,
pool: Arc,
light_deps: Option>,
) -> jsonrpc_core::IoHandler where
C: ProvideRuntimeApi,
C: sc_client::blockchain::HeaderBackend,
C: Send + Sync + 'static,
C::Api: substrate_frame_rpc_system::AccountNonceApi,
C::Api: pallet_contracts_rpc::ContractsRuntimeApi,
C::Api: pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi,
F: sc_client::light::fetcher::Fetcher + 'static,
P: TransactionPool + 'static,
M: jsonrpc_core::Metadata + Default,
{
use substrate_frame_rpc_system::{FullSystem, LightSystem, SystemApi};
use pallet_contracts_rpc::{Contracts, ContractsApi};
use pallet_transaction_payment_rpc::{TransactionPayment, TransactionPaymentApi};
let mut io = jsonrpc_core::IoHandler::default();
if let Some(LightDeps { remote_blockchain, fetcher }) = light_deps {
io.extend_with(
SystemApi::::to_delegate(LightSystem::new(client, remote_blockchain, fetcher, pool))
);
} else {
io.extend_with(
SystemApi::to_delegate(FullSystem::new(client.clone(), pool))
);
// Making synchronous calls in light client freezes the browser currently,
// more context: https://github.com/paritytech/substrate/pull/3480
// These RPCs should use an asynchronous caller instead.
io.extend_with(
ContractsApi::to_delegate(Contracts::new(client.clone()))
);
io.extend_with(
TransactionPaymentApi::to_delegate(TransactionPayment::new(client))
);
}
io
}