Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,7 @@ import (
// NewRootCmd creates a new root command for simd. It is called once in the main function.
func NewRootCmd() *cobra.Command {
var (
interfaceRegistry codectypes.InterfaceRegistry
appCodec codec.Codec
txConfig client.TxConfig
txConfigOpts tx.ConfigOptions
autoCliOpts autocli.AppOptions
moduleBasicManager module.BasicManager
initClientCtx client.Context
Expand All @@ -49,9 +47,7 @@ func NewRootCmd() *cobra.Command {
ProvideKeyring,
),
),
&interfaceRegistry,
&appCodec,
&txConfig,
&txConfigOpts,
&autoCliOpts,
&moduleBasicManager,
&initClientCtx,
Expand Down Expand Up @@ -79,15 +75,11 @@ func NewRootCmd() *cobra.Command {
return err
}

// This needs to go after ReadFromClientConfig, as that function
// sets the RPC client needed for SIGN_MODE_TEXTUAL.
enabledSignModes := append(tx.DefaultSignModes, signing.SignMode_SIGN_MODE_TEXTUAL)
txConfigOpts := tx.ConfigOptions{
EnabledSignModes: enabledSignModes,
TextualCoinMetadataQueryFn: txmodule.NewGRPCCoinMetadataQueryFn(initClientCtx),
}
// This needs to go after ReadFromClientConfig, as that function sets the RPC client needed for SIGN_MODE_TEXTUAL.
txConfigOpts.EnabledSignModes = append(txConfigOpts.EnabledSignModes, signing.SignMode_SIGN_MODE_TEXTUAL)
txConfigOpts.TextualCoinMetadataQueryFn = txmodule.NewGRPCCoinMetadataQueryFn(initClientCtx)
txConfigWithTextual, err := tx.NewTxConfigWithOptions(
codec.NewProtoCodec(interfaceRegistry),
codec.NewProtoCodec(initClientCtx.InterfaceRegistry),
txConfigOpts,
)
if err != nil {
Expand All @@ -105,7 +97,7 @@ func NewRootCmd() *cobra.Command {
},
}

initRootCmd(rootCmd, txConfig, interfaceRegistry, appCodec, moduleBasicManager)
initRootCmd(rootCmd, initClientCtx.TxConfig, initClientCtx.InterfaceRegistry, initClientCtx.Codec, moduleBasicManager)

overwriteFlagDefaults(rootCmd, map[string]string{
flags.FlagChainID: strings.ReplaceAll(app.Name, "-", ""),
Expand Down Expand Up @@ -135,20 +127,26 @@ func overwriteFlagDefaults(c *cobra.Command, defaults map[string]string) {
}
}

func ProvideClientContext(appCodec codec.Codec, interfaceRegistry codectypes.InterfaceRegistry, legacyAmino *codec.LegacyAmino) client.Context {
initClientCtx := client.Context{}.
func ProvideClientContext(
appCodec codec.Codec,
interfaceRegistry codectypes.InterfaceRegistry,
txConfig client.TxConfig,
legacyAmino *codec.LegacyAmino,
) client.Context {
clientCtx := client.Context{}.
WithCodec(appCodec).
WithInterfaceRegistry(interfaceRegistry).
WithTxConfig(txConfig).
WithLegacyAmino(legacyAmino).
WithInput(os.Stdin).
WithAccountRetriever(types.AccountRetriever{}).
WithHomeDir(app.DefaultNodeHome).
WithViper(app.Name)

// Read the config again to overwrite the default values with the values from the config file
initClientCtx, _ = config.ReadFromClientConfig(initClientCtx)
clientCtx, _ = config.ReadFromClientConfig(clientCtx)

return initClientCtx
return clientCtx
}

func ProvideKeyring(clientCtx client.Context, addressCodec address.Codec) (clientv2keyring.Keyring, error) {
Expand Down
2 changes: 1 addition & 1 deletion ignite/templates/app/files/go.mod.plush
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ require (
github.com/cometbft/cometbft v0.38.0
github.com/cosmos/cosmos-db v1.0.0
github.com/cosmos/cosmos-proto v1.0.0-beta.3
github.com/cosmos/cosmos-sdk v0.50.0-rc.1
github.com/cosmos/cosmos-sdk v0.50.0-rc.1.0.20230929112110-e6b06db813ee
github.com/cosmos/gogoproto v1.4.11
github.com/cosmos/ibc-go/modules/capability v1.0.0-rc5
github.com/cosmos/ibc-go/v8 v8.0.0-beta.0
Expand Down