uint8ArrayToHex

Converts an array of bytes to a hexadecimal string.

Example

import { uint8arrayToHex } from "thirdweb/utils";
const hex = uint8arrayToHex(
new Uint8Array([
72, 101, 108, 108, 111, 44, 32, 119, 111, 114, 108, 100,
]),
);
console.log(hex); // "0x48656c6c6f2c20776f726c64"
function uint8ArrayToHex(
value: Uint8Array,
): Hex;

Parameters

The array of bytes to convert.

Type

let value: Uint8Array;

Optional parameters for the conversion.

Type

let opts: { size?: number };

Returns

let returnType: `0x${string}`;

The hexadecimal string representation of the bytes.