@fileverse-dev/formulajs 4.4.11-mod-77 → 4.4.11-mod-79

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-77 */
1
+ /* @fileverse-dev/formulajs v4.4.11-mod-79 */
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) {
@@ -99,128 +67,6 @@ function _createForOfIteratorHelper(r, e) {
99
67
  };
100
68
  }
101
69
 
102
- function _defineProperties(e, r) {
103
- for (var t = 0; t < r.length; t++) {
104
- var o = r[t];
105
- o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0),
106
- Object.defineProperty(e, _toPropertyKey(o.key), o);
107
- }
108
- }
109
-
110
- function _createClass(e, r, t) {
111
- return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", {
112
- writable: !1
113
- }), e;
114
- }
115
-
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
- function _classCallCheck(a, n) {
133
- if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
134
- }
135
-
136
- function _callSuper(t, o, e) {
137
- return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e));
138
- }
139
-
140
- function _possibleConstructorReturn(t, e) {
141
- if (e && ("object" == _typeof(e) || "function" == typeof e)) return e;
142
- if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined");
143
- return _assertThisInitialized(t);
144
- }
145
-
146
- function _assertThisInitialized(e) {
147
- if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
148
- return e;
149
- }
150
-
151
- function _inherits(t, e) {
152
- if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
153
- t.prototype = Object.create(e && e.prototype, {
154
- constructor: {
155
- value: t,
156
- writable: !0,
157
- configurable: !0
158
- }
159
- }), Object.defineProperty(t, "prototype", {
160
- writable: !1
161
- }), e && _setPrototypeOf(t, e);
162
- }
163
-
164
- function _wrapNativeSuper(t) {
165
- var r = "function" == typeof Map ? new Map : void 0;
166
- return _wrapNativeSuper = function _wrapNativeSuper(t) {
167
- if (null === t || !_isNativeFunction(t)) return t;
168
- if ("function" != typeof t) throw new TypeError("Super expression must either be null or a function");
169
- if (void 0 !== r) {
170
- if (r.has(t)) return r.get(t);
171
- r.set(t, Wrapper);
172
- }
173
- function Wrapper() {
174
- return _construct(t, arguments, _getPrototypeOf(this).constructor);
175
- }
176
- return Wrapper.prototype = Object.create(t.prototype, {
177
- constructor: {
178
- value: Wrapper,
179
- enumerable: !1,
180
- writable: !0,
181
- configurable: !0
182
- }
183
- }), _setPrototypeOf(Wrapper, t);
184
- }, _wrapNativeSuper(t);
185
- }
186
-
187
- function _construct(t, e, r) {
188
- if (_isNativeReflectConstruct()) return Reflect.construct.apply(null, arguments);
189
- var o = [ null ];
190
- o.push.apply(o, e);
191
- var p = new (t.bind.apply(t, o));
192
- return r && _setPrototypeOf(p, r.prototype), p;
193
- }
194
-
195
- function _isNativeReflectConstruct() {
196
- try {
197
- var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], (function() {})));
198
- } catch (t) {}
199
- return (_isNativeReflectConstruct = function _isNativeReflectConstruct() {
200
- return !!t;
201
- })();
202
- }
203
-
204
- function _isNativeFunction(t) {
205
- try {
206
- return -1 !== Function.toString.call(t).indexOf("[native code]");
207
- } catch (n) {
208
- return "function" == typeof t;
209
- }
210
- }
211
-
212
- function _setPrototypeOf(t, e) {
213
- return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(t, e) {
214
- return t.__proto__ = e, t;
215
- }, _setPrototypeOf(t, e);
216
- }
217
-
218
- function _getPrototypeOf(t) {
219
- return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(t) {
220
- return t.__proto__ || Object.getPrototypeOf(t);
221
- }, _getPrototypeOf(t);
222
- }
223
-
224
70
  function _regeneratorRuntime() {
225
71
  "use strict";
226
72
  /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() {
@@ -511,6 +357,160 @@ function _asyncToGenerator(n) {
511
357
  };
512
358
  }
513
359
 
360
+ function ownKeys(e, r) {
361
+ var t = Object.keys(e);
362
+ if (Object.getOwnPropertySymbols) {
363
+ var o = Object.getOwnPropertySymbols(e);
364
+ r && (o = o.filter((function(r) {
365
+ return Object.getOwnPropertyDescriptor(e, r).enumerable;
366
+ }))), t.push.apply(t, o);
367
+ }
368
+ return t;
369
+ }
370
+
371
+ function _objectSpread(e) {
372
+ for (var r = 1; r < arguments.length; r++) {
373
+ var t = null != arguments[r] ? arguments[r] : {};
374
+ r % 2 ? ownKeys(Object(t), !0).forEach((function(r) {
375
+ _defineProperty(e, r, t[r]);
376
+ })) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach((function(r) {
377
+ Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
378
+ }));
379
+ }
380
+ return e;
381
+ }
382
+
383
+ function _defineProperty(e, r, t) {
384
+ return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
385
+ value: t,
386
+ enumerable: !0,
387
+ configurable: !0,
388
+ writable: !0
389
+ }) : e[r] = t, e;
390
+ }
391
+
392
+ function _defineProperties(e, r) {
393
+ for (var t = 0; t < r.length; t++) {
394
+ var o = r[t];
395
+ o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0),
396
+ Object.defineProperty(e, _toPropertyKey(o.key), o);
397
+ }
398
+ }
399
+
400
+ function _createClass(e, r, t) {
401
+ return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", {
402
+ writable: !1
403
+ }), e;
404
+ }
405
+
406
+ function _toPropertyKey(t) {
407
+ var i = _toPrimitive(t, "string");
408
+ return "symbol" == _typeof(i) ? i : i + "";
409
+ }
410
+
411
+ function _toPrimitive(t, r) {
412
+ if ("object" != _typeof(t) || !t) return t;
413
+ var e = t[Symbol.toPrimitive];
414
+ if (void 0 !== e) {
415
+ var i = e.call(t, r || "default");
416
+ if ("object" != _typeof(i)) return i;
417
+ throw new TypeError("@@toPrimitive must return a primitive value.");
418
+ }
419
+ return ("string" === r ? String : Number)(t);
420
+ }
421
+
422
+ function _classCallCheck(a, n) {
423
+ if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
424
+ }
425
+
426
+ function _callSuper(t, o, e) {
427
+ return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e));
428
+ }
429
+
430
+ function _possibleConstructorReturn(t, e) {
431
+ if (e && ("object" == _typeof(e) || "function" == typeof e)) return e;
432
+ if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined");
433
+ return _assertThisInitialized(t);
434
+ }
435
+
436
+ function _assertThisInitialized(e) {
437
+ if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
438
+ return e;
439
+ }
440
+
441
+ function _inherits(t, e) {
442
+ if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
443
+ t.prototype = Object.create(e && e.prototype, {
444
+ constructor: {
445
+ value: t,
446
+ writable: !0,
447
+ configurable: !0
448
+ }
449
+ }), Object.defineProperty(t, "prototype", {
450
+ writable: !1
451
+ }), e && _setPrototypeOf(t, e);
452
+ }
453
+
454
+ function _wrapNativeSuper(t) {
455
+ var r = "function" == typeof Map ? new Map : void 0;
456
+ return _wrapNativeSuper = function _wrapNativeSuper(t) {
457
+ if (null === t || !_isNativeFunction(t)) return t;
458
+ if ("function" != typeof t) throw new TypeError("Super expression must either be null or a function");
459
+ if (void 0 !== r) {
460
+ if (r.has(t)) return r.get(t);
461
+ r.set(t, Wrapper);
462
+ }
463
+ function Wrapper() {
464
+ return _construct(t, arguments, _getPrototypeOf(this).constructor);
465
+ }
466
+ return Wrapper.prototype = Object.create(t.prototype, {
467
+ constructor: {
468
+ value: Wrapper,
469
+ enumerable: !1,
470
+ writable: !0,
471
+ configurable: !0
472
+ }
473
+ }), _setPrototypeOf(Wrapper, t);
474
+ }, _wrapNativeSuper(t);
475
+ }
476
+
477
+ function _construct(t, e, r) {
478
+ if (_isNativeReflectConstruct()) return Reflect.construct.apply(null, arguments);
479
+ var o = [ null ];
480
+ o.push.apply(o, e);
481
+ var p = new (t.bind.apply(t, o));
482
+ return r && _setPrototypeOf(p, r.prototype), p;
483
+ }
484
+
485
+ function _isNativeReflectConstruct() {
486
+ try {
487
+ var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], (function() {})));
488
+ } catch (t) {}
489
+ return (_isNativeReflectConstruct = function _isNativeReflectConstruct() {
490
+ return !!t;
491
+ })();
492
+ }
493
+
494
+ function _isNativeFunction(t) {
495
+ try {
496
+ return -1 !== Function.toString.call(t).indexOf("[native code]");
497
+ } catch (n) {
498
+ return "function" == typeof t;
499
+ }
500
+ }
501
+
502
+ function _setPrototypeOf(t, e) {
503
+ return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(t, e) {
504
+ return t.__proto__ = e, t;
505
+ }, _setPrototypeOf(t, e);
506
+ }
507
+
508
+ function _getPrototypeOf(t) {
509
+ return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(t) {
510
+ return t.__proto__ || Object.getPrototypeOf(t);
511
+ }, _getPrototypeOf(t);
512
+ }
513
+
514
514
  function _slicedToArray(r, e) {
515
515
  return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
516
516
  }
@@ -589,6 +589,7 @@ function _typeof(o) {
589
589
  factory(global.formulajs = {}));
590
590
  })(this, (function(exports) {
591
591
  "use strict";
592
+ var _process;
592
593
  var nil = new Error("#NULL!");
593
594
  var div0 = new Error("#DIV/0!");
594
595
  var value = new Error("#VALUE!");
@@ -11068,51 +11069,6 @@ function _typeof(o) {
11068
11069
  Neynar: "Neynar",
11069
11070
  Defillama: "Defillama"
11070
11071
  };
11071
- var fromTimeStampToBlock = function() {
11072
- var _ref = _asyncToGenerator(_regeneratorRuntime().mark((function _callee(timestamp, chain, apiKey) {
11073
- var chainId, url, res, json;
11074
- return _regeneratorRuntime().wrap((function _callee$(_context) {
11075
- while (1) switch (_context.prev = _context.next) {
11076
- case 0:
11077
- if (!(!timestamp || !chain || !apiKey)) {
11078
- _context.next = 2;
11079
- break;
11080
- }
11081
- return _context.abrupt("return");
11082
-
11083
- case 2:
11084
- chainId = CHAIN_ID_MAP[chain];
11085
- 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);
11088
-
11089
- case 6:
11090
- res = _context.sent;
11091
- _context.next = 9;
11092
- return res.json();
11093
-
11094
- case 9:
11095
- json = _context.sent;
11096
- return _context.abrupt("return", parseInt(json.result));
11097
-
11098
- case 11:
11099
- case "end":
11100
- return _context.stop();
11101
- }
11102
- }), _callee);
11103
- })));
11104
- return function fromTimeStampToBlock(_x2, _x3, _x4) {
11105
- return _ref.apply(this, arguments);
11106
- };
11107
- }();
11108
- var fromTimestampToBlock = {
11109
- fromTimeStampToBlock: fromTimeStampToBlock
11110
- };
11111
- function toTimestamp(dateStr) {
11112
- 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];
11113
- var date = new Date(year, month - 1, day);
11114
- return Math.floor(date.getTime() / 1e3);
11115
- }
11116
11072
  var ValidationError = function(_Error) {
11117
11073
  function ValidationError(message) {
11118
11074
  _classCallCheck(this, ValidationError);
@@ -11171,6 +11127,134 @@ function _typeof(o) {
11171
11127
  _inherits(InvalidApiKeyError, _Error6);
11172
11128
  return _createClass(InvalidApiKeyError);
11173
11129
  }(_wrapNativeSuper(Error));
11130
+ var fileverseProxyUrl = "".concat((_process = process) === null || _process === void 0 || (_process = _process.env) === null || _process === void 0 ? void 0 : _process.NEXT_PUBLIC_PROXY_BASE_URL, "/proxy");
11131
+ var PROXY_MAP = {
11132
+ Etherscan: {
11133
+ url: fileverseProxyUrl,
11134
+ removeParams: [ "apikey" ]
11135
+ },
11136
+ Basescan: {
11137
+ url: fileverseProxyUrl,
11138
+ removeParams: [ "apikey" ]
11139
+ },
11140
+ Gnosisscan: {
11141
+ url: fileverseProxyUrl,
11142
+ removeParams: [ "apikey" ]
11143
+ },
11144
+ Coingecko: {
11145
+ url: fileverseProxyUrl,
11146
+ removeParams: [ "apikey" ]
11147
+ },
11148
+ Firefly: {
11149
+ url: fileverseProxyUrl,
11150
+ removeParams: [ "apikey" ]
11151
+ },
11152
+ Neynar: {
11153
+ url: fileverseProxyUrl,
11154
+ removeParams: [ "api_key" ]
11155
+ },
11156
+ Safe: {
11157
+ url: fileverseProxyUrl,
11158
+ removeParams: [ "api_key" ]
11159
+ },
11160
+ Defillama: {
11161
+ url: fileverseProxyUrl,
11162
+ removeParams: [ "api_key" ]
11163
+ },
11164
+ GnosisPay: {
11165
+ url: fileverseProxyUrl,
11166
+ removeParams: [ "api_key" ]
11167
+ }
11168
+ };
11169
+ function removeUrlParams(url, paramsToRemove) {
11170
+ if (!paramsToRemove || paramsToRemove.length === 0) {
11171
+ return url;
11172
+ }
11173
+ var urlObj = new URL(url);
11174
+ paramsToRemove.forEach((function(param) {
11175
+ if (urlObj.searchParams.has(param)) {
11176
+ urlObj.searchParams["delete"](param);
11177
+ }
11178
+ }));
11179
+ return urlObj.toString();
11180
+ }
11181
+ function getUrlAndHeaders(_ref) {
11182
+ var url = _ref.url, serviceName = _ref.serviceName, _ref$headers = _ref.headers, headers = _ref$headers === void 0 ? {} : _ref$headers;
11183
+ var apiKeyLS = window.localStorage.getItem(SERVICES_API_KEY[serviceName]);
11184
+ var isProxyModeEnabledValue = apiKeyLS === "DEFAULT_PROXY_MODE";
11185
+ var proxyConfig = PROXY_MAP[serviceName];
11186
+ if (!proxyConfig && SERVICES_API_KEY[serviceName] && (!apiKeyLS || apiKeyLS === "")) {
11187
+ throw new MissingApiKeyError(SERVICES_API_KEY[serviceName]);
11188
+ }
11189
+ if ((isProxyModeEnabledValue || !apiKeyLS || apiKeyLS === "") && proxyConfig) {
11190
+ var cleanedUrl = removeUrlParams(url, proxyConfig.removeParams);
11191
+ return {
11192
+ URL: proxyConfig.url,
11193
+ HEADERS: {
11194
+ "target-url": cleanedUrl,
11195
+ method: "GET",
11196
+ "Content-Type": "application/json"
11197
+ }
11198
+ };
11199
+ }
11200
+ return {
11201
+ URL: url,
11202
+ HEADERS: _objectSpread({}, headers)
11203
+ };
11204
+ }
11205
+ var fromTimeStampToBlock = function() {
11206
+ var _ref2 = _asyncToGenerator(_regeneratorRuntime().mark((function _callee(timestamp, chain, apiKey) {
11207
+ var chainId, url, _getUrlAndHeaders, finalUrl, HEADERS, res, json;
11208
+ return _regeneratorRuntime().wrap((function _callee$(_context) {
11209
+ while (1) switch (_context.prev = _context.next) {
11210
+ case 0:
11211
+ if (!(!timestamp || !chain)) {
11212
+ _context.next = 2;
11213
+ break;
11214
+ }
11215
+ return _context.abrupt("return");
11216
+
11217
+ case 2:
11218
+ chainId = CHAIN_ID_MAP[chain];
11219
+ url = "https://api.etherscan.io/v2/api?module=block&action=getblocknobytime&timestamp=".concat(timestamp, "&closest=before&apikey=").concat(apiKey, "&chainId=").concat(chainId);
11220
+ _getUrlAndHeaders = getUrlAndHeaders({
11221
+ url: url,
11222
+ serviceName: "Etherscan",
11223
+ headers: {}
11224
+ }), finalUrl = _getUrlAndHeaders.URL, HEADERS = _getUrlAndHeaders.HEADERS;
11225
+ _context.next = 7;
11226
+ return fetch(finalUrl, {
11227
+ method: "GET",
11228
+ headers: HEADERS
11229
+ });
11230
+
11231
+ case 7:
11232
+ res = _context.sent;
11233
+ _context.next = 10;
11234
+ return res.json();
11235
+
11236
+ case 10:
11237
+ json = _context.sent;
11238
+ return _context.abrupt("return", parseInt(json.result));
11239
+
11240
+ case 12:
11241
+ case "end":
11242
+ return _context.stop();
11243
+ }
11244
+ }), _callee);
11245
+ })));
11246
+ return function fromTimeStampToBlock(_x2, _x3, _x4) {
11247
+ return _ref2.apply(this, arguments);
11248
+ };
11249
+ }();
11250
+ var fromTimestampToBlock = {
11251
+ fromTimeStampToBlock: fromTimeStampToBlock
11252
+ };
11253
+ function toTimestamp(dateStr) {
11254
+ 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];
11255
+ var date = new Date(year, month - 1, day);
11256
+ return Math.floor(date.getTime() / 1e3);
11257
+ }
11174
11258
  var isAddress = function isAddress(input) {
11175
11259
  return /^0x[a-fA-F0-9]{40}$/.test(input);
11176
11260
  };
@@ -11233,7 +11317,7 @@ function _typeof(o) {
11233
11317
  return _fromEnsNameToAddress.apply(this, arguments);
11234
11318
  }
11235
11319
  var validateAndGetAddress = function() {
11236
- var _ref2 = _asyncToGenerator(_regeneratorRuntime().mark((function _callee2(address) {
11320
+ var _ref3 = _asyncToGenerator(_regeneratorRuntime().mark((function _callee2(address) {
11237
11321
  var resolvedAddress;
11238
11322
  return _regeneratorRuntime().wrap((function _callee2$(_context2) {
11239
11323
  while (1) switch (_context2.prev = _context2.next) {
@@ -11266,7 +11350,7 @@ function _typeof(o) {
11266
11350
  }), _callee2);
11267
11351
  })));
11268
11352
  return function validateAndGetAddress(_x6) {
11269
- return _ref2.apply(this, arguments);
11353
+ return _ref3.apply(this, arguments);
11270
11354
  };
11271
11355
  }();
11272
11356
  var fromEnsNameToAddress$1 = {
@@ -11276,15 +11360,15 @@ function _typeof(o) {
11276
11360
  return _handleScanRequest.apply(this, arguments);
11277
11361
  }
11278
11362
  function _handleScanRequest() {
11279
- _handleScanRequest = _asyncToGenerator(_regeneratorRuntime().mark((function _callee11(_ref3) {
11280
- var type, address, startDate, endDate, _ref3$page, page, _ref3$offset, offset, apiKey, functionName, chainId, network, API_INFO_MAP, apiInfo, baseUrl, ACTION_MAP, action, module, url, _yield$Promise$all, _yield$Promise$all2, startBlock, endBlock, res, json;
11363
+ _handleScanRequest = _asyncToGenerator(_regeneratorRuntime().mark((function _callee11(_ref4) {
11364
+ 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;
11281
11365
  return _regeneratorRuntime().wrap((function _callee11$(_context11) {
11282
11366
  while (1) switch (_context11.prev = _context11.next) {
11283
11367
  case 0:
11284
- type = _ref3.type, address = _ref3.address, startDate = _ref3.startDate, endDate = _ref3.endDate,
11285
- _ref3$page = _ref3.page, page = _ref3$page === void 0 ? 1 : _ref3$page, _ref3$offset = _ref3.offset,
11286
- offset = _ref3$offset === void 0 ? 10 : _ref3$offset, apiKey = _ref3.apiKey, functionName = _ref3.functionName,
11287
- chainId = _ref3.chainId, network = _ref3.network;
11368
+ type = _ref4.type, address = _ref4.address, startDate = _ref4.startDate, endDate = _ref4.endDate,
11369
+ _ref4$page = _ref4.page, page = _ref4$page === void 0 ? 1 : _ref4$page, _ref4$offset = _ref4.offset,
11370
+ offset = _ref4$offset === void 0 ? 10 : _ref4$offset, apiKey = _ref4.apiKey, functionName = _ref4.functionName,
11371
+ chainId = _ref4.chainId, network = _ref4.network;
11288
11372
  API_INFO_MAP = {
11289
11373
  BASE: {
11290
11374
  url: "https://api.basescan.org/api",
@@ -11358,44 +11442,52 @@ function _typeof(o) {
11358
11442
  url += "&page=".concat(page, "&offset=").concat(offset);
11359
11443
 
11360
11444
  case 27:
11361
- _context11.next = 29;
11362
- return fetch(url);
11445
+ _getUrlAndHeaders3 = getUrlAndHeaders({
11446
+ url: url,
11447
+ serviceName: apiInfo.apiKeyName,
11448
+ headers: {}
11449
+ }), finalUrl = _getUrlAndHeaders3.URL, HEADERS = _getUrlAndHeaders3.HEADERS;
11450
+ _context11.next = 30;
11451
+ return fetch(finalUrl, {
11452
+ method: "GET",
11453
+ headers: HEADERS
11454
+ });
11363
11455
 
11364
- case 29:
11456
+ case 30:
11365
11457
  res = _context11.sent;
11366
11458
  if (res.ok) {
11367
- _context11.next = 32;
11459
+ _context11.next = 33;
11368
11460
  break;
11369
11461
  }
11370
11462
  throw new NetworkError(apiInfo.apiKeyName, res.status);
11371
11463
 
11372
- case 32:
11373
- _context11.next = 34;
11464
+ case 33:
11465
+ _context11.next = 35;
11374
11466
  return res.json();
11375
11467
 
11376
- case 34:
11468
+ case 35:
11377
11469
  json = _context11.sent;
11378
11470
  if (!(typeof json.result === "string")) {
11379
- _context11.next = 40;
11471
+ _context11.next = 41;
11380
11472
  break;
11381
11473
  }
11382
11474
  if (!json.result.includes("Invalid API Key")) {
11383
- _context11.next = 38;
11475
+ _context11.next = 39;
11384
11476
  break;
11385
11477
  }
11386
11478
  throw new InvalidApiKeyError(apiInfo.apiKeyName);
11387
11479
 
11388
- case 38:
11480
+ case 39:
11389
11481
  if (!json.result.includes("Max rate limit reached")) {
11390
- _context11.next = 40;
11482
+ _context11.next = 41;
11391
11483
  break;
11392
11484
  }
11393
11485
  throw new RateLimitError(apiInfo.apiKeyName);
11394
11486
 
11395
- case 40:
11487
+ case 41:
11396
11488
  return _context11.abrupt("return", type === "gas" && !Array.isArray(json.result) ? [ json.result ] : json.result);
11397
11489
 
11398
- case 41:
11490
+ case 42:
11399
11491
  case "end":
11400
11492
  return _context11.stop();
11401
11493
  }
@@ -11404,8 +11496,8 @@ function _typeof(o) {
11404
11496
  return _handleScanRequest.apply(this, arguments);
11405
11497
  }
11406
11498
  var fromUsernameToFid = function() {
11407
- var _ref4 = _asyncToGenerator(_regeneratorRuntime().mark((function _callee3(username, apiKey) {
11408
- var url, res, json, users, user;
11499
+ var _ref5 = _asyncToGenerator(_regeneratorRuntime().mark((function _callee3(username, apiKey) {
11500
+ var url, _getUrlAndHeaders2, finalUrl, HEADERS, res, json, users, user;
11409
11501
  return _regeneratorRuntime().wrap((function _callee3$(_context3) {
11410
11502
  while (1) switch (_context3.prev = _context3.next) {
11411
11503
  case 0:
@@ -11417,20 +11509,26 @@ function _typeof(o) {
11417
11509
 
11418
11510
  case 2:
11419
11511
  url = "https://api.neynar.com/v2/farcaster/user/search/?q=".concat(username, "&limit=5");
11420
- _context3.next = 5;
11421
- return fetch(url, {
11512
+ _getUrlAndHeaders2 = getUrlAndHeaders({
11513
+ url: url,
11514
+ serviceName: "Neynar",
11422
11515
  headers: {
11423
11516
  "x-api-key": apiKey,
11424
11517
  "x-neynar-experimental": "false"
11425
11518
  }
11519
+ }), finalUrl = _getUrlAndHeaders2.URL, HEADERS = _getUrlAndHeaders2.HEADERS;
11520
+ _context3.next = 6;
11521
+ return fetch(finalUrl, {
11522
+ method: "GET",
11523
+ headers: HEADERS
11426
11524
  });
11427
11525
 
11428
- case 5:
11526
+ case 6:
11429
11527
  res = _context3.sent;
11430
- _context3.next = 8;
11528
+ _context3.next = 9;
11431
11529
  return res.json();
11432
11530
 
11433
- case 8:
11531
+ case 9:
11434
11532
  json = _context3.sent;
11435
11533
  users = json.result ? json.result.users : [];
11436
11534
  user = users.find((function(user) {
@@ -11438,14 +11536,14 @@ function _typeof(o) {
11438
11536
  }));
11439
11537
  return _context3.abrupt("return", user && user.fid || null);
11440
11538
 
11441
- case 12:
11539
+ case 13:
11442
11540
  case "end":
11443
11541
  return _context3.stop();
11444
11542
  }
11445
11543
  }), _callee3);
11446
11544
  })));
11447
11545
  return function fromUsernameToFid(_x8, _x9) {
11448
- return _ref4.apply(this, arguments);
11546
+ return _ref5.apply(this, arguments);
11449
11547
  };
11450
11548
  }();
11451
11549
  var fromUsernameToFid$1 = {
@@ -12192,7 +12290,7 @@ function _typeof(o) {
12192
12290
  description: description
12193
12291
  };
12194
12292
  var customMap = function customMap(iss, ctx) {
12195
- var _ref6;
12293
+ var _ref7;
12196
12294
  var message = params.message;
12197
12295
  if (iss.code === "invalid_enum_value") {
12198
12296
  return {
@@ -12200,16 +12298,16 @@ function _typeof(o) {
12200
12298
  };
12201
12299
  }
12202
12300
  if (typeof ctx.data === "undefined") {
12203
- var _ref5;
12301
+ var _ref6;
12204
12302
  return {
12205
- message: (_ref5 = message !== null && message !== void 0 ? message : required_error) !== null && _ref5 !== void 0 ? _ref5 : ctx.defaultError
12303
+ message: (_ref6 = message !== null && message !== void 0 ? message : required_error) !== null && _ref6 !== void 0 ? _ref6 : ctx.defaultError
12206
12304
  };
12207
12305
  }
12208
12306
  if (iss.code !== "invalid_type") return {
12209
12307
  message: ctx.defaultError
12210
12308
  };
12211
12309
  return {
12212
- message: (_ref6 = message !== null && message !== void 0 ? message : invalid_type_error) !== null && _ref6 !== void 0 ? _ref6 : ctx.defaultError
12310
+ message: (_ref7 = message !== null && message !== void 0 ? message : invalid_type_error) !== null && _ref7 !== void 0 ? _ref7 : ctx.defaultError
12213
12311
  };
12214
12312
  };
12215
12313
  return {
@@ -14949,7 +15047,7 @@ function _typeof(o) {
14949
15047
  }
14950
15048
  if (ctx.common.async) {
14951
15049
  return Promise.all(options.map(function() {
14952
- var _ref8 = _asyncToGenerator(_regeneratorRuntime().mark((function _callee8(option) {
15050
+ var _ref9 = _asyncToGenerator(_regeneratorRuntime().mark((function _callee8(option) {
14953
15051
  var childCtx;
14954
15052
  return _regeneratorRuntime().wrap((function _callee8$(_context8) {
14955
15053
  while (1) switch (_context8.prev = _context8.next) {
@@ -14982,7 +15080,7 @@ function _typeof(o) {
14982
15080
  }), _callee8);
14983
15081
  })));
14984
15082
  return function(_x14) {
14985
- return _ref8.apply(this, arguments);
15083
+ return _ref9.apply(this, arguments);
14986
15084
  };
14987
15085
  }())).then(handleResults);
14988
15086
  } else {
@@ -15284,8 +15382,8 @@ function _typeof(o) {
15284
15382
  data: ctx.data,
15285
15383
  path: ctx.path,
15286
15384
  parent: ctx
15287
- }) ]).then((function(_ref9) {
15288
- var _ref0 = _slicedToArray(_ref9, 2), left = _ref0[0], right = _ref0[1];
15385
+ }) ]).then((function(_ref0) {
15386
+ var _ref1 = _slicedToArray(_ref0, 2), left = _ref1[0], right = _ref1[1];
15289
15387
  return handleParsed(left, right);
15290
15388
  }));
15291
15389
  } else {
@@ -15418,8 +15516,8 @@ function _typeof(o) {
15418
15516
  }
15419
15517
  var keyType = this._def.keyType;
15420
15518
  var valueType = this._def.valueType;
15421
- var pairs = _toConsumableArray(ctx.data.entries()).map((function(_ref1, index) {
15422
- var _ref10 = _slicedToArray(_ref1, 2), key = _ref10[0], value = _ref10[1];
15519
+ var pairs = _toConsumableArray(ctx.data.entries()).map((function(_ref10, index) {
15520
+ var _ref11 = _slicedToArray(_ref10, 2), key = _ref11[0], value = _ref11[1];
15423
15521
  return {
15424
15522
  key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, [ index, "key" ])),
15425
15523
  value: valueType._parse(new ParseInputLazyPath(ctx, value, ctx.path, [ index, "value" ]))
@@ -15953,7 +16051,7 @@ function _typeof(o) {
15953
16051
  var processed = effect.transform(ctx.data, checkCtx);
15954
16052
  if (ctx.common.async) {
15955
16053
  return Promise.resolve(processed).then(function() {
15956
- var _ref12 = _asyncToGenerator(_regeneratorRuntime().mark((function _callee0(processed) {
16054
+ var _ref13 = _asyncToGenerator(_regeneratorRuntime().mark((function _callee0(processed) {
15957
16055
  var result;
15958
16056
  return _regeneratorRuntime().wrap((function _callee0$(_context0) {
15959
16057
  while (1) switch (_context0.prev = _context0.next) {
@@ -16004,7 +16102,7 @@ function _typeof(o) {
16004
16102
  }), _callee0);
16005
16103
  })));
16006
16104
  return function(_x15) {
16007
- return _ref12.apply(this, arguments);
16105
+ return _ref13.apply(this, arguments);
16008
16106
  };
16009
16107
  }());
16010
16108
  } else {
@@ -16335,7 +16433,7 @@ function _typeof(o) {
16335
16433
  var _this$_processInputPa13 = this._processInputParams(input), status = _this$_processInputPa13.status, ctx = _this$_processInputPa13.ctx;
16336
16434
  if (ctx.common.async) {
16337
16435
  var handleAsync = function() {
16338
- var _ref13 = _asyncToGenerator(_regeneratorRuntime().mark((function _callee1() {
16436
+ var _ref14 = _asyncToGenerator(_regeneratorRuntime().mark((function _callee1() {
16339
16437
  var inResult;
16340
16438
  return _regeneratorRuntime().wrap((function _callee1$(_context1) {
16341
16439
  while (1) switch (_context1.prev = _context1.next) {
@@ -16377,7 +16475,7 @@ function _typeof(o) {
16377
16475
  }), _callee1);
16378
16476
  })));
16379
16477
  return function handleAsync() {
16380
- return _ref13.apply(this, arguments);
16478
+ return _ref14.apply(this, arguments);
16381
16479
  };
16382
16480
  }();
16383
16481
  return handleAsync();
@@ -16718,7 +16816,7 @@ function _typeof(o) {
16718
16816
  }
16719
16817
  function _FIREFLY() {
16720
16818
  _FIREFLY = _asyncToGenerator(_regeneratorRuntime().mark((function _callee12() {
16721
- var _argsToArray3, _argsToArray4, platform, contentType, identifier, _argsToArray4$, start, _argsToArray4$2, end, apiKey, url, response, _yield$response$json, _data, _args12 = arguments;
16819
+ var _argsToArray3, _argsToArray4, platform, contentType, identifier, _argsToArray4$, start, _argsToArray4$2, end, apiKey, url, _getUrlAndHeaders4, finalUrl, HEADERS, response, _yield$response$json, _data, _args12 = arguments;
16722
16820
  return _regeneratorRuntime().wrap((function _callee12$(_context12) {
16723
16821
  while (1) switch (_context12.prev = _context12.next) {
16724
16822
  case 0:
@@ -16735,13 +16833,6 @@ function _typeof(o) {
16735
16833
  end: end
16736
16834
  });
16737
16835
  apiKey = window.localStorage.getItem(SERVICES_API_KEY.Firefly);
16738
- if (apiKey) {
16739
- _context12.next = 6;
16740
- break;
16741
- }
16742
- throw new MissingApiKeyError(SERVICES_API_KEY.Firefly);
16743
-
16744
- case 6:
16745
16836
  url = new URL("https://openapi.firefly.land/v1/fileverse/fetch");
16746
16837
  url.searchParams.set("query", identifier.split(",").map((function(s) {
16747
16838
  return s.trim();
@@ -16749,35 +16840,41 @@ function _typeof(o) {
16749
16840
  url.searchParams.set("type", fireFlyPlaformType[platform][contentType]);
16750
16841
  url.searchParams.set("start", String(start));
16751
16842
  url.searchParams.set("end", String(end));
16752
- _context12.next = 13;
16753
- return fetch(url.toString(), {
16843
+ _getUrlAndHeaders4 = getUrlAndHeaders({
16844
+ url: url.toString(),
16845
+ serviceName: "Firefly",
16754
16846
  headers: {
16755
16847
  "x-api-key": apiKey
16756
16848
  }
16849
+ }), finalUrl = _getUrlAndHeaders4.URL, HEADERS = _getUrlAndHeaders4.HEADERS;
16850
+ _context12.next = 12;
16851
+ return fetch(finalUrl, {
16852
+ method: "GET",
16853
+ headers: HEADERS
16757
16854
  });
16758
16855
 
16759
- case 13:
16856
+ case 12:
16760
16857
  response = _context12.sent;
16761
16858
  if (response.ok) {
16762
- _context12.next = 16;
16859
+ _context12.next = 15;
16763
16860
  break;
16764
16861
  }
16765
16862
  throw new NetworkError(SERVICES_API_KEY.Firefly, response.status);
16766
16863
 
16767
- case 16:
16768
- _context12.next = 18;
16864
+ case 15:
16865
+ _context12.next = 17;
16769
16866
  return response.json();
16770
16867
 
16771
- case 18:
16868
+ case 17:
16772
16869
  _yield$response$json = _context12.sent;
16773
16870
  _data = _yield$response$json.data;
16774
16871
  if (Array.isArray(_data)) {
16775
- _context12.next = 22;
16872
+ _context12.next = 21;
16776
16873
  break;
16777
16874
  }
16778
16875
  return _context12.abrupt("return", []);
16779
16876
 
16780
- case 22:
16877
+ case 21:
16781
16878
  return _context12.abrupt("return", _data.map((function(item) {
16782
16879
  var flat = {};
16783
16880
  for (var _i10 = 0, _Object$entries = Object.entries(item); _i10 < _Object$entries.length; _i10++) {
@@ -16790,16 +16887,16 @@ function _typeof(o) {
16790
16887
  return flat;
16791
16888
  })));
16792
16889
 
16793
- case 25:
16794
- _context12.prev = 25;
16890
+ case 24:
16891
+ _context12.prev = 24;
16795
16892
  _context12.t0 = _context12["catch"](0);
16796
16893
  return _context12.abrupt("return", errorMessageHandler(_context12.t0, "FIREFLY"));
16797
16894
 
16798
- case 28:
16895
+ case 27:
16799
16896
  case "end":
16800
16897
  return _context12.stop();
16801
16898
  }
16802
- }), _callee12, null, [ [ 0, 25 ] ]);
16899
+ }), _callee12, null, [ [ 0, 24 ] ]);
16803
16900
  })));
16804
16901
  return _FIREFLY.apply(this, arguments);
16805
16902
  }
@@ -16808,7 +16905,7 @@ function _typeof(o) {
16808
16905
  }
16809
16906
  function _LENS() {
16810
16907
  _LENS = _asyncToGenerator(_regeneratorRuntime().mark((function _callee13() {
16811
- var _argsToArray5, _argsToArray6, contentType, identifier, _argsToArray6$, start, _argsToArray6$2, end, apiKey, url, typeMap, response, _yield$response$json2, _data2, _args13 = arguments;
16908
+ var _argsToArray5, _argsToArray6, contentType, identifier, _argsToArray6$, start, _argsToArray6$2, end, apiKey, url, typeMap, _getUrlAndHeaders5, finalUrl, HEADERS, response, _yield$response$json2, _data2, _args13 = arguments;
16812
16909
  return _regeneratorRuntime().wrap((function _callee13$(_context13) {
16813
16910
  while (1) switch (_context13.prev = _context13.next) {
16814
16911
  case 0:
@@ -16824,13 +16921,6 @@ function _typeof(o) {
16824
16921
  end: end
16825
16922
  });
16826
16923
  apiKey = window.localStorage.getItem(SERVICES_API_KEY.Firefly);
16827
- if (apiKey) {
16828
- _context13.next = 6;
16829
- break;
16830
- }
16831
- throw new MissingApiKeyError(SERVICES_API_KEY.Firefly);
16832
-
16833
- case 6:
16834
16924
  url = new URL("https://openapi.firefly.land/v1/fileverse/fetch");
16835
16925
  url.searchParams.set("query", identifier.split(",").map((function(s) {
16836
16926
  return s.trim();
@@ -16842,35 +16932,41 @@ function _typeof(o) {
16842
16932
  url.searchParams.set("type", typeMap[contentType]);
16843
16933
  url.searchParams.set("start", String(start));
16844
16934
  url.searchParams.set("end", String(end));
16845
- _context13.next = 14;
16846
- return fetch(url.toString(), {
16935
+ _getUrlAndHeaders5 = getUrlAndHeaders({
16936
+ url: url.toString(),
16937
+ serviceName: "Firefly",
16847
16938
  headers: {
16848
16939
  "x-api-key": apiKey
16849
16940
  }
16941
+ }), finalUrl = _getUrlAndHeaders5.URL, HEADERS = _getUrlAndHeaders5.HEADERS;
16942
+ _context13.next = 13;
16943
+ return fetch(finalUrl, {
16944
+ method: "GET",
16945
+ headers: HEADERS
16850
16946
  });
16851
16947
 
16852
- case 14:
16948
+ case 13:
16853
16949
  response = _context13.sent;
16854
16950
  if (response.ok) {
16855
- _context13.next = 17;
16951
+ _context13.next = 16;
16856
16952
  break;
16857
16953
  }
16858
16954
  throw new NetworkError(SERVICES_API_KEY.Firefly, response.status);
16859
16955
 
16860
- case 17:
16861
- _context13.next = 19;
16956
+ case 16:
16957
+ _context13.next = 18;
16862
16958
  return response.json();
16863
16959
 
16864
- case 19:
16960
+ case 18:
16865
16961
  _yield$response$json2 = _context13.sent;
16866
16962
  _data2 = _yield$response$json2.data;
16867
16963
  if (Array.isArray(_data2)) {
16868
- _context13.next = 23;
16964
+ _context13.next = 22;
16869
16965
  break;
16870
16966
  }
16871
16967
  return _context13.abrupt("return", []);
16872
16968
 
16873
- case 23:
16969
+ case 22:
16874
16970
  return _context13.abrupt("return", _data2.map((function(item) {
16875
16971
  var flat = {};
16876
16972
  for (var _i11 = 0, _Object$entries2 = Object.entries(item); _i11 < _Object$entries2.length; _i11++) {
@@ -16883,16 +16979,16 @@ function _typeof(o) {
16883
16979
  return flat;
16884
16980
  })));
16885
16981
 
16886
- case 26:
16887
- _context13.prev = 26;
16982
+ case 25:
16983
+ _context13.prev = 25;
16888
16984
  _context13.t0 = _context13["catch"](0);
16889
16985
  return _context13.abrupt("return", errorMessageHandler(_context13.t0, "LENS"));
16890
16986
 
16891
- case 29:
16987
+ case 28:
16892
16988
  case "end":
16893
16989
  return _context13.stop();
16894
16990
  }
16895
- }), _callee13, null, [ [ 0, 26 ] ]);
16991
+ }), _callee13, null, [ [ 0, 25 ] ]);
16896
16992
  })));
16897
16993
  return _LENS.apply(this, arguments);
16898
16994
  }
@@ -16901,7 +16997,7 @@ function _typeof(o) {
16901
16997
  }
16902
16998
  function _FARCASTER() {
16903
16999
  _FARCASTER = _asyncToGenerator(_regeneratorRuntime().mark((function _callee14() {
16904
- var _argsToArray7, _argsToArray8, contentType, identifier, _argsToArray8$, start, _argsToArray8$2, end, apiKey, url, typeMap, response, _yield$response$json3, _data3, _args14 = arguments;
17000
+ var _argsToArray7, _argsToArray8, contentType, identifier, _argsToArray8$, start, _argsToArray8$2, end, apiKey, url, typeMap, _getUrlAndHeaders6, finalUrl, HEADERS, response, _yield$response$json3, _data3, _args14 = arguments;
16905
17001
  return _regeneratorRuntime().wrap((function _callee14$(_context14) {
16906
17002
  while (1) switch (_context14.prev = _context14.next) {
16907
17003
  case 0:
@@ -16917,13 +17013,6 @@ function _typeof(o) {
16917
17013
  end: end
16918
17014
  });
16919
17015
  apiKey = window.localStorage.getItem(SERVICES_API_KEY.Firefly);
16920
- if (apiKey) {
16921
- _context14.next = 6;
16922
- break;
16923
- }
16924
- throw new MissingApiKeyError(SERVICES_API_KEY.Firefly);
16925
-
16926
- case 6:
16927
17016
  url = new URL("https://openapi.firefly.land/v1/fileverse/fetch");
16928
17017
  url.searchParams.set("query", identifier.split(",").map((function(s) {
16929
17018
  return s.trim();
@@ -16936,35 +17025,41 @@ function _typeof(o) {
16936
17025
  url.searchParams.set("type", typeMap[contentType]);
16937
17026
  url.searchParams.set("start", String(start));
16938
17027
  url.searchParams.set("end", String(end));
16939
- _context14.next = 14;
16940
- return fetch(url.toString(), {
17028
+ _getUrlAndHeaders6 = getUrlAndHeaders({
17029
+ url: url.toString(),
17030
+ serviceName: "Firefly",
16941
17031
  headers: {
16942
17032
  "x-api-key": apiKey
16943
17033
  }
17034
+ }), finalUrl = _getUrlAndHeaders6.URL, HEADERS = _getUrlAndHeaders6.HEADERS;
17035
+ _context14.next = 13;
17036
+ return fetch(finalUrl, {
17037
+ method: "GET",
17038
+ headers: HEADERS
16944
17039
  });
16945
17040
 
16946
- case 14:
17041
+ case 13:
16947
17042
  response = _context14.sent;
16948
17043
  if (response.ok) {
16949
- _context14.next = 17;
17044
+ _context14.next = 16;
16950
17045
  break;
16951
17046
  }
16952
17047
  throw new NetworkError(SERVICES_API_KEY.Firefly, response.status);
16953
17048
 
16954
- case 17:
16955
- _context14.next = 19;
17049
+ case 16:
17050
+ _context14.next = 18;
16956
17051
  return response.json();
16957
17052
 
16958
- case 19:
17053
+ case 18:
16959
17054
  _yield$response$json3 = _context14.sent;
16960
17055
  _data3 = _yield$response$json3.data;
16961
17056
  if (Array.isArray(_data3)) {
16962
- _context14.next = 23;
17057
+ _context14.next = 22;
16963
17058
  break;
16964
17059
  }
16965
17060
  return _context14.abrupt("return", []);
16966
17061
 
16967
- case 23:
17062
+ case 22:
16968
17063
  return _context14.abrupt("return", _data3.map((function(item) {
16969
17064
  var flat = {};
16970
17065
  for (var _i12 = 0, _Object$entries3 = Object.entries(item); _i12 < _Object$entries3.length; _i12++) {
@@ -16977,16 +17072,16 @@ function _typeof(o) {
16977
17072
  return flat;
16978
17073
  })));
16979
17074
 
16980
- case 26:
16981
- _context14.prev = 26;
17075
+ case 25:
17076
+ _context14.prev = 25;
16982
17077
  _context14.t0 = _context14["catch"](0);
16983
17078
  return _context14.abrupt("return", errorMessageHandler(_context14.t0, "FARCASTER"));
16984
17079
 
16985
- case 29:
17080
+ case 28:
16986
17081
  case "end":
16987
17082
  return _context14.stop();
16988
17083
  }
16989
- }), _callee14, null, [ [ 0, 26 ] ]);
17084
+ }), _callee14, null, [ [ 0, 25 ] ]);
16990
17085
  })));
16991
17086
  return _FARCASTER.apply(this, arguments);
16992
17087
  }
@@ -17106,14 +17201,7 @@ function _typeof(o) {
17106
17201
  limit: limit
17107
17202
  });
17108
17203
  API_KEY = window.localStorage.getItem(SERVICES_API_KEY.Basescan);
17109
- if (API_KEY) {
17110
- _context16.next = 6;
17111
- break;
17112
- }
17113
- throw new MissingApiKeyError(SERVICES_API_KEY.Basescan);
17114
-
17115
- case 6:
17116
- _context16.next = 8;
17204
+ _context16.next = 6;
17117
17205
  return handleScanRequest({
17118
17206
  type: type,
17119
17207
  address: address,
@@ -17127,19 +17215,19 @@ function _typeof(o) {
17127
17215
  network: "base"
17128
17216
  });
17129
17217
 
17130
- case 8:
17218
+ case 6:
17131
17219
  return _context16.abrupt("return", _context16.sent);
17132
17220
 
17133
- case 11:
17134
- _context16.prev = 11;
17221
+ case 9:
17222
+ _context16.prev = 9;
17135
17223
  _context16.t0 = _context16["catch"](0);
17136
17224
  return _context16.abrupt("return", errorMessageHandler(_context16.t0, "BASE"));
17137
17225
 
17138
- case 14:
17226
+ case 12:
17139
17227
  case "end":
17140
17228
  return _context16.stop();
17141
17229
  }
17142
- }), _callee16, null, [ [ 0, 11 ] ]);
17230
+ }), _callee16, null, [ [ 0, 9 ] ]);
17143
17231
  })));
17144
17232
  return _BASE.apply(this, arguments);
17145
17233
  }
@@ -17166,14 +17254,7 @@ function _typeof(o) {
17166
17254
  limit: limit
17167
17255
  });
17168
17256
  apiKey = window.localStorage.getItem(SERVICES_API_KEY.Gnosisscan);
17169
- if (apiKey) {
17170
- _context17.next = 6;
17171
- break;
17172
- }
17173
- throw new MissingApiKeyError(SERVICES_API_KEY.Gnosisscan);
17174
-
17175
- case 6:
17176
- _context17.next = 8;
17257
+ _context17.next = 6;
17177
17258
  return handleScanRequest({
17178
17259
  type: type,
17179
17260
  address: address,
@@ -17187,19 +17268,19 @@ function _typeof(o) {
17187
17268
  network: "gnosis"
17188
17269
  });
17189
17270
 
17190
- case 8:
17271
+ case 6:
17191
17272
  return _context17.abrupt("return", _context17.sent);
17192
17273
 
17193
- case 11:
17194
- _context17.prev = 11;
17274
+ case 9:
17275
+ _context17.prev = 9;
17195
17276
  _context17.t0 = _context17["catch"](0);
17196
17277
  return _context17.abrupt("return", errorMessageHandler(_context17.t0, "GNOSIS"));
17197
17278
 
17198
- case 14:
17279
+ case 12:
17199
17280
  case "end":
17200
17281
  return _context17.stop();
17201
17282
  }
17202
- }), _callee17, null, [ [ 0, 11 ] ]);
17283
+ }), _callee17, null, [ [ 0, 9 ] ]);
17203
17284
  })));
17204
17285
  return _GNOSIS.apply(this, arguments);
17205
17286
  }
@@ -17208,7 +17289,7 @@ function _typeof(o) {
17208
17289
  }
17209
17290
  function _NEYNAR() {
17210
17291
  _NEYNAR = _asyncToGenerator(_regeneratorRuntime().mark((function _callee18() {
17211
- var neynarParamsSchema, _argsToArray13, _argsToArray14, username, apiKey, fid, url, response, json, users, _args18 = arguments;
17292
+ var neynarParamsSchema, _argsToArray13, _argsToArray14, username, apiKey, fid, url, _getUrlAndHeaders7, finalUrl, HEADERS, response, json, users, _args18 = arguments;
17212
17293
  return _regeneratorRuntime().wrap((function _callee18$(_context18) {
17213
17294
  while (1) switch (_context18.prev = _context18.next) {
17214
17295
  case 0:
@@ -17222,59 +17303,58 @@ function _typeof(o) {
17222
17303
  username: username
17223
17304
  });
17224
17305
  apiKey = window.localStorage.getItem(SERVICES_API_KEY.Neynar);
17225
- if (apiKey) {
17226
- _context18.next = 7;
17227
- break;
17228
- }
17229
- throw new MissingApiKeyError(SERVICES_API_KEY.Neynar);
17230
-
17231
- case 7:
17232
- _context18.next = 9;
17306
+ _context18.next = 7;
17233
17307
  return fromUsernameToFid$1.fromUsernameToFid(username, apiKey);
17234
17308
 
17235
- case 9:
17309
+ case 7:
17236
17310
  fid = _context18.sent;
17237
17311
  if (fid) {
17238
- _context18.next = 12;
17312
+ _context18.next = 10;
17239
17313
  break;
17240
17314
  }
17241
17315
  throw new ValidationError("Invalid username: ".concat(username));
17242
17316
 
17243
- case 12:
17317
+ case 10:
17244
17318
  url = "https://api.neynar.com/v2/farcaster/followers?fid=".concat(fid);
17245
- _context18.next = 15;
17246
- return fetch(url, {
17319
+ _getUrlAndHeaders7 = getUrlAndHeaders({
17320
+ url: url.toString(),
17321
+ serviceName: "Neynar",
17247
17322
  headers: {
17248
17323
  "x-api-key": apiKey,
17249
17324
  "x-neynar-experimental": "false"
17250
17325
  }
17326
+ }), finalUrl = _getUrlAndHeaders7.URL, HEADERS = _getUrlAndHeaders7.HEADERS;
17327
+ _context18.next = 14;
17328
+ return fetch(finalUrl, {
17329
+ method: "GET",
17330
+ headers: HEADERS
17251
17331
  });
17252
17332
 
17253
- case 15:
17333
+ case 14:
17254
17334
  response = _context18.sent;
17255
17335
  if (response.ok) {
17256
- _context18.next = 18;
17336
+ _context18.next = 17;
17257
17337
  break;
17258
17338
  }
17259
17339
  throw new NetworkError(SERVICES_API_KEY.Neynar, response.status);
17260
17340
 
17261
- case 18:
17262
- _context18.next = 20;
17341
+ case 17:
17342
+ _context18.next = 19;
17263
17343
  return response.json();
17264
17344
 
17265
- case 20:
17345
+ case 19:
17266
17346
  json = _context18.sent;
17267
17347
  users = (json === null || json === void 0 ? void 0 : json.users) || [];
17268
17348
  if (users.length) {
17269
- _context18.next = 24;
17349
+ _context18.next = 23;
17270
17350
  break;
17271
17351
  }
17272
17352
  return _context18.abrupt("return", []);
17273
17353
 
17274
- case 24:
17275
- return _context18.abrupt("return", users.map((function(_ref14) {
17354
+ case 23:
17355
+ return _context18.abrupt("return", users.map((function(_ref15) {
17276
17356
  var _user$profile, _user$profile2;
17277
- var user = _ref14.user;
17357
+ var user = _ref15.user;
17278
17358
  return {
17279
17359
  username: user.username,
17280
17360
  custody_address: user.custody_address,
@@ -17284,16 +17364,16 @@ function _typeof(o) {
17284
17364
  };
17285
17365
  })));
17286
17366
 
17287
- case 27:
17288
- _context18.prev = 27;
17367
+ case 26:
17368
+ _context18.prev = 26;
17289
17369
  _context18.t0 = _context18["catch"](0);
17290
17370
  return _context18.abrupt("return", errorMessageHandler(_context18.t0, "NEYNAR"));
17291
17371
 
17292
- case 30:
17372
+ case 29:
17293
17373
  case "end":
17294
17374
  return _context18.stop();
17295
17375
  }
17296
- }), _callee18, null, [ [ 0, 27 ] ]);
17376
+ }), _callee18, null, [ [ 0, 26 ] ]);
17297
17377
  })));
17298
17378
  return _NEYNAR.apply(this, arguments);
17299
17379
  }
@@ -17330,14 +17410,7 @@ function _typeof(o) {
17330
17410
 
17331
17411
  case 6:
17332
17412
  apiKey = window.localStorage.getItem(SERVICES_API_KEY.Etherscan);
17333
- if (apiKey) {
17334
- _context19.next = 9;
17335
- break;
17336
- }
17337
- throw new MissingApiKeyError(SERVICES_API_KEY.Etherscan);
17338
-
17339
- case 9:
17340
- _context19.next = 11;
17413
+ _context19.next = 9;
17341
17414
  return handleScanRequest({
17342
17415
  type: type,
17343
17416
  address: address,
@@ -17351,19 +17424,19 @@ function _typeof(o) {
17351
17424
  network: chain
17352
17425
  });
17353
17426
 
17354
- case 11:
17427
+ case 9:
17355
17428
  return _context19.abrupt("return", _context19.sent);
17356
17429
 
17357
- case 14:
17358
- _context19.prev = 14;
17430
+ case 12:
17431
+ _context19.prev = 12;
17359
17432
  _context19.t0 = _context19["catch"](0);
17360
17433
  return _context19.abrupt("return", errorMessageHandler(_context19.t0, "ETHERSCAN"));
17361
17434
 
17362
- case 17:
17435
+ case 15:
17363
17436
  case "end":
17364
17437
  return _context19.stop();
17365
17438
  }
17366
- }), _callee19, null, [ [ 0, 14 ] ]);
17439
+ }), _callee19, null, [ [ 0, 12 ] ]);
17367
17440
  })));
17368
17441
  return _ETHERSCAN.apply(this, arguments);
17369
17442
  }
@@ -17372,7 +17445,7 @@ function _typeof(o) {
17372
17445
  }
17373
17446
  function _COINGECKO() {
17374
17447
  _COINGECKO = _asyncToGenerator(_regeneratorRuntime().mark((function _callee20() {
17375
- 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, _args20 = arguments;
17448
+ 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;
17376
17449
  return _regeneratorRuntime().wrap((function _callee20$(_context20) {
17377
17450
  while (1) switch (_context20.prev = _context20.next) {
17378
17451
  case 0:
@@ -17385,28 +17458,21 @@ function _typeof(o) {
17385
17458
  param2: param2
17386
17459
  });
17387
17460
  apiKey = window.localStorage.getItem(SERVICES_API_KEY.Coingecko);
17388
- if (apiKey) {
17389
- _context20.next = 6;
17390
- break;
17391
- }
17392
- throw new MissingApiKeyError(SERVICES_API_KEY.Coingecko);
17393
-
17394
- case 6:
17395
17461
  headers = {
17396
17462
  accept: "application/json",
17397
17463
  "x-cg-demo-api-key": apiKey
17398
17464
  };
17399
17465
  url = "";
17400
17466
  _context20.t0 = category === null || category === void 0 || (_category$toLowerCase = category.toLowerCase) === null || _category$toLowerCase === void 0 ? void 0 : _category$toLowerCase.call(category);
17401
- _context20.next = _context20.t0 === "price" ? 11 : _context20.t0 === "market" ? 14 : _context20.t0 === "stablecoins" ? 19 : _context20.t0 === "derivatives" ? 23 : 25;
17467
+ _context20.next = _context20.t0 === "price" ? 9 : _context20.t0 === "market" ? 12 : _context20.t0 === "stablecoins" ? 17 : _context20.t0 === "derivatives" ? 21 : 23;
17402
17468
  break;
17403
17469
 
17404
- case 11:
17470
+ case 9:
17405
17471
  vs = param2 || "usd";
17406
17472
  url = "https://api.coingecko.com/api/v3/simple/price?vs_currencies=".concat(vs, "&symbols=").concat(param1);
17407
- return _context20.abrupt("break", 25);
17473
+ return _context20.abrupt("break", 23);
17408
17474
 
17409
- case 14:
17475
+ case 12:
17410
17476
  map = {
17411
17477
  all: "",
17412
17478
  base: "base-ecosystem",
@@ -17421,48 +17487,53 @@ function _typeof(o) {
17421
17487
  _category = map[param1] || "";
17422
17488
  trend = param2 ? "&price_change_percentage=".concat(param2) : "";
17423
17489
  url = "https://api.coingecko.com/api/v3/coins/markets?vs_currency=usd&include_tokens=top&page=1&per_page=100".concat(_category ? "&category=".concat(_category) : "").concat(trend);
17424
- return _context20.abrupt("break", 25);
17490
+ return _context20.abrupt("break", 23);
17425
17491
 
17426
- case 19:
17492
+ case 17:
17427
17493
  _category2 = param1 === "all" ? "stablecoins" : param1;
17428
17494
  _trend = param2 ? "&price_change_percentage=".concat(param2) : "";
17429
17495
  url = "https://api.coingecko.com/api/v3/coins/markets?vs_currency=usd&category=".concat(_category2, "&order=market_cap_desc&page=1&per_page=100").concat(_trend);
17430
- return _context20.abrupt("break", 25);
17496
+ return _context20.abrupt("break", 23);
17431
17497
 
17432
- case 23:
17498
+ case 21:
17433
17499
  url = !param1 || param1 === "all" ? "https://api.coingecko.com/api/v3/derivatives" : "https://api.coingecko.com/api/v3/derivatives/exchanges/".concat(param1, "?include_tickers=all");
17434
- return _context20.abrupt("break", 25);
17500
+ return _context20.abrupt("break", 23);
17435
17501
 
17436
- case 25:
17437
- _context20.next = 27;
17438
- return fetch(url, {
17502
+ case 23:
17503
+ _getUrlAndHeaders8 = getUrlAndHeaders({
17504
+ url: url,
17505
+ serviceName: "Coingecko",
17439
17506
  headers: headers
17507
+ }), finalUrl = _getUrlAndHeaders8.URL, HEADERS = _getUrlAndHeaders8.HEADERS;
17508
+ _context20.next = 26;
17509
+ return fetch(finalUrl, {
17510
+ headers: HEADERS
17440
17511
  });
17441
17512
 
17442
- case 27:
17513
+ case 26:
17443
17514
  res = _context20.sent;
17444
- _context20.next = 30;
17515
+ _context20.next = 29;
17445
17516
  return res.json();
17446
17517
 
17447
- case 30:
17518
+ case 29:
17448
17519
  json = _context20.sent;
17449
17520
  if (res.ok) {
17450
- _context20.next = 36;
17521
+ _context20.next = 35;
17451
17522
  break;
17452
17523
  }
17453
17524
  msg = (json === null || json === void 0 || (_json$status = json.status) === null || _json$status === void 0 ? void 0 : _json$status.error_message) || "";
17454
17525
  if (!msg.includes("API Key Missing")) {
17455
- _context20.next = 35;
17526
+ _context20.next = 34;
17456
17527
  break;
17457
17528
  }
17458
17529
  throw new InvalidApiKeyError(SERVICES_API_KEY.Coingecko);
17459
17530
 
17460
- case 35:
17531
+ case 34:
17461
17532
  throw new NetworkError(SERVICES_API_KEY.Coingecko, res.status);
17462
17533
 
17463
- case 36:
17534
+ case 35:
17464
17535
  if (!(category === "price")) {
17465
- _context20.next = 40;
17536
+ _context20.next = 39;
17466
17537
  break;
17467
17538
  }
17468
17539
  out = {};
@@ -17477,7 +17548,7 @@ function _typeof(o) {
17477
17548
  }
17478
17549
  return _context20.abrupt("return", [ out ]);
17479
17550
 
17480
- case 40:
17551
+ case 39:
17481
17552
  _data4 = Array.isArray(json) ? json : [ json ];
17482
17553
  return _context20.abrupt("return", _data4.map((function(item) {
17483
17554
  var flat = {};
@@ -17490,16 +17561,16 @@ function _typeof(o) {
17490
17561
  return flat;
17491
17562
  })));
17492
17563
 
17493
- case 44:
17494
- _context20.prev = 44;
17564
+ case 43:
17565
+ _context20.prev = 43;
17495
17566
  _context20.t1 = _context20["catch"](0);
17496
17567
  return _context20.abrupt("return", errorMessageHandler(_context20.t1, "COINGECKO"));
17497
17568
 
17498
- case 47:
17569
+ case 46:
17499
17570
  case "end":
17500
17571
  return _context20.stop();
17501
17572
  }
17502
- }), _callee20, null, [ [ 0, 44 ] ]);
17573
+ }), _callee20, null, [ [ 0, 43 ] ]);
17503
17574
  })));
17504
17575
  return _COINGECKO.apply(this, arguments);
17505
17576
  }
@@ -17514,56 +17585,64 @@ function _typeof(o) {
17514
17585
  case 0:
17515
17586
  _context25.prev = 0;
17516
17587
  fetchJSON = function() {
17517
- var _ref15 = _asyncToGenerator(_regeneratorRuntime().mark((function _callee21(url) {
17518
- var res, json;
17588
+ var _ref16 = _asyncToGenerator(_regeneratorRuntime().mark((function _callee21(url) {
17589
+ var _getUrlAndHeaders9, finalUrl, HEADERS, res, json;
17519
17590
  return _regeneratorRuntime().wrap((function _callee21$(_context21) {
17520
17591
  while (1) switch (_context21.prev = _context21.next) {
17521
17592
  case 0:
17522
- _context21.next = 2;
17523
- return fetch(url);
17593
+ _getUrlAndHeaders9 = getUrlAndHeaders({
17594
+ url: url,
17595
+ serviceName: "Etherscan",
17596
+ headers: {}
17597
+ }), finalUrl = _getUrlAndHeaders9.URL, HEADERS = _getUrlAndHeaders9.HEADERS;
17598
+ _context21.next = 3;
17599
+ return fetch(finalUrl, {
17600
+ method: "GET",
17601
+ headers: HEADERS
17602
+ });
17524
17603
 
17525
- case 2:
17604
+ case 3:
17526
17605
  res = _context21.sent;
17527
17606
  if (res.ok) {
17528
- _context21.next = 5;
17607
+ _context21.next = 6;
17529
17608
  break;
17530
17609
  }
17531
17610
  throw new NetworkError(SERVICES_API_KEY.Etherscan, res.status);
17532
17611
 
17533
- case 5:
17534
- _context21.next = 7;
17612
+ case 6:
17613
+ _context21.next = 8;
17535
17614
  return res.json();
17536
17615
 
17537
- case 7:
17616
+ case 8:
17538
17617
  json = _context21.sent;
17539
17618
  if (!(typeof json.result === "string")) {
17540
- _context21.next = 13;
17619
+ _context21.next = 14;
17541
17620
  break;
17542
17621
  }
17543
17622
  if (!json.result.includes("Invalid API Key")) {
17544
- _context21.next = 11;
17623
+ _context21.next = 12;
17545
17624
  break;
17546
17625
  }
17547
17626
  throw new InvalidApiKeyError(SERVICES_API_KEY.Etherscan);
17548
17627
 
17549
- case 11:
17628
+ case 12:
17550
17629
  if (!json.result.includes("Max rate limit reached")) {
17551
- _context21.next = 13;
17630
+ _context21.next = 14;
17552
17631
  break;
17553
17632
  }
17554
17633
  throw new RateLimitError(SERVICES_API_KEY.Etherscan);
17555
17634
 
17556
- case 13:
17635
+ case 14:
17557
17636
  return _context21.abrupt("return", json.result);
17558
17637
 
17559
- case 14:
17638
+ case 15:
17560
17639
  case "end":
17561
17640
  return _context21.stop();
17562
17641
  }
17563
17642
  }), _callee21);
17564
17643
  })));
17565
17644
  return function fetchJSON(_x18) {
17566
- return _ref15.apply(this, arguments);
17645
+ return _ref16.apply(this, arguments);
17567
17646
  };
17568
17647
  }();
17569
17648
  _argsToArray19 = argsToArray(_args25), _argsToArray20 = _slicedToArray(_argsToArray19, 7),
@@ -17581,13 +17660,6 @@ function _typeof(o) {
17581
17660
  offset: offset
17582
17661
  });
17583
17662
  apiKey = window.localStorage.getItem(SERVICES_API_KEY.Etherscan);
17584
- if (apiKey) {
17585
- _context25.next = 7;
17586
- break;
17587
- }
17588
- throw new MissingApiKeyError(SERVICES_API_KEY.Etherscan);
17589
-
17590
- case 7:
17591
17663
  INPUTS = addresses.split(",").map((function(s) {
17592
17664
  return s.trim();
17593
17665
  })).filter(Boolean);
@@ -17596,54 +17668,54 @@ function _typeof(o) {
17596
17668
  })).filter(Boolean);
17597
17669
  ADDRESS_MAP = {};
17598
17670
  _iterator41 = _createForOfIteratorHelper(INPUTS);
17599
- _context25.prev = 11;
17671
+ _context25.prev = 9;
17600
17672
  _iterator41.s();
17601
17673
 
17602
- case 13:
17674
+ case 11:
17603
17675
  if ((_step41 = _iterator41.n()).done) {
17604
- _context25.next = 25;
17676
+ _context25.next = 23;
17605
17677
  break;
17606
17678
  }
17607
17679
  inp = _step41.value;
17608
17680
  if (!isAddress$1.isAddress(inp)) {
17609
- _context25.next = 19;
17681
+ _context25.next = 17;
17610
17682
  break;
17611
17683
  }
17612
17684
  ADDRESS_MAP[inp.toLowerCase()] = null;
17613
- _context25.next = 23;
17685
+ _context25.next = 21;
17614
17686
  break;
17615
17687
 
17616
- case 19:
17617
- _context25.next = 21;
17688
+ case 17:
17689
+ _context25.next = 19;
17618
17690
  return fromEnsNameToAddress$1.validateAndGetAddress(inp);
17619
17691
 
17620
- case 21:
17692
+ case 19:
17621
17693
  _address = _context25.sent;
17622
17694
  ADDRESS_MAP[_address.toLowerCase()] = _address;
17623
17695
 
17624
- case 23:
17625
- _context25.next = 13;
17696
+ case 21:
17697
+ _context25.next = 11;
17626
17698
  break;
17627
17699
 
17628
- case 25:
17629
- _context25.next = 30;
17700
+ case 23:
17701
+ _context25.next = 28;
17630
17702
  break;
17631
17703
 
17632
- case 27:
17633
- _context25.prev = 27;
17634
- _context25.t0 = _context25["catch"](11);
17704
+ case 25:
17705
+ _context25.prev = 25;
17706
+ _context25.t0 = _context25["catch"](9);
17635
17707
  _iterator41.e(_context25.t0);
17636
17708
 
17637
- case 30:
17638
- _context25.prev = 30;
17709
+ case 28:
17710
+ _context25.prev = 28;
17639
17711
  _iterator41.f();
17640
- return _context25.finish(30);
17712
+ return _context25.finish(28);
17641
17713
 
17642
- case 33:
17714
+ case 31:
17643
17715
  ADDRS = Object.keys(ADDRESS_MAP);
17644
17716
  out = [];
17645
17717
  _iterator42 = _createForOfIteratorHelper(CHAINS);
17646
- _context25.prev = 36;
17718
+ _context25.prev = 34;
17647
17719
  _loop = _regeneratorRuntime().mark((function _loop() {
17648
17720
  var chain, chainId, _loop2, _ret2, i, sb, eb, _loop3, _ret3, _i16, _ADDRS;
17649
17721
  return _regeneratorRuntime().wrap((function _loop$(_context24) {
@@ -17817,52 +17889,52 @@ function _typeof(o) {
17817
17889
  }));
17818
17890
  _iterator42.s();
17819
17891
 
17820
- case 39:
17892
+ case 37:
17821
17893
  if ((_step42 = _iterator42.n()).done) {
17822
- _context25.next = 46;
17894
+ _context25.next = 44;
17823
17895
  break;
17824
17896
  }
17825
- return _context25.delegateYield(_loop(), "t1", 41);
17897
+ return _context25.delegateYield(_loop(), "t1", 39);
17826
17898
 
17827
- case 41:
17899
+ case 39:
17828
17900
  _ret = _context25.t1;
17829
17901
  if (!_ret) {
17830
- _context25.next = 44;
17902
+ _context25.next = 42;
17831
17903
  break;
17832
17904
  }
17833
17905
  return _context25.abrupt("return", _ret.v);
17834
17906
 
17835
- case 44:
17836
- _context25.next = 39;
17907
+ case 42:
17908
+ _context25.next = 37;
17837
17909
  break;
17838
17910
 
17839
- case 46:
17840
- _context25.next = 51;
17911
+ case 44:
17912
+ _context25.next = 49;
17841
17913
  break;
17842
17914
 
17843
- case 48:
17844
- _context25.prev = 48;
17845
- _context25.t2 = _context25["catch"](36);
17915
+ case 46:
17916
+ _context25.prev = 46;
17917
+ _context25.t2 = _context25["catch"](34);
17846
17918
  _iterator42.e(_context25.t2);
17847
17919
 
17848
- case 51:
17849
- _context25.prev = 51;
17920
+ case 49:
17921
+ _context25.prev = 49;
17850
17922
  _iterator42.f();
17851
- return _context25.finish(51);
17923
+ return _context25.finish(49);
17852
17924
 
17853
- case 54:
17925
+ case 52:
17854
17926
  return _context25.abrupt("return", out);
17855
17927
 
17856
- case 57:
17857
- _context25.prev = 57;
17928
+ case 55:
17929
+ _context25.prev = 55;
17858
17930
  _context25.t3 = _context25["catch"](0);
17859
17931
  return _context25.abrupt("return", errorMessageHandler(_context25.t3, "EOA"));
17860
17932
 
17861
- case 60:
17933
+ case 58:
17862
17934
  case "end":
17863
17935
  return _context25.stop();
17864
17936
  }
17865
- }), _callee22, null, [ [ 0, 57 ], [ 11, 27, 30, 33 ], [ 36, 48, 51, 54 ] ]);
17937
+ }), _callee22, null, [ [ 0, 55 ], [ 9, 25, 28, 31 ], [ 34, 46, 49, 52 ] ]);
17866
17938
  })));
17867
17939
  return _EOA.apply(this, arguments);
17868
17940
  }
@@ -17895,7 +17967,7 @@ function _typeof(o) {
17895
17967
  }
17896
17968
  function _SAFE() {
17897
17969
  _SAFE = _asyncToGenerator(_regeneratorRuntime().mark((function _callee24() {
17898
- var _argsToArray21, _argsToArray22, address, utility, chain, _argsToArray22$, limit, _argsToArray22$2, offset, apiKey, chainId, resolved, url, res, json, _args27 = arguments;
17970
+ var _argsToArray21, _argsToArray22, address, utility, chain, _argsToArray22$, limit, _argsToArray22$2, offset, apiKey, chainId, resolved, url, _getUrlAndHeaders0, finalUrl, HEADERS, res, json, _args27 = arguments;
17899
17971
  return _regeneratorRuntime().wrap((function _callee24$(_context27) {
17900
17972
  while (1) switch (_context27.prev = _context27.next) {
17901
17973
  case 0:
@@ -17912,70 +17984,68 @@ function _typeof(o) {
17912
17984
  offset: offset
17913
17985
  });
17914
17986
  apiKey = window.localStorage.getItem(SERVICES_API_KEY.Safe);
17915
- if (apiKey) {
17916
- _context27.next = 6;
17917
- break;
17918
- }
17919
- throw new MissingApiKeyError(SERVICES_API_KEY.Safe);
17920
-
17921
- case 6:
17922
17987
  chainId = SAFE_CHAIN_MAP[chain];
17923
17988
  if (chainId) {
17924
- _context27.next = 9;
17989
+ _context27.next = 7;
17925
17990
  break;
17926
17991
  }
17927
17992
  throw new ValidationError("Invalid chain: ".concat(chain));
17928
17993
 
17929
- case 9:
17930
- _context27.next = 11;
17994
+ case 7:
17995
+ _context27.next = 9;
17931
17996
  return fromEnsNameToAddress$1.validateAndGetAddress(address);
17932
17997
 
17933
- case 11:
17998
+ case 9:
17934
17999
  resolved = _context27.sent;
17935
18000
  url = "https://api.safe.global/tx-service/".concat(chainId, "/api/v2/safes/").concat(resolved, "/multisig-transactions?limit=").concat(limit, "&offset=").concat(offset);
17936
- _context27.next = 15;
17937
- return fetch(url, {
18001
+ _getUrlAndHeaders0 = getUrlAndHeaders({
18002
+ url: url,
18003
+ serviceName: "Etherscan",
17938
18004
  headers: {
17939
18005
  Authorization: "Bearer ".concat(apiKey)
17940
18006
  }
18007
+ }), finalUrl = _getUrlAndHeaders0.URL, HEADERS = _getUrlAndHeaders0.HEADERS;
18008
+ _context27.next = 14;
18009
+ return fetch(finalUrl, {
18010
+ headers: HEADERS
17941
18011
  });
17942
18012
 
17943
- case 15:
18013
+ case 14:
17944
18014
  res = _context27.sent;
17945
18015
  if (res.ok) {
17946
- _context27.next = 18;
18016
+ _context27.next = 17;
17947
18017
  break;
17948
18018
  }
17949
18019
  throw new NetworkError(SERVICES_API_KEY.Safe, res.status);
17950
18020
 
17951
- case 18:
17952
- _context27.next = 20;
18021
+ case 17:
18022
+ _context27.next = 19;
17953
18023
  return res.json();
17954
18024
 
17955
- case 20:
18025
+ case 19:
17956
18026
  json = _context27.sent;
17957
18027
  if (Array.isArray(json.results)) {
17958
- _context27.next = 23;
18028
+ _context27.next = 22;
17959
18029
  break;
17960
18030
  }
17961
18031
  throw new ValidationError("Invalid API response");
17962
18032
 
17963
- case 23:
17964
- return _context27.abrupt("return", json.results.map((function(_ref16) {
17965
- var confirmations = _ref16.confirmations, dataDecoded = _ref16.dataDecoded, rest = _objectWithoutProperties(_ref16, _excluded);
18033
+ case 22:
18034
+ return _context27.abrupt("return", json.results.map((function(_ref17) {
18035
+ var confirmations = _ref17.confirmations, dataDecoded = _ref17.dataDecoded, rest = _objectWithoutProperties(_ref17, _excluded);
17966
18036
  return rest;
17967
18037
  })));
17968
18038
 
17969
- case 26:
17970
- _context27.prev = 26;
18039
+ case 25:
18040
+ _context27.prev = 25;
17971
18041
  _context27.t0 = _context27["catch"](0);
17972
18042
  return _context27.abrupt("return", errorMessageHandler(_context27.t0, "SAFE"));
17973
18043
 
17974
- case 29:
18044
+ case 28:
17975
18045
  case "end":
17976
18046
  return _context27.stop();
17977
18047
  }
17978
- }), _callee24, null, [ [ 0, 26 ] ]);
18048
+ }), _callee24, null, [ [ 0, 25 ] ]);
17979
18049
  })));
17980
18050
  return _SAFE.apply(this, arguments);
17981
18051
  }
@@ -17995,55 +18065,48 @@ function _typeof(o) {
17995
18065
  category: category
17996
18066
  });
17997
18067
  apiKey = window.localStorage.getItem(SERVICES_API_KEY.Defillama);
17998
- if (apiKey) {
17999
- _context28.next = 6;
18000
- break;
18001
- }
18002
- throw new MissingApiKeyError(SERVICES_API_KEY.Defillama);
18003
-
18004
- case 6:
18005
18068
  url = CATEGORY_URLS[category];
18006
18069
  if (url) {
18007
- _context28.next = 9;
18070
+ _context28.next = 7;
18008
18071
  break;
18009
18072
  }
18010
18073
  throw new ValidationError("Invalid category: ".concat(category));
18011
18074
 
18012
- case 9:
18013
- _context28.next = 11;
18075
+ case 7:
18076
+ _context28.next = 9;
18014
18077
  return fetch(url);
18015
18078
 
18016
- case 11:
18079
+ case 9:
18017
18080
  res = _context28.sent;
18018
18081
  if (res.ok) {
18019
- _context28.next = 14;
18082
+ _context28.next = 12;
18020
18083
  break;
18021
18084
  }
18022
18085
  throw new NetworkError(SERVICES_API_KEY.Defillama, res.status);
18023
18086
 
18024
- case 14:
18025
- _context28.next = 16;
18087
+ case 12:
18088
+ _context28.next = 14;
18026
18089
  return res.json();
18027
18090
 
18028
- case 16:
18091
+ case 14:
18029
18092
  json = _context28.sent;
18030
18093
  _context28.t0 = category;
18031
- _context28.next = _context28.t0 === "protocols" ? 20 : _context28.t0 === "yields" ? 22 : _context28.t0 === "dex" ? 24 : _context28.t0 === "fees" ? 24 : 26;
18094
+ _context28.next = _context28.t0 === "protocols" ? 18 : _context28.t0 === "yields" ? 20 : _context28.t0 === "dex" ? 22 : _context28.t0 === "fees" ? 22 : 24;
18032
18095
  break;
18033
18096
 
18034
- case 20:
18097
+ case 18:
18035
18098
  json = Array.isArray(json) ? json.slice(0, 500) : [];
18036
- return _context28.abrupt("break", 26);
18099
+ return _context28.abrupt("break", 24);
18037
18100
 
18038
- case 22:
18101
+ case 20:
18039
18102
  json = Array.isArray(json.data) ? json.data.slice(0, 500) : [];
18040
- return _context28.abrupt("break", 26);
18103
+ return _context28.abrupt("break", 24);
18041
18104
 
18042
- case 24:
18105
+ case 22:
18043
18106
  json = Array.isArray(json.protocols) ? json.protocols.slice(0, 500) : [];
18044
- return _context28.abrupt("break", 26);
18107
+ return _context28.abrupt("break", 24);
18045
18108
 
18046
- case 26:
18109
+ case 24:
18047
18110
  return _context28.abrupt("return", (Array.isArray(json) ? json : [ json ]).map((function(item) {
18048
18111
  var out = {};
18049
18112
  for (var _i17 = 0, _Object$entries7 = Object.entries(item); _i17 < _Object$entries7.length; _i17++) {
@@ -18053,16 +18116,16 @@ function _typeof(o) {
18053
18116
  return out;
18054
18117
  })));
18055
18118
 
18056
- case 29:
18057
- _context28.prev = 29;
18119
+ case 27:
18120
+ _context28.prev = 27;
18058
18121
  _context28.t1 = _context28["catch"](0);
18059
18122
  return _context28.abrupt("return", errorMessageHandler(_context28.t1, "DEFILLAMA"));
18060
18123
 
18061
- case 32:
18124
+ case 30:
18062
18125
  case "end":
18063
18126
  return _context28.stop();
18064
18127
  }
18065
- }), _callee25, null, [ [ 0, 29 ] ]);
18128
+ }), _callee25, null, [ [ 0, 27 ] ]);
18066
18129
  })));
18067
18130
  return _DEFILLAMA.apply(this, arguments);
18068
18131
  }
@@ -18110,8 +18173,8 @@ function _typeof(o) {
18110
18173
  }
18111
18174
  return _context29.abrupt("return", json.map((function(item) {
18112
18175
  var flat = {};
18113
- Object.entries(item).forEach((function(_ref17) {
18114
- var _ref18 = _slicedToArray(_ref17, 2), k = _ref18[0], v = _ref18[1];
18176
+ Object.entries(item).forEach((function(_ref18) {
18177
+ var _ref19 = _slicedToArray(_ref18, 2), k = _ref19[0], v = _ref19[1];
18115
18178
  if (v === null || _typeof(v) !== "object") flat[k] = v;
18116
18179
  }));
18117
18180
  return flat;
@@ -18177,8 +18240,8 @@ function _typeof(o) {
18177
18240
  }
18178
18241
  return _context30.abrupt("return", json.map((function(item) {
18179
18242
  var flat = {};
18180
- Object.entries(item).forEach((function(_ref19) {
18181
- var _ref20 = _slicedToArray(_ref19, 2), k = _ref20[0], v = _ref20[1];
18243
+ Object.entries(item).forEach((function(_ref20) {
18244
+ var _ref21 = _slicedToArray(_ref20, 2), k = _ref21[0], v = _ref21[1];
18182
18245
  if (v === null || _typeof(v) !== "object") flat[k] = v;
18183
18246
  }));
18184
18247
  return flat;