@fileverse-dev/formulajs 4.4.11-mod-99 → 4.4.11-mod-99-dune-sim-2

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-99 */
1
+ /* @fileverse-dev/formulajs v4.4.11-mod-99-dune-sim-2 */
2
2
  var _excluded = [ "confirmations", "dataDecoded" ];
3
3
 
4
4
  function _objectWithoutProperties(e, t) {
@@ -11066,7 +11066,8 @@ function _typeof(o) {
11066
11066
  Firefly: "Firefly",
11067
11067
  GnosisPay: "GnosisPay",
11068
11068
  Neynar: "Neynar",
11069
- Defillama: "Defillama"
11069
+ Defillama: "Defillama",
11070
+ DuneSim: "DuneSim"
11070
11071
  };
11071
11072
  var ValidationError = function(_Error) {
11072
11073
  function ValidationError(message) {
@@ -16402,6 +16403,9 @@ function _typeof(o) {
16402
16403
  if (!PROXY_MAP) {
16403
16404
  var fileverseProxyUrl = "".concat(window.NEXT_PUBLIC_PROXY_BASE_URL, "/proxy");
16404
16405
  PROXY_MAP = {
16406
+ DuneSim: {
16407
+ url: fileverseProxyUrl
16408
+ },
16405
16409
  Etherscan: {
16406
16410
  url: fileverseProxyUrl,
16407
16411
  removeParams: [ "apikey" ]
@@ -16537,7 +16541,7 @@ function _typeof(o) {
16537
16541
  }
16538
16542
  function _EOA() {
16539
16543
  _EOA = _asyncToGenerator(_regeneratorRuntime().mark((function _callee13() {
16540
- 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;
16541
16545
  return _regeneratorRuntime().wrap((function _callee13$(_context16) {
16542
16546
  while (1) switch (_context16.prev = _context16.next) {
16543
16547
  case 0:
@@ -16674,9 +16678,9 @@ function _typeof(o) {
16674
16678
  out = [];
16675
16679
  _iterator42 = _createForOfIteratorHelper(CHAINS);
16676
16680
  _context16.prev = 34;
16677
- _loop = _regeneratorRuntime().mark((function _loop() {
16678
- var chain, chainId, _loop2, _ret2, i, sb, eb, _loop3, _ret3, _i10, _ADDRS;
16679
- 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) {
16680
16684
  while (1) switch (_context15.prev = _context15.next) {
16681
16685
  case 0:
16682
16686
  chain = _step42.value;
@@ -16692,9 +16696,9 @@ function _typeof(o) {
16692
16696
  _context15.next = 17;
16693
16697
  break;
16694
16698
  }
16695
- _loop2 = _regeneratorRuntime().mark((function _loop2(i) {
16699
+ _loop3 = _regeneratorRuntime().mark((function _loop3(i) {
16696
16700
  var slice, url, data;
16697
- return _regeneratorRuntime().wrap((function _loop2$(_context13) {
16701
+ return _regeneratorRuntime().wrap((function _loop3$(_context13) {
16698
16702
  while (1) switch (_context13.prev = _context13.next) {
16699
16703
  case 0:
16700
16704
  slice = ADDRS.slice(i, i + 20).join(",");
@@ -16727,7 +16731,7 @@ function _typeof(o) {
16727
16731
  case "end":
16728
16732
  return _context13.stop();
16729
16733
  }
16730
- }), _loop2);
16734
+ }), _loop3);
16731
16735
  }));
16732
16736
  i = 0;
16733
16737
 
@@ -16736,7 +16740,7 @@ function _typeof(o) {
16736
16740
  _context15.next = 15;
16737
16741
  break;
16738
16742
  }
16739
- return _context15.delegateYield(_loop2(i), "t0", 9);
16743
+ return _context15.delegateYield(_loop3(i), "t0", 9);
16740
16744
 
16741
16745
  case 9:
16742
16746
  _ret2 = _context15.t0;
@@ -16780,9 +16784,9 @@ function _typeof(o) {
16780
16784
  throw new ValidationError("Invalid endTime: ".concat(endTime));
16781
16785
 
16782
16786
  case 27:
16783
- _loop3 = _regeneratorRuntime().mark((function _loop3() {
16787
+ _loop4 = _regeneratorRuntime().mark((function _loop4() {
16784
16788
  var addr, url, data;
16785
- return _regeneratorRuntime().wrap((function _loop3$(_context14) {
16789
+ return _regeneratorRuntime().wrap((function _loop4$(_context14) {
16786
16790
  while (1) switch (_context14.prev = _context14.next) {
16787
16791
  case 0:
16788
16792
  addr = _ADDRS[_i10];
@@ -16815,7 +16819,7 @@ function _typeof(o) {
16815
16819
  case "end":
16816
16820
  return _context14.stop();
16817
16821
  }
16818
- }), _loop3);
16822
+ }), _loop4);
16819
16823
  }));
16820
16824
  _i10 = 0, _ADDRS = ADDRS;
16821
16825
 
@@ -16824,7 +16828,7 @@ function _typeof(o) {
16824
16828
  _context15.next = 37;
16825
16829
  break;
16826
16830
  }
16827
- return _context15.delegateYield(_loop3(), "t1", 31);
16831
+ return _context15.delegateYield(_loop4(), "t1", 31);
16828
16832
 
16829
16833
  case 31:
16830
16834
  _ret3 = _context15.t1;
@@ -16843,7 +16847,7 @@ function _typeof(o) {
16843
16847
  case "end":
16844
16848
  return _context15.stop();
16845
16849
  }
16846
- }), _loop);
16850
+ }), _loop2);
16847
16851
  }));
16848
16852
  _iterator42.s();
16849
16853
 
@@ -16852,7 +16856,7 @@ function _typeof(o) {
16852
16856
  _context16.next = 44;
16853
16857
  break;
16854
16858
  }
16855
- return _context16.delegateYield(_loop(), "t1", 39);
16859
+ return _context16.delegateYield(_loop2(), "t1", 39);
16856
16860
 
16857
16861
  case 39:
16858
16862
  _ret = _context16.t1;
@@ -18329,15 +18333,105 @@ function _typeof(o) {
18329
18333
  })));
18330
18334
  return _TALLY.apply(this, arguments);
18331
18335
  }
18336
+ var duneSimParamsSchema = objectType({
18337
+ address: stringType().nonempty()
18338
+ });
18339
+ function flattenObject(obj) {
18340
+ var parentKey = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
18341
+ var res = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
18342
+ var _loop = function _loop() {
18343
+ if (!Object.prototype.hasOwnProperty.call(obj, key)) return 1;
18344
+ var newKey = parentKey ? "".concat(parentKey, "_").concat(key) : key;
18345
+ if (_typeof(obj[key]) === "object" && obj[key] !== null && !Array.isArray(obj[key])) {
18346
+ flattenObject(obj[key], newKey, res);
18347
+ } else if (Array.isArray(obj[key])) {
18348
+ obj[key].forEach((function(val, i) {
18349
+ if (_typeof(val) === "object" && val !== null) {
18350
+ flattenObject(val, "".concat(newKey, "_").concat(i), res);
18351
+ } else {
18352
+ res["".concat(newKey, "_").concat(i)] = val;
18353
+ }
18354
+ }));
18355
+ } else {
18356
+ res[newKey] = obj[key];
18357
+ }
18358
+ };
18359
+ for (var key in obj) {
18360
+ if (_loop()) continue;
18361
+ }
18362
+ return res;
18363
+ }
18364
+ function DUNESIM() {
18365
+ return _DUNESIM.apply(this, arguments);
18366
+ }
18367
+ function _DUNESIM() {
18368
+ _DUNESIM = _asyncToGenerator(_regeneratorRuntime().mark((function _callee29() {
18369
+ var _argsToArray31, _argsToArray32, address, apiKey, url, _getUrlAndHeaders1, finalUrl, HEADERS, response, json, activity, _args32 = arguments;
18370
+ return _regeneratorRuntime().wrap((function _callee29$(_context32) {
18371
+ while (1) switch (_context32.prev = _context32.next) {
18372
+ case 0:
18373
+ _context32.prev = 0;
18374
+ _argsToArray31 = argsToArray(_args32), _argsToArray32 = _slicedToArray(_argsToArray31, 1),
18375
+ address = _argsToArray32[0];
18376
+ validateParams(duneSimParamsSchema, {
18377
+ address: address
18378
+ });
18379
+ apiKey = window.localStorage.getItem(SERVICES_API_KEY.DuneSim);
18380
+ url = "https://api.sim.dune.com/v1/evm/activity/".concat(address);
18381
+ _getUrlAndHeaders1 = getUrlAndHeaders({
18382
+ url: url,
18383
+ serviceName: "DuneSim",
18384
+ headers: {
18385
+ "X-Sim-Api-Key": apiKey
18386
+ }
18387
+ }), finalUrl = _getUrlAndHeaders1.URL, HEADERS = _getUrlAndHeaders1.HEADERS;
18388
+ _context32.next = 8;
18389
+ return fetch(finalUrl, {
18390
+ method: "GET",
18391
+ headers: HEADERS
18392
+ });
18393
+
18394
+ case 8:
18395
+ response = _context32.sent;
18396
+ if (response.ok) {
18397
+ _context32.next = 11;
18398
+ break;
18399
+ }
18400
+ throw new NetworkError(SERVICES_API_KEY.DuneSim, response.status);
18401
+
18402
+ case 11:
18403
+ _context32.next = 13;
18404
+ return response.json();
18405
+
18406
+ case 13:
18407
+ json = _context32.sent;
18408
+ activity = (json === null || json === void 0 ? void 0 : json.activity) || [];
18409
+ return _context32.abrupt("return", activity.map((function(item) {
18410
+ return flattenObject(item);
18411
+ })));
18412
+
18413
+ case 18:
18414
+ _context32.prev = 18;
18415
+ _context32.t0 = _context32["catch"](0);
18416
+ return _context32.abrupt("return", errorMessageHandler(_context32.t0, "DUNESIM"));
18417
+
18418
+ case 21:
18419
+ case "end":
18420
+ return _context32.stop();
18421
+ }
18422
+ }), _callee29, null, [ [ 0, 18 ] ]);
18423
+ })));
18424
+ return _DUNESIM.apply(this, arguments);
18425
+ }
18332
18426
  function FLVURL() {
18333
18427
  return _FLVURL.apply(this, arguments);
18334
18428
  }
18335
18429
  function _FLVURL() {
18336
- _FLVURL = _asyncToGenerator(_regeneratorRuntime().mark((function _callee29() {
18337
- return _regeneratorRuntime().wrap((function _callee29$(_context32) {
18338
- while (1) switch (_context32.prev = _context32.next) {
18430
+ _FLVURL = _asyncToGenerator(_regeneratorRuntime().mark((function _callee30() {
18431
+ return _regeneratorRuntime().wrap((function _callee30$(_context33) {
18432
+ while (1) switch (_context33.prev = _context33.next) {
18339
18433
  case 0:
18340
- return _context32.abrupt("return", new Promise((function(resolve) {
18434
+ return _context33.abrupt("return", new Promise((function(resolve) {
18341
18435
  setTimeout((function() {
18342
18436
  resolve([ {
18343
18437
  Yoo: "gotcha"
@@ -18347,9 +18441,9 @@ function _typeof(o) {
18347
18441
 
18348
18442
  case 1:
18349
18443
  case "end":
18350
- return _context32.stop();
18444
+ return _context33.stop();
18351
18445
  }
18352
- }), _callee29);
18446
+ }), _callee30);
18353
18447
  })));
18354
18448
  return _FLVURL.apply(this, arguments);
18355
18449
  }
@@ -18489,6 +18583,7 @@ function _typeof(o) {
18489
18583
  exports.DSTDEV = DSTDEV;
18490
18584
  exports.DSTDEVP = DSTDEVP;
18491
18585
  exports.DSUM = DSUM;
18586
+ exports.DUNESIM = DUNESIM;
18492
18587
  exports.DVAR = DVAR;
18493
18588
  exports.DVARP = DVARP;
18494
18589
  exports.EDATE = EDATE;