@fileverse-dev/formulajs 4.4.11-mod-83 → 4.4.11-mod-83-patch-2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- /* @fileverse-dev/formulajs v4.4.11-mod-83 */
1
+ /* @fileverse-dev/formulajs v4.4.11-mod-83-patch-2 */
2
2
  var _excluded = [ "confirmations", "dataDecoded" ];
3
3
 
4
4
  function _objectWithoutProperties(e, t) {
@@ -21,52 +21,6 @@ function _objectWithoutPropertiesLoose(r, e) {
21
21
  return t;
22
22
  }
23
23
 
24
- function _createForOfIteratorHelper(r, e) {
25
- var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
26
- if (!t) {
27
- if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) {
28
- t && (r = t);
29
- var _n = 0, F = function F() {};
30
- return {
31
- s: F,
32
- n: function n() {
33
- return _n >= r.length ? {
34
- done: !0
35
- } : {
36
- done: !1,
37
- value: r[_n++]
38
- };
39
- },
40
- e: function e(r) {
41
- throw r;
42
- },
43
- f: F
44
- };
45
- }
46
- throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
47
- }
48
- var o, a = !0, u = !1;
49
- return {
50
- s: function s() {
51
- t = t.call(r);
52
- },
53
- n: function n() {
54
- var r = t.next();
55
- return a = r.done, r;
56
- },
57
- e: function e(r) {
58
- u = !0, o = r;
59
- },
60
- f: function f() {
61
- try {
62
- a || null == t["return"] || t["return"]();
63
- } finally {
64
- if (u) throw o;
65
- }
66
- }
67
- };
68
- }
69
-
70
24
  function _regeneratorRuntime() {
71
25
  "use strict";
72
26
  /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() {
@@ -389,6 +343,52 @@ function _defineProperty(e, r, t) {
389
343
  }) : e[r] = t, e;
390
344
  }
391
345
 
346
+ function _createForOfIteratorHelper(r, e) {
347
+ var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
348
+ if (!t) {
349
+ if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) {
350
+ t && (r = t);
351
+ var _n = 0, F = function F() {};
352
+ return {
353
+ s: F,
354
+ n: function n() {
355
+ return _n >= r.length ? {
356
+ done: !0
357
+ } : {
358
+ done: !1,
359
+ value: r[_n++]
360
+ };
361
+ },
362
+ e: function e(r) {
363
+ throw r;
364
+ },
365
+ f: F
366
+ };
367
+ }
368
+ throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
369
+ }
370
+ var o, a = !0, u = !1;
371
+ return {
372
+ s: function s() {
373
+ t = t.call(r);
374
+ },
375
+ n: function n() {
376
+ var r = t.next();
377
+ return a = r.done, r;
378
+ },
379
+ e: function e(r) {
380
+ u = !0, o = r;
381
+ },
382
+ f: function f() {
383
+ try {
384
+ a || null == t["return"] || t["return"]();
385
+ } finally {
386
+ if (u) throw o;
387
+ }
388
+ }
389
+ };
390
+ }
391
+
392
392
  function _defineProperties(e, r) {
393
393
  for (var t = 0; t < r.length; t++) {
394
394
  var o = r[t];
@@ -11126,484 +11126,55 @@ function _typeof(o) {
11126
11126
  _inherits(InvalidApiKeyError, _Error6);
11127
11127
  return _createClass(InvalidApiKeyError);
11128
11128
  }(_wrapNativeSuper(Error));
11129
- var PROXY_MAP;
11130
- function initializeProxyMap() {
11131
- if (!PROXY_MAP) {
11132
- var fileverseProxyUrl = "".concat(window.NEXT_PUBLIC_PROXY_BASE_URL, "/proxy");
11133
- PROXY_MAP = {
11134
- Etherscan: {
11135
- url: fileverseProxyUrl,
11136
- removeParams: [ "apikey" ]
11137
- },
11138
- Basescan: {
11139
- url: fileverseProxyUrl,
11140
- removeParams: [ "apikey" ]
11141
- },
11142
- Gnosisscan: {
11143
- url: fileverseProxyUrl,
11144
- removeParams: [ "apikey" ]
11145
- },
11146
- Coingecko: {
11147
- url: fileverseProxyUrl,
11148
- removeParams: [ "apikey" ]
11149
- },
11150
- Firefly: {
11151
- url: fileverseProxyUrl,
11152
- removeParams: [ "apikey" ]
11153
- },
11154
- Neynar: {
11155
- url: fileverseProxyUrl,
11156
- removeParams: [ "api_key" ]
11157
- },
11158
- Safe: {
11159
- url: fileverseProxyUrl,
11160
- removeParams: [ "api_key" ]
11161
- },
11162
- Defillama: {
11163
- url: fileverseProxyUrl,
11164
- removeParams: [ "api_key" ]
11165
- },
11166
- GnosisPay: {
11167
- url: fileverseProxyUrl,
11168
- removeParams: [ "api_key" ]
11169
- }
11170
- };
11171
- }
11172
- return PROXY_MAP;
11173
- }
11174
- function removeUrlParams(url, paramsToRemove) {
11175
- if (!paramsToRemove || paramsToRemove.length === 0) {
11176
- return url;
11177
- }
11178
- var urlObj = new URL(url);
11179
- paramsToRemove.forEach((function(param) {
11180
- if (urlObj.searchParams.has(param)) {
11181
- urlObj.searchParams["delete"](param);
11129
+ var errorMessageHandler = function errorMessageHandler(err, functionName) {
11130
+ switch (true) {
11131
+ case err instanceof ValidationError:
11132
+ {
11133
+ return {
11134
+ message: err.message,
11135
+ functionName: functionName,
11136
+ type: ERROR_MESSAGES_FLAG.INVALID_PARAM
11137
+ };
11182
11138
  }
11183
- }));
11184
- return urlObj.toString();
11185
- }
11186
- function getUrlAndHeaders(_ref) {
11187
- var url = _ref.url, serviceName = _ref.serviceName, _ref$headers = _ref.headers, headers = _ref$headers === void 0 ? {} : _ref$headers;
11188
- var proxyMap = initializeProxyMap();
11189
- var apiKeyLS = window.localStorage.getItem(SERVICES_API_KEY[serviceName]);
11190
- var isProxyModeEnabledValue = apiKeyLS === "DEFAULT_PROXY_MODE";
11191
- var proxyConfig = proxyMap[serviceName];
11192
- if (!proxyConfig && SERVICES_API_KEY[serviceName] && (!apiKeyLS || apiKeyLS === "")) {
11193
- throw new MissingApiKeyError(SERVICES_API_KEY[serviceName]);
11194
- }
11195
- if ((isProxyModeEnabledValue || !apiKeyLS || apiKeyLS === "") && proxyConfig) {
11196
- var cleanedUrl = removeUrlParams(url, proxyConfig.removeParams);
11139
+
11140
+ case err instanceof MissingApiKeyError:
11197
11141
  return {
11198
- URL: proxyConfig.url,
11199
- HEADERS: {
11200
- "target-url": cleanedUrl,
11201
- method: "GET",
11202
- "Content-Type": "application/json"
11203
- }
11142
+ message: err.message,
11143
+ functionName: functionName,
11144
+ type: ERROR_MESSAGES_FLAG.MISSING_KEY
11204
11145
  };
11205
- }
11206
- return {
11207
- URL: url,
11208
- HEADERS: _objectSpread({}, headers)
11209
- };
11210
- }
11211
- var fromTimeStampToBlock = function() {
11212
- var _ref2 = _asyncToGenerator(_regeneratorRuntime().mark((function _callee(timestamp, chain, apiKey) {
11213
- var chainId, url, _getUrlAndHeaders, finalUrl, HEADERS, res, json;
11214
- return _regeneratorRuntime().wrap((function _callee$(_context) {
11215
- while (1) switch (_context.prev = _context.next) {
11216
- case 0:
11217
- if (!(!timestamp || !chain)) {
11218
- _context.next = 2;
11219
- break;
11220
- }
11221
- return _context.abrupt("return");
11222
11146
 
11223
- case 2:
11224
- chainId = CHAIN_ID_MAP[chain];
11225
- url = "https://api.etherscan.io/v2/api?module=block&action=getblocknobytime&timestamp=".concat(timestamp, "&closest=before&apikey=").concat(apiKey, "&chainId=").concat(chainId);
11226
- _getUrlAndHeaders = getUrlAndHeaders({
11227
- url: url,
11228
- serviceName: "Etherscan",
11229
- headers: {}
11230
- }), finalUrl = _getUrlAndHeaders.URL, HEADERS = _getUrlAndHeaders.HEADERS;
11231
- _context.next = 7;
11232
- return fetch(finalUrl, {
11233
- method: "GET",
11234
- headers: HEADERS
11235
- });
11147
+ case err instanceof RateLimitError:
11148
+ return {
11149
+ message: err.message,
11150
+ functionName: functionName,
11151
+ type: ERROR_MESSAGES_FLAG.RATE_LIMIT,
11152
+ apiKeyName: err.api
11153
+ };
11236
11154
 
11237
- case 7:
11238
- res = _context.sent;
11239
- _context.next = 10;
11240
- return res.json();
11155
+ case err instanceof NetworkError:
11156
+ if (err.status === 429) {
11157
+ return {
11158
+ message: err.message,
11159
+ functionName: functionName,
11160
+ type: ERROR_MESSAGES_FLAG.RATE_LIMIT,
11161
+ apiKeyName: err.api
11162
+ };
11163
+ } else {
11164
+ return {
11165
+ message: err.message,
11166
+ functionName: functionName,
11167
+ type: ERROR_MESSAGES_FLAG.NETWORK_ERROR,
11168
+ apiKeyName: err.api
11169
+ };
11170
+ }
11241
11171
 
11242
- case 10:
11243
- json = _context.sent;
11244
- return _context.abrupt("return", parseInt(json.result));
11245
-
11246
- case 12:
11247
- case "end":
11248
- return _context.stop();
11249
- }
11250
- }), _callee);
11251
- })));
11252
- return function fromTimeStampToBlock(_x2, _x3, _x4) {
11253
- return _ref2.apply(this, arguments);
11254
- };
11255
- }();
11256
- var fromTimestampToBlock = {
11257
- fromTimeStampToBlock: fromTimeStampToBlock
11258
- };
11259
- function toTimestamp(dateStr) {
11260
- var _dateStr$split$map = dateStr.split("/").map(Number), _dateStr$split$map2 = _slicedToArray(_dateStr$split$map, 3), day = _dateStr$split$map2[0], month = _dateStr$split$map2[1], year = _dateStr$split$map2[2];
11261
- var date = new Date(year, month - 1, day);
11262
- return Math.floor(date.getTime() / 1e3);
11263
- }
11264
- var isAddress = function isAddress(input) {
11265
- return /^0x[a-fA-F0-9]{40}$/.test(input);
11266
- };
11267
- var isAddress$1 = {
11268
- isAddress: isAddress
11269
- };
11270
- function fromEnsNameToAddress(_x5) {
11271
- return _fromEnsNameToAddress.apply(this, arguments);
11272
- }
11273
- function _fromEnsNameToAddress() {
11274
- _fromEnsNameToAddress = _asyncToGenerator(_regeneratorRuntime().mark((function _callee10(name) {
11275
- var ALCHEMY_KEY, provider, resolved;
11276
- return _regeneratorRuntime().wrap((function _callee10$(_context10) {
11277
- while (1) switch (_context10.prev = _context10.next) {
11278
- case 0:
11279
- if (!(typeof ethers === "undefined")) {
11280
- _context10.next = 3;
11281
- break;
11282
- }
11283
- _context10.next = 3;
11284
- return new Promise((function(resolve, reject) {
11285
- var script = document.createElement("script");
11286
- script.src = "https://cdn.jsdelivr.net/npm/ethers@6.10.0/dist/ethers.umd.min.js";
11287
- script.onload = resolve;
11288
- script.onerror = reject;
11289
- document.head.appendChild(script);
11290
- }));
11291
-
11292
- case 3:
11293
- ALCHEMY_KEY = window.localStorage.getItem(UTILITY.ALCHEMY_API_KEY);
11294
- if (ALCHEMY_KEY) {
11295
- _context10.next = 7;
11296
- break;
11297
- }
11298
- console.error("alchemy api key missing");
11299
- return _context10.abrupt("return", null);
11300
-
11301
- case 7:
11302
- provider = new ethers.AlchemyProvider("mainnet", ALCHEMY_KEY);
11303
- _context10.prev = 8;
11304
- _context10.next = 11;
11305
- return provider.resolveName(name);
11306
-
11307
- case 11:
11308
- resolved = _context10.sent;
11309
- return _context10.abrupt("return", resolved || null);
11310
-
11311
- case 15:
11312
- _context10.prev = 15;
11313
- _context10.t0 = _context10["catch"](8);
11314
- console.error("ENS resolution failed:", _context10.t0.message);
11315
- return _context10.abrupt("return", null);
11316
-
11317
- case 19:
11318
- case "end":
11319
- return _context10.stop();
11320
- }
11321
- }), _callee10, null, [ [ 8, 15 ] ]);
11322
- })));
11323
- return _fromEnsNameToAddress.apply(this, arguments);
11324
- }
11325
- var validateAndGetAddress = function() {
11326
- var _ref3 = _asyncToGenerator(_regeneratorRuntime().mark((function _callee2(address) {
11327
- var resolvedAddress;
11328
- return _regeneratorRuntime().wrap((function _callee2$(_context2) {
11329
- while (1) switch (_context2.prev = _context2.next) {
11330
- case 0:
11331
- if (!isAddress$1.isAddress(address)) {
11332
- _context2.next = 2;
11333
- break;
11334
- }
11335
- return _context2.abrupt("return", address);
11336
-
11337
- case 2:
11338
- _context2.next = 4;
11339
- return fromEnsNameToAddress(address);
11340
-
11341
- case 4:
11342
- resolvedAddress = _context2.sent;
11343
- if (!resolvedAddress) {
11344
- _context2.next = 7;
11345
- break;
11346
- }
11347
- return _context2.abrupt("return", resolvedAddress);
11348
-
11349
- case 7:
11350
- throw new ValidationError("Invalid address");
11351
-
11352
- case 8:
11353
- case "end":
11354
- return _context2.stop();
11355
- }
11356
- }), _callee2);
11357
- })));
11358
- return function validateAndGetAddress(_x6) {
11359
- return _ref3.apply(this, arguments);
11360
- };
11361
- }();
11362
- var fromEnsNameToAddress$1 = {
11363
- validateAndGetAddress: validateAndGetAddress
11364
- };
11365
- function handleScanRequest(_x7) {
11366
- return _handleScanRequest.apply(this, arguments);
11367
- }
11368
- function _handleScanRequest() {
11369
- _handleScanRequest = _asyncToGenerator(_regeneratorRuntime().mark((function _callee11(_ref4) {
11370
- var type, address, startDate, endDate, _ref4$page, page, _ref4$offset, offset, apiKey, functionName, chainId, network, API_INFO_MAP, apiInfo, baseUrl, ACTION_MAP, action, module, url, _yield$Promise$all, _yield$Promise$all2, startBlock, endBlock, _getUrlAndHeaders3, finalUrl, HEADERS, res, json;
11371
- return _regeneratorRuntime().wrap((function _callee11$(_context11) {
11372
- while (1) switch (_context11.prev = _context11.next) {
11373
- case 0:
11374
- type = _ref4.type, address = _ref4.address, startDate = _ref4.startDate, endDate = _ref4.endDate,
11375
- _ref4$page = _ref4.page, page = _ref4$page === void 0 ? 1 : _ref4$page, _ref4$offset = _ref4.offset,
11376
- offset = _ref4$offset === void 0 ? 10 : _ref4$offset, apiKey = _ref4.apiKey, functionName = _ref4.functionName,
11377
- chainId = _ref4.chainId, network = _ref4.network;
11378
- API_INFO_MAP = {
11379
- BASE: {
11380
- url: "https://api.basescan.org/api",
11381
- apiKeyName: SERVICES_API_KEY.Basescan
11382
- },
11383
- ETHERSCAN: {
11384
- url: "https://api.etherscan.io/v2/api",
11385
- apiKeyName: SERVICES_API_KEY.Etherscan
11386
- },
11387
- GNOSIS: {
11388
- url: "https://api.gnosisscan.io/api",
11389
- apiKeyName: SERVICES_API_KEY.Gnosisscan
11390
- }
11391
- };
11392
- if (!(type !== "gas")) {
11393
- _context11.next = 6;
11394
- break;
11395
- }
11396
- _context11.next = 5;
11397
- return fromEnsNameToAddress$1.validateAndGetAddress(address);
11398
-
11399
- case 5:
11400
- address = _context11.sent;
11401
-
11402
- case 6:
11403
- apiInfo = API_INFO_MAP[functionName];
11404
- baseUrl = apiInfo === null || apiInfo === void 0 ? void 0 : apiInfo.url;
11405
- if (baseUrl) {
11406
- _context11.next = 10;
11407
- break;
11408
- }
11409
- throw new ValidationError("Api not found for: ".concat(functionName));
11410
-
11411
- case 10:
11412
- ACTION_MAP = {
11413
- "all-txns": "txlist",
11414
- "token-txns": "tokentx",
11415
- "nft-txns": "tokennfttx",
11416
- gas: "gasoracle"
11417
- };
11418
- action = ACTION_MAP[type];
11419
- if (action) {
11420
- _context11.next = 14;
11421
- break;
11422
- }
11423
- throw new ValidationError("Invalid type: ".concat(type));
11424
-
11425
- case 14:
11426
- module = action === "gasoracle" ? "gastracker" : "account";
11427
- url = "".concat(baseUrl, "?chainid=").concat(chainId, "&module=").concat(module, "&action=").concat(action, "&apikey=").concat(apiKey);
11428
- if (![ "all-txns", "token-txns", "nft-txns" ].includes(type)) {
11429
- _context11.next = 27;
11430
- break;
11431
- }
11432
- url += "&address=".concat(address, "&startblock=0&endblock=99999999&sort=asc");
11433
- if (!(!isNaN(startDate) && !isNaN(endDate))) {
11434
- _context11.next = 26;
11435
- break;
11436
- }
11437
- _context11.next = 21;
11438
- return Promise.all([ fromTimestampToBlock.fromTimeStampToBlock(toTimestamp(startDate), network, apiKey), fromTimestampToBlock.fromTimeStampToBlock(toTimestamp(endDate), network, apiKey) ]);
11439
-
11440
- case 21:
11441
- _yield$Promise$all = _context11.sent;
11442
- _yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 2);
11443
- startBlock = _yield$Promise$all2[0];
11444
- endBlock = _yield$Promise$all2[1];
11445
- url += "&startblock=".concat(startBlock || "0", "&endblock=").concat(endBlock || "99999999");
11446
-
11447
- case 26:
11448
- url += "&page=".concat(page, "&offset=").concat(offset);
11449
-
11450
- case 27:
11451
- _getUrlAndHeaders3 = getUrlAndHeaders({
11452
- url: url,
11453
- serviceName: apiInfo.apiKeyName,
11454
- headers: {}
11455
- }), finalUrl = _getUrlAndHeaders3.URL, HEADERS = _getUrlAndHeaders3.HEADERS;
11456
- _context11.next = 30;
11457
- return fetch(finalUrl, {
11458
- method: "GET",
11459
- headers: HEADERS
11460
- });
11461
-
11462
- case 30:
11463
- res = _context11.sent;
11464
- if (res.ok) {
11465
- _context11.next = 33;
11466
- break;
11467
- }
11468
- throw new NetworkError(apiInfo.apiKeyName, res.status);
11469
-
11470
- case 33:
11471
- _context11.next = 35;
11472
- return res.json();
11473
-
11474
- case 35:
11475
- json = _context11.sent;
11476
- if (!(typeof json.result === "string")) {
11477
- _context11.next = 41;
11478
- break;
11479
- }
11480
- if (!json.result.includes("Invalid API Key")) {
11481
- _context11.next = 39;
11482
- break;
11483
- }
11484
- throw new InvalidApiKeyError(apiInfo.apiKeyName);
11485
-
11486
- case 39:
11487
- if (!json.result.includes("Max rate limit reached")) {
11488
- _context11.next = 41;
11489
- break;
11490
- }
11491
- throw new RateLimitError(apiInfo.apiKeyName);
11492
-
11493
- case 41:
11494
- return _context11.abrupt("return", type === "gas" && !Array.isArray(json.result) ? [ json.result ] : json.result);
11495
-
11496
- case 42:
11497
- case "end":
11498
- return _context11.stop();
11499
- }
11500
- }), _callee11);
11501
- })));
11502
- return _handleScanRequest.apply(this, arguments);
11503
- }
11504
- var fromUsernameToFid = function() {
11505
- var _ref5 = _asyncToGenerator(_regeneratorRuntime().mark((function _callee3(username, apiKey) {
11506
- var url, _getUrlAndHeaders2, finalUrl, HEADERS, res, json, users, user;
11507
- return _regeneratorRuntime().wrap((function _callee3$(_context3) {
11508
- while (1) switch (_context3.prev = _context3.next) {
11509
- case 0:
11510
- if (username) {
11511
- _context3.next = 2;
11512
- break;
11513
- }
11514
- return _context3.abrupt("return", null);
11515
-
11516
- case 2:
11517
- url = "https://api.neynar.com/v2/farcaster/user/search/?q=".concat(username, "&limit=5");
11518
- _getUrlAndHeaders2 = getUrlAndHeaders({
11519
- url: url,
11520
- serviceName: "Neynar",
11521
- headers: {
11522
- "x-api-key": apiKey,
11523
- "x-neynar-experimental": "false"
11524
- }
11525
- }), finalUrl = _getUrlAndHeaders2.URL, HEADERS = _getUrlAndHeaders2.HEADERS;
11526
- _context3.next = 6;
11527
- return fetch(finalUrl, {
11528
- method: "GET",
11529
- headers: HEADERS
11530
- });
11531
-
11532
- case 6:
11533
- res = _context3.sent;
11534
- _context3.next = 9;
11535
- return res.json();
11536
-
11537
- case 9:
11538
- json = _context3.sent;
11539
- users = json.result ? json.result.users : [];
11540
- user = users.find((function(user) {
11541
- return user.username === username;
11542
- }));
11543
- return _context3.abrupt("return", user && user.fid || null);
11544
-
11545
- case 13:
11546
- case "end":
11547
- return _context3.stop();
11548
- }
11549
- }), _callee3);
11550
- })));
11551
- return function fromUsernameToFid(_x8, _x9) {
11552
- return _ref5.apply(this, arguments);
11553
- };
11554
- }();
11555
- var fromUsernameToFid$1 = {
11556
- fromUsernameToFid: fromUsernameToFid
11557
- };
11558
- var errorMessageHandler = function errorMessageHandler(err, functionName) {
11559
- switch (true) {
11560
- case err instanceof ValidationError:
11561
- {
11562
- return {
11563
- message: err.message,
11564
- functionName: functionName,
11565
- type: ERROR_MESSAGES_FLAG.INVALID_PARAM
11566
- };
11567
- }
11568
-
11569
- case err instanceof MissingApiKeyError:
11570
- return {
11571
- message: err.message,
11572
- functionName: functionName,
11573
- type: ERROR_MESSAGES_FLAG.MISSING_KEY
11574
- };
11575
-
11576
- case err instanceof RateLimitError:
11577
- return {
11578
- message: err.message,
11579
- functionName: functionName,
11580
- type: ERROR_MESSAGES_FLAG.RATE_LIMIT,
11581
- apiKeyName: err.api
11582
- };
11583
-
11584
- case err instanceof NetworkError:
11585
- if (err.status === 429) {
11586
- return {
11587
- message: err.message,
11588
- functionName: functionName,
11589
- type: ERROR_MESSAGES_FLAG.RATE_LIMIT,
11590
- apiKeyName: err.api
11591
- };
11592
- } else {
11593
- return {
11594
- message: err.message,
11595
- functionName: functionName,
11596
- type: ERROR_MESSAGES_FLAG.NETWORK_ERROR,
11597
- apiKeyName: err.api
11598
- };
11599
- }
11600
-
11601
- case err instanceof EnsError:
11602
- return {
11603
- message: err.message,
11604
- functionName: functionName,
11605
- type: ERROR_MESSAGES_FLAG.ENS
11606
- };
11172
+ case err instanceof EnsError:
11173
+ return {
11174
+ message: err.message,
11175
+ functionName: functionName,
11176
+ type: ERROR_MESSAGES_FLAG.ENS
11177
+ };
11607
11178
 
11608
11179
  case err instanceof InvalidApiKeyError:
11609
11180
  return {
@@ -12109,65 +11680,65 @@ function _typeof(o) {
12109
11680
  }, {
12110
11681
  key: "mergeObjectAsync",
12111
11682
  value: function() {
12112
- var _mergeObjectAsync = _asyncToGenerator(_regeneratorRuntime().mark((function _callee4(status, pairs) {
11683
+ var _mergeObjectAsync = _asyncToGenerator(_regeneratorRuntime().mark((function _callee(status, pairs) {
12113
11684
  var syncPairs, _iterator8, _step8, pair, key, _value5;
12114
- return _regeneratorRuntime().wrap((function _callee4$(_context4) {
12115
- while (1) switch (_context4.prev = _context4.next) {
11685
+ return _regeneratorRuntime().wrap((function _callee$(_context) {
11686
+ while (1) switch (_context.prev = _context.next) {
12116
11687
  case 0:
12117
11688
  syncPairs = [];
12118
11689
  _iterator8 = _createForOfIteratorHelper(pairs);
12119
- _context4.prev = 2;
11690
+ _context.prev = 2;
12120
11691
  _iterator8.s();
12121
11692
 
12122
11693
  case 4:
12123
11694
  if ((_step8 = _iterator8.n()).done) {
12124
- _context4.next = 15;
11695
+ _context.next = 15;
12125
11696
  break;
12126
11697
  }
12127
11698
  pair = _step8.value;
12128
- _context4.next = 8;
11699
+ _context.next = 8;
12129
11700
  return pair.key;
12130
11701
 
12131
11702
  case 8:
12132
- key = _context4.sent;
12133
- _context4.next = 11;
11703
+ key = _context.sent;
11704
+ _context.next = 11;
12134
11705
  return pair.value;
12135
11706
 
12136
11707
  case 11:
12137
- _value5 = _context4.sent;
11708
+ _value5 = _context.sent;
12138
11709
  syncPairs.push({
12139
11710
  key: key,
12140
11711
  value: _value5
12141
11712
  });
12142
11713
 
12143
11714
  case 13:
12144
- _context4.next = 4;
11715
+ _context.next = 4;
12145
11716
  break;
12146
11717
 
12147
11718
  case 15:
12148
- _context4.next = 20;
11719
+ _context.next = 20;
12149
11720
  break;
12150
11721
 
12151
11722
  case 17:
12152
- _context4.prev = 17;
12153
- _context4.t0 = _context4["catch"](2);
12154
- _iterator8.e(_context4.t0);
11723
+ _context.prev = 17;
11724
+ _context.t0 = _context["catch"](2);
11725
+ _iterator8.e(_context.t0);
12155
11726
 
12156
11727
  case 20:
12157
- _context4.prev = 20;
11728
+ _context.prev = 20;
12158
11729
  _iterator8.f();
12159
- return _context4.finish(20);
11730
+ return _context.finish(20);
12160
11731
 
12161
11732
  case 23:
12162
- return _context4.abrupt("return", ParseStatus.mergeObjectSync(status, syncPairs));
11733
+ return _context.abrupt("return", ParseStatus.mergeObjectSync(status, syncPairs));
12163
11734
 
12164
11735
  case 24:
12165
11736
  case "end":
12166
- return _context4.stop();
11737
+ return _context.stop();
12167
11738
  }
12168
- }), _callee4, null, [ [ 2, 17, 20, 23 ] ]);
11739
+ }), _callee, null, [ [ 2, 17, 20, 23 ] ]);
12169
11740
  })));
12170
- function mergeObjectAsync(_x0, _x1) {
11741
+ function mergeObjectAsync(_x2, _x3) {
12171
11742
  return _mergeObjectAsync.apply(this, arguments);
12172
11743
  }
12173
11744
  return mergeObjectAsync;
@@ -12296,7 +11867,7 @@ function _typeof(o) {
12296
11867
  description: description
12297
11868
  };
12298
11869
  var customMap = function customMap(iss, ctx) {
12299
- var _ref7;
11870
+ var _ref2;
12300
11871
  var message = params.message;
12301
11872
  if (iss.code === "invalid_enum_value") {
12302
11873
  return {
@@ -12304,16 +11875,16 @@ function _typeof(o) {
12304
11875
  };
12305
11876
  }
12306
11877
  if (typeof ctx.data === "undefined") {
12307
- var _ref6;
11878
+ var _ref;
12308
11879
  return {
12309
- message: (_ref6 = message !== null && message !== void 0 ? message : required_error) !== null && _ref6 !== void 0 ? _ref6 : ctx.defaultError
11880
+ message: (_ref = message !== null && message !== void 0 ? message : required_error) !== null && _ref !== void 0 ? _ref : ctx.defaultError
12310
11881
  };
12311
11882
  }
12312
11883
  if (iss.code !== "invalid_type") return {
12313
11884
  message: ctx.defaultError
12314
11885
  };
12315
11886
  return {
12316
- message: (_ref7 = message !== null && message !== void 0 ? message : invalid_type_error) !== null && _ref7 !== void 0 ? _ref7 : ctx.defaultError
11887
+ message: (_ref2 = message !== null && message !== void 0 ? message : invalid_type_error) !== null && _ref2 !== void 0 ? _ref2 : ctx.defaultError
12317
11888
  };
12318
11889
  };
12319
11890
  return {
@@ -12493,32 +12064,32 @@ function _typeof(o) {
12493
12064
  }, {
12494
12065
  key: "parseAsync",
12495
12066
  value: function() {
12496
- var _parseAsync2 = _asyncToGenerator(_regeneratorRuntime().mark((function _callee5(data, params) {
12067
+ var _parseAsync2 = _asyncToGenerator(_regeneratorRuntime().mark((function _callee2(data, params) {
12497
12068
  var result;
12498
- return _regeneratorRuntime().wrap((function _callee5$(_context5) {
12499
- while (1) switch (_context5.prev = _context5.next) {
12069
+ return _regeneratorRuntime().wrap((function _callee2$(_context2) {
12070
+ while (1) switch (_context2.prev = _context2.next) {
12500
12071
  case 0:
12501
- _context5.next = 2;
12072
+ _context2.next = 2;
12502
12073
  return this.safeParseAsync(data, params);
12503
12074
 
12504
12075
  case 2:
12505
- result = _context5.sent;
12076
+ result = _context2.sent;
12506
12077
  if (!result.success) {
12507
- _context5.next = 5;
12078
+ _context2.next = 5;
12508
12079
  break;
12509
12080
  }
12510
- return _context5.abrupt("return", result.data);
12081
+ return _context2.abrupt("return", result.data);
12511
12082
 
12512
12083
  case 5:
12513
12084
  throw result.error;
12514
12085
 
12515
12086
  case 6:
12516
12087
  case "end":
12517
- return _context5.stop();
12088
+ return _context2.stop();
12518
12089
  }
12519
- }), _callee5, this);
12090
+ }), _callee2, this);
12520
12091
  })));
12521
- function parseAsync(_x10, _x11) {
12092
+ function parseAsync(_x4, _x5) {
12522
12093
  return _parseAsync2.apply(this, arguments);
12523
12094
  }
12524
12095
  return parseAsync;
@@ -12526,10 +12097,10 @@ function _typeof(o) {
12526
12097
  }, {
12527
12098
  key: "safeParseAsync",
12528
12099
  value: function() {
12529
- var _safeParseAsync = _asyncToGenerator(_regeneratorRuntime().mark((function _callee6(data, params) {
12100
+ var _safeParseAsync = _asyncToGenerator(_regeneratorRuntime().mark((function _callee3(data, params) {
12530
12101
  var ctx, maybeAsyncResult, result;
12531
- return _regeneratorRuntime().wrap((function _callee6$(_context6) {
12532
- while (1) switch (_context6.prev = _context6.next) {
12102
+ return _regeneratorRuntime().wrap((function _callee3$(_context3) {
12103
+ while (1) switch (_context3.prev = _context3.next) {
12533
12104
  case 0:
12534
12105
  ctx = {
12535
12106
  common: {
@@ -12548,20 +12119,20 @@ function _typeof(o) {
12548
12119
  path: ctx.path,
12549
12120
  parent: ctx
12550
12121
  });
12551
- _context6.next = 4;
12122
+ _context3.next = 4;
12552
12123
  return isAsync(maybeAsyncResult) ? maybeAsyncResult : Promise.resolve(maybeAsyncResult);
12553
12124
 
12554
12125
  case 4:
12555
- result = _context6.sent;
12556
- return _context6.abrupt("return", handleResult(ctx, result));
12126
+ result = _context3.sent;
12127
+ return _context3.abrupt("return", handleResult(ctx, result));
12557
12128
 
12558
12129
  case 6:
12559
12130
  case "end":
12560
- return _context6.stop();
12131
+ return _context3.stop();
12561
12132
  }
12562
- }), _callee6, this);
12133
+ }), _callee3, this);
12563
12134
  })));
12564
- function safeParseAsync(_x12, _x13) {
12135
+ function safeParseAsync(_x6, _x7) {
12565
12136
  return _safeParseAsync.apply(this, arguments);
12566
12137
  }
12567
12138
  return safeParseAsync;
@@ -14720,32 +14291,32 @@ function _typeof(o) {
14720
14291
  }
14721
14292
  }
14722
14293
  if (ctx.common.async) {
14723
- return Promise.resolve().then(_asyncToGenerator(_regeneratorRuntime().mark((function _callee7() {
14294
+ return Promise.resolve().then(_asyncToGenerator(_regeneratorRuntime().mark((function _callee4() {
14724
14295
  var syncPairs, _iterator24, _step24, pair, _key4, _value8;
14725
- return _regeneratorRuntime().wrap((function _callee7$(_context7) {
14726
- while (1) switch (_context7.prev = _context7.next) {
14296
+ return _regeneratorRuntime().wrap((function _callee4$(_context4) {
14297
+ while (1) switch (_context4.prev = _context4.next) {
14727
14298
  case 0:
14728
14299
  syncPairs = [];
14729
14300
  _iterator24 = _createForOfIteratorHelper(pairs);
14730
- _context7.prev = 2;
14301
+ _context4.prev = 2;
14731
14302
  _iterator24.s();
14732
14303
 
14733
14304
  case 4:
14734
14305
  if ((_step24 = _iterator24.n()).done) {
14735
- _context7.next = 15;
14306
+ _context4.next = 15;
14736
14307
  break;
14737
14308
  }
14738
14309
  pair = _step24.value;
14739
- _context7.next = 8;
14310
+ _context4.next = 8;
14740
14311
  return pair.key;
14741
14312
 
14742
14313
  case 8:
14743
- _key4 = _context7.sent;
14744
- _context7.next = 11;
14314
+ _key4 = _context4.sent;
14315
+ _context4.next = 11;
14745
14316
  return pair.value;
14746
14317
 
14747
14318
  case 11:
14748
- _value8 = _context7.sent;
14319
+ _value8 = _context4.sent;
14749
14320
  syncPairs.push({
14750
14321
  key: _key4,
14751
14322
  value: _value8,
@@ -14753,31 +14324,31 @@ function _typeof(o) {
14753
14324
  });
14754
14325
 
14755
14326
  case 13:
14756
- _context7.next = 4;
14327
+ _context4.next = 4;
14757
14328
  break;
14758
14329
 
14759
14330
  case 15:
14760
- _context7.next = 20;
14331
+ _context4.next = 20;
14761
14332
  break;
14762
14333
 
14763
14334
  case 17:
14764
- _context7.prev = 17;
14765
- _context7.t0 = _context7["catch"](2);
14766
- _iterator24.e(_context7.t0);
14335
+ _context4.prev = 17;
14336
+ _context4.t0 = _context4["catch"](2);
14337
+ _iterator24.e(_context4.t0);
14767
14338
 
14768
14339
  case 20:
14769
- _context7.prev = 20;
14340
+ _context4.prev = 20;
14770
14341
  _iterator24.f();
14771
- return _context7.finish(20);
14342
+ return _context4.finish(20);
14772
14343
 
14773
14344
  case 23:
14774
- return _context7.abrupt("return", syncPairs);
14345
+ return _context4.abrupt("return", syncPairs);
14775
14346
 
14776
14347
  case 24:
14777
14348
  case "end":
14778
- return _context7.stop();
14349
+ return _context4.stop();
14779
14350
  }
14780
- }), _callee7, null, [ [ 2, 17, 20, 23 ] ]);
14351
+ }), _callee4, null, [ [ 2, 17, 20, 23 ] ]);
14781
14352
  })))).then((function(syncPairs) {
14782
14353
  return ParseStatus.mergeObjectSync(status, syncPairs);
14783
14354
  }));
@@ -15053,10 +14624,10 @@ function _typeof(o) {
15053
14624
  }
15054
14625
  if (ctx.common.async) {
15055
14626
  return Promise.all(options.map(function() {
15056
- var _ref9 = _asyncToGenerator(_regeneratorRuntime().mark((function _callee8(option) {
14627
+ var _ref4 = _asyncToGenerator(_regeneratorRuntime().mark((function _callee5(option) {
15057
14628
  var childCtx;
15058
- return _regeneratorRuntime().wrap((function _callee8$(_context8) {
15059
- while (1) switch (_context8.prev = _context8.next) {
14629
+ return _regeneratorRuntime().wrap((function _callee5$(_context5) {
14630
+ while (1) switch (_context5.prev = _context5.next) {
15060
14631
  case 0:
15061
14632
  childCtx = _objectSpread(_objectSpread({}, ctx), {}, {
15062
14633
  common: _objectSpread(_objectSpread({}, ctx.common), {}, {
@@ -15064,7 +14635,7 @@ function _typeof(o) {
15064
14635
  }),
15065
14636
  parent: null
15066
14637
  });
15067
- _context8.next = 3;
14638
+ _context5.next = 3;
15068
14639
  return option._parseAsync({
15069
14640
  data: ctx.data,
15070
14641
  path: ctx.path,
@@ -15072,21 +14643,21 @@ function _typeof(o) {
15072
14643
  });
15073
14644
 
15074
14645
  case 3:
15075
- _context8.t0 = _context8.sent;
15076
- _context8.t1 = childCtx;
15077
- return _context8.abrupt("return", {
15078
- result: _context8.t0,
15079
- ctx: _context8.t1
14646
+ _context5.t0 = _context5.sent;
14647
+ _context5.t1 = childCtx;
14648
+ return _context5.abrupt("return", {
14649
+ result: _context5.t0,
14650
+ ctx: _context5.t1
15080
14651
  });
15081
14652
 
15082
14653
  case 6:
15083
14654
  case "end":
15084
- return _context8.stop();
14655
+ return _context5.stop();
15085
14656
  }
15086
- }), _callee8);
14657
+ }), _callee5);
15087
14658
  })));
15088
- return function(_x14) {
15089
- return _ref9.apply(this, arguments);
14659
+ return function(_x8) {
14660
+ return _ref4.apply(this, arguments);
15090
14661
  };
15091
14662
  }())).then(handleResults);
15092
14663
  } else {
@@ -15388,8 +14959,8 @@ function _typeof(o) {
15388
14959
  data: ctx.data,
15389
14960
  path: ctx.path,
15390
14961
  parent: ctx
15391
- }) ]).then((function(_ref0) {
15392
- var _ref1 = _slicedToArray(_ref0, 2), left = _ref1[0], right = _ref1[1];
14962
+ }) ]).then((function(_ref5) {
14963
+ var _ref6 = _slicedToArray(_ref5, 2), left = _ref6[0], right = _ref6[1];
15393
14964
  return handleParsed(left, right);
15394
14965
  }));
15395
14966
  } else {
@@ -15522,8 +15093,8 @@ function _typeof(o) {
15522
15093
  }
15523
15094
  var keyType = this._def.keyType;
15524
15095
  var valueType = this._def.valueType;
15525
- var pairs = _toConsumableArray(ctx.data.entries()).map((function(_ref10, index) {
15526
- var _ref11 = _slicedToArray(_ref10, 2), key = _ref11[0], value = _ref11[1];
15096
+ var pairs = _toConsumableArray(ctx.data.entries()).map((function(_ref7, index) {
15097
+ var _ref8 = _slicedToArray(_ref7, 2), key = _ref8[0], value = _ref8[1];
15527
15098
  return {
15528
15099
  key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, [ index, "key" ])),
15529
15100
  value: valueType._parse(new ParseInputLazyPath(ctx, value, ctx.path, [ index, "value" ]))
@@ -15531,36 +15102,36 @@ function _typeof(o) {
15531
15102
  }));
15532
15103
  if (ctx.common.async) {
15533
15104
  var finalMap = new Map;
15534
- return Promise.resolve().then(_asyncToGenerator(_regeneratorRuntime().mark((function _callee9() {
15105
+ return Promise.resolve().then(_asyncToGenerator(_regeneratorRuntime().mark((function _callee6() {
15535
15106
  var _iterator35, _step35, pair, key, _value1;
15536
- return _regeneratorRuntime().wrap((function _callee9$(_context9) {
15537
- while (1) switch (_context9.prev = _context9.next) {
15107
+ return _regeneratorRuntime().wrap((function _callee6$(_context6) {
15108
+ while (1) switch (_context6.prev = _context6.next) {
15538
15109
  case 0:
15539
15110
  _iterator35 = _createForOfIteratorHelper(pairs);
15540
- _context9.prev = 1;
15111
+ _context6.prev = 1;
15541
15112
  _iterator35.s();
15542
15113
 
15543
15114
  case 3:
15544
15115
  if ((_step35 = _iterator35.n()).done) {
15545
- _context9.next = 17;
15116
+ _context6.next = 17;
15546
15117
  break;
15547
15118
  }
15548
15119
  pair = _step35.value;
15549
- _context9.next = 7;
15120
+ _context6.next = 7;
15550
15121
  return pair.key;
15551
15122
 
15552
15123
  case 7:
15553
- key = _context9.sent;
15554
- _context9.next = 10;
15124
+ key = _context6.sent;
15125
+ _context6.next = 10;
15555
15126
  return pair.value;
15556
15127
 
15557
15128
  case 10:
15558
- _value1 = _context9.sent;
15129
+ _value1 = _context6.sent;
15559
15130
  if (!(key.status === "aborted" || _value1.status === "aborted")) {
15560
- _context9.next = 13;
15131
+ _context6.next = 13;
15561
15132
  break;
15562
15133
  }
15563
- return _context9.abrupt("return", INVALID);
15134
+ return _context6.abrupt("return", INVALID);
15564
15135
 
15565
15136
  case 13:
15566
15137
  if (key.status === "dirty" || _value1.status === "dirty") {
@@ -15569,34 +15140,34 @@ function _typeof(o) {
15569
15140
  finalMap.set(key.value, _value1.value);
15570
15141
 
15571
15142
  case 15:
15572
- _context9.next = 3;
15143
+ _context6.next = 3;
15573
15144
  break;
15574
15145
 
15575
15146
  case 17:
15576
- _context9.next = 22;
15147
+ _context6.next = 22;
15577
15148
  break;
15578
15149
 
15579
15150
  case 19:
15580
- _context9.prev = 19;
15581
- _context9.t0 = _context9["catch"](1);
15582
- _iterator35.e(_context9.t0);
15151
+ _context6.prev = 19;
15152
+ _context6.t0 = _context6["catch"](1);
15153
+ _iterator35.e(_context6.t0);
15583
15154
 
15584
15155
  case 22:
15585
- _context9.prev = 22;
15156
+ _context6.prev = 22;
15586
15157
  _iterator35.f();
15587
- return _context9.finish(22);
15158
+ return _context6.finish(22);
15588
15159
 
15589
15160
  case 25:
15590
- return _context9.abrupt("return", {
15161
+ return _context6.abrupt("return", {
15591
15162
  status: status.value,
15592
15163
  value: finalMap
15593
15164
  });
15594
15165
 
15595
15166
  case 26:
15596
15167
  case "end":
15597
- return _context9.stop();
15168
+ return _context6.stop();
15598
15169
  }
15599
- }), _callee9, null, [ [ 1, 19, 22, 25 ] ]);
15170
+ }), _callee6, null, [ [ 1, 19, 22, 25 ] ]);
15600
15171
  }))));
15601
15172
  } else {
15602
15173
  var _finalMap = new Map;
@@ -16057,19 +15628,19 @@ function _typeof(o) {
16057
15628
  var processed = effect.transform(ctx.data, checkCtx);
16058
15629
  if (ctx.common.async) {
16059
15630
  return Promise.resolve(processed).then(function() {
16060
- var _ref13 = _asyncToGenerator(_regeneratorRuntime().mark((function _callee0(processed) {
15631
+ var _ref0 = _asyncToGenerator(_regeneratorRuntime().mark((function _callee7(processed) {
16061
15632
  var result;
16062
- return _regeneratorRuntime().wrap((function _callee0$(_context0) {
16063
- while (1) switch (_context0.prev = _context0.next) {
15633
+ return _regeneratorRuntime().wrap((function _callee7$(_context7) {
15634
+ while (1) switch (_context7.prev = _context7.next) {
16064
15635
  case 0:
16065
15636
  if (!(status.value === "aborted")) {
16066
- _context0.next = 2;
15637
+ _context7.next = 2;
16067
15638
  break;
16068
15639
  }
16069
- return _context0.abrupt("return", INVALID);
15640
+ return _context7.abrupt("return", INVALID);
16070
15641
 
16071
15642
  case 2:
16072
- _context0.next = 4;
15643
+ _context7.next = 4;
16073
15644
  return _this14._def.schema._parseAsync({
16074
15645
  data: processed,
16075
15646
  path: ctx.path,
@@ -16077,38 +15648,38 @@ function _typeof(o) {
16077
15648
  });
16078
15649
 
16079
15650
  case 4:
16080
- result = _context0.sent;
15651
+ result = _context7.sent;
16081
15652
  if (!(result.status === "aborted")) {
16082
- _context0.next = 7;
15653
+ _context7.next = 7;
16083
15654
  break;
16084
15655
  }
16085
- return _context0.abrupt("return", INVALID);
15656
+ return _context7.abrupt("return", INVALID);
16086
15657
 
16087
15658
  case 7:
16088
15659
  if (!(result.status === "dirty")) {
16089
- _context0.next = 9;
15660
+ _context7.next = 9;
16090
15661
  break;
16091
15662
  }
16092
- return _context0.abrupt("return", DIRTY(result.value));
15663
+ return _context7.abrupt("return", DIRTY(result.value));
16093
15664
 
16094
15665
  case 9:
16095
15666
  if (!(status.value === "dirty")) {
16096
- _context0.next = 11;
15667
+ _context7.next = 11;
16097
15668
  break;
16098
15669
  }
16099
- return _context0.abrupt("return", DIRTY(result.value));
15670
+ return _context7.abrupt("return", DIRTY(result.value));
16100
15671
 
16101
15672
  case 11:
16102
- return _context0.abrupt("return", result);
15673
+ return _context7.abrupt("return", result);
16103
15674
 
16104
15675
  case 12:
16105
15676
  case "end":
16106
- return _context0.stop();
15677
+ return _context7.stop();
16107
15678
  }
16108
- }), _callee0);
15679
+ }), _callee7);
16109
15680
  })));
16110
- return function(_x15) {
16111
- return _ref13.apply(this, arguments);
15681
+ return function(_x9) {
15682
+ return _ref0.apply(this, arguments);
16112
15683
  };
16113
15684
  }());
16114
15685
  } else {
@@ -16439,12 +16010,12 @@ function _typeof(o) {
16439
16010
  var _this$_processInputPa13 = this._processInputParams(input), status = _this$_processInputPa13.status, ctx = _this$_processInputPa13.ctx;
16440
16011
  if (ctx.common.async) {
16441
16012
  var handleAsync = function() {
16442
- var _ref14 = _asyncToGenerator(_regeneratorRuntime().mark((function _callee1() {
16013
+ var _ref1 = _asyncToGenerator(_regeneratorRuntime().mark((function _callee8() {
16443
16014
  var inResult;
16444
- return _regeneratorRuntime().wrap((function _callee1$(_context1) {
16445
- while (1) switch (_context1.prev = _context1.next) {
16015
+ return _regeneratorRuntime().wrap((function _callee8$(_context8) {
16016
+ while (1) switch (_context8.prev = _context8.next) {
16446
16017
  case 0:
16447
- _context1.next = 2;
16018
+ _context8.next = 2;
16448
16019
  return _this16._def["in"]._parseAsync({
16449
16020
  data: ctx.data,
16450
16021
  path: ctx.path,
@@ -16452,23 +16023,23 @@ function _typeof(o) {
16452
16023
  });
16453
16024
 
16454
16025
  case 2:
16455
- inResult = _context1.sent;
16026
+ inResult = _context8.sent;
16456
16027
  if (!(inResult.status === "aborted")) {
16457
- _context1.next = 5;
16028
+ _context8.next = 5;
16458
16029
  break;
16459
16030
  }
16460
- return _context1.abrupt("return", INVALID);
16031
+ return _context8.abrupt("return", INVALID);
16461
16032
 
16462
16033
  case 5:
16463
16034
  if (!(inResult.status === "dirty")) {
16464
- _context1.next = 10;
16035
+ _context8.next = 10;
16465
16036
  break;
16466
16037
  }
16467
16038
  status.dirty();
16468
- return _context1.abrupt("return", DIRTY(inResult.value));
16039
+ return _context8.abrupt("return", DIRTY(inResult.value));
16469
16040
 
16470
16041
  case 10:
16471
- return _context1.abrupt("return", _this16._def.out._parseAsync({
16042
+ return _context8.abrupt("return", _this16._def.out._parseAsync({
16472
16043
  data: inResult.value,
16473
16044
  path: ctx.path,
16474
16045
  parent: ctx
@@ -16476,12 +16047,12 @@ function _typeof(o) {
16476
16047
 
16477
16048
  case 11:
16478
16049
  case "end":
16479
- return _context1.stop();
16050
+ return _context8.stop();
16480
16051
  }
16481
- }), _callee1);
16052
+ }), _callee8);
16482
16053
  })));
16483
16054
  return function handleAsync() {
16484
- return _ref14.apply(this, arguments);
16055
+ return _ref1.apply(this, arguments);
16485
16056
  };
16486
16057
  }();
16487
16058
  return handleAsync();
@@ -16606,52 +16177,79 @@ function _typeof(o) {
16606
16177
  ZodOptional.create;
16607
16178
  ZodNullable.create;
16608
16179
  var preprocessType = ZodEffects.createWithPreprocess;
16609
- var farcasterSchema = objectType({
16610
- platform: literalType("farcaster"),
16611
- contentType: enumType([ "posts", "replies", "channels" ]),
16612
- identifier: stringType().nonempty(),
16613
- start: numberType()["int"]().nonnegative()["default"](0),
16614
- end: numberType()["int"]().nonnegative().max(MAX_PAGE_LIMIT, {
16615
- message: '"end" must be less than or equal to '.concat(MAX_PAGE_LIMIT)
16616
- })["default"](10)
16617
- });
16618
- var lensSchema = objectType({
16619
- platform: literalType("lens"),
16620
- contentType: enumType([ "posts", "replies" ]),
16621
- identifier: stringType().nonempty(),
16622
- start: numberType()["int"]().nonnegative()["default"](0),
16623
- end: numberType()["int"]().nonnegative().max(MAX_PAGE_LIMIT, {
16624
- message: '"end" must be less than or equal to '.concat(MAX_PAGE_LIMIT)
16625
- })["default"](10)
16626
- });
16627
- var fireflyParamsSchema = discriminatedUnionType("platform", [ farcasterSchema, lensSchema ]);
16628
- var fireFlyPlaformType = {
16629
- farcaster: {
16630
- posts: "farcasterid",
16631
- replies: "farcasterpostid",
16632
- channels: "farcasterchannels"
16633
- },
16634
- lens: {
16635
- posts: "lensid",
16636
- replies: "lenspostid"
16637
- }
16638
- };
16639
- var lensParamsSchema = objectType({
16640
- contentType: enumType([ "posts", "replies" ]),
16641
- identifier: stringType().nonempty(),
16642
- start: numberType()["int"]().nonnegative()["default"](0),
16643
- end: numberType()["int"]().nonnegative().max(MAX_PAGE_LIMIT, {
16644
- message: '"end" must be less than or equal to '.concat(MAX_PAGE_LIMIT)
16645
- })["default"](10)
16646
- });
16647
- var farcasterParamsSchema = objectType({
16648
- contentType: enumType([ "posts", "replies", "channels" ]),
16649
- identifier: stringType().nonempty(),
16650
- start: numberType()["int"]().nonnegative()["default"](0),
16651
- end: numberType()["int"]().nonnegative().max(MAX_PAGE_LIMIT, {
16652
- message: '"end" must be less than or equal to '.concat(MAX_PAGE_LIMIT)
16653
- })["default"](10)
16180
+ var aaveParamsSchema = objectType({
16181
+ graphType: enumType([ "v2", "v2-raw" ]),
16182
+ category: enumType([ "tokens", "markets" ]),
16183
+ param1: stringType().nonempty(),
16184
+ param2: stringType().optional()
16654
16185
  });
16186
+ function AAVE() {
16187
+ return _AAVE.apply(this, arguments);
16188
+ }
16189
+ function _AAVE() {
16190
+ _AAVE = _asyncToGenerator(_regeneratorRuntime().mark((function _callee10() {
16191
+ var _argsToArray3, _argsToArray4, graphType, category, param1, param2, baseUrl, url, res, json, _args10 = arguments;
16192
+ return _regeneratorRuntime().wrap((function _callee10$(_context10) {
16193
+ while (1) switch (_context10.prev = _context10.next) {
16194
+ case 0:
16195
+ _context10.prev = 0;
16196
+ _argsToArray3 = argsToArray(_args10), _argsToArray4 = _slicedToArray(_argsToArray3, 4),
16197
+ graphType = _argsToArray4[0], category = _argsToArray4[1], param1 = _argsToArray4[2],
16198
+ param2 = _argsToArray4[3];
16199
+ validateParams(aaveParamsSchema, {
16200
+ graphType: graphType,
16201
+ category: category,
16202
+ param1: param1,
16203
+ param2: param2
16204
+ });
16205
+ baseUrl = "https://onchain-proxy.fileverse.io/third-party";
16206
+ url = "".concat(baseUrl) + "?service=aave" + "&graphType=".concat(encodeURIComponent(graphType)) + "&category=".concat(encodeURIComponent(category)) + "&input1=".concat(encodeURIComponent(param1)) + (param2 ? "&input2=".concat(encodeURIComponent(param2)) : "");
16207
+ _context10.next = 7;
16208
+ return fetch(url);
16209
+
16210
+ case 7:
16211
+ res = _context10.sent;
16212
+ if (res.ok) {
16213
+ _context10.next = 10;
16214
+ break;
16215
+ }
16216
+ throw new NetworkError("AAVE", res.status);
16217
+
16218
+ case 10:
16219
+ _context10.next = 12;
16220
+ return res.json();
16221
+
16222
+ case 12:
16223
+ json = _context10.sent;
16224
+ if (!Array.isArray(json)) {
16225
+ _context10.next = 15;
16226
+ break;
16227
+ }
16228
+ return _context10.abrupt("return", json.map((function(item) {
16229
+ var flat = {};
16230
+ Object.entries(item).forEach((function(_ref15) {
16231
+ var _ref16 = _slicedToArray(_ref15, 2), k = _ref16[0], v = _ref16[1];
16232
+ if (v === null || _typeof(v) !== "object") flat[k] = v;
16233
+ }));
16234
+ return flat;
16235
+ })));
16236
+
16237
+ case 15:
16238
+ return _context10.abrupt("return", json);
16239
+
16240
+ case 18:
16241
+ _context10.prev = 18;
16242
+ _context10.t0 = _context10["catch"](0);
16243
+ return _context10.abrupt("return", errorMessageHandler(_context10.t0, "AAVE"));
16244
+
16245
+ case 21:
16246
+ case "end":
16247
+ return _context10.stop();
16248
+ }
16249
+ }), _callee10, null, [ [ 0, 18 ] ]);
16250
+ })));
16251
+ return _AAVE.apply(this, arguments);
16252
+ }
16655
16253
  var dateStringToTimestamp = function dateStringToTimestamp(val) {
16656
16254
  var _val$split = val.split("/"), _val$split2 = _slicedToArray(_val$split, 3), dd = _val$split2[0], mm = _val$split2[1], yyyy = _val$split2[2];
16657
16255
  var date = new Date("".concat(yyyy, "-").concat(mm.padStart(2, "0"), "-").concat(dd.padStart(2, "0")));
@@ -16667,94 +16265,6 @@ function _typeof(o) {
16667
16265
  }), {
16668
16266
  message: "Invalid date format or value: expected DD/MM/YYYY"
16669
16267
  }));
16670
- var blockscoutParamsSchema = objectType({
16671
- address: stringType().nonempty(),
16672
- type: enumType([ "stat", "txns", "tokens" ]),
16673
- chain: enumType([ "ethereum", "gnosis", "arbitrum", "optimism", "soneium", "unichain" ])["default"]("ethereum"),
16674
- startTimestamp: dateOrTimestamp.optional(),
16675
- endTimestamp: dateOrTimestamp.optional(),
16676
- page: numberType()["int"]().nonnegative()["default"](1),
16677
- offset: numberType()["int"]().nonnegative().max(MAX_PAGE_LIMIT, {
16678
- message: '"offset" must be less than or equal to '.concat(MAX_PAGE_LIMIT)
16679
- })["default"](10)
16680
- });
16681
- var gasSchema$1 = objectType({
16682
- type: literalType("gas"),
16683
- startDate: dateOrTimestamp.optional(),
16684
- endDate: dateOrTimestamp.optional(),
16685
- page: numberType()["int"]().nonnegative()["default"](1),
16686
- limit: numberType()["int"]().nonnegative().max(MAX_PAGE_LIMIT, {
16687
- message: '"limit" must be less than or equal to '.concat(MAX_PAGE_LIMIT)
16688
- })["default"](10)
16689
- });
16690
- var txnSchema$1 = objectType({
16691
- type: enumType([ "all-txns", "token-txns", "nft-txns" ]),
16692
- address: stringType().nonempty(),
16693
- startDate: dateOrTimestamp.optional(),
16694
- endDate: dateOrTimestamp.optional(),
16695
- page: numberType()["int"]().nonnegative()["default"](1),
16696
- limit: numberType()["int"]().nonnegative().max(MAX_PAGE_LIMIT, {
16697
- message: '"limit" must be less than or equal to '.concat(MAX_PAGE_LIMIT)
16698
- })["default"](10)
16699
- });
16700
- var baseParamsSchema = discriminatedUnionType("type", [ gasSchema$1, txnSchema$1 ]);
16701
- var gasSchema = objectType({
16702
- type: literalType("gas"),
16703
- startDate: dateOrTimestamp.optional(),
16704
- endDate: dateOrTimestamp.optional(),
16705
- page: numberType()["int"]().nonnegative()["default"](1),
16706
- limit: numberType()["int"]().nonnegative().max(MAX_PAGE_LIMIT, {
16707
- message: '"limit" must be less than or equal to '.concat(MAX_PAGE_LIMIT)
16708
- })["default"](10)
16709
- });
16710
- var txnSchema = objectType({
16711
- type: enumType([ "all-txns", "token-txns", "nft-txns" ]),
16712
- address: stringType().nonempty(),
16713
- startDate: dateOrTimestamp.optional(),
16714
- endDate: dateOrTimestamp.optional(),
16715
- chain: enumType([ "ethereum", "base", "gnosis" ]),
16716
- page: numberType()["int"]().nonnegative()["default"](1),
16717
- limit: numberType()["int"]().nonnegative().max(MAX_PAGE_LIMIT, {
16718
- message: '"limit" must be less than or equal to '.concat(MAX_PAGE_LIMIT)
16719
- })["default"](10)
16720
- });
16721
- var etherscanParamsSchema = discriminatedUnionType("type", [ gasSchema, txnSchema ]);
16722
- var allowedValues = [ "1h", "24h", "7d" ];
16723
- var param2Schema = stringType().refine((function(val) {
16724
- var tokens = val.split(",").map((function(t) {
16725
- return t.trim().toLowerCase();
16726
- }));
16727
- return tokens.some((function(token) {
16728
- return allowedValues.some((function(allowed) {
16729
- return token.includes(allowed);
16730
- }));
16731
- }));
16732
- }), {
16733
- message: "param2 must contain at least one of: '1h', '24h', '7d'"
16734
- }).optional();
16735
- var priceSchema = objectType({
16736
- category: literalType("price"),
16737
- param1: stringType().nonempty(),
16738
- param2: stringType().nonempty().optional()
16739
- });
16740
- var marketEcosystems = [ "all", "base", "meme", "aiagents", "bitcoin", "ethereum", "hyperliquid", "pump", "solana" ];
16741
- var marketSchema = objectType({
16742
- category: literalType("market"),
16743
- param1: enumType(marketEcosystems),
16744
- param2: param2Schema
16745
- });
16746
- var stablecoinsTypes = [ "all", "yield-bearing-stablecoins", "crypto-backed-stablecoin" ];
16747
- var stablecoinsSchema = objectType({
16748
- category: literalType("stablecoins"),
16749
- param1: enumType(stablecoinsTypes),
16750
- param2: param2Schema
16751
- });
16752
- var derivativesSchema = objectType({
16753
- category: literalType("derivatives"),
16754
- param1: stringType().nonempty(),
16755
- param2: anyType().optional()
16756
- });
16757
- var coingeckoParamsSchema = discriminatedUnionType("category", [ priceSchema, marketSchema, stablecoinsSchema, derivativesSchema ]);
16758
16268
  var baseSchema = objectType({
16759
16269
  addresses: stringType().nonempty(),
16760
16270
  category: enumType([ "balance", "txns" ]),
@@ -16786,637 +16296,788 @@ function _typeof(o) {
16786
16296
  message: "startTime and endTime required for txns",
16787
16297
  path: [ "startTime" ]
16788
16298
  }));
16789
- var safeParamsSchema = objectType({
16790
- address: stringType().nonempty(),
16791
- utility: literalType("txns"),
16792
- chain: enumType([ "ethereum", "gnosis" ]),
16793
- limit: numberType()["int"]().nonnegative().max(MAX_PAGE_LIMIT, {
16794
- message: '"limit" must be less than or equal to '.concat(MAX_PAGE_LIMIT)
16795
- })["default"](10),
16796
- offset: numberType()["int"]().nonnegative()["default"](0)
16797
- });
16798
- var categories = [ "protocols", "yields", "dex", "fees" ];
16799
- var defillamaParamsSchema = objectType({
16800
- category: enumType(categories)
16801
- });
16802
- var CATEGORY_URLS = {
16803
- protocols: "https://api.llama.fi/protocols",
16804
- yields: "https://yields.llama.fi/pools",
16805
- dex: "https://api.llama.fi/overview/dexs?excludeTotalDataChart=true&excludeTotalDataChartBreakdown=true",
16806
- fees: "https://api.llama.fi/overview/fees?excludeTotalDataChart=true&excludeTotalDataChartBreakdown=true&dataType=dailyFees"
16299
+ var isAddress = function isAddress(input) {
16300
+ return /^0x[a-fA-F0-9]{40}$/.test(input);
16807
16301
  };
16808
- var uniswapParamsSchema = objectType({
16809
- graphType: enumType([ "v3", "v3-raw" ]),
16810
- category: enumType([ "tokens", "markets" ]),
16811
- param1: stringType().nonempty(),
16812
- param2: stringType().optional()
16813
- });
16814
- var aaveParamsSchema = objectType({
16815
- graphType: enumType([ "v2", "v2-raw" ]),
16816
- category: enumType([ "tokens", "markets" ]),
16817
- param1: stringType().nonempty(),
16818
- param2: stringType().optional()
16819
- });
16820
- function FIREFLY() {
16821
- return _FIREFLY.apply(this, arguments);
16822
- }
16823
- function _FIREFLY() {
16824
- _FIREFLY = _asyncToGenerator(_regeneratorRuntime().mark((function _callee12() {
16825
- var _argsToArray3, _argsToArray4, platform, contentType, identifier, _argsToArray4$, start, _argsToArray4$2, end, apiKey, url, _getUrlAndHeaders4, finalUrl, HEADERS, response, _yield$response$json, _data, _args12 = arguments;
16826
- return _regeneratorRuntime().wrap((function _callee12$(_context12) {
16827
- while (1) switch (_context12.prev = _context12.next) {
16828
- case 0:
16829
- _context12.prev = 0;
16830
- _argsToArray3 = argsToArray(_args12), _argsToArray4 = _slicedToArray(_argsToArray3, 5),
16831
- platform = _argsToArray4[0], contentType = _argsToArray4[1], identifier = _argsToArray4[2],
16832
- _argsToArray4$ = _argsToArray4[3], start = _argsToArray4$ === void 0 ? 0 : _argsToArray4$,
16833
- _argsToArray4$2 = _argsToArray4[4], end = _argsToArray4$2 === void 0 ? 10 : _argsToArray4$2;
16834
- validateParams(fireflyParamsSchema, {
16835
- platform: platform,
16836
- contentType: contentType,
16837
- identifier: identifier,
16838
- start: start,
16839
- end: end
16840
- });
16841
- apiKey = window.localStorage.getItem(SERVICES_API_KEY.Firefly);
16842
- url = new URL("https://openapi.firefly.land/v1/fileverse/fetch");
16843
- url.searchParams.set("query", identifier.split(",").map((function(s) {
16844
- return s.trim();
16845
- })).filter(Boolean).join(","));
16846
- url.searchParams.set("type", fireFlyPlaformType[platform][contentType]);
16847
- url.searchParams.set("start", String(start));
16848
- url.searchParams.set("end", String(end));
16849
- _getUrlAndHeaders4 = getUrlAndHeaders({
16850
- url: url.toString(),
16851
- serviceName: "Firefly",
16852
- headers: {
16853
- "x-api-key": apiKey
16854
- }
16855
- }), finalUrl = _getUrlAndHeaders4.URL, HEADERS = _getUrlAndHeaders4.HEADERS;
16856
- _context12.next = 12;
16857
- return fetch(finalUrl, {
16858
- method: "GET",
16859
- headers: HEADERS
16860
- });
16302
+ var isAddress$1 = {
16303
+ isAddress: isAddress
16304
+ };
16305
+ function fromEnsNameToAddress(_x0) {
16306
+ return _fromEnsNameToAddress.apply(this, arguments);
16307
+ }
16308
+ function _fromEnsNameToAddress() {
16309
+ _fromEnsNameToAddress = _asyncToGenerator(_regeneratorRuntime().mark((function _callee11(name) {
16310
+ var ALCHEMY_KEY, provider, resolved;
16311
+ return _regeneratorRuntime().wrap((function _callee11$(_context11) {
16312
+ while (1) switch (_context11.prev = _context11.next) {
16313
+ case 0:
16314
+ if (!(typeof ethers === "undefined")) {
16315
+ _context11.next = 3;
16316
+ break;
16317
+ }
16318
+ _context11.next = 3;
16319
+ return new Promise((function(resolve, reject) {
16320
+ var script = document.createElement("script");
16321
+ script.src = "https://cdn.jsdelivr.net/npm/ethers@6.10.0/dist/ethers.umd.min.js";
16322
+ script.onload = resolve;
16323
+ script.onerror = reject;
16324
+ document.head.appendChild(script);
16325
+ }));
16861
16326
 
16862
- case 12:
16863
- response = _context12.sent;
16864
- if (response.ok) {
16865
- _context12.next = 15;
16327
+ case 3:
16328
+ ALCHEMY_KEY = window.localStorage.getItem(UTILITY.ALCHEMY_API_KEY);
16329
+ if (ALCHEMY_KEY) {
16330
+ _context11.next = 7;
16866
16331
  break;
16867
16332
  }
16868
- throw new NetworkError(SERVICES_API_KEY.Firefly, response.status);
16333
+ console.error("alchemy api key missing");
16334
+ return _context11.abrupt("return", null);
16335
+
16336
+ case 7:
16337
+ provider = new ethers.AlchemyProvider("mainnet", ALCHEMY_KEY);
16338
+ _context11.prev = 8;
16339
+ _context11.next = 11;
16340
+ return provider.resolveName(name);
16341
+
16342
+ case 11:
16343
+ resolved = _context11.sent;
16344
+ return _context11.abrupt("return", resolved || null);
16869
16345
 
16870
16346
  case 15:
16871
- _context12.next = 17;
16872
- return response.json();
16347
+ _context11.prev = 15;
16348
+ _context11.t0 = _context11["catch"](8);
16349
+ console.error("ENS resolution failed:", _context11.t0.message);
16350
+ return _context11.abrupt("return", null);
16873
16351
 
16874
- case 17:
16875
- _yield$response$json = _context12.sent;
16876
- _data = _yield$response$json.data;
16877
- if (Array.isArray(_data)) {
16878
- _context12.next = 21;
16352
+ case 19:
16353
+ case "end":
16354
+ return _context11.stop();
16355
+ }
16356
+ }), _callee11, null, [ [ 8, 15 ] ]);
16357
+ })));
16358
+ return _fromEnsNameToAddress.apply(this, arguments);
16359
+ }
16360
+ var validateAndGetAddress = function() {
16361
+ var _ref10 = _asyncToGenerator(_regeneratorRuntime().mark((function _callee9(address) {
16362
+ var resolvedAddress;
16363
+ return _regeneratorRuntime().wrap((function _callee9$(_context9) {
16364
+ while (1) switch (_context9.prev = _context9.next) {
16365
+ case 0:
16366
+ if (!isAddress$1.isAddress(address)) {
16367
+ _context9.next = 2;
16879
16368
  break;
16880
16369
  }
16881
- return _context12.abrupt("return", []);
16370
+ return _context9.abrupt("return", address);
16882
16371
 
16883
- case 21:
16884
- return _context12.abrupt("return", _data.map((function(item) {
16885
- var flat = {};
16886
- for (var _i10 = 0, _Object$entries = Object.entries(item); _i10 < _Object$entries.length; _i10++) {
16887
- var _Object$entries$_i = _slicedToArray(_Object$entries[_i10], 2), key = _Object$entries$_i[0], _value11 = _Object$entries$_i[1];
16888
- if (_typeof(_value11) !== "object" || _value11 === null) {
16889
- flat[key] = _value11;
16890
- }
16891
- }
16892
- flat.platform = platform;
16893
- return flat;
16894
- })));
16372
+ case 2:
16373
+ _context9.next = 4;
16374
+ return fromEnsNameToAddress(address);
16895
16375
 
16896
- case 24:
16897
- _context12.prev = 24;
16898
- _context12.t0 = _context12["catch"](0);
16899
- return _context12.abrupt("return", errorMessageHandler(_context12.t0, "FIREFLY"));
16376
+ case 4:
16377
+ resolvedAddress = _context9.sent;
16378
+ if (!resolvedAddress) {
16379
+ _context9.next = 7;
16380
+ break;
16381
+ }
16382
+ return _context9.abrupt("return", resolvedAddress);
16900
16383
 
16901
- case 27:
16384
+ case 7:
16385
+ throw new ValidationError("Invalid address");
16386
+
16387
+ case 8:
16902
16388
  case "end":
16903
- return _context12.stop();
16389
+ return _context9.stop();
16904
16390
  }
16905
- }), _callee12, null, [ [ 0, 24 ] ]);
16391
+ }), _callee9);
16906
16392
  })));
16907
- return _FIREFLY.apply(this, arguments);
16393
+ return function validateAndGetAddress(_x1) {
16394
+ return _ref10.apply(this, arguments);
16395
+ };
16396
+ }();
16397
+ var fromEnsNameToAddress$1 = {
16398
+ validateAndGetAddress: validateAndGetAddress
16399
+ };
16400
+ var PROXY_MAP;
16401
+ function initializeProxyMap() {
16402
+ if (!PROXY_MAP) {
16403
+ var fileverseProxyUrl = "".concat(window.NEXT_PUBLIC_PROXY_BASE_URL, "/proxy");
16404
+ PROXY_MAP = {
16405
+ Etherscan: {
16406
+ url: fileverseProxyUrl,
16407
+ removeParams: [ "apikey" ]
16408
+ },
16409
+ Basescan: {
16410
+ url: fileverseProxyUrl,
16411
+ removeParams: [ "apikey" ]
16412
+ },
16413
+ Gnosisscan: {
16414
+ url: fileverseProxyUrl,
16415
+ removeParams: [ "apikey" ]
16416
+ },
16417
+ Coingecko: {
16418
+ url: fileverseProxyUrl,
16419
+ removeParams: [ "apikey" ]
16420
+ },
16421
+ Firefly: {
16422
+ url: fileverseProxyUrl,
16423
+ removeParams: [ "apikey" ]
16424
+ },
16425
+ Neynar: {
16426
+ url: fileverseProxyUrl,
16427
+ removeParams: [ "api_key" ]
16428
+ },
16429
+ Safe: {
16430
+ url: fileverseProxyUrl,
16431
+ removeParams: [ "api_key" ]
16432
+ },
16433
+ Defillama: {
16434
+ url: fileverseProxyUrl,
16435
+ removeParams: [ "api_key" ]
16436
+ },
16437
+ GnosisPay: {
16438
+ url: fileverseProxyUrl,
16439
+ removeParams: [ "api_key" ]
16440
+ }
16441
+ };
16442
+ }
16443
+ return PROXY_MAP;
16908
16444
  }
16909
- function LENS() {
16910
- return _LENS.apply(this, arguments);
16445
+ function removeUrlParams(url, paramsToRemove) {
16446
+ if (!paramsToRemove || paramsToRemove.length === 0) {
16447
+ return url;
16448
+ }
16449
+ var urlObj = new URL(url);
16450
+ paramsToRemove.forEach((function(param) {
16451
+ if (urlObj.searchParams.has(param)) {
16452
+ urlObj.searchParams["delete"](param);
16453
+ }
16454
+ }));
16455
+ return urlObj.toString();
16911
16456
  }
16912
- function _LENS() {
16913
- _LENS = _asyncToGenerator(_regeneratorRuntime().mark((function _callee13() {
16914
- var _argsToArray5, _argsToArray6, contentType, identifier, _argsToArray6$, start, _argsToArray6$2, end, apiKey, url, typeMap, _getUrlAndHeaders5, finalUrl, HEADERS, response, _yield$response$json2, _data2, _args13 = arguments;
16915
- return _regeneratorRuntime().wrap((function _callee13$(_context13) {
16916
- while (1) switch (_context13.prev = _context13.next) {
16457
+ function getUrlAndHeaders(_ref11) {
16458
+ var url = _ref11.url, serviceName = _ref11.serviceName, _ref11$headers = _ref11.headers, headers = _ref11$headers === void 0 ? {} : _ref11$headers;
16459
+ var proxyMap = initializeProxyMap();
16460
+ var apiKeyLS = window.localStorage.getItem(SERVICES_API_KEY[serviceName]);
16461
+ var isProxyModeEnabledValue = apiKeyLS === "DEFAULT_PROXY_MODE";
16462
+ var proxyConfig = proxyMap[serviceName];
16463
+ if (!proxyConfig && SERVICES_API_KEY[serviceName] && (!apiKeyLS || apiKeyLS === "")) {
16464
+ throw new MissingApiKeyError(SERVICES_API_KEY[serviceName]);
16465
+ }
16466
+ if ((isProxyModeEnabledValue || !apiKeyLS || apiKeyLS === "") && proxyConfig) {
16467
+ var cleanedUrl = removeUrlParams(url, proxyConfig.removeParams);
16468
+ return {
16469
+ URL: proxyConfig.url,
16470
+ HEADERS: {
16471
+ "target-url": cleanedUrl,
16472
+ method: "GET",
16473
+ "Content-Type": "application/json"
16474
+ }
16475
+ };
16476
+ }
16477
+ return {
16478
+ URL: url,
16479
+ HEADERS: _objectSpread({}, headers)
16480
+ };
16481
+ }
16482
+ var fromTimeStampToBlock = function() {
16483
+ var _ref12 = _asyncToGenerator(_regeneratorRuntime().mark((function _callee0(timestamp, chain, apiKey) {
16484
+ var chainId, url, _getUrlAndHeaders, finalUrl, HEADERS, res, json;
16485
+ return _regeneratorRuntime().wrap((function _callee0$(_context0) {
16486
+ while (1) switch (_context0.prev = _context0.next) {
16917
16487
  case 0:
16918
- _context13.prev = 0;
16919
- _argsToArray5 = argsToArray(_args13), _argsToArray6 = _slicedToArray(_argsToArray5, 4),
16920
- contentType = _argsToArray6[0], identifier = _argsToArray6[1], _argsToArray6$ = _argsToArray6[2],
16921
- start = _argsToArray6$ === void 0 ? 0 : _argsToArray6$, _argsToArray6$2 = _argsToArray6[3],
16922
- end = _argsToArray6$2 === void 0 ? 10 : _argsToArray6$2;
16923
- validateParams(lensParamsSchema, {
16924
- contentType: contentType,
16925
- identifier: identifier,
16926
- start: start,
16927
- end: end
16928
- });
16929
- apiKey = window.localStorage.getItem(SERVICES_API_KEY.Firefly);
16930
- url = new URL("https://openapi.firefly.land/v1/fileverse/fetch");
16931
- url.searchParams.set("query", identifier.split(",").map((function(s) {
16932
- return s.trim();
16933
- })).filter(Boolean).join(","));
16934
- typeMap = {
16935
- posts: "lensid",
16936
- replies: "lenspostid"
16937
- };
16938
- url.searchParams.set("type", typeMap[contentType]);
16939
- url.searchParams.set("start", String(start));
16940
- url.searchParams.set("end", String(end));
16941
- _getUrlAndHeaders5 = getUrlAndHeaders({
16942
- url: url.toString(),
16943
- serviceName: "Firefly",
16944
- headers: {
16945
- "x-api-key": apiKey
16946
- }
16947
- }), finalUrl = _getUrlAndHeaders5.URL, HEADERS = _getUrlAndHeaders5.HEADERS;
16948
- _context13.next = 13;
16488
+ if (!(!timestamp || !chain)) {
16489
+ _context0.next = 2;
16490
+ break;
16491
+ }
16492
+ return _context0.abrupt("return");
16493
+
16494
+ case 2:
16495
+ chainId = CHAIN_ID_MAP[chain];
16496
+ url = "https://api.etherscan.io/v2/api?module=block&action=getblocknobytime&timestamp=".concat(timestamp, "&closest=before&apikey=").concat(apiKey, "&chainId=").concat(chainId);
16497
+ _getUrlAndHeaders = getUrlAndHeaders({
16498
+ url: url,
16499
+ serviceName: "Etherscan",
16500
+ headers: {}
16501
+ }), finalUrl = _getUrlAndHeaders.URL, HEADERS = _getUrlAndHeaders.HEADERS;
16502
+ _context0.next = 7;
16949
16503
  return fetch(finalUrl, {
16950
16504
  method: "GET",
16951
16505
  headers: HEADERS
16952
16506
  });
16953
16507
 
16954
- case 13:
16955
- response = _context13.sent;
16956
- if (response.ok) {
16957
- _context13.next = 16;
16508
+ case 7:
16509
+ res = _context0.sent;
16510
+ _context0.next = 10;
16511
+ return res.json();
16512
+
16513
+ case 10:
16514
+ json = _context0.sent;
16515
+ return _context0.abrupt("return", parseInt(json.result));
16516
+
16517
+ case 12:
16518
+ case "end":
16519
+ return _context0.stop();
16520
+ }
16521
+ }), _callee0);
16522
+ })));
16523
+ return function fromTimeStampToBlock(_x10, _x11, _x12) {
16524
+ return _ref12.apply(this, arguments);
16525
+ };
16526
+ }();
16527
+ var fromTimestampToBlock = {
16528
+ fromTimeStampToBlock: fromTimeStampToBlock
16529
+ };
16530
+ function toTimestamp(dateStr) {
16531
+ var _dateStr$split$map = dateStr.split("/").map(Number), _dateStr$split$map2 = _slicedToArray(_dateStr$split$map, 3), day = _dateStr$split$map2[0], month = _dateStr$split$map2[1], year = _dateStr$split$map2[2];
16532
+ var date = new Date(year, month - 1, day);
16533
+ return Math.floor(date.getTime() / 1e3);
16534
+ }
16535
+ function EOA() {
16536
+ return _EOA.apply(this, arguments);
16537
+ }
16538
+ function _EOA() {
16539
+ _EOA = _asyncToGenerator(_regeneratorRuntime().mark((function _callee13() {
16540
+ 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;
16541
+ return _regeneratorRuntime().wrap((function _callee13$(_context16) {
16542
+ while (1) switch (_context16.prev = _context16.next) {
16543
+ case 0:
16544
+ _context16.prev = 0;
16545
+ fetchJSON = function() {
16546
+ var _ref17 = _asyncToGenerator(_regeneratorRuntime().mark((function _callee12(url) {
16547
+ var _getUrlAndHeaders3, finalUrl, HEADERS, res, json;
16548
+ return _regeneratorRuntime().wrap((function _callee12$(_context12) {
16549
+ while (1) switch (_context12.prev = _context12.next) {
16550
+ case 0:
16551
+ _getUrlAndHeaders3 = getUrlAndHeaders({
16552
+ url: url,
16553
+ serviceName: "Etherscan",
16554
+ headers: {}
16555
+ }), finalUrl = _getUrlAndHeaders3.URL, HEADERS = _getUrlAndHeaders3.HEADERS;
16556
+ _context12.next = 3;
16557
+ return fetch(finalUrl, {
16558
+ method: "GET",
16559
+ headers: HEADERS
16560
+ });
16561
+
16562
+ case 3:
16563
+ res = _context12.sent;
16564
+ if (res.ok) {
16565
+ _context12.next = 6;
16566
+ break;
16567
+ }
16568
+ throw new NetworkError(SERVICES_API_KEY.Etherscan, res.status);
16569
+
16570
+ case 6:
16571
+ _context12.next = 8;
16572
+ return res.json();
16573
+
16574
+ case 8:
16575
+ json = _context12.sent;
16576
+ if (!(typeof json.result === "string")) {
16577
+ _context12.next = 14;
16578
+ break;
16579
+ }
16580
+ if (!json.result.includes("Invalid API Key")) {
16581
+ _context12.next = 12;
16582
+ break;
16583
+ }
16584
+ throw new InvalidApiKeyError(SERVICES_API_KEY.Etherscan);
16585
+
16586
+ case 12:
16587
+ if (!json.result.includes("Max rate limit reached")) {
16588
+ _context12.next = 14;
16589
+ break;
16590
+ }
16591
+ throw new RateLimitError(SERVICES_API_KEY.Etherscan);
16592
+
16593
+ case 14:
16594
+ return _context12.abrupt("return", json.result);
16595
+
16596
+ case 15:
16597
+ case "end":
16598
+ return _context12.stop();
16599
+ }
16600
+ }), _callee12);
16601
+ })));
16602
+ return function fetchJSON(_x16) {
16603
+ return _ref17.apply(this, arguments);
16604
+ };
16605
+ }();
16606
+ _argsToArray5 = argsToArray(_args16), _argsToArray6 = _slicedToArray(_argsToArray5, 7),
16607
+ addresses = _argsToArray6[0], category = _argsToArray6[1], chains = _argsToArray6[2],
16608
+ startTime = _argsToArray6[3], endTime = _argsToArray6[4], _argsToArray6$ = _argsToArray6[5],
16609
+ page = _argsToArray6$ === void 0 ? 1 : _argsToArray6$, _argsToArray6$2 = _argsToArray6[6],
16610
+ offset = _argsToArray6$2 === void 0 ? 10 : _argsToArray6$2;
16611
+ validateParams(eoaParamsSchema, {
16612
+ addresses: addresses,
16613
+ category: category,
16614
+ chains: chains,
16615
+ startTime: startTime,
16616
+ endTime: endTime,
16617
+ page: page,
16618
+ offset: offset
16619
+ });
16620
+ apiKey = window.localStorage.getItem(SERVICES_API_KEY.Etherscan);
16621
+ INPUTS = addresses.split(",").map((function(s) {
16622
+ return s.trim();
16623
+ })).filter(Boolean);
16624
+ CHAINS = chains.split(",").map((function(s) {
16625
+ return s.trim();
16626
+ })).filter(Boolean);
16627
+ ADDRESS_MAP = {};
16628
+ _iterator41 = _createForOfIteratorHelper(INPUTS);
16629
+ _context16.prev = 9;
16630
+ _iterator41.s();
16631
+
16632
+ case 11:
16633
+ if ((_step41 = _iterator41.n()).done) {
16634
+ _context16.next = 23;
16958
16635
  break;
16959
16636
  }
16960
- throw new NetworkError(SERVICES_API_KEY.Firefly, response.status);
16961
-
16962
- case 16:
16963
- _context13.next = 18;
16964
- return response.json();
16965
-
16966
- case 18:
16967
- _yield$response$json2 = _context13.sent;
16968
- _data2 = _yield$response$json2.data;
16969
- if (Array.isArray(_data2)) {
16970
- _context13.next = 22;
16637
+ inp = _step41.value;
16638
+ if (!isAddress$1.isAddress(inp)) {
16639
+ _context16.next = 17;
16971
16640
  break;
16972
16641
  }
16973
- return _context13.abrupt("return", []);
16642
+ ADDRESS_MAP[inp.toLowerCase()] = null;
16643
+ _context16.next = 21;
16644
+ break;
16974
16645
 
16975
- case 22:
16976
- return _context13.abrupt("return", _data2.map((function(item) {
16977
- var flat = {};
16978
- for (var _i11 = 0, _Object$entries2 = Object.entries(item); _i11 < _Object$entries2.length; _i11++) {
16979
- var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i11], 2), key = _Object$entries2$_i[0], _value12 = _Object$entries2$_i[1];
16980
- if (_value12 == null || _typeof(_value12) !== "object") {
16981
- flat[key] = _value12;
16982
- }
16983
- }
16984
- flat.platform = "lens";
16985
- return flat;
16986
- })));
16646
+ case 17:
16647
+ _context16.next = 19;
16648
+ return fromEnsNameToAddress$1.validateAndGetAddress(inp);
16649
+
16650
+ case 19:
16651
+ _address = _context16.sent;
16652
+ ADDRESS_MAP[_address.toLowerCase()] = _address;
16653
+
16654
+ case 21:
16655
+ _context16.next = 11;
16656
+ break;
16657
+
16658
+ case 23:
16659
+ _context16.next = 28;
16660
+ break;
16987
16661
 
16988
16662
  case 25:
16989
- _context13.prev = 25;
16990
- _context13.t0 = _context13["catch"](0);
16991
- return _context13.abrupt("return", errorMessageHandler(_context13.t0, "LENS"));
16663
+ _context16.prev = 25;
16664
+ _context16.t0 = _context16["catch"](9);
16665
+ _iterator41.e(_context16.t0);
16992
16666
 
16993
16667
  case 28:
16994
- case "end":
16995
- return _context13.stop();
16996
- }
16997
- }), _callee13, null, [ [ 0, 25 ] ]);
16998
- })));
16999
- return _LENS.apply(this, arguments);
17000
- }
17001
- function FARCASTER() {
17002
- return _FARCASTER.apply(this, arguments);
17003
- }
17004
- function _FARCASTER() {
17005
- _FARCASTER = _asyncToGenerator(_regeneratorRuntime().mark((function _callee14() {
17006
- var _argsToArray7, _argsToArray8, contentType, identifier, _argsToArray8$, start, _argsToArray8$2, end, apiKey, url, typeMap, _getUrlAndHeaders6, finalUrl, HEADERS, response, _yield$response$json3, _data3, _args14 = arguments;
17007
- return _regeneratorRuntime().wrap((function _callee14$(_context14) {
17008
- while (1) switch (_context14.prev = _context14.next) {
17009
- case 0:
17010
- _context14.prev = 0;
17011
- _argsToArray7 = argsToArray(_args14), _argsToArray8 = _slicedToArray(_argsToArray7, 4),
17012
- contentType = _argsToArray8[0], identifier = _argsToArray8[1], _argsToArray8$ = _argsToArray8[2],
17013
- start = _argsToArray8$ === void 0 ? 0 : _argsToArray8$, _argsToArray8$2 = _argsToArray8[3],
17014
- end = _argsToArray8$2 === void 0 ? 10 : _argsToArray8$2;
17015
- validateParams(farcasterParamsSchema, {
17016
- contentType: contentType,
17017
- identifier: identifier,
17018
- start: start,
17019
- end: end
17020
- });
17021
- apiKey = window.localStorage.getItem(SERVICES_API_KEY.Firefly);
17022
- url = new URL("https://openapi.firefly.land/v1/fileverse/fetch");
17023
- url.searchParams.set("query", identifier.split(",").map((function(s) {
17024
- return s.trim();
17025
- })).filter(Boolean).join(","));
17026
- typeMap = {
17027
- posts: "farcasterid",
17028
- replies: "farcasterpostid",
17029
- channels: "farcasterchannels"
17030
- };
17031
- url.searchParams.set("type", typeMap[contentType]);
17032
- url.searchParams.set("start", String(start));
17033
- url.searchParams.set("end", String(end));
17034
- _getUrlAndHeaders6 = getUrlAndHeaders({
17035
- url: url.toString(),
17036
- serviceName: "Firefly",
17037
- headers: {
17038
- "x-api-key": apiKey
17039
- }
17040
- }), finalUrl = _getUrlAndHeaders6.URL, HEADERS = _getUrlAndHeaders6.HEADERS;
17041
- _context14.next = 13;
17042
- return fetch(finalUrl, {
17043
- method: "GET",
17044
- headers: HEADERS
17045
- });
16668
+ _context16.prev = 28;
16669
+ _iterator41.f();
16670
+ return _context16.finish(28);
17046
16671
 
17047
- case 13:
17048
- response = _context14.sent;
17049
- if (response.ok) {
17050
- _context14.next = 16;
17051
- break;
17052
- }
17053
- throw new NetworkError(SERVICES_API_KEY.Firefly, response.status);
16672
+ case 31:
16673
+ ADDRS = Object.keys(ADDRESS_MAP);
16674
+ out = [];
16675
+ _iterator42 = _createForOfIteratorHelper(CHAINS);
16676
+ _context16.prev = 34;
16677
+ _loop = _regeneratorRuntime().mark((function _loop() {
16678
+ var chain, chainId, _loop2, _ret2, i, sb, eb, _loop3, _ret3, _i10, _ADDRS;
16679
+ return _regeneratorRuntime().wrap((function _loop$(_context15) {
16680
+ while (1) switch (_context15.prev = _context15.next) {
16681
+ case 0:
16682
+ chain = _step42.value;
16683
+ chainId = CHAIN_ID_MAP[chain];
16684
+ if (chainId) {
16685
+ _context15.next = 4;
16686
+ break;
16687
+ }
16688
+ throw new ValidationError("Invalid chain: ".concat(chain));
17054
16689
 
17055
- case 16:
17056
- _context14.next = 18;
17057
- return response.json();
16690
+ case 4:
16691
+ if (!(category === "balance")) {
16692
+ _context15.next = 17;
16693
+ break;
16694
+ }
16695
+ _loop2 = _regeneratorRuntime().mark((function _loop2(i) {
16696
+ var slice, url, data;
16697
+ return _regeneratorRuntime().wrap((function _loop2$(_context13) {
16698
+ while (1) switch (_context13.prev = _context13.next) {
16699
+ case 0:
16700
+ slice = ADDRS.slice(i, i + 20).join(",");
16701
+ 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);
16702
+ _context13.next = 4;
16703
+ return fetchJSON(url);
17058
16704
 
17059
- case 18:
17060
- _yield$response$json3 = _context14.sent;
17061
- _data3 = _yield$response$json3.data;
17062
- if (Array.isArray(_data3)) {
17063
- _context14.next = 22;
17064
- break;
17065
- }
17066
- return _context14.abrupt("return", []);
16705
+ case 4:
16706
+ data = _context13.sent;
16707
+ if (Array.isArray(data)) {
16708
+ _context13.next = 7;
16709
+ break;
16710
+ }
16711
+ return _context13.abrupt("return", {
16712
+ v: {
16713
+ v: data
16714
+ }
16715
+ });
17067
16716
 
17068
- case 22:
17069
- return _context14.abrupt("return", _data3.map((function(item) {
17070
- var flat = {};
17071
- for (var _i12 = 0, _Object$entries3 = Object.entries(item); _i12 < _Object$entries3.length; _i12++) {
17072
- var _Object$entries3$_i = _slicedToArray(_Object$entries3[_i12], 2), k = _Object$entries3$_i[0], v = _Object$entries3$_i[1];
17073
- if (v == null || _typeof(v) !== "object") {
17074
- flat[k] = v;
17075
- }
17076
- }
17077
- flat.platform = "farcaster";
17078
- return flat;
17079
- })));
16717
+ case 7:
16718
+ data.forEach((function(item, idx) {
16719
+ return out.push(_objectSpread({
16720
+ chain: chain,
16721
+ address: ADDRS[i + idx],
16722
+ name: ADDRESS_MAP[ADDRS[i + idx]]
16723
+ }, item));
16724
+ }));
17080
16725
 
17081
- case 25:
17082
- _context14.prev = 25;
17083
- _context14.t0 = _context14["catch"](0);
17084
- return _context14.abrupt("return", errorMessageHandler(_context14.t0, "FARCASTER"));
16726
+ case 8:
16727
+ case "end":
16728
+ return _context13.stop();
16729
+ }
16730
+ }), _loop2);
16731
+ }));
16732
+ i = 0;
17085
16733
 
17086
- case 28:
17087
- case "end":
17088
- return _context14.stop();
17089
- }
17090
- }), _callee14, null, [ [ 0, 25 ] ]);
17091
- })));
17092
- return _FARCASTER.apply(this, arguments);
17093
- }
17094
- function BLOCKSCOUT() {
17095
- return _BLOCKSCOUT.apply(this, arguments);
17096
- }
17097
- function _BLOCKSCOUT() {
17098
- _BLOCKSCOUT = _asyncToGenerator(_regeneratorRuntime().mark((function _callee15() {
17099
- var _json$result, _json$result2, _argsToArray9, _argsToArray0, address, type, _argsToArray0$, chain, startTimestamp, endTimestamp, page, offset, startTs, endTs, resolvedAddress, hostname, requestUrl, response, json, _args15 = arguments;
17100
- return _regeneratorRuntime().wrap((function _callee15$(_context15) {
17101
- while (1) switch (_context15.prev = _context15.next) {
17102
- case 0:
17103
- _context15.prev = 0;
17104
- _argsToArray9 = argsToArray(_args15), _argsToArray0 = _slicedToArray(_argsToArray9, 7),
17105
- address = _argsToArray0[0], type = _argsToArray0[1], _argsToArray0$ = _argsToArray0[2],
17106
- chain = _argsToArray0$ === void 0 ? "ethereum" : _argsToArray0$, startTimestamp = _argsToArray0[3],
17107
- endTimestamp = _argsToArray0[4], page = _argsToArray0[5], offset = _argsToArray0[6];
17108
- validateParams(blockscoutParamsSchema, {
17109
- address: address,
17110
- type: type,
17111
- chain: chain,
17112
- startTimestamp: startTimestamp,
17113
- endTimestamp: endTimestamp,
17114
- page: page,
17115
- offset: offset
17116
- });
17117
- startTs = startTimestamp !== null && startTimestamp !== void 0 ? startTimestamp : Math.floor((Date.now() - 30 * 24 * 3600 * 1e3) / 1e3);
17118
- endTs = endTimestamp;
17119
- _context15.next = 7;
17120
- return fromEnsNameToAddress$1.validateAndGetAddress(address);
16734
+ case 7:
16735
+ if (!(i < ADDRS.length)) {
16736
+ _context15.next = 15;
16737
+ break;
16738
+ }
16739
+ return _context15.delegateYield(_loop2(i), "t0", 9);
17121
16740
 
17122
- case 7:
17123
- resolvedAddress = _context15.sent;
17124
- hostname = BLOCKSCOUT_CHAINS_MAP[chain];
17125
- _context15.t0 = type;
17126
- _context15.next = _context15.t0 === "stat" ? 12 : _context15.t0 === "txns" ? 14 : _context15.t0 === "tokens" ? 16 : 18;
17127
- break;
16741
+ case 9:
16742
+ _ret2 = _context15.t0;
16743
+ if (!_ret2) {
16744
+ _context15.next = 12;
16745
+ break;
16746
+ }
16747
+ return _context15.abrupt("return", _ret2.v);
17128
16748
 
17129
- case 12:
17130
- requestUrl = "".concat(hostname, "/api/v2/addresses/").concat(resolvedAddress, "/counters");
17131
- return _context15.abrupt("break", 18);
16749
+ case 12:
16750
+ i += 20;
16751
+ _context15.next = 7;
16752
+ break;
17132
16753
 
17133
- case 14:
17134
- 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";
17135
- return _context15.abrupt("break", 18);
16754
+ case 15:
16755
+ _context15.next = 37;
16756
+ break;
16757
+
16758
+ case 17:
16759
+ _context15.next = 19;
16760
+ return fromTimestampToBlock.fromTimeStampToBlock(toTimestamp(startTime), chain, apiKey);
16761
+
16762
+ case 19:
16763
+ sb = _context15.sent;
16764
+ _context15.next = 22;
16765
+ return fromTimestampToBlock.fromTimeStampToBlock(toTimestamp(endTime), chain, apiKey);
16766
+
16767
+ case 22:
16768
+ eb = _context15.sent;
16769
+ if (sb) {
16770
+ _context15.next = 25;
16771
+ break;
16772
+ }
16773
+ throw new ValidationError("Invalid startTime: ".concat(startTime));
16774
+
16775
+ case 25:
16776
+ if (eb) {
16777
+ _context15.next = 27;
16778
+ break;
16779
+ }
16780
+ throw new ValidationError("Invalid endTime: ".concat(endTime));
16781
+
16782
+ case 27:
16783
+ _loop3 = _regeneratorRuntime().mark((function _loop3() {
16784
+ var addr, url, data;
16785
+ return _regeneratorRuntime().wrap((function _loop3$(_context14) {
16786
+ while (1) switch (_context14.prev = _context14.next) {
16787
+ case 0:
16788
+ addr = _ADDRS[_i10];
16789
+ 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);
16790
+ _context14.next = 4;
16791
+ return fetchJSON(url);
16792
+
16793
+ case 4:
16794
+ data = _context14.sent;
16795
+ if (Array.isArray(data)) {
16796
+ _context14.next = 7;
16797
+ break;
16798
+ }
16799
+ return _context14.abrupt("return", {
16800
+ v: {
16801
+ v: data
16802
+ }
16803
+ });
16804
+
16805
+ case 7:
16806
+ data.forEach((function(item) {
16807
+ return out.push(_objectSpread({
16808
+ chain: chain,
16809
+ address: addr,
16810
+ name: ADDRESS_MAP[addr]
16811
+ }, item));
16812
+ }));
16813
+
16814
+ case 8:
16815
+ case "end":
16816
+ return _context14.stop();
16817
+ }
16818
+ }), _loop3);
16819
+ }));
16820
+ _i10 = 0, _ADDRS = ADDRS;
17136
16821
 
17137
- case 16:
17138
- requestUrl = "".concat(hostname, "/api?module=account&action=tokenlist") + "&address=".concat(resolvedAddress);
17139
- return _context15.abrupt("break", 18);
16822
+ case 29:
16823
+ if (!(_i10 < _ADDRS.length)) {
16824
+ _context15.next = 37;
16825
+ break;
16826
+ }
16827
+ return _context15.delegateYield(_loop3(), "t1", 31);
17140
16828
 
17141
- case 18:
17142
- _context15.next = 20;
17143
- return fetch(requestUrl);
16829
+ case 31:
16830
+ _ret3 = _context15.t1;
16831
+ if (!_ret3) {
16832
+ _context15.next = 34;
16833
+ break;
16834
+ }
16835
+ return _context15.abrupt("return", _ret3.v);
17144
16836
 
17145
- case 20:
17146
- response = _context15.sent;
17147
- if (response.ok) {
17148
- _context15.next = 23;
17149
- break;
17150
- }
17151
- throw new NetworkError("BLOCKSCOUT", response.status);
16837
+ case 34:
16838
+ _i10++;
16839
+ _context15.next = 29;
16840
+ break;
17152
16841
 
17153
- case 23:
17154
- _context15.next = 25;
17155
- return response.json();
16842
+ case 37:
16843
+ case "end":
16844
+ return _context15.stop();
16845
+ }
16846
+ }), _loop);
16847
+ }));
16848
+ _iterator42.s();
17156
16849
 
17157
- case 25:
17158
- json = _context15.sent;
17159
- if (!(json !== null && json !== void 0 && (_json$result = json.result) !== null && _json$result !== void 0 && _json$result.includes("Invalid parameter(s)"))) {
17160
- _context15.next = 28;
16850
+ case 37:
16851
+ if ((_step42 = _iterator42.n()).done) {
16852
+ _context16.next = 44;
17161
16853
  break;
17162
16854
  }
17163
- throw new ValidationError("Invalid parameters");
16855
+ return _context16.delegateYield(_loop(), "t1", 39);
17164
16856
 
17165
- case 28:
17166
- if (!(json !== null && json !== void 0 && (_json$result2 = json.result) !== null && _json$result2 !== void 0 && _json$result2.includes("Not found"))) {
17167
- _context15.next = 30;
16857
+ case 39:
16858
+ _ret = _context16.t1;
16859
+ if (!_ret) {
16860
+ _context16.next = 42;
17168
16861
  break;
17169
16862
  }
17170
- throw new ValidationError("Address information not found");
16863
+ return _context16.abrupt("return", _ret.v);
17171
16864
 
17172
- case 30:
17173
- return _context15.abrupt("return", type === "stat" ? [ json ] : json.result);
16865
+ case 42:
16866
+ _context16.next = 37;
16867
+ break;
17174
16868
 
17175
- case 33:
17176
- _context15.prev = 33;
17177
- _context15.t1 = _context15["catch"](0);
17178
- return _context15.abrupt("return", errorMessageHandler(_context15.t1, "BLOCKSCOUT"));
16869
+ case 44:
16870
+ _context16.next = 49;
16871
+ break;
17179
16872
 
17180
- case 36:
17181
- case "end":
17182
- return _context15.stop();
17183
- }
17184
- }), _callee15, null, [ [ 0, 33 ] ]);
17185
- })));
17186
- return _BLOCKSCOUT.apply(this, arguments);
17187
- }
17188
- function BASE() {
17189
- return _BASE.apply(this, arguments);
17190
- }
17191
- function _BASE() {
17192
- _BASE = _asyncToGenerator(_regeneratorRuntime().mark((function _callee16() {
17193
- var _argsToArray1, _argsToArray10, type, address, startDate, endDate, page, limit, API_KEY, _args16 = arguments;
17194
- return _regeneratorRuntime().wrap((function _callee16$(_context16) {
17195
- while (1) switch (_context16.prev = _context16.next) {
17196
- case 0:
17197
- _context16.prev = 0;
17198
- _argsToArray1 = argsToArray(_args16), _argsToArray10 = _slicedToArray(_argsToArray1, 6),
17199
- type = _argsToArray10[0], address = _argsToArray10[1], startDate = _argsToArray10[2],
17200
- endDate = _argsToArray10[3], page = _argsToArray10[4], limit = _argsToArray10[5];
17201
- validateParams(baseParamsSchema, {
17202
- type: type,
17203
- address: address,
17204
- startDate: startDate,
17205
- endDate: endDate,
17206
- page: page,
17207
- limit: limit
17208
- });
17209
- API_KEY = window.localStorage.getItem(SERVICES_API_KEY.Basescan);
17210
- _context16.next = 6;
17211
- return handleScanRequest({
17212
- type: type,
17213
- address: address,
17214
- startDate: startDate,
17215
- endDate: endDate,
17216
- page: page,
17217
- offset: limit,
17218
- apiKey: API_KEY,
17219
- functionName: "BASE",
17220
- chainId: CHAIN_ID_MAP.base,
17221
- network: "base"
17222
- });
16873
+ case 46:
16874
+ _context16.prev = 46;
16875
+ _context16.t2 = _context16["catch"](34);
16876
+ _iterator42.e(_context16.t2);
17223
16877
 
17224
- case 6:
17225
- return _context16.abrupt("return", _context16.sent);
16878
+ case 49:
16879
+ _context16.prev = 49;
16880
+ _iterator42.f();
16881
+ return _context16.finish(49);
17226
16882
 
17227
- case 9:
17228
- _context16.prev = 9;
17229
- _context16.t0 = _context16["catch"](0);
17230
- return _context16.abrupt("return", errorMessageHandler(_context16.t0, "BASE"));
16883
+ case 52:
16884
+ return _context16.abrupt("return", out);
17231
16885
 
17232
- case 12:
16886
+ case 55:
16887
+ _context16.prev = 55;
16888
+ _context16.t3 = _context16["catch"](0);
16889
+ return _context16.abrupt("return", errorMessageHandler(_context16.t3, "EOA"));
16890
+
16891
+ case 58:
17233
16892
  case "end":
17234
16893
  return _context16.stop();
17235
16894
  }
17236
- }), _callee16, null, [ [ 0, 9 ] ]);
16895
+ }), _callee13, null, [ [ 0, 55 ], [ 9, 25, 28, 31 ], [ 34, 46, 49, 52 ] ]);
17237
16896
  })));
17238
- return _BASE.apply(this, arguments);
16897
+ return _EOA.apply(this, arguments);
17239
16898
  }
17240
- function GNOSIS() {
17241
- return _GNOSIS.apply(this, arguments);
16899
+ var gasSchema$1 = objectType({
16900
+ type: literalType("gas"),
16901
+ startDate: dateOrTimestamp.optional(),
16902
+ endDate: dateOrTimestamp.optional(),
16903
+ page: numberType()["int"]().nonnegative()["default"](1),
16904
+ limit: numberType()["int"]().nonnegative().max(MAX_PAGE_LIMIT, {
16905
+ message: '"limit" must be less than or equal to '.concat(MAX_PAGE_LIMIT)
16906
+ })["default"](10)
16907
+ });
16908
+ var txnSchema$1 = objectType({
16909
+ type: enumType([ "all-txns", "token-txns", "nft-txns" ]),
16910
+ address: stringType().nonempty(),
16911
+ startDate: dateOrTimestamp.optional(),
16912
+ endDate: dateOrTimestamp.optional(),
16913
+ page: numberType()["int"]().nonnegative()["default"](1),
16914
+ limit: numberType()["int"]().nonnegative().max(MAX_PAGE_LIMIT, {
16915
+ message: '"limit" must be less than or equal to '.concat(MAX_PAGE_LIMIT)
16916
+ })["default"](10)
16917
+ });
16918
+ var baseParamsSchema = discriminatedUnionType("type", [ gasSchema$1, txnSchema$1 ]);
16919
+ function handleScanRequest(_x13) {
16920
+ return _handleScanRequest.apply(this, arguments);
17242
16921
  }
17243
- function _GNOSIS() {
17244
- _GNOSIS = _asyncToGenerator(_regeneratorRuntime().mark((function _callee17() {
17245
- var _argsToArray11, _argsToArray12, type, address, startDate, endDate, _argsToArray12$, page, _argsToArray12$2, limit, apiKey, _args17 = arguments;
17246
- return _regeneratorRuntime().wrap((function _callee17$(_context17) {
16922
+ function _handleScanRequest() {
16923
+ _handleScanRequest = _asyncToGenerator(_regeneratorRuntime().mark((function _callee14(_ref13) {
16924
+ 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;
16925
+ return _regeneratorRuntime().wrap((function _callee14$(_context17) {
17247
16926
  while (1) switch (_context17.prev = _context17.next) {
17248
16927
  case 0:
17249
- _context17.prev = 0;
17250
- _argsToArray11 = argsToArray(_args17), _argsToArray12 = _slicedToArray(_argsToArray11, 6),
17251
- type = _argsToArray12[0], address = _argsToArray12[1], startDate = _argsToArray12[2],
17252
- endDate = _argsToArray12[3], _argsToArray12$ = _argsToArray12[4], page = _argsToArray12$ === void 0 ? 1 : _argsToArray12$,
17253
- _argsToArray12$2 = _argsToArray12[5], limit = _argsToArray12$2 === void 0 ? 10 : _argsToArray12$2;
17254
- validateParams(baseParamsSchema, {
17255
- type: type,
17256
- address: address,
17257
- startDate: startDate,
17258
- endDate: endDate,
17259
- page: page,
17260
- limit: limit
17261
- });
17262
- apiKey = window.localStorage.getItem(SERVICES_API_KEY.Gnosisscan);
17263
- _context17.next = 6;
17264
- return handleScanRequest({
17265
- type: type,
17266
- address: address,
17267
- startDate: startDate,
17268
- endDate: endDate,
17269
- page: page,
17270
- offset: limit,
17271
- apiKey: apiKey,
17272
- functionName: "GNOSIS",
17273
- chainId: CHAIN_ID_MAP.gnosis,
17274
- network: "gnosis"
17275
- });
16928
+ type = _ref13.type, address = _ref13.address, startDate = _ref13.startDate, endDate = _ref13.endDate,
16929
+ _ref13$page = _ref13.page, page = _ref13$page === void 0 ? 1 : _ref13$page, _ref13$offset = _ref13.offset,
16930
+ offset = _ref13$offset === void 0 ? 10 : _ref13$offset, apiKey = _ref13.apiKey,
16931
+ functionName = _ref13.functionName, chainId = _ref13.chainId, network = _ref13.network;
16932
+ API_INFO_MAP = {
16933
+ BASE: {
16934
+ url: "https://api.basescan.org/api",
16935
+ apiKeyName: SERVICES_API_KEY.Basescan
16936
+ },
16937
+ ETHERSCAN: {
16938
+ url: "https://api.etherscan.io/v2/api",
16939
+ apiKeyName: SERVICES_API_KEY.Etherscan
16940
+ },
16941
+ GNOSIS: {
16942
+ url: "https://api.gnosisscan.io/api",
16943
+ apiKeyName: SERVICES_API_KEY.Gnosisscan
16944
+ }
16945
+ };
16946
+ if (!(type !== "gas")) {
16947
+ _context17.next = 6;
16948
+ break;
16949
+ }
16950
+ _context17.next = 5;
16951
+ return fromEnsNameToAddress$1.validateAndGetAddress(address);
17276
16952
 
17277
- case 6:
17278
- return _context17.abrupt("return", _context17.sent);
16953
+ case 5:
16954
+ address = _context17.sent;
17279
16955
 
17280
- case 9:
17281
- _context17.prev = 9;
17282
- _context17.t0 = _context17["catch"](0);
17283
- return _context17.abrupt("return", errorMessageHandler(_context17.t0, "GNOSIS"));
16956
+ case 6:
16957
+ apiInfo = API_INFO_MAP[functionName];
16958
+ baseUrl = apiInfo === null || apiInfo === void 0 ? void 0 : apiInfo.url;
16959
+ if (baseUrl) {
16960
+ _context17.next = 10;
16961
+ break;
16962
+ }
16963
+ throw new ValidationError("Api not found for: ".concat(functionName));
17284
16964
 
17285
- case 12:
17286
- case "end":
17287
- return _context17.stop();
17288
- }
17289
- }), _callee17, null, [ [ 0, 9 ] ]);
17290
- })));
17291
- return _GNOSIS.apply(this, arguments);
17292
- }
17293
- function NEYNAR() {
17294
- return _NEYNAR.apply(this, arguments);
17295
- }
17296
- function _NEYNAR() {
17297
- _NEYNAR = _asyncToGenerator(_regeneratorRuntime().mark((function _callee18() {
17298
- var neynarParamsSchema, _argsToArray13, _argsToArray14, username, apiKey, fid, url, _getUrlAndHeaders7, finalUrl, HEADERS, response, json, users, _args18 = arguments;
17299
- return _regeneratorRuntime().wrap((function _callee18$(_context18) {
17300
- while (1) switch (_context18.prev = _context18.next) {
17301
- case 0:
17302
- _context18.prev = 0;
17303
- neynarParamsSchema = objectType({
17304
- username: stringType().nonempty()
17305
- });
17306
- _argsToArray13 = argsToArray(_args18), _argsToArray14 = _slicedToArray(_argsToArray13, 1),
17307
- username = _argsToArray14[0];
17308
- validateParams(neynarParamsSchema, {
17309
- username: username
17310
- });
17311
- apiKey = window.localStorage.getItem(SERVICES_API_KEY.Neynar);
17312
- _context18.next = 7;
17313
- return fromUsernameToFid$1.fromUsernameToFid(username, apiKey);
16965
+ case 10:
16966
+ ACTION_MAP = {
16967
+ "all-txns": "txlist",
16968
+ "token-txns": "tokentx",
16969
+ "nft-txns": "tokennfttx",
16970
+ gas: "gasoracle"
16971
+ };
16972
+ action = ACTION_MAP[type];
16973
+ if (action) {
16974
+ _context17.next = 14;
16975
+ break;
16976
+ }
16977
+ throw new ValidationError("Invalid type: ".concat(type));
17314
16978
 
17315
- case 7:
17316
- fid = _context18.sent;
17317
- if (fid) {
17318
- _context18.next = 10;
16979
+ case 14:
16980
+ module = action === "gasoracle" ? "gastracker" : "account";
16981
+ url = "".concat(baseUrl, "?chainid=").concat(chainId, "&module=").concat(module, "&action=").concat(action, "&apikey=").concat(apiKey);
16982
+ if (![ "all-txns", "token-txns", "nft-txns" ].includes(type)) {
16983
+ _context17.next = 27;
17319
16984
  break;
17320
16985
  }
17321
- throw new ValidationError("Invalid username: ".concat(username));
16986
+ url += "&address=".concat(address, "&startblock=0&endblock=99999999&sort=asc");
16987
+ if (!(!isNaN(startDate) && !isNaN(endDate))) {
16988
+ _context17.next = 26;
16989
+ break;
16990
+ }
16991
+ _context17.next = 21;
16992
+ return Promise.all([ fromTimestampToBlock.fromTimeStampToBlock(toTimestamp(startDate), network, apiKey), fromTimestampToBlock.fromTimeStampToBlock(toTimestamp(endDate), network, apiKey) ]);
17322
16993
 
17323
- case 10:
17324
- url = "https://api.neynar.com/v2/farcaster/followers?fid=".concat(fid);
17325
- _getUrlAndHeaders7 = getUrlAndHeaders({
17326
- url: url.toString(),
17327
- serviceName: "Neynar",
17328
- headers: {
17329
- "x-api-key": apiKey,
17330
- "x-neynar-experimental": "false"
17331
- }
17332
- }), finalUrl = _getUrlAndHeaders7.URL, HEADERS = _getUrlAndHeaders7.HEADERS;
17333
- _context18.next = 14;
16994
+ case 21:
16995
+ _yield$Promise$all = _context17.sent;
16996
+ _yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 2);
16997
+ startBlock = _yield$Promise$all2[0];
16998
+ endBlock = _yield$Promise$all2[1];
16999
+ url += "&startblock=".concat(startBlock || "0", "&endblock=").concat(endBlock || "99999999");
17000
+
17001
+ case 26:
17002
+ url += "&page=".concat(page, "&offset=").concat(offset);
17003
+
17004
+ case 27:
17005
+ _getUrlAndHeaders4 = getUrlAndHeaders({
17006
+ url: url,
17007
+ serviceName: apiInfo.apiKeyName,
17008
+ headers: {}
17009
+ }), finalUrl = _getUrlAndHeaders4.URL, HEADERS = _getUrlAndHeaders4.HEADERS;
17010
+ _context17.next = 30;
17334
17011
  return fetch(finalUrl, {
17335
17012
  method: "GET",
17336
17013
  headers: HEADERS
17337
17014
  });
17338
17015
 
17339
- case 14:
17340
- response = _context18.sent;
17341
- if (response.ok) {
17342
- _context18.next = 17;
17016
+ case 30:
17017
+ res = _context17.sent;
17018
+ if (res.ok) {
17019
+ _context17.next = 33;
17343
17020
  break;
17344
17021
  }
17345
- throw new NetworkError(SERVICES_API_KEY.Neynar, response.status);
17022
+ throw new NetworkError(apiInfo.apiKeyName, res.status);
17346
17023
 
17347
- case 17:
17348
- _context18.next = 19;
17349
- return response.json();
17024
+ case 33:
17025
+ _context17.next = 35;
17026
+ return res.json();
17350
17027
 
17351
- case 19:
17352
- json = _context18.sent;
17353
- users = (json === null || json === void 0 ? void 0 : json.users) || [];
17354
- if (users.length) {
17355
- _context18.next = 23;
17028
+ case 35:
17029
+ json = _context17.sent;
17030
+ if (!(typeof json.result === "string")) {
17031
+ _context17.next = 41;
17032
+ break;
17033
+ }
17034
+ if (!json.result.includes("Invalid API Key")) {
17035
+ _context17.next = 39;
17036
+ break;
17037
+ }
17038
+ throw new InvalidApiKeyError(apiInfo.apiKeyName);
17039
+
17040
+ case 39:
17041
+ if (!json.result.includes("Max rate limit reached")) {
17042
+ _context17.next = 41;
17356
17043
  break;
17357
17044
  }
17358
- return _context18.abrupt("return", []);
17359
-
17360
- case 23:
17361
- return _context18.abrupt("return", users.map((function(_ref15) {
17362
- var _user$profile, _user$profile2;
17363
- var user = _ref15.user;
17364
- return {
17365
- username: user.username,
17366
- custody_address: user.custody_address,
17367
- follower_count: user.follower_count,
17368
- country: ((_user$profile = user.profile) === null || _user$profile === void 0 || (_user$profile = _user$profile.location) === null || _user$profile === void 0 || (_user$profile = _user$profile.address) === null || _user$profile === void 0 ? void 0 : _user$profile.country) || "",
17369
- city: ((_user$profile2 = user.profile) === null || _user$profile2 === void 0 || (_user$profile2 = _user$profile2.location) === null || _user$profile2 === void 0 || (_user$profile2 = _user$profile2.address) === null || _user$profile2 === void 0 ? void 0 : _user$profile2.city) || ""
17370
- };
17371
- })));
17045
+ throw new RateLimitError(apiInfo.apiKeyName);
17372
17046
 
17373
- case 26:
17374
- _context18.prev = 26;
17375
- _context18.t0 = _context18["catch"](0);
17376
- return _context18.abrupt("return", errorMessageHandler(_context18.t0, "NEYNAR"));
17047
+ case 41:
17048
+ return _context17.abrupt("return", type === "gas" && !Array.isArray(json.result) ? [ json.result ] : json.result);
17377
17049
 
17378
- case 29:
17050
+ case 42:
17379
17051
  case "end":
17380
- return _context18.stop();
17052
+ return _context17.stop();
17381
17053
  }
17382
- }), _callee18, null, [ [ 0, 26 ] ]);
17054
+ }), _callee14);
17383
17055
  })));
17384
- return _NEYNAR.apply(this, arguments);
17056
+ return _handleScanRequest.apply(this, arguments);
17385
17057
  }
17386
- function ETHERSCAN() {
17387
- return _ETHERSCAN.apply(this, arguments);
17058
+ function BASE() {
17059
+ return _BASE.apply(this, arguments);
17388
17060
  }
17389
- function _ETHERSCAN() {
17390
- _ETHERSCAN = _asyncToGenerator(_regeneratorRuntime().mark((function _callee19() {
17391
- var _argsToArray15, _argsToArray16, type, chain, address, startDate, endDate, _argsToArray16$, page, _argsToArray16$2, limit, chainId, apiKey, _args19 = arguments;
17392
- return _regeneratorRuntime().wrap((function _callee19$(_context19) {
17393
- while (1) switch (_context19.prev = _context19.next) {
17061
+ function _BASE() {
17062
+ _BASE = _asyncToGenerator(_regeneratorRuntime().mark((function _callee15() {
17063
+ var _argsToArray7, _argsToArray8, type, address, startDate, endDate, page, limit, API_KEY, _args18 = arguments;
17064
+ return _regeneratorRuntime().wrap((function _callee15$(_context18) {
17065
+ while (1) switch (_context18.prev = _context18.next) {
17394
17066
  case 0:
17395
- _context19.prev = 0;
17396
- _argsToArray15 = argsToArray(_args19), _argsToArray16 = _slicedToArray(_argsToArray15, 7),
17397
- type = _argsToArray16[0], chain = _argsToArray16[1], address = _argsToArray16[2],
17398
- startDate = _argsToArray16[3], endDate = _argsToArray16[4], _argsToArray16$ = _argsToArray16[5],
17399
- page = _argsToArray16$ === void 0 ? 1 : _argsToArray16$, _argsToArray16$2 = _argsToArray16[6],
17400
- limit = _argsToArray16$2 === void 0 ? 10 : _argsToArray16$2;
17401
- validateParams(etherscanParamsSchema, {
17067
+ _context18.prev = 0;
17068
+ _argsToArray7 = argsToArray(_args18), _argsToArray8 = _slicedToArray(_argsToArray7, 6),
17069
+ type = _argsToArray8[0], address = _argsToArray8[1], startDate = _argsToArray8[2],
17070
+ endDate = _argsToArray8[3], page = _argsToArray8[4], limit = _argsToArray8[5];
17071
+ validateParams(baseParamsSchema, {
17402
17072
  type: type,
17403
- chain: chain,
17404
17073
  address: address,
17405
17074
  startDate: startDate,
17406
17075
  endDate: endDate,
17407
17076
  page: page,
17408
17077
  limit: limit
17409
17078
  });
17410
- chainId = CHAIN_ID_MAP[chain];
17411
- if (chainId) {
17412
- _context19.next = 6;
17413
- break;
17414
- }
17415
- throw new ValidationError("Invalid chain: ".concat(chain));
17416
-
17417
- case 6:
17418
- apiKey = window.localStorage.getItem(SERVICES_API_KEY.Etherscan);
17419
- _context19.next = 9;
17079
+ API_KEY = window.localStorage.getItem(SERVICES_API_KEY.Basescan);
17080
+ _context18.next = 6;
17420
17081
  return handleScanRequest({
17421
17082
  type: type,
17422
17083
  address: address,
@@ -17424,40 +17085,181 @@ function _typeof(o) {
17424
17085
  endDate: endDate,
17425
17086
  page: page,
17426
17087
  offset: limit,
17427
- apiKey: apiKey,
17428
- functionName: "ETHERSCAN",
17429
- chainId: chainId,
17430
- network: chain
17088
+ apiKey: API_KEY,
17089
+ functionName: "BASE",
17090
+ chainId: CHAIN_ID_MAP.base,
17091
+ network: "base"
17431
17092
  });
17432
17093
 
17094
+ case 6:
17095
+ return _context18.abrupt("return", _context18.sent);
17096
+
17433
17097
  case 9:
17434
- return _context19.abrupt("return", _context19.sent);
17098
+ _context18.prev = 9;
17099
+ _context18.t0 = _context18["catch"](0);
17100
+ return _context18.abrupt("return", errorMessageHandler(_context18.t0, "BASE"));
17101
+
17102
+ case 12:
17103
+ case "end":
17104
+ return _context18.stop();
17105
+ }
17106
+ }), _callee15, null, [ [ 0, 9 ] ]);
17107
+ })));
17108
+ return _BASE.apply(this, arguments);
17109
+ }
17110
+ var blockscoutParamsSchema = objectType({
17111
+ address: stringType().nonempty(),
17112
+ type: enumType([ "stat", "txns", "tokens" ]),
17113
+ chain: enumType([ "ethereum", "gnosis", "arbitrum", "optimism", "soneium", "unichain" ])["default"]("ethereum"),
17114
+ startTimestamp: dateOrTimestamp.optional(),
17115
+ endTimestamp: dateOrTimestamp.optional(),
17116
+ page: numberType()["int"]().nonnegative()["default"](1),
17117
+ offset: numberType()["int"]().nonnegative().max(MAX_PAGE_LIMIT, {
17118
+ message: '"offset" must be less than or equal to '.concat(MAX_PAGE_LIMIT)
17119
+ })["default"](10)
17120
+ });
17121
+ function BLOCKSCOUT() {
17122
+ return _BLOCKSCOUT.apply(this, arguments);
17123
+ }
17124
+ function _BLOCKSCOUT() {
17125
+ _BLOCKSCOUT = _asyncToGenerator(_regeneratorRuntime().mark((function _callee16() {
17126
+ var _json$result, _json$result2, _argsToArray9, _argsToArray0, address, type, _argsToArray0$, chain, startTimestamp, endTimestamp, page, offset, startTs, endTs, resolvedAddress, hostname, requestUrl, response, json, _args19 = arguments;
17127
+ return _regeneratorRuntime().wrap((function _callee16$(_context19) {
17128
+ while (1) switch (_context19.prev = _context19.next) {
17129
+ case 0:
17130
+ _context19.prev = 0;
17131
+ _argsToArray9 = argsToArray(_args19), _argsToArray0 = _slicedToArray(_argsToArray9, 7),
17132
+ address = _argsToArray0[0], type = _argsToArray0[1], _argsToArray0$ = _argsToArray0[2],
17133
+ chain = _argsToArray0$ === void 0 ? "ethereum" : _argsToArray0$, startTimestamp = _argsToArray0[3],
17134
+ endTimestamp = _argsToArray0[4], page = _argsToArray0[5], offset = _argsToArray0[6];
17135
+ validateParams(blockscoutParamsSchema, {
17136
+ address: address,
17137
+ type: type,
17138
+ chain: chain,
17139
+ startTimestamp: startTimestamp,
17140
+ endTimestamp: endTimestamp,
17141
+ page: page,
17142
+ offset: offset
17143
+ });
17144
+ startTs = startTimestamp !== null && startTimestamp !== void 0 ? startTimestamp : Math.floor((Date.now() - 30 * 24 * 3600 * 1e3) / 1e3);
17145
+ endTs = endTimestamp;
17146
+ _context19.next = 7;
17147
+ return fromEnsNameToAddress$1.validateAndGetAddress(address);
17148
+
17149
+ case 7:
17150
+ resolvedAddress = _context19.sent;
17151
+ hostname = BLOCKSCOUT_CHAINS_MAP[chain];
17152
+ _context19.t0 = type;
17153
+ _context19.next = _context19.t0 === "stat" ? 12 : _context19.t0 === "txns" ? 14 : _context19.t0 === "tokens" ? 16 : 18;
17154
+ break;
17435
17155
 
17436
17156
  case 12:
17437
- _context19.prev = 12;
17438
- _context19.t0 = _context19["catch"](0);
17439
- return _context19.abrupt("return", errorMessageHandler(_context19.t0, "ETHERSCAN"));
17157
+ requestUrl = "".concat(hostname, "/api/v2/addresses/").concat(resolvedAddress, "/counters");
17158
+ return _context19.abrupt("break", 18);
17440
17159
 
17441
- case 15:
17160
+ case 14:
17161
+ 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";
17162
+ return _context19.abrupt("break", 18);
17163
+
17164
+ case 16:
17165
+ requestUrl = "".concat(hostname, "/api?module=account&action=tokenlist") + "&address=".concat(resolvedAddress);
17166
+ return _context19.abrupt("break", 18);
17167
+
17168
+ case 18:
17169
+ _context19.next = 20;
17170
+ return fetch(requestUrl);
17171
+
17172
+ case 20:
17173
+ response = _context19.sent;
17174
+ if (response.ok) {
17175
+ _context19.next = 23;
17176
+ break;
17177
+ }
17178
+ throw new NetworkError("BLOCKSCOUT", response.status);
17179
+
17180
+ case 23:
17181
+ _context19.next = 25;
17182
+ return response.json();
17183
+
17184
+ case 25:
17185
+ json = _context19.sent;
17186
+ if (!(json !== null && json !== void 0 && (_json$result = json.result) !== null && _json$result !== void 0 && _json$result.includes("Invalid parameter(s)"))) {
17187
+ _context19.next = 28;
17188
+ break;
17189
+ }
17190
+ throw new ValidationError("Invalid parameters");
17191
+
17192
+ case 28:
17193
+ if (!(json !== null && json !== void 0 && (_json$result2 = json.result) !== null && _json$result2 !== void 0 && _json$result2.includes("Not found"))) {
17194
+ _context19.next = 30;
17195
+ break;
17196
+ }
17197
+ throw new ValidationError("Address information not found");
17198
+
17199
+ case 30:
17200
+ return _context19.abrupt("return", type === "stat" ? [ json ] : json.result);
17201
+
17202
+ case 33:
17203
+ _context19.prev = 33;
17204
+ _context19.t1 = _context19["catch"](0);
17205
+ return _context19.abrupt("return", errorMessageHandler(_context19.t1, "BLOCKSCOUT"));
17206
+
17207
+ case 36:
17442
17208
  case "end":
17443
17209
  return _context19.stop();
17444
17210
  }
17445
- }), _callee19, null, [ [ 0, 12 ] ]);
17211
+ }), _callee16, null, [ [ 0, 33 ] ]);
17446
17212
  })));
17447
- return _ETHERSCAN.apply(this, arguments);
17213
+ return _BLOCKSCOUT.apply(this, arguments);
17448
17214
  }
17215
+ var allowedValues = [ "1h", "24h", "7d" ];
17216
+ var param2Schema = stringType().refine((function(val) {
17217
+ var tokens = val.split(",").map((function(t) {
17218
+ return t.trim().toLowerCase();
17219
+ }));
17220
+ return tokens.some((function(token) {
17221
+ return allowedValues.some((function(allowed) {
17222
+ return token.includes(allowed);
17223
+ }));
17224
+ }));
17225
+ }), {
17226
+ message: "param2 must contain at least one of: '1h', '24h', '7d'"
17227
+ }).optional();
17228
+ var priceSchema = objectType({
17229
+ category: literalType("price"),
17230
+ param1: stringType().nonempty(),
17231
+ param2: stringType().nonempty().optional()
17232
+ });
17233
+ var marketEcosystems = [ "all", "base", "meme", "aiagents", "bitcoin", "ethereum", "hyperliquid", "pump", "solana" ];
17234
+ var marketSchema = objectType({
17235
+ category: literalType("market"),
17236
+ param1: enumType(marketEcosystems),
17237
+ param2: param2Schema
17238
+ });
17239
+ var stablecoinsTypes = [ "all", "yield-bearing-stablecoins", "crypto-backed-stablecoin" ];
17240
+ var stablecoinsSchema = objectType({
17241
+ category: literalType("stablecoins"),
17242
+ param1: enumType(stablecoinsTypes),
17243
+ param2: param2Schema
17244
+ });
17245
+ var derivativesSchema = objectType({
17246
+ category: literalType("derivatives"),
17247
+ param1: stringType().nonempty(),
17248
+ param2: anyType().optional()
17249
+ });
17250
+ var coingeckoParamsSchema = discriminatedUnionType("category", [ priceSchema, marketSchema, stablecoinsSchema, derivativesSchema ]);
17449
17251
  function COINGECKO() {
17450
17252
  return _COINGECKO.apply(this, arguments);
17451
17253
  }
17452
17254
  function _COINGECKO() {
17453
- _COINGECKO = _asyncToGenerator(_regeneratorRuntime().mark((function _callee20() {
17454
- var _category$toLowerCase, _argsToArray17, _argsToArray18, category, param1, param2, apiKey, headers, url, vs, map, _category, trend, _category2, _trend, _getUrlAndHeaders8, finalUrl, HEADERS, res, json, _json$status, msg, out, _i13, _Object$entries4, _Object$entries4$_i, token, prices, _i14, _Object$entries5, _Object$entries5$_i, cur, val, _data4, _args20 = arguments;
17455
- return _regeneratorRuntime().wrap((function _callee20$(_context20) {
17255
+ _COINGECKO = _asyncToGenerator(_regeneratorRuntime().mark((function _callee17() {
17256
+ 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;
17257
+ return _regeneratorRuntime().wrap((function _callee17$(_context20) {
17456
17258
  while (1) switch (_context20.prev = _context20.next) {
17457
17259
  case 0:
17458
17260
  _context20.prev = 0;
17459
- _argsToArray17 = argsToArray(_args20), _argsToArray18 = _slicedToArray(_argsToArray17, 3),
17460
- category = _argsToArray18[0], param1 = _argsToArray18[1], param2 = _argsToArray18[2];
17261
+ _argsToArray1 = argsToArray(_args20), _argsToArray10 = _slicedToArray(_argsToArray1, 3),
17262
+ category = _argsToArray10[0], param1 = _argsToArray10[1], param2 = _argsToArray10[2];
17461
17263
  validateParams(coingeckoParamsSchema, {
17462
17264
  category: category,
17463
17265
  param1: param1,
@@ -17506,11 +17308,11 @@ function _typeof(o) {
17506
17308
  return _context20.abrupt("break", 23);
17507
17309
 
17508
17310
  case 23:
17509
- _getUrlAndHeaders8 = getUrlAndHeaders({
17311
+ _getUrlAndHeaders5 = getUrlAndHeaders({
17510
17312
  url: url,
17511
17313
  serviceName: "Coingecko",
17512
17314
  headers: headers
17513
- }), finalUrl = _getUrlAndHeaders8.URL, HEADERS = _getUrlAndHeaders8.HEADERS;
17315
+ }), finalUrl = _getUrlAndHeaders5.URL, HEADERS = _getUrlAndHeaders5.HEADERS;
17514
17316
  _context20.next = 26;
17515
17317
  return fetch(finalUrl, {
17516
17318
  headers: HEADERS
@@ -17543,25 +17345,25 @@ function _typeof(o) {
17543
17345
  break;
17544
17346
  }
17545
17347
  out = {};
17546
- for (_i13 = 0, _Object$entries4 = Object.entries(json); _i13 < _Object$entries4.length; _i13++) {
17547
- _Object$entries4$_i = _slicedToArray(_Object$entries4[_i13], 2), token = _Object$entries4$_i[0],
17548
- prices = _Object$entries4$_i[1];
17549
- for (_i14 = 0, _Object$entries5 = Object.entries(prices); _i14 < _Object$entries5.length; _i14++) {
17550
- _Object$entries5$_i = _slicedToArray(_Object$entries5[_i14], 2), cur = _Object$entries5$_i[0],
17551
- val = _Object$entries5$_i[1];
17348
+ for (_i11 = 0, _Object$entries = Object.entries(json); _i11 < _Object$entries.length; _i11++) {
17349
+ _Object$entries$_i = _slicedToArray(_Object$entries[_i11], 2), token = _Object$entries$_i[0],
17350
+ prices = _Object$entries$_i[1];
17351
+ for (_i12 = 0, _Object$entries2 = Object.entries(prices); _i12 < _Object$entries2.length; _i12++) {
17352
+ _Object$entries2$_i = _slicedToArray(_Object$entries2[_i12], 2), cur = _Object$entries2$_i[0],
17353
+ val = _Object$entries2$_i[1];
17552
17354
  out["".concat(token.charAt(0).toUpperCase() + token.slice(1), "_").concat(cur.toUpperCase())] = val;
17553
17355
  }
17554
17356
  }
17555
17357
  return _context20.abrupt("return", [ out ]);
17556
17358
 
17557
17359
  case 39:
17558
- _data4 = Array.isArray(json) ? json : [ json ];
17559
- return _context20.abrupt("return", _data4.map((function(item) {
17360
+ _data = Array.isArray(json) ? json : [ json ];
17361
+ return _context20.abrupt("return", _data.map((function(item) {
17560
17362
  var flat = {};
17561
- for (var _i15 = 0, _Object$entries6 = Object.entries(item); _i15 < _Object$entries6.length; _i15++) {
17562
- var _Object$entries6$_i = _slicedToArray(_Object$entries6[_i15], 2), key = _Object$entries6$_i[0], _value13 = _Object$entries6$_i[1];
17563
- if (_typeof(_value13) !== "object" || _value13 === null) {
17564
- flat[key] = _value13;
17363
+ for (var _i13 = 0, _Object$entries3 = Object.entries(item); _i13 < _Object$entries3.length; _i13++) {
17364
+ var _Object$entries3$_i = _slicedToArray(_Object$entries3[_i13], 2), key = _Object$entries3$_i[0], _value11 = _Object$entries3$_i[1];
17365
+ if (_typeof(_value11) !== "object" || _value11 === null) {
17366
+ flat[key] = _value11;
17565
17367
  }
17566
17368
  }
17567
17369
  return flat;
@@ -17576,476 +17378,694 @@ function _typeof(o) {
17576
17378
  case "end":
17577
17379
  return _context20.stop();
17578
17380
  }
17579
- }), _callee20, null, [ [ 0, 43 ] ]);
17381
+ }), _callee17, null, [ [ 0, 43 ] ]);
17580
17382
  })));
17581
17383
  return _COINGECKO.apply(this, arguments);
17582
17384
  }
17583
- function EOA() {
17584
- return _EOA.apply(this, arguments);
17385
+ var categories = [ "protocols", "yields", "dex", "fees" ];
17386
+ var defillamaParamsSchema = objectType({
17387
+ category: enumType(categories)
17388
+ });
17389
+ var CATEGORY_URLS = {
17390
+ protocols: "https://api.llama.fi/protocols",
17391
+ yields: "https://yields.llama.fi/pools",
17392
+ dex: "https://api.llama.fi/overview/dexs?excludeTotalDataChart=true&excludeTotalDataChartBreakdown=true",
17393
+ fees: "https://api.llama.fi/overview/fees?excludeTotalDataChart=true&excludeTotalDataChartBreakdown=true&dataType=dailyFees"
17394
+ };
17395
+ function DEFILLAMA() {
17396
+ return _DEFILLAMA.apply(this, arguments);
17585
17397
  }
17586
- function _EOA() {
17587
- _EOA = _asyncToGenerator(_regeneratorRuntime().mark((function _callee22() {
17588
- var fetchJSON, _argsToArray19, _argsToArray20, addresses, category, chains, startTime, endTime, _argsToArray20$, page, _argsToArray20$2, offset, apiKey, INPUTS, CHAINS, ADDRESS_MAP, _iterator41, _step41, inp, _address, ADDRS, out, _iterator42, _step42, _loop, _ret, _args25 = arguments;
17589
- return _regeneratorRuntime().wrap((function _callee22$(_context25) {
17590
- while (1) switch (_context25.prev = _context25.next) {
17398
+ function _DEFILLAMA() {
17399
+ _DEFILLAMA = _asyncToGenerator(_regeneratorRuntime().mark((function _callee18() {
17400
+ var _argsToArray11, _argsToArray12, category, url, res, json, _args21 = arguments;
17401
+ return _regeneratorRuntime().wrap((function _callee18$(_context21) {
17402
+ while (1) switch (_context21.prev = _context21.next) {
17591
17403
  case 0:
17592
- _context25.prev = 0;
17593
- fetchJSON = function() {
17594
- var _ref16 = _asyncToGenerator(_regeneratorRuntime().mark((function _callee21(url) {
17595
- var _getUrlAndHeaders9, finalUrl, HEADERS, res, json;
17596
- return _regeneratorRuntime().wrap((function _callee21$(_context21) {
17597
- while (1) switch (_context21.prev = _context21.next) {
17598
- case 0:
17599
- _getUrlAndHeaders9 = getUrlAndHeaders({
17600
- url: url,
17601
- serviceName: "Etherscan",
17602
- headers: {}
17603
- }), finalUrl = _getUrlAndHeaders9.URL, HEADERS = _getUrlAndHeaders9.HEADERS;
17604
- _context21.next = 3;
17605
- return fetch(finalUrl, {
17606
- method: "GET",
17607
- headers: HEADERS
17608
- });
17609
-
17610
- case 3:
17611
- res = _context21.sent;
17612
- if (res.ok) {
17613
- _context21.next = 6;
17614
- break;
17615
- }
17616
- throw new NetworkError(SERVICES_API_KEY.Etherscan, res.status);
17617
-
17618
- case 6:
17619
- _context21.next = 8;
17620
- return res.json();
17621
-
17622
- case 8:
17623
- json = _context21.sent;
17624
- if (!(typeof json.result === "string")) {
17625
- _context21.next = 14;
17626
- break;
17627
- }
17628
- if (!json.result.includes("Invalid API Key")) {
17629
- _context21.next = 12;
17630
- break;
17631
- }
17632
- throw new InvalidApiKeyError(SERVICES_API_KEY.Etherscan);
17633
-
17634
- case 12:
17635
- if (!json.result.includes("Max rate limit reached")) {
17636
- _context21.next = 14;
17637
- break;
17638
- }
17639
- throw new RateLimitError(SERVICES_API_KEY.Etherscan);
17640
-
17641
- case 14:
17642
- return _context21.abrupt("return", json.result);
17643
-
17644
- case 15:
17645
- case "end":
17646
- return _context21.stop();
17647
- }
17648
- }), _callee21);
17649
- })));
17650
- return function fetchJSON(_x18) {
17651
- return _ref16.apply(this, arguments);
17652
- };
17653
- }();
17654
- _argsToArray19 = argsToArray(_args25), _argsToArray20 = _slicedToArray(_argsToArray19, 7),
17655
- addresses = _argsToArray20[0], category = _argsToArray20[1], chains = _argsToArray20[2],
17656
- startTime = _argsToArray20[3], endTime = _argsToArray20[4], _argsToArray20$ = _argsToArray20[5],
17657
- page = _argsToArray20$ === void 0 ? 1 : _argsToArray20$, _argsToArray20$2 = _argsToArray20[6],
17658
- offset = _argsToArray20$2 === void 0 ? 10 : _argsToArray20$2;
17659
- validateParams(eoaParamsSchema, {
17660
- addresses: addresses,
17661
- category: category,
17662
- chains: chains,
17663
- startTime: startTime,
17664
- endTime: endTime,
17665
- page: page,
17666
- offset: offset
17404
+ _context21.prev = 0;
17405
+ _argsToArray11 = argsToArray(_args21), _argsToArray12 = _slicedToArray(_argsToArray11, 1),
17406
+ category = _argsToArray12[0];
17407
+ validateParams(defillamaParamsSchema, {
17408
+ category: category
17667
17409
  });
17668
- apiKey = window.localStorage.getItem(SERVICES_API_KEY.Etherscan);
17669
- INPUTS = addresses.split(",").map((function(s) {
17670
- return s.trim();
17671
- })).filter(Boolean);
17672
- CHAINS = chains.split(",").map((function(s) {
17673
- return s.trim();
17674
- })).filter(Boolean);
17675
- ADDRESS_MAP = {};
17676
- _iterator41 = _createForOfIteratorHelper(INPUTS);
17677
- _context25.prev = 9;
17678
- _iterator41.s();
17679
-
17680
- case 11:
17681
- if ((_step41 = _iterator41.n()).done) {
17682
- _context25.next = 23;
17410
+ url = CATEGORY_URLS[category];
17411
+ if (url) {
17412
+ _context21.next = 6;
17683
17413
  break;
17684
17414
  }
17685
- inp = _step41.value;
17686
- if (!isAddress$1.isAddress(inp)) {
17687
- _context25.next = 17;
17415
+ throw new ValidationError("Invalid category: ".concat(category));
17416
+
17417
+ case 6:
17418
+ _context21.next = 8;
17419
+ return fetch(url);
17420
+
17421
+ case 8:
17422
+ res = _context21.sent;
17423
+ if (res.ok) {
17424
+ _context21.next = 11;
17688
17425
  break;
17689
17426
  }
17690
- ADDRESS_MAP[inp.toLowerCase()] = null;
17691
- _context25.next = 21;
17427
+ throw new NetworkError(SERVICES_API_KEY.Defillama, res.status);
17428
+
17429
+ case 11:
17430
+ _context21.next = 13;
17431
+ return res.json();
17432
+
17433
+ case 13:
17434
+ json = _context21.sent;
17435
+ _context21.t0 = category;
17436
+ _context21.next = _context21.t0 === "protocols" ? 17 : _context21.t0 === "yields" ? 19 : _context21.t0 === "dex" ? 21 : _context21.t0 === "fees" ? 21 : 23;
17692
17437
  break;
17693
17438
 
17694
17439
  case 17:
17695
- _context25.next = 19;
17696
- return fromEnsNameToAddress$1.validateAndGetAddress(inp);
17440
+ json = Array.isArray(json) ? json.slice(0, 500) : [];
17441
+ return _context21.abrupt("break", 23);
17697
17442
 
17698
17443
  case 19:
17699
- _address = _context25.sent;
17700
- ADDRESS_MAP[_address.toLowerCase()] = _address;
17444
+ json = Array.isArray(json.data) ? json.data.slice(0, 500) : [];
17445
+ return _context21.abrupt("break", 23);
17701
17446
 
17702
17447
  case 21:
17703
- _context25.next = 11;
17704
- break;
17448
+ json = Array.isArray(json.protocols) ? json.protocols.slice(0, 500) : [];
17449
+ return _context21.abrupt("break", 23);
17705
17450
 
17706
17451
  case 23:
17707
- _context25.next = 28;
17708
- break;
17709
-
17710
- case 25:
17711
- _context25.prev = 25;
17712
- _context25.t0 = _context25["catch"](9);
17713
- _iterator41.e(_context25.t0);
17714
-
17715
- case 28:
17716
- _context25.prev = 28;
17717
- _iterator41.f();
17718
- return _context25.finish(28);
17719
-
17720
- case 31:
17721
- ADDRS = Object.keys(ADDRESS_MAP);
17722
- out = [];
17723
- _iterator42 = _createForOfIteratorHelper(CHAINS);
17724
- _context25.prev = 34;
17725
- _loop = _regeneratorRuntime().mark((function _loop() {
17726
- var chain, chainId, _loop2, _ret2, i, sb, eb, _loop3, _ret3, _i16, _ADDRS;
17727
- return _regeneratorRuntime().wrap((function _loop$(_context24) {
17728
- while (1) switch (_context24.prev = _context24.next) {
17729
- case 0:
17730
- chain = _step42.value;
17731
- chainId = CHAIN_ID_MAP[chain];
17732
- if (chainId) {
17733
- _context24.next = 4;
17734
- break;
17735
- }
17736
- throw new ValidationError("Invalid chain: ".concat(chain));
17737
-
17738
- case 4:
17739
- if (!(category === "balance")) {
17740
- _context24.next = 17;
17741
- break;
17742
- }
17743
- _loop2 = _regeneratorRuntime().mark((function _loop2(i) {
17744
- var slice, url, data;
17745
- return _regeneratorRuntime().wrap((function _loop2$(_context22) {
17746
- while (1) switch (_context22.prev = _context22.next) {
17747
- case 0:
17748
- slice = ADDRS.slice(i, i + 20).join(",");
17749
- 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);
17750
- _context22.next = 4;
17751
- return fetchJSON(url);
17752
-
17753
- case 4:
17754
- data = _context22.sent;
17755
- if (Array.isArray(data)) {
17756
- _context22.next = 7;
17757
- break;
17758
- }
17759
- return _context22.abrupt("return", {
17760
- v: {
17761
- v: data
17762
- }
17763
- });
17764
-
17765
- case 7:
17766
- data.forEach((function(item, idx) {
17767
- return out.push(_objectSpread({
17768
- chain: chain,
17769
- address: ADDRS[i + idx],
17770
- name: ADDRESS_MAP[ADDRS[i + idx]]
17771
- }, item));
17772
- }));
17773
-
17774
- case 8:
17775
- case "end":
17776
- return _context22.stop();
17777
- }
17778
- }), _loop2);
17779
- }));
17780
- i = 0;
17781
-
17782
- case 7:
17783
- if (!(i < ADDRS.length)) {
17784
- _context24.next = 15;
17785
- break;
17786
- }
17787
- return _context24.delegateYield(_loop2(i), "t0", 9);
17788
-
17789
- case 9:
17790
- _ret2 = _context24.t0;
17791
- if (!_ret2) {
17792
- _context24.next = 12;
17793
- break;
17794
- }
17795
- return _context24.abrupt("return", _ret2.v);
17796
-
17797
- case 12:
17798
- i += 20;
17799
- _context24.next = 7;
17800
- break;
17801
-
17802
- case 15:
17803
- _context24.next = 37;
17804
- break;
17452
+ return _context21.abrupt("return", (Array.isArray(json) ? json : [ json ]).map((function(item) {
17453
+ var out = {};
17454
+ for (var _i14 = 0, _Object$entries4 = Object.entries(item); _i14 < _Object$entries4.length; _i14++) {
17455
+ var _Object$entries4$_i = _slicedToArray(_Object$entries4[_i14], 2), k = _Object$entries4$_i[0], v = _Object$entries4$_i[1];
17456
+ if (v === null || _typeof(v) !== "object") out[k] = v;
17457
+ }
17458
+ return out;
17459
+ })));
17805
17460
 
17806
- case 17:
17807
- _context24.next = 19;
17808
- return fromTimestampToBlock.fromTimeStampToBlock(toTimestamp(startTime), chain, apiKey);
17461
+ case 26:
17462
+ _context21.prev = 26;
17463
+ _context21.t1 = _context21["catch"](0);
17464
+ return _context21.abrupt("return", errorMessageHandler(_context21.t1, "DEFILLAMA"));
17809
17465
 
17810
- case 19:
17811
- sb = _context24.sent;
17812
- _context24.next = 22;
17813
- return fromTimestampToBlock.fromTimeStampToBlock(toTimestamp(endTime), chain, apiKey);
17466
+ case 29:
17467
+ case "end":
17468
+ return _context21.stop();
17469
+ }
17470
+ }), _callee18, null, [ [ 0, 26 ] ]);
17471
+ })));
17472
+ return _DEFILLAMA.apply(this, arguments);
17473
+ }
17474
+ var gasSchema = objectType({
17475
+ type: literalType("gas"),
17476
+ startDate: dateOrTimestamp.optional(),
17477
+ endDate: dateOrTimestamp.optional(),
17478
+ page: numberType()["int"]().nonnegative()["default"](1),
17479
+ limit: numberType()["int"]().nonnegative().max(MAX_PAGE_LIMIT, {
17480
+ message: '"limit" must be less than or equal to '.concat(MAX_PAGE_LIMIT)
17481
+ })["default"](10)
17482
+ });
17483
+ var txnSchema = objectType({
17484
+ type: enumType([ "all-txns", "token-txns", "nft-txns" ]),
17485
+ address: stringType().nonempty(),
17486
+ startDate: dateOrTimestamp.optional(),
17487
+ endDate: dateOrTimestamp.optional(),
17488
+ chain: enumType([ "ethereum", "base", "gnosis" ]),
17489
+ page: numberType()["int"]().nonnegative()["default"](1),
17490
+ limit: numberType()["int"]().nonnegative().max(MAX_PAGE_LIMIT, {
17491
+ message: '"limit" must be less than or equal to '.concat(MAX_PAGE_LIMIT)
17492
+ })["default"](10)
17493
+ });
17494
+ var etherscanParamsSchema = discriminatedUnionType("type", [ gasSchema, txnSchema ]);
17495
+ function ETHERSCAN() {
17496
+ return _ETHERSCAN.apply(this, arguments);
17497
+ }
17498
+ function _ETHERSCAN() {
17499
+ _ETHERSCAN = _asyncToGenerator(_regeneratorRuntime().mark((function _callee19() {
17500
+ var _argsToArray13, _argsToArray14, type, chain, address, startDate, endDate, _argsToArray14$, page, _argsToArray14$2, limit, chainId, apiKey, _args22 = arguments;
17501
+ return _regeneratorRuntime().wrap((function _callee19$(_context22) {
17502
+ while (1) switch (_context22.prev = _context22.next) {
17503
+ case 0:
17504
+ _context22.prev = 0;
17505
+ _argsToArray13 = argsToArray(_args22), _argsToArray14 = _slicedToArray(_argsToArray13, 7),
17506
+ type = _argsToArray14[0], chain = _argsToArray14[1], address = _argsToArray14[2],
17507
+ startDate = _argsToArray14[3], endDate = _argsToArray14[4], _argsToArray14$ = _argsToArray14[5],
17508
+ page = _argsToArray14$ === void 0 ? 1 : _argsToArray14$, _argsToArray14$2 = _argsToArray14[6],
17509
+ limit = _argsToArray14$2 === void 0 ? 10 : _argsToArray14$2;
17510
+ validateParams(etherscanParamsSchema, {
17511
+ type: type,
17512
+ chain: chain,
17513
+ address: address,
17514
+ startDate: startDate,
17515
+ endDate: endDate,
17516
+ page: page,
17517
+ limit: limit
17518
+ });
17519
+ chainId = CHAIN_ID_MAP[chain];
17520
+ if (chainId) {
17521
+ _context22.next = 6;
17522
+ break;
17523
+ }
17524
+ throw new ValidationError("Invalid chain: ".concat(chain));
17814
17525
 
17815
- case 22:
17816
- eb = _context24.sent;
17817
- if (sb) {
17818
- _context24.next = 25;
17819
- break;
17820
- }
17821
- throw new ValidationError("Invalid startTime: ".concat(startTime));
17526
+ case 6:
17527
+ apiKey = window.localStorage.getItem(SERVICES_API_KEY.Etherscan);
17528
+ _context22.next = 9;
17529
+ return handleScanRequest({
17530
+ type: type,
17531
+ address: address,
17532
+ startDate: startDate,
17533
+ endDate: endDate,
17534
+ page: page,
17535
+ offset: limit,
17536
+ apiKey: apiKey,
17537
+ functionName: "ETHERSCAN",
17538
+ chainId: chainId,
17539
+ network: chain
17540
+ });
17822
17541
 
17823
- case 25:
17824
- if (eb) {
17825
- _context24.next = 27;
17826
- break;
17827
- }
17828
- throw new ValidationError("Invalid endTime: ".concat(endTime));
17542
+ case 9:
17543
+ return _context22.abrupt("return", _context22.sent);
17829
17544
 
17830
- case 27:
17831
- _loop3 = _regeneratorRuntime().mark((function _loop3() {
17832
- var addr, url, data;
17833
- return _regeneratorRuntime().wrap((function _loop3$(_context23) {
17834
- while (1) switch (_context23.prev = _context23.next) {
17835
- case 0:
17836
- addr = _ADDRS[_i16];
17837
- 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);
17838
- _context23.next = 4;
17839
- return fetchJSON(url);
17545
+ case 12:
17546
+ _context22.prev = 12;
17547
+ _context22.t0 = _context22["catch"](0);
17548
+ return _context22.abrupt("return", errorMessageHandler(_context22.t0, "ETHERSCAN"));
17840
17549
 
17841
- case 4:
17842
- data = _context23.sent;
17843
- if (Array.isArray(data)) {
17844
- _context23.next = 7;
17845
- break;
17846
- }
17847
- return _context23.abrupt("return", {
17848
- v: {
17849
- v: data
17850
- }
17851
- });
17550
+ case 15:
17551
+ case "end":
17552
+ return _context22.stop();
17553
+ }
17554
+ }), _callee19, null, [ [ 0, 12 ] ]);
17555
+ })));
17556
+ return _ETHERSCAN.apply(this, arguments);
17557
+ }
17558
+ var farcasterParamsSchema = objectType({
17559
+ contentType: enumType([ "posts", "replies", "channels" ]),
17560
+ identifier: stringType().nonempty(),
17561
+ start: numberType()["int"]().nonnegative()["default"](0),
17562
+ end: numberType()["int"]().nonnegative().max(MAX_PAGE_LIMIT, {
17563
+ message: '"end" must be less than or equal to '.concat(MAX_PAGE_LIMIT)
17564
+ })["default"](10)
17565
+ });
17566
+ function FARCASTER() {
17567
+ return _FARCASTER.apply(this, arguments);
17568
+ }
17569
+ function _FARCASTER() {
17570
+ _FARCASTER = _asyncToGenerator(_regeneratorRuntime().mark((function _callee20() {
17571
+ var _argsToArray15, _argsToArray16, contentType, identifier, _argsToArray16$, start, _argsToArray16$2, end, apiKey, url, typeMap, _getUrlAndHeaders6, finalUrl, HEADERS, response, _yield$response$json, _data2, _args23 = arguments;
17572
+ return _regeneratorRuntime().wrap((function _callee20$(_context23) {
17573
+ while (1) switch (_context23.prev = _context23.next) {
17574
+ case 0:
17575
+ _context23.prev = 0;
17576
+ _argsToArray15 = argsToArray(_args23), _argsToArray16 = _slicedToArray(_argsToArray15, 4),
17577
+ contentType = _argsToArray16[0], identifier = _argsToArray16[1], _argsToArray16$ = _argsToArray16[2],
17578
+ start = _argsToArray16$ === void 0 ? 0 : _argsToArray16$, _argsToArray16$2 = _argsToArray16[3],
17579
+ end = _argsToArray16$2 === void 0 ? 10 : _argsToArray16$2;
17580
+ validateParams(farcasterParamsSchema, {
17581
+ contentType: contentType,
17582
+ identifier: identifier,
17583
+ start: start,
17584
+ end: end
17585
+ });
17586
+ apiKey = window.localStorage.getItem(SERVICES_API_KEY.Firefly);
17587
+ url = new URL("https://openapi.firefly.land/v1/fileverse/fetch");
17588
+ url.searchParams.set("query", identifier.split(",").map((function(s) {
17589
+ return s.trim();
17590
+ })).filter(Boolean).join(","));
17591
+ typeMap = {
17592
+ posts: "farcasterid",
17593
+ replies: "farcasterpostid",
17594
+ channels: "farcasterchannels"
17595
+ };
17596
+ url.searchParams.set("type", typeMap[contentType]);
17597
+ url.searchParams.set("start", String(start));
17598
+ url.searchParams.set("end", String(end));
17599
+ _getUrlAndHeaders6 = getUrlAndHeaders({
17600
+ url: url.toString(),
17601
+ serviceName: "Firefly",
17602
+ headers: {
17603
+ "x-api-key": apiKey
17604
+ }
17605
+ }), finalUrl = _getUrlAndHeaders6.URL, HEADERS = _getUrlAndHeaders6.HEADERS;
17606
+ _context23.next = 13;
17607
+ return fetch(finalUrl, {
17608
+ method: "GET",
17609
+ headers: HEADERS
17610
+ });
17852
17611
 
17853
- case 7:
17854
- data.forEach((function(item) {
17855
- return out.push(_objectSpread({
17856
- chain: chain,
17857
- address: addr,
17858
- name: ADDRESS_MAP[addr]
17859
- }, item));
17860
- }));
17612
+ case 13:
17613
+ response = _context23.sent;
17614
+ if (response.ok) {
17615
+ _context23.next = 16;
17616
+ break;
17617
+ }
17618
+ throw new NetworkError(SERVICES_API_KEY.Firefly, response.status);
17861
17619
 
17862
- case 8:
17863
- case "end":
17864
- return _context23.stop();
17865
- }
17866
- }), _loop3);
17867
- }));
17868
- _i16 = 0, _ADDRS = ADDRS;
17620
+ case 16:
17621
+ _context23.next = 18;
17622
+ return response.json();
17869
17623
 
17870
- case 29:
17871
- if (!(_i16 < _ADDRS.length)) {
17872
- _context24.next = 37;
17873
- break;
17874
- }
17875
- return _context24.delegateYield(_loop3(), "t1", 31);
17624
+ case 18:
17625
+ _yield$response$json = _context23.sent;
17626
+ _data2 = _yield$response$json.data;
17627
+ if (Array.isArray(_data2)) {
17628
+ _context23.next = 22;
17629
+ break;
17630
+ }
17631
+ return _context23.abrupt("return", []);
17876
17632
 
17877
- case 31:
17878
- _ret3 = _context24.t1;
17879
- if (!_ret3) {
17880
- _context24.next = 34;
17881
- break;
17882
- }
17883
- return _context24.abrupt("return", _ret3.v);
17633
+ case 22:
17634
+ return _context23.abrupt("return", _data2.map((function(item) {
17635
+ var flat = {};
17636
+ for (var _i15 = 0, _Object$entries5 = Object.entries(item); _i15 < _Object$entries5.length; _i15++) {
17637
+ var _Object$entries5$_i = _slicedToArray(_Object$entries5[_i15], 2), k = _Object$entries5$_i[0], v = _Object$entries5$_i[1];
17638
+ if (v == null || _typeof(v) !== "object") {
17639
+ flat[k] = v;
17640
+ }
17641
+ }
17642
+ flat.platform = "farcaster";
17643
+ return flat;
17644
+ })));
17884
17645
 
17885
- case 34:
17886
- _i16++;
17887
- _context24.next = 29;
17888
- break;
17646
+ case 25:
17647
+ _context23.prev = 25;
17648
+ _context23.t0 = _context23["catch"](0);
17649
+ return _context23.abrupt("return", errorMessageHandler(_context23.t0, "FARCASTER"));
17889
17650
 
17890
- case 37:
17891
- case "end":
17892
- return _context24.stop();
17893
- }
17894
- }), _loop);
17895
- }));
17896
- _iterator42.s();
17651
+ case 28:
17652
+ case "end":
17653
+ return _context23.stop();
17654
+ }
17655
+ }), _callee20, null, [ [ 0, 25 ] ]);
17656
+ })));
17657
+ return _FARCASTER.apply(this, arguments);
17658
+ }
17659
+ var farcasterSchema = objectType({
17660
+ platform: literalType("farcaster"),
17661
+ contentType: enumType([ "posts", "replies", "channels" ]),
17662
+ identifier: stringType().nonempty(),
17663
+ start: numberType()["int"]().nonnegative()["default"](0),
17664
+ end: numberType()["int"]().nonnegative().max(MAX_PAGE_LIMIT, {
17665
+ message: '"end" must be less than or equal to '.concat(MAX_PAGE_LIMIT)
17666
+ })["default"](10)
17667
+ });
17668
+ var lensSchema = objectType({
17669
+ platform: literalType("lens"),
17670
+ contentType: enumType([ "posts", "replies" ]),
17671
+ identifier: stringType().nonempty(),
17672
+ start: numberType()["int"]().nonnegative()["default"](0),
17673
+ end: numberType()["int"]().nonnegative().max(MAX_PAGE_LIMIT, {
17674
+ message: '"end" must be less than or equal to '.concat(MAX_PAGE_LIMIT)
17675
+ })["default"](10)
17676
+ });
17677
+ var fireflyParamsSchema = discriminatedUnionType("platform", [ farcasterSchema, lensSchema ]);
17678
+ var fireFlyPlaformType = {
17679
+ farcaster: {
17680
+ posts: "farcasterid",
17681
+ replies: "farcasterpostid",
17682
+ channels: "farcasterchannels"
17683
+ },
17684
+ lens: {
17685
+ posts: "lensid",
17686
+ replies: "lenspostid"
17687
+ }
17688
+ };
17689
+ function FIREFLY() {
17690
+ return _FIREFLY.apply(this, arguments);
17691
+ }
17692
+ function _FIREFLY() {
17693
+ _FIREFLY = _asyncToGenerator(_regeneratorRuntime().mark((function _callee21() {
17694
+ var _argsToArray17, _argsToArray18, platform, contentType, identifier, _argsToArray18$, start, _argsToArray18$2, end, apiKey, url, _getUrlAndHeaders7, finalUrl, HEADERS, response, _yield$response$json2, _data3, _args24 = arguments;
17695
+ return _regeneratorRuntime().wrap((function _callee21$(_context24) {
17696
+ while (1) switch (_context24.prev = _context24.next) {
17697
+ case 0:
17698
+ _context24.prev = 0;
17699
+ _argsToArray17 = argsToArray(_args24), _argsToArray18 = _slicedToArray(_argsToArray17, 5),
17700
+ platform = _argsToArray18[0], contentType = _argsToArray18[1], identifier = _argsToArray18[2],
17701
+ _argsToArray18$ = _argsToArray18[3], start = _argsToArray18$ === void 0 ? 0 : _argsToArray18$,
17702
+ _argsToArray18$2 = _argsToArray18[4], end = _argsToArray18$2 === void 0 ? 10 : _argsToArray18$2;
17703
+ validateParams(fireflyParamsSchema, {
17704
+ platform: platform,
17705
+ contentType: contentType,
17706
+ identifier: identifier,
17707
+ start: start,
17708
+ end: end
17709
+ });
17710
+ apiKey = window.localStorage.getItem(SERVICES_API_KEY.Firefly);
17711
+ url = new URL("https://openapi.firefly.land/v1/fileverse/fetch");
17712
+ url.searchParams.set("query", identifier.split(",").map((function(s) {
17713
+ return s.trim();
17714
+ })).filter(Boolean).join(","));
17715
+ url.searchParams.set("type", fireFlyPlaformType[platform][contentType]);
17716
+ url.searchParams.set("start", String(start));
17717
+ url.searchParams.set("end", String(end));
17718
+ _getUrlAndHeaders7 = getUrlAndHeaders({
17719
+ url: url.toString(),
17720
+ serviceName: "Firefly",
17721
+ headers: {
17722
+ "x-api-key": apiKey
17723
+ }
17724
+ }), finalUrl = _getUrlAndHeaders7.URL, HEADERS = _getUrlAndHeaders7.HEADERS;
17725
+ _context24.next = 12;
17726
+ return fetch(finalUrl, {
17727
+ method: "GET",
17728
+ headers: HEADERS
17729
+ });
17897
17730
 
17898
- case 37:
17899
- if ((_step42 = _iterator42.n()).done) {
17900
- _context25.next = 44;
17731
+ case 12:
17732
+ response = _context24.sent;
17733
+ if (response.ok) {
17734
+ _context24.next = 15;
17901
17735
  break;
17902
17736
  }
17903
- return _context25.delegateYield(_loop(), "t1", 39);
17737
+ throw new NetworkError(SERVICES_API_KEY.Firefly, response.status);
17904
17738
 
17905
- case 39:
17906
- _ret = _context25.t1;
17907
- if (!_ret) {
17908
- _context25.next = 42;
17739
+ case 15:
17740
+ _context24.next = 17;
17741
+ return response.json();
17742
+
17743
+ case 17:
17744
+ _yield$response$json2 = _context24.sent;
17745
+ _data3 = _yield$response$json2.data;
17746
+ if (Array.isArray(_data3)) {
17747
+ _context24.next = 21;
17909
17748
  break;
17910
17749
  }
17911
- return _context25.abrupt("return", _ret.v);
17912
-
17913
- case 42:
17914
- _context25.next = 37;
17915
- break;
17750
+ return _context24.abrupt("return", []);
17916
17751
 
17917
- case 44:
17918
- _context25.next = 49;
17919
- break;
17752
+ case 21:
17753
+ return _context24.abrupt("return", _data3.map((function(item) {
17754
+ var flat = {};
17755
+ for (var _i16 = 0, _Object$entries6 = Object.entries(item); _i16 < _Object$entries6.length; _i16++) {
17756
+ var _Object$entries6$_i = _slicedToArray(_Object$entries6[_i16], 2), key = _Object$entries6$_i[0], _value12 = _Object$entries6$_i[1];
17757
+ if (_typeof(_value12) !== "object" || _value12 === null) {
17758
+ flat[key] = _value12;
17759
+ }
17760
+ }
17761
+ flat.platform = platform;
17762
+ return flat;
17763
+ })));
17920
17764
 
17921
- case 46:
17922
- _context25.prev = 46;
17923
- _context25.t2 = _context25["catch"](34);
17924
- _iterator42.e(_context25.t2);
17765
+ case 24:
17766
+ _context24.prev = 24;
17767
+ _context24.t0 = _context24["catch"](0);
17768
+ return _context24.abrupt("return", errorMessageHandler(_context24.t0, "FIREFLY"));
17925
17769
 
17926
- case 49:
17927
- _context25.prev = 49;
17928
- _iterator42.f();
17929
- return _context25.finish(49);
17770
+ case 27:
17771
+ case "end":
17772
+ return _context24.stop();
17773
+ }
17774
+ }), _callee21, null, [ [ 0, 24 ] ]);
17775
+ })));
17776
+ return _FIREFLY.apply(this, arguments);
17777
+ }
17778
+ function GNOSIS() {
17779
+ return _GNOSIS.apply(this, arguments);
17780
+ }
17781
+ function _GNOSIS() {
17782
+ _GNOSIS = _asyncToGenerator(_regeneratorRuntime().mark((function _callee22() {
17783
+ var _argsToArray19, _argsToArray20, type, address, startDate, endDate, _argsToArray20$, page, _argsToArray20$2, limit, apiKey, _args25 = arguments;
17784
+ return _regeneratorRuntime().wrap((function _callee22$(_context25) {
17785
+ while (1) switch (_context25.prev = _context25.next) {
17786
+ case 0:
17787
+ _context25.prev = 0;
17788
+ _argsToArray19 = argsToArray(_args25), _argsToArray20 = _slicedToArray(_argsToArray19, 6),
17789
+ type = _argsToArray20[0], address = _argsToArray20[1], startDate = _argsToArray20[2],
17790
+ endDate = _argsToArray20[3], _argsToArray20$ = _argsToArray20[4], page = _argsToArray20$ === void 0 ? 1 : _argsToArray20$,
17791
+ _argsToArray20$2 = _argsToArray20[5], limit = _argsToArray20$2 === void 0 ? 10 : _argsToArray20$2;
17792
+ validateParams(baseParamsSchema, {
17793
+ type: type,
17794
+ address: address,
17795
+ startDate: startDate,
17796
+ endDate: endDate,
17797
+ page: page,
17798
+ limit: limit
17799
+ });
17800
+ apiKey = window.localStorage.getItem(SERVICES_API_KEY.Gnosisscan);
17801
+ _context25.next = 6;
17802
+ return handleScanRequest({
17803
+ type: type,
17804
+ address: address,
17805
+ startDate: startDate,
17806
+ endDate: endDate,
17807
+ page: page,
17808
+ offset: limit,
17809
+ apiKey: apiKey,
17810
+ functionName: "GNOSIS",
17811
+ chainId: CHAIN_ID_MAP.gnosis,
17812
+ network: "gnosis"
17813
+ });
17930
17814
 
17931
- case 52:
17932
- return _context25.abrupt("return", out);
17815
+ case 6:
17816
+ return _context25.abrupt("return", _context25.sent);
17933
17817
 
17934
- case 55:
17935
- _context25.prev = 55;
17936
- _context25.t3 = _context25["catch"](0);
17937
- return _context25.abrupt("return", errorMessageHandler(_context25.t3, "EOA"));
17818
+ case 9:
17819
+ _context25.prev = 9;
17820
+ _context25.t0 = _context25["catch"](0);
17821
+ return _context25.abrupt("return", errorMessageHandler(_context25.t0, "GNOSIS"));
17938
17822
 
17939
- case 58:
17823
+ case 12:
17940
17824
  case "end":
17941
17825
  return _context25.stop();
17942
17826
  }
17943
- }), _callee22, null, [ [ 0, 55 ], [ 9, 25, 28, 31 ], [ 34, 46, 49, 52 ] ]);
17827
+ }), _callee22, null, [ [ 0, 9 ] ]);
17944
17828
  })));
17945
- return _EOA.apply(this, arguments);
17829
+ return _GNOSIS.apply(this, arguments);
17946
17830
  }
17947
- function FLVURL(_x16, _x17) {
17948
- return _FLVURL.apply(this, arguments);
17831
+ var lensParamsSchema = objectType({
17832
+ contentType: enumType([ "posts", "replies" ]),
17833
+ identifier: stringType().nonempty(),
17834
+ start: numberType()["int"]().nonnegative()["default"](0),
17835
+ end: numberType()["int"]().nonnegative().max(MAX_PAGE_LIMIT, {
17836
+ message: '"end" must be less than or equal to '.concat(MAX_PAGE_LIMIT)
17837
+ })["default"](10)
17838
+ });
17839
+ function LENS() {
17840
+ return _LENS.apply(this, arguments);
17949
17841
  }
17950
- function _FLVURL() {
17951
- _FLVURL = _asyncToGenerator(_regeneratorRuntime().mark((function _callee23(token, vs_currencies) {
17842
+ function _LENS() {
17843
+ _LENS = _asyncToGenerator(_regeneratorRuntime().mark((function _callee23() {
17844
+ var _argsToArray21, _argsToArray22, contentType, identifier, _argsToArray22$, start, _argsToArray22$2, end, apiKey, url, typeMap, _getUrlAndHeaders8, finalUrl, HEADERS, response, _yield$response$json3, _data4, _args26 = arguments;
17952
17845
  return _regeneratorRuntime().wrap((function _callee23$(_context26) {
17953
17846
  while (1) switch (_context26.prev = _context26.next) {
17954
17847
  case 0:
17955
- return _context26.abrupt("return", new Promise((function(resolve) {
17956
- setTimeout((function() {
17957
- resolve([ {
17958
- Yoo: "gotcha"
17959
- } ]);
17960
- }), 1e4);
17848
+ _context26.prev = 0;
17849
+ _argsToArray21 = argsToArray(_args26), _argsToArray22 = _slicedToArray(_argsToArray21, 4),
17850
+ contentType = _argsToArray22[0], identifier = _argsToArray22[1], _argsToArray22$ = _argsToArray22[2],
17851
+ start = _argsToArray22$ === void 0 ? 0 : _argsToArray22$, _argsToArray22$2 = _argsToArray22[3],
17852
+ end = _argsToArray22$2 === void 0 ? 10 : _argsToArray22$2;
17853
+ validateParams(lensParamsSchema, {
17854
+ contentType: contentType,
17855
+ identifier: identifier,
17856
+ start: start,
17857
+ end: end
17858
+ });
17859
+ apiKey = window.localStorage.getItem(SERVICES_API_KEY.Firefly);
17860
+ url = new URL("https://openapi.firefly.land/v1/fileverse/fetch");
17861
+ url.searchParams.set("query", identifier.split(",").map((function(s) {
17862
+ return s.trim();
17863
+ })).filter(Boolean).join(","));
17864
+ typeMap = {
17865
+ posts: "lensid",
17866
+ replies: "lenspostid"
17867
+ };
17868
+ url.searchParams.set("type", typeMap[contentType]);
17869
+ url.searchParams.set("start", String(start));
17870
+ url.searchParams.set("end", String(end));
17871
+ _getUrlAndHeaders8 = getUrlAndHeaders({
17872
+ url: url.toString(),
17873
+ serviceName: "Firefly",
17874
+ headers: {
17875
+ "x-api-key": apiKey
17876
+ }
17877
+ }), finalUrl = _getUrlAndHeaders8.URL, HEADERS = _getUrlAndHeaders8.HEADERS;
17878
+ _context26.next = 13;
17879
+ return fetch(finalUrl, {
17880
+ method: "GET",
17881
+ headers: HEADERS
17882
+ });
17883
+
17884
+ case 13:
17885
+ response = _context26.sent;
17886
+ if (response.ok) {
17887
+ _context26.next = 16;
17888
+ break;
17889
+ }
17890
+ throw new NetworkError(SERVICES_API_KEY.Firefly, response.status);
17891
+
17892
+ case 16:
17893
+ _context26.next = 18;
17894
+ return response.json();
17895
+
17896
+ case 18:
17897
+ _yield$response$json3 = _context26.sent;
17898
+ _data4 = _yield$response$json3.data;
17899
+ if (Array.isArray(_data4)) {
17900
+ _context26.next = 22;
17901
+ break;
17902
+ }
17903
+ return _context26.abrupt("return", []);
17904
+
17905
+ case 22:
17906
+ return _context26.abrupt("return", _data4.map((function(item) {
17907
+ var flat = {};
17908
+ for (var _i17 = 0, _Object$entries7 = Object.entries(item); _i17 < _Object$entries7.length; _i17++) {
17909
+ var _Object$entries7$_i = _slicedToArray(_Object$entries7[_i17], 2), key = _Object$entries7$_i[0], _value13 = _Object$entries7$_i[1];
17910
+ if (_value13 == null || _typeof(_value13) !== "object") {
17911
+ flat[key] = _value13;
17912
+ }
17913
+ }
17914
+ flat.platform = "lens";
17915
+ return flat;
17961
17916
  })));
17962
17917
 
17963
- case 1:
17918
+ case 25:
17919
+ _context26.prev = 25;
17920
+ _context26.t0 = _context26["catch"](0);
17921
+ return _context26.abrupt("return", errorMessageHandler(_context26.t0, "LENS"));
17922
+
17923
+ case 28:
17964
17924
  case "end":
17965
17925
  return _context26.stop();
17966
17926
  }
17967
- }), _callee23);
17927
+ }), _callee23, null, [ [ 0, 25 ] ]);
17968
17928
  })));
17969
- return _FLVURL.apply(this, arguments);
17929
+ return _LENS.apply(this, arguments);
17970
17930
  }
17971
- function SAFE() {
17972
- return _SAFE.apply(this, arguments);
17931
+ var neynarParamsSchema = objectType({
17932
+ username: stringType().nonempty()
17933
+ });
17934
+ var fromUsernameToFid = function() {
17935
+ var _ref14 = _asyncToGenerator(_regeneratorRuntime().mark((function _callee1(username, apiKey) {
17936
+ var url, _getUrlAndHeaders2, finalUrl, HEADERS, res, json, users, user;
17937
+ return _regeneratorRuntime().wrap((function _callee1$(_context1) {
17938
+ while (1) switch (_context1.prev = _context1.next) {
17939
+ case 0:
17940
+ if (username) {
17941
+ _context1.next = 2;
17942
+ break;
17943
+ }
17944
+ return _context1.abrupt("return", null);
17945
+
17946
+ case 2:
17947
+ url = "https://api.neynar.com/v2/farcaster/user/search/?q=".concat(username, "&limit=5");
17948
+ _getUrlAndHeaders2 = getUrlAndHeaders({
17949
+ url: url,
17950
+ serviceName: "Neynar",
17951
+ headers: {
17952
+ "x-api-key": apiKey,
17953
+ "x-neynar-experimental": "false"
17954
+ }
17955
+ }), finalUrl = _getUrlAndHeaders2.URL, HEADERS = _getUrlAndHeaders2.HEADERS;
17956
+ _context1.next = 6;
17957
+ return fetch(finalUrl, {
17958
+ method: "GET",
17959
+ headers: HEADERS
17960
+ });
17961
+
17962
+ case 6:
17963
+ res = _context1.sent;
17964
+ _context1.next = 9;
17965
+ return res.json();
17966
+
17967
+ case 9:
17968
+ json = _context1.sent;
17969
+ users = json.result ? json.result.users : [];
17970
+ user = users.find((function(user) {
17971
+ return user.username === username;
17972
+ }));
17973
+ return _context1.abrupt("return", user && user.fid || null);
17974
+
17975
+ case 13:
17976
+ case "end":
17977
+ return _context1.stop();
17978
+ }
17979
+ }), _callee1);
17980
+ })));
17981
+ return function fromUsernameToFid(_x14, _x15) {
17982
+ return _ref14.apply(this, arguments);
17983
+ };
17984
+ }();
17985
+ var fromUsernameToFid$1 = {
17986
+ fromUsernameToFid: fromUsernameToFid
17987
+ };
17988
+ function NEYNAR() {
17989
+ return _NEYNAR.apply(this, arguments);
17973
17990
  }
17974
- function _SAFE() {
17975
- _SAFE = _asyncToGenerator(_regeneratorRuntime().mark((function _callee24() {
17976
- var _argsToArray21, _argsToArray22, address, utility, chain, _argsToArray22$, limit, _argsToArray22$2, offset, apiKey, chainId, resolved, url, _getUrlAndHeaders0, finalUrl, HEADERS, res, json, _args27 = arguments;
17991
+ function _NEYNAR() {
17992
+ _NEYNAR = _asyncToGenerator(_regeneratorRuntime().mark((function _callee24() {
17993
+ var _argsToArray23, _argsToArray24, username, apiKey, fid, url, _getUrlAndHeaders9, finalUrl, HEADERS, response, json, users, _args27 = arguments;
17977
17994
  return _regeneratorRuntime().wrap((function _callee24$(_context27) {
17978
17995
  while (1) switch (_context27.prev = _context27.next) {
17979
17996
  case 0:
17980
17997
  _context27.prev = 0;
17981
- _argsToArray21 = argsToArray(_args27), _argsToArray22 = _slicedToArray(_argsToArray21, 5),
17982
- address = _argsToArray22[0], utility = _argsToArray22[1], chain = _argsToArray22[2],
17983
- _argsToArray22$ = _argsToArray22[3], limit = _argsToArray22$ === void 0 ? 10 : _argsToArray22$,
17984
- _argsToArray22$2 = _argsToArray22[4], offset = _argsToArray22$2 === void 0 ? 0 : _argsToArray22$2;
17985
- validateParams(safeParamsSchema, {
17986
- address: address,
17987
- utility: utility,
17988
- chain: chain,
17989
- limit: limit,
17990
- offset: offset
17998
+ _argsToArray23 = argsToArray(_args27), _argsToArray24 = _slicedToArray(_argsToArray23, 1),
17999
+ username = _argsToArray24[0];
18000
+ validateParams(neynarParamsSchema, {
18001
+ username: username
17991
18002
  });
17992
- apiKey = window.localStorage.getItem(SERVICES_API_KEY.Safe);
17993
- chainId = SAFE_CHAIN_MAP[chain];
17994
- if (chainId) {
17995
- _context27.next = 7;
18003
+ apiKey = window.localStorage.getItem(SERVICES_API_KEY.Neynar);
18004
+ _context27.next = 6;
18005
+ return fromUsernameToFid$1.fromUsernameToFid(username, apiKey);
18006
+
18007
+ case 6:
18008
+ fid = _context27.sent;
18009
+ if (fid) {
18010
+ _context27.next = 9;
17996
18011
  break;
17997
18012
  }
17998
- throw new ValidationError("Invalid chain: ".concat(chain));
17999
-
18000
- case 7:
18001
- _context27.next = 9;
18002
- return fromEnsNameToAddress$1.validateAndGetAddress(address);
18013
+ throw new ValidationError("Invalid username: ".concat(username));
18003
18014
 
18004
18015
  case 9:
18005
- resolved = _context27.sent;
18006
- url = "https://api.safe.global/tx-service/".concat(chainId, "/api/v2/safes/").concat(resolved, "/multisig-transactions?limit=").concat(limit, "&offset=").concat(offset);
18007
- _getUrlAndHeaders0 = getUrlAndHeaders({
18008
- url: url,
18009
- serviceName: "Etherscan",
18016
+ url = "https://api.neynar.com/v2/farcaster/followers?fid=".concat(fid);
18017
+ _getUrlAndHeaders9 = getUrlAndHeaders({
18018
+ url: url.toString(),
18019
+ serviceName: "Neynar",
18010
18020
  headers: {
18011
- Authorization: "Bearer ".concat(apiKey)
18021
+ "x-api-key": apiKey,
18022
+ "x-neynar-experimental": "false"
18012
18023
  }
18013
- }), finalUrl = _getUrlAndHeaders0.URL, HEADERS = _getUrlAndHeaders0.HEADERS;
18014
- _context27.next = 14;
18024
+ }), finalUrl = _getUrlAndHeaders9.URL, HEADERS = _getUrlAndHeaders9.HEADERS;
18025
+ _context27.next = 13;
18015
18026
  return fetch(finalUrl, {
18027
+ method: "GET",
18016
18028
  headers: HEADERS
18017
18029
  });
18018
18030
 
18019
- case 14:
18020
- res = _context27.sent;
18021
- if (res.ok) {
18022
- _context27.next = 17;
18031
+ case 13:
18032
+ response = _context27.sent;
18033
+ if (response.ok) {
18034
+ _context27.next = 16;
18023
18035
  break;
18024
18036
  }
18025
- throw new NetworkError(SERVICES_API_KEY.Safe, res.status);
18037
+ throw new NetworkError(SERVICES_API_KEY.Neynar, response.status);
18026
18038
 
18027
- case 17:
18028
- _context27.next = 19;
18029
- return res.json();
18039
+ case 16:
18040
+ _context27.next = 18;
18041
+ return response.json();
18030
18042
 
18031
- case 19:
18043
+ case 18:
18032
18044
  json = _context27.sent;
18033
- if (Array.isArray(json.results)) {
18045
+ users = (json === null || json === void 0 ? void 0 : json.users) || [];
18046
+ if (users.length) {
18034
18047
  _context27.next = 22;
18035
18048
  break;
18036
18049
  }
18037
- throw new ValidationError("Invalid API response");
18050
+ return _context27.abrupt("return", []);
18038
18051
 
18039
18052
  case 22:
18040
- return _context27.abrupt("return", json.results.map((function(_ref17) {
18041
- var confirmations = _ref17.confirmations, dataDecoded = _ref17.dataDecoded, rest = _objectWithoutProperties(_ref17, _excluded);
18042
- return rest;
18053
+ return _context27.abrupt("return", users.map((function(_ref18) {
18054
+ var _user$profile, _user$profile2;
18055
+ var user = _ref18.user;
18056
+ return {
18057
+ username: user.username,
18058
+ custody_address: user.custody_address,
18059
+ follower_count: user.follower_count,
18060
+ country: ((_user$profile = user.profile) === null || _user$profile === void 0 || (_user$profile = _user$profile.location) === null || _user$profile === void 0 || (_user$profile = _user$profile.address) === null || _user$profile === void 0 ? void 0 : _user$profile.country) || "",
18061
+ city: ((_user$profile2 = user.profile) === null || _user$profile2 === void 0 || (_user$profile2 = _user$profile2.location) === null || _user$profile2 === void 0 || (_user$profile2 = _user$profile2.address) === null || _user$profile2 === void 0 ? void 0 : _user$profile2.city) || ""
18062
+ };
18043
18063
  })));
18044
18064
 
18045
18065
  case 25:
18046
18066
  _context27.prev = 25;
18047
18067
  _context27.t0 = _context27["catch"](0);
18048
- return _context27.abrupt("return", errorMessageHandler(_context27.t0, "SAFE"));
18068
+ return _context27.abrupt("return", errorMessageHandler(_context27.t0, "NEYNAR"));
18049
18069
 
18050
18070
  case 28:
18051
18071
  case "end":
@@ -18053,101 +18073,123 @@ function _typeof(o) {
18053
18073
  }
18054
18074
  }), _callee24, null, [ [ 0, 25 ] ]);
18055
18075
  })));
18056
- return _SAFE.apply(this, arguments);
18076
+ return _NEYNAR.apply(this, arguments);
18057
18077
  }
18058
- function DEFILLAMA() {
18059
- return _DEFILLAMA.apply(this, arguments);
18078
+ var safeParamsSchema = objectType({
18079
+ address: stringType().nonempty(),
18080
+ utility: literalType("txns"),
18081
+ chain: enumType([ "ethereum", "gnosis" ]),
18082
+ limit: numberType()["int"]().nonnegative().max(MAX_PAGE_LIMIT, {
18083
+ message: '"limit" must be less than or equal to '.concat(MAX_PAGE_LIMIT)
18084
+ })["default"](10),
18085
+ offset: numberType()["int"]().nonnegative()["default"](0)
18086
+ });
18087
+ function SAFE() {
18088
+ return _SAFE.apply(this, arguments);
18060
18089
  }
18061
- function _DEFILLAMA() {
18062
- _DEFILLAMA = _asyncToGenerator(_regeneratorRuntime().mark((function _callee25() {
18063
- var _argsToArray23, _argsToArray24, category, apiKey, url, res, json, _args28 = arguments;
18090
+ function _SAFE() {
18091
+ _SAFE = _asyncToGenerator(_regeneratorRuntime().mark((function _callee25() {
18092
+ var _argsToArray25, _argsToArray26, address, utility, chain, _argsToArray26$, limit, _argsToArray26$2, offset, apiKey, chainId, resolved, url, _getUrlAndHeaders0, finalUrl, HEADERS, res, json, _args28 = arguments;
18064
18093
  return _regeneratorRuntime().wrap((function _callee25$(_context28) {
18065
18094
  while (1) switch (_context28.prev = _context28.next) {
18066
18095
  case 0:
18067
18096
  _context28.prev = 0;
18068
- _argsToArray23 = argsToArray(_args28), _argsToArray24 = _slicedToArray(_argsToArray23, 1),
18069
- category = _argsToArray24[0];
18070
- validateParams(defillamaParamsSchema, {
18071
- category: category
18097
+ _argsToArray25 = argsToArray(_args28), _argsToArray26 = _slicedToArray(_argsToArray25, 5),
18098
+ address = _argsToArray26[0], utility = _argsToArray26[1], chain = _argsToArray26[2],
18099
+ _argsToArray26$ = _argsToArray26[3], limit = _argsToArray26$ === void 0 ? 10 : _argsToArray26$,
18100
+ _argsToArray26$2 = _argsToArray26[4], offset = _argsToArray26$2 === void 0 ? 0 : _argsToArray26$2;
18101
+ validateParams(safeParamsSchema, {
18102
+ address: address,
18103
+ utility: utility,
18104
+ chain: chain,
18105
+ limit: limit,
18106
+ offset: offset
18072
18107
  });
18073
- apiKey = window.localStorage.getItem(SERVICES_API_KEY.Defillama);
18074
- url = CATEGORY_URLS[category];
18075
- if (url) {
18108
+ apiKey = window.localStorage.getItem(SERVICES_API_KEY.Safe);
18109
+ chainId = SAFE_CHAIN_MAP[chain];
18110
+ if (chainId) {
18076
18111
  _context28.next = 7;
18077
18112
  break;
18078
18113
  }
18079
- throw new ValidationError("Invalid category: ".concat(category));
18114
+ throw new ValidationError("Invalid chain: ".concat(chain));
18080
18115
 
18081
18116
  case 7:
18082
18117
  _context28.next = 9;
18083
- return fetch(url);
18118
+ return fromEnsNameToAddress$1.validateAndGetAddress(address);
18084
18119
 
18085
18120
  case 9:
18121
+ resolved = _context28.sent;
18122
+ url = "https://api.safe.global/tx-service/".concat(chainId, "/api/v2/safes/").concat(resolved, "/multisig-transactions?limit=").concat(limit, "&offset=").concat(offset);
18123
+ _getUrlAndHeaders0 = getUrlAndHeaders({
18124
+ url: url,
18125
+ serviceName: "Etherscan",
18126
+ headers: {
18127
+ Authorization: "Bearer ".concat(apiKey)
18128
+ }
18129
+ }), finalUrl = _getUrlAndHeaders0.URL, HEADERS = _getUrlAndHeaders0.HEADERS;
18130
+ _context28.next = 14;
18131
+ return fetch(finalUrl, {
18132
+ headers: HEADERS
18133
+ });
18134
+
18135
+ case 14:
18086
18136
  res = _context28.sent;
18087
18137
  if (res.ok) {
18088
- _context28.next = 12;
18138
+ _context28.next = 17;
18089
18139
  break;
18090
18140
  }
18091
- throw new NetworkError(SERVICES_API_KEY.Defillama, res.status);
18141
+ throw new NetworkError(SERVICES_API_KEY.Safe, res.status);
18092
18142
 
18093
- case 12:
18094
- _context28.next = 14;
18143
+ case 17:
18144
+ _context28.next = 19;
18095
18145
  return res.json();
18096
18146
 
18097
- case 14:
18147
+ case 19:
18098
18148
  json = _context28.sent;
18099
- _context28.t0 = category;
18100
- _context28.next = _context28.t0 === "protocols" ? 18 : _context28.t0 === "yields" ? 20 : _context28.t0 === "dex" ? 22 : _context28.t0 === "fees" ? 22 : 24;
18101
- break;
18102
-
18103
- case 18:
18104
- json = Array.isArray(json) ? json.slice(0, 500) : [];
18105
- return _context28.abrupt("break", 24);
18106
-
18107
- case 20:
18108
- json = Array.isArray(json.data) ? json.data.slice(0, 500) : [];
18109
- return _context28.abrupt("break", 24);
18149
+ if (Array.isArray(json.results)) {
18150
+ _context28.next = 22;
18151
+ break;
18152
+ }
18153
+ throw new ValidationError("Invalid API response");
18110
18154
 
18111
18155
  case 22:
18112
- json = Array.isArray(json.protocols) ? json.protocols.slice(0, 500) : [];
18113
- return _context28.abrupt("break", 24);
18114
-
18115
- case 24:
18116
- return _context28.abrupt("return", (Array.isArray(json) ? json : [ json ]).map((function(item) {
18117
- var out = {};
18118
- for (var _i17 = 0, _Object$entries7 = Object.entries(item); _i17 < _Object$entries7.length; _i17++) {
18119
- var _Object$entries7$_i = _slicedToArray(_Object$entries7[_i17], 2), k = _Object$entries7$_i[0], v = _Object$entries7$_i[1];
18120
- if (v === null || _typeof(v) !== "object") out[k] = v;
18121
- }
18122
- return out;
18156
+ return _context28.abrupt("return", json.results.map((function(_ref19) {
18157
+ var confirmations = _ref19.confirmations, dataDecoded = _ref19.dataDecoded, rest = _objectWithoutProperties(_ref19, _excluded);
18158
+ return rest;
18123
18159
  })));
18124
18160
 
18125
- case 27:
18126
- _context28.prev = 27;
18127
- _context28.t1 = _context28["catch"](0);
18128
- return _context28.abrupt("return", errorMessageHandler(_context28.t1, "DEFILLAMA"));
18161
+ case 25:
18162
+ _context28.prev = 25;
18163
+ _context28.t0 = _context28["catch"](0);
18164
+ return _context28.abrupt("return", errorMessageHandler(_context28.t0, "SAFE"));
18129
18165
 
18130
- case 30:
18166
+ case 28:
18131
18167
  case "end":
18132
18168
  return _context28.stop();
18133
18169
  }
18134
- }), _callee25, null, [ [ 0, 27 ] ]);
18170
+ }), _callee25, null, [ [ 0, 25 ] ]);
18135
18171
  })));
18136
- return _DEFILLAMA.apply(this, arguments);
18172
+ return _SAFE.apply(this, arguments);
18137
18173
  }
18174
+ var uniswapParamsSchema = objectType({
18175
+ graphType: enumType([ "v3", "v3-raw" ]),
18176
+ category: enumType([ "tokens", "markets" ]),
18177
+ param1: stringType().nonempty(),
18178
+ param2: stringType().optional()
18179
+ });
18138
18180
  function UNISWAP() {
18139
18181
  return _UNISWAP.apply(this, arguments);
18140
18182
  }
18141
18183
  function _UNISWAP() {
18142
18184
  _UNISWAP = _asyncToGenerator(_regeneratorRuntime().mark((function _callee26() {
18143
- var _argsToArray25, _argsToArray26, graphType, category, param1, param2, baseUrl, url, res, json, _args29 = arguments;
18185
+ var _argsToArray27, _argsToArray28, graphType, category, param1, param2, baseUrl, url, res, json, _args29 = arguments;
18144
18186
  return _regeneratorRuntime().wrap((function _callee26$(_context29) {
18145
18187
  while (1) switch (_context29.prev = _context29.next) {
18146
18188
  case 0:
18147
18189
  _context29.prev = 0;
18148
- _argsToArray25 = argsToArray(_args29), _argsToArray26 = _slicedToArray(_argsToArray25, 4),
18149
- graphType = _argsToArray26[0], category = _argsToArray26[1], param1 = _argsToArray26[2],
18150
- param2 = _argsToArray26[3];
18190
+ _argsToArray27 = argsToArray(_args29), _argsToArray28 = _slicedToArray(_argsToArray27, 4),
18191
+ graphType = _argsToArray28[0], category = _argsToArray28[1], param1 = _argsToArray28[2],
18192
+ param2 = _argsToArray28[3];
18151
18193
  validateParams(uniswapParamsSchema, {
18152
18194
  graphType: graphType,
18153
18195
  category: category,
@@ -18179,8 +18221,8 @@ function _typeof(o) {
18179
18221
  }
18180
18222
  return _context29.abrupt("return", json.map((function(item) {
18181
18223
  var flat = {};
18182
- Object.entries(item).forEach((function(_ref18) {
18183
- var _ref19 = _slicedToArray(_ref18, 2), k = _ref19[0], v = _ref19[1];
18224
+ Object.entries(item).forEach((function(_ref20) {
18225
+ var _ref21 = _slicedToArray(_ref20, 2), k = _ref21[0], v = _ref21[1];
18184
18226
  if (v === null || _typeof(v) !== "object") flat[k] = v;
18185
18227
  }));
18186
18228
  return flat;
@@ -18202,72 +18244,29 @@ function _typeof(o) {
18202
18244
  })));
18203
18245
  return _UNISWAP.apply(this, arguments);
18204
18246
  }
18205
- function AAVE() {
18206
- return _AAVE.apply(this, arguments);
18247
+ function FLVURL() {
18248
+ return _FLVURL.apply(this, arguments);
18207
18249
  }
18208
- function _AAVE() {
18209
- _AAVE = _asyncToGenerator(_regeneratorRuntime().mark((function _callee27() {
18210
- var _argsToArray27, _argsToArray28, graphType, category, param1, param2, baseUrl, url, res, json, _args30 = arguments;
18250
+ function _FLVURL() {
18251
+ _FLVURL = _asyncToGenerator(_regeneratorRuntime().mark((function _callee27() {
18211
18252
  return _regeneratorRuntime().wrap((function _callee27$(_context30) {
18212
18253
  while (1) switch (_context30.prev = _context30.next) {
18213
18254
  case 0:
18214
- _context30.prev = 0;
18215
- _argsToArray27 = argsToArray(_args30), _argsToArray28 = _slicedToArray(_argsToArray27, 4),
18216
- graphType = _argsToArray28[0], category = _argsToArray28[1], param1 = _argsToArray28[2],
18217
- param2 = _argsToArray28[3];
18218
- validateParams(aaveParamsSchema, {
18219
- graphType: graphType,
18220
- category: category,
18221
- param1: param1,
18222
- param2: param2
18223
- });
18224
- baseUrl = "https://onchain-proxy.fileverse.io/third-party";
18225
- url = "".concat(baseUrl) + "?service=aave" + "&graphType=".concat(encodeURIComponent(graphType)) + "&category=".concat(encodeURIComponent(category)) + "&input1=".concat(encodeURIComponent(param1)) + (param2 ? "&input2=".concat(encodeURIComponent(param2)) : "");
18226
- _context30.next = 7;
18227
- return fetch(url);
18228
-
18229
- case 7:
18230
- res = _context30.sent;
18231
- if (res.ok) {
18232
- _context30.next = 10;
18233
- break;
18234
- }
18235
- throw new NetworkError("AAVE", res.status);
18236
-
18237
- case 10:
18238
- _context30.next = 12;
18239
- return res.json();
18240
-
18241
- case 12:
18242
- json = _context30.sent;
18243
- if (!Array.isArray(json)) {
18244
- _context30.next = 15;
18245
- break;
18246
- }
18247
- return _context30.abrupt("return", json.map((function(item) {
18248
- var flat = {};
18249
- Object.entries(item).forEach((function(_ref20) {
18250
- var _ref21 = _slicedToArray(_ref20, 2), k = _ref21[0], v = _ref21[1];
18251
- if (v === null || _typeof(v) !== "object") flat[k] = v;
18252
- }));
18253
- return flat;
18255
+ return _context30.abrupt("return", new Promise((function(resolve) {
18256
+ setTimeout((function() {
18257
+ resolve([ {
18258
+ Yoo: "gotcha"
18259
+ } ]);
18260
+ }), 1e4);
18254
18261
  })));
18255
18262
 
18256
- case 15:
18257
- return _context30.abrupt("return", json);
18258
-
18259
- case 18:
18260
- _context30.prev = 18;
18261
- _context30.t0 = _context30["catch"](0);
18262
- return _context30.abrupt("return", errorMessageHandler(_context30.t0, "AAVE"));
18263
-
18264
- case 21:
18263
+ case 1:
18265
18264
  case "end":
18266
18265
  return _context30.stop();
18267
18266
  }
18268
- }), _callee27, null, [ [ 0, 18 ] ]);
18267
+ }), _callee27);
18269
18268
  })));
18270
- return _AAVE.apply(this, arguments);
18269
+ return _FLVURL.apply(this, arguments);
18271
18270
  }
18272
18271
  function POLYMARKET() {
18273
18272
  return "Coming Soon";