mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 18:41:05 +00:00
* Companion PR for #6215 * rpc: fix reviewer comments * "Update Substrate" Co-authored-by: parity-processbot <> Co-authored-by: André Silva <andrerfosilva@gmail.com>
This commit is contained in:
+13
-6
@@ -23,12 +23,13 @@ use std::sync::Arc;
|
||||
use polkadot_primitives::v0::{Block, BlockNumber, AccountId, Nonce, Balance, Hash};
|
||||
use sp_api::ProvideRuntimeApi;
|
||||
use txpool_api::TransactionPool;
|
||||
use sp_block_builder::BlockBuilder;
|
||||
use sp_blockchain::{HeaderBackend, HeaderMetadata, Error as BlockChainError};
|
||||
use sp_consensus::SelectChain;
|
||||
use sp_consensus_babe::BabeApi;
|
||||
use sc_client_api::light::{Fetcher, RemoteBlockchain};
|
||||
use sc_consensus_babe::Epoch;
|
||||
use sp_block_builder::BlockBuilder;
|
||||
use sc_finality_grandpa::FinalityProofProvider;
|
||||
pub use sc_rpc::{DenyUnsafe, SubscriptionTaskExecutor};
|
||||
|
||||
/// A type representing all RPC extensions.
|
||||
@@ -57,19 +58,21 @@ pub struct BabeDeps {
|
||||
}
|
||||
|
||||
/// Dependencies for GRANDPA
|
||||
pub struct GrandpaDeps {
|
||||
pub struct GrandpaDeps<B> {
|
||||
/// Voting round info.
|
||||
pub shared_voter_state: sc_finality_grandpa::SharedVoterState,
|
||||
/// Authority set info.
|
||||
pub shared_authority_set: sc_finality_grandpa::SharedAuthoritySet<Hash, BlockNumber>,
|
||||
/// Receives notifications about justification events from Grandpa.
|
||||
pub justification_stream: sc_finality_grandpa::GrandpaJustificationStream<Block>,
|
||||
/// Subscription manager to keep track of pubsub subscribers.
|
||||
/// Executor to drive the subscription manager in the Grandpa RPC handler.
|
||||
pub subscription_executor: sc_rpc::SubscriptionTaskExecutor,
|
||||
/// Finality proof provider.
|
||||
pub finality_provider: Arc<FinalityProofProvider<B, Block>>,
|
||||
}
|
||||
|
||||
/// Full client dependencies
|
||||
pub struct FullDeps<C, P, SC> {
|
||||
pub struct FullDeps<C, P, SC, B> {
|
||||
/// The client instance to use.
|
||||
pub client: Arc<C>,
|
||||
/// Transaction pool instance.
|
||||
@@ -81,11 +84,11 @@ pub struct FullDeps<C, P, SC> {
|
||||
/// BABE specific dependencies.
|
||||
pub babe: BabeDeps,
|
||||
/// GRANDPA specific dependencies.
|
||||
pub grandpa: GrandpaDeps,
|
||||
pub grandpa: GrandpaDeps<B>,
|
||||
}
|
||||
|
||||
/// Instantiate all RPC extensions.
|
||||
pub fn create_full<C, P, SC>(deps: FullDeps<C, P, SC>) -> RpcExtension where
|
||||
pub fn create_full<C, P, SC, B>(deps: FullDeps<C, P, SC, B>) -> RpcExtension where
|
||||
C: ProvideRuntimeApi<Block>,
|
||||
C: HeaderBackend<Block> + HeaderMetadata<Block, Error=BlockChainError>,
|
||||
C: Send + Sync + 'static,
|
||||
@@ -95,6 +98,8 @@ pub fn create_full<C, P, SC>(deps: FullDeps<C, P, SC>) -> RpcExtension where
|
||||
C::Api: BlockBuilder<Block>,
|
||||
P: TransactionPool + Sync + Send + 'static,
|
||||
SC: SelectChain<Block> + 'static,
|
||||
B: sc_client_api::Backend<Block> + Send + Sync + 'static,
|
||||
B::State: sc_client_api::StateBackend<sp_runtime::traits::HashFor<Block>>,
|
||||
{
|
||||
use frame_rpc_system::{FullSystem, SystemApi};
|
||||
use pallet_transaction_payment_rpc::{TransactionPayment, TransactionPaymentApi};
|
||||
@@ -120,6 +125,7 @@ pub fn create_full<C, P, SC>(deps: FullDeps<C, P, SC>) -> RpcExtension where
|
||||
shared_authority_set,
|
||||
justification_stream,
|
||||
subscription_executor,
|
||||
finality_provider,
|
||||
} = grandpa;
|
||||
|
||||
io.extend_with(
|
||||
@@ -146,6 +152,7 @@ pub fn create_full<C, P, SC>(deps: FullDeps<C, P, SC>) -> RpcExtension where
|
||||
shared_voter_state,
|
||||
justification_stream,
|
||||
subscription_executor,
|
||||
finality_provider,
|
||||
))
|
||||
);
|
||||
io
|
||||
|
||||
Reference in New Issue
Block a user