|
14 | 14 | // You should have received a copy of the GNU General Public License |
15 | 15 | // along with Parity Bridges Common. If not, see <http://www.gnu.org/licenses/>. |
16 | 16 |
|
| 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 | +
|
17 | 24 | // std |
18 | 25 | use std::sync::Arc; |
19 | 26 |
|
@@ -212,7 +219,14 @@ where |
212 | 219 | sc_client_api::StateBackendFor<TFullBackend<Block>, Block>: sp_api::StateBackend<BlakeTwo256>, |
213 | 220 | Executor: NativeExecutionDispatch + 'static, |
214 | 221 | RB: Fn( |
| 222 | + sc_rpc_api::DenyUnsafe, |
215 | 223 | Arc<TFullClient<Block, RuntimeApi, NativeElseWasmExecutor<Executor>>>, |
| 224 | + Arc< |
| 225 | + sc_transaction_pool::FullPool< |
| 226 | + Block, |
| 227 | + TFullClient<Block, RuntimeApi, NativeElseWasmExecutor<Executor>>, |
| 228 | + >, |
| 229 | + >, |
216 | 230 | ) -> jsonrpc_core::IoHandler<sc_rpc::Metadata> |
217 | 231 | + Send |
218 | 232 | + 'static, |
@@ -288,7 +302,10 @@ where |
288 | 302 | })?; |
289 | 303 |
|
290 | 304 | 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 | + }); |
292 | 309 |
|
293 | 310 | sc_service::spawn_tasks(sc_service::SpawnTasksParams { |
294 | 311 | rpc_extensions_builder, |
@@ -412,7 +429,19 @@ pub async fn start_node( |
412 | 429 | parachain_config, |
413 | 430 | polkadot_config, |
414 | 431 | 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 | + }, |
416 | 445 | parachain_build_import_queue, |
417 | 446 | |client, |
418 | 447 | prometheus_registry, |
|
0 commit comments