superchain
The superchain is an optionally no_std crate that provides core types
and bindings for the Superchain.
It re-exports two crates:
superchain-primitivessuperchain-registryOnly available ifserdefeature flag is enabled
superchain-primitives defines core types used in the superchain-registry
along with a few default values for core chains.
superchain-registry provides bindings to all chains in the superchain.
Usage
Add the following to your Cargo.toml.
[]
= "0.1"
To make make superchain no_std, toggle default-features off like so.
[]
= { = "0.1", = false }
Example
superchain-registry exposes lazily defined mappings from chain id
to chain configurations that the superchain re-exports. Below
demonstrates getting the RollupConfig for OP Mainnet (Chain ID 10).
use ROLLUP_CONFIGS;
let op_chain_id = 10;
let op_rollup_config = ROLLUP_CONFIGS.get;
println!;
A mapping from chain id to ChainConfig is also available.
use OPCHAINS;
let op_chain_id = 10;
let op_chain_config = OPCHAINS.get;
println!;
Feature Flags
serde: Enablesserdesupport for types and makessuperchain-registrytypes available.std: Uses the standard library to pull in environment variables.