@fileverse-dev/formulajs 4.4.11-mod-8 → 4.4.11-mod-9
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 +30 -30
- package/lib/browser/formula.min.js +2 -2
- package/lib/browser/formula.min.js.map +1 -1
- package/lib/cjs/index.cjs +59 -61
- package/lib/esm/index.mjs +59 -61
- package/package.json +1 -1
- package/types/cjs/index.d.cts +1 -1
- package/types/esm/index.d.mts +1 -1
package/lib/browser/formula.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* @fileverse-dev/formulajs v4.4.11-mod-
|
|
1
|
+
/* @fileverse-dev/formulajs v4.4.11-mod-9 */
|
|
2
2
|
function _slicedToArray(r, e) {
|
|
3
3
|
return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
|
|
4
4
|
}
|
|
@@ -10716,65 +10716,68 @@ function _typeof(o) {
|
|
|
10716
10716
|
while (1) switch (_context.prev = _context.next) {
|
|
10717
10717
|
case 0:
|
|
10718
10718
|
API_KEY = window.localStorage.getItem(SERVICE_API_KEY.Etherscan);
|
|
10719
|
-
console.log("FORMULA JS API KEY ETHERSCAN NOT FOUND", API_KEY);
|
|
10720
10719
|
url = "https://api.etherscan.io/api?module=account&action=txlist&address=".concat(address, "&startblock=0&endblock=99999999&page=").concat(page, "&offset=").concat(offset, "&sort=asc&apikey=").concat(API_KEY);
|
|
10721
|
-
_context.prev =
|
|
10722
|
-
_context.next =
|
|
10720
|
+
_context.prev = 2;
|
|
10721
|
+
_context.next = 5;
|
|
10723
10722
|
return fetch(url);
|
|
10724
10723
|
|
|
10725
|
-
case
|
|
10724
|
+
case 5:
|
|
10726
10725
|
response = _context.sent;
|
|
10727
10726
|
if (response.ok) {
|
|
10728
|
-
_context.next =
|
|
10727
|
+
_context.next = 8;
|
|
10729
10728
|
break;
|
|
10730
10729
|
}
|
|
10731
10730
|
throw new Error("HTTP error! Status: ".concat(response.status));
|
|
10732
10731
|
|
|
10733
|
-
case
|
|
10734
|
-
_context.next =
|
|
10732
|
+
case 8:
|
|
10733
|
+
_context.next = 10;
|
|
10735
10734
|
return response.json();
|
|
10736
10735
|
|
|
10737
|
-
case
|
|
10736
|
+
case 10:
|
|
10738
10737
|
json = _context.sent;
|
|
10739
|
-
console.log(json.result);
|
|
10740
10738
|
if (!json.result.includes("Invalid API Key")) {
|
|
10741
|
-
_context.next =
|
|
10739
|
+
_context.next = 13;
|
|
10742
10740
|
break;
|
|
10743
10741
|
}
|
|
10744
10742
|
return _context.abrupt("return", "".concat(SERVICE_API_KEY.Etherscan, "_MISSING"));
|
|
10745
10743
|
|
|
10746
|
-
case
|
|
10744
|
+
case 13:
|
|
10747
10745
|
return _context.abrupt("return", json.result);
|
|
10748
10746
|
|
|
10749
|
-
case
|
|
10750
|
-
_context.prev =
|
|
10751
|
-
_context.t0 = _context["catch"](
|
|
10752
|
-
console.error("API call failed:", _context.t0);
|
|
10747
|
+
case 16:
|
|
10748
|
+
_context.prev = 16;
|
|
10749
|
+
_context.t0 = _context["catch"](2);
|
|
10753
10750
|
return _context.abrupt("return", "ERROR IN FETCHING");
|
|
10754
10751
|
|
|
10755
|
-
case
|
|
10752
|
+
case 19:
|
|
10756
10753
|
case "end":
|
|
10757
10754
|
return _context.stop();
|
|
10758
10755
|
}
|
|
10759
|
-
}), _callee, null, [ [
|
|
10756
|
+
}), _callee, null, [ [ 2, 16 ] ]);
|
|
10760
10757
|
})));
|
|
10761
10758
|
return _GETTXLIST.apply(this, arguments);
|
|
10762
10759
|
}
|
|
10763
|
-
function GETPRICE(_x4, _x5
|
|
10760
|
+
function GETPRICE(_x4, _x5) {
|
|
10764
10761
|
return _GETPRICE.apply(this, arguments);
|
|
10765
10762
|
}
|
|
10766
10763
|
function _GETPRICE() {
|
|
10767
|
-
_GETPRICE = _asyncToGenerator(_regeneratorRuntime().mark((function _callee2(token, vs_currencies
|
|
10768
|
-
var API_KEY, url, response, jsonResponse, output, _i0, _Object$entries, _Object$entries$_i, coin, prices, _i1, _Object$entries2, _Object$entries2$_i, currency, _value5, key;
|
|
10764
|
+
_GETPRICE = _asyncToGenerator(_regeneratorRuntime().mark((function _callee2(token, vs_currencies) {
|
|
10765
|
+
var API_KEY, url, options, response, jsonResponse, output, _i0, _Object$entries, _Object$entries$_i, coin, prices, _i1, _Object$entries2, _Object$entries2$_i, currency, _value5, key;
|
|
10769
10766
|
return _regeneratorRuntime().wrap((function _callee2$(_context2) {
|
|
10770
10767
|
while (1) switch (_context2.prev = _context2.next) {
|
|
10771
10768
|
case 0:
|
|
10772
10769
|
API_KEY = window.localStorage.getItem(SERVICE_API_KEY.Coingecko);
|
|
10773
|
-
console.log("FORMULA JS API KEY ETHERSCAN NOT FOUND", API_KEY);
|
|
10774
10770
|
url = "https://api.coingecko.com/api/v3/simple/price?vs_currencies=".concat(vs_currencies, "&ids=").concat(token);
|
|
10771
|
+
options = {
|
|
10772
|
+
method: "GET",
|
|
10773
|
+
headers: {
|
|
10774
|
+
accept: "application/json",
|
|
10775
|
+
"x-cg-demo-api-key": "".concat(API_KEY)
|
|
10776
|
+
}
|
|
10777
|
+
};
|
|
10775
10778
|
_context2.prev = 3;
|
|
10776
10779
|
_context2.next = 6;
|
|
10777
|
-
return fetch(url);
|
|
10780
|
+
return fetch(url, options);
|
|
10778
10781
|
|
|
10779
10782
|
case 6:
|
|
10780
10783
|
response = _context2.sent;
|
|
@@ -10790,7 +10793,6 @@ function _typeof(o) {
|
|
|
10790
10793
|
|
|
10791
10794
|
case 11:
|
|
10792
10795
|
jsonResponse = _context2.sent;
|
|
10793
|
-
console.log(jsonResponse);
|
|
10794
10796
|
output = {};
|
|
10795
10797
|
for (_i0 = 0, _Object$entries = Object.entries(jsonResponse); _i0 < _Object$entries.length; _i0++) {
|
|
10796
10798
|
_Object$entries$_i = _slicedToArray(_Object$entries[_i0], 2), coin = _Object$entries$_i[0],
|
|
@@ -10802,20 +10804,18 @@ function _typeof(o) {
|
|
|
10802
10804
|
output[key] = _value5;
|
|
10803
10805
|
}
|
|
10804
10806
|
}
|
|
10805
|
-
console.log([ output ]);
|
|
10806
10807
|
return _context2.abrupt("return", [ output ]);
|
|
10807
10808
|
|
|
10808
|
-
case
|
|
10809
|
-
_context2.prev =
|
|
10809
|
+
case 17:
|
|
10810
|
+
_context2.prev = 17;
|
|
10810
10811
|
_context2.t0 = _context2["catch"](3);
|
|
10811
|
-
console.error("API call failed:", _context2.t0);
|
|
10812
10812
|
return _context2.abrupt("return", "ERROR IN FETCHING");
|
|
10813
10813
|
|
|
10814
|
-
case
|
|
10814
|
+
case 20:
|
|
10815
10815
|
case "end":
|
|
10816
10816
|
return _context2.stop();
|
|
10817
10817
|
}
|
|
10818
|
-
}), _callee2, null, [ [ 3,
|
|
10818
|
+
}), _callee2, null, [ [ 3, 17 ] ]);
|
|
10819
10819
|
})));
|
|
10820
10820
|
return _GETPRICE.apply(this, arguments);
|
|
10821
10821
|
}
|