feat(client): add auto cli for node service (#21074)

This commit is contained in:
zakir
2024-08-15 18:52:45 +00:00
committed by GitHub
parent adf5d1b3bb
commit 1cb2336a67
5 changed files with 61 additions and 0 deletions
+4
View File
@@ -18,6 +18,7 @@ import (
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/config"
nodeservice "github.com/cosmos/cosmos-sdk/client/grpc/node"
addresscodec "github.com/cosmos/cosmos-sdk/codec/address"
"github.com/cosmos/cosmos-sdk/server"
simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims"
@@ -122,6 +123,9 @@ func NewRootCmd() *cobra.Command {
autoCliOpts := tempApp.AutoCliOpts()
autoCliOpts.ClientCtx = initClientCtx
nodeCmds := nodeservice.NewNodeCommands()
autoCliOpts.ModuleOptions[nodeCmds.Name()] = nodeCmds.AutoCLIOptions()
if err := autoCliOpts.EnhanceRootCommand(rootCmd); err != nil {
panic(err)
}
+6
View File
@@ -8,6 +8,7 @@ import (
"github.com/spf13/cobra"
authv1 "cosmossdk.io/api/cosmos/auth/module/v1"
autocliv1 "cosmossdk.io/api/cosmos/autocli/v1"
stakingv1 "cosmossdk.io/api/cosmos/staking/module/v1"
"cosmossdk.io/client/v2/autocli"
"cosmossdk.io/core/address"
@@ -18,6 +19,7 @@ import (
"cosmossdk.io/x/auth/tx"
authtxconfig "cosmossdk.io/x/auth/tx/config"
"cosmossdk.io/x/auth/types"
nodeservice "github.com/cosmos/cosmos-sdk/client/grpc/node"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/config"
@@ -83,6 +85,10 @@ func NewRootCmd() *cobra.Command {
initRootCmd(rootCmd, moduleManager)
nodeCmds := nodeservice.NewNodeCommands()
autoCliOpts.ModuleOptions = make(map[string]*autocliv1.ModuleOptions)
autoCliOpts.ModuleOptions[nodeCmds.Name()] = nodeCmds.AutoCLIOptions()
if err := autoCliOpts.EnhanceRootCommand(rootCmd); err != nil {
panic(err)
}