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:
David Craven
2020-05-12 13:25:22 +02:00
committed by GitHub
parent 825f3ab64c
commit f861f3fac4
21 changed files with 697 additions and 564 deletions
+18 -11
View File
@@ -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