subcoin_service/
chain_spec.rs1use crate::ChainSpec;
2use sc_service::{ChainType, Properties};
3use subcoin_runtime::WASM_BINARY;
4
5fn props() -> Properties {
6 let mut properties = Properties::new();
7 properties.insert("tokenDecimals".to_string(), 8.into());
8 properties.insert("tokenSymbol".to_string(), "BTC".into());
9 properties
10}
11
12pub fn config(network: bitcoin::Network) -> Result<ChainSpec, String> {
13 let (name, id) = match network {
14 bitcoin::Network::Bitcoin => ("Bitcoin Mainnet", "bitcoin-mainnet"),
15 bitcoin::Network::Testnet => ("Bitcoin Testnet", "bitcoin-testnet"),
16 bitcoin::Network::Signet => ("Bitcoin Signet", "bitcoin-signet"),
17 bitcoin::Network::Regtest => ("Bitcoin Regtest", "bitcoin-regtest"),
18 unknown_network => unreachable!("Unknown Bitcoin network: {unknown_network:?}"),
19 };
20 Ok(ChainSpec::builder(
21 WASM_BINARY.expect("Wasm binary not available"),
22 Default::default(),
23 )
24 .with_name(name)
25 .with_id(id)
26 .with_chain_type(ChainType::Live)
27 .with_properties(props())
28 .build())
29}