@fileverse-dev/formulajs 4.4.15 → 4.4.17

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.15 */
1
+ /* @fileverse-dev/formulajs v4.4.17 */
2
2
  var _excluded = [ "confirmations", "dataDecoded" ];
3
3
 
4
4
  function _objectWithoutProperties(e, t) {
@@ -17360,7 +17360,7 @@ function _typeof(o) {
17360
17360
  for (_i12 = 0, _Object$entries2 = Object.entries(prices); _i12 < _Object$entries2.length; _i12++) {
17361
17361
  _Object$entries2$_i = _slicedToArray(_Object$entries2[_i12], 2), cur = _Object$entries2$_i[0],
17362
17362
  val = _Object$entries2$_i[1];
17363
- out["".concat(token.charAt(0).toUpperCase() + token.slice(1), "_").concat(cur.toUpperCase())] = val;
17363
+ out["".concat(token.toUpperCase(), "_").concat(cur.toUpperCase())] = val;
17364
17364
  }
17365
17365
  }
17366
17366
  return _context20.abrupt("return", [ out ]);
@@ -18400,16 +18400,23 @@ function _typeof(o) {
18400
18400
  ethereum: 1
18401
18401
  };
18402
18402
  function formatNumber(raw, decimals) {
18403
- if (!decimals) {
18403
+ try {
18404
+ if (!decimals) {
18405
+ return raw;
18406
+ }
18407
+ var quorum = BigInt(raw);
18408
+ var divisor = Math.pow(10, decimals);
18409
+ var normalized = Number(quorum) / divisor;
18410
+ return new Intl.NumberFormat("en-US", {
18411
+ notation: "compact",
18412
+ maximumFractionDigits: 2
18413
+ }).format(normalized);
18414
+ } catch (error) {
18415
+ console.log({
18416
+ error: error
18417
+ });
18404
18418
  return raw;
18405
18419
  }
18406
- var quorum = BigInt(raw);
18407
- var divisor = Math.pow(10, decimals);
18408
- var normalized = Number(quorum) / divisor;
18409
- return new Intl.NumberFormat("en-US", {
18410
- notation: "compact",
18411
- maximumFractionDigits: 2
18412
- }).format(normalized);
18413
18420
  }
18414
18421
  var cachedChains = null;
18415
18422
  function getChainName(_x16) {
@@ -18469,7 +18476,7 @@ function _typeof(o) {
18469
18476
  }
18470
18477
  function _DUNE() {
18471
18478
  _DUNE = _asyncToGenerator(_regeneratorRuntime().mark((function _callee30() {
18472
- var _ref26, _json$activity, _ref27, _json$holders, _ref28, _json$tokens, _argsToArray31, _argsToArray32, type, input1, input2, input3, input4, route, buildQuery, address, qs, chain, _qs, tokenAddress, _qs2, _chain, apiKey, url, _getUrlAndHeaders1, finalUrl, HEADERS, res, json, _data6, result, _final, globalDecimals, _iterator43, _step43, _loop4, _args34 = arguments;
18479
+ var _ref26, _json$activity, _ref27, _json$holders, _ref28, _json$tokens, _argsToArray31, _argsToArray32, type, input1, input2, input3, input4, route, buildQuery, address, qs, chain, _qs, tokenAddress, _qs2, _chain, apiKey, url, _getUrlAndHeaders1, finalUrl, HEADERS, res, _data6, json, _data7, result, _final, globalDecimals, _iterator43, _step43, _loop4, _args34 = arguments;
18473
18480
  return _regeneratorRuntime().wrap((function _callee30$(_context34) {
18474
18481
  while (1) switch (_context34.prev = _context34.next) {
18475
18482
  case 0:
@@ -18537,22 +18544,34 @@ function _typeof(o) {
18537
18544
  case 18:
18538
18545
  res = _context34.sent;
18539
18546
  if (res.ok) {
18540
- _context34.next = 21;
18547
+ _context34.next = 26;
18548
+ break;
18549
+ }
18550
+ if (!(res.status === 400)) {
18551
+ _context34.next = 25;
18541
18552
  break;
18542
18553
  }
18543
- throw new NetworkError(SERVICES_API_KEY.DuneSim, res.status);
18544
-
18545
- case 21:
18546
18554
  _context34.next = 23;
18547
18555
  return res.json();
18548
18556
 
18549
18557
  case 23:
18558
+ _data6 = _context34.sent;
18559
+ throw new ValidationError(_data6.message);
18560
+
18561
+ case 25:
18562
+ throw new NetworkError(SERVICES_API_KEY.DuneSim, res.status);
18563
+
18564
+ case 26:
18565
+ _context34.next = 28;
18566
+ return res.json();
18567
+
18568
+ case 28:
18550
18569
  json = _context34.sent;
18551
- _data6 = type === "activity" ? (_ref26 = (_json$activity = json === null || json === void 0 ? void 0 : json.activity) !== null && _json$activity !== void 0 ? _json$activity : json) !== null && _ref26 !== void 0 ? _ref26 : [] : type === "token-holders" ? (_ref27 = (_json$holders = json === null || json === void 0 ? void 0 : json.holders) !== null && _json$holders !== void 0 ? _json$holders : json) !== null && _ref27 !== void 0 ? _ref27 : [] : type === "price" ? (_ref28 = (_json$tokens = json === null || json === void 0 ? void 0 : json.tokens) !== null && _json$tokens !== void 0 ? _json$tokens : json) !== null && _ref28 !== void 0 ? _ref28 : [] : json !== null && json !== void 0 ? json : [];
18552
- result = Array.isArray(_data6) ? _data6 : [ _data6 ];
18570
+ _data7 = type === "activity" ? (_ref26 = (_json$activity = json === null || json === void 0 ? void 0 : json.activity) !== null && _json$activity !== void 0 ? _json$activity : json) !== null && _ref26 !== void 0 ? _ref26 : [] : type === "token-holders" ? (_ref27 = (_json$holders = json === null || json === void 0 ? void 0 : json.holders) !== null && _json$holders !== void 0 ? _json$holders : json) !== null && _ref27 !== void 0 ? _ref27 : [] : type === "price" ? (_ref28 = (_json$tokens = json === null || json === void 0 ? void 0 : json.tokens) !== null && _json$tokens !== void 0 ? _json$tokens : json) !== null && _ref28 !== void 0 ? _ref28 : [] : json !== null && json !== void 0 ? json : [];
18571
+ result = Array.isArray(_data7) ? _data7 : [ _data7 ];
18553
18572
  _final = [];
18554
18573
  _iterator43 = _createForOfIteratorHelper(result);
18555
- _context34.prev = 28;
18574
+ _context34.prev = 33;
18556
18575
  _loop4 = _regeneratorRuntime().mark((function _loop4() {
18557
18576
  var item, prices, _resData$tokens$, _chain2, _url, _getUrlAndHeaders10, _finalUrl, _HEADERS, _res, resData, decimals;
18558
18577
  return _regeneratorRuntime().wrap((function _loop4$(_context33) {
@@ -18659,44 +18678,44 @@ function _typeof(o) {
18659
18678
  }));
18660
18679
  _iterator43.s();
18661
18680
 
18662
- case 31:
18681
+ case 36:
18663
18682
  if ((_step43 = _iterator43.n()).done) {
18664
- _context34.next = 35;
18683
+ _context34.next = 40;
18665
18684
  break;
18666
18685
  }
18667
- return _context34.delegateYield(_loop4(), "t0", 33);
18686
+ return _context34.delegateYield(_loop4(), "t0", 38);
18668
18687
 
18669
- case 33:
18670
- _context34.next = 31;
18688
+ case 38:
18689
+ _context34.next = 36;
18671
18690
  break;
18672
18691
 
18673
- case 35:
18674
- _context34.next = 40;
18692
+ case 40:
18693
+ _context34.next = 45;
18675
18694
  break;
18676
18695
 
18677
- case 37:
18678
- _context34.prev = 37;
18679
- _context34.t1 = _context34["catch"](28);
18696
+ case 42:
18697
+ _context34.prev = 42;
18698
+ _context34.t1 = _context34["catch"](33);
18680
18699
  _iterator43.e(_context34.t1);
18681
18700
 
18682
- case 40:
18683
- _context34.prev = 40;
18701
+ case 45:
18702
+ _context34.prev = 45;
18684
18703
  _iterator43.f();
18685
- return _context34.finish(40);
18704
+ return _context34.finish(45);
18686
18705
 
18687
- case 43:
18706
+ case 48:
18688
18707
  return _context34.abrupt("return", _final);
18689
18708
 
18690
- case 46:
18691
- _context34.prev = 46;
18709
+ case 51:
18710
+ _context34.prev = 51;
18692
18711
  _context34.t2 = _context34["catch"](0);
18693
18712
  return _context34.abrupt("return", errorMessageHandler(_context34.t2, "DUNE"));
18694
18713
 
18695
- case 49:
18714
+ case 54:
18696
18715
  case "end":
18697
18716
  return _context34.stop();
18698
18717
  }
18699
- }), _callee30, null, [ [ 0, 46 ], [ 28, 37, 40, 43 ] ]);
18718
+ }), _callee30, null, [ [ 0, 51 ], [ 33, 42, 45, 48 ] ]);
18700
18719
  })));
18701
18720
  return _DUNE.apply(this, arguments);
18702
18721
  }