@fileverse-dev/formulajs 4.4.11-mod-74 → 4.4.11-mod-76
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 +184 -264
- package/lib/browser/formula.min.js +2 -2
- package/lib/browser/formula.min.js.map +1 -1
- package/lib/cjs/index.cjs +8 -26
- package/lib/esm/index.mjs +8 -26
- 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-76 */
|
|
2
2
|
var _excluded = [ "confirmations", "dataDecoded" ];
|
|
3
3
|
|
|
4
4
|
function _objectWithoutProperties(e, t) {
|
|
@@ -11181,13 +11181,12 @@ function _typeof(o) {
|
|
|
11181
11181
|
function getUrlAndHeaders(_ref) {
|
|
11182
11182
|
var url = _ref.url, serviceName = _ref.serviceName, _ref$headers = _ref.headers, headers = _ref$headers === void 0 ? {} : _ref$headers;
|
|
11183
11183
|
var apiKeyLS = window.localStorage.getItem(SERVICES_API_KEY[serviceName]);
|
|
11184
|
-
if (SERVICES_API_KEY[serviceName] && (!apiKeyLS || apiKeyLS === "")) {
|
|
11185
|
-
throw new MissingApiKeyError(SERVICES_API_KEY[serviceName]);
|
|
11186
|
-
}
|
|
11187
11184
|
var isProxyModeEnabledValue = apiKeyLS === "DEFAULT_PROXY_MODE";
|
|
11188
11185
|
var proxyConfig = PROXY_MAP[serviceName];
|
|
11189
|
-
if (
|
|
11190
|
-
|
|
11186
|
+
if (!proxyConfig && SERVICES_API_KEY[serviceName] && (!apiKeyLS || apiKeyLS === "")) {
|
|
11187
|
+
throw new MissingApiKeyError(SERVICES_API_KEY[serviceName]);
|
|
11188
|
+
}
|
|
11189
|
+
if ((isProxyModeEnabledValue || !apiKeyLS || apiKeyLS === "") && proxyConfig) {
|
|
11191
11190
|
var cleanedUrl = removeUrlParams(url, proxyConfig.removeParams);
|
|
11192
11191
|
return {
|
|
11193
11192
|
URL: proxyConfig.url,
|
|
@@ -11209,7 +11208,7 @@ function _typeof(o) {
|
|
|
11209
11208
|
return _regeneratorRuntime().wrap((function _callee$(_context) {
|
|
11210
11209
|
while (1) switch (_context.prev = _context.next) {
|
|
11211
11210
|
case 0:
|
|
11212
|
-
if (!(!timestamp || !chain
|
|
11211
|
+
if (!(!timestamp || !chain)) {
|
|
11213
11212
|
_context.next = 2;
|
|
11214
11213
|
break;
|
|
11215
11214
|
}
|
|
@@ -16803,13 +16802,6 @@ function _typeof(o) {
|
|
|
16803
16802
|
end: end
|
|
16804
16803
|
});
|
|
16805
16804
|
apiKey = window.localStorage.getItem(SERVICES_API_KEY.Firefly);
|
|
16806
|
-
if (apiKey) {
|
|
16807
|
-
_context11.next = 6;
|
|
16808
|
-
break;
|
|
16809
|
-
}
|
|
16810
|
-
throw new MissingApiKeyError(SERVICES_API_KEY.Firefly);
|
|
16811
|
-
|
|
16812
|
-
case 6:
|
|
16813
16805
|
url = new URL("https://openapi.firefly.land/v1/fileverse/fetch");
|
|
16814
16806
|
url.searchParams.set("query", identifier.split(",").map((function(s) {
|
|
16815
16807
|
return s.trim();
|
|
@@ -16824,34 +16816,34 @@ function _typeof(o) {
|
|
|
16824
16816
|
"x-api-key": apiKey
|
|
16825
16817
|
}
|
|
16826
16818
|
}), finalUrl = _getUrlAndHeaders4.URL, HEADERS = _getUrlAndHeaders4.HEADERS;
|
|
16827
|
-
_context11.next =
|
|
16819
|
+
_context11.next = 12;
|
|
16828
16820
|
return fetch(finalUrl, {
|
|
16829
16821
|
method: "GET",
|
|
16830
16822
|
headers: HEADERS
|
|
16831
16823
|
});
|
|
16832
16824
|
|
|
16833
|
-
case
|
|
16825
|
+
case 12:
|
|
16834
16826
|
response = _context11.sent;
|
|
16835
16827
|
if (response.ok) {
|
|
16836
|
-
_context11.next =
|
|
16828
|
+
_context11.next = 15;
|
|
16837
16829
|
break;
|
|
16838
16830
|
}
|
|
16839
16831
|
throw new NetworkError(SERVICES_API_KEY.Firefly, response.status);
|
|
16840
16832
|
|
|
16841
|
-
case
|
|
16842
|
-
_context11.next =
|
|
16833
|
+
case 15:
|
|
16834
|
+
_context11.next = 17;
|
|
16843
16835
|
return response.json();
|
|
16844
16836
|
|
|
16845
|
-
case
|
|
16837
|
+
case 17:
|
|
16846
16838
|
_yield$response$json = _context11.sent;
|
|
16847
16839
|
_data = _yield$response$json.data;
|
|
16848
16840
|
if (Array.isArray(_data)) {
|
|
16849
|
-
_context11.next =
|
|
16841
|
+
_context11.next = 21;
|
|
16850
16842
|
break;
|
|
16851
16843
|
}
|
|
16852
16844
|
return _context11.abrupt("return", []);
|
|
16853
16845
|
|
|
16854
|
-
case
|
|
16846
|
+
case 21:
|
|
16855
16847
|
return _context11.abrupt("return", _data.map((function(item) {
|
|
16856
16848
|
var flat = {};
|
|
16857
16849
|
for (var _i10 = 0, _Object$entries = Object.entries(item); _i10 < _Object$entries.length; _i10++) {
|
|
@@ -16864,16 +16856,16 @@ function _typeof(o) {
|
|
|
16864
16856
|
return flat;
|
|
16865
16857
|
})));
|
|
16866
16858
|
|
|
16867
|
-
case
|
|
16868
|
-
_context11.prev =
|
|
16859
|
+
case 24:
|
|
16860
|
+
_context11.prev = 24;
|
|
16869
16861
|
_context11.t0 = _context11["catch"](0);
|
|
16870
16862
|
return _context11.abrupt("return", errorMessageHandler(_context11.t0, "FIREFLY"));
|
|
16871
16863
|
|
|
16872
|
-
case
|
|
16864
|
+
case 27:
|
|
16873
16865
|
case "end":
|
|
16874
16866
|
return _context11.stop();
|
|
16875
16867
|
}
|
|
16876
|
-
}), _callee11, null, [ [ 0,
|
|
16868
|
+
}), _callee11, null, [ [ 0, 24 ] ]);
|
|
16877
16869
|
})));
|
|
16878
16870
|
return _FIREFLY.apply(this, arguments);
|
|
16879
16871
|
}
|
|
@@ -16898,13 +16890,6 @@ function _typeof(o) {
|
|
|
16898
16890
|
end: end
|
|
16899
16891
|
});
|
|
16900
16892
|
apiKey = window.localStorage.getItem(SERVICES_API_KEY.Firefly);
|
|
16901
|
-
if (apiKey) {
|
|
16902
|
-
_context12.next = 6;
|
|
16903
|
-
break;
|
|
16904
|
-
}
|
|
16905
|
-
throw new MissingApiKeyError(SERVICES_API_KEY.Firefly);
|
|
16906
|
-
|
|
16907
|
-
case 6:
|
|
16908
16893
|
url = new URL("https://openapi.firefly.land/v1/fileverse/fetch");
|
|
16909
16894
|
url.searchParams.set("query", identifier.split(",").map((function(s) {
|
|
16910
16895
|
return s.trim();
|
|
@@ -16923,34 +16908,34 @@ function _typeof(o) {
|
|
|
16923
16908
|
"x-api-key": apiKey
|
|
16924
16909
|
}
|
|
16925
16910
|
}), finalUrl = _getUrlAndHeaders5.URL, HEADERS = _getUrlAndHeaders5.HEADERS;
|
|
16926
|
-
_context12.next =
|
|
16911
|
+
_context12.next = 13;
|
|
16927
16912
|
return fetch(finalUrl, {
|
|
16928
16913
|
method: "GET",
|
|
16929
16914
|
headers: HEADERS
|
|
16930
16915
|
});
|
|
16931
16916
|
|
|
16932
|
-
case
|
|
16917
|
+
case 13:
|
|
16933
16918
|
response = _context12.sent;
|
|
16934
16919
|
if (response.ok) {
|
|
16935
|
-
_context12.next =
|
|
16920
|
+
_context12.next = 16;
|
|
16936
16921
|
break;
|
|
16937
16922
|
}
|
|
16938
16923
|
throw new NetworkError(SERVICES_API_KEY.Firefly, response.status);
|
|
16939
16924
|
|
|
16940
|
-
case
|
|
16941
|
-
_context12.next =
|
|
16925
|
+
case 16:
|
|
16926
|
+
_context12.next = 18;
|
|
16942
16927
|
return response.json();
|
|
16943
16928
|
|
|
16944
|
-
case
|
|
16929
|
+
case 18:
|
|
16945
16930
|
_yield$response$json2 = _context12.sent;
|
|
16946
16931
|
_data2 = _yield$response$json2.data;
|
|
16947
16932
|
if (Array.isArray(_data2)) {
|
|
16948
|
-
_context12.next =
|
|
16933
|
+
_context12.next = 22;
|
|
16949
16934
|
break;
|
|
16950
16935
|
}
|
|
16951
16936
|
return _context12.abrupt("return", []);
|
|
16952
16937
|
|
|
16953
|
-
case
|
|
16938
|
+
case 22:
|
|
16954
16939
|
return _context12.abrupt("return", _data2.map((function(item) {
|
|
16955
16940
|
var flat = {};
|
|
16956
16941
|
for (var _i11 = 0, _Object$entries2 = Object.entries(item); _i11 < _Object$entries2.length; _i11++) {
|
|
@@ -16963,16 +16948,16 @@ function _typeof(o) {
|
|
|
16963
16948
|
return flat;
|
|
16964
16949
|
})));
|
|
16965
16950
|
|
|
16966
|
-
case
|
|
16967
|
-
_context12.prev =
|
|
16951
|
+
case 25:
|
|
16952
|
+
_context12.prev = 25;
|
|
16968
16953
|
_context12.t0 = _context12["catch"](0);
|
|
16969
16954
|
return _context12.abrupt("return", errorMessageHandler(_context12.t0, "LENS"));
|
|
16970
16955
|
|
|
16971
|
-
case
|
|
16956
|
+
case 28:
|
|
16972
16957
|
case "end":
|
|
16973
16958
|
return _context12.stop();
|
|
16974
16959
|
}
|
|
16975
|
-
}), _callee12, null, [ [ 0,
|
|
16960
|
+
}), _callee12, null, [ [ 0, 25 ] ]);
|
|
16976
16961
|
})));
|
|
16977
16962
|
return _LENS.apply(this, arguments);
|
|
16978
16963
|
}
|
|
@@ -16997,13 +16982,6 @@ function _typeof(o) {
|
|
|
16997
16982
|
end: end
|
|
16998
16983
|
});
|
|
16999
16984
|
apiKey = window.localStorage.getItem(SERVICES_API_KEY.Firefly);
|
|
17000
|
-
if (apiKey) {
|
|
17001
|
-
_context13.next = 6;
|
|
17002
|
-
break;
|
|
17003
|
-
}
|
|
17004
|
-
throw new MissingApiKeyError(SERVICES_API_KEY.Firefly);
|
|
17005
|
-
|
|
17006
|
-
case 6:
|
|
17007
16985
|
url = new URL("https://openapi.firefly.land/v1/fileverse/fetch");
|
|
17008
16986
|
url.searchParams.set("query", identifier.split(",").map((function(s) {
|
|
17009
16987
|
return s.trim();
|
|
@@ -17023,34 +17001,34 @@ function _typeof(o) {
|
|
|
17023
17001
|
"x-api-key": apiKey
|
|
17024
17002
|
}
|
|
17025
17003
|
}), finalUrl = _getUrlAndHeaders6.URL, HEADERS = _getUrlAndHeaders6.HEADERS;
|
|
17026
|
-
_context13.next =
|
|
17004
|
+
_context13.next = 13;
|
|
17027
17005
|
return fetch(finalUrl, {
|
|
17028
17006
|
method: "GET",
|
|
17029
17007
|
headers: HEADERS
|
|
17030
17008
|
});
|
|
17031
17009
|
|
|
17032
|
-
case
|
|
17010
|
+
case 13:
|
|
17033
17011
|
response = _context13.sent;
|
|
17034
17012
|
if (response.ok) {
|
|
17035
|
-
_context13.next =
|
|
17013
|
+
_context13.next = 16;
|
|
17036
17014
|
break;
|
|
17037
17015
|
}
|
|
17038
17016
|
throw new NetworkError(SERVICES_API_KEY.Firefly, response.status);
|
|
17039
17017
|
|
|
17040
|
-
case
|
|
17041
|
-
_context13.next =
|
|
17018
|
+
case 16:
|
|
17019
|
+
_context13.next = 18;
|
|
17042
17020
|
return response.json();
|
|
17043
17021
|
|
|
17044
|
-
case
|
|
17022
|
+
case 18:
|
|
17045
17023
|
_yield$response$json3 = _context13.sent;
|
|
17046
17024
|
_data3 = _yield$response$json3.data;
|
|
17047
17025
|
if (Array.isArray(_data3)) {
|
|
17048
|
-
_context13.next =
|
|
17026
|
+
_context13.next = 22;
|
|
17049
17027
|
break;
|
|
17050
17028
|
}
|
|
17051
17029
|
return _context13.abrupt("return", []);
|
|
17052
17030
|
|
|
17053
|
-
case
|
|
17031
|
+
case 22:
|
|
17054
17032
|
return _context13.abrupt("return", _data3.map((function(item) {
|
|
17055
17033
|
var flat = {};
|
|
17056
17034
|
for (var _i12 = 0, _Object$entries3 = Object.entries(item); _i12 < _Object$entries3.length; _i12++) {
|
|
@@ -17063,16 +17041,16 @@ function _typeof(o) {
|
|
|
17063
17041
|
return flat;
|
|
17064
17042
|
})));
|
|
17065
17043
|
|
|
17066
|
-
case
|
|
17067
|
-
_context13.prev =
|
|
17044
|
+
case 25:
|
|
17045
|
+
_context13.prev = 25;
|
|
17068
17046
|
_context13.t0 = _context13["catch"](0);
|
|
17069
17047
|
return _context13.abrupt("return", errorMessageHandler(_context13.t0, "FARCASTER"));
|
|
17070
17048
|
|
|
17071
|
-
case
|
|
17049
|
+
case 28:
|
|
17072
17050
|
case "end":
|
|
17073
17051
|
return _context13.stop();
|
|
17074
17052
|
}
|
|
17075
|
-
}), _callee13, null, [ [ 0,
|
|
17053
|
+
}), _callee13, null, [ [ 0, 25 ] ]);
|
|
17076
17054
|
})));
|
|
17077
17055
|
return _FARCASTER.apply(this, arguments);
|
|
17078
17056
|
}
|
|
@@ -17205,14 +17183,7 @@ function _typeof(o) {
|
|
|
17205
17183
|
limit: limit
|
|
17206
17184
|
});
|
|
17207
17185
|
API_KEY = window.localStorage.getItem(SERVICES_API_KEY.Basescan);
|
|
17208
|
-
|
|
17209
|
-
_context15.next = 6;
|
|
17210
|
-
break;
|
|
17211
|
-
}
|
|
17212
|
-
throw new MissingApiKeyError(SERVICES_API_KEY.Basescan);
|
|
17213
|
-
|
|
17214
|
-
case 6:
|
|
17215
|
-
_context15.next = 8;
|
|
17186
|
+
_context15.next = 6;
|
|
17216
17187
|
return handleScanRequest({
|
|
17217
17188
|
type: type,
|
|
17218
17189
|
address: address,
|
|
@@ -17226,19 +17197,19 @@ function _typeof(o) {
|
|
|
17226
17197
|
network: "base"
|
|
17227
17198
|
});
|
|
17228
17199
|
|
|
17229
|
-
case
|
|
17200
|
+
case 6:
|
|
17230
17201
|
return _context15.abrupt("return", _context15.sent);
|
|
17231
17202
|
|
|
17232
|
-
case
|
|
17233
|
-
_context15.prev =
|
|
17203
|
+
case 9:
|
|
17204
|
+
_context15.prev = 9;
|
|
17234
17205
|
_context15.t0 = _context15["catch"](0);
|
|
17235
17206
|
return _context15.abrupt("return", errorMessageHandler(_context15.t0, "BASE"));
|
|
17236
17207
|
|
|
17237
|
-
case
|
|
17208
|
+
case 12:
|
|
17238
17209
|
case "end":
|
|
17239
17210
|
return _context15.stop();
|
|
17240
17211
|
}
|
|
17241
|
-
}), _callee15, null, [ [ 0,
|
|
17212
|
+
}), _callee15, null, [ [ 0, 9 ] ]);
|
|
17242
17213
|
})));
|
|
17243
17214
|
return _BASE.apply(this, arguments);
|
|
17244
17215
|
}
|
|
@@ -17265,14 +17236,7 @@ function _typeof(o) {
|
|
|
17265
17236
|
limit: limit
|
|
17266
17237
|
});
|
|
17267
17238
|
apiKey = window.localStorage.getItem(SERVICES_API_KEY.Gnosisscan);
|
|
17268
|
-
|
|
17269
|
-
_context16.next = 6;
|
|
17270
|
-
break;
|
|
17271
|
-
}
|
|
17272
|
-
throw new MissingApiKeyError(SERVICES_API_KEY.Gnosisscan);
|
|
17273
|
-
|
|
17274
|
-
case 6:
|
|
17275
|
-
_context16.next = 8;
|
|
17239
|
+
_context16.next = 6;
|
|
17276
17240
|
return handleScanRequest({
|
|
17277
17241
|
type: type,
|
|
17278
17242
|
address: address,
|
|
@@ -17286,19 +17250,19 @@ function _typeof(o) {
|
|
|
17286
17250
|
network: "gnosis"
|
|
17287
17251
|
});
|
|
17288
17252
|
|
|
17289
|
-
case
|
|
17253
|
+
case 6:
|
|
17290
17254
|
return _context16.abrupt("return", _context16.sent);
|
|
17291
17255
|
|
|
17292
|
-
case
|
|
17293
|
-
_context16.prev =
|
|
17256
|
+
case 9:
|
|
17257
|
+
_context16.prev = 9;
|
|
17294
17258
|
_context16.t0 = _context16["catch"](0);
|
|
17295
17259
|
return _context16.abrupt("return", errorMessageHandler(_context16.t0, "GNOSIS"));
|
|
17296
17260
|
|
|
17297
|
-
case
|
|
17261
|
+
case 12:
|
|
17298
17262
|
case "end":
|
|
17299
17263
|
return _context16.stop();
|
|
17300
17264
|
}
|
|
17301
|
-
}), _callee16, null, [ [ 0,
|
|
17265
|
+
}), _callee16, null, [ [ 0, 9 ] ]);
|
|
17302
17266
|
})));
|
|
17303
17267
|
return _GNOSIS.apply(this, arguments);
|
|
17304
17268
|
}
|
|
@@ -17321,62 +17285,55 @@ function _typeof(o) {
|
|
|
17321
17285
|
username: username
|
|
17322
17286
|
});
|
|
17323
17287
|
apiKey = window.localStorage.getItem(SERVICES_API_KEY.Neynar);
|
|
17324
|
-
|
|
17325
|
-
_context17.next = 7;
|
|
17326
|
-
break;
|
|
17327
|
-
}
|
|
17328
|
-
throw new MissingApiKeyError(SERVICES_API_KEY.Neynar);
|
|
17329
|
-
|
|
17330
|
-
case 7:
|
|
17331
|
-
_context17.next = 9;
|
|
17288
|
+
_context17.next = 7;
|
|
17332
17289
|
return fromUsernameToFid$1.fromUsernameToFid(username, apiKey);
|
|
17333
17290
|
|
|
17334
|
-
case
|
|
17291
|
+
case 7:
|
|
17335
17292
|
fid = _context17.sent;
|
|
17336
17293
|
if (fid) {
|
|
17337
|
-
_context17.next =
|
|
17294
|
+
_context17.next = 10;
|
|
17338
17295
|
break;
|
|
17339
17296
|
}
|
|
17340
17297
|
throw new ValidationError("Invalid username: ".concat(username));
|
|
17341
17298
|
|
|
17342
|
-
case
|
|
17299
|
+
case 10:
|
|
17343
17300
|
url = "https://api.neynar.com/v2/farcaster/followers?fid=".concat(fid);
|
|
17344
17301
|
_getUrlAndHeaders7 = getUrlAndHeaders({
|
|
17345
17302
|
url: url.toString(),
|
|
17346
|
-
serviceName: "
|
|
17303
|
+
serviceName: "Neynar",
|
|
17347
17304
|
headers: {
|
|
17348
17305
|
"x-api-key": apiKey,
|
|
17349
17306
|
"x-neynar-experimental": "false"
|
|
17350
17307
|
}
|
|
17351
17308
|
}), finalUrl = _getUrlAndHeaders7.URL, HEADERS = _getUrlAndHeaders7.HEADERS;
|
|
17352
|
-
_context17.next =
|
|
17309
|
+
_context17.next = 14;
|
|
17353
17310
|
return fetch(finalUrl, {
|
|
17354
17311
|
method: "GET",
|
|
17355
17312
|
headers: HEADERS
|
|
17356
17313
|
});
|
|
17357
17314
|
|
|
17358
|
-
case
|
|
17315
|
+
case 14:
|
|
17359
17316
|
response = _context17.sent;
|
|
17360
17317
|
if (response.ok) {
|
|
17361
|
-
_context17.next =
|
|
17318
|
+
_context17.next = 17;
|
|
17362
17319
|
break;
|
|
17363
17320
|
}
|
|
17364
17321
|
throw new NetworkError(SERVICES_API_KEY.Neynar, response.status);
|
|
17365
17322
|
|
|
17366
|
-
case
|
|
17367
|
-
_context17.next =
|
|
17323
|
+
case 17:
|
|
17324
|
+
_context17.next = 19;
|
|
17368
17325
|
return response.json();
|
|
17369
17326
|
|
|
17370
|
-
case
|
|
17327
|
+
case 19:
|
|
17371
17328
|
json = _context17.sent;
|
|
17372
17329
|
users = (json === null || json === void 0 ? void 0 : json.users) || [];
|
|
17373
17330
|
if (users.length) {
|
|
17374
|
-
_context17.next =
|
|
17331
|
+
_context17.next = 23;
|
|
17375
17332
|
break;
|
|
17376
17333
|
}
|
|
17377
17334
|
return _context17.abrupt("return", []);
|
|
17378
17335
|
|
|
17379
|
-
case
|
|
17336
|
+
case 23:
|
|
17380
17337
|
return _context17.abrupt("return", users.map((function(_ref14) {
|
|
17381
17338
|
var _user$profile, _user$profile2;
|
|
17382
17339
|
var user = _ref14.user;
|
|
@@ -17389,16 +17346,16 @@ function _typeof(o) {
|
|
|
17389
17346
|
};
|
|
17390
17347
|
})));
|
|
17391
17348
|
|
|
17392
|
-
case
|
|
17393
|
-
_context17.prev =
|
|
17349
|
+
case 26:
|
|
17350
|
+
_context17.prev = 26;
|
|
17394
17351
|
_context17.t0 = _context17["catch"](0);
|
|
17395
17352
|
return _context17.abrupt("return", errorMessageHandler(_context17.t0, "NEYNAR"));
|
|
17396
17353
|
|
|
17397
|
-
case
|
|
17354
|
+
case 29:
|
|
17398
17355
|
case "end":
|
|
17399
17356
|
return _context17.stop();
|
|
17400
17357
|
}
|
|
17401
|
-
}), _callee17, null, [ [ 0,
|
|
17358
|
+
}), _callee17, null, [ [ 0, 26 ] ]);
|
|
17402
17359
|
})));
|
|
17403
17360
|
return _NEYNAR.apply(this, arguments);
|
|
17404
17361
|
}
|
|
@@ -17435,14 +17392,7 @@ function _typeof(o) {
|
|
|
17435
17392
|
|
|
17436
17393
|
case 6:
|
|
17437
17394
|
apiKey = window.localStorage.getItem(SERVICES_API_KEY.Etherscan);
|
|
17438
|
-
|
|
17439
|
-
_context18.next = 9;
|
|
17440
|
-
break;
|
|
17441
|
-
}
|
|
17442
|
-
throw new MissingApiKeyError(SERVICES_API_KEY.Etherscan);
|
|
17443
|
-
|
|
17444
|
-
case 9:
|
|
17445
|
-
_context18.next = 11;
|
|
17395
|
+
_context18.next = 9;
|
|
17446
17396
|
return handleScanRequest({
|
|
17447
17397
|
type: type,
|
|
17448
17398
|
address: address,
|
|
@@ -17456,19 +17406,19 @@ function _typeof(o) {
|
|
|
17456
17406
|
network: chain
|
|
17457
17407
|
});
|
|
17458
17408
|
|
|
17459
|
-
case
|
|
17409
|
+
case 9:
|
|
17460
17410
|
return _context18.abrupt("return", _context18.sent);
|
|
17461
17411
|
|
|
17462
|
-
case
|
|
17463
|
-
_context18.prev =
|
|
17412
|
+
case 12:
|
|
17413
|
+
_context18.prev = 12;
|
|
17464
17414
|
_context18.t0 = _context18["catch"](0);
|
|
17465
17415
|
return _context18.abrupt("return", errorMessageHandler(_context18.t0, "ETHERSCAN"));
|
|
17466
17416
|
|
|
17467
|
-
case
|
|
17417
|
+
case 15:
|
|
17468
17418
|
case "end":
|
|
17469
17419
|
return _context18.stop();
|
|
17470
17420
|
}
|
|
17471
|
-
}), _callee18, null, [ [ 0,
|
|
17421
|
+
}), _callee18, null, [ [ 0, 12 ] ]);
|
|
17472
17422
|
})));
|
|
17473
17423
|
return _ETHERSCAN.apply(this, arguments);
|
|
17474
17424
|
}
|
|
@@ -17490,28 +17440,21 @@ function _typeof(o) {
|
|
|
17490
17440
|
param2: param2
|
|
17491
17441
|
});
|
|
17492
17442
|
apiKey = window.localStorage.getItem(SERVICES_API_KEY.Coingecko);
|
|
17493
|
-
if (apiKey) {
|
|
17494
|
-
_context19.next = 6;
|
|
17495
|
-
break;
|
|
17496
|
-
}
|
|
17497
|
-
throw new MissingApiKeyError(SERVICES_API_KEY.Coingecko);
|
|
17498
|
-
|
|
17499
|
-
case 6:
|
|
17500
17443
|
headers = {
|
|
17501
17444
|
accept: "application/json",
|
|
17502
17445
|
"x-cg-demo-api-key": apiKey
|
|
17503
17446
|
};
|
|
17504
17447
|
url = "";
|
|
17505
17448
|
_context19.t0 = category === null || category === void 0 || (_category$toLowerCase = category.toLowerCase) === null || _category$toLowerCase === void 0 ? void 0 : _category$toLowerCase.call(category);
|
|
17506
|
-
_context19.next = _context19.t0 === "price" ?
|
|
17449
|
+
_context19.next = _context19.t0 === "price" ? 9 : _context19.t0 === "market" ? 12 : _context19.t0 === "stablecoins" ? 17 : _context19.t0 === "derivatives" ? 21 : 23;
|
|
17507
17450
|
break;
|
|
17508
17451
|
|
|
17509
|
-
case
|
|
17452
|
+
case 9:
|
|
17510
17453
|
vs = param2 || "usd";
|
|
17511
17454
|
url = "https://api.coingecko.com/api/v3/simple/price?vs_currencies=".concat(vs, "&symbols=").concat(param1);
|
|
17512
|
-
return _context19.abrupt("break",
|
|
17455
|
+
return _context19.abrupt("break", 23);
|
|
17513
17456
|
|
|
17514
|
-
case
|
|
17457
|
+
case 12:
|
|
17515
17458
|
map = {
|
|
17516
17459
|
all: "",
|
|
17517
17460
|
base: "base-ecosystem",
|
|
@@ -17526,53 +17469,53 @@ function _typeof(o) {
|
|
|
17526
17469
|
_category = map[param1] || "";
|
|
17527
17470
|
trend = param2 ? "&price_change_percentage=".concat(param2) : "";
|
|
17528
17471
|
url = "https://api.coingecko.com/api/v3/coins/markets?vs_currency=usd&include_tokens=top&page=1&per_page=100".concat(_category ? "&category=".concat(_category) : "").concat(trend);
|
|
17529
|
-
return _context19.abrupt("break",
|
|
17472
|
+
return _context19.abrupt("break", 23);
|
|
17530
17473
|
|
|
17531
|
-
case
|
|
17474
|
+
case 17:
|
|
17532
17475
|
_category2 = param1 === "all" ? "stablecoins" : param1;
|
|
17533
17476
|
_trend = param2 ? "&price_change_percentage=".concat(param2) : "";
|
|
17534
17477
|
url = "https://api.coingecko.com/api/v3/coins/markets?vs_currency=usd&category=".concat(_category2, "&order=market_cap_desc&page=1&per_page=100").concat(_trend);
|
|
17535
|
-
return _context19.abrupt("break",
|
|
17478
|
+
return _context19.abrupt("break", 23);
|
|
17536
17479
|
|
|
17537
|
-
case
|
|
17480
|
+
case 21:
|
|
17538
17481
|
url = !param1 || param1 === "all" ? "https://api.coingecko.com/api/v3/derivatives" : "https://api.coingecko.com/api/v3/derivatives/exchanges/".concat(param1, "?include_tickers=all");
|
|
17539
|
-
return _context19.abrupt("break",
|
|
17482
|
+
return _context19.abrupt("break", 23);
|
|
17540
17483
|
|
|
17541
|
-
case
|
|
17484
|
+
case 23:
|
|
17542
17485
|
_getUrlAndHeaders8 = getUrlAndHeaders({
|
|
17543
17486
|
url: url,
|
|
17544
17487
|
serviceName: "Coingecko",
|
|
17545
17488
|
headers: headers
|
|
17546
17489
|
}), finalUrl = _getUrlAndHeaders8.URL, HEADERS = _getUrlAndHeaders8.HEADERS;
|
|
17547
|
-
_context19.next =
|
|
17490
|
+
_context19.next = 26;
|
|
17548
17491
|
return fetch(finalUrl, {
|
|
17549
17492
|
headers: HEADERS
|
|
17550
17493
|
});
|
|
17551
17494
|
|
|
17552
|
-
case
|
|
17495
|
+
case 26:
|
|
17553
17496
|
res = _context19.sent;
|
|
17554
|
-
_context19.next =
|
|
17497
|
+
_context19.next = 29;
|
|
17555
17498
|
return res.json();
|
|
17556
17499
|
|
|
17557
|
-
case
|
|
17500
|
+
case 29:
|
|
17558
17501
|
json = _context19.sent;
|
|
17559
17502
|
if (res.ok) {
|
|
17560
|
-
_context19.next =
|
|
17503
|
+
_context19.next = 35;
|
|
17561
17504
|
break;
|
|
17562
17505
|
}
|
|
17563
17506
|
msg = (json === null || json === void 0 || (_json$status = json.status) === null || _json$status === void 0 ? void 0 : _json$status.error_message) || "";
|
|
17564
17507
|
if (!msg.includes("API Key Missing")) {
|
|
17565
|
-
_context19.next =
|
|
17508
|
+
_context19.next = 34;
|
|
17566
17509
|
break;
|
|
17567
17510
|
}
|
|
17568
17511
|
throw new InvalidApiKeyError(SERVICES_API_KEY.Coingecko);
|
|
17569
17512
|
|
|
17570
|
-
case
|
|
17513
|
+
case 34:
|
|
17571
17514
|
throw new NetworkError(SERVICES_API_KEY.Coingecko, res.status);
|
|
17572
17515
|
|
|
17573
|
-
case
|
|
17516
|
+
case 35:
|
|
17574
17517
|
if (!(category === "price")) {
|
|
17575
|
-
_context19.next =
|
|
17518
|
+
_context19.next = 39;
|
|
17576
17519
|
break;
|
|
17577
17520
|
}
|
|
17578
17521
|
out = {};
|
|
@@ -17587,7 +17530,7 @@ function _typeof(o) {
|
|
|
17587
17530
|
}
|
|
17588
17531
|
return _context19.abrupt("return", [ out ]);
|
|
17589
17532
|
|
|
17590
|
-
case
|
|
17533
|
+
case 39:
|
|
17591
17534
|
_data4 = Array.isArray(json) ? json : [ json ];
|
|
17592
17535
|
return _context19.abrupt("return", _data4.map((function(item) {
|
|
17593
17536
|
var flat = {};
|
|
@@ -17600,16 +17543,16 @@ function _typeof(o) {
|
|
|
17600
17543
|
return flat;
|
|
17601
17544
|
})));
|
|
17602
17545
|
|
|
17603
|
-
case
|
|
17604
|
-
_context19.prev =
|
|
17546
|
+
case 43:
|
|
17547
|
+
_context19.prev = 43;
|
|
17605
17548
|
_context19.t1 = _context19["catch"](0);
|
|
17606
17549
|
return _context19.abrupt("return", errorMessageHandler(_context19.t1, "COINGECKO"));
|
|
17607
17550
|
|
|
17608
|
-
case
|
|
17551
|
+
case 46:
|
|
17609
17552
|
case "end":
|
|
17610
17553
|
return _context19.stop();
|
|
17611
17554
|
}
|
|
17612
|
-
}), _callee19, null, [ [ 0,
|
|
17555
|
+
}), _callee19, null, [ [ 0, 43 ] ]);
|
|
17613
17556
|
})));
|
|
17614
17557
|
return _COINGECKO.apply(this, arguments);
|
|
17615
17558
|
}
|
|
@@ -17622,8 +17565,7 @@ function _typeof(o) {
|
|
|
17622
17565
|
return _regeneratorRuntime().wrap((function _callee21$(_context24) {
|
|
17623
17566
|
while (1) switch (_context24.prev = _context24.next) {
|
|
17624
17567
|
case 0:
|
|
17625
|
-
|
|
17626
|
-
_context24.prev = 1;
|
|
17568
|
+
_context24.prev = 0;
|
|
17627
17569
|
fetchJSON = function() {
|
|
17628
17570
|
var _ref15 = _asyncToGenerator(_regeneratorRuntime().mark((function _callee20(url) {
|
|
17629
17571
|
var _getUrlAndHeaders9, finalUrl, HEADERS, res, json;
|
|
@@ -17700,13 +17642,6 @@ function _typeof(o) {
|
|
|
17700
17642
|
offset: offset
|
|
17701
17643
|
});
|
|
17702
17644
|
apiKey = window.localStorage.getItem(SERVICES_API_KEY.Etherscan);
|
|
17703
|
-
if (apiKey) {
|
|
17704
|
-
_context24.next = 8;
|
|
17705
|
-
break;
|
|
17706
|
-
}
|
|
17707
|
-
throw new MissingApiKeyError(SERVICES_API_KEY.Etherscan);
|
|
17708
|
-
|
|
17709
|
-
case 8:
|
|
17710
17645
|
INPUTS = addresses.split(",").map((function(s) {
|
|
17711
17646
|
return s.trim();
|
|
17712
17647
|
})).filter(Boolean);
|
|
@@ -17715,63 +17650,62 @@ function _typeof(o) {
|
|
|
17715
17650
|
})).filter(Boolean);
|
|
17716
17651
|
ADDRESS_MAP = {};
|
|
17717
17652
|
_iterator41 = _createForOfIteratorHelper(INPUTS);
|
|
17718
|
-
_context24.prev =
|
|
17653
|
+
_context24.prev = 9;
|
|
17719
17654
|
_iterator41.s();
|
|
17720
17655
|
|
|
17721
|
-
case
|
|
17656
|
+
case 11:
|
|
17722
17657
|
if ((_step41 = _iterator41.n()).done) {
|
|
17723
|
-
_context24.next =
|
|
17658
|
+
_context24.next = 26;
|
|
17724
17659
|
break;
|
|
17725
17660
|
}
|
|
17726
17661
|
inp = _step41.value;
|
|
17727
17662
|
if (!isAddress$1.isAddress(inp)) {
|
|
17728
|
-
_context24.next =
|
|
17663
|
+
_context24.next = 17;
|
|
17729
17664
|
break;
|
|
17730
17665
|
}
|
|
17731
17666
|
ADDRESS_MAP[inp.toLowerCase()] = null;
|
|
17732
|
-
_context24.next =
|
|
17667
|
+
_context24.next = 24;
|
|
17733
17668
|
break;
|
|
17734
17669
|
|
|
17735
|
-
case
|
|
17670
|
+
case 17:
|
|
17736
17671
|
ens = inp;
|
|
17737
|
-
_context24.next =
|
|
17672
|
+
_context24.next = 20;
|
|
17738
17673
|
return fromEnsNameToAddress$1.fromEnsNameToAddress(ens);
|
|
17739
17674
|
|
|
17740
|
-
case
|
|
17675
|
+
case 20:
|
|
17741
17676
|
resolved = _context24.sent;
|
|
17742
17677
|
if (resolved) {
|
|
17743
|
-
_context24.next =
|
|
17678
|
+
_context24.next = 23;
|
|
17744
17679
|
break;
|
|
17745
17680
|
}
|
|
17746
17681
|
throw new EnsError(ens);
|
|
17747
17682
|
|
|
17748
|
-
case
|
|
17683
|
+
case 23:
|
|
17749
17684
|
ADDRESS_MAP[resolved.toLowerCase()] = ens;
|
|
17750
17685
|
|
|
17751
|
-
case
|
|
17752
|
-
_context24.next =
|
|
17686
|
+
case 24:
|
|
17687
|
+
_context24.next = 11;
|
|
17753
17688
|
break;
|
|
17754
17689
|
|
|
17755
|
-
case
|
|
17756
|
-
_context24.next =
|
|
17690
|
+
case 26:
|
|
17691
|
+
_context24.next = 31;
|
|
17757
17692
|
break;
|
|
17758
17693
|
|
|
17759
|
-
case
|
|
17760
|
-
_context24.prev =
|
|
17761
|
-
_context24.t0 = _context24["catch"](
|
|
17694
|
+
case 28:
|
|
17695
|
+
_context24.prev = 28;
|
|
17696
|
+
_context24.t0 = _context24["catch"](9);
|
|
17762
17697
|
_iterator41.e(_context24.t0);
|
|
17763
17698
|
|
|
17764
|
-
case
|
|
17765
|
-
_context24.prev =
|
|
17699
|
+
case 31:
|
|
17700
|
+
_context24.prev = 31;
|
|
17766
17701
|
_iterator41.f();
|
|
17767
|
-
return _context24.finish(
|
|
17702
|
+
return _context24.finish(31);
|
|
17768
17703
|
|
|
17769
|
-
case
|
|
17704
|
+
case 34:
|
|
17770
17705
|
ADDRS = Object.keys(ADDRESS_MAP);
|
|
17771
|
-
console.log("ADDRS", ADDRS);
|
|
17772
17706
|
out = [];
|
|
17773
17707
|
_iterator42 = _createForOfIteratorHelper(CHAINS);
|
|
17774
|
-
_context24.prev =
|
|
17708
|
+
_context24.prev = 37;
|
|
17775
17709
|
_loop = _regeneratorRuntime().mark((function _loop() {
|
|
17776
17710
|
var chain, chainId, _loop2, _ret2, i, sb, eb, _loop3, _ret3, _i16, _ADDRS;
|
|
17777
17711
|
return _regeneratorRuntime().wrap((function _loop$(_context23) {
|
|
@@ -17945,52 +17879,52 @@ function _typeof(o) {
|
|
|
17945
17879
|
}));
|
|
17946
17880
|
_iterator42.s();
|
|
17947
17881
|
|
|
17948
|
-
case
|
|
17882
|
+
case 40:
|
|
17949
17883
|
if ((_step42 = _iterator42.n()).done) {
|
|
17950
|
-
_context24.next =
|
|
17884
|
+
_context24.next = 47;
|
|
17951
17885
|
break;
|
|
17952
17886
|
}
|
|
17953
|
-
return _context24.delegateYield(_loop(), "t1",
|
|
17887
|
+
return _context24.delegateYield(_loop(), "t1", 42);
|
|
17954
17888
|
|
|
17955
|
-
case
|
|
17889
|
+
case 42:
|
|
17956
17890
|
_ret = _context24.t1;
|
|
17957
17891
|
if (!_ret) {
|
|
17958
|
-
_context24.next =
|
|
17892
|
+
_context24.next = 45;
|
|
17959
17893
|
break;
|
|
17960
17894
|
}
|
|
17961
17895
|
return _context24.abrupt("return", _ret.v);
|
|
17962
17896
|
|
|
17963
|
-
case
|
|
17964
|
-
_context24.next =
|
|
17897
|
+
case 45:
|
|
17898
|
+
_context24.next = 40;
|
|
17965
17899
|
break;
|
|
17966
17900
|
|
|
17967
|
-
case
|
|
17968
|
-
_context24.next =
|
|
17901
|
+
case 47:
|
|
17902
|
+
_context24.next = 52;
|
|
17969
17903
|
break;
|
|
17970
17904
|
|
|
17971
|
-
case
|
|
17972
|
-
_context24.prev =
|
|
17973
|
-
_context24.t2 = _context24["catch"](
|
|
17905
|
+
case 49:
|
|
17906
|
+
_context24.prev = 49;
|
|
17907
|
+
_context24.t2 = _context24["catch"](37);
|
|
17974
17908
|
_iterator42.e(_context24.t2);
|
|
17975
17909
|
|
|
17976
|
-
case
|
|
17977
|
-
_context24.prev =
|
|
17910
|
+
case 52:
|
|
17911
|
+
_context24.prev = 52;
|
|
17978
17912
|
_iterator42.f();
|
|
17979
|
-
return _context24.finish(
|
|
17913
|
+
return _context24.finish(52);
|
|
17980
17914
|
|
|
17981
|
-
case
|
|
17915
|
+
case 55:
|
|
17982
17916
|
return _context24.abrupt("return", out);
|
|
17983
17917
|
|
|
17984
|
-
case
|
|
17985
|
-
_context24.prev =
|
|
17986
|
-
_context24.t3 = _context24["catch"](
|
|
17918
|
+
case 58:
|
|
17919
|
+
_context24.prev = 58;
|
|
17920
|
+
_context24.t3 = _context24["catch"](0);
|
|
17987
17921
|
return _context24.abrupt("return", errorMessageHandler(_context24.t3, "EOA"));
|
|
17988
17922
|
|
|
17989
|
-
case
|
|
17923
|
+
case 61:
|
|
17990
17924
|
case "end":
|
|
17991
17925
|
return _context24.stop();
|
|
17992
17926
|
}
|
|
17993
|
-
}), _callee21, null, [ [
|
|
17927
|
+
}), _callee21, null, [ [ 0, 58 ], [ 9, 28, 31, 34 ], [ 37, 49, 52, 55 ] ]);
|
|
17994
17928
|
})));
|
|
17995
17929
|
return _EOA.apply(this, arguments);
|
|
17996
17930
|
}
|
|
@@ -18040,39 +17974,32 @@ function _typeof(o) {
|
|
|
18040
17974
|
offset: offset
|
|
18041
17975
|
});
|
|
18042
17976
|
apiKey = window.localStorage.getItem(SERVICES_API_KEY.Safe);
|
|
18043
|
-
if (apiKey) {
|
|
18044
|
-
_context26.next = 6;
|
|
18045
|
-
break;
|
|
18046
|
-
}
|
|
18047
|
-
throw new MissingApiKeyError(SERVICES_API_KEY.Safe);
|
|
18048
|
-
|
|
18049
|
-
case 6:
|
|
18050
17977
|
chainId = SAFE_CHAIN_MAP[chain];
|
|
18051
17978
|
if (chainId) {
|
|
18052
|
-
_context26.next =
|
|
17979
|
+
_context26.next = 7;
|
|
18053
17980
|
break;
|
|
18054
17981
|
}
|
|
18055
17982
|
throw new ValidationError("Invalid chain: ".concat(chain));
|
|
18056
17983
|
|
|
18057
|
-
case
|
|
17984
|
+
case 7:
|
|
18058
17985
|
resolved = address;
|
|
18059
17986
|
if (isAddress$1.isAddress(resolved)) {
|
|
18060
|
-
_context26.next =
|
|
17987
|
+
_context26.next = 15;
|
|
18061
17988
|
break;
|
|
18062
17989
|
}
|
|
18063
17990
|
ens = resolved;
|
|
18064
|
-
_context26.next =
|
|
17991
|
+
_context26.next = 12;
|
|
18065
17992
|
return fromEnsNameToAddress$1.fromEnsNameToAddress(ens);
|
|
18066
17993
|
|
|
18067
|
-
case
|
|
17994
|
+
case 12:
|
|
18068
17995
|
resolved = _context26.sent;
|
|
18069
17996
|
if (resolved) {
|
|
18070
|
-
_context26.next =
|
|
17997
|
+
_context26.next = 15;
|
|
18071
17998
|
break;
|
|
18072
17999
|
}
|
|
18073
18000
|
throw new EnsError(ens);
|
|
18074
18001
|
|
|
18075
|
-
case
|
|
18002
|
+
case 15:
|
|
18076
18003
|
url = "https://api.safe.global/tx-service/".concat(chainId, "/api/v2/safes/").concat(resolved, "/multisig-transactions?limit=").concat(limit, "&offset=").concat(offset);
|
|
18077
18004
|
_getUrlAndHeaders0 = getUrlAndHeaders({
|
|
18078
18005
|
url: url,
|
|
@@ -18081,47 +18008,47 @@ function _typeof(o) {
|
|
|
18081
18008
|
Authorization: "Bearer ".concat(apiKey)
|
|
18082
18009
|
}
|
|
18083
18010
|
}), finalUrl = _getUrlAndHeaders0.URL, HEADERS = _getUrlAndHeaders0.HEADERS;
|
|
18084
|
-
_context26.next =
|
|
18011
|
+
_context26.next = 19;
|
|
18085
18012
|
return fetch(finalUrl, {
|
|
18086
18013
|
headers: HEADERS
|
|
18087
18014
|
});
|
|
18088
18015
|
|
|
18089
|
-
case
|
|
18016
|
+
case 19:
|
|
18090
18017
|
res = _context26.sent;
|
|
18091
18018
|
if (res.ok) {
|
|
18092
|
-
_context26.next =
|
|
18019
|
+
_context26.next = 22;
|
|
18093
18020
|
break;
|
|
18094
18021
|
}
|
|
18095
18022
|
throw new NetworkError(SERVICES_API_KEY.Safe, res.status);
|
|
18096
18023
|
|
|
18097
|
-
case
|
|
18098
|
-
_context26.next =
|
|
18024
|
+
case 22:
|
|
18025
|
+
_context26.next = 24;
|
|
18099
18026
|
return res.json();
|
|
18100
18027
|
|
|
18101
|
-
case
|
|
18028
|
+
case 24:
|
|
18102
18029
|
json = _context26.sent;
|
|
18103
18030
|
if (Array.isArray(json.results)) {
|
|
18104
|
-
_context26.next =
|
|
18031
|
+
_context26.next = 27;
|
|
18105
18032
|
break;
|
|
18106
18033
|
}
|
|
18107
18034
|
throw new ValidationError("Invalid API response");
|
|
18108
18035
|
|
|
18109
|
-
case
|
|
18036
|
+
case 27:
|
|
18110
18037
|
return _context26.abrupt("return", json.results.map((function(_ref16) {
|
|
18111
18038
|
var confirmations = _ref16.confirmations, dataDecoded = _ref16.dataDecoded, rest = _objectWithoutProperties(_ref16, _excluded);
|
|
18112
18039
|
return rest;
|
|
18113
18040
|
})));
|
|
18114
18041
|
|
|
18115
|
-
case
|
|
18116
|
-
_context26.prev =
|
|
18042
|
+
case 30:
|
|
18043
|
+
_context26.prev = 30;
|
|
18117
18044
|
_context26.t0 = _context26["catch"](0);
|
|
18118
18045
|
return _context26.abrupt("return", errorMessageHandler(_context26.t0, "SAFE"));
|
|
18119
18046
|
|
|
18120
|
-
case
|
|
18047
|
+
case 33:
|
|
18121
18048
|
case "end":
|
|
18122
18049
|
return _context26.stop();
|
|
18123
18050
|
}
|
|
18124
|
-
}), _callee23, null, [ [ 0,
|
|
18051
|
+
}), _callee23, null, [ [ 0, 30 ] ]);
|
|
18125
18052
|
})));
|
|
18126
18053
|
return _SAFE.apply(this, arguments);
|
|
18127
18054
|
}
|
|
@@ -18141,55 +18068,48 @@ function _typeof(o) {
|
|
|
18141
18068
|
category: category
|
|
18142
18069
|
});
|
|
18143
18070
|
apiKey = window.localStorage.getItem(SERVICES_API_KEY.Defillama);
|
|
18144
|
-
if (apiKey) {
|
|
18145
|
-
_context27.next = 6;
|
|
18146
|
-
break;
|
|
18147
|
-
}
|
|
18148
|
-
throw new MissingApiKeyError(SERVICES_API_KEY.Defillama);
|
|
18149
|
-
|
|
18150
|
-
case 6:
|
|
18151
18071
|
url = CATEGORY_URLS[category];
|
|
18152
18072
|
if (url) {
|
|
18153
|
-
_context27.next =
|
|
18073
|
+
_context27.next = 7;
|
|
18154
18074
|
break;
|
|
18155
18075
|
}
|
|
18156
18076
|
throw new ValidationError("Invalid category: ".concat(category));
|
|
18157
18077
|
|
|
18158
|
-
case
|
|
18159
|
-
_context27.next =
|
|
18078
|
+
case 7:
|
|
18079
|
+
_context27.next = 9;
|
|
18160
18080
|
return fetch(url);
|
|
18161
18081
|
|
|
18162
|
-
case
|
|
18082
|
+
case 9:
|
|
18163
18083
|
res = _context27.sent;
|
|
18164
18084
|
if (res.ok) {
|
|
18165
|
-
_context27.next =
|
|
18085
|
+
_context27.next = 12;
|
|
18166
18086
|
break;
|
|
18167
18087
|
}
|
|
18168
18088
|
throw new NetworkError(SERVICES_API_KEY.Defillama, res.status);
|
|
18169
18089
|
|
|
18170
|
-
case
|
|
18171
|
-
_context27.next =
|
|
18090
|
+
case 12:
|
|
18091
|
+
_context27.next = 14;
|
|
18172
18092
|
return res.json();
|
|
18173
18093
|
|
|
18174
|
-
case
|
|
18094
|
+
case 14:
|
|
18175
18095
|
json = _context27.sent;
|
|
18176
18096
|
_context27.t0 = category;
|
|
18177
|
-
_context27.next = _context27.t0 === "protocols" ?
|
|
18097
|
+
_context27.next = _context27.t0 === "protocols" ? 18 : _context27.t0 === "yields" ? 20 : _context27.t0 === "dex" ? 22 : _context27.t0 === "fees" ? 22 : 24;
|
|
18178
18098
|
break;
|
|
18179
18099
|
|
|
18180
|
-
case
|
|
18100
|
+
case 18:
|
|
18181
18101
|
json = Array.isArray(json) ? json.slice(0, 500) : [];
|
|
18182
|
-
return _context27.abrupt("break",
|
|
18102
|
+
return _context27.abrupt("break", 24);
|
|
18183
18103
|
|
|
18184
|
-
case
|
|
18104
|
+
case 20:
|
|
18185
18105
|
json = Array.isArray(json.data) ? json.data.slice(0, 500) : [];
|
|
18186
|
-
return _context27.abrupt("break",
|
|
18106
|
+
return _context27.abrupt("break", 24);
|
|
18187
18107
|
|
|
18188
|
-
case
|
|
18108
|
+
case 22:
|
|
18189
18109
|
json = Array.isArray(json.protocols) ? json.protocols.slice(0, 500) : [];
|
|
18190
|
-
return _context27.abrupt("break",
|
|
18110
|
+
return _context27.abrupt("break", 24);
|
|
18191
18111
|
|
|
18192
|
-
case
|
|
18112
|
+
case 24:
|
|
18193
18113
|
return _context27.abrupt("return", (Array.isArray(json) ? json : [ json ]).map((function(item) {
|
|
18194
18114
|
var out = {};
|
|
18195
18115
|
for (var _i17 = 0, _Object$entries7 = Object.entries(item); _i17 < _Object$entries7.length; _i17++) {
|
|
@@ -18199,16 +18119,16 @@ function _typeof(o) {
|
|
|
18199
18119
|
return out;
|
|
18200
18120
|
})));
|
|
18201
18121
|
|
|
18202
|
-
case
|
|
18203
|
-
_context27.prev =
|
|
18122
|
+
case 27:
|
|
18123
|
+
_context27.prev = 27;
|
|
18204
18124
|
_context27.t1 = _context27["catch"](0);
|
|
18205
18125
|
return _context27.abrupt("return", errorMessageHandler(_context27.t1, "DEFILLAMA"));
|
|
18206
18126
|
|
|
18207
|
-
case
|
|
18127
|
+
case 30:
|
|
18208
18128
|
case "end":
|
|
18209
18129
|
return _context27.stop();
|
|
18210
18130
|
}
|
|
18211
|
-
}), _callee24, null, [ [ 0,
|
|
18131
|
+
}), _callee24, null, [ [ 0, 27 ] ]);
|
|
18212
18132
|
})));
|
|
18213
18133
|
return _DEFILLAMA.apply(this, arguments);
|
|
18214
18134
|
}
|