astar_collator/local/
chain_spec.rs

1// This file is part of Astar.
2
3// Copyright (C) Stake Technologies Pte.Ltd.
4// SPDX-License-Identifier: GPL-3.0-or-later
5
6// Astar is free software: you can redistribute it and/or modify
7// it under the terms of the GNU General Public License as published by
8// the Free Software Foundation, either version 3 of the License, or
9// (at your option) any later version.
10
11// Astar is distributed in the hope that it will be useful,
12// but WITHOUT ANY WARRANTY; without even the implied warranty of
13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14// GNU General Public License for more details.
15
16// You should have received a copy of the GNU General Public License
17// along with Astar. If not, see <http://www.gnu.org/licenses/>.
18
19use crate::parachain::chain_spec::Extensions;
20use astar_primitives::parachain::SHIBUYA_ID;
21use sc_service::ChainType;
22use shibuya_runtime::wasm_binary_unwrap;
23
24/// Specialized `ChainSpec` for local network.
25pub type ChainSpec = sc_service::GenericChainSpec<Extensions>;
26
27/// Development config for local parachain-oriented dev mode.
28pub fn development_config() -> ChainSpec {
29    let mut properties = serde_json::map::Map::new();
30    properties.insert("tokenSymbol".into(), "SBY".into());
31    properties.insert("tokenDecimals".into(), 18.into());
32
33    ChainSpec::builder(
34        wasm_binary_unwrap(),
35        Extensions {
36            relay_chain: "local".into(),
37            para_id: SHIBUYA_ID,
38            ..Default::default()
39        },
40    )
41    .with_name("Development")
42    .with_id("dev")
43    .with_chain_type(ChainType::Development)
44    .with_properties(properties)
45    .with_genesis_config_preset_name("development")
46    .build()
47}
48
49#[cfg(test)]
50pub(crate) mod tests {
51    use super::*;
52    use sp_runtime::BuildStorage;
53
54    #[test]
55    fn test_create_development_chain_spec() {
56        development_config().build_storage().unwrap();
57    }
58}