@fileverse-dev/formulajs 4.4.12-mod-8 → 4.4.13-patch-1
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 +644 -486
- package/lib/browser/formula.min.js +2 -2
- package/lib/browser/formula.min.js.map +1 -1
- package/lib/cjs/index.cjs +75 -31
- package/lib/esm/index.mjs +75 -31
- package/package.json +1 -1
package/lib/browser/formula.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* @fileverse-dev/formulajs v4.4.
|
|
1
|
+
/* @fileverse-dev/formulajs v4.4.13-patch-1 */
|
|
2
2
|
var _excluded = [ "confirmations", "dataDecoded" ];
|
|
3
3
|
|
|
4
4
|
function _objectWithoutProperties(e, t) {
|
|
@@ -16188,13 +16188,13 @@ function _typeof(o) {
|
|
|
16188
16188
|
return _AAVE.apply(this, arguments);
|
|
16189
16189
|
}
|
|
16190
16190
|
function _AAVE() {
|
|
16191
|
-
_AAVE = _asyncToGenerator(_regeneratorRuntime().mark((function
|
|
16192
|
-
var _argsToArray3, _argsToArray4, graphType, category, param1, param2, baseUrl, url, res, json,
|
|
16193
|
-
return _regeneratorRuntime().wrap((function
|
|
16194
|
-
while (1) switch (
|
|
16191
|
+
_AAVE = _asyncToGenerator(_regeneratorRuntime().mark((function _callee10() {
|
|
16192
|
+
var _argsToArray3, _argsToArray4, graphType, category, param1, param2, baseUrl, url, res, json, _args10 = arguments;
|
|
16193
|
+
return _regeneratorRuntime().wrap((function _callee10$(_context10) {
|
|
16194
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
16195
16195
|
case 0:
|
|
16196
|
-
|
|
16197
|
-
_argsToArray3 = argsToArray(
|
|
16196
|
+
_context10.prev = 0;
|
|
16197
|
+
_argsToArray3 = argsToArray(_args10), _argsToArray4 = _slicedToArray(_argsToArray3, 4),
|
|
16198
16198
|
graphType = _argsToArray4[0], category = _argsToArray4[1], param1 = _argsToArray4[2],
|
|
16199
16199
|
param2 = _argsToArray4[3];
|
|
16200
16200
|
validateParams(aaveParamsSchema, {
|
|
@@ -16205,49 +16205,49 @@ function _typeof(o) {
|
|
|
16205
16205
|
});
|
|
16206
16206
|
baseUrl = "https://onchain-proxy.fileverse.io/third-party";
|
|
16207
16207
|
url = "".concat(baseUrl) + "?service=aave" + "&graphType=".concat(encodeURIComponent(graphType)) + "&category=".concat(encodeURIComponent(category)) + "&input1=".concat(encodeURIComponent(param1)) + (param2 ? "&input2=".concat(encodeURIComponent(param2)) : "");
|
|
16208
|
-
|
|
16208
|
+
_context10.next = 7;
|
|
16209
16209
|
return fetch(url);
|
|
16210
16210
|
|
|
16211
16211
|
case 7:
|
|
16212
|
-
res =
|
|
16212
|
+
res = _context10.sent;
|
|
16213
16213
|
if (res.ok) {
|
|
16214
|
-
|
|
16214
|
+
_context10.next = 10;
|
|
16215
16215
|
break;
|
|
16216
16216
|
}
|
|
16217
16217
|
throw new NetworkError("AAVE", res.status);
|
|
16218
16218
|
|
|
16219
16219
|
case 10:
|
|
16220
|
-
|
|
16220
|
+
_context10.next = 12;
|
|
16221
16221
|
return res.json();
|
|
16222
16222
|
|
|
16223
16223
|
case 12:
|
|
16224
|
-
json =
|
|
16224
|
+
json = _context10.sent;
|
|
16225
16225
|
if (!Array.isArray(json)) {
|
|
16226
|
-
|
|
16226
|
+
_context10.next = 15;
|
|
16227
16227
|
break;
|
|
16228
16228
|
}
|
|
16229
|
-
return
|
|
16229
|
+
return _context10.abrupt("return", json.map((function(item) {
|
|
16230
16230
|
var flat = {};
|
|
16231
|
-
Object.entries(item).forEach((function(
|
|
16232
|
-
var
|
|
16231
|
+
Object.entries(item).forEach((function(_ref15) {
|
|
16232
|
+
var _ref16 = _slicedToArray(_ref15, 2), k = _ref16[0], v = _ref16[1];
|
|
16233
16233
|
if (v === null || _typeof(v) !== "object") flat[k] = v;
|
|
16234
16234
|
}));
|
|
16235
16235
|
return flat;
|
|
16236
16236
|
})));
|
|
16237
16237
|
|
|
16238
16238
|
case 15:
|
|
16239
|
-
return
|
|
16239
|
+
return _context10.abrupt("return", json);
|
|
16240
16240
|
|
|
16241
16241
|
case 18:
|
|
16242
|
-
|
|
16243
|
-
|
|
16244
|
-
return
|
|
16242
|
+
_context10.prev = 18;
|
|
16243
|
+
_context10.t0 = _context10["catch"](0);
|
|
16244
|
+
return _context10.abrupt("return", errorMessageHandler(_context10.t0, "AAVE"));
|
|
16245
16245
|
|
|
16246
16246
|
case 21:
|
|
16247
16247
|
case "end":
|
|
16248
|
-
return
|
|
16248
|
+
return _context10.stop();
|
|
16249
16249
|
}
|
|
16250
|
-
}),
|
|
16250
|
+
}), _callee10, null, [ [ 0, 18 ] ]);
|
|
16251
16251
|
})));
|
|
16252
16252
|
return _AAVE.apply(this, arguments);
|
|
16253
16253
|
}
|
|
@@ -16307,16 +16307,16 @@ function _typeof(o) {
|
|
|
16307
16307
|
return _fromEnsNameToAddress.apply(this, arguments);
|
|
16308
16308
|
}
|
|
16309
16309
|
function _fromEnsNameToAddress() {
|
|
16310
|
-
_fromEnsNameToAddress = _asyncToGenerator(_regeneratorRuntime().mark((function
|
|
16310
|
+
_fromEnsNameToAddress = _asyncToGenerator(_regeneratorRuntime().mark((function _callee11(name) {
|
|
16311
16311
|
var ALCHEMY_KEY, provider, resolved;
|
|
16312
|
-
return _regeneratorRuntime().wrap((function
|
|
16313
|
-
while (1) switch (
|
|
16312
|
+
return _regeneratorRuntime().wrap((function _callee11$(_context11) {
|
|
16313
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
16314
16314
|
case 0:
|
|
16315
16315
|
if (!(typeof ethers === "undefined")) {
|
|
16316
|
-
|
|
16316
|
+
_context11.next = 3;
|
|
16317
16317
|
break;
|
|
16318
16318
|
}
|
|
16319
|
-
|
|
16319
|
+
_context11.next = 3;
|
|
16320
16320
|
return new Promise((function(resolve, reject) {
|
|
16321
16321
|
var script = document.createElement("script");
|
|
16322
16322
|
script.src = "https://cdn.jsdelivr.net/npm/ethers@6.10.0/dist/ethers.umd.min.js";
|
|
@@ -16328,33 +16328,33 @@ function _typeof(o) {
|
|
|
16328
16328
|
case 3:
|
|
16329
16329
|
ALCHEMY_KEY = window.localStorage.getItem(UTILITY.ALCHEMY_API_KEY);
|
|
16330
16330
|
if (ALCHEMY_KEY) {
|
|
16331
|
-
|
|
16331
|
+
_context11.next = 7;
|
|
16332
16332
|
break;
|
|
16333
16333
|
}
|
|
16334
16334
|
console.error("alchemy api key missing");
|
|
16335
|
-
return
|
|
16335
|
+
return _context11.abrupt("return", null);
|
|
16336
16336
|
|
|
16337
16337
|
case 7:
|
|
16338
16338
|
provider = new ethers.AlchemyProvider("mainnet", ALCHEMY_KEY);
|
|
16339
|
-
|
|
16340
|
-
|
|
16339
|
+
_context11.prev = 8;
|
|
16340
|
+
_context11.next = 11;
|
|
16341
16341
|
return provider.resolveName(name);
|
|
16342
16342
|
|
|
16343
16343
|
case 11:
|
|
16344
|
-
resolved =
|
|
16345
|
-
return
|
|
16344
|
+
resolved = _context11.sent;
|
|
16345
|
+
return _context11.abrupt("return", resolved || null);
|
|
16346
16346
|
|
|
16347
16347
|
case 15:
|
|
16348
|
-
|
|
16349
|
-
|
|
16350
|
-
console.error("ENS resolution failed:",
|
|
16351
|
-
return
|
|
16348
|
+
_context11.prev = 15;
|
|
16349
|
+
_context11.t0 = _context11["catch"](8);
|
|
16350
|
+
console.error("ENS resolution failed:", _context11.t0.message);
|
|
16351
|
+
return _context11.abrupt("return", null);
|
|
16352
16352
|
|
|
16353
16353
|
case 19:
|
|
16354
16354
|
case "end":
|
|
16355
|
-
return
|
|
16355
|
+
return _context11.stop();
|
|
16356
16356
|
}
|
|
16357
|
-
}),
|
|
16357
|
+
}), _callee11, null, [ [ 8, 15 ] ]);
|
|
16358
16358
|
})));
|
|
16359
16359
|
return _fromEnsNameToAddress.apply(this, arguments);
|
|
16360
16360
|
}
|
|
@@ -16474,13 +16474,18 @@ function _typeof(o) {
|
|
|
16474
16474
|
HEADERS: {
|
|
16475
16475
|
"target-url": cleanedUrl,
|
|
16476
16476
|
method: "GET",
|
|
16477
|
-
"Content-Type": "application/json"
|
|
16477
|
+
"Content-Type": "application/json",
|
|
16478
|
+
"Cache-Control": "no-store",
|
|
16479
|
+
Pragma: "no-cache"
|
|
16478
16480
|
}
|
|
16479
16481
|
};
|
|
16480
16482
|
}
|
|
16481
16483
|
return {
|
|
16482
16484
|
URL: url,
|
|
16483
|
-
HEADERS: _objectSpread({
|
|
16485
|
+
HEADERS: _objectSpread({
|
|
16486
|
+
"Cache-Control": "no-store",
|
|
16487
|
+
Pragma: "no-cache"
|
|
16488
|
+
}, headers)
|
|
16484
16489
|
};
|
|
16485
16490
|
}
|
|
16486
16491
|
var fromTimeStampToBlock = function() {
|
|
@@ -16540,74 +16545,74 @@ function _typeof(o) {
|
|
|
16540
16545
|
return _EOA.apply(this, arguments);
|
|
16541
16546
|
}
|
|
16542
16547
|
function _EOA() {
|
|
16543
|
-
_EOA = _asyncToGenerator(_regeneratorRuntime().mark((function
|
|
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, _loop, _ret,
|
|
16545
|
-
return _regeneratorRuntime().wrap((function
|
|
16546
|
-
while (1) switch (
|
|
16548
|
+
_EOA = _asyncToGenerator(_regeneratorRuntime().mark((function _callee13() {
|
|
16549
|
+
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;
|
|
16550
|
+
return _regeneratorRuntime().wrap((function _callee13$(_context16) {
|
|
16551
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
16547
16552
|
case 0:
|
|
16548
|
-
|
|
16553
|
+
_context16.prev = 0;
|
|
16549
16554
|
fetchJSON = function() {
|
|
16550
|
-
var
|
|
16555
|
+
var _ref17 = _asyncToGenerator(_regeneratorRuntime().mark((function _callee12(url) {
|
|
16551
16556
|
var _getUrlAndHeaders3, finalUrl, HEADERS, res, json;
|
|
16552
|
-
return _regeneratorRuntime().wrap((function
|
|
16553
|
-
while (1) switch (
|
|
16557
|
+
return _regeneratorRuntime().wrap((function _callee12$(_context12) {
|
|
16558
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
16554
16559
|
case 0:
|
|
16555
16560
|
_getUrlAndHeaders3 = getUrlAndHeaders({
|
|
16556
16561
|
url: url,
|
|
16557
16562
|
serviceName: "Etherscan",
|
|
16558
16563
|
headers: {}
|
|
16559
16564
|
}), finalUrl = _getUrlAndHeaders3.URL, HEADERS = _getUrlAndHeaders3.HEADERS;
|
|
16560
|
-
|
|
16565
|
+
_context12.next = 3;
|
|
16561
16566
|
return fetch(finalUrl, {
|
|
16562
16567
|
method: "GET",
|
|
16563
16568
|
headers: HEADERS
|
|
16564
16569
|
});
|
|
16565
16570
|
|
|
16566
16571
|
case 3:
|
|
16567
|
-
res =
|
|
16572
|
+
res = _context12.sent;
|
|
16568
16573
|
if (res.ok) {
|
|
16569
|
-
|
|
16574
|
+
_context12.next = 6;
|
|
16570
16575
|
break;
|
|
16571
16576
|
}
|
|
16572
16577
|
throw new NetworkError(SERVICES_API_KEY.Etherscan, res.status);
|
|
16573
16578
|
|
|
16574
16579
|
case 6:
|
|
16575
|
-
|
|
16580
|
+
_context12.next = 8;
|
|
16576
16581
|
return res.json();
|
|
16577
16582
|
|
|
16578
16583
|
case 8:
|
|
16579
|
-
json =
|
|
16584
|
+
json = _context12.sent;
|
|
16580
16585
|
if (!(typeof json.result === "string")) {
|
|
16581
|
-
|
|
16586
|
+
_context12.next = 14;
|
|
16582
16587
|
break;
|
|
16583
16588
|
}
|
|
16584
16589
|
if (!json.result.includes("Invalid API Key")) {
|
|
16585
|
-
|
|
16590
|
+
_context12.next = 12;
|
|
16586
16591
|
break;
|
|
16587
16592
|
}
|
|
16588
16593
|
throw new InvalidApiKeyError(SERVICES_API_KEY.Etherscan);
|
|
16589
16594
|
|
|
16590
16595
|
case 12:
|
|
16591
16596
|
if (!json.result.includes("Max rate limit reached")) {
|
|
16592
|
-
|
|
16597
|
+
_context12.next = 14;
|
|
16593
16598
|
break;
|
|
16594
16599
|
}
|
|
16595
16600
|
throw new RateLimitError(SERVICES_API_KEY.Etherscan);
|
|
16596
16601
|
|
|
16597
16602
|
case 14:
|
|
16598
|
-
return
|
|
16603
|
+
return _context12.abrupt("return", json.result);
|
|
16599
16604
|
|
|
16600
16605
|
case 15:
|
|
16601
16606
|
case "end":
|
|
16602
|
-
return
|
|
16607
|
+
return _context12.stop();
|
|
16603
16608
|
}
|
|
16604
|
-
}),
|
|
16609
|
+
}), _callee12);
|
|
16605
16610
|
})));
|
|
16606
|
-
return function fetchJSON(
|
|
16607
|
-
return
|
|
16611
|
+
return function fetchJSON(_x17) {
|
|
16612
|
+
return _ref17.apply(this, arguments);
|
|
16608
16613
|
};
|
|
16609
16614
|
}();
|
|
16610
|
-
_argsToArray5 = argsToArray(
|
|
16615
|
+
_argsToArray5 = argsToArray(_args16), _argsToArray6 = _slicedToArray(_argsToArray5, 7),
|
|
16611
16616
|
addresses = _argsToArray6[0], category = _argsToArray6[1], chains = _argsToArray6[2],
|
|
16612
16617
|
startTime = _argsToArray6[3], endTime = _argsToArray6[4], _argsToArray6$ = _argsToArray6[5],
|
|
16613
16618
|
page = _argsToArray6$ === void 0 ? 1 : _argsToArray6$, _argsToArray6$2 = _argsToArray6[6],
|
|
@@ -16630,89 +16635,89 @@ function _typeof(o) {
|
|
|
16630
16635
|
})).filter(Boolean);
|
|
16631
16636
|
ADDRESS_MAP = {};
|
|
16632
16637
|
_iterator41 = _createForOfIteratorHelper(INPUTS);
|
|
16633
|
-
|
|
16638
|
+
_context16.prev = 9;
|
|
16634
16639
|
_iterator41.s();
|
|
16635
16640
|
|
|
16636
16641
|
case 11:
|
|
16637
16642
|
if ((_step41 = _iterator41.n()).done) {
|
|
16638
|
-
|
|
16643
|
+
_context16.next = 23;
|
|
16639
16644
|
break;
|
|
16640
16645
|
}
|
|
16641
16646
|
inp = _step41.value;
|
|
16642
16647
|
if (!isAddress$1.isAddress(inp)) {
|
|
16643
|
-
|
|
16648
|
+
_context16.next = 17;
|
|
16644
16649
|
break;
|
|
16645
16650
|
}
|
|
16646
16651
|
ADDRESS_MAP[inp.toLowerCase()] = null;
|
|
16647
|
-
|
|
16652
|
+
_context16.next = 21;
|
|
16648
16653
|
break;
|
|
16649
16654
|
|
|
16650
16655
|
case 17:
|
|
16651
|
-
|
|
16656
|
+
_context16.next = 19;
|
|
16652
16657
|
return fromEnsNameToAddress$1.validateAndGetAddress(inp);
|
|
16653
16658
|
|
|
16654
16659
|
case 19:
|
|
16655
|
-
_address =
|
|
16660
|
+
_address = _context16.sent;
|
|
16656
16661
|
ADDRESS_MAP[_address.toLowerCase()] = _address;
|
|
16657
16662
|
|
|
16658
16663
|
case 21:
|
|
16659
|
-
|
|
16664
|
+
_context16.next = 11;
|
|
16660
16665
|
break;
|
|
16661
16666
|
|
|
16662
16667
|
case 23:
|
|
16663
|
-
|
|
16668
|
+
_context16.next = 28;
|
|
16664
16669
|
break;
|
|
16665
16670
|
|
|
16666
16671
|
case 25:
|
|
16667
|
-
|
|
16668
|
-
|
|
16669
|
-
_iterator41.e(
|
|
16672
|
+
_context16.prev = 25;
|
|
16673
|
+
_context16.t0 = _context16["catch"](9);
|
|
16674
|
+
_iterator41.e(_context16.t0);
|
|
16670
16675
|
|
|
16671
16676
|
case 28:
|
|
16672
|
-
|
|
16677
|
+
_context16.prev = 28;
|
|
16673
16678
|
_iterator41.f();
|
|
16674
|
-
return
|
|
16679
|
+
return _context16.finish(28);
|
|
16675
16680
|
|
|
16676
16681
|
case 31:
|
|
16677
16682
|
ADDRS = Object.keys(ADDRESS_MAP);
|
|
16678
16683
|
out = [];
|
|
16679
16684
|
_iterator42 = _createForOfIteratorHelper(CHAINS);
|
|
16680
|
-
|
|
16685
|
+
_context16.prev = 34;
|
|
16681
16686
|
_loop = _regeneratorRuntime().mark((function _loop() {
|
|
16682
16687
|
var chain, chainId, _loop2, _ret2, i, sb, eb, _loop3, _ret3, _i10, _ADDRS;
|
|
16683
|
-
return _regeneratorRuntime().wrap((function _loop$(
|
|
16684
|
-
while (1) switch (
|
|
16688
|
+
return _regeneratorRuntime().wrap((function _loop$(_context15) {
|
|
16689
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
16685
16690
|
case 0:
|
|
16686
16691
|
chain = _step42.value;
|
|
16687
16692
|
chainId = CHAIN_ID_MAP[chain];
|
|
16688
16693
|
if (chainId) {
|
|
16689
|
-
|
|
16694
|
+
_context15.next = 4;
|
|
16690
16695
|
break;
|
|
16691
16696
|
}
|
|
16692
16697
|
throw new ValidationError("Invalid chain: ".concat(chain));
|
|
16693
16698
|
|
|
16694
16699
|
case 4:
|
|
16695
16700
|
if (!(category === "balance")) {
|
|
16696
|
-
|
|
16701
|
+
_context15.next = 17;
|
|
16697
16702
|
break;
|
|
16698
16703
|
}
|
|
16699
16704
|
_loop2 = _regeneratorRuntime().mark((function _loop2(i) {
|
|
16700
16705
|
var slice, url, data;
|
|
16701
|
-
return _regeneratorRuntime().wrap((function _loop2$(
|
|
16702
|
-
while (1) switch (
|
|
16706
|
+
return _regeneratorRuntime().wrap((function _loop2$(_context13) {
|
|
16707
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
16703
16708
|
case 0:
|
|
16704
16709
|
slice = ADDRS.slice(i, i + 20).join(",");
|
|
16705
16710
|
url = "https://api.etherscan.io/v2/api?chainid=".concat(chainId) + "&module=account&action=addresstokenbalance&address=".concat(slice) + "&page=".concat(page, "&offset=").concat(offset, "&apikey=").concat(apiKey);
|
|
16706
|
-
|
|
16711
|
+
_context13.next = 4;
|
|
16707
16712
|
return fetchJSON(url);
|
|
16708
16713
|
|
|
16709
16714
|
case 4:
|
|
16710
|
-
data =
|
|
16715
|
+
data = _context13.sent;
|
|
16711
16716
|
if (Array.isArray(data)) {
|
|
16712
|
-
|
|
16717
|
+
_context13.next = 7;
|
|
16713
16718
|
break;
|
|
16714
16719
|
}
|
|
16715
|
-
return
|
|
16720
|
+
return _context13.abrupt("return", {
|
|
16716
16721
|
v: {
|
|
16717
16722
|
v: data
|
|
16718
16723
|
}
|
|
@@ -16729,7 +16734,7 @@ function _typeof(o) {
|
|
|
16729
16734
|
|
|
16730
16735
|
case 8:
|
|
16731
16736
|
case "end":
|
|
16732
|
-
return
|
|
16737
|
+
return _context13.stop();
|
|
16733
16738
|
}
|
|
16734
16739
|
}), _loop2);
|
|
16735
16740
|
}));
|
|
@@ -16737,48 +16742,48 @@ function _typeof(o) {
|
|
|
16737
16742
|
|
|
16738
16743
|
case 7:
|
|
16739
16744
|
if (!(i < ADDRS.length)) {
|
|
16740
|
-
|
|
16745
|
+
_context15.next = 15;
|
|
16741
16746
|
break;
|
|
16742
16747
|
}
|
|
16743
|
-
return
|
|
16748
|
+
return _context15.delegateYield(_loop2(i), "t0", 9);
|
|
16744
16749
|
|
|
16745
16750
|
case 9:
|
|
16746
|
-
_ret2 =
|
|
16751
|
+
_ret2 = _context15.t0;
|
|
16747
16752
|
if (!_ret2) {
|
|
16748
|
-
|
|
16753
|
+
_context15.next = 12;
|
|
16749
16754
|
break;
|
|
16750
16755
|
}
|
|
16751
|
-
return
|
|
16756
|
+
return _context15.abrupt("return", _ret2.v);
|
|
16752
16757
|
|
|
16753
16758
|
case 12:
|
|
16754
16759
|
i += 20;
|
|
16755
|
-
|
|
16760
|
+
_context15.next = 7;
|
|
16756
16761
|
break;
|
|
16757
16762
|
|
|
16758
16763
|
case 15:
|
|
16759
|
-
|
|
16764
|
+
_context15.next = 37;
|
|
16760
16765
|
break;
|
|
16761
16766
|
|
|
16762
16767
|
case 17:
|
|
16763
|
-
|
|
16768
|
+
_context15.next = 19;
|
|
16764
16769
|
return fromTimestampToBlock.fromTimeStampToBlock(toTimestamp(startTime), chain, apiKey);
|
|
16765
16770
|
|
|
16766
16771
|
case 19:
|
|
16767
|
-
sb =
|
|
16768
|
-
|
|
16772
|
+
sb = _context15.sent;
|
|
16773
|
+
_context15.next = 22;
|
|
16769
16774
|
return fromTimestampToBlock.fromTimeStampToBlock(toTimestamp(endTime), chain, apiKey);
|
|
16770
16775
|
|
|
16771
16776
|
case 22:
|
|
16772
|
-
eb =
|
|
16777
|
+
eb = _context15.sent;
|
|
16773
16778
|
if (sb) {
|
|
16774
|
-
|
|
16779
|
+
_context15.next = 25;
|
|
16775
16780
|
break;
|
|
16776
16781
|
}
|
|
16777
16782
|
throw new ValidationError("Invalid startTime: ".concat(startTime));
|
|
16778
16783
|
|
|
16779
16784
|
case 25:
|
|
16780
16785
|
if (eb) {
|
|
16781
|
-
|
|
16786
|
+
_context15.next = 27;
|
|
16782
16787
|
break;
|
|
16783
16788
|
}
|
|
16784
16789
|
throw new ValidationError("Invalid endTime: ".concat(endTime));
|
|
@@ -16786,21 +16791,21 @@ function _typeof(o) {
|
|
|
16786
16791
|
case 27:
|
|
16787
16792
|
_loop3 = _regeneratorRuntime().mark((function _loop3() {
|
|
16788
16793
|
var addr, url, data;
|
|
16789
|
-
return _regeneratorRuntime().wrap((function _loop3$(
|
|
16790
|
-
while (1) switch (
|
|
16794
|
+
return _regeneratorRuntime().wrap((function _loop3$(_context14) {
|
|
16795
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
16791
16796
|
case 0:
|
|
16792
16797
|
addr = _ADDRS[_i10];
|
|
16793
16798
|
url = "https://api.etherscan.io/v2/api?chainid=".concat(chainId) + "&module=account&action=tokentx&address=".concat(addr) + "&startblock=".concat(sb, "&endblock=").concat(eb) + "&page=".concat(page, "&offset=").concat(offset, "&sort=asc&apikey=").concat(apiKey);
|
|
16794
|
-
|
|
16799
|
+
_context14.next = 4;
|
|
16795
16800
|
return fetchJSON(url);
|
|
16796
16801
|
|
|
16797
16802
|
case 4:
|
|
16798
|
-
data =
|
|
16803
|
+
data = _context14.sent;
|
|
16799
16804
|
if (Array.isArray(data)) {
|
|
16800
|
-
|
|
16805
|
+
_context14.next = 7;
|
|
16801
16806
|
break;
|
|
16802
16807
|
}
|
|
16803
|
-
return
|
|
16808
|
+
return _context14.abrupt("return", {
|
|
16804
16809
|
v: {
|
|
16805
16810
|
v: data
|
|
16806
16811
|
}
|
|
@@ -16817,7 +16822,7 @@ function _typeof(o) {
|
|
|
16817
16822
|
|
|
16818
16823
|
case 8:
|
|
16819
16824
|
case "end":
|
|
16820
|
-
return
|
|
16825
|
+
return _context14.stop();
|
|
16821
16826
|
}
|
|
16822
16827
|
}), _loop3);
|
|
16823
16828
|
}));
|
|
@@ -16825,27 +16830,27 @@ function _typeof(o) {
|
|
|
16825
16830
|
|
|
16826
16831
|
case 29:
|
|
16827
16832
|
if (!(_i10 < _ADDRS.length)) {
|
|
16828
|
-
|
|
16833
|
+
_context15.next = 37;
|
|
16829
16834
|
break;
|
|
16830
16835
|
}
|
|
16831
|
-
return
|
|
16836
|
+
return _context15.delegateYield(_loop3(), "t1", 31);
|
|
16832
16837
|
|
|
16833
16838
|
case 31:
|
|
16834
|
-
_ret3 =
|
|
16839
|
+
_ret3 = _context15.t1;
|
|
16835
16840
|
if (!_ret3) {
|
|
16836
|
-
|
|
16841
|
+
_context15.next = 34;
|
|
16837
16842
|
break;
|
|
16838
16843
|
}
|
|
16839
|
-
return
|
|
16844
|
+
return _context15.abrupt("return", _ret3.v);
|
|
16840
16845
|
|
|
16841
16846
|
case 34:
|
|
16842
16847
|
_i10++;
|
|
16843
|
-
|
|
16848
|
+
_context15.next = 29;
|
|
16844
16849
|
break;
|
|
16845
16850
|
|
|
16846
16851
|
case 37:
|
|
16847
16852
|
case "end":
|
|
16848
|
-
return
|
|
16853
|
+
return _context15.stop();
|
|
16849
16854
|
}
|
|
16850
16855
|
}), _loop);
|
|
16851
16856
|
}));
|
|
@@ -16853,50 +16858,50 @@ function _typeof(o) {
|
|
|
16853
16858
|
|
|
16854
16859
|
case 37:
|
|
16855
16860
|
if ((_step42 = _iterator42.n()).done) {
|
|
16856
|
-
|
|
16861
|
+
_context16.next = 44;
|
|
16857
16862
|
break;
|
|
16858
16863
|
}
|
|
16859
|
-
return
|
|
16864
|
+
return _context16.delegateYield(_loop(), "t1", 39);
|
|
16860
16865
|
|
|
16861
16866
|
case 39:
|
|
16862
|
-
_ret =
|
|
16867
|
+
_ret = _context16.t1;
|
|
16863
16868
|
if (!_ret) {
|
|
16864
|
-
|
|
16869
|
+
_context16.next = 42;
|
|
16865
16870
|
break;
|
|
16866
16871
|
}
|
|
16867
|
-
return
|
|
16872
|
+
return _context16.abrupt("return", _ret.v);
|
|
16868
16873
|
|
|
16869
16874
|
case 42:
|
|
16870
|
-
|
|
16875
|
+
_context16.next = 37;
|
|
16871
16876
|
break;
|
|
16872
16877
|
|
|
16873
16878
|
case 44:
|
|
16874
|
-
|
|
16879
|
+
_context16.next = 49;
|
|
16875
16880
|
break;
|
|
16876
16881
|
|
|
16877
16882
|
case 46:
|
|
16878
|
-
|
|
16879
|
-
|
|
16880
|
-
_iterator42.e(
|
|
16883
|
+
_context16.prev = 46;
|
|
16884
|
+
_context16.t2 = _context16["catch"](34);
|
|
16885
|
+
_iterator42.e(_context16.t2);
|
|
16881
16886
|
|
|
16882
16887
|
case 49:
|
|
16883
|
-
|
|
16888
|
+
_context16.prev = 49;
|
|
16884
16889
|
_iterator42.f();
|
|
16885
|
-
return
|
|
16890
|
+
return _context16.finish(49);
|
|
16886
16891
|
|
|
16887
16892
|
case 52:
|
|
16888
|
-
return
|
|
16893
|
+
return _context16.abrupt("return", out);
|
|
16889
16894
|
|
|
16890
16895
|
case 55:
|
|
16891
|
-
|
|
16892
|
-
|
|
16893
|
-
return
|
|
16896
|
+
_context16.prev = 55;
|
|
16897
|
+
_context16.t3 = _context16["catch"](0);
|
|
16898
|
+
return _context16.abrupt("return", errorMessageHandler(_context16.t3, "EOA"));
|
|
16894
16899
|
|
|
16895
16900
|
case 58:
|
|
16896
16901
|
case "end":
|
|
16897
|
-
return
|
|
16902
|
+
return _context16.stop();
|
|
16898
16903
|
}
|
|
16899
|
-
}),
|
|
16904
|
+
}), _callee13, null, [ [ 0, 55 ], [ 9, 25, 28, 31 ], [ 34, 46, 49, 52 ] ]);
|
|
16900
16905
|
})));
|
|
16901
16906
|
return _EOA.apply(this, arguments);
|
|
16902
16907
|
}
|
|
@@ -16924,10 +16929,10 @@ function _typeof(o) {
|
|
|
16924
16929
|
return _handleScanRequest.apply(this, arguments);
|
|
16925
16930
|
}
|
|
16926
16931
|
function _handleScanRequest() {
|
|
16927
|
-
_handleScanRequest = _asyncToGenerator(_regeneratorRuntime().mark((function
|
|
16932
|
+
_handleScanRequest = _asyncToGenerator(_regeneratorRuntime().mark((function _callee14(_ref13) {
|
|
16928
16933
|
var type, address, startDate, endDate, _ref13$page, page, _ref13$offset, offset, apiKey, functionName, chainId, network, API_INFO_MAP, apiInfo, baseUrl, ACTION_MAP, action, module, url, _yield$Promise$all, _yield$Promise$all2, startBlock, endBlock, _getUrlAndHeaders4, finalUrl, HEADERS, res, json;
|
|
16929
|
-
return _regeneratorRuntime().wrap((function
|
|
16930
|
-
while (1) switch (
|
|
16934
|
+
return _regeneratorRuntime().wrap((function _callee14$(_context17) {
|
|
16935
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
16931
16936
|
case 0:
|
|
16932
16937
|
type = _ref13.type, address = _ref13.address, startDate = _ref13.startDate, endDate = _ref13.endDate,
|
|
16933
16938
|
_ref13$page = _ref13.page, page = _ref13$page === void 0 ? 1 : _ref13$page, _ref13$offset = _ref13.offset,
|
|
@@ -16948,20 +16953,20 @@ function _typeof(o) {
|
|
|
16948
16953
|
}
|
|
16949
16954
|
};
|
|
16950
16955
|
if (!(type !== "gas")) {
|
|
16951
|
-
|
|
16956
|
+
_context17.next = 6;
|
|
16952
16957
|
break;
|
|
16953
16958
|
}
|
|
16954
|
-
|
|
16959
|
+
_context17.next = 5;
|
|
16955
16960
|
return fromEnsNameToAddress$1.validateAndGetAddress(address);
|
|
16956
16961
|
|
|
16957
16962
|
case 5:
|
|
16958
|
-
address =
|
|
16963
|
+
address = _context17.sent;
|
|
16959
16964
|
|
|
16960
16965
|
case 6:
|
|
16961
16966
|
apiInfo = API_INFO_MAP[functionName];
|
|
16962
16967
|
baseUrl = apiInfo === null || apiInfo === void 0 ? void 0 : apiInfo.url;
|
|
16963
16968
|
if (baseUrl) {
|
|
16964
|
-
|
|
16969
|
+
_context17.next = 10;
|
|
16965
16970
|
break;
|
|
16966
16971
|
}
|
|
16967
16972
|
throw new ValidationError("Api not found for: ".concat(functionName));
|
|
@@ -16975,7 +16980,7 @@ function _typeof(o) {
|
|
|
16975
16980
|
};
|
|
16976
16981
|
action = ACTION_MAP[type];
|
|
16977
16982
|
if (action) {
|
|
16978
|
-
|
|
16983
|
+
_context17.next = 14;
|
|
16979
16984
|
break;
|
|
16980
16985
|
}
|
|
16981
16986
|
throw new ValidationError("Invalid type: ".concat(type));
|
|
@@ -16984,19 +16989,19 @@ function _typeof(o) {
|
|
|
16984
16989
|
module = action === "gasoracle" ? "gastracker" : "account";
|
|
16985
16990
|
url = "".concat(baseUrl, "?chainid=").concat(chainId, "&module=").concat(module, "&action=").concat(action, "&apikey=").concat(apiKey);
|
|
16986
16991
|
if (![ "all-txns", "token-txns", "nft-txns" ].includes(type)) {
|
|
16987
|
-
|
|
16992
|
+
_context17.next = 27;
|
|
16988
16993
|
break;
|
|
16989
16994
|
}
|
|
16990
16995
|
url += "&address=".concat(address, "&startblock=0&endblock=99999999&sort=asc");
|
|
16991
16996
|
if (!(!isNaN(startDate) && !isNaN(endDate))) {
|
|
16992
|
-
|
|
16997
|
+
_context17.next = 26;
|
|
16993
16998
|
break;
|
|
16994
16999
|
}
|
|
16995
|
-
|
|
17000
|
+
_context17.next = 21;
|
|
16996
17001
|
return Promise.all([ fromTimestampToBlock.fromTimeStampToBlock(toTimestamp(startDate), network, apiKey), fromTimestampToBlock.fromTimeStampToBlock(toTimestamp(endDate), network, apiKey) ]);
|
|
16997
17002
|
|
|
16998
17003
|
case 21:
|
|
16999
|
-
_yield$Promise$all =
|
|
17004
|
+
_yield$Promise$all = _context17.sent;
|
|
17000
17005
|
_yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 2);
|
|
17001
17006
|
startBlock = _yield$Promise$all2[0];
|
|
17002
17007
|
endBlock = _yield$Promise$all2[1];
|
|
@@ -17011,51 +17016,51 @@ function _typeof(o) {
|
|
|
17011
17016
|
serviceName: apiInfo.apiKeyName,
|
|
17012
17017
|
headers: {}
|
|
17013
17018
|
}), finalUrl = _getUrlAndHeaders4.URL, HEADERS = _getUrlAndHeaders4.HEADERS;
|
|
17014
|
-
|
|
17019
|
+
_context17.next = 30;
|
|
17015
17020
|
return fetch(finalUrl, {
|
|
17016
17021
|
method: "GET",
|
|
17017
17022
|
headers: HEADERS
|
|
17018
17023
|
});
|
|
17019
17024
|
|
|
17020
17025
|
case 30:
|
|
17021
|
-
res =
|
|
17026
|
+
res = _context17.sent;
|
|
17022
17027
|
if (res.ok) {
|
|
17023
|
-
|
|
17028
|
+
_context17.next = 33;
|
|
17024
17029
|
break;
|
|
17025
17030
|
}
|
|
17026
17031
|
throw new NetworkError(apiInfo.apiKeyName, res.status);
|
|
17027
17032
|
|
|
17028
17033
|
case 33:
|
|
17029
|
-
|
|
17034
|
+
_context17.next = 35;
|
|
17030
17035
|
return res.json();
|
|
17031
17036
|
|
|
17032
17037
|
case 35:
|
|
17033
|
-
json =
|
|
17038
|
+
json = _context17.sent;
|
|
17034
17039
|
if (!(typeof json.result === "string")) {
|
|
17035
|
-
|
|
17040
|
+
_context17.next = 41;
|
|
17036
17041
|
break;
|
|
17037
17042
|
}
|
|
17038
17043
|
if (!json.result.includes("Invalid API Key")) {
|
|
17039
|
-
|
|
17044
|
+
_context17.next = 39;
|
|
17040
17045
|
break;
|
|
17041
17046
|
}
|
|
17042
17047
|
throw new InvalidApiKeyError(apiInfo.apiKeyName);
|
|
17043
17048
|
|
|
17044
17049
|
case 39:
|
|
17045
17050
|
if (!json.result.includes("Max rate limit reached")) {
|
|
17046
|
-
|
|
17051
|
+
_context17.next = 41;
|
|
17047
17052
|
break;
|
|
17048
17053
|
}
|
|
17049
17054
|
throw new RateLimitError(apiInfo.apiKeyName);
|
|
17050
17055
|
|
|
17051
17056
|
case 41:
|
|
17052
|
-
return
|
|
17057
|
+
return _context17.abrupt("return", type === "gas" && !Array.isArray(json.result) ? [ json.result ] : json.result);
|
|
17053
17058
|
|
|
17054
17059
|
case 42:
|
|
17055
17060
|
case "end":
|
|
17056
|
-
return
|
|
17061
|
+
return _context17.stop();
|
|
17057
17062
|
}
|
|
17058
|
-
}),
|
|
17063
|
+
}), _callee14);
|
|
17059
17064
|
})));
|
|
17060
17065
|
return _handleScanRequest.apply(this, arguments);
|
|
17061
17066
|
}
|
|
@@ -17063,13 +17068,13 @@ function _typeof(o) {
|
|
|
17063
17068
|
return _BASE.apply(this, arguments);
|
|
17064
17069
|
}
|
|
17065
17070
|
function _BASE() {
|
|
17066
|
-
_BASE = _asyncToGenerator(_regeneratorRuntime().mark((function
|
|
17067
|
-
var _argsToArray7, _argsToArray8, type, address, startDate, endDate, page, limit, API_KEY,
|
|
17068
|
-
return _regeneratorRuntime().wrap((function
|
|
17069
|
-
while (1) switch (
|
|
17071
|
+
_BASE = _asyncToGenerator(_regeneratorRuntime().mark((function _callee15() {
|
|
17072
|
+
var _argsToArray7, _argsToArray8, type, address, startDate, endDate, page, limit, API_KEY, _args18 = arguments;
|
|
17073
|
+
return _regeneratorRuntime().wrap((function _callee15$(_context18) {
|
|
17074
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
17070
17075
|
case 0:
|
|
17071
|
-
|
|
17072
|
-
_argsToArray7 = argsToArray(
|
|
17076
|
+
_context18.prev = 0;
|
|
17077
|
+
_argsToArray7 = argsToArray(_args18), _argsToArray8 = _slicedToArray(_argsToArray7, 6),
|
|
17073
17078
|
type = _argsToArray8[0], address = _argsToArray8[1], startDate = _argsToArray8[2],
|
|
17074
17079
|
endDate = _argsToArray8[3], page = _argsToArray8[4], limit = _argsToArray8[5];
|
|
17075
17080
|
validateParams(baseParamsSchema, {
|
|
@@ -17081,7 +17086,7 @@ function _typeof(o) {
|
|
|
17081
17086
|
limit: limit
|
|
17082
17087
|
});
|
|
17083
17088
|
API_KEY = window.localStorage.getItem(SERVICES_API_KEY.Basescan);
|
|
17084
|
-
|
|
17089
|
+
_context18.next = 6;
|
|
17085
17090
|
return handleScanRequest({
|
|
17086
17091
|
type: type,
|
|
17087
17092
|
address: address,
|
|
@@ -17096,18 +17101,18 @@ function _typeof(o) {
|
|
|
17096
17101
|
});
|
|
17097
17102
|
|
|
17098
17103
|
case 6:
|
|
17099
|
-
return
|
|
17104
|
+
return _context18.abrupt("return", _context18.sent);
|
|
17100
17105
|
|
|
17101
17106
|
case 9:
|
|
17102
|
-
|
|
17103
|
-
|
|
17104
|
-
return
|
|
17107
|
+
_context18.prev = 9;
|
|
17108
|
+
_context18.t0 = _context18["catch"](0);
|
|
17109
|
+
return _context18.abrupt("return", errorMessageHandler(_context18.t0, "BASE"));
|
|
17105
17110
|
|
|
17106
17111
|
case 12:
|
|
17107
17112
|
case "end":
|
|
17108
|
-
return
|
|
17113
|
+
return _context18.stop();
|
|
17109
17114
|
}
|
|
17110
|
-
}),
|
|
17115
|
+
}), _callee15, null, [ [ 0, 9 ] ]);
|
|
17111
17116
|
})));
|
|
17112
17117
|
return _BASE.apply(this, arguments);
|
|
17113
17118
|
}
|
|
@@ -17126,13 +17131,13 @@ function _typeof(o) {
|
|
|
17126
17131
|
return _BLOCKSCOUT.apply(this, arguments);
|
|
17127
17132
|
}
|
|
17128
17133
|
function _BLOCKSCOUT() {
|
|
17129
|
-
_BLOCKSCOUT = _asyncToGenerator(_regeneratorRuntime().mark((function
|
|
17130
|
-
var _json$result, _json$result2, _argsToArray9, _argsToArray0, address, type, _argsToArray0$, chain, startTimestamp, endTimestamp, page, offset, startTs, endTs, resolvedAddress, hostname, requestUrl, response, json,
|
|
17131
|
-
return _regeneratorRuntime().wrap((function
|
|
17132
|
-
while (1) switch (
|
|
17134
|
+
_BLOCKSCOUT = _asyncToGenerator(_regeneratorRuntime().mark((function _callee16() {
|
|
17135
|
+
var _json$result, _json$result2, _argsToArray9, _argsToArray0, address, type, _argsToArray0$, chain, startTimestamp, endTimestamp, page, offset, startTs, endTs, resolvedAddress, hostname, requestUrl, response, json, _args19 = arguments;
|
|
17136
|
+
return _regeneratorRuntime().wrap((function _callee16$(_context19) {
|
|
17137
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
17133
17138
|
case 0:
|
|
17134
|
-
|
|
17135
|
-
_argsToArray9 = argsToArray(
|
|
17139
|
+
_context19.prev = 0;
|
|
17140
|
+
_argsToArray9 = argsToArray(_args19), _argsToArray0 = _slicedToArray(_argsToArray9, 7),
|
|
17136
17141
|
address = _argsToArray0[0], type = _argsToArray0[1], _argsToArray0$ = _argsToArray0[2],
|
|
17137
17142
|
chain = _argsToArray0$ === void 0 ? "ethereum" : _argsToArray0$, startTimestamp = _argsToArray0[3],
|
|
17138
17143
|
endTimestamp = _argsToArray0[4], page = _argsToArray0[5], offset = _argsToArray0[6];
|
|
@@ -17147,72 +17152,72 @@ function _typeof(o) {
|
|
|
17147
17152
|
});
|
|
17148
17153
|
startTs = startTimestamp !== null && startTimestamp !== void 0 ? startTimestamp : Math.floor((Date.now() - 30 * 24 * 3600 * 1e3) / 1e3);
|
|
17149
17154
|
endTs = endTimestamp;
|
|
17150
|
-
|
|
17155
|
+
_context19.next = 7;
|
|
17151
17156
|
return fromEnsNameToAddress$1.validateAndGetAddress(address);
|
|
17152
17157
|
|
|
17153
17158
|
case 7:
|
|
17154
|
-
resolvedAddress =
|
|
17159
|
+
resolvedAddress = _context19.sent;
|
|
17155
17160
|
hostname = BLOCKSCOUT_CHAINS_MAP[chain];
|
|
17156
|
-
|
|
17157
|
-
|
|
17161
|
+
_context19.t0 = type;
|
|
17162
|
+
_context19.next = _context19.t0 === "stat" ? 12 : _context19.t0 === "txns" ? 14 : _context19.t0 === "tokens" ? 16 : 18;
|
|
17158
17163
|
break;
|
|
17159
17164
|
|
|
17160
17165
|
case 12:
|
|
17161
17166
|
requestUrl = "".concat(hostname, "/api/v2/addresses/").concat(resolvedAddress, "/counters");
|
|
17162
|
-
return
|
|
17167
|
+
return _context19.abrupt("break", 18);
|
|
17163
17168
|
|
|
17164
17169
|
case 14:
|
|
17165
17170
|
requestUrl = "".concat(hostname, "/api?module=account&action=txlist") + "&address=".concat(resolvedAddress) + "&start_timestamp=".concat(startTs) + "&end_timestamp=".concat(endTs !== null && endTs !== void 0 ? endTs : "") + "&page=".concat(page) + "&offset=".concat(offset) + "&sort=asc";
|
|
17166
|
-
return
|
|
17171
|
+
return _context19.abrupt("break", 18);
|
|
17167
17172
|
|
|
17168
17173
|
case 16:
|
|
17169
17174
|
requestUrl = "".concat(hostname, "/api?module=account&action=tokenlist") + "&address=".concat(resolvedAddress);
|
|
17170
|
-
return
|
|
17175
|
+
return _context19.abrupt("break", 18);
|
|
17171
17176
|
|
|
17172
17177
|
case 18:
|
|
17173
|
-
|
|
17178
|
+
_context19.next = 20;
|
|
17174
17179
|
return fetch(requestUrl);
|
|
17175
17180
|
|
|
17176
17181
|
case 20:
|
|
17177
|
-
response =
|
|
17182
|
+
response = _context19.sent;
|
|
17178
17183
|
if (response.ok) {
|
|
17179
|
-
|
|
17184
|
+
_context19.next = 23;
|
|
17180
17185
|
break;
|
|
17181
17186
|
}
|
|
17182
17187
|
throw new NetworkError("BLOCKSCOUT", response.status);
|
|
17183
17188
|
|
|
17184
17189
|
case 23:
|
|
17185
|
-
|
|
17190
|
+
_context19.next = 25;
|
|
17186
17191
|
return response.json();
|
|
17187
17192
|
|
|
17188
17193
|
case 25:
|
|
17189
|
-
json =
|
|
17194
|
+
json = _context19.sent;
|
|
17190
17195
|
if (!(json !== null && json !== void 0 && (_json$result = json.result) !== null && _json$result !== void 0 && _json$result.includes("Invalid parameter(s)"))) {
|
|
17191
|
-
|
|
17196
|
+
_context19.next = 28;
|
|
17192
17197
|
break;
|
|
17193
17198
|
}
|
|
17194
17199
|
throw new ValidationError("Invalid parameters");
|
|
17195
17200
|
|
|
17196
17201
|
case 28:
|
|
17197
17202
|
if (!(json !== null && json !== void 0 && (_json$result2 = json.result) !== null && _json$result2 !== void 0 && _json$result2.includes("Not found"))) {
|
|
17198
|
-
|
|
17203
|
+
_context19.next = 30;
|
|
17199
17204
|
break;
|
|
17200
17205
|
}
|
|
17201
17206
|
throw new ValidationError("Address information not found");
|
|
17202
17207
|
|
|
17203
17208
|
case 30:
|
|
17204
|
-
return
|
|
17209
|
+
return _context19.abrupt("return", type === "stat" ? [ json ] : json.result);
|
|
17205
17210
|
|
|
17206
17211
|
case 33:
|
|
17207
|
-
|
|
17208
|
-
|
|
17209
|
-
return
|
|
17212
|
+
_context19.prev = 33;
|
|
17213
|
+
_context19.t1 = _context19["catch"](0);
|
|
17214
|
+
return _context19.abrupt("return", errorMessageHandler(_context19.t1, "BLOCKSCOUT"));
|
|
17210
17215
|
|
|
17211
17216
|
case 36:
|
|
17212
17217
|
case "end":
|
|
17213
|
-
return
|
|
17218
|
+
return _context19.stop();
|
|
17214
17219
|
}
|
|
17215
|
-
}),
|
|
17220
|
+
}), _callee16, null, [ [ 0, 33 ] ]);
|
|
17216
17221
|
})));
|
|
17217
17222
|
return _BLOCKSCOUT.apply(this, arguments);
|
|
17218
17223
|
}
|
|
@@ -17256,13 +17261,13 @@ function _typeof(o) {
|
|
|
17256
17261
|
return _COINGECKO.apply(this, arguments);
|
|
17257
17262
|
}
|
|
17258
17263
|
function _COINGECKO() {
|
|
17259
|
-
_COINGECKO = _asyncToGenerator(_regeneratorRuntime().mark((function
|
|
17260
|
-
var _category$toLowerCase, _argsToArray1, _argsToArray10, category, param1, param2, apiKey, headers, url, vs, map, _category, trend, _category2, _trend, _getUrlAndHeaders5, finalUrl, HEADERS, res, json, _json$status, msg, out, _i11, _Object$entries, _Object$entries$_i, token, prices, _i12, _Object$entries2, _Object$entries2$_i, cur, val, _data,
|
|
17261
|
-
return _regeneratorRuntime().wrap((function
|
|
17262
|
-
while (1) switch (
|
|
17264
|
+
_COINGECKO = _asyncToGenerator(_regeneratorRuntime().mark((function _callee17() {
|
|
17265
|
+
var _category$toLowerCase, _argsToArray1, _argsToArray10, category, param1, param2, apiKey, headers, url, vs, map, _category, trend, _category2, _trend, _getUrlAndHeaders5, finalUrl, HEADERS, res, json, _json$status, msg, out, _i11, _Object$entries, _Object$entries$_i, token, prices, _i12, _Object$entries2, _Object$entries2$_i, cur, val, _data, _args20 = arguments;
|
|
17266
|
+
return _regeneratorRuntime().wrap((function _callee17$(_context20) {
|
|
17267
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
17263
17268
|
case 0:
|
|
17264
|
-
|
|
17265
|
-
_argsToArray1 = argsToArray(
|
|
17269
|
+
_context20.prev = 0;
|
|
17270
|
+
_argsToArray1 = argsToArray(_args20), _argsToArray10 = _slicedToArray(_argsToArray1, 3),
|
|
17266
17271
|
category = _argsToArray10[0], param1 = _argsToArray10[1], param2 = _argsToArray10[2];
|
|
17267
17272
|
validateParams(coingeckoParamsSchema, {
|
|
17268
17273
|
category: category,
|
|
@@ -17275,14 +17280,14 @@ function _typeof(o) {
|
|
|
17275
17280
|
"x-cg-demo-api-key": apiKey
|
|
17276
17281
|
};
|
|
17277
17282
|
url = "";
|
|
17278
|
-
|
|
17279
|
-
|
|
17283
|
+
_context20.t0 = category === null || category === void 0 || (_category$toLowerCase = category.toLowerCase) === null || _category$toLowerCase === void 0 ? void 0 : _category$toLowerCase.call(category);
|
|
17284
|
+
_context20.next = _context20.t0 === "price" ? 9 : _context20.t0 === "market" ? 12 : _context20.t0 === "stablecoins" ? 17 : _context20.t0 === "derivatives" ? 21 : 23;
|
|
17280
17285
|
break;
|
|
17281
17286
|
|
|
17282
17287
|
case 9:
|
|
17283
17288
|
vs = param2 || "usd";
|
|
17284
17289
|
url = "https://api.coingecko.com/api/v3/simple/price?vs_currencies=".concat(vs, "&symbols=").concat(param1);
|
|
17285
|
-
return
|
|
17290
|
+
return _context20.abrupt("break", 23);
|
|
17286
17291
|
|
|
17287
17292
|
case 12:
|
|
17288
17293
|
map = {
|
|
@@ -17299,17 +17304,17 @@ function _typeof(o) {
|
|
|
17299
17304
|
_category = map[param1] || "";
|
|
17300
17305
|
trend = param2 ? "&price_change_percentage=".concat(param2) : "";
|
|
17301
17306
|
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);
|
|
17302
|
-
return
|
|
17307
|
+
return _context20.abrupt("break", 23);
|
|
17303
17308
|
|
|
17304
17309
|
case 17:
|
|
17305
17310
|
_category2 = param1 === "all" ? "stablecoins" : param1;
|
|
17306
17311
|
_trend = param2 ? "&price_change_percentage=".concat(param2) : "";
|
|
17307
17312
|
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);
|
|
17308
|
-
return
|
|
17313
|
+
return _context20.abrupt("break", 23);
|
|
17309
17314
|
|
|
17310
17315
|
case 21:
|
|
17311
17316
|
url = !param1 || param1 === "all" ? "https://api.coingecko.com/api/v3/derivatives" : "https://api.coingecko.com/api/v3/derivatives/exchanges/".concat(param1, "?include_tickers=all");
|
|
17312
|
-
return
|
|
17317
|
+
return _context20.abrupt("break", 23);
|
|
17313
17318
|
|
|
17314
17319
|
case 23:
|
|
17315
17320
|
_getUrlAndHeaders5 = getUrlAndHeaders({
|
|
@@ -17317,25 +17322,25 @@ function _typeof(o) {
|
|
|
17317
17322
|
serviceName: "Coingecko",
|
|
17318
17323
|
headers: headers
|
|
17319
17324
|
}), finalUrl = _getUrlAndHeaders5.URL, HEADERS = _getUrlAndHeaders5.HEADERS;
|
|
17320
|
-
|
|
17325
|
+
_context20.next = 26;
|
|
17321
17326
|
return fetch(finalUrl, {
|
|
17322
17327
|
headers: HEADERS
|
|
17323
17328
|
});
|
|
17324
17329
|
|
|
17325
17330
|
case 26:
|
|
17326
|
-
res =
|
|
17327
|
-
|
|
17331
|
+
res = _context20.sent;
|
|
17332
|
+
_context20.next = 29;
|
|
17328
17333
|
return res.json();
|
|
17329
17334
|
|
|
17330
17335
|
case 29:
|
|
17331
|
-
json =
|
|
17336
|
+
json = _context20.sent;
|
|
17332
17337
|
if (res.ok) {
|
|
17333
|
-
|
|
17338
|
+
_context20.next = 35;
|
|
17334
17339
|
break;
|
|
17335
17340
|
}
|
|
17336
17341
|
msg = (json === null || json === void 0 || (_json$status = json.status) === null || _json$status === void 0 ? void 0 : _json$status.error_message) || "";
|
|
17337
17342
|
if (!msg.includes("API Key Missing")) {
|
|
17338
|
-
|
|
17343
|
+
_context20.next = 34;
|
|
17339
17344
|
break;
|
|
17340
17345
|
}
|
|
17341
17346
|
throw new InvalidApiKeyError(SERVICES_API_KEY.Coingecko);
|
|
@@ -17345,7 +17350,7 @@ function _typeof(o) {
|
|
|
17345
17350
|
|
|
17346
17351
|
case 35:
|
|
17347
17352
|
if (!(category === "price")) {
|
|
17348
|
-
|
|
17353
|
+
_context20.next = 39;
|
|
17349
17354
|
break;
|
|
17350
17355
|
}
|
|
17351
17356
|
out = {};
|
|
@@ -17358,11 +17363,11 @@ function _typeof(o) {
|
|
|
17358
17363
|
out["".concat(token.charAt(0).toUpperCase() + token.slice(1), "_").concat(cur.toUpperCase())] = val;
|
|
17359
17364
|
}
|
|
17360
17365
|
}
|
|
17361
|
-
return
|
|
17366
|
+
return _context20.abrupt("return", [ out ]);
|
|
17362
17367
|
|
|
17363
17368
|
case 39:
|
|
17364
17369
|
_data = Array.isArray(json) ? json : [ json ];
|
|
17365
|
-
return
|
|
17370
|
+
return _context20.abrupt("return", _data.map((function(item) {
|
|
17366
17371
|
var flat = {};
|
|
17367
17372
|
for (var _i13 = 0, _Object$entries3 = Object.entries(item); _i13 < _Object$entries3.length; _i13++) {
|
|
17368
17373
|
var _Object$entries3$_i = _slicedToArray(_Object$entries3[_i13], 2), key = _Object$entries3$_i[0], _value11 = _Object$entries3$_i[1];
|
|
@@ -17374,15 +17379,15 @@ function _typeof(o) {
|
|
|
17374
17379
|
})));
|
|
17375
17380
|
|
|
17376
17381
|
case 43:
|
|
17377
|
-
|
|
17378
|
-
|
|
17379
|
-
return
|
|
17382
|
+
_context20.prev = 43;
|
|
17383
|
+
_context20.t1 = _context20["catch"](0);
|
|
17384
|
+
return _context20.abrupt("return", errorMessageHandler(_context20.t1, "COINGECKO"));
|
|
17380
17385
|
|
|
17381
17386
|
case 46:
|
|
17382
17387
|
case "end":
|
|
17383
|
-
return
|
|
17388
|
+
return _context20.stop();
|
|
17384
17389
|
}
|
|
17385
|
-
}),
|
|
17390
|
+
}), _callee17, null, [ [ 0, 43 ] ]);
|
|
17386
17391
|
})));
|
|
17387
17392
|
return _COINGECKO.apply(this, arguments);
|
|
17388
17393
|
}
|
|
@@ -17400,60 +17405,60 @@ function _typeof(o) {
|
|
|
17400
17405
|
return _DEFILLAMA.apply(this, arguments);
|
|
17401
17406
|
}
|
|
17402
17407
|
function _DEFILLAMA() {
|
|
17403
|
-
_DEFILLAMA = _asyncToGenerator(_regeneratorRuntime().mark((function
|
|
17404
|
-
var _argsToArray11, _argsToArray12, category, url, res, json,
|
|
17405
|
-
return _regeneratorRuntime().wrap((function
|
|
17406
|
-
while (1) switch (
|
|
17408
|
+
_DEFILLAMA = _asyncToGenerator(_regeneratorRuntime().mark((function _callee18() {
|
|
17409
|
+
var _argsToArray11, _argsToArray12, category, url, res, json, _args21 = arguments;
|
|
17410
|
+
return _regeneratorRuntime().wrap((function _callee18$(_context21) {
|
|
17411
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
17407
17412
|
case 0:
|
|
17408
|
-
|
|
17409
|
-
_argsToArray11 = argsToArray(
|
|
17413
|
+
_context21.prev = 0;
|
|
17414
|
+
_argsToArray11 = argsToArray(_args21), _argsToArray12 = _slicedToArray(_argsToArray11, 1),
|
|
17410
17415
|
category = _argsToArray12[0];
|
|
17411
17416
|
validateParams(defillamaParamsSchema, {
|
|
17412
17417
|
category: category
|
|
17413
17418
|
});
|
|
17414
17419
|
url = CATEGORY_URLS[category];
|
|
17415
17420
|
if (url) {
|
|
17416
|
-
|
|
17421
|
+
_context21.next = 6;
|
|
17417
17422
|
break;
|
|
17418
17423
|
}
|
|
17419
17424
|
throw new ValidationError("Invalid category: ".concat(category));
|
|
17420
17425
|
|
|
17421
17426
|
case 6:
|
|
17422
|
-
|
|
17427
|
+
_context21.next = 8;
|
|
17423
17428
|
return fetch(url);
|
|
17424
17429
|
|
|
17425
17430
|
case 8:
|
|
17426
|
-
res =
|
|
17431
|
+
res = _context21.sent;
|
|
17427
17432
|
if (res.ok) {
|
|
17428
|
-
|
|
17433
|
+
_context21.next = 11;
|
|
17429
17434
|
break;
|
|
17430
17435
|
}
|
|
17431
17436
|
throw new NetworkError(SERVICES_API_KEY.Defillama, res.status);
|
|
17432
17437
|
|
|
17433
17438
|
case 11:
|
|
17434
|
-
|
|
17439
|
+
_context21.next = 13;
|
|
17435
17440
|
return res.json();
|
|
17436
17441
|
|
|
17437
17442
|
case 13:
|
|
17438
|
-
json =
|
|
17439
|
-
|
|
17440
|
-
|
|
17443
|
+
json = _context21.sent;
|
|
17444
|
+
_context21.t0 = category;
|
|
17445
|
+
_context21.next = _context21.t0 === "protocols" ? 17 : _context21.t0 === "yields" ? 19 : _context21.t0 === "dex" ? 21 : _context21.t0 === "fees" ? 21 : 23;
|
|
17441
17446
|
break;
|
|
17442
17447
|
|
|
17443
17448
|
case 17:
|
|
17444
17449
|
json = Array.isArray(json) ? json.slice(0, 500) : [];
|
|
17445
|
-
return
|
|
17450
|
+
return _context21.abrupt("break", 23);
|
|
17446
17451
|
|
|
17447
17452
|
case 19:
|
|
17448
17453
|
json = Array.isArray(json.data) ? json.data.slice(0, 500) : [];
|
|
17449
|
-
return
|
|
17454
|
+
return _context21.abrupt("break", 23);
|
|
17450
17455
|
|
|
17451
17456
|
case 21:
|
|
17452
17457
|
json = Array.isArray(json.protocols) ? json.protocols.slice(0, 500) : [];
|
|
17453
|
-
return
|
|
17458
|
+
return _context21.abrupt("break", 23);
|
|
17454
17459
|
|
|
17455
17460
|
case 23:
|
|
17456
|
-
return
|
|
17461
|
+
return _context21.abrupt("return", (Array.isArray(json) ? json : [ json ]).map((function(item) {
|
|
17457
17462
|
var out = {};
|
|
17458
17463
|
for (var _i14 = 0, _Object$entries4 = Object.entries(item); _i14 < _Object$entries4.length; _i14++) {
|
|
17459
17464
|
var _Object$entries4$_i = _slicedToArray(_Object$entries4[_i14], 2), k = _Object$entries4$_i[0], v = _Object$entries4$_i[1];
|
|
@@ -17463,15 +17468,15 @@ function _typeof(o) {
|
|
|
17463
17468
|
})));
|
|
17464
17469
|
|
|
17465
17470
|
case 26:
|
|
17466
|
-
|
|
17467
|
-
|
|
17468
|
-
return
|
|
17471
|
+
_context21.prev = 26;
|
|
17472
|
+
_context21.t1 = _context21["catch"](0);
|
|
17473
|
+
return _context21.abrupt("return", errorMessageHandler(_context21.t1, "DEFILLAMA"));
|
|
17469
17474
|
|
|
17470
17475
|
case 29:
|
|
17471
17476
|
case "end":
|
|
17472
|
-
return
|
|
17477
|
+
return _context21.stop();
|
|
17473
17478
|
}
|
|
17474
|
-
}),
|
|
17479
|
+
}), _callee18, null, [ [ 0, 26 ] ]);
|
|
17475
17480
|
})));
|
|
17476
17481
|
return _DEFILLAMA.apply(this, arguments);
|
|
17477
17482
|
}
|
|
@@ -17500,13 +17505,13 @@ function _typeof(o) {
|
|
|
17500
17505
|
return _ETHERSCAN.apply(this, arguments);
|
|
17501
17506
|
}
|
|
17502
17507
|
function _ETHERSCAN() {
|
|
17503
|
-
_ETHERSCAN = _asyncToGenerator(_regeneratorRuntime().mark((function
|
|
17504
|
-
var _argsToArray13, _argsToArray14, type, chain, address, startDate, endDate, _argsToArray14$, page, _argsToArray14$2, limit, chainId, apiKey,
|
|
17505
|
-
return _regeneratorRuntime().wrap((function
|
|
17506
|
-
while (1) switch (
|
|
17508
|
+
_ETHERSCAN = _asyncToGenerator(_regeneratorRuntime().mark((function _callee19() {
|
|
17509
|
+
var _argsToArray13, _argsToArray14, type, chain, address, startDate, endDate, _argsToArray14$, page, _argsToArray14$2, limit, chainId, apiKey, _args22 = arguments;
|
|
17510
|
+
return _regeneratorRuntime().wrap((function _callee19$(_context22) {
|
|
17511
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
17507
17512
|
case 0:
|
|
17508
|
-
|
|
17509
|
-
_argsToArray13 = argsToArray(
|
|
17513
|
+
_context22.prev = 0;
|
|
17514
|
+
_argsToArray13 = argsToArray(_args22), _argsToArray14 = _slicedToArray(_argsToArray13, 7),
|
|
17510
17515
|
type = _argsToArray14[0], chain = _argsToArray14[1], address = _argsToArray14[2],
|
|
17511
17516
|
startDate = _argsToArray14[3], endDate = _argsToArray14[4], _argsToArray14$ = _argsToArray14[5],
|
|
17512
17517
|
page = _argsToArray14$ === void 0 ? 1 : _argsToArray14$, _argsToArray14$2 = _argsToArray14[6],
|
|
@@ -17522,14 +17527,14 @@ function _typeof(o) {
|
|
|
17522
17527
|
});
|
|
17523
17528
|
chainId = CHAIN_ID_MAP[chain];
|
|
17524
17529
|
if (chainId) {
|
|
17525
|
-
|
|
17530
|
+
_context22.next = 6;
|
|
17526
17531
|
break;
|
|
17527
17532
|
}
|
|
17528
17533
|
throw new ValidationError("Invalid chain: ".concat(chain));
|
|
17529
17534
|
|
|
17530
17535
|
case 6:
|
|
17531
17536
|
apiKey = window.localStorage.getItem(SERVICES_API_KEY.Etherscan);
|
|
17532
|
-
|
|
17537
|
+
_context22.next = 9;
|
|
17533
17538
|
return handleScanRequest({
|
|
17534
17539
|
type: type,
|
|
17535
17540
|
address: address,
|
|
@@ -17544,18 +17549,18 @@ function _typeof(o) {
|
|
|
17544
17549
|
});
|
|
17545
17550
|
|
|
17546
17551
|
case 9:
|
|
17547
|
-
return
|
|
17552
|
+
return _context22.abrupt("return", _context22.sent);
|
|
17548
17553
|
|
|
17549
17554
|
case 12:
|
|
17550
|
-
|
|
17551
|
-
|
|
17552
|
-
return
|
|
17555
|
+
_context22.prev = 12;
|
|
17556
|
+
_context22.t0 = _context22["catch"](0);
|
|
17557
|
+
return _context22.abrupt("return", errorMessageHandler(_context22.t0, "ETHERSCAN"));
|
|
17553
17558
|
|
|
17554
17559
|
case 15:
|
|
17555
17560
|
case "end":
|
|
17556
|
-
return
|
|
17561
|
+
return _context22.stop();
|
|
17557
17562
|
}
|
|
17558
|
-
}),
|
|
17563
|
+
}), _callee19, null, [ [ 0, 12 ] ]);
|
|
17559
17564
|
})));
|
|
17560
17565
|
return _ETHERSCAN.apply(this, arguments);
|
|
17561
17566
|
}
|
|
@@ -17571,13 +17576,13 @@ function _typeof(o) {
|
|
|
17571
17576
|
return _FARCASTER.apply(this, arguments);
|
|
17572
17577
|
}
|
|
17573
17578
|
function _FARCASTER() {
|
|
17574
|
-
_FARCASTER = _asyncToGenerator(_regeneratorRuntime().mark((function
|
|
17575
|
-
var _argsToArray15, _argsToArray16, contentType, identifier, _argsToArray16$, start, _argsToArray16$2, end, apiKey, url, typeMap, _getUrlAndHeaders6, finalUrl, HEADERS, response, _yield$response$json, _data2,
|
|
17576
|
-
return _regeneratorRuntime().wrap((function
|
|
17577
|
-
while (1) switch (
|
|
17579
|
+
_FARCASTER = _asyncToGenerator(_regeneratorRuntime().mark((function _callee20() {
|
|
17580
|
+
var _argsToArray15, _argsToArray16, contentType, identifier, _argsToArray16$, start, _argsToArray16$2, end, apiKey, url, typeMap, _getUrlAndHeaders6, finalUrl, HEADERS, response, _yield$response$json, _data2, _args23 = arguments;
|
|
17581
|
+
return _regeneratorRuntime().wrap((function _callee20$(_context23) {
|
|
17582
|
+
while (1) switch (_context23.prev = _context23.next) {
|
|
17578
17583
|
case 0:
|
|
17579
|
-
|
|
17580
|
-
_argsToArray15 = argsToArray(
|
|
17584
|
+
_context23.prev = 0;
|
|
17585
|
+
_argsToArray15 = argsToArray(_args23), _argsToArray16 = _slicedToArray(_argsToArray15, 4),
|
|
17581
17586
|
contentType = _argsToArray16[0], identifier = _argsToArray16[1], _argsToArray16$ = _argsToArray16[2],
|
|
17582
17587
|
start = _argsToArray16$ === void 0 ? 0 : _argsToArray16$, _argsToArray16$2 = _argsToArray16[3],
|
|
17583
17588
|
end = _argsToArray16$2 === void 0 ? 10 : _argsToArray16$2;
|
|
@@ -17607,35 +17612,35 @@ function _typeof(o) {
|
|
|
17607
17612
|
"x-api-key": apiKey
|
|
17608
17613
|
}
|
|
17609
17614
|
}), finalUrl = _getUrlAndHeaders6.URL, HEADERS = _getUrlAndHeaders6.HEADERS;
|
|
17610
|
-
|
|
17615
|
+
_context23.next = 13;
|
|
17611
17616
|
return fetch(finalUrl, {
|
|
17612
17617
|
method: "GET",
|
|
17613
17618
|
headers: HEADERS
|
|
17614
17619
|
});
|
|
17615
17620
|
|
|
17616
17621
|
case 13:
|
|
17617
|
-
response =
|
|
17622
|
+
response = _context23.sent;
|
|
17618
17623
|
if (response.ok) {
|
|
17619
|
-
|
|
17624
|
+
_context23.next = 16;
|
|
17620
17625
|
break;
|
|
17621
17626
|
}
|
|
17622
17627
|
throw new NetworkError(SERVICES_API_KEY.Firefly, response.status);
|
|
17623
17628
|
|
|
17624
17629
|
case 16:
|
|
17625
|
-
|
|
17630
|
+
_context23.next = 18;
|
|
17626
17631
|
return response.json();
|
|
17627
17632
|
|
|
17628
17633
|
case 18:
|
|
17629
|
-
_yield$response$json =
|
|
17634
|
+
_yield$response$json = _context23.sent;
|
|
17630
17635
|
_data2 = _yield$response$json.data;
|
|
17631
17636
|
if (Array.isArray(_data2)) {
|
|
17632
|
-
|
|
17637
|
+
_context23.next = 22;
|
|
17633
17638
|
break;
|
|
17634
17639
|
}
|
|
17635
|
-
return
|
|
17640
|
+
return _context23.abrupt("return", []);
|
|
17636
17641
|
|
|
17637
17642
|
case 22:
|
|
17638
|
-
return
|
|
17643
|
+
return _context23.abrupt("return", _data2.map((function(item) {
|
|
17639
17644
|
var flat = {};
|
|
17640
17645
|
for (var _i15 = 0, _Object$entries5 = Object.entries(item); _i15 < _Object$entries5.length; _i15++) {
|
|
17641
17646
|
var _Object$entries5$_i = _slicedToArray(_Object$entries5[_i15], 2), k = _Object$entries5$_i[0], v = _Object$entries5$_i[1];
|
|
@@ -17648,15 +17653,15 @@ function _typeof(o) {
|
|
|
17648
17653
|
})));
|
|
17649
17654
|
|
|
17650
17655
|
case 25:
|
|
17651
|
-
|
|
17652
|
-
|
|
17653
|
-
return
|
|
17656
|
+
_context23.prev = 25;
|
|
17657
|
+
_context23.t0 = _context23["catch"](0);
|
|
17658
|
+
return _context23.abrupt("return", errorMessageHandler(_context23.t0, "FARCASTER"));
|
|
17654
17659
|
|
|
17655
17660
|
case 28:
|
|
17656
17661
|
case "end":
|
|
17657
|
-
return
|
|
17662
|
+
return _context23.stop();
|
|
17658
17663
|
}
|
|
17659
|
-
}),
|
|
17664
|
+
}), _callee20, null, [ [ 0, 25 ] ]);
|
|
17660
17665
|
})));
|
|
17661
17666
|
return _FARCASTER.apply(this, arguments);
|
|
17662
17667
|
}
|
|
@@ -17694,13 +17699,13 @@ function _typeof(o) {
|
|
|
17694
17699
|
return _FIREFLY.apply(this, arguments);
|
|
17695
17700
|
}
|
|
17696
17701
|
function _FIREFLY() {
|
|
17697
|
-
_FIREFLY = _asyncToGenerator(_regeneratorRuntime().mark((function
|
|
17698
|
-
var _argsToArray17, _argsToArray18, platform, contentType, identifier, _argsToArray18$, start, _argsToArray18$2, end, apiKey, url, _getUrlAndHeaders7, finalUrl, HEADERS, response, _yield$response$json2, _data3,
|
|
17699
|
-
return _regeneratorRuntime().wrap((function
|
|
17700
|
-
while (1) switch (
|
|
17702
|
+
_FIREFLY = _asyncToGenerator(_regeneratorRuntime().mark((function _callee21() {
|
|
17703
|
+
var _argsToArray17, _argsToArray18, platform, contentType, identifier, _argsToArray18$, start, _argsToArray18$2, end, apiKey, url, _getUrlAndHeaders7, finalUrl, HEADERS, response, _yield$response$json2, _data3, _args24 = arguments;
|
|
17704
|
+
return _regeneratorRuntime().wrap((function _callee21$(_context24) {
|
|
17705
|
+
while (1) switch (_context24.prev = _context24.next) {
|
|
17701
17706
|
case 0:
|
|
17702
|
-
|
|
17703
|
-
_argsToArray17 = argsToArray(
|
|
17707
|
+
_context24.prev = 0;
|
|
17708
|
+
_argsToArray17 = argsToArray(_args24), _argsToArray18 = _slicedToArray(_argsToArray17, 5),
|
|
17704
17709
|
platform = _argsToArray18[0], contentType = _argsToArray18[1], identifier = _argsToArray18[2],
|
|
17705
17710
|
_argsToArray18$ = _argsToArray18[3], start = _argsToArray18$ === void 0 ? 0 : _argsToArray18$,
|
|
17706
17711
|
_argsToArray18$2 = _argsToArray18[4], end = _argsToArray18$2 === void 0 ? 10 : _argsToArray18$2;
|
|
@@ -17726,35 +17731,35 @@ function _typeof(o) {
|
|
|
17726
17731
|
"x-api-key": apiKey
|
|
17727
17732
|
}
|
|
17728
17733
|
}), finalUrl = _getUrlAndHeaders7.URL, HEADERS = _getUrlAndHeaders7.HEADERS;
|
|
17729
|
-
|
|
17734
|
+
_context24.next = 12;
|
|
17730
17735
|
return fetch(finalUrl, {
|
|
17731
17736
|
method: "GET",
|
|
17732
17737
|
headers: HEADERS
|
|
17733
17738
|
});
|
|
17734
17739
|
|
|
17735
17740
|
case 12:
|
|
17736
|
-
response =
|
|
17741
|
+
response = _context24.sent;
|
|
17737
17742
|
if (response.ok) {
|
|
17738
|
-
|
|
17743
|
+
_context24.next = 15;
|
|
17739
17744
|
break;
|
|
17740
17745
|
}
|
|
17741
17746
|
throw new NetworkError(SERVICES_API_KEY.Firefly, response.status);
|
|
17742
17747
|
|
|
17743
17748
|
case 15:
|
|
17744
|
-
|
|
17749
|
+
_context24.next = 17;
|
|
17745
17750
|
return response.json();
|
|
17746
17751
|
|
|
17747
17752
|
case 17:
|
|
17748
|
-
_yield$response$json2 =
|
|
17753
|
+
_yield$response$json2 = _context24.sent;
|
|
17749
17754
|
_data3 = _yield$response$json2.data;
|
|
17750
17755
|
if (Array.isArray(_data3)) {
|
|
17751
|
-
|
|
17756
|
+
_context24.next = 21;
|
|
17752
17757
|
break;
|
|
17753
17758
|
}
|
|
17754
|
-
return
|
|
17759
|
+
return _context24.abrupt("return", []);
|
|
17755
17760
|
|
|
17756
17761
|
case 21:
|
|
17757
|
-
return
|
|
17762
|
+
return _context24.abrupt("return", _data3.map((function(item) {
|
|
17758
17763
|
var flat = {};
|
|
17759
17764
|
for (var _i16 = 0, _Object$entries6 = Object.entries(item); _i16 < _Object$entries6.length; _i16++) {
|
|
17760
17765
|
var _Object$entries6$_i = _slicedToArray(_Object$entries6[_i16], 2), key = _Object$entries6$_i[0], _value12 = _Object$entries6$_i[1];
|
|
@@ -17767,15 +17772,15 @@ function _typeof(o) {
|
|
|
17767
17772
|
})));
|
|
17768
17773
|
|
|
17769
17774
|
case 24:
|
|
17770
|
-
|
|
17771
|
-
|
|
17772
|
-
return
|
|
17775
|
+
_context24.prev = 24;
|
|
17776
|
+
_context24.t0 = _context24["catch"](0);
|
|
17777
|
+
return _context24.abrupt("return", errorMessageHandler(_context24.t0, "FIREFLY"));
|
|
17773
17778
|
|
|
17774
17779
|
case 27:
|
|
17775
17780
|
case "end":
|
|
17776
|
-
return
|
|
17781
|
+
return _context24.stop();
|
|
17777
17782
|
}
|
|
17778
|
-
}),
|
|
17783
|
+
}), _callee21, null, [ [ 0, 24 ] ]);
|
|
17779
17784
|
})));
|
|
17780
17785
|
return _FIREFLY.apply(this, arguments);
|
|
17781
17786
|
}
|
|
@@ -17783,13 +17788,13 @@ function _typeof(o) {
|
|
|
17783
17788
|
return _GNOSIS.apply(this, arguments);
|
|
17784
17789
|
}
|
|
17785
17790
|
function _GNOSIS() {
|
|
17786
|
-
_GNOSIS = _asyncToGenerator(_regeneratorRuntime().mark((function
|
|
17787
|
-
var _argsToArray19, _argsToArray20, type, address, startDate, endDate, _argsToArray20$, page, _argsToArray20$2, limit, apiKey,
|
|
17788
|
-
return _regeneratorRuntime().wrap((function
|
|
17789
|
-
while (1) switch (
|
|
17791
|
+
_GNOSIS = _asyncToGenerator(_regeneratorRuntime().mark((function _callee22() {
|
|
17792
|
+
var _argsToArray19, _argsToArray20, type, address, startDate, endDate, _argsToArray20$, page, _argsToArray20$2, limit, apiKey, _args25 = arguments;
|
|
17793
|
+
return _regeneratorRuntime().wrap((function _callee22$(_context25) {
|
|
17794
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
17790
17795
|
case 0:
|
|
17791
|
-
|
|
17792
|
-
_argsToArray19 = argsToArray(
|
|
17796
|
+
_context25.prev = 0;
|
|
17797
|
+
_argsToArray19 = argsToArray(_args25), _argsToArray20 = _slicedToArray(_argsToArray19, 6),
|
|
17793
17798
|
type = _argsToArray20[0], address = _argsToArray20[1], startDate = _argsToArray20[2],
|
|
17794
17799
|
endDate = _argsToArray20[3], _argsToArray20$ = _argsToArray20[4], page = _argsToArray20$ === void 0 ? 1 : _argsToArray20$,
|
|
17795
17800
|
_argsToArray20$2 = _argsToArray20[5], limit = _argsToArray20$2 === void 0 ? 10 : _argsToArray20$2;
|
|
@@ -17802,7 +17807,7 @@ function _typeof(o) {
|
|
|
17802
17807
|
limit: limit
|
|
17803
17808
|
});
|
|
17804
17809
|
apiKey = window.localStorage.getItem(SERVICES_API_KEY.Gnosisscan);
|
|
17805
|
-
|
|
17810
|
+
_context25.next = 6;
|
|
17806
17811
|
return handleScanRequest({
|
|
17807
17812
|
type: type,
|
|
17808
17813
|
address: address,
|
|
@@ -17817,18 +17822,18 @@ function _typeof(o) {
|
|
|
17817
17822
|
});
|
|
17818
17823
|
|
|
17819
17824
|
case 6:
|
|
17820
|
-
return
|
|
17825
|
+
return _context25.abrupt("return", _context25.sent);
|
|
17821
17826
|
|
|
17822
17827
|
case 9:
|
|
17823
|
-
|
|
17824
|
-
|
|
17825
|
-
return
|
|
17828
|
+
_context25.prev = 9;
|
|
17829
|
+
_context25.t0 = _context25["catch"](0);
|
|
17830
|
+
return _context25.abrupt("return", errorMessageHandler(_context25.t0, "GNOSIS"));
|
|
17826
17831
|
|
|
17827
17832
|
case 12:
|
|
17828
17833
|
case "end":
|
|
17829
|
-
return
|
|
17834
|
+
return _context25.stop();
|
|
17830
17835
|
}
|
|
17831
|
-
}),
|
|
17836
|
+
}), _callee22, null, [ [ 0, 9 ] ]);
|
|
17832
17837
|
})));
|
|
17833
17838
|
return _GNOSIS.apply(this, arguments);
|
|
17834
17839
|
}
|
|
@@ -17844,13 +17849,13 @@ function _typeof(o) {
|
|
|
17844
17849
|
return _LENS.apply(this, arguments);
|
|
17845
17850
|
}
|
|
17846
17851
|
function _LENS() {
|
|
17847
|
-
_LENS = _asyncToGenerator(_regeneratorRuntime().mark((function
|
|
17848
|
-
var _argsToArray21, _argsToArray22, contentType, identifier, _argsToArray22$, start, _argsToArray22$2, end, apiKey, url, typeMap, _getUrlAndHeaders8, finalUrl, HEADERS, response, _yield$response$json3, _data4,
|
|
17849
|
-
return _regeneratorRuntime().wrap((function
|
|
17850
|
-
while (1) switch (
|
|
17852
|
+
_LENS = _asyncToGenerator(_regeneratorRuntime().mark((function _callee23() {
|
|
17853
|
+
var _argsToArray21, _argsToArray22, contentType, identifier, _argsToArray22$, start, _argsToArray22$2, end, apiKey, url, typeMap, _getUrlAndHeaders8, finalUrl, HEADERS, response, _yield$response$json3, _data4, _args26 = arguments;
|
|
17854
|
+
return _regeneratorRuntime().wrap((function _callee23$(_context26) {
|
|
17855
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
17851
17856
|
case 0:
|
|
17852
|
-
|
|
17853
|
-
_argsToArray21 = argsToArray(
|
|
17857
|
+
_context26.prev = 0;
|
|
17858
|
+
_argsToArray21 = argsToArray(_args26), _argsToArray22 = _slicedToArray(_argsToArray21, 4),
|
|
17854
17859
|
contentType = _argsToArray22[0], identifier = _argsToArray22[1], _argsToArray22$ = _argsToArray22[2],
|
|
17855
17860
|
start = _argsToArray22$ === void 0 ? 0 : _argsToArray22$, _argsToArray22$2 = _argsToArray22[3],
|
|
17856
17861
|
end = _argsToArray22$2 === void 0 ? 10 : _argsToArray22$2;
|
|
@@ -17879,35 +17884,35 @@ function _typeof(o) {
|
|
|
17879
17884
|
"x-api-key": apiKey
|
|
17880
17885
|
}
|
|
17881
17886
|
}), finalUrl = _getUrlAndHeaders8.URL, HEADERS = _getUrlAndHeaders8.HEADERS;
|
|
17882
|
-
|
|
17887
|
+
_context26.next = 13;
|
|
17883
17888
|
return fetch(finalUrl, {
|
|
17884
17889
|
method: "GET",
|
|
17885
17890
|
headers: HEADERS
|
|
17886
17891
|
});
|
|
17887
17892
|
|
|
17888
17893
|
case 13:
|
|
17889
|
-
response =
|
|
17894
|
+
response = _context26.sent;
|
|
17890
17895
|
if (response.ok) {
|
|
17891
|
-
|
|
17896
|
+
_context26.next = 16;
|
|
17892
17897
|
break;
|
|
17893
17898
|
}
|
|
17894
17899
|
throw new NetworkError(SERVICES_API_KEY.Firefly, response.status);
|
|
17895
17900
|
|
|
17896
17901
|
case 16:
|
|
17897
|
-
|
|
17902
|
+
_context26.next = 18;
|
|
17898
17903
|
return response.json();
|
|
17899
17904
|
|
|
17900
17905
|
case 18:
|
|
17901
|
-
_yield$response$json3 =
|
|
17906
|
+
_yield$response$json3 = _context26.sent;
|
|
17902
17907
|
_data4 = _yield$response$json3.data;
|
|
17903
17908
|
if (Array.isArray(_data4)) {
|
|
17904
|
-
|
|
17909
|
+
_context26.next = 22;
|
|
17905
17910
|
break;
|
|
17906
17911
|
}
|
|
17907
|
-
return
|
|
17912
|
+
return _context26.abrupt("return", []);
|
|
17908
17913
|
|
|
17909
17914
|
case 22:
|
|
17910
|
-
return
|
|
17915
|
+
return _context26.abrupt("return", _data4.map((function(item) {
|
|
17911
17916
|
var flat = {};
|
|
17912
17917
|
for (var _i17 = 0, _Object$entries7 = Object.entries(item); _i17 < _Object$entries7.length; _i17++) {
|
|
17913
17918
|
var _Object$entries7$_i = _slicedToArray(_Object$entries7[_i17], 2), key = _Object$entries7$_i[0], _value13 = _Object$entries7$_i[1];
|
|
@@ -17920,15 +17925,15 @@ function _typeof(o) {
|
|
|
17920
17925
|
})));
|
|
17921
17926
|
|
|
17922
17927
|
case 25:
|
|
17923
|
-
|
|
17924
|
-
|
|
17925
|
-
return
|
|
17928
|
+
_context26.prev = 25;
|
|
17929
|
+
_context26.t0 = _context26["catch"](0);
|
|
17930
|
+
return _context26.abrupt("return", errorMessageHandler(_context26.t0, "LENS"));
|
|
17926
17931
|
|
|
17927
17932
|
case 28:
|
|
17928
17933
|
case "end":
|
|
17929
|
-
return
|
|
17934
|
+
return _context26.stop();
|
|
17930
17935
|
}
|
|
17931
|
-
}),
|
|
17936
|
+
}), _callee23, null, [ [ 0, 25 ] ]);
|
|
17932
17937
|
})));
|
|
17933
17938
|
return _LENS.apply(this, arguments);
|
|
17934
17939
|
}
|
|
@@ -17993,25 +17998,25 @@ function _typeof(o) {
|
|
|
17993
17998
|
return _NEYNAR.apply(this, arguments);
|
|
17994
17999
|
}
|
|
17995
18000
|
function _NEYNAR() {
|
|
17996
|
-
_NEYNAR = _asyncToGenerator(_regeneratorRuntime().mark((function
|
|
17997
|
-
var _argsToArray23, _argsToArray24, username, apiKey, fid, url, _getUrlAndHeaders9, finalUrl, HEADERS, response, json, users,
|
|
17998
|
-
return _regeneratorRuntime().wrap((function
|
|
17999
|
-
while (1) switch (
|
|
18001
|
+
_NEYNAR = _asyncToGenerator(_regeneratorRuntime().mark((function _callee24() {
|
|
18002
|
+
var _argsToArray23, _argsToArray24, username, apiKey, fid, url, _getUrlAndHeaders9, finalUrl, HEADERS, response, json, users, _args27 = arguments;
|
|
18003
|
+
return _regeneratorRuntime().wrap((function _callee24$(_context27) {
|
|
18004
|
+
while (1) switch (_context27.prev = _context27.next) {
|
|
18000
18005
|
case 0:
|
|
18001
|
-
|
|
18002
|
-
_argsToArray23 = argsToArray(
|
|
18006
|
+
_context27.prev = 0;
|
|
18007
|
+
_argsToArray23 = argsToArray(_args27), _argsToArray24 = _slicedToArray(_argsToArray23, 1),
|
|
18003
18008
|
username = _argsToArray24[0];
|
|
18004
18009
|
validateParams(neynarParamsSchema, {
|
|
18005
18010
|
username: username
|
|
18006
18011
|
});
|
|
18007
18012
|
apiKey = window.localStorage.getItem(SERVICES_API_KEY.Neynar);
|
|
18008
|
-
|
|
18013
|
+
_context27.next = 6;
|
|
18009
18014
|
return fromUsernameToFid$1.fromUsernameToFid(username, apiKey);
|
|
18010
18015
|
|
|
18011
18016
|
case 6:
|
|
18012
|
-
fid =
|
|
18017
|
+
fid = _context27.sent;
|
|
18013
18018
|
if (fid) {
|
|
18014
|
-
|
|
18019
|
+
_context27.next = 9;
|
|
18015
18020
|
break;
|
|
18016
18021
|
}
|
|
18017
18022
|
throw new ValidationError("Invalid username: ".concat(username));
|
|
@@ -18026,37 +18031,37 @@ function _typeof(o) {
|
|
|
18026
18031
|
"x-neynar-experimental": "false"
|
|
18027
18032
|
}
|
|
18028
18033
|
}), finalUrl = _getUrlAndHeaders9.URL, HEADERS = _getUrlAndHeaders9.HEADERS;
|
|
18029
|
-
|
|
18034
|
+
_context27.next = 13;
|
|
18030
18035
|
return fetch(finalUrl, {
|
|
18031
18036
|
method: "GET",
|
|
18032
18037
|
headers: HEADERS
|
|
18033
18038
|
});
|
|
18034
18039
|
|
|
18035
18040
|
case 13:
|
|
18036
|
-
response =
|
|
18041
|
+
response = _context27.sent;
|
|
18037
18042
|
if (response.ok) {
|
|
18038
|
-
|
|
18043
|
+
_context27.next = 16;
|
|
18039
18044
|
break;
|
|
18040
18045
|
}
|
|
18041
18046
|
throw new NetworkError(SERVICES_API_KEY.Neynar, response.status);
|
|
18042
18047
|
|
|
18043
18048
|
case 16:
|
|
18044
|
-
|
|
18049
|
+
_context27.next = 18;
|
|
18045
18050
|
return response.json();
|
|
18046
18051
|
|
|
18047
18052
|
case 18:
|
|
18048
|
-
json =
|
|
18053
|
+
json = _context27.sent;
|
|
18049
18054
|
users = (json === null || json === void 0 ? void 0 : json.users) || [];
|
|
18050
18055
|
if (users.length) {
|
|
18051
|
-
|
|
18056
|
+
_context27.next = 22;
|
|
18052
18057
|
break;
|
|
18053
18058
|
}
|
|
18054
|
-
return
|
|
18059
|
+
return _context27.abrupt("return", []);
|
|
18055
18060
|
|
|
18056
18061
|
case 22:
|
|
18057
|
-
return
|
|
18062
|
+
return _context27.abrupt("return", users.map((function(_ref18) {
|
|
18058
18063
|
var _user$profile, _user$profile2;
|
|
18059
|
-
var user =
|
|
18064
|
+
var user = _ref18.user;
|
|
18060
18065
|
return {
|
|
18061
18066
|
username: user.username,
|
|
18062
18067
|
custody_address: user.custody_address,
|
|
@@ -18067,15 +18072,15 @@ function _typeof(o) {
|
|
|
18067
18072
|
})));
|
|
18068
18073
|
|
|
18069
18074
|
case 25:
|
|
18070
|
-
|
|
18071
|
-
|
|
18072
|
-
return
|
|
18075
|
+
_context27.prev = 25;
|
|
18076
|
+
_context27.t0 = _context27["catch"](0);
|
|
18077
|
+
return _context27.abrupt("return", errorMessageHandler(_context27.t0, "NEYNAR"));
|
|
18073
18078
|
|
|
18074
18079
|
case 28:
|
|
18075
18080
|
case "end":
|
|
18076
|
-
return
|
|
18081
|
+
return _context27.stop();
|
|
18077
18082
|
}
|
|
18078
|
-
}),
|
|
18083
|
+
}), _callee24, null, [ [ 0, 25 ] ]);
|
|
18079
18084
|
})));
|
|
18080
18085
|
return _NEYNAR.apply(this, arguments);
|
|
18081
18086
|
}
|
|
@@ -18092,13 +18097,13 @@ function _typeof(o) {
|
|
|
18092
18097
|
return _SAFE.apply(this, arguments);
|
|
18093
18098
|
}
|
|
18094
18099
|
function _SAFE() {
|
|
18095
|
-
_SAFE = _asyncToGenerator(_regeneratorRuntime().mark((function
|
|
18096
|
-
var _argsToArray25, _argsToArray26, address, utility, chain, _argsToArray26$, limit, _argsToArray26$2, offset, apiKey, chainId, resolved, url, _getUrlAndHeaders0, finalUrl, HEADERS, res, json,
|
|
18097
|
-
return _regeneratorRuntime().wrap((function
|
|
18098
|
-
while (1) switch (
|
|
18100
|
+
_SAFE = _asyncToGenerator(_regeneratorRuntime().mark((function _callee25() {
|
|
18101
|
+
var _argsToArray25, _argsToArray26, address, utility, chain, _argsToArray26$, limit, _argsToArray26$2, offset, apiKey, chainId, resolved, url, _getUrlAndHeaders0, finalUrl, HEADERS, res, json, _args28 = arguments;
|
|
18102
|
+
return _regeneratorRuntime().wrap((function _callee25$(_context28) {
|
|
18103
|
+
while (1) switch (_context28.prev = _context28.next) {
|
|
18099
18104
|
case 0:
|
|
18100
|
-
|
|
18101
|
-
_argsToArray25 = argsToArray(
|
|
18105
|
+
_context28.prev = 0;
|
|
18106
|
+
_argsToArray25 = argsToArray(_args28), _argsToArray26 = _slicedToArray(_argsToArray25, 5),
|
|
18102
18107
|
address = _argsToArray26[0], utility = _argsToArray26[1], chain = _argsToArray26[2],
|
|
18103
18108
|
_argsToArray26$ = _argsToArray26[3], limit = _argsToArray26$ === void 0 ? 10 : _argsToArray26$,
|
|
18104
18109
|
_argsToArray26$2 = _argsToArray26[4], offset = _argsToArray26$2 === void 0 ? 0 : _argsToArray26$2;
|
|
@@ -18112,17 +18117,17 @@ function _typeof(o) {
|
|
|
18112
18117
|
apiKey = window.localStorage.getItem(SERVICES_API_KEY.Safe);
|
|
18113
18118
|
chainId = SAFE_CHAIN_MAP[chain];
|
|
18114
18119
|
if (chainId) {
|
|
18115
|
-
|
|
18120
|
+
_context28.next = 7;
|
|
18116
18121
|
break;
|
|
18117
18122
|
}
|
|
18118
18123
|
throw new ValidationError("Invalid chain: ".concat(chain));
|
|
18119
18124
|
|
|
18120
18125
|
case 7:
|
|
18121
|
-
|
|
18126
|
+
_context28.next = 9;
|
|
18122
18127
|
return fromEnsNameToAddress$1.validateAndGetAddress(address);
|
|
18123
18128
|
|
|
18124
18129
|
case 9:
|
|
18125
|
-
resolved =
|
|
18130
|
+
resolved = _context28.sent;
|
|
18126
18131
|
url = "https://api.safe.global/tx-service/".concat(chainId, "/api/v2/safes/").concat(resolved, "/multisig-transactions?limit=").concat(limit, "&offset=").concat(offset);
|
|
18127
18132
|
_getUrlAndHeaders0 = getUrlAndHeaders({
|
|
18128
18133
|
url: url,
|
|
@@ -18131,47 +18136,47 @@ function _typeof(o) {
|
|
|
18131
18136
|
Authorization: "Bearer ".concat(apiKey)
|
|
18132
18137
|
}
|
|
18133
18138
|
}), finalUrl = _getUrlAndHeaders0.URL, HEADERS = _getUrlAndHeaders0.HEADERS;
|
|
18134
|
-
|
|
18139
|
+
_context28.next = 14;
|
|
18135
18140
|
return fetch(finalUrl, {
|
|
18136
18141
|
headers: HEADERS
|
|
18137
18142
|
});
|
|
18138
18143
|
|
|
18139
18144
|
case 14:
|
|
18140
|
-
res =
|
|
18145
|
+
res = _context28.sent;
|
|
18141
18146
|
if (res.ok) {
|
|
18142
|
-
|
|
18147
|
+
_context28.next = 17;
|
|
18143
18148
|
break;
|
|
18144
18149
|
}
|
|
18145
18150
|
throw new NetworkError(SERVICES_API_KEY.Safe, res.status);
|
|
18146
18151
|
|
|
18147
18152
|
case 17:
|
|
18148
|
-
|
|
18153
|
+
_context28.next = 19;
|
|
18149
18154
|
return res.json();
|
|
18150
18155
|
|
|
18151
18156
|
case 19:
|
|
18152
|
-
json =
|
|
18157
|
+
json = _context28.sent;
|
|
18153
18158
|
if (Array.isArray(json.results)) {
|
|
18154
|
-
|
|
18159
|
+
_context28.next = 22;
|
|
18155
18160
|
break;
|
|
18156
18161
|
}
|
|
18157
18162
|
throw new ValidationError("Invalid API response");
|
|
18158
18163
|
|
|
18159
18164
|
case 22:
|
|
18160
|
-
return
|
|
18161
|
-
var confirmations =
|
|
18165
|
+
return _context28.abrupt("return", json.results.map((function(_ref19) {
|
|
18166
|
+
var confirmations = _ref19.confirmations, dataDecoded = _ref19.dataDecoded, rest = _objectWithoutProperties(_ref19, _excluded);
|
|
18162
18167
|
return rest;
|
|
18163
18168
|
})));
|
|
18164
18169
|
|
|
18165
18170
|
case 25:
|
|
18166
|
-
|
|
18167
|
-
|
|
18168
|
-
return
|
|
18171
|
+
_context28.prev = 25;
|
|
18172
|
+
_context28.t0 = _context28["catch"](0);
|
|
18173
|
+
return _context28.abrupt("return", errorMessageHandler(_context28.t0, "SAFE"));
|
|
18169
18174
|
|
|
18170
18175
|
case 28:
|
|
18171
18176
|
case "end":
|
|
18172
|
-
return
|
|
18177
|
+
return _context28.stop();
|
|
18173
18178
|
}
|
|
18174
|
-
}),
|
|
18179
|
+
}), _callee25, null, [ [ 0, 25 ] ]);
|
|
18175
18180
|
})));
|
|
18176
18181
|
return _SAFE.apply(this, arguments);
|
|
18177
18182
|
}
|
|
@@ -18185,13 +18190,13 @@ function _typeof(o) {
|
|
|
18185
18190
|
return _UNISWAP.apply(this, arguments);
|
|
18186
18191
|
}
|
|
18187
18192
|
function _UNISWAP() {
|
|
18188
|
-
_UNISWAP = _asyncToGenerator(_regeneratorRuntime().mark((function
|
|
18189
|
-
var _argsToArray27, _argsToArray28, graphType, category, param1, param2, baseUrl, url, res, json,
|
|
18190
|
-
return _regeneratorRuntime().wrap((function
|
|
18191
|
-
while (1) switch (
|
|
18193
|
+
_UNISWAP = _asyncToGenerator(_regeneratorRuntime().mark((function _callee26() {
|
|
18194
|
+
var _argsToArray27, _argsToArray28, graphType, category, param1, param2, baseUrl, url, res, json, _args29 = arguments;
|
|
18195
|
+
return _regeneratorRuntime().wrap((function _callee26$(_context29) {
|
|
18196
|
+
while (1) switch (_context29.prev = _context29.next) {
|
|
18192
18197
|
case 0:
|
|
18193
|
-
|
|
18194
|
-
_argsToArray27 = argsToArray(
|
|
18198
|
+
_context29.prev = 0;
|
|
18199
|
+
_argsToArray27 = argsToArray(_args29), _argsToArray28 = _slicedToArray(_argsToArray27, 4),
|
|
18195
18200
|
graphType = _argsToArray28[0], category = _argsToArray28[1], param1 = _argsToArray28[2],
|
|
18196
18201
|
param2 = _argsToArray28[3];
|
|
18197
18202
|
validateParams(uniswapParamsSchema, {
|
|
@@ -18202,49 +18207,49 @@ function _typeof(o) {
|
|
|
18202
18207
|
});
|
|
18203
18208
|
baseUrl = "https://onchain-proxy.fileverse.io/third-party";
|
|
18204
18209
|
url = "".concat(baseUrl) + "?service=uniswap" + "&graphType=".concat(graphType) + "&category=".concat(category) + "&input1=".concat(encodeURIComponent(param1)) + (param2 ? "&input2=".concat(encodeURIComponent(param2)) : "");
|
|
18205
|
-
|
|
18210
|
+
_context29.next = 7;
|
|
18206
18211
|
return fetch(url);
|
|
18207
18212
|
|
|
18208
18213
|
case 7:
|
|
18209
|
-
res =
|
|
18214
|
+
res = _context29.sent;
|
|
18210
18215
|
if (res.ok) {
|
|
18211
|
-
|
|
18216
|
+
_context29.next = 10;
|
|
18212
18217
|
break;
|
|
18213
18218
|
}
|
|
18214
18219
|
throw new NetworkError("UNISWAP", res.status);
|
|
18215
18220
|
|
|
18216
18221
|
case 10:
|
|
18217
|
-
|
|
18222
|
+
_context29.next = 12;
|
|
18218
18223
|
return res.json();
|
|
18219
18224
|
|
|
18220
18225
|
case 12:
|
|
18221
|
-
json =
|
|
18226
|
+
json = _context29.sent;
|
|
18222
18227
|
if (!Array.isArray(json)) {
|
|
18223
|
-
|
|
18228
|
+
_context29.next = 15;
|
|
18224
18229
|
break;
|
|
18225
18230
|
}
|
|
18226
|
-
return
|
|
18231
|
+
return _context29.abrupt("return", json.map((function(item) {
|
|
18227
18232
|
var flat = {};
|
|
18228
|
-
Object.entries(item).forEach((function(
|
|
18229
|
-
var
|
|
18233
|
+
Object.entries(item).forEach((function(_ref20) {
|
|
18234
|
+
var _ref21 = _slicedToArray(_ref20, 2), k = _ref21[0], v = _ref21[1];
|
|
18230
18235
|
if (v === null || _typeof(v) !== "object") flat[k] = v;
|
|
18231
18236
|
}));
|
|
18232
18237
|
return flat;
|
|
18233
18238
|
})));
|
|
18234
18239
|
|
|
18235
18240
|
case 15:
|
|
18236
|
-
return
|
|
18241
|
+
return _context29.abrupt("return", json);
|
|
18237
18242
|
|
|
18238
18243
|
case 18:
|
|
18239
|
-
|
|
18240
|
-
|
|
18241
|
-
return
|
|
18244
|
+
_context29.prev = 18;
|
|
18245
|
+
_context29.t0 = _context29["catch"](0);
|
|
18246
|
+
return _context29.abrupt("return", errorMessageHandler(_context29.t0, "UNISWAP"));
|
|
18242
18247
|
|
|
18243
18248
|
case 21:
|
|
18244
18249
|
case "end":
|
|
18245
|
-
return
|
|
18250
|
+
return _context29.stop();
|
|
18246
18251
|
}
|
|
18247
|
-
}),
|
|
18252
|
+
}), _callee26, null, [ [ 0, 18 ] ]);
|
|
18248
18253
|
})));
|
|
18249
18254
|
return _UNISWAP.apply(this, arguments);
|
|
18250
18255
|
}
|
|
@@ -18252,14 +18257,14 @@ function _typeof(o) {
|
|
|
18252
18257
|
return _SMARTCONTRACT.apply(this, arguments);
|
|
18253
18258
|
}
|
|
18254
18259
|
function _SMARTCONTRACT() {
|
|
18255
|
-
_SMARTCONTRACT = _asyncToGenerator(_regeneratorRuntime().mark((function
|
|
18256
|
-
var args,
|
|
18257
|
-
return _regeneratorRuntime().wrap((function
|
|
18258
|
-
while (1) switch (
|
|
18260
|
+
_SMARTCONTRACT = _asyncToGenerator(_regeneratorRuntime().mark((function _callee27() {
|
|
18261
|
+
var args, _args30 = arguments;
|
|
18262
|
+
return _regeneratorRuntime().wrap((function _callee27$(_context30) {
|
|
18263
|
+
while (1) switch (_context30.prev = _context30.next) {
|
|
18259
18264
|
case 0:
|
|
18260
|
-
|
|
18261
|
-
args = argsToArray(
|
|
18262
|
-
return
|
|
18265
|
+
_context30.prev = 0;
|
|
18266
|
+
args = argsToArray(_args30);
|
|
18267
|
+
return _context30.abrupt("return", new Promise((function(resolve) {
|
|
18263
18268
|
resolve({
|
|
18264
18269
|
callSignature: args,
|
|
18265
18270
|
responseType: "smart-contract"
|
|
@@ -18267,15 +18272,15 @@ function _typeof(o) {
|
|
|
18267
18272
|
})));
|
|
18268
18273
|
|
|
18269
18274
|
case 5:
|
|
18270
|
-
|
|
18271
|
-
|
|
18272
|
-
return
|
|
18275
|
+
_context30.prev = 5;
|
|
18276
|
+
_context30.t0 = _context30["catch"](0);
|
|
18277
|
+
return _context30.abrupt("return", errorMessageHandler(_context30.t0, "SMARTCONTRACT"));
|
|
18273
18278
|
|
|
18274
18279
|
case 8:
|
|
18275
18280
|
case "end":
|
|
18276
|
-
return
|
|
18281
|
+
return _context30.stop();
|
|
18277
18282
|
}
|
|
18278
|
-
}),
|
|
18283
|
+
}), _callee27, null, [ [ 0, 5 ] ]);
|
|
18279
18284
|
})));
|
|
18280
18285
|
return _SMARTCONTRACT.apply(this, arguments);
|
|
18281
18286
|
}
|
|
@@ -18287,13 +18292,13 @@ function _typeof(o) {
|
|
|
18287
18292
|
return _TALLY.apply(this, arguments);
|
|
18288
18293
|
}
|
|
18289
18294
|
function _TALLY() {
|
|
18290
|
-
_TALLY = _asyncToGenerator(_regeneratorRuntime().mark((function
|
|
18291
|
-
var _argsToArray29, _argsToArray30, query, slug, baseUrl, url, res, _data5,
|
|
18292
|
-
return _regeneratorRuntime().wrap((function
|
|
18293
|
-
while (1) switch (
|
|
18295
|
+
_TALLY = _asyncToGenerator(_regeneratorRuntime().mark((function _callee28() {
|
|
18296
|
+
var _argsToArray29, _argsToArray30, query, slug, baseUrl, url, res, _data5, _args31 = arguments;
|
|
18297
|
+
return _regeneratorRuntime().wrap((function _callee28$(_context31) {
|
|
18298
|
+
while (1) switch (_context31.prev = _context31.next) {
|
|
18294
18299
|
case 0:
|
|
18295
|
-
|
|
18296
|
-
_argsToArray29 = argsToArray(
|
|
18300
|
+
_context31.prev = 0;
|
|
18301
|
+
_argsToArray29 = argsToArray(_args31), _argsToArray30 = _slicedToArray(_argsToArray29, 2),
|
|
18297
18302
|
query = _argsToArray30[0], slug = _argsToArray30[1];
|
|
18298
18303
|
validateParams(tallyParamsSchema, {
|
|
18299
18304
|
query: query,
|
|
@@ -18301,35 +18306,35 @@ function _typeof(o) {
|
|
|
18301
18306
|
});
|
|
18302
18307
|
baseUrl = "https://onchain-proxy.fileverse.io/third-party";
|
|
18303
18308
|
url = "".concat(baseUrl) + "?service=tally" + "&input1=".concat(encodeURIComponent(query)) + "&input2=".concat(encodeURIComponent(slug));
|
|
18304
|
-
|
|
18309
|
+
_context31.next = 7;
|
|
18305
18310
|
return fetch(url);
|
|
18306
18311
|
|
|
18307
18312
|
case 7:
|
|
18308
|
-
res =
|
|
18313
|
+
res = _context31.sent;
|
|
18309
18314
|
if (res.ok) {
|
|
18310
|
-
|
|
18315
|
+
_context31.next = 10;
|
|
18311
18316
|
break;
|
|
18312
18317
|
}
|
|
18313
18318
|
throw new NetworkError("TALLY", res.status);
|
|
18314
18319
|
|
|
18315
18320
|
case 10:
|
|
18316
|
-
|
|
18321
|
+
_context31.next = 12;
|
|
18317
18322
|
return res.json();
|
|
18318
18323
|
|
|
18319
18324
|
case 12:
|
|
18320
|
-
_data5 =
|
|
18321
|
-
return
|
|
18325
|
+
_data5 = _context31.sent;
|
|
18326
|
+
return _context31.abrupt("return", _data5);
|
|
18322
18327
|
|
|
18323
18328
|
case 16:
|
|
18324
|
-
|
|
18325
|
-
|
|
18326
|
-
return
|
|
18329
|
+
_context31.prev = 16;
|
|
18330
|
+
_context31.t0 = _context31["catch"](0);
|
|
18331
|
+
return _context31.abrupt("return", errorMessageHandler(_context31.t0, "TALLY"));
|
|
18327
18332
|
|
|
18328
18333
|
case 19:
|
|
18329
18334
|
case "end":
|
|
18330
|
-
return
|
|
18335
|
+
return _context31.stop();
|
|
18331
18336
|
}
|
|
18332
|
-
}),
|
|
18337
|
+
}), _callee28, null, [ [ 0, 16 ] ]);
|
|
18333
18338
|
})));
|
|
18334
18339
|
return _TALLY.apply(this, arguments);
|
|
18335
18340
|
}
|
|
@@ -18391,7 +18396,8 @@ function _typeof(o) {
|
|
|
18391
18396
|
avalanche: 43114,
|
|
18392
18397
|
fantom: 250,
|
|
18393
18398
|
scroll: 534352,
|
|
18394
|
-
linea: 59144
|
|
18399
|
+
linea: 59144,
|
|
18400
|
+
ethereum: 1
|
|
18395
18401
|
};
|
|
18396
18402
|
function formatNumber(raw, decimals) {
|
|
18397
18403
|
if (!decimals) {
|
|
@@ -18405,17 +18411,70 @@ function _typeof(o) {
|
|
|
18405
18411
|
maximumFractionDigits: 2
|
|
18406
18412
|
}).format(normalized);
|
|
18407
18413
|
}
|
|
18414
|
+
var cachedChains = null;
|
|
18415
|
+
function getChainName(_x16) {
|
|
18416
|
+
return _getChainName.apply(this, arguments);
|
|
18417
|
+
}
|
|
18418
|
+
function _getChainName() {
|
|
18419
|
+
_getChainName = _asyncToGenerator(_regeneratorRuntime().mark((function _callee29(chainId) {
|
|
18420
|
+
var res, chain;
|
|
18421
|
+
return _regeneratorRuntime().wrap((function _callee29$(_context32) {
|
|
18422
|
+
while (1) switch (_context32.prev = _context32.next) {
|
|
18423
|
+
case 0:
|
|
18424
|
+
_context32.prev = 0;
|
|
18425
|
+
if (cachedChains) {
|
|
18426
|
+
_context32.next = 10;
|
|
18427
|
+
break;
|
|
18428
|
+
}
|
|
18429
|
+
_context32.next = 4;
|
|
18430
|
+
return fetch("https://chainid.network/chains_mini.json");
|
|
18431
|
+
|
|
18432
|
+
case 4:
|
|
18433
|
+
res = _context32.sent;
|
|
18434
|
+
if (res.ok) {
|
|
18435
|
+
_context32.next = 7;
|
|
18436
|
+
break;
|
|
18437
|
+
}
|
|
18438
|
+
throw new Error("Failed to fetch chains.json");
|
|
18439
|
+
|
|
18440
|
+
case 7:
|
|
18441
|
+
_context32.next = 9;
|
|
18442
|
+
return res.json();
|
|
18443
|
+
|
|
18444
|
+
case 9:
|
|
18445
|
+
cachedChains = _context32.sent;
|
|
18446
|
+
|
|
18447
|
+
case 10:
|
|
18448
|
+
chain = cachedChains.find((function(c) {
|
|
18449
|
+
return c.chainId === chainId;
|
|
18450
|
+
}));
|
|
18451
|
+
return _context32.abrupt("return", chain ? chain.name : chainId);
|
|
18452
|
+
|
|
18453
|
+
case 14:
|
|
18454
|
+
_context32.prev = 14;
|
|
18455
|
+
_context32.t0 = _context32["catch"](0);
|
|
18456
|
+
console.log(_context32.t0);
|
|
18457
|
+
return _context32.abrupt("return", chainId);
|
|
18458
|
+
|
|
18459
|
+
case 18:
|
|
18460
|
+
case "end":
|
|
18461
|
+
return _context32.stop();
|
|
18462
|
+
}
|
|
18463
|
+
}), _callee29, null, [ [ 0, 14 ] ]);
|
|
18464
|
+
})));
|
|
18465
|
+
return _getChainName.apply(this, arguments);
|
|
18466
|
+
}
|
|
18408
18467
|
function DUNESIM() {
|
|
18409
18468
|
return _DUNESIM.apply(this, arguments);
|
|
18410
18469
|
}
|
|
18411
18470
|
function _DUNESIM() {
|
|
18412
18471
|
_DUNESIM = _asyncToGenerator(_regeneratorRuntime().mark((function _callee30() {
|
|
18413
|
-
var
|
|
18414
|
-
return _regeneratorRuntime().wrap((function _callee30$(
|
|
18415
|
-
while (1) switch (
|
|
18472
|
+
var _ref26, _json$activity, _ref27, _json$holders, _ref28, _json$tokens, _argsToArray31, _argsToArray32, type, input1, input2, input3, input4, route, buildQuery, address, qs, chain, _qs, tokenAddress, _qs2, _chain, apiKey, url, _getUrlAndHeaders1, finalUrl, HEADERS, res, json, _data6, result, _final, globalDecimals, _iterator43, _step43, _loop4, _args34 = arguments;
|
|
18473
|
+
return _regeneratorRuntime().wrap((function _callee30$(_context34) {
|
|
18474
|
+
while (1) switch (_context34.prev = _context34.next) {
|
|
18416
18475
|
case 0:
|
|
18417
|
-
|
|
18418
|
-
_argsToArray31 = argsToArray(
|
|
18476
|
+
_context34.prev = 0;
|
|
18477
|
+
_argsToArray31 = argsToArray(_args34), _argsToArray32 = _slicedToArray(_argsToArray31, 5),
|
|
18419
18478
|
type = _argsToArray32[0], input1 = _argsToArray32[1], input2 = _argsToArray32[2],
|
|
18420
18479
|
input3 = _argsToArray32[3], input4 = _argsToArray32[4];
|
|
18421
18480
|
validateParams(duneSimParamsSchema, {
|
|
@@ -18427,24 +18486,24 @@ function _typeof(o) {
|
|
|
18427
18486
|
});
|
|
18428
18487
|
route = "";
|
|
18429
18488
|
buildQuery = function buildQuery(pairs) {
|
|
18430
|
-
var parts = pairs.filter((function(
|
|
18431
|
-
var
|
|
18489
|
+
var parts = pairs.filter((function(_ref22) {
|
|
18490
|
+
var _ref23 = _slicedToArray(_ref22, 2), _ = _ref23[0], v = _ref23[1];
|
|
18432
18491
|
return v !== undefined && v !== "";
|
|
18433
|
-
})).map((function(
|
|
18434
|
-
var
|
|
18492
|
+
})).map((function(_ref24) {
|
|
18493
|
+
var _ref25 = _slicedToArray(_ref24, 2), k = _ref25[0], v = _ref25[1];
|
|
18435
18494
|
return "".concat(k, "=").concat(encodeURIComponent(v));
|
|
18436
18495
|
}));
|
|
18437
18496
|
return parts.length ? "?".concat(parts.join("&")) : "";
|
|
18438
18497
|
};
|
|
18439
18498
|
if (!(type === "activity")) {
|
|
18440
|
-
|
|
18499
|
+
_context34.next = 11;
|
|
18441
18500
|
break;
|
|
18442
18501
|
}
|
|
18443
|
-
|
|
18502
|
+
_context34.next = 8;
|
|
18444
18503
|
return fromEnsNameToAddress$1.validateAndGetAddress(input1);
|
|
18445
18504
|
|
|
18446
18505
|
case 8:
|
|
18447
|
-
address =
|
|
18506
|
+
address = _context34.sent;
|
|
18448
18507
|
qs = buildQuery([ [ "chain_ids", SUPPORTED_TOKEN_NAMES[input2] || input2 ], [ "limit", input3 ] ]);
|
|
18449
18508
|
route = "activity/".concat(address).concat(qs);
|
|
18450
18509
|
|
|
@@ -18469,85 +18528,184 @@ function _typeof(o) {
|
|
|
18469
18528
|
"X-Sim-Api-Key": apiKey
|
|
18470
18529
|
}
|
|
18471
18530
|
}), finalUrl = _getUrlAndHeaders1.URL, HEADERS = _getUrlAndHeaders1.HEADERS;
|
|
18472
|
-
|
|
18531
|
+
_context34.next = 18;
|
|
18473
18532
|
return fetch(finalUrl, {
|
|
18474
18533
|
method: "GET",
|
|
18475
18534
|
headers: HEADERS
|
|
18476
18535
|
});
|
|
18477
18536
|
|
|
18478
18537
|
case 18:
|
|
18479
|
-
res =
|
|
18538
|
+
res = _context34.sent;
|
|
18480
18539
|
if (res.ok) {
|
|
18481
|
-
|
|
18540
|
+
_context34.next = 21;
|
|
18482
18541
|
break;
|
|
18483
18542
|
}
|
|
18484
18543
|
throw new NetworkError(SERVICES_API_KEY.DuneSim, res.status);
|
|
18485
18544
|
|
|
18486
18545
|
case 21:
|
|
18487
|
-
|
|
18546
|
+
_context34.next = 23;
|
|
18488
18547
|
return res.json();
|
|
18489
18548
|
|
|
18490
18549
|
case 23:
|
|
18491
|
-
json =
|
|
18492
|
-
_data6 = type === "activity" ? (
|
|
18493
|
-
result =
|
|
18494
|
-
|
|
18495
|
-
|
|
18496
|
-
|
|
18550
|
+
json = _context34.sent;
|
|
18551
|
+
_data6 = type === "activity" ? (_ref26 = (_json$activity = json === null || json === void 0 ? void 0 : json.activity) !== null && _json$activity !== void 0 ? _json$activity : json) !== null && _ref26 !== void 0 ? _ref26 : [] : type === "token-holders" ? (_ref27 = (_json$holders = json === null || json === void 0 ? void 0 : json.holders) !== null && _json$holders !== void 0 ? _json$holders : json) !== null && _ref27 !== void 0 ? _ref27 : [] : type === "price" ? (_ref28 = (_json$tokens = json === null || json === void 0 ? void 0 : json.tokens) !== null && _json$tokens !== void 0 ? _json$tokens : json) !== null && _ref28 !== void 0 ? _ref28 : [] : json !== null && json !== void 0 ? json : [];
|
|
18552
|
+
result = Array.isArray(_data6) ? _data6 : [ _data6 ];
|
|
18553
|
+
_final = [];
|
|
18554
|
+
_iterator43 = _createForOfIteratorHelper(result);
|
|
18555
|
+
_context34.prev = 28;
|
|
18556
|
+
_loop4 = _regeneratorRuntime().mark((function _loop4() {
|
|
18557
|
+
var item, prices, _resData$tokens$, _chain2, _url, _getUrlAndHeaders10, _finalUrl, _HEADERS, _res, resData, decimals;
|
|
18558
|
+
return _regeneratorRuntime().wrap((function _loop4$(_context33) {
|
|
18559
|
+
while (1) switch (_context33.prev = _context33.next) {
|
|
18560
|
+
case 0:
|
|
18561
|
+
item = _step43.value;
|
|
18562
|
+
if (item !== null && item !== void 0 && item.decimals) {
|
|
18563
|
+
if (item !== null && item !== void 0 && item.total_supply) {
|
|
18564
|
+
item.total_supply = formatNumber(item === null || item === void 0 ? void 0 : item.total_supply, item.decimals);
|
|
18565
|
+
}
|
|
18566
|
+
}
|
|
18567
|
+
if (item !== null && item !== void 0 && item.first_acquired) {
|
|
18568
|
+
item.first_acquired = new Intl.DateTimeFormat("en-US", {
|
|
18569
|
+
year: "numeric",
|
|
18570
|
+
month: "long",
|
|
18571
|
+
day: "numeric",
|
|
18572
|
+
hour: "numeric",
|
|
18573
|
+
minute: "2-digit"
|
|
18574
|
+
}).format(new Date(item.first_acquired));
|
|
18575
|
+
}
|
|
18576
|
+
if (item.historical_prices) {
|
|
18577
|
+
prices = item.historical_prices;
|
|
18578
|
+
prices.forEach((function(priceData) {
|
|
18579
|
+
var key = "price_" + priceData.offset_hours + "h";
|
|
18580
|
+
var price = priceData.price_usd;
|
|
18581
|
+
item[key] = price;
|
|
18582
|
+
}));
|
|
18583
|
+
}
|
|
18584
|
+
if (type === "price") {
|
|
18585
|
+
delete item["chain_id"];
|
|
18586
|
+
delete item["decimals"];
|
|
18587
|
+
delete item["logo"];
|
|
18588
|
+
}
|
|
18589
|
+
if (!(type === "activity")) {
|
|
18590
|
+
_context33.next = 9;
|
|
18591
|
+
break;
|
|
18592
|
+
}
|
|
18593
|
+
_context33.next = 8;
|
|
18594
|
+
return getChainName(item.chain_id);
|
|
18595
|
+
|
|
18596
|
+
case 8:
|
|
18597
|
+
item.chain_id = _context33.sent;
|
|
18598
|
+
|
|
18599
|
+
case 9:
|
|
18600
|
+
if (!(type === "token-holders")) {
|
|
18601
|
+
_context33.next = 30;
|
|
18602
|
+
break;
|
|
18603
|
+
}
|
|
18604
|
+
if (!item.balance) {
|
|
18605
|
+
_context33.next = 30;
|
|
18606
|
+
break;
|
|
18607
|
+
}
|
|
18608
|
+
if (globalDecimals) {
|
|
18609
|
+
_context33.next = 29;
|
|
18610
|
+
break;
|
|
18611
|
+
}
|
|
18612
|
+
_context33.prev = 12;
|
|
18613
|
+
_chain2 = SUPPORTED_TOKEN_NAMES[input2] || input2;
|
|
18614
|
+
_url = "https://api.sim.dune.com/v1/evm/token-info/".concat(input1, "?chain_ids=").concat(_chain2);
|
|
18615
|
+
_getUrlAndHeaders10 = getUrlAndHeaders({
|
|
18616
|
+
url: _url,
|
|
18617
|
+
serviceName: "DuneSim",
|
|
18618
|
+
headers: {
|
|
18619
|
+
"X-Sim-Api-Key": apiKey
|
|
18620
|
+
}
|
|
18621
|
+
}), _finalUrl = _getUrlAndHeaders10.URL, _HEADERS = _getUrlAndHeaders10.HEADERS;
|
|
18622
|
+
_context33.next = 18;
|
|
18623
|
+
return fetch(_finalUrl, {
|
|
18624
|
+
method: "GET",
|
|
18625
|
+
headers: _HEADERS
|
|
18626
|
+
});
|
|
18627
|
+
|
|
18628
|
+
case 18:
|
|
18629
|
+
_res = _context33.sent;
|
|
18630
|
+
_context33.next = 21;
|
|
18631
|
+
return _res.json();
|
|
18632
|
+
|
|
18633
|
+
case 21:
|
|
18634
|
+
resData = _context33.sent;
|
|
18635
|
+
decimals = (_resData$tokens$ = resData.tokens[0]) === null || _resData$tokens$ === void 0 ? void 0 : _resData$tokens$.decimals;
|
|
18636
|
+
globalDecimals = decimals;
|
|
18637
|
+
_context33.next = 29;
|
|
18638
|
+
break;
|
|
18639
|
+
|
|
18640
|
+
case 26:
|
|
18641
|
+
_context33.prev = 26;
|
|
18642
|
+
_context33.t0 = _context33["catch"](12);
|
|
18643
|
+
console.log(_context33.t0);
|
|
18644
|
+
|
|
18645
|
+
case 29:
|
|
18646
|
+
item.balance = formatNumber(item.balance, globalDecimals);
|
|
18647
|
+
|
|
18648
|
+
case 30:
|
|
18649
|
+
_final.push(flattenObject(item));
|
|
18650
|
+
|
|
18651
|
+
case 31:
|
|
18652
|
+
case "end":
|
|
18653
|
+
return _context33.stop();
|
|
18497
18654
|
}
|
|
18498
|
-
}
|
|
18499
|
-
if (item !== null && item !== void 0 && item.first_acquired) {
|
|
18500
|
-
item.first_acquired = new Intl.DateTimeFormat("en-US", {
|
|
18501
|
-
year: "numeric",
|
|
18502
|
-
month: "long",
|
|
18503
|
-
day: "numeric",
|
|
18504
|
-
hour: "numeric",
|
|
18505
|
-
minute: "2-digit"
|
|
18506
|
-
}).format(new Date(item.first_acquired));
|
|
18507
|
-
}
|
|
18508
|
-
if (item.historical_prices) {
|
|
18509
|
-
var prices = item.historical_prices;
|
|
18510
|
-
prices.forEach((function(priceData) {
|
|
18511
|
-
var key = "price_" + priceData.offset_hours + "h";
|
|
18512
|
-
var price = priceData.price_usd;
|
|
18513
|
-
item[key] = price;
|
|
18514
|
-
}));
|
|
18515
|
-
}
|
|
18516
|
-
return flattenObject(item);
|
|
18655
|
+
}), _loop4, null, [ [ 12, 26 ] ]);
|
|
18517
18656
|
}));
|
|
18518
|
-
|
|
18657
|
+
_iterator43.s();
|
|
18519
18658
|
|
|
18520
|
-
case
|
|
18521
|
-
|
|
18522
|
-
|
|
18523
|
-
|
|
18659
|
+
case 31:
|
|
18660
|
+
if ((_step43 = _iterator43.n()).done) {
|
|
18661
|
+
_context34.next = 35;
|
|
18662
|
+
break;
|
|
18663
|
+
}
|
|
18664
|
+
return _context34.delegateYield(_loop4(), "t0", 33);
|
|
18524
18665
|
|
|
18525
|
-
case
|
|
18666
|
+
case 33:
|
|
18667
|
+
_context34.next = 31;
|
|
18668
|
+
break;
|
|
18669
|
+
|
|
18670
|
+
case 35:
|
|
18671
|
+
_context34.next = 40;
|
|
18672
|
+
break;
|
|
18673
|
+
|
|
18674
|
+
case 37:
|
|
18675
|
+
_context34.prev = 37;
|
|
18676
|
+
_context34.t1 = _context34["catch"](28);
|
|
18677
|
+
_iterator43.e(_context34.t1);
|
|
18678
|
+
|
|
18679
|
+
case 40:
|
|
18680
|
+
_context34.prev = 40;
|
|
18681
|
+
_iterator43.f();
|
|
18682
|
+
return _context34.finish(40);
|
|
18683
|
+
|
|
18684
|
+
case 43:
|
|
18685
|
+
return _context34.abrupt("return", _final);
|
|
18686
|
+
|
|
18687
|
+
case 46:
|
|
18688
|
+
_context34.prev = 46;
|
|
18689
|
+
_context34.t2 = _context34["catch"](0);
|
|
18690
|
+
return _context34.abrupt("return", errorMessageHandler(_context34.t2, "DUNESIM"));
|
|
18691
|
+
|
|
18692
|
+
case 49:
|
|
18526
18693
|
case "end":
|
|
18527
|
-
return
|
|
18694
|
+
return _context34.stop();
|
|
18528
18695
|
}
|
|
18529
|
-
}), _callee30, null, [ [ 0,
|
|
18696
|
+
}), _callee30, null, [ [ 0, 46 ], [ 28, 37, 40, 43 ] ]);
|
|
18530
18697
|
})));
|
|
18531
18698
|
return _DUNESIM.apply(this, arguments);
|
|
18532
18699
|
}
|
|
18533
|
-
_asyncToGenerator(_regeneratorRuntime().mark((function _callee10() {
|
|
18534
|
-
return _regeneratorRuntime().wrap((function _callee10$(_context10) {
|
|
18535
|
-
while (1) switch (_context10.prev = _context10.next) {
|
|
18536
|
-
case 0:
|
|
18537
|
-
case "end":
|
|
18538
|
-
return _context10.stop();
|
|
18539
|
-
}
|
|
18540
|
-
}), _callee10);
|
|
18541
|
-
})))();
|
|
18542
18700
|
function FLVURL() {
|
|
18543
18701
|
return _FLVURL.apply(this, arguments);
|
|
18544
18702
|
}
|
|
18545
18703
|
function _FLVURL() {
|
|
18546
18704
|
_FLVURL = _asyncToGenerator(_regeneratorRuntime().mark((function _callee31() {
|
|
18547
|
-
return _regeneratorRuntime().wrap((function _callee31$(
|
|
18548
|
-
while (1) switch (
|
|
18705
|
+
return _regeneratorRuntime().wrap((function _callee31$(_context35) {
|
|
18706
|
+
while (1) switch (_context35.prev = _context35.next) {
|
|
18549
18707
|
case 0:
|
|
18550
|
-
return
|
|
18708
|
+
return _context35.abrupt("return", new Promise((function(resolve) {
|
|
18551
18709
|
setTimeout((function() {
|
|
18552
18710
|
resolve([ {
|
|
18553
18711
|
Yoo: "gotcha"
|
|
@@ -18557,7 +18715,7 @@ function _typeof(o) {
|
|
|
18557
18715
|
|
|
18558
18716
|
case 1:
|
|
18559
18717
|
case "end":
|
|
18560
|
-
return
|
|
18718
|
+
return _context35.stop();
|
|
18561
18719
|
}
|
|
18562
18720
|
}), _callee31);
|
|
18563
18721
|
})));
|