@fileverse-dev/formulajs 4.4.12-mod-2 → 4.4.12-mod-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.12-mod-2 */
1
+ /* @fileverse-dev/formulajs v4.4.12-mod-3 */
2
2
  var _excluded = [ "confirmations", "dataDecoded" ];
3
3
 
4
4
  function _objectWithoutProperties(e, t) {
@@ -16541,7 +16541,7 @@ function _typeof(o) {
16541
16541
  }
16542
16542
  function _EOA() {
16543
16543
  _EOA = _asyncToGenerator(_regeneratorRuntime().mark((function _callee13() {
16544
- var fetchJSON, _argsToArray5, _argsToArray6, addresses, category, chains, startTime, endTime, _argsToArray6$, page, _argsToArray6$2, offset, apiKey, INPUTS, CHAINS, ADDRESS_MAP, _iterator41, _step41, inp, _address, ADDRS, out, _iterator42, _step42, _loop, _ret, _args16 = arguments;
16544
+ var fetchJSON, _argsToArray5, _argsToArray6, addresses, category, chains, startTime, endTime, _argsToArray6$, page, _argsToArray6$2, offset, apiKey, INPUTS, CHAINS, ADDRESS_MAP, _iterator41, _step41, inp, _address, ADDRS, out, _iterator42, _step42, _loop2, _ret, _args16 = arguments;
16545
16545
  return _regeneratorRuntime().wrap((function _callee13$(_context16) {
16546
16546
  while (1) switch (_context16.prev = _context16.next) {
16547
16547
  case 0:
@@ -16678,9 +16678,9 @@ function _typeof(o) {
16678
16678
  out = [];
16679
16679
  _iterator42 = _createForOfIteratorHelper(CHAINS);
16680
16680
  _context16.prev = 34;
16681
- _loop = _regeneratorRuntime().mark((function _loop() {
16682
- var chain, chainId, _loop2, _ret2, i, sb, eb, _loop3, _ret3, _i10, _ADDRS;
16683
- return _regeneratorRuntime().wrap((function _loop$(_context15) {
16681
+ _loop2 = _regeneratorRuntime().mark((function _loop2() {
16682
+ var chain, chainId, _loop3, _ret2, i, sb, eb, _loop4, _ret3, _i10, _ADDRS;
16683
+ return _regeneratorRuntime().wrap((function _loop2$(_context15) {
16684
16684
  while (1) switch (_context15.prev = _context15.next) {
16685
16685
  case 0:
16686
16686
  chain = _step42.value;
@@ -16696,9 +16696,9 @@ function _typeof(o) {
16696
16696
  _context15.next = 17;
16697
16697
  break;
16698
16698
  }
16699
- _loop2 = _regeneratorRuntime().mark((function _loop2(i) {
16699
+ _loop3 = _regeneratorRuntime().mark((function _loop3(i) {
16700
16700
  var slice, url, data;
16701
- return _regeneratorRuntime().wrap((function _loop2$(_context13) {
16701
+ return _regeneratorRuntime().wrap((function _loop3$(_context13) {
16702
16702
  while (1) switch (_context13.prev = _context13.next) {
16703
16703
  case 0:
16704
16704
  slice = ADDRS.slice(i, i + 20).join(",");
@@ -16731,7 +16731,7 @@ function _typeof(o) {
16731
16731
  case "end":
16732
16732
  return _context13.stop();
16733
16733
  }
16734
- }), _loop2);
16734
+ }), _loop3);
16735
16735
  }));
16736
16736
  i = 0;
16737
16737
 
@@ -16740,7 +16740,7 @@ function _typeof(o) {
16740
16740
  _context15.next = 15;
16741
16741
  break;
16742
16742
  }
16743
- return _context15.delegateYield(_loop2(i), "t0", 9);
16743
+ return _context15.delegateYield(_loop3(i), "t0", 9);
16744
16744
 
16745
16745
  case 9:
16746
16746
  _ret2 = _context15.t0;
@@ -16784,9 +16784,9 @@ function _typeof(o) {
16784
16784
  throw new ValidationError("Invalid endTime: ".concat(endTime));
16785
16785
 
16786
16786
  case 27:
16787
- _loop3 = _regeneratorRuntime().mark((function _loop3() {
16787
+ _loop4 = _regeneratorRuntime().mark((function _loop4() {
16788
16788
  var addr, url, data;
16789
- return _regeneratorRuntime().wrap((function _loop3$(_context14) {
16789
+ return _regeneratorRuntime().wrap((function _loop4$(_context14) {
16790
16790
  while (1) switch (_context14.prev = _context14.next) {
16791
16791
  case 0:
16792
16792
  addr = _ADDRS[_i10];
@@ -16819,7 +16819,7 @@ function _typeof(o) {
16819
16819
  case "end":
16820
16820
  return _context14.stop();
16821
16821
  }
16822
- }), _loop3);
16822
+ }), _loop4);
16823
16823
  }));
16824
16824
  _i10 = 0, _ADDRS = ADDRS;
16825
16825
 
@@ -16828,7 +16828,7 @@ function _typeof(o) {
16828
16828
  _context15.next = 37;
16829
16829
  break;
16830
16830
  }
16831
- return _context15.delegateYield(_loop3(), "t1", 31);
16831
+ return _context15.delegateYield(_loop4(), "t1", 31);
16832
16832
 
16833
16833
  case 31:
16834
16834
  _ret3 = _context15.t1;
@@ -16847,7 +16847,7 @@ function _typeof(o) {
16847
16847
  case "end":
16848
16848
  return _context15.stop();
16849
16849
  }
16850
- }), _loop);
16850
+ }), _loop2);
16851
16851
  }));
16852
16852
  _iterator42.s();
16853
16853
 
@@ -16856,7 +16856,7 @@ function _typeof(o) {
16856
16856
  _context16.next = 44;
16857
16857
  break;
16858
16858
  }
16859
- return _context16.delegateYield(_loop(), "t1", 39);
16859
+ return _context16.delegateYield(_loop2(), "t1", 39);
16860
16860
 
16861
16861
  case 39:
16862
16862
  _ret = _context16.t1;
@@ -18333,15 +18333,112 @@ function _typeof(o) {
18333
18333
  })));
18334
18334
  return _TALLY.apply(this, arguments);
18335
18335
  }
18336
+ var duneSimParamsSchema = objectType({
18337
+ wallet: stringType().nonempty(),
18338
+ type: enumType([ "activity" ])
18339
+ });
18340
+ function flattenObject(obj) {
18341
+ var parentKey = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
18342
+ var res = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
18343
+ var _loop = function _loop() {
18344
+ if (!Object.prototype.hasOwnProperty.call(obj, key)) return 1;
18345
+ var newKey = parentKey ? "".concat(parentKey, "_").concat(key) : key;
18346
+ if (_typeof(obj[key]) === "object" && obj[key] !== null && !Array.isArray(obj[key])) {
18347
+ flattenObject(obj[key], newKey, res);
18348
+ } else if (Array.isArray(obj[key])) {
18349
+ obj[key].forEach((function(val, i) {
18350
+ if (_typeof(val) === "object" && val !== null) {
18351
+ flattenObject(val, "".concat(newKey, "_").concat(i), res);
18352
+ } else {
18353
+ res["".concat(newKey, "_").concat(i)] = val;
18354
+ }
18355
+ }));
18356
+ } else {
18357
+ res[newKey] = obj[key];
18358
+ }
18359
+ };
18360
+ for (var key in obj) {
18361
+ if (_loop()) continue;
18362
+ }
18363
+ return res;
18364
+ }
18365
+ function DUNESIM() {
18366
+ return _DUNESIM.apply(this, arguments);
18367
+ }
18368
+ function _DUNESIM() {
18369
+ _DUNESIM = _asyncToGenerator(_regeneratorRuntime().mark((function _callee29() {
18370
+ var _argsToArray31, _argsToArray32, type, wallet, address, apiKey, url, _getUrlAndHeaders1, finalUrl, HEADERS, response, json, activity, _args32 = arguments;
18371
+ return _regeneratorRuntime().wrap((function _callee29$(_context32) {
18372
+ while (1) switch (_context32.prev = _context32.next) {
18373
+ case 0:
18374
+ _context32.prev = 0;
18375
+ _argsToArray31 = argsToArray(_args32), _argsToArray32 = _slicedToArray(_argsToArray31, 2),
18376
+ type = _argsToArray32[0], wallet = _argsToArray32[1];
18377
+ validateParams(duneSimParamsSchema, {
18378
+ wallet: wallet,
18379
+ type: type
18380
+ });
18381
+ _context32.next = 5;
18382
+ return fromEnsNameToAddress$1.validateAndGetAddress(wallet);
18383
+
18384
+ case 5:
18385
+ address = _context32.sent;
18386
+ apiKey = window.localStorage.getItem(SERVICES_API_KEY.DuneSim);
18387
+ url = "https://api.sim.dune.com/v1/evm/activity/".concat(address);
18388
+ _getUrlAndHeaders1 = getUrlAndHeaders({
18389
+ url: url,
18390
+ serviceName: "DuneSim",
18391
+ headers: {
18392
+ "X-Sim-Api-Key": apiKey
18393
+ }
18394
+ }), finalUrl = _getUrlAndHeaders1.URL, HEADERS = _getUrlAndHeaders1.HEADERS;
18395
+ _context32.next = 11;
18396
+ return fetch(finalUrl, {
18397
+ method: "GET",
18398
+ headers: HEADERS
18399
+ });
18400
+
18401
+ case 11:
18402
+ response = _context32.sent;
18403
+ if (response.ok) {
18404
+ _context32.next = 14;
18405
+ break;
18406
+ }
18407
+ throw new NetworkError(SERVICES_API_KEY.DuneSim, response.status);
18408
+
18409
+ case 14:
18410
+ _context32.next = 16;
18411
+ return response.json();
18412
+
18413
+ case 16:
18414
+ json = _context32.sent;
18415
+ activity = (json === null || json === void 0 ? void 0 : json.activity) || [];
18416
+ return _context32.abrupt("return", activity.map((function(item) {
18417
+ return flattenObject(item);
18418
+ })));
18419
+
18420
+ case 21:
18421
+ _context32.prev = 21;
18422
+ _context32.t0 = _context32["catch"](0);
18423
+ return _context32.abrupt("return", errorMessageHandler(_context32.t0, "DUNESIM"));
18424
+
18425
+ case 24:
18426
+ case "end":
18427
+ return _context32.stop();
18428
+ }
18429
+ }), _callee29, null, [ [ 0, 21 ] ]);
18430
+ })));
18431
+ return _DUNESIM.apply(this, arguments);
18432
+ }
18336
18433
  function FLVURL() {
18337
18434
  return _FLVURL.apply(this, arguments);
18338
18435
  }
18339
18436
  function _FLVURL() {
18340
- _FLVURL = _asyncToGenerator(_regeneratorRuntime().mark((function _callee29() {
18341
- return _regeneratorRuntime().wrap((function _callee29$(_context32) {
18342
- while (1) switch (_context32.prev = _context32.next) {
18437
+ _FLVURL = _asyncToGenerator(_regeneratorRuntime().mark((function _callee30() {
18438
+ return _regeneratorRuntime().wrap((function _callee30$(_context33) {
18439
+ while (1) switch (_context33.prev = _context33.next) {
18343
18440
  case 0:
18344
- return _context32.abrupt("return", new Promise((function(resolve) {
18441
+ return _context33.abrupt("return", new Promise((function(resolve) {
18345
18442
  setTimeout((function() {
18346
18443
  resolve([ {
18347
18444
  Yoo: "gotcha"
@@ -18351,9 +18448,9 @@ function _typeof(o) {
18351
18448
 
18352
18449
  case 1:
18353
18450
  case "end":
18354
- return _context32.stop();
18451
+ return _context33.stop();
18355
18452
  }
18356
- }), _callee29);
18453
+ }), _callee30);
18357
18454
  })));
18358
18455
  return _FLVURL.apply(this, arguments);
18359
18456
  }
@@ -18493,6 +18590,7 @@ function _typeof(o) {
18493
18590
  exports.DSTDEV = DSTDEV;
18494
18591
  exports.DSTDEVP = DSTDEVP;
18495
18592
  exports.DSUM = DSUM;
18593
+ exports.DUNESIM = DUNESIM;
18496
18594
  exports.DVAR = DVAR;
18497
18595
  exports.DVARP = DVARP;
18498
18596
  exports.EDATE = EDATE;