polkadot_parachain/chain_spec/
glutton.rs1use cumulus_primitives_core::ParaId;
18use polkadot_omni_node_lib::chain_spec::{Extensions, GenericChainSpec};
19use sc_service::ChainType;
20
21pub fn glutton_westend_config(
23 para_id: ParaId,
24 chain_type: ChainType,
25 relay_chain: &str,
26) -> GenericChainSpec {
27 let mut properties = sc_chain_spec::Properties::new();
28 properties.insert("ss58Format".into(), 42.into());
29
30 GenericChainSpec::builder(
31 glutton_westend_runtime::WASM_BINARY.expect("WASM binary was not built, please build it!"),
32 Extensions::new_with_relay_chain(relay_chain.into()),
33 )
34 .with_name(&chain_type_name(para_id, &chain_type))
35 .with_id(&chain_id(para_id, &chain_type))
36 .with_chain_type(chain_type.clone())
37 .with_genesis_config_preset_name(match chain_type {
38 ChainType::Development => sp_genesis_builder::DEV_RUNTIME_PRESET,
39 ChainType::Local => sp_genesis_builder::LOCAL_TESTNET_RUNTIME_PRESET,
40 _ => panic!("chain_type: {chain_type:?} not supported here!"),
41 })
42 .build()
43}
44
45fn chain_type_name(para_id: ParaId, chain_type: &ChainType) -> String {
47 match chain_type {
48 ChainType::Development => format!("Glutton Development {}", para_id),
49 ChainType::Local => format!("Glutton Local {}", para_id),
50 ChainType::Live => format!("Glutton {}", para_id),
51 ChainType::Custom(name) => name.clone(),
52 }
53}
54
55pub fn chain_id(para_id: ParaId, chain_type: &ChainType) -> String {
57 match chain_type {
58 ChainType::Development => format!("glutton-westend-dev-{}", para_id),
59 ChainType::Local => format!("glutton-westend-local-{}", para_id),
60 ChainType::Live => format!("glutton-westend-{}", para_id),
61 ChainType::Custom(_) => format!("glutton-westend-custom-{}", para_id),
62 }
63}