pub struct InstrumentedClient { /* private fields */ }
Expand description
This struct represents an instrumented client that can be used to interact with an Ethereum node. It provides a set of methods to interact with the node and measures the duration of the calls.
Implementations§
Source§impl InstrumentedClient
impl InstrumentedClient
Sourcepub async fn new(url: &str) -> Result<Self, InstrumentedClientError>
pub async fn new(url: &str) -> Result<Self, InstrumentedClientError>
Sourcepub async fn new_ws(url: &str) -> Result<Self, InstrumentedClientError>
pub async fn new_ws(url: &str) -> Result<Self, InstrumentedClientError>
Sourcepub async fn new_from_client(
client: RootProvider<Http<Client>>,
) -> Result<Self, InstrumentedClientError>
pub async fn new_from_client( client: RootProvider<Http<Client>>, ) -> Result<Self, InstrumentedClientError>
Sourcepub async fn chain_id(&self) -> TransportResult<ChainId>
pub async fn chain_id(&self) -> TransportResult<ChainId>
Sourcepub async fn balance_at(
&self,
account: Address,
block_number: BlockNumberOrTag,
) -> TransportResult<U256>
pub async fn balance_at( &self, account: Address, block_number: BlockNumberOrTag, ) -> TransportResult<U256>
Sourcepub async fn block_by_hash(
&self,
hash: BlockHash,
) -> TransportResult<Option<Block>>
pub async fn block_by_hash( &self, hash: BlockHash, ) -> TransportResult<Option<Block>>
Sourcepub async fn call_contract(
&self,
call: TransactionRequest,
block_number: BlockNumberOrTag,
) -> TransportResult<Bytes>
pub async fn call_contract( &self, call: TransactionRequest, block_number: BlockNumberOrTag, ) -> TransportResult<Bytes>
Sourcepub async fn code_at(
&self,
address: Address,
block_number: BlockNumberOrTag,
) -> TransportResult<Bytes>
pub async fn code_at( &self, address: Address, block_number: BlockNumberOrTag, ) -> TransportResult<Bytes>
Sourcepub async fn estimate_gas(&self, tx: TransactionRequest) -> TransportResult<u64>
pub async fn estimate_gas(&self, tx: TransactionRequest) -> TransportResult<u64>
Sourcepub async fn fee_history(
&self,
block_count: u64,
last_block: BlockNumberOrTag,
reward_percentiles: &[f64],
) -> TransportResult<FeeHistory>
pub async fn fee_history( &self, block_count: u64, last_block: BlockNumberOrTag, reward_percentiles: &[f64], ) -> TransportResult<FeeHistory>
Returns a collection of historical gas information.
§Arguments
block_count
- The number of blocks to include in the collection.last_block
- The last block number to include in the collection.reward_percentiles
- A sorted list of percentage points used to sample the effective priority fees per gas from each block. The samples are taken in ascending order and weighted by gas usage. The list is sorted increasingly.
Sourcepub async fn filter_logs(&self, filter: Filter) -> TransportResult<Vec<Log>>
pub async fn filter_logs(&self, filter: Filter) -> TransportResult<Vec<Log>>
Sourcepub async fn header_by_hash(&self, hash: B256) -> TransportResult<Header>
pub async fn header_by_hash(&self, hash: B256) -> TransportResult<Header>
Sourcepub async fn header_by_number(
&self,
block_number: BlockNumberOrTag,
) -> TransportResult<Header>
pub async fn header_by_number( &self, block_number: BlockNumberOrTag, ) -> TransportResult<Header>
Sourcepub async fn nonce_at(
&self,
account: Address,
block_number: BlockNumberOrTag,
) -> TransportResult<u64>
pub async fn nonce_at( &self, account: Address, block_number: BlockNumberOrTag, ) -> TransportResult<u64>
Sourcepub async fn pending_balance_at(
&self,
account: Address,
) -> TransportResult<U256>
pub async fn pending_balance_at( &self, account: Address, ) -> TransportResult<U256>
Sourcepub async fn pending_call_contract(
&self,
call: TransactionRequest,
) -> TransportResult<Bytes>
pub async fn pending_call_contract( &self, call: TransactionRequest, ) -> TransportResult<Bytes>
Sourcepub async fn pending_code_at(&self, account: Address) -> TransportResult<Bytes>
pub async fn pending_code_at(&self, account: Address) -> TransportResult<Bytes>
Sourcepub async fn pending_nonce_at(&self, account: Address) -> TransportResult<u64>
pub async fn pending_nonce_at(&self, account: Address) -> TransportResult<u64>
Sourcepub async fn pending_storage_at(
&self,
account: Address,
key: U256,
) -> TransportResult<U256>
pub async fn pending_storage_at( &self, account: Address, key: U256, ) -> TransportResult<U256>
Sourcepub async fn pending_transaction_count(&self) -> TransportResult<u64>
pub async fn pending_transaction_count(&self) -> TransportResult<u64>
Returns the total number of transactions in the pending state.
§Returns
The number of pending transactions.
Sourcepub async fn send_transaction(&self, tx: TxEnvelope) -> TransportResult<B256>
pub async fn send_transaction(&self, tx: TxEnvelope) -> TransportResult<B256>
Sourcepub async fn storage_at(
&self,
account: Address,
key: U256,
block_number: U256,
) -> TransportResult<U256>
pub async fn storage_at( &self, account: Address, key: U256, block_number: U256, ) -> TransportResult<U256>
Sourcepub async fn subscribe_filter_logs<R: RpcReturn>(
&self,
filter: Filter,
) -> TransportResult<Subscription<R>>
pub async fn subscribe_filter_logs<R: RpcReturn>( &self, filter: Filter, ) -> TransportResult<Subscription<R>>
Sourcepub async fn subscribe_new_head<R: RpcReturn>(
&self,
) -> TransportResult<Subscription<R>>
pub async fn subscribe_new_head<R: RpcReturn>( &self, ) -> TransportResult<Subscription<R>>
Sourcepub async fn suggest_gas_price(&self) -> TransportResult<u64>
pub async fn suggest_gas_price(&self) -> TransportResult<u64>
Sourcepub async fn suggest_gas_tip_cap(&self) -> TransportResult<u64>
pub async fn suggest_gas_tip_cap(&self) -> TransportResult<u64>
Retrieves the currently suggested gas tip cap after EIP1559.
§Returns
The currently suggested gas price.
Sourcepub async fn sync_progress(&self) -> TransportResult<SyncStatus>
pub async fn sync_progress(&self) -> TransportResult<SyncStatus>
Retrieves the current progress of the sync algorithm. If there’s no sync currently running, it returns None.
§Returns
The current progress of the sync algorithm.
Sourcepub async fn transaction_by_hash(
&self,
tx_hash: B256,
) -> TransportResult<Transaction>
pub async fn transaction_by_hash( &self, tx_hash: B256, ) -> TransportResult<Transaction>
Sourcepub async fn transaction_count(&self, block_hash: B256) -> TransportResult<u64>
pub async fn transaction_count(&self, block_hash: B256) -> TransportResult<u64>
Sourcepub async fn transaction_in_block(
&self,
block_hash: B256,
index: u64,
) -> TransportResult<Transaction>
pub async fn transaction_in_block( &self, block_hash: B256, index: u64, ) -> TransportResult<Transaction>
Sourcepub async fn transaction_receipt(
&self,
tx_hash: B256,
) -> TransportResult<TransactionReceipt>
pub async fn transaction_receipt( &self, tx_hash: B256, ) -> TransportResult<TransactionReceipt>
Trait Implementations§
Source§impl BackendClient for InstrumentedClient
impl BackendClient for InstrumentedClient
Source§fn block_number<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<BlockNumber, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn block_number<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<BlockNumber, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn block_by_number<'life0, 'async_trait>(
&'life0 self,
number: BlockNumberOrTag,
) -> Pin<Box<dyn Future<Output = Result<Option<Block>, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn block_by_number<'life0, 'async_trait>(
&'life0 self,
number: BlockNumberOrTag,
) -> Pin<Box<dyn Future<Output = Result<Option<Block>, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
type Error = InstrumentedClientError
Auto Trait Implementations§
impl Freeze for InstrumentedClient
impl !RefUnwindSafe for InstrumentedClient
impl Send for InstrumentedClient
impl Sync for InstrumentedClient
impl Unpin for InstrumentedClient
impl !UnwindSafe for InstrumentedClient
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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 moreCreates a shared type from an unshared type.