// Copyright 2019 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 frame_support::Parameter;
use futures::future::{
self,
Future,
};
use serde::de::DeserializeOwned;
use sp_runtime::{
traits::{
AtLeast32Bit,
Bounded,
CheckEqual,
Extrinsic,
Hash,
Header,
MaybeDisplay,
MaybeMallocSizeOf,
MaybeSerialize,
MaybeSerializeDeserialize,
Member,
SignedExtension,
SimpleBitOps,
},
RuntimeDebug,
};
use std::{
fmt::Debug,
pin::Pin,
};
use crate::{
error::Error,
extrinsic::SignedExtra,
frame::{
balances::Balances,
Call,
},
Client,
};
/// The subset of the `frame::Trait` that a client must implement.
pub trait System: 'static + Eq + Clone + Debug {
/// 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
+ AtLeast32Bit
+ 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).
type Hashing: Hash