Struct ethers::providers::Provider [−][src]
pub struct Provider<P> { /* fields omitted */ }
Expand description
An abstract provider for interacting with the Ethereum JSON RPC
API. Must be instantiated
with a data transport which implements the JsonRpcClient
trait
(e.g. HTTP, Websockets etc.)
Example
use ethers_providers::{Middleware, Provider, Http};
use std::convert::TryFrom;
let provider = Provider::<Http>::try_from(
"https://mainnet.infura.io/v3/c60b0bb42f8a4c6481ecd229eddaca27"
).expect("could not instantiate HTTP Provider");
let block = provider.get_block(100u64).await?;
println!("Got block: {}", serde_json::to_string(&block)?);
Implementations
Returns the type of node we’re connected to, while also caching the value for use in other node-specific API calls, such as the get_block_receipts call.
Sets the ENS Address (default: mainnet)
Sets the default polling interval for event filters and pending transactions (default: 7 seconds)
Gets the polling interval which the provider currently uses for event filters and pending transactions (default: 7 seconds)
Direct connection to an IPC socket.
Provider that uses a quorum
Returns a Provider
instantiated with an internal “mock” transport.
Example
use ethers_core::types::U64;
use ethers_providers::{Middleware, Provider};
// Instantiate the provider
let (provider, mock) = Provider::mocked();
// Push the mock response
mock.push(U64::from(12))?;
// Make the call
let blk = provider.get_block_number().await.unwrap();
// The response matches
assert_eq!(blk.as_u64(), 12);
// and the request as well!
mock.assert_request("eth_blockNumber", ()).unwrap();
Trait Implementations
Returns the current client version using the web3_clientVersion
RPC.
Gets the latest block number via the eth_BlockNumber
API
pub fn get_block<'life0, 'async_trait, T>(
&'life0 self,
block_hash_or_number: T
) -> Pin<Box<dyn Future<Output = Result<Option<Block<H256>>, <Provider<P> as Middleware>::Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
T: Into<BlockId> + Send + Sync + 'async_trait,
Provider<P>: 'async_trait,
pub fn get_block<'life0, 'async_trait, T>(
&'life0 self,
block_hash_or_number: T
) -> Pin<Box<dyn Future<Output = Result<Option<Block<H256>>, <Provider<P> as Middleware>::Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
T: Into<BlockId> + Send + Sync + 'async_trait,
Provider<P>: 'async_trait,
Gets the block at block_hash_or_number
(transaction hashes only)
pub fn get_block_with_txs<'life0, 'async_trait, T>(
&'life0 self,
block_hash_or_number: T
) -> Pin<Box<dyn Future<Output = Result<Option<Block<Transaction>>, ProviderError>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
T: Into<BlockId> + Send + Sync + 'async_trait,
Provider<P>: 'async_trait,
pub fn get_block_with_txs<'life0, 'async_trait, T>(
&'life0 self,
block_hash_or_number: T
) -> Pin<Box<dyn Future<Output = Result<Option<Block<Transaction>>, ProviderError>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
T: Into<BlockId> + Send + Sync + 'async_trait,
Provider<P>: 'async_trait,
Gets the block at block_hash_or_number
(full transactions included)
pub fn get_uncle_count<'life0, 'async_trait, T>(
&'life0 self,
block_hash_or_number: T
) -> Pin<Box<dyn Future<Output = Result<U256, <Provider<P> as Middleware>::Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
T: Into<BlockId> + Send + Sync + 'async_trait,
Provider<P>: 'async_trait,
pub fn get_uncle_count<'life0, 'async_trait, T>(
&'life0 self,
block_hash_or_number: T
) -> Pin<Box<dyn Future<Output = Result<U256, <Provider<P> as Middleware>::Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
T: Into<BlockId> + Send + Sync + 'async_trait,
Provider<P>: 'async_trait,
Gets the block uncle count at block_hash_or_number
pub fn get_uncle<'life0, 'async_trait, T>(
&'life0 self,
block_hash_or_number: T,
idx: U64
) -> Pin<Box<dyn Future<Output = Result<Option<Block<H256>>, ProviderError>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
T: Into<BlockId> + Send + Sync + 'async_trait,
Provider<P>: 'async_trait,
pub fn get_uncle<'life0, 'async_trait, T>(
&'life0 self,
block_hash_or_number: T,
idx: U64
) -> Pin<Box<dyn Future<Output = Result<Option<Block<H256>>, ProviderError>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
T: Into<BlockId> + Send + Sync + 'async_trait,
Provider<P>: 'async_trait,
Gets the block uncle at block_hash_or_number
and idx
Gets the transaction with transaction_hash
pub fn get_transaction_receipt<'life0, 'async_trait, T>(
&'life0 self,
transaction_hash: T
) -> Pin<Box<dyn Future<Output = Result<Option<TransactionReceipt>, ProviderError>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
T: Send + Sync + Into<H256> + 'async_trait,
Provider<P>: 'async_trait,
pub fn get_transaction_receipt<'life0, 'async_trait, T>(
&'life0 self,
transaction_hash: T
) -> Pin<Box<dyn Future<Output = Result<Option<TransactionReceipt>, ProviderError>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
T: Send + Sync + Into<H256> + 'async_trait,
Provider<P>: 'async_trait,
Gets the transaction receipt with transaction_hash
pub fn get_block_receipts<'life0, 'async_trait, T>(
&'life0 self,
block: T
) -> Pin<Box<dyn Future<Output = Result<Vec<TransactionReceipt, Global>, <Provider<P> as Middleware>::Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
T: Into<BlockNumber> + Send + Sync + 'async_trait,
Provider<P>: 'async_trait,
pub fn get_block_receipts<'life0, 'async_trait, T>(
&'life0 self,
block: T
) -> Pin<Box<dyn Future<Output = Result<Vec<TransactionReceipt, Global>, <Provider<P> as Middleware>::Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
T: Into<BlockNumber> + Send + Sync + 'async_trait,
Provider<P>: 'async_trait,
Returns all receipts for a block.
Note that this uses the eth_getBlockReceipts
RPC, which is
non-standard and currently supported by Erigon.
pub fn parity_block_receipts<'life0, 'async_trait, T>(
&'life0 self,
block: T
) -> Pin<Box<dyn Future<Output = Result<Vec<TransactionReceipt, Global>, <Provider<P> as Middleware>::Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
T: Into<BlockNumber> + Send + Sync + 'async_trait,
Provider<P>: 'async_trait,
pub fn parity_block_receipts<'life0, 'async_trait, T>(
&'life0 self,
block: T
) -> Pin<Box<dyn Future<Output = Result<Vec<TransactionReceipt, Global>, <Provider<P> as Middleware>::Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
T: Into<BlockNumber> + Send + Sync + 'async_trait,
Provider<P>: 'async_trait,
Returns all receipts for that block. Must be done on a parity node.
Gets the current gas price as estimated by the node
pub fn estimate_eip1559_fees<'life0, 'async_trait>(
&'life0 self,
estimator: Option<fn(U256, Vec<Vec<U256, Global>, Global>) -> (U256, U256)>
) -> Pin<Box<dyn Future<Output = Result<(U256, U256), <Provider<P> as Middleware>::Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
Provider<P>: 'async_trait,
pub fn estimate_eip1559_fees<'life0, 'async_trait>(
&'life0 self,
estimator: Option<fn(U256, Vec<Vec<U256, Global>, Global>) -> (U256, U256)>
) -> Pin<Box<dyn Future<Output = Result<(U256, U256), <Provider<P> as Middleware>::Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
Provider<P>: 'async_trait,
Gets a heuristic recommendation of max fee per gas and max priority fee per gas for EIP-1559 compatible transactions.
Gets the accounts on the node
pub fn get_transaction_count<'life0, 'async_trait, T>(
&'life0 self,
from: T,
block: Option<BlockId>
) -> Pin<Box<dyn Future<Output = Result<U256, ProviderError>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
T: Into<NameOrAddress> + Send + Sync + 'async_trait,
Provider<P>: 'async_trait,
pub fn get_transaction_count<'life0, 'async_trait, T>(
&'life0 self,
from: T,
block: Option<BlockId>
) -> Pin<Box<dyn Future<Output = Result<U256, ProviderError>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
T: Into<NameOrAddress> + Send + Sync + 'async_trait,
Provider<P>: 'async_trait,
Returns the nonce of the address
Returns the account’s balance
Returns the currently configured chain id, a value used in replay-protected transaction signing as introduced by EIP-155.
Returns the network version.
Sends the read-only (constant) transaction to a single Ethereum node and return the result (as bytes) of executing it. This is free, since it does not change any state on the blockchain.
pub fn estimate_gas<'life0, 'life1, 'async_trait>(
&'life0 self,
tx: &'life1 TypedTransaction
) -> Pin<Box<dyn Future<Output = Result<U256, ProviderError>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
'life1: 'async_trait,
Provider<P>: 'async_trait,
pub fn estimate_gas<'life0, 'life1, 'async_trait>(
&'life0 self,
tx: &'life1 TypedTransaction
) -> Pin<Box<dyn Future<Output = Result<U256, ProviderError>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
'life1: 'async_trait,
Provider<P>: 'async_trait,
Sends a transaction to a single Ethereum node and return the estimated amount of gas required (as a U256) to send it This is free, but only an estimate. Providing too little gas will result in a transaction being rejected (while still consuming all provided gas).
pub fn send_transaction<'life0, 'async_trait, T>(
&'life0 self,
tx: T,
block: Option<BlockId>
) -> Pin<Box<dyn Future<Output = Result<PendingTransaction<'life0, P>, ProviderError>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
T: Into<TypedTransaction> + Send + Sync + 'async_trait,
Provider<P>: 'async_trait,
pub fn send_transaction<'life0, 'async_trait, T>(
&'life0 self,
tx: T,
block: Option<BlockId>
) -> Pin<Box<dyn Future<Output = Result<PendingTransaction<'life0, P>, ProviderError>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
T: Into<TypedTransaction> + Send + Sync + 'async_trait,
Provider<P>: 'async_trait,
Sends the transaction to the entire Ethereum network and returns the transaction’s hash This will consume gas from the account that signed the transaction.
pub fn send_raw_transaction<'a, 'async_trait>(
&'a self,
tx: Bytes
) -> Pin<Box<dyn Future<Output = Result<PendingTransaction<'a, P>, ProviderError>> + Send + 'async_trait, Global>> where
'a: 'async_trait,
Provider<P>: 'async_trait,
pub fn send_raw_transaction<'a, 'async_trait>(
&'a self,
tx: Bytes
) -> Pin<Box<dyn Future<Output = Result<PendingTransaction<'a, P>, ProviderError>> + Send + 'async_trait, Global>> where
'a: 'async_trait,
Provider<P>: 'async_trait,
Send the raw RLP encoded transaction to the entire Ethereum network and returns the transaction’s hash This will consume gas from the account that signed the transaction.
The JSON-RPC provider is at the bottom-most position in the middleware stack. Here we check
if it has the key for the sender address unlocked, as well as supports the eth_sign
call.
pub fn sign<'life0, 'life1, 'async_trait, T>(
&'life0 self,
data: T,
from: &'life1 H160
) -> Pin<Box<dyn Future<Output = Result<Signature, ProviderError>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
'life1: 'async_trait,
T: Into<Bytes> + Send + Sync + 'async_trait,
Provider<P>: 'async_trait,
pub fn sign<'life0, 'life1, 'async_trait, T>(
&'life0 self,
data: T,
from: &'life1 H160
) -> Pin<Box<dyn Future<Output = Result<Signature, ProviderError>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
'life1: 'async_trait,
T: Into<Bytes> + Send + Sync + 'async_trait,
Provider<P>: 'async_trait,
Signs data using a specific account. This account needs to be unlocked.
pub fn sign_transaction<'life0, 'life1, 'async_trait>(
&'life0 self,
_tx: &'life1 TypedTransaction,
_from: H160
) -> Pin<Box<dyn Future<Output = Result<Signature, <Provider<P> as Middleware>::Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
'life1: 'async_trait,
Provider<P>: 'async_trait,
pub fn sign_transaction<'life0, 'life1, 'async_trait>(
&'life0 self,
_tx: &'life1 TypedTransaction,
_from: H160
) -> Pin<Box<dyn Future<Output = Result<Signature, <Provider<P> as Middleware>::Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
'life1: 'async_trait,
Provider<P>: 'async_trait,
Sign a transaction via RPC call
Returns an array (possibly empty) of logs that match the filter
Streams matching filter logs
pub fn watch_blocks<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<FilterWatcher<'life0, P, H256>, ProviderError>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
Provider<P>: 'async_trait,
pub fn watch_blocks<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<FilterWatcher<'life0, P, H256>, ProviderError>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
Provider<P>: 'async_trait,
Streams new block hashes
pub fn watch_pending_transactions<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<FilterWatcher<'life0, P, H256>, ProviderError>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
Provider<P>: 'async_trait,
pub fn watch_pending_transactions<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<FilterWatcher<'life0, P, H256>, ProviderError>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
Provider<P>: 'async_trait,
Streams pending transactions
pub fn new_filter<'life0, 'life1, 'async_trait>(
&'life0 self,
filter: FilterKind<'life1>
) -> Pin<Box<dyn Future<Output = Result<U256, ProviderError>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
'life1: 'async_trait,
Provider<P>: 'async_trait,
pub fn new_filter<'life0, 'life1, 'async_trait>(
&'life0 self,
filter: FilterKind<'life1>
) -> Pin<Box<dyn Future<Output = Result<U256, ProviderError>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
'life1: 'async_trait,
Provider<P>: 'async_trait,
Creates a filter object, based on filter options, to notify when the state changes (logs).
To check if the state has changed, call get_filter_changes
with the filter id.
Uninstalls a filter
pub fn get_filter_changes<'life0, 'async_trait, T, R>(
&'life0 self,
id: T
) -> Pin<Box<dyn Future<Output = Result<Vec<R, Global>, ProviderError>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
T: Into<U256> + Send + Sync + 'async_trait,
R: Serialize + DeserializeOwned + Send + Sync + Debug + 'async_trait,
Provider<P>: 'async_trait,
pub fn get_filter_changes<'life0, 'async_trait, T, R>(
&'life0 self,
id: T
) -> Pin<Box<dyn Future<Output = Result<Vec<R, Global>, ProviderError>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
T: Into<U256> + Send + Sync + 'async_trait,
R: Serialize + DeserializeOwned + Send + Sync + Debug + 'async_trait,
Provider<P>: 'async_trait,
Polling method for a filter, which returns an array of logs which occurred since last poll.
This method must be called with one of the following return types, depending on the filter type:
eth_newBlockFilter
:H256
, returns block hasheseth_newPendingTransactionFilter
:H256
, returns transaction hasheseth_newFilter
:Log
, returns raw logs
If one of these types is not used, decoding will fail and the method will return an error.
pub fn get_storage_at<'life0, 'async_trait, T>(
&'life0 self,
from: T,
location: H256,
block: Option<BlockId>
) -> Pin<Box<dyn Future<Output = Result<H256, ProviderError>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
T: Into<NameOrAddress> + Send + Sync + 'async_trait,
Provider<P>: 'async_trait,
pub fn get_storage_at<'life0, 'async_trait, T>(
&'life0 self,
from: T,
location: H256,
block: Option<BlockId>
) -> Pin<Box<dyn Future<Output = Result<H256, ProviderError>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
T: Into<NameOrAddress> + Send + Sync + 'async_trait,
Provider<P>: 'async_trait,
Get the storage of an address for a particular slot location
Returns the deployed code at a given address
pub fn get_proof<'life0, 'async_trait, T>(
&'life0 self,
from: T,
locations: Vec<H256, Global>,
block: Option<BlockId>
) -> Pin<Box<dyn Future<Output = Result<EIP1186ProofResponse, ProviderError>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
T: Into<NameOrAddress> + Send + Sync + 'async_trait,
Provider<P>: 'async_trait,
pub fn get_proof<'life0, 'async_trait, T>(
&'life0 self,
from: T,
locations: Vec<H256, Global>,
block: Option<BlockId>
) -> Pin<Box<dyn Future<Output = Result<EIP1186ProofResponse, ProviderError>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
T: Into<NameOrAddress> + Send + Sync + 'async_trait,
Provider<P>: 'async_trait,
Returns the EIP-1186 proof response https://github.com/ethereum/EIPs/issues/1186
Returns the address that the ens_name
resolves to (or None if not configured).
Panics
If the bytes returned from the ENS registrar/resolver cannot be interpreted as an address. This should theoretically never happen.
Returns the ENS name the address
resolves to (or None if not configured).
Panics
If the bytes returned from the ENS registrar/resolver cannot be interpreted as a string. This should theoretically never happen.
pub fn txpool_content<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<TxpoolContent, ProviderError>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
Provider<P>: 'async_trait,
pub fn txpool_content<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<TxpoolContent, ProviderError>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
Provider<P>: 'async_trait,
Returns the details of all transactions currently pending for inclusion in the next block(s), as well as the ones that are being scheduled for future execution only. Ref: Here
pub fn txpool_inspect<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<TxpoolInspect, ProviderError>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
Provider<P>: 'async_trait,
pub fn txpool_inspect<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<TxpoolInspect, ProviderError>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
Provider<P>: 'async_trait,
Returns a summary of all the transactions currently pending for inclusion in the next block(s), as well as the ones that are being scheduled for future execution only. Ref: Here
pub fn txpool_status<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<TxpoolStatus, ProviderError>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
Provider<P>: 'async_trait,
pub fn txpool_status<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<TxpoolStatus, ProviderError>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
Provider<P>: 'async_trait,
Returns the number of transactions currently pending for inclusion in the next block(s), as well as the ones that are being scheduled for future execution only. Ref: Here
pub fn trace_call<'life0, 'async_trait, T>(
&'life0 self,
req: T,
trace_type: Vec<TraceType, Global>,
block: Option<BlockNumber>
) -> Pin<Box<dyn Future<Output = Result<BlockTrace, ProviderError>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
T: Into<TypedTransaction> + Send + Sync + 'async_trait,
Provider<P>: 'async_trait,
pub fn trace_call<'life0, 'async_trait, T>(
&'life0 self,
req: T,
trace_type: Vec<TraceType, Global>,
block: Option<BlockNumber>
) -> Pin<Box<dyn Future<Output = Result<BlockTrace, ProviderError>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
T: Into<TypedTransaction> + Send + Sync + 'async_trait,
Provider<P>: 'async_trait,
Executes the given call and returns a number of possible traces for it
pub fn trace_raw_transaction<'life0, 'async_trait>(
&'life0 self,
data: Bytes,
trace_type: Vec<TraceType, Global>
) -> Pin<Box<dyn Future<Output = Result<BlockTrace, ProviderError>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
Provider<P>: 'async_trait,
pub fn trace_raw_transaction<'life0, 'async_trait>(
&'life0 self,
data: Bytes,
trace_type: Vec<TraceType, Global>
) -> Pin<Box<dyn Future<Output = Result<BlockTrace, ProviderError>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
Provider<P>: 'async_trait,
Traces a call to eth_sendRawTransaction
without making the call, returning the traces
pub fn trace_replay_transaction<'life0, 'async_trait>(
&'life0 self,
hash: H256,
trace_type: Vec<TraceType, Global>
) -> Pin<Box<dyn Future<Output = Result<BlockTrace, ProviderError>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
Provider<P>: 'async_trait,
pub fn trace_replay_transaction<'life0, 'async_trait>(
&'life0 self,
hash: H256,
trace_type: Vec<TraceType, Global>
) -> Pin<Box<dyn Future<Output = Result<BlockTrace, ProviderError>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
Provider<P>: 'async_trait,
Replays a transaction, returning the traces
pub fn trace_replay_block_transactions<'life0, 'async_trait>(
&'life0 self,
block: BlockNumber,
trace_type: Vec<TraceType, Global>
) -> Pin<Box<dyn Future<Output = Result<Vec<BlockTrace, Global>, ProviderError>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
Provider<P>: 'async_trait,
pub fn trace_replay_block_transactions<'life0, 'async_trait>(
&'life0 self,
block: BlockNumber,
trace_type: Vec<TraceType, Global>
) -> Pin<Box<dyn Future<Output = Result<Vec<BlockTrace, Global>, ProviderError>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
Provider<P>: 'async_trait,
Replays all transactions in a block returning the requested traces for each transaction
pub fn trace_block<'life0, 'async_trait>(
&'life0 self,
block: BlockNumber
) -> Pin<Box<dyn Future<Output = Result<Vec<Trace, Global>, ProviderError>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
Provider<P>: 'async_trait,
pub fn trace_block<'life0, 'async_trait>(
&'life0 self,
block: BlockNumber
) -> Pin<Box<dyn Future<Output = Result<Vec<Trace, Global>, ProviderError>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
Provider<P>: 'async_trait,
Returns traces created at given block
pub fn trace_filter<'life0, 'async_trait>(
&'life0 self,
filter: TraceFilter
) -> Pin<Box<dyn Future<Output = Result<Vec<Trace, Global>, ProviderError>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
Provider<P>: 'async_trait,
pub fn trace_filter<'life0, 'async_trait>(
&'life0 self,
filter: TraceFilter
) -> Pin<Box<dyn Future<Output = Result<Vec<Trace, Global>, ProviderError>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
Provider<P>: 'async_trait,
Return traces matching the given filter
Returns trace at the given position
Returns all traces of a given transaction
type Error = ProviderError
type Provider = P
The next middleware in the stack
The HTTP or Websocket provider.
pub fn create_access_list<'life0, 'life1, 'async_trait>(
&'life0 self,
tx: &'life1 TypedTransaction,
block: Option<BlockId>
) -> Pin<Box<dyn Future<Output = Result<AccessListWithGasUsed, ProviderError>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
'life1: 'async_trait,
Provider<P>: 'async_trait,
pub fn subscribe<'life0, 'async_trait, T, R>(
&'life0 self,
params: T
) -> Pin<Box<dyn Future<Output = Result<SubscriptionStream<'life0, P, R>, ProviderError>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
T: Debug + Serialize + Send + Sync + 'async_trait,
R: DeserializeOwned + Send + Sync + 'async_trait,
P: PubsubClient,
Provider<P>: 'async_trait,
pub fn unsubscribe<'life0, 'async_trait, T>(
&'life0 self,
id: T
) -> Pin<Box<dyn Future<Output = Result<bool, ProviderError>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
T: Into<U256> + Send + Sync + 'async_trait,
P: PubsubClient,
Provider<P>: 'async_trait,
pub fn subscribe_blocks<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<SubscriptionStream<'life0, P, Block<H256>>, ProviderError>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
P: PubsubClient,
Provider<P>: 'async_trait,
pub fn subscribe_pending_txs<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<SubscriptionStream<'life0, P, H256>, ProviderError>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
P: PubsubClient,
Provider<P>: 'async_trait,
pub fn subscribe_logs<'a, 'life0, 'async_trait>(
&'a self,
filter: &'life0 Filter
) -> Pin<Box<dyn Future<Output = Result<SubscriptionStream<'a, P, Log>, ProviderError>> + Send + 'async_trait, Global>> where
'a: 'async_trait,
'life0: 'async_trait,
P: PubsubClient,
Provider<P>: 'async_trait,
pub fn fee_history<'life0, 'life1, 'async_trait, T>(
&'life0 self,
block_count: T,
last_block: BlockNumber,
reward_percentiles: &'life1 [f64]
) -> Pin<Box<dyn Future<Output = Result<FeeHistory, <Provider<P> as Middleware>::Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
'life1: 'async_trait,
T: Into<U256> + Serialize + Send + Sync + 'async_trait,
Provider<P>: 'async_trait,
Helper for filling a transaction
fn send_escalating<'a, 'life0, 'async_trait>(
&'a self,
tx: &'life0 TypedTransaction,
escalations: usize,
policy: Box<dyn Fn(U256, usize) + Send + Sync + 'static, Global>
) -> Pin<Box<dyn Future<Output = Result<EscalatingPending<'a, Self::Provider>, Self::Error>> + Send + 'async_trait, Global>> where
'a: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
fn send_escalating<'a, 'life0, 'async_trait>(
&'a self,
tx: &'life0 TypedTransaction,
escalations: usize,
policy: Box<dyn Fn(U256, usize) + Send + Sync + 'static, Global>
) -> Pin<Box<dyn Future<Output = Result<EscalatingPending<'a, Self::Provider>, Self::Error>> + Send + 'async_trait, Global>> where
'a: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
Send a transaction with a simple escalation policy. Read more
Auto Trait Implementations
impl<P> !RefUnwindSafe for Provider<P>
impl<P> !UnwindSafe for Provider<P>
Blanket Implementations
pub fn as_slice_of<T>(&self) -> Result<&[T], Error> where
T: FromByteSlice,
pub fn base32_len(&self) -> usize
pub fn base32_len(&self) -> usize
Calculate the base32 serialized length
Mutably borrows from an owned value. Read more
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
pub fn write_base32<W>(
&self,
writer: &mut W
) -> Result<(), <W as WriteBase32>::Err> where
W: WriteBase32,
pub fn write_base32<W>(
&self,
writer: &mut W
) -> Result<(), <W as WriteBase32>::Err> where
W: WriteBase32,
Encode as base32 and write it to the supplied writer Implementations shouldn’t allocate. Read more
pub fn vzip(self) -> V
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more