Cli: add subcommand to withdraw from vote account (#8550)

* feat: cli command for vote account withdraw

* Rework names

* Update to flexible signer, and make consistent with other cli apis

* Add integration test

* Clean up default help msg

Co-authored-by: Michael Vines <mvines@gmail.com>
Co-authored-by: Tyera Eulberg <tyera@solana.com>
This commit is contained in:
Sunny Gleason
2020-03-13 16:30:04 -04:00
committed by GitHub
parent b7b36bb0a4
commit 96a61cc4e4
5 changed files with 305 additions and 39 deletions

View File

@ -364,6 +364,12 @@ pub enum CliCommand {
use_lamports_unit: bool,
commitment_config: CommitmentConfig,
},
WithdrawFromVoteAccount {
vote_account_pubkey: Pubkey,
destination_account_pubkey: Pubkey,
withdraw_authority: SignerIndex,
lamports: u64,
},
VoteAuthorize {
vote_account_pubkey: Pubkey,
new_authorized_pubkey: Pubkey,
@ -696,6 +702,9 @@ pub fn parse_command(
VoteAuthorize::Withdrawer,
),
("vote-account", Some(matches)) => parse_vote_get_account_command(matches),
("withdraw-from-vote-account", Some(matches)) => {
parse_withdraw_from_vote_account(matches, default_signer_path, wallet_manager)
}
// Wallet Commands
("address", Some(matches)) => Ok(CliCommandInfo {
command: CliCommand::Address,
@ -1924,6 +1933,19 @@ pub fn process_command(config: &CliConfig) -> ProcessResult {
*use_lamports_unit,
*commitment_config,
),
CliCommand::WithdrawFromVoteAccount {
vote_account_pubkey,
withdraw_authority,
lamports,
destination_account_pubkey,
} => process_withdraw_from_vote_account(
&rpc_client,
config,
vote_account_pubkey,
*withdraw_authority,
*lamports,
destination_account_pubkey,
),
CliCommand::VoteAuthorize {
vote_account_pubkey,
new_authorized_pubkey,
@ -2288,7 +2310,7 @@ pub fn app<'ab, 'v>(name: &str, about: &'ab str, version: &'v str) -> App<'ab, '
.takes_value(true)
.required(false)
.validator(is_valid_signer)
.help("From (base) key, defaults to client keypair."),
.help("From (base) key, [default: cli config keypair]"),
),
)
.subcommand(