33 releases (8 breaking)

new 0.8.1 Dec 16, 2024
0.7.3 Dec 5, 2024
0.7.0 Nov 28, 2024
0.2.0 Jul 16, 2024
0.1.0 Dec 18, 2023

#260 in Magic Beans

Download history 17845/week @ 2024-08-27 21308/week @ 2024-09-03 19609/week @ 2024-09-10 24190/week @ 2024-09-17 24058/week @ 2024-09-24 29832/week @ 2024-10-01 36959/week @ 2024-10-08 38541/week @ 2024-10-15 39235/week @ 2024-10-22 34899/week @ 2024-10-29 38595/week @ 2024-11-05 33082/week @ 2024-11-12 35058/week @ 2024-11-19 38062/week @ 2024-11-26 41573/week @ 2024-12-03 35828/week @ 2024-12-10

156,319 downloads per month
Used in 105 crates (22 directly)

MIT/Apache

2.5MB
32K 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
~849K SLoC