Skip to content

Commit

Permalink
Upgrade remote-externalities to use jsonrpsee v0.3 (paritytech#9342)
Browse files Browse the repository at this point in the history
  • Loading branch information
dvdplm authored Jul 13, 2021
1 parent cf086ee commit 993907f
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 18 deletions.
77 changes: 64 additions & 13 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions utils/frame/remote-externalities/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ readme = "README.md"
targets = ["x86_64-unknown-linux-gnu"]

[dependencies]
jsonrpsee-ws-client = { version = "0.2.0", default-features = false, features = ["tokio02"] }
jsonrpsee-proc-macros = "0.2.0"
jsonrpsee-ws-client = { version = "0.3.0", default-features = false, features = ["tokio02"] }
jsonrpsee-proc-macros = "0.3.0"

hex = "0.4.0"
env_logger = "0.8.2"
Expand Down
4 changes: 2 additions & 2 deletions utils/frame/remote-externalities/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ use sp_core::{
use codec::{Encode, Decode};
use sp_runtime::traits::Block as BlockT;
use jsonrpsee_ws_client::{
WsClientBuilder, WsClient, v2::params::JsonRpcParams,
WsClientBuilder, WsClient, types::v2::params::JsonRpcParams,
};

pub mod rpc_api;
Expand Down Expand Up @@ -275,7 +275,7 @@ impl<B: BlockT> Builder<B> {
prefix: StorageKey,
at: B::Hash,
) -> Result<Vec<KeyPair>, &'static str> {
use jsonrpsee_ws_client::traits::Client;
use jsonrpsee_ws_client::types::traits::Client;
use serde_json::to_value;
let keys = self.get_keys_paged(prefix, at).await?;
let keys_count = keys.len();
Expand Down
9 changes: 8 additions & 1 deletion utils/frame/remote-externalities/src/rpc_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,14 @@
// TODO: Consolidate one off RPC calls https://github.com/paritytech/substrate/issues/8988

use sp_runtime::{generic::SignedBlock, traits::{Block as BlockT, Header as HeaderT}};
use jsonrpsee_ws_client::{WsClientBuilder, WsClient, v2::params::JsonRpcParams, traits::Client};
use jsonrpsee_ws_client::{
WsClientBuilder,
WsClient,
types::{
v2::params::JsonRpcParams,
traits::Client
},
};

/// Get the header of the block identified by `at`
pub async fn get_header<Block, S>(from: S, at: Block::Hash) -> Result<Block::Header, String>
Expand Down

0 comments on commit 993907f

Please sign in to comment.