mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-09 20:11:09 +00:00
Update default runtime types to match substrate, format code (#34)
* Update default runtime types to match latest substrate * Format code
This commit is contained in:
+1
-1
@@ -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,
|
||||
|
||||
+1
-1
@@ -30,9 +30,9 @@ use runtime_primitives::{
|
||||
UncheckedExtrinsic,
|
||||
},
|
||||
traits::{
|
||||
Verify,
|
||||
IdentifyAccount,
|
||||
SignedExtension,
|
||||
Verify,
|
||||
},
|
||||
transaction_validity::TransactionValidityError,
|
||||
};
|
||||
|
||||
+24
-25
@@ -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<T: System>(url: &Url) -> impl Future<Item = Rpc<T>, Error = Error> {
|
||||
ws::connect(url).map_err(Into::into)
|
||||
@@ -156,13 +156,12 @@ impl<T: System, S> Clone for Client<T, S> {
|
||||
genesis_hash: self.genesis_hash.clone(),
|
||||
metadata: self.metadata.clone(),
|
||||
runtime_version: self.runtime_version.clone(),
|
||||
_marker:PhantomData,
|
||||
_marker: PhantomData,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: System + Balances + 'static, S: 'static> Client<T, S>
|
||||
{
|
||||
impl<T: System + Balances + 'static, S: 'static> Client<T, S> {
|
||||
fn connect(&self) -> impl Future<Item = Rpc<T>, Error = Error> {
|
||||
connect(&self.url)
|
||||
}
|
||||
@@ -339,7 +338,8 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: System + Balances + Send + Sync + 'static, P, S: 'static> XtBuilder<T, P, S, Valid>
|
||||
impl<T: System + Balances + Send + Sync + 'static, P, S: 'static>
|
||||
XtBuilder<T, P, S, Valid>
|
||||
where
|
||||
P: Pair,
|
||||
S: Verify + Codec + From<P::Signature>,
|
||||
@@ -357,8 +357,7 @@ where
|
||||
<DefaultExtra<T> as SignedExtra<T>>::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 = <Runtime as System>::Index;
|
||||
type AccountId = <Runtime as System>::AccountId;
|
||||
|
||||
@@ -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<F>(&self, f: F) -> XtBuilder<Self::Balances, Self::Pair, Self::Signature, Valid>
|
||||
fn balances<F>(
|
||||
&self,
|
||||
f: F,
|
||||
) -> XtBuilder<Self::Balances, Self::Pair, Self::Signature, Valid>
|
||||
where
|
||||
F: FnOnce(
|
||||
ModuleCalls<Self::Balances, Self::Pair>,
|
||||
|
||||
@@ -48,7 +48,10 @@ pub trait ContractsXt {
|
||||
type Signature: Verify;
|
||||
|
||||
/// Create a call for the paint contracts module
|
||||
fn contracts<F>(&self, f: F) -> XtBuilder<Self::Contracts, Self::Pair, Self::Signature, Valid>
|
||||
fn contracts<F>(
|
||||
&self,
|
||||
f: F,
|
||||
) -> XtBuilder<Self::Contracts, Self::Pair, Self::Signature, Valid>
|
||||
where
|
||||
F: FnOnce(
|
||||
ModuleCalls<Self::Contracts, Self::Pair>,
|
||||
|
||||
+5
-2
@@ -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<F>(&self, f: F) -> XtBuilder<Self::System, Self::Pair, Self::Signature, Valid>
|
||||
fn system<F>(
|
||||
&self,
|
||||
f: F,
|
||||
) -> XtBuilder<Self::System, Self::Pair, Self::Signature, Valid>
|
||||
where
|
||||
F: FnOnce(
|
||||
ModuleCalls<Self::System, Self::Pair>,
|
||||
|
||||
+4
-3
@@ -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 = <AnySignature as Verify>::Signer;
|
||||
type AccountId = <<MultiSignature as Verify>::Signer as IdentifyAccount>::AccountId;
|
||||
type Address = paint_indices::address::Address<Self::AccountId, u32>;
|
||||
type Header = Header<Self::BlockNumber, BlakeTwo256>;
|
||||
}
|
||||
|
||||
impl Balances for DefaultNodeRuntime {
|
||||
type Balance = u64;
|
||||
type Balance = u128;
|
||||
}
|
||||
|
||||
impl Contracts for DefaultNodeRuntime {}
|
||||
|
||||
Reference in New Issue
Block a user