From 84f2f33f4944a599f505296423517ccf207e8385 Mon Sep 17 00:00:00 2001 From: Trent Nelson Date: Thu, 1 Apr 2021 00:44:47 -0600 Subject: [PATCH] spl-token-cli: Use CLI config wallet for nonce authority fallback --- token/cli/src/main.rs | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/token/cli/src/main.rs b/token/cli/src/main.rs index 8df244a7..19afc5c7 100644 --- a/token/cli/src/main.rs +++ b/token/cli/src/main.rs @@ -1954,16 +1954,23 @@ fn main() { eprintln!("error: {}", e); exit(1); }); - let (signer, nonce_authority) = - signer_of(&matches, NONCE_AUTHORITY_ARG.name, &mut wallet_manager).unwrap_or_else( - |e| { - eprintln!("error: {}", e); - exit(1); - }, - ); - if signer.is_some() { - bulk_signers.push(signer); - } + let (signer, nonce_authority) = signer_from_path( + &matches, + matches + .value_of(NONCE_AUTHORITY_ARG.name) + .unwrap_or(&cli_config.keypair_path), + NONCE_AUTHORITY_ARG.name, + &mut wallet_manager, + ) + .map(|s| { + let p = s.pubkey(); + (Some(s), Some(p)) + }) + .unwrap_or_else(|e| { + eprintln!("error: {}", e); + exit(1); + }); + bulk_signers.push(signer); let blockhash_query = BlockhashQuery::new_from_matches(matches); let sign_only = matches.is_present(SIGN_ONLY_ARG.name);