Add ALL support to withdraw-stake subcommand

This commit is contained in:
Michael Vines
2021-04-26 08:33:56 -07:00
parent 9706512115
commit cf779c63c5
3 changed files with 52 additions and 37 deletions

View File

@@ -292,7 +292,7 @@ pub enum CliCommand {
WithdrawStake {
stake_account_pubkey: Pubkey,
destination_account_pubkey: Pubkey,
lamports: u64,
amount: SpendAmount,
withdraw_authority: SignerIndex,
custodian: Option<SignerIndex>,
sign_only: bool,
@@ -710,7 +710,7 @@ pub fn parse_command(
}
// Stake Commands
("create-stake-account", Some(matches)) => {
parse_stake_create_account(matches, default_signer, wallet_manager)
parse_create_stake_account(matches, default_signer, wallet_manager)
}
("delegate-stake", Some(matches)) => {
parse_stake_delegate_stake(matches, default_signer, wallet_manager)
@@ -1721,7 +1721,7 @@ pub fn process_command(config: &CliConfig) -> ProcessResult {
CliCommand::WithdrawStake {
stake_account_pubkey,
destination_account_pubkey,
lamports,
amount,
withdraw_authority,
custodian,
sign_only,
@@ -1737,7 +1737,7 @@ pub fn process_command(config: &CliConfig) -> ProcessResult {
config,
&stake_account_pubkey,
&destination_account_pubkey,
*lamports,
*amount,
*withdraw_authority,
*custodian,
*sign_only,
@@ -2683,7 +2683,7 @@ mod tests {
config.command = CliCommand::WithdrawStake {
stake_account_pubkey,
destination_account_pubkey: to_pubkey,
lamports: 100,
amount: SpendAmount::All,
withdraw_authority: 0,
custodian: None,
sign_only: false,
@@ -2752,7 +2752,7 @@ mod tests {
};
config.signers = vec![&keypair, &merge_stake_account];
let result = process_command(&config);
assert!(dbg!(result).is_ok());
assert!(result.is_ok());
config.command = CliCommand::GetSlot;
assert_eq!(process_command(&config).unwrap(), "0");