mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 16:57:58 +00:00
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:
@@ -23,7 +23,6 @@
|
||||
use codec::{DecodeAll, FullCodec, FullEncode};
|
||||
use core::marker::PhantomData;
|
||||
use frame_support::storage::generator::{StorageDoubleMap, StorageMap, StorageValue};
|
||||
use futures::compat::Future01CompatExt;
|
||||
use jsonrpc_client_transports::RpcError;
|
||||
use sc_rpc_api::state::StateClient;
|
||||
use serde::{de::DeserializeOwned, Serialize};
|
||||
@@ -32,7 +31,6 @@ use sp_storage::{StorageData, StorageKey};
|
||||
/// A typed query on chain state usable from an RPC client.
|
||||
///
|
||||
/// ```no_run
|
||||
/// # use futures::compat::Future01CompatExt;
|
||||
/// # use jsonrpc_client_transports::RpcError;
|
||||
/// # use jsonrpc_client_transports::transports::http;
|
||||
/// # use codec::Encode;
|
||||
@@ -69,7 +67,7 @@ use sp_storage::{StorageData, StorageKey};
|
||||
/// }
|
||||
///
|
||||
/// # async fn test() -> Result<(), RpcError> {
|
||||
/// let conn = http::connect("http://[::1]:9933").compat().await?;
|
||||
/// let conn = http::connect("http://[::1]:9933").await?;
|
||||
/// let cl = StateClient::<Hash>::new(conn);
|
||||
///
|
||||
/// let q = StorageQuery::value::<LastActionId>();
|
||||
@@ -127,9 +125,9 @@ impl<V: FullCodec> StorageQuery<V> {
|
||||
state_client: &StateClient<Hash>,
|
||||
block_index: Option<Hash>,
|
||||
) -> Result<Option<V>, RpcError> {
|
||||
let opt: Option<StorageData> = state_client.storage(self.key, block_index).compat().await?;
|
||||
let opt: Option<StorageData> = state_client.storage(self.key, block_index).await?;
|
||||
opt.map(|encoded| V::decode_all(&encoded.0))
|
||||
.transpose()
|
||||
.map_err(|decode_err| RpcError::Other(decode_err.into()))
|
||||
.map_err(|decode_err| RpcError::Other(Box::new(decode_err)))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user