Skip to content

Commit

Permalink
Add Vested Delegated API endpoint (Kava-Labs#1327)
Browse files Browse the repository at this point in the history
* add empty grpc endpoint

* add basic implementation

* remove unbonding from returned balance

* fix test typo

* resolve todo, use better method from staking mod
  • Loading branch information
rhuairahrighairidh authored Oct 5, 2022
1 parent 55284aa commit a39c413
Show file tree
Hide file tree
Showing 13 changed files with 1,367 additions and 9 deletions.
17 changes: 17 additions & 0 deletions client/docs/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,23 @@
]
}
},
{
"url": "./tmp-swagger-gen/kava/liquid/v1beta1/query.swagger.json",
"tags": {
"rename": {
"Query": "Liquid"
}
},
"operationIds": {
"rename": [
{
"type": "regex",
"from": "(.*)",
"to": "Liquid$1"
}
]
}
},
{
"url": "./tmp-swagger-gen/kava/pricefeed/v1beta1/query.swagger.json",
"tags": {
Expand Down
155 changes: 155 additions & 0 deletions client/docs/swagger-ui/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10827,6 +10827,9 @@ paths:
format: byte
weight:
type: string
description: >-
CoreReward defines the reward weights for core
infrastructure providers.
partner_rewards:
type: array
items:
Expand All @@ -10851,6 +10854,12 @@ paths:
implements the custom method

signatures required by gogoproto.
description: >-
PartnerRewards defines the reward schedule for
partner infrastructure providers.
description: >-
InfrastructureParams define the parameters for
infrastructure rewards.
title: Params governance parameters for kavadist module
description: >-
QueryParamsResponse defines the response type for querying
Expand Down Expand Up @@ -10879,6 +10888,89 @@ paths:
format: byte
tags:
- Kavadist
/kava/liquid/v1beta1/delegated_balance/{delegator}:
get:
summary: >-
DelegatedBalance returns an account's vesting and vested coins currently
delegated to validators.

It ignores coins in unbonding delegations.
operationId: LiquidDelegatedBalance
responses:
'200':
description: A successful response.
schema:
type: object
properties:
vested:
title: >-
vested is the amount of all delegated coins that have vested
(ie not locked)
type: object
properties:
denom:
type: string
amount:
type: string
description: >-
Coin defines a token with a denomination and an amount.


NOTE: The amount field is an Int which implements the custom
method

signatures required by gogoproto.
vesting:
title: >-
vesting is the amount of all delegated coins that are still
vesting (ie locked)
type: object
properties:
denom:
type: string
amount:
type: string
description: >-
Coin defines a token with a denomination and an amount.


NOTE: The amount field is an Int which implements the custom
method

signatures required by gogoproto.
description: >-
DelegatedBalanceResponse defines the response type for the
Query/DelegatedBalance method.
default:
description: An unexpected error response
schema:
type: object
properties:
error:
type: string
code:
type: integer
format: int32
message:
type: string
details:
type: array
items:
type: object
properties:
type_url:
type: string
value:
type: string
format: byte
parameters:
- name: delegator
description: delegator is the address of the account to query
in: path
required: true
type: string
tags:
- Liquid
/kava/pricefeed/v1beta1/markets:
get:
summary: Markets queries all markets
Expand Down Expand Up @@ -55908,6 +56000,7 @@ definitions:
format: byte
weight:
type: string
description: CoreReward defines the reward weights for core infrastructure providers.
kava.kavadist.v1beta1.InfrastructureParams:
type: object
properties:
Expand Down Expand Up @@ -55944,6 +56037,9 @@ definitions:
format: byte
weight:
type: string
description: >-
CoreReward defines the reward weights for core infrastructure
providers.
partner_rewards:
type: array
items:
Expand All @@ -55967,6 +56063,10 @@ definitions:
method

signatures required by gogoproto.
description: >-
PartnerRewards defines the reward schedule for partner
infrastructure providers.
description: InfrastructureParams define the parameters for infrastructure rewards.
kava.kavadist.v1beta1.Params:
type: object
properties:
Expand Down Expand Up @@ -56032,6 +56132,9 @@ definitions:
format: byte
weight:
type: string
description: >-
CoreReward defines the reward weights for core infrastructure
providers.
partner_rewards:
type: array
items:
Expand All @@ -56055,6 +56158,10 @@ definitions:
method

signatures required by gogoproto.
description: >-
PartnerRewards defines the reward schedule for partner
infrastructure providers.
description: InfrastructureParams define the parameters for infrastructure rewards.
title: Params governance parameters for kavadist module
kava.kavadist.v1beta1.PartnerReward:
type: object
Expand All @@ -56074,6 +56181,9 @@ definitions:

NOTE: The amount field is an Int which implements the custom method
signatures required by gogoproto.
description: >-
PartnerRewards defines the reward schedule for partner infrastructure
providers.
kava.kavadist.v1beta1.Period:
type: object
properties:
Expand Down Expand Up @@ -56183,6 +56293,9 @@ definitions:
format: byte
weight:
type: string
description: >-
CoreReward defines the reward weights for core
infrastructure providers.
partner_rewards:
type: array
items:
Expand All @@ -56206,10 +56319,52 @@ definitions:
custom method

signatures required by gogoproto.
description: >-
PartnerRewards defines the reward schedule for partner
infrastructure providers.
description: >-
InfrastructureParams define the parameters for infrastructure
rewards.
title: Params governance parameters for kavadist module
description: >-
QueryParamsResponse defines the response type for querying x/kavadist
parameters.
kava.liquid.v1beta1.QueryDelegatedBalanceResponse:
type: object
properties:
vested:
title: >-
vested is the amount of all delegated coins that have vested (ie not
locked)
type: object
properties:
denom:
type: string
amount:
type: string
description: |-
Coin defines a token with a denomination and an amount.

NOTE: The amount field is an Int which implements the custom method
signatures required by gogoproto.
vesting:
title: >-
vesting is the amount of all delegated coins that are still vesting
(ie locked)
type: object
properties:
denom:
type: string
amount:
type: string
description: |-
Coin defines a token with a denomination and an amount.

NOTE: The amount field is an Int which implements the custom method
signatures required by gogoproto.
description: >-
DelegatedBalanceResponse defines the response type for the
Query/DelegatedBalance method.
kava.pricefeed.v1beta1.CurrentPriceResponse:
type: object
properties:
Expand Down
69 changes: 66 additions & 3 deletions docs/core/proto-docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,12 @@

- [Query](#kava.kavadist.v1beta1.Query)

- [kava/liquid/v1beta1/query.proto](#kava/liquid/v1beta1/query.proto)
- [QueryDelegatedBalanceRequest](#kava.liquid.v1beta1.QueryDelegatedBalanceRequest)
- [QueryDelegatedBalanceResponse](#kava.liquid.v1beta1.QueryDelegatedBalanceResponse)

- [Query](#kava.liquid.v1beta1.Query)

- [kava/liquid/v1beta1/tx.proto](#kava/liquid/v1beta1/tx.proto)
- [MsgBurnDerivative](#kava.liquid.v1beta1.MsgBurnDerivative)
- [MsgBurnDerivativeResponse](#kava.liquid.v1beta1.MsgBurnDerivativeResponse)
Expand Down Expand Up @@ -5332,7 +5338,7 @@ Msg defines the issuance Msg service.
<a name="kava.kavadist.v1beta1.CoreReward"></a>

### CoreReward

CoreReward defines the reward weights for core infrastructure providers.


| Field | Type | Label | Description |
Expand All @@ -5348,7 +5354,7 @@ Msg defines the issuance Msg service.
<a name="kava.kavadist.v1beta1.InfrastructureParams"></a>

### InfrastructureParams

InfrastructureParams define the parameters for infrastructure rewards.


| Field | Type | Label | Description |
Expand Down Expand Up @@ -5382,7 +5388,7 @@ Params governance parameters for kavadist module
<a name="kava.kavadist.v1beta1.PartnerReward"></a>

### PartnerReward

PartnerRewards defines the reward schedule for partner infrastructure providers.


| Field | Type | Label | Description |
Expand Down Expand Up @@ -5599,6 +5605,63 @@ Query defines the gRPC querier service.



<a name="kava/liquid/v1beta1/query.proto"></a>
<p align="right"><a href="#top">Top</a></p>

## kava/liquid/v1beta1/query.proto



<a name="kava.liquid.v1beta1.QueryDelegatedBalanceRequest"></a>

### QueryDelegatedBalanceRequest
QueryDelegatedBalanceRequest defines the request type for Query/DelegatedBalance method.


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `delegator` | [string](#string) | | delegator is the address of the account to query |






<a name="kava.liquid.v1beta1.QueryDelegatedBalanceResponse"></a>

### QueryDelegatedBalanceResponse
DelegatedBalanceResponse defines the response type for the Query/DelegatedBalance method.


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `vested` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | vested is the amount of all delegated coins that have vested (ie not locked) |
| `vesting` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | vesting is the amount of all delegated coins that are still vesting (ie locked) |





<!-- end messages -->

<!-- end enums -->

<!-- end HasExtensions -->


<a name="kava.liquid.v1beta1.Query"></a>

### Query
Query defines the gRPC querier service for liquid module

| Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint |
| ----------- | ------------ | ------------- | ------------| ------- | -------- |
| `DelegatedBalance` | [QueryDelegatedBalanceRequest](#kava.liquid.v1beta1.QueryDelegatedBalanceRequest) | [QueryDelegatedBalanceResponse](#kava.liquid.v1beta1.QueryDelegatedBalanceResponse) | DelegatedBalance returns an account's vesting and vested coins currently delegated to validators. It ignores coins in unbonding delegations. | GET|/kava/liquid/v1beta1/delegated_balance/{delegator}|

<!-- end services -->



<a name="kava/liquid/v1beta1/tx.proto"></a>
<p align="right"><a href="#top">Top</a></p>

Expand Down
3 changes: 3 additions & 0 deletions proto/kava/kavadist/v1beta1/params.proto
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ message Params {
InfrastructureParams infrastructure_params = 4 [(gogoproto.nullable) = false];
}

// InfrastructureParams define the parameters for infrastructure rewards.
message InfrastructureParams {
repeated Period infrastructure_periods = 1 [(gogoproto.castrepeated) = "Periods", (gogoproto.nullable) = false];
repeated CoreReward core_rewards = 2 [(gogoproto.castrepeated) = "CoreRewards", (gogoproto.nullable) = false];
Expand All @@ -26,6 +27,7 @@ message InfrastructureParams {
option (gogoproto.goproto_stringer) = true;
}

// CoreReward defines the reward weights for core infrastructure providers.
message CoreReward {
bytes address = 1 [
(cosmos_proto.scalar) = "cosmos.AddressBytes",
Expand All @@ -39,6 +41,7 @@ message CoreReward {
option (gogoproto.goproto_stringer) = true;
}

// PartnerRewards defines the reward schedule for partner infrastructure providers.
message PartnerReward {
bytes address = 1 [
(cosmos_proto.scalar) = "cosmos.AddressBytes",
Expand Down
Loading

0 comments on commit a39c413

Please sign in to comment.