Result
Variant 42 v411Result
About This Type
Standard Rust Result type: Ok(T) or Err(E).
The return type of most pallet dispatchable calls (with T=() and E=DispatchError). Ok indicates success; Err contains an error explaining what went wrong.
Encoding: Variant: 0x00 = Ok (followed by T encoding), 0x01 = Err (followed by E encoding).
Variants (2)
| Index | Name | Fields | Docs |
|---|---|---|---|
| 0 | Ok | ||
| 1 | Err |
SCALE Encoding
- Rule
- Variant: 0x00 = Ok (no payload), 0x01 = Err (followed by DispatchError).
- Size
- variable (1+ bytes)
Examples
Success (Ok) = Ok(())
0x0000 Variant index 0 = Ok, no payloadFailure (Err) = Err(DispatchError::BadOrigin)
0x010201 Variant index 1 = Err02 DispatchError variant 2 = BadOriginCode 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 = ()
E = DispatchError
Referenced By (7)
Type Information
- Type ID
- 42
- Kind
- Variant
- Path
- Result
- Runtime
- v411