1 |
|
2 |
|
3 | import { BigInt } from '@polkadot/x-bigint';
|
4 | import { hexToBigInt } from "../hex/toBigInt.js";
|
5 | import { isBn } from "../is/bn.js";
|
6 | import { isHex } from "../is/hex.js";
|
7 | import { isToBigInt } from "../is/toBigInt.js";
|
8 | import { isToBn } from "../is/toBn.js";
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 | export function nToBigInt(value) {
|
15 | return typeof value === 'bigint' ? value : !value ? BigInt(0) : isHex(value) ? hexToBigInt(value.toString()) : isBn(value) ? BigInt(value.toString()) : isToBigInt(value) ? value.toBigInt() : isToBn(value) ? BigInt(value.toBn().toString()) : BigInt(value);
|
16 | } |
\ | No newline at end of file |