Skip to content

Types

Compact

Bases: ScaleType

A space efficient type to encoding fixed-width integers

CompactU32

Bases: Compact

Specialized composite implementation for performance improvement

Option

Bases: ScaleType

Option is a type that represents an optional value, which can be either Some(value) if a value is present or None if it is absent, allowing for safe handling of null or missing values without causing runtime errors.

Bytes

Bases: ScaleType

A variable collection of bytes, stored as an Vec<u8>

U8

Bases: ScalePrimitive

Unsigned 8-bit int type, encoded in little-endian (LE) format

U16

Bases: ScalePrimitive

Unsigned 16-bit int type, encoded in little-endian (LE) format

U32

Bases: ScalePrimitive

Unsigned 32-bit int type, encoded in little-endian (LE) format

U64

Bases: ScalePrimitive

Unsigned 64-bit int type, encoded in little-endian (LE) format

U128

Bases: ScalePrimitive

Unsigned 128-bit int type, encoded in little-endian (LE) format

U256

Bases: ScalePrimitive

Unsigned 256-bit int type, encoded in little-endian (LE) format

I8

Bases: ScalePrimitive

Signed 8-bit int type, encoded in little-endian (LE) format

I16

Bases: ScalePrimitive

Signed 16-bit int type, encoded in little-endian (LE) format

I32

Bases: ScalePrimitive

Signed 32-bit int type, encoded in little-endian (LE) format

I64

Bases: ScalePrimitive

Signed 64-bit int type, encoded in little-endian (LE) format

I128

Bases: ScalePrimitive

Signed 128-bit int type, encoded in little-endian (LE) format

I256

Bases: ScalePrimitive

Signed 256-bit int type, encoded in little-endian (LE) format

H160

Bases: ScalePrimitive

Fixed-size uninterpreted hash type with 20 bytes (160 bits) size.

H256

Bases: ScalePrimitive

Fixed-size uninterpreted hash type with 32 bytes (256 bits) size.

H512

Bases: ScalePrimitive

Fixed-size uninterpreted hash type with 64 bytes (512 bits) size.

Struct

Bases: ScaleType

A struct is a composite data type that groups together zero or more values with various types into a single object

Set

Bases: ScaleType

The Set type in Substrate is an unordered collection that contains unique elements. It is implemented using a binary search tree, allowing for efficient insertion, removal, and lookup operations.

Era

Bases: ScaleType

An Era represents a range of blocks in which a transaction is allowed to be executed.

An Era may either be "immortal", in which case the transaction is always valid, or "mortal", in which case the transaction has a defined start block and period in which it is valid.

is_immortal() -> bool

Returns true if the era is immortal, false if mortal.

birth(current: int) -> int

Gets the block number of the start of the era given, with current as the reference block number for the era, normally included as part of the transaction.

death(current: int) -> int

Gets the block number of the first block at which the era has ended.

If the era is immortal, 2**64 - 1 (the maximum unsigned 64-bit integer) is returned.

Bool

Bases: ScalePrimitive

Boolean type

GenericAccountId

Bases: H256

An SS58 formatted representation of an account

GenericEthereumAccountId

Bases: H160

Representation of an Ethereum address, internally a H160

GenericAccountIndex

Bases: U32

The AccountIndex type Substrate represents an account index, which is a unique identifier assigned to an account in the Substrate runtime.

Vec

Bases: ScaleType

A Vec in RUST is a dynamically resizable array that can hold a sequence of elements of the same type, allowing for efficient random access and insertion or removal of elements at the end of the vector.

BoundedVec

Bases: Vec

BoundedVec is a fixed-size vector used in Substrate, with a maximum number of elements that can be added. It is used in cases where a fixed-size buffer is required, such as in the case of the transaction input/output limit in the Substrate runtime.

BitVec

Bases: ScaleType

A BitVec that represents an array of bits. The bits are however stored encoded. The difference between this and a normal Bytes would be that the length prefix indicates the number of bits encoded, not the bytes

Enum

Bases: ScaleType

A fixed number of variants, each mutually exclusive and potentially implying a further value or series of values.

Conviction

Bases: Enum

Conviction represents a measure of the degree of confidence or trust that a stakeholder has in a particular proposal in the Substrate runtime. It is used to determine the voting power of a stakeholder for a particular proposal, with higher conviction leading to more voting power.

OpaqueCall

Bases: Bytes

A Bytes representation of a Call, without having to decode the contents

FixedLengthArray

Bases: ScaleType

Fixed sized array of specified subtype e.g. [u8; 8]

GenericMultiAddress

Bases: Enum

MultiAddress is a type used in the Substrate runtime to represent an address that can be expressed in multiple ways, such as an account ID, a public key, or a human-readable name, allowing for flexible addressing and storage of data.

GenericMetadataAll

Bases: Enum

Enum that contains a Metadata version.

E.g. {"V14": MetadataV14}

GenericMetadataVersioned

Bases: Tuple

Tuple that contains a backwards compatible MetadataAll type

GenericVariant

Bases: Struct

get_param_info(max_recursion: int = TYPE_DECOMP_MAX_RECURSIVE) -> dict

Generates a dictionary of all possible params with their decomposition information

Returns:

Type Description
dict

ScaleInfoStorageEntryMetadata

Bases: GenericStorageEntryMetadata

get_param_info(max_recursion: int = TYPE_DECOMP_MAX_RECURSIVE) -> list

Return a type decomposition how to format parameters for current storage function

Returns:

Type Description
list

GenericRuntimeCallDefinition

Bases: Struct

get_param_info(max_recursion: int = TYPE_DECOMP_MAX_RECURSIVE) -> list

Return a type decomposition how to format parameters for current storage function

Returns:

Type Description
list

GenericExtrinsic

Bases: ScaleType

The Extrinsic type is used to send transactions from an account to the Substrate runtime, and it can contain one or more calls to the runtime functions.

GenericEvent

Bases: Enum

An Event is a type used to represent a runtime event, which is a signal that indicates that a specific state transition has occurred.

It is implemented as a variant enum that contains different types of events, such as system events, runtime events, and custom events, each with its own set of fields that describe the event.