Merge pull request #969 from public-awesome/jhernandezb/add-params-query

add params query
This commit is contained in:
Alexander Peters
2022-09-01 11:09:46 +02:00
committed by GitHub
8 changed files with 582 additions and 76 deletions

View File

@@ -38,6 +38,7 @@ func GetQueryCmd() *cobra.Command {
GetCmdGetContractState(),
GetCmdListPinnedCode(),
GetCmdLibVersion(),
GetCmdQueryParams(),
)
return queryCmd
}
@@ -540,3 +541,32 @@ func withPageKeyDecoded(flagSet *flag.FlagSet) *flag.FlagSet {
}
return flagSet
}
// GetCmdQueryParams implements a command to return the current wasm
// parameters.
func GetCmdQueryParams() *cobra.Command {
cmd := &cobra.Command{
Use: "params",
Short: "Query the current wasm 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)
params := &types.QueryParamsRequest{}
res, err := queryClient.Params(cmd.Context(), params)
if err != nil {
return err
}
return clientCtx.PrintProto(&res.Params)
},
}
flags.AddQueryFlagsToCmd(cmd)
return cmd
}