Add missing RPC APIs to rialto parachain node (#1250)

* add missing RPC APIs to rialto parachain node

* spellcheck
This commit is contained in:
Svyatoslav Nikolsky
2021-12-14 13:47:32 +03:00
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
// 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
use std::sync::Arc;
@@ -212,7 +219,14 @@ where
sc_client_api::StateBackendFor<TFullBackend<Block>, Block>: sp_api::StateBackend<BlakeTwo256>,
Executor: NativeExecutionDispatch + 'static,
RB: Fn(
sc_rpc_api::DenyUnsafe,
Arc<TFullClient<Block, RuntimeApi, NativeElseWasmExecutor<Executor>>>,
Arc<
sc_transaction_pool::FullPool<
Block,
TFullClient<Block, RuntimeApi, NativeElseWasmExecutor<Executor>>,
>,
>,
) -> jsonrpc_core::IoHandler<sc_rpc::Metadata>
+ Send
+ 'static,
@@ -288,7 +302,10 @@ where
})?;
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 {
rpc_extensions_builder,
@@ -412,7 +429,19 @@ pub async fn start_node(
parachain_config,
polkadot_config,
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,
|client,
prometheus_registry,