4 releases
Uses new Rust 2024
new 0.1.3 | May 6, 2025 |
---|---|
0.1.2 | May 5, 2025 |
0.1.1 | May 5, 2025 |
0.1.0 | May 5, 2025 |
#293 in Magic Beans
69 downloads per month
2MB
218 lines
chainlist •


Minimal no_std
rust bindings for the Chainlist API built in pure Rust.
Getting Started
Add chainlist
using cargo add.
cargo add chainlist --features std,online
Or append the chainlist
crate to your project.
chainlist = "0.1.3"
Usage
use chainlist::{rpc, Chain, CHAINS};
// Get the RPC Configuration for Ethereum Mainnet.
let mainnet = CHAINS.iter().find(|c| c.chain_id == Some(1)).expect("exists");
assert_eq!(mainnet.name, "Ethereum Mainnet");
// Using the `rpc!` macro.
let mainnet = rpc!(1);
assert_eq!(mainnet.name, "Ethereum Mainnet");
// Get the `Chain` RPC configuration from an alloy "NamedChain".
// Note, this will panic if an RPC configuration doesn't exist
// in the chain list for the given chain id.
let mainnet: Chain = alloy_chains::NamedChain::Mainnet.into();
assert_eq!(mainnet.chain_id, Some(alloy_chains::NamedChain::Mainnet as u64));
Safety
[!Warning]
This is experimental software and is provided on an "as is" and "as available" basis. Expect rapid iteration and use at your own risk.
License
Acknowledgements
Dependencies
~5–23MB
~265K SLoC