superchain
The superchain is an optionally no_std crate that provides core types
and bindings for the Superchain.
superchain is an optionally no_std crate, by disabling
the std feature flag. By default, std is enabled, providing standard
library support.
serde is a required dependency.
Usage
Add the following to your Cargo.toml.
[]
= "0.5"
To make superchain work in a no_std environment, toggle default-features off like so.
[]
= { = "0.5", = false }
Example
superchain exposes lazily defined mappings from chain id
to chain configurations. 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
std: Uses the standard library to pull in environment variables.