Result

Variant 626 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(Option)
0x00<field0>
00 Variant index 0 = Ok
field 0 field0: Option
Err = Err(ContractAccessError)
0x01<field0>
01 Variant index 1 = Err
field 0 field0: ContractAccessError

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 = Option
E = ContractAccessError

Referenced By (10)

Type Information

Type ID
626
Kind
Variant
Path
Result
Runtime
v393