TransactionRpcProvider

Trait TransactionRpcProvider 

Source
pub trait TransactionRpcProvider: Send + Sync {
    // Required methods
    fn get_recent_prioritization_fees<'life0, 'life1, 'async_trait>(
        &'life0 self,
        accounts: &'life1 [Pubkey],
    ) -> Pin<Box<dyn Future<Output = Result<Vec<RpcPrioritizationFee>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn get_lookup_table_accounts<'life0, 'life1, 'async_trait>(
        &'life0 self,
        pubkeys: &'life1 [Pubkey],
    ) -> Pin<Box<dyn Future<Output = Result<Vec<AddressLookupTableAccount>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn get_latest_blockhash<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Hash>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn simulate_transaction<'life0, 'life1, 'async_trait>(
        &'life0 self,
        tx: &'life1 VersionedTransaction,
        config: RpcSimulateTransactionConfig,
    ) -> Pin<Box<dyn Future<Output = Result<RpcSimulateTransactionResult>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn send_and_confirm_transaction<'life0, 'life1, 'async_trait>(
        &'life0 self,
        tx: &'life1 VersionedTransaction,
        config: Option<RpcSendTransactionConfig>,
    ) -> Pin<Box<dyn Future<Output = Result<Signature>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Trait abstracting RPC operations for Solana transactions.

This trait allows for different RPC implementations (native, cached, mocked) while maintaining a consistent interface for transaction building and submission.

§Implementing Custom Providers

Custom implementations can add caching, rate limiting, retry logic, or use alternative RPC endpoints. All implementations must handle errors by converting them to the crate’s Error type.

§Examples

let rpc = RpcClient::new("https://api.mainnet-beta.solana.com".to_string());
let provider: NativeRpcWrapper = rpc.into();

Required Methods§

Source

fn get_recent_prioritization_fees<'life0, 'life1, 'async_trait>( &'life0 self, accounts: &'life1 [Pubkey], ) -> Pin<Box<dyn Future<Output = Result<Vec<RpcPrioritizationFee>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn get_lookup_table_accounts<'life0, 'life1, 'async_trait>( &'life0 self, pubkeys: &'life1 [Pubkey], ) -> Pin<Box<dyn Future<Output = Result<Vec<AddressLookupTableAccount>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn get_latest_blockhash<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Hash>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn simulate_transaction<'life0, 'life1, 'async_trait>( &'life0 self, tx: &'life1 VersionedTransaction, config: RpcSimulateTransactionConfig, ) -> Pin<Box<dyn Future<Output = Result<RpcSimulateTransactionResult>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn send_and_confirm_transaction<'life0, 'life1, 'async_trait>( &'life0 self, tx: &'life1 VersionedTransaction, config: Option<RpcSendTransactionConfig>, ) -> Pin<Box<dyn Future<Output = Result<Signature>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Implementations on Foreign Types§

Source§

impl TransactionRpcProvider for Arc<RpcClient>

Source§

fn get_recent_prioritization_fees<'life0, 'life1, 'async_trait>( &'life0 self, accounts: &'life1 [Pubkey], ) -> Pin<Box<dyn Future<Output = Result<Vec<RpcPrioritizationFee>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

fn get_lookup_table_accounts<'life0, 'life1, 'async_trait>( &'life0 self, pubkeys: &'life1 [Pubkey], ) -> Pin<Box<dyn Future<Output = Result<Vec<AddressLookupTableAccount>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

fn get_latest_blockhash<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Hash>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn simulate_transaction<'life0, 'life1, 'async_trait>( &'life0 self, tx: &'life1 VersionedTransaction, config: RpcSimulateTransactionConfig, ) -> Pin<Box<dyn Future<Output = Result<RpcSimulateTransactionResult>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

fn send_and_confirm_transaction<'life0, 'life1, 'async_trait>( &'life0 self, tx: &'life1 VersionedTransaction, config: Option<RpcSendTransactionConfig>, ) -> Pin<Box<dyn Future<Output = Result<Signature>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Implementors§