// Copyright 2019-2020 Parity Technologies (UK) Ltd.
// This file is part of substrate-subxt.
//
// subxt is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// subxt is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with substrate-subxt. If not, see .
//! Implements support for the frame_system module.
use codec::{
Codec,
Decode,
Encode,
};
use core::marker::PhantomData;
use frame_support::{
weights::DispatchInfo,
Parameter,
};
use serde::de::DeserializeOwned;
use sp_runtime::{
traits::{
AtLeast32Bit,
AtLeast32BitUnsigned,
Bounded,
CheckEqual,
Extrinsic,
Hash,
Header,
MaybeDisplay,
MaybeMallocSizeOf,
MaybeSerialize,
MaybeSerializeDeserialize,
Member,
SimpleBitOps,
},
DispatchError,
};
use std::fmt::Debug;
/// The subset of the `frame::Trait` that a client must implement.
#[module]
pub trait System {
/// Account index (aka nonce) type. This stores the number of previous
/// transactions associated with a sender account.
type Index: Parameter
+ Member
+ MaybeSerialize
+ Debug
+ Default
+ MaybeDisplay
+ AtLeast32Bit
+ Copy;
/// The block number type used by the runtime.
type BlockNumber: Parameter
+ Member
+ MaybeMallocSizeOf
+ MaybeSerializeDeserialize
+ Debug
+ MaybeDisplay
+ AtLeast32BitUnsigned
+ Default
+ Bounded
+ Copy
+ std::hash::Hash
+ std::str::FromStr;
/// The output of the `Hashing` function.
type Hash: Parameter
+ Member
+ MaybeMallocSizeOf
+ MaybeSerializeDeserialize
+ Debug
+ MaybeDisplay
+ Ord
+ SimpleBitOps
+ Default
+ Copy
+ CheckEqual
+ std::hash::Hash
+ AsRef<[u8]>
+ AsMut<[u8]>;
/// The hashing system (algorithm) being used in the runtime (e.g. Blake2).
#[module(ignore)]
type Hashing: Hash