1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.nToBigInt = void 0;
|
4 | const x_bigint_1 = require("@polkadot/x-bigint");
|
5 | const toBigInt_js_1 = require("../hex/toBigInt.js");
|
6 | const bn_js_1 = require("../is/bn.js");
|
7 | const hex_js_1 = require("../is/hex.js");
|
8 | const toBigInt_js_2 = require("../is/toBigInt.js");
|
9 | const toBn_js_1 = require("../is/toBn.js");
|
10 |
|
11 |
|
12 |
|
13 |
|
14 | function nToBigInt(value) {
|
15 | return typeof value === 'bigint'
|
16 | ? value
|
17 | : !value
|
18 | ? (0, x_bigint_1.BigInt)(0)
|
19 | : (0, hex_js_1.isHex)(value)
|
20 | ? (0, toBigInt_js_1.hexToBigInt)(value.toString())
|
21 | : (0, bn_js_1.isBn)(value)
|
22 | ? (0, x_bigint_1.BigInt)(value.toString())
|
23 | : (0, toBigInt_js_2.isToBigInt)(value)
|
24 | ? value.toBigInt()
|
25 | : (0, toBn_js_1.isToBn)(value)
|
26 | ? (0, x_bigint_1.BigInt)(value.toBn().toString())
|
27 | : (0, x_bigint_1.BigInt)(value);
|
28 | }
|
29 | exports.nToBigInt = nToBigInt;
|