Option

Variant 168 v393

Option

About This Type

Flexible address format supporting multiple encoding styles.

Allows specifying an account as Id (AccountId32), Index (u32 account index), Raw bytes, Address32, or Address20. Most commonly used with the Id variant.

Encoding: Variant: 0x00=Id (32 bytes), 0x01=Index (compact u32), 0x02=Raw, 0x03=Address32, 0x04=Address20.

Variants (2)

IndexNameFieldsDocs
0Nonenone
1Some

SCALE Encoding

Rule
1-byte variant selects the address format, followed by format-specific data.
Size
variable (1–33 bytes)

Examples

Id variant (AccountId32) = Id(5Grw...QY)
0x00d43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d
00 Variant 0 = Id
d43593c7...56da27d 32-byte AccountId32

Code Examples

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

const registry = new TypeRegistry();

// Encode Option — variant "None"
const value = registry.createType("Option", "None");
console.log("Hex:", value.toHex());

Type Parameters

T = (u32, u32)

Referenced By (157)

and 137 more...

Type Information

Type ID
168
Kind
Variant
Path
Option
Runtime
v393