Skip to content

Commit ecd7687

Browse files
svyatonikbkchr
authored andcommitted
Add missing RPC APIs to rialto parachain node (#1250)
* add missing RPC APIs to rialto parachain node * spellcheck
1 parent bbd3f12 commit ecd7687

File tree

1 file changed

+31
-2
lines changed

1 file changed

+31
-2
lines changed

bridges/bin/rialto-parachain/node/src/service.rs

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,13 @@
1414
// You should have received a copy of the GNU General Public License
1515
// along with Parity Bridges Common. If not, see <http://www.gnu.org/licenses/>.
1616

17+
//! Rialto parachain node service.
18+
//!
19+
//! The code is mostly copy of `polkadot-parachains/src/service.rs` file from Cumulus
20+
//! repository with some parts removed. We have added two RPC extensions to the original
21+
//! service: `pallet_transaction_payment_rpc::TransactionPaymentApi` and
22+
//! `substrate_frame_rpc_system::SystemApi`.
23+
1724
// std
1825
use std::sync::Arc;
1926

@@ -212,7 +219,14 @@ where
212219
sc_client_api::StateBackendFor<TFullBackend<Block>, Block>: sp_api::StateBackend<BlakeTwo256>,
213220
Executor: NativeExecutionDispatch + 'static,
214221
RB: Fn(
222+
sc_rpc_api::DenyUnsafe,
215223
Arc<TFullClient<Block, RuntimeApi, NativeElseWasmExecutor<Executor>>>,
224+
Arc<
225+
sc_transaction_pool::FullPool<
226+
Block,
227+
TFullClient<Block, RuntimeApi, NativeElseWasmExecutor<Executor>>,
228+
>,
229+
>,
216230
) -> jsonrpc_core::IoHandler<sc_rpc::Metadata>
217231
+ Send
218232
+ 'static,
@@ -288,7 +302,10 @@ where
288302
})?;
289303

290304
let rpc_client = client.clone();
291-
let rpc_extensions_builder = Box::new(move |_, _| Ok(rpc_ext_builder(rpc_client.clone())));
305+
let rpc_transaction_pool = transaction_pool.clone();
306+
let rpc_extensions_builder = Box::new(move |deny_unsafe, _| {
307+
Ok(rpc_ext_builder(deny_unsafe, rpc_client.clone(), rpc_transaction_pool.clone()))
308+
});
292309

293310
sc_service::spawn_tasks(sc_service::SpawnTasksParams {
294311
rpc_extensions_builder,
@@ -412,7 +429,19 @@ pub async fn start_node(
412429
parachain_config,
413430
polkadot_config,
414431
id,
415-
|_| Default::default(),
432+
|deny_unsafe, client, pool| {
433+
use pallet_transaction_payment_rpc::{TransactionPayment, TransactionPaymentApi};
434+
use substrate_frame_rpc_system::{FullSystem, SystemApi};
435+
436+
let mut io = jsonrpc_core::IoHandler::default();
437+
io.extend_with(SystemApi::to_delegate(FullSystem::new(
438+
client.clone(),
439+
pool,
440+
deny_unsafe,
441+
)));
442+
io.extend_with(TransactionPaymentApi::to_delegate(TransactionPayment::new(client)));
443+
io
444+
},
416445
parachain_build_import_queue,
417446
|client,
418447
prometheus_registry,

0 commit comments

Comments
 (0)