planetmint-go/x/machine/client/cli/query_params.go
Lorenz Herzberger 8261397ec1
ignite scaffold module machine
Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
2023-07-03 11:52:22 +02:00

37 lines
732 B
Go

package cli
import (
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/spf13/cobra"
"planetmint-go/x/machine/types"
)
func CmdQueryParams() *cobra.Command {
cmd := &cobra.Command{
Use: "params",
Short: "shows the parameters of the module",
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)
res, err := queryClient.Params(cmd.Context(), &types.QueryParamsRequest{})
if err != nil {
return err
}
return clientCtx.PrintProto(res)
},
}
flags.AddQueryFlagsToCmd(cmd)
return cmd
}