| Crates.io | chainlist-rs |
| lib.rs | chainlist-rs |
| version | 0.1.2 |
| created_at | 2025-11-26 10:02:34.805578+00 |
| updated_at | 2025-11-28 02:47:57.669324+00 |
| description | EVM chain metadata and helpers generated from chainid.network |
| homepage | |
| repository | |
| max_upload_size | |
| id | 1951205 |
| size | 1,147,135 |
Typed access to EVM chain metadata generated from chainid.network/chains.json. The build script downloads the JSON on every build and turns it into a Chain enum with helpers for IDs, names, native currency, RPC URLs, and block times.
Add to your Cargo.toml:
chainlist-rs = "0.1"
Use the enum:
use chainlist_rs::Chain;
fn main() {
let mainnet = Chain::Mainnet;
println!(
"{} (id {}) uses {}",
mainnet.name(),
mainnet.id(),
mainnet.native_currency().1
);
}
Examples:
cargo run --example print_chaincargo run --example wallet_paramscargo run --example list_chainslet chains = chainlist_rs::all_chains();chains.json is downloaded at build time from https://chainid.network/chains.json (network required).CHAINS_JSON_URL to point to your mirror, or CHAINS_JSON_PATH if you want to supply a local file explicitly.chains.json unless you provide CHAINS_JSON_PATH.cargo fmt, cargo clippy --all-targets --all-features, cargo test.CHAINS_JSON_PATH=data/chains.json to stay offline.cargo package --dry-run (or cargo publish --dry-run) to verify the crate contents and metadata.vX.Y.Z runs checks (fmt/clippy/tests) and publishes with cargo publish --locked when CARGO_REGISTRY_TOKEN is set in repo secrets; the tag must match the crate version.cargo llvm-cov --lcov with CHAINS_JSON_PATH=data/chains.json and uploads to Codecov (set CODECOV_TOKEN if the repo is private).MIT OR Apache-2.0 (dual license).