Struct solana_program_test::BanksClient
source · pub struct BanksClient { /* private fields */ }
Implementations§
source§impl BanksClient
impl BanksClient
pub fn new<C>( config: Config, transport: C ) -> NewClient<BanksClient, RequestDispatch<BanksRequest, BanksResponse, C>>where C: Transport<ClientMessage<BanksRequest>, Response<BanksResponse>>,
pub fn send_transaction_with_context( &mut self, ctx: Context, transaction: Transaction ) -> impl Future<Output = Result<(), BanksClientError>>
pub fn get_fees_with_commitment_and_context( &mut self, ctx: Context, commitment: CommitmentLevel ) -> impl Future<Output = Result<(FeeCalculator, Hash, u64), BanksClientError>>
get_fee_for_message
or is_blockhash_valid
insteadpub fn get_transaction_status_with_context( &mut self, ctx: Context, signature: Signature ) -> impl Future<Output = Result<Option<TransactionStatus>, BanksClientError>>
pub fn get_slot_with_context( &mut self, ctx: Context, commitment: CommitmentLevel ) -> impl Future<Output = Result<u64, BanksClientError>>
pub fn get_block_height_with_context( &mut self, ctx: Context, commitment: CommitmentLevel ) -> impl Future<Output = Result<u64, BanksClientError>>
pub fn process_transaction_with_commitment_and_context( &mut self, ctx: Context, transaction: Transaction, commitment: CommitmentLevel ) -> impl Future<Output = Result<Option<Result<(), TransactionError>>, BanksClientError>>
pub fn process_transaction_with_preflight_and_commitment_and_context( &mut self, ctx: Context, transaction: Transaction, commitment: CommitmentLevel ) -> impl Future<Output = Result<BanksTransactionResultWithSimulation, BanksClientError>>
pub fn simulate_transaction_with_commitment_and_context( &mut self, ctx: Context, transaction: Transaction, commitment: CommitmentLevel ) -> impl Future<Output = Result<BanksTransactionResultWithSimulation, BanksClientError>>
pub fn get_account_with_commitment_and_context( &mut self, ctx: Context, address: Pubkey, commitment: CommitmentLevel ) -> impl Future<Output = Result<Option<Account>, BanksClientError>>
sourcepub fn send_transaction(
&mut self,
transaction: Transaction
) -> impl Future<Output = Result<(), BanksClientError>>
pub fn send_transaction( &mut self, transaction: Transaction ) -> impl Future<Output = Result<(), BanksClientError>>
Send a transaction and return immediately. The server will resend the transaction until either it is accepted by the cluster or the transaction’s blockhash expires.
sourcepub fn get_fees(
&mut self
) -> impl Future<Output = Result<(FeeCalculator, Hash, u64), BanksClientError>>
👎Deprecated since 1.9.0: Please use get_fee_for_message
or is_blockhash_valid
instead
pub fn get_fees( &mut self ) -> impl Future<Output = Result<(FeeCalculator, Hash, u64), BanksClientError>>
get_fee_for_message
or is_blockhash_valid
insteadReturn the fee parameters associated with a recent, rooted blockhash. The cluster will use the transaction’s blockhash to look up these same fee parameters and use them to calculate the transaction fee.
sourcepub fn get_sysvar<T>(
&mut self
) -> impl Future<Output = Result<T, BanksClientError>>where
T: Sysvar,
pub fn get_sysvar<T>( &mut self ) -> impl Future<Output = Result<T, BanksClientError>>where T: Sysvar,
Return the cluster Sysvar
sourcepub fn get_rent(
&mut self
) -> impl Future<Output = Result<Rent, BanksClientError>>
pub fn get_rent( &mut self ) -> impl Future<Output = Result<Rent, BanksClientError>>
Return the cluster rent
sourcepub fn get_recent_blockhash(
&mut self
) -> impl Future<Output = Result<Hash, BanksClientError>>
👎Deprecated since 1.9.0: Please use get_latest_blockhash
instead
pub fn get_recent_blockhash( &mut self ) -> impl Future<Output = Result<Hash, BanksClientError>>
get_latest_blockhash
insteadReturn a recent, rooted blockhash from the server. The cluster will only accept
transactions with a blockhash that has not yet expired. Use the get_fees
method to get both a blockhash and the blockhash’s last valid slot.
sourcepub fn process_transaction_with_commitment(
&mut self,
transaction: Transaction,
commitment: CommitmentLevel
) -> impl Future<Output = Result<(), BanksClientError>>
pub fn process_transaction_with_commitment( &mut self, transaction: Transaction, commitment: CommitmentLevel ) -> impl Future<Output = Result<(), BanksClientError>>
Send a transaction and return after the transaction has been rejected or reached the given level of commitment.
sourcepub fn process_transaction_with_preflight_and_commitment(
&mut self,
transaction: Transaction,
commitment: CommitmentLevel
) -> impl Future<Output = Result<(), BanksClientError>>
pub fn process_transaction_with_preflight_and_commitment( &mut self, transaction: Transaction, commitment: CommitmentLevel ) -> impl Future<Output = Result<(), BanksClientError>>
Send a transaction and return any preflight (sanitization or simulation) errors, or return after the transaction has been rejected or reached the given level of commitment.
sourcepub fn process_transaction_with_preflight(
&mut self,
transaction: Transaction
) -> impl Future<Output = Result<(), BanksClientError>>
pub fn process_transaction_with_preflight( &mut self, transaction: Transaction ) -> impl Future<Output = Result<(), BanksClientError>>
Send a transaction and return any preflight (sanitization or simulation) errors, or return after the transaction has been finalized or rejected.
sourcepub fn process_transaction(
&mut self,
transaction: Transaction
) -> impl Future<Output = Result<(), BanksClientError>>
pub fn process_transaction( &mut self, transaction: Transaction ) -> impl Future<Output = Result<(), BanksClientError>>
Send a transaction and return until the transaction has been finalized or rejected.
pub async fn process_transactions_with_commitment( &mut self, transactions: Vec<Transaction, Global>, commitment: CommitmentLevel ) -> impl Future<Output = Result<(), BanksClientError>>
sourcepub fn process_transactions(
&mut self,
transactions: Vec<Transaction, Global>
) -> impl Future<Output = Result<(), BanksClientError>>
pub fn process_transactions( &mut self, transactions: Vec<Transaction, Global> ) -> impl Future<Output = Result<(), BanksClientError>>
Send transactions and return until the transaction has been finalized or rejected.
sourcepub fn simulate_transaction_with_commitment(
&mut self,
transaction: Transaction,
commitment: CommitmentLevel
) -> impl Future<Output = Result<BanksTransactionResultWithSimulation, BanksClientError>>
pub fn simulate_transaction_with_commitment( &mut self, transaction: Transaction, commitment: CommitmentLevel ) -> impl Future<Output = Result<BanksTransactionResultWithSimulation, BanksClientError>>
Simulate a transaction at the given commitment level
sourcepub fn simulate_transaction(
&mut self,
transaction: Transaction
) -> impl Future<Output = Result<BanksTransactionResultWithSimulation, BanksClientError>>
pub fn simulate_transaction( &mut self, transaction: Transaction ) -> impl Future<Output = Result<BanksTransactionResultWithSimulation, BanksClientError>>
Simulate a transaction at the default commitment level
sourcepub fn get_root_slot(
&mut self
) -> impl Future<Output = Result<u64, BanksClientError>>
pub fn get_root_slot( &mut self ) -> impl Future<Output = Result<u64, BanksClientError>>
Return the most recent rooted slot. All transactions at or below this slot are said to be finalized. The cluster will not fork to a higher slot.
sourcepub fn get_root_block_height(
&mut self
) -> impl Future<Output = Result<u64, BanksClientError>>
pub fn get_root_block_height( &mut self ) -> impl Future<Output = Result<u64, BanksClientError>>
Return the most recent rooted block height. All transactions at or below this height are said to be finalized. The cluster will not fork to a higher block height.
sourcepub fn get_account_with_commitment(
&mut self,
address: Pubkey,
commitment: CommitmentLevel
) -> impl Future<Output = Result<Option<Account>, BanksClientError>>
pub fn get_account_with_commitment( &mut self, address: Pubkey, commitment: CommitmentLevel ) -> impl Future<Output = Result<Option<Account>, BanksClientError>>
Return the account at the given address at the slot corresponding to the given commitment level. If the account is not found, None is returned.
sourcepub fn get_account(
&mut self,
address: Pubkey
) -> impl Future<Output = Result<Option<Account>, BanksClientError>>
pub fn get_account( &mut self, address: Pubkey ) -> impl Future<Output = Result<Option<Account>, BanksClientError>>
Return the account at the given address at the time of the most recent root slot. If the account is not found, None is returned.
sourcepub fn get_packed_account_data<T>(
&mut self,
address: Pubkey
) -> impl Future<Output = Result<T, BanksClientError>>where
T: Pack,
pub fn get_packed_account_data<T>( &mut self, address: Pubkey ) -> impl Future<Output = Result<T, BanksClientError>>where T: Pack,
Return the unpacked account data at the given address If the account is not found, an error is returned
sourcepub fn get_account_data_with_borsh<T>(
&mut self,
address: Pubkey
) -> impl Future<Output = Result<T, BanksClientError>>where
T: BorshDeserialize,
pub fn get_account_data_with_borsh<T>( &mut self, address: Pubkey ) -> impl Future<Output = Result<T, BanksClientError>>where T: BorshDeserialize,
Return the unpacked account data at the given address If the account is not found, an error is returned
sourcepub fn get_balance_with_commitment(
&mut self,
address: Pubkey,
commitment: CommitmentLevel
) -> impl Future<Output = Result<u64, BanksClientError>>
pub fn get_balance_with_commitment( &mut self, address: Pubkey, commitment: CommitmentLevel ) -> impl Future<Output = Result<u64, BanksClientError>>
Return the balance in lamports of an account at the given address at the slot corresponding to the given commitment level.
sourcepub fn get_balance(
&mut self,
address: Pubkey
) -> impl Future<Output = Result<u64, BanksClientError>>
pub fn get_balance( &mut self, address: Pubkey ) -> impl Future<Output = Result<u64, BanksClientError>>
Return the balance in lamports of an account at the given address at the time of the most recent root slot.
sourcepub fn get_transaction_status(
&mut self,
signature: Signature
) -> impl Future<Output = Result<Option<TransactionStatus>, BanksClientError>>
pub fn get_transaction_status( &mut self, signature: Signature ) -> impl Future<Output = Result<Option<TransactionStatus>, BanksClientError>>
Return the status of a transaction with a signature matching the transaction’s first signature. Return None if the transaction is not found, which may be because the blockhash was expired or the fee-paying account had insufficient funds to pay the transaction fee. Note that servers rarely store the full transaction history. This method may return None if the transaction status has been discarded.
sourcepub async fn get_transaction_statuses(
&mut self,
signatures: Vec<Signature, Global>
) -> impl Future<Output = Result<Vec<Option<TransactionStatus>, Global>, BanksClientError>>
pub async fn get_transaction_statuses( &mut self, signatures: Vec<Signature, Global> ) -> impl Future<Output = Result<Vec<Option<TransactionStatus>, Global>, BanksClientError>>
Same as get_transaction_status, but for multiple transactions.
pub fn get_latest_blockhash( &mut self ) -> impl Future<Output = Result<Hash, BanksClientError>>
pub fn get_latest_blockhash_with_commitment( &mut self, commitment: CommitmentLevel ) -> impl Future<Output = Result<Option<(Hash, u64)>, BanksClientError>>
pub fn get_latest_blockhash_with_commitment_and_context( &mut self, ctx: Context, commitment: CommitmentLevel ) -> impl Future<Output = Result<Option<(Hash, u64)>, BanksClientError>>
pub fn get_fee_for_message_with_commitment_and_context( &mut self, ctx: Context, commitment: CommitmentLevel, message: Message ) -> impl Future<Output = Result<Option<u64>, BanksClientError>>
Trait Implementations§
source§impl Clone for BanksClient
impl Clone for BanksClient
source§fn clone(&self) -> BanksClient
fn clone(&self) -> BanksClient
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl ProgramTestBanksClientExt for BanksClient
impl ProgramTestBanksClientExt for BanksClient
source§fn get_new_blockhash<'life0, 'life1, 'async_trait>(
&'life0 mut self,
blockhash: &'life1 Hash
) -> Pin<Box<dyn Future<Output = Result<(Hash, FeeCalculator)>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_new_blockhash<'life0, 'life1, 'async_trait>( &'life0 mut self, blockhash: &'life1 Hash ) -> Pin<Box<dyn Future<Output = Result<(Hash, FeeCalculator)>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,
get_new_latest_blockhash
instead