-
Notifications
You must be signed in to change notification settings - Fork 8
/
query.go
41 lines (33 loc) · 1.11 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
package cli
import (
"fmt"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/version"
"github.com/spf13/cobra"
"github.com/cosmos/ibc-go/v3/modules/apps/27-interchain-accounts/controller/types"
)
// GetCmdParams returns the command handler for the controller submodule parameter querying.
func GetCmdParams() *cobra.Command {
cmd := &cobra.Command{
Use: "params",
Short: "Query the current interchain-accounts controller submodule parameters",
Long: "Query the current interchain-accounts controller submodule parameters",
Args: cobra.NoArgs,
Example: fmt.Sprintf("%s query interchain-accounts controller params", version.AppName),
RunE: func(cmd *cobra.Command, _ []string) error {
clientCtx, err := client.GetClientQueryContext(cmd)
if err != nil {
return err
}
queryClient := types.NewQueryClient(clientCtx)
res, err := queryClient.Params(cmd.Context(), &types.QueryParamsRequest{})
if err != nil {
return err
}
return clientCtx.PrintProto(res.Params)
},
}
flags.AddQueryFlagsToCmd(cmd)
return cmd
}