|
|
@@ -5,12 +5,14 @@ use {
|
|
|
log_instruction_custom_error, CliCommand, CliCommandInfo, CliConfig, CliError,
|
|
|
ProcessResult,
|
|
|
},
|
|
|
+ compute_unit_price::WithComputeUnitPrice,
|
|
|
memo::WithMemo,
|
|
|
nonce::check_nonce_account,
|
|
|
spend_utils::{resolve_spend_tx_and_check_account_balances, SpendAmount},
|
|
|
},
|
|
|
clap::{value_t, App, Arg, ArgGroup, ArgMatches, SubCommand},
|
|
|
solana_clap_utils::{
|
|
|
+ compute_unit_price::{compute_unit_price_arg, COMPUTE_UNIT_PRICE_ARG},
|
|
|
fee_payer::{fee_payer_arg, FEE_PAYER_ARG},
|
|
|
input_parsers::*,
|
|
|
input_validators::*,
|
|
|
@@ -196,6 +198,7 @@ impl StakeSubCommands for App<'_, '_> {
|
|
|
.nonce_args(false)
|
|
|
.arg(fee_payer_arg())
|
|
|
.arg(memo_arg())
|
|
|
+ .arg(compute_unit_price_arg())
|
|
|
)
|
|
|
.subcommand(
|
|
|
SubCommand::with_name("create-stake-account-checked")
|
|
|
@@ -254,6 +257,7 @@ impl StakeSubCommands for App<'_, '_> {
|
|
|
.nonce_args(false)
|
|
|
.arg(fee_payer_arg())
|
|
|
.arg(memo_arg())
|
|
|
+ .arg(compute_unit_price_arg())
|
|
|
)
|
|
|
.subcommand(
|
|
|
SubCommand::with_name("delegate-stake")
|
|
|
@@ -284,6 +288,7 @@ impl StakeSubCommands for App<'_, '_> {
|
|
|
.nonce_args(false)
|
|
|
.arg(fee_payer_arg())
|
|
|
.arg(memo_arg())
|
|
|
+ .arg(compute_unit_price_arg())
|
|
|
)
|
|
|
.subcommand(
|
|
|
SubCommand::with_name("redelegate-stake")
|
|
|
@@ -367,6 +372,7 @@ impl StakeSubCommands for App<'_, '_> {
|
|
|
.help("Return signature immediately after submitting the transaction, instead of waiting for confirmations"),
|
|
|
)
|
|
|
.arg(memo_arg())
|
|
|
+ .arg(compute_unit_price_arg())
|
|
|
)
|
|
|
.subcommand(
|
|
|
SubCommand::with_name("stake-authorize-checked")
|
|
|
@@ -407,6 +413,7 @@ impl StakeSubCommands for App<'_, '_> {
|
|
|
.help("Return signature immediately after submitting the transaction, instead of waiting for confirmations"),
|
|
|
)
|
|
|
.arg(memo_arg())
|
|
|
+ .arg(compute_unit_price_arg())
|
|
|
)
|
|
|
.subcommand(
|
|
|
SubCommand::with_name("deactivate-stake")
|
|
|
@@ -438,6 +445,7 @@ impl StakeSubCommands for App<'_, '_> {
|
|
|
.nonce_args(false)
|
|
|
.arg(fee_payer_arg())
|
|
|
.arg(memo_arg())
|
|
|
+ .arg(compute_unit_price_arg())
|
|
|
)
|
|
|
.subcommand(
|
|
|
SubCommand::with_name("split-stake")
|
|
|
@@ -480,6 +488,7 @@ impl StakeSubCommands for App<'_, '_> {
|
|
|
.nonce_args(false)
|
|
|
.arg(fee_payer_arg())
|
|
|
.arg(memo_arg())
|
|
|
+ .arg(compute_unit_price_arg())
|
|
|
)
|
|
|
.subcommand(
|
|
|
SubCommand::with_name("merge-stake")
|
|
|
@@ -504,6 +513,7 @@ impl StakeSubCommands for App<'_, '_> {
|
|
|
.nonce_args(false)
|
|
|
.arg(fee_payer_arg())
|
|
|
.arg(memo_arg())
|
|
|
+ .arg(compute_unit_price_arg())
|
|
|
)
|
|
|
.subcommand(
|
|
|
SubCommand::with_name("withdraw-stake")
|
|
|
@@ -545,6 +555,7 @@ impl StakeSubCommands for App<'_, '_> {
|
|
|
.arg(fee_payer_arg())
|
|
|
.arg(custodian_arg())
|
|
|
.arg(memo_arg())
|
|
|
+ .arg(compute_unit_price_arg())
|
|
|
)
|
|
|
.subcommand(
|
|
|
SubCommand::with_name("stake-set-lockup")
|
|
|
@@ -593,6 +604,7 @@ impl StakeSubCommands for App<'_, '_> {
|
|
|
.nonce_args(false)
|
|
|
.arg(fee_payer_arg())
|
|
|
.arg(memo_arg())
|
|
|
+ .arg(compute_unit_price_arg())
|
|
|
)
|
|
|
.subcommand(
|
|
|
SubCommand::with_name("stake-set-lockup-checked")
|
|
|
@@ -643,6 +655,7 @@ impl StakeSubCommands for App<'_, '_> {
|
|
|
.nonce_args(false)
|
|
|
.arg(fee_payer_arg())
|
|
|
.arg(memo_arg())
|
|
|
+ .arg(compute_unit_price_arg())
|
|
|
)
|
|
|
.subcommand(
|
|
|
SubCommand::with_name("stake-account")
|
|
|
@@ -758,6 +771,7 @@ pub fn parse_create_stake_account(
|
|
|
}
|
|
|
let signer_info =
|
|
|
default_signer.generate_unique_signers(bulk_signers, matches, wallet_manager)?;
|
|
|
+ let compute_unit_price = value_of(matches, COMPUTE_UNIT_PRICE_ARG.name);
|
|
|
|
|
|
Ok(CliCommandInfo {
|
|
|
command: CliCommand::CreateStakeAccount {
|
|
|
@@ -784,6 +798,7 @@ pub fn parse_create_stake_account(
|
|
|
memo,
|
|
|
fee_payer: signer_info.index_of(fee_payer_pubkey).unwrap(),
|
|
|
from: signer_info.index_of(from_pubkey).unwrap(),
|
|
|
+ compute_unit_price,
|
|
|
},
|
|
|
signers: signer_info.signers,
|
|
|
})
|
|
|
@@ -818,6 +833,7 @@ pub fn parse_stake_delegate_stake(
|
|
|
}
|
|
|
let signer_info =
|
|
|
default_signer.generate_unique_signers(bulk_signers, matches, wallet_manager)?;
|
|
|
+ let compute_unit_price = value_of(matches, COMPUTE_UNIT_PRICE_ARG.name);
|
|
|
|
|
|
Ok(CliCommandInfo {
|
|
|
command: CliCommand::DelegateStake {
|
|
|
@@ -833,6 +849,7 @@ pub fn parse_stake_delegate_stake(
|
|
|
memo,
|
|
|
fee_payer: signer_info.index_of(fee_payer_pubkey).unwrap(),
|
|
|
redelegation_stake_account_pubkey,
|
|
|
+ compute_unit_price,
|
|
|
},
|
|
|
signers: signer_info.signers,
|
|
|
})
|
|
|
@@ -923,6 +940,7 @@ pub fn parse_stake_authorize(
|
|
|
}
|
|
|
let signer_info =
|
|
|
default_signer.generate_unique_signers(bulk_signers, matches, wallet_manager)?;
|
|
|
+ let compute_unit_price = value_of(matches, COMPUTE_UNIT_PRICE_ARG.name);
|
|
|
|
|
|
let new_authorizations = new_authorizations
|
|
|
.into_iter()
|
|
|
@@ -955,6 +973,7 @@ pub fn parse_stake_authorize(
|
|
|
fee_payer: signer_info.index_of(fee_payer_pubkey).unwrap(),
|
|
|
custodian: custodian_pubkey.and_then(|_| signer_info.index_of(custodian_pubkey)),
|
|
|
no_wait,
|
|
|
+ compute_unit_price,
|
|
|
},
|
|
|
signers: signer_info.signers,
|
|
|
})
|
|
|
@@ -989,6 +1008,7 @@ pub fn parse_split_stake(
|
|
|
}
|
|
|
let signer_info =
|
|
|
default_signer.generate_unique_signers(bulk_signers, matches, wallet_manager)?;
|
|
|
+ let compute_unit_price = value_of(matches, COMPUTE_UNIT_PRICE_ARG.name);
|
|
|
|
|
|
Ok(CliCommandInfo {
|
|
|
command: CliCommand::SplitStake {
|
|
|
@@ -1004,6 +1024,7 @@ pub fn parse_split_stake(
|
|
|
seed,
|
|
|
lamports,
|
|
|
fee_payer: signer_info.index_of(fee_payer_pubkey).unwrap(),
|
|
|
+ compute_unit_price,
|
|
|
},
|
|
|
signers: signer_info.signers,
|
|
|
})
|
|
|
@@ -1036,6 +1057,7 @@ pub fn parse_merge_stake(
|
|
|
}
|
|
|
let signer_info =
|
|
|
default_signer.generate_unique_signers(bulk_signers, matches, wallet_manager)?;
|
|
|
+ let compute_unit_price = value_of(matches, COMPUTE_UNIT_PRICE_ARG.name);
|
|
|
|
|
|
Ok(CliCommandInfo {
|
|
|
command: CliCommand::MergeStake {
|
|
|
@@ -1049,6 +1071,7 @@ pub fn parse_merge_stake(
|
|
|
nonce_authority: signer_info.index_of(nonce_authority_pubkey).unwrap(),
|
|
|
memo,
|
|
|
fee_payer: signer_info.index_of(fee_payer_pubkey).unwrap(),
|
|
|
+ compute_unit_price,
|
|
|
},
|
|
|
signers: signer_info.signers,
|
|
|
})
|
|
|
@@ -1081,6 +1104,7 @@ pub fn parse_stake_deactivate_stake(
|
|
|
}
|
|
|
let signer_info =
|
|
|
default_signer.generate_unique_signers(bulk_signers, matches, wallet_manager)?;
|
|
|
+ let compute_unit_price = value_of(matches, COMPUTE_UNIT_PRICE_ARG.name);
|
|
|
|
|
|
Ok(CliCommandInfo {
|
|
|
command: CliCommand::DeactivateStake {
|
|
|
@@ -1095,6 +1119,7 @@ pub fn parse_stake_deactivate_stake(
|
|
|
memo,
|
|
|
seed,
|
|
|
fee_payer: signer_info.index_of(fee_payer_pubkey).unwrap(),
|
|
|
+ compute_unit_price,
|
|
|
},
|
|
|
signers: signer_info.signers,
|
|
|
})
|
|
|
@@ -1132,6 +1157,7 @@ pub fn parse_stake_withdraw_stake(
|
|
|
}
|
|
|
let signer_info =
|
|
|
default_signer.generate_unique_signers(bulk_signers, matches, wallet_manager)?;
|
|
|
+ let compute_unit_price = value_of(matches, COMPUTE_UNIT_PRICE_ARG.name);
|
|
|
|
|
|
Ok(CliCommandInfo {
|
|
|
command: CliCommand::WithdrawStake {
|
|
|
@@ -1148,6 +1174,7 @@ pub fn parse_stake_withdraw_stake(
|
|
|
seed,
|
|
|
fee_payer: signer_info.index_of(fee_payer_pubkey).unwrap(),
|
|
|
custodian: custodian_pubkey.and_then(|_| signer_info.index_of(custodian_pubkey)),
|
|
|
+ compute_unit_price,
|
|
|
},
|
|
|
signers: signer_info.signers,
|
|
|
})
|
|
|
@@ -1193,6 +1220,7 @@ pub fn parse_stake_set_lockup(
|
|
|
}
|
|
|
let signer_info =
|
|
|
default_signer.generate_unique_signers(bulk_signers, matches, wallet_manager)?;
|
|
|
+ let compute_unit_price = value_of(matches, COMPUTE_UNIT_PRICE_ARG.name);
|
|
|
|
|
|
Ok(CliCommandInfo {
|
|
|
command: CliCommand::StakeSetLockup {
|
|
|
@@ -1215,6 +1243,7 @@ pub fn parse_stake_set_lockup(
|
|
|
nonce_authority: signer_info.index_of(nonce_authority_pubkey).unwrap(),
|
|
|
memo,
|
|
|
fee_payer: signer_info.index_of(fee_payer_pubkey).unwrap(),
|
|
|
+ compute_unit_price,
|
|
|
},
|
|
|
signers: signer_info.signers,
|
|
|
})
|
|
|
@@ -1283,6 +1312,7 @@ pub fn process_create_stake_account(
|
|
|
memo: Option<&String>,
|
|
|
fee_payer: SignerIndex,
|
|
|
from: SignerIndex,
|
|
|
+ compute_unit_price: Option<&u64>,
|
|
|
) -> ProcessResult {
|
|
|
let stake_account = config.signers[stake_account];
|
|
|
let stake_account_address = if let Some(seed) = seed {
|
|
|
@@ -1339,7 +1369,8 @@ pub fn process_create_stake_account(
|
|
|
lamports,
|
|
|
),
|
|
|
}
|
|
|
- .with_memo(memo);
|
|
|
+ .with_memo(memo)
|
|
|
+ .with_compute_unit_price(compute_unit_price);
|
|
|
if let Some(nonce_account) = &nonce_account {
|
|
|
Message::new_with_nonce(
|
|
|
ixs,
|
|
|
@@ -1431,6 +1462,7 @@ pub fn process_stake_authorize(
|
|
|
memo: Option<&String>,
|
|
|
fee_payer: SignerIndex,
|
|
|
no_wait: bool,
|
|
|
+ compute_unit_price: Option<&u64>,
|
|
|
) -> ProcessResult {
|
|
|
let mut ixs = Vec::new();
|
|
|
let custodian = custodian.map(|index| config.signers[index]);
|
|
|
@@ -1497,7 +1529,9 @@ pub fn process_stake_authorize(
|
|
|
));
|
|
|
}
|
|
|
}
|
|
|
- ixs = ixs.with_memo(memo);
|
|
|
+ ixs = ixs
|
|
|
+ .with_memo(memo)
|
|
|
+ .with_compute_unit_price(compute_unit_price);
|
|
|
|
|
|
let recent_blockhash = blockhash_query.get_blockhash(rpc_client, config.commitment)?;
|
|
|
|
|
|
@@ -1565,6 +1599,7 @@ pub fn process_deactivate_stake_account(
|
|
|
memo: Option<&String>,
|
|
|
seed: Option<&String>,
|
|
|
fee_payer: SignerIndex,
|
|
|
+ compute_unit_price: Option<&u64>,
|
|
|
) -> ProcessResult {
|
|
|
let recent_blockhash = blockhash_query.get_blockhash(rpc_client, config.commitment)?;
|
|
|
|
|
|
@@ -1643,7 +1678,8 @@ pub fn process_deactivate_stake_account(
|
|
|
let stake_authority = config.signers[stake_authority];
|
|
|
stake_instruction::deactivate_stake(&stake_account_address, &stake_authority.pubkey())
|
|
|
}]
|
|
|
- .with_memo(memo);
|
|
|
+ .with_memo(memo)
|
|
|
+ .with_compute_unit_price(compute_unit_price);
|
|
|
|
|
|
let nonce_authority = config.signers[nonce_authority];
|
|
|
let fee_payer = config.signers[fee_payer];
|
|
|
@@ -1707,6 +1743,7 @@ pub fn process_withdraw_stake(
|
|
|
memo: Option<&String>,
|
|
|
seed: Option<&String>,
|
|
|
fee_payer: SignerIndex,
|
|
|
+ compute_unit_price: Option<&u64>,
|
|
|
) -> ProcessResult {
|
|
|
let withdraw_authority = config.signers[withdraw_authority];
|
|
|
let custodian = custodian.map(|index| config.signers[index]);
|
|
|
@@ -1730,7 +1767,8 @@ pub fn process_withdraw_stake(
|
|
|
lamports,
|
|
|
custodian.map(|signer| signer.pubkey()).as_ref(),
|
|
|
)]
|
|
|
- .with_memo(memo);
|
|
|
+ .with_memo(memo)
|
|
|
+ .with_compute_unit_price(compute_unit_price);
|
|
|
|
|
|
if let Some(nonce_account) = &nonce_account {
|
|
|
Message::new_with_nonce(
|
|
|
@@ -1803,6 +1841,7 @@ pub fn process_split_stake(
|
|
|
split_stake_account_seed: &Option<String>,
|
|
|
lamports: u64,
|
|
|
fee_payer: SignerIndex,
|
|
|
+ compute_unit_price: Option<&u64>,
|
|
|
) -> ProcessResult {
|
|
|
let split_stake_account = config.signers[split_stake_account];
|
|
|
let fee_payer = config.signers[fee_payer];
|
|
|
@@ -1876,6 +1915,7 @@ pub fn process_split_stake(
|
|
|
seed,
|
|
|
)
|
|
|
.with_memo(memo)
|
|
|
+ .with_compute_unit_price(compute_unit_price)
|
|
|
} else {
|
|
|
stake_instruction::split(
|
|
|
stake_account_pubkey,
|
|
|
@@ -1884,6 +1924,7 @@ pub fn process_split_stake(
|
|
|
&split_stake_account_address,
|
|
|
)
|
|
|
.with_memo(memo)
|
|
|
+ .with_compute_unit_price(compute_unit_price)
|
|
|
};
|
|
|
|
|
|
let nonce_authority = config.signers[nonce_authority];
|
|
|
@@ -1944,6 +1985,7 @@ pub fn process_merge_stake(
|
|
|
nonce_authority: SignerIndex,
|
|
|
memo: Option<&String>,
|
|
|
fee_payer: SignerIndex,
|
|
|
+ compute_unit_price: Option<&u64>,
|
|
|
) -> ProcessResult {
|
|
|
let fee_payer = config.signers[fee_payer];
|
|
|
|
|
|
@@ -1989,7 +2031,8 @@ pub fn process_merge_stake(
|
|
|
source_stake_account_pubkey,
|
|
|
&stake_authority.pubkey(),
|
|
|
)
|
|
|
- .with_memo(memo);
|
|
|
+ .with_memo(memo)
|
|
|
+ .with_compute_unit_price(compute_unit_price);
|
|
|
|
|
|
let nonce_authority = config.signers[nonce_authority];
|
|
|
|
|
|
@@ -2054,6 +2097,7 @@ pub fn process_stake_set_lockup(
|
|
|
nonce_authority: SignerIndex,
|
|
|
memo: Option<&String>,
|
|
|
fee_payer: SignerIndex,
|
|
|
+ compute_unit_price: Option<&u64>,
|
|
|
) -> ProcessResult {
|
|
|
let recent_blockhash = blockhash_query.get_blockhash(rpc_client, config.commitment)?;
|
|
|
let custodian = config.signers[custodian];
|
|
|
@@ -2063,7 +2107,8 @@ pub fn process_stake_set_lockup(
|
|
|
} else {
|
|
|
stake_instruction::set_lockup(stake_account_pubkey, lockup, &custodian.pubkey())
|
|
|
}]
|
|
|
- .with_memo(memo);
|
|
|
+ .with_memo(memo)
|
|
|
+ .with_compute_unit_price(compute_unit_price);
|
|
|
let nonce_authority = config.signers[nonce_authority];
|
|
|
let fee_payer = config.signers[fee_payer];
|
|
|
|
|
|
@@ -2463,6 +2508,7 @@ pub fn process_delegate_stake(
|
|
|
memo: Option<&String>,
|
|
|
fee_payer: SignerIndex,
|
|
|
redelegation_stake_account_pubkey: Option<&Pubkey>,
|
|
|
+ compute_unit_price: Option<&u64>,
|
|
|
) -> ProcessResult {
|
|
|
check_unique_pubkeys(
|
|
|
(&config.signers[0].pubkey(), "cli keypair".to_string()),
|
|
|
@@ -2550,7 +2596,8 @@ pub fn process_delegate_stake(
|
|
|
vote_account_pubkey,
|
|
|
)]
|
|
|
}
|
|
|
- .with_memo(memo);
|
|
|
+ .with_memo(memo)
|
|
|
+ .with_compute_unit_price(compute_unit_price);
|
|
|
|
|
|
let nonce_authority = config.signers[nonce_authority];
|
|
|
let fee_payer = config.signers[fee_payer];
|
|
|
@@ -2701,6 +2748,7 @@ mod tests {
|
|
|
fee_payer: 0,
|
|
|
custodian: None,
|
|
|
no_wait: false,
|
|
|
+ compute_unit_price: None,
|
|
|
},
|
|
|
signers: vec![read_keypair_file(&default_keypair_file).unwrap().into(),],
|
|
|
},
|
|
|
@@ -2749,6 +2797,7 @@ mod tests {
|
|
|
fee_payer: 0,
|
|
|
custodian: None,
|
|
|
no_wait: false,
|
|
|
+ compute_unit_price: None,
|
|
|
},
|
|
|
signers: vec![
|
|
|
read_keypair_file(&default_keypair_file).unwrap().into(),
|
|
|
@@ -2801,6 +2850,7 @@ mod tests {
|
|
|
fee_payer: 0,
|
|
|
custodian: None,
|
|
|
no_wait: false,
|
|
|
+ compute_unit_price: None,
|
|
|
},
|
|
|
signers: vec![
|
|
|
read_keypair_file(&default_keypair_file).unwrap().into(),
|
|
|
@@ -2837,6 +2887,7 @@ mod tests {
|
|
|
fee_payer: 0,
|
|
|
custodian: None,
|
|
|
no_wait: false,
|
|
|
+ compute_unit_price: None,
|
|
|
},
|
|
|
signers: vec![read_keypair_file(&default_keypair_file).unwrap().into(),],
|
|
|
},
|
|
|
@@ -2870,6 +2921,7 @@ mod tests {
|
|
|
fee_payer: 0,
|
|
|
custodian: None,
|
|
|
no_wait: false,
|
|
|
+ compute_unit_price: None,
|
|
|
},
|
|
|
signers: vec![
|
|
|
read_keypair_file(&default_keypair_file).unwrap().into(),
|
|
|
@@ -2909,6 +2961,7 @@ mod tests {
|
|
|
fee_payer: 0,
|
|
|
custodian: None,
|
|
|
no_wait: false,
|
|
|
+ compute_unit_price: None,
|
|
|
},
|
|
|
signers: vec![
|
|
|
read_keypair_file(&default_keypair_file).unwrap().into(),
|
|
|
@@ -2945,6 +2998,7 @@ mod tests {
|
|
|
fee_payer: 0,
|
|
|
custodian: None,
|
|
|
no_wait: false,
|
|
|
+ compute_unit_price: None,
|
|
|
},
|
|
|
signers: vec![read_keypair_file(&default_keypair_file).unwrap().into(),],
|
|
|
},
|
|
|
@@ -2978,6 +3032,7 @@ mod tests {
|
|
|
fee_payer: 0,
|
|
|
custodian: None,
|
|
|
no_wait: false,
|
|
|
+ compute_unit_price: None,
|
|
|
},
|
|
|
signers: vec![
|
|
|
read_keypair_file(&default_keypair_file).unwrap().into(),
|
|
|
@@ -3017,6 +3072,7 @@ mod tests {
|
|
|
fee_payer: 0,
|
|
|
custodian: None,
|
|
|
no_wait: true,
|
|
|
+ compute_unit_price: None,
|
|
|
},
|
|
|
signers: vec![read_keypair_file(&default_keypair_file).unwrap().into()],
|
|
|
}
|
|
|
@@ -3063,6 +3119,7 @@ mod tests {
|
|
|
fee_payer: 0,
|
|
|
custodian: None,
|
|
|
no_wait: false,
|
|
|
+ compute_unit_price: None,
|
|
|
},
|
|
|
signers: vec![
|
|
|
read_keypair_file(&default_keypair_file).unwrap().into(),
|
|
|
@@ -3114,6 +3171,7 @@ mod tests {
|
|
|
fee_payer: 0,
|
|
|
custodian: None,
|
|
|
no_wait: false,
|
|
|
+ compute_unit_price: None,
|
|
|
},
|
|
|
signers: vec![
|
|
|
read_keypair_file(&default_keypair_file).unwrap().into(),
|
|
|
@@ -3167,6 +3225,7 @@ mod tests {
|
|
|
fee_payer: 0,
|
|
|
custodian: None,
|
|
|
no_wait: false,
|
|
|
+ compute_unit_price: None,
|
|
|
},
|
|
|
signers: vec![
|
|
|
read_keypair_file(&default_keypair_file).unwrap().into(),
|
|
|
@@ -3204,6 +3263,7 @@ mod tests {
|
|
|
fee_payer: 0,
|
|
|
custodian: None,
|
|
|
no_wait: false,
|
|
|
+ compute_unit_price: None,
|
|
|
},
|
|
|
signers: vec![
|
|
|
read_keypair_file(&default_keypair_file).unwrap().into(),
|
|
|
@@ -3240,6 +3300,7 @@ mod tests {
|
|
|
fee_payer: 0,
|
|
|
custodian: None,
|
|
|
no_wait: false,
|
|
|
+ compute_unit_price: None,
|
|
|
},
|
|
|
signers: vec![
|
|
|
read_keypair_file(&default_keypair_file).unwrap().into(),
|
|
|
@@ -3280,6 +3341,7 @@ mod tests {
|
|
|
fee_payer: 0,
|
|
|
custodian: None,
|
|
|
no_wait: false,
|
|
|
+ compute_unit_price: None,
|
|
|
},
|
|
|
signers: vec![
|
|
|
read_keypair_file(&default_keypair_file).unwrap().into(),
|
|
|
@@ -3317,6 +3379,7 @@ mod tests {
|
|
|
fee_payer: 0,
|
|
|
custodian: None,
|
|
|
no_wait: false,
|
|
|
+ compute_unit_price: None,
|
|
|
},
|
|
|
signers: vec![
|
|
|
read_keypair_file(&default_keypair_file).unwrap().into(),
|
|
|
@@ -3353,6 +3416,7 @@ mod tests {
|
|
|
fee_payer: 0,
|
|
|
custodian: None,
|
|
|
no_wait: false,
|
|
|
+ compute_unit_price: None,
|
|
|
},
|
|
|
signers: vec![
|
|
|
read_keypair_file(&default_keypair_file).unwrap().into(),
|
|
|
@@ -3393,6 +3457,7 @@ mod tests {
|
|
|
fee_payer: 0,
|
|
|
custodian: None,
|
|
|
no_wait: true,
|
|
|
+ compute_unit_price: None,
|
|
|
},
|
|
|
signers: vec![
|
|
|
read_keypair_file(&default_keypair_file).unwrap().into(),
|
|
|
@@ -3434,6 +3499,7 @@ mod tests {
|
|
|
fee_payer: 0,
|
|
|
custodian: None,
|
|
|
no_wait: false,
|
|
|
+ compute_unit_price: None,
|
|
|
},
|
|
|
signers: vec![read_keypair_file(&default_keypair_file).unwrap().into()],
|
|
|
}
|
|
|
@@ -3479,6 +3545,7 @@ mod tests {
|
|
|
fee_payer: 1,
|
|
|
custodian: None,
|
|
|
no_wait: false,
|
|
|
+ compute_unit_price: None,
|
|
|
},
|
|
|
signers: vec![
|
|
|
read_keypair_file(&default_keypair_file).unwrap().into(),
|
|
|
@@ -3534,6 +3601,7 @@ mod tests {
|
|
|
fee_payer: 1,
|
|
|
custodian: None,
|
|
|
no_wait: false,
|
|
|
+ compute_unit_price: None,
|
|
|
},
|
|
|
signers: vec![
|
|
|
read_keypair_file(&default_keypair_file).unwrap().into(),
|
|
|
@@ -3575,6 +3643,7 @@ mod tests {
|
|
|
fee_payer: 0,
|
|
|
custodian: None,
|
|
|
no_wait: false,
|
|
|
+ compute_unit_price: None,
|
|
|
},
|
|
|
signers: vec![read_keypair_file(&default_keypair_file).unwrap().into()],
|
|
|
}
|
|
|
@@ -3621,6 +3690,7 @@ mod tests {
|
|
|
fee_payer: 0,
|
|
|
custodian: None,
|
|
|
no_wait: false,
|
|
|
+ compute_unit_price: None,
|
|
|
},
|
|
|
signers: vec![
|
|
|
read_keypair_file(&default_keypair_file).unwrap().into(),
|
|
|
@@ -3663,6 +3733,7 @@ mod tests {
|
|
|
fee_payer: 1,
|
|
|
custodian: None,
|
|
|
no_wait: false,
|
|
|
+ compute_unit_price: None,
|
|
|
},
|
|
|
signers: vec![
|
|
|
read_keypair_file(&default_keypair_file).unwrap().into(),
|
|
|
@@ -3709,6 +3780,7 @@ mod tests {
|
|
|
fee_payer: 1,
|
|
|
custodian: None,
|
|
|
no_wait: false,
|
|
|
+ compute_unit_price: None,
|
|
|
},
|
|
|
signers: vec![
|
|
|
read_keypair_file(&default_keypair_file).unwrap().into(),
|
|
|
@@ -3759,6 +3831,7 @@ mod tests {
|
|
|
memo: None,
|
|
|
fee_payer: 0,
|
|
|
from: 0,
|
|
|
+ compute_unit_price: None,
|
|
|
},
|
|
|
signers: vec![
|
|
|
read_keypair_file(&default_keypair_file).unwrap().into(),
|
|
|
@@ -3799,6 +3872,7 @@ mod tests {
|
|
|
memo: None,
|
|
|
fee_payer: 0,
|
|
|
from: 0,
|
|
|
+ compute_unit_price: None,
|
|
|
},
|
|
|
signers: vec![
|
|
|
read_keypair_file(&default_keypair_file).unwrap().into(),
|
|
|
@@ -3838,6 +3912,7 @@ mod tests {
|
|
|
memo: None,
|
|
|
fee_payer: 0,
|
|
|
from: 0,
|
|
|
+ compute_unit_price: None,
|
|
|
},
|
|
|
signers: vec![
|
|
|
read_keypair_file(&default_keypair_file).unwrap().into(),
|
|
|
@@ -3910,6 +3985,7 @@ mod tests {
|
|
|
memo: None,
|
|
|
fee_payer: 0,
|
|
|
from: 0,
|
|
|
+ compute_unit_price: None,
|
|
|
},
|
|
|
signers: vec![
|
|
|
Presigner::new(&offline_pubkey, &offline_sig).into(),
|
|
|
@@ -3943,6 +4019,7 @@ mod tests {
|
|
|
memo: None,
|
|
|
fee_payer: 0,
|
|
|
redelegation_stake_account_pubkey: None,
|
|
|
+ compute_unit_price: None,
|
|
|
},
|
|
|
signers: vec![read_keypair_file(&default_keypair_file).unwrap().into()],
|
|
|
}
|
|
|
@@ -3975,6 +4052,7 @@ mod tests {
|
|
|
memo: None,
|
|
|
fee_payer: 0,
|
|
|
redelegation_stake_account_pubkey: None,
|
|
|
+ compute_unit_price: None,
|
|
|
},
|
|
|
signers: vec![
|
|
|
read_keypair_file(&default_keypair_file).unwrap().into(),
|
|
|
@@ -4009,6 +4087,7 @@ mod tests {
|
|
|
memo: None,
|
|
|
fee_payer: 0,
|
|
|
redelegation_stake_account_pubkey: None,
|
|
|
+ compute_unit_price: None,
|
|
|
},
|
|
|
signers: vec![read_keypair_file(&default_keypair_file).unwrap().into()],
|
|
|
}
|
|
|
@@ -4044,6 +4123,7 @@ mod tests {
|
|
|
memo: None,
|
|
|
fee_payer: 0,
|
|
|
redelegation_stake_account_pubkey: None,
|
|
|
+ compute_unit_price: None,
|
|
|
},
|
|
|
signers: vec![read_keypair_file(&default_keypair_file).unwrap().into()],
|
|
|
}
|
|
|
@@ -4074,6 +4154,7 @@ mod tests {
|
|
|
memo: None,
|
|
|
fee_payer: 0,
|
|
|
redelegation_stake_account_pubkey: None,
|
|
|
+ compute_unit_price: None,
|
|
|
},
|
|
|
signers: vec![read_keypair_file(&default_keypair_file).unwrap().into()],
|
|
|
}
|
|
|
@@ -4114,6 +4195,7 @@ mod tests {
|
|
|
memo: None,
|
|
|
fee_payer: 1,
|
|
|
redelegation_stake_account_pubkey: None,
|
|
|
+ compute_unit_price: None,
|
|
|
},
|
|
|
signers: vec![
|
|
|
read_keypair_file(&default_keypair_file).unwrap().into(),
|
|
|
@@ -4163,6 +4245,7 @@ mod tests {
|
|
|
memo: None,
|
|
|
fee_payer: 1,
|
|
|
redelegation_stake_account_pubkey: None,
|
|
|
+ compute_unit_price: None,
|
|
|
},
|
|
|
signers: vec![
|
|
|
read_keypair_file(&default_keypair_file).unwrap().into(),
|
|
|
@@ -4200,6 +4283,7 @@ mod tests {
|
|
|
memo: None,
|
|
|
fee_payer: 1,
|
|
|
redelegation_stake_account_pubkey: None,
|
|
|
+ compute_unit_price: None,
|
|
|
},
|
|
|
signers: vec![
|
|
|
read_keypair_file(&default_keypair_file).unwrap().into(),
|
|
|
@@ -4243,6 +4327,7 @@ mod tests {
|
|
|
memo: None,
|
|
|
fee_payer: 0,
|
|
|
redelegation_stake_account_pubkey: Some(redelegation_stake_account_pubkey),
|
|
|
+ compute_unit_price: None,
|
|
|
},
|
|
|
signers: vec![
|
|
|
read_keypair_file(&default_keypair_file).unwrap().into(),
|
|
|
@@ -4279,6 +4364,41 @@ mod tests {
|
|
|
memo: None,
|
|
|
seed: None,
|
|
|
fee_payer: 0,
|
|
|
+ compute_unit_price: None,
|
|
|
+ },
|
|
|
+ signers: vec![read_keypair_file(&default_keypair_file).unwrap().into()],
|
|
|
+ }
|
|
|
+ );
|
|
|
+
|
|
|
+ // Test WithdrawStake Subcommand w/ ComputeUnitPrice
|
|
|
+ let test_withdraw_stake = test_commands.clone().get_matches_from(vec![
|
|
|
+ "test",
|
|
|
+ "withdraw-stake",
|
|
|
+ &stake_account_string,
|
|
|
+ &stake_account_string,
|
|
|
+ "42",
|
|
|
+ "--with-compute-unit-price",
|
|
|
+ "99",
|
|
|
+ ]);
|
|
|
+
|
|
|
+ assert_eq!(
|
|
|
+ parse_command(&test_withdraw_stake, &default_signer, &mut None).unwrap(),
|
|
|
+ CliCommandInfo {
|
|
|
+ command: CliCommand::WithdrawStake {
|
|
|
+ stake_account_pubkey,
|
|
|
+ destination_account_pubkey: stake_account_pubkey,
|
|
|
+ amount: SpendAmount::Some(42_000_000_000),
|
|
|
+ withdraw_authority: 0,
|
|
|
+ custodian: None,
|
|
|
+ sign_only: false,
|
|
|
+ dump_transaction_message: false,
|
|
|
+ blockhash_query: BlockhashQuery::All(blockhash_query::Source::Cluster),
|
|
|
+ nonce_account: None,
|
|
|
+ nonce_authority: 0,
|
|
|
+ memo: None,
|
|
|
+ seed: None,
|
|
|
+ fee_payer: 0,
|
|
|
+ compute_unit_price: Some(99),
|
|
|
},
|
|
|
signers: vec![read_keypair_file(&default_keypair_file).unwrap().into()],
|
|
|
}
|
|
|
@@ -4312,6 +4432,7 @@ mod tests {
|
|
|
memo: None,
|
|
|
seed: None,
|
|
|
fee_payer: 0,
|
|
|
+ compute_unit_price: None,
|
|
|
},
|
|
|
signers: vec![
|
|
|
read_keypair_file(&default_keypair_file).unwrap().into(),
|
|
|
@@ -4350,6 +4471,7 @@ mod tests {
|
|
|
memo: None,
|
|
|
seed: None,
|
|
|
fee_payer: 0,
|
|
|
+ compute_unit_price: None,
|
|
|
},
|
|
|
signers: vec![
|
|
|
read_keypair_file(&default_keypair_file).unwrap().into(),
|
|
|
@@ -4399,6 +4521,7 @@ mod tests {
|
|
|
memo: None,
|
|
|
seed: None,
|
|
|
fee_payer: 1,
|
|
|
+ compute_unit_price: None,
|
|
|
},
|
|
|
signers: vec![
|
|
|
read_keypair_file(&stake_authority_keypair_file)
|
|
|
@@ -4430,6 +4553,7 @@ mod tests {
|
|
|
memo: None,
|
|
|
seed: None,
|
|
|
fee_payer: 0,
|
|
|
+ compute_unit_price: None,
|
|
|
},
|
|
|
signers: vec![read_keypair_file(&default_keypair_file).unwrap().into()],
|
|
|
}
|
|
|
@@ -4457,6 +4581,7 @@ mod tests {
|
|
|
memo: None,
|
|
|
seed: None,
|
|
|
fee_payer: 0,
|
|
|
+ compute_unit_price: None,
|
|
|
},
|
|
|
signers: vec![read_keypair_file(&default_keypair_file).unwrap().into()],
|
|
|
}
|
|
|
@@ -4485,6 +4610,7 @@ mod tests {
|
|
|
memo: None,
|
|
|
seed: None,
|
|
|
fee_payer: 0,
|
|
|
+ compute_unit_price: None,
|
|
|
},
|
|
|
signers: vec![
|
|
|
read_keypair_file(&default_keypair_file).unwrap().into(),
|
|
|
@@ -4523,6 +4649,7 @@ mod tests {
|
|
|
memo: None,
|
|
|
seed: None,
|
|
|
fee_payer: 0,
|
|
|
+ compute_unit_price: None,
|
|
|
},
|
|
|
signers: vec![read_keypair_file(&default_keypair_file).unwrap().into()],
|
|
|
}
|
|
|
@@ -4551,6 +4678,7 @@ mod tests {
|
|
|
memo: None,
|
|
|
seed: None,
|
|
|
fee_payer: 0,
|
|
|
+ compute_unit_price: None,
|
|
|
},
|
|
|
signers: vec![read_keypair_file(&default_keypair_file).unwrap().into()],
|
|
|
}
|
|
|
@@ -4589,6 +4717,7 @@ mod tests {
|
|
|
memo: None,
|
|
|
seed: None,
|
|
|
fee_payer: 1,
|
|
|
+ compute_unit_price: None,
|
|
|
},
|
|
|
signers: vec![
|
|
|
read_keypair_file(&default_keypair_file).unwrap().into(),
|
|
|
@@ -4636,6 +4765,7 @@ mod tests {
|
|
|
memo: None,
|
|
|
seed: None,
|
|
|
fee_payer: 1,
|
|
|
+ compute_unit_price: None,
|
|
|
},
|
|
|
signers: vec![
|
|
|
read_keypair_file(&default_keypair_file).unwrap().into(),
|
|
|
@@ -4668,6 +4798,7 @@ mod tests {
|
|
|
memo: None,
|
|
|
seed: None,
|
|
|
fee_payer: 1,
|
|
|
+ compute_unit_price: None,
|
|
|
},
|
|
|
signers: vec![
|
|
|
read_keypair_file(&default_keypair_file).unwrap().into(),
|
|
|
@@ -4707,6 +4838,7 @@ mod tests {
|
|
|
seed: None,
|
|
|
lamports: 50_000_000_000,
|
|
|
fee_payer: 0,
|
|
|
+ compute_unit_price: None,
|
|
|
},
|
|
|
signers: vec![
|
|
|
read_keypair_file(&default_keypair_file).unwrap().into(),
|
|
|
@@ -4773,6 +4905,7 @@ mod tests {
|
|
|
seed: None,
|
|
|
lamports: 50_000_000_000,
|
|
|
fee_payer: 1,
|
|
|
+ compute_unit_price: None,
|
|
|
},
|
|
|
signers: vec![
|
|
|
Presigner::new(&stake_auth_pubkey, &stake_sig).into(),
|
|
|
@@ -4810,6 +4943,7 @@ mod tests {
|
|
|
nonce_authority: 0,
|
|
|
memo: None,
|
|
|
fee_payer: 0,
|
|
|
+ compute_unit_price: None,
|
|
|
},
|
|
|
signers: vec![read_keypair_file(&default_keypair_file).unwrap().into(),],
|
|
|
}
|