Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change gentx cmd amount field to arg from flag #8183

Merged
merged 7 commits into from
Dec 17, 2020
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
2 changes: 1 addition & 1 deletion docs/run-node/run-node.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion docs/using-the-sdk/cosmovisor.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```

Expand Down
9 changes: 4 additions & 5 deletions x/genutil/client/cli/gentx.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,17 @@ 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
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 \
Expand Down Expand Up @@ -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")
Expand Down
1 change: 1 addition & 0 deletions x/genutil/client/cli/gentx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down