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

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-71 */
1
+ /* @fileverse-dev/formulajs v4.4.11-mod-68-patch-9 */
2
2
  var _excluded = [ "confirmations", "dataDecoded" ];
3
3
 
4
4
  function _objectWithoutProperties(e, t) {
@@ -21,38 +21,6 @@ function _objectWithoutPropertiesLoose(r, e) {
21
21
  return t;
22
22
  }
23
23
 
24
- function ownKeys(e, r) {
25
- var t = Object.keys(e);
26
- if (Object.getOwnPropertySymbols) {
27
- var o = Object.getOwnPropertySymbols(e);
28
- r && (o = o.filter((function(r) {
29
- return Object.getOwnPropertyDescriptor(e, r).enumerable;
30
- }))), t.push.apply(t, o);
31
- }
32
- return t;
33
- }
34
-
35
- function _objectSpread(e) {
36
- for (var r = 1; r < arguments.length; r++) {
37
- var t = null != arguments[r] ? arguments[r] : {};
38
- r % 2 ? ownKeys(Object(t), !0).forEach((function(r) {
39
- _defineProperty(e, r, t[r]);
40
- })) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach((function(r) {
41
- Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
42
- }));
43
- }
44
- return e;
45
- }
46
-
47
- function _defineProperty(e, r, t) {
48
- return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
49
- value: t,
50
- enumerable: !0,
51
- configurable: !0,
52
- writable: !0
53
- }) : e[r] = t, e;
54
- }
55
-
56
24
  function _createForOfIteratorHelper(r, e) {
57
25
  var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
58
26
  if (!t) {
@@ -113,22 +81,6 @@ function _createClass(e, r, t) {
113
81
  }), e;
114
82
  }
115
83
 
116
- function _toPropertyKey(t) {
117
- var i = _toPrimitive(t, "string");
118
- return "symbol" == _typeof(i) ? i : i + "";
119
- }
120
-
121
- function _toPrimitive(t, r) {
122
- if ("object" != _typeof(t) || !t) return t;
123
- var e = t[Symbol.toPrimitive];
124
- if (void 0 !== e) {
125
- var i = e.call(t, r || "default");
126
- if ("object" != _typeof(i)) return i;
127
- throw new TypeError("@@toPrimitive must return a primitive value.");
128
- }
129
- return ("string" === r ? String : Number)(t);
130
- }
131
-
132
84
  function _classCallCheck(a, n) {
133
85
  if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
134
86
  }
@@ -511,6 +463,54 @@ function _asyncToGenerator(n) {
511
463
  };
512
464
  }
513
465
 
466
+ function ownKeys(e, r) {
467
+ var t = Object.keys(e);
468
+ if (Object.getOwnPropertySymbols) {
469
+ var o = Object.getOwnPropertySymbols(e);
470
+ r && (o = o.filter((function(r) {
471
+ return Object.getOwnPropertyDescriptor(e, r).enumerable;
472
+ }))), t.push.apply(t, o);
473
+ }
474
+ return t;
475
+ }
476
+
477
+ function _objectSpread(e) {
478
+ for (var r = 1; r < arguments.length; r++) {
479
+ var t = null != arguments[r] ? arguments[r] : {};
480
+ r % 2 ? ownKeys(Object(t), !0).forEach((function(r) {
481
+ _defineProperty(e, r, t[r]);
482
+ })) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach((function(r) {
483
+ Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
484
+ }));
485
+ }
486
+ return e;
487
+ }
488
+
489
+ function _defineProperty(e, r, t) {
490
+ return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
491
+ value: t,
492
+ enumerable: !0,
493
+ configurable: !0,
494
+ writable: !0
495
+ }) : e[r] = t, e;
496
+ }
497
+
498
+ function _toPropertyKey(t) {
499
+ var i = _toPrimitive(t, "string");
500
+ return "symbol" == _typeof(i) ? i : i + "";
501
+ }
502
+
503
+ function _toPrimitive(t, r) {
504
+ if ("object" != _typeof(t) || !t) return t;
505
+ var e = t[Symbol.toPrimitive];
506
+ if (void 0 !== e) {
507
+ var i = e.call(t, r || "default");
508
+ if ("object" != _typeof(i)) return i;
509
+ throw new TypeError("@@toPrimitive must return a primitive value.");
510
+ }
511
+ return ("string" === r ? String : Number)(t);
512
+ }
513
+
514
514
  function _slicedToArray(r, e) {
515
515
  return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
516
516
  }
@@ -11068,41 +11068,129 @@ function _typeof(o) {
11068
11068
  Neynar: "Neynar",
11069
11069
  Defillama: "Defillama"
11070
11070
  };
11071
+ var PROXY_MAP = {
11072
+ Etherscan: {
11073
+ url: "https://staging-api-proxy-ca4268d7d581.herokuapp.com/proxy",
11074
+ removeParams: [ "apikey" ]
11075
+ },
11076
+ Basescan: {
11077
+ url: "https://staging-api-proxy-ca4268d7d581.herokuapp.com/proxy",
11078
+ removeParams: [ "apikey" ]
11079
+ },
11080
+ Gnosisscan: {
11081
+ url: "https://staging-api-proxy-ca4268d7d581.herokuapp.com/proxy",
11082
+ removeParams: [ "apikey" ]
11083
+ },
11084
+ Coingecko: {
11085
+ url: "https://staging-api-proxy-ca4268d7d581.herokuapp.com/proxy",
11086
+ removeParams: [ "apikey" ]
11087
+ },
11088
+ Firefly: {
11089
+ url: "https://staging-api-proxy-ca4268d7d581.herokuapp.com/proxy",
11090
+ removeParams: [ "apikey" ]
11091
+ },
11092
+ Neynar: {
11093
+ url: "https://staging-api-proxy-ca4268d7d581.herokuapp.com/proxy",
11094
+ removeParams: [ "api_key" ]
11095
+ },
11096
+ Safe: {
11097
+ url: "https://staging-api-proxy-ca4268d7d581.herokuapp.com/proxy",
11098
+ removeParams: [ "api_key" ]
11099
+ },
11100
+ Defillama: {
11101
+ url: "https://staging-api-proxy-ca4268d7d581.herokuapp.com/proxy",
11102
+ removeParams: [ "api_key" ]
11103
+ },
11104
+ GnosisPay: {
11105
+ url: "https://staging-api-proxy-ca4268d7d581.herokuapp.com/proxy",
11106
+ removeParams: [ "api_key" ]
11107
+ }
11108
+ };
11109
+ function removeUrlParams(url, paramsToRemove) {
11110
+ if (!paramsToRemove || paramsToRemove.length === 0) {
11111
+ return url;
11112
+ }
11113
+ var urlObj = new URL(url);
11114
+ paramsToRemove.forEach((function(param) {
11115
+ if (urlObj.searchParams.has(param)) {
11116
+ urlObj.searchParams["delete"](param);
11117
+ }
11118
+ }));
11119
+ return urlObj.toString();
11120
+ }
11121
+ function getUrlAndHeaders(_ref) {
11122
+ var url = _ref.url, serviceName = _ref.serviceName, _ref$headers = _ref.headers, headers = _ref$headers === void 0 ? {} : _ref$headers;
11123
+ console.log("getUrlAndHeaders new modified function from formulajs", url, serviceName);
11124
+ var apiKeyLS = window.localStorage.getItem(SERVICES_API_KEY[serviceName]);
11125
+ var isProxyModeEnabledValue = apiKeyLS === "DEFAULT_PROXY_MODE";
11126
+ var proxyConfig = PROXY_MAP[serviceName];
11127
+ if (isProxyModeEnabledValue && proxyConfig && serviceName && SERVICES_API_KEY[serviceName]) {
11128
+ console.log("isProxyModeEnabledValue", isProxyModeEnabledValue);
11129
+ var cleanedUrl = removeUrlParams(url, proxyConfig.removeParams);
11130
+ return {
11131
+ URL: proxyConfig.url,
11132
+ HEADERS: {
11133
+ "target-url": cleanedUrl,
11134
+ method: "GET",
11135
+ "Content-Type": "application/json"
11136
+ }
11137
+ };
11138
+ }
11139
+ return {
11140
+ URL: url,
11141
+ HEADERS: _objectSpread(_objectSpread({}, headers), {}, {
11142
+ method: "GET"
11143
+ })
11144
+ };
11145
+ }
11071
11146
  var fromTimeStampToBlock = function() {
11072
- var _ref = _asyncToGenerator(_regeneratorRuntime().mark((function _callee(timestamp, chain, apiKey) {
11073
- var chainId, url, res, json;
11147
+ var _ref2 = _asyncToGenerator(_regeneratorRuntime().mark((function _callee(timestamp, chain, apiKey) {
11148
+ var chainId, url, _getUrlAndHeaders, finalUrl, HEADERS, res, json;
11074
11149
  return _regeneratorRuntime().wrap((function _callee$(_context) {
11075
11150
  while (1) switch (_context.prev = _context.next) {
11076
11151
  case 0:
11152
+ console.log("fromTimeStampToBlock", timestamp, chain, apiKey);
11077
11153
  if (!(!timestamp || !chain || !apiKey)) {
11078
- _context.next = 2;
11154
+ _context.next = 3;
11079
11155
  break;
11080
11156
  }
11081
11157
  return _context.abrupt("return");
11082
11158
 
11083
- case 2:
11159
+ case 3:
11084
11160
  chainId = CHAIN_ID_MAP[chain];
11161
+ console.log("chainId", chainId);
11085
11162
  url = "https://api.etherscan.io/v2/api?module=block&action=getblocknobytime&timestamp=".concat(timestamp, "&closest=before&apikey=").concat(apiKey, "&chainId=").concat(chainId);
11086
- _context.next = 6;
11087
- return fetch(url);
11163
+ console.log("url", url, getUrlAndHeaders);
11164
+ _getUrlAndHeaders = getUrlAndHeaders({
11165
+ url: url,
11166
+ serviceName: "Etherscan",
11167
+ headers: {}
11168
+ }), finalUrl = _getUrlAndHeaders.URL, HEADERS = _getUrlAndHeaders.HEADERS;
11169
+ console.log("finalUrl", finalUrl, HEADERS);
11170
+ _context.next = 11;
11171
+ return fetch(finalUrl, {
11172
+ method: "GET",
11173
+ headers: HEADERS
11174
+ });
11088
11175
 
11089
- case 6:
11176
+ case 11:
11090
11177
  res = _context.sent;
11091
- _context.next = 9;
11178
+ console.log("res", res, finalUrl, HEADERS);
11179
+ _context.next = 15;
11092
11180
  return res.json();
11093
11181
 
11094
- case 9:
11182
+ case 15:
11095
11183
  json = _context.sent;
11096
11184
  return _context.abrupt("return", parseInt(json.result));
11097
11185
 
11098
- case 11:
11186
+ case 17:
11099
11187
  case "end":
11100
11188
  return _context.stop();
11101
11189
  }
11102
11190
  }), _callee);
11103
11191
  })));
11104
11192
  return function fromTimeStampToBlock(_x2, _x3, _x4) {
11105
- return _ref.apply(this, arguments);
11193
+ return _ref2.apply(this, arguments);
11106
11194
  };
11107
11195
  }();
11108
11196
  var fromTimestampToBlock = {
@@ -11239,15 +11327,15 @@ function _typeof(o) {
11239
11327
  return _handleScanRequest.apply(this, arguments);
11240
11328
  }
11241
11329
  function _handleScanRequest() {
11242
- _handleScanRequest = _asyncToGenerator(_regeneratorRuntime().mark((function _callee10(_ref2) {
11243
- var type, address, startDate, endDate, _ref2$page, page, _ref2$offset, offset, apiKey, functionName, chainId, network, API_INFO_MAP, ensName, apiInfo, baseUrl, ACTION_MAP, action, module, url, _yield$Promise$all, _yield$Promise$all2, startBlock, endBlock, res, json;
11330
+ _handleScanRequest = _asyncToGenerator(_regeneratorRuntime().mark((function _callee10(_ref3) {
11331
+ var type, address, startDate, endDate, _ref3$page, page, _ref3$offset, offset, apiKey, functionName, chainId, network, API_INFO_MAP, ensName, apiInfo, baseUrl, ACTION_MAP, action, module, url, _yield$Promise$all, _yield$Promise$all2, startBlock, endBlock, _getUrlAndHeaders3, finalUrl, HEADERS, res, json;
11244
11332
  return _regeneratorRuntime().wrap((function _callee10$(_context10) {
11245
11333
  while (1) switch (_context10.prev = _context10.next) {
11246
11334
  case 0:
11247
- type = _ref2.type, address = _ref2.address, startDate = _ref2.startDate, endDate = _ref2.endDate,
11248
- _ref2$page = _ref2.page, page = _ref2$page === void 0 ? 1 : _ref2$page, _ref2$offset = _ref2.offset,
11249
- offset = _ref2$offset === void 0 ? 10 : _ref2$offset, apiKey = _ref2.apiKey, functionName = _ref2.functionName,
11250
- chainId = _ref2.chainId, network = _ref2.network;
11335
+ type = _ref3.type, address = _ref3.address, startDate = _ref3.startDate, endDate = _ref3.endDate,
11336
+ _ref3$page = _ref3.page, page = _ref3$page === void 0 ? 1 : _ref3$page, _ref3$offset = _ref3.offset,
11337
+ offset = _ref3$offset === void 0 ? 10 : _ref3$offset, apiKey = _ref3.apiKey, functionName = _ref3.functionName,
11338
+ chainId = _ref3.chainId, network = _ref3.network;
11251
11339
  API_INFO_MAP = {
11252
11340
  BASE: {
11253
11341
  url: "https://api.basescan.org/api",
@@ -11327,44 +11415,52 @@ function _typeof(o) {
11327
11415
  url += "&page=".concat(page, "&offset=").concat(offset);
11328
11416
 
11329
11417
  case 30:
11330
- _context10.next = 32;
11331
- return fetch(url);
11418
+ _getUrlAndHeaders3 = getUrlAndHeaders({
11419
+ url: url,
11420
+ serviceName: "Etherscan",
11421
+ headers: {}
11422
+ }), finalUrl = _getUrlAndHeaders3.URL, HEADERS = _getUrlAndHeaders3.HEADERS;
11423
+ _context10.next = 33;
11424
+ return fetch(finalUrl, {
11425
+ method: "GET",
11426
+ headers: HEADERS
11427
+ });
11332
11428
 
11333
- case 32:
11429
+ case 33:
11334
11430
  res = _context10.sent;
11335
11431
  if (res.ok) {
11336
- _context10.next = 35;
11432
+ _context10.next = 36;
11337
11433
  break;
11338
11434
  }
11339
11435
  throw new NetworkError(apiInfo.apiKeyName, res.status);
11340
11436
 
11341
- case 35:
11342
- _context10.next = 37;
11437
+ case 36:
11438
+ _context10.next = 38;
11343
11439
  return res.json();
11344
11440
 
11345
- case 37:
11441
+ case 38:
11346
11442
  json = _context10.sent;
11347
11443
  if (!(typeof json.result === "string")) {
11348
- _context10.next = 43;
11444
+ _context10.next = 44;
11349
11445
  break;
11350
11446
  }
11351
11447
  if (!json.result.includes("Invalid API Key")) {
11352
- _context10.next = 41;
11448
+ _context10.next = 42;
11353
11449
  break;
11354
11450
  }
11355
11451
  throw new InvalidApiKeyError(apiInfo.apiKeyName);
11356
11452
 
11357
- case 41:
11453
+ case 42:
11358
11454
  if (!json.result.includes("Max rate limit reached")) {
11359
- _context10.next = 43;
11455
+ _context10.next = 44;
11360
11456
  break;
11361
11457
  }
11362
11458
  throw new RateLimitError(apiInfo.apiKeyName);
11363
11459
 
11364
- case 43:
11460
+ case 44:
11365
11461
  return _context10.abrupt("return", type === "gas" && !Array.isArray(json.result) ? [ json.result ] : json.result);
11366
11462
 
11367
- case 44:
11463
+ case 45:
11368
11464
  case "end":
11369
11465
  return _context10.stop();
11370
11466
  }
@@ -11373,8 +11469,8 @@ function _typeof(o) {
11373
11469
  return _handleScanRequest.apply(this, arguments);
11374
11470
  }
11375
11471
  var fromUsernameToFid = function() {
11376
- var _ref3 = _asyncToGenerator(_regeneratorRuntime().mark((function _callee2(username, apiKey) {
11377
- var url, res, json, users, user;
11472
+ var _ref4 = _asyncToGenerator(_regeneratorRuntime().mark((function _callee2(username, apiKey) {
11473
+ var url, _getUrlAndHeaders2, finalUrl, HEADERS, res, json, users, user;
11378
11474
  return _regeneratorRuntime().wrap((function _callee2$(_context2) {
11379
11475
  while (1) switch (_context2.prev = _context2.next) {
11380
11476
  case 0:
@@ -11386,20 +11482,26 @@ function _typeof(o) {
11386
11482
 
11387
11483
  case 2:
11388
11484
  url = "https://api.neynar.com/v2/farcaster/user/search/?q=".concat(username, "&limit=5");
11389
- _context2.next = 5;
11390
- return fetch(url, {
11485
+ _getUrlAndHeaders2 = getUrlAndHeaders({
11486
+ url: url,
11487
+ serviceName: "Neynar",
11391
11488
  headers: {
11392
11489
  "x-api-key": apiKey,
11393
11490
  "x-neynar-experimental": "false"
11394
11491
  }
11492
+ }), finalUrl = _getUrlAndHeaders2.URL, HEADERS = _getUrlAndHeaders2.HEADERS;
11493
+ _context2.next = 6;
11494
+ return fetch(finalUrl, {
11495
+ method: "GET",
11496
+ headers: HEADERS
11395
11497
  });
11396
11498
 
11397
- case 5:
11499
+ case 6:
11398
11500
  res = _context2.sent;
11399
- _context2.next = 8;
11501
+ _context2.next = 9;
11400
11502
  return res.json();
11401
11503
 
11402
- case 8:
11504
+ case 9:
11403
11505
  json = _context2.sent;
11404
11506
  users = json.result ? json.result.users : [];
11405
11507
  user = users.find((function(user) {
@@ -11407,14 +11509,14 @@ function _typeof(o) {
11407
11509
  }));
11408
11510
  return _context2.abrupt("return", user && user.fid || null);
11409
11511
 
11410
- case 12:
11512
+ case 13:
11411
11513
  case "end":
11412
11514
  return _context2.stop();
11413
11515
  }
11414
11516
  }), _callee2);
11415
11517
  })));
11416
11518
  return function fromUsernameToFid(_x7, _x8) {
11417
- return _ref3.apply(this, arguments);
11519
+ return _ref4.apply(this, arguments);
11418
11520
  };
11419
11521
  }();
11420
11522
  var fromUsernameToFid$1 = {
@@ -12161,7 +12263,7 @@ function _typeof(o) {
12161
12263
  description: description
12162
12264
  };
12163
12265
  var customMap = function customMap(iss, ctx) {
12164
- var _ref5;
12266
+ var _ref6;
12165
12267
  var message = params.message;
12166
12268
  if (iss.code === "invalid_enum_value") {
12167
12269
  return {
@@ -12169,16 +12271,16 @@ function _typeof(o) {
12169
12271
  };
12170
12272
  }
12171
12273
  if (typeof ctx.data === "undefined") {
12172
- var _ref4;
12274
+ var _ref5;
12173
12275
  return {
12174
- message: (_ref4 = message !== null && message !== void 0 ? message : required_error) !== null && _ref4 !== void 0 ? _ref4 : ctx.defaultError
12276
+ message: (_ref5 = message !== null && message !== void 0 ? message : required_error) !== null && _ref5 !== void 0 ? _ref5 : ctx.defaultError
12175
12277
  };
12176
12278
  }
12177
12279
  if (iss.code !== "invalid_type") return {
12178
12280
  message: ctx.defaultError
12179
12281
  };
12180
12282
  return {
12181
- message: (_ref5 = message !== null && message !== void 0 ? message : invalid_type_error) !== null && _ref5 !== void 0 ? _ref5 : ctx.defaultError
12283
+ message: (_ref6 = message !== null && message !== void 0 ? message : invalid_type_error) !== null && _ref6 !== void 0 ? _ref6 : ctx.defaultError
12182
12284
  };
12183
12285
  };
12184
12286
  return {
@@ -14918,7 +15020,7 @@ function _typeof(o) {
14918
15020
  }
14919
15021
  if (ctx.common.async) {
14920
15022
  return Promise.all(options.map(function() {
14921
- var _ref7 = _asyncToGenerator(_regeneratorRuntime().mark((function _callee7(option) {
15023
+ var _ref8 = _asyncToGenerator(_regeneratorRuntime().mark((function _callee7(option) {
14922
15024
  var childCtx;
14923
15025
  return _regeneratorRuntime().wrap((function _callee7$(_context7) {
14924
15026
  while (1) switch (_context7.prev = _context7.next) {
@@ -14951,7 +15053,7 @@ function _typeof(o) {
14951
15053
  }), _callee7);
14952
15054
  })));
14953
15055
  return function(_x13) {
14954
- return _ref7.apply(this, arguments);
15056
+ return _ref8.apply(this, arguments);
14955
15057
  };
14956
15058
  }())).then(handleResults);
14957
15059
  } else {
@@ -15253,8 +15355,8 @@ function _typeof(o) {
15253
15355
  data: ctx.data,
15254
15356
  path: ctx.path,
15255
15357
  parent: ctx
15256
- }) ]).then((function(_ref8) {
15257
- var _ref9 = _slicedToArray(_ref8, 2), left = _ref9[0], right = _ref9[1];
15358
+ }) ]).then((function(_ref9) {
15359
+ var _ref0 = _slicedToArray(_ref9, 2), left = _ref0[0], right = _ref0[1];
15258
15360
  return handleParsed(left, right);
15259
15361
  }));
15260
15362
  } else {
@@ -15387,8 +15489,8 @@ function _typeof(o) {
15387
15489
  }
15388
15490
  var keyType = this._def.keyType;
15389
15491
  var valueType = this._def.valueType;
15390
- var pairs = _toConsumableArray(ctx.data.entries()).map((function(_ref0, index) {
15391
- var _ref1 = _slicedToArray(_ref0, 2), key = _ref1[0], value = _ref1[1];
15492
+ var pairs = _toConsumableArray(ctx.data.entries()).map((function(_ref1, index) {
15493
+ var _ref10 = _slicedToArray(_ref1, 2), key = _ref10[0], value = _ref10[1];
15392
15494
  return {
15393
15495
  key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, [ index, "key" ])),
15394
15496
  value: valueType._parse(new ParseInputLazyPath(ctx, value, ctx.path, [ index, "value" ]))
@@ -15922,7 +16024,7 @@ function _typeof(o) {
15922
16024
  var processed = effect.transform(ctx.data, checkCtx);
15923
16025
  if (ctx.common.async) {
15924
16026
  return Promise.resolve(processed).then(function() {
15925
- var _ref11 = _asyncToGenerator(_regeneratorRuntime().mark((function _callee9(processed) {
16027
+ var _ref12 = _asyncToGenerator(_regeneratorRuntime().mark((function _callee9(processed) {
15926
16028
  var result;
15927
16029
  return _regeneratorRuntime().wrap((function _callee9$(_context9) {
15928
16030
  while (1) switch (_context9.prev = _context9.next) {
@@ -15973,7 +16075,7 @@ function _typeof(o) {
15973
16075
  }), _callee9);
15974
16076
  })));
15975
16077
  return function(_x14) {
15976
- return _ref11.apply(this, arguments);
16078
+ return _ref12.apply(this, arguments);
15977
16079
  };
15978
16080
  }());
15979
16081
  } else {
@@ -16304,7 +16406,7 @@ function _typeof(o) {
16304
16406
  var _this$_processInputPa13 = this._processInputParams(input), status = _this$_processInputPa13.status, ctx = _this$_processInputPa13.ctx;
16305
16407
  if (ctx.common.async) {
16306
16408
  var handleAsync = function() {
16307
- var _ref12 = _asyncToGenerator(_regeneratorRuntime().mark((function _callee0() {
16409
+ var _ref13 = _asyncToGenerator(_regeneratorRuntime().mark((function _callee0() {
16308
16410
  var inResult;
16309
16411
  return _regeneratorRuntime().wrap((function _callee0$(_context0) {
16310
16412
  while (1) switch (_context0.prev = _context0.next) {
@@ -16346,7 +16448,7 @@ function _typeof(o) {
16346
16448
  }), _callee0);
16347
16449
  })));
16348
16450
  return function handleAsync() {
16349
- return _ref12.apply(this, arguments);
16451
+ return _ref13.apply(this, arguments);
16350
16452
  };
16351
16453
  }();
16352
16454
  return handleAsync();
@@ -16687,7 +16789,7 @@ function _typeof(o) {
16687
16789
  }
16688
16790
  function _FIREFLY() {
16689
16791
  _FIREFLY = _asyncToGenerator(_regeneratorRuntime().mark((function _callee11() {
16690
- var _argsToArray3, _argsToArray4, platform, contentType, identifier, _argsToArray4$, start, _argsToArray4$2, end, apiKey, url, response, _yield$response$json, _data, _args11 = arguments;
16792
+ var _argsToArray3, _argsToArray4, platform, contentType, identifier, _argsToArray4$, start, _argsToArray4$2, end, apiKey, url, _getUrlAndHeaders4, finalUrl, HEADERS, response, _yield$response$json, _data, _args11 = arguments;
16691
16793
  return _regeneratorRuntime().wrap((function _callee11$(_context11) {
16692
16794
  while (1) switch (_context11.prev = _context11.next) {
16693
16795
  case 0:
@@ -16718,35 +16820,41 @@ function _typeof(o) {
16718
16820
  url.searchParams.set("type", fireFlyPlaformType[platform][contentType]);
16719
16821
  url.searchParams.set("start", String(start));
16720
16822
  url.searchParams.set("end", String(end));
16721
- _context11.next = 13;
16722
- return fetch(url.toString(), {
16823
+ _getUrlAndHeaders4 = getUrlAndHeaders({
16824
+ url: url.toString(),
16825
+ serviceName: "Firefly",
16723
16826
  headers: {
16724
16827
  "x-api-key": apiKey
16725
16828
  }
16829
+ }), finalUrl = _getUrlAndHeaders4.URL, HEADERS = _getUrlAndHeaders4.HEADERS;
16830
+ _context11.next = 14;
16831
+ return fetch(finalUrl, {
16832
+ method: "GET",
16833
+ headers: HEADERS
16726
16834
  });
16727
16835
 
16728
- case 13:
16836
+ case 14:
16729
16837
  response = _context11.sent;
16730
16838
  if (response.ok) {
16731
- _context11.next = 16;
16839
+ _context11.next = 17;
16732
16840
  break;
16733
16841
  }
16734
16842
  throw new NetworkError(SERVICES_API_KEY.Firefly, response.status);
16735
16843
 
16736
- case 16:
16737
- _context11.next = 18;
16844
+ case 17:
16845
+ _context11.next = 19;
16738
16846
  return response.json();
16739
16847
 
16740
- case 18:
16848
+ case 19:
16741
16849
  _yield$response$json = _context11.sent;
16742
16850
  _data = _yield$response$json.data;
16743
16851
  if (Array.isArray(_data)) {
16744
- _context11.next = 22;
16852
+ _context11.next = 23;
16745
16853
  break;
16746
16854
  }
16747
16855
  return _context11.abrupt("return", []);
16748
16856
 
16749
- case 22:
16857
+ case 23:
16750
16858
  return _context11.abrupt("return", _data.map((function(item) {
16751
16859
  var flat = {};
16752
16860
  for (var _i10 = 0, _Object$entries = Object.entries(item); _i10 < _Object$entries.length; _i10++) {
@@ -16759,16 +16867,16 @@ function _typeof(o) {
16759
16867
  return flat;
16760
16868
  })));
16761
16869
 
16762
- case 25:
16763
- _context11.prev = 25;
16870
+ case 26:
16871
+ _context11.prev = 26;
16764
16872
  _context11.t0 = _context11["catch"](0);
16765
16873
  return _context11.abrupt("return", errorMessageHandler(_context11.t0, "FIREFLY"));
16766
16874
 
16767
- case 28:
16875
+ case 29:
16768
16876
  case "end":
16769
16877
  return _context11.stop();
16770
16878
  }
16771
- }), _callee11, null, [ [ 0, 25 ] ]);
16879
+ }), _callee11, null, [ [ 0, 26 ] ]);
16772
16880
  })));
16773
16881
  return _FIREFLY.apply(this, arguments);
16774
16882
  }
@@ -16777,7 +16885,7 @@ function _typeof(o) {
16777
16885
  }
16778
16886
  function _LENS() {
16779
16887
  _LENS = _asyncToGenerator(_regeneratorRuntime().mark((function _callee12() {
16780
- var _argsToArray5, _argsToArray6, contentType, identifier, _argsToArray6$, start, _argsToArray6$2, end, apiKey, url, typeMap, response, _yield$response$json2, _data2, _args12 = arguments;
16888
+ var _argsToArray5, _argsToArray6, contentType, identifier, _argsToArray6$, start, _argsToArray6$2, end, apiKey, url, typeMap, _getUrlAndHeaders5, finalUrl, HEADERS, response, _yield$response$json2, _data2, _args12 = arguments;
16781
16889
  return _regeneratorRuntime().wrap((function _callee12$(_context12) {
16782
16890
  while (1) switch (_context12.prev = _context12.next) {
16783
16891
  case 0:
@@ -16811,35 +16919,41 @@ function _typeof(o) {
16811
16919
  url.searchParams.set("type", typeMap[contentType]);
16812
16920
  url.searchParams.set("start", String(start));
16813
16921
  url.searchParams.set("end", String(end));
16814
- _context12.next = 14;
16815
- return fetch(url.toString(), {
16922
+ _getUrlAndHeaders5 = getUrlAndHeaders({
16923
+ url: url.toString(),
16924
+ serviceName: "Firefly",
16816
16925
  headers: {
16817
16926
  "x-api-key": apiKey
16818
16927
  }
16928
+ }), finalUrl = _getUrlAndHeaders5.URL, HEADERS = _getUrlAndHeaders5.HEADERS;
16929
+ _context12.next = 15;
16930
+ return fetch(finalUrl, {
16931
+ method: "GET",
16932
+ headers: HEADERS
16819
16933
  });
16820
16934
 
16821
- case 14:
16935
+ case 15:
16822
16936
  response = _context12.sent;
16823
16937
  if (response.ok) {
16824
- _context12.next = 17;
16938
+ _context12.next = 18;
16825
16939
  break;
16826
16940
  }
16827
16941
  throw new NetworkError(SERVICES_API_KEY.Firefly, response.status);
16828
16942
 
16829
- case 17:
16830
- _context12.next = 19;
16943
+ case 18:
16944
+ _context12.next = 20;
16831
16945
  return response.json();
16832
16946
 
16833
- case 19:
16947
+ case 20:
16834
16948
  _yield$response$json2 = _context12.sent;
16835
16949
  _data2 = _yield$response$json2.data;
16836
16950
  if (Array.isArray(_data2)) {
16837
- _context12.next = 23;
16951
+ _context12.next = 24;
16838
16952
  break;
16839
16953
  }
16840
16954
  return _context12.abrupt("return", []);
16841
16955
 
16842
- case 23:
16956
+ case 24:
16843
16957
  return _context12.abrupt("return", _data2.map((function(item) {
16844
16958
  var flat = {};
16845
16959
  for (var _i11 = 0, _Object$entries2 = Object.entries(item); _i11 < _Object$entries2.length; _i11++) {
@@ -16852,16 +16966,16 @@ function _typeof(o) {
16852
16966
  return flat;
16853
16967
  })));
16854
16968
 
16855
- case 26:
16856
- _context12.prev = 26;
16969
+ case 27:
16970
+ _context12.prev = 27;
16857
16971
  _context12.t0 = _context12["catch"](0);
16858
16972
  return _context12.abrupt("return", errorMessageHandler(_context12.t0, "LENS"));
16859
16973
 
16860
- case 29:
16974
+ case 30:
16861
16975
  case "end":
16862
16976
  return _context12.stop();
16863
16977
  }
16864
- }), _callee12, null, [ [ 0, 26 ] ]);
16978
+ }), _callee12, null, [ [ 0, 27 ] ]);
16865
16979
  })));
16866
16980
  return _LENS.apply(this, arguments);
16867
16981
  }
@@ -16870,7 +16984,7 @@ function _typeof(o) {
16870
16984
  }
16871
16985
  function _FARCASTER() {
16872
16986
  _FARCASTER = _asyncToGenerator(_regeneratorRuntime().mark((function _callee13() {
16873
- var _argsToArray7, _argsToArray8, contentType, identifier, _argsToArray8$, start, _argsToArray8$2, end, apiKey, url, typeMap, response, _yield$response$json3, _data3, _args13 = arguments;
16987
+ var _argsToArray7, _argsToArray8, contentType, identifier, _argsToArray8$, start, _argsToArray8$2, end, apiKey, url, typeMap, _getUrlAndHeaders6, finalUrl, HEADERS, response, _yield$response$json3, _data3, _args13 = arguments;
16874
16988
  return _regeneratorRuntime().wrap((function _callee13$(_context13) {
16875
16989
  while (1) switch (_context13.prev = _context13.next) {
16876
16990
  case 0:
@@ -16905,35 +17019,41 @@ function _typeof(o) {
16905
17019
  url.searchParams.set("type", typeMap[contentType]);
16906
17020
  url.searchParams.set("start", String(start));
16907
17021
  url.searchParams.set("end", String(end));
16908
- _context13.next = 14;
16909
- return fetch(url.toString(), {
17022
+ _getUrlAndHeaders6 = getUrlAndHeaders({
17023
+ url: url.toString(),
17024
+ serviceName: "Firefly",
16910
17025
  headers: {
16911
17026
  "x-api-key": apiKey
16912
17027
  }
17028
+ }), finalUrl = _getUrlAndHeaders6.URL, HEADERS = _getUrlAndHeaders6.HEADERS;
17029
+ _context13.next = 15;
17030
+ return fetch(finalUrl, {
17031
+ method: "GET",
17032
+ headers: HEADERS
16913
17033
  });
16914
17034
 
16915
- case 14:
17035
+ case 15:
16916
17036
  response = _context13.sent;
16917
17037
  if (response.ok) {
16918
- _context13.next = 17;
17038
+ _context13.next = 18;
16919
17039
  break;
16920
17040
  }
16921
17041
  throw new NetworkError(SERVICES_API_KEY.Firefly, response.status);
16922
17042
 
16923
- case 17:
16924
- _context13.next = 19;
17043
+ case 18:
17044
+ _context13.next = 20;
16925
17045
  return response.json();
16926
17046
 
16927
- case 19:
17047
+ case 20:
16928
17048
  _yield$response$json3 = _context13.sent;
16929
17049
  _data3 = _yield$response$json3.data;
16930
17050
  if (Array.isArray(_data3)) {
16931
- _context13.next = 23;
17051
+ _context13.next = 24;
16932
17052
  break;
16933
17053
  }
16934
17054
  return _context13.abrupt("return", []);
16935
17055
 
16936
- case 23:
17056
+ case 24:
16937
17057
  return _context13.abrupt("return", _data3.map((function(item) {
16938
17058
  var flat = {};
16939
17059
  for (var _i12 = 0, _Object$entries3 = Object.entries(item); _i12 < _Object$entries3.length; _i12++) {
@@ -16946,16 +17066,16 @@ function _typeof(o) {
16946
17066
  return flat;
16947
17067
  })));
16948
17068
 
16949
- case 26:
16950
- _context13.prev = 26;
17069
+ case 27:
17070
+ _context13.prev = 27;
16951
17071
  _context13.t0 = _context13["catch"](0);
16952
17072
  return _context13.abrupt("return", errorMessageHandler(_context13.t0, "FARCASTER"));
16953
17073
 
16954
- case 29:
17074
+ case 30:
16955
17075
  case "end":
16956
17076
  return _context13.stop();
16957
17077
  }
16958
- }), _callee13, null, [ [ 0, 26 ] ]);
17078
+ }), _callee13, null, [ [ 0, 27 ] ]);
16959
17079
  })));
16960
17080
  return _FARCASTER.apply(this, arguments);
16961
17081
  }
@@ -17190,7 +17310,7 @@ function _typeof(o) {
17190
17310
  }
17191
17311
  function _NEYNAR() {
17192
17312
  _NEYNAR = _asyncToGenerator(_regeneratorRuntime().mark((function _callee17() {
17193
- var neynarParamsSchema, _argsToArray13, _argsToArray14, username, apiKey, fid, url, response, json, users, _args17 = arguments;
17313
+ var neynarParamsSchema, _argsToArray13, _argsToArray14, username, apiKey, fid, url, _getUrlAndHeaders7, finalUrl, HEADERS, response, json, users, _args17 = arguments;
17194
17314
  return _regeneratorRuntime().wrap((function _callee17$(_context17) {
17195
17315
  while (1) switch (_context17.prev = _context17.next) {
17196
17316
  case 0:
@@ -17224,39 +17344,45 @@ function _typeof(o) {
17224
17344
 
17225
17345
  case 12:
17226
17346
  url = "https://api.neynar.com/v2/farcaster/followers?fid=".concat(fid);
17227
- _context17.next = 15;
17228
- return fetch(url, {
17347
+ _getUrlAndHeaders7 = getUrlAndHeaders({
17348
+ url: url.toString(),
17349
+ serviceName: "Firefly",
17229
17350
  headers: {
17230
17351
  "x-api-key": apiKey,
17231
17352
  "x-neynar-experimental": "false"
17232
17353
  }
17354
+ }), finalUrl = _getUrlAndHeaders7.URL, HEADERS = _getUrlAndHeaders7.HEADERS;
17355
+ _context17.next = 16;
17356
+ return fetch(finalUrl, {
17357
+ method: "GET",
17358
+ headers: HEADERS
17233
17359
  });
17234
17360
 
17235
- case 15:
17361
+ case 16:
17236
17362
  response = _context17.sent;
17237
17363
  if (response.ok) {
17238
- _context17.next = 18;
17364
+ _context17.next = 19;
17239
17365
  break;
17240
17366
  }
17241
17367
  throw new NetworkError(SERVICES_API_KEY.Neynar, response.status);
17242
17368
 
17243
- case 18:
17244
- _context17.next = 20;
17369
+ case 19:
17370
+ _context17.next = 21;
17245
17371
  return response.json();
17246
17372
 
17247
- case 20:
17373
+ case 21:
17248
17374
  json = _context17.sent;
17249
17375
  users = (json === null || json === void 0 ? void 0 : json.users) || [];
17250
17376
  if (users.length) {
17251
- _context17.next = 24;
17377
+ _context17.next = 25;
17252
17378
  break;
17253
17379
  }
17254
17380
  return _context17.abrupt("return", []);
17255
17381
 
17256
- case 24:
17257
- return _context17.abrupt("return", users.map((function(_ref13) {
17382
+ case 25:
17383
+ return _context17.abrupt("return", users.map((function(_ref14) {
17258
17384
  var _user$profile, _user$profile2;
17259
- var user = _ref13.user;
17385
+ var user = _ref14.user;
17260
17386
  return {
17261
17387
  username: user.username,
17262
17388
  custody_address: user.custody_address,
@@ -17266,16 +17392,16 @@ function _typeof(o) {
17266
17392
  };
17267
17393
  })));
17268
17394
 
17269
- case 27:
17270
- _context17.prev = 27;
17395
+ case 28:
17396
+ _context17.prev = 28;
17271
17397
  _context17.t0 = _context17["catch"](0);
17272
17398
  return _context17.abrupt("return", errorMessageHandler(_context17.t0, "NEYNAR"));
17273
17399
 
17274
- case 30:
17400
+ case 31:
17275
17401
  case "end":
17276
17402
  return _context17.stop();
17277
17403
  }
17278
- }), _callee17, null, [ [ 0, 27 ] ]);
17404
+ }), _callee17, null, [ [ 0, 28 ] ]);
17279
17405
  })));
17280
17406
  return _NEYNAR.apply(this, arguments);
17281
17407
  }
@@ -17354,7 +17480,7 @@ function _typeof(o) {
17354
17480
  }
17355
17481
  function _COINGECKO() {
17356
17482
  _COINGECKO = _asyncToGenerator(_regeneratorRuntime().mark((function _callee19() {
17357
- var _category$toLowerCase, _argsToArray17, _argsToArray18, category, param1, param2, apiKey, headers, url, vs, map, _category, trend, _category2, _trend, res, json, _json$status, msg, out, _i13, _Object$entries4, _Object$entries4$_i, token, prices, _i14, _Object$entries5, _Object$entries5$_i, cur, val, _data4, _args19 = arguments;
17483
+ 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, _args19 = arguments;
17358
17484
  return _regeneratorRuntime().wrap((function _callee19$(_context19) {
17359
17485
  while (1) switch (_context19.prev = _context19.next) {
17360
17486
  case 0:
@@ -17416,35 +17542,40 @@ function _typeof(o) {
17416
17542
  return _context19.abrupt("break", 25);
17417
17543
 
17418
17544
  case 25:
17419
- _context19.next = 27;
17420
- return fetch(url, {
17545
+ _getUrlAndHeaders8 = getUrlAndHeaders({
17546
+ url: url,
17547
+ serviceName: "Coingecko",
17421
17548
  headers: headers
17549
+ }), finalUrl = _getUrlAndHeaders8.URL, HEADERS = _getUrlAndHeaders8.HEADERS;
17550
+ _context19.next = 28;
17551
+ return fetch(finalUrl, {
17552
+ headers: HEADERS
17422
17553
  });
17423
17554
 
17424
- case 27:
17555
+ case 28:
17425
17556
  res = _context19.sent;
17426
- _context19.next = 30;
17557
+ _context19.next = 31;
17427
17558
  return res.json();
17428
17559
 
17429
- case 30:
17560
+ case 31:
17430
17561
  json = _context19.sent;
17431
17562
  if (res.ok) {
17432
- _context19.next = 36;
17563
+ _context19.next = 37;
17433
17564
  break;
17434
17565
  }
17435
17566
  msg = (json === null || json === void 0 || (_json$status = json.status) === null || _json$status === void 0 ? void 0 : _json$status.error_message) || "";
17436
17567
  if (!msg.includes("API Key Missing")) {
17437
- _context19.next = 35;
17568
+ _context19.next = 36;
17438
17569
  break;
17439
17570
  }
17440
17571
  throw new InvalidApiKeyError(SERVICES_API_KEY.Coingecko);
17441
17572
 
17442
- case 35:
17573
+ case 36:
17443
17574
  throw new NetworkError(SERVICES_API_KEY.Coingecko, res.status);
17444
17575
 
17445
- case 36:
17576
+ case 37:
17446
17577
  if (!(category === "price")) {
17447
- _context19.next = 40;
17578
+ _context19.next = 41;
17448
17579
  break;
17449
17580
  }
17450
17581
  out = {};
@@ -17459,7 +17590,7 @@ function _typeof(o) {
17459
17590
  }
17460
17591
  return _context19.abrupt("return", [ out ]);
17461
17592
 
17462
- case 40:
17593
+ case 41:
17463
17594
  _data4 = Array.isArray(json) ? json : [ json ];
17464
17595
  return _context19.abrupt("return", _data4.map((function(item) {
17465
17596
  var flat = {};
@@ -17472,16 +17603,16 @@ function _typeof(o) {
17472
17603
  return flat;
17473
17604
  })));
17474
17605
 
17475
- case 44:
17476
- _context19.prev = 44;
17606
+ case 45:
17607
+ _context19.prev = 45;
17477
17608
  _context19.t1 = _context19["catch"](0);
17478
17609
  return _context19.abrupt("return", errorMessageHandler(_context19.t1, "COINGECKO"));
17479
17610
 
17480
- case 47:
17611
+ case 48:
17481
17612
  case "end":
17482
17613
  return _context19.stop();
17483
17614
  }
17484
- }), _callee19, null, [ [ 0, 44 ] ]);
17615
+ }), _callee19, null, [ [ 0, 45 ] ]);
17485
17616
  })));
17486
17617
  return _COINGECKO.apply(this, arguments);
17487
17618
  }
@@ -17494,58 +17625,68 @@ function _typeof(o) {
17494
17625
  return _regeneratorRuntime().wrap((function _callee21$(_context24) {
17495
17626
  while (1) switch (_context24.prev = _context24.next) {
17496
17627
  case 0:
17497
- _context24.prev = 0;
17628
+ console.log("EOA");
17629
+ _context24.prev = 1;
17498
17630
  fetchJSON = function() {
17499
- var _ref14 = _asyncToGenerator(_regeneratorRuntime().mark((function _callee20(url) {
17500
- var res, json;
17631
+ var _ref15 = _asyncToGenerator(_regeneratorRuntime().mark((function _callee20(url) {
17632
+ var _getUrlAndHeaders9, finalUrl, HEADERS, res, json;
17501
17633
  return _regeneratorRuntime().wrap((function _callee20$(_context20) {
17502
17634
  while (1) switch (_context20.prev = _context20.next) {
17503
17635
  case 0:
17504
- _context20.next = 2;
17505
- return fetch(url);
17636
+ _getUrlAndHeaders9 = getUrlAndHeaders({
17637
+ url: url,
17638
+ serviceName: "Etherscan",
17639
+ headers: {}
17640
+ }), finalUrl = _getUrlAndHeaders9.URL, HEADERS = _getUrlAndHeaders9.HEADERS;
17641
+ console.log("finalUrl", finalUrl, HEADERS);
17642
+ _context20.next = 4;
17643
+ return fetch(finalUrl, {
17644
+ method: "GET",
17645
+ headers: HEADERS
17646
+ });
17506
17647
 
17507
- case 2:
17648
+ case 4:
17508
17649
  res = _context20.sent;
17509
17650
  if (res.ok) {
17510
- _context20.next = 5;
17651
+ _context20.next = 7;
17511
17652
  break;
17512
17653
  }
17513
17654
  throw new NetworkError(SERVICES_API_KEY.Etherscan, res.status);
17514
17655
 
17515
- case 5:
17516
- _context20.next = 7;
17656
+ case 7:
17657
+ _context20.next = 9;
17517
17658
  return res.json();
17518
17659
 
17519
- case 7:
17660
+ case 9:
17520
17661
  json = _context20.sent;
17521
17662
  if (!(typeof json.result === "string")) {
17522
- _context20.next = 13;
17663
+ _context20.next = 15;
17523
17664
  break;
17524
17665
  }
17525
17666
  if (!json.result.includes("Invalid API Key")) {
17526
- _context20.next = 11;
17667
+ _context20.next = 13;
17527
17668
  break;
17528
17669
  }
17529
17670
  throw new InvalidApiKeyError(SERVICES_API_KEY.Etherscan);
17530
17671
 
17531
- case 11:
17672
+ case 13:
17532
17673
  if (!json.result.includes("Max rate limit reached")) {
17533
- _context20.next = 13;
17674
+ _context20.next = 15;
17534
17675
  break;
17535
17676
  }
17536
17677
  throw new RateLimitError(SERVICES_API_KEY.Etherscan);
17537
17678
 
17538
- case 13:
17679
+ case 15:
17539
17680
  return _context20.abrupt("return", json.result);
17540
17681
 
17541
- case 14:
17682
+ case 16:
17542
17683
  case "end":
17543
17684
  return _context20.stop();
17544
17685
  }
17545
17686
  }), _callee20);
17546
17687
  })));
17547
17688
  return function fetchJSON(_x17) {
17548
- return _ref14.apply(this, arguments);
17689
+ return _ref15.apply(this, arguments);
17549
17690
  };
17550
17691
  }();
17551
17692
  _argsToArray19 = argsToArray(_args24), _argsToArray20 = _slicedToArray(_argsToArray19, 7),
@@ -17563,13 +17704,14 @@ function _typeof(o) {
17563
17704
  offset: offset
17564
17705
  });
17565
17706
  apiKey = window.localStorage.getItem(SERVICES_API_KEY.Etherscan);
17707
+ console.log("apiKey", apiKey);
17566
17708
  if (apiKey) {
17567
- _context24.next = 7;
17709
+ _context24.next = 9;
17568
17710
  break;
17569
17711
  }
17570
17712
  throw new MissingApiKeyError(SERVICES_API_KEY.Etherscan);
17571
17713
 
17572
- case 7:
17714
+ case 9:
17573
17715
  INPUTS = addresses.split(",").map((function(s) {
17574
17716
  return s.trim();
17575
17717
  })).filter(Boolean);
@@ -17578,80 +17720,84 @@ function _typeof(o) {
17578
17720
  })).filter(Boolean);
17579
17721
  ADDRESS_MAP = {};
17580
17722
  _iterator41 = _createForOfIteratorHelper(INPUTS);
17581
- _context24.prev = 11;
17723
+ _context24.prev = 13;
17582
17724
  _iterator41.s();
17583
17725
 
17584
- case 13:
17726
+ case 15:
17585
17727
  if ((_step41 = _iterator41.n()).done) {
17586
- _context24.next = 28;
17728
+ _context24.next = 30;
17587
17729
  break;
17588
17730
  }
17589
17731
  inp = _step41.value;
17590
17732
  if (!isAddress$1.isAddress(inp)) {
17591
- _context24.next = 19;
17733
+ _context24.next = 21;
17592
17734
  break;
17593
17735
  }
17594
17736
  ADDRESS_MAP[inp.toLowerCase()] = null;
17595
- _context24.next = 26;
17737
+ _context24.next = 28;
17596
17738
  break;
17597
17739
 
17598
- case 19:
17740
+ case 21:
17599
17741
  ens = inp;
17600
- _context24.next = 22;
17742
+ _context24.next = 24;
17601
17743
  return fromEnsNameToAddress$1.fromEnsNameToAddress(ens);
17602
17744
 
17603
- case 22:
17745
+ case 24:
17604
17746
  resolved = _context24.sent;
17605
17747
  if (resolved) {
17606
- _context24.next = 25;
17748
+ _context24.next = 27;
17607
17749
  break;
17608
17750
  }
17609
17751
  throw new EnsError(ens);
17610
17752
 
17611
- case 25:
17753
+ case 27:
17612
17754
  ADDRESS_MAP[resolved.toLowerCase()] = ens;
17613
17755
 
17614
- case 26:
17615
- _context24.next = 13;
17616
- break;
17617
-
17618
17756
  case 28:
17619
- _context24.next = 33;
17757
+ _context24.next = 15;
17620
17758
  break;
17621
17759
 
17622
17760
  case 30:
17623
- _context24.prev = 30;
17624
- _context24.t0 = _context24["catch"](11);
17761
+ _context24.next = 35;
17762
+ break;
17763
+
17764
+ case 32:
17765
+ _context24.prev = 32;
17766
+ _context24.t0 = _context24["catch"](13);
17625
17767
  _iterator41.e(_context24.t0);
17626
17768
 
17627
- case 33:
17628
- _context24.prev = 33;
17769
+ case 35:
17770
+ _context24.prev = 35;
17629
17771
  _iterator41.f();
17630
- return _context24.finish(33);
17772
+ return _context24.finish(35);
17631
17773
 
17632
- case 36:
17774
+ case 38:
17633
17775
  ADDRS = Object.keys(ADDRESS_MAP);
17776
+ console.log("ADDRS", ADDRS);
17634
17777
  out = [];
17635
17778
  _iterator42 = _createForOfIteratorHelper(CHAINS);
17636
- _context24.prev = 39;
17779
+ _context24.prev = 42;
17637
17780
  _loop = _regeneratorRuntime().mark((function _loop() {
17638
17781
  var chain, chainId, _loop2, _ret2, i, sb, eb, _loop3, _ret3, _i16, _ADDRS;
17639
17782
  return _regeneratorRuntime().wrap((function _loop$(_context23) {
17640
17783
  while (1) switch (_context23.prev = _context23.next) {
17641
17784
  case 0:
17642
17785
  chain = _step42.value;
17786
+ console.log("chain", chain);
17643
17787
  chainId = CHAIN_ID_MAP[chain];
17644
17788
  if (chainId) {
17645
- _context23.next = 4;
17789
+ _context23.next = 5;
17646
17790
  break;
17647
17791
  }
17648
17792
  throw new ValidationError("Invalid chain: ".concat(chain));
17649
17793
 
17650
- case 4:
17794
+ case 5:
17795
+ console.log("chain", chain);
17651
17796
  if (!(category === "balance")) {
17652
- _context23.next = 17;
17797
+ _context23.next = 20;
17653
17798
  break;
17654
17799
  }
17800
+ console.log("balance");
17655
17801
  _loop2 = _regeneratorRuntime().mark((function _loop2(i) {
17656
17802
  var slice, url, data;
17657
17803
  return _regeneratorRuntime().wrap((function _loop2$(_context21) {
@@ -17691,55 +17837,57 @@ function _typeof(o) {
17691
17837
  }));
17692
17838
  i = 0;
17693
17839
 
17694
- case 7:
17840
+ case 10:
17695
17841
  if (!(i < ADDRS.length)) {
17696
- _context23.next = 15;
17842
+ _context23.next = 18;
17697
17843
  break;
17698
17844
  }
17699
- return _context23.delegateYield(_loop2(i), "t0", 9);
17845
+ return _context23.delegateYield(_loop2(i), "t0", 12);
17700
17846
 
17701
- case 9:
17847
+ case 12:
17702
17848
  _ret2 = _context23.t0;
17703
17849
  if (!_ret2) {
17704
- _context23.next = 12;
17850
+ _context23.next = 15;
17705
17851
  break;
17706
17852
  }
17707
17853
  return _context23.abrupt("return", _ret2.v);
17708
17854
 
17709
- case 12:
17855
+ case 15:
17710
17856
  i += 20;
17711
- _context23.next = 7;
17857
+ _context23.next = 10;
17712
17858
  break;
17713
17859
 
17714
- case 15:
17715
- _context23.next = 37;
17860
+ case 18:
17861
+ _context23.next = 42;
17716
17862
  break;
17717
17863
 
17718
- case 17:
17719
- _context23.next = 19;
17864
+ case 20:
17865
+ console.log("startTime", startTime, "endTime", endTime, chain, apiKey);
17866
+ _context23.next = 23;
17720
17867
  return fromTimestampToBlock.fromTimeStampToBlock(toTimestamp(startTime), chain, apiKey);
17721
17868
 
17722
- case 19:
17869
+ case 23:
17723
17870
  sb = _context23.sent;
17724
- _context23.next = 22;
17871
+ _context23.next = 26;
17725
17872
  return fromTimestampToBlock.fromTimeStampToBlock(toTimestamp(endTime), chain, apiKey);
17726
17873
 
17727
- case 22:
17874
+ case 26:
17728
17875
  eb = _context23.sent;
17876
+ console.log("sb", sb, "eb", eb);
17729
17877
  if (sb) {
17730
- _context23.next = 25;
17878
+ _context23.next = 30;
17731
17879
  break;
17732
17880
  }
17733
17881
  throw new ValidationError("Invalid startTime: ".concat(startTime));
17734
17882
 
17735
- case 25:
17883
+ case 30:
17736
17884
  if (eb) {
17737
- _context23.next = 27;
17885
+ _context23.next = 32;
17738
17886
  break;
17739
17887
  }
17740
17888
  throw new ValidationError("Invalid endTime: ".concat(endTime));
17741
17889
 
17742
- case 27:
17890
+ case 32:
17743
17891
  _loop3 = _regeneratorRuntime().mark((function _loop3() {
17744
17892
  var addr, url, data;
17745
17893
  return _regeneratorRuntime().wrap((function _loop3$(_context22) {
@@ -17779,27 +17927,27 @@ function _typeof(o) {
17779
17927
  }));
17780
17928
  _i16 = 0, _ADDRS = ADDRS;
17781
17929
 
17782
- case 29:
17930
+ case 34:
17783
17931
  if (!(_i16 < _ADDRS.length)) {
17784
- _context23.next = 37;
17932
+ _context23.next = 42;
17785
17933
  break;
17786
17934
  }
17787
- return _context23.delegateYield(_loop3(), "t1", 31);
17935
+ return _context23.delegateYield(_loop3(), "t1", 36);
17788
17936
 
17789
- case 31:
17937
+ case 36:
17790
17938
  _ret3 = _context23.t1;
17791
17939
  if (!_ret3) {
17792
- _context23.next = 34;
17940
+ _context23.next = 39;
17793
17941
  break;
17794
17942
  }
17795
17943
  return _context23.abrupt("return", _ret3.v);
17796
17944
 
17797
- case 34:
17945
+ case 39:
17798
17946
  _i16++;
17799
- _context23.next = 29;
17947
+ _context23.next = 34;
17800
17948
  break;
17801
17949
 
17802
- case 37:
17950
+ case 42:
17803
17951
  case "end":
17804
17952
  return _context23.stop();
17805
17953
  }
@@ -17807,52 +17955,52 @@ function _typeof(o) {
17807
17955
  }));
17808
17956
  _iterator42.s();
17809
17957
 
17810
- case 42:
17958
+ case 45:
17811
17959
  if ((_step42 = _iterator42.n()).done) {
17812
- _context24.next = 49;
17960
+ _context24.next = 52;
17813
17961
  break;
17814
17962
  }
17815
- return _context24.delegateYield(_loop(), "t1", 44);
17963
+ return _context24.delegateYield(_loop(), "t1", 47);
17816
17964
 
17817
- case 44:
17965
+ case 47:
17818
17966
  _ret = _context24.t1;
17819
17967
  if (!_ret) {
17820
- _context24.next = 47;
17968
+ _context24.next = 50;
17821
17969
  break;
17822
17970
  }
17823
17971
  return _context24.abrupt("return", _ret.v);
17824
17972
 
17825
- case 47:
17826
- _context24.next = 42;
17973
+ case 50:
17974
+ _context24.next = 45;
17827
17975
  break;
17828
17976
 
17829
- case 49:
17830
- _context24.next = 54;
17977
+ case 52:
17978
+ _context24.next = 57;
17831
17979
  break;
17832
17980
 
17833
- case 51:
17834
- _context24.prev = 51;
17835
- _context24.t2 = _context24["catch"](39);
17836
- _iterator42.e(_context24.t2);
17837
-
17838
17981
  case 54:
17839
17982
  _context24.prev = 54;
17840
- _iterator42.f();
17841
- return _context24.finish(54);
17983
+ _context24.t2 = _context24["catch"](42);
17984
+ _iterator42.e(_context24.t2);
17842
17985
 
17843
17986
  case 57:
17844
- return _context24.abrupt("return", out);
17987
+ _context24.prev = 57;
17988
+ _iterator42.f();
17989
+ return _context24.finish(57);
17845
17990
 
17846
17991
  case 60:
17847
- _context24.prev = 60;
17848
- _context24.t3 = _context24["catch"](0);
17849
- return _context24.abrupt("return", errorMessageHandler(_context24.t3, "EOA"));
17992
+ return _context24.abrupt("return", out);
17850
17993
 
17851
17994
  case 63:
17995
+ _context24.prev = 63;
17996
+ _context24.t3 = _context24["catch"](1);
17997
+ return _context24.abrupt("return", errorMessageHandler(_context24.t3, "EOA"));
17998
+
17999
+ case 66:
17852
18000
  case "end":
17853
18001
  return _context24.stop();
17854
18002
  }
17855
- }), _callee21, null, [ [ 0, 60 ], [ 11, 30, 33, 36 ], [ 39, 51, 54, 57 ] ]);
18003
+ }), _callee21, null, [ [ 1, 63 ], [ 13, 32, 35, 38 ], [ 42, 54, 57, 60 ] ]);
17856
18004
  })));
17857
18005
  return _EOA.apply(this, arguments);
17858
18006
  }
@@ -17885,7 +18033,7 @@ function _typeof(o) {
17885
18033
  }
17886
18034
  function _SAFE() {
17887
18035
  _SAFE = _asyncToGenerator(_regeneratorRuntime().mark((function _callee23() {
17888
- var _argsToArray21, _argsToArray22, address, utility, chain, _argsToArray22$, limit, _argsToArray22$2, offset, apiKey, chainId, resolved, ens, url, res, json, _args26 = arguments;
18036
+ var _argsToArray21, _argsToArray22, address, utility, chain, _argsToArray22$, limit, _argsToArray22$2, offset, apiKey, chainId, resolved, ens, url, _getUrlAndHeaders0, finalUrl, HEADERS, res, json, _args26 = arguments;
17889
18037
  return _regeneratorRuntime().wrap((function _callee23$(_context26) {
17890
18038
  while (1) switch (_context26.prev = _context26.next) {
17891
18039
  case 0:
@@ -17936,49 +18084,54 @@ function _typeof(o) {
17936
18084
 
17937
18085
  case 17:
17938
18086
  url = "https://api.safe.global/tx-service/".concat(chainId, "/api/v2/safes/").concat(resolved, "/multisig-transactions?limit=").concat(limit, "&offset=").concat(offset);
17939
- _context26.next = 20;
17940
- return fetch(url, {
18087
+ _getUrlAndHeaders0 = getUrlAndHeaders({
18088
+ url: url,
18089
+ serviceName: "Etherscan",
17941
18090
  headers: {
17942
18091
  Authorization: "Bearer ".concat(apiKey)
17943
18092
  }
18093
+ }), finalUrl = _getUrlAndHeaders0.URL, HEADERS = _getUrlAndHeaders0.HEADERS;
18094
+ _context26.next = 21;
18095
+ return fetch(finalUrl, {
18096
+ headers: HEADERS
17944
18097
  });
17945
18098
 
17946
- case 20:
18099
+ case 21:
17947
18100
  res = _context26.sent;
17948
18101
  if (res.ok) {
17949
- _context26.next = 23;
18102
+ _context26.next = 24;
17950
18103
  break;
17951
18104
  }
17952
18105
  throw new NetworkError(SERVICES_API_KEY.Safe, res.status);
17953
18106
 
17954
- case 23:
17955
- _context26.next = 25;
18107
+ case 24:
18108
+ _context26.next = 26;
17956
18109
  return res.json();
17957
18110
 
17958
- case 25:
18111
+ case 26:
17959
18112
  json = _context26.sent;
17960
18113
  if (Array.isArray(json.results)) {
17961
- _context26.next = 28;
18114
+ _context26.next = 29;
17962
18115
  break;
17963
18116
  }
17964
18117
  throw new ValidationError("Invalid API response");
17965
18118
 
17966
- case 28:
17967
- return _context26.abrupt("return", json.results.map((function(_ref15) {
17968
- var confirmations = _ref15.confirmations, dataDecoded = _ref15.dataDecoded, rest = _objectWithoutProperties(_ref15, _excluded);
18119
+ case 29:
18120
+ return _context26.abrupt("return", json.results.map((function(_ref16) {
18121
+ var confirmations = _ref16.confirmations, dataDecoded = _ref16.dataDecoded, rest = _objectWithoutProperties(_ref16, _excluded);
17969
18122
  return rest;
17970
18123
  })));
17971
18124
 
17972
- case 31:
17973
- _context26.prev = 31;
18125
+ case 32:
18126
+ _context26.prev = 32;
17974
18127
  _context26.t0 = _context26["catch"](0);
17975
18128
  return _context26.abrupt("return", errorMessageHandler(_context26.t0, "SAFE"));
17976
18129
 
17977
- case 34:
18130
+ case 35:
17978
18131
  case "end":
17979
18132
  return _context26.stop();
17980
18133
  }
17981
- }), _callee23, null, [ [ 0, 31 ] ]);
18134
+ }), _callee23, null, [ [ 0, 32 ] ]);
17982
18135
  })));
17983
18136
  return _SAFE.apply(this, arguments);
17984
18137
  }
@@ -18113,8 +18266,8 @@ function _typeof(o) {
18113
18266
  }
18114
18267
  return _context28.abrupt("return", json.map((function(item) {
18115
18268
  var flat = {};
18116
- Object.entries(item).forEach((function(_ref16) {
18117
- var _ref17 = _slicedToArray(_ref16, 2), k = _ref17[0], v = _ref17[1];
18269
+ Object.entries(item).forEach((function(_ref17) {
18270
+ var _ref18 = _slicedToArray(_ref17, 2), k = _ref18[0], v = _ref18[1];
18118
18271
  if (v === null || _typeof(v) !== "object") flat[k] = v;
18119
18272
  }));
18120
18273
  return flat;
@@ -18180,8 +18333,8 @@ function _typeof(o) {
18180
18333
  }
18181
18334
  return _context29.abrupt("return", json.map((function(item) {
18182
18335
  var flat = {};
18183
- Object.entries(item).forEach((function(_ref18) {
18184
- var _ref19 = _slicedToArray(_ref18, 2), k = _ref19[0], v = _ref19[1];
18336
+ Object.entries(item).forEach((function(_ref19) {
18337
+ var _ref20 = _slicedToArray(_ref19, 2), k = _ref20[0], v = _ref20[1];
18185
18338
  if (v === null || _typeof(v) !== "object") flat[k] = v;
18186
18339
  }));
18187
18340
  return flat;