companion #8738 (jsonrpsee) (#823)

* update polkadot and substrate

* add jsonrpsee glue code

* fix tests

* update substrate & polkadot

* update substrate & polkadot

* update Cargo.lock

* revert Cargo.toml

* revert changes in Cargo.toml

* update companion

* revert substrate change

* add Cargo.lock

* update substrate manually

* update polkadot
This commit is contained in:
Niklas Adolfsson
2022-05-10 12:53:21 +02:00
committed by GitHub
parent 30c2a2fc42
commit 3d982fef1c
17 changed files with 586 additions and 909 deletions
+10 -9
View File
@@ -17,7 +17,7 @@ use sp_block_builder::BlockBuilder;
use sp_blockchain::{Error as BlockChainError, HeaderBackend, HeaderMetadata};
/// A type representing all RPC extensions.
pub type RpcExtension = jsonrpc_core::IoHandler<sc_rpc::Metadata>;
pub type RpcExtension = jsonrpsee::RpcModule<()>;
/// Full client dependencies
pub struct FullDeps<C, P> {
@@ -30,7 +30,9 @@ pub struct FullDeps<C, P> {
}
/// Instantiate all RPC extensions.
pub fn create_full<C, P>(deps: FullDeps<C, P>) -> RpcExtension
pub fn create_full<C, P>(
deps: FullDeps<C, P>,
) -> Result<RpcExtension, Box<dyn std::error::Error + Send + Sync>>
where
C: ProvideRuntimeApi<Block>
+ HeaderBackend<Block>
@@ -44,14 +46,13 @@ where
C::Api: BlockBuilder<Block>,
P: TransactionPool + Sync + Send + 'static,
{
use pallet_transaction_payment_rpc::{TransactionPayment, TransactionPaymentApi};
use substrate_frame_rpc_system::{FullSystem, SystemApi};
use pallet_transaction_payment_rpc::{TransactionPaymentApiServer, TransactionPaymentRpc};
use substrate_frame_rpc_system::{SystemApiServer, SystemRpc};
let mut io = jsonrpc_core::IoHandler::default();
let mut module = RpcExtension::new(());
let FullDeps { client, pool, deny_unsafe } = deps;
io.extend_with(SystemApi::to_delegate(FullSystem::new(client.clone(), pool, deny_unsafe)));
io.extend_with(TransactionPaymentApi::to_delegate(TransactionPayment::new(client)));
io
module.merge(SystemRpc::new(client.clone(), pool.clone(), deny_unsafe).into_rpc())?;
module.merge(TransactionPaymentRpc::new(client.clone()).into_rpc())?;
Ok(module)
}