mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-19 22:45:40 +00:00
rpc: add rpc v2 chainSpec to polkadot (#2859)
The [chainSpec RPC API from the v2 spec](https://paritytech.github.io/json-rpc-interface-spec/api/chainSpec.html) was only added to substrate-node and should be added to polkadot as well /cc @lexnv
This commit is contained in:
@@ -121,6 +121,7 @@ where
|
||||
use sc_consensus_babe_rpc::{Babe, BabeApiServer};
|
||||
use sc_consensus_beefy_rpc::{Beefy, BeefyApiServer};
|
||||
use sc_consensus_grandpa_rpc::{Grandpa, GrandpaApiServer};
|
||||
use sc_rpc_spec_v2::chain_spec::{ChainSpec, ChainSpecApiServer};
|
||||
use sc_sync_state_rpc::{SyncState, SyncStateApiServer};
|
||||
use substrate_state_trie_migration_rpc::{StateMigration, StateMigrationApiServer};
|
||||
|
||||
@@ -134,6 +135,11 @@ where
|
||||
finality_provider,
|
||||
} = grandpa;
|
||||
|
||||
let chain_name = chain_spec.name().to_string();
|
||||
let genesis_hash = client.hash(0).ok().flatten().expect("Genesis block exists; qed");
|
||||
let properties = chain_spec.properties();
|
||||
|
||||
io.merge(ChainSpec::new(chain_name, genesis_hash, properties).into_rpc())?;
|
||||
io.merge(StateMigration::new(client.clone(), backend.clone(), deny_unsafe).into_rpc())?;
|
||||
io.merge(System::new(client.clone(), pool.clone(), deny_unsafe).into_rpc())?;
|
||||
io.merge(TransactionPayment::new(client.clone()).into_rpc())?;
|
||||
|
||||
Reference in New Issue
Block a user