Skip to content

Commit

Permalink
Merge pull request #323 from terra-money/feat/v0.3.x/backports
Browse files Browse the repository at this point in the history
feat(v0.3.x): backport features from v0.4.x
  • Loading branch information
emidev98 authored Mar 6, 2024
2 parents a227ea2 + 1ec7992 commit c0e35d6
Show file tree
Hide file tree
Showing 13 changed files with 1,814 additions and 649 deletions.
89 changes: 79 additions & 10 deletions docs/proto/proto-docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,14 @@
- [QueryAllianceDelegationResponse](#alliance.alliance.QueryAllianceDelegationResponse)
- [QueryAllianceDelegationRewardsRequest](#alliance.alliance.QueryAllianceDelegationRewardsRequest)
- [QueryAllianceDelegationRewardsResponse](#alliance.alliance.QueryAllianceDelegationRewardsResponse)
- [QueryAllianceRedelegationsByDelegatorRequest](#alliance.alliance.QueryAllianceRedelegationsByDelegatorRequest)
- [QueryAllianceRedelegationsByDelegatorResponse](#alliance.alliance.QueryAllianceRedelegationsByDelegatorResponse)
- [QueryAllianceRedelegationsRequest](#alliance.alliance.QueryAllianceRedelegationsRequest)
- [QueryAllianceRedelegationsResponse](#alliance.alliance.QueryAllianceRedelegationsResponse)
- [QueryAllianceRequest](#alliance.alliance.QueryAllianceRequest)
- [QueryAllianceResponse](#alliance.alliance.QueryAllianceResponse)
- [QueryAllianceUnbondingsByDelegatorRequest](#alliance.alliance.QueryAllianceUnbondingsByDelegatorRequest)
- [QueryAllianceUnbondingsByDelegatorResponse](#alliance.alliance.QueryAllianceUnbondingsByDelegatorResponse)
- [QueryAllianceUnbondingsByDenomAndDelegatorRequest](#alliance.alliance.QueryAllianceUnbondingsByDenomAndDelegatorRequest)
- [QueryAllianceUnbondingsByDenomAndDelegatorResponse](#alliance.alliance.QueryAllianceUnbondingsByDenomAndDelegatorResponse)
- [QueryAllianceUnbondingsRequest](#alliance.alliance.QueryAllianceUnbondingsRequest)
Expand Down Expand Up @@ -136,6 +140,7 @@
| ----- | ---- | ----- | ----------- |
| `denom` | [string](#string) | | |
| `index` | [string](#string) | | |
| `alliance` | [string](#string) | | |



Expand Down Expand Up @@ -678,6 +683,7 @@ UnbondingDelegation defines an unbonding object with relevant metadata.
| `completion_time` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | completion_time is the unix time for unbonding completion. |
| `validator_address` | [string](#string) | | validator_address is the bech32-encoded address of the validator. |
| `amount` | [string](#string) | | amount defines the tokens to receive at completion. |
| `denom` | [string](#string) | | alliance denom of the unbonding delegation |



Expand Down Expand Up @@ -813,6 +819,38 @@ AllianceDelegation



<a name="alliance.alliance.QueryAllianceRedelegationsByDelegatorRequest"></a>

### QueryAllianceRedelegationsByDelegatorRequest



| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `delegator_addr` | [string](#string) | | |
| `pagination` | [cosmos.base.query.v1beta1.PageRequest](#cosmos.base.query.v1beta1.PageRequest) | | |






<a name="alliance.alliance.QueryAllianceRedelegationsByDelegatorResponse"></a>

### QueryAllianceRedelegationsByDelegatorResponse



| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `redelegations` | [RedelegationEntry](#alliance.alliance.RedelegationEntry) | repeated | |
| `pagination` | [cosmos.base.query.v1beta1.PageResponse](#cosmos.base.query.v1beta1.PageResponse) | | |






<a name="alliance.alliance.QueryAllianceRedelegationsRequest"></a>

### QueryAllianceRedelegationsRequest
Expand Down Expand Up @@ -876,6 +914,37 @@ Alliance



<a name="alliance.alliance.QueryAllianceUnbondingsByDelegatorRequest"></a>

### QueryAllianceUnbondingsByDelegatorRequest
AllianceDelegation


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `delegator_addr` | [string](#string) | | |
| `pagination` | [cosmos.base.query.v1beta1.PageRequest](#cosmos.base.query.v1beta1.PageRequest) | | |






<a name="alliance.alliance.QueryAllianceUnbondingsByDelegatorResponse"></a>

### QueryAllianceUnbondingsByDelegatorResponse



| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `unbondings` | [UnbondingDelegation](#alliance.alliance.UnbondingDelegation) | repeated | |






<a name="alliance.alliance.QueryAllianceUnbondingsByDenomAndDelegatorRequest"></a>

### QueryAllianceUnbondingsByDenomAndDelegatorRequest
Expand Down Expand Up @@ -1161,21 +1230,21 @@ Params

| Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint |
| ----------- | ------------ | ------------- | ------------| ------- | -------- |
| `Params` | [QueryParamsRequest](#alliance.alliance.QueryParamsRequest) | [QueryParamsResponse](#alliance.alliance.QueryParamsResponse) | | GET|/terra/alliances/params|
| `Alliances` | [QueryAlliancesRequest](#alliance.alliance.QueryAlliancesRequest) | [QueryAlliancesResponse](#alliance.alliance.QueryAlliancesResponse) | Query paginated alliances | GET|/terra/alliances|
| `IBCAlliance` | [QueryIBCAllianceRequest](#alliance.alliance.QueryIBCAllianceRequest) | [QueryAllianceResponse](#alliance.alliance.QueryAllianceResponse) | Query a specific alliance by ibc hash @deprecated: this endpoint will be replaced for by the encoded version of the denom e.g.: GET:/terra/alliances/ibc%2Falliance | GET|/terra/alliances/ibc/{hash}|
| `AllAlliancesDelegations` | [QueryAllAlliancesDelegationsRequest](#alliance.alliance.QueryAllAlliancesDelegationsRequest) | [QueryAlliancesDelegationsResponse](#alliance.alliance.QueryAlliancesDelegationsResponse) | Query all paginated alliance delegations | GET|/terra/alliances/delegations|
| `Params` | [QueryParamsRequest](#alliance.alliance.QueryParamsRequest) | [QueryParamsResponse](#alliance.alliance.QueryParamsResponse) | Query Alliance module parameters more info about the params https://docs.alliance.money/tech/parameters | GET|/terra/alliances/params|
| `Alliances` | [QueryAlliancesRequest](#alliance.alliance.QueryAlliancesRequest) | [QueryAlliancesResponse](#alliance.alliance.QueryAlliancesResponse) | Query all alliances with pagination | GET|/terra/alliances|
| `AllAlliancesDelegations` | [QueryAllAlliancesDelegationsRequest](#alliance.alliance.QueryAllAlliancesDelegationsRequest) | [QueryAlliancesDelegationsResponse](#alliance.alliance.QueryAlliancesDelegationsResponse) | Query all alliances delegations with pagination | GET|/terra/alliances/delegations|
| `AllianceValidator` | [QueryAllianceValidatorRequest](#alliance.alliance.QueryAllianceValidatorRequest) | [QueryAllianceValidatorResponse](#alliance.alliance.QueryAllianceValidatorResponse) | Query alliance validator | GET|/terra/alliances/validators/{validator_addr}|
| `AllAllianceValidators` | [QueryAllAllianceValidatorsRequest](#alliance.alliance.QueryAllAllianceValidatorsRequest) | [QueryAllianceValidatorsResponse](#alliance.alliance.QueryAllianceValidatorsResponse) | Query all paginated alliance validators | GET|/terra/alliances/validators|
| `AlliancesDelegation` | [QueryAlliancesDelegationsRequest](#alliance.alliance.QueryAlliancesDelegationsRequest) | [QueryAlliancesDelegationsResponse](#alliance.alliance.QueryAlliancesDelegationsResponse) | Query all paginated alliance delegations for a delegator addr | GET|/terra/alliances/delegations/{delegator_addr}|
| `AlliancesDelegationByValidator` | [QueryAlliancesDelegationByValidatorRequest](#alliance.alliance.QueryAlliancesDelegationByValidatorRequest) | [QueryAlliancesDelegationsResponse](#alliance.alliance.QueryAlliancesDelegationsResponse) | Query all paginated alliance delegations for a delegator addr and validator_addr | GET|/terra/alliances/delegations/{delegator_addr}/{validator_addr}|
| `AllianceDelegation` | [QueryAllianceDelegationRequest](#alliance.alliance.QueryAllianceDelegationRequest) | [QueryAllianceDelegationResponse](#alliance.alliance.QueryAllianceDelegationResponse) | Query a delegation to an alliance by delegator addr, validator_addr and denom | GET|/terra/alliances/delegations/{delegator_addr}/{validator_addr}/{denom}|
| `IBCAllianceDelegation` | [QueryIBCAllianceDelegationRequest](#alliance.alliance.QueryIBCAllianceDelegationRequest) | [QueryAllianceDelegationResponse](#alliance.alliance.QueryAllianceDelegationResponse) | Query a delegation to an alliance by delegator addr, validator_addr and denom @deprecated: this endpoint will be replaced for by the encoded version of the denom e.g.: GET:/terra/alliances/terradr1231/terravaloper41234/ibc%2Falliance | GET|/terra/alliances/delegations/{delegator_addr}/{validator_addr}/ibc/{hash}|
| `AllianceDelegationRewards` | [QueryAllianceDelegationRewardsRequest](#alliance.alliance.QueryAllianceDelegationRewardsRequest) | [QueryAllianceDelegationRewardsResponse](#alliance.alliance.QueryAllianceDelegationRewardsResponse) | Query for rewards by delegator addr, validator_addr and denom | GET|/terra/alliances/rewards/{delegator_addr}/{validator_addr}/{denom}|
| `AllianceDelegation` | [QueryAllianceDelegationRequest](#alliance.alliance.QueryAllianceDelegationRequest) | [QueryAllianceDelegationResponse](#alliance.alliance.QueryAllianceDelegationResponse) | Query a specific delegation by delegator addr, validator addr and denom | GET|/terra/alliances/delegations/{delegator_addr}/{validator_addr}/{denom}|
| `AllianceDelegationRewards` | [QueryAllianceDelegationRewardsRequest](#alliance.alliance.QueryAllianceDelegationRewardsRequest) | [QueryAllianceDelegationRewardsResponse](#alliance.alliance.QueryAllianceDelegationRewardsResponse) | Query a specific delegation rewards by delegator addr, validator addr and denom | GET|/terra/alliances/rewards/{delegator_addr}/{validator_addr}/{denom}|
| `IBCAllianceDelegationRewards` | [QueryIBCAllianceDelegationRewardsRequest](#alliance.alliance.QueryIBCAllianceDelegationRewardsRequest) | [QueryAllianceDelegationRewardsResponse](#alliance.alliance.QueryAllianceDelegationRewardsResponse) | Query for rewards by delegator addr, validator_addr and denom @deprecated: this endpoint will be replaced for by the encoded version of the denom e.g.: GET:/terra/alliances/terradr1231/terravaloper41234/ibc%2Falliance | GET|/terra/alliances/rewards/{delegator_addr}/{validator_addr}/ibc/{hash}|
| `AllianceUnbondingsByDenomAndDelegator` | [QueryAllianceUnbondingsByDenomAndDelegatorRequest](#alliance.alliance.QueryAllianceUnbondingsByDenomAndDelegatorRequest) | [QueryAllianceUnbondingsByDenomAndDelegatorResponse](#alliance.alliance.QueryAllianceUnbondingsByDenomAndDelegatorResponse) | Query for rewards by delegator addr, validator_addr and denom | GET|/terra/alliances/unbondings/{denom}/{delegator_addr}|
| `AllianceUnbondings` | [QueryAllianceUnbondingsRequest](#alliance.alliance.QueryAllianceUnbondingsRequest) | [QueryAllianceUnbondingsResponse](#alliance.alliance.QueryAllianceUnbondingsResponse) | Query for rewards by delegator addr, validator_addr and denom | GET|/terra/alliances/unbondings/{denom}/{delegator_addr}/{validator_addr}|
| `AllianceRedelegations` | [QueryAllianceRedelegationsRequest](#alliance.alliance.QueryAllianceRedelegationsRequest) | [QueryAllianceRedelegationsResponse](#alliance.alliance.QueryAllianceRedelegationsResponse) | Query redelegations by denom and delegator address | GET|/terra/alliances/redelegations/{denom}/{delegator_addr}|
| `AllianceUnbondingsByDelegator` | [QueryAllianceUnbondingsByDelegatorRequest](#alliance.alliance.QueryAllianceUnbondingsByDelegatorRequest) | [QueryAllianceUnbondingsByDelegatorResponse](#alliance.alliance.QueryAllianceUnbondingsByDelegatorResponse) | Query unbondings by delegator address | GET|/terra/alliances/unbondings/{delegator_addr}|
| `AllianceUnbondingsByDenomAndDelegator` | [QueryAllianceUnbondingsByDenomAndDelegatorRequest](#alliance.alliance.QueryAllianceUnbondingsByDenomAndDelegatorRequest) | [QueryAllianceUnbondingsByDenomAndDelegatorResponse](#alliance.alliance.QueryAllianceUnbondingsByDenomAndDelegatorResponse) | Query unbondings by denom, delegator addr | GET|/terra/alliances/unbondings/{denom}/{delegator_addr}|
| `AllianceUnbondings` | [QueryAllianceUnbondingsRequest](#alliance.alliance.QueryAllianceUnbondingsRequest) | [QueryAllianceUnbondingsResponse](#alliance.alliance.QueryAllianceUnbondingsResponse) | Query unbondings by denom, delegator addr, validator addr | GET|/terra/alliances/unbondings/{denom}/{delegator_addr}/{validator_addr}|
| `AllianceRedelegationsByDelegator` | [QueryAllianceRedelegationsByDelegatorRequest](#alliance.alliance.QueryAllianceRedelegationsByDelegatorRequest) | [QueryAllianceRedelegationsByDelegatorResponse](#alliance.alliance.QueryAllianceRedelegationsByDelegatorResponse) | Query paginated redelegations delegator addr | GET|/terra/alliances/redelegations/{delegator_addr}|
| `AllianceRedelegations` | [QueryAllianceRedelegationsRequest](#alliance.alliance.QueryAllianceRedelegationsRequest) | [QueryAllianceRedelegationsResponse](#alliance.alliance.QueryAllianceRedelegationsResponse) | Query paginated redelegations by denom and delegator addr | GET|/terra/alliances/redelegations/{denom}/{delegator_addr}|
| `Alliance` | [QueryAllianceRequest](#alliance.alliance.QueryAllianceRequest) | [QueryAllianceResponse](#alliance.alliance.QueryAllianceResponse) | Query a specific alliance by denom | GET|/terra/alliances/{denom}|

<!-- end services -->
Expand Down
81 changes: 54 additions & 27 deletions proto/alliance/alliance/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,19 @@ import "alliance/alliance/redelegations.proto";
option go_package = "github.com/terra-money/alliance/x/alliance/types";

service Query {

// Query Alliance module parameters more info about the params
// https://docs.alliance.money/tech/parameters
rpc Params(QueryParamsRequest) returns (QueryParamsResponse) {
option (google.api.http).get = "/terra/alliances/params";
}

// Query paginated alliances
// Query all alliances with pagination
rpc Alliances(QueryAlliancesRequest) returns (QueryAlliancesResponse) {
option (google.api.http).get = "/terra/alliances";
}

// Query a specific alliance by ibc hash
// @deprecated: this endpoint will be replaced for by the encoded version
// of the denom e.g.: GET:/terra/alliances/ibc%2Falliance
rpc IBCAlliance(QueryIBCAllianceRequest) returns (QueryAllianceResponse) {
// Deprecated. Please use the default endpoint
// with the encoded denom e.g from ibc/alliance to ibc%2Falliance
option deprecated = true;
option (google.api.http).get = "/terra/alliances/ibc/{hash}";
}

// Query all paginated alliance delegations
// Query all alliances delegations with pagination
rpc AllAlliancesDelegations(QueryAllAlliancesDelegationsRequest) returns (QueryAlliancesDelegationsResponse) {
option (google.api.http).get = "/terra/alliances/delegations";
}
Expand All @@ -58,22 +51,12 @@ service Query {
option (google.api.http).get = "/terra/alliances/delegations/{delegator_addr}/{validator_addr}";
}

// Query a delegation to an alliance by delegator addr, validator_addr and denom
// Query a specific delegation by delegator addr, validator addr and denom
rpc AllianceDelegation(QueryAllianceDelegationRequest) returns (QueryAllianceDelegationResponse) {
option (google.api.http).get = "/terra/alliances/delegations/{delegator_addr}/{validator_addr}/{denom}";
}

// Query a delegation to an alliance by delegator addr, validator_addr and denom
// @deprecated: this endpoint will be replaced for by the encoded version
// of the denom e.g.: GET:/terra/alliances/terradr1231/terravaloper41234/ibc%2Falliance
rpc IBCAllianceDelegation(QueryIBCAllianceDelegationRequest) returns (QueryAllianceDelegationResponse) {
// Deprecated. Please use the default endpoint
// with the encoded denom e.g from ibc/alliance to ibc%2Falliance
option deprecated = true;
option (google.api.http).get = "/terra/alliances/delegations/{delegator_addr}/{validator_addr}/ibc/{hash}";
}

// Query for rewards by delegator addr, validator_addr and denom
// Query a specific delegation rewards by delegator addr, validator addr and denom
rpc AllianceDelegationRewards(QueryAllianceDelegationRewardsRequest) returns (QueryAllianceDelegationRewardsResponse) {
option (google.api.http).get = "/terra/alliances/rewards/{delegator_addr}/{validator_addr}/{denom}";
}
Expand All @@ -87,17 +70,27 @@ service Query {
option (google.api.http).get = "/terra/alliances/rewards/{delegator_addr}/{validator_addr}/ibc/{hash}";
}

// Query for rewards by delegator addr, validator_addr and denom
// Query unbondings by delegator address
rpc AllianceUnbondingsByDelegator(QueryAllianceUnbondingsByDelegatorRequest) returns (QueryAllianceUnbondingsByDelegatorResponse) {
option (google.api.http).get = "/terra/alliances/unbondings/{delegator_addr}";
}

// Query unbondings by denom, delegator addr
rpc AllianceUnbondingsByDenomAndDelegator(QueryAllianceUnbondingsByDenomAndDelegatorRequest) returns (QueryAllianceUnbondingsByDenomAndDelegatorResponse) {
option (google.api.http).get = "/terra/alliances/unbondings/{denom}/{delegator_addr}";
}

// Query for rewards by delegator addr, validator_addr and denom
// Query unbondings by denom, delegator addr, validator addr
rpc AllianceUnbondings(QueryAllianceUnbondingsRequest) returns (QueryAllianceUnbondingsResponse) {
option (google.api.http).get = "/terra/alliances/unbondings/{denom}/{delegator_addr}/{validator_addr}";
}

// Query redelegations by denom and delegator address
// Query paginated redelegations delegator addr
rpc AllianceRedelegationsByDelegator(QueryAllianceRedelegationsByDelegatorRequest) returns (QueryAllianceRedelegationsByDelegatorResponse) {
option (google.api.http).get = "/terra/alliances/redelegations/{delegator_addr}";
}

// Query paginated redelegations by denom and delegator addr
rpc AllianceRedelegations(QueryAllianceRedelegationsRequest) returns (QueryAllianceRedelegationsResponse) {
option (google.api.http).get = "/terra/alliances/redelegations/{denom}/{delegator_addr}";
}
Expand Down Expand Up @@ -284,6 +277,23 @@ message QueryAllianceValidatorsResponse {
cosmos.base.query.v1beta1.PageResponse pagination = 2;
}

// AllianceDelegation
message QueryAllianceUnbondingsByDelegatorRequest {
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;

string delegator_addr = 1;
cosmos.base.query.v1beta1.PageRequest pagination = 3;
}

message QueryAllianceUnbondingsByDelegatorResponse {
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;

repeated UnbondingDelegation unbondings = 1 [(gogoproto.nullable) = false];
}


// AllianceDelegation
message QueryAllianceUnbondingsByDenomAndDelegatorRequest {
option (gogoproto.equal) = false;
Expand Down Expand Up @@ -334,6 +344,23 @@ message QueryAllianceRedelegationsResponse {
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;

repeated RedelegationEntry redelegations = 1 [(gogoproto.nullable) = false];
cosmos.base.query.v1beta1.PageResponse pagination = 2;
}


message QueryAllianceRedelegationsByDelegatorRequest {
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;

string delegator_addr = 1;
cosmos.base.query.v1beta1.PageRequest pagination = 2;
}

message QueryAllianceRedelegationsByDelegatorResponse {
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;

repeated RedelegationEntry redelegations = 1 [(gogoproto.nullable) = false];
cosmos.base.query.v1beta1.PageResponse pagination = 2;
}
2 changes: 2 additions & 0 deletions proto/alliance/alliance/unbonding.proto
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,6 @@ message UnbondingDelegation {
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.nullable) = false
];
// alliance denom of the unbonding delegation
string denom = 4;
}
Loading

0 comments on commit c0e35d6

Please sign in to comment.