@fileverse-dev/formulajs 4.4.11-mod-24 → 4.4.11-mod-26

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-24 */
1
+ /* @fileverse-dev/formulajs v4.4.11-mod-26 */
2
2
  var _excluded = [ "confirmations", "dataDecoded" ];
3
3
 
4
4
  function _objectWithoutProperties(e, t) {
@@ -10997,12 +10997,13 @@ function _typeof(o) {
10997
10997
  }
10998
10998
  function _handleScanRequest() {
10999
10999
  _handleScanRequest = _asyncToGenerator(_regeneratorRuntime().mark((function _callee2(_ref2) {
11000
- var scanKey, baseUrl, type, chain, address, startDate, endDate, API_KEY, chainId, ACTION_MAP, action, url, _yield$Promise$all, _yield$Promise$all2, startBlock, endBlock, res, json;
11000
+ var scanKey, baseUrl, type, chain, address, startDate, endDate, _ref2$page, page, _ref2$offset, offset, API_KEY, chainId, ACTION_MAP, action, url, _yield$Promise$all, _yield$Promise$all2, startBlock, endBlock, res, json;
11001
11001
  return _regeneratorRuntime().wrap((function _callee2$(_context2) {
11002
11002
  while (1) switch (_context2.prev = _context2.next) {
11003
11003
  case 0:
11004
11004
  scanKey = _ref2.scanKey, baseUrl = _ref2.baseUrl, type = _ref2.type, chain = _ref2.chain,
11005
- address = _ref2.address, startDate = _ref2.startDate, endDate = _ref2.endDate;
11005
+ address = _ref2.address, startDate = _ref2.startDate, endDate = _ref2.endDate, _ref2$page = _ref2.page,
11006
+ page = _ref2$page === void 0 ? 1 : _ref2$page, _ref2$offset = _ref2.offset, offset = _ref2$offset === void 0 ? 10 : _ref2$offset;
11006
11007
  API_KEY = window.localStorage.getItem(scanKey);
11007
11008
  if (API_KEY) {
11008
11009
  _context2.next = 4;
@@ -11040,83 +11041,88 @@ function _typeof(o) {
11040
11041
  return _context2.abrupt("return", "".concat(scanKey).concat(ERROR_MESSAGES_FLAG.INVALID_TYPE));
11041
11042
 
11042
11043
  case 13:
11044
+ if (scanKey === SERVICE_API_KEY.Basescan) chainId = "base";
11045
+ if (scanKey === SERVICE_API_KEY.Gnosisscan) chainId = "gnosis";
11043
11046
  url = "".concat(baseUrl, "?chainid=").concat(chainId, "&module=account&action=").concat(action, "&apikey=").concat(API_KEY);
11044
11047
  if (![ "all-txns", "token-txns", "nft-txns" ].includes(type)) {
11045
- _context2.next = 26;
11048
+ _context2.next = 29;
11046
11049
  break;
11047
11050
  }
11048
11051
  if (address) {
11049
- _context2.next = 17;
11052
+ _context2.next = 19;
11050
11053
  break;
11051
11054
  }
11052
11055
  return _context2.abrupt("return", "".concat(scanKey).concat(ERROR_MESSAGES_FLAG.INVALID_ADDRESS));
11053
11056
 
11054
- case 17:
11057
+ case 19:
11055
11058
  url += "&address=".concat(address, "&startblock=0&endblock=99999999&sort=asc");
11056
11059
  if (!(!isNaN(startDate) && !isNaN(endDate))) {
11057
- _context2.next = 26;
11060
+ _context2.next = 28;
11058
11061
  break;
11059
11062
  }
11060
- _context2.next = 21;
11063
+ _context2.next = 23;
11061
11064
  return Promise.all([ fromTimeStampToBlock(startDate, chain, API_KEY), fromTimeStampToBlock(endDate, chain, API_KEY) ]);
11062
11065
 
11063
- case 21:
11066
+ case 23:
11064
11067
  _yield$Promise$all = _context2.sent;
11065
11068
  _yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 2);
11066
11069
  startBlock = _yield$Promise$all2[0];
11067
11070
  endBlock = _yield$Promise$all2[1];
11068
11071
  url += "&startblock=".concat(startBlock, "&endblock=").concat(endBlock);
11069
11072
 
11070
- case 26:
11071
- _context2.prev = 26;
11072
- _context2.next = 29;
11073
- return fetch(url);
11073
+ case 28:
11074
+ url += "&page=".concat(page, "&offset=").concat(offset);
11074
11075
 
11075
11076
  case 29:
11077
+ _context2.prev = 29;
11078
+ _context2.next = 32;
11079
+ return fetch(url);
11080
+
11081
+ case 32:
11076
11082
  res = _context2.sent;
11077
11083
  if (res.ok) {
11078
- _context2.next = 32;
11084
+ _context2.next = 35;
11079
11085
  break;
11080
11086
  }
11081
11087
  throw new Error("HTTP error: ".concat(res.status));
11082
11088
 
11083
- case 32:
11084
- _context2.next = 34;
11089
+ case 35:
11090
+ _context2.next = 37;
11085
11091
  return res.json();
11086
11092
 
11087
- case 34:
11093
+ case 37:
11088
11094
  json = _context2.sent;
11089
11095
  if (!(typeof json.result === "string")) {
11090
- _context2.next = 40;
11096
+ _context2.next = 43;
11091
11097
  break;
11092
11098
  }
11093
11099
  if (!json.result.includes("Invalid API Key")) {
11094
- _context2.next = 38;
11100
+ _context2.next = 41;
11095
11101
  break;
11096
11102
  }
11097
11103
  return _context2.abrupt("return", "".concat(scanKey).concat(ERROR_MESSAGES_FLAG.INVALID_API_KEY));
11098
11104
 
11099
- case 38:
11105
+ case 41:
11100
11106
  if (!json.result.includes("Max rate limit reached")) {
11101
- _context2.next = 40;
11107
+ _context2.next = 43;
11102
11108
  break;
11103
11109
  }
11104
11110
  return _context2.abrupt("return", "".concat(scanKey).concat(ERROR_MESSAGES_FLAG.RATE_LIMIT));
11105
11111
 
11106
- case 40:
11112
+ case 43:
11107
11113
  return _context2.abrupt("return", json.result);
11108
11114
 
11109
- case 43:
11110
- _context2.prev = 43;
11111
- _context2.t0 = _context2["catch"](26);
11115
+ case 46:
11116
+ _context2.prev = 46;
11117
+ _context2.t0 = _context2["catch"](29);
11112
11118
  console.error("[".concat(scanKey, "]"), _context2.t0);
11113
11119
  return _context2.abrupt("return", ERROR_MESSAGES_FLAG.DEFAULT);
11114
11120
 
11115
- case 47:
11121
+ case 50:
11116
11122
  case "end":
11117
11123
  return _context2.stop();
11118
11124
  }
11119
- }), _callee2, null, [ [ 26, 43 ] ]);
11125
+ }), _callee2, null, [ [ 29, 46 ] ]);
11120
11126
  })));
11121
11127
  return _handleScanRequest.apply(this, arguments);
11122
11128
  }
@@ -11365,14 +11371,15 @@ function _typeof(o) {
11365
11371
  }
11366
11372
  function _BASESCAN() {
11367
11373
  _BASESCAN = _asyncToGenerator(_regeneratorRuntime().mark((function _callee5() {
11368
- var _len2, args, _key2, type, chain, address, startDate, endDate, _args5 = arguments;
11374
+ var _len2, args, _key2, type, chain, address, startDate, endDate, page, limit, _args5 = arguments;
11369
11375
  return _regeneratorRuntime().wrap((function _callee5$(_context5) {
11370
11376
  while (1) switch (_context5.prev = _context5.next) {
11371
11377
  case 0:
11372
11378
  for (_len2 = _args5.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
11373
11379
  args[_key2] = _args5[_key2];
11374
11380
  }
11375
- type = args[0], chain = args[1], address = args[2], startDate = args[3], endDate = args[4];
11381
+ type = args[0], chain = args[1], address = args[2], startDate = args[3], endDate = args[4],
11382
+ page = args[5], limit = args[6];
11376
11383
  return _context5.abrupt("return", handleScanRequest({
11377
11384
  scanKey: SERVICE_API_KEY.Basescan,
11378
11385
  baseUrl: "https://api.basescan.org/api",
@@ -11380,7 +11387,9 @@ function _typeof(o) {
11380
11387
  chain: chain,
11381
11388
  address: address,
11382
11389
  startDate: startDate,
11383
- endDate: endDate
11390
+ endDate: endDate,
11391
+ page: page,
11392
+ offset: limit
11384
11393
  }));
11385
11394
 
11386
11395
  case 3:
@@ -11396,14 +11405,15 @@ function _typeof(o) {
11396
11405
  }
11397
11406
  function _GNOSISSCAN() {
11398
11407
  _GNOSISSCAN = _asyncToGenerator(_regeneratorRuntime().mark((function _callee6() {
11399
- var _len3, args, _key3, type, chain, address, startDate, endDate, _args6 = arguments;
11408
+ var _len3, args, _key3, type, chain, address, startDate, endDate, page, limit, _args6 = arguments;
11400
11409
  return _regeneratorRuntime().wrap((function _callee6$(_context6) {
11401
11410
  while (1) switch (_context6.prev = _context6.next) {
11402
11411
  case 0:
11403
11412
  for (_len3 = _args6.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
11404
11413
  args[_key3] = _args6[_key3];
11405
11414
  }
11406
- type = args[0], chain = args[1], address = args[2], startDate = args[3], endDate = args[4];
11415
+ type = args[0], chain = args[1], address = args[2], startDate = args[3], endDate = args[4],
11416
+ page = args[5], limit = args[6];
11407
11417
  return _context6.abrupt("return", handleScanRequest({
11408
11418
  scanKey: SERVICE_API_KEY.Gnosisscan,
11409
11419
  baseUrl: "https://api.gnosisscan.io/api",
@@ -11411,7 +11421,9 @@ function _typeof(o) {
11411
11421
  chain: chain,
11412
11422
  address: address,
11413
11423
  startDate: startDate,
11414
- endDate: endDate
11424
+ endDate: endDate,
11425
+ page: page,
11426
+ offset: limit
11415
11427
  }));
11416
11428
 
11417
11429
  case 3:
@@ -11604,14 +11616,15 @@ function _typeof(o) {
11604
11616
  }
11605
11617
  function _ETHERSCAN() {
11606
11618
  _ETHERSCAN = _asyncToGenerator(_regeneratorRuntime().mark((function _callee9() {
11607
- var _len4, args, _key4, type, chain, address, startDate, endDate, _args9 = arguments;
11619
+ var _len4, args, _key4, type, chain, address, startDate, endDate, page, limit, _args9 = arguments;
11608
11620
  return _regeneratorRuntime().wrap((function _callee9$(_context9) {
11609
11621
  while (1) switch (_context9.prev = _context9.next) {
11610
11622
  case 0:
11611
11623
  for (_len4 = _args9.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
11612
11624
  args[_key4] = _args9[_key4];
11613
11625
  }
11614
- type = args[0], chain = args[1], address = args[2], startDate = args[3], endDate = args[4];
11626
+ type = args[0], chain = args[1], address = args[2], startDate = args[3], endDate = args[4],
11627
+ page = args[5], limit = args[6];
11615
11628
  return _context9.abrupt("return", handleScanRequest({
11616
11629
  scanKey: SERVICE_API_KEY.Etherscan,
11617
11630
  baseUrl: "https://api.etherscan.io/v2/api",
@@ -11619,7 +11632,9 @@ function _typeof(o) {
11619
11632
  chain: chain,
11620
11633
  address: address,
11621
11634
  startDate: startDate,
11622
- endDate: endDate
11635
+ endDate: endDate,
11636
+ page: page,
11637
+ offset: limit
11623
11638
  }));
11624
11639
 
11625
11640
  case 3:
@@ -11714,11 +11729,13 @@ function _typeof(o) {
11714
11729
  }
11715
11730
  function _EOA() {
11716
11731
  _EOA = _asyncToGenerator(_regeneratorRuntime().mark((function _callee1(addresses, category, chains, startTime, endTime) {
11717
- var ADDRESSES, CHAINS, flatResults, API_KEY, _iterator, _step, chain, chainId, _iterator2, _step2, address, action, timeQuery, startBlock, endBlock, url, _json$result3, _json$result3$include, _json$result4, _json$result4$include, response, json, entries, _iterator3, _step3, entry;
11732
+ var page, offset, ADDRESSES, CHAINS, flatResults, API_KEY, _iterator, _step, chain, chainId, _iterator2, _step2, address, action, timeQuery, startBlock, endBlock, url, _json$result3, _json$result3$include, _json$result4, _json$result4$include, response, json, entries, _iterator3, _step3, entry, _args1 = arguments;
11718
11733
  return _regeneratorRuntime().wrap((function _callee1$(_context1) {
11719
11734
  while (1) switch (_context1.prev = _context1.next) {
11720
11735
  case 0:
11721
- _context1.prev = 0;
11736
+ page = _args1.length > 5 && _args1[5] !== undefined ? _args1[5] : 1;
11737
+ offset = _args1.length > 6 && _args1[6] !== undefined ? _args1[6] : 10;
11738
+ _context1.prev = 2;
11722
11739
  ADDRESSES = addresses.split(",").map((function(a) {
11723
11740
  return a.trim();
11724
11741
  }));
@@ -11728,97 +11745,97 @@ function _typeof(o) {
11728
11745
  flatResults = [];
11729
11746
  API_KEY = window.localStorage.getItem(SERVICE_API_KEY.Etherscan);
11730
11747
  if (API_KEY) {
11731
- _context1.next = 7;
11748
+ _context1.next = 9;
11732
11749
  break;
11733
11750
  }
11734
11751
  return _context1.abrupt("return", "".concat(SERVICE_API_KEY.Etherscan).concat(ERROR_MESSAGES_FLAG.MISSING_KEY));
11735
11752
 
11736
- case 7:
11753
+ case 9:
11737
11754
  _iterator = _createForOfIteratorHelper(CHAINS);
11738
- _context1.prev = 8;
11755
+ _context1.prev = 10;
11739
11756
  _iterator.s();
11740
11757
 
11741
- case 10:
11758
+ case 12:
11742
11759
  if ((_step = _iterator.n()).done) {
11743
- _context1.next = 67;
11760
+ _context1.next = 69;
11744
11761
  break;
11745
11762
  }
11746
11763
  chain = _step.value;
11747
11764
  chainId = CHAIN_ID_MAP[chain];
11748
11765
  if (chainId) {
11749
- _context1.next = 15;
11766
+ _context1.next = 17;
11750
11767
  break;
11751
11768
  }
11752
11769
  throw new Error("Unsupported chain");
11753
11770
 
11754
- case 15:
11771
+ case 17:
11755
11772
  _iterator2 = _createForOfIteratorHelper(ADDRESSES);
11756
- _context1.prev = 16;
11773
+ _context1.prev = 18;
11757
11774
  _iterator2.s();
11758
11775
 
11759
- case 18:
11776
+ case 20:
11760
11777
  if ((_step2 = _iterator2.n()).done) {
11761
- _context1.next = 57;
11778
+ _context1.next = 59;
11762
11779
  break;
11763
11780
  }
11764
11781
  address = _step2.value;
11765
11782
  action = category === "txns" ? "account.txlist" : "account.balance";
11766
11783
  timeQuery = "";
11767
11784
  if (!(category === "txns")) {
11768
- _context1.next = 32;
11785
+ _context1.next = 34;
11769
11786
  break;
11770
11787
  }
11771
- _context1.next = 25;
11788
+ _context1.next = 27;
11772
11789
  return fromTimeStampToBlock(startTime, chain, API_KEY);
11773
11790
 
11774
- case 25:
11791
+ case 27:
11775
11792
  startBlock = _context1.sent;
11776
- _context1.next = 28;
11793
+ _context1.next = 30;
11777
11794
  return fromTimeStampToBlock(endTime, chain, API_KEY);
11778
11795
 
11779
- case 28:
11796
+ case 30:
11780
11797
  endBlock = _context1.sent;
11781
- timeQuery = "&startblock=".concat(startBlock, "&endblock=").concat(endBlock);
11782
- _context1.next = 33;
11798
+ timeQuery = "&startblock=".concat(startBlock, "&endblock=").concat(endBlock, "&page=").concat(page, "&offset=").concat(offset, "&sort=asc");
11799
+ _context1.next = 35;
11783
11800
  break;
11784
11801
 
11785
- case 32:
11802
+ case 34:
11786
11803
  timeQuery = "&tag=latest";
11787
11804
 
11788
- case 33:
11789
- url = "https://api.etherscan.io/v2/api?module=".concat(action.split(".")[0], "&action=").concat(action.split(".")[1], "&address=").concat(address, "&sort=asc&chainid=").concat(chainId, "&apikey=").concat(API_KEY).concat(timeQuery);
11790
- _context1.prev = 34;
11791
- _context1.next = 37;
11805
+ case 35:
11806
+ url = "https://api.etherscan.io/v2/api?module=".concat(action.split(".")[0], "&action=").concat(action.split(".")[1], "&address=").concat(address, "&chainid=").concat(chainId, "&apikey=").concat(API_KEY).concat(timeQuery);
11807
+ _context1.prev = 36;
11808
+ _context1.next = 39;
11792
11809
  return fetch(url);
11793
11810
 
11794
- case 37:
11811
+ case 39:
11795
11812
  response = _context1.sent;
11796
11813
  if (response.ok) {
11797
- _context1.next = 40;
11814
+ _context1.next = 42;
11798
11815
  break;
11799
11816
  }
11800
11817
  return _context1.abrupt("return", "HTTP_".concat(response.status));
11801
11818
 
11802
- case 40:
11803
- _context1.next = 42;
11819
+ case 42:
11820
+ _context1.next = 44;
11804
11821
  return response.json();
11805
11822
 
11806
- case 42:
11823
+ case 44:
11807
11824
  json = _context1.sent;
11808
11825
  if (!((_json$result3 = json.result) !== null && _json$result3 !== void 0 && (_json$result3$include = _json$result3.includes) !== null && _json$result3$include !== void 0 && _json$result3$include.call(_json$result3, "Invalid API Key"))) {
11809
- _context1.next = 45;
11826
+ _context1.next = 47;
11810
11827
  break;
11811
11828
  }
11812
11829
  return _context1.abrupt("return", "".concat(SERVICE_API_KEY.Etherscan).concat(ERROR_MESSAGES_FLAG.INVALID_API_KEY));
11813
11830
 
11814
- case 45:
11831
+ case 47:
11815
11832
  if (!((_json$result4 = json.result) !== null && _json$result4 !== void 0 && (_json$result4$include = _json$result4.includes) !== null && _json$result4$include !== void 0 && _json$result4$include.call(_json$result4, "Max rate limit reached"))) {
11816
- _context1.next = 47;
11833
+ _context1.next = 49;
11817
11834
  break;
11818
11835
  }
11819
11836
  return _context1.abrupt("return", "".concat(SERVICE_API_KEY.Etherscan).concat(ERROR_MESSAGES_FLAG.RATE_LIMIT));
11820
11837
 
11821
- case 47:
11838
+ case 49:
11822
11839
  entries = Array.isArray(json.result) ? json.result : [ json.result ];
11823
11840
  _iterator3 = _createForOfIteratorHelper(entries);
11824
11841
  try {
@@ -11834,64 +11851,64 @@ function _typeof(o) {
11834
11851
  } finally {
11835
11852
  _iterator3.f();
11836
11853
  }
11837
- _context1.next = 55;
11854
+ _context1.next = 57;
11838
11855
  break;
11839
11856
 
11840
- case 52:
11841
- _context1.prev = 52;
11842
- _context1.t0 = _context1["catch"](34);
11857
+ case 54:
11858
+ _context1.prev = 54;
11859
+ _context1.t0 = _context1["catch"](36);
11843
11860
  return _context1.abrupt("return", ERROR_MESSAGES_FLAG.DEFAULT);
11844
11861
 
11845
- case 55:
11846
- _context1.next = 18;
11847
- break;
11848
-
11849
11862
  case 57:
11850
- _context1.next = 62;
11863
+ _context1.next = 20;
11851
11864
  break;
11852
11865
 
11853
11866
  case 59:
11854
- _context1.prev = 59;
11855
- _context1.t1 = _context1["catch"](16);
11867
+ _context1.next = 64;
11868
+ break;
11869
+
11870
+ case 61:
11871
+ _context1.prev = 61;
11872
+ _context1.t1 = _context1["catch"](18);
11856
11873
  _iterator2.e(_context1.t1);
11857
11874
 
11858
- case 62:
11859
- _context1.prev = 62;
11875
+ case 64:
11876
+ _context1.prev = 64;
11860
11877
  _iterator2.f();
11861
- return _context1.finish(62);
11862
-
11863
- case 65:
11864
- _context1.next = 10;
11865
- break;
11878
+ return _context1.finish(64);
11866
11879
 
11867
11880
  case 67:
11868
- _context1.next = 72;
11881
+ _context1.next = 12;
11869
11882
  break;
11870
11883
 
11871
11884
  case 69:
11872
- _context1.prev = 69;
11873
- _context1.t2 = _context1["catch"](8);
11885
+ _context1.next = 74;
11886
+ break;
11887
+
11888
+ case 71:
11889
+ _context1.prev = 71;
11890
+ _context1.t2 = _context1["catch"](10);
11874
11891
  _iterator.e(_context1.t2);
11875
11892
 
11876
- case 72:
11877
- _context1.prev = 72;
11893
+ case 74:
11894
+ _context1.prev = 74;
11878
11895
  _iterator.f();
11879
- return _context1.finish(72);
11896
+ return _context1.finish(74);
11880
11897
 
11881
- case 75:
11898
+ case 77:
11882
11899
  return _context1.abrupt("return", flatResults);
11883
11900
 
11884
- case 78:
11885
- _context1.prev = 78;
11886
- _context1.t3 = _context1["catch"](0);
11901
+ case 80:
11902
+ _context1.prev = 80;
11903
+ _context1.t3 = _context1["catch"](2);
11887
11904
  console.log(_context1.t3);
11888
11905
  return _context1.abrupt("return", ERROR_MESSAGES_FLAG.DEFAULT);
11889
11906
 
11890
- case 82:
11907
+ case 84:
11891
11908
  case "end":
11892
11909
  return _context1.stop();
11893
11910
  }
11894
- }), _callee1, null, [ [ 0, 78 ], [ 8, 69, 72, 75 ], [ 16, 59, 62, 65 ], [ 34, 52 ] ]);
11911
+ }), _callee1, null, [ [ 2, 80 ], [ 10, 71, 74, 77 ], [ 18, 61, 64, 67 ], [ 36, 54 ] ]);
11895
11912
  })));
11896
11913
  return _EOA.apply(this, arguments);
11897
11914
  }