diff --git a/cli/src/cli.rs b/cli/src/cli.rs index 71733248c4..d6e6c95957 100644 --- a/cli/src/cli.rs +++ b/cli/src/cli.rs @@ -909,7 +909,7 @@ pub fn get_blockhash_and_fee_calculator( }) } -pub fn return_signers(tx: &Transaction, config: &CliConfig) -> ProcessResult { +pub fn return_signers(tx: &Transaction, output_format: &OutputFormat) -> ProcessResult { let verify_results = tx.verify_with_results(); let mut signers = Vec::new(); let mut absent = Vec::new(); @@ -935,7 +935,7 @@ pub fn return_signers(tx: &Transaction, config: &CliConfig) -> ProcessResult { bad_sig, }; - Ok(config.output_format.formatted_string(&cli_command)) + Ok(output_format.formatted_string(&cli_command)) } pub fn parse_create_address_with_seed( @@ -1400,7 +1400,7 @@ fn process_transfer( if sign_only { tx.try_partial_sign(&config.signers, recent_blockhash)?; - return_signers(&tx, &config) + return_signers(&tx, &config.output_format) } else { if let Some(nonce_account) = &nonce_account { let nonce_account = nonce_utils::get_account_with_commitment( @@ -3156,8 +3156,6 @@ mod tests { } } - let mut config = CliConfig::default(); - config.output_format = OutputFormat::JsonCompact; let present: Box = Box::new(keypair_from_seed(&[2u8; 32]).unwrap()); let absent: Box = Box::new(NullSigner::new(&Pubkey::new(&[3u8; 32]))); let bad: Box = Box::new(BadSigner::new(Pubkey::new(&[4u8; 32]))); @@ -3176,7 +3174,7 @@ mod tests { let signers = vec![present.as_ref(), absent.as_ref(), bad.as_ref()]; let blockhash = Hash::new(&[7u8; 32]); tx.try_partial_sign(&signers, blockhash).unwrap(); - let res = return_signers(&tx, &config).unwrap(); + let res = return_signers(&tx, &OutputFormat::JsonCompact).unwrap(); let sign_only = parse_sign_only_reply_string(&res); assert_eq!(sign_only.blockhash, blockhash); assert_eq!(sign_only.present_signers[0].0, present.pubkey()); diff --git a/cli/src/stake.rs b/cli/src/stake.rs index 050f4705a7..85024cb41c 100644 --- a/cli/src/stake.rs +++ b/cli/src/stake.rs @@ -946,7 +946,7 @@ pub fn process_create_stake_account( let mut tx = Transaction::new_unsigned(message); if sign_only { tx.try_partial_sign(&config.signers, recent_blockhash)?; - return_signers(&tx, &config) + return_signers(&tx, &config.output_format) } else { tx.try_sign(&config.signers, recent_blockhash)?; let result = rpc_client.send_and_confirm_transaction_with_spinner_and_config( @@ -1005,7 +1005,7 @@ pub fn process_stake_authorize( if sign_only { tx.try_partial_sign(&config.signers, recent_blockhash)?; - return_signers(&tx, &config) + return_signers(&tx, &config.output_format) } else { tx.try_sign(&config.signers, recent_blockhash)?; if let Some(nonce_account) = &nonce_account { @@ -1068,7 +1068,7 @@ pub fn process_deactivate_stake_account( if sign_only { tx.try_partial_sign(&config.signers, recent_blockhash)?; - return_signers(&tx, &config) + return_signers(&tx, &config.output_format) } else { tx.try_sign(&config.signers, recent_blockhash)?; if let Some(nonce_account) = &nonce_account { @@ -1140,7 +1140,7 @@ pub fn process_withdraw_stake( if sign_only { tx.try_partial_sign(&config.signers, recent_blockhash)?; - return_signers(&tx, &config) + return_signers(&tx, &config.output_format) } else { tx.try_sign(&config.signers, recent_blockhash)?; if let Some(nonce_account) = &nonce_account { @@ -1283,7 +1283,7 @@ pub fn process_split_stake( if sign_only { tx.try_partial_sign(&config.signers, recent_blockhash)?; - return_signers(&tx, &config) + return_signers(&tx, &config.output_format) } else { tx.try_sign(&config.signers, recent_blockhash)?; if let Some(nonce_account) = &nonce_account { @@ -1385,7 +1385,7 @@ pub fn process_merge_stake( if sign_only { tx.try_partial_sign(&config.signers, recent_blockhash)?; - return_signers(&tx, &config) + return_signers(&tx, &config.output_format) } else { tx.try_sign(&config.signers, recent_blockhash)?; if let Some(nonce_account) = &nonce_account { @@ -1451,7 +1451,7 @@ pub fn process_stake_set_lockup( if sign_only { tx.try_partial_sign(&config.signers, recent_blockhash)?; - return_signers(&tx, &config) + return_signers(&tx, &config.output_format) } else { tx.try_sign(&config.signers, recent_blockhash)?; if let Some(nonce_account) = &nonce_account { @@ -1739,7 +1739,7 @@ pub fn process_delegate_stake( if sign_only { tx.try_partial_sign(&config.signers, recent_blockhash)?; - return_signers(&tx, &config) + return_signers(&tx, &config.output_format) } else { tx.try_sign(&config.signers, recent_blockhash)?; if let Some(nonce_account) = &nonce_account {