fix(simapp): textual wiring (#18242)

This commit is contained in:
Julien Robert
2023-10-24 21:14:10 +00:00
committed by GitHub
parent 685a0a363e
commit fd93ee77e4
8 changed files with 57 additions and 60 deletions
+10 -4
View File
@@ -24,13 +24,13 @@ import (
simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims"
"github.com/cosmos/cosmos-sdk/types/module"
"github.com/cosmos/cosmos-sdk/x/auth/tx"
authtxconfig "github.com/cosmos/cosmos-sdk/x/auth/tx/config"
"github.com/cosmos/cosmos-sdk/x/auth/types"
)
// NewRootCmd creates a new root command for simd. It is called once in the main function.
func NewRootCmd() *cobra.Command {
var (
txConfigOpts tx.ConfigOptions
autoCliOpts autocli.AppOptions
moduleBasicManager module.BasicManager
clientCtx client.Context
@@ -47,7 +47,6 @@ func NewRootCmd() *cobra.Command {
ProvideKeyring,
),
),
&txConfigOpts,
&autoCliOpts,
&moduleBasicManager,
&clientCtx,
@@ -99,7 +98,7 @@ func NewRootCmd() *cobra.Command {
func ProvideClientContext(
appCodec codec.Codec,
interfaceRegistry codectypes.InterfaceRegistry,
txConfig client.TxConfig,
txConfigOpts tx.ConfigOptions,
legacyAmino *codec.LegacyAmino,
addressCodec address.Codec,
validatorAddressCodec runtime.ValidatorAddressCodec,
@@ -110,7 +109,6 @@ func ProvideClientContext(
clientCtx := client.Context{}.
WithCodec(appCodec).
WithInterfaceRegistry(interfaceRegistry).
WithTxConfig(txConfig).
WithLegacyAmino(legacyAmino).
WithInput(os.Stdin).
WithAccountRetriever(types.AccountRetriever{}).
@@ -127,6 +125,14 @@ func ProvideClientContext(
panic(err)
}
// re-create the tx config grpc instead of bank keeper
txConfigOpts.TextualCoinMetadataQueryFn = authtxconfig.NewGRPCCoinMetadataQueryFn(clientCtx)
txConfig, err := tx.NewTxConfigWithOptions(clientCtx.Codec, txConfigOpts)
if err != nil {
panic(err)
}
clientCtx = clientCtx.WithTxConfig(txConfig)
return clientCtx
}