Upgrade jsonrpc to 0.18.0 (#9547)

* Upgrade jsonrpc to 0.18.0

I think this says all :P

* 🤦

* Fmt etc

* Fix tests

* Fix tests again...

* Better impl

* Revert "Tell dependabot to ignore jsonrpc-* updates (#9518)"

This reverts commit 6e0cd5587d.
This commit is contained in:
Bastian Köcher
2021-08-13 08:46:07 +02:00
committed by GitHub
parent 199b2883af
commit c44aba89e6
65 changed files with 1422 additions and 1291 deletions
+1 -1
View File
@@ -248,7 +248,7 @@ impl sc_transaction_pool_api::TransactionPool for Transactions {
_at: &BlockId<Self::Block>,
_source: TransactionSource,
_xt: TransactionFor<Self>,
) -> PoolFuture<Box<TransactionStatusStreamFor<Self>>, Self::Error> {
) -> PoolFuture<Pin<Box<TransactionStatusStreamFor<Self>>>, Self::Error> {
unimplemented!()
}
@@ -9,7 +9,7 @@ license = "Apache-2.0"
[dependencies]
futures-timer = "3.0.2"
libp2p = { version = "0.37.1", default-features = false }
jsonrpc-core = "15.0.0"
jsonrpc-core = "18.0.0"
serde = "1.0.126"
serde_json = "1.0.48"
wasm-bindgen = { version = "=0.2.73", features = ["serde-serialize"] }
+1 -1
View File
@@ -36,7 +36,7 @@ crate-type = ["cdylib", "rlib"]
# third-party dependencies
codec = { package = "parity-scale-codec", version = "2.0.0" }
serde = { version = "1.0.126", features = ["derive"] }
futures = { version = "0.3.9", features = ["compat"] }
futures = "0.3.16"
hex-literal = "0.3.1"
log = "0.4.8"
rand = "0.7.2"
+2 -3
View File
@@ -11,9 +11,8 @@ repository = "https://github.com/paritytech/substrate/"
targets = ["x86_64-unknown-linux-gnu"]
[dependencies]
futures = "0.1.29"
hyper = "~0.12.35"
jsonrpc-core-client = { version = "15.1.0", default-features = false, features = ["http"] }
futures = "0.3.16"
jsonrpc-core-client = { version = "18.0.0", default-features = false, features = ["http"] }
log = "0.4.8"
node-primitives = { version = "2.0.0", path = "../primitives" }
sp-tracing = { version = "4.0.0-dev", path = "../../../primitives/tracing" }
+7 -10
View File
@@ -22,24 +22,21 @@
//! This module shows how you can write a Rust RPC client that connects to a running
//! substrate node and use statically typed RPC wrappers.
use futures::Future;
use hyper::rt;
use futures::{Future, TryFutureExt};
use jsonrpc_core_client::{transports::http, RpcError};
use node_primitives::Hash;
use sc_rpc::author::{hash::ExtrinsicOrHash, AuthorClient};
fn main() {
fn main() -> Result<(), RpcError> {
sp_tracing::try_init_simple();
rt::run(rt::lazy(|| {
futures::executor::block_on(async {
let uri = "http://localhost:9933";
http::connect(uri)
.and_then(|client: AuthorClient<Hash, Hash>| remove_all_extrinsics(client))
.map_err(|e| {
println!("Error: {:?}", e);
})
}))
.await
})
}
/// Remove all pending extrinsics from the node.
@@ -52,7 +49,7 @@ fn main() {
/// to be removed and the extrinsics are going to be temporarily banned.
fn remove_all_extrinsics(
client: AuthorClient<Hash, Hash>,
) -> impl Future<Item = (), Error = RpcError> {
) -> impl Future<Output = Result<(), RpcError>> {
client
.pending_extrinsics()
.and_then(move |pending| {
@@ -60,7 +57,7 @@ fn remove_all_extrinsics(
pending.into_iter().map(|tx| ExtrinsicOrHash::Extrinsic(tx.into())).collect(),
)
})
.map(|removed| {
.map_ok(|removed| {
println!("Removed extrinsics: {:?}", removed);
})
}
+1 -1
View File
@@ -11,7 +11,7 @@ repository = "https://github.com/paritytech/substrate/"
targets = ["x86_64-unknown-linux-gnu"]
[dependencies]
jsonrpc-core = "15.1.0"
jsonrpc-core = "18.0.0"
node-primitives = { version = "2.0.0", path = "../primitives" }
pallet-contracts-rpc = { version = "4.0.0-dev", path = "../../../frame/contracts/rpc/" }
pallet-mmr-rpc = { version = "3.0.0", path = "../../../frame/merkle-mountain-range/rpc/" }