@fileverse-dev/formulajs 4.4.11-mod-68-patch-9 → 4.4.11-mod-73

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-68-patch-9 */
1
+ /* @fileverse-dev/formulajs v4.4.11-mod-73 */
2
2
  var _excluded = [ "confirmations", "dataDecoded" ];
3
3
 
4
4
  function _objectWithoutProperties(e, t) {
@@ -11068,41 +11068,42 @@ function _typeof(o) {
11068
11068
  Neynar: "Neynar",
11069
11069
  Defillama: "Defillama"
11070
11070
  };
11071
+ var stagingFileverseProxyUrl = "https://staging-api-proxy-ca4268d7d581.herokuapp.com/proxy";
11071
11072
  var PROXY_MAP = {
11072
11073
  Etherscan: {
11073
- url: "https://staging-api-proxy-ca4268d7d581.herokuapp.com/proxy",
11074
+ url: process.env.NEXT_PUBLIC_PROXY_BASE_URL || stagingFileverseProxyUrl,
11074
11075
  removeParams: [ "apikey" ]
11075
11076
  },
11076
11077
  Basescan: {
11077
- url: "https://staging-api-proxy-ca4268d7d581.herokuapp.com/proxy",
11078
+ url: process.env.NEXT_PUBLIC_PROXY_BASE_URL || stagingFileverseProxyUrl,
11078
11079
  removeParams: [ "apikey" ]
11079
11080
  },
11080
11081
  Gnosisscan: {
11081
- url: "https://staging-api-proxy-ca4268d7d581.herokuapp.com/proxy",
11082
+ url: process.env.NEXT_PUBLIC_PROXY_BASE_URL || stagingFileverseProxyUrl,
11082
11083
  removeParams: [ "apikey" ]
11083
11084
  },
11084
11085
  Coingecko: {
11085
- url: "https://staging-api-proxy-ca4268d7d581.herokuapp.com/proxy",
11086
+ url: process.env.NEXT_PUBLIC_PROXY_BASE_URL || stagingFileverseProxyUrl,
11086
11087
  removeParams: [ "apikey" ]
11087
11088
  },
11088
11089
  Firefly: {
11089
- url: "https://staging-api-proxy-ca4268d7d581.herokuapp.com/proxy",
11090
+ url: process.env.NEXT_PUBLIC_PROXY_BASE_URL || stagingFileverseProxyUrl,
11090
11091
  removeParams: [ "apikey" ]
11091
11092
  },
11092
11093
  Neynar: {
11093
- url: "https://staging-api-proxy-ca4268d7d581.herokuapp.com/proxy",
11094
+ url: process.env.NEXT_PUBLIC_PROXY_BASE_URL || stagingFileverseProxyUrl,
11094
11095
  removeParams: [ "api_key" ]
11095
11096
  },
11096
11097
  Safe: {
11097
- url: "https://staging-api-proxy-ca4268d7d581.herokuapp.com/proxy",
11098
+ url: process.env.NEXT_PUBLIC_PROXY_BASE_URL || stagingFileverseProxyUrl,
11098
11099
  removeParams: [ "api_key" ]
11099
11100
  },
11100
11101
  Defillama: {
11101
- url: "https://staging-api-proxy-ca4268d7d581.herokuapp.com/proxy",
11102
+ url: process.env.NEXT_PUBLIC_PROXY_BASE_URL || stagingFileverseProxyUrl,
11102
11103
  removeParams: [ "api_key" ]
11103
11104
  },
11104
11105
  GnosisPay: {
11105
- url: "https://staging-api-proxy-ca4268d7d581.herokuapp.com/proxy",
11106
+ url: process.env.NEXT_PUBLIC_PROXY_BASE_URL || stagingFileverseProxyUrl,
11106
11107
  removeParams: [ "api_key" ]
11107
11108
  }
11108
11109
  };
@@ -11120,7 +11121,6 @@ function _typeof(o) {
11120
11121
  }
11121
11122
  function getUrlAndHeaders(_ref) {
11122
11123
  var url = _ref.url, serviceName = _ref.serviceName, _ref$headers = _ref.headers, headers = _ref$headers === void 0 ? {} : _ref$headers;
11123
- console.log("getUrlAndHeaders new modified function from formulajs", url, serviceName);
11124
11124
  var apiKeyLS = window.localStorage.getItem(SERVICES_API_KEY[serviceName]);
11125
11125
  var isProxyModeEnabledValue = apiKeyLS === "DEFAULT_PROXY_MODE";
11126
11126
  var proxyConfig = PROXY_MAP[serviceName];
@@ -11138,9 +11138,7 @@ function _typeof(o) {
11138
11138
  }
11139
11139
  return {
11140
11140
  URL: url,
11141
- HEADERS: _objectSpread(_objectSpread({}, headers), {}, {
11142
- method: "GET"
11143
- })
11141
+ HEADERS: _objectSpread({}, headers)
11144
11142
  };
11145
11143
  }
11146
11144
  var fromTimeStampToBlock = function() {
@@ -11149,41 +11147,36 @@ function _typeof(o) {
11149
11147
  return _regeneratorRuntime().wrap((function _callee$(_context) {
11150
11148
  while (1) switch (_context.prev = _context.next) {
11151
11149
  case 0:
11152
- console.log("fromTimeStampToBlock", timestamp, chain, apiKey);
11153
11150
  if (!(!timestamp || !chain || !apiKey)) {
11154
- _context.next = 3;
11151
+ _context.next = 2;
11155
11152
  break;
11156
11153
  }
11157
11154
  return _context.abrupt("return");
11158
11155
 
11159
- case 3:
11156
+ case 2:
11160
11157
  chainId = CHAIN_ID_MAP[chain];
11161
- console.log("chainId", chainId);
11162
11158
  url = "https://api.etherscan.io/v2/api?module=block&action=getblocknobytime&timestamp=".concat(timestamp, "&closest=before&apikey=").concat(apiKey, "&chainId=").concat(chainId);
11163
- console.log("url", url, getUrlAndHeaders);
11164
11159
  _getUrlAndHeaders = getUrlAndHeaders({
11165
11160
  url: url,
11166
11161
  serviceName: "Etherscan",
11167
11162
  headers: {}
11168
11163
  }), finalUrl = _getUrlAndHeaders.URL, HEADERS = _getUrlAndHeaders.HEADERS;
11169
- console.log("finalUrl", finalUrl, HEADERS);
11170
- _context.next = 11;
11164
+ _context.next = 7;
11171
11165
  return fetch(finalUrl, {
11172
11166
  method: "GET",
11173
11167
  headers: HEADERS
11174
11168
  });
11175
11169
 
11176
- case 11:
11170
+ case 7:
11177
11171
  res = _context.sent;
11178
- console.log("res", res, finalUrl, HEADERS);
11179
- _context.next = 15;
11172
+ _context.next = 10;
11180
11173
  return res.json();
11181
11174
 
11182
- case 15:
11175
+ case 10:
11183
11176
  json = _context.sent;
11184
11177
  return _context.abrupt("return", parseInt(json.result));
11185
11178
 
11186
- case 17:
11179
+ case 12:
11187
11180
  case "end":
11188
11181
  return _context.stop();
11189
11182
  }
@@ -11417,7 +11410,7 @@ function _typeof(o) {
11417
11410
  case 30:
11418
11411
  _getUrlAndHeaders3 = getUrlAndHeaders({
11419
11412
  url: url,
11420
- serviceName: "Etherscan",
11413
+ serviceName: apiInfo.apiKeyName,
11421
11414
  headers: {}
11422
11415
  }), finalUrl = _getUrlAndHeaders3.URL, HEADERS = _getUrlAndHeaders3.HEADERS;
11423
11416
  _context10.next = 33;
@@ -17638,48 +17631,47 @@ function _typeof(o) {
17638
17631
  serviceName: "Etherscan",
17639
17632
  headers: {}
17640
17633
  }), finalUrl = _getUrlAndHeaders9.URL, HEADERS = _getUrlAndHeaders9.HEADERS;
17641
- console.log("finalUrl", finalUrl, HEADERS);
17642
- _context20.next = 4;
17634
+ _context20.next = 3;
17643
17635
  return fetch(finalUrl, {
17644
17636
  method: "GET",
17645
17637
  headers: HEADERS
17646
17638
  });
17647
17639
 
17648
- case 4:
17640
+ case 3:
17649
17641
  res = _context20.sent;
17650
17642
  if (res.ok) {
17651
- _context20.next = 7;
17643
+ _context20.next = 6;
17652
17644
  break;
17653
17645
  }
17654
17646
  throw new NetworkError(SERVICES_API_KEY.Etherscan, res.status);
17655
17647
 
17656
- case 7:
17657
- _context20.next = 9;
17648
+ case 6:
17649
+ _context20.next = 8;
17658
17650
  return res.json();
17659
17651
 
17660
- case 9:
17652
+ case 8:
17661
17653
  json = _context20.sent;
17662
17654
  if (!(typeof json.result === "string")) {
17663
- _context20.next = 15;
17655
+ _context20.next = 14;
17664
17656
  break;
17665
17657
  }
17666
17658
  if (!json.result.includes("Invalid API Key")) {
17667
- _context20.next = 13;
17659
+ _context20.next = 12;
17668
17660
  break;
17669
17661
  }
17670
17662
  throw new InvalidApiKeyError(SERVICES_API_KEY.Etherscan);
17671
17663
 
17672
- case 13:
17664
+ case 12:
17673
17665
  if (!json.result.includes("Max rate limit reached")) {
17674
- _context20.next = 15;
17666
+ _context20.next = 14;
17675
17667
  break;
17676
17668
  }
17677
17669
  throw new RateLimitError(SERVICES_API_KEY.Etherscan);
17678
17670
 
17679
- case 15:
17671
+ case 14:
17680
17672
  return _context20.abrupt("return", json.result);
17681
17673
 
17682
- case 16:
17674
+ case 15:
17683
17675
  case "end":
17684
17676
  return _context20.stop();
17685
17677
  }
@@ -17704,14 +17696,13 @@ function _typeof(o) {
17704
17696
  offset: offset
17705
17697
  });
17706
17698
  apiKey = window.localStorage.getItem(SERVICES_API_KEY.Etherscan);
17707
- console.log("apiKey", apiKey);
17708
17699
  if (apiKey) {
17709
- _context24.next = 9;
17700
+ _context24.next = 8;
17710
17701
  break;
17711
17702
  }
17712
17703
  throw new MissingApiKeyError(SERVICES_API_KEY.Etherscan);
17713
17704
 
17714
- case 9:
17705
+ case 8:
17715
17706
  INPUTS = addresses.split(",").map((function(s) {
17716
17707
  return s.trim();
17717
17708
  })).filter(Boolean);
@@ -17720,84 +17711,81 @@ function _typeof(o) {
17720
17711
  })).filter(Boolean);
17721
17712
  ADDRESS_MAP = {};
17722
17713
  _iterator41 = _createForOfIteratorHelper(INPUTS);
17723
- _context24.prev = 13;
17714
+ _context24.prev = 12;
17724
17715
  _iterator41.s();
17725
17716
 
17726
- case 15:
17717
+ case 14:
17727
17718
  if ((_step41 = _iterator41.n()).done) {
17728
- _context24.next = 30;
17719
+ _context24.next = 29;
17729
17720
  break;
17730
17721
  }
17731
17722
  inp = _step41.value;
17732
17723
  if (!isAddress$1.isAddress(inp)) {
17733
- _context24.next = 21;
17724
+ _context24.next = 20;
17734
17725
  break;
17735
17726
  }
17736
17727
  ADDRESS_MAP[inp.toLowerCase()] = null;
17737
- _context24.next = 28;
17728
+ _context24.next = 27;
17738
17729
  break;
17739
17730
 
17740
- case 21:
17731
+ case 20:
17741
17732
  ens = inp;
17742
- _context24.next = 24;
17733
+ _context24.next = 23;
17743
17734
  return fromEnsNameToAddress$1.fromEnsNameToAddress(ens);
17744
17735
 
17745
- case 24:
17736
+ case 23:
17746
17737
  resolved = _context24.sent;
17747
17738
  if (resolved) {
17748
- _context24.next = 27;
17739
+ _context24.next = 26;
17749
17740
  break;
17750
17741
  }
17751
17742
  throw new EnsError(ens);
17752
17743
 
17753
- case 27:
17744
+ case 26:
17754
17745
  ADDRESS_MAP[resolved.toLowerCase()] = ens;
17755
17746
 
17756
- case 28:
17757
- _context24.next = 15;
17747
+ case 27:
17748
+ _context24.next = 14;
17758
17749
  break;
17759
17750
 
17760
- case 30:
17761
- _context24.next = 35;
17751
+ case 29:
17752
+ _context24.next = 34;
17762
17753
  break;
17763
17754
 
17764
- case 32:
17765
- _context24.prev = 32;
17766
- _context24.t0 = _context24["catch"](13);
17755
+ case 31:
17756
+ _context24.prev = 31;
17757
+ _context24.t0 = _context24["catch"](12);
17767
17758
  _iterator41.e(_context24.t0);
17768
17759
 
17769
- case 35:
17770
- _context24.prev = 35;
17760
+ case 34:
17761
+ _context24.prev = 34;
17771
17762
  _iterator41.f();
17772
- return _context24.finish(35);
17763
+ return _context24.finish(34);
17773
17764
 
17774
- case 38:
17765
+ case 37:
17775
17766
  ADDRS = Object.keys(ADDRESS_MAP);
17776
17767
  console.log("ADDRS", ADDRS);
17777
17768
  out = [];
17778
17769
  _iterator42 = _createForOfIteratorHelper(CHAINS);
17779
- _context24.prev = 42;
17770
+ _context24.prev = 41;
17780
17771
  _loop = _regeneratorRuntime().mark((function _loop() {
17781
17772
  var chain, chainId, _loop2, _ret2, i, sb, eb, _loop3, _ret3, _i16, _ADDRS;
17782
17773
  return _regeneratorRuntime().wrap((function _loop$(_context23) {
17783
17774
  while (1) switch (_context23.prev = _context23.next) {
17784
17775
  case 0:
17785
17776
  chain = _step42.value;
17786
- console.log("chain", chain);
17787
17777
  chainId = CHAIN_ID_MAP[chain];
17788
17778
  if (chainId) {
17789
- _context23.next = 5;
17779
+ _context23.next = 4;
17790
17780
  break;
17791
17781
  }
17792
17782
  throw new ValidationError("Invalid chain: ".concat(chain));
17793
17783
 
17794
- case 5:
17795
- console.log("chain", chain);
17784
+ case 4:
17796
17785
  if (!(category === "balance")) {
17797
- _context23.next = 20;
17786
+ _context23.next = 17;
17798
17787
  break;
17799
17788
  }
17800
- console.log("balance");
17801
17789
  _loop2 = _regeneratorRuntime().mark((function _loop2(i) {
17802
17790
  var slice, url, data;
17803
17791
  return _regeneratorRuntime().wrap((function _loop2$(_context21) {
@@ -17837,57 +17825,55 @@ function _typeof(o) {
17837
17825
  }));
17838
17826
  i = 0;
17839
17827
 
17840
- case 10:
17828
+ case 7:
17841
17829
  if (!(i < ADDRS.length)) {
17842
- _context23.next = 18;
17830
+ _context23.next = 15;
17843
17831
  break;
17844
17832
  }
17845
- return _context23.delegateYield(_loop2(i), "t0", 12);
17833
+ return _context23.delegateYield(_loop2(i), "t0", 9);
17846
17834
 
17847
- case 12:
17835
+ case 9:
17848
17836
  _ret2 = _context23.t0;
17849
17837
  if (!_ret2) {
17850
- _context23.next = 15;
17838
+ _context23.next = 12;
17851
17839
  break;
17852
17840
  }
17853
17841
  return _context23.abrupt("return", _ret2.v);
17854
17842
 
17855
- case 15:
17843
+ case 12:
17856
17844
  i += 20;
17857
- _context23.next = 10;
17845
+ _context23.next = 7;
17858
17846
  break;
17859
17847
 
17860
- case 18:
17861
- _context23.next = 42;
17848
+ case 15:
17849
+ _context23.next = 37;
17862
17850
  break;
17863
17851
 
17864
- case 20:
17865
- console.log("startTime", startTime, "endTime", endTime, chain, apiKey);
17866
- _context23.next = 23;
17852
+ case 17:
17853
+ _context23.next = 19;
17867
17854
  return fromTimestampToBlock.fromTimeStampToBlock(toTimestamp(startTime), chain, apiKey);
17868
17855
 
17869
- case 23:
17856
+ case 19:
17870
17857
  sb = _context23.sent;
17871
- _context23.next = 26;
17858
+ _context23.next = 22;
17872
17859
  return fromTimestampToBlock.fromTimeStampToBlock(toTimestamp(endTime), chain, apiKey);
17873
17860
 
17874
- case 26:
17861
+ case 22:
17875
17862
  eb = _context23.sent;
17876
- console.log("sb", sb, "eb", eb);
17877
17863
  if (sb) {
17878
- _context23.next = 30;
17864
+ _context23.next = 25;
17879
17865
  break;
17880
17866
  }
17881
17867
  throw new ValidationError("Invalid startTime: ".concat(startTime));
17882
17868
 
17883
- case 30:
17869
+ case 25:
17884
17870
  if (eb) {
17885
- _context23.next = 32;
17871
+ _context23.next = 27;
17886
17872
  break;
17887
17873
  }
17888
17874
  throw new ValidationError("Invalid endTime: ".concat(endTime));
17889
17875
 
17890
- case 32:
17876
+ case 27:
17891
17877
  _loop3 = _regeneratorRuntime().mark((function _loop3() {
17892
17878
  var addr, url, data;
17893
17879
  return _regeneratorRuntime().wrap((function _loop3$(_context22) {
@@ -17927,27 +17913,27 @@ function _typeof(o) {
17927
17913
  }));
17928
17914
  _i16 = 0, _ADDRS = ADDRS;
17929
17915
 
17930
- case 34:
17916
+ case 29:
17931
17917
  if (!(_i16 < _ADDRS.length)) {
17932
- _context23.next = 42;
17918
+ _context23.next = 37;
17933
17919
  break;
17934
17920
  }
17935
- return _context23.delegateYield(_loop3(), "t1", 36);
17921
+ return _context23.delegateYield(_loop3(), "t1", 31);
17936
17922
 
17937
- case 36:
17923
+ case 31:
17938
17924
  _ret3 = _context23.t1;
17939
17925
  if (!_ret3) {
17940
- _context23.next = 39;
17926
+ _context23.next = 34;
17941
17927
  break;
17942
17928
  }
17943
17929
  return _context23.abrupt("return", _ret3.v);
17944
17930
 
17945
- case 39:
17931
+ case 34:
17946
17932
  _i16++;
17947
- _context23.next = 34;
17933
+ _context23.next = 29;
17948
17934
  break;
17949
17935
 
17950
- case 42:
17936
+ case 37:
17951
17937
  case "end":
17952
17938
  return _context23.stop();
17953
17939
  }
@@ -17955,52 +17941,52 @@ function _typeof(o) {
17955
17941
  }));
17956
17942
  _iterator42.s();
17957
17943
 
17958
- case 45:
17944
+ case 44:
17959
17945
  if ((_step42 = _iterator42.n()).done) {
17960
- _context24.next = 52;
17946
+ _context24.next = 51;
17961
17947
  break;
17962
17948
  }
17963
- return _context24.delegateYield(_loop(), "t1", 47);
17949
+ return _context24.delegateYield(_loop(), "t1", 46);
17964
17950
 
17965
- case 47:
17951
+ case 46:
17966
17952
  _ret = _context24.t1;
17967
17953
  if (!_ret) {
17968
- _context24.next = 50;
17954
+ _context24.next = 49;
17969
17955
  break;
17970
17956
  }
17971
17957
  return _context24.abrupt("return", _ret.v);
17972
17958
 
17973
- case 50:
17974
- _context24.next = 45;
17959
+ case 49:
17960
+ _context24.next = 44;
17975
17961
  break;
17976
17962
 
17977
- case 52:
17978
- _context24.next = 57;
17963
+ case 51:
17964
+ _context24.next = 56;
17979
17965
  break;
17980
17966
 
17981
- case 54:
17982
- _context24.prev = 54;
17983
- _context24.t2 = _context24["catch"](42);
17967
+ case 53:
17968
+ _context24.prev = 53;
17969
+ _context24.t2 = _context24["catch"](41);
17984
17970
  _iterator42.e(_context24.t2);
17985
17971
 
17986
- case 57:
17987
- _context24.prev = 57;
17972
+ case 56:
17973
+ _context24.prev = 56;
17988
17974
  _iterator42.f();
17989
- return _context24.finish(57);
17975
+ return _context24.finish(56);
17990
17976
 
17991
- case 60:
17977
+ case 59:
17992
17978
  return _context24.abrupt("return", out);
17993
17979
 
17994
- case 63:
17995
- _context24.prev = 63;
17980
+ case 62:
17981
+ _context24.prev = 62;
17996
17982
  _context24.t3 = _context24["catch"](1);
17997
17983
  return _context24.abrupt("return", errorMessageHandler(_context24.t3, "EOA"));
17998
17984
 
17999
- case 66:
17985
+ case 65:
18000
17986
  case "end":
18001
17987
  return _context24.stop();
18002
17988
  }
18003
- }), _callee21, null, [ [ 1, 63 ], [ 13, 32, 35, 38 ], [ 42, 54, 57, 60 ] ]);
17989
+ }), _callee21, null, [ [ 1, 62 ], [ 12, 31, 34, 37 ], [ 41, 53, 56, 59 ] ]);
18004
17990
  })));
18005
17991
  return _EOA.apply(this, arguments);
18006
17992
  }