Expand description
§superchain-primitives
§WARNING
This crate has been deprecated. Please use https://crates.io/crates/op-alloy-genesis instead.
A set of primitive types for the superchain.
These types mirror the golang types defined by the superchain-registry.
superchain-primitives is a no_std crate with optional type support for
serde serialization and deserialization providing a serde feature flag.
Standard library support is available by enabling the std feature flag on the
superchain-primitives dependency.
By default, both the std and serde feature flags are enabled.
§Usage
Add the following to your Cargo.toml.
[dependencies]
superchain-primitives = "0.3"To disable default feature flags, disable the default-features field like so.
superchain-primitives = { version = "0.3", default-features = false }Features can then be enabled individually.
superchain-primitives = { version = "0.3", default-features = false, features = [ "std" ] }§Example
Below uses statically defined rollup configs for common chain ids.
use superchain_primitives::rollup_config_from_chain_id;
let op_mainnet_rollup_config = rollup_config_from_chain_id(10).unwrap();
println!("OP Mainnet Rollup Config:\n{op_mainnet_rollup_config:?}");To inherit rollup configs defined by the superchain-registry,
use the superchain-registry crate defined in registry.
Note, serde is required.
§Feature Flags
serde: Implements serialization and deserialization for types.std: Uses standard library types.
§Hardcoded Rollup Configs
OP_MAINNET_CONFIG: OP Mainnet (Chain ID:10)OP_SEPOLIA_CONFIG: OP Sepolia (Chain ID:11155420)BASE_MAINNET_CONFIG: Base Mainnet (Chain ID:8453)BASE_SEPOLIA_CONFIG: Base Sepolia (Chain ID:84532)
Re-exports§
pub use superchain::Superchain;pub use superchain::SuperchainConfig;pub use superchain::SuperchainL1Info;pub use superchain::SuperchainLevel;pub use predeploys::BASE_FEE_VAULT;pub use predeploys::BEACON_BLOCK_ROOT;pub use predeploys::EAS;pub use predeploys::GAS_PRICE_ORACLE;pub use predeploys::GOVERNANCE_TOKEN;pub use predeploys::L1_BLOCK;pub use predeploys::L1_BLOCK_NUMBER;pub use predeploys::L1_FEE_VAULT;pub use predeploys::L2_CROSS_DOMAIN_MESSENGER;pub use predeploys::L2_ERC721_BRIDGE;pub use predeploys::L2_STANDARD_BRIDGE;pub use predeploys::L2_TO_L1_MESSAGE_PASSER;pub use predeploys::OPTIMISM_MINTABLE_ERC20_FACTORY;pub use predeploys::OPTIMISM_MINTABLE_ERC721_FACTORY;pub use predeploys::PROXY_ADMIN;pub use predeploys::SCHEMA_REGISTRY;pub use predeploys::SEQUENCER_FEE_VAULT;pub use predeploys::WETH9;pub use fee_params::BASE_SEPOLIA_BASE_FEE_PARAMS;pub use fee_params::BASE_SEPOLIA_CANYON_BASE_FEE_PARAMS;pub use fee_params::BASE_SEPOLIA_EIP1559_DEFAULT_ELASTICITY_MULTIPLIER;pub use fee_params::OP_BASE_FEE_PARAMS;pub use fee_params::OP_CANYON_BASE_FEE_PARAMS;pub use fee_params::OP_SEPOLIA_BASE_FEE_PARAMS;pub use fee_params::OP_SEPOLIA_CANYON_BASE_FEE_PARAMS;pub use fee_params::OP_SEPOLIA_EIP1559_BASE_FEE_MAX_CHANGE_DENOMINATOR_CANYON;pub use fee_params::OP_SEPOLIA_EIP1559_DEFAULT_BASE_FEE_MAX_CHANGE_DENOMINATOR;pub use fee_params::OP_SEPOLIA_EIP1559_DEFAULT_ELASTICITY_MULTIPLIER;pub use rollup_config::load_op_stack_rollup_config;pub use rollup_config::rollup_config_from_chain_id;pub use rollup_config::RollupConfig;pub use rollup_config::BASE_MAINNET_CONFIG;pub use rollup_config::BASE_SEPOLIA_CONFIG;pub use rollup_config::OP_MAINNET_CONFIG;pub use rollup_config::OP_SEPOLIA_CONFIG;pub use chain_config::AltDAConfig;pub use chain_config::ChainConfig;pub use chain_config::HardForkConfiguration;pub use genesis::ChainGenesis;pub use block::BlockID;pub use system_config::SystemConfig;pub use addresses::AddressList;
Modules§
- addresses
- Address Types
- block
- Block Types
- chain_
config - Chain Config Types
- fee_
params - Module containing fee parameters.
- genesis
- Genesis types.
- predeploys
- Contains all predeploy contract addresses.
- rollup_
config - Rollup Config Types
- superchain
- Superchain types.
- system_
config - System Config Type
Structs§
- Genesis
- Re-export the Genesis type from alloy_genesis. The genesis block specification.