From da28ad47602401f618fc6a7631be9ed50c54d399 Mon Sep 17 00:00:00 2001 From: hoangdv2429 Date: Mon, 21 Aug 2023 11:33:39 +0700 Subject: [PATCH] add Consensus address to autocliopts --- app/app.go | 1 + cmd/wasmd/root.go | 17 +++++++---------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/app/app.go b/app/app.go index 6a83470d3e..482b66d9ec 100644 --- a/app/app.go +++ b/app/app.go @@ -1045,6 +1045,7 @@ func (app *WasmApp) AutoCliOpts() autocli.AppOptions { Modules: modules, AddressCodec: authcodec.NewBech32Codec(sdk.GetConfig().GetBech32AccountAddrPrefix()), ValidatorAddressCodec: authcodec.NewBech32Codec(sdk.GetConfig().GetBech32ValidatorAddrPrefix()), + ConsensusAddressCodec: authcodec.NewBech32Codec(sdk.GetConfig().GetBech32ConsensusAddrPrefix()), } } diff --git a/cmd/wasmd/root.go b/cmd/wasmd/root.go index 1c862a9358..14113f4921 100644 --- a/cmd/wasmd/root.go +++ b/cmd/wasmd/root.go @@ -3,11 +3,9 @@ package main import ( "os" - dbm "github.com/cosmos/cosmos-db" - "github.com/spf13/cobra" - "cosmossdk.io/log" + dbm "github.com/cosmos/cosmos-db" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/config" "github.com/cosmos/cosmos-sdk/codec" @@ -18,6 +16,7 @@ import ( "github.com/cosmos/cosmos-sdk/x/auth/tx" txmodule "github.com/cosmos/cosmos-sdk/x/auth/tx/config" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + "github.com/spf13/cobra" "github.com/CosmWasm/wasmd/app" "github.com/CosmWasm/wasmd/app/params" @@ -48,9 +47,8 @@ func NewRootCmd() *cobra.Command { WithViper("") // In wasmd, we don't use any prefix for env variables. rootCmd := &cobra.Command{ - Use: version.AppName, - Short: "Wasm Daemon (server)", - SilenceErrors: true, + Use: version.AppName, + Short: "Wasm Daemon (server)", PersistentPreRunE: func(cmd *cobra.Command, _ []string) error { // set the default command outputs cmd.SetOut(cmd.OutOrStdout()) @@ -96,10 +94,9 @@ func NewRootCmd() *cobra.Command { initRootCmd(rootCmd, encodingConfig.TxConfig, encodingConfig.InterfaceRegistry, encodingConfig.Codec, tempApp.BasicModuleManager) - // Missing "consensus address codec in builder" - // if err := tempApp.AutoCliOpts().EnhanceRootCommand(rootCmd); err != nil { - // panic(err) - // } + if err := tempApp.AutoCliOpts().EnhanceRootCommand(rootCmd); err != nil { + panic(err) + } return rootCmd }