Skip to content
This repository has been archived by the owner on Feb 21, 2024. It is now read-only.

Commit

Permalink
Merge pull request paritytech#150 from subspace/simplify-properties
Browse files Browse the repository at this point in the history
Simplify the properties generation in ChainSpec
  • Loading branch information
liuchengxu authored Nov 25, 2021
2 parents e0814b5 + 893a569 commit 5cab601
Showing 1 changed file with 6 additions and 14 deletions.
20 changes: 6 additions & 14 deletions crates/subspace-node/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ pub fn get_account_id_from_seed(seed: &str) -> AccountId {
}

pub fn testnet_config() -> Result<ChainSpec, String> {
let mut properties = Properties::new();
properties.insert("ss58Format".into(), SS58Prefix::get().into());
properties.insert("tokenDecimals".into(), DECIMAL_PLACES.into());
properties.insert("tokenSymbol".into(), "tSSC".into());

Ok(ChainSpec::from_genesis(
// Name
"Subspace testnet",
Expand Down Expand Up @@ -144,20 +149,7 @@ pub fn testnet_config() -> Result<ChainSpec, String> {
// Protocol ID
Some("subspace"),
// Properties
Some(Properties::from_iter([
(
"ss58Format".to_string(),
serde_json::to_value(SS58Prefix::get()).expect("u16 is always serializable; qed"),
),
(
"tokenDecimals".to_string(),
serde_json::to_value(DECIMAL_PLACES).expect("u8 is always serializable; qed"),
),
(
"tokenSymbol".to_string(),
serde_json::to_value("tSSC").expect("&str is always serializable; qed"),
),
])),
Some(properties),
// Extensions
None,
))
Expand Down

0 comments on commit 5cab601

Please sign in to comment.