Kit
Functions

getU128Decoder

getU128Decoder(config): FixedSizeDecoder<bigint, 16>

Returns a decoder for 128-bit unsigned integers (u128).

This decoder deserializes u128 values from sixteen bytes in little-endian format by default. You may specify big-endian storage using the endian option.

For more details, see getU128Codec.

Parameters

ParameterTypeDescription
configNumberCodecConfigOptional settings for endianness.

Returns

FixedSizeDecoder<bigint, 16>

A FixedSizeDecoder<bigint, 16> for decoding u128 values.

Example

Decoding a u128 value.

const decoder = getU128Decoder();
const value = decoder.decode(new Uint8Array([0x2a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00])); // 42n

See

getU128Codec

On this page