pub struct Provider<P> { /* private fields */ }
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://eth.llamarpc.com"
).expect("could not instantiate HTTP Provider");

let block = provider.get_block(100u64).await?;
println!("Got block: {}", serde_json::to_string(&block)?);

Implementations§

source§

impl<P: JsonRpcClient> Provider<P>

source

pub fn new(provider: P) -> Self

Instantiate a new provider with a backend.

source

pub async fn node_client(&self) -> Result<NodeClient, ProviderError>

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.

source

pub fn with_sender(self, address: impl Into<Address>) -> Self

Set the default sender on the provider

source

pub async fn request<T, R>( &self, method: &str, params: T ) -> Result<R, ProviderError>

Make an RPC request via the internal connection, and return the result.

source

pub fn call_raw<'a>(&'a self, tx: &'a TypedTransaction) -> CallBuilder<'a, P>

Analogous to Middleware::call, but returns a CallBuilder that can either be .awaitd or used to override the parameters sent to eth_call.

See the ethers_core::types::spoof for functions to construct state override parameters.

Note: this method does not send a transaction from your account

§Example
let geth = Geth::new().spawn();
let provider = Provider::<Http>::try_from(geth.endpoint()).unwrap();

let adr1: Address = "0x6fC21092DA55B392b045eD78F4732bff3C580e2c".parse()?;
let adr2: Address = "0x295a70b2de5e3953354a6a8344e616ed314d7251".parse()?;
let pay_amt = parse_ether(1u64)?;

// Not enough ether to pay for the transaction
let tx = TransactionRequest::pay(adr2, pay_amt).from(adr1).into();

// override the sender's balance for the call
let mut state = spoof::balance(adr1, pay_amt * 2);
provider.call_raw(&tx).state(&state).await?;
source§

impl<P: JsonRpcClient> Provider<P>

source

pub fn ens<T: Into<Address>>(self, ens: T) -> Self

Sets the ENS Address (default: mainnet)

source

pub fn set_interval<T: Into<Duration>>(&mut self, interval: T) -> &mut Self

Sets the default polling interval for event filters and pending transactions (default: 7 seconds)

source

pub fn interval<T: Into<Duration>>(self, interval: T) -> Self

Sets the default polling interval for event filters and pending transactions (default: 7 seconds)

source

pub fn get_interval(&self) -> Duration

Gets the polling interval which the provider currently uses for event filters and pending transactions (default: 7 seconds)

source§

impl Provider<Ipc>

source

pub async fn connect_ipc(path: impl AsRef<Path>) -> Result<Self, ProviderError>

Available on crate feature ipc and (Unix or Windows) only.

Connects to the Unix socket at the provided path.

source§

impl Provider<Http>

source

pub fn url(&self) -> &Url

The Url to which requests are made

source

pub fn url_mut(&mut self) -> &mut Url

Mutable access to the Url to which requests are made

source§

impl<Read, Write> Provider<RwClient<Read, Write>>
where Read: JsonRpcClient + 'static, <Read as JsonRpcClient>::Error: Sync + Send + 'static, Write: JsonRpcClient + 'static, <Write as JsonRpcClient>::Error: Sync + Send + 'static,

source

pub fn rw(r: Read, w: Write) -> Self

Creates a new Provider with a RwClient

source§

impl<T: JsonRpcClientWrapper> Provider<QuorumProvider<T>>

source

pub fn quorum(inner: QuorumProvider<T>) -> Self

Provider that uses a quorum

source§

impl Provider<MockProvider>

source

pub fn mocked() -> (Self, MockProvider)

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();
source§

impl Provider<RetryClient<Http>>

source

pub fn new_client( src: &str, max_retry: u32, initial_backoff: u64 ) -> Result<Self, ParseError>

Available on non-WebAssembly only.

Create a new RetryClient by connecting to the provided URL. Errors if src is not a valid URL

source§

impl Provider<Ws>

source

pub async fn connect( url: impl IntoClientRequest + Unpin ) -> Result<Self, ProviderError>

Available on crate feature legacy-ws and non-WebAssembly only.

Direct connection to a websocket endpoint

source

pub async fn connect_with_auth( url: impl IntoClientRequest + Unpin, auth: Authorization ) -> Result<Self, ProviderError>

Available on crate feature legacy-ws and non-WebAssembly only.

Connect to a WS RPC provider with authentication details

Trait Implementations§

source§

impl<P> AsRef<P> for Provider<P>

source§

fn as_ref(&self) -> &P

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl<P: Clone> Clone for Provider<P>

source§

fn clone(&self) -> Provider<P>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<P: Debug> Debug for Provider<P>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<P: JsonRpcClient> Middleware for Provider<P>

source§

fn sign_transaction<'life0, 'life1, 'async_trait>( &'life0 self, _tx: &'life1 TypedTransaction, _from: Address ) -> Pin<Box<dyn Future<Output = Result<Signature, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Sign a transaction via RPC call

source§

fn watch_pending_transactions<'life0, 'async_trait>( &'life0 self ) -> Pin<Box<dyn Future<Output = Result<FilterWatcher<'_, P, H256>, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Streams pending transactions

source§

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

Returns an indication if this node is currently mining.

§

type Error = ProviderError

Error type returned by most operations
§

type Provider = P

The JSON-RPC client type at the bottom of the stack
§

type Inner = Provider<P>

The next-lower middleware in the middleware stack
source§

fn inner(&self) -> &Self::Inner

Get a reference to the next-lower middleware in the middleware stack
source§

fn provider(&self) -> &Provider<Self::Provider>

The HTTP or Websocket provider.
source§

fn convert_err(p: ProviderError) -> Self::Error

Convert a provider error into the associated error type by successively converting it to every intermediate middleware error
source§

fn default_sender(&self) -> Option<Address>

Return the default sender (if any). This will typically be the connected node’s first address, or the address of a Signer in a lower middleware stack
source§

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

Returns the current client version using the web3_clientVersion RPC.
source§

fn fill_transaction<'life0, 'life1, 'async_trait>( &'life0 self, tx: &'life1 mut TypedTransaction, block: Option<BlockId> ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Fill necessary details of a transaction for dispatch Read more
source§

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

Get the block number
source§

fn get_block<'life0, 'async_trait, T>( &'life0 self, block_hash_or_number: T ) -> Pin<Box<dyn Future<Output = Result<Option<Block<TxHash>>, Self::Error>> + Send + 'async_trait>>
where T: 'async_trait + Into<BlockId> + Send + Sync, Self: 'async_trait, 'life0: 'async_trait,

Gets the block at block_hash_or_number (transaction hashes only)
source§

fn get_header<'life0, 'async_trait, T>( &'life0 self, block_hash_or_number: T ) -> Pin<Box<dyn Future<Output = Result<Option<Block<Transaction>>, Self::Error>> + Send + 'async_trait>>
where T: 'async_trait + Into<BlockId> + Send + Sync, Self: 'async_trait, 'life0: 'async_trait,

Get the block header by number or hash
source§

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>>
where T: 'async_trait + Into<BlockId> + Send + Sync, Self: 'async_trait, 'life0: 'async_trait,

Gets the block at block_hash_or_number (full transactions included)
source§

fn get_uncle_count<'life0, 'async_trait, T>( &'life0 self, block_hash_or_number: T ) -> Pin<Box<dyn Future<Output = Result<U256, Self::Error>> + Send + 'async_trait>>
where T: 'async_trait + Into<BlockId> + Send + Sync, Self: 'async_trait, 'life0: 'async_trait,

Gets the block uncle count at block_hash_or_number
source§

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>>
where T: 'async_trait + Into<BlockId> + Send + Sync, Self: 'async_trait, 'life0: 'async_trait,

Gets the block uncle at block_hash_or_number and idx
source§

fn get_transaction<'life0, 'async_trait, T>( &'life0 self, transaction_hash: T ) -> Pin<Box<dyn Future<Output = Result<Option<Transaction>, ProviderError>> + Send + 'async_trait>>
where T: 'async_trait + Send + Sync + Into<TxHash>, Self: 'async_trait, 'life0: 'async_trait,

Gets the transaction with transaction_hash
source§

fn get_transaction_by_block_and_index<'life0, 'async_trait, T>( &'life0 self, block_hash_or_number: T, idx: U64 ) -> Pin<Box<dyn Future<Output = Result<Option<Transaction>, ProviderError>> + Send + 'async_trait>>
where T: 'async_trait + Into<BlockId> + Send + Sync, Self: 'async_trait, 'life0: 'async_trait,

Gets the transaction with block and index
source§

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>>
where T: 'async_trait + Send + Sync + Into<TxHash>, Self: 'async_trait, 'life0: 'async_trait,

Gets the transaction receipt with transaction_hash
source§

fn get_block_receipts<'life0, 'async_trait, T>( &'life0 self, block: T ) -> Pin<Box<dyn Future<Output = Result<Vec<TransactionReceipt>, Self::Error>> + Send + 'async_trait>>
where T: 'async_trait + Into<BlockNumber> + Send + Sync, Self: 'async_trait, 'life0: 'async_trait,

Returns all receipts for a block. Read more
source§

fn parity_block_receipts<'life0, 'async_trait, T>( &'life0 self, block: T ) -> Pin<Box<dyn Future<Output = Result<Vec<TransactionReceipt>, Self::Error>> + Send + 'async_trait>>
where T: 'async_trait + Into<BlockNumber> + Send + Sync, Self: 'async_trait, 'life0: 'async_trait,

Returns all receipts for that block. Must be done on a parity node.
source§

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

Gets the current gas price as estimated by the node
source§

fn estimate_eip1559_fees<'life0, 'async_trait>( &'life0 self, estimator: Option<fn(_: U256, _: Vec<Vec<U256>>) -> (U256, U256)> ) -> Pin<Box<dyn Future<Output = Result<(U256, U256), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Gets a heuristic recommendation of max fee per gas and max priority fee per gas for EIP-1559 compatible transactions.
source§

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

Gets the accounts on the node
source§

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>>
where T: 'async_trait + Into<NameOrAddress> + Send + Sync, Self: 'async_trait, 'life0: 'async_trait,

Returns the nonce of the address
source§

fn get_balance<'life0, 'async_trait, T>( &'life0 self, from: T, block: Option<BlockId> ) -> Pin<Box<dyn Future<Output = Result<U256, ProviderError>> + Send + 'async_trait>>
where T: 'async_trait + Into<NameOrAddress> + Send + Sync, Self: 'async_trait, 'life0: 'async_trait,

Returns the account’s balance
source§

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

Returns the currently configured chain id, a value used in replay-protected transaction signing as introduced by EIP-155.
source§

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

Return current client syncing status. If IsFalse sync is over.
source§

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

Returns the network version.
source§

fn call<'life0, 'life1, 'async_trait>( &'life0 self, tx: &'life1 TypedTransaction, block: Option<BlockId> ) -> Pin<Box<dyn Future<Output = Result<Bytes, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

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.
source§

fn estimate_gas<'life0, 'life1, 'async_trait>( &'life0 self, tx: &'life1 TypedTransaction, block: Option<BlockId> ) -> Pin<Box<dyn Future<Output = Result<U256, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: '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).
source§

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>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Query the node for an EIP-2930 Access List. Read more
source§

fn send_transaction<'life0, 'async_trait, T>( &'life0 self, tx: T, block: Option<BlockId> ) -> Pin<Box<dyn Future<Output = Result<PendingTransaction<'_, P>, ProviderError>> + Send + 'async_trait>>
where T: 'async_trait + Into<TypedTransaction> + Send + Sync, Self: 'async_trait, 'life0: '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. This call will fail if no signer is available, and the RPC node does not have an unlocked accounts
source§

fn send_raw_transaction<'a, 'async_trait>( &'a self, tx: Bytes ) -> Pin<Box<dyn Future<Output = Result<PendingTransaction<'a, P>, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'a: '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.
source§

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

This returns true if either the middleware stack contains a SignerMiddleware, or the JSON-RPC provider has an unlocked key that can sign using the eth_sign call. If none of the above conditions are met, then the middleware stack is not capable of signing data.
source§

fn sign<'life0, 'life1, 'async_trait, T>( &'life0 self, data: T, from: &'life1 Address ) -> Pin<Box<dyn Future<Output = Result<Signature, ProviderError>> + Send + 'async_trait>>
where T: 'async_trait + Into<Bytes> + Send + Sync, Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Signs data using a specific account. This account needs to be unlocked, or the middleware stack must contain a SignerMiddleware
source§

fn get_logs<'life0, 'life1, 'async_trait>( &'life0 self, filter: &'life1 Filter ) -> Pin<Box<dyn Future<Output = Result<Vec<Log>, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Returns an array (possibly empty) of logs that match the filter
source§

fn get_logs_paginated<'a>( &'a self, filter: &Filter, page_size: u64 ) -> LogQuery<'a, P>

Returns a stream of logs are loaded in pages of given page size
source§

fn watch<'a, 'life0, 'async_trait>( &'a self, filter: &'life0 Filter ) -> Pin<Box<dyn Future<Output = Result<FilterWatcher<'a, P, Log>, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'a: 'async_trait, 'life0: 'async_trait,

Streams event logs matching the filter. Read more
source§

fn watch_blocks<'life0, 'async_trait>( &'life0 self ) -> Pin<Box<dyn Future<Output = Result<FilterWatcher<'_, P, H256>, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Streams new block hashes Read more
source§

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>>
where T: 'async_trait + Into<NameOrAddress> + Send + Sync, Self: 'async_trait, 'life0: 'async_trait,

Get the storage of an address for a particular slot location
source§

fn get_code<'life0, 'async_trait, T>( &'life0 self, at: T, block: Option<BlockId> ) -> Pin<Box<dyn Future<Output = Result<Bytes, ProviderError>> + Send + 'async_trait>>
where T: 'async_trait + Into<NameOrAddress> + Send + Sync, Self: 'async_trait, 'life0: 'async_trait,

Returns the deployed code at a given address
source§

fn get_proof<'life0, 'async_trait, T>( &'life0 self, from: T, locations: Vec<H256>, block: Option<BlockId> ) -> Pin<Box<dyn Future<Output = Result<EIP1186ProofResponse, ProviderError>> + Send + 'async_trait>>
where T: 'async_trait + Into<NameOrAddress> + Send + Sync, Self: 'async_trait, 'life0: 'async_trait,

Returns the EIP-1186 proof response https://github.com/ethereum/EIPs/issues/1186
source§

fn import_raw_key<'life0, 'async_trait>( &'life0 self, private_key: Bytes, passphrase: String ) -> Pin<Box<dyn Future<Output = Result<Address, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Sends the given key to the node to be encrypted with the provided passphrase and stored. Read more
source§

fn unlock_account<'life0, 'async_trait, T>( &'life0 self, account: T, passphrase: String, duration: Option<u64> ) -> Pin<Box<dyn Future<Output = Result<bool, ProviderError>> + Send + 'async_trait>>
where T: 'async_trait + Into<Address> + Send + Sync, Self: 'async_trait, 'life0: 'async_trait,

Prompts the node to decrypt the given account from its keystore. Read more
source§

fn add_peer<'life0, 'async_trait>( &'life0 self, enode_url: String ) -> Pin<Box<dyn Future<Output = Result<bool, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Requests adding the given peer, returning a boolean representing whether or not the peer was accepted for tracking.
source§

fn add_trusted_peer<'life0, 'async_trait>( &'life0 self, enode_url: String ) -> Pin<Box<dyn Future<Output = Result<bool, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Requests adding the given peer as a trusted peer, which the node will always connect to even when its peer slots are full.
source§

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

Returns general information about the node as well as information about the running p2p protocols (e.g. eth, snap).
source§

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

Returns the list of peers currently connected to the node.
source§

fn remove_peer<'life0, 'async_trait>( &'life0 self, enode_url: String ) -> Pin<Box<dyn Future<Output = Result<bool, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Requests to remove the given peer, returning true if the enode was successfully parsed and the peer was removed.
source§

fn remove_trusted_peer<'life0, 'async_trait>( &'life0 self, enode_url: String ) -> Pin<Box<dyn Future<Output = Result<bool, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Requests to remove the given peer, returning a boolean representing whether or not the enode url passed was validated. A return value of true does not necessarily mean that the peer was disconnected.
source§

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

Starts the miner.
source§

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

Stop terminates the miner, both at the consensus engine level as well as at the block creation level.
source§

fn resolve_name<'life0, 'life1, 'async_trait>( &'life0 self, ens_name: &'life1 str ) -> Pin<Box<dyn Future<Output = Result<Address, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Returns the address that the ens_name resolves to (or None if not configured). Read more
source§

fn lookup_address<'life0, 'async_trait>( &'life0 self, address: Address ) -> Pin<Box<dyn Future<Output = Result<String, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Returns the ENS name the address resolves to (or None if not configured). Read more
source§

fn resolve_avatar<'life0, 'life1, 'async_trait>( &'life0 self, ens_name: &'life1 str ) -> Pin<Box<dyn Future<Output = Result<Url, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Returns the avatar HTTP link of the avatar that the ens_name resolves to (or None if not configured) Read more
source§

fn resolve_nft<'life0, 'async_trait>( &'life0 self, token: ERCNFT ) -> Pin<Box<dyn Future<Output = Result<Url, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Returns the URL (not necesserily HTTP) of the image behind a token. Read more
source§

fn resolve_field<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, ens_name: &'life1 str, field: &'life2 str ) -> Pin<Box<dyn Future<Output = Result<String, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Fetch a field for the ens_name (no None if not configured). Read more
source§

fn txpool_content<'life0, 'async_trait>( &'life0 self ) -> Pin<Box<dyn Future<Output = Result<TxpoolContent, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: '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
source§

fn txpool_inspect<'life0, 'async_trait>( &'life0 self ) -> Pin<Box<dyn Future<Output = Result<TxpoolInspect, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: '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
source§

fn txpool_status<'life0, 'async_trait>( &'life0 self ) -> Pin<Box<dyn Future<Output = Result<TxpoolStatus, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: '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
source§

fn debug_trace_transaction<'life0, 'async_trait>( &'life0 self, tx_hash: TxHash, trace_options: GethDebugTracingOptions ) -> Pin<Box<dyn Future<Output = Result<GethTrace, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

After replaying any previous transactions in the same block, Replays a transaction, returning the traces configured with passed options
source§

fn debug_trace_call<'life0, 'async_trait, T>( &'life0 self, req: T, block: Option<BlockId>, trace_options: GethDebugTracingCallOptions ) -> Pin<Box<dyn Future<Output = Result<GethTrace, ProviderError>> + Send + 'async_trait>>
where T: 'async_trait + Into<TypedTransaction> + Send + Sync, Self: 'async_trait, 'life0: 'async_trait,

Executes the given call and returns a number of possible traces for it
source§

fn debug_trace_block_by_number<'life0, 'async_trait>( &'life0 self, block: Option<BlockNumber>, trace_options: GethDebugTracingOptions ) -> Pin<Box<dyn Future<Output = Result<Vec<GethTrace>, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Replays all transactions in a given block (specified by block number) and returns the traces configured with passed options Ref: Here
source§

fn debug_trace_block_by_hash<'life0, 'async_trait>( &'life0 self, block: H256, trace_options: GethDebugTracingOptions ) -> Pin<Box<dyn Future<Output = Result<Vec<GethTrace>, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Replays all transactions in a given block (specified by block hash) and returns the traces configured with passed options Ref: Here
source§

fn trace_call<'life0, 'async_trait, T>( &'life0 self, req: T, trace_type: Vec<TraceType>, block: Option<BlockNumber> ) -> Pin<Box<dyn Future<Output = Result<BlockTrace, ProviderError>> + Send + 'async_trait>>
where T: 'async_trait + Into<TypedTransaction> + Send + Sync, Self: 'async_trait, 'life0: 'async_trait,

Executes the given call and returns a number of possible traces for it
source§

fn trace_call_many<'life0, 'async_trait, T>( &'life0 self, req: Vec<(T, Vec<TraceType>)>, block: Option<BlockNumber> ) -> Pin<Box<dyn Future<Output = Result<Vec<BlockTrace>, ProviderError>> + Send + 'async_trait>>
where T: 'async_trait + Into<TypedTransaction> + Send + Sync, Self: 'async_trait, 'life0: 'async_trait,

Executes given calls and returns a number of possible traces for each call
source§

fn trace_raw_transaction<'life0, 'async_trait>( &'life0 self, data: Bytes, trace_type: Vec<TraceType> ) -> Pin<Box<dyn Future<Output = Result<BlockTrace, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Traces a call to eth_sendRawTransaction without making the call, returning the traces
source§

fn trace_replay_transaction<'life0, 'async_trait>( &'life0 self, hash: H256, trace_type: Vec<TraceType> ) -> Pin<Box<dyn Future<Output = Result<BlockTrace, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Replays a transaction, returning the traces
source§

fn trace_replay_block_transactions<'life0, 'async_trait>( &'life0 self, block: BlockNumber, trace_type: Vec<TraceType> ) -> Pin<Box<dyn Future<Output = Result<Vec<BlockTrace>, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Replays all transactions in a block returning the requested traces for each transaction
source§

fn trace_block<'life0, 'async_trait>( &'life0 self, block: BlockNumber ) -> Pin<Box<dyn Future<Output = Result<Vec<Trace>, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Returns traces created at given block
source§

fn trace_filter<'life0, 'async_trait>( &'life0 self, filter: TraceFilter ) -> Pin<Box<dyn Future<Output = Result<Vec<Trace>, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Return traces matching the given filter
source§

fn trace_get<'life0, 'async_trait, T>( &'life0 self, hash: H256, index: Vec<T> ) -> Pin<Box<dyn Future<Output = Result<Trace, ProviderError>> + Send + 'async_trait>>
where T: 'async_trait + Into<U64> + Send + Sync, Self: 'async_trait, 'life0: 'async_trait,

Returns trace at the given position
source§

fn trace_transaction<'life0, 'async_trait>( &'life0 self, hash: H256 ) -> Pin<Box<dyn Future<Output = Result<Vec<Trace>, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Returns all traces of a given transaction
source§

fn subscribe_blocks<'life0, 'async_trait>( &'life0 self ) -> Pin<Box<dyn Future<Output = Result<SubscriptionStream<'_, P, Block<TxHash>>, ProviderError>> + Send + 'async_trait>>
where P: PubsubClient, Self: 'async_trait, 'life0: 'async_trait,

Subscribe to a stream of incoming blocks. Read more
source§

fn subscribe_pending_txs<'life0, 'async_trait>( &'life0 self ) -> Pin<Box<dyn Future<Output = Result<SubscriptionStream<'_, P, TxHash>, ProviderError>> + Send + 'async_trait>>
where P: PubsubClient, Self: 'async_trait, 'life0: 'async_trait,

Subscribe to a stream of pending transaction hashes. Read more
source§

fn subscribe_full_pending_txs<'life0, 'async_trait>( &'life0 self ) -> Pin<Box<dyn Future<Output = Result<SubscriptionStream<'_, P, Transaction>, ProviderError>> + Send + 'async_trait>>
where P: PubsubClient, Self: 'async_trait, 'life0: 'async_trait,

Subscribe to a stream of pending transaction bodies. Read more
source§

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>>
where P: PubsubClient, Self: 'async_trait, 'a: 'async_trait, 'life0: 'async_trait,

Subscribe to a stream of event logs matchin the provided Filter. Read more
source§

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, Self::Error>> + Send + 'async_trait>>
where T: 'async_trait + Into<U256> + Send + Sync, Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Query the node for a FeeHistory object. This objct contains information about the EIP-1559 base fee in past blocks, as well as gas utilization within those blocks. Read more
source§

fn send_escalating<'a, 'life0, 'async_trait>( &'a self, tx: &'life0 TypedTransaction, escalations: usize, policy: EscalationPolicy ) -> Pin<Box<dyn Future<Output = Result<EscalatingPending<'a, Self::Provider>, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'a: 'async_trait, 'life0: 'async_trait,

Send a transaction with a simple escalation policy. Read more
source§

impl ProviderExt for Provider<Http>

§

type Error = ParseError

The error type that can occur when creating a provider
source§

fn try_connect<'life0, 'async_trait>( url: &'life0 str ) -> Pin<Box<dyn Future<Output = Result<Self, Self::Error>> + Send + 'async_trait>>
where Self: Sized + 'async_trait, 'life0: 'async_trait,

Try to create a new Provider
source§

fn set_chain(&mut self, chain: impl Into<Chain>) -> &mut Self

Customized Provider settings for chain
source§

fn connect<'life0, 'async_trait>( url: &'life0 str ) -> Pin<Box<dyn Future<Output = Self> + Send + 'async_trait>>
where Self: Sized + Send + 'async_trait, 'life0: 'async_trait,

Creates a new instance connected to the given url, exit on error
source§

fn for_chain(self, chain: impl Into<Chain>) -> Self
where Self: Sized,

Customize Provider settings for chain. Read more
source§

impl<'a> TryFrom<&'a String> for Provider<Http>

§

type Error = ParseError

The type returned in the event of a conversion error.
source§

fn try_from(src: &'a String) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<&str> for Provider<Http>

§

type Error = ParseError

The type returned in the event of a conversion error.
source§

fn try_from(src: &str) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<String> for Provider<Http>

§

type Error = ParseError

The type returned in the event of a conversion error.
source§

fn try_from(src: String) -> Result<Self, Self::Error>

Performs the conversion.

Auto Trait Implementations§

§

impl<P> !RefUnwindSafe for Provider<P>

§

impl<P> Send for Provider<P>
where P: Send,

§

impl<P> Sync for Provider<P>
where P: Sync,

§

impl<P> Unpin for Provider<P>
where P: Unpin,

§

impl<P> !UnwindSafe for Provider<P>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CeloMiddleware for T
where T: Middleware,

source§

fn get_validators_bls_public_keys<'life0, 'async_trait, T>( &'life0 self, block_id: T ) -> Pin<Box<dyn Future<Output = Result<Vec<String>, ProviderError>> + Send + 'async_trait>>
where T: 'async_trait + Into<BlockId> + Send + Sync, Self: Sync + 'async_trait, 'life0: 'async_trait,

Available on crate feature celo only.
Get validator BLS public keys
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> JsonSchemaMaybe for T