Option

Variant 607 v393

Option

About This Type

Enum type: Option.

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 (2)

IndexNameFieldsDocs
0Nonenone
1Some

SCALE Encoding

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

Examples

None
0x00
00 Variant index 0 = None
Some = Some(Block)
0x01<field0>
01 Variant index 1 = Some
field 0 field0: Block

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 = Block

Referenced By (157)

and 137 more...

Type Information

Type ID
607
Kind
Variant
Path
Option
Runtime
v393