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