Uint8Array (U8a)
u8aToHex
u8aToHexConvert a Uint8Array to a hex string
import { u8aToHex } from 'dedot/utils';
u8aToHex(new Uint8Array([128, 0, 10])) // '0x80000a'u8aToString
u8aToStringConvert a Uint8Array to a string
import { u8aToString } from 'dedot/utils';
const sampleU8a = new Uint8Array([0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x77, 0x6f, 0x72, 0x6c, 0x64]);
u8aToString(sampleU8a) // 'hello world'u8aEq
u8aEqCompare two Uint8Arrays for equality
import { u8aEq } from 'dedot/utils';
u8aEq(new Uint8Array([1, 2, 3]), new Uint8Array([1, 2, 3])) // true
u8aEq(new Uint8Array([1, 2, 3]), new Uint8Array([4, 5, 6])) // falsetoU8a
toU8aConverts the input to a hex string, input can be in different types: string | number | Uint8Array | HexString
concatU8a
concatU8aConcat multiple Uint8Array instances into a single Uint8Array.
Last updated
Was this helpful?