Skip to content
This repository was archived by the owner on Mar 11, 2025. It is now read-only.

Commit 7b86fc9

Browse files
committed
token-cli: remove handle_tx
1 parent 7847f35 commit 7b86fc9

File tree

1 file changed

+0
-79
lines changed

1 file changed

+0
-79
lines changed

token/cli/src/main.rs

Lines changed: 0 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,11 @@ use solana_cli_output::{
2828
use solana_client::rpc_request::TokenAccountsFilter;
2929
use solana_remote_wallet::remote_wallet::RemoteWalletManager;
3030
use solana_sdk::{
31-
instruction::Instruction,
32-
message::Message,
3331
native_token::*,
3432
program_option::COption,
3533
pubkey::Pubkey,
3634
signature::{Keypair, Signer},
3735
system_program,
38-
transaction::Transaction,
3936
};
4037
use spl_associated_token_account::get_associated_token_address_with_program_id;
4138
use spl_token_2022::{
@@ -66,25 +63,6 @@ mod bench;
6663
use bench::*;
6764
use spl_token_2022::generic_token_account::GenericTokenAccount;
6865

69-
struct CliSignerInfo {
70-
pub signers: Vec<Arc<dyn Signer>>,
71-
}
72-
73-
impl CliSignerInfo {
74-
pub fn signers_for_message(&self, message: &Message) -> Vec<&dyn Signer> {
75-
self.signers
76-
.iter()
77-
.filter_map(|k| {
78-
if message.signer_keys().contains(&&k.pubkey()) {
79-
Some(k.as_ref())
80-
} else {
81-
None
82-
}
83-
})
84-
.collect()
85-
}
86-
}
87-
8866
pub const OWNER_ADDRESS_ARG: ArgConstant<'static> = ArgConstant {
8967
name: "owner",
9068
long: "owner",
@@ -3418,63 +3396,6 @@ enum TransactionReturnData {
34183396
CliSignOnlyData(CliSignOnlyData),
34193397
}
34203398

3421-
// XXX this goes away once everything is converted to token client
3422-
async fn handle_tx<'a>(
3423-
signer_info: &CliSignerInfo,
3424-
config: &Config<'a>,
3425-
no_wait: bool,
3426-
minimum_balance_for_rent_exemption: u64,
3427-
instructions: Vec<Instruction>,
3428-
) -> Result<TransactionReturnData, Error> {
3429-
let fee_payer_pubkey = config.fee_payer.pubkey();
3430-
let fee_payer = Some(&fee_payer_pubkey);
3431-
3432-
let recent_blockhash = config.program_client.get_latest_blockhash().await?;
3433-
let message = if let Some(nonce_account) = config.nonce_account.as_ref() {
3434-
let mut message = Message::new_with_nonce(
3435-
instructions,
3436-
fee_payer,
3437-
nonce_account,
3438-
config.nonce_authority.as_ref().unwrap(),
3439-
);
3440-
message.recent_blockhash = recent_blockhash;
3441-
message
3442-
} else {
3443-
Message::new_with_blockhash(&instructions, fee_payer, &recent_blockhash)
3444-
};
3445-
3446-
if !config.sign_only {
3447-
let fee = config.rpc_client.get_fee_for_message(&message).await?;
3448-
check_fee_payer_balance(config, minimum_balance_for_rent_exemption + fee).await?;
3449-
}
3450-
3451-
let signers = signer_info.signers_for_message(&message);
3452-
let mut transaction = Transaction::new_unsigned(message);
3453-
3454-
if config.sign_only {
3455-
transaction.try_partial_sign(&signers, recent_blockhash)?;
3456-
Ok(TransactionReturnData::CliSignOnlyData(return_signers_data(
3457-
&transaction,
3458-
&ReturnSignersConfig {
3459-
dump_transaction_message: config.dump_transaction_message,
3460-
},
3461-
)))
3462-
} else {
3463-
transaction.try_sign(&signers, recent_blockhash)?;
3464-
let signature = if no_wait {
3465-
config.rpc_client.send_transaction(&transaction).await?
3466-
} else {
3467-
config
3468-
.rpc_client
3469-
.send_and_confirm_transaction_with_spinner(&transaction)
3470-
.await?
3471-
};
3472-
Ok(TransactionReturnData::CliSignature(CliSignature {
3473-
signature: signature.to_string(),
3474-
}))
3475-
}
3476-
}
3477-
34783399
async fn finish_tx<'a>(
34793400
config: &Config<'a>,
34803401
rpc_response: &RpcClientResponse,

0 commit comments

Comments
 (0)