@@ -0,0 +1,31 @@
|
||||
package params
|
||||
|
||||
import (
|
||||
autocliv1 "cosmossdk.io/api/cosmos/autocli/v1"
|
||||
paramsv1beta1 "cosmossdk.io/api/cosmos/params/v1beta1"
|
||||
)
|
||||
|
||||
// AutoCLIOptions implements the autocli.HasAutoCLIConfig interface.
|
||||
func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions {
|
||||
return &autocliv1.ModuleOptions{
|
||||
Query: &autocliv1.ServiceCommandDescriptor{
|
||||
Service: paramsv1beta1.Query_ServiceDesc.ServiceName,
|
||||
RpcCommandOptions: []*autocliv1.RpcCommandOptions{
|
||||
{
|
||||
RpcMethod: "Params",
|
||||
Use: "subspace [subspace] [key]",
|
||||
Short: "Query for raw parameters by subspace and key",
|
||||
PositionalArgs: []*autocliv1.PositionalArgDescriptor{
|
||||
{ProtoField: "subspace"},
|
||||
{ProtoField: "key"},
|
||||
},
|
||||
},
|
||||
{
|
||||
RpcMethod: "Subspaces",
|
||||
Use: "subspaces",
|
||||
Short: "Query for all registered subspaces and all keys for a subspace",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
package cli
|
||||
|
||||
import (
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/cosmos/cosmos-sdk/client/flags"
|
||||
"github.com/cosmos/cosmos-sdk/x/params/types"
|
||||
"github.com/cosmos/cosmos-sdk/x/params/types/proposal"
|
||||
)
|
||||
|
||||
// NewQueryCmd returns a root CLI command handler for all x/params query commands.
|
||||
func NewQueryCmd() *cobra.Command {
|
||||
cmd := &cobra.Command{
|
||||
Use: types.ModuleName,
|
||||
Short: "Querying commands for the params module",
|
||||
DisableFlagParsing: true,
|
||||
SuggestionsMinimumDistance: 2,
|
||||
RunE: client.ValidateCmd,
|
||||
}
|
||||
|
||||
cmd.AddCommand(NewQuerySubspaceParamsCmd())
|
||||
|
||||
return cmd
|
||||
}
|
||||
|
||||
// NewQuerySubspaceParamsCmd returns a CLI command handler for querying subspace
|
||||
// parameters managed by the x/params module.
|
||||
func NewQuerySubspaceParamsCmd() *cobra.Command {
|
||||
cmd := &cobra.Command{
|
||||
Use: "subspace [subspace] [key]",
|
||||
Short: "Query for raw parameters by subspace and key",
|
||||
Args: cobra.ExactArgs(2),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
clientCtx, err := client.GetClientQueryContext(cmd)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
queryClient := proposal.NewQueryClient(clientCtx)
|
||||
|
||||
params := proposal.QueryParamsRequest{Subspace: args[0], Key: args[1]}
|
||||
res, err := queryClient.Params(cmd.Context(), ¶ms)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return clientCtx.PrintProto(&res.Param)
|
||||
},
|
||||
}
|
||||
|
||||
flags.AddQueryFlagsToCmd(cmd)
|
||||
|
||||
return cmd
|
||||
}
|
||||
@@ -4,7 +4,6 @@ import (
|
||||
"context"
|
||||
|
||||
gwruntime "github.com/grpc-ecosystem/grpc-gateway/runtime"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
modulev1 "cosmossdk.io/api/cosmos/params/module/v1"
|
||||
"cosmossdk.io/core/appmodule"
|
||||
@@ -17,7 +16,6 @@ import (
|
||||
"github.com/cosmos/cosmos-sdk/types/module"
|
||||
simtypes "github.com/cosmos/cosmos-sdk/types/simulation"
|
||||
govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1"
|
||||
"github.com/cosmos/cosmos-sdk/x/params/client/cli"
|
||||
"github.com/cosmos/cosmos-sdk/x/params/keeper"
|
||||
"github.com/cosmos/cosmos-sdk/x/params/types"
|
||||
"github.com/cosmos/cosmos-sdk/x/params/types/proposal"
|
||||
@@ -52,11 +50,6 @@ func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *g
|
||||
}
|
||||
}
|
||||
|
||||
// GetQueryCmd returns no root query command for the params module.
|
||||
func (AppModuleBasic) GetQueryCmd() *cobra.Command {
|
||||
return cli.NewQueryCmd()
|
||||
}
|
||||
|
||||
func (am AppModuleBasic) RegisterInterfaces(registry codectypes.InterfaceRegistry) {
|
||||
proposal.RegisterInterfaces(registry)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user