@fileverse-dev/formulajs 4.4.11-mod-73 → 4.4.11-mod-75
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/browser/formula.js +390 -466
- package/lib/browser/formula.min.js +2 -2
- package/lib/browser/formula.min.js.map +1 -1
- package/lib/cjs/index.cjs +61 -76
- package/lib/esm/index.mjs +61 -76
- package/package.json +1 -1
package/lib/browser/formula.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* @fileverse-dev/formulajs v4.4.11-mod-
|
|
1
|
+
/* @fileverse-dev/formulajs v4.4.11-mod-75 */
|
|
2
2
|
var _excluded = [ "confirmations", "dataDecoded" ];
|
|
3
3
|
|
|
4
4
|
function _objectWithoutProperties(e, t) {
|
|
@@ -67,112 +67,6 @@ function _createForOfIteratorHelper(r, e) {
|
|
|
67
67
|
};
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
function _defineProperties(e, r) {
|
|
71
|
-
for (var t = 0; t < r.length; t++) {
|
|
72
|
-
var o = r[t];
|
|
73
|
-
o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0),
|
|
74
|
-
Object.defineProperty(e, _toPropertyKey(o.key), o);
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
function _createClass(e, r, t) {
|
|
79
|
-
return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", {
|
|
80
|
-
writable: !1
|
|
81
|
-
}), e;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
function _classCallCheck(a, n) {
|
|
85
|
-
if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
function _callSuper(t, o, e) {
|
|
89
|
-
return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e));
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
function _possibleConstructorReturn(t, e) {
|
|
93
|
-
if (e && ("object" == _typeof(e) || "function" == typeof e)) return e;
|
|
94
|
-
if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined");
|
|
95
|
-
return _assertThisInitialized(t);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
function _assertThisInitialized(e) {
|
|
99
|
-
if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
100
|
-
return e;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
function _inherits(t, e) {
|
|
104
|
-
if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
|
|
105
|
-
t.prototype = Object.create(e && e.prototype, {
|
|
106
|
-
constructor: {
|
|
107
|
-
value: t,
|
|
108
|
-
writable: !0,
|
|
109
|
-
configurable: !0
|
|
110
|
-
}
|
|
111
|
-
}), Object.defineProperty(t, "prototype", {
|
|
112
|
-
writable: !1
|
|
113
|
-
}), e && _setPrototypeOf(t, e);
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
function _wrapNativeSuper(t) {
|
|
117
|
-
var r = "function" == typeof Map ? new Map : void 0;
|
|
118
|
-
return _wrapNativeSuper = function _wrapNativeSuper(t) {
|
|
119
|
-
if (null === t || !_isNativeFunction(t)) return t;
|
|
120
|
-
if ("function" != typeof t) throw new TypeError("Super expression must either be null or a function");
|
|
121
|
-
if (void 0 !== r) {
|
|
122
|
-
if (r.has(t)) return r.get(t);
|
|
123
|
-
r.set(t, Wrapper);
|
|
124
|
-
}
|
|
125
|
-
function Wrapper() {
|
|
126
|
-
return _construct(t, arguments, _getPrototypeOf(this).constructor);
|
|
127
|
-
}
|
|
128
|
-
return Wrapper.prototype = Object.create(t.prototype, {
|
|
129
|
-
constructor: {
|
|
130
|
-
value: Wrapper,
|
|
131
|
-
enumerable: !1,
|
|
132
|
-
writable: !0,
|
|
133
|
-
configurable: !0
|
|
134
|
-
}
|
|
135
|
-
}), _setPrototypeOf(Wrapper, t);
|
|
136
|
-
}, _wrapNativeSuper(t);
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
function _construct(t, e, r) {
|
|
140
|
-
if (_isNativeReflectConstruct()) return Reflect.construct.apply(null, arguments);
|
|
141
|
-
var o = [ null ];
|
|
142
|
-
o.push.apply(o, e);
|
|
143
|
-
var p = new (t.bind.apply(t, o));
|
|
144
|
-
return r && _setPrototypeOf(p, r.prototype), p;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
function _isNativeReflectConstruct() {
|
|
148
|
-
try {
|
|
149
|
-
var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], (function() {})));
|
|
150
|
-
} catch (t) {}
|
|
151
|
-
return (_isNativeReflectConstruct = function _isNativeReflectConstruct() {
|
|
152
|
-
return !!t;
|
|
153
|
-
})();
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
function _isNativeFunction(t) {
|
|
157
|
-
try {
|
|
158
|
-
return -1 !== Function.toString.call(t).indexOf("[native code]");
|
|
159
|
-
} catch (n) {
|
|
160
|
-
return "function" == typeof t;
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
function _setPrototypeOf(t, e) {
|
|
165
|
-
return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(t, e) {
|
|
166
|
-
return t.__proto__ = e, t;
|
|
167
|
-
}, _setPrototypeOf(t, e);
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
function _getPrototypeOf(t) {
|
|
171
|
-
return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(t) {
|
|
172
|
-
return t.__proto__ || Object.getPrototypeOf(t);
|
|
173
|
-
}, _getPrototypeOf(t);
|
|
174
|
-
}
|
|
175
|
-
|
|
176
70
|
function _regeneratorRuntime() {
|
|
177
71
|
"use strict";
|
|
178
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() {
|
|
@@ -495,6 +389,20 @@ function _defineProperty(e, r, t) {
|
|
|
495
389
|
}) : e[r] = t, e;
|
|
496
390
|
}
|
|
497
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
|
+
|
|
498
406
|
function _toPropertyKey(t) {
|
|
499
407
|
var i = _toPrimitive(t, "string");
|
|
500
408
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
@@ -511,6 +419,98 @@ function _toPrimitive(t, r) {
|
|
|
511
419
|
return ("string" === r ? String : Number)(t);
|
|
512
420
|
}
|
|
513
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
|
}
|
|
@@ -11068,50 +11068,109 @@ function _typeof(o) {
|
|
|
11068
11068
|
Neynar: "Neynar",
|
|
11069
11069
|
Defillama: "Defillama"
|
|
11070
11070
|
};
|
|
11071
|
-
var
|
|
11072
|
-
|
|
11073
|
-
|
|
11074
|
-
|
|
11075
|
-
removeParams: [ "apikey" ]
|
|
11076
|
-
},
|
|
11077
|
-
Basescan: {
|
|
11078
|
-
url: process.env.NEXT_PUBLIC_PROXY_BASE_URL || stagingFileverseProxyUrl,
|
|
11079
|
-
removeParams: [ "apikey" ]
|
|
11080
|
-
},
|
|
11081
|
-
Gnosisscan: {
|
|
11082
|
-
url: process.env.NEXT_PUBLIC_PROXY_BASE_URL || stagingFileverseProxyUrl,
|
|
11083
|
-
removeParams: [ "apikey" ]
|
|
11084
|
-
},
|
|
11085
|
-
Coingecko: {
|
|
11086
|
-
url: process.env.NEXT_PUBLIC_PROXY_BASE_URL || stagingFileverseProxyUrl,
|
|
11087
|
-
removeParams: [ "apikey" ]
|
|
11088
|
-
},
|
|
11089
|
-
Firefly: {
|
|
11090
|
-
url: process.env.NEXT_PUBLIC_PROXY_BASE_URL || stagingFileverseProxyUrl,
|
|
11091
|
-
removeParams: [ "apikey" ]
|
|
11092
|
-
},
|
|
11093
|
-
Neynar: {
|
|
11094
|
-
url: process.env.NEXT_PUBLIC_PROXY_BASE_URL || stagingFileverseProxyUrl,
|
|
11095
|
-
removeParams: [ "api_key" ]
|
|
11096
|
-
},
|
|
11097
|
-
Safe: {
|
|
11098
|
-
url: process.env.NEXT_PUBLIC_PROXY_BASE_URL || stagingFileverseProxyUrl,
|
|
11099
|
-
removeParams: [ "api_key" ]
|
|
11100
|
-
},
|
|
11101
|
-
Defillama: {
|
|
11102
|
-
url: process.env.NEXT_PUBLIC_PROXY_BASE_URL || stagingFileverseProxyUrl,
|
|
11103
|
-
removeParams: [ "api_key" ]
|
|
11104
|
-
},
|
|
11105
|
-
GnosisPay: {
|
|
11106
|
-
url: process.env.NEXT_PUBLIC_PROXY_BASE_URL || stagingFileverseProxyUrl,
|
|
11107
|
-
removeParams: [ "api_key" ]
|
|
11071
|
+
var ValidationError = function(_Error) {
|
|
11072
|
+
function ValidationError(message) {
|
|
11073
|
+
_classCallCheck(this, ValidationError);
|
|
11074
|
+
return _callSuper(this, ValidationError, [ message ]);
|
|
11108
11075
|
}
|
|
11109
|
-
|
|
11110
|
-
|
|
11111
|
-
|
|
11112
|
-
|
|
11076
|
+
_inherits(ValidationError, _Error);
|
|
11077
|
+
return _createClass(ValidationError);
|
|
11078
|
+
}(_wrapNativeSuper(Error));
|
|
11079
|
+
var MissingApiKeyError = function(_Error2) {
|
|
11080
|
+
function MissingApiKeyError(apiKeyName) {
|
|
11081
|
+
_classCallCheck(this, MissingApiKeyError);
|
|
11082
|
+
return _callSuper(this, MissingApiKeyError, [ "API key for ".concat(apiKeyName, " is missing") ]);
|
|
11113
11083
|
}
|
|
11114
|
-
|
|
11084
|
+
_inherits(MissingApiKeyError, _Error2);
|
|
11085
|
+
return _createClass(MissingApiKeyError);
|
|
11086
|
+
}(_wrapNativeSuper(Error));
|
|
11087
|
+
var RateLimitError = function(_Error3) {
|
|
11088
|
+
function RateLimitError(apiKeyName) {
|
|
11089
|
+
var _this;
|
|
11090
|
+
_classCallCheck(this, RateLimitError);
|
|
11091
|
+
_this = _callSuper(this, RateLimitError, [ "You have reached the rate limit for ".concat(apiKeyName) ]);
|
|
11092
|
+
_this.api = apiKeyName;
|
|
11093
|
+
return _this;
|
|
11094
|
+
}
|
|
11095
|
+
_inherits(RateLimitError, _Error3);
|
|
11096
|
+
return _createClass(RateLimitError);
|
|
11097
|
+
}(_wrapNativeSuper(Error));
|
|
11098
|
+
var NetworkError = function(_Error4) {
|
|
11099
|
+
function NetworkError(apiKeyName, status) {
|
|
11100
|
+
var _this2;
|
|
11101
|
+
_classCallCheck(this, NetworkError);
|
|
11102
|
+
_this2 = _callSuper(this, NetworkError, [ status === 429 ? "You have reached the rate limit for ".concat(apiKeyName) : "".concat(apiKeyName, " API failed with status code: ").concat(status) ]);
|
|
11103
|
+
_this2.status = status;
|
|
11104
|
+
_this2.api = apiKeyName;
|
|
11105
|
+
return _this2;
|
|
11106
|
+
}
|
|
11107
|
+
_inherits(NetworkError, _Error4);
|
|
11108
|
+
return _createClass(NetworkError);
|
|
11109
|
+
}(_wrapNativeSuper(Error));
|
|
11110
|
+
var EnsError = function(_Error5) {
|
|
11111
|
+
function EnsError(ensname) {
|
|
11112
|
+
_classCallCheck(this, EnsError);
|
|
11113
|
+
return _callSuper(this, EnsError, [ "".concat(ensname, " is not a supported ens name") ]);
|
|
11114
|
+
}
|
|
11115
|
+
_inherits(EnsError, _Error5);
|
|
11116
|
+
return _createClass(EnsError);
|
|
11117
|
+
}(_wrapNativeSuper(Error));
|
|
11118
|
+
var InvalidApiKeyError = function(_Error6) {
|
|
11119
|
+
function InvalidApiKeyError(apiKeyName) {
|
|
11120
|
+
var _this3;
|
|
11121
|
+
_classCallCheck(this, InvalidApiKeyError);
|
|
11122
|
+
_this3 = _callSuper(this, InvalidApiKeyError, [ "Api key is invalid for ".concat(apiKeyName) ]);
|
|
11123
|
+
_this3.api = apiKeyName;
|
|
11124
|
+
return _this3;
|
|
11125
|
+
}
|
|
11126
|
+
_inherits(InvalidApiKeyError, _Error6);
|
|
11127
|
+
return _createClass(InvalidApiKeyError);
|
|
11128
|
+
}(_wrapNativeSuper(Error));
|
|
11129
|
+
var stagingFileverseProxyUrl = "https://staging-api-proxy-ca4268d7d581.herokuapp.com/proxy";
|
|
11130
|
+
var productionFileverseProxyUrl = "".concat(process.env.NEXT_PUBLIC_PROXY_BASE_URL, "/proxy");
|
|
11131
|
+
var PROXY_MAP = {
|
|
11132
|
+
Etherscan: {
|
|
11133
|
+
url: productionFileverseProxyUrl || stagingFileverseProxyUrl,
|
|
11134
|
+
removeParams: [ "apikey" ]
|
|
11135
|
+
},
|
|
11136
|
+
Basescan: {
|
|
11137
|
+
url: productionFileverseProxyUrl || stagingFileverseProxyUrl,
|
|
11138
|
+
removeParams: [ "apikey" ]
|
|
11139
|
+
},
|
|
11140
|
+
Gnosisscan: {
|
|
11141
|
+
url: productionFileverseProxyUrl || stagingFileverseProxyUrl,
|
|
11142
|
+
removeParams: [ "apikey" ]
|
|
11143
|
+
},
|
|
11144
|
+
Coingecko: {
|
|
11145
|
+
url: productionFileverseProxyUrl || stagingFileverseProxyUrl,
|
|
11146
|
+
removeParams: [ "apikey" ]
|
|
11147
|
+
},
|
|
11148
|
+
Firefly: {
|
|
11149
|
+
url: productionFileverseProxyUrl || stagingFileverseProxyUrl,
|
|
11150
|
+
removeParams: [ "apikey" ]
|
|
11151
|
+
},
|
|
11152
|
+
Neynar: {
|
|
11153
|
+
url: productionFileverseProxyUrl || stagingFileverseProxyUrl,
|
|
11154
|
+
removeParams: [ "api_key" ]
|
|
11155
|
+
},
|
|
11156
|
+
Safe: {
|
|
11157
|
+
url: productionFileverseProxyUrl || stagingFileverseProxyUrl,
|
|
11158
|
+
removeParams: [ "api_key" ]
|
|
11159
|
+
},
|
|
11160
|
+
Defillama: {
|
|
11161
|
+
url: productionFileverseProxyUrl || stagingFileverseProxyUrl,
|
|
11162
|
+
removeParams: [ "api_key" ]
|
|
11163
|
+
},
|
|
11164
|
+
GnosisPay: {
|
|
11165
|
+
url: productionFileverseProxyUrl || stagingFileverseProxyUrl,
|
|
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);
|
|
11115
11174
|
paramsToRemove.forEach((function(param) {
|
|
11116
11175
|
if (urlObj.searchParams.has(param)) {
|
|
11117
11176
|
urlObj.searchParams["delete"](param);
|
|
@@ -11124,8 +11183,10 @@ function _typeof(o) {
|
|
|
11124
11183
|
var apiKeyLS = window.localStorage.getItem(SERVICES_API_KEY[serviceName]);
|
|
11125
11184
|
var isProxyModeEnabledValue = apiKeyLS === "DEFAULT_PROXY_MODE";
|
|
11126
11185
|
var proxyConfig = PROXY_MAP[serviceName];
|
|
11127
|
-
if (
|
|
11128
|
-
|
|
11186
|
+
if (!proxyConfig && SERVICES_API_KEY[serviceName] && (!apiKeyLS || apiKeyLS === "")) {
|
|
11187
|
+
throw new MissingApiKeyError(SERVICES_API_KEY[serviceName]);
|
|
11188
|
+
}
|
|
11189
|
+
if ((isProxyModeEnabledValue || !apiKeyLS || apiKeyLS === "") && proxyConfig) {
|
|
11129
11190
|
var cleanedUrl = removeUrlParams(url, proxyConfig.removeParams);
|
|
11130
11191
|
return {
|
|
11131
11192
|
URL: proxyConfig.url,
|
|
@@ -11258,64 +11319,6 @@ function _typeof(o) {
|
|
|
11258
11319
|
var fromEnsNameToAddress$1 = {
|
|
11259
11320
|
fromEnsNameToAddress: fromEnsNameToAddress
|
|
11260
11321
|
};
|
|
11261
|
-
var ValidationError = function(_Error) {
|
|
11262
|
-
function ValidationError(message) {
|
|
11263
|
-
_classCallCheck(this, ValidationError);
|
|
11264
|
-
return _callSuper(this, ValidationError, [ message ]);
|
|
11265
|
-
}
|
|
11266
|
-
_inherits(ValidationError, _Error);
|
|
11267
|
-
return _createClass(ValidationError);
|
|
11268
|
-
}(_wrapNativeSuper(Error));
|
|
11269
|
-
var MissingApiKeyError = function(_Error2) {
|
|
11270
|
-
function MissingApiKeyError(apiKeyName) {
|
|
11271
|
-
_classCallCheck(this, MissingApiKeyError);
|
|
11272
|
-
return _callSuper(this, MissingApiKeyError, [ "API key for ".concat(apiKeyName, " is missing") ]);
|
|
11273
|
-
}
|
|
11274
|
-
_inherits(MissingApiKeyError, _Error2);
|
|
11275
|
-
return _createClass(MissingApiKeyError);
|
|
11276
|
-
}(_wrapNativeSuper(Error));
|
|
11277
|
-
var RateLimitError = function(_Error3) {
|
|
11278
|
-
function RateLimitError(apiKeyName) {
|
|
11279
|
-
var _this;
|
|
11280
|
-
_classCallCheck(this, RateLimitError);
|
|
11281
|
-
_this = _callSuper(this, RateLimitError, [ "You have reached the rate limit for ".concat(apiKeyName) ]);
|
|
11282
|
-
_this.api = apiKeyName;
|
|
11283
|
-
return _this;
|
|
11284
|
-
}
|
|
11285
|
-
_inherits(RateLimitError, _Error3);
|
|
11286
|
-
return _createClass(RateLimitError);
|
|
11287
|
-
}(_wrapNativeSuper(Error));
|
|
11288
|
-
var NetworkError = function(_Error4) {
|
|
11289
|
-
function NetworkError(apiKeyName, status) {
|
|
11290
|
-
var _this2;
|
|
11291
|
-
_classCallCheck(this, NetworkError);
|
|
11292
|
-
_this2 = _callSuper(this, NetworkError, [ status === 429 ? "You have reached the rate limit for ".concat(apiKeyName) : "".concat(apiKeyName, " API failed with status code: ").concat(status) ]);
|
|
11293
|
-
_this2.status = status;
|
|
11294
|
-
_this2.api = apiKeyName;
|
|
11295
|
-
return _this2;
|
|
11296
|
-
}
|
|
11297
|
-
_inherits(NetworkError, _Error4);
|
|
11298
|
-
return _createClass(NetworkError);
|
|
11299
|
-
}(_wrapNativeSuper(Error));
|
|
11300
|
-
var EnsError = function(_Error5) {
|
|
11301
|
-
function EnsError(ensname) {
|
|
11302
|
-
_classCallCheck(this, EnsError);
|
|
11303
|
-
return _callSuper(this, EnsError, [ "".concat(ensname, " is not a supported ens name") ]);
|
|
11304
|
-
}
|
|
11305
|
-
_inherits(EnsError, _Error5);
|
|
11306
|
-
return _createClass(EnsError);
|
|
11307
|
-
}(_wrapNativeSuper(Error));
|
|
11308
|
-
var InvalidApiKeyError = function(_Error6) {
|
|
11309
|
-
function InvalidApiKeyError(apiKeyName) {
|
|
11310
|
-
var _this3;
|
|
11311
|
-
_classCallCheck(this, InvalidApiKeyError);
|
|
11312
|
-
_this3 = _callSuper(this, InvalidApiKeyError, [ "Api key is invalid for ".concat(apiKeyName) ]);
|
|
11313
|
-
_this3.api = apiKeyName;
|
|
11314
|
-
return _this3;
|
|
11315
|
-
}
|
|
11316
|
-
_inherits(InvalidApiKeyError, _Error6);
|
|
11317
|
-
return _createClass(InvalidApiKeyError);
|
|
11318
|
-
}(_wrapNativeSuper(Error));
|
|
11319
11322
|
function handleScanRequest(_x6) {
|
|
11320
11323
|
return _handleScanRequest.apply(this, arguments);
|
|
11321
11324
|
}
|
|
@@ -16799,13 +16802,6 @@ function _typeof(o) {
|
|
|
16799
16802
|
end: end
|
|
16800
16803
|
});
|
|
16801
16804
|
apiKey = window.localStorage.getItem(SERVICES_API_KEY.Firefly);
|
|
16802
|
-
if (apiKey) {
|
|
16803
|
-
_context11.next = 6;
|
|
16804
|
-
break;
|
|
16805
|
-
}
|
|
16806
|
-
throw new MissingApiKeyError(SERVICES_API_KEY.Firefly);
|
|
16807
|
-
|
|
16808
|
-
case 6:
|
|
16809
16805
|
url = new URL("https://openapi.firefly.land/v1/fileverse/fetch");
|
|
16810
16806
|
url.searchParams.set("query", identifier.split(",").map((function(s) {
|
|
16811
16807
|
return s.trim();
|
|
@@ -16820,34 +16816,34 @@ function _typeof(o) {
|
|
|
16820
16816
|
"x-api-key": apiKey
|
|
16821
16817
|
}
|
|
16822
16818
|
}), finalUrl = _getUrlAndHeaders4.URL, HEADERS = _getUrlAndHeaders4.HEADERS;
|
|
16823
|
-
_context11.next =
|
|
16819
|
+
_context11.next = 12;
|
|
16824
16820
|
return fetch(finalUrl, {
|
|
16825
16821
|
method: "GET",
|
|
16826
16822
|
headers: HEADERS
|
|
16827
16823
|
});
|
|
16828
16824
|
|
|
16829
|
-
case
|
|
16825
|
+
case 12:
|
|
16830
16826
|
response = _context11.sent;
|
|
16831
16827
|
if (response.ok) {
|
|
16832
|
-
_context11.next =
|
|
16828
|
+
_context11.next = 15;
|
|
16833
16829
|
break;
|
|
16834
16830
|
}
|
|
16835
16831
|
throw new NetworkError(SERVICES_API_KEY.Firefly, response.status);
|
|
16836
16832
|
|
|
16837
|
-
case
|
|
16838
|
-
_context11.next =
|
|
16833
|
+
case 15:
|
|
16834
|
+
_context11.next = 17;
|
|
16839
16835
|
return response.json();
|
|
16840
16836
|
|
|
16841
|
-
case
|
|
16837
|
+
case 17:
|
|
16842
16838
|
_yield$response$json = _context11.sent;
|
|
16843
16839
|
_data = _yield$response$json.data;
|
|
16844
16840
|
if (Array.isArray(_data)) {
|
|
16845
|
-
_context11.next =
|
|
16841
|
+
_context11.next = 21;
|
|
16846
16842
|
break;
|
|
16847
16843
|
}
|
|
16848
16844
|
return _context11.abrupt("return", []);
|
|
16849
16845
|
|
|
16850
|
-
case
|
|
16846
|
+
case 21:
|
|
16851
16847
|
return _context11.abrupt("return", _data.map((function(item) {
|
|
16852
16848
|
var flat = {};
|
|
16853
16849
|
for (var _i10 = 0, _Object$entries = Object.entries(item); _i10 < _Object$entries.length; _i10++) {
|
|
@@ -16860,16 +16856,16 @@ function _typeof(o) {
|
|
|
16860
16856
|
return flat;
|
|
16861
16857
|
})));
|
|
16862
16858
|
|
|
16863
|
-
case
|
|
16864
|
-
_context11.prev =
|
|
16859
|
+
case 24:
|
|
16860
|
+
_context11.prev = 24;
|
|
16865
16861
|
_context11.t0 = _context11["catch"](0);
|
|
16866
16862
|
return _context11.abrupt("return", errorMessageHandler(_context11.t0, "FIREFLY"));
|
|
16867
16863
|
|
|
16868
|
-
case
|
|
16864
|
+
case 27:
|
|
16869
16865
|
case "end":
|
|
16870
16866
|
return _context11.stop();
|
|
16871
16867
|
}
|
|
16872
|
-
}), _callee11, null, [ [ 0,
|
|
16868
|
+
}), _callee11, null, [ [ 0, 24 ] ]);
|
|
16873
16869
|
})));
|
|
16874
16870
|
return _FIREFLY.apply(this, arguments);
|
|
16875
16871
|
}
|
|
@@ -16894,13 +16890,6 @@ function _typeof(o) {
|
|
|
16894
16890
|
end: end
|
|
16895
16891
|
});
|
|
16896
16892
|
apiKey = window.localStorage.getItem(SERVICES_API_KEY.Firefly);
|
|
16897
|
-
if (apiKey) {
|
|
16898
|
-
_context12.next = 6;
|
|
16899
|
-
break;
|
|
16900
|
-
}
|
|
16901
|
-
throw new MissingApiKeyError(SERVICES_API_KEY.Firefly);
|
|
16902
|
-
|
|
16903
|
-
case 6:
|
|
16904
16893
|
url = new URL("https://openapi.firefly.land/v1/fileverse/fetch");
|
|
16905
16894
|
url.searchParams.set("query", identifier.split(",").map((function(s) {
|
|
16906
16895
|
return s.trim();
|
|
@@ -16919,34 +16908,34 @@ function _typeof(o) {
|
|
|
16919
16908
|
"x-api-key": apiKey
|
|
16920
16909
|
}
|
|
16921
16910
|
}), finalUrl = _getUrlAndHeaders5.URL, HEADERS = _getUrlAndHeaders5.HEADERS;
|
|
16922
|
-
_context12.next =
|
|
16911
|
+
_context12.next = 13;
|
|
16923
16912
|
return fetch(finalUrl, {
|
|
16924
16913
|
method: "GET",
|
|
16925
16914
|
headers: HEADERS
|
|
16926
16915
|
});
|
|
16927
16916
|
|
|
16928
|
-
case
|
|
16917
|
+
case 13:
|
|
16929
16918
|
response = _context12.sent;
|
|
16930
16919
|
if (response.ok) {
|
|
16931
|
-
_context12.next =
|
|
16920
|
+
_context12.next = 16;
|
|
16932
16921
|
break;
|
|
16933
16922
|
}
|
|
16934
16923
|
throw new NetworkError(SERVICES_API_KEY.Firefly, response.status);
|
|
16935
16924
|
|
|
16936
|
-
case
|
|
16937
|
-
_context12.next =
|
|
16925
|
+
case 16:
|
|
16926
|
+
_context12.next = 18;
|
|
16938
16927
|
return response.json();
|
|
16939
16928
|
|
|
16940
|
-
case
|
|
16929
|
+
case 18:
|
|
16941
16930
|
_yield$response$json2 = _context12.sent;
|
|
16942
16931
|
_data2 = _yield$response$json2.data;
|
|
16943
16932
|
if (Array.isArray(_data2)) {
|
|
16944
|
-
_context12.next =
|
|
16933
|
+
_context12.next = 22;
|
|
16945
16934
|
break;
|
|
16946
16935
|
}
|
|
16947
16936
|
return _context12.abrupt("return", []);
|
|
16948
16937
|
|
|
16949
|
-
case
|
|
16938
|
+
case 22:
|
|
16950
16939
|
return _context12.abrupt("return", _data2.map((function(item) {
|
|
16951
16940
|
var flat = {};
|
|
16952
16941
|
for (var _i11 = 0, _Object$entries2 = Object.entries(item); _i11 < _Object$entries2.length; _i11++) {
|
|
@@ -16959,16 +16948,16 @@ function _typeof(o) {
|
|
|
16959
16948
|
return flat;
|
|
16960
16949
|
})));
|
|
16961
16950
|
|
|
16962
|
-
case
|
|
16963
|
-
_context12.prev =
|
|
16951
|
+
case 25:
|
|
16952
|
+
_context12.prev = 25;
|
|
16964
16953
|
_context12.t0 = _context12["catch"](0);
|
|
16965
16954
|
return _context12.abrupt("return", errorMessageHandler(_context12.t0, "LENS"));
|
|
16966
16955
|
|
|
16967
|
-
case
|
|
16956
|
+
case 28:
|
|
16968
16957
|
case "end":
|
|
16969
16958
|
return _context12.stop();
|
|
16970
16959
|
}
|
|
16971
|
-
}), _callee12, null, [ [ 0,
|
|
16960
|
+
}), _callee12, null, [ [ 0, 25 ] ]);
|
|
16972
16961
|
})));
|
|
16973
16962
|
return _LENS.apply(this, arguments);
|
|
16974
16963
|
}
|
|
@@ -16993,13 +16982,6 @@ function _typeof(o) {
|
|
|
16993
16982
|
end: end
|
|
16994
16983
|
});
|
|
16995
16984
|
apiKey = window.localStorage.getItem(SERVICES_API_KEY.Firefly);
|
|
16996
|
-
if (apiKey) {
|
|
16997
|
-
_context13.next = 6;
|
|
16998
|
-
break;
|
|
16999
|
-
}
|
|
17000
|
-
throw new MissingApiKeyError(SERVICES_API_KEY.Firefly);
|
|
17001
|
-
|
|
17002
|
-
case 6:
|
|
17003
16985
|
url = new URL("https://openapi.firefly.land/v1/fileverse/fetch");
|
|
17004
16986
|
url.searchParams.set("query", identifier.split(",").map((function(s) {
|
|
17005
16987
|
return s.trim();
|
|
@@ -17019,34 +17001,34 @@ function _typeof(o) {
|
|
|
17019
17001
|
"x-api-key": apiKey
|
|
17020
17002
|
}
|
|
17021
17003
|
}), finalUrl = _getUrlAndHeaders6.URL, HEADERS = _getUrlAndHeaders6.HEADERS;
|
|
17022
|
-
_context13.next =
|
|
17004
|
+
_context13.next = 13;
|
|
17023
17005
|
return fetch(finalUrl, {
|
|
17024
17006
|
method: "GET",
|
|
17025
17007
|
headers: HEADERS
|
|
17026
17008
|
});
|
|
17027
17009
|
|
|
17028
|
-
case
|
|
17010
|
+
case 13:
|
|
17029
17011
|
response = _context13.sent;
|
|
17030
17012
|
if (response.ok) {
|
|
17031
|
-
_context13.next =
|
|
17013
|
+
_context13.next = 16;
|
|
17032
17014
|
break;
|
|
17033
17015
|
}
|
|
17034
17016
|
throw new NetworkError(SERVICES_API_KEY.Firefly, response.status);
|
|
17035
17017
|
|
|
17036
|
-
case
|
|
17037
|
-
_context13.next =
|
|
17018
|
+
case 16:
|
|
17019
|
+
_context13.next = 18;
|
|
17038
17020
|
return response.json();
|
|
17039
17021
|
|
|
17040
|
-
case
|
|
17022
|
+
case 18:
|
|
17041
17023
|
_yield$response$json3 = _context13.sent;
|
|
17042
17024
|
_data3 = _yield$response$json3.data;
|
|
17043
17025
|
if (Array.isArray(_data3)) {
|
|
17044
|
-
_context13.next =
|
|
17026
|
+
_context13.next = 22;
|
|
17045
17027
|
break;
|
|
17046
17028
|
}
|
|
17047
17029
|
return _context13.abrupt("return", []);
|
|
17048
17030
|
|
|
17049
|
-
case
|
|
17031
|
+
case 22:
|
|
17050
17032
|
return _context13.abrupt("return", _data3.map((function(item) {
|
|
17051
17033
|
var flat = {};
|
|
17052
17034
|
for (var _i12 = 0, _Object$entries3 = Object.entries(item); _i12 < _Object$entries3.length; _i12++) {
|
|
@@ -17059,16 +17041,16 @@ function _typeof(o) {
|
|
|
17059
17041
|
return flat;
|
|
17060
17042
|
})));
|
|
17061
17043
|
|
|
17062
|
-
case
|
|
17063
|
-
_context13.prev =
|
|
17044
|
+
case 25:
|
|
17045
|
+
_context13.prev = 25;
|
|
17064
17046
|
_context13.t0 = _context13["catch"](0);
|
|
17065
17047
|
return _context13.abrupt("return", errorMessageHandler(_context13.t0, "FARCASTER"));
|
|
17066
17048
|
|
|
17067
|
-
case
|
|
17049
|
+
case 28:
|
|
17068
17050
|
case "end":
|
|
17069
17051
|
return _context13.stop();
|
|
17070
17052
|
}
|
|
17071
|
-
}), _callee13, null, [ [ 0,
|
|
17053
|
+
}), _callee13, null, [ [ 0, 25 ] ]);
|
|
17072
17054
|
})));
|
|
17073
17055
|
return _FARCASTER.apply(this, arguments);
|
|
17074
17056
|
}
|
|
@@ -17201,14 +17183,7 @@ function _typeof(o) {
|
|
|
17201
17183
|
limit: limit
|
|
17202
17184
|
});
|
|
17203
17185
|
API_KEY = window.localStorage.getItem(SERVICES_API_KEY.Basescan);
|
|
17204
|
-
|
|
17205
|
-
_context15.next = 6;
|
|
17206
|
-
break;
|
|
17207
|
-
}
|
|
17208
|
-
throw new MissingApiKeyError(SERVICES_API_KEY.Basescan);
|
|
17209
|
-
|
|
17210
|
-
case 6:
|
|
17211
|
-
_context15.next = 8;
|
|
17186
|
+
_context15.next = 6;
|
|
17212
17187
|
return handleScanRequest({
|
|
17213
17188
|
type: type,
|
|
17214
17189
|
address: address,
|
|
@@ -17222,19 +17197,19 @@ function _typeof(o) {
|
|
|
17222
17197
|
network: "base"
|
|
17223
17198
|
});
|
|
17224
17199
|
|
|
17225
|
-
case
|
|
17200
|
+
case 6:
|
|
17226
17201
|
return _context15.abrupt("return", _context15.sent);
|
|
17227
17202
|
|
|
17228
|
-
case
|
|
17229
|
-
_context15.prev =
|
|
17203
|
+
case 9:
|
|
17204
|
+
_context15.prev = 9;
|
|
17230
17205
|
_context15.t0 = _context15["catch"](0);
|
|
17231
17206
|
return _context15.abrupt("return", errorMessageHandler(_context15.t0, "BASE"));
|
|
17232
17207
|
|
|
17233
|
-
case
|
|
17208
|
+
case 12:
|
|
17234
17209
|
case "end":
|
|
17235
17210
|
return _context15.stop();
|
|
17236
17211
|
}
|
|
17237
|
-
}), _callee15, null, [ [ 0,
|
|
17212
|
+
}), _callee15, null, [ [ 0, 9 ] ]);
|
|
17238
17213
|
})));
|
|
17239
17214
|
return _BASE.apply(this, arguments);
|
|
17240
17215
|
}
|
|
@@ -17261,14 +17236,7 @@ function _typeof(o) {
|
|
|
17261
17236
|
limit: limit
|
|
17262
17237
|
});
|
|
17263
17238
|
apiKey = window.localStorage.getItem(SERVICES_API_KEY.Gnosisscan);
|
|
17264
|
-
|
|
17265
|
-
_context16.next = 6;
|
|
17266
|
-
break;
|
|
17267
|
-
}
|
|
17268
|
-
throw new MissingApiKeyError(SERVICES_API_KEY.Gnosisscan);
|
|
17269
|
-
|
|
17270
|
-
case 6:
|
|
17271
|
-
_context16.next = 8;
|
|
17239
|
+
_context16.next = 6;
|
|
17272
17240
|
return handleScanRequest({
|
|
17273
17241
|
type: type,
|
|
17274
17242
|
address: address,
|
|
@@ -17282,19 +17250,19 @@ function _typeof(o) {
|
|
|
17282
17250
|
network: "gnosis"
|
|
17283
17251
|
});
|
|
17284
17252
|
|
|
17285
|
-
case
|
|
17253
|
+
case 6:
|
|
17286
17254
|
return _context16.abrupt("return", _context16.sent);
|
|
17287
17255
|
|
|
17288
|
-
case
|
|
17289
|
-
_context16.prev =
|
|
17256
|
+
case 9:
|
|
17257
|
+
_context16.prev = 9;
|
|
17290
17258
|
_context16.t0 = _context16["catch"](0);
|
|
17291
17259
|
return _context16.abrupt("return", errorMessageHandler(_context16.t0, "GNOSIS"));
|
|
17292
17260
|
|
|
17293
|
-
case
|
|
17261
|
+
case 12:
|
|
17294
17262
|
case "end":
|
|
17295
17263
|
return _context16.stop();
|
|
17296
17264
|
}
|
|
17297
|
-
}), _callee16, null, [ [ 0,
|
|
17265
|
+
}), _callee16, null, [ [ 0, 9 ] ]);
|
|
17298
17266
|
})));
|
|
17299
17267
|
return _GNOSIS.apply(this, arguments);
|
|
17300
17268
|
}
|
|
@@ -17317,62 +17285,55 @@ function _typeof(o) {
|
|
|
17317
17285
|
username: username
|
|
17318
17286
|
});
|
|
17319
17287
|
apiKey = window.localStorage.getItem(SERVICES_API_KEY.Neynar);
|
|
17320
|
-
|
|
17321
|
-
_context17.next = 7;
|
|
17322
|
-
break;
|
|
17323
|
-
}
|
|
17324
|
-
throw new MissingApiKeyError(SERVICES_API_KEY.Neynar);
|
|
17325
|
-
|
|
17326
|
-
case 7:
|
|
17327
|
-
_context17.next = 9;
|
|
17288
|
+
_context17.next = 7;
|
|
17328
17289
|
return fromUsernameToFid$1.fromUsernameToFid(username, apiKey);
|
|
17329
17290
|
|
|
17330
|
-
case
|
|
17291
|
+
case 7:
|
|
17331
17292
|
fid = _context17.sent;
|
|
17332
17293
|
if (fid) {
|
|
17333
|
-
_context17.next =
|
|
17294
|
+
_context17.next = 10;
|
|
17334
17295
|
break;
|
|
17335
17296
|
}
|
|
17336
17297
|
throw new ValidationError("Invalid username: ".concat(username));
|
|
17337
17298
|
|
|
17338
|
-
case
|
|
17299
|
+
case 10:
|
|
17339
17300
|
url = "https://api.neynar.com/v2/farcaster/followers?fid=".concat(fid);
|
|
17340
17301
|
_getUrlAndHeaders7 = getUrlAndHeaders({
|
|
17341
17302
|
url: url.toString(),
|
|
17342
|
-
serviceName: "
|
|
17303
|
+
serviceName: "Neynar",
|
|
17343
17304
|
headers: {
|
|
17344
17305
|
"x-api-key": apiKey,
|
|
17345
17306
|
"x-neynar-experimental": "false"
|
|
17346
17307
|
}
|
|
17347
17308
|
}), finalUrl = _getUrlAndHeaders7.URL, HEADERS = _getUrlAndHeaders7.HEADERS;
|
|
17348
|
-
_context17.next =
|
|
17309
|
+
_context17.next = 14;
|
|
17349
17310
|
return fetch(finalUrl, {
|
|
17350
17311
|
method: "GET",
|
|
17351
17312
|
headers: HEADERS
|
|
17352
17313
|
});
|
|
17353
17314
|
|
|
17354
|
-
case
|
|
17315
|
+
case 14:
|
|
17355
17316
|
response = _context17.sent;
|
|
17356
17317
|
if (response.ok) {
|
|
17357
|
-
_context17.next =
|
|
17318
|
+
_context17.next = 17;
|
|
17358
17319
|
break;
|
|
17359
17320
|
}
|
|
17360
17321
|
throw new NetworkError(SERVICES_API_KEY.Neynar, response.status);
|
|
17361
17322
|
|
|
17362
|
-
case
|
|
17363
|
-
_context17.next =
|
|
17323
|
+
case 17:
|
|
17324
|
+
_context17.next = 19;
|
|
17364
17325
|
return response.json();
|
|
17365
17326
|
|
|
17366
|
-
case
|
|
17327
|
+
case 19:
|
|
17367
17328
|
json = _context17.sent;
|
|
17368
17329
|
users = (json === null || json === void 0 ? void 0 : json.users) || [];
|
|
17369
17330
|
if (users.length) {
|
|
17370
|
-
_context17.next =
|
|
17331
|
+
_context17.next = 23;
|
|
17371
17332
|
break;
|
|
17372
17333
|
}
|
|
17373
17334
|
return _context17.abrupt("return", []);
|
|
17374
17335
|
|
|
17375
|
-
case
|
|
17336
|
+
case 23:
|
|
17376
17337
|
return _context17.abrupt("return", users.map((function(_ref14) {
|
|
17377
17338
|
var _user$profile, _user$profile2;
|
|
17378
17339
|
var user = _ref14.user;
|
|
@@ -17385,16 +17346,16 @@ function _typeof(o) {
|
|
|
17385
17346
|
};
|
|
17386
17347
|
})));
|
|
17387
17348
|
|
|
17388
|
-
case
|
|
17389
|
-
_context17.prev =
|
|
17349
|
+
case 26:
|
|
17350
|
+
_context17.prev = 26;
|
|
17390
17351
|
_context17.t0 = _context17["catch"](0);
|
|
17391
17352
|
return _context17.abrupt("return", errorMessageHandler(_context17.t0, "NEYNAR"));
|
|
17392
17353
|
|
|
17393
|
-
case
|
|
17354
|
+
case 29:
|
|
17394
17355
|
case "end":
|
|
17395
17356
|
return _context17.stop();
|
|
17396
17357
|
}
|
|
17397
|
-
}), _callee17, null, [ [ 0,
|
|
17358
|
+
}), _callee17, null, [ [ 0, 26 ] ]);
|
|
17398
17359
|
})));
|
|
17399
17360
|
return _NEYNAR.apply(this, arguments);
|
|
17400
17361
|
}
|
|
@@ -17431,14 +17392,7 @@ function _typeof(o) {
|
|
|
17431
17392
|
|
|
17432
17393
|
case 6:
|
|
17433
17394
|
apiKey = window.localStorage.getItem(SERVICES_API_KEY.Etherscan);
|
|
17434
|
-
|
|
17435
|
-
_context18.next = 9;
|
|
17436
|
-
break;
|
|
17437
|
-
}
|
|
17438
|
-
throw new MissingApiKeyError(SERVICES_API_KEY.Etherscan);
|
|
17439
|
-
|
|
17440
|
-
case 9:
|
|
17441
|
-
_context18.next = 11;
|
|
17395
|
+
_context18.next = 9;
|
|
17442
17396
|
return handleScanRequest({
|
|
17443
17397
|
type: type,
|
|
17444
17398
|
address: address,
|
|
@@ -17452,19 +17406,19 @@ function _typeof(o) {
|
|
|
17452
17406
|
network: chain
|
|
17453
17407
|
});
|
|
17454
17408
|
|
|
17455
|
-
case
|
|
17409
|
+
case 9:
|
|
17456
17410
|
return _context18.abrupt("return", _context18.sent);
|
|
17457
17411
|
|
|
17458
|
-
case
|
|
17459
|
-
_context18.prev =
|
|
17412
|
+
case 12:
|
|
17413
|
+
_context18.prev = 12;
|
|
17460
17414
|
_context18.t0 = _context18["catch"](0);
|
|
17461
17415
|
return _context18.abrupt("return", errorMessageHandler(_context18.t0, "ETHERSCAN"));
|
|
17462
17416
|
|
|
17463
|
-
case
|
|
17417
|
+
case 15:
|
|
17464
17418
|
case "end":
|
|
17465
17419
|
return _context18.stop();
|
|
17466
17420
|
}
|
|
17467
|
-
}), _callee18, null, [ [ 0,
|
|
17421
|
+
}), _callee18, null, [ [ 0, 12 ] ]);
|
|
17468
17422
|
})));
|
|
17469
17423
|
return _ETHERSCAN.apply(this, arguments);
|
|
17470
17424
|
}
|
|
@@ -17486,28 +17440,21 @@ function _typeof(o) {
|
|
|
17486
17440
|
param2: param2
|
|
17487
17441
|
});
|
|
17488
17442
|
apiKey = window.localStorage.getItem(SERVICES_API_KEY.Coingecko);
|
|
17489
|
-
if (apiKey) {
|
|
17490
|
-
_context19.next = 6;
|
|
17491
|
-
break;
|
|
17492
|
-
}
|
|
17493
|
-
throw new MissingApiKeyError(SERVICES_API_KEY.Coingecko);
|
|
17494
|
-
|
|
17495
|
-
case 6:
|
|
17496
17443
|
headers = {
|
|
17497
17444
|
accept: "application/json",
|
|
17498
17445
|
"x-cg-demo-api-key": apiKey
|
|
17499
17446
|
};
|
|
17500
17447
|
url = "";
|
|
17501
17448
|
_context19.t0 = category === null || category === void 0 || (_category$toLowerCase = category.toLowerCase) === null || _category$toLowerCase === void 0 ? void 0 : _category$toLowerCase.call(category);
|
|
17502
|
-
_context19.next = _context19.t0 === "price" ?
|
|
17449
|
+
_context19.next = _context19.t0 === "price" ? 9 : _context19.t0 === "market" ? 12 : _context19.t0 === "stablecoins" ? 17 : _context19.t0 === "derivatives" ? 21 : 23;
|
|
17503
17450
|
break;
|
|
17504
17451
|
|
|
17505
|
-
case
|
|
17452
|
+
case 9:
|
|
17506
17453
|
vs = param2 || "usd";
|
|
17507
17454
|
url = "https://api.coingecko.com/api/v3/simple/price?vs_currencies=".concat(vs, "&symbols=").concat(param1);
|
|
17508
|
-
return _context19.abrupt("break",
|
|
17455
|
+
return _context19.abrupt("break", 23);
|
|
17509
17456
|
|
|
17510
|
-
case
|
|
17457
|
+
case 12:
|
|
17511
17458
|
map = {
|
|
17512
17459
|
all: "",
|
|
17513
17460
|
base: "base-ecosystem",
|
|
@@ -17522,53 +17469,53 @@ function _typeof(o) {
|
|
|
17522
17469
|
_category = map[param1] || "";
|
|
17523
17470
|
trend = param2 ? "&price_change_percentage=".concat(param2) : "";
|
|
17524
17471
|
url = "https://api.coingecko.com/api/v3/coins/markets?vs_currency=usd&include_tokens=top&page=1&per_page=100".concat(_category ? "&category=".concat(_category) : "").concat(trend);
|
|
17525
|
-
return _context19.abrupt("break",
|
|
17472
|
+
return _context19.abrupt("break", 23);
|
|
17526
17473
|
|
|
17527
|
-
case
|
|
17474
|
+
case 17:
|
|
17528
17475
|
_category2 = param1 === "all" ? "stablecoins" : param1;
|
|
17529
17476
|
_trend = param2 ? "&price_change_percentage=".concat(param2) : "";
|
|
17530
17477
|
url = "https://api.coingecko.com/api/v3/coins/markets?vs_currency=usd&category=".concat(_category2, "&order=market_cap_desc&page=1&per_page=100").concat(_trend);
|
|
17531
|
-
return _context19.abrupt("break",
|
|
17478
|
+
return _context19.abrupt("break", 23);
|
|
17532
17479
|
|
|
17533
|
-
case
|
|
17480
|
+
case 21:
|
|
17534
17481
|
url = !param1 || param1 === "all" ? "https://api.coingecko.com/api/v3/derivatives" : "https://api.coingecko.com/api/v3/derivatives/exchanges/".concat(param1, "?include_tickers=all");
|
|
17535
|
-
return _context19.abrupt("break",
|
|
17482
|
+
return _context19.abrupt("break", 23);
|
|
17536
17483
|
|
|
17537
|
-
case
|
|
17484
|
+
case 23:
|
|
17538
17485
|
_getUrlAndHeaders8 = getUrlAndHeaders({
|
|
17539
17486
|
url: url,
|
|
17540
17487
|
serviceName: "Coingecko",
|
|
17541
17488
|
headers: headers
|
|
17542
17489
|
}), finalUrl = _getUrlAndHeaders8.URL, HEADERS = _getUrlAndHeaders8.HEADERS;
|
|
17543
|
-
_context19.next =
|
|
17490
|
+
_context19.next = 26;
|
|
17544
17491
|
return fetch(finalUrl, {
|
|
17545
17492
|
headers: HEADERS
|
|
17546
17493
|
});
|
|
17547
17494
|
|
|
17548
|
-
case
|
|
17495
|
+
case 26:
|
|
17549
17496
|
res = _context19.sent;
|
|
17550
|
-
_context19.next =
|
|
17497
|
+
_context19.next = 29;
|
|
17551
17498
|
return res.json();
|
|
17552
17499
|
|
|
17553
|
-
case
|
|
17500
|
+
case 29:
|
|
17554
17501
|
json = _context19.sent;
|
|
17555
17502
|
if (res.ok) {
|
|
17556
|
-
_context19.next =
|
|
17503
|
+
_context19.next = 35;
|
|
17557
17504
|
break;
|
|
17558
17505
|
}
|
|
17559
17506
|
msg = (json === null || json === void 0 || (_json$status = json.status) === null || _json$status === void 0 ? void 0 : _json$status.error_message) || "";
|
|
17560
17507
|
if (!msg.includes("API Key Missing")) {
|
|
17561
|
-
_context19.next =
|
|
17508
|
+
_context19.next = 34;
|
|
17562
17509
|
break;
|
|
17563
17510
|
}
|
|
17564
17511
|
throw new InvalidApiKeyError(SERVICES_API_KEY.Coingecko);
|
|
17565
17512
|
|
|
17566
|
-
case
|
|
17513
|
+
case 34:
|
|
17567
17514
|
throw new NetworkError(SERVICES_API_KEY.Coingecko, res.status);
|
|
17568
17515
|
|
|
17569
|
-
case
|
|
17516
|
+
case 35:
|
|
17570
17517
|
if (!(category === "price")) {
|
|
17571
|
-
_context19.next =
|
|
17518
|
+
_context19.next = 39;
|
|
17572
17519
|
break;
|
|
17573
17520
|
}
|
|
17574
17521
|
out = {};
|
|
@@ -17583,7 +17530,7 @@ function _typeof(o) {
|
|
|
17583
17530
|
}
|
|
17584
17531
|
return _context19.abrupt("return", [ out ]);
|
|
17585
17532
|
|
|
17586
|
-
case
|
|
17533
|
+
case 39:
|
|
17587
17534
|
_data4 = Array.isArray(json) ? json : [ json ];
|
|
17588
17535
|
return _context19.abrupt("return", _data4.map((function(item) {
|
|
17589
17536
|
var flat = {};
|
|
@@ -17596,16 +17543,16 @@ function _typeof(o) {
|
|
|
17596
17543
|
return flat;
|
|
17597
17544
|
})));
|
|
17598
17545
|
|
|
17599
|
-
case
|
|
17600
|
-
_context19.prev =
|
|
17546
|
+
case 43:
|
|
17547
|
+
_context19.prev = 43;
|
|
17601
17548
|
_context19.t1 = _context19["catch"](0);
|
|
17602
17549
|
return _context19.abrupt("return", errorMessageHandler(_context19.t1, "COINGECKO"));
|
|
17603
17550
|
|
|
17604
|
-
case
|
|
17551
|
+
case 46:
|
|
17605
17552
|
case "end":
|
|
17606
17553
|
return _context19.stop();
|
|
17607
17554
|
}
|
|
17608
|
-
}), _callee19, null, [ [ 0,
|
|
17555
|
+
}), _callee19, null, [ [ 0, 43 ] ]);
|
|
17609
17556
|
})));
|
|
17610
17557
|
return _COINGECKO.apply(this, arguments);
|
|
17611
17558
|
}
|
|
@@ -17618,8 +17565,7 @@ function _typeof(o) {
|
|
|
17618
17565
|
return _regeneratorRuntime().wrap((function _callee21$(_context24) {
|
|
17619
17566
|
while (1) switch (_context24.prev = _context24.next) {
|
|
17620
17567
|
case 0:
|
|
17621
|
-
|
|
17622
|
-
_context24.prev = 1;
|
|
17568
|
+
_context24.prev = 0;
|
|
17623
17569
|
fetchJSON = function() {
|
|
17624
17570
|
var _ref15 = _asyncToGenerator(_regeneratorRuntime().mark((function _callee20(url) {
|
|
17625
17571
|
var _getUrlAndHeaders9, finalUrl, HEADERS, res, json;
|
|
@@ -17696,13 +17642,6 @@ function _typeof(o) {
|
|
|
17696
17642
|
offset: offset
|
|
17697
17643
|
});
|
|
17698
17644
|
apiKey = window.localStorage.getItem(SERVICES_API_KEY.Etherscan);
|
|
17699
|
-
if (apiKey) {
|
|
17700
|
-
_context24.next = 8;
|
|
17701
|
-
break;
|
|
17702
|
-
}
|
|
17703
|
-
throw new MissingApiKeyError(SERVICES_API_KEY.Etherscan);
|
|
17704
|
-
|
|
17705
|
-
case 8:
|
|
17706
17645
|
INPUTS = addresses.split(",").map((function(s) {
|
|
17707
17646
|
return s.trim();
|
|
17708
17647
|
})).filter(Boolean);
|
|
@@ -17711,63 +17650,62 @@ function _typeof(o) {
|
|
|
17711
17650
|
})).filter(Boolean);
|
|
17712
17651
|
ADDRESS_MAP = {};
|
|
17713
17652
|
_iterator41 = _createForOfIteratorHelper(INPUTS);
|
|
17714
|
-
_context24.prev =
|
|
17653
|
+
_context24.prev = 9;
|
|
17715
17654
|
_iterator41.s();
|
|
17716
17655
|
|
|
17717
|
-
case
|
|
17656
|
+
case 11:
|
|
17718
17657
|
if ((_step41 = _iterator41.n()).done) {
|
|
17719
|
-
_context24.next =
|
|
17658
|
+
_context24.next = 26;
|
|
17720
17659
|
break;
|
|
17721
17660
|
}
|
|
17722
17661
|
inp = _step41.value;
|
|
17723
17662
|
if (!isAddress$1.isAddress(inp)) {
|
|
17724
|
-
_context24.next =
|
|
17663
|
+
_context24.next = 17;
|
|
17725
17664
|
break;
|
|
17726
17665
|
}
|
|
17727
17666
|
ADDRESS_MAP[inp.toLowerCase()] = null;
|
|
17728
|
-
_context24.next =
|
|
17667
|
+
_context24.next = 24;
|
|
17729
17668
|
break;
|
|
17730
17669
|
|
|
17731
|
-
case
|
|
17670
|
+
case 17:
|
|
17732
17671
|
ens = inp;
|
|
17733
|
-
_context24.next =
|
|
17672
|
+
_context24.next = 20;
|
|
17734
17673
|
return fromEnsNameToAddress$1.fromEnsNameToAddress(ens);
|
|
17735
17674
|
|
|
17736
|
-
case
|
|
17675
|
+
case 20:
|
|
17737
17676
|
resolved = _context24.sent;
|
|
17738
17677
|
if (resolved) {
|
|
17739
|
-
_context24.next =
|
|
17678
|
+
_context24.next = 23;
|
|
17740
17679
|
break;
|
|
17741
17680
|
}
|
|
17742
17681
|
throw new EnsError(ens);
|
|
17743
17682
|
|
|
17744
|
-
case
|
|
17683
|
+
case 23:
|
|
17745
17684
|
ADDRESS_MAP[resolved.toLowerCase()] = ens;
|
|
17746
17685
|
|
|
17747
|
-
case
|
|
17748
|
-
_context24.next =
|
|
17686
|
+
case 24:
|
|
17687
|
+
_context24.next = 11;
|
|
17749
17688
|
break;
|
|
17750
17689
|
|
|
17751
|
-
case
|
|
17752
|
-
_context24.next =
|
|
17690
|
+
case 26:
|
|
17691
|
+
_context24.next = 31;
|
|
17753
17692
|
break;
|
|
17754
17693
|
|
|
17755
|
-
case
|
|
17756
|
-
_context24.prev =
|
|
17757
|
-
_context24.t0 = _context24["catch"](
|
|
17694
|
+
case 28:
|
|
17695
|
+
_context24.prev = 28;
|
|
17696
|
+
_context24.t0 = _context24["catch"](9);
|
|
17758
17697
|
_iterator41.e(_context24.t0);
|
|
17759
17698
|
|
|
17760
|
-
case
|
|
17761
|
-
_context24.prev =
|
|
17699
|
+
case 31:
|
|
17700
|
+
_context24.prev = 31;
|
|
17762
17701
|
_iterator41.f();
|
|
17763
|
-
return _context24.finish(
|
|
17702
|
+
return _context24.finish(31);
|
|
17764
17703
|
|
|
17765
|
-
case
|
|
17704
|
+
case 34:
|
|
17766
17705
|
ADDRS = Object.keys(ADDRESS_MAP);
|
|
17767
|
-
console.log("ADDRS", ADDRS);
|
|
17768
17706
|
out = [];
|
|
17769
17707
|
_iterator42 = _createForOfIteratorHelper(CHAINS);
|
|
17770
|
-
_context24.prev =
|
|
17708
|
+
_context24.prev = 37;
|
|
17771
17709
|
_loop = _regeneratorRuntime().mark((function _loop() {
|
|
17772
17710
|
var chain, chainId, _loop2, _ret2, i, sb, eb, _loop3, _ret3, _i16, _ADDRS;
|
|
17773
17711
|
return _regeneratorRuntime().wrap((function _loop$(_context23) {
|
|
@@ -17941,52 +17879,52 @@ function _typeof(o) {
|
|
|
17941
17879
|
}));
|
|
17942
17880
|
_iterator42.s();
|
|
17943
17881
|
|
|
17944
|
-
case
|
|
17882
|
+
case 40:
|
|
17945
17883
|
if ((_step42 = _iterator42.n()).done) {
|
|
17946
|
-
_context24.next =
|
|
17884
|
+
_context24.next = 47;
|
|
17947
17885
|
break;
|
|
17948
17886
|
}
|
|
17949
|
-
return _context24.delegateYield(_loop(), "t1",
|
|
17887
|
+
return _context24.delegateYield(_loop(), "t1", 42);
|
|
17950
17888
|
|
|
17951
|
-
case
|
|
17889
|
+
case 42:
|
|
17952
17890
|
_ret = _context24.t1;
|
|
17953
17891
|
if (!_ret) {
|
|
17954
|
-
_context24.next =
|
|
17892
|
+
_context24.next = 45;
|
|
17955
17893
|
break;
|
|
17956
17894
|
}
|
|
17957
17895
|
return _context24.abrupt("return", _ret.v);
|
|
17958
17896
|
|
|
17959
|
-
case
|
|
17960
|
-
_context24.next =
|
|
17897
|
+
case 45:
|
|
17898
|
+
_context24.next = 40;
|
|
17961
17899
|
break;
|
|
17962
17900
|
|
|
17963
|
-
case
|
|
17964
|
-
_context24.next =
|
|
17901
|
+
case 47:
|
|
17902
|
+
_context24.next = 52;
|
|
17965
17903
|
break;
|
|
17966
17904
|
|
|
17967
|
-
case
|
|
17968
|
-
_context24.prev =
|
|
17969
|
-
_context24.t2 = _context24["catch"](
|
|
17905
|
+
case 49:
|
|
17906
|
+
_context24.prev = 49;
|
|
17907
|
+
_context24.t2 = _context24["catch"](37);
|
|
17970
17908
|
_iterator42.e(_context24.t2);
|
|
17971
17909
|
|
|
17972
|
-
case
|
|
17973
|
-
_context24.prev =
|
|
17910
|
+
case 52:
|
|
17911
|
+
_context24.prev = 52;
|
|
17974
17912
|
_iterator42.f();
|
|
17975
|
-
return _context24.finish(
|
|
17913
|
+
return _context24.finish(52);
|
|
17976
17914
|
|
|
17977
|
-
case
|
|
17915
|
+
case 55:
|
|
17978
17916
|
return _context24.abrupt("return", out);
|
|
17979
17917
|
|
|
17980
|
-
case
|
|
17981
|
-
_context24.prev =
|
|
17982
|
-
_context24.t3 = _context24["catch"](
|
|
17918
|
+
case 58:
|
|
17919
|
+
_context24.prev = 58;
|
|
17920
|
+
_context24.t3 = _context24["catch"](0);
|
|
17983
17921
|
return _context24.abrupt("return", errorMessageHandler(_context24.t3, "EOA"));
|
|
17984
17922
|
|
|
17985
|
-
case
|
|
17923
|
+
case 61:
|
|
17986
17924
|
case "end":
|
|
17987
17925
|
return _context24.stop();
|
|
17988
17926
|
}
|
|
17989
|
-
}), _callee21, null, [ [
|
|
17927
|
+
}), _callee21, null, [ [ 0, 58 ], [ 9, 28, 31, 34 ], [ 37, 49, 52, 55 ] ]);
|
|
17990
17928
|
})));
|
|
17991
17929
|
return _EOA.apply(this, arguments);
|
|
17992
17930
|
}
|
|
@@ -18036,39 +17974,32 @@ function _typeof(o) {
|
|
|
18036
17974
|
offset: offset
|
|
18037
17975
|
});
|
|
18038
17976
|
apiKey = window.localStorage.getItem(SERVICES_API_KEY.Safe);
|
|
18039
|
-
if (apiKey) {
|
|
18040
|
-
_context26.next = 6;
|
|
18041
|
-
break;
|
|
18042
|
-
}
|
|
18043
|
-
throw new MissingApiKeyError(SERVICES_API_KEY.Safe);
|
|
18044
|
-
|
|
18045
|
-
case 6:
|
|
18046
17977
|
chainId = SAFE_CHAIN_MAP[chain];
|
|
18047
17978
|
if (chainId) {
|
|
18048
|
-
_context26.next =
|
|
17979
|
+
_context26.next = 7;
|
|
18049
17980
|
break;
|
|
18050
17981
|
}
|
|
18051
17982
|
throw new ValidationError("Invalid chain: ".concat(chain));
|
|
18052
17983
|
|
|
18053
|
-
case
|
|
17984
|
+
case 7:
|
|
18054
17985
|
resolved = address;
|
|
18055
17986
|
if (isAddress$1.isAddress(resolved)) {
|
|
18056
|
-
_context26.next =
|
|
17987
|
+
_context26.next = 15;
|
|
18057
17988
|
break;
|
|
18058
17989
|
}
|
|
18059
17990
|
ens = resolved;
|
|
18060
|
-
_context26.next =
|
|
17991
|
+
_context26.next = 12;
|
|
18061
17992
|
return fromEnsNameToAddress$1.fromEnsNameToAddress(ens);
|
|
18062
17993
|
|
|
18063
|
-
case
|
|
17994
|
+
case 12:
|
|
18064
17995
|
resolved = _context26.sent;
|
|
18065
17996
|
if (resolved) {
|
|
18066
|
-
_context26.next =
|
|
17997
|
+
_context26.next = 15;
|
|
18067
17998
|
break;
|
|
18068
17999
|
}
|
|
18069
18000
|
throw new EnsError(ens);
|
|
18070
18001
|
|
|
18071
|
-
case
|
|
18002
|
+
case 15:
|
|
18072
18003
|
url = "https://api.safe.global/tx-service/".concat(chainId, "/api/v2/safes/").concat(resolved, "/multisig-transactions?limit=").concat(limit, "&offset=").concat(offset);
|
|
18073
18004
|
_getUrlAndHeaders0 = getUrlAndHeaders({
|
|
18074
18005
|
url: url,
|
|
@@ -18077,47 +18008,47 @@ function _typeof(o) {
|
|
|
18077
18008
|
Authorization: "Bearer ".concat(apiKey)
|
|
18078
18009
|
}
|
|
18079
18010
|
}), finalUrl = _getUrlAndHeaders0.URL, HEADERS = _getUrlAndHeaders0.HEADERS;
|
|
18080
|
-
_context26.next =
|
|
18011
|
+
_context26.next = 19;
|
|
18081
18012
|
return fetch(finalUrl, {
|
|
18082
18013
|
headers: HEADERS
|
|
18083
18014
|
});
|
|
18084
18015
|
|
|
18085
|
-
case
|
|
18016
|
+
case 19:
|
|
18086
18017
|
res = _context26.sent;
|
|
18087
18018
|
if (res.ok) {
|
|
18088
|
-
_context26.next =
|
|
18019
|
+
_context26.next = 22;
|
|
18089
18020
|
break;
|
|
18090
18021
|
}
|
|
18091
18022
|
throw new NetworkError(SERVICES_API_KEY.Safe, res.status);
|
|
18092
18023
|
|
|
18093
|
-
case
|
|
18094
|
-
_context26.next =
|
|
18024
|
+
case 22:
|
|
18025
|
+
_context26.next = 24;
|
|
18095
18026
|
return res.json();
|
|
18096
18027
|
|
|
18097
|
-
case
|
|
18028
|
+
case 24:
|
|
18098
18029
|
json = _context26.sent;
|
|
18099
18030
|
if (Array.isArray(json.results)) {
|
|
18100
|
-
_context26.next =
|
|
18031
|
+
_context26.next = 27;
|
|
18101
18032
|
break;
|
|
18102
18033
|
}
|
|
18103
18034
|
throw new ValidationError("Invalid API response");
|
|
18104
18035
|
|
|
18105
|
-
case
|
|
18036
|
+
case 27:
|
|
18106
18037
|
return _context26.abrupt("return", json.results.map((function(_ref16) {
|
|
18107
18038
|
var confirmations = _ref16.confirmations, dataDecoded = _ref16.dataDecoded, rest = _objectWithoutProperties(_ref16, _excluded);
|
|
18108
18039
|
return rest;
|
|
18109
18040
|
})));
|
|
18110
18041
|
|
|
18111
|
-
case
|
|
18112
|
-
_context26.prev =
|
|
18042
|
+
case 30:
|
|
18043
|
+
_context26.prev = 30;
|
|
18113
18044
|
_context26.t0 = _context26["catch"](0);
|
|
18114
18045
|
return _context26.abrupt("return", errorMessageHandler(_context26.t0, "SAFE"));
|
|
18115
18046
|
|
|
18116
|
-
case
|
|
18047
|
+
case 33:
|
|
18117
18048
|
case "end":
|
|
18118
18049
|
return _context26.stop();
|
|
18119
18050
|
}
|
|
18120
|
-
}), _callee23, null, [ [ 0,
|
|
18051
|
+
}), _callee23, null, [ [ 0, 30 ] ]);
|
|
18121
18052
|
})));
|
|
18122
18053
|
return _SAFE.apply(this, arguments);
|
|
18123
18054
|
}
|
|
@@ -18137,55 +18068,48 @@ function _typeof(o) {
|
|
|
18137
18068
|
category: category
|
|
18138
18069
|
});
|
|
18139
18070
|
apiKey = window.localStorage.getItem(SERVICES_API_KEY.Defillama);
|
|
18140
|
-
if (apiKey) {
|
|
18141
|
-
_context27.next = 6;
|
|
18142
|
-
break;
|
|
18143
|
-
}
|
|
18144
|
-
throw new MissingApiKeyError(SERVICES_API_KEY.Defillama);
|
|
18145
|
-
|
|
18146
|
-
case 6:
|
|
18147
18071
|
url = CATEGORY_URLS[category];
|
|
18148
18072
|
if (url) {
|
|
18149
|
-
_context27.next =
|
|
18073
|
+
_context27.next = 7;
|
|
18150
18074
|
break;
|
|
18151
18075
|
}
|
|
18152
18076
|
throw new ValidationError("Invalid category: ".concat(category));
|
|
18153
18077
|
|
|
18154
|
-
case
|
|
18155
|
-
_context27.next =
|
|
18078
|
+
case 7:
|
|
18079
|
+
_context27.next = 9;
|
|
18156
18080
|
return fetch(url);
|
|
18157
18081
|
|
|
18158
|
-
case
|
|
18082
|
+
case 9:
|
|
18159
18083
|
res = _context27.sent;
|
|
18160
18084
|
if (res.ok) {
|
|
18161
|
-
_context27.next =
|
|
18085
|
+
_context27.next = 12;
|
|
18162
18086
|
break;
|
|
18163
18087
|
}
|
|
18164
18088
|
throw new NetworkError(SERVICES_API_KEY.Defillama, res.status);
|
|
18165
18089
|
|
|
18166
|
-
case
|
|
18167
|
-
_context27.next =
|
|
18090
|
+
case 12:
|
|
18091
|
+
_context27.next = 14;
|
|
18168
18092
|
return res.json();
|
|
18169
18093
|
|
|
18170
|
-
case
|
|
18094
|
+
case 14:
|
|
18171
18095
|
json = _context27.sent;
|
|
18172
18096
|
_context27.t0 = category;
|
|
18173
|
-
_context27.next = _context27.t0 === "protocols" ?
|
|
18097
|
+
_context27.next = _context27.t0 === "protocols" ? 18 : _context27.t0 === "yields" ? 20 : _context27.t0 === "dex" ? 22 : _context27.t0 === "fees" ? 22 : 24;
|
|
18174
18098
|
break;
|
|
18175
18099
|
|
|
18176
|
-
case
|
|
18100
|
+
case 18:
|
|
18177
18101
|
json = Array.isArray(json) ? json.slice(0, 500) : [];
|
|
18178
|
-
return _context27.abrupt("break",
|
|
18102
|
+
return _context27.abrupt("break", 24);
|
|
18179
18103
|
|
|
18180
|
-
case
|
|
18104
|
+
case 20:
|
|
18181
18105
|
json = Array.isArray(json.data) ? json.data.slice(0, 500) : [];
|
|
18182
|
-
return _context27.abrupt("break",
|
|
18106
|
+
return _context27.abrupt("break", 24);
|
|
18183
18107
|
|
|
18184
|
-
case
|
|
18108
|
+
case 22:
|
|
18185
18109
|
json = Array.isArray(json.protocols) ? json.protocols.slice(0, 500) : [];
|
|
18186
|
-
return _context27.abrupt("break",
|
|
18110
|
+
return _context27.abrupt("break", 24);
|
|
18187
18111
|
|
|
18188
|
-
case
|
|
18112
|
+
case 24:
|
|
18189
18113
|
return _context27.abrupt("return", (Array.isArray(json) ? json : [ json ]).map((function(item) {
|
|
18190
18114
|
var out = {};
|
|
18191
18115
|
for (var _i17 = 0, _Object$entries7 = Object.entries(item); _i17 < _Object$entries7.length; _i17++) {
|
|
@@ -18195,16 +18119,16 @@ function _typeof(o) {
|
|
|
18195
18119
|
return out;
|
|
18196
18120
|
})));
|
|
18197
18121
|
|
|
18198
|
-
case
|
|
18199
|
-
_context27.prev =
|
|
18122
|
+
case 27:
|
|
18123
|
+
_context27.prev = 27;
|
|
18200
18124
|
_context27.t1 = _context27["catch"](0);
|
|
18201
18125
|
return _context27.abrupt("return", errorMessageHandler(_context27.t1, "DEFILLAMA"));
|
|
18202
18126
|
|
|
18203
|
-
case
|
|
18127
|
+
case 30:
|
|
18204
18128
|
case "end":
|
|
18205
18129
|
return _context27.stop();
|
|
18206
18130
|
}
|
|
18207
|
-
}), _callee24, null, [ [ 0,
|
|
18131
|
+
}), _callee24, null, [ [ 0, 27 ] ]);
|
|
18208
18132
|
})));
|
|
18209
18133
|
return _DEFILLAMA.apply(this, arguments);
|
|
18210
18134
|
}
|