@fileverse-dev/formulajs 4.4.11-mod-55 → 4.4.11-mod-56

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-55 */
1
+ /* @fileverse-dev/formulajs v4.4.11-mod-56 */
2
2
  var _excluded = [ "confirmations", "dataDecoded" ];
3
3
 
4
4
  function _objectWithoutProperties(e, t) {
@@ -11970,7 +11970,7 @@ function _typeof(o) {
11970
11970
  url = "";
11971
11971
  lowerCategory = (category || "").toLowerCase();
11972
11972
  _context11.t0 = lowerCategory;
11973
- _context11.next = _context11.t0 === "price" ? 9 : _context11.t0 === "market" ? 15 : _context11.t0 === "stablecoins" ? 25 : _context11.t0 === "derivatives" ? 29 : 32;
11973
+ _context11.next = _context11.t0 === "price" ? 9 : _context11.t0 === "market" ? 15 : _context11.t0 === "stablecoins" ? 23 : _context11.t0 === "derivatives" ? 27 : 30;
11974
11974
  break;
11975
11975
 
11976
11976
  case 9:
@@ -11984,7 +11984,7 @@ function _typeof(o) {
11984
11984
 
11985
11985
  case 13:
11986
11986
  url = "https://api.coingecko.com/api/v3/simple/price?vs_currencies=".concat(vsCurrencies ? vsCurrencies : "usd", "&symbols=").concat(token);
11987
- return _context11.abrupt("break", 33);
11987
+ return _context11.abrupt("break", 31);
11988
11988
 
11989
11989
  case 15:
11990
11990
  ecosystemMap = {
@@ -12003,71 +12003,64 @@ function _typeof(o) {
12003
12003
  categoryVal = ecosystemMap[key] || "";
12004
12004
  trend = param2 ? "&price_change_percentage=".concat(param2) : "";
12005
12005
  url = "https://api.coingecko.com/api/v3/coins/markets?vs_currency=usd&include_tokens=top&page=1&per_page=100";
12006
- if (!(key && !categoryVal)) {
12007
- _context11.next = 22;
12008
- break;
12009
- }
12010
- return _context11.abrupt("return", "".concat(SERVICE_API_KEY.Coingecko).concat(ERROR_MESSAGES_FLAG.INVALID_PARAM));
12011
-
12012
- case 22:
12013
12006
  if (categoryVal) url += "&category=".concat(categoryVal);
12014
12007
  if (trend) url += trend;
12015
- return _context11.abrupt("break", 33);
12008
+ return _context11.abrupt("break", 31);
12016
12009
 
12017
- case 25:
12010
+ case 23:
12018
12011
  _category = !param1 || param1.toLowerCase() === "all" ? "stablecoins" : param1.toLowerCase();
12019
12012
  _trend = param2 ? "&price_change_percentage=".concat(param2) : "";
12020
12013
  url = "https://api.coingecko.com/api/v3/coins/markets?vs_currency=usd&category=".concat(_category, "&order=market_cap_desc&page=1&per_page=100").concat(_trend);
12021
- return _context11.abrupt("break", 33);
12014
+ return _context11.abrupt("break", 31);
12022
12015
 
12023
- case 29:
12016
+ case 27:
12024
12017
  exchange = param1;
12025
12018
  if (!exchange || exchange === "all") {
12026
12019
  url = "https://api.coingecko.com/api/v3/derivatives";
12027
12020
  } else {
12028
12021
  url = "https://api.coingecko.com/api/v3/derivatives/exchanges/".concat(exchange, "?include_tickers=all");
12029
12022
  }
12030
- return _context11.abrupt("break", 33);
12023
+ return _context11.abrupt("break", 31);
12031
12024
 
12032
- case 32:
12025
+ case 30:
12033
12026
  return _context11.abrupt("return", "".concat(SERVICE_API_KEY.Coingecko).concat(ERROR_MESSAGES_FLAG.INVALID_PARAM));
12034
12027
 
12035
- case 33:
12036
- _context11.prev = 33;
12037
- _context11.next = 36;
12028
+ case 31:
12029
+ _context11.prev = 31;
12030
+ _context11.next = 34;
12038
12031
  return fetch(url, {
12039
12032
  method: "GET",
12040
12033
  headers: headers
12041
12034
  });
12042
12035
 
12043
- case 36:
12036
+ case 34:
12044
12037
  response = _context11.sent;
12045
- _context11.next = 39;
12038
+ _context11.next = 37;
12046
12039
  return response.json();
12047
12040
 
12048
- case 39:
12041
+ case 37:
12049
12042
  json = _context11.sent;
12050
12043
  if (response.ok) {
12051
- _context11.next = 46;
12044
+ _context11.next = 44;
12052
12045
  break;
12053
12046
  }
12054
12047
  message = (json === null || json === void 0 || (_json$status = json.status) === null || _json$status === void 0 ? void 0 : _json$status.error_message) || "";
12055
12048
  if (!message.includes("API Key Missing")) {
12056
- _context11.next = 44;
12049
+ _context11.next = 42;
12057
12050
  break;
12058
12051
  }
12059
12052
  return _context11.abrupt("return", "".concat(SERVICE_API_KEY.Coingecko).concat(ERROR_MESSAGES_FLAG.INVALID_API_KEY));
12060
12053
 
12061
- case 44:
12054
+ case 42:
12062
12055
  if (!(response.status === 429)) {
12063
- _context11.next = 46;
12056
+ _context11.next = 44;
12064
12057
  break;
12065
12058
  }
12066
12059
  return _context11.abrupt("return", "".concat(SERVICE_API_KEY.Coingecko).concat(ERROR_MESSAGES_FLAG.RATE_LIMIT));
12067
12060
 
12068
- case 46:
12061
+ case 44:
12069
12062
  if (!(lowerCategory === "price")) {
12070
- _context11.next = 50;
12063
+ _context11.next = 48;
12071
12064
  break;
12072
12065
  }
12073
12066
  output = {};
@@ -12083,7 +12076,7 @@ function _typeof(o) {
12083
12076
  }
12084
12077
  return _context11.abrupt("return", [ output ]);
12085
12078
 
12086
- case 50:
12079
+ case 48:
12087
12080
  _data = json;
12088
12081
  if (lowerCategory === "derivatives") {
12089
12082
  if (json.length > 200) {
@@ -12119,17 +12112,17 @@ function _typeof(o) {
12119
12112
  return flat;
12120
12113
  })));
12121
12114
 
12122
- case 56:
12123
- _context11.prev = 56;
12124
- _context11.t1 = _context11["catch"](33);
12115
+ case 54:
12116
+ _context11.prev = 54;
12117
+ _context11.t1 = _context11["catch"](31);
12125
12118
  console.error(_context11.t1);
12126
12119
  return _context11.abrupt("return", ERROR_MESSAGES_FLAG.DEFAULT);
12127
12120
 
12128
- case 60:
12121
+ case 58:
12129
12122
  case "end":
12130
12123
  return _context11.stop();
12131
12124
  }
12132
- }), _callee11, null, [ [ 33, 56 ] ]);
12125
+ }), _callee11, null, [ [ 31, 54 ] ]);
12133
12126
  })));
12134
12127
  return _COINGECKO.apply(this, arguments);
12135
12128
  }
@@ -12665,8 +12658,8 @@ function _typeof(o) {
12665
12658
  return _context19.abrupt("return", "".concat(SERVICE_API_KEY.Defillama, "_MISSING"));
12666
12659
 
12667
12660
  case 4:
12668
- categoryList = [ "protocols", "yields", "dex" ];
12669
- categoryMap = _defineProperty(_defineProperty(_defineProperty({}, categoryList[0], "https://api.llama.fi/protocols"), categoryList[1], "https://yields.llama.fi/pools"), categoryList[2], "https://api.llama.fi/overview/dexs?excludeTotalDataChart=true&excludeTotalDataChartBreakdown=true");
12661
+ categoryList = [ "protocols", "yields", "dex", "fees" ];
12662
+ categoryMap = _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, categoryList[0], "https://api.llama.fi/protocols"), categoryList[1], "https://yields.llama.fi/pools"), categoryList[2], "https://api.llama.fi/overview/dexs?excludeTotalDataChart=true&excludeTotalDataChartBreakdown=true"), categoryList[3], "https://api.llama.fi/overview/fees?excludeTotalDataChart=true&excludeTotalDataChartBreakdown=true&dataType=dailyFees");
12670
12663
  url = categoryMap[category];
12671
12664
  _context19.prev = 7;
12672
12665
  _context19.next = 10;
@@ -12687,37 +12680,41 @@ function _typeof(o) {
12687
12680
  case 15:
12688
12681
  json = _context19.sent;
12689
12682
  _context19.t0 = category;
12690
- _context19.next = _context19.t0 === categoryList[0] ? 19 : _context19.t0 === categoryList[1] ? 21 : _context19.t0 === categoryList[2] ? 23 : 25;
12683
+ _context19.next = _context19.t0 === categoryList[0] ? 19 : _context19.t0 === categoryList[1] ? 21 : _context19.t0 === categoryList[2] ? 23 : _context19.t0 === categoryList[3] ? 25 : 27;
12691
12684
  break;
12692
12685
 
12693
12686
  case 19:
12694
12687
  if (json.length > 500) {
12695
12688
  json = json.slice(0, 500);
12696
12689
  }
12697
- return _context19.abrupt("break", 25);
12690
+ return _context19.abrupt("break", 27);
12698
12691
 
12699
12692
  case 21:
12700
12693
  json = json.data.slice(0, 500);
12701
- return _context19.abrupt("break", 25);
12694
+ return _context19.abrupt("break", 27);
12702
12695
 
12703
12696
  case 23:
12704
12697
  json = json.protocols.slice(0, 500);
12705
- return _context19.abrupt("break", 25);
12698
+ return _context19.abrupt("break", 27);
12706
12699
 
12707
12700
  case 25:
12701
+ json = json.protocols.slice(0, 500);
12702
+ return _context19.abrupt("break", 27);
12703
+
12704
+ case 27:
12708
12705
  return _context19.abrupt("return", removeNestedStructure(Array.isArray(json) ? json : [ json ]));
12709
12706
 
12710
- case 28:
12711
- _context19.prev = 28;
12707
+ case 30:
12708
+ _context19.prev = 30;
12712
12709
  _context19.t1 = _context19["catch"](7);
12713
12710
  console.log(_context19.t1);
12714
12711
  return _context19.abrupt("return", "ERROR IN FETCHING");
12715
12712
 
12716
- case 32:
12713
+ case 34:
12717
12714
  case "end":
12718
12715
  return _context19.stop();
12719
12716
  }
12720
- }), _callee16, null, [ [ 7, 28 ] ]);
12717
+ }), _callee16, null, [ [ 7, 30 ] ]);
12721
12718
  })));
12722
12719
  return _DEFILLAMA.apply(this, arguments);
12723
12720
  }