Result

Variant 599 v393

Result

About This Type

Enum type: Result.

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
0Ok
1Err

SCALE Encoding

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

Examples

Ok = Ok(ExecutionInfoV2)
0x00<field0>
00 Variant index 0 = Ok
field 0 field0: ExecutionInfoV2
Err = Err(DispatchError)
0x01<field0>
01 Variant index 1 = Err
field 0 field0: DispatchError

Code Examples

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

const registry = new TypeRegistry();

// Encode Result — variant "Ok"
const value = registry.createType("Result", { Ok: { value: 0 } });
console.log("Hex:", value.toHex());

Type Parameters

T = ExecutionInfoV2
E = DispatchError

Referenced By (10)

Type Information

Type ID
599
Kind
Variant
Path
Result
Runtime
v393