DigestItem

Variant 17 v393

sp_runtime::generic::digest::DigestItem

About This Type

Enum type: DigestItem.

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

IndexNameFieldsDocs
6PreRuntime
4Consensus
5Seal
0Other
8RuntimeEnvironmentUpdatednone

SCALE Encoding

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

Examples

Other = Other(Vec<u8>)
0x00<field0>
00 Variant index 0 = Other
field 0 field0: Vec<u8>
Consensus = Consensus([u8; 4], Vec<u8>)
0x04<field0><field1>
04 Variant index 4 = Consensus
field 0 field0: [u8; 4]
field 1 field1: Vec<u8>
Seal = Seal([u8; 4], Vec<u8>)
0x05<field0><field1>
05 Variant index 5 = Seal
field 0 field0: [u8; 4]
field 1 field1: Vec<u8>

Code Examples

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

const registry = new TypeRegistry();

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

Referenced By (1)

Type Information

Type ID
17
Kind
Variant
Path
sp_runtime::generic::digest::DigestItem
Runtime
v393