Bump jsonrpsee (#1530)

* switch to jsonrpsee 0.15

* use client_bounds marker
This commit is contained in:
Svyatoslav Nikolsky
2022-08-01 14:30:09 +03:00
committed by Bastian Köcher
parent 86b5a0ee6a
commit dd9debed3c
3 changed files with 65 additions and 210 deletions
+18 -13
View File
@@ -16,6 +16,8 @@
//! The most generic Substrate node RPC interface.
use crate::Chain;
use jsonrpsee::{core::RpcResult, proc_macros::rpc};
use pallet_transaction_payment_rpc_runtime_api::FeeDetails;
use sc_rpc_api::{state::ReadProof, system::Health};
@@ -26,24 +28,27 @@ use sp_core::{
use sp_rpc::number::NumberOrHex;
use sp_version::RuntimeVersion;
#[rpc(client)]
pub(crate) trait Substrate<AccountId, BlockNumber, Hash, Header, Index, SignedBlock> {
#[rpc(client, client_bounds(C: Chain))]
pub(crate) trait Substrate<C> {
#[method(name = "system_health", param_kind = array)]
async fn system_health(&self) -> RpcResult<Health>;
#[method(name = "system_properties", param_kind = array)]
async fn system_properties(&self) -> RpcResult<sc_chain_spec::Properties>;
#[method(name = "chain_getHeader", param_kind = array)]
async fn chain_get_header(&self, block_hash: Option<Hash>) -> RpcResult<Header>;
async fn chain_get_header(&self, block_hash: Option<C::Hash>) -> RpcResult<C::Header>;
#[method(name = "chain_getFinalizedHead", param_kind = array)]
async fn chain_get_finalized_head(&self) -> RpcResult<Hash>;
async fn chain_get_finalized_head(&self) -> RpcResult<C::Hash>;
#[method(name = "chain_getBlock", param_kind = array)]
async fn chain_get_block(&self, block_hash: Option<Hash>) -> RpcResult<SignedBlock>;
async fn chain_get_block(&self, block_hash: Option<C::Hash>) -> RpcResult<C::SignedBlock>;
#[method(name = "chain_getBlockHash", param_kind = array)]
async fn chain_get_block_hash(&self, block_number: Option<BlockNumber>) -> RpcResult<Hash>;
async fn chain_get_block_hash(
&self,
block_number: Option<C::BlockNumber>,
) -> RpcResult<C::Hash>;
#[method(name = "system_accountNextIndex", param_kind = array)]
async fn system_account_next_index(&self, account_id: AccountId) -> RpcResult<Index>;
async fn system_account_next_index(&self, account_id: C::AccountId) -> RpcResult<C::Index>;
#[method(name = "author_submitExtrinsic", param_kind = array)]
async fn author_submit_extrinsic(&self, extrinsic: Bytes) -> RpcResult<Hash>;
async fn author_submit_extrinsic(&self, extrinsic: Bytes) -> RpcResult<C::Hash>;
#[method(name = "author_pendingExtrinsics", param_kind = array)]
async fn author_pending_extrinsics(&self) -> RpcResult<Vec<Bytes>>;
#[method(name = "state_call", param_kind = array)]
@@ -51,26 +56,26 @@ pub(crate) trait Substrate<AccountId, BlockNumber, Hash, Header, Index, SignedBl
&self,
method: String,
data: Bytes,
at_block: Option<Hash>,
at_block: Option<C::Hash>,
) -> RpcResult<Bytes>;
#[method(name = "state_getStorage", param_kind = array)]
async fn state_get_storage(
&self,
key: StorageKey,
at_block: Option<Hash>,
at_block: Option<C::Hash>,
) -> RpcResult<Option<StorageData>>;
#[method(name = "state_getReadProof", param_kind = array)]
async fn state_prove_storage(
&self,
keys: Vec<StorageKey>,
hash: Option<Hash>,
) -> RpcResult<ReadProof<Hash>>;
hash: Option<C::Hash>,
) -> RpcResult<ReadProof<C::Hash>>;
#[method(name = "state_getRuntimeVersion", param_kind = array)]
async fn state_runtime_version(&self) -> RpcResult<RuntimeVersion>;
#[method(name = "payment_queryFeeDetails", param_kind = array)]
async fn payment_query_fee_details(
&self,
extrinsic: Bytes,
at_block: Option<Hash>,
at_block: Option<C::Hash>,
) -> RpcResult<FeeDetails<NumberOrHex>>;
}