mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 05:11:02 +00:00
Add missing RPC APIs to rialto parachain node (#1250)
* add missing RPC APIs to rialto parachain node * spellcheck
This commit is contained in:
committed by
Bastian Köcher
parent
bbd3f1229a
commit
ecd7687701
@@ -14,6 +14,13 @@
|
|||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with Parity Bridges Common. If not, see <http://www.gnu.org/licenses/>.
|
// along with Parity Bridges Common. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
//! Rialto parachain node service.
|
||||||
|
//!
|
||||||
|
//! The code is mostly copy of `polkadot-parachains/src/service.rs` file from Cumulus
|
||||||
|
//! repository with some parts removed. We have added two RPC extensions to the original
|
||||||
|
//! service: `pallet_transaction_payment_rpc::TransactionPaymentApi` and
|
||||||
|
//! `substrate_frame_rpc_system::SystemApi`.
|
||||||
|
|
||||||
// std
|
// std
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
@@ -212,7 +219,14 @@ where
|
|||||||
sc_client_api::StateBackendFor<TFullBackend<Block>, Block>: sp_api::StateBackend<BlakeTwo256>,
|
sc_client_api::StateBackendFor<TFullBackend<Block>, Block>: sp_api::StateBackend<BlakeTwo256>,
|
||||||
Executor: NativeExecutionDispatch + 'static,
|
Executor: NativeExecutionDispatch + 'static,
|
||||||
RB: Fn(
|
RB: Fn(
|
||||||
|
sc_rpc_api::DenyUnsafe,
|
||||||
Arc<TFullClient<Block, RuntimeApi, NativeElseWasmExecutor<Executor>>>,
|
Arc<TFullClient<Block, RuntimeApi, NativeElseWasmExecutor<Executor>>>,
|
||||||
|
Arc<
|
||||||
|
sc_transaction_pool::FullPool<
|
||||||
|
Block,
|
||||||
|
TFullClient<Block, RuntimeApi, NativeElseWasmExecutor<Executor>>,
|
||||||
|
>,
|
||||||
|
>,
|
||||||
) -> jsonrpc_core::IoHandler<sc_rpc::Metadata>
|
) -> jsonrpc_core::IoHandler<sc_rpc::Metadata>
|
||||||
+ Send
|
+ Send
|
||||||
+ 'static,
|
+ 'static,
|
||||||
@@ -288,7 +302,10 @@ where
|
|||||||
})?;
|
})?;
|
||||||
|
|
||||||
let rpc_client = client.clone();
|
let rpc_client = client.clone();
|
||||||
let rpc_extensions_builder = Box::new(move |_, _| Ok(rpc_ext_builder(rpc_client.clone())));
|
let rpc_transaction_pool = transaction_pool.clone();
|
||||||
|
let rpc_extensions_builder = Box::new(move |deny_unsafe, _| {
|
||||||
|
Ok(rpc_ext_builder(deny_unsafe, rpc_client.clone(), rpc_transaction_pool.clone()))
|
||||||
|
});
|
||||||
|
|
||||||
sc_service::spawn_tasks(sc_service::SpawnTasksParams {
|
sc_service::spawn_tasks(sc_service::SpawnTasksParams {
|
||||||
rpc_extensions_builder,
|
rpc_extensions_builder,
|
||||||
@@ -412,7 +429,19 @@ pub async fn start_node(
|
|||||||
parachain_config,
|
parachain_config,
|
||||||
polkadot_config,
|
polkadot_config,
|
||||||
id,
|
id,
|
||||||
|_| Default::default(),
|
|deny_unsafe, client, pool| {
|
||||||
|
use pallet_transaction_payment_rpc::{TransactionPayment, TransactionPaymentApi};
|
||||||
|
use substrate_frame_rpc_system::{FullSystem, SystemApi};
|
||||||
|
|
||||||
|
let mut io = jsonrpc_core::IoHandler::default();
|
||||||
|
io.extend_with(SystemApi::to_delegate(FullSystem::new(
|
||||||
|
client.clone(),
|
||||||
|
pool,
|
||||||
|
deny_unsafe,
|
||||||
|
)));
|
||||||
|
io.extend_with(TransactionPaymentApi::to_delegate(TransactionPayment::new(client)));
|
||||||
|
io
|
||||||
|
},
|
||||||
parachain_build_import_queue,
|
parachain_build_import_queue,
|
||||||
|client,
|
|client,
|
||||||
prometheus_registry,
|
prometheus_registry,
|
||||||
|
|||||||
Reference in New Issue
Block a user