#deprecated #chain #primitive #rollup #registry #optimism #superchain

deprecated no-std superchain-primitives

Deprecated. Please use the 'op-alloy-genesis' crate instead.

15 releases (4 breaking)

0.5.0 Sep 13, 2024
0.4.0 Sep 7, 2024
0.3.4 Sep 4, 2024
0.3.2 Aug 28, 2024
0.1.1 Jun 26, 2024

#11 in #optimism

Download history 683/week @ 2024-06-24 188/week @ 2024-07-01 409/week @ 2024-07-08 376/week @ 2024-07-15 826/week @ 2024-07-22 376/week @ 2024-07-29 304/week @ 2024-08-05 490/week @ 2024-08-12 1034/week @ 2024-08-19 1360/week @ 2024-08-26 2204/week @ 2024-09-02 1409/week @ 2024-09-09 3382/week @ 2024-09-16 395/week @ 2024-09-23 210/week @ 2024-09-30 151/week @ 2024-10-07

4,472 downloads per month
Used in 5 crates (2 directly)

MIT license

81KB
1.5K SLoC

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

Dependencies

~10MB
~194K SLoC