diff --git a/docs/run-node/run-node.md b/docs/run-node/run-node.md index 768726d602d8..393172b9aa0c 100644 --- a/docs/run-node/run-node.md +++ b/docs/run-node/run-node.md @@ -53,7 +53,7 @@ Now that your account has some tokens, you need to add a validator to your chain ```bash # Create a gentx. -simd gentx my_validator --amount 100000stake --chain-id my-test-chain --keyring-backend test +simd gentx my_validator 100000stake --chain-id my-test-chain --keyring-backend test # Add the gentx to the genesis file. simd collect-gentxs diff --git a/docs/using-the-sdk/cosmovisor.md b/docs/using-the-sdk/cosmovisor.md index 870bbae236b2..56ee5f7fa7bb 100644 --- a/docs/using-the-sdk/cosmovisor.md +++ b/docs/using-the-sdk/cosmovisor.md @@ -103,7 +103,7 @@ rm -rf $HOME/.simapp ./build/simd keys --keyring-backend=test add validator ./build/simd init testing --chain-id test ./build/simd add-genesis-account --keyring-backend=test $(./build/simd keys --keyring-backend=test show validator -a) 1000000000stake,1000000000validatortoken -./build/simd gentx --keyring-backend test --chain-id test validator +./build/simd gentx --keyring-backend test --chain-id test validator 100000stake ./build/simd collect-gentxs ``` diff --git a/x/genutil/client/cli/gentx.go b/x/genutil/client/cli/gentx.go index 6ded1b76b9dd..200d038f627a 100644 --- a/x/genutil/client/cli/gentx.go +++ b/x/genutil/client/cli/gentx.go @@ -35,9 +35,9 @@ func GenTxCmd(mbm module.BasicManager, txEncCfg client.TxEncodingConfig, genBalI fsCreateValidator, defaultsDesc := cli.CreateValidatorMsgFlagSet(ipDefault) cmd := &cobra.Command{ - Use: "gentx [key_name]", + Use: "gentx [key_name] [amount]", Short: "Generate a genesis tx carrying a self delegation", - Args: cobra.ExactArgs(1), + Args: cobra.ExactArgs(2), Long: fmt.Sprintf(`Generate a genesis transaction that creates a validator with a self-delegation, that is signed by the key in the Keyring referenced by a given name. A node ID and Bech32 consensus pubkey may optionally be provided. If they are omitted, they will be retrieved from the priv_validator.json @@ -45,8 +45,7 @@ file. The following default parameters are included: %s Example: -$ %s gentx my-key-name --home=/path/to/home/dir --keyring-backend=os --chain-id=test-chain-1 \ - --amount=1000000stake \ +$ %s gentx my-key-name 1000000stake --home=/path/to/home/dir --keyring-backend=os --chain-id=test-chain-1 \ --moniker="myvalidator" \ --commission-max-change-rate=0.01 \ --commission-max-rate=1.0 \ @@ -118,7 +117,7 @@ $ %s gentx my-key-name --home=/path/to/home/dir --keyring-backend=os --chain-id= return errors.Wrap(err, "error creating configuration to create validator msg") } - amount, _ := cmd.Flags().GetString(cli.FlagAmount) + amount := args[1] coins, err := sdk.ParseCoinsNormalized(amount) if err != nil { return errors.Wrap(err, "failed to parse coins") diff --git a/x/genutil/client/cli/gentx_test.go b/x/genutil/client/cli/gentx_test.go index a433a97643d2..bbea1818ddb5 100644 --- a/x/genutil/client/cli/gentx_test.go +++ b/x/genutil/client/cli/gentx_test.go @@ -65,6 +65,7 @@ func (s *IntegrationTestSuite) TestGenTxCmd() { fmt.Sprintf("--%s=%s", flags.FlagChainID, s.network.Config.ChainID), fmt.Sprintf("--%s=%s", flags.FlagOutputDocument, genTxFile), val.Moniker, + sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10)).String(), }) err := cmd.ExecuteContext(ctx)