MultiAddress

Variant 138 v393

sp_runtime::multiaddress::MultiAddress

About This Type

Enum type: MultiAddress.

A tagged union where the first byte selects which variant is active, followed by that variant's data.

Encoding: 1-byte variant index followed by the selected variant's field data.

Variants (5)

IndexNameFieldsDocs
0Id
1Index
2Raw
3Address32
4Address20

SCALE Encoding

Rule
1-byte variant index followed by variant-specific field data. 5 possible variants.
Size
variable (1+ bytes)

Examples

Id = Id(AccountId)
0x00<field0>
00 Variant index 0 = Id
field 0 field0: AccountId
Index = Index(Compact<()>)
0x01<field0>
01 Variant index 1 = Index
field 0 field0: Compact<()>
Raw = Raw(Vec<u8>)
0x02<field0>
02 Variant index 2 = Raw
field 0 field0: Vec<u8>

Code Examples

import { TypeRegistry } from "@polkadot/types";

const registry = new TypeRegistry();

// Encode MultiAddress — variant "Id"
const value = registry.createType("MultiAddress", { Id: { value: "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY" } });
console.log("Hex:", value.toHex());

Type Parameters

AccountId = AccountId
AccountIndex = ()

Referenced By (22)

and 2 more...

Type Information

Type ID
138
Kind
Variant
Path
sp_runtime::multiaddress::MultiAddress
Runtime
v393