Skip to content

Commit

Permalink
x/alloc: add cli params query
Browse files Browse the repository at this point in the history
  • Loading branch information
harish551 committed Feb 16, 2022
1 parent 76cf3c8 commit 286c0ff
Showing 1 changed file with 30 additions and 1 deletion.
31 changes: 30 additions & 1 deletion x/alloc/client/cli/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package cli

import (
"fmt"
"github.com/cosmos/cosmos-sdk/client/flags"

"github.com/OmniFlix/omniflixhub/x/alloc/types"
"github.com/cosmos/cosmos-sdk/client"
Expand All @@ -18,8 +19,36 @@ func GetQueryCmd(queryRoute string) *cobra.Command {
SuggestionsMinimumDistance: 2,
RunE: client.ValidateCmd,
}

cmd.AddCommand(
GetCmdQueryParams(),
)
// this line is used by starport scaffolding # 1

return cmd
}

// GetCmdQueryParams implements the query params command.
func GetCmdQueryParams() *cobra.Command {
cmd := &cobra.Command{
Use: "params",
Args: cobra.NoArgs,
Short: "Query alloc params",
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
}

0 comments on commit 286c0ff

Please sign in to comment.