mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 11:41:04 +00:00
Remove serde_json stuff from the metadata RPC (#833)
The metadata call does not work anymore with JSON and just returns an opaque blob.
This commit is contained in:
Generated
-1
@@ -3066,7 +3066,6 @@ dependencies = [
|
|||||||
"parity-codec 2.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
"parity-codec 2.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"rustc-hex 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rustc-hex 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"serde_json 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"sr-primitives 0.1.0",
|
"sr-primitives 0.1.0",
|
||||||
"sr-version 0.1.0",
|
"sr-version 0.1.0",
|
||||||
"substrate-client 0.1.0",
|
"substrate-client 0.1.0",
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ substrate-primitives = { path = "../primitives" }
|
|||||||
sr-primitives = { path = "../sr-primitives" }
|
sr-primitives = { path = "../sr-primitives" }
|
||||||
sr-version = { path = "../sr-version" }
|
sr-version = { path = "../sr-version" }
|
||||||
tokio = "0.1.7"
|
tokio = "0.1.7"
|
||||||
serde_json = "1.0"
|
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
assert_matches = "1.1"
|
assert_matches = "1.1"
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ extern crate substrate_primitives as primitives;
|
|||||||
extern crate sr_primitives as runtime_primitives;
|
extern crate sr_primitives as runtime_primitives;
|
||||||
extern crate sr_version as runtime_version;
|
extern crate sr_version as runtime_version;
|
||||||
extern crate tokio;
|
extern crate tokio;
|
||||||
extern crate serde_json;
|
|
||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate error_chain;
|
extern crate error_chain;
|
||||||
|
|||||||
@@ -19,17 +19,11 @@ use rpc;
|
|||||||
|
|
||||||
use errors;
|
use errors;
|
||||||
|
|
||||||
use serde_json;
|
|
||||||
|
|
||||||
error_chain! {
|
error_chain! {
|
||||||
links {
|
links {
|
||||||
Client(client::error::Error, client::error::ErrorKind) #[doc = "Client error"];
|
Client(client::error::Error, client::error::ErrorKind) #[doc = "Client error"];
|
||||||
}
|
}
|
||||||
|
|
||||||
foreign_links {
|
|
||||||
Json(serde_json::Error);
|
|
||||||
}
|
|
||||||
|
|
||||||
errors {
|
errors {
|
||||||
/// Provided block range couldn't be resolved to a list of blocks.
|
/// Provided block range couldn't be resolved to a list of blocks.
|
||||||
InvalidBlockRange(from: String, to: String, details: String) {
|
InvalidBlockRange(from: String, to: String, details: String) {
|
||||||
|
|||||||
@@ -33,7 +33,6 @@ use rpc::futures::{stream, Future, Sink, Stream};
|
|||||||
use runtime_primitives::generic::BlockId;
|
use runtime_primitives::generic::BlockId;
|
||||||
use runtime_primitives::traits::{Block as BlockT, Header};
|
use runtime_primitives::traits::{Block as BlockT, Header};
|
||||||
use tokio::runtime::TaskExecutor;
|
use tokio::runtime::TaskExecutor;
|
||||||
use serde_json;
|
|
||||||
|
|
||||||
use subscriptions::Subscriptions;
|
use subscriptions::Subscriptions;
|
||||||
|
|
||||||
@@ -66,7 +65,7 @@ build_rpc_trait! {
|
|||||||
|
|
||||||
/// Returns the runtime metadata as JSON.
|
/// Returns the runtime metadata as JSON.
|
||||||
#[rpc(name = "state_getMetadata")]
|
#[rpc(name = "state_getMetadata")]
|
||||||
fn metadata(&self, Trailing<Hash>) -> Result<serde_json::Value>;
|
fn metadata(&self, Trailing<Hash>) -> Result<Vec<u8>>;
|
||||||
|
|
||||||
/// Query historical storage entries (by key) starting from a block given as the second parameter.
|
/// Query historical storage entries (by key) starting from a block given as the second parameter.
|
||||||
///
|
///
|
||||||
@@ -143,10 +142,9 @@ impl<B, E, Block> StateApi<Block::Hash> for State<B, E, Block> where
|
|||||||
Ok(self.storage(key, block)?.map(|x| x.0.len() as u64))
|
Ok(self.storage(key, block)?.map(|x| x.0.len() as u64))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn metadata(&self, block: Trailing<Block::Hash>) -> Result<serde_json::Value> {
|
fn metadata(&self, block: Trailing<Block::Hash>) -> Result<Vec<u8>> {
|
||||||
let block = self.unwrap_or_best(block)?;
|
let block = self.unwrap_or_best(block)?;
|
||||||
let metadata = self.client.metadata(&BlockId::Hash(block))?;
|
self.client.metadata(&BlockId::Hash(block)).map_err(Into::into)
|
||||||
serde_json::to_value(metadata).map_err(Into::into)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn query_storage(&self, keys: Vec<StorageKey>, from: Block::Hash, to: Trailing<Block::Hash>) -> Result<Vec<StorageChangeSet<Block::Hash>>> {
|
fn query_storage(&self, keys: Vec<StorageKey>, from: Block::Hash, to: Trailing<Block::Hash>) -> Result<Vec<StorageChangeSet<Block::Hash>>> {
|
||||||
|
|||||||
Reference in New Issue
Block a user