MCPcopy Create free account
hub / github.com/base/base / chain_value_parser

Function chain_value_parser

crates/execution/cli/src/chainspec.rs:26–32  ·  view source on GitHub ↗

Clap value parser for [`BaseChainSpec`]s. The value parser matches either a known chain, the path to a json file, or a json formatted string in-memory. The json needs to be a Genesis struct.

(s: &str)

Source from the content-addressed store, hash-verified

24/// The value parser matches either a known chain, the path
25/// to a json file, or a json formatted string in-memory. The json needs to be a Genesis struct.
26pub fn chain_value_parser(s: &str) -> eyre::Result<Arc<BaseChainSpec>, eyre::Error> {
27 if let Some(base_chain_spec) = BaseChainSpec::parse_chain(s) {
28 Ok(base_chain_spec)
29 } else {
30 Ok(Arc::new(BaseChainSpec::try_from_genesis(parse_genesis(s)?)?))
31 }
32}
33
34#[cfg(test)]
35mod tests {

Callers 1

parseMethod · 0.85

Calls 1

parse_genesisFunction · 0.85

Tested by

no test coverage detected