toHex

Converts a value to its hexadecimal representation.

Example

import { toHex } from "thirdweb/utils";
const hex = toHex(420);
console.log(hex); // "0x1a4"
function toHex(
value: string | number | bigint | boolean | Uint8Array,
): Hex;

Parameters

The value to convert to hexadecimal.

Type

let value: string | number | bigint | boolean | Uint8Array;

Optional parameters for the conversion.

Type

let opts: { size?: number };

Returns

let returnType: ox__Hex.Hex;

The hexadecimal representation of the value.