github.com/fibonacci-chain/fbc@v0.0.0-20231124064014-c7636198c1e9/x/staking/types/querier.go (about) 1 package types 2 3 import ( 4 sdk "github.com/fibonacci-chain/fbc/libs/cosmos-sdk/types" 5 "github.com/fibonacci-chain/fbc/libs/cosmos-sdk/types/query" 6 ) 7 8 // query endpoints supported by the staking Querier 9 const ( 10 QueryValidators = "validators" 11 QueryValidator = "validator" 12 QueryUnbondingDelegation = "unbondingDelegation" 13 QueryPool = "pool" 14 QueryParameters = "parameters" 15 QueryParams4IBC = "params4ibc" 16 QueryAddress = "address" 17 QueryForAddress = "validatorAddress" 18 QueryForAccAddress = "validatorAccAddress" 19 QueryProxy = "proxy" 20 QueryValidatorAllShares = "validatorAllShares" 21 QueryDelegator = "delegator" 22 QueryDelegatorDelegations = "delegatorDelegations" 23 QueryUnbondingDelegation2 = "unbondingDelegation2" 24 QueryHistoricalInfo = "historicalInfo" 25 QueryDelegatorValidators = "delegatorValidators" 26 QueryDelegatorValidator = "delegatorValidator" 27 QueryValidatorDelegations = "validatorDelegations" 28 QueryValidatorDelegator = "validatorDelegator" 29 ) 30 31 // QueryDelegatorParams defines the params for the following queries: 32 // - 'custom/staking/delegatorDelegations' 33 // - 'custom/staking/delegatorUnbondingDelegations' 34 // - 'custom/staking/delegatorValidators' 35 type QueryDelegatorParams struct { 36 DelegatorAddr sdk.AccAddress 37 } 38 39 // NewQueryDelegatorParams creates a new instance of QueryDelegatorParams 40 func NewQueryDelegatorParams(delegatorAddr sdk.AccAddress) QueryDelegatorParams { 41 return QueryDelegatorParams{ 42 DelegatorAddr: delegatorAddr, 43 } 44 } 45 46 // QueryValidatorParams defines the params for the following queries: 47 // - 'custom/staking/validator' 48 // - 'custom/staking/validatorDelegations' 49 // - 'custom/staking/validatorUnbondingDelegations' 50 // - 'custom/staking/validatorRedelegations' 51 type QueryValidatorParams struct { 52 ValidatorAddr sdk.ValAddress 53 } 54 55 // NewQueryValidatorParams creates a new instance of QueryValidatorParams 56 func NewQueryValidatorParams(validatorAddr sdk.ValAddress) QueryValidatorParams { 57 return QueryValidatorParams{ 58 ValidatorAddr: validatorAddr, 59 } 60 } 61 62 // QueryBondsParams defines the params for the following queries: 63 // - 'custom/staking/delegation' 64 // - 'custom/staking/unbondingDelegation' 65 // - 'custom/staking/delegatorValidator' 66 type QueryBondsParams struct { 67 DelegatorAddr sdk.AccAddress 68 ValidatorAddr sdk.ValAddress 69 } 70 71 // NewQueryBondsParams creates a new instance of QueryBondsParams 72 func NewQueryBondsParams(delegatorAddr sdk.AccAddress, validatorAddr sdk.ValAddress) QueryBondsParams { 73 return QueryBondsParams{ 74 DelegatorAddr: delegatorAddr, 75 ValidatorAddr: validatorAddr, 76 } 77 } 78 79 // QueryValidatorsParams defines the params for the following queries: 80 // - 'custom/staking/validators' 81 type QueryValidatorsParams struct { 82 Page, Limit int 83 Status string 84 } 85 86 // NewQueryValidatorsParams creates a new instance of QueryValidatorsParams 87 func NewQueryValidatorsParams(page, limit int, status string) QueryValidatorsParams { 88 return QueryValidatorsParams{page, limit, status} 89 } 90 91 type QueryDelegatorDelegationsRequest struct { 92 // delegator_addr defines the delegator address to query for. 93 DelegatorAddr string `protobuf:"bytes,1,opt,name=delegator_addr,json=delegatorAddr,proto3" json:"delegator_addr,omitempty"` 94 // pagination defines an optional pagination for the request. 95 Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` 96 } 97 98 type QueryDelegatorUnbondingDelegationsRequest struct { 99 // delegator_addr defines the delegator address to query for. 100 DelegatorAddr string `protobuf:"bytes,1,opt,name=delegator_addr,json=delegatorAddr,proto3" json:"delegator_addr,omitempty"` 101 // pagination defines an optional pagination for the request. 102 Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` 103 } 104 105 type QueryUnbondingDelegationRequest struct { 106 // delegator_addr defines the delegator address to query for. 107 DelegatorAddr string `protobuf:"bytes,1,opt,name=delegator_addr,json=delegatorAddr,proto3" json:"delegator_addr,omitempty"` 108 // validator_addr defines the validator address to query for. 109 ValidatorAddr string `protobuf:"bytes,2,opt,name=validator_addr,json=validatorAddr,proto3" json:"validator_addr,omitempty"` 110 } 111 112 // QueryHistoricalInfoParams defines the params for the following queries: 113 // - 'custom/staking/historicalInfo' 114 type QueryHistoricalInfoParams struct { 115 Height int64 116 } 117 118 // NewQueryHistoricalInfoParams creates a new QueryHistoricalInfoParams instance 119 func NewQueryHistoricalInfoParams(height int64) QueryHistoricalInfoParams { 120 return QueryHistoricalInfoParams{height} 121 }