@fileverse-dev/formulajs 4.4.11-mod-21-patch-2 → 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.
@@ -1,4 +1,4 @@
1
- /* @fileverse-dev/formulajs v4.4.11-mod-21-patch-2 */
1
+ /* @fileverse-dev/formulajs v4.4.11-mod-21-patch-3 */
2
2
  var _excluded = [ "confirmations", "dataDecoded" ];
3
3
 
4
4
  function _objectWithoutProperties(e, t) {
@@ -10887,16 +10887,63 @@ function _typeof(o) {
10887
10887
  }
10888
10888
  function _ETHERSCAN() {
10889
10889
  _ETHERSCAN = _asyncToGenerator(_regeneratorRuntime().mark((function _callee2(address, page, offset) {
10890
+ var API_KEY, url, response, json;
10890
10891
  return _regeneratorRuntime().wrap((function _callee2$(_context2) {
10891
10892
  while (1) switch (_context2.prev = _context2.next) {
10892
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
+ }
10893
10899
  return _context2.abrupt("return", "".concat(SERVICE_API_KEY.Etherscan).concat(ERROR_MESSAGES_FLAG.RATE_LIMIT));
10894
10900
 
10895
- case 1:
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:
10896
10943
  case "end":
10897
10944
  return _context2.stop();
10898
10945
  }
10899
- }), _callee2);
10946
+ }), _callee2, null, [ [ 4, 20 ] ]);
10900
10947
  })));
10901
10948
  return _ETHERSCAN.apply(this, arguments);
10902
10949
  }