1 | import { BigInt } from '@polkadot/x-bigint';
|
2 | import { u8aToBigInt } from '../u8a/toBigInt.js';
|
3 | import { hexToU8a } from './toU8a.js';
|
4 | /**
|
5 | * @name hexToBigInt
|
6 | * @summary Creates a BigInt instance object from a hex string.
|
7 | */
|
8 | export function hexToBigInt(value, { isLe = false, isNegative = false } = {}) {
|
9 | return !value || value === '0x'
|
10 | ? BigInt(0)
|
11 | : u8aToBigInt(hexToU8a(value), { isLe, isNegative });
|
12 | }
|