[u8; 2]

Array 178 v393

About This Type

Fixed-length array of 2 u8 values.

Always exactly 2 elements. No length prefix needed since the size is known at compile time.

Encoding: 2 elements encoded consecutively, no length prefix.

Fixed-Length Array

Element Type
u8
Length
2
SCALE Encoding
Fixed-length (2 x element size bytes)

SCALE Encoding

Rule
2 elements encoded consecutively, no length prefix (size known at compile time).
Size
2 bytes

Examples

2-byte array = [u8; 2]
0xxxxx...
2 raw bytes 2 bytes concatenated, no prefix

Code Examples

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

const registry = new TypeRegistry();

// Encode a [u8; 2]
const arr = registry.createType("[u8; 2]", new Uint8Array(2));
console.log("Hex:", arr.toHex());

Referenced By (2)

Type Information

Type ID
178
Kind
Array
Runtime
v393