Add some information about what an address can be for CLI commands (#9233)

This commit is contained in:
sakridge 2020-04-01 19:45:37 -07:00 committed by GitHub
parent 8b14eb9020
commit a8817fb973
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 146 additions and 210 deletions

View File

@ -2255,24 +2255,20 @@ pub fn app<'ab, 'v>(name: &str, about: &'ab str, version: &'v str) -> App<'ab, '
.help("The airdrop amount to request, in SOL"), .help("The airdrop amount to request, in SOL"),
) )
.arg( .arg(
Arg::with_name("to") pubkey!(Arg::with_name("to")
.index(2) .index(2)
.value_name("RECIPIENT_ADDRESS") .value_name("RECIPIENT_ADDRESS"),
.takes_value(true) "The account address of airdrop recipient. "),
.validator(is_valid_pubkey)
.help("The account address of airdrop recipient"),
), ),
) )
.subcommand( .subcommand(
SubCommand::with_name("balance") SubCommand::with_name("balance")
.about("Get your balance") .about("Get your balance")
.arg( .arg(
Arg::with_name("pubkey") pubkey!(Arg::with_name("pubkey")
.index(1) .index(1)
.value_name("ACCOUNT_ADDRESS") .value_name("ACCOUNT_ADDRESS"),
.takes_value(true) "The account address of the balance to check. ")
.validator(is_valid_pubkey)
.help("The account address of the balance to check"),
) )
.arg( .arg(
Arg::with_name("lamports") Arg::with_name("lamports")
@ -2329,13 +2325,11 @@ pub fn app<'ab, 'v>(name: &str, about: &'ab str, version: &'v str) -> App<'ab, '
), ),
) )
.arg( .arg(
Arg::with_name("from") pubkey!(Arg::with_name("from")
.long("from") .long("from")
.value_name("FROM_PUBKEY") .value_name("FROM_PUBKEY")
.takes_value(true) .required(false),
.required(false) "From (base) key, [default: cli config keypair]. "),
.validator(is_valid_pubkey)
.help("From (base) key, [default: cli config keypair]"),
), ),
) )
.subcommand( .subcommand(
@ -2354,13 +2348,11 @@ pub fn app<'ab, 'v>(name: &str, about: &'ab str, version: &'v str) -> App<'ab, '
SubCommand::with_name("pay") SubCommand::with_name("pay")
.about("Send a payment") .about("Send a payment")
.arg( .arg(
Arg::with_name("to") pubkey!(Arg::with_name("to")
.index(1) .index(1)
.value_name("RECIPIENT_ADDRESS") .value_name("RECIPIENT_ADDRESS")
.takes_value(true) .required(true),
.required(true) "The account address of recipient. "),
.validator(is_valid_pubkey)
.help("The account address of recipient"),
) )
.arg( .arg(
Arg::with_name("amount") Arg::with_name("amount")
@ -2423,13 +2415,11 @@ pub fn app<'ab, 'v>(name: &str, about: &'ab str, version: &'v str) -> App<'ab, '
SubCommand::with_name("send-signature") SubCommand::with_name("send-signature")
.about("Send a signature to authorize a transfer") .about("Send a signature to authorize a transfer")
.arg( .arg(
Arg::with_name("to") pubkey!(Arg::with_name("to")
.index(1) .index(1)
.value_name("RECIPIENT_ADDRESS") .value_name("RECIPIENT_ADDRESS")
.takes_value(true) .required(true),
.required(true) "The account address of recipient. "),
.validator(is_pubkey)
.help("The account address of recipient"),
) )
.arg( .arg(
Arg::with_name("process_id") Arg::with_name("process_id")
@ -2444,13 +2434,11 @@ pub fn app<'ab, 'v>(name: &str, about: &'ab str, version: &'v str) -> App<'ab, '
SubCommand::with_name("send-timestamp") SubCommand::with_name("send-timestamp")
.about("Send a timestamp to unlock a transfer") .about("Send a timestamp to unlock a transfer")
.arg( .arg(
Arg::with_name("to") pubkey!(Arg::with_name("to")
.index(1) .index(1)
.value_name("RECIPIENT_ADDRESS") .value_name("RECIPIENT_ADDRESS")
.takes_value(true) .required(true),
.required(true) "The account address of recipient. "),
.validator(is_pubkey)
.help("The account address of recipient"),
) )
.arg( .arg(
Arg::with_name("process_id") Arg::with_name("process_id")
@ -2472,13 +2460,11 @@ pub fn app<'ab, 'v>(name: &str, about: &'ab str, version: &'v str) -> App<'ab, '
SubCommand::with_name("transfer") SubCommand::with_name("transfer")
.about("Transfer funds between system accounts") .about("Transfer funds between system accounts")
.arg( .arg(
Arg::with_name("to") pubkey!(Arg::with_name("to")
.index(1) .index(1)
.value_name("RECIPIENT_ADDRESS") .value_name("RECIPIENT_ADDRESS")
.takes_value(true) .required(true),
.required(true) "The account address of recipient. "),
.validator(is_valid_pubkey)
.help("The account address of recipient"),
) )
.arg( .arg(
Arg::with_name("amount") Arg::with_name("amount")
@ -2490,12 +2476,10 @@ pub fn app<'ab, 'v>(name: &str, about: &'ab str, version: &'v str) -> App<'ab, '
.help("The amount to send, in SOL"), .help("The amount to send, in SOL"),
) )
.arg( .arg(
Arg::with_name("from") pubkey!(Arg::with_name("from")
.long("from") .long("from")
.takes_value(true) .value_name("FROM_ADDRESS"),
.value_name("KEYPAIR") "Source account of funds (if different from client local account). "),
.validator(is_valid_signer)
.help("Source account of funds (if different from client local account)"),
) )
.offline_args() .offline_args()
.arg(nonce_arg()) .arg(nonce_arg())
@ -2507,13 +2491,11 @@ pub fn app<'ab, 'v>(name: &str, about: &'ab str, version: &'v str) -> App<'ab, '
.about("Show the contents of an account") .about("Show the contents of an account")
.alias("account") .alias("account")
.arg( .arg(
Arg::with_name("account_pubkey") pubkey!(Arg::with_name("account_pubkey")
.index(1) .index(1)
.value_name("ACCOUNT_ADDRESS") .value_name("ACCOUNT_ADDRESS")
.takes_value(true) .required(true),
.required(true) "Account key URI. ")
.validator(is_valid_pubkey)
.help("Account pubkey"),
) )
.arg( .arg(
Arg::with_name("output_file") Arg::with_name("output_file")

View File

@ -54,13 +54,11 @@ impl ClusterQuerySubCommands for App<'_, '_> {
SubCommand::with_name("catchup") SubCommand::with_name("catchup")
.about("Wait for a validator to catch up to the cluster") .about("Wait for a validator to catch up to the cluster")
.arg( .arg(
Arg::with_name("node_pubkey") pubkey!(Arg::with_name("node_pubkey")
.index(1) .index(1)
.takes_value(true)
.value_name("VALIDATOR_PUBKEY") .value_name("VALIDATOR_PUBKEY")
.validator(is_valid_pubkey) .required(true),
.required(true) "Identity pubkey of the validator"),
.help("Identity pubkey of the validator"),
) )
.arg( .arg(
Arg::with_name("node_json_rpc_url") Arg::with_name("node_json_rpc_url")
@ -219,13 +217,11 @@ impl ClusterQuerySubCommands for App<'_, '_> {
SubCommand::with_name("stakes") SubCommand::with_name("stakes")
.about("Show stake account information") .about("Show stake account information")
.arg( .arg(
Arg::with_name("vote_account_pubkeys") pubkey!(Arg::with_name("vote_account_pubkeys")
.index(1) .index(1)
.value_name("VOTE_ACCOUNT_PUBKEYS") .value_name("VOTE_ACCOUNT_PUBKEYS")
.takes_value(true) .multiple(true),
.multiple(true) "Only show stake accounts delegated to the provided vote accounts. "),
.validator(is_valid_pubkey)
.help("Only show stake accounts delegated to the provided vote accounts"),
) )
.arg( .arg(
Arg::with_name("lamports") Arg::with_name("lamports")

View File

@ -1,3 +1,23 @@
macro_rules! ACCOUNT_STRING {
() => {
r#"Can be:
* a bs58 pubkey string
* path to keypair file
* '-' to take json-encoded keypair string from stdin
* 'ASK' to ask for a passphrase
* path to hardware wallet (usb://..)"#
};
}
#[macro_use]
macro_rules! pubkey {
($arg:expr, $help:expr) => {
$arg.takes_value(true)
.validator(is_valid_pubkey)
.help(concat!($help, ACCOUNT_STRING!()))
};
}
pub mod cli; pub mod cli;
pub mod cluster_query; pub mod cluster_query;
pub mod display; pub mod display;

View File

@ -92,22 +92,18 @@ impl NonceSubCommands for App<'_, '_> {
SubCommand::with_name("authorize-nonce-account") SubCommand::with_name("authorize-nonce-account")
.about("Assign account authority to a new entity") .about("Assign account authority to a new entity")
.arg( .arg(
Arg::with_name("nonce_account_pubkey") pubkey!(Arg::with_name("nonce_account_pubkey")
.index(1) .index(1)
.value_name("NONCE_ACCOUNT_ADDRESS") .value_name("NONCE_ACCOUNT_ADDRESS")
.takes_value(true) .required(true),
.required(true) "Address of the nonce account. "),
.validator(is_valid_pubkey)
.help("Address of the nonce account"),
) )
.arg( .arg(
Arg::with_name("new_authority") pubkey!(Arg::with_name("new_authority")
.index(2) .index(2)
.value_name("AUTHORITY_PUBKEY") .value_name("AUTHORITY_PUBKEY")
.takes_value(true) .required(true),
.required(true) "Account to be granted authority of the nonce account. "),
.validator(is_valid_pubkey)
.help("Account to be granted authority of the nonce account"),
) )
.arg(nonce_authority_arg()), .arg(nonce_authority_arg()),
) )
@ -133,12 +129,10 @@ impl NonceSubCommands for App<'_, '_> {
.help("The amount to load the nonce account with, in SOL"), .help("The amount to load the nonce account with, in SOL"),
) )
.arg( .arg(
Arg::with_name(NONCE_AUTHORITY_ARG.name) pubkey!(Arg::with_name(NONCE_AUTHORITY_ARG.name)
.long(NONCE_AUTHORITY_ARG.long) .long(NONCE_AUTHORITY_ARG.long)
.takes_value(true) .value_name("PUBKEY"),
.value_name("PUBKEY") "Assign noncing authority to another entity. "),
.validator(is_valid_pubkey)
.help("Assign noncing authority to another entity"),
) )
.arg( .arg(
Arg::with_name("seed") Arg::with_name("seed")
@ -153,26 +147,22 @@ impl NonceSubCommands for App<'_, '_> {
.about("Get the current nonce value") .about("Get the current nonce value")
.alias("get-nonce") .alias("get-nonce")
.arg( .arg(
Arg::with_name("nonce_account_pubkey") pubkey!(Arg::with_name("nonce_account_pubkey")
.index(1) .index(1)
.value_name("NONCE_ACCOUNT_ADDRESS") .value_name("NONCE_ACCOUNT_ADDRESS")
.takes_value(true) .required(true),
.required(true) "Address of the nonce account to display. "),
.validator(is_valid_pubkey)
.help("Address of the nonce account to display"),
), ),
) )
.subcommand( .subcommand(
SubCommand::with_name("new-nonce") SubCommand::with_name("new-nonce")
.about("Generate a new nonce, rendering the existing nonce useless") .about("Generate a new nonce, rendering the existing nonce useless")
.arg( .arg(
Arg::with_name("nonce_account_pubkey") pubkey!(Arg::with_name("nonce_account_pubkey")
.index(1) .index(1)
.value_name("NONCE_ACCOUNT_ADDRESS") .value_name("NONCE_ACCOUNT_ADDRESS")
.takes_value(true) .required(true),
.required(true) "Address of the nonce account. "),
.validator(is_valid_pubkey)
.help("Address of the nonce account"),
) )
.arg(nonce_authority_arg()), .arg(nonce_authority_arg()),
) )
@ -181,13 +171,11 @@ impl NonceSubCommands for App<'_, '_> {
.about("Show the contents of a nonce account") .about("Show the contents of a nonce account")
.alias("show-nonce-account") .alias("show-nonce-account")
.arg( .arg(
Arg::with_name("nonce_account_pubkey") pubkey!(Arg::with_name("nonce_account_pubkey")
.index(1) .index(1)
.value_name("NONCE_ACCOUNT_ADDRESS") .value_name("NONCE_ACCOUNT_ADDRESS")
.takes_value(true) .required(true),
.required(true) "Address of the nonce account to display. "),
.validator(is_valid_pubkey)
.help("Address of the nonce account to display"),
) )
.arg( .arg(
Arg::with_name("lamports") Arg::with_name("lamports")
@ -200,22 +188,18 @@ impl NonceSubCommands for App<'_, '_> {
SubCommand::with_name("withdraw-from-nonce-account") SubCommand::with_name("withdraw-from-nonce-account")
.about("Withdraw SOL from the nonce account") .about("Withdraw SOL from the nonce account")
.arg( .arg(
Arg::with_name("nonce_account_pubkey") pubkey!(Arg::with_name("nonce_account_pubkey")
.index(1) .index(1)
.value_name("NONCE_ACCOUNT_ADDRESS") .value_name("NONCE_ACCOUNT_ADDRESS")
.takes_value(true) .required(true),
.required(true) "Nonce account to withdraw from. "),
.validator(is_valid_pubkey)
.help("Nonce account to withdraw from"),
) )
.arg( .arg(
Arg::with_name("destination_account_pubkey") pubkey!(Arg::with_name("destination_account_pubkey")
.index(2) .index(2)
.value_name("RECIPIENT_ADDRESS") .value_name("RECIPIENT_ADDRESS")
.takes_value(true) .required(true),
.required(true) "The account to which the SOL should be transferred. "),
.validator(is_valid_pubkey)
.help("The account to which the SOL should be transferred"),
) )
.arg( .arg(
Arg::with_name("amount") Arg::with_name("amount")

View File

@ -89,12 +89,10 @@ impl StakeSubCommands for App<'_, '_> {
.help("The amount to send to the stake account, in SOL") .help("The amount to send to the stake account, in SOL")
) )
.arg( .arg(
Arg::with_name("custodian") pubkey!(Arg::with_name("custodian")
.long("custodian") .long("custodian")
.value_name("PUBKEY") .value_name("PUBKEY"),
.takes_value(true) "Authority to modify lockups. ")
.validator(is_valid_pubkey)
.help("Authority to modify lockups")
) )
.arg( .arg(
Arg::with_name("seed") Arg::with_name("seed")
@ -158,22 +156,18 @@ impl StakeSubCommands for App<'_, '_> {
.help("Override vote account sanity checks (use carefully!)") .help("Override vote account sanity checks (use carefully!)")
) )
.arg( .arg(
Arg::with_name("stake_account_pubkey") pubkey!(Arg::with_name("stake_account_pubkey")
.index(1) .index(1)
.value_name("STAKE_ACCOUNT_ADDRESS") .value_name("STAKE_ACCOUNT_ADDRESS")
.takes_value(true) .required(true),
.required(true) "Stake account to delegate")
.validator(is_valid_pubkey)
.help("Stake account to delegate")
) )
.arg( .arg(
Arg::with_name("vote_account_pubkey") pubkey!(Arg::with_name("vote_account_pubkey")
.index(2) .index(2)
.value_name("VOTE_ACCOUNT_ADDRESS") .value_name("VOTE_ACCOUNT_ADDRESS")
.takes_value(true) .required(true),
.required(true) "The vote account to which the stake will be delegated")
.validator(is_valid_pubkey)
.help("The vote account to which the stake will be delegated")
) )
.arg(stake_authority_arg()) .arg(stake_authority_arg())
.offline_args() .offline_args()
@ -185,31 +179,25 @@ impl StakeSubCommands for App<'_, '_> {
SubCommand::with_name("stake-authorize") SubCommand::with_name("stake-authorize")
.about("Authorize a new signing keypair for the given stake account") .about("Authorize a new signing keypair for the given stake account")
.arg( .arg(
Arg::with_name("stake_account_pubkey") pubkey!(Arg::with_name("stake_account_pubkey")
.required(true) .required(true)
.index(1) .index(1)
.takes_value(true) .value_name("STAKE_ACCOUNT_ADDRESS"),
.value_name("STAKE_ACCOUNT_ADDRESS") "Stake account in which to set a new authority. ")
.validator(is_valid_pubkey)
.help("Stake account in which to set a new authority")
) )
.arg( .arg(
Arg::with_name("new_stake_authority") pubkey!(Arg::with_name("new_stake_authority")
.long("new-stake-authority") .long("new-stake-authority")
.required_unless("new_withdraw_authority") .required_unless("new_withdraw_authority")
.takes_value(true) .value_name("PUBKEY"),
.value_name("PUBKEY") "New authorized staker")
.validator(is_valid_pubkey)
.help("New authorized staker")
) )
.arg( .arg(
Arg::with_name("new_withdraw_authority") pubkey!(Arg::with_name("new_withdraw_authority")
.long("new-withdraw-authority") .long("new-withdraw-authority")
.required_unless("new_stake_authority") .required_unless("new_stake_authority")
.takes_value(true) .value_name("PUBKEY"),
.value_name("PUBKEY") "New authorized withdrawer. ")
.validator(is_valid_pubkey)
.help("New authorized withdrawer")
) )
.arg(stake_authority_arg()) .arg(stake_authority_arg())
.arg(withdraw_authority_arg()) .arg(withdraw_authority_arg())
@ -222,13 +210,11 @@ impl StakeSubCommands for App<'_, '_> {
SubCommand::with_name("deactivate-stake") SubCommand::with_name("deactivate-stake")
.about("Deactivate the delegated stake from the stake account") .about("Deactivate the delegated stake from the stake account")
.arg( .arg(
Arg::with_name("stake_account_pubkey") pubkey!(Arg::with_name("stake_account_pubkey")
.index(1) .index(1)
.value_name("STAKE_ACCOUNT_ADDRESS") .value_name("STAKE_ACCOUNT_ADDRESS")
.takes_value(true) .required(true),
.required(true) "Stake account to be deactivated. ")
.validator(is_valid_pubkey)
.help("Stake account to be deactivated.")
) )
.arg(stake_authority_arg()) .arg(stake_authority_arg())
.offline_args() .offline_args()
@ -240,13 +226,11 @@ impl StakeSubCommands for App<'_, '_> {
SubCommand::with_name("split-stake") SubCommand::with_name("split-stake")
.about("Duplicate a stake account, splitting the tokens between the two") .about("Duplicate a stake account, splitting the tokens between the two")
.arg( .arg(
Arg::with_name("stake_account_pubkey") pubkey!(Arg::with_name("stake_account_pubkey")
.index(1) .index(1)
.value_name("STAKE_ACCOUNT_ADDRESS") .value_name("STAKE_ACCOUNT_ADDRESS")
.takes_value(true) .required(true),
.required(true) "Stake account to split (or base of derived address if --seed is used). ")
.validator(is_valid_pubkey)
.help("Stake account to split (or base of derived address if --seed is used)")
) )
.arg( .arg(
Arg::with_name("split_stake_account") Arg::with_name("split_stake_account")
@ -283,22 +267,18 @@ impl StakeSubCommands for App<'_, '_> {
SubCommand::with_name("withdraw-stake") SubCommand::with_name("withdraw-stake")
.about("Withdraw the unstaked SOL from the stake account") .about("Withdraw the unstaked SOL from the stake account")
.arg( .arg(
Arg::with_name("stake_account_pubkey") pubkey!(Arg::with_name("stake_account_pubkey")
.index(1) .index(1)
.value_name("STAKE_ACCOUNT_ADDRESS") .value_name("STAKE_ACCOUNT_ADDRESS")
.takes_value(true) .required(true),
.required(true) "Stake account from which to withdraw")
.validator(is_valid_pubkey)
.help("Stake account from which to withdraw")
) )
.arg( .arg(
Arg::with_name("destination_account_pubkey") pubkey!(Arg::with_name("destination_account_pubkey")
.index(2) .index(2)
.value_name("RECIPIENT_ADDRESS") .value_name("RECIPIENT_ADDRESS")
.takes_value(true) .required(true),
.required(true) "Recipient of withdrawn SOL")
.validator(is_valid_pubkey)
.help("Recipient of withdrawn SOL")
) )
.arg( .arg(
Arg::with_name("amount") Arg::with_name("amount")
@ -319,13 +299,11 @@ impl StakeSubCommands for App<'_, '_> {
SubCommand::with_name("stake-set-lockup") SubCommand::with_name("stake-set-lockup")
.about("Set Lockup for the stake account") .about("Set Lockup for the stake account")
.arg( .arg(
Arg::with_name("stake_account_pubkey") pubkey!(Arg::with_name("stake_account_pubkey")
.index(1) .index(1)
.value_name("STAKE_ACCOUNT_ADDRESS") .value_name("STAKE_ACCOUNT_ADDRESS")
.takes_value(true) .required(true),
.required(true) "Stake account for which to set lockup parameters. ")
.validator(is_valid_pubkey)
.help("Stake account for which to set lockup parameters")
) )
.arg( .arg(
Arg::with_name("lockup_epoch") Arg::with_name("lockup_epoch")
@ -343,12 +321,10 @@ impl StakeSubCommands for App<'_, '_> {
.help("The date and time at which this account will be available for withdrawal") .help("The date and time at which this account will be available for withdrawal")
) )
.arg( .arg(
Arg::with_name("new_custodian") pubkey!(Arg::with_name("new_custodian")
.long("new-custodian") .long("new-custodian")
.value_name("PUBKEY") .value_name("PUBKEY"),
.takes_value(true) "Identity of a new lockup custodian. ")
.validator(is_valid_pubkey)
.help("Identity of a new lockup custodian")
) )
.group(ArgGroup::with_name("lockup_details") .group(ArgGroup::with_name("lockup_details")
.args(&["lockup_epoch", "lockup_date", "new_custodian"]) .args(&["lockup_epoch", "lockup_date", "new_custodian"])
@ -371,13 +347,11 @@ impl StakeSubCommands for App<'_, '_> {
.about("Show the contents of a stake account") .about("Show the contents of a stake account")
.alias("show-stake-account") .alias("show-stake-account")
.arg( .arg(
Arg::with_name("stake_account_pubkey") pubkey!(Arg::with_name("stake_account_pubkey")
.index(1) .index(1)
.value_name("STAKE_ACCOUNT_ADDRESS") .value_name("STAKE_ACCOUNT_ADDRESS")
.takes_value(true) .required(true),
.required(true) "The stake account to display. ")
.validator(is_valid_pubkey)
.help("The stake account to display")
) )
.arg( .arg(
Arg::with_name("lamports") Arg::with_name("lamports")

View File

@ -53,20 +53,16 @@ impl VoteSubCommands for App<'_, '_> {
.help("The commission taken on reward redemption (0-100)"), .help("The commission taken on reward redemption (0-100)"),
) )
.arg( .arg(
Arg::with_name("authorized_voter") pubkey!(Arg::with_name("authorized_voter")
.long("authorized-voter") .long("authorized-voter")
.value_name("VOTER_PUBKEY") .value_name("VOTER_PUBKEY"),
.takes_value(true) "Public key of the authorized voter [default: validator identity pubkey]. "),
.validator(is_valid_pubkey)
.help("Public key of the authorized voter [default: validator identity pubkey]"),
) )
.arg( .arg(
Arg::with_name("authorized_withdrawer") pubkey!(Arg::with_name("authorized_withdrawer")
.long("authorized-withdrawer") .long("authorized-withdrawer")
.value_name("WITHDRAWER_PUBKEY") .value_name("WITHDRAWER_PUBKEY"),
.takes_value(true) "Public key of the authorized withdrawer [default: validator identity pubkey]. "),
.validator(is_valid_pubkey)
.help("Public key of the authorized withdrawer [default: validator identity pubkey]"),
) )
.arg( .arg(
Arg::with_name("seed") Arg::with_name("seed")
@ -80,57 +76,47 @@ impl VoteSubCommands for App<'_, '_> {
SubCommand::with_name("vote-authorize-voter") SubCommand::with_name("vote-authorize-voter")
.about("Authorize a new vote signing keypair for the given vote account") .about("Authorize a new vote signing keypair for the given vote account")
.arg( .arg(
Arg::with_name("vote_account_pubkey") pubkey!(Arg::with_name("vote_account_pubkey")
.index(1) .index(1)
.value_name("VOTE_ACCOUNT_ADDRESS") .value_name("VOTE_ACCOUNT_ADDRESS")
.takes_value(true) .required(true),
.required(true) "Vote account in which to set the authorized voter. "),
.validator(is_valid_pubkey)
.help("Vote account in which to set the authorized voter"),
) )
.arg( .arg(
Arg::with_name("new_authorized_pubkey") pubkey!(Arg::with_name("new_authorized_pubkey")
.index(2) .index(2)
.value_name("AUTHORIZED_PUBKEY") .value_name("AUTHORIZED_PUBKEY")
.takes_value(true) .required(true),
.required(true) "New authorized vote signer. "),
.validator(is_valid_pubkey)
.help("New authorized vote signer"),
), ),
) )
.subcommand( .subcommand(
SubCommand::with_name("vote-authorize-withdrawer") SubCommand::with_name("vote-authorize-withdrawer")
.about("Authorize a new withdraw signing keypair for the given vote account") .about("Authorize a new withdraw signing keypair for the given vote account")
.arg( .arg(
Arg::with_name("vote_account_pubkey") pubkey!(Arg::with_name("vote_account_pubkey")
.index(1) .index(1)
.value_name("VOTE_ACCOUNT_ADDRESS") .value_name("VOTE_ACCOUNT_ADDRESS")
.takes_value(true) .required(true),
.required(true) "Vote account in which to set the authorized withdrawer. "),
.validator(is_valid_pubkey)
.help("Vote account in which to set the authorized withdrawer"),
) )
.arg( .arg(
Arg::with_name("new_authorized_pubkey") pubkey!(Arg::with_name("new_authorized_pubkey")
.index(2) .index(2)
.value_name("AUTHORIZED_PUBKEY") .value_name("AUTHORIZED_PUBKEY")
.takes_value(true) .required(true),
.required(true) "New authorized withdrawer. "),
.validator(is_valid_pubkey)
.help("New authorized withdrawer"),
), ),
) )
.subcommand( .subcommand(
SubCommand::with_name("vote-update-validator") SubCommand::with_name("vote-update-validator")
.about("Update the vote account's validator identity") .about("Update the vote account's validator identity")
.arg( .arg(
Arg::with_name("vote_account_pubkey") pubkey!(Arg::with_name("vote_account_pubkey")
.index(1) .index(1)
.value_name("VOTE_ACCOUNT_ADDRESS") .value_name("VOTE_ACCOUNT_ADDRESS")
.takes_value(true) .required(true),
.required(true) "Vote account to update. "),
.validator(is_valid_pubkey)
.help("Vote account to update"),
) )
.arg( .arg(
Arg::with_name("new_identity_account") Arg::with_name("new_identity_account")
@ -164,13 +150,11 @@ impl VoteSubCommands for App<'_, '_> {
), ),
) )
.arg( .arg(
Arg::with_name("vote_account_pubkey") pubkey!(Arg::with_name("vote_account_pubkey")
.index(1) .index(1)
.value_name("VOTE_ACCOUNT_ADDRESS") .value_name("VOTE_ACCOUNT_ADDRESS")
.takes_value(true) .required(true),
.required(true) "Vote account pubkey. "),
.validator(is_valid_pubkey)
.help("Vote account pubkey"),
) )
.arg( .arg(
Arg::with_name("lamports") Arg::with_name("lamports")
@ -183,22 +167,18 @@ impl VoteSubCommands for App<'_, '_> {
SubCommand::with_name("withdraw-from-vote-account") SubCommand::with_name("withdraw-from-vote-account")
.about("Withdraw lamports from a vote account into a specified account") .about("Withdraw lamports from a vote account into a specified account")
.arg( .arg(
Arg::with_name("vote_account_pubkey") pubkey!(Arg::with_name("vote_account_pubkey")
.index(1) .index(1)
.value_name("VOTE_ACCOUNT_ADDRESS") .value_name("VOTE_ACCOUNT_ADDRESS")
.takes_value(true) .required(true),
.required(true) "Vote account from which to withdraw. "),
.validator(is_valid_pubkey)
.help("Vote account from which to withdraw"),
) )
.arg( .arg(
Arg::with_name("destination_account_pubkey") pubkey!(Arg::with_name("destination_account_pubkey")
.index(2) .index(2)
.value_name("RECIPIENT_ADDRESS") .value_name("RECIPIENT_ADDRESS")
.takes_value(true) .required(true),
.required(true) "The recipient of withdrawn SOL. "),
.validator(is_valid_pubkey)
.help("The recipient of withdrawn SOL"),
) )
.arg( .arg(
Arg::with_name("amount") Arg::with_name("amount")