@fileverse-dev/formulajs 4.4.11-mod-14 → 4.4.11-mod-15

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-14 */
1
+ /* @fileverse-dev/formulajs v4.4.11-mod-15 */
2
2
  function _slicedToArray(r, e) {
3
3
  return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
4
4
  }
@@ -10704,7 +10704,9 @@ function _typeof(o) {
10704
10704
  }
10705
10705
  var SERVICE_API_KEY = {
10706
10706
  Etherscan: "ETHERSCAN_API_KEY",
10707
- Coingecko: "COINGECKO_API_KEY"
10707
+ Coingecko: "COINGECKO_API_KEY",
10708
+ Gnosisscan: "GNOSISSSCAN",
10709
+ BASESCAN: "Basescan"
10708
10710
  };
10709
10711
  function ETHERSCAN(_x, _x2, _x3) {
10710
10712
  return _ETHERSCAN.apply(this, arguments);
@@ -10828,15 +10830,127 @@ function _typeof(o) {
10828
10830
  })));
10829
10831
  return _GETPRICE.apply(this, arguments);
10830
10832
  }
10831
- function FLVURL(_x6, _x7) {
10833
+ function OX(_x6, _x7, _x8, _x9, _x0) {
10834
+ return _OX.apply(this, arguments);
10835
+ }
10836
+ function _OX() {
10837
+ _OX = _asyncToGenerator(_regeneratorRuntime().mark((function _callee4(address, categories, chain, startTime, endTime) {
10838
+ var API_KEYS, CHAIN_API_BASE, apiKey, baseUrl, timeToBlock, startBlock, endBlock, action, url, _json$result, _json$result$includes, response, json;
10839
+ return _regeneratorRuntime().wrap((function _callee4$(_context4) {
10840
+ while (1) switch (_context4.prev = _context4.next) {
10841
+ case 0:
10842
+ API_KEYS = {
10843
+ ethereum: window.localStorage.getItem(SERVICE_API_KEY.Etherscan),
10844
+ gnosis: window.localStorage.getItem(SERVICE_API_KEY.Gnosisscan),
10845
+ base: window.localStorage.getItem(SERVICE_API_KEY.Basescan)
10846
+ };
10847
+ CHAIN_API_BASE = {
10848
+ ethereum: "https://api.etherscan.io/api",
10849
+ gnosis: "https://api.gnosisscan.io/api",
10850
+ base: "https://api.basescan.org/api"
10851
+ };
10852
+ apiKey = API_KEYS[chain];
10853
+ baseUrl = CHAIN_API_BASE[chain];
10854
+ timeToBlock = function() {
10855
+ var _ref = _asyncToGenerator(_regeneratorRuntime().mark((function _callee3(timestamp) {
10856
+ var _url, res, json;
10857
+ return _regeneratorRuntime().wrap((function _callee3$(_context3) {
10858
+ while (1) switch (_context3.prev = _context3.next) {
10859
+ case 0:
10860
+ _context3.prev = 0;
10861
+ _url = "".concat(baseUrl, "?module=block&action=getblocknobytime&timestamp=").concat(timestamp, "&closest=before&apikey=").concat(apiKey);
10862
+ _context3.next = 4;
10863
+ return fetch(_url);
10864
+
10865
+ case 4:
10866
+ res = _context3.sent;
10867
+ _context3.next = 7;
10868
+ return res.json();
10869
+
10870
+ case 7:
10871
+ json = _context3.sent;
10872
+ return _context3.abrupt("return", parseInt(json.result));
10873
+
10874
+ case 11:
10875
+ _context3.prev = 11;
10876
+ _context3.t0 = _context3["catch"](0);
10877
+ return _context3.abrupt("return", 0);
10878
+
10879
+ case 14:
10880
+ case "end":
10881
+ return _context3.stop();
10882
+ }
10883
+ }), _callee3, null, [ [ 0, 11 ] ]);
10884
+ })));
10885
+ return function timeToBlock(_x11) {
10886
+ return _ref.apply(this, arguments);
10887
+ };
10888
+ }();
10889
+ _context4.next = 7;
10890
+ return timeToBlock(startTime);
10891
+
10892
+ case 7:
10893
+ startBlock = _context4.sent;
10894
+ _context4.next = 10;
10895
+ return timeToBlock(endTime);
10896
+
10897
+ case 10:
10898
+ endBlock = _context4.sent;
10899
+ action = "";
10900
+ if (categories === "txns") action = "txlist"; else if (categories === "balances") action = "balance"; else if (categories === "portfolio") action = "tokentx";
10901
+ url = "".concat(baseUrl, "?module=account&action=").concat(action, "&address=").concat(address, "&startblock=").concat(startBlock, "&endblock=").concat(endBlock, "&sort=asc&apikey=").concat(apiKey);
10902
+ _context4.prev = 14;
10903
+ _context4.next = 17;
10904
+ return fetch(url);
10905
+
10906
+ case 17:
10907
+ response = _context4.sent;
10908
+ if (response.ok) {
10909
+ _context4.next = 20;
10910
+ break;
10911
+ }
10912
+ throw new Error("HTTP error! Status: ".concat(response.status));
10913
+
10914
+ case 20:
10915
+ _context4.next = 22;
10916
+ return response.json();
10917
+
10918
+ case 22:
10919
+ json = _context4.sent;
10920
+ if (!((_json$result = json.result) !== null && _json$result !== void 0 && (_json$result$includes = _json$result.includes) !== null && _json$result$includes !== void 0 && _json$result$includes.call(_json$result, "Invalid API Key"))) {
10921
+ _context4.next = 25;
10922
+ break;
10923
+ }
10924
+ return _context4.abrupt("return", "".concat(SERVICE_API_KEY[chain.charAt(0).toUpperCase() + chain.slice(1)], "_MISSING"));
10925
+
10926
+ case 25:
10927
+ console.log({
10928
+ ANSWER: json.result
10929
+ });
10930
+ return _context4.abrupt("return", json.result);
10931
+
10932
+ case 29:
10933
+ _context4.prev = 29;
10934
+ _context4.t0 = _context4["catch"](14);
10935
+ return _context4.abrupt("return", "ERROR IN FETCHING");
10936
+
10937
+ case 32:
10938
+ case "end":
10939
+ return _context4.stop();
10940
+ }
10941
+ }), _callee4, null, [ [ 14, 29 ] ]);
10942
+ })));
10943
+ return _OX.apply(this, arguments);
10944
+ }
10945
+ function FLVURL(_x1, _x10) {
10832
10946
  return _FLVURL.apply(this, arguments);
10833
10947
  }
10834
10948
  function _FLVURL() {
10835
- _FLVURL = _asyncToGenerator(_regeneratorRuntime().mark((function _callee3(token, vs_currencies) {
10836
- return _regeneratorRuntime().wrap((function _callee3$(_context3) {
10837
- while (1) switch (_context3.prev = _context3.next) {
10949
+ _FLVURL = _asyncToGenerator(_regeneratorRuntime().mark((function _callee5(token, vs_currencies) {
10950
+ return _regeneratorRuntime().wrap((function _callee5$(_context5) {
10951
+ while (1) switch (_context5.prev = _context5.next) {
10838
10952
  case 0:
10839
- return _context3.abrupt("return", new Promise((function(resolve) {
10953
+ return _context5.abrupt("return", new Promise((function(resolve) {
10840
10954
  setTimeout((function() {
10841
10955
  resolve([ {
10842
10956
  Yoo: "gotcha"
@@ -10846,9 +10960,9 @@ function _typeof(o) {
10846
10960
 
10847
10961
  case 1:
10848
10962
  case "end":
10849
- return _context3.stop();
10963
+ return _context5.stop();
10850
10964
  }
10851
- }), _callee3);
10965
+ }), _callee5);
10852
10966
  })));
10853
10967
  return _FLVURL.apply(this, arguments);
10854
10968
  }
@@ -11126,6 +11240,7 @@ function _typeof(o) {
11126
11240
  exports.OCT2HEX = OCT2HEX;
11127
11241
  exports.ODD = ODD;
11128
11242
  exports.OR = OR;
11243
+ exports.OX = OX;
11129
11244
  exports.PDURATION = PDURATION;
11130
11245
  exports.PEARSON = PEARSON;
11131
11246
  exports.PERCENTILE = PERCENTILE;