diff --git a/chain/cmd/bandcli/main.go b/chain/cmd/bandcli/main.go index 37e18a3fa2..4c2a212540 100644 --- a/chain/cmd/bandcli/main.go +++ b/chain/cmd/bandcli/main.go @@ -23,16 +23,13 @@ import ( "github.com/tendermint/tendermint/libs/cli" ) +const flagCosmosHDPath = "cosmos-hd-path" + func main() { cobra.EnableCommandSorting = false cdc := app.MakeCodec() - // Read in the configuration file for the sdk - config := sdk.GetConfig() - app.SetBech32AddressPrefixesAndBip44CoinType(config) - config.Seal() - rootCmd := &cobra.Command{ Use: "bandcli", Short: "Command line interface for interacting with BandChain", @@ -40,7 +37,17 @@ func main() { // Add --chain-id to persistent flags and mark it required rootCmd.PersistentFlags().String(client.FlagChainID, "", "Chain ID of tendermint node") + rootCmd.PersistentFlags().Bool(flagCosmosHDPath, false, fmt.Sprintf("Use Cosmos BIP-44 coin type (%d)", sdk.CoinType)) + rootCmd.PersistentPreRunE = func(_ *cobra.Command, _ []string) error { + // Read in the configuration file for the sdk + config := sdk.GetConfig() + app.SetBech32AddressPrefixesAndBip44CoinType(config) + if viper.GetBool(flagCosmosHDPath) { + fmt.Println("HERE!") + config.SetCoinType(sdk.CoinType) + } + config.Seal() return initConfig(rootCmd) }