@ -405,6 +405,7 @@ pub enum CliCommand {
|
|||||||
to: Pubkey,
|
to: Pubkey,
|
||||||
from: SignerIndex,
|
from: SignerIndex,
|
||||||
sign_only: bool,
|
sign_only: bool,
|
||||||
|
no_wait: bool,
|
||||||
blockhash_query: BlockhashQuery,
|
blockhash_query: BlockhashQuery,
|
||||||
nonce_account: Option<Pubkey>,
|
nonce_account: Option<Pubkey>,
|
||||||
nonce_authority: SignerIndex,
|
nonce_authority: SignerIndex,
|
||||||
@ -902,6 +903,7 @@ pub fn parse_command(
|
|||||||
let lamports = lamports_of_sol(matches, "amount").unwrap();
|
let lamports = lamports_of_sol(matches, "amount").unwrap();
|
||||||
let to = pubkey_of_signer(matches, "to", wallet_manager)?.unwrap();
|
let to = pubkey_of_signer(matches, "to", wallet_manager)?.unwrap();
|
||||||
let sign_only = matches.is_present(SIGN_ONLY_ARG.name);
|
let sign_only = matches.is_present(SIGN_ONLY_ARG.name);
|
||||||
|
let no_wait = matches.is_present("no_wait");
|
||||||
let blockhash_query = BlockhashQuery::new_from_matches(matches);
|
let blockhash_query = BlockhashQuery::new_from_matches(matches);
|
||||||
let nonce_account = pubkey_of_signer(matches, NONCE_ARG.name, wallet_manager)?;
|
let nonce_account = pubkey_of_signer(matches, NONCE_ARG.name, wallet_manager)?;
|
||||||
let (nonce_authority, nonce_authority_pubkey) =
|
let (nonce_authority, nonce_authority_pubkey) =
|
||||||
@ -927,6 +929,7 @@ pub fn parse_command(
|
|||||||
lamports,
|
lamports,
|
||||||
to,
|
to,
|
||||||
sign_only,
|
sign_only,
|
||||||
|
no_wait,
|
||||||
blockhash_query,
|
blockhash_query,
|
||||||
nonce_account,
|
nonce_account,
|
||||||
nonce_authority: signer_info.index_of(nonce_authority_pubkey).unwrap(),
|
nonce_authority: signer_info.index_of(nonce_authority_pubkey).unwrap(),
|
||||||
@ -1488,6 +1491,7 @@ fn process_transfer(
|
|||||||
to: &Pubkey,
|
to: &Pubkey,
|
||||||
from: SignerIndex,
|
from: SignerIndex,
|
||||||
sign_only: bool,
|
sign_only: bool,
|
||||||
|
no_wait: bool,
|
||||||
blockhash_query: &BlockhashQuery,
|
blockhash_query: &BlockhashQuery,
|
||||||
nonce_account: Option<&Pubkey>,
|
nonce_account: Option<&Pubkey>,
|
||||||
nonce_authority: SignerIndex,
|
nonce_authority: SignerIndex,
|
||||||
@ -1534,7 +1538,11 @@ fn process_transfer(
|
|||||||
&fee_calculator,
|
&fee_calculator,
|
||||||
&tx.message,
|
&tx.message,
|
||||||
)?;
|
)?;
|
||||||
let result = rpc_client.send_and_confirm_transaction_with_spinner(&mut tx, &config.signers);
|
let result = if no_wait {
|
||||||
|
rpc_client.send_transaction(&tx)
|
||||||
|
} else {
|
||||||
|
rpc_client.send_and_confirm_transaction_with_spinner(&mut tx, &config.signers)
|
||||||
|
};
|
||||||
log_instruction_custom_error::<SystemError>(result)
|
log_instruction_custom_error::<SystemError>(result)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2080,6 +2088,7 @@ pub fn process_command(config: &CliConfig) -> ProcessResult {
|
|||||||
to,
|
to,
|
||||||
from,
|
from,
|
||||||
sign_only,
|
sign_only,
|
||||||
|
no_wait,
|
||||||
ref blockhash_query,
|
ref blockhash_query,
|
||||||
ref nonce_account,
|
ref nonce_account,
|
||||||
nonce_authority,
|
nonce_authority,
|
||||||
@ -2091,6 +2100,7 @@ pub fn process_command(config: &CliConfig) -> ProcessResult {
|
|||||||
to,
|
to,
|
||||||
*from,
|
*from,
|
||||||
*sign_only,
|
*sign_only,
|
||||||
|
*no_wait,
|
||||||
blockhash_query,
|
blockhash_query,
|
||||||
nonce_account.as_ref(),
|
nonce_account.as_ref(),
|
||||||
*nonce_authority,
|
*nonce_authority,
|
||||||
@ -2497,6 +2507,12 @@ pub fn app<'ab, 'v>(name: &str, about: &'ab str, version: &'v str) -> App<'ab, '
|
|||||||
.validator(is_valid_signer)
|
.validator(is_valid_signer)
|
||||||
.help("Source account of funds (if different from client local account)"),
|
.help("Source account of funds (if different from client local account)"),
|
||||||
)
|
)
|
||||||
|
.arg(
|
||||||
|
Arg::with_name("no_wait")
|
||||||
|
.long("no-wait")
|
||||||
|
.takes_value(false)
|
||||||
|
.help("Return signature immediately after submitting the transaction, instead of waiting for confirmations"),
|
||||||
|
)
|
||||||
.offline_args()
|
.offline_args()
|
||||||
.arg(nonce_arg())
|
.arg(nonce_arg())
|
||||||
.arg(nonce_authority_arg())
|
.arg(nonce_authority_arg())
|
||||||
@ -3557,6 +3573,33 @@ mod tests {
|
|||||||
to: to_pubkey,
|
to: to_pubkey,
|
||||||
from: 0,
|
from: 0,
|
||||||
sign_only: false,
|
sign_only: false,
|
||||||
|
no_wait: false,
|
||||||
|
blockhash_query: BlockhashQuery::All(blockhash_query::Source::Cluster),
|
||||||
|
nonce_account: None,
|
||||||
|
nonce_authority: 0,
|
||||||
|
fee_payer: 0,
|
||||||
|
},
|
||||||
|
signers: vec![read_keypair_file(&default_keypair_file).unwrap().into()],
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
// Test Transfer no-wait
|
||||||
|
let test_transfer = test_commands.clone().get_matches_from(vec![
|
||||||
|
"test",
|
||||||
|
"transfer",
|
||||||
|
"--no-wait",
|
||||||
|
&to_string,
|
||||||
|
"42",
|
||||||
|
]);
|
||||||
|
assert_eq!(
|
||||||
|
parse_command(&test_transfer, &default_keypair_file, None).unwrap(),
|
||||||
|
CliCommandInfo {
|
||||||
|
command: CliCommand::Transfer {
|
||||||
|
lamports: 42_000_000_000,
|
||||||
|
to: to_pubkey,
|
||||||
|
from: 0,
|
||||||
|
sign_only: false,
|
||||||
|
no_wait: true,
|
||||||
blockhash_query: BlockhashQuery::All(blockhash_query::Source::Cluster),
|
blockhash_query: BlockhashQuery::All(blockhash_query::Source::Cluster),
|
||||||
nonce_account: None,
|
nonce_account: None,
|
||||||
nonce_authority: 0,
|
nonce_authority: 0,
|
||||||
@ -3586,6 +3629,7 @@ mod tests {
|
|||||||
to: to_pubkey,
|
to: to_pubkey,
|
||||||
from: 0,
|
from: 0,
|
||||||
sign_only: true,
|
sign_only: true,
|
||||||
|
no_wait: false,
|
||||||
blockhash_query: BlockhashQuery::None(blockhash),
|
blockhash_query: BlockhashQuery::None(blockhash),
|
||||||
nonce_account: None,
|
nonce_account: None,
|
||||||
nonce_authority: 0,
|
nonce_authority: 0,
|
||||||
@ -3620,6 +3664,7 @@ mod tests {
|
|||||||
to: to_pubkey,
|
to: to_pubkey,
|
||||||
from: 0,
|
from: 0,
|
||||||
sign_only: false,
|
sign_only: false,
|
||||||
|
no_wait: false,
|
||||||
blockhash_query: BlockhashQuery::FeeCalculator(
|
blockhash_query: BlockhashQuery::FeeCalculator(
|
||||||
blockhash_query::Source::Cluster,
|
blockhash_query::Source::Cluster,
|
||||||
blockhash
|
blockhash
|
||||||
@ -3658,6 +3703,7 @@ mod tests {
|
|||||||
to: to_pubkey,
|
to: to_pubkey,
|
||||||
from: 0,
|
from: 0,
|
||||||
sign_only: false,
|
sign_only: false,
|
||||||
|
no_wait: false,
|
||||||
blockhash_query: BlockhashQuery::FeeCalculator(
|
blockhash_query: BlockhashQuery::FeeCalculator(
|
||||||
blockhash_query::Source::NonceAccount(nonce_address),
|
blockhash_query::Source::NonceAccount(nonce_address),
|
||||||
blockhash
|
blockhash
|
||||||
|
@ -338,6 +338,7 @@ fn test_create_account_with_seed() {
|
|||||||
to: to_address,
|
to: to_address,
|
||||||
from: 0,
|
from: 0,
|
||||||
sign_only: true,
|
sign_only: true,
|
||||||
|
no_wait: false,
|
||||||
blockhash_query: BlockhashQuery::None(nonce_hash),
|
blockhash_query: BlockhashQuery::None(nonce_hash),
|
||||||
nonce_account: Some(nonce_address),
|
nonce_account: Some(nonce_address),
|
||||||
nonce_authority: 0,
|
nonce_authority: 0,
|
||||||
@ -358,6 +359,7 @@ fn test_create_account_with_seed() {
|
|||||||
to: to_address,
|
to: to_address,
|
||||||
from: 0,
|
from: 0,
|
||||||
sign_only: false,
|
sign_only: false,
|
||||||
|
no_wait: false,
|
||||||
blockhash_query: BlockhashQuery::FeeCalculator(
|
blockhash_query: BlockhashQuery::FeeCalculator(
|
||||||
blockhash_query::Source::NonceAccount(nonce_address),
|
blockhash_query::Source::NonceAccount(nonce_address),
|
||||||
sign_only.blockhash,
|
sign_only.blockhash,
|
||||||
|
@ -68,6 +68,7 @@ fn test_transfer() {
|
|||||||
to: recipient_pubkey,
|
to: recipient_pubkey,
|
||||||
from: 0,
|
from: 0,
|
||||||
sign_only: false,
|
sign_only: false,
|
||||||
|
no_wait: false,
|
||||||
blockhash_query: BlockhashQuery::All(blockhash_query::Source::Cluster),
|
blockhash_query: BlockhashQuery::All(blockhash_query::Source::Cluster),
|
||||||
nonce_account: None,
|
nonce_account: None,
|
||||||
nonce_authority: 0,
|
nonce_authority: 0,
|
||||||
@ -95,6 +96,7 @@ fn test_transfer() {
|
|||||||
to: recipient_pubkey,
|
to: recipient_pubkey,
|
||||||
from: 0,
|
from: 0,
|
||||||
sign_only: true,
|
sign_only: true,
|
||||||
|
no_wait: false,
|
||||||
blockhash_query: BlockhashQuery::None(blockhash),
|
blockhash_query: BlockhashQuery::None(blockhash),
|
||||||
nonce_account: None,
|
nonce_account: None,
|
||||||
nonce_authority: 0,
|
nonce_authority: 0,
|
||||||
@ -110,6 +112,7 @@ fn test_transfer() {
|
|||||||
to: recipient_pubkey,
|
to: recipient_pubkey,
|
||||||
from: 0,
|
from: 0,
|
||||||
sign_only: false,
|
sign_only: false,
|
||||||
|
no_wait: false,
|
||||||
blockhash_query: BlockhashQuery::FeeCalculator(blockhash_query::Source::Cluster, blockhash),
|
blockhash_query: BlockhashQuery::FeeCalculator(blockhash_query::Source::Cluster, blockhash),
|
||||||
nonce_account: None,
|
nonce_account: None,
|
||||||
nonce_authority: 0,
|
nonce_authority: 0,
|
||||||
@ -147,6 +150,7 @@ fn test_transfer() {
|
|||||||
to: recipient_pubkey,
|
to: recipient_pubkey,
|
||||||
from: 0,
|
from: 0,
|
||||||
sign_only: false,
|
sign_only: false,
|
||||||
|
no_wait: false,
|
||||||
blockhash_query: BlockhashQuery::FeeCalculator(
|
blockhash_query: BlockhashQuery::FeeCalculator(
|
||||||
blockhash_query::Source::NonceAccount(nonce_account.pubkey()),
|
blockhash_query::Source::NonceAccount(nonce_account.pubkey()),
|
||||||
nonce_hash,
|
nonce_hash,
|
||||||
@ -187,6 +191,7 @@ fn test_transfer() {
|
|||||||
to: recipient_pubkey,
|
to: recipient_pubkey,
|
||||||
from: 0,
|
from: 0,
|
||||||
sign_only: true,
|
sign_only: true,
|
||||||
|
no_wait: false,
|
||||||
blockhash_query: BlockhashQuery::None(nonce_hash),
|
blockhash_query: BlockhashQuery::None(nonce_hash),
|
||||||
nonce_account: Some(nonce_account.pubkey()),
|
nonce_account: Some(nonce_account.pubkey()),
|
||||||
nonce_authority: 0,
|
nonce_authority: 0,
|
||||||
@ -202,6 +207,7 @@ fn test_transfer() {
|
|||||||
to: recipient_pubkey,
|
to: recipient_pubkey,
|
||||||
from: 0,
|
from: 0,
|
||||||
sign_only: false,
|
sign_only: false,
|
||||||
|
no_wait: false,
|
||||||
blockhash_query: BlockhashQuery::FeeCalculator(
|
blockhash_query: BlockhashQuery::FeeCalculator(
|
||||||
blockhash_query::Source::NonceAccount(nonce_account.pubkey()),
|
blockhash_query::Source::NonceAccount(nonce_account.pubkey()),
|
||||||
sign_only.blockhash,
|
sign_only.blockhash,
|
||||||
@ -269,6 +275,7 @@ fn test_transfer_multisession_signing() {
|
|||||||
to: to_pubkey,
|
to: to_pubkey,
|
||||||
from: 1,
|
from: 1,
|
||||||
sign_only: true,
|
sign_only: true,
|
||||||
|
no_wait: false,
|
||||||
blockhash_query: BlockhashQuery::None(blockhash),
|
blockhash_query: BlockhashQuery::None(blockhash),
|
||||||
nonce_account: None,
|
nonce_account: None,
|
||||||
nonce_authority: 0,
|
nonce_authority: 0,
|
||||||
@ -293,6 +300,7 @@ fn test_transfer_multisession_signing() {
|
|||||||
to: to_pubkey,
|
to: to_pubkey,
|
||||||
from: 1,
|
from: 1,
|
||||||
sign_only: true,
|
sign_only: true,
|
||||||
|
no_wait: false,
|
||||||
blockhash_query: BlockhashQuery::None(blockhash),
|
blockhash_query: BlockhashQuery::None(blockhash),
|
||||||
nonce_account: None,
|
nonce_account: None,
|
||||||
nonce_authority: 0,
|
nonce_authority: 0,
|
||||||
@ -314,6 +322,7 @@ fn test_transfer_multisession_signing() {
|
|||||||
to: to_pubkey,
|
to: to_pubkey,
|
||||||
from: 1,
|
from: 1,
|
||||||
sign_only: false,
|
sign_only: false,
|
||||||
|
no_wait: false,
|
||||||
blockhash_query: BlockhashQuery::FeeCalculator(blockhash_query::Source::Cluster, blockhash),
|
blockhash_query: BlockhashQuery::FeeCalculator(blockhash_query::Source::Cluster, blockhash),
|
||||||
nonce_account: None,
|
nonce_account: None,
|
||||||
nonce_authority: 0,
|
nonce_authority: 0,
|
||||||
|
Reference in New Issue
Block a user