@polkadot/types
- Version 13.0.1
- Published
- 2.28 MB
- 8 dependencies
- Apache-2.0 license
Install
npm i @polkadot/types
yarn add @polkadot/types
pnpm add @polkadot/types
Overview
Implementation of the Parity codec
Index
Variables
Functions
Classes
TypeRegistry
- chainDecimals
- chainIsEthereum
- chainSS58
- chainTokens
- clearCache()
- createClass()
- createClassUnsafe()
- createdAtHash
- createLookupType()
- createType()
- createTypeUnsafe()
- findMetaCall()
- findMetaError()
- findMetaEvent()
- firstCallIndex
- get()
- getChainProperties()
- getClassName()
- getDefinition()
- getModuleInstances()
- getOrThrow()
- getOrUnknown()
- getSignedExtensionExtra()
- getSignedExtensionTypes()
- getUnsafe()
- hasClass()
- hasDef()
- hash()
- hasType()
- isLookupType()
- knownTypes
- lookup
- metadata
- register()
- setChainProperties()
- setHasher()
- setKnownTypes()
- setLookup()
- setMetadata()
- setSignedExtensions()
- signedExtensions
- unknownTypes
Namespaces
typeDefinitions
- assetConversion
- assets
- attestations
- aura
- author
- authorship
- babe
- balances
- beefy
- benchmark
- blockbuilder
- bridges
- chain
- childstate
- claims
- collective
- consensus
- contracts
- contractsAbi
- crowdloan
- cumulus
- democracy
- dev
- discovery
- elections
- engine
- eth
- evm
- extrinsics
- finality
- fungibles
- genericAsset
- genesisBuilder
- gilt
- grandpa
- identity
- imOnline
- lottery
- metadata
- mixnet
- mmr
- nfts
- nimbus
- nompools
- offchain
- offences
- ormlOracle
- ormlTokens
- parachains
- payment
- poll
- pow
- proxy
- purchase
- recovery
- rpc
- runtime
- scaleInfo
- scheduler
- session
- society
- staking
- state
- statement
- support
- syncstate
- system
- treasury
- txpayment
- txqueue
- uniques
- utility
- vesting
- xcm
- xcmPaymentApi
- xcmRuntimeApi
Variables
variable packageInfo
const packageInfo: { name: string; path: string; type: string; version: string };
variable rpcDefinitions
const rpcDefinitions: Record<string, Record<string, DefinitionRpcExt>>;
Functions
function convertSiV0toV1
convertSiV0toV1: (registry: Registry, types: Si0Type[]) => PortableType[];
function createClass
createClass: <T extends Codec = Codec, K extends string = string>( registry: Registry, type: K) => CodecClass<DetectCodec<T, K>>;
function createType
createType: <T extends Codec = Codec, K extends string = string>( registry: Registry, type: K, ...params: unknown[]) => DetectCodec<T, K>;
Create an instance of a
type
with a givenparams
.Parameter type
A recognizable string representing the type to create an instance from
Parameter params
The value to instantiate the type with
function expandMetadata
expandMetadata: (registry: Registry, metadata: Metadata) => DecoratedMeta;
Expands the metadata by decoration into consts, query and tx sections
function lazyVariants
lazyVariants: <T>( lookup: PortableRegistry, { type }: TypeHolder, getName: (v: SiVariant) => string, creator: (v: SiVariant) => T) => Record<string, T>;
Classes
class Data
class Data extends Enum {}
Data A [[Data]] container with node, raw or hashed data
constructor
constructor(registry: Registry, value?: any);
property asBlakeTwo256
readonly asBlakeTwo256: H256;
property asKeccak256
readonly asKeccak256: H256;
property asRaw
readonly asRaw: Bytes;
property asSha256
readonly asSha256: H256;
property asShaThree256
readonly asShaThree256: H256;
property encodedLength
readonly encodedLength: number;
The encoded length
property isBlakeTwo256
readonly isBlakeTwo256: boolean;
property isKeccak256
readonly isKeccak256: boolean;
property isNone
readonly isNone: boolean;
property isRaw
readonly isRaw: boolean;
property isSha256
readonly isSha256: boolean;
property isShaThree256
readonly isShaThree256: boolean;
method toU8a
toU8a: () => Uint8Array;
Encodes the value as a Uint8Array as per the SCALE specifications
class GenericAccountId
class GenericAccountId extends BaseAccountId {}
GenericAccountId A wrapper around an AccountId/PublicKey representation. Since we are dealing with underlying PublicKeys (32 bytes in length), we extend from U8aFixed which is just a Uint8Array wrapper with a fixed length.
constructor
constructor(registry: Registry, value?: AnyU8a);
class GenericAccountId32
class GenericAccountId extends BaseAccountId {}
GenericAccountId A wrapper around an AccountId/PublicKey representation. Since we are dealing with underlying PublicKeys (32 bytes in length), we extend from U8aFixed which is just a Uint8Array wrapper with a fixed length.
constructor
constructor(registry: Registry, value?: AnyU8a);
class GenericAccountId33
class GenericAccountId33 extends BaseAccountId {}
constructor
constructor(registry: Registry, value?: AnyU8a);
class GenericAccountIndex
class GenericAccountIndex extends u32 {}
GenericAccountIndex A wrapper around an AccountIndex, which is a shortened, variable-length encoding for an Account. We extends from [[U32]] to provide the number-like properties.
constructor
constructor(registry: Registry, value?: AnyNumber);
method calcLength
static calcLength: (_value: BN | number) => number;
method eq
eq: (other?: unknown) => boolean;
Compares the value of the input to see if there is a match
method readLength
static readLength: (input: Uint8Array) => [number, number];
method toHuman
toHuman: () => string;
Converts the Object to to a human-friendly JSON, with additional fields, expansion and formatting of information
method toJSON
toJSON: () => string;
Converts the Object to JSON, typically used for RPC transfers
method toPrimitive
toPrimitive: () => string;
Converts the value in a best-fit primitive form
method toRawType
toRawType: () => string;
Returns the base runtime type name for this instance
method toString
toString: () => string;
Returns the string representation of the value
method writeLength
static writeLength: (input: Uint8Array) => Uint8Array;
class GenericAddress
class GenericMultiAddress extends Enum {}
constructor
constructor(registry: Registry, value?: {});
method inspect
inspect: () => Inspect;
Returns a breakdown of the hex encoding for this Codec
method toString
toString: () => string;
Returns the string representation of the value
class GenericBlock
class GenericBlock extends Struct {}
GenericBlock A block encoded with header and extrinsics
constructor
constructor(registry: Registry, value?: Uint8Array | BlockValue);
property contentHash
readonly contentHash: IU8a;
Encodes a content [[Hash]] for the block
property extrinsics
readonly extrinsics: Vec<GenericExtrinsic<AnyTuple>>;
The [[Extrinsic]] contained in the block
property hash
readonly hash: IU8a;
Block/header [[Hash]]
property header
readonly header: Header;
The [[Header]] of the block
class GenericCall
class GenericCall<A extends AnyTuple = AnyTuple> extends Struct implements CallBase<A> {}
GenericCall Extrinsic function descriptor
constructor
constructor(registry: Registry, value: {}, meta?: FunctionMetadataLatest);
property args
readonly args: AnyTuple;
The arguments for the function call
property argsDef
readonly argsDef: ArgsDef;
The argument definitions
property argsEntries
readonly argsEntries: [string, Codec][];
The argument entries
property callIndex
readonly callIndex: Uint8Array;
The encoded
[sectionIndex, methodIndex]
identifier
property data
readonly data: Uint8Array;
The encoded data
property meta
readonly meta: FunctionMetadataLatest;
The [[FunctionMetadata]]
property method
readonly method: string;
Returns the name of the method
property section
readonly section: string;
Returns the module containing the method
method is
is: (other: IMethod<AnyTuple>) => other is IMethod<A>;
Checks if the source matches this in type
method toHuman
toHuman: ( isExpanded?: boolean, disableAscii?: boolean) => Record<string, AnyJson>;
Converts the Object to to a human-friendly JSON, with additional fields, expansion and formatting of information
method toRawType
toRawType: () => string;
Returns the base runtime type name for this instance
class GenericChainProperties
class GenericChainProperties extends Json {}
constructor
constructor( registry: Registry, value?: Record<string, unknown> | Map<string, unknown>);
property isEthereum
readonly isEthereum: Bool;
The chain uses Ethereum addresses
property ss58Format
readonly ss58Format: Option<u32>;
The chain ss58Format
property tokenDecimals
readonly tokenDecimals: Option<Vec<u32>>;
The decimals for each of the tokens
property tokenSymbol
readonly tokenSymbol: Option<Vec<Text>>;
The symbols for the tokens
class GenericConsensusEngineId
class GenericConsensusEngineId extends U8aFixed {}
GenericConsensusEngineId A 4-byte identifier identifying the engine
constructor
constructor(registry: Registry, value?: AnyU8a);
property isAura
readonly isAura: boolean;
true
if the engine matches aura
property isBabe
readonly isBabe: boolean;
true
is the engine matches babe
property isGrandpa
readonly isGrandpa: boolean;
true
is the engine matches grandpa
property isNimbus
readonly isNimbus: boolean;
true
is the engine matches nimbus
property isPow
readonly isPow: boolean;
true
is the engine matches pow
method extractAuthor
extractAuthor: ( bytes: Bytes, sessionValidators: AccountId[]) => AccountId | undefined;
From the input bytes, decode into an author
method toHuman
toHuman: () => string;
Converts the Object to to a human-friendly JSON, with additional fields, expansion and formatting of information
method toRawType
toRawType: () => string;
Returns the base runtime type name for this instance
method toString
toString: () => string;
Override the default toString to return a 4-byte string
class GenericEthereumAccountId
class GenericEthereumAccountId extends U8aFixed {}
GenericEthereumAccountId A wrapper around an Ethereum-compatible AccountId. Since we are dealing with underlying addresses (20 bytes in length), we extend from U8aFixed which is just a Uint8Array wrapper with a fixed length.
constructor
constructor(registry: Registry, value?: AnyU8a);
method eq
eq: (other?: unknown) => boolean;
Compares the value of the input to see if there is a match
method toHuman
toHuman: () => string;
Converts the Object to to a human-friendly JSON, with additional fields, expansion and formatting of information
method toJSON
toJSON: () => string;
Converts the Object to JSON, typically used for RPC transfers
method toPrimitive
toPrimitive: () => string;
Converts the value in a best-fit primitive form
method toRawType
toRawType: () => string;
Returns the base runtime type name for this instance
method toString
toString: () => string;
Returns the string representation of the value
class GenericEthereumLookupSource
class GenericEthereumLookupSource extends AbstractBase< GenericEthereumAccountId | GenericAccountIndex> {}
GenericEthereumLookupSource A wrapper around an EthereumAccountId and/or AccountIndex that is encoded with a prefix. Since we are dealing with underlying publicKeys (or shorter encoded addresses), we extend from Base with an AccountId/AccountIndex wrapper. Basically the Address is encoded as
[ <prefix-byte>, ...publicKey/...bytes ]
as per spec
constructor
constructor(registry: Registry, value?: any);
property encodedLength
readonly encodedLength: number;
The length of the value when encoded as a Uint8Array
method toHex
toHex: () => HexString;
Returns a hex string representation of the value
method toRawType
toRawType: () => string;
Returns the base runtime type name for this instance
method toU8a
toU8a: (isBare?: boolean) => Uint8Array;
Encodes the value as a Uint8Array as per the SCALE specifications
Parameter isBare
true when the value has none of the type-specific prefixes (internal)
class GenericEvent
class GenericEvent extends Struct implements IEvent<Codec[]> {}
GenericEvent A representation of a system event. These are generated via the [[Metadata]] interfaces and specific to a specific Substrate runtime
constructor
constructor(registry: Registry, _value?: Uint8Array);
property data
readonly data: Codec[] & IEventData;
The wrapped [[EventData]]
property index
readonly index: EventId;
The [[EventId]], identifying the raw event
property meta
readonly meta: EventMetadataLatest;
The [[EventMetadata]] with the documentation
property method
readonly method: string;
The method string identifying the event
property section
readonly section: string;
The section string identifying the event
property typeDef
readonly typeDef: TypeDef[];
The [[TypeDef]] for the event
method toHuman
toHuman: ( isExpanded?: boolean, disableAscii?: boolean) => Record<string, AnyJson>;
Converts the Object to to a human-friendly JSON, with additional fields, expansion and formatting of information
class GenericEventData
class GenericEventData extends Tuple implements IEventData {}
GenericEventData Wrapper for the actual data that forms part of an [[Event]]
constructor
constructor( registry: Registry, value: Uint8Array, meta: EventMetadataLatest, section?: string, method?: string);
property meta
readonly meta: EventMetadataLatest;
The wrapped [[EventMetadata]]
property method
readonly method: string;
The method as a string
property names
readonly names: string[];
The field names (as available)
property section
readonly section: string;
The section as a string
property typeDef
readonly typeDef: TypeDef[];
The [[TypeDef]] for this event
method toHuman
toHuman: (isExtended?: boolean, disableAscii?: boolean) => AnyJson;
Converts the Object to to a human-friendly JSON, with additional fields, expansion and formatting of information
class GenericExtrinsic
class GenericExtrinsic<A extends AnyTuple = AnyTuple> extends ExtrinsicBase<A> implements IExtrinsic<A> {}
GenericExtrinsic Representation of an Extrinsic in the system. It contains the actual call, (optional) signature and encodes with an actual length prefix
https://github.com/paritytech/wiki/blob/master/Extrinsic.md#the-extrinsic-format-for-node.
Can be: - signed, to create a transaction - left as is, to create an inherent
constructor
constructor(registry: Registry, value?: any, { version }?: CreateOptions);
property hash
readonly hash: CodecHash;
returns a hash of the contents
property LATEST_EXTRINSIC_VERSION
static LATEST_EXTRINSIC_VERSION: number;
method addSignature
addSignature: ( signer: Address | Uint8Array | string, signature: Uint8Array | HexString, payload: ExtrinsicPayloadValue | Uint8Array | HexString) => GenericExtrinsic<A>;
Injects an already-generated signature into the extrinsic
method inspect
inspect: () => Inspect;
Returns a breakdown of the hex encoding for this Codec
method sign
sign: (account: IKeyringPair, options: SignatureOptions) => GenericExtrinsic<A>;
Sign the extrinsic with a specific keypair
method signFake
signFake: ( signer: Address | Uint8Array | string, options: SignatureOptions) => GenericExtrinsic<A>;
Adds a fake signature to the extrinsic
method toHex
toHex: (isBare?: boolean) => HexString;
Returns a hex string representation of the value
method toHuman
toHuman: (isExpanded?: boolean, disableAscii?: boolean) => AnyJson;
Converts the Object to to a human-friendly JSON, with additional fields, expansion and formatting of information
method toJSON
toJSON: () => string;
Converts the Object to JSON, typically used for RPC transfers
method toRawType
toRawType: () => string;
Returns the base runtime type name for this instance
method toU8a
toU8a: (isBare?: boolean) => Uint8Array;
Encodes the value as a Uint8Array as per the SCALE specifications
Parameter isBare
true when the value is not length-prefixed
method toU8aInner
toU8aInner: () => Uint8Array[];
class GenericExtrinsicEra
class GenericExtrinsicEra extends Enum implements IExtrinsicEra {}
GenericExtrinsicEra The era for an extrinsic, indicating either a mortal or immortal extrinsic
constructor
constructor(registry: Registry, value?: {});
property asImmortalEra
readonly asImmortalEra: ImmortalEra;
Returns the item as a [[ImmortalEra]]
property asMortalEra
readonly asMortalEra: MortalEra;
Returns the item as a [[MortalEra]]
property encodedLength
readonly encodedLength: number;
Override the encoded length method
property isImmortalEra
readonly isImmortalEra: boolean;
true
if Immortal
property isMortalEra
readonly isMortalEra: boolean;
true
if Mortal
method toU8a
toU8a: (isBare?: boolean) => Uint8Array;
Encodes the value as a Uint8Array as per the parity-codec specifications
Parameter isBare
true when the value has none of the type-specific prefixes (internal)
class GenericExtrinsicPayload
class GenericExtrinsicPayload extends AbstractBase<ExtrinsicPayloadVx> {}
GenericExtrinsicPayload A signing payload for an [[Extrinsic]]. For the final encoding, it is variable length based on the contents included
constructor
constructor( registry: Registry, value?: string | Uint8Array | Partial<ExtrinsicPayloadValue>, { version }?: ExtrinsicPayloadOptions);
property assetId
readonly assetId: IOption<any>;
The (optional) asset id as a [[u32]] or [[MultiLocation]] for this payload
property blockHash
readonly blockHash: BlockHash;
The block [[BlockHash]] the signature applies to (mortal/immortal)
property era
readonly era: GenericExtrinsicEra;
The [[ExtrinsicEra]]
property genesisHash
readonly genesisHash: BlockHash;
The genesis block [[BlockHash]] the signature applies to
property metadataHash
readonly metadataHash: IOption<Hash>;
The (optional) [[Hash]] of the genesis metadata for this payload
property method
readonly method: Bytes;
The [[Bytes]] contained in the payload
property nonce
readonly nonce: ICompact<INumber>;
The [[Index]]
property specVersion
readonly specVersion: INumber;
The specVersion as a [[u32]] for this payload
property tip
readonly tip: ICompact<INumber>;
The [[Balance]]
property transactionVersion
readonly transactionVersion: INumber;
The transaction version as a [[u32]] for this payload
method eq
eq: (other?: unknown) => boolean;
Compares the value of the input to see if there is a match
method sign
sign: (signerPair: IKeyringPair) => { signature: HexString };
Sign the payload with the keypair
method toHuman
toHuman: (isExtended?: boolean, disableAscii?: boolean) => AnyJson;
Converts the Object to to a human-friendly JSON, with additional fields, expansion and formatting of information
method toJSON
toJSON: () => any;
Converts the Object to JSON, typically used for RPC transfers
method toRawType
toRawType: () => string;
Returns the base runtime type name for this instance
method toString
toString: () => string;
Returns the string representation of the value
method toU8a
toU8a: (isBare?: BareOpts) => Uint8Array;
Returns a serialized u8a form
class GenericExtrinsicPayloadUnknown
class GenericExtrinsicPayloadUnknown extends Struct {}
GenericExtrinsicPayloadUnknown A default handler for payloads where the version is not known (default throw)
constructor
constructor( registry: Registry, _value?: {}, { version }?: Partial<ExtrinsicPayloadOptions>);
class GenericExtrinsicPayloadV4
class GenericExtrinsicPayloadV4 extends Struct {}
GenericExtrinsicPayloadV4 A signing payload for an [[Extrinsic]]. For the final encoding, it is variable length based on the contents included
constructor
constructor(registry: Registry, value?: any);
property assetId
readonly assetId: IOption<any>;
The (optional) asset id for this signature for chains that support transaction fees in assets
property blockHash
readonly blockHash: BlockHash;
The block [[BlockHash]] the signature applies to (mortal/immortal)
property era
readonly era: ExtrinsicEra;
The [[ExtrinsicEra]]
property genesisHash
readonly genesisHash: BlockHash;
The genesis [[BlockHash]] the signature applies to (mortal/immortal)
property metadataHash
readonly metadataHash: IOption<Hash>;
The (optional) asset id for this signature for chains that support transaction fees in assets
property method
readonly method: Bytes;
The [[Bytes]] contained in the payload
property nonce
readonly nonce: ICompact<INumber>;
The [[Index]]
property specVersion
readonly specVersion: INumber;
The specVersion for this signature
property tip
readonly tip: ICompact<INumber>;
The tip [[Balance]]
property transactionVersion
readonly transactionVersion: INumber;
The transactionVersion for this signature
method inspect
inspect: () => Inspect;
Returns a breakdown of the hex encoding for this Codec
method sign
sign: (signerPair: IKeyringPair) => Uint8Array;
Sign the payload with the keypair
class GenericExtrinsicSignatureV4
class GenericExtrinsicSignatureV4 extends Struct implements IExtrinsicSignature {}
GenericExtrinsicSignatureV4 A container for the [[Signature]] associated with a specific [[Extrinsic]]
constructor
constructor( registry: Registry, value?: Uint8Array | GenericExtrinsicSignatureV4, { isSigned }?: ExtrinsicSignatureOptions);
property assetId
readonly assetId: IOption<any>;
The [[u32]] or [[MultiLocation]] assetId
property encodedLength
readonly encodedLength: number;
The length of the value when encoded as a Uint8Array
property era
readonly era: ExtrinsicEra;
The [[ExtrinsicEra]] (mortal or immortal) this signature applies to
property isSigned
readonly isSigned: boolean;
true
if the signature is valid
property metadataHash
readonly metadataHash: IOption<Hash>;
The [[Hash]] for the metadata
property mode
readonly mode: INumber;
the [[u32]] mode
property multiSignature
readonly multiSignature: ExtrinsicSignature;
The raw [[ExtrinsicSignature]]
property nonce
readonly nonce: ICompact<INumber>;
The [[Index]] for the signature
property signature
readonly signature: EcdsaSignature | Ed25519Signature | Sr25519Signature;
The actual [[EcdsaSignature]], [[Ed25519Signature]] or [[Sr25519Signature]]
property signer
readonly signer: Address;
The [[Address]] that signed
property tip
readonly tip: ICompact<INumber>;
The [[Balance]] tip
method addSignature
addSignature: ( signer: Address | Uint8Array | string, signature: Uint8Array | HexString, payload: ExtrinsicPayloadValue | Uint8Array | HexString) => IExtrinsicSignature;
Adds a raw signature
method createPayload
createPayload: ( method: Call, options: SignatureOptions) => GenericExtrinsicPayloadV4;
Creates a payload from the supplied options
method sign
sign: ( method: Call, account: IKeyringPair, options: SignatureOptions) => IExtrinsicSignature;
Generate a payload and applies the signature from a keypair
method signFake
signFake: ( method: Call, address: Address | Uint8Array | string, options: SignatureOptions) => IExtrinsicSignature;
Generate a payload and applies a fake signature
method toU8a
toU8a: (isBare?: boolean) => Uint8Array;
Encodes the value as a Uint8Array as per the SCALE specifications
Parameter isBare
true when the value has none of the type-specific prefixes (internal)
class GenericExtrinsicUnknown
class GenericExtrinsicUnknown extends Struct {}
GenericExtrinsicUnknown A default handler for extrinsics where the version is not known (default throw)
constructor
constructor( registry: Registry, _value?: {}, { isSigned, version }?: Partial<ExtrinsicOptions>);
class GenericExtrinsicV4
class GenericExtrinsicV4 extends Struct implements IExtrinsicImpl {}
GenericExtrinsicV4 The third generation of compact extrinsics
constructor
constructor( registry: Registry, value?: Uint8Array | ExtrinsicValueV4 | Call, { isSigned }?: Partial<ExtrinsicOptions>);
property encodedLength
readonly encodedLength: number;
The length of the value when encoded as a Uint8Array
property method
readonly method: Call;
The [[Call]] this extrinsic wraps
property signature
readonly signature: ExtrinsicSignatureV4;
The [[ExtrinsicSignatureV4]]
property version
readonly version: number;
The version for the signature
method addSignature
addSignature: ( signer: Address | Uint8Array | string, signature: Uint8Array | HexString, payload: ExtrinsicPayloadValue | Uint8Array | HexString) => GenericExtrinsicV4;
Add an [[ExtrinsicSignatureV4]] to the extrinsic (already generated)
method sign
sign: (account: IKeyringPair, options: SignatureOptions) => GenericExtrinsicV4;
Sign the extrinsic with a specific keypair
method signFake
signFake: ( signer: Address | Uint8Array | string, options: SignatureOptions) => GenericExtrinsicV4;
Adds a fake signature to the extrinsic
class GenericImmortalEra
class ImmortalEra extends Raw {}
ImmortalEra The ImmortalEra for an extrinsic
constructor
constructor(registry: Registry, _value?: AnyU8a);
class GenericLookupSource
class GenericLookupSource extends AbstractBase< GenericAccountId | GenericAccountIndex> {}
LookupSource A wrapper around an AccountId and/or AccountIndex that is encoded with a prefix. Since we are dealing with underlying publicKeys (or shorter encoded addresses), we extend from Base with an AccountId/AccountIndex wrapper. Basically the Address is encoded as
[ <prefix-byte>, ...publicKey/...bytes ]
as per spec
constructor
constructor(registry: Registry, value?: any);
property encodedLength
readonly encodedLength: number;
The length of the value when encoded as a Uint8Array
method inspect
inspect: () => Inspect;
Returns a breakdown of the hex encoding for this Codec
method toHex
toHex: () => HexString;
Returns a hex string representation of the value
method toRawType
toRawType: () => string;
Returns the base runtime type name for this instance
method toU8a
toU8a: (isBare?: boolean) => Uint8Array;
Encodes the value as a Uint8Array as per the SCALE specifications
Parameter isBare
true when the value has none of the type-specific prefixes (internal)
class GenericMortalEra
class MortalEra extends Tuple {}
MortalEra The MortalEra for an extrinsic, indicating period and phase
constructor
constructor( registry: Registry, value?: string | Uint8Array | number[] | MortalMethod);
property encodedLength
readonly encodedLength: number;
Encoded length for mortals occupy 2 bytes, different from the actual Tuple since it is encoded. This is a shortcut fro
toU8a().length
property period
readonly period: INumber;
The period of this Mortal wraps as a [[U64]]
property phase
readonly phase: INumber;
The phase of this Mortal wraps as a [[U64]]
method birth
birth: (current: BN | bigint | number | string) => number;
Get the block number of the start of the era whose properties this object describes that
current
belongs to.
method death
death: (current: BN | bigint | number | string) => number;
Get the block number of the first block at which the era has ended.
method toHuman
toHuman: () => any;
Converts the Object to to a human-friendly JSON, with additional fields, expansion and formatting of information
method toJSON
toJSON: () => any;
Returns a JSON representation of the actual value
method toU8a
toU8a: (_isBare?: boolean) => Uint8Array;
Encodes the value as a Uint8Array as per the parity-codec specifications
Parameter isBare
true when the value has none of the type-specific prefixes (internal) Period and phase are encoded: - The period of validity from the block hash found in the signing material. - The phase in the period that this transaction's lifetime begins (and, importantly, implies which block hash is included in the signature material). If the
period
is greater than 1 << 12, then it will be a factor of the times greater than 1<<12 thatperiod
is.
class GenericMultiAddress
class GenericMultiAddress extends Enum {}
constructor
constructor(registry: Registry, value?: {});
method inspect
inspect: () => Inspect;
Returns a breakdown of the hex encoding for this Codec
method toString
toString: () => string;
Returns the string representation of the value
class GenericSignerPayload
class GenericSignerPayload extends Struct implements ISignerPayload, SignerPayloadType {}
GenericSignerPayload A generic signer payload that can be used for serialization between API and signer
constructor
constructor(registry: Registry, value?: any);
property address
readonly address: Address;
property assetId
readonly assetId: IOption<any>;
property blockHash
readonly blockHash: BlockHash;
property blockNumber
readonly blockNumber: INumber;
property era
readonly era: ExtrinsicEra;
property genesisHash
readonly genesisHash: BlockHash;
property metadataHash
readonly metadataHash: IOption<Hash>;
property method
readonly method: Call;
property mode
readonly mode: INumber;
property nonce
readonly nonce: ICompact<INumber>;
property runtimeVersion
readonly runtimeVersion: IRuntimeVersion;
property signedExtensions
readonly signedExtensions: Vec<Text>;
property tip
readonly tip: ICompact<INumber>;
property version
readonly version: INumber;
property withSignedTransaction
readonly withSignedTransaction: boolean;
method toPayload
toPayload: () => SignerPayloadJSON;
Creates an representation of the structure as an ISignerPayload JSON
method toRaw
toRaw: () => SignerPayloadRaw;
Creates a representation of the payload in raw Exrinsic form
class GenericVote
class GenericVote extends U8aFixed {}
GenericVote A number of lock periods, plus a vote, one way or the other.
constructor
constructor(registry: Registry, value?: InputTypes);
property conviction
readonly conviction: Conviction;
returns a V2 conviction
property isAye
readonly isAye: boolean;
true if the wrapped value is a positive vote
property isNay
readonly isNay: boolean;
true if the wrapped value is a negative vote
method toHuman
toHuman: (isExpanded?: boolean) => AnyJson;
Converts the Object to to a human-friendly JSON, with additional fields, expansion and formatting of information
method toPrimitive
toPrimitive: () => any;
Converts the value in a best-fit primitive form
method toRawType
toRawType: () => string;
Returns the base runtime type name for this instance
class Metadata
class Metadata extends MetadataVersioned {}
Metadata The versioned runtime metadata as a decoded structure
constructor
constructor(registry: Registry, value?: any);
class PortableRegistry
class PortableRegistry extends Struct implements ILookup {}
constructor
constructor(registry: Registry, value?: Uint8Array, isContract?: boolean);
property names
readonly names: string[];
Returns all the available type names for this chain
property paramTypes
readonly paramTypes: TypeInfoParams;
Returns all the available parameterized types for this chain
property types
readonly types: Vec<PortableType>;
The types of the registry
method getName
getName: ( lookupId: SiLookupTypeId | LookupString | number) => string | undefined;
Returns the name for a specific lookup
method getSiType
getSiType: (lookupId: SiLookupTypeId | LookupString | number) => SiType;
Finds a specific type in the registry
method getTypeDef
getTypeDef: (lookupId: SiLookupTypeId | LookupString | number) => TypeDef;
Lookup the type definition for the index
method register
register: () => void;
Register all available types into the registry (generally for internal usage)
method sanitizeField
sanitizeField: (name: Option<Text>) => [string | null, string | null];
For a specific field, perform adjustments to not have built-in conflicts
class StorageKey
class StorageKey<A extends AnyTuple = AnyTuple> extends Bytes implements IStorageKey<A> {}
StorageKey A representation of a storage key (typically hashed) in the system. It can be constructed by passing in a raw key or a StorageEntry with (optional) arguments.
constructor
constructor( registry: Registry, value?: | string | Uint8Array | StorageKey<AnyTuple> | StorageEntry | [StorageEntry, unknown[]?], override?: Partial<StorageKeyExtra>);
property args
readonly args: AnyTuple;
Return the decoded arguments (applicable to map with decodable values)
property meta
readonly meta: StorageEntryMetadataLatest;
The metadata or
undefined
when not available
property method
readonly method: string;
The key method or
undefined
when not specified
property outputType
readonly outputType: string;
The output type
property section
readonly section: string;
The key section or
undefined
when not specified
method is
is: (key: IStorageKey<AnyTuple>) => key is IStorageKey<A>;
method setMeta
setMeta: ( meta?: StorageEntryMetadataLatest, section?: string, method?: string) => this;
Sets the meta for this key
method toHuman
toHuman: (_isExtended?: boolean, disableAscii?: boolean) => AnyJson;
Returns the Human representation for this type
method toRawType
toRawType: () => string;
Returns the raw type for this
class TypeRegistry
class TypeRegistry implements Registry {}
constructor
constructor(createdAtHash?: string | Hash | Uint8Array);
property chainDecimals
readonly chainDecimals: number[];
property chainIsEthereum
readonly chainIsEthereum: boolean;
property chainSS58
readonly chainSS58: number;
property chainTokens
readonly chainTokens: string[];
property createdAtHash
createdAtHash?: Hash;
property firstCallIndex
readonly firstCallIndex: Uint8Array;
property knownTypes
readonly knownTypes: RegisteredTypes;
property lookup
readonly lookup: PortableRegistry;
property metadata
readonly metadata: MetadataLatest;
property signedExtensions
readonly signedExtensions: string[];
property unknownTypes
readonly unknownTypes: string[];
method clearCache
clearCache: () => void;
method createClass
createClass: <T extends Codec = Codec, K extends string = string>( type: K) => CodecClass<DetectCodec<T, K>>;
Creates an instance of the class
method createClassUnsafe
createClassUnsafe: <T extends Codec = Codec, K extends string = string>( type: K) => CodecClass<T>;
Creates an instance of the class
method createLookupType
createLookupType: (lookupId: SiLookupTypeId | number) => LookupString;
Creates a lookup string from the supplied id
method createType
createType: <T extends Codec = Codec, K extends string = string>( type: K, ...params: unknown[]) => DetectCodec<T, K>;
Creates an instance of a type as registered
method createTypeUnsafe
createTypeUnsafe: <T extends Codec = Codec, K extends string = string>( type: K, params: unknown[], options?: CreateOptions) => T;
Creates an instance of a type as registered
method findMetaCall
findMetaCall: (callIndex: Uint8Array) => CallFunction;
method findMetaError
findMetaError: ( errorIndex: | Uint8Array | DispatchErrorModule | DispatchErrorModuleU8 | DispatchErrorModuleU8a) => RegistryError;
method findMetaEvent
findMetaEvent: (eventIndex: Uint8Array) => CodecClass<GenericEventData>;
method get
get: <T extends Codec = Codec, K extends string = string>( name: K, withUnknown?: boolean, knownTypeDef?: TypeDef) => CodecClass<T> | undefined;
method getChainProperties
getChainProperties: () => ChainProperties | undefined;
method getClassName
getClassName: (Type: CodecClass) => string | undefined;
method getDefinition
getDefinition: (typeName: string) => string | undefined;
method getModuleInstances
getModuleInstances: ( specName: AnyString, moduleName: string) => string[] | undefined;
method getOrThrow
getOrThrow: < T extends Codec = Codec, K extends string = string, R = DetectCodec<T, K>>( name: K) => CodecClass<R>;
method getOrUnknown
getOrUnknown: < T extends Codec = Codec, K extends string = string, R = DetectCodec<T, K>>( name: K) => CodecClass<R>;
method getSignedExtensionExtra
getSignedExtensionExtra: () => Record<string, string>;
method getSignedExtensionTypes
getSignedExtensionTypes: () => Record<string, string>;
method getUnsafe
getUnsafe: <T extends Codec = Codec, K extends string = string>( name: K, withUnknown?: boolean, knownTypeDef?: TypeDef) => CodecClass<T> | undefined;
method hasClass
hasClass: (name: string) => boolean;
method hasDef
hasDef: (name: string) => boolean;
method hash
hash: (data: Uint8Array) => IU8a;
method hasType
hasType: (name: string) => boolean;
method isLookupType
isLookupType: (value: string) => value is LookupString;
Returns true if the type is in a Compat format
method register
register: { (type: CodecClass | RegistryTypes): void; (name: string, type: CodecClass): void;};
method setChainProperties
setChainProperties: (properties?: ChainProperties) => void;
method setHasher
setHasher: (hasher?: CodecHasher | null) => void;
method setKnownTypes
setKnownTypes: (knownTypes: RegisteredTypes) => void;
method setLookup
setLookup: (lookup: PortableRegistry) => void;
method setMetadata
setMetadata: ( metadata: Metadata, signedExtensions?: string[], userExtensions?: ExtDef, noInitWarn?: boolean) => void;
method setSignedExtensions
setSignedExtensions: ( signedExtensions?: string[], userExtensions?: ExtDef, noInitWarn?: boolean) => void;
Namespaces
namespace typeDefinitions
module 'interfaces/definitions.d.ts' {}
variable assetConversion
const assetConversion: Definitions;
variable assets
const assets: Definitions;
variable attestations
const attestations: Definitions;
variable aura
const aura: Definitions;
variable author
const author: Definitions;
variable authorship
const authorship: Definitions;
variable babe
const babe: Definitions;
variable balances
const balances: Definitions;
variable beefy
const beefy: Definitions;
variable benchmark
const benchmark: Definitions;
variable blockbuilder
const blockbuilder: Definitions;
variable bridges
const bridges: Definitions;
variable chain
const chain: Definitions;
variable childstate
const childstate: Definitions;
variable claims
const claims: Definitions;
variable collective
const collective: Definitions;
variable consensus
const consensus: Definitions;
variable contracts
const contracts: Definitions;
variable contractsAbi
const contractsAbi: Definitions;
variable crowdloan
const crowdloan: Definitions;
variable cumulus
const cumulus: Definitions;
variable democracy
const democracy: Definitions;
variable dev
const dev: Definitions;
variable discovery
const discovery: Definitions;
variable elections
const elections: Definitions;
variable engine
const engine: Definitions;
variable eth
const eth: { rpc: import('../../types/definitions.js').DefinitionsRpc; runtime: import('../../types/definitions.js').DefinitionsCall; types: DefinitionsTypes;};
variable evm
const evm: Definitions;
variable extrinsics
const extrinsics: Definitions;
variable finality
const finality: Definitions;
variable fungibles
const fungibles: Definitions;
variable genericAsset
const genericAsset: Definitions;
variable genesisBuilder
const genesisBuilder: Definitions;
variable gilt
const gilt: Definitions;
variable grandpa
const grandpa: Definitions;
variable identity
const identity: Definitions;
variable imOnline
const imOnline: Definitions;
variable lottery
const lottery: Definitions;
variable metadata
const metadata: Definitions;
variable mixnet
const mixnet: Definitions;
variable mmr
const mmr: Definitions;
variable nfts
const nfts: Definitions;
variable nimbus
const nimbus: Definitions;
variable nompools
const nompools: Definitions;
variable offchain
const offchain: Definitions;
variable offences
const offences: Definitions;
variable ormlOracle
const ormlOracle: Definitions;
variable ormlTokens
const ormlTokens: Definitions;
variable parachains
const parachains: Definitions;
variable payment
const payment: Definitions;
variable poll
const poll: Definitions;
variable pow
const pow: Definitions;
variable proxy
const proxy: Definitions;
variable purchase
const purchase: Definitions;
variable recovery
const recovery: Definitions;
variable rpc
const rpc: Definitions;
variable runtime
const runtime: Definitions;
variable scaleInfo
const scaleInfo: Definitions;
variable scheduler
const scheduler: Definitions;
variable session
const session: Definitions;
variable society
const society: Definitions;
variable staking
const staking: Definitions;
variable state
const state: Definitions;
variable statement
const statement: Definitions;
variable support
const support: Definitions;
variable syncstate
const syncstate: Definitions;
variable system
const system: Definitions;
variable treasury
const treasury: Definitions;
variable txpayment
const txpayment: Definitions;
variable txqueue
const txqueue: Definitions;
variable uniques
const uniques: Definitions;
variable utility
const utility: Definitions;
variable vesting
const vesting: Definitions;
variable xcm
const xcm: Definitions;
variable xcmPaymentApi
const xcmPaymentApi: Definitions;
variable xcmRuntimeApi
const xcmRuntimeApi: Definitions;
Package Files (111)
- create/createClass.d.ts
- create/createType.d.ts
- create/lazy.d.ts
- create/registry.d.ts
- ethereum/AccountId.d.ts
- ethereum/LookupSource.d.ts
- extrinsic/Extrinsic.d.ts
- extrinsic/ExtrinsicEra.d.ts
- extrinsic/ExtrinsicPayload.d.ts
- extrinsic/ExtrinsicPayloadUnknown.d.ts
- extrinsic/ExtrinsicUnknown.d.ts
- extrinsic/SignerPayload.d.ts
- extrinsic/v4/Extrinsic.d.ts
- extrinsic/v4/ExtrinsicPayload.d.ts
- extrinsic/v4/ExtrinsicSignature.d.ts
- generic/AccountId.d.ts
- generic/AccountIndex.d.ts
- generic/Block.d.ts
- generic/Call.d.ts
- generic/ChainProperties.d.ts
- generic/ConsensusEngineId.d.ts
- generic/Event.d.ts
- generic/LookupSource.d.ts
- generic/MultiAddress.d.ts
- generic/Vote.d.ts
- index.d.ts
- interfaces/assetConversion/definitions.d.ts
- interfaces/assets/definitions.d.ts
- interfaces/attestations/definitions.d.ts
- interfaces/aura/definitions.d.ts
- interfaces/author/definitions.d.ts
- interfaces/authorship/definitions.d.ts
- interfaces/babe/definitions.d.ts
- interfaces/balances/definitions.d.ts
- interfaces/beefy/definitions.d.ts
- interfaces/benchmark/definitions.d.ts
- interfaces/blockbuilder/definitions.d.ts
- interfaces/bridges/definitions.d.ts
- interfaces/chain/definitions.d.ts
- interfaces/childstate/definitions.d.ts
- interfaces/claims/definitions.d.ts
- interfaces/collective/definitions.d.ts
- interfaces/consensus/definitions.d.ts
- interfaces/contracts/definitions.d.ts
- interfaces/contractsAbi/definitions.d.ts
- interfaces/crowdloan/definitions.d.ts
- interfaces/cumulus/definitions.d.ts
- interfaces/definitions.d.ts
- interfaces/democracy/definitions.d.ts
- interfaces/dev/definitions.d.ts
- interfaces/discovery/definitions.d.ts
- interfaces/elections/definitions.d.ts
- interfaces/engine/definitions.d.ts
- interfaces/eth/definitions.d.ts
- interfaces/evm/definitions.d.ts
- interfaces/extrinsics/definitions.d.ts
- interfaces/finality/definitions.d.ts
- interfaces/fungibles/definitions.d.ts
- interfaces/genericAsset/definitions.d.ts
- interfaces/genesisBuilder/definitions.d.ts
- interfaces/gilt/definitions.d.ts
- interfaces/grandpa/definitions.d.ts
- interfaces/identity/definitions.d.ts
- interfaces/imOnline/definitions.d.ts
- interfaces/jsonrpc.d.ts
- interfaces/lottery/definitions.d.ts
- interfaces/metadata/definitions.d.ts
- interfaces/mixnet/definitions.d.ts
- interfaces/mmr/definitions.d.ts
- interfaces/nfts/definitions.d.ts
- interfaces/nimbus/definitions.d.ts
- interfaces/nompools/definitions.d.ts
- interfaces/offchain/definitions.d.ts
- interfaces/offences/definitions.d.ts
- interfaces/ormlOracle/definitions.d.ts
- interfaces/ormlTokens/definitions.d.ts
- interfaces/parachains/definitions.d.ts
- interfaces/payment/definitions.d.ts
- interfaces/poll/definitions.d.ts
- interfaces/pow/definitions.d.ts
- interfaces/proxy/definitions.d.ts
- interfaces/purchase/definitions.d.ts
- interfaces/recovery/definitions.d.ts
- interfaces/rpc/definitions.d.ts
- interfaces/runtime/definitions.d.ts
- interfaces/scaleInfo/definitions.d.ts
- interfaces/scheduler/definitions.d.ts
- interfaces/session/definitions.d.ts
- interfaces/society/definitions.d.ts
- interfaces/staking/definitions.d.ts
- interfaces/state/definitions.d.ts
- interfaces/statement/definitions.d.ts
- interfaces/support/definitions.d.ts
- interfaces/syncstate/definitions.d.ts
- interfaces/system/definitions.d.ts
- interfaces/treasury/definitions.d.ts
- interfaces/txpayment/definitions.d.ts
- interfaces/txqueue/definitions.d.ts
- interfaces/uniques/definitions.d.ts
- interfaces/utility/definitions.d.ts
- interfaces/vesting/definitions.d.ts
- interfaces/xcm/definitions.d.ts
- interfaces/xcmPaymentApi/definitions.d.ts
- interfaces/xcmRuntimeApi/definitions.d.ts
- metadata/Metadata.d.ts
- metadata/PortableRegistry/PortableRegistry.d.ts
- metadata/PortableRegistry/toV1.d.ts
- metadata/decorate/index.d.ts
- packageInfo.d.ts
- primitive/Data.d.ts
- primitive/StorageKey.d.ts
Dependencies (8)
Dev Dependencies (0)
No dev dependencies.
Peer Dependencies (0)
No peer dependencies.
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@polkadot/types
.
- Markdown[![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@polkadot/types)
- HTML<a href="https://www.jsdocs.io/package/@polkadot/types"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 10471 ms. - Missing or incorrect documentation? Open an issue for this package.