mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-30 17:47:56 +00:00
Latest substrate updates (#70)
* Fix compilation errors with latest substrate * System::Account replaces FreeBalance and Nonce * System::Account replaces FreeBalance and Nonce * Remove Balances FreeBalance, replaced with System Account * Update system event, fix instantiate * reorder deps
This commit is contained in:
+25
-12
@@ -30,10 +30,11 @@ use sp_runtime::traits::{
|
||||
Hash,
|
||||
Header,
|
||||
MaybeDisplay,
|
||||
MaybeMallocSizeOf,
|
||||
MaybeSerialize,
|
||||
MaybeSerializeDeserialize,
|
||||
Member,
|
||||
SimpleArithmetic,
|
||||
AtLeast32Bit,
|
||||
SimpleBitOps,
|
||||
};
|
||||
use std::{
|
||||
@@ -60,16 +61,17 @@ pub trait System: 'static + Eq + Clone + Debug {
|
||||
+ Debug
|
||||
+ Default
|
||||
+ MaybeDisplay
|
||||
+ SimpleArithmetic
|
||||
+ AtLeast32Bit
|
||||
+ Copy;
|
||||
|
||||
/// The block number type used by the runtime.
|
||||
type BlockNumber: Parameter
|
||||
+ Member
|
||||
+ MaybeMallocSizeOf
|
||||
+ MaybeSerializeDeserialize
|
||||
+ Debug
|
||||
+ MaybeDisplay
|
||||
+ SimpleArithmetic
|
||||
+ AtLeast32Bit
|
||||
+ Default
|
||||
+ Bounded
|
||||
+ Copy
|
||||
@@ -79,6 +81,7 @@ pub trait System: 'static + Eq + Clone + Debug {
|
||||
/// The output of the `Hashing` function.
|
||||
type Hash: Parameter
|
||||
+ Member
|
||||
+ MaybeMallocSizeOf
|
||||
+ MaybeSerializeDeserialize
|
||||
+ Debug
|
||||
+ MaybeDisplay
|
||||
@@ -113,6 +116,10 @@ pub trait System: 'static + Eq + Clone + Debug {
|
||||
|
||||
/// Extrinsic type within blocks.
|
||||
type Extrinsic: Parameter + Member + Extrinsic + Debug + MaybeSerializeDeserialize;
|
||||
|
||||
/// Data to be associated with an account (other than nonce/transaction counter, which this
|
||||
/// module does regardless).
|
||||
type AccountData: Member + Codec + Clone + Default;
|
||||
}
|
||||
|
||||
/// The System extension trait for the Client.
|
||||
@@ -120,12 +127,12 @@ pub trait SystemStore {
|
||||
/// System type.
|
||||
type System: System;
|
||||
|
||||
/// Returns the account nonce for an account_id.
|
||||
fn account_nonce(
|
||||
/// Returns the nonce and account data for an account_id.
|
||||
fn account(
|
||||
&self,
|
||||
account_id: <Self::System as System>::AccountId,
|
||||
) -> Pin<
|
||||
Box<dyn Future<Output = Result<<Self::System as System>::Index, Error>> + Send>,
|
||||
Box<dyn Future<Output = Result<(<Self::System as System>::Index, <Self::System as System>::AccountData), Error>> + Send>,
|
||||
>;
|
||||
}
|
||||
|
||||
@@ -134,20 +141,20 @@ impl<T: System + Balances + Sync + Send + 'static, S: 'static> SystemStore
|
||||
{
|
||||
type System = T;
|
||||
|
||||
fn account_nonce(
|
||||
fn account(
|
||||
&self,
|
||||
account_id: <Self::System as System>::AccountId,
|
||||
) -> Pin<
|
||||
Box<dyn Future<Output = Result<<Self::System as System>::Index, Error>> + Send>,
|
||||
Box<dyn Future<Output = Result<(<Self::System as System>::Index, <Self::System as System>::AccountData), Error>> + Send>,
|
||||
> {
|
||||
let account_nonce_map = || {
|
||||
let account_map = || {
|
||||
Ok(self
|
||||
.metadata
|
||||
.module("System")?
|
||||
.storage("AccountNonce")?
|
||||
.storage("Account")?
|
||||
.get_map()?)
|
||||
};
|
||||
let map = match account_nonce_map() {
|
||||
let map = match account_map() {
|
||||
Ok(map) => map,
|
||||
Err(err) => return Box::pin(future::err(err)),
|
||||
};
|
||||
@@ -175,11 +182,17 @@ use frame_support::weights::DispatchInfo;
|
||||
|
||||
/// Event for the System module.
|
||||
#[derive(Clone, Debug, codec::Decode)]
|
||||
pub enum SystemEvent {
|
||||
pub enum SystemEvent<T: System> {
|
||||
/// An extrinsic completed successfully.
|
||||
ExtrinsicSuccess(DispatchInfo),
|
||||
/// An extrinsic failed.
|
||||
ExtrinsicFailed(sp_runtime::DispatchError, DispatchInfo),
|
||||
/// `:code` was updated.
|
||||
CodeUpdated,
|
||||
/// A new account was created.
|
||||
NewAccount(T::AccountId),
|
||||
/// An account was reaped.
|
||||
ReapedAccount(T::AccountId),
|
||||
}
|
||||
|
||||
/// A phase of a block's execution.
|
||||
|
||||
Reference in New Issue
Block a user