Expand description
§alloy-provider
Interface with an Ethereum blockchain.
This crate contains the Provider
trait, which exposes Ethereum JSON-RPC
methods. Providers in alloy are similar to ethers.js
providers. They manage
an RpcClient
and allow other parts of the program to easily make RPC calls.
Unlike an ethers.js
Provider, an alloy Provider is network-aware. It is
parameterized with a Network
from [alloy-networks
]. This allows the Provider
to expose a consistent interface to the rest of the program, while adjusting
request and response types to match the underlying blockchain.
Providers can be composed via stacking. For example, a Provider
that tracks
the nonce for a given address can be stacked onto a Provider
that signs
transactions to create a Provider
that can send signed transactions with
correct nonces.
The ProviderBuilder
struct can quickly create a stacked provider, similar to
tower::ServiceBuilder
.
§Feature flags
pubsub
- Enable support for subscription methods.ws
- Enable WebSocket support. Implicitly enablespubsub
.ipc
- Enable IPC support. Implicitly enablespubsub
.
§Usage
TODO :)
Re-exports§
pub use provider::SendableTx;
pub use alloy_network as network;
pub use alloy_network::Network;
Modules§
- Extended APIs for the provider module.
- Transaction Fillers
- Useful layer implementations for the provider. Currently this module contains the
AnvilLayer
,AnvilProvider
andChainLayer
types. - Provider-related utilities.
Structs§
- A builder for an
"eth_call"
request. This type is returned by theProvider::call
method. - The parameters for an
"eth_call"
RPC request. - An identity layer that does nothing.
- IpcConnect
ipc
An IPC Connection object. - Helper struct that houses the params along with the BlockId.
- Represents a transaction that is yet to be confirmed a specified number of times.
- A builder for configuring a pending transaction watcher.
- Configuration for watching a pending transaction.
- A builder for constructing a
Provider
from various layers. - The root provider manages the RPC client and the heartbeat. It is at the base of every provider stack.
- A struct that takes an optional
BlockId
parameter. - A stack of two providers.
- Simple connection details for a websocket connection.
Enums§
- Errors which may occur when watching a pending transaction.
- The primary future type for the
Provider
. - Errors which may occur in heartbeat when watching a transaction.
Traits§
- Trait that helpes convert
EthCall
into aProviderCall
. - Provider is parameterized with a network and a transport. The default transport is type-erased, but you can do
Provider<Http, N>
. - A layering abstraction in the vein of
tower::Layer
- Trait for Providers, Fill stacks, etc, which contain
NetworkWallet
.
Functions§
- Helper function to directly access
ProviderBuilder
with minimal generics.
Type Aliases§
- A task that polls the provider with
eth_getFilterChanges
, returning a list ofR
. - Hyper
Provider hyper
Type alias for aRootProvider
using theHttp
transport and a hyper client. - Reqwest
Provider reqwest
Type alias for aRootProvider
using theHttp
transport and a reqwest client.