change gentx cmd amount field to arg from flag (#8183)
* Read gentx amount as argument * Update gentx command usage * Update gentx tests * Update docs of gentx Co-authored-by: Alessio Treglia <alessio@tendermint.com>
This commit is contained in:
parent
96f89df56b
commit
be573cb0ce
@ -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
|
||||
|
||||
@ -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
|
||||
```
|
||||
|
||||
|
||||
@ -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")
|
||||
|
||||
@ -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)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user