2019-06-18 06:44:09 -07:00
|
|
|
package types
|
|
|
|
|
|
|
|
import (
|
|
|
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
2020-06-20 16:44:04 -07:00
|
|
|
"github.com/cosmos/cosmos-sdk/types/query"
|
2019-06-18 06:44:09 -07:00
|
|
|
)
|
|
|
|
|
2020-01-30 13:31:16 -08:00
|
|
|
// Querier path constants
|
|
|
|
const (
|
|
|
|
QueryBalance = "balance"
|
|
|
|
QueryAllBalances = "all_balances"
|
2020-04-20 08:22:12 -07:00
|
|
|
QueryTotalSupply = "total_supply"
|
|
|
|
QuerySupplyOf = "supply_of"
|
2020-01-30 13:31:16 -08:00
|
|
|
)
|
|
|
|
|
2020-06-05 11:10:04 -07:00
|
|
|
// NewQueryBalanceRequest creates a new instance of QueryBalanceRequest.
|
|
|
|
func NewQueryBalanceRequest(addr sdk.AccAddress, denom string) *QueryBalanceRequest {
|
|
|
|
return &QueryBalanceRequest{Address: addr, Denom: denom}
|
2019-06-18 06:44:09 -07:00
|
|
|
}
|
|
|
|
|
2020-06-05 11:10:04 -07:00
|
|
|
// NewQueryAllBalancesRequest creates a new instance of QueryAllBalancesRequest.
|
2020-06-20 16:44:04 -07:00
|
|
|
func NewQueryAllBalancesRequest(addr sdk.AccAddress, req *query.PageRequest) *QueryAllBalancesRequest {
|
2020-07-20 09:51:16 -07:00
|
|
|
return &QueryAllBalancesRequest{Address: addr, Pagination: req}
|
2019-06-18 06:44:09 -07:00
|
|
|
}
|
2020-04-20 08:22:12 -07:00
|
|
|
|
2020-07-20 09:51:16 -07:00
|
|
|
// QueryTotalSupplyParams defines the params for the following queries:
|
2020-04-20 08:22:12 -07:00
|
|
|
//
|
|
|
|
// - 'custom/bank/totalSupply'
|
|
|
|
type QueryTotalSupplyParams struct {
|
|
|
|
Page, Limit int
|
|
|
|
}
|
|
|
|
|
|
|
|
// NewQueryTotalSupplyParams creates a new instance to query the total supply
|
|
|
|
func NewQueryTotalSupplyParams(page, limit int) QueryTotalSupplyParams {
|
|
|
|
return QueryTotalSupplyParams{page, limit}
|
|
|
|
}
|
|
|
|
|
|
|
|
// QuerySupplyOfParams defines the params for the following queries:
|
|
|
|
//
|
|
|
|
// - 'custom/bank/totalSupplyOf'
|
|
|
|
type QuerySupplyOfParams struct {
|
|
|
|
Denom string
|
|
|
|
}
|
|
|
|
|
|
|
|
// NewQuerySupplyOfParams creates a new instance to query the total supply
|
|
|
|
// of a given denomination
|
|
|
|
func NewQuerySupplyOfParams(denom string) QuerySupplyOfParams {
|
|
|
|
return QuerySupplyOfParams{denom}
|
|
|
|
}
|