superchain-primitives

Crates.iosuperchain-primitives
lib.rssuperchain-primitives
version0.5.0
sourcesrc
created_at2024-06-21 17:51:53.363025
updated_at2024-09-13 18:58:18.117943
descriptionDeprecated. Please use the 'op-alloy-genesis' crate instead.
homepage
repositoryhttps://github.com/anton-rs/superchain
max_upload_size
id1279737
size80,857
refcell (refcell)

documentation

README

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

Commit count: 255

cargo fmt