Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
update rpc client params
Browse files Browse the repository at this point in the history
  • Loading branch information
niklasad1 committed Dec 2, 2022
1 parent 6453704 commit cd70de0
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 17 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

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

2 changes: 1 addition & 1 deletion client/relay-chain-interface/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "mas
futures = "0.3.25"
async-trait = "0.1.59"
thiserror = "1.0.37"
jsonrpsee-core = "0.16.1"
jsonrpsee-core = "0.16.2"
parity-scale-codec = "3.2.1"
2 changes: 1 addition & 1 deletion client/relay-chain-rpc-interface/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ tokio = { version = "1.22.0", features = ["sync"] }
futures = "0.3.25"
futures-timer = "3.0.2"
parity-scale-codec = "3.2.1"
jsonrpsee = { version = "0.16.1", features = ["ws-client"] }
jsonrpsee = { version = "0.16.2", features = ["ws-client"] }
tracing = "0.1.37"
async-trait = "0.1.59"
url = "2.3.1"
Expand Down
26 changes: 15 additions & 11 deletions client/relay-chain-rpc-interface/src/rpc_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ use futures::{
use jsonrpsee::{
core::{
client::{Client as JsonRpcClient, ClientT, Subscription, SubscriptionClientT},
params::ArrayParams,
Error as JsonRpseeError,
},
rpc_params,
types::ParamsSer,
ws_client::WsClientBuilder,
};
use parity_scale_codec::{Decode, Encode};
Expand Down Expand Up @@ -264,7 +264,7 @@ impl RelayChainRpcClient {
async fn request<'a, R>(
&self,
method: &'a str,
params: Option<ParamsSer<'a>>,
params: ArrayParams,
) -> Result<R, RelayChainError>
where
R: DeserializeOwned + std::fmt::Debug,
Expand All @@ -281,7 +281,7 @@ impl RelayChainRpcClient {
async fn request_tracing<'a, R, OR>(
&self,
method: &'a str,
params: Option<ParamsSer<'a>>,
params: ArrayParams,
trace_error: OR,
) -> Result<R, RelayChainError>
where
Expand Down Expand Up @@ -359,12 +359,12 @@ impl RelayChainRpcClient {

/// Get local listen address of the node
pub async fn system_local_listen_addresses(&self) -> Result<Vec<String>, RelayChainError> {
self.request("system_localListenAddresses", None).await
self.request("system_localListenAddresses", rpc_params![]).await
}

/// Get system health information
pub async fn system_health(&self) -> Result<Health, RelayChainError> {
self.request("system_health", None).await
self.request("system_health", rpc_params![]).await
}

/// Get read proof for `storage_keys`
Expand Down Expand Up @@ -449,7 +449,7 @@ impl RelayChainRpcClient {

/// Get hash of last finalized block.
pub async fn chain_get_finalized_head(&self) -> Result<PHash, RelayChainError> {
self.request("chain_getFinalizedHead", None).await
self.request("chain_getFinalizedHead", rpc_params![]).await
}

/// Get hash of n-th block.
Expand Down Expand Up @@ -680,17 +680,21 @@ impl RelayChainRpcClient {
ws_client: &JsonRpcClient,
) -> Result<Subscription<PHeader>, RelayChainError> {
Ok(ws_client
.subscribe::<PHeader>("chain_subscribeAllHeads", None, "chain_unsubscribeAllHeads")
.subscribe::<PHeader, _>(
"chain_subscribeAllHeads",
rpc_params![],
"chain_unsubscribeAllHeads",
)
.await?)
}

async fn subscribe_finalized_heads(
ws_client: &JsonRpcClient,
) -> Result<Subscription<PHeader>, RelayChainError> {
Ok(ws_client
.subscribe::<PHeader>(
.subscribe::<PHeader, _>(
"chain_subscribeFinalizedHeads",
None,
rpc_params![],
"chain_unsubscribeFinalizedHeads",
)
.await?)
Expand All @@ -700,9 +704,9 @@ impl RelayChainRpcClient {
ws_client: &JsonRpcClient,
) -> Result<Subscription<PHeader>, RelayChainError> {
Ok(ws_client
.subscribe::<PHeader>(
.subscribe::<PHeader, _>(
"chain_subscribeNewHeads",
None,
rpc_params![],
"chain_unsubscribeFinalizedHeads",
)
.await?)
Expand Down
2 changes: 1 addition & 1 deletion parachain-template/node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ clap = { version = "4.0.29", features = ["derive"] }
log = "0.4.17"
codec = { package = "parity-scale-codec", version = "3.0.0" }
serde = { version = "1.0.148", features = ["derive"] }
jsonrpsee = { version = "0.15.1", features = ["server"] }
jsonrpsee = { version = "0.16.2", features = ["server"] }

# Local
parachain-template-runtime = { path = "../runtime" }
Expand Down
2 changes: 1 addition & 1 deletion polkadot-parachain/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ contracts-rococo-runtime = { path = "../parachains/runtimes/contracts/contracts-
bridge-hub-rococo-runtime = { path = "../parachains/runtimes/bridge-hubs/bridge-hub-rococo" }
bridge-hub-kusama-runtime = { path = "../parachains/runtimes/bridge-hubs/bridge-hub-kusama" }
penpal-runtime = { path = "../parachains/runtimes/testing/penpal" }
jsonrpsee = { version = "0.16.1", features = ["server"] }
jsonrpsee = { version = "0.16.2", features = ["server"] }
parachains-common = { path = "../parachains/common" }

# Substrate
Expand Down
2 changes: 1 addition & 1 deletion test/service/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ async-trait = "0.1.59"
clap = { version = "4.0.29", features = ["derive"] }
codec = { package = "parity-scale-codec", version = "3.0.0" }
criterion = { version = "0.4.0", features = [ "async_tokio" ] }
jsonrpsee = { version = "0.16.1", features = ["server"] }
jsonrpsee = { version = "0.16.2", features = ["server"] }
rand = "0.8.5"
serde = { version = "1.0.148", features = ["derive"] }
tokio = { version = "1.22.0", features = ["macros"] }
Expand Down

0 comments on commit cd70de0

Please sign in to comment.