pub struct RobustProvider<N: Network = Ethereum> { /* private fields */ }Expand description
Provider wrapper with built-in retry and timeout mechanisms.
This wrapper around Alloy providers automatically handles retries, timeouts, and error logging for RPC calls.
Implementations§
Source§impl<N: Network> RobustProvider<N>
impl<N: Network> RobustProvider<N>
pub fn primary(&self) -> &RootProvider<N>
pub fn fallback_providers(&self) -> &[RootProvider<N>]
pub fn call_timeout(&self) -> Duration
pub fn max_retries(&self) -> usize
pub fn min_delay(&self) -> Duration
Sourcepub async fn get_accounts(&self) -> Result<Vec<Address>, Error>
pub async fn get_accounts(&self) -> Result<Vec<Address>, Error>
This is a wrapper function for Provider::get_accounts.
§Errors
Error::RpcError- if no fallback providers succeeded; contains the last error returned by the last provider attempted on the last retry.Error::Timeout- if the overall operation timeout elapses (i.e. exceedscall_timeout).
Sourcepub async fn get_blob_base_fee(&self) -> Result<u128, Error>
pub async fn get_blob_base_fee(&self) -> Result<u128, Error>
This is a wrapper function for Provider::get_blob_base_fee.
§Errors
Error::RpcError- if no fallback providers succeeded; contains the last error returned by the last provider attempted on the last retry.Error::Timeout- if the overall operation timeout elapses (i.e. exceedscall_timeout).
Sourcepub async fn call(&self, tx: N::TransactionRequest) -> Result<Bytes, Error>
pub async fn call(&self, tx: N::TransactionRequest) -> Result<Bytes, Error>
This is a wrapper function for Provider::call.
§Arguments
tx- The transaction request to simulate.
§Errors
Error::RpcError- if no fallback providers succeeded; contains the last error returned by the last provider attempted on the last retry.Error::Timeout- if the overall operation timeout elapses (i.e. exceedscall_timeout).
Sourcepub async fn call_many(
&self,
bundles: &[Bundle],
) -> Result<Vec<Vec<EthCallResponse>>, Error>
pub async fn call_many( &self, bundles: &[Bundle], ) -> Result<Vec<Vec<EthCallResponse>>, Error>
This is a wrapper function for Provider::call_many.
§Arguments
bundles- A slice of transaction bundles to execute.
§Errors
Error::RpcError- if no fallback providers succeeded; contains the last error returned by the last provider attempted on the last retry.Error::Timeout- if the overall operation timeout elapses (i.e. exceedscall_timeout).
Sourcepub async fn get_chain_id(&self) -> Result<u64, Error>
pub async fn get_chain_id(&self) -> Result<u64, Error>
This is a wrapper function for Provider::get_chain_id.
§Errors
Error::RpcError- if no fallback providers succeeded; contains the last error returned by the last provider attempted on the last retry.Error::Timeout- if the overall operation timeout elapses (i.e. exceedscall_timeout).
Sourcepub async fn get_net_version(&self) -> Result<u64, Error>
pub async fn get_net_version(&self) -> Result<u64, Error>
This is a wrapper function for Provider::get_net_version.
§Errors
Error::RpcError- if no fallback providers succeeded; contains the last error returned by the last provider attempted on the last retry.Error::Timeout- if the overall operation timeout elapses (i.e. exceedscall_timeout).
Sourcepub async fn get_sha3(&self, data: &[u8]) -> Result<B256, Error>
pub async fn get_sha3(&self, data: &[u8]) -> Result<B256, Error>
This is a wrapper function for Provider::get_sha3.
§Arguments
data- The data to hash.
§Errors
Error::RpcError- if no fallback providers succeeded; contains the last error returned by the last provider attempted on the last retry.Error::Timeout- if the overall operation timeout elapses (i.e. exceedscall_timeout).
Sourcepub async fn create_access_list(
&self,
request: &N::TransactionRequest,
) -> Result<AccessListResult, Error>
pub async fn create_access_list( &self, request: &N::TransactionRequest, ) -> Result<AccessListResult, Error>
This is a wrapper function for Provider::create_access_list.
§Arguments
request- The transaction request to create an access list for.
§Errors
Error::RpcError- if no fallback providers succeeded; contains the last error returned by the last provider attempted on the last retry.Error::Timeout- if the overall operation timeout elapses (i.e. exceedscall_timeout).
Sourcepub async fn estimate_gas(
&self,
tx: N::TransactionRequest,
) -> Result<u64, Error>
pub async fn estimate_gas( &self, tx: N::TransactionRequest, ) -> Result<u64, Error>
This is a wrapper function for Provider::estimate_gas.
§Arguments
tx- The transaction request to estimate gas for.
§Errors
Error::RpcError- if no fallback providers succeeded; contains the last error returned by the last provider attempted on the last retry.Error::Timeout- if the overall operation timeout elapses (i.e. exceedscall_timeout).
Sourcepub async fn estimate_eip1559_fees(&self) -> Result<Eip1559Estimation, Error>
pub async fn estimate_eip1559_fees(&self) -> Result<Eip1559Estimation, Error>
This is a wrapper function for Provider::estimate_eip1559_fees.
§Errors
Error::RpcError- if no fallback providers succeeded; contains the last error returned by the last provider attempted on the last retry.Error::Timeout- if the overall operation timeout elapses (i.e. exceedscall_timeout).
Sourcepub async fn get_fee_history(
&self,
block_count: u64,
last_block: BlockNumberOrTag,
reward_percentiles: &[f64],
) -> Result<FeeHistory, Error>
pub async fn get_fee_history( &self, block_count: u64, last_block: BlockNumberOrTag, reward_percentiles: &[f64], ) -> Result<FeeHistory, Error>
This is a wrapper function for Provider::get_fee_history.
§Arguments
block_count- The number of blocks to include in the fee history.
§Arguments
last_block- The last block to include in the fee history.
§Arguments
reward_percentiles- A list of percentiles to compute reward values for.
§Errors
Error::RpcError- if no fallback providers succeeded; contains the last error returned by the last provider attempted on the last retry.Error::Timeout- if the overall operation timeout elapses (i.e. exceedscall_timeout).
Sourcepub async fn get_gas_price(&self) -> Result<u128, Error>
pub async fn get_gas_price(&self) -> Result<u128, Error>
This is a wrapper function for Provider::get_gas_price.
§Errors
Error::RpcError- if no fallback providers succeeded; contains the last error returned by the last provider attempted on the last retry.Error::Timeout- if the overall operation timeout elapses (i.e. exceedscall_timeout).
Sourcepub async fn get_max_priority_fee_per_gas(&self) -> Result<u128, Error>
pub async fn get_max_priority_fee_per_gas(&self) -> Result<u128, Error>
This is a wrapper function for Provider::get_max_priority_fee_per_gas.
§Errors
Error::RpcError- if no fallback providers succeeded; contains the last error returned by the last provider attempted on the last retry.Error::Timeout- if the overall operation timeout elapses (i.e. exceedscall_timeout).
Sourcepub async fn get_account_info(
&self,
address: Address,
) -> Result<AccountInfo, Error>
pub async fn get_account_info( &self, address: Address, ) -> Result<AccountInfo, Error>
This is a wrapper function for Provider::get_account_info.
§Arguments
address- The address for which to get the account info.
§Errors
Error::RpcError- if no fallback providers succeeded; contains the last error returned by the last provider attempted on the last retry.Error::Timeout- if the overall operation timeout elapses (i.e. exceedscall_timeout).
Sourcepub async fn get_account(&self, address: Address) -> Result<TrieAccount, Error>
pub async fn get_account(&self, address: Address) -> Result<TrieAccount, Error>
This is a wrapper function for Provider::get_account.
§Arguments
address- The address to get the account for.
§Errors
Error::RpcError- if no fallback providers succeeded; contains the last error returned by the last provider attempted on the last retry.Error::Timeout- if the overall operation timeout elapses (i.e. exceedscall_timeout).
Sourcepub async fn get_balance(&self, address: Address) -> Result<U256, Error>
pub async fn get_balance(&self, address: Address) -> Result<U256, Error>
This is a wrapper function for Provider::get_balance.
§Arguments
address- The address to get the balance for.
§Errors
Error::RpcError- if no fallback providers succeeded; contains the last error returned by the last provider attempted on the last retry.Error::Timeout- if the overall operation timeout elapses (i.e. exceedscall_timeout).
Sourcepub async fn get_block_by_number(
&self,
number: BlockNumberOrTag,
) -> Result<N::BlockResponse, Error>
pub async fn get_block_by_number( &self, number: BlockNumberOrTag, ) -> Result<N::BlockResponse, Error>
This is a wrapper function for Provider::get_block_by_number.
§Arguments
number- The block number or tag.
§Errors
Error::RpcError- if no fallback providers succeeded; contains the last error returned by the last provider attempted on the last retry.Error::Timeout- if the overall operation timeout elapses (i.e. exceedscall_timeout).Error::BlockNotFound- if the block is not available. This is verified on Anvil, Reth, and Geth; other clients may surface this condition asError::RpcError.
Sourcepub async fn get_block(&self, id: BlockId) -> Result<N::BlockResponse, Error>
pub async fn get_block(&self, id: BlockId) -> Result<N::BlockResponse, Error>
This is a wrapper function for Provider::get_block.
§Arguments
id- The block identifier.
§Errors
Error::RpcError- if no fallback providers succeeded; contains the last error returned by the last provider attempted on the last retry.Error::Timeout- if the overall operation timeout elapses (i.e. exceedscall_timeout).Error::BlockNotFound- if the block is not available. This is verified on Anvil, Reth, and Geth; other clients may surface this condition asError::RpcError.
Sourcepub async fn get_block_number(&self) -> Result<BlockNumber, Error>
pub async fn get_block_number(&self) -> Result<BlockNumber, Error>
This is a wrapper function for Provider::get_block_number.
§Errors
Error::RpcError- if no fallback providers succeeded; contains the last error returned by the last provider attempted on the last retry.Error::Timeout- if the overall operation timeout elapses (i.e. exceedscall_timeout).
Sourcepub async fn get_block_number_by_id(
&self,
block_id: BlockId,
) -> Result<BlockNumber, Error>
pub async fn get_block_number_by_id( &self, block_id: BlockId, ) -> Result<BlockNumber, Error>
This is a wrapper function for Provider::get_block_number_by_id.
§Arguments
block_id- The block identifier to fetch the block number for.
§Errors
Error::RpcError- if no fallback providers succeeded; contains the last error returned by the last provider attempted on the last retry.Error::Timeout- if the overall operation timeout elapses (i.e. exceedscall_timeout).Error::BlockNotFound- if the block is not available. This is verified on Anvil, Reth, and Geth; other clients may surface this condition asError::RpcError.
Sourcepub async fn get_block_by_hash(
&self,
hash: BlockHash,
) -> Result<N::BlockResponse, Error>
pub async fn get_block_by_hash( &self, hash: BlockHash, ) -> Result<N::BlockResponse, Error>
This is a wrapper function for Provider::get_block_by_hash.
§Arguments
hash- The block hash.
§Errors
Error::RpcError- if no fallback providers succeeded; contains the last error returned by the last provider attempted on the last retry.Error::Timeout- if the overall operation timeout elapses (i.e. exceedscall_timeout).Error::BlockNotFound- if the block is not available. This is verified on Anvil, Reth, and Geth; other clients may surface this condition asError::RpcError.
Sourcepub async fn get_block_receipts(
&self,
block: BlockId,
) -> Result<Vec<N::ReceiptResponse>, Error>
pub async fn get_block_receipts( &self, block: BlockId, ) -> Result<Vec<N::ReceiptResponse>, Error>
This is a wrapper function for Provider::get_block_receipts.
§Arguments
block- The block identifier (hash, number, or tag).
§Errors
Error::RpcError- if no fallback providers succeeded; contains the last error returned by the last provider attempted on the last retry.Error::Timeout- if the overall operation timeout elapses (i.e. exceedscall_timeout).Error::BlockNotFound- if the block is not available. This is verified on Anvil, Reth, and Geth; other clients may surface this condition asError::RpcError.
Sourcepub async fn get_block_transaction_count_by_hash(
&self,
hash: BlockHash,
) -> Result<u64, Error>
pub async fn get_block_transaction_count_by_hash( &self, hash: BlockHash, ) -> Result<u64, Error>
This is a wrapper function for Provider::get_block_transaction_count_by_hash.
§Arguments
hash- The block hash.
§Errors
Error::RpcError- if no fallback providers succeeded; contains the last error returned by the last provider attempted on the last retry.Error::Timeout- if the overall operation timeout elapses (i.e. exceedscall_timeout).Error::BlockNotFound- if the block is not available. This is verified on Anvil, Reth, and Geth; other clients may surface this condition asError::RpcError.
Sourcepub async fn get_block_transaction_count_by_number(
&self,
block_number: BlockNumberOrTag,
) -> Result<u64, Error>
pub async fn get_block_transaction_count_by_number( &self, block_number: BlockNumberOrTag, ) -> Result<u64, Error>
This is a wrapper function for Provider::get_block_transaction_count_by_number.
§Arguments
block_number- The block number or tag.
§Errors
Error::RpcError- if no fallback providers succeeded; contains the last error returned by the last provider attempted on the last retry.Error::Timeout- if the overall operation timeout elapses (i.e. exceedscall_timeout).Error::BlockNotFound- if the block is not available. This is verified on Anvil, Reth, and Geth; other clients may surface this condition asError::RpcError.
Sourcepub async fn get_logs(&self, filter: &Filter) -> Result<Vec<Log>, Error>
pub async fn get_logs(&self, filter: &Filter) -> Result<Vec<Log>, Error>
This is a wrapper function for Provider::get_logs.
§Arguments
filter- The log filter.
§Errors
Error::RpcError- if no fallback providers succeeded; contains the last error returned by the last provider attempted on the last retry.Error::Timeout- if the overall operation timeout elapses (i.e. exceedscall_timeout).
Sourcepub async fn get_code_at(&self, address: Address) -> Result<Bytes, Error>
pub async fn get_code_at(&self, address: Address) -> Result<Bytes, Error>
This is a wrapper function for Provider::get_code_at.
§Arguments
address- The address to get the code for.
§Errors
Error::RpcError- if no fallback providers succeeded; contains the last error returned by the last provider attempted on the last retry.Error::Timeout- if the overall operation timeout elapses (i.e. exceedscall_timeout).
Sourcepub async fn get_filter_logs(&self, filter_id: U256) -> Result<Vec<Log>, Error>
pub async fn get_filter_logs(&self, filter_id: U256) -> Result<Vec<Log>, Error>
This is a wrapper function for Provider::get_filter_logs.
§Arguments
filter_id- The filter ID to fetch logs for.
§Errors
Error::RpcError- if no fallback providers succeeded; contains the last error returned by the last provider attempted on the last retry.Error::Timeout- if the overall operation timeout elapses (i.e. exceedscall_timeout).
Sourcepub async fn get_filter_changes<R: RpcRecv>(
&self,
filter_id: U256,
) -> Result<Vec<R>, Error>
pub async fn get_filter_changes<R: RpcRecv>( &self, filter_id: U256, ) -> Result<Vec<R>, Error>
This is a wrapper function for Provider::get_filter_changes.
§Arguments
filter_id- The filter ID to get changes for.
§Errors
Error::RpcError- if no fallback providers succeeded; contains the last error returned by the last provider attempted on the last retry.Error::Timeout- if the overall operation timeout elapses (i.e. exceedscall_timeout).
Sourcepub async fn new_filter(&self, filter: &Filter) -> Result<U256, Error>
pub async fn new_filter(&self, filter: &Filter) -> Result<U256, Error>
This is a wrapper function for Provider::new_filter.
§Arguments
filter- The filter to create.
§Errors
Error::RpcError- if no fallback providers succeeded; contains the last error returned by the last provider attempted on the last retry.Error::Timeout- if the overall operation timeout elapses (i.e. exceedscall_timeout).
Sourcepub async fn new_block_filter(&self) -> Result<U256, Error>
pub async fn new_block_filter(&self) -> Result<U256, Error>
This is a wrapper function for Provider::new_block_filter.
§Errors
Error::RpcError- if no fallback providers succeeded; contains the last error returned by the last provider attempted on the last retry.Error::Timeout- if the overall operation timeout elapses (i.e. exceedscall_timeout).
Sourcepub async fn new_pending_transactions_filter(
&self,
full: bool,
) -> Result<U256, Error>
pub async fn new_pending_transactions_filter( &self, full: bool, ) -> Result<U256, Error>
This is a wrapper function for Provider::new_pending_transactions_filter.
§Arguments
full- Whether to include full transaction objects.
§Errors
Error::RpcError- if no fallback providers succeeded; contains the last error returned by the last provider attempted on the last retry.Error::Timeout- if the overall operation timeout elapses (i.e. exceedscall_timeout).
Sourcepub async fn sign_transaction(
&self,
tx: N::TransactionRequest,
) -> Result<Bytes, Error>
pub async fn sign_transaction( &self, tx: N::TransactionRequest, ) -> Result<Bytes, Error>
This is a wrapper function for Provider::sign_transaction.
§Arguments
tx- The transaction request to sign.
§Errors
Error::RpcError- if no fallback providers succeeded; contains the last error returned by the last provider attempted on the last retry.Error::Timeout- if the overall operation timeout elapses (i.e. exceedscall_timeout).
Sourcepub async fn fill_transaction(
&self,
tx: N::TransactionRequest,
) -> Result<FillTransaction<N::TxEnvelope>, Error>where
N::TxEnvelope: RpcRecv,
pub async fn fill_transaction(
&self,
tx: N::TransactionRequest,
) -> Result<FillTransaction<N::TxEnvelope>, Error>where
N::TxEnvelope: RpcRecv,
This is a wrapper function for Provider::fill_transaction.
§Arguments
tx- The transaction request to fill.
§Errors
Error::RpcError- if no fallback providers succeeded; contains the last error returned by the last provider attempted on the last retry.Error::Timeout- if the overall operation timeout elapses (i.e. exceedscall_timeout).
Sourcepub async fn get_proof(
&self,
address: Address,
keys: Vec<StorageKey>,
) -> Result<EIP1186AccountProofResponse, Error>
pub async fn get_proof( &self, address: Address, keys: Vec<StorageKey>, ) -> Result<EIP1186AccountProofResponse, Error>
This is a wrapper function for Provider::get_proof.
§Arguments
address- The address of the account.
§Arguments
keys- A vector of storage keys to include in the proof.
§Errors
Error::RpcError- if no fallback providers succeeded; contains the last error returned by the last provider attempted on the last retry.Error::Timeout- if the overall operation timeout elapses (i.e. exceedscall_timeout).
Sourcepub async fn get_storage_at(
&self,
address: Address,
key: U256,
) -> Result<StorageValue, Error>
pub async fn get_storage_at( &self, address: Address, key: U256, ) -> Result<StorageValue, Error>
This is a wrapper function for Provider::get_storage_at.
§Arguments
address- The address of the storage.
§Arguments
key- The position in the storage.
§Errors
Error::RpcError- if no fallback providers succeeded; contains the last error returned by the last provider attempted on the last retry.Error::Timeout- if the overall operation timeout elapses (i.e. exceedscall_timeout).
Sourcepub async fn get_transaction_by_block_hash_and_index(
&self,
block_hash: B256,
index: usize,
) -> Result<Option<N::TransactionResponse>, Error>
pub async fn get_transaction_by_block_hash_and_index( &self, block_hash: B256, index: usize, ) -> Result<Option<N::TransactionResponse>, Error>
This is a wrapper function for Provider::get_transaction_by_block_hash_and_index.
§Arguments
block_hash- The hash of the block.
§Arguments
index- The transaction index position.
§Errors
Error::RpcError- if no fallback providers succeeded; contains the last error returned by the last provider attempted on the last retry.Error::Timeout- if the overall operation timeout elapses (i.e. exceedscall_timeout).
Sourcepub async fn get_transaction_by_block_number_and_index(
&self,
block_number: BlockNumberOrTag,
index: usize,
) -> Result<Option<N::TransactionResponse>, Error>
pub async fn get_transaction_by_block_number_and_index( &self, block_number: BlockNumberOrTag, index: usize, ) -> Result<Option<N::TransactionResponse>, Error>
This is a wrapper function for Provider::get_transaction_by_block_number_and_index.
§Arguments
block_number- The block number or tag.
§Arguments
index- The transaction index position.
§Errors
Error::RpcError- if no fallback providers succeeded; contains the last error returned by the last provider attempted on the last retry.Error::Timeout- if the overall operation timeout elapses (i.e. exceedscall_timeout).
Sourcepub async fn get_transaction_by_hash(
&self,
hash: TxHash,
) -> Result<Option<N::TransactionResponse>, Error>
pub async fn get_transaction_by_hash( &self, hash: TxHash, ) -> Result<Option<N::TransactionResponse>, Error>
This is a wrapper function for Provider::get_transaction_by_hash.
§Arguments
hash- The transaction hash.
§Errors
Error::RpcError- if no fallback providers succeeded; contains the last error returned by the last provider attempted on the last retry.Error::Timeout- if the overall operation timeout elapses (i.e. exceedscall_timeout).
Sourcepub async fn get_raw_transaction_by_hash(
&self,
hash: TxHash,
) -> Result<Option<Bytes>, Error>
pub async fn get_raw_transaction_by_hash( &self, hash: TxHash, ) -> Result<Option<Bytes>, Error>
This is a wrapper function for Provider::get_raw_transaction_by_hash.
§Arguments
hash- The transaction hash.
§Errors
Error::RpcError- if no fallback providers succeeded; contains the last error returned by the last provider attempted on the last retry.Error::Timeout- if the overall operation timeout elapses (i.e. exceedscall_timeout).
Sourcepub async fn get_transaction_count(
&self,
address: Address,
) -> Result<u64, Error>
pub async fn get_transaction_count( &self, address: Address, ) -> Result<u64, Error>
This is a wrapper function for Provider::get_transaction_count.
§Arguments
address- The address to get the transaction count for.
§Errors
Error::RpcError- if no fallback providers succeeded; contains the last error returned by the last provider attempted on the last retry.Error::Timeout- if the overall operation timeout elapses (i.e. exceedscall_timeout).
Sourcepub async fn get_transaction_receipt(
&self,
hash: TxHash,
) -> Result<Option<N::ReceiptResponse>, Error>
pub async fn get_transaction_receipt( &self, hash: TxHash, ) -> Result<Option<N::ReceiptResponse>, Error>
This is a wrapper function for Provider::get_transaction_receipt.
§Arguments
hash- The transaction hash.
§Errors
Error::RpcError- if no fallback providers succeeded; contains the last error returned by the last provider attempted on the last retry.Error::Timeout- if the overall operation timeout elapses (i.e. exceedscall_timeout).
Sourcepub async fn get_uncle_count(&self, block: BlockId) -> Result<u64, Error>
pub async fn get_uncle_count(&self, block: BlockId) -> Result<u64, Error>
This is a wrapper function for Provider::get_uncle_count.
§Arguments
block- The block identifier (hash or number).
§Errors
Error::RpcError- if no fallback providers succeeded; contains the last error returned by the last provider attempted on the last retry.Error::Timeout- if the overall operation timeout elapses (i.e. exceedscall_timeout).
Sourcepub async fn get_uncle(
&self,
tag: BlockId,
idx: u64,
) -> Result<Option<N::BlockResponse>, Error>
pub async fn get_uncle( &self, tag: BlockId, idx: u64, ) -> Result<Option<N::BlockResponse>, Error>
This is a wrapper function for Provider::get_uncle.
§Arguments
tag- The block identifier (hash or number).
§Arguments
idx- The uncle index position.
§Errors
Error::RpcError- if no fallback providers succeeded; contains the last error returned by the last provider attempted on the last retry.Error::Timeout- if the overall operation timeout elapses (i.e. exceedscall_timeout).
Sourcepub async fn simulate(
&self,
request: &SimulatePayload,
) -> Result<Vec<SimulatedBlock<N::BlockResponse>>, Error>
pub async fn simulate( &self, request: &SimulatePayload, ) -> Result<Vec<SimulatedBlock<N::BlockResponse>>, Error>
This is a wrapper function for Provider::simulate.
§Arguments
request- The simulation request
§Errors
Error::RpcError- if no fallback providers succeeded; contains the last error returned by the last provider attempted on the last retry.Error::Timeout- if the overall operation timeout elapses (i.e. exceedscall_timeout).
Sourcepub async fn syncing(&self) -> Result<SyncStatus, Error>
pub async fn syncing(&self) -> Result<SyncStatus, Error>
This is a wrapper function for Provider::syncing.
§Errors
Error::RpcError- if no fallback providers succeeded; contains the last error returned by the last provider attempted on the last retry.Error::Timeout- if the overall operation timeout elapses (i.e. exceedscall_timeout).
Sourcepub async fn uninstall_filter(&self, id: U256) -> Result<bool, Error>
pub async fn uninstall_filter(&self, id: U256) -> Result<bool, Error>
This is a wrapper function for Provider::uninstall_filter.
§Arguments
id- The filter ID to uninstall.
§Errors
Error::RpcError- if no fallback providers succeeded; contains the last error returned by the last provider attempted on the last retry.Error::Timeout- if the overall operation timeout elapses (i.e. exceedscall_timeout).
Sourcepub async fn send_raw_transaction(
&self,
encoded_tx: &[u8],
) -> Result<PendingTransactionBuilder<N>, Error>
pub async fn send_raw_transaction( &self, encoded_tx: &[u8], ) -> Result<PendingTransactionBuilder<N>, Error>
This is a wrapper function for Provider::send_raw_transaction.
§Arguments
encoded_tx- The RLP-encoded signed transaction bytes
§Errors
Error::RpcError- if no fallback providers succeeded; contains the last error returned by the last provider attempted on the last retry.Error::Timeout- if the overall operation timeout elapses (i.e. exceedscall_timeout).
Sourcepub async fn send_raw_transaction_sync(
&self,
encoded_tx: &[u8],
) -> Result<N::ReceiptResponse, Error>
pub async fn send_raw_transaction_sync( &self, encoded_tx: &[u8], ) -> Result<N::ReceiptResponse, Error>
This is a wrapper function for Provider::send_raw_transaction_sync.
§Arguments
encoded_tx- The RLP-encoded signed transaction bytes
§Errors
Error::RpcError- if no fallback providers succeeded; contains the last error returned by the last provider attempted on the last retry.Error::Timeout- if the overall operation timeout elapses (i.e. exceedscall_timeout).
Sourcepub async fn send_raw_transaction_conditional(
&self,
encoded_tx: &[u8],
conditional: TransactionConditional,
) -> Result<PendingTransactionBuilder<N>, Error>
pub async fn send_raw_transaction_conditional( &self, encoded_tx: &[u8], conditional: TransactionConditional, ) -> Result<PendingTransactionBuilder<N>, Error>
This is a wrapper function for Provider::send_raw_transaction_conditional.
§Arguments
encoded_tx- The RLP-encoded signed transaction bytes
§Arguments
conditional- The transaction conditional to apply
§Errors
Error::RpcError- if no fallback providers succeeded; contains the last error returned by the last provider attempted on the last retry.Error::Timeout- if the overall operation timeout elapses (i.e. exceedscall_timeout).
Sourcepub async fn send_transaction(
&self,
tx: N::TransactionRequest,
) -> Result<PendingTransactionBuilder<N>, Error>
pub async fn send_transaction( &self, tx: N::TransactionRequest, ) -> Result<PendingTransactionBuilder<N>, Error>
This is a wrapper function for Provider::send_transaction.
§Arguments
tx- The transaction request to send
§Errors
Error::RpcError- if no fallback providers succeeded; contains the last error returned by the last provider attempted on the last retry.Error::Timeout- if the overall operation timeout elapses (i.e. exceedscall_timeout).
Sourcepub async fn send_tx_envelope(
&self,
tx: N::TxEnvelope,
) -> Result<PendingTransactionBuilder<N>, Error>where
N::TxEnvelope: Clone,
pub async fn send_tx_envelope(
&self,
tx: N::TxEnvelope,
) -> Result<PendingTransactionBuilder<N>, Error>where
N::TxEnvelope: Clone,
This is a wrapper function for Provider::send_tx_envelope.
§Arguments
tx- The signed transaction envelope to send.
§Errors
Error::RpcError- if no fallback providers succeeded; contains the last error returned by the last provider attempted on the last retry.Error::Timeout- if the overall operation timeout elapses (i.e. exceedscall_timeout).
Sourcepub async fn send_transaction_sync(
&self,
tx: N::TransactionRequest,
) -> Result<N::ReceiptResponse, Error>
pub async fn send_transaction_sync( &self, tx: N::TransactionRequest, ) -> Result<N::ReceiptResponse, Error>
This is a wrapper function for Provider::send_transaction_sync.
§Arguments
tx- The transaction request to send synchronously
§Errors
Error::RpcError- if no fallback providers succeeded; contains the last error returned by the last provider attempted on the last retry.Error::Timeout- if the overall operation timeout elapses (i.e. exceedscall_timeout).
Sourcepub async fn get_transaction_by_sender_nonce(
&self,
sender: Address,
nonce: u64,
) -> Result<Option<N::TransactionResponse>, Error>
pub async fn get_transaction_by_sender_nonce( &self, sender: Address, nonce: u64, ) -> Result<Option<N::TransactionResponse>, Error>
This is a wrapper function for Provider::get_transaction_by_sender_nonce.
§Arguments
sender- The sender address
§Arguments
nonce- The nonce of the transaction
§Errors
Error::RpcError- if no fallback providers succeeded; contains the last error returned by the last provider attempted on the last retry.Error::Timeout- if the overall operation timeout elapses (i.e. exceedscall_timeout).
Sourcepub async fn get_raw_transaction_by_block_hash_and_index(
&self,
block_hash: B256,
index: usize,
) -> Result<Option<Bytes>, Error>
pub async fn get_raw_transaction_by_block_hash_and_index( &self, block_hash: B256, index: usize, ) -> Result<Option<Bytes>, Error>
This is a wrapper function for Provider::get_raw_transaction_by_block_hash_and_index.
§Arguments
block_hash- The hash of the block
§Arguments
index- The transaction index position
§Errors
Error::RpcError- if no fallback providers succeeded; contains the last error returned by the last provider attempted on the last retry.Error::Timeout- if the overall operation timeout elapses (i.e. exceedscall_timeout).
Sourcepub async fn get_raw_transaction_by_block_number_and_index(
&self,
block_number: BlockNumberOrTag,
index: usize,
) -> Result<Option<Bytes>, Error>
pub async fn get_raw_transaction_by_block_number_and_index( &self, block_number: BlockNumberOrTag, index: usize, ) -> Result<Option<Bytes>, Error>
This is a wrapper function for Provider::get_raw_transaction_by_block_number_and_index.
§Arguments
block_number- The block number or tag
§Arguments
index- The transaction index position
§Errors
Error::RpcError- if no fallback providers succeeded; contains the last error returned by the last provider attempted on the last retry.Error::Timeout- if the overall operation timeout elapses (i.e. exceedscall_timeout).
Sourcepub async fn get_client_version(&self) -> Result<String, Error>
pub async fn get_client_version(&self) -> Result<String, Error>
This is a wrapper function for Provider::get_client_version.
§Errors
Error::RpcError- if no fallback providers succeeded; contains the last error returned by the last provider attempted on the last retry.Error::Timeout- if the overall operation timeout elapses (i.e. exceedscall_timeout).
Sourcepub async fn estimate_eip1559_fees_with(
&self,
estimator: Eip1559Estimator,
) -> Result<Eip1559Estimation, Error>
pub async fn estimate_eip1559_fees_with( &self, estimator: Eip1559Estimator, ) -> Result<Eip1559Estimation, Error>
Estimates the [EIP-1559] maxFeePerGas and maxPriorityFeePerGas fields using a custom
estimator.
§Implementation Note
Unlike most methods in RobustProvider, this method does not wrap the underlying
provider’s estimate_eip1559_fees_with call with retry/failover logic. Instead, it
implements the estimation logic directly (copied from alloy’s implementation).
Reason: This method accepts an owned, non-cloneable Eip1559Estimator value.
The current retry implementation (try_operation_with_failover) requires operations to
be retryable across multiple providers, which means closures must be able to run
multiple times. This only works with Copy or Clone types. Since Eip1559Estimator
consumes itself and cannot be cloned, we cannot use the standard retry wrapper.
There is a pending issue on alloy https://github.com/alloy-rs/alloy/issues/3669 which
would allow Eip1559Estimator to implement Clone. If this is merged we can remove this
custom impl.
However, the individual RPC calls within this method (get_fee_history and
get_block_by_number) do benefit from full retry and failover support, as they use
the standard robust wrappers internally.
§Parameters
estimator- TheEip1559Estimatorto use for calculating fees.
§Errors
Error::RpcError- if the underlying RPC calls fail after exhausting retries on all providersError::Timeout- if the operation exceeds the configured timeoutError::RpcErrorwithUnsupportedFeature("eip1559")- if the chain doesn’t support EIP-1559 (i.e., the latest block has nobase_fee_per_gas)
Sourcepub async fn raw_request<P, R>(
&self,
method: Cow<'static, str>,
params: P,
) -> Result<R, Error>
pub async fn raw_request<P, R>( &self, method: Cow<'static, str>, params: P, ) -> Result<R, Error>
This is a wrapper function for Provider::raw_request.
§Errors
Error::RpcError- if no fallback providers succeeded; contains the last error returned by the last provider attempted on the last retry.Error::Timeout- if the overall operation timeout elapses (i.e. exceedscall_timeout).
Sourcepub async fn raw_request_dyn(
&self,
method: Cow<'static, str>,
params: &RawValue,
) -> Result<Box<RawValue>, Error>
pub async fn raw_request_dyn( &self, method: Cow<'static, str>, params: &RawValue, ) -> Result<Box<RawValue>, Error>
This is a wrapper function for Provider::raw_request_dyn.
§Errors
Error::RpcError- if no fallback providers succeeded; contains the last error returned by the last provider attempted on the last retry.Error::Timeout- if the overall operation timeout elapses (i.e. exceedscall_timeout).
Sourcepub async fn subscribe_blocks(&self) -> Result<RobustSubscription<N>, Error>
pub async fn subscribe_blocks(&self) -> Result<RobustSubscription<N>, Error>
Subscribe to new block headers with automatic failover and reconnection.
Returns a RobustSubscription that automatically:
- Handles connection errors by switching to fallback providers
- Detects and recovers from lagged subscriptions
- Periodically attempts to reconnect to the primary provider
When the http-subscription feature is enabled and
allow_http_subscriptions
is set to true, HTTP providers can participate in subscriptions via polling.
This is a wrapper function for Provider::subscribe_blocks.
§Errors
Error::RpcError- if no fallback providers succeeded; contains the last error returned by the last provider attempted on the last retry.Error::Timeout- if the overall operation timeout elapses (i.e. exceedscall_timeout).
Sourcepub async fn watch_blocks(
&self,
) -> Result<PollerBuilder<(U256,), Vec<BlockHash>>, Error>
pub async fn watch_blocks( &self, ) -> Result<PollerBuilder<(U256,), Vec<BlockHash>>, Error>
This is a wrapper function for Provider::watch_blocks.
§Errors
Error::RpcError- if no fallback providers succeeded; contains the last error returned by the last provider attempted on the last retry.Error::Timeout- if the overall operation timeout elapses (i.e. exceedscall_timeout).
Sourcepub async fn try_operation_with_failover<T: Debug, F, Fut>(
&self,
operation: F,
) -> Result<T, FailoverError>
pub async fn try_operation_with_failover<T: Debug, F, Fut>( &self, operation: F, ) -> Result<T, FailoverError>
Execute operation with exponential backoff and a total timeout.
Wraps the retry logic with tokio::time::timeout so
the entire operation (including time spent inside the RPC call) cannot exceed
call_timeout.
If the timeout is exceeded and fallback providers are available, it will attempt to use each fallback provider in sequence.
§Errors
FailoverError::RpcError- if no fallback providers succeeded; contains the last error returned by the last provider attempted on the last retry.FailoverError::Timeout- if the overall operation timeout elapses (i.e. exceedscall_timeout).
Trait Implementations§
Source§impl<N: Clone + Network> Clone for RobustProvider<N>
impl<N: Clone + Network> Clone for RobustProvider<N>
Source§fn clone(&self) -> RobustProvider<N>
fn clone(&self) -> RobustProvider<N>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<N: Network> IntoRobustProvider<N> for RobustProvider<N>
impl<N: Network> IntoRobustProvider<N> for RobustProvider<N>
Source§async fn into_robust_provider(self) -> Result<RobustProvider<N>, Error>
async fn into_robust_provider(self) -> Result<RobustProvider<N>, Error>
Auto Trait Implementations§
impl<N> Freeze for RobustProvider<N>
impl<N = Ethereum> !RefUnwindSafe for RobustProvider<N>
impl<N> Send for RobustProvider<N>
impl<N> Sync for RobustProvider<N>
impl<N> Unpin for RobustProvider<N>
impl<N> UnsafeUnpin for RobustProvider<N>
impl<N = Ethereum> !UnwindSafe for RobustProvider<N>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more