diff --git a/src/events.rs b/src/events.rs index 838f8a5439..ec34844a5f 100644 --- a/src/events.rs +++ b/src/events.rs @@ -25,6 +25,7 @@ use crate::{ SystemEvent, }; use log; +use paint_system::Phase; use parity_scale_codec::{ Codec, Compact, @@ -34,7 +35,6 @@ use parity_scale_codec::{ Input, Output, }; -use paint_system::Phase; use std::{ collections::{ HashMap, diff --git a/src/extrinsic.rs b/src/extrinsic.rs index 64a3c065b3..59e28f9d75 100644 --- a/src/extrinsic.rs +++ b/src/extrinsic.rs @@ -30,9 +30,9 @@ use runtime_primitives::{ UncheckedExtrinsic, }, traits::{ - Verify, IdentifyAccount, SignedExtension, + Verify, }, transaction_validity::TransactionValidityError, }; diff --git a/src/lib.rs b/src/lib.rs index 65f66ed0b0..5edac52f42 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -35,8 +35,8 @@ use parity_scale_codec::{ use runtime_primitives::{ generic::UncheckedExtrinsic, traits::{ - Verify, IdentifyAccount, + Verify, }, MultiSignature, }; @@ -62,12 +62,6 @@ use crate::{ SignedExtra, }, metadata::MetadataError, - rpc::{ - BlockNumber, - ChainBlock, - MapStream, - Rpc, - }, paint::{ balances::Balances, system::{ @@ -77,6 +71,12 @@ use crate::{ }, ModuleCalls, }, + rpc::{ + BlockNumber, + ChainBlock, + MapStream, + Rpc, + }, }; mod codec; @@ -84,15 +84,15 @@ mod error; mod events; mod extrinsic; mod metadata; +mod paint; mod rpc; mod runtimes; -mod paint; pub use error::Error; pub use events::RawEvent; +pub use paint::*; pub use rpc::ExtrinsicSuccess; pub use runtimes::*; -pub use paint::*; fn connect(url: &Url) -> impl Future, Error = Error> { ws::connect(url).map_err(Into::into) @@ -156,13 +156,12 @@ impl Clone for Client { genesis_hash: self.genesis_hash.clone(), metadata: self.metadata.clone(), runtime_version: self.runtime_version.clone(), - _marker:PhantomData, + _marker: PhantomData, } } } -impl Client -{ +impl Client { fn connect(&self) -> impl Future, Error = Error> { connect(&self.url) } @@ -339,7 +338,8 @@ where } } -impl XtBuilder +impl + XtBuilder where P: Pair, S: Verify + Codec + From, @@ -357,8 +357,7 @@ where as SignedExtra>::Extra, >, Error, - > - { + > { let signer = self.signer.clone(); let account_nonce = self.nonce.clone(); let version = self.runtime_version.spec_version; @@ -415,22 +414,22 @@ where #[cfg(test)] mod tests { use super::*; - use crate::paint::{ - balances::{ - Balances, - BalancesStore, - BalancesXt, + use crate::{ + paint::{ + balances::{ + Balances, + BalancesStore, + BalancesXt, + }, + contracts::ContractsXt, }, - contracts::ContractsXt, + DefaultNodeRuntime as Runtime, }; use futures::stream::Stream; - use node_runtime::Runtime; use parity_scale_codec::Encode; use runtime_support::StorageMap; use substrate_keyring::AccountKeyring; - use substrate_primitives::{ - storage::StorageKey, - }; + use substrate_primitives::storage::StorageKey; type Index = ::Index; type AccountId = ::AccountId; diff --git a/src/paint/balances.rs b/src/paint/balances.rs index 0bbc91dda8..09ec0adf62 100644 --- a/src/paint/balances.rs +++ b/src/paint/balances.rs @@ -20,15 +20,15 @@ use futures::future::{ }; use parity_scale_codec::Codec; use runtime_primitives::traits::{ + IdentifyAccount, MaybeSerialize, Member, SimpleArithmetic, Verify, - IdentifyAccount, }; use runtime_support::Parameter; -use substrate_primitives::Pair; use std::fmt::Debug; +use substrate_primitives::Pair; /// The subset of the `paint_balances::Trait` that a client must implement. pub trait Balances: System { @@ -111,7 +111,10 @@ pub trait BalancesXt { type Signature: Verify; /// Create a call for the paint balances module - fn balances(&self, f: F) -> XtBuilder + fn balances( + &self, + f: F, + ) -> XtBuilder where F: FnOnce( ModuleCalls, diff --git a/src/paint/contracts.rs b/src/paint/contracts.rs index 471fa3f3ec..4681539bd9 100644 --- a/src/paint/contracts.rs +++ b/src/paint/contracts.rs @@ -48,7 +48,10 @@ pub trait ContractsXt { type Signature: Verify; /// Create a call for the paint contracts module - fn contracts(&self, f: F) -> XtBuilder + fn contracts( + &self, + f: F, + ) -> XtBuilder where F: FnOnce( ModuleCalls, diff --git a/src/paint/system.rs b/src/paint/system.rs index d220bbc945..1f31da7320 100644 --- a/src/paint/system.rs +++ b/src/paint/system.rs @@ -33,8 +33,8 @@ use runtime_primitives::traits::{ }; use runtime_support::Parameter; use serde::de::DeserializeOwned; -use substrate_primitives::Pair; use std::fmt::Debug; +use substrate_primitives::Pair; /// The subset of the `paint::Trait` that a client must implement. pub trait System: 'static + Eq + Clone + Debug { @@ -155,7 +155,10 @@ pub trait SystemXt { type Signature: Verify; /// Create a call for the paint system module - fn system(&self, f: F) -> XtBuilder + fn system( + &self, + f: F, + ) -> XtBuilder where F: FnOnce( ModuleCalls, diff --git a/src/runtimes.rs b/src/runtimes.rs index a29238648a..448434269a 100644 --- a/src/runtimes.rs +++ b/src/runtimes.rs @@ -23,9 +23,10 @@ use runtime_primitives::{ generic::Header, traits::{ BlakeTwo256, + IdentifyAccount, Verify, }, - AnySignature, + MultiSignature, }; /// Concrete type definitions compatible with those in the default substrate `node_runtime` @@ -42,13 +43,13 @@ impl System for DefaultNodeRuntime { type BlockNumber = u32; type Hash = substrate_primitives::H256; type Hashing = BlakeTwo256; - type AccountId = ::Signer; + type AccountId = <::Signer as IdentifyAccount>::AccountId; type Address = paint_indices::address::Address; type Header = Header; } impl Balances for DefaultNodeRuntime { - type Balance = u64; + type Balance = u128; } impl Contracts for DefaultNodeRuntime {}