Module frame_support::pallet_prelude
source · Expand description
Prelude to be used alongside pallet macro, for ease of use.
Re-exports
pub use crate::dispatch::DispatchClass;
pub use crate::dispatch::DispatchResult;
pub use crate::dispatch::DispatchResultWithPostInfo;
pub use crate::dispatch::Parameter;
pub use crate::dispatch::Pays;
pub use crate::inherent::ProvideInherent;
pub use crate::storage;
pub use crate::storage::types::OptionQuery;
pub use crate::storage::types::ResultQuery;
pub use crate::storage::types::ValueQuery;
pub use frame_support::pallet_macros::*;
Macros
- Evaluate
$x:expr
and if not true returnErr($y:expr)
.
Structs
- Hash storage keys with blake2 128
- Hash storage keys with
concat(blake2_128(key), key)
- Hash storage keys with blake2 256
- A bounded vector.
- Const getter for a basic type.
- A wrapper around a
StorageMap
and aStorageValue<Value=u32>
to keep track of how many items are in a map, without needing to iterate all the values. - Implement Get by returning Default for any type that implements Default.
- Store the key directly.
- Inherent data to include in a block.
- A type used exclusively by storage maps as their key type.
- Zero-sized type used to mark things that “act like” they own a
T
. - A type that allow to store values for
(key1, key2)
couple. Similar toStorageMap
but allow to iterate and remove value associated to first key. - A type that allow to store value for given key. Allowing to insert/remove/iterate on values.
- A type that allow to store values for an arbitrary number of keys in the form of
(Key<Hasher1, key1>, Key<Hasher2, key2>, ..., Key<HasherN, keyN>)
. - A type that allow to store a value.
- The storage version of a pallet.
- Hash storage keys with
concat(twox64(key), key)
- Hash storage keys with twox 128
- Hash storage keys with twox 256
- Information concerning a valid transaction.
Enums
- Reason why a dispatch call failed.
- An invalid transaction validity.
- The source of the transaction.
- Errors that can occur while checking the validity of a transaction.
- An unknown transaction validity.
Constants
- The number of bytes of the module-specific
error
field defined inModuleError
. In FRAME, this is the maximum encoded size of a pallet error type.
Traits
- Trait that allows zero-copy read of value-references from slices in LE format.
- Trait that allows zero-copy write of value-references to slices in LE format.
- Some sort of check on the origin is performed by this object.
- A trait to define the build function of a genesis config, T and I are placeholder for pallet trait and pallet instance.
- A trait for querying a single value from a type.
- Provides information about the storage version of a pallet.
- The pallet hooks trait. Implementing this lets you express some logic to execute.
- Trait to be used when types are exactly same.
- Items implementing
MaxEncodedLen
have a statically known maximum encoded size. - A type that implements Serialize, DeserializeOwned and Debug when in std environment or serde feature is activated.
- A type that can be used in runtime structures.
- Provides information about the pallet itself and its setup in the runtime.
- A trait to give information about storage.
- Implementors return their meta type information.
- A trait for querying a single value from a type defined in the trait.
- Provide validation for unsigned extrinsics.
Type Definitions
- An identifier for an inherent.
- Minimum number of blocks a transaction will remain valid for.
TransactionLongevity::max_value()
means “forever”. - Priority for a transaction. Additive. Higher is better.
- Tag for a transaction. No two transactions with the same tag should be placed on-chain.
- Information on a transaction’s validity and, if valid, on how it relates to other transactions.
Attribute Macros
- Attach this attribute to an impl statement that you want to use with
#[derive_impl(..)]
.
Derive Macros
- Derive
Clone
but do not bound any generic. Docs are atframe_support::CloneNoBound
. - Derive
Debug
but do not bound any generics. Docs are atframe_support::DebugNoBound
. - Derive
parity_scale_codec::Decode
and for struct and enum. - Derive
parity_scale_codec::Encode
andparity_scale_codec::EncodeLike
for struct and enum. - derive Eq but do no bound any generic. Docs are at
frame_support::EqNoBound
. - Derive
parity_scale_codec::MaxEncodedLen
for struct and enum. - Derive
PartialEq
but do not bound any generic. Docs are atframe_support::PartialEqNoBound
. - Derive [
Debug
], ifstd
is enabled it usesframe_support::DebugNoBound
, ifstd
is not enabled it just returns"<wasm:stripped>"
. This behaviour is useful to prevent bloating the runtime WASM blob from unneeded code.