28 releases (6 breaking)

new 0.6.4 Nov 12, 2024
0.5.4 Oct 23, 2024
0.2.0 Jul 16, 2024
0.1.0 Dec 18, 2023

#491 in Magic Beans

Download history 12932/week @ 2024-07-28 16778/week @ 2024-08-04 17888/week @ 2024-08-11 16100/week @ 2024-08-18 17277/week @ 2024-08-25 21382/week @ 2024-09-01 19711/week @ 2024-09-08 22250/week @ 2024-09-15 24569/week @ 2024-09-22 27019/week @ 2024-09-29 35014/week @ 2024-10-06 39707/week @ 2024-10-13 37684/week @ 2024-10-20 37726/week @ 2024-10-27 38227/week @ 2024-11-03 32228/week @ 2024-11-10

148,667 downloads per month
Used in 91 crates (28 directly)

MIT/Apache

2.5MB
30K 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

~28–44MB
~842K SLoC