mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-27 09:17:58 +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:
@@ -30,7 +30,6 @@ extern crate substrate_primitives as primitives;
|
||||
extern crate sr_primitives as runtime_primitives;
|
||||
extern crate sr_version as runtime_version;
|
||||
extern crate tokio;
|
||||
extern crate serde_json;
|
||||
|
||||
#[macro_use]
|
||||
extern crate error_chain;
|
||||
|
||||
@@ -19,17 +19,11 @@ use rpc;
|
||||
|
||||
use errors;
|
||||
|
||||
use serde_json;
|
||||
|
||||
error_chain! {
|
||||
links {
|
||||
Client(client::error::Error, client::error::ErrorKind) #[doc = "Client error"];
|
||||
}
|
||||
|
||||
foreign_links {
|
||||
Json(serde_json::Error);
|
||||
}
|
||||
|
||||
errors {
|
||||
/// Provided block range couldn't be resolved to a list of blocks.
|
||||
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::traits::{Block as BlockT, Header};
|
||||
use tokio::runtime::TaskExecutor;
|
||||
use serde_json;
|
||||
|
||||
use subscriptions::Subscriptions;
|
||||
|
||||
@@ -66,7 +65,7 @@ build_rpc_trait! {
|
||||
|
||||
/// Returns the runtime metadata as JSON.
|
||||
#[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.
|
||||
///
|
||||
@@ -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))
|
||||
}
|
||||
|
||||
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 metadata = self.client.metadata(&BlockId::Hash(block))?;
|
||||
serde_json::to_value(metadata).map_err(Into::into)
|
||||
self.client.metadata(&BlockId::Hash(block)).map_err(Into::into)
|
||||
}
|
||||
|
||||
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