7 releases

0.2.0 Jul 16, 2024
0.1.4 Jul 8, 2024
0.1.3 Jun 25, 2024
0.1.0 Dec 18, 2023
0.0.0-reserved May 23, 2024

#1128 in Magic Beans

Download history 2/week @ 2024-04-04 77/week @ 2024-05-23 4/week @ 2024-05-30 11/week @ 2024-06-06 2136/week @ 2024-06-13 6388/week @ 2024-06-20 6831/week @ 2024-06-27 8125/week @ 2024-07-04 10292/week @ 2024-07-11 9447/week @ 2024-07-18

35,962 downloads per month
Used in 26 crates (8 directly)

MIT/Apache

2MB
23K SLoC

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 enables pubsub.
  • ipc - Enable IPC support. Implicitly enables pubsub.

Usage

TODO :)

Dependencies

~25–40MB
~831K SLoC