chore(op): Add OpChainSpec (#10516)

This commit is contained in:
Emilia Hane
2024-08-27 14:25:38 +02:00
committed by GitHub
parent e6dc947a37
commit 7df7bc2c1a
20 changed files with 236 additions and 177 deletions

View File

@ -14,7 +14,6 @@ workspace = true
[dependencies]
# reth
reth-cli-runner.workspace = true
reth-chainspec.workspace = true
# misc
clap.workspace = true

View File

@ -1,17 +1,17 @@
use clap::builder::TypedValueParser;
use reth_chainspec::ChainSpec;
use std::sync::Arc;
use clap::builder::TypedValueParser;
/// Trait for parsing chain specifications.
///
/// This trait extends [`clap::builder::TypedValueParser`] to provide a parser for chain
/// specifications. Implementers of this trait must provide a list of supported chains and a
/// function to parse a given string into a [`ChainSpec`].
pub trait ChainSpecParser: TypedValueParser<Value = Arc<ChainSpec>> + Default {
/// function to parse a given string into a chain spec.
pub trait ChainSpecParser<ChainSpec>: TypedValueParser<Value = Arc<ChainSpec>> + Default {
/// List of supported chains.
const SUPPORTED_CHAINS: &'static [&'static str];
/// Parses the given string into a [`ChainSpec`].
/// Parses the given string into a chain spec.
///
/// # Arguments
///
@ -20,6 +20,6 @@ pub trait ChainSpecParser: TypedValueParser<Value = Arc<ChainSpec>> + Default {
/// # Errors
///
/// This function will return an error if the input string cannot be parsed into a valid
/// [`ChainSpec`].
/// chain spec.
fn parse(s: &str) -> eyre::Result<Arc<ChainSpec>>;
}