mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 17:01:09 +00:00
Split subxt (#102)
* Proc macro improvements. * Use proc-macros. * Update examples. * Fix build. * Run rustfmt. * Fix total issuance test. * Remove gas limit from put code call. * Handle runtime errors. * Fix tests. * Make test more reliable. * Revert "Handle runtime errors." This reverts commit 26f30a9f4cfcfddfb3e49308cded46cfe6468697. * Use expect instead of unwrap. * Parse marker type. * Fetch doesn't fail.
This commit is contained in:
+18
-11
@@ -19,13 +19,16 @@
|
||||
// Related: https://github.com/paritytech/substrate-subxt/issues/66
|
||||
#![allow(irrefutable_let_patterns)]
|
||||
|
||||
use std::convert::TryInto;
|
||||
|
||||
use codec::{
|
||||
Decode,
|
||||
Encode,
|
||||
Error as CodecError,
|
||||
};
|
||||
use core::{
|
||||
convert::TryInto,
|
||||
marker::PhantomData,
|
||||
};
|
||||
use frame_metadata::RuntimeMetadataPrefixed;
|
||||
use jsonrpsee::{
|
||||
client::Subscription,
|
||||
common::{
|
||||
@@ -34,10 +37,7 @@ use jsonrpsee::{
|
||||
},
|
||||
Client,
|
||||
};
|
||||
|
||||
use num_traits::bounds::Bounded;
|
||||
|
||||
use frame_metadata::RuntimeMetadataPrefixed;
|
||||
use sc_rpc_api::state::ReadProof;
|
||||
use serde::Serialize;
|
||||
use sp_core::{
|
||||
@@ -62,7 +62,6 @@ use sp_runtime::{
|
||||
};
|
||||
use sp_transaction_pool::TransactionStatus;
|
||||
use sp_version::RuntimeVersion;
|
||||
use std::marker::PhantomData;
|
||||
|
||||
use crate::{
|
||||
error::Error,
|
||||
@@ -110,18 +109,26 @@ where
|
||||
}
|
||||
|
||||
/// Client for substrate rpc interfaces
|
||||
#[derive(Clone)]
|
||||
pub struct Rpc<T: System> {
|
||||
client: Client,
|
||||
marker: std::marker::PhantomData<T>,
|
||||
marker: PhantomData<T>,
|
||||
}
|
||||
|
||||
impl<T: System> Clone for Rpc<T> {
|
||||
fn clone(&self) -> Self {
|
||||
Self {
|
||||
client: self.client.clone(),
|
||||
marker: PhantomData,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: System> Rpc<T> {
|
||||
pub async fn new(client: Client) -> Result<Self, Error> {
|
||||
Ok(Rpc {
|
||||
pub fn new(client: Client) -> Self {
|
||||
Self {
|
||||
client,
|
||||
marker: PhantomData,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
/// Fetch a storage key
|
||||
|
||||
Reference in New Issue
Block a user