-
Notifications
You must be signed in to change notification settings - Fork 3.6k
/
querier.go
98 lines (85 loc) · 3.05 KB
/
querier.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
package types
import (
sdk "github.com/cosmos/cosmos-sdk/types"
)
// query endpoints supported by the staking Querier
const (
QueryValidators = "validators"
QueryValidator = "validator"
QueryDelegatorDelegations = "delegatorDelegations"
QueryDelegatorUnbondingDelegations = "delegatorUnbondingDelegations"
QueryRedelegations = "redelegations"
QueryValidatorDelegations = "validatorDelegations"
QueryValidatorRedelegations = "validatorRedelegations"
QueryValidatorUnbondingDelegations = "validatorUnbondingDelegations"
QueryDelegation = "delegation"
QueryUnbondingDelegation = "unbondingDelegation"
QueryDelegatorValidators = "delegatorValidators"
QueryDelegatorValidator = "delegatorValidator"
QueryPool = "pool"
QueryParameters = "parameters"
)
// defines the params for the following queries:
// - 'custom/staking/delegatorDelegations'
// - 'custom/staking/delegatorUnbondingDelegations'
// - 'custom/staking/delegatorRedelegations'
// - 'custom/staking/delegatorValidators'
type QueryDelegatorParams struct {
DelegatorAddr sdk.AccAddress
}
func NewQueryDelegatorParams(delegatorAddr sdk.AccAddress) QueryDelegatorParams {
return QueryDelegatorParams{
DelegatorAddr: delegatorAddr,
}
}
// defines the params for the following queries:
// - 'custom/staking/validator'
// - 'custom/staking/validatorDelegations'
// - 'custom/staking/validatorUnbondingDelegations'
// - 'custom/staking/validatorRedelegations'
type QueryValidatorParams struct {
ValidatorAddr sdk.ValAddress
}
func NewQueryValidatorParams(validatorAddr sdk.ValAddress) QueryValidatorParams {
return QueryValidatorParams{
ValidatorAddr: validatorAddr,
}
}
// defines the params for the following queries:
// - 'custom/staking/delegation'
// - 'custom/staking/unbondingDelegation'
// - 'custom/staking/delegatorValidator'
type QueryBondsParams struct {
DelegatorAddr sdk.AccAddress
ValidatorAddr sdk.ValAddress
}
func NewQueryBondsParams(delegatorAddr sdk.AccAddress, validatorAddr sdk.ValAddress) QueryBondsParams {
return QueryBondsParams{
DelegatorAddr: delegatorAddr,
ValidatorAddr: validatorAddr,
}
}
// defines the params for the following queries:
// - 'custom/staking/redelegation'
type QueryRedelegationParams struct {
DelegatorAddr sdk.AccAddress
SrcValidatorAddr sdk.ValAddress
DstValidatorAddr sdk.ValAddress
}
func NewQueryRedelegationParams(delegatorAddr sdk.AccAddress,
srcValidatorAddr, dstValidatorAddr sdk.ValAddress) QueryRedelegationParams {
return QueryRedelegationParams{
DelegatorAddr: delegatorAddr,
SrcValidatorAddr: srcValidatorAddr,
DstValidatorAddr: dstValidatorAddr,
}
}
// QueryValidatorsParams defines the params for the following queries:
// - 'custom/staking/validators'
type QueryValidatorsParams struct {
Page, Limit int
Status string
}
func NewQueryValidatorsParams(page, limit int, status string) QueryValidatorsParams {
return QueryValidatorsParams{page, limit, status}
}