// Copyright 2019-2021 Parity Technologies (UK) Ltd. // This file is part of Parity Bridges Common. // Parity Bridges Common is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // Parity Bridges Common is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // You should have received a copy of the GNU General Public License // along with Parity Bridges Common. If not, see . //! The most generic Substrate node RPC interface. use jsonrpsee::{core::RpcResult, proc_macros::rpc}; use pallet_transaction_payment_rpc_runtime_api::FeeDetails; use sc_rpc_api::{state::ReadProof, system::Health}; use sp_core::{ storage::{StorageData, StorageKey}, Bytes, }; use sp_rpc::number::NumberOrHex; use sp_version::RuntimeVersion; #[rpc(client)] pub(crate) trait Substrate { #[method(name = "system_health", param_kind = array)] async fn system_health(&self) -> RpcResult; #[method(name = "system_properties", param_kind = array)] async fn system_properties(&self) -> RpcResult; #[method(name = "chain_getHeader", param_kind = array)] async fn chain_get_header(&self, block_hash: Option) -> RpcResult
; #[method(name = "chain_getFinalizedHead", param_kind = array)] async fn chain_get_finalized_head(&self) -> RpcResult; #[method(name = "chain_getBlock", param_kind = array)] async fn chain_get_block(&self, block_hash: Option) -> RpcResult; #[method(name = "chain_getBlockHash", param_kind = array)] async fn chain_get_block_hash(&self, block_number: Option) -> RpcResult; #[method(name = "system_accountNextIndex", param_kind = array)] async fn system_account_next_index(&self, account_id: AccountId) -> RpcResult; #[method(name = "author_submitExtrinsic", param_kind = array)] async fn author_submit_extrinsic(&self, extrinsic: Bytes) -> RpcResult; #[method(name = "author_pendingExtrinsics", param_kind = array)] async fn author_pending_extrinsics(&self) -> RpcResult>; #[method(name = "state_call", param_kind = array)] async fn state_call( &self, method: String, data: Bytes, at_block: Option, ) -> RpcResult; #[method(name = "state_getStorage", param_kind = array)] async fn state_get_storage( &self, key: StorageKey, at_block: Option, ) -> RpcResult>; #[method(name = "state_getReadProof", param_kind = array)] async fn state_prove_storage( &self, keys: Vec, hash: Option, ) -> RpcResult>; #[method(name = "state_getRuntimeVersion", param_kind = array)] async fn state_runtime_version(&self) -> RpcResult; #[method(name = "payment_queryFeeDetails", param_kind = array)] async fn payment_query_fee_details( &self, extrinsic: Bytes, at_block: Option, ) -> RpcResult>; }