@fileverse-dev/formulajs 4.4.11-mod-21-patch-1 → 4.4.11-mod-21-patch-3
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/browser/formula.js +174 -4
- package/lib/browser/formula.min.js +2 -2
- package/lib/browser/formula.min.js.map +1 -1
- package/lib/cjs/index.cjs +77 -32
- package/lib/esm/crypto-constants.mjs +42 -1
- package/lib/esm/index.mjs +77 -33
- package/package.json +1 -1
- package/types/cjs/index.d.cts +2 -1
- package/types/esm/index.d.mts +2 -1
package/lib/browser/formula.js
CHANGED
|
@@ -1,4 +1,26 @@
|
|
|
1
|
-
/* @fileverse-dev/formulajs v4.4.11-mod-21-patch-
|
|
1
|
+
/* @fileverse-dev/formulajs v4.4.11-mod-21-patch-3 */
|
|
2
|
+
var _excluded = [ "confirmations", "dataDecoded" ];
|
|
3
|
+
|
|
4
|
+
function _objectWithoutProperties(e, t) {
|
|
5
|
+
if (null == e) return {};
|
|
6
|
+
var o, r, i = _objectWithoutPropertiesLoose(e, t);
|
|
7
|
+
if (Object.getOwnPropertySymbols) {
|
|
8
|
+
var n = Object.getOwnPropertySymbols(e);
|
|
9
|
+
for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
|
|
10
|
+
}
|
|
11
|
+
return i;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function _objectWithoutPropertiesLoose(r, e) {
|
|
15
|
+
if (null == r) return {};
|
|
16
|
+
var t = {};
|
|
17
|
+
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
18
|
+
if (-1 !== e.indexOf(n)) continue;
|
|
19
|
+
t[n] = r[n];
|
|
20
|
+
}
|
|
21
|
+
return t;
|
|
22
|
+
}
|
|
23
|
+
|
|
2
24
|
function _regeneratorRuntime() {
|
|
3
25
|
"use strict";
|
|
4
26
|
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() {
|
|
@@ -10806,13 +10828,18 @@ function _typeof(o) {
|
|
|
10806
10828
|
}
|
|
10807
10829
|
var SERVICE_API_KEY = {
|
|
10808
10830
|
Etherscan: "ETHERSCAN_API_KEY",
|
|
10809
|
-
Coingecko: "COINGECKO_API_KEY"
|
|
10831
|
+
Coingecko: "COINGECKO_API_KEY",
|
|
10832
|
+
Safe: "SAFE_API_KEY"
|
|
10810
10833
|
};
|
|
10811
10834
|
var CHAIN_ID_MAP = {
|
|
10812
10835
|
ethereum: 1,
|
|
10813
10836
|
gnosis: 100,
|
|
10814
10837
|
base: 8453
|
|
10815
10838
|
};
|
|
10839
|
+
var SAFE_CHAIN_MAP = {
|
|
10840
|
+
ethereum: "eth",
|
|
10841
|
+
gnosis: "gno"
|
|
10842
|
+
};
|
|
10816
10843
|
var ERROR_MESSAGES_FLAG = {
|
|
10817
10844
|
INVALID_API_KEY: "_MISSING",
|
|
10818
10845
|
RATE_LIMIT: "_RATE_LIMIT_REACHED",
|
|
@@ -10860,16 +10887,63 @@ function _typeof(o) {
|
|
|
10860
10887
|
}
|
|
10861
10888
|
function _ETHERSCAN() {
|
|
10862
10889
|
_ETHERSCAN = _asyncToGenerator(_regeneratorRuntime().mark((function _callee2(address, page, offset) {
|
|
10890
|
+
var API_KEY, url, response, json;
|
|
10863
10891
|
return _regeneratorRuntime().wrap((function _callee2$(_context2) {
|
|
10864
10892
|
while (1) switch (_context2.prev = _context2.next) {
|
|
10865
10893
|
case 0:
|
|
10894
|
+
API_KEY = window.localStorage.getItem(SERVICE_API_KEY.Etherscan);
|
|
10895
|
+
if (!(API_KEY === "xxxx")) {
|
|
10896
|
+
_context2.next = 3;
|
|
10897
|
+
break;
|
|
10898
|
+
}
|
|
10866
10899
|
return _context2.abrupt("return", "".concat(SERVICE_API_KEY.Etherscan).concat(ERROR_MESSAGES_FLAG.RATE_LIMIT));
|
|
10867
10900
|
|
|
10868
|
-
case
|
|
10901
|
+
case 3:
|
|
10902
|
+
url = "https://api.etherscan.io/v2/api?chainid=1&module=account&action=txlist&address=".concat(address, "&startblock=0&endblock=99999999&page=").concat(page || 1, "&offset=").concat(offset || 10, "&sort=asc&apikey=").concat(API_KEY);
|
|
10903
|
+
_context2.prev = 4;
|
|
10904
|
+
_context2.next = 7;
|
|
10905
|
+
return fetch(url);
|
|
10906
|
+
|
|
10907
|
+
case 7:
|
|
10908
|
+
response = _context2.sent;
|
|
10909
|
+
if (response.ok) {
|
|
10910
|
+
_context2.next = 10;
|
|
10911
|
+
break;
|
|
10912
|
+
}
|
|
10913
|
+
throw new Error("HTTP error! Status: ".concat(response.status));
|
|
10914
|
+
|
|
10915
|
+
case 10:
|
|
10916
|
+
_context2.next = 12;
|
|
10917
|
+
return response.json();
|
|
10918
|
+
|
|
10919
|
+
case 12:
|
|
10920
|
+
json = _context2.sent;
|
|
10921
|
+
if (!json.result.includes("Invalid API Key")) {
|
|
10922
|
+
_context2.next = 15;
|
|
10923
|
+
break;
|
|
10924
|
+
}
|
|
10925
|
+
return _context2.abrupt("return", "".concat(SERVICE_API_KEY.Etherscan).concat(ERROR_MESSAGES_FLAG.INVALID_API_KEY));
|
|
10926
|
+
|
|
10927
|
+
case 15:
|
|
10928
|
+
if (!json.result.includes("Max rate limit reached")) {
|
|
10929
|
+
_context2.next = 17;
|
|
10930
|
+
break;
|
|
10931
|
+
}
|
|
10932
|
+
return _context2.abrupt("return", "".concat(SERVICE_API_KEY.Etherscan).concat(ERROR_MESSAGES_FLAG.RATE_LIMIT));
|
|
10933
|
+
|
|
10934
|
+
case 17:
|
|
10935
|
+
return _context2.abrupt("return", json.result);
|
|
10936
|
+
|
|
10937
|
+
case 20:
|
|
10938
|
+
_context2.prev = 20;
|
|
10939
|
+
_context2.t0 = _context2["catch"](4);
|
|
10940
|
+
return _context2.abrupt("return", ERROR_MESSAGES_FLAG.DEFAULT);
|
|
10941
|
+
|
|
10942
|
+
case 23:
|
|
10869
10943
|
case "end":
|
|
10870
10944
|
return _context2.stop();
|
|
10871
10945
|
}
|
|
10872
|
-
}), _callee2);
|
|
10946
|
+
}), _callee2, null, [ [ 4, 20 ] ]);
|
|
10873
10947
|
})));
|
|
10874
10948
|
return _ETHERSCAN.apply(this, arguments);
|
|
10875
10949
|
}
|
|
@@ -11083,6 +11157,101 @@ function _typeof(o) {
|
|
|
11083
11157
|
})));
|
|
11084
11158
|
return _FLVURL.apply(this, arguments);
|
|
11085
11159
|
}
|
|
11160
|
+
function SAFE(_x14, _x15, _x16, _x17, _x18) {
|
|
11161
|
+
return _SAFE.apply(this, arguments);
|
|
11162
|
+
}
|
|
11163
|
+
function _SAFE() {
|
|
11164
|
+
_SAFE = _asyncToGenerator(_regeneratorRuntime().mark((function _callee6(address, utility, chain, limit, offset) {
|
|
11165
|
+
var apiKey, chainIdentifier, url, response, json;
|
|
11166
|
+
return _regeneratorRuntime().wrap((function _callee6$(_context6) {
|
|
11167
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
11168
|
+
case 0:
|
|
11169
|
+
if (!(typeof limit !== "number" || limit < 0)) {
|
|
11170
|
+
_context6.next = 2;
|
|
11171
|
+
break;
|
|
11172
|
+
}
|
|
11173
|
+
return _context6.abrupt("return", "INVALID_LIMIT");
|
|
11174
|
+
|
|
11175
|
+
case 2:
|
|
11176
|
+
if (!(typeof offset !== "number" || offset < 0)) {
|
|
11177
|
+
_context6.next = 4;
|
|
11178
|
+
break;
|
|
11179
|
+
}
|
|
11180
|
+
return _context6.abrupt("return", "INVALID_OFFSET");
|
|
11181
|
+
|
|
11182
|
+
case 4:
|
|
11183
|
+
if (!(utility !== "txns")) {
|
|
11184
|
+
_context6.next = 6;
|
|
11185
|
+
break;
|
|
11186
|
+
}
|
|
11187
|
+
return _context6.abrupt("return", "UTILITY IS NOT SUPPORTED");
|
|
11188
|
+
|
|
11189
|
+
case 6:
|
|
11190
|
+
apiKey = window.localStorage.getItem(SERVICE_API_KEY.Safe);
|
|
11191
|
+
chainIdentifier = SAFE_CHAIN_MAP[chain];
|
|
11192
|
+
if (apiKey) {
|
|
11193
|
+
_context6.next = 10;
|
|
11194
|
+
break;
|
|
11195
|
+
}
|
|
11196
|
+
return _context6.abrupt("return", "".concat(SERVICE_API_KEY.Safe, "_MISSING"));
|
|
11197
|
+
|
|
11198
|
+
case 10:
|
|
11199
|
+
if (chainIdentifier) {
|
|
11200
|
+
_context6.next = 12;
|
|
11201
|
+
break;
|
|
11202
|
+
}
|
|
11203
|
+
return _context6.abrupt("return", "CHAIN IS NOT SUPPORTED");
|
|
11204
|
+
|
|
11205
|
+
case 12:
|
|
11206
|
+
url = "https://api.safe.global/tx-service/".concat(chainIdentifier, "/api/v2/safes/").concat(address, "/multisig-transactions?limit=").concat(limit, "&offset=").concat(offset);
|
|
11207
|
+
_context6.prev = 13;
|
|
11208
|
+
_context6.next = 16;
|
|
11209
|
+
return fetch(url, {
|
|
11210
|
+
headers: {
|
|
11211
|
+
Authorization: "Bearer ".concat(apiKey)
|
|
11212
|
+
}
|
|
11213
|
+
});
|
|
11214
|
+
|
|
11215
|
+
case 16:
|
|
11216
|
+
response = _context6.sent;
|
|
11217
|
+
if (response.ok) {
|
|
11218
|
+
_context6.next = 19;
|
|
11219
|
+
break;
|
|
11220
|
+
}
|
|
11221
|
+
throw new Error("HTTP error! Status: ".concat(response.status));
|
|
11222
|
+
|
|
11223
|
+
case 19:
|
|
11224
|
+
_context6.next = 21;
|
|
11225
|
+
return response.json();
|
|
11226
|
+
|
|
11227
|
+
case 21:
|
|
11228
|
+
json = _context6.sent;
|
|
11229
|
+
if (Array.isArray(json.results)) {
|
|
11230
|
+
_context6.next = 24;
|
|
11231
|
+
break;
|
|
11232
|
+
}
|
|
11233
|
+
return _context6.abrupt("return", "INVALID API RESPONSE");
|
|
11234
|
+
|
|
11235
|
+
case 24:
|
|
11236
|
+
return _context6.abrupt("return", json.results.map((function(_ref2) {
|
|
11237
|
+
var confirmations = _ref2.confirmations, dataDecoded = _ref2.dataDecoded, rest = _objectWithoutProperties(_ref2, _excluded);
|
|
11238
|
+
return rest;
|
|
11239
|
+
})));
|
|
11240
|
+
|
|
11241
|
+
case 27:
|
|
11242
|
+
_context6.prev = 27;
|
|
11243
|
+
_context6.t0 = _context6["catch"](13);
|
|
11244
|
+
console.log(_context6.t0);
|
|
11245
|
+
return _context6.abrupt("return", "ERROR IN FETCHING");
|
|
11246
|
+
|
|
11247
|
+
case 31:
|
|
11248
|
+
case "end":
|
|
11249
|
+
return _context6.stop();
|
|
11250
|
+
}
|
|
11251
|
+
}), _callee6, null, [ [ 13, 27 ] ]);
|
|
11252
|
+
})));
|
|
11253
|
+
return _SAFE.apply(this, arguments);
|
|
11254
|
+
}
|
|
11086
11255
|
var utils = {
|
|
11087
11256
|
errors: errors,
|
|
11088
11257
|
symbols: symbols,
|
|
@@ -11405,6 +11574,7 @@ function _typeof(o) {
|
|
|
11405
11574
|
exports.ROWS = ROWS;
|
|
11406
11575
|
exports.RRI = RRI;
|
|
11407
11576
|
exports.RSQ = RSQ;
|
|
11577
|
+
exports.SAFE = SAFE;
|
|
11408
11578
|
exports.SEARCH = SEARCH;
|
|
11409
11579
|
exports.SEC = SEC;
|
|
11410
11580
|
exports.SECH = SECH;
|