package cli import ( "context" "github.com/spf13/cobra" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/kava-labs/kava/x/earn/types" ) // GetQueryCmd returns the cli query commands for the earn module func GetQueryCmd() *cobra.Command { earnQueryCommand := &cobra.Command{ Use: types.ModuleName, Short: "Querying commands for the earn module", DisableFlagParsing: true, SuggestionsMinimumDistance: 2, RunE: client.ValidateCmd, } cmds := []*cobra.Command{ queryParamsCmd(), } for _, cmd := range cmds { flags.AddQueryFlagsToCmd(cmd) } earnQueryCommand.AddCommand(cmds...) return earnQueryCommand } func queryParamsCmd() *cobra.Command { return &cobra.Command{ Use: "params", Short: "get the earn module parameters", Long: "Get the current earn module parameters.", Args: cobra.NoArgs, RunE: func(cmd *cobra.Command, args []string) error { clientCtx, err := client.GetClientQueryContext(cmd) if err != nil { return err } queryClient := types.NewQueryClient(clientCtx) req := types.NewQueryParamsRequest() res, err := queryClient.Params(context.Background(), req) if err != nil { return err } return clientCtx.PrintProto(&res.Params) }, } }