@reown/appkit-common-react-native 0.0.0-feat-multi-social-20250714211631 → 0.0.0-feat-onramp-20250718185718
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/index.js +1 -62
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/utils/ConstantsUtil.js +1 -4
- package/lib/commonjs/utils/ConstantsUtil.js.map +1 -1
- package/lib/commonjs/utils/NumberUtil.js +11 -52
- package/lib/commonjs/utils/NumberUtil.js.map +1 -1
- package/lib/commonjs/utils/PresetsUtil.js +8 -34
- package/lib/commonjs/utils/PresetsUtil.js.map +1 -1
- package/lib/commonjs/utils/TypeUtil.js +0 -46
- package/lib/commonjs/utils/TypeUtil.js.map +1 -1
- package/lib/module/index.js +0 -5
- package/lib/module/index.js.map +1 -1
- package/lib/module/utils/ConstantsUtil.js +1 -4
- package/lib/module/utils/ConstantsUtil.js.map +1 -1
- package/lib/module/utils/NumberUtil.js +11 -52
- package/lib/module/utils/NumberUtil.js.map +1 -1
- package/lib/module/utils/PresetsUtil.js +8 -34
- package/lib/module/utils/PresetsUtil.js.map +1 -1
- package/lib/module/utils/TypeUtil.js +0 -40
- package/lib/module/utils/TypeUtil.js.map +1 -1
- package/lib/typescript/index.d.ts +0 -5
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/utils/ConstantsUtil.d.ts +0 -3
- package/lib/typescript/utils/ConstantsUtil.d.ts.map +1 -1
- package/lib/typescript/utils/NumberUtil.d.ts +11 -39
- package/lib/typescript/utils/NumberUtil.d.ts.map +1 -1
- package/lib/typescript/utils/PresetsUtil.d.ts +3 -1
- package/lib/typescript/utils/PresetsUtil.d.ts.map +1 -1
- package/lib/typescript/utils/TypeUtil.d.ts +11 -291
- package/lib/typescript/utils/TypeUtil.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/index.ts +0 -5
- package/src/utils/ConstantsUtil.ts +1 -4
- package/src/utils/NumberUtil.ts +11 -54
- package/src/utils/PresetsUtil.ts +10 -36
- package/src/utils/TypeUtil.ts +13 -375
- package/lib/commonjs/adapters/BlockchainAdapter.js +0 -79
- package/lib/commonjs/adapters/BlockchainAdapter.js.map +0 -1
- package/lib/commonjs/adapters/EvmAdapter.js +0 -267
- package/lib/commonjs/adapters/EvmAdapter.js.map +0 -1
- package/lib/commonjs/adapters/SolanaBaseAdapter.js +0 -12
- package/lib/commonjs/adapters/SolanaBaseAdapter.js.map +0 -1
- package/lib/commonjs/networks/bitcoin.js +0 -40
- package/lib/commonjs/networks/bitcoin.js.map +0 -1
- package/lib/commonjs/networks/solana.js +0 -78
- package/lib/commonjs/networks/solana.js.map +0 -1
- package/lib/module/adapters/BlockchainAdapter.js +0 -72
- package/lib/module/adapters/BlockchainAdapter.js.map +0 -1
- package/lib/module/adapters/EvmAdapter.js +0 -261
- package/lib/module/adapters/EvmAdapter.js.map +0 -1
- package/lib/module/adapters/SolanaBaseAdapter.js +0 -5
- package/lib/module/adapters/SolanaBaseAdapter.js.map +0 -1
- package/lib/module/networks/bitcoin.js +0 -34
- package/lib/module/networks/bitcoin.js.map +0 -1
- package/lib/module/networks/solana.js +0 -72
- package/lib/module/networks/solana.js.map +0 -1
- package/lib/typescript/adapters/BlockchainAdapter.d.ts +0 -27
- package/lib/typescript/adapters/BlockchainAdapter.d.ts.map +0 -1
- package/lib/typescript/adapters/EvmAdapter.d.ts +0 -55
- package/lib/typescript/adapters/EvmAdapter.d.ts.map +0 -1
- package/lib/typescript/adapters/SolanaBaseAdapter.d.ts +0 -4
- package/lib/typescript/adapters/SolanaBaseAdapter.d.ts.map +0 -1
- package/lib/typescript/adapters/__tests__/EvmAdapter.test.d.ts +0 -2
- package/lib/typescript/adapters/__tests__/EvmAdapter.test.d.ts.map +0 -1
- package/lib/typescript/networks/bitcoin.d.ts +0 -4
- package/lib/typescript/networks/bitcoin.d.ts.map +0 -1
- package/lib/typescript/networks/solana.d.ts +0 -5
- package/lib/typescript/networks/solana.d.ts.map +0 -1
- package/src/adapters/BlockchainAdapter.ts +0 -109
- package/src/adapters/EvmAdapter.ts +0 -298
- package/src/adapters/SolanaBaseAdapter.ts +0 -5
- package/src/adapters/__tests__/EvmAdapter.test.ts +0 -104
- package/src/networks/bitcoin.ts +0 -32
- package/src/networks/solana.ts +0 -44
package/lib/commonjs/index.js
CHANGED
|
@@ -13,22 +13,8 @@ var _exportNames = {
|
|
|
13
13
|
PresetsUtil: true,
|
|
14
14
|
StringUtil: true,
|
|
15
15
|
ErrorUtil: true,
|
|
16
|
-
erc20ABI: true
|
|
17
|
-
solana: true,
|
|
18
|
-
solanaDevnet: true,
|
|
19
|
-
solanaTestnet: true,
|
|
20
|
-
bitcoin: true,
|
|
21
|
-
bitcoinTestnet: true,
|
|
22
|
-
BlockchainAdapter: true,
|
|
23
|
-
EVMAdapter: true,
|
|
24
|
-
SolanaBaseAdapter: true
|
|
16
|
+
erc20ABI: true
|
|
25
17
|
};
|
|
26
|
-
Object.defineProperty(exports, "BlockchainAdapter", {
|
|
27
|
-
enumerable: true,
|
|
28
|
-
get: function () {
|
|
29
|
-
return _BlockchainAdapter.BlockchainAdapter;
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
18
|
Object.defineProperty(exports, "ConstantsUtil", {
|
|
33
19
|
enumerable: true,
|
|
34
20
|
get: function () {
|
|
@@ -47,12 +33,6 @@ Object.defineProperty(exports, "DateUtil", {
|
|
|
47
33
|
return _DateUtil.DateUtil;
|
|
48
34
|
}
|
|
49
35
|
});
|
|
50
|
-
Object.defineProperty(exports, "EVMAdapter", {
|
|
51
|
-
enumerable: true,
|
|
52
|
-
get: function () {
|
|
53
|
-
return _EvmAdapter.EVMAdapter;
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
36
|
Object.defineProperty(exports, "ErrorUtil", {
|
|
57
37
|
enumerable: true,
|
|
58
38
|
get: function () {
|
|
@@ -83,54 +63,18 @@ Object.defineProperty(exports, "PresetsUtil", {
|
|
|
83
63
|
return _PresetsUtil.PresetsUtil;
|
|
84
64
|
}
|
|
85
65
|
});
|
|
86
|
-
Object.defineProperty(exports, "SolanaBaseAdapter", {
|
|
87
|
-
enumerable: true,
|
|
88
|
-
get: function () {
|
|
89
|
-
return _SolanaBaseAdapter.SolanaBaseAdapter;
|
|
90
|
-
}
|
|
91
|
-
});
|
|
92
66
|
Object.defineProperty(exports, "StringUtil", {
|
|
93
67
|
enumerable: true,
|
|
94
68
|
get: function () {
|
|
95
69
|
return _StringUtil.StringUtil;
|
|
96
70
|
}
|
|
97
71
|
});
|
|
98
|
-
Object.defineProperty(exports, "bitcoin", {
|
|
99
|
-
enumerable: true,
|
|
100
|
-
get: function () {
|
|
101
|
-
return _bitcoin.bitcoin;
|
|
102
|
-
}
|
|
103
|
-
});
|
|
104
|
-
Object.defineProperty(exports, "bitcoinTestnet", {
|
|
105
|
-
enumerable: true,
|
|
106
|
-
get: function () {
|
|
107
|
-
return _bitcoin.bitcoinTestnet;
|
|
108
|
-
}
|
|
109
|
-
});
|
|
110
72
|
Object.defineProperty(exports, "erc20ABI", {
|
|
111
73
|
enumerable: true,
|
|
112
74
|
get: function () {
|
|
113
75
|
return _erc.erc20ABI;
|
|
114
76
|
}
|
|
115
77
|
});
|
|
116
|
-
Object.defineProperty(exports, "solana", {
|
|
117
|
-
enumerable: true,
|
|
118
|
-
get: function () {
|
|
119
|
-
return _solana.solana;
|
|
120
|
-
}
|
|
121
|
-
});
|
|
122
|
-
Object.defineProperty(exports, "solanaDevnet", {
|
|
123
|
-
enumerable: true,
|
|
124
|
-
get: function () {
|
|
125
|
-
return _solana.solanaDevnet;
|
|
126
|
-
}
|
|
127
|
-
});
|
|
128
|
-
Object.defineProperty(exports, "solanaTestnet", {
|
|
129
|
-
enumerable: true,
|
|
130
|
-
get: function () {
|
|
131
|
-
return _solana.solanaTestnet;
|
|
132
|
-
}
|
|
133
|
-
});
|
|
134
78
|
var _ConstantsUtil = require("./utils/ConstantsUtil");
|
|
135
79
|
var _ContractUtil = require("./utils/ContractUtil");
|
|
136
80
|
var _DateUtil = require("./utils/DateUtil");
|
|
@@ -141,11 +85,6 @@ var _PresetsUtil = require("./utils/PresetsUtil");
|
|
|
141
85
|
var _StringUtil = require("./utils/StringUtil");
|
|
142
86
|
var _ErrorUtil = require("./utils/ErrorUtil");
|
|
143
87
|
var _erc = require("./contracts/erc20");
|
|
144
|
-
var _solana = require("./networks/solana");
|
|
145
|
-
var _bitcoin = require("./networks/bitcoin");
|
|
146
|
-
var _BlockchainAdapter = require("./adapters/BlockchainAdapter");
|
|
147
|
-
var _EvmAdapter = require("./adapters/EvmAdapter");
|
|
148
|
-
var _SolanaBaseAdapter = require("./adapters/SolanaBaseAdapter");
|
|
149
88
|
var _TypeUtil = require("./utils/TypeUtil");
|
|
150
89
|
Object.keys(_TypeUtil).forEach(function (key) {
|
|
151
90
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_ConstantsUtil","require","_ContractUtil","_DateUtil","_NamesUtil","_NetworkUtil","_NumberUtil","_PresetsUtil","_StringUtil","_ErrorUtil","_erc","
|
|
1
|
+
{"version":3,"names":["_ConstantsUtil","require","_ContractUtil","_DateUtil","_NamesUtil","_NetworkUtil","_NumberUtil","_PresetsUtil","_StringUtil","_ErrorUtil","_erc","_TypeUtil","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,cAAA,GAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAL,OAAA;AACA,IAAAM,YAAA,GAAAN,OAAA;AACA,IAAAO,WAAA,GAAAP,OAAA;AACA,IAAAQ,UAAA,GAAAR,OAAA;AACA,IAAAS,IAAA,GAAAT,OAAA;AACA,IAAAU,SAAA,GAAAV,OAAA;AAAAW,MAAA,CAAAC,IAAA,CAAAF,SAAA,EAAAG,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAJ,SAAA,CAAAI,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAZ,SAAA,CAAAI,GAAA;IAAA;EAAA;AAAA"}
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.ConstantsUtil = void 0;
|
|
7
7
|
const ConstantsUtil = exports.ConstantsUtil = {
|
|
8
|
-
VERSION: '0.0.0-feat-
|
|
8
|
+
VERSION: '0.0.0-feat-onramp-20250718185718',
|
|
9
9
|
EIP155: 'eip155',
|
|
10
10
|
ADD_CHAIN_METHOD: 'wallet_addEthereumChain',
|
|
11
11
|
WC_NAME_SUFFIX: '.reown.id',
|
|
@@ -14,9 +14,6 @@ const ConstantsUtil = exports.ConstantsUtil = {
|
|
|
14
14
|
BLOCKCHAIN_API_RPC_URL_STAGING: 'https://staging.rpc.walletconnect.org',
|
|
15
15
|
PULSE_API_URL: 'https://pulse.walletconnect.org',
|
|
16
16
|
API_URL: 'https://api.web3modal.org',
|
|
17
|
-
WEB_WALLET_URL: 'https://web-wallet.walletconnect.org',
|
|
18
|
-
SECURE_SITE_DASHBOARD: `https://secure.reown.com/dashboard`,
|
|
19
|
-
SECURE_SITE_ICON: `https://secure.reown.com/images/favicon.png`,
|
|
20
17
|
WALLET_CONNECT_CONNECTOR_ID: 'walletConnect',
|
|
21
18
|
COINBASE_CONNECTOR_ID: 'coinbaseWallet',
|
|
22
19
|
AUTH_CONNECTOR_ID: 'appKitAuth',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ConstantsUtil","exports","VERSION","EIP155","ADD_CHAIN_METHOD","WC_NAME_SUFFIX","WC_NAME_SUFFIX_LEGACY","BLOCKCHAIN_API_RPC_URL","BLOCKCHAIN_API_RPC_URL_STAGING","PULSE_API_URL","API_URL","
|
|
1
|
+
{"version":3,"names":["ConstantsUtil","exports","VERSION","EIP155","ADD_CHAIN_METHOD","WC_NAME_SUFFIX","WC_NAME_SUFFIX_LEGACY","BLOCKCHAIN_API_RPC_URL","BLOCKCHAIN_API_RPC_URL_STAGING","PULSE_API_URL","API_URL","WALLET_CONNECT_CONNECTOR_ID","COINBASE_CONNECTOR_ID","AUTH_CONNECTOR_ID","COINBASE_EXPLORER_ID","USDT_CONTRACT_ADDRESSES"],"sourceRoot":"../../../src","sources":["utils/ConstantsUtil.ts"],"mappings":";;;;;;AAAO,MAAMA,aAAa,GAAAC,OAAA,CAAAD,aAAA,GAAG;EAC3BE,OAAO,EAAE,kCAAkC;EAE3CC,MAAM,EAAE,QAAQ;EAChBC,gBAAgB,EAAE,yBAAyB;EAE3CC,cAAc,EAAE,WAAW;EAC3BC,qBAAqB,EAAE,SAAS;EAEhCC,sBAAsB,EAAE,+BAA+B;EACvDC,8BAA8B,EAAE,uCAAuC;EACvEC,aAAa,EAAE,iCAAiC;EAChDC,OAAO,EAAE,2BAA2B;EAEpCC,2BAA2B,EAAE,eAAe;EAC5CC,qBAAqB,EAAE,gBAAgB;EACvCC,iBAAiB,EAAE,YAAY;EAE/BC,oBAAoB,EAAE,kEAAkE;EAExFC,uBAAuB,EAAE;EACvB;EACA,4CAA4C;EAC5C;EACA,4CAA4C;EAC5C;EACA,4CAA4C;EAC5C;EACA,4CAA4C;EAC5C;EACA,4CAA4C;EAC5C;EACA,4CAA4C;EAC5C;EACA,4CAA4C;AAEhD,CAAC"}
|
|
@@ -8,12 +8,6 @@ var BigNumber = _interopRequireWildcard(require("bignumber.js"));
|
|
|
8
8
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
9
9
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
10
10
|
const NumberUtil = exports.NumberUtil = {
|
|
11
|
-
/**
|
|
12
|
-
* Creates a BigNumber instance from a given value.
|
|
13
|
-
* If the value is a string, commas are removed before conversion.
|
|
14
|
-
* @param value - The input value (string, number, or BigNumber) to convert to a BigNumber.
|
|
15
|
-
* @returns A BigNumber instance.
|
|
16
|
-
*/
|
|
17
11
|
bigNumber(value) {
|
|
18
12
|
if (typeof value === 'string') {
|
|
19
13
|
return new BigNumber.BigNumber(value.replace(/,/g, ''));
|
|
@@ -21,11 +15,10 @@ const NumberUtil = exports.NumberUtil = {
|
|
|
21
15
|
return new BigNumber.BigNumber(value);
|
|
22
16
|
},
|
|
23
17
|
/**
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
* @param
|
|
27
|
-
* @
|
|
28
|
-
* @returns The product as a BigNumber instance, or BigNumber(0) if either input is undefined.
|
|
18
|
+
* Multiply two numbers represented as strings with BigNumber to handle decimals correctly
|
|
19
|
+
* @param a string
|
|
20
|
+
* @param b string
|
|
21
|
+
* @returns
|
|
29
22
|
*/
|
|
30
23
|
multiply(a, b) {
|
|
31
24
|
if (a === undefined || b === undefined) {
|
|
@@ -35,32 +28,19 @@ const NumberUtil = exports.NumberUtil = {
|
|
|
35
28
|
const bBigNumber = new BigNumber.BigNumber(typeof b === 'string' ? b.replace(/,/gu, '') : b);
|
|
36
29
|
return aBigNumber.multipliedBy(bBigNumber);
|
|
37
30
|
},
|
|
38
|
-
/**
|
|
39
|
-
* Rounds a number to a specified number of decimal places if its string representation meets a certain length threshold.
|
|
40
|
-
* @param number - The number to potentially round.
|
|
41
|
-
* @param threshold - The minimum string length of the number to trigger rounding.
|
|
42
|
-
* @param fixed - The number of decimal places to round to.
|
|
43
|
-
* @returns The rounded number (as a string if rounded, otherwise the original number) or the original number.
|
|
44
|
-
*/
|
|
45
31
|
roundNumber(number, threshold, fixed) {
|
|
46
32
|
const roundedNumber = number.toString().length >= threshold ? Number(number).toFixed(fixed) : number;
|
|
47
33
|
return roundedNumber;
|
|
48
34
|
},
|
|
49
|
-
/**
|
|
50
|
-
* Calculates the next multiple of ten greater than or equal to the given amount.
|
|
51
|
-
* Defaults to 10 if no amount is provided or if the calculated multiple is less than 10.
|
|
52
|
-
* @param amount - The number for which to find the next multiple of ten. Optional.
|
|
53
|
-
* @returns The next multiple of ten, at least 10.
|
|
54
|
-
*/
|
|
55
35
|
nextMultipleOfTen(amount) {
|
|
56
36
|
if (!amount) return 10;
|
|
57
37
|
return Math.max(Math.ceil(amount / 10) * 10, 10);
|
|
58
38
|
},
|
|
59
39
|
/**
|
|
60
|
-
*
|
|
61
|
-
* @param value - The value to format
|
|
62
|
-
* @param decimals -
|
|
63
|
-
* @returns
|
|
40
|
+
* Format the given number or string to human readable numbers with the given number of decimals
|
|
41
|
+
* @param value - The value to format. It could be a number or string. If it's a string, it will be parsed to a float then formatted.
|
|
42
|
+
* @param decimals - number of decimals after dot
|
|
43
|
+
* @returns
|
|
64
44
|
*/
|
|
65
45
|
formatNumberToLocalString(value, decimals = 2) {
|
|
66
46
|
if (value === undefined) {
|
|
@@ -78,9 +58,9 @@ const NumberUtil = exports.NumberUtil = {
|
|
|
78
58
|
});
|
|
79
59
|
},
|
|
80
60
|
/**
|
|
81
|
-
*
|
|
82
|
-
* @param value - The formatted string to parse
|
|
83
|
-
* @returns
|
|
61
|
+
* Parse a formatted local string back to a number
|
|
62
|
+
* @param value - The formatted string to parse
|
|
63
|
+
* @returns
|
|
84
64
|
*/
|
|
85
65
|
parseLocalStringToNumber(value) {
|
|
86
66
|
if (value === undefined) {
|
|
@@ -89,27 +69,6 @@ const NumberUtil = exports.NumberUtil = {
|
|
|
89
69
|
|
|
90
70
|
// Remove any commas used as thousand separators and parse the float
|
|
91
71
|
return parseFloat(value.replace(/,/gu, ''));
|
|
92
|
-
},
|
|
93
|
-
/**
|
|
94
|
-
* Converts a numeric value (BigInt, number, or string representation of a number) to a 0x-prefixed hexadecimal string.
|
|
95
|
-
* This is often required for Ethereum RPC parameters like value, gas, gasPrice.
|
|
96
|
-
* @param value - The value to convert. Can be BigInt, number, or a string (decimal or hex).
|
|
97
|
-
* @returns A 0x-prefixed hexadecimal string, or undefined if the input is undefined or null.
|
|
98
|
-
* @throws Error if the value cannot be converted to BigInt.
|
|
99
|
-
*/
|
|
100
|
-
convertNumericToHexString: value => {
|
|
101
|
-
if (value === undefined || value === null) {
|
|
102
|
-
return undefined;
|
|
103
|
-
}
|
|
104
|
-
try {
|
|
105
|
-
// This handles BigInt, number, or string representation of a number (decimal or hex)
|
|
106
|
-
const bigIntValue = BigInt(value);
|
|
107
|
-
// Ethereum RPC spec requires "0x0" for zero, and other values to be 0x-prefixed hex.
|
|
108
|
-
|
|
109
|
-
return '0x' + bigIntValue.toString(16);
|
|
110
|
-
} catch (error) {
|
|
111
|
-
throw new Error(`NumberUtil: Invalid parameter, cannot convert to hex: ${value}`);
|
|
112
|
-
}
|
|
113
72
|
}
|
|
114
73
|
};
|
|
115
74
|
//# sourceMappingURL=NumberUtil.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["BigNumber","_interopRequireWildcard","require","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","NumberUtil","exports","bigNumber","value","replace","multiply","b","undefined","aBigNumber","bBigNumber","multipliedBy","roundNumber","number","threshold","fixed","roundedNumber","toString","length","Number","toFixed","nextMultipleOfTen","amount","Math","max","ceil","formatNumberToLocalString","decimals","toLocaleString","maximumFractionDigits","minimumFractionDigits","parseFloat","parseLocalStringToNumber"
|
|
1
|
+
{"version":3,"names":["BigNumber","_interopRequireWildcard","require","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","NumberUtil","exports","bigNumber","value","replace","multiply","b","undefined","aBigNumber","bBigNumber","multipliedBy","roundNumber","number","threshold","fixed","roundedNumber","toString","length","Number","toFixed","nextMultipleOfTen","amount","Math","max","ceil","formatNumberToLocalString","decimals","toLocaleString","maximumFractionDigits","minimumFractionDigits","parseFloat","parseLocalStringToNumber"],"sourceRoot":"../../../src","sources":["utils/NumberUtil.ts"],"mappings":";;;;;;AAAA,IAAAA,SAAA,GAAAC,uBAAA,CAAAC,OAAA;AAA0C,SAAAC,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAH,wBAAAG,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAA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H;IACzB,CAAC,CAAC;EACJ,CAAC;EACD;AACF;AACA;AACA;AACA;EACEK,wBAAwBA,CAAC5B,KAAyB,EAAE;IAClD,IAAIA,KAAK,KAAKI,SAAS,EAAE;MACvB,OAAO,CAAC;IACV;;IAEA;IACA,OAAOuB,UAAU,CAAC3B,KAAK,CAACC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;EAC7C;AACF,CAAC"}
|
|
@@ -9,11 +9,11 @@ const PresetsUtil = exports.PresetsUtil = {
|
|
|
9
9
|
ConnectorExplorerIds: {
|
|
10
10
|
[_ConstantsUtil.ConstantsUtil.COINBASE_CONNECTOR_ID]: 'fd20dc426fb37566d803205b19bbc1d4096b248ac04548e3cfb6b3a38bd033aa'
|
|
11
11
|
},
|
|
12
|
-
|
|
12
|
+
EIP155NetworkImageIds: {
|
|
13
13
|
// Ethereum
|
|
14
14
|
1: 'ba0ba0cd-17c6-4806-ad93-f9d174f17900',
|
|
15
15
|
// Arbitrum
|
|
16
|
-
42161: '
|
|
16
|
+
42161: '600a9a04-c1b9-42ca-6785-9b4b6ff85200',
|
|
17
17
|
// Avalanche
|
|
18
18
|
43114: '30c46e53-e989-45fb-4549-be3bd4eb3b00',
|
|
19
19
|
// Binance Smart Chain
|
|
@@ -24,20 +24,6 @@ const PresetsUtil = exports.PresetsUtil = {
|
|
|
24
24
|
10: 'ab9c186a-c52f-464b-2906-ca59d760a400',
|
|
25
25
|
// Polygon
|
|
26
26
|
137: '41d04d42-da3b-4453-8506-668cc0727900',
|
|
27
|
-
// Mantle
|
|
28
|
-
5000: 'e86fae9b-b770-4eea-e520-150e12c81100',
|
|
29
|
-
// Hedera Mainnet
|
|
30
|
-
295: '6a97d510-cac8-4e58-c7ce-e8681b044c00',
|
|
31
|
-
// Sepolia
|
|
32
|
-
11_155_111: 'e909ea0a-f92a-4512-c8fc-748044ea6800',
|
|
33
|
-
// Base Sepolia
|
|
34
|
-
84532: 'a18a7ecd-e307-4360-4746-283182228e00',
|
|
35
|
-
// Unichain Sepolia
|
|
36
|
-
1301: '4eeea7ef-0014-4649-5d1d-07271a80f600',
|
|
37
|
-
// Unichain Mainnet
|
|
38
|
-
130: '2257980a-3463-48c6-cbac-a42d2a956e00',
|
|
39
|
-
// Monad Testnet
|
|
40
|
-
10_143: '0a728e83-bacb-46db-7844-948f05434900',
|
|
41
27
|
// Gnosis
|
|
42
28
|
100: '02b53f6a-e3d4-479e-1cb4-21178987d100',
|
|
43
29
|
// EVMos
|
|
@@ -61,24 +47,7 @@ const PresetsUtil = exports.PresetsUtil = {
|
|
|
61
47
|
// Base
|
|
62
48
|
8453: '7289c336-3981-4081-c5f4-efc26ac64a00',
|
|
63
49
|
// Aurora
|
|
64
|
-
1313161554: '3ff73439-a619-4894-9262-4470c773a100'
|
|
65
|
-
// Ronin Mainnet
|
|
66
|
-
2020: 'b8101fc0-9c19-4b6f-ec65-f6dfff106e00',
|
|
67
|
-
// Saigon Testnet (a.k.a. Ronin)
|
|
68
|
-
2021: 'b8101fc0-9c19-4b6f-ec65-f6dfff106e00',
|
|
69
|
-
// Berachain Mainnet
|
|
70
|
-
80094: 'e329c2c9-59b0-4a02-83e4-212ff3779900',
|
|
71
|
-
// Abstract Mainnet
|
|
72
|
-
2741: 'fc2427d1-5af9-4a9c-8da5-6f94627cd900',
|
|
73
|
-
// Solana networks
|
|
74
|
-
/// Mainnet
|
|
75
|
-
'5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp': 'a1b58899-f671-4276-6a5e-56ca5bd59700',
|
|
76
|
-
/// Testnet
|
|
77
|
-
'4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z': 'a1b58899-f671-4276-6a5e-56ca5bd59700',
|
|
78
|
-
// Bitcoin
|
|
79
|
-
'000000000019d6689c085ae165831e93': '0b4838db-0161-4ffe-022d-532bf03dba00',
|
|
80
|
-
// Bitcoin Testnet
|
|
81
|
-
'000000000933ea01ad0ee984209779ba': '39354064-d79b-420b-065d-f980c4b78200'
|
|
50
|
+
1313161554: '3ff73439-a619-4894-9262-4470c773a100'
|
|
82
51
|
},
|
|
83
52
|
ConnectorNamesMap: {
|
|
84
53
|
[_ConstantsUtil.ConstantsUtil.WALLET_CONNECT_CONNECTOR_ID]: 'WalletConnect',
|
|
@@ -89,6 +58,11 @@ const PresetsUtil = exports.PresetsUtil = {
|
|
|
89
58
|
[_ConstantsUtil.ConstantsUtil.COINBASE_CONNECTOR_ID]: '0c2840c3-5b04-4c44-9661-fbd4b49e1800',
|
|
90
59
|
[_ConstantsUtil.ConstantsUtil.WALLET_CONNECT_CONNECTOR_ID]: 'ef1a1fcf-7fe8-4d69-bd6d-fda1345b4400'
|
|
91
60
|
},
|
|
61
|
+
ConnectorTypesMap: {
|
|
62
|
+
[_ConstantsUtil.ConstantsUtil.WALLET_CONNECT_CONNECTOR_ID]: 'WALLET_CONNECT',
|
|
63
|
+
[_ConstantsUtil.ConstantsUtil.COINBASE_CONNECTOR_ID]: 'COINBASE',
|
|
64
|
+
[_ConstantsUtil.ConstantsUtil.AUTH_CONNECTOR_ID]: 'AUTH'
|
|
65
|
+
},
|
|
92
66
|
RpcChainIds: [
|
|
93
67
|
// Ethereum
|
|
94
68
|
1,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_ConstantsUtil","require","PresetsUtil","exports","ConnectorExplorerIds","ConstantsUtil","COINBASE_CONNECTOR_ID","
|
|
1
|
+
{"version":3,"names":["_ConstantsUtil","require","PresetsUtil","exports","ConnectorExplorerIds","ConstantsUtil","COINBASE_CONNECTOR_ID","EIP155NetworkImageIds","ConnectorNamesMap","WALLET_CONNECT_CONNECTOR_ID","AUTH_CONNECTOR_ID","ConnectorImageIds","ConnectorTypesMap","RpcChainIds"],"sourceRoot":"../../../src","sources":["utils/PresetsUtil.ts"],"mappings":";;;;;;AACA,IAAAA,cAAA,GAAAC,OAAA;AAEO,MAAMC,WAAW,GAAAC,OAAA,CAAAD,WAAA,GAAG;EACzBE,oBAAoB,EAAE;IACpB,CAAC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EAAE;EACF;EACA,GAAG;EACH;EACA,KAAK;EACL;EACA,MAAM;EACN;EACA,GAAG;EACH;EACA,KAAK;EACL;EACA,KAAK;EACL;EACA,UAAU;EACV;EACA,UAAU;EACV;EACA,EAAE;EACF;EACA,EAAE;EACF;EACA,KAAK;EACL;EACA,KAAK;EACL;EACA,GAAG;EACH;EACA,IAAI;EACJ;EACA,KAAK;EACL;EACA,OAAO;EACP;EACA,GAAG;EACH;EACA,GAAG;EACH;EACA,GAAG;AAEP,CAAC"}
|
|
@@ -1,48 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.WalletConnector = void 0;
|
|
7
|
-
var _events = require("events");
|
|
8
|
-
//TODO: remove this
|
|
9
|
-
|
|
10
|
-
//********** Adapter Event Payloads **********//
|
|
11
|
-
|
|
12
|
-
//********** Adapter Event Map **********//
|
|
13
|
-
|
|
14
|
-
//********** Connector Types **********//
|
|
15
|
-
|
|
16
|
-
class WalletConnector extends _events.EventEmitter {
|
|
17
|
-
constructor({
|
|
18
|
-
type
|
|
19
|
-
}) {
|
|
20
|
-
super();
|
|
21
|
-
this.type = type;
|
|
22
|
-
}
|
|
23
|
-
async init(ops) {
|
|
24
|
-
this.storage = ops.storage;
|
|
25
|
-
this.metadata = ops.metadata;
|
|
26
|
-
}
|
|
27
|
-
setProvider(provider) {
|
|
28
|
-
this.provider = provider;
|
|
29
|
-
}
|
|
30
|
-
async disconnect() {
|
|
31
|
-
await this.provider?.disconnect();
|
|
32
|
-
this.namespaces = undefined;
|
|
33
|
-
this.wallet = undefined;
|
|
34
|
-
this.properties = undefined;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
//********** Provider Types **********//
|
|
39
|
-
|
|
40
|
-
//TODO: rename this and remove the old one ConnectorType
|
|
41
|
-
|
|
42
|
-
//********** Others **********//
|
|
43
|
-
|
|
44
|
-
//********** SIWE Types **********//
|
|
45
|
-
|
|
46
|
-
// Signed Cacao (CAIP-74)
|
|
47
|
-
exports.WalletConnector = WalletConnector;
|
|
48
2
|
//# sourceMappingURL=TypeUtil.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["utils/TypeUtil.ts"],"mappings":""}
|
package/lib/module/index.js
CHANGED
|
@@ -8,10 +8,5 @@ export { PresetsUtil } from './utils/PresetsUtil';
|
|
|
8
8
|
export { StringUtil } from './utils/StringUtil';
|
|
9
9
|
export { ErrorUtil } from './utils/ErrorUtil';
|
|
10
10
|
export { erc20ABI } from './contracts/erc20';
|
|
11
|
-
export { solana, solanaDevnet, solanaTestnet } from './networks/solana';
|
|
12
|
-
export { bitcoin, bitcoinTestnet } from './networks/bitcoin';
|
|
13
|
-
export { BlockchainAdapter } from './adapters/BlockchainAdapter';
|
|
14
|
-
export { EVMAdapter } from './adapters/EvmAdapter';
|
|
15
|
-
export { SolanaBaseAdapter } from './adapters/SolanaBaseAdapter';
|
|
16
11
|
export * from './utils/TypeUtil';
|
|
17
12
|
//# sourceMappingURL=index.js.map
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ConstantsUtil","ContractUtil","DateUtil","NamesUtil","NetworkUtil","NumberUtil","PresetsUtil","StringUtil","ErrorUtil","erc20ABI"
|
|
1
|
+
{"version":3,"names":["ConstantsUtil","ContractUtil","DateUtil","NamesUtil","NetworkUtil","NumberUtil","PresetsUtil","StringUtil","ErrorUtil","erc20ABI"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":"AAAA,SAASA,aAAa,QAAQ,uBAAuB;AACrD,SAASC,YAAY,QAAQ,sBAAsB;AACnD,SAASC,QAAQ,QAAQ,kBAAkB;AAC3C,SAASC,SAAS,QAAQ,mBAAmB;AAC7C,SAASC,WAAW,QAAQ,qBAAqB;AACjD,SAASC,UAAU,QAAQ,oBAAoB;AAC/C,SAASC,WAAW,QAAQ,qBAAqB;AACjD,SAASC,UAAU,QAAQ,oBAAoB;AAC/C,SAASC,SAAS,QAAQ,mBAAmB;AAC7C,SAASC,QAAQ,QAAQ,mBAAmB;AAC5C,cAAc,kBAAkB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export const ConstantsUtil = {
|
|
2
|
-
VERSION: '0.0.0-feat-
|
|
2
|
+
VERSION: '0.0.0-feat-onramp-20250718185718',
|
|
3
3
|
EIP155: 'eip155',
|
|
4
4
|
ADD_CHAIN_METHOD: 'wallet_addEthereumChain',
|
|
5
5
|
WC_NAME_SUFFIX: '.reown.id',
|
|
@@ -8,9 +8,6 @@ export const ConstantsUtil = {
|
|
|
8
8
|
BLOCKCHAIN_API_RPC_URL_STAGING: 'https://staging.rpc.walletconnect.org',
|
|
9
9
|
PULSE_API_URL: 'https://pulse.walletconnect.org',
|
|
10
10
|
API_URL: 'https://api.web3modal.org',
|
|
11
|
-
WEB_WALLET_URL: 'https://web-wallet.walletconnect.org',
|
|
12
|
-
SECURE_SITE_DASHBOARD: `https://secure.reown.com/dashboard`,
|
|
13
|
-
SECURE_SITE_ICON: `https://secure.reown.com/images/favicon.png`,
|
|
14
11
|
WALLET_CONNECT_CONNECTOR_ID: 'walletConnect',
|
|
15
12
|
COINBASE_CONNECTOR_ID: 'coinbaseWallet',
|
|
16
13
|
AUTH_CONNECTOR_ID: 'appKitAuth',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ConstantsUtil","VERSION","EIP155","ADD_CHAIN_METHOD","WC_NAME_SUFFIX","WC_NAME_SUFFIX_LEGACY","BLOCKCHAIN_API_RPC_URL","BLOCKCHAIN_API_RPC_URL_STAGING","PULSE_API_URL","API_URL","
|
|
1
|
+
{"version":3,"names":["ConstantsUtil","VERSION","EIP155","ADD_CHAIN_METHOD","WC_NAME_SUFFIX","WC_NAME_SUFFIX_LEGACY","BLOCKCHAIN_API_RPC_URL","BLOCKCHAIN_API_RPC_URL_STAGING","PULSE_API_URL","API_URL","WALLET_CONNECT_CONNECTOR_ID","COINBASE_CONNECTOR_ID","AUTH_CONNECTOR_ID","COINBASE_EXPLORER_ID","USDT_CONTRACT_ADDRESSES"],"sourceRoot":"../../../src","sources":["utils/ConstantsUtil.ts"],"mappings":"AAAA,OAAO,MAAMA,aAAa,GAAG;EAC3BC,OAAO,EAAE,kCAAkC;EAE3CC,MAAM,EAAE,QAAQ;EAChBC,gBAAgB,EAAE,yBAAyB;EAE3CC,cAAc,EAAE,WAAW;EAC3BC,qBAAqB,EAAE,SAAS;EAEhCC,sBAAsB,EAAE,+BAA+B;EACvDC,8BAA8B,EAAE,uCAAuC;EACvEC,aAAa,EAAE,iCAAiC;EAChDC,OAAO,EAAE,2BAA2B;EAEpCC,2BAA2B,EAAE,eAAe;EAC5CC,qBAAqB,EAAE,gBAAgB;EACvCC,iBAAiB,EAAE,YAAY;EAE/BC,oBAAoB,EAAE,kEAAkE;EAExFC,uBAAuB,EAAE;EACvB;EACA,4CAA4C;EAC5C;EACA,4CAA4C;EAC5C;EACA,4CAA4C;EAC5C;EACA,4CAA4C;EAC5C;EACA,4CAA4C;EAC5C;EACA,4CAA4C;EAC5C;EACA,4CAA4C;AAEhD,CAAC"}
|
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
import * as BigNumber from 'bignumber.js';
|
|
2
2
|
export const NumberUtil = {
|
|
3
|
-
/**
|
|
4
|
-
* Creates a BigNumber instance from a given value.
|
|
5
|
-
* If the value is a string, commas are removed before conversion.
|
|
6
|
-
* @param value - The input value (string, number, or BigNumber) to convert to a BigNumber.
|
|
7
|
-
* @returns A BigNumber instance.
|
|
8
|
-
*/
|
|
9
3
|
bigNumber(value) {
|
|
10
4
|
if (typeof value === 'string') {
|
|
11
5
|
return new BigNumber.BigNumber(value.replace(/,/g, ''));
|
|
@@ -13,11 +7,10 @@ export const NumberUtil = {
|
|
|
13
7
|
return new BigNumber.BigNumber(value);
|
|
14
8
|
},
|
|
15
9
|
/**
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
* @param
|
|
19
|
-
* @
|
|
20
|
-
* @returns The product as a BigNumber instance, or BigNumber(0) if either input is undefined.
|
|
10
|
+
* Multiply two numbers represented as strings with BigNumber to handle decimals correctly
|
|
11
|
+
* @param a string
|
|
12
|
+
* @param b string
|
|
13
|
+
* @returns
|
|
21
14
|
*/
|
|
22
15
|
multiply(a, b) {
|
|
23
16
|
if (a === undefined || b === undefined) {
|
|
@@ -27,32 +20,19 @@ export const NumberUtil = {
|
|
|
27
20
|
const bBigNumber = new BigNumber.BigNumber(typeof b === 'string' ? b.replace(/,/gu, '') : b);
|
|
28
21
|
return aBigNumber.multipliedBy(bBigNumber);
|
|
29
22
|
},
|
|
30
|
-
/**
|
|
31
|
-
* Rounds a number to a specified number of decimal places if its string representation meets a certain length threshold.
|
|
32
|
-
* @param number - The number to potentially round.
|
|
33
|
-
* @param threshold - The minimum string length of the number to trigger rounding.
|
|
34
|
-
* @param fixed - The number of decimal places to round to.
|
|
35
|
-
* @returns The rounded number (as a string if rounded, otherwise the original number) or the original number.
|
|
36
|
-
*/
|
|
37
23
|
roundNumber(number, threshold, fixed) {
|
|
38
24
|
const roundedNumber = number.toString().length >= threshold ? Number(number).toFixed(fixed) : number;
|
|
39
25
|
return roundedNumber;
|
|
40
26
|
},
|
|
41
|
-
/**
|
|
42
|
-
* Calculates the next multiple of ten greater than or equal to the given amount.
|
|
43
|
-
* Defaults to 10 if no amount is provided or if the calculated multiple is less than 10.
|
|
44
|
-
* @param amount - The number for which to find the next multiple of ten. Optional.
|
|
45
|
-
* @returns The next multiple of ten, at least 10.
|
|
46
|
-
*/
|
|
47
27
|
nextMultipleOfTen(amount) {
|
|
48
28
|
if (!amount) return 10;
|
|
49
29
|
return Math.max(Math.ceil(amount / 10) * 10, 10);
|
|
50
30
|
},
|
|
51
31
|
/**
|
|
52
|
-
*
|
|
53
|
-
* @param value - The value to format
|
|
54
|
-
* @param decimals -
|
|
55
|
-
* @returns
|
|
32
|
+
* Format the given number or string to human readable numbers with the given number of decimals
|
|
33
|
+
* @param value - The value to format. It could be a number or string. If it's a string, it will be parsed to a float then formatted.
|
|
34
|
+
* @param decimals - number of decimals after dot
|
|
35
|
+
* @returns
|
|
56
36
|
*/
|
|
57
37
|
formatNumberToLocalString(value, decimals = 2) {
|
|
58
38
|
if (value === undefined) {
|
|
@@ -70,9 +50,9 @@ export const NumberUtil = {
|
|
|
70
50
|
});
|
|
71
51
|
},
|
|
72
52
|
/**
|
|
73
|
-
*
|
|
74
|
-
* @param value - The formatted string to parse
|
|
75
|
-
* @returns
|
|
53
|
+
* Parse a formatted local string back to a number
|
|
54
|
+
* @param value - The formatted string to parse
|
|
55
|
+
* @returns
|
|
76
56
|
*/
|
|
77
57
|
parseLocalStringToNumber(value) {
|
|
78
58
|
if (value === undefined) {
|
|
@@ -81,27 +61,6 @@ export const NumberUtil = {
|
|
|
81
61
|
|
|
82
62
|
// Remove any commas used as thousand separators and parse the float
|
|
83
63
|
return parseFloat(value.replace(/,/gu, ''));
|
|
84
|
-
},
|
|
85
|
-
/**
|
|
86
|
-
* Converts a numeric value (BigInt, number, or string representation of a number) to a 0x-prefixed hexadecimal string.
|
|
87
|
-
* This is often required for Ethereum RPC parameters like value, gas, gasPrice.
|
|
88
|
-
* @param value - The value to convert. Can be BigInt, number, or a string (decimal or hex).
|
|
89
|
-
* @returns A 0x-prefixed hexadecimal string, or undefined if the input is undefined or null.
|
|
90
|
-
* @throws Error if the value cannot be converted to BigInt.
|
|
91
|
-
*/
|
|
92
|
-
convertNumericToHexString: value => {
|
|
93
|
-
if (value === undefined || value === null) {
|
|
94
|
-
return undefined;
|
|
95
|
-
}
|
|
96
|
-
try {
|
|
97
|
-
// This handles BigInt, number, or string representation of a number (decimal or hex)
|
|
98
|
-
const bigIntValue = BigInt(value);
|
|
99
|
-
// Ethereum RPC spec requires "0x0" for zero, and other values to be 0x-prefixed hex.
|
|
100
|
-
|
|
101
|
-
return '0x' + bigIntValue.toString(16);
|
|
102
|
-
} catch (error) {
|
|
103
|
-
throw new Error(`NumberUtil: Invalid parameter, cannot convert to hex: ${value}`);
|
|
104
|
-
}
|
|
105
64
|
}
|
|
106
65
|
};
|
|
107
66
|
//# sourceMappingURL=NumberUtil.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["BigNumber","NumberUtil","bigNumber","value","replace","multiply","a","b","undefined","aBigNumber","bBigNumber","multipliedBy","roundNumber","number","threshold","fixed","roundedNumber","toString","length","Number","toFixed","nextMultipleOfTen","amount","Math","max","ceil","formatNumberToLocalString","decimals","toLocaleString","maximumFractionDigits","minimumFractionDigits","parseFloat","parseLocalStringToNumber"
|
|
1
|
+
{"version":3,"names":["BigNumber","NumberUtil","bigNumber","value","replace","multiply","a","b","undefined","aBigNumber","bBigNumber","multipliedBy","roundNumber","number","threshold","fixed","roundedNumber","toString","length","Number","toFixed","nextMultipleOfTen","amount","Math","max","ceil","formatNumberToLocalString","decimals","toLocaleString","maximumFractionDigits","minimumFractionDigits","parseFloat","parseLocalStringToNumber"],"sourceRoot":"../../../src","sources":["utils/NumberUtil.ts"],"mappings":"AAAA,OAAO,KAAKA,SAAS,MAAM,cAAc;AAEzC,OAAO,MAAMC,UAAU,GAAG;EACxBC,SAASA,CAACC,KAAgC,EAAE;IAC1C,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;MAC7B,OAAO,IAAIH,SAAS,CAACA,SAAS,CAACG,KAAK,CAACC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IACzD;IAEA,OAAO,IAAIJ,SAAS,CAACA,SAAS,CAACG,KAAK,CAAC;EACvC,CAAC;EAED;AACF;AACA;AACA;AACA;AACA;EACEE,QAAQA,CAACC,CAAwC,EAAEC,CAAwC,EAAE;IAC3F,IAAID,CAAC,KAAKE,SAAS,IAAID,CAAC,KAAKC,SAAS,EAAE;MACtC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