[−][src]Crate ethers_providers
Clients for interacting with Ethereum nodes
This crate provides asynchronous Ethereum JSON-RPC compliant clients.
For more documentation on the available calls, refer to the Provider
struct.
Examples
use ethers::providers::{Provider, Http}; use std::convert::TryFrom; let provider = Provider::<Http>::try_from( "https://mainnet.infura.io/v3/c60b0bb42f8a4c6481ecd229eddaca27" )?; let block = provider.get_block(100u64).await?; println!("Got block: {}", serde_json::to_string(&block)?); let code = provider.get_code("0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359", None).await?; println!("Got code: {}", serde_json::to_string(&code)?);
Ethereum Name Service
The provider may also be used to resolve Ethereum Name Service (ENS) names
to addresses (and vice versa). The default ENS address is mainnet and can be overriden by calling the ens
method on the provider.
// Resolve ENS name to Address let name = "vitalik.eth"; let address = provider.resolve_name(name).await?; // Lookup ENS name given Address let resolved_name = provider.lookup_address(address).await?; assert_eq!(name, resolved_name);
Structs
Http | A low-level JSON-RPC Client over HTTP. |
PendingTransaction | A pending transaction is a transaction which has been submitted but is not yet mined.
|
Provider | An abstract provider for interacting with the Ethereum JSON RPC
API. Must be instantiated
with a data transport which implements the |
Enums
ProviderError | An error thrown when making a call to the provider |
Traits
FilterStream | Trait for streaming filters. |
JsonRpcClient | Trait which must be implemented by data transports to be used with the Ethereum JSON-RPC provider. |
StreamExt | An extension trait for |