Skip to content

Commit

Permalink
rm unused Results
Browse files Browse the repository at this point in the history
  • Loading branch information
cryptopapi997 committed Feb 18, 2025
1 parent 7ca0ccd commit 951d409
Showing 1 changed file with 11 additions and 17 deletions.
28 changes: 11 additions & 17 deletions client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,7 @@ impl<C: Deref<Target = impl Signer> + Clone, S: AsSigner> RequestBuilder<'_, C,
self
}

pub fn instructions(&self) -> Result<Vec<Instruction>, ClientError> {
pub fn instructions(&self) -> Vec<Instruction> {
let mut instructions = self.instructions.clone();
if let Some(ix_data) = &self.instruction_data {
instructions.push(Instruction {
Expand All @@ -606,44 +606,38 @@ impl<C: Deref<Target = impl Signer> + Clone, S: AsSigner> RequestBuilder<'_, C,
});
}

Ok(instructions)
instructions
}

fn signed_transaction_with_blockhash(
&self,
latest_hash: Hash,
) -> Result<Transaction, ClientError> {
let instructions = self.instructions()?;
fn signed_transaction_with_blockhash(&self, latest_hash: Hash) -> Transaction {
let instructions = self.instructions();
let signers: Vec<&dyn Signer> = self.signers.iter().map(|s| s.as_signer()).collect();
let mut all_signers = signers;
all_signers.push(&*self.payer);

let tx = Transaction::new_signed_with_payer(
Transaction::new_signed_with_payer(
&instructions,
Some(&self.payer.pubkey()),
&all_signers,
latest_hash,
);

Ok(tx)
)
}

pub fn transaction(&self) -> Result<Transaction, ClientError> {
pub fn transaction(&self) -> Transaction {
let instructions = &self.instructions;
let tx = Transaction::new_with_payer(instructions, Some(&self.payer.pubkey()));
Ok(tx)
Transaction::new_with_payer(instructions, Some(&self.payer.pubkey()))
}

async fn signed_transaction_internal(&self) -> Result<Transaction, ClientError> {
let latest_hash = self.internal_rpc_client.get_latest_blockhash().await?;

let tx = self.signed_transaction_with_blockhash(latest_hash)?;
let tx = self.signed_transaction_with_blockhash(latest_hash);
Ok(tx)
}

async fn send_internal(&self) -> Result<Signature, ClientError> {
let latest_hash = self.internal_rpc_client.get_latest_blockhash().await?;
let tx = self.signed_transaction_with_blockhash(latest_hash)?;
let tx = self.signed_transaction_with_blockhash(latest_hash);

self.internal_rpc_client
.send_and_confirm_transaction(&tx)
Expand All @@ -656,7 +650,7 @@ impl<C: Deref<Target = impl Signer> + Clone, S: AsSigner> RequestBuilder<'_, C,
config: RpcSendTransactionConfig,
) -> Result<Signature, ClientError> {
let latest_hash = self.internal_rpc_client.get_latest_blockhash().await?;
let tx = self.signed_transaction_with_blockhash(latest_hash)?;
let tx = self.signed_transaction_with_blockhash(latest_hash);

self.internal_rpc_client
.send_and_confirm_transaction_with_spinner_and_config(
Expand Down

0 comments on commit 951d409

Please sign in to comment.