superchain 0.1.0

The Superchain Registry
Documentation

superchain

The superchain is an optionally no_std crate that provides core types and bindings for the Superchain.

It re-exports two crates:

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.

[dependencies]
superchain = "0.1"

To make make superchain no_std, toggle default-features off like so.

[dependencies]
superchain = { version = "0.1", default-features = 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 superchain::ROLLUP_CONFIGS;

let op_chain_id = 10;
let op_rollup_config = ROLLUP_CONFIGS.get(&op_chain_id);
println!("OP Mainnet Rollup Config: {:?}", op_rollup_config);

A mapping from chain id to ChainConfig is also available.

use superchain::OPCHAINS;

let op_chain_id = 10;
let op_chain_config = OPCHAINS.get(&op_chain_id);
println!("OP Mainnet Chain Config: {:?}", op_chain_config);

Feature Flags

  • serde: Enables serde support for types and makes superchain-registry types available.
  • std: Uses the standard library to pull in environment variables.