Add new RPC method to get the chain type (#5576)

* Add new RPC method to get the chain type

This adds a new RPC method to get the chain type of the running chain.
The chain type needs to be specified in the chain spec. This should make
it easier for tools/UI to display extra information without needing to
rely on parsing the chain name.

* Update client/rpc-api/src/system/mod.rs

Co-Authored-By: Tomasz Drwięga <tomusdrw@users.noreply.github.com>

* Primitive crate

* Feedback

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>
This commit is contained in:
Bastian Köcher
2020-04-08 20:41:51 +02:00
committed by GitHub
parent 1d2cbfbdf9
commit 7cdfaff12b
19 changed files with 135 additions and 26 deletions
+6 -1
View File
@@ -27,7 +27,7 @@ use node_runtime::{
};
use node_runtime::Block;
use node_runtime::constants::currency::*;
use sc_service;
use sc_service::ChainType;
use hex_literal::hex;
use sc_telemetry::TelemetryEndpoints;
use grandpa_primitives::{AuthorityId as GrandpaId};
@@ -158,6 +158,7 @@ pub fn staging_testnet_config() -> ChainSpec {
ChainSpec::from_genesis(
"Staging Testnet",
"staging_testnet",
ChainType::Live,
staging_testnet_config_genesis,
boot_nodes,
Some(TelemetryEndpoints::new(vec![(STAGING_TELEMETRY_URL.to_string(), 0)])
@@ -338,6 +339,7 @@ pub fn development_config() -> ChainSpec {
ChainSpec::from_genesis(
"Development",
"dev",
ChainType::Development,
development_config_genesis,
vec![],
None,
@@ -364,6 +366,7 @@ pub fn local_testnet_config() -> ChainSpec {
ChainSpec::from_genesis(
"Local Testnet",
"local_testnet",
ChainType::Local,
local_testnet_genesis,
vec![],
None,
@@ -396,6 +399,7 @@ pub(crate) mod tests {
ChainSpec::from_genesis(
"Integration Test",
"test",
ChainType::Development,
local_testnet_genesis_instant_single,
vec![],
None,
@@ -410,6 +414,7 @@ pub(crate) mod tests {
ChainSpec::from_genesis(
"Integration Test",
"test",
ChainType::Development,
local_testnet_genesis,
vec![],
None,