numberToHex

Converts a number or bigint to a hexadecimal string.

Example

import { numberToHex } from "thirdweb/utils";
const hex = numberToHex(420);
console.log(hex); // "0x1a4"
function numberToHex(
value_: number | bigint,
opts: Options,
): `0x${string}`;

Parameters

The number or bigint value to convert.

Type

let value_: number | bigint;

Optional configuration options.

Type

let opts: Options;

Returns

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

The hexadecimal representation of the input value.