-
Notifications
You must be signed in to change notification settings - Fork 0
/
querier.go
83 lines (72 loc) · 2.47 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
package types
import (
sdk "github.com/cosmos/cosmos-sdk/types"
tmbytes "github.com/tendermint/tendermint/libs/bytes"
)
const (
// QueryGetAssetSupply command for getting info about an asset's supply
QueryGetAssetSupply = "supply"
// QueryGetAssetSupplies command for getting a list of asset supplies
QueryGetAssetSupplies = "supplies"
// QueryGetAtomicSwap command for getting info about an atomic swap
QueryGetAtomicSwap = "swap"
// QueryGetAtomicSwaps command for getting a list of atomic swaps
QueryGetAtomicSwaps = "swaps"
// QueryGetParams command for getting module params
QueryGetParams = "parameters"
)
// Legacy querier requests
// QueryAssetSupply contains the params for query 'custom/bep3/supply'
type QueryAssetSupply struct {
Denom string `json:"denom" yaml:"denom"`
}
// NewQueryAssetSupply creates a new QueryAssetSupply
func NewQueryAssetSupply(denom string) QueryAssetSupply {
return QueryAssetSupply{
Denom: denom,
}
}
// QueryAssetSupplies contains the params for an AssetSupplies query
type QueryAssetSupplies struct {
Page int `json:"page" yaml:"page"`
Limit int `json:"limit" yaml:"limit"`
}
// NewQueryAssetSupplies creates a new QueryAssetSupplies
func NewQueryAssetSupplies(page int, limit int) QueryAssetSupplies {
return QueryAssetSupplies{
Page: page,
Limit: limit,
}
}
// QueryAtomicSwapByID contains the params for query 'custom/bep3/swap'
type QueryAtomicSwapByID struct {
SwapID tmbytes.HexBytes `json:"swap_id" yaml:"swap_id"`
}
// NewQueryAtomicSwapByID creates a new QueryAtomicSwapByID
func NewQueryAtomicSwapByID(swapBytes tmbytes.HexBytes) QueryAtomicSwapByID {
return QueryAtomicSwapByID{
SwapID: swapBytes,
}
}
// QueryAtomicSwaps contains the params for an AtomicSwaps query
type QueryAtomicSwaps struct {
Page int `json:"page" yaml:"page"`
Limit int `json:"limit" yaml:"limit"`
Involve sdk.AccAddress `json:"involve" yaml:"involve"`
Expiration uint64 `json:"expiration" yaml:"expiration"`
Status SwapStatus `json:"status" yaml:"status"`
Direction SwapDirection `json:"direction" yaml:"direction"`
}
// NewQueryAtomicSwaps creates a new instance of QueryAtomicSwaps
func NewQueryAtomicSwaps(page, limit int, involve sdk.AccAddress, expiration uint64,
status SwapStatus, direction SwapDirection,
) QueryAtomicSwaps {
return QueryAtomicSwaps{
Page: page,
Limit: limit,
Involve: involve,
Expiration: expiration,
Status: status,
Direction: direction,
}
}