-
Notifications
You must be signed in to change notification settings - Fork 0
/
query.go
42 lines (35 loc) · 1.2 KB
/
query.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
package cli
import (
"github.com/spf13/cobra"
"github.com/osmosis-labs/osmosis/osmoutils/osmocli"
"github.com/fury-labs/furya/v20/x/cosmwasmpool/client/queryproto"
"github.com/fury-labs/furya/v20/x/cosmwasmpool/types"
)
// NewQueryCmd returns the cli query commands for this module.
func NewQueryCmd() *cobra.Command {
cmd := osmocli.QueryIndexCmd(types.ModuleName)
qcGetter := queryproto.NewQueryClient
osmocli.AddQueryCmd(cmd, qcGetter, GetCmdPools)
osmocli.AddQueryCmd(cmd, qcGetter, GetCmdContractInfoByPoolId)
cmd.AddCommand(
osmocli.GetParams[*queryproto.ParamsRequest](
types.ModuleName, queryproto.NewQueryClient),
)
return cmd
}
func GetCmdPools() (*osmocli.QueryDescriptor, *queryproto.PoolsRequest) {
return &osmocli.QueryDescriptor{
Use: "pools",
Short: "Query pools",
Long: `{{.Short}}{{.ExampleHeader}}
{{.CommandPrefix}} pools`,
}, &queryproto.PoolsRequest{}
}
func GetCmdContractInfoByPoolId() (*osmocli.QueryDescriptor, *queryproto.ContractInfoByPoolIdRequest) {
return &osmocli.QueryDescriptor{
Use: "contract-info",
Short: "Query contract info by pool id",
Long: `{{.Short}}{{.ExampleHeader}}
{{.CommandPrefix}} pools`,
}, &queryproto.ContractInfoByPoolIdRequest{}
}