hexToBigInt

Converts a hexadecimal string to a BigInt.

Example

import { hexToBigInt } from "thirdweb/utils";
const bigInt = hexToBigInt("0x1a4");
console.log(bigInt); // 420n
function hexToBigInt(
hex: `0x${string}`,
): bigint;

Parameters

The hexadecimal string to convert.

Type

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

Optional parameters for the conversion.

Type

let opts: { signed?: boolean; size?: number };

Returns

let returnType: bigint;

The BigInt representation of the hexadecimal string.