Skip to content

Commit

Permalink
Add properties to Chain Spec (#917)
Browse files Browse the repository at this point in the history
* Add properties to chainspec.

* Update bin/millau/node/src/chain_spec.rs

Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com>

Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com>
  • Loading branch information
tomusdrw and HCastano committed Apr 22, 2021
1 parent d691c73 commit a30c51d
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 4 deletions.
2 changes: 2 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions bin/millau/node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
[dependencies]
jsonrpc-core = "15.1.0"
structopt = "0.3.21"
serde_json = "1.0.59"

# Bridge dependencies

Expand Down
13 changes: 11 additions & 2 deletions bin/millau/node/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,15 @@ pub fn get_authority_keys_from_seed(s: &str) -> (AccountId, AuraId, GrandpaId) {
impl Alternative {
/// Get an actual chain config from one of the alternatives.
pub(crate) fn load(self) -> ChainSpec {
let properties = Some(
serde_json::json!({
"tokenDecimals": 9,
"tokenSymbol": "MLAU",
})
.as_object()
.expect("Map given; qed")
.clone(),
);
match self {
Alternative::Development => ChainSpec::from_genesis(
"Development",
Expand All @@ -88,7 +97,7 @@ impl Alternative {
vec![],
None,
None,
None,
properties,
None,
),
Alternative::LocalTestnet => ChainSpec::from_genesis(
Expand Down Expand Up @@ -136,7 +145,7 @@ impl Alternative {
vec![],
None,
None,
None,
properties,
None,
),
}
Expand Down
1 change: 1 addition & 0 deletions bin/rialto/node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
[dependencies]
jsonrpc-core = "15.1.0"
structopt = "0.3.21"
serde_json = "1.0.59"

# Bridge dependencies

Expand Down
14 changes: 12 additions & 2 deletions bin/rialto/node/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ use rialto_runtime::{
AccountId, AuraConfig, BalancesConfig, BridgeKovanConfig, BridgeRialtoPoAConfig, GenesisConfig, GrandpaConfig,
SessionConfig, SessionKeys, Signature, SudoConfig, SystemConfig, WASM_BINARY,
};
use serde_json::json;
use sp_consensus_aura::sr25519::AuthorityId as AuraId;
use sp_core::{sr25519, Pair, Public};
use sp_finality_grandpa::AuthorityId as GrandpaId;
Expand Down Expand Up @@ -67,6 +68,15 @@ pub fn get_authority_keys_from_seed(s: &str) -> (AccountId, AuraId, GrandpaId) {
impl Alternative {
/// Get an actual chain config from one of the alternatives.
pub(crate) fn load(self) -> ChainSpec {
let properties = Some(
json!({
"tokenDecimals": 9,
"tokenSymbol": "RLT",
})
.as_object()
.expect("Map given; qed")
.clone(),
);
match self {
Alternative::Development => ChainSpec::from_genesis(
"Development",
Expand All @@ -88,7 +98,7 @@ impl Alternative {
vec![],
None,
None,
None,
properties,
None,
),
Alternative::LocalTestnet => ChainSpec::from_genesis(
Expand Down Expand Up @@ -136,7 +146,7 @@ impl Alternative {
vec![],
None,
None,
None,
properties,
None,
),
}
Expand Down

0 comments on commit a30c51d

Please sign in to comment.