Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Companion for substrate#11469 #5569

Merged
merged 4 commits into from
May 21, 2022
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 16 additions & 20 deletions rpc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,14 @@ where
B: sc_client_api::Backend<Block> + Send + Sync + 'static,
B::State: sc_client_api::StateBackend<sp_runtime::traits::HashFor<Block>>,
{
use beefy_gadget_rpc::{BeefyApiServer, BeefyRpcHandler};
use frame_rpc_system::{SystemApiServer, SystemRpc};
use pallet_mmr_rpc::{MmrApiServer, MmrRpc};
use pallet_transaction_payment_rpc::{TransactionPaymentApiServer, TransactionPaymentRpc};
use sc_consensus_babe_rpc::{BabeApiServer, BabeRpc};
use sc_finality_grandpa_rpc::{GrandpaApiServer, GrandpaRpc};
use sc_sync_state_rpc::{SyncStateRpc, SyncStateRpcApiServer};
use substrate_state_trie_migration_rpc::StateMigrationApiServer;
use beefy_gadget_rpc::{Beefy, BeefyApiServer};
use frame_rpc_system::{System, SystemApiServer};
use pallet_mmr_rpc::{Mmr, MmrApiServer};
use pallet_transaction_payment_rpc::{TransactionPayment, TransactionPaymentApiServer};
use sc_consensus_babe_rpc::{Babe, BabeApiServer};
use sc_finality_grandpa_rpc::{Grandpa, GrandpaApiServer};
use sc_sync_state_rpc::{SyncState, SyncStateApiServer};
use substrate_state_trie_migration_rpc::{StateMigration, StateMigrationApiServer};

let mut io = RpcModule::new(());
let FullDeps { client, pool, select_chain, chain_spec, deny_unsafe, babe, grandpa, beefy } =
Expand All @@ -136,15 +136,12 @@ where
finality_provider,
} = grandpa;

io.merge(StateMigration::new(client.clone(), backend, deny_unsafe).into_rpc())?;
io.merge(System::new(client.clone(), pool.clone(), deny_unsafe).into_rpc())?;
io.merge(TransactionPayment::new(client.clone()).into_rpc())?;
io.merge(Mmr::new(client.clone()).into_rpc())?;
io.merge(
substrate_state_trie_migration_rpc::MigrationRpc::new(client.clone(), backend, deny_unsafe)
.into_rpc(),
)?;
io.merge(SystemRpc::new(client.clone(), pool.clone(), deny_unsafe).into_rpc())?;
io.merge(TransactionPaymentRpc::new(client.clone()).into_rpc())?;
io.merge(MmrRpc::new(client.clone()).into_rpc())?;
io.merge(
BabeRpc::new(
Babe::new(
client.clone(),
shared_epoch_changes.clone(),
keystore,
Expand All @@ -155,7 +152,7 @@ where
.into_rpc(),
)?;
io.merge(
GrandpaRpc::new(
Grandpa::new(
subscription_executor,
shared_authority_set.clone(),
shared_voter_state,
Expand All @@ -165,12 +162,11 @@ where
.into_rpc(),
)?;
io.merge(
SyncStateRpc::new(chain_spec, client, shared_authority_set, shared_epoch_changes)?
.into_rpc(),
SyncState::new(chain_spec, client, shared_authority_set, shared_epoch_changes)?.into_rpc(),
)?;

io.merge(
BeefyRpcHandler::<Block>::new(
Beefy::<Block>::new(
beefy.beefy_commitment_stream,
beefy.beefy_best_block_stream,
beefy.subscription_executor,
Expand Down