@fileverse-dev/formulajs 4.4.11-mod-77 → 4.4.11-mod-78
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 +589 -527
- package/lib/browser/formula.min.js +2 -2
- package/lib/browser/formula.min.js.map +1 -1
- package/lib/cjs/index.cjs +229 -105
- package/lib/esm/index.mjs +229 -105
- 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-78 */
|
|
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
|
}
|
|
@@ -11068,51 +11068,6 @@ function _typeof(o) {
|
|
|
11068
11068
|
Neynar: "Neynar",
|
|
11069
11069
|
Defillama: "Defillama"
|
|
11070
11070
|
};
|
|
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×tamp=".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
11071
|
var ValidationError = function(_Error) {
|
|
11117
11072
|
function ValidationError(message) {
|
|
11118
11073
|
_classCallCheck(this, ValidationError);
|
|
@@ -11171,6 +11126,134 @@ function _typeof(o) {
|
|
|
11171
11126
|
_inherits(InvalidApiKeyError, _Error6);
|
|
11172
11127
|
return _createClass(InvalidApiKeyError);
|
|
11173
11128
|
}(_wrapNativeSuper(Error));
|
|
11129
|
+
var fileverseProxyUrl = "".concat(process.env.NEXT_PUBLIC_PROXY_BASE_URL, "/proxy");
|
|
11130
|
+
var PROXY_MAP = {
|
|
11131
|
+
Etherscan: {
|
|
11132
|
+
url: fileverseProxyUrl,
|
|
11133
|
+
removeParams: [ "apikey" ]
|
|
11134
|
+
},
|
|
11135
|
+
Basescan: {
|
|
11136
|
+
url: fileverseProxyUrl,
|
|
11137
|
+
removeParams: [ "apikey" ]
|
|
11138
|
+
},
|
|
11139
|
+
Gnosisscan: {
|
|
11140
|
+
url: fileverseProxyUrl,
|
|
11141
|
+
removeParams: [ "apikey" ]
|
|
11142
|
+
},
|
|
11143
|
+
Coingecko: {
|
|
11144
|
+
url: fileverseProxyUrl,
|
|
11145
|
+
removeParams: [ "apikey" ]
|
|
11146
|
+
},
|
|
11147
|
+
Firefly: {
|
|
11148
|
+
url: fileverseProxyUrl,
|
|
11149
|
+
removeParams: [ "apikey" ]
|
|
11150
|
+
},
|
|
11151
|
+
Neynar: {
|
|
11152
|
+
url: fileverseProxyUrl,
|
|
11153
|
+
removeParams: [ "api_key" ]
|
|
11154
|
+
},
|
|
11155
|
+
Safe: {
|
|
11156
|
+
url: fileverseProxyUrl,
|
|
11157
|
+
removeParams: [ "api_key" ]
|
|
11158
|
+
},
|
|
11159
|
+
Defillama: {
|
|
11160
|
+
url: fileverseProxyUrl,
|
|
11161
|
+
removeParams: [ "api_key" ]
|
|
11162
|
+
},
|
|
11163
|
+
GnosisPay: {
|
|
11164
|
+
url: fileverseProxyUrl,
|
|
11165
|
+
removeParams: [ "api_key" ]
|
|
11166
|
+
}
|
|
11167
|
+
};
|
|
11168
|
+
function removeUrlParams(url, paramsToRemove) {
|
|
11169
|
+
if (!paramsToRemove || paramsToRemove.length === 0) {
|
|
11170
|
+
return url;
|
|
11171
|
+
}
|
|
11172
|
+
var urlObj = new URL(url);
|
|
11173
|
+
paramsToRemove.forEach((function(param) {
|
|
11174
|
+
if (urlObj.searchParams.has(param)) {
|
|
11175
|
+
urlObj.searchParams["delete"](param);
|
|
11176
|
+
}
|
|
11177
|
+
}));
|
|
11178
|
+
return urlObj.toString();
|
|
11179
|
+
}
|
|
11180
|
+
function getUrlAndHeaders(_ref) {
|
|
11181
|
+
var url = _ref.url, serviceName = _ref.serviceName, _ref$headers = _ref.headers, headers = _ref$headers === void 0 ? {} : _ref$headers;
|
|
11182
|
+
var apiKeyLS = window.localStorage.getItem(SERVICES_API_KEY[serviceName]);
|
|
11183
|
+
var isProxyModeEnabledValue = apiKeyLS === "DEFAULT_PROXY_MODE";
|
|
11184
|
+
var proxyConfig = PROXY_MAP[serviceName];
|
|
11185
|
+
if (!proxyConfig && SERVICES_API_KEY[serviceName] && (!apiKeyLS || apiKeyLS === "")) {
|
|
11186
|
+
throw new MissingApiKeyError(SERVICES_API_KEY[serviceName]);
|
|
11187
|
+
}
|
|
11188
|
+
if ((isProxyModeEnabledValue || !apiKeyLS || apiKeyLS === "") && proxyConfig) {
|
|
11189
|
+
var cleanedUrl = removeUrlParams(url, proxyConfig.removeParams);
|
|
11190
|
+
return {
|
|
11191
|
+
URL: proxyConfig.url,
|
|
11192
|
+
HEADERS: {
|
|
11193
|
+
"target-url": cleanedUrl,
|
|
11194
|
+
method: "GET",
|
|
11195
|
+
"Content-Type": "application/json"
|
|
11196
|
+
}
|
|
11197
|
+
};
|
|
11198
|
+
}
|
|
11199
|
+
return {
|
|
11200
|
+
URL: url,
|
|
11201
|
+
HEADERS: _objectSpread({}, headers)
|
|
11202
|
+
};
|
|
11203
|
+
}
|
|
11204
|
+
var fromTimeStampToBlock = function() {
|
|
11205
|
+
var _ref2 = _asyncToGenerator(_regeneratorRuntime().mark((function _callee(timestamp, chain, apiKey) {
|
|
11206
|
+
var chainId, url, _getUrlAndHeaders, finalUrl, HEADERS, res, json;
|
|
11207
|
+
return _regeneratorRuntime().wrap((function _callee$(_context) {
|
|
11208
|
+
while (1) switch (_context.prev = _context.next) {
|
|
11209
|
+
case 0:
|
|
11210
|
+
if (!(!timestamp || !chain)) {
|
|
11211
|
+
_context.next = 2;
|
|
11212
|
+
break;
|
|
11213
|
+
}
|
|
11214
|
+
return _context.abrupt("return");
|
|
11215
|
+
|
|
11216
|
+
case 2:
|
|
11217
|
+
chainId = CHAIN_ID_MAP[chain];
|
|
11218
|
+
url = "https://api.etherscan.io/v2/api?module=block&action=getblocknobytime×tamp=".concat(timestamp, "&closest=before&apikey=").concat(apiKey, "&chainId=").concat(chainId);
|
|
11219
|
+
_getUrlAndHeaders = getUrlAndHeaders({
|
|
11220
|
+
url: url,
|
|
11221
|
+
serviceName: "Etherscan",
|
|
11222
|
+
headers: {}
|
|
11223
|
+
}), finalUrl = _getUrlAndHeaders.URL, HEADERS = _getUrlAndHeaders.HEADERS;
|
|
11224
|
+
_context.next = 7;
|
|
11225
|
+
return fetch(finalUrl, {
|
|
11226
|
+
method: "GET",
|
|
11227
|
+
headers: HEADERS
|
|
11228
|
+
});
|
|
11229
|
+
|
|
11230
|
+
case 7:
|
|
11231
|
+
res = _context.sent;
|
|
11232
|
+
_context.next = 10;
|
|
11233
|
+
return res.json();
|
|
11234
|
+
|
|
11235
|
+
case 10:
|
|
11236
|
+
json = _context.sent;
|
|
11237
|
+
return _context.abrupt("return", parseInt(json.result));
|
|
11238
|
+
|
|
11239
|
+
case 12:
|
|
11240
|
+
case "end":
|
|
11241
|
+
return _context.stop();
|
|
11242
|
+
}
|
|
11243
|
+
}), _callee);
|
|
11244
|
+
})));
|
|
11245
|
+
return function fromTimeStampToBlock(_x2, _x3, _x4) {
|
|
11246
|
+
return _ref2.apply(this, arguments);
|
|
11247
|
+
};
|
|
11248
|
+
}();
|
|
11249
|
+
var fromTimestampToBlock = {
|
|
11250
|
+
fromTimeStampToBlock: fromTimeStampToBlock
|
|
11251
|
+
};
|
|
11252
|
+
function toTimestamp(dateStr) {
|
|
11253
|
+
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];
|
|
11254
|
+
var date = new Date(year, month - 1, day);
|
|
11255
|
+
return Math.floor(date.getTime() / 1e3);
|
|
11256
|
+
}
|
|
11174
11257
|
var isAddress = function isAddress(input) {
|
|
11175
11258
|
return /^0x[a-fA-F0-9]{40}$/.test(input);
|
|
11176
11259
|
};
|
|
@@ -11233,7 +11316,7 @@ function _typeof(o) {
|
|
|
11233
11316
|
return _fromEnsNameToAddress.apply(this, arguments);
|
|
11234
11317
|
}
|
|
11235
11318
|
var validateAndGetAddress = function() {
|
|
11236
|
-
var
|
|
11319
|
+
var _ref3 = _asyncToGenerator(_regeneratorRuntime().mark((function _callee2(address) {
|
|
11237
11320
|
var resolvedAddress;
|
|
11238
11321
|
return _regeneratorRuntime().wrap((function _callee2$(_context2) {
|
|
11239
11322
|
while (1) switch (_context2.prev = _context2.next) {
|
|
@@ -11266,7 +11349,7 @@ function _typeof(o) {
|
|
|
11266
11349
|
}), _callee2);
|
|
11267
11350
|
})));
|
|
11268
11351
|
return function validateAndGetAddress(_x6) {
|
|
11269
|
-
return
|
|
11352
|
+
return _ref3.apply(this, arguments);
|
|
11270
11353
|
};
|
|
11271
11354
|
}();
|
|
11272
11355
|
var fromEnsNameToAddress$1 = {
|
|
@@ -11276,15 +11359,15 @@ function _typeof(o) {
|
|
|
11276
11359
|
return _handleScanRequest.apply(this, arguments);
|
|
11277
11360
|
}
|
|
11278
11361
|
function _handleScanRequest() {
|
|
11279
|
-
_handleScanRequest = _asyncToGenerator(_regeneratorRuntime().mark((function _callee11(
|
|
11280
|
-
var type, address, startDate, endDate,
|
|
11362
|
+
_handleScanRequest = _asyncToGenerator(_regeneratorRuntime().mark((function _callee11(_ref4) {
|
|
11363
|
+
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
11364
|
return _regeneratorRuntime().wrap((function _callee11$(_context11) {
|
|
11282
11365
|
while (1) switch (_context11.prev = _context11.next) {
|
|
11283
11366
|
case 0:
|
|
11284
|
-
type =
|
|
11285
|
-
|
|
11286
|
-
offset =
|
|
11287
|
-
chainId =
|
|
11367
|
+
type = _ref4.type, address = _ref4.address, startDate = _ref4.startDate, endDate = _ref4.endDate,
|
|
11368
|
+
_ref4$page = _ref4.page, page = _ref4$page === void 0 ? 1 : _ref4$page, _ref4$offset = _ref4.offset,
|
|
11369
|
+
offset = _ref4$offset === void 0 ? 10 : _ref4$offset, apiKey = _ref4.apiKey, functionName = _ref4.functionName,
|
|
11370
|
+
chainId = _ref4.chainId, network = _ref4.network;
|
|
11288
11371
|
API_INFO_MAP = {
|
|
11289
11372
|
BASE: {
|
|
11290
11373
|
url: "https://api.basescan.org/api",
|
|
@@ -11358,44 +11441,52 @@ function _typeof(o) {
|
|
|
11358
11441
|
url += "&page=".concat(page, "&offset=").concat(offset);
|
|
11359
11442
|
|
|
11360
11443
|
case 27:
|
|
11361
|
-
|
|
11362
|
-
|
|
11444
|
+
_getUrlAndHeaders3 = getUrlAndHeaders({
|
|
11445
|
+
url: url,
|
|
11446
|
+
serviceName: apiInfo.apiKeyName,
|
|
11447
|
+
headers: {}
|
|
11448
|
+
}), finalUrl = _getUrlAndHeaders3.URL, HEADERS = _getUrlAndHeaders3.HEADERS;
|
|
11449
|
+
_context11.next = 30;
|
|
11450
|
+
return fetch(finalUrl, {
|
|
11451
|
+
method: "GET",
|
|
11452
|
+
headers: HEADERS
|
|
11453
|
+
});
|
|
11363
11454
|
|
|
11364
|
-
case
|
|
11455
|
+
case 30:
|
|
11365
11456
|
res = _context11.sent;
|
|
11366
11457
|
if (res.ok) {
|
|
11367
|
-
_context11.next =
|
|
11458
|
+
_context11.next = 33;
|
|
11368
11459
|
break;
|
|
11369
11460
|
}
|
|
11370
11461
|
throw new NetworkError(apiInfo.apiKeyName, res.status);
|
|
11371
11462
|
|
|
11372
|
-
case
|
|
11373
|
-
_context11.next =
|
|
11463
|
+
case 33:
|
|
11464
|
+
_context11.next = 35;
|
|
11374
11465
|
return res.json();
|
|
11375
11466
|
|
|
11376
|
-
case
|
|
11467
|
+
case 35:
|
|
11377
11468
|
json = _context11.sent;
|
|
11378
11469
|
if (!(typeof json.result === "string")) {
|
|
11379
|
-
_context11.next =
|
|
11470
|
+
_context11.next = 41;
|
|
11380
11471
|
break;
|
|
11381
11472
|
}
|
|
11382
11473
|
if (!json.result.includes("Invalid API Key")) {
|
|
11383
|
-
_context11.next =
|
|
11474
|
+
_context11.next = 39;
|
|
11384
11475
|
break;
|
|
11385
11476
|
}
|
|
11386
11477
|
throw new InvalidApiKeyError(apiInfo.apiKeyName);
|
|
11387
11478
|
|
|
11388
|
-
case
|
|
11479
|
+
case 39:
|
|
11389
11480
|
if (!json.result.includes("Max rate limit reached")) {
|
|
11390
|
-
_context11.next =
|
|
11481
|
+
_context11.next = 41;
|
|
11391
11482
|
break;
|
|
11392
11483
|
}
|
|
11393
11484
|
throw new RateLimitError(apiInfo.apiKeyName);
|
|
11394
11485
|
|
|
11395
|
-
case
|
|
11486
|
+
case 41:
|
|
11396
11487
|
return _context11.abrupt("return", type === "gas" && !Array.isArray(json.result) ? [ json.result ] : json.result);
|
|
11397
11488
|
|
|
11398
|
-
case
|
|
11489
|
+
case 42:
|
|
11399
11490
|
case "end":
|
|
11400
11491
|
return _context11.stop();
|
|
11401
11492
|
}
|
|
@@ -11404,8 +11495,8 @@ function _typeof(o) {
|
|
|
11404
11495
|
return _handleScanRequest.apply(this, arguments);
|
|
11405
11496
|
}
|
|
11406
11497
|
var fromUsernameToFid = function() {
|
|
11407
|
-
var
|
|
11408
|
-
var url, res, json, users, user;
|
|
11498
|
+
var _ref5 = _asyncToGenerator(_regeneratorRuntime().mark((function _callee3(username, apiKey) {
|
|
11499
|
+
var url, _getUrlAndHeaders2, finalUrl, HEADERS, res, json, users, user;
|
|
11409
11500
|
return _regeneratorRuntime().wrap((function _callee3$(_context3) {
|
|
11410
11501
|
while (1) switch (_context3.prev = _context3.next) {
|
|
11411
11502
|
case 0:
|
|
@@ -11417,20 +11508,26 @@ function _typeof(o) {
|
|
|
11417
11508
|
|
|
11418
11509
|
case 2:
|
|
11419
11510
|
url = "https://api.neynar.com/v2/farcaster/user/search/?q=".concat(username, "&limit=5");
|
|
11420
|
-
|
|
11421
|
-
|
|
11511
|
+
_getUrlAndHeaders2 = getUrlAndHeaders({
|
|
11512
|
+
url: url,
|
|
11513
|
+
serviceName: "Neynar",
|
|
11422
11514
|
headers: {
|
|
11423
11515
|
"x-api-key": apiKey,
|
|
11424
11516
|
"x-neynar-experimental": "false"
|
|
11425
11517
|
}
|
|
11518
|
+
}), finalUrl = _getUrlAndHeaders2.URL, HEADERS = _getUrlAndHeaders2.HEADERS;
|
|
11519
|
+
_context3.next = 6;
|
|
11520
|
+
return fetch(finalUrl, {
|
|
11521
|
+
method: "GET",
|
|
11522
|
+
headers: HEADERS
|
|
11426
11523
|
});
|
|
11427
11524
|
|
|
11428
|
-
case
|
|
11525
|
+
case 6:
|
|
11429
11526
|
res = _context3.sent;
|
|
11430
|
-
_context3.next =
|
|
11527
|
+
_context3.next = 9;
|
|
11431
11528
|
return res.json();
|
|
11432
11529
|
|
|
11433
|
-
case
|
|
11530
|
+
case 9:
|
|
11434
11531
|
json = _context3.sent;
|
|
11435
11532
|
users = json.result ? json.result.users : [];
|
|
11436
11533
|
user = users.find((function(user) {
|
|
@@ -11438,14 +11535,14 @@ function _typeof(o) {
|
|
|
11438
11535
|
}));
|
|
11439
11536
|
return _context3.abrupt("return", user && user.fid || null);
|
|
11440
11537
|
|
|
11441
|
-
case
|
|
11538
|
+
case 13:
|
|
11442
11539
|
case "end":
|
|
11443
11540
|
return _context3.stop();
|
|
11444
11541
|
}
|
|
11445
11542
|
}), _callee3);
|
|
11446
11543
|
})));
|
|
11447
11544
|
return function fromUsernameToFid(_x8, _x9) {
|
|
11448
|
-
return
|
|
11545
|
+
return _ref5.apply(this, arguments);
|
|
11449
11546
|
};
|
|
11450
11547
|
}();
|
|
11451
11548
|
var fromUsernameToFid$1 = {
|
|
@@ -12192,7 +12289,7 @@ function _typeof(o) {
|
|
|
12192
12289
|
description: description
|
|
12193
12290
|
};
|
|
12194
12291
|
var customMap = function customMap(iss, ctx) {
|
|
12195
|
-
var
|
|
12292
|
+
var _ref7;
|
|
12196
12293
|
var message = params.message;
|
|
12197
12294
|
if (iss.code === "invalid_enum_value") {
|
|
12198
12295
|
return {
|
|
@@ -12200,16 +12297,16 @@ function _typeof(o) {
|
|
|
12200
12297
|
};
|
|
12201
12298
|
}
|
|
12202
12299
|
if (typeof ctx.data === "undefined") {
|
|
12203
|
-
var
|
|
12300
|
+
var _ref6;
|
|
12204
12301
|
return {
|
|
12205
|
-
message: (
|
|
12302
|
+
message: (_ref6 = message !== null && message !== void 0 ? message : required_error) !== null && _ref6 !== void 0 ? _ref6 : ctx.defaultError
|
|
12206
12303
|
};
|
|
12207
12304
|
}
|
|
12208
12305
|
if (iss.code !== "invalid_type") return {
|
|
12209
12306
|
message: ctx.defaultError
|
|
12210
12307
|
};
|
|
12211
12308
|
return {
|
|
12212
|
-
message: (
|
|
12309
|
+
message: (_ref7 = message !== null && message !== void 0 ? message : invalid_type_error) !== null && _ref7 !== void 0 ? _ref7 : ctx.defaultError
|
|
12213
12310
|
};
|
|
12214
12311
|
};
|
|
12215
12312
|
return {
|
|
@@ -14949,7 +15046,7 @@ function _typeof(o) {
|
|
|
14949
15046
|
}
|
|
14950
15047
|
if (ctx.common.async) {
|
|
14951
15048
|
return Promise.all(options.map(function() {
|
|
14952
|
-
var
|
|
15049
|
+
var _ref9 = _asyncToGenerator(_regeneratorRuntime().mark((function _callee8(option) {
|
|
14953
15050
|
var childCtx;
|
|
14954
15051
|
return _regeneratorRuntime().wrap((function _callee8$(_context8) {
|
|
14955
15052
|
while (1) switch (_context8.prev = _context8.next) {
|
|
@@ -14982,7 +15079,7 @@ function _typeof(o) {
|
|
|
14982
15079
|
}), _callee8);
|
|
14983
15080
|
})));
|
|
14984
15081
|
return function(_x14) {
|
|
14985
|
-
return
|
|
15082
|
+
return _ref9.apply(this, arguments);
|
|
14986
15083
|
};
|
|
14987
15084
|
}())).then(handleResults);
|
|
14988
15085
|
} else {
|
|
@@ -15284,8 +15381,8 @@ function _typeof(o) {
|
|
|
15284
15381
|
data: ctx.data,
|
|
15285
15382
|
path: ctx.path,
|
|
15286
15383
|
parent: ctx
|
|
15287
|
-
}) ]).then((function(
|
|
15288
|
-
var
|
|
15384
|
+
}) ]).then((function(_ref0) {
|
|
15385
|
+
var _ref1 = _slicedToArray(_ref0, 2), left = _ref1[0], right = _ref1[1];
|
|
15289
15386
|
return handleParsed(left, right);
|
|
15290
15387
|
}));
|
|
15291
15388
|
} else {
|
|
@@ -15418,8 +15515,8 @@ function _typeof(o) {
|
|
|
15418
15515
|
}
|
|
15419
15516
|
var keyType = this._def.keyType;
|
|
15420
15517
|
var valueType = this._def.valueType;
|
|
15421
|
-
var pairs = _toConsumableArray(ctx.data.entries()).map((function(
|
|
15422
|
-
var
|
|
15518
|
+
var pairs = _toConsumableArray(ctx.data.entries()).map((function(_ref10, index) {
|
|
15519
|
+
var _ref11 = _slicedToArray(_ref10, 2), key = _ref11[0], value = _ref11[1];
|
|
15423
15520
|
return {
|
|
15424
15521
|
key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, [ index, "key" ])),
|
|
15425
15522
|
value: valueType._parse(new ParseInputLazyPath(ctx, value, ctx.path, [ index, "value" ]))
|
|
@@ -15953,7 +16050,7 @@ function _typeof(o) {
|
|
|
15953
16050
|
var processed = effect.transform(ctx.data, checkCtx);
|
|
15954
16051
|
if (ctx.common.async) {
|
|
15955
16052
|
return Promise.resolve(processed).then(function() {
|
|
15956
|
-
var
|
|
16053
|
+
var _ref13 = _asyncToGenerator(_regeneratorRuntime().mark((function _callee0(processed) {
|
|
15957
16054
|
var result;
|
|
15958
16055
|
return _regeneratorRuntime().wrap((function _callee0$(_context0) {
|
|
15959
16056
|
while (1) switch (_context0.prev = _context0.next) {
|
|
@@ -16004,7 +16101,7 @@ function _typeof(o) {
|
|
|
16004
16101
|
}), _callee0);
|
|
16005
16102
|
})));
|
|
16006
16103
|
return function(_x15) {
|
|
16007
|
-
return
|
|
16104
|
+
return _ref13.apply(this, arguments);
|
|
16008
16105
|
};
|
|
16009
16106
|
}());
|
|
16010
16107
|
} else {
|
|
@@ -16335,7 +16432,7 @@ function _typeof(o) {
|
|
|
16335
16432
|
var _this$_processInputPa13 = this._processInputParams(input), status = _this$_processInputPa13.status, ctx = _this$_processInputPa13.ctx;
|
|
16336
16433
|
if (ctx.common.async) {
|
|
16337
16434
|
var handleAsync = function() {
|
|
16338
|
-
var
|
|
16435
|
+
var _ref14 = _asyncToGenerator(_regeneratorRuntime().mark((function _callee1() {
|
|
16339
16436
|
var inResult;
|
|
16340
16437
|
return _regeneratorRuntime().wrap((function _callee1$(_context1) {
|
|
16341
16438
|
while (1) switch (_context1.prev = _context1.next) {
|
|
@@ -16377,7 +16474,7 @@ function _typeof(o) {
|
|
|
16377
16474
|
}), _callee1);
|
|
16378
16475
|
})));
|
|
16379
16476
|
return function handleAsync() {
|
|
16380
|
-
return
|
|
16477
|
+
return _ref14.apply(this, arguments);
|
|
16381
16478
|
};
|
|
16382
16479
|
}();
|
|
16383
16480
|
return handleAsync();
|
|
@@ -16718,7 +16815,7 @@ function _typeof(o) {
|
|
|
16718
16815
|
}
|
|
16719
16816
|
function _FIREFLY() {
|
|
16720
16817
|
_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;
|
|
16818
|
+
var _argsToArray3, _argsToArray4, platform, contentType, identifier, _argsToArray4$, start, _argsToArray4$2, end, apiKey, url, _getUrlAndHeaders4, finalUrl, HEADERS, response, _yield$response$json, _data, _args12 = arguments;
|
|
16722
16819
|
return _regeneratorRuntime().wrap((function _callee12$(_context12) {
|
|
16723
16820
|
while (1) switch (_context12.prev = _context12.next) {
|
|
16724
16821
|
case 0:
|
|
@@ -16735,13 +16832,6 @@ function _typeof(o) {
|
|
|
16735
16832
|
end: end
|
|
16736
16833
|
});
|
|
16737
16834
|
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
16835
|
url = new URL("https://openapi.firefly.land/v1/fileverse/fetch");
|
|
16746
16836
|
url.searchParams.set("query", identifier.split(",").map((function(s) {
|
|
16747
16837
|
return s.trim();
|
|
@@ -16749,35 +16839,41 @@ function _typeof(o) {
|
|
|
16749
16839
|
url.searchParams.set("type", fireFlyPlaformType[platform][contentType]);
|
|
16750
16840
|
url.searchParams.set("start", String(start));
|
|
16751
16841
|
url.searchParams.set("end", String(end));
|
|
16752
|
-
|
|
16753
|
-
|
|
16842
|
+
_getUrlAndHeaders4 = getUrlAndHeaders({
|
|
16843
|
+
url: url.toString(),
|
|
16844
|
+
serviceName: "Firefly",
|
|
16754
16845
|
headers: {
|
|
16755
16846
|
"x-api-key": apiKey
|
|
16756
16847
|
}
|
|
16848
|
+
}), finalUrl = _getUrlAndHeaders4.URL, HEADERS = _getUrlAndHeaders4.HEADERS;
|
|
16849
|
+
_context12.next = 12;
|
|
16850
|
+
return fetch(finalUrl, {
|
|
16851
|
+
method: "GET",
|
|
16852
|
+
headers: HEADERS
|
|
16757
16853
|
});
|
|
16758
16854
|
|
|
16759
|
-
case
|
|
16855
|
+
case 12:
|
|
16760
16856
|
response = _context12.sent;
|
|
16761
16857
|
if (response.ok) {
|
|
16762
|
-
_context12.next =
|
|
16858
|
+
_context12.next = 15;
|
|
16763
16859
|
break;
|
|
16764
16860
|
}
|
|
16765
16861
|
throw new NetworkError(SERVICES_API_KEY.Firefly, response.status);
|
|
16766
16862
|
|
|
16767
|
-
case
|
|
16768
|
-
_context12.next =
|
|
16863
|
+
case 15:
|
|
16864
|
+
_context12.next = 17;
|
|
16769
16865
|
return response.json();
|
|
16770
16866
|
|
|
16771
|
-
case
|
|
16867
|
+
case 17:
|
|
16772
16868
|
_yield$response$json = _context12.sent;
|
|
16773
16869
|
_data = _yield$response$json.data;
|
|
16774
16870
|
if (Array.isArray(_data)) {
|
|
16775
|
-
_context12.next =
|
|
16871
|
+
_context12.next = 21;
|
|
16776
16872
|
break;
|
|
16777
16873
|
}
|
|
16778
16874
|
return _context12.abrupt("return", []);
|
|
16779
16875
|
|
|
16780
|
-
case
|
|
16876
|
+
case 21:
|
|
16781
16877
|
return _context12.abrupt("return", _data.map((function(item) {
|
|
16782
16878
|
var flat = {};
|
|
16783
16879
|
for (var _i10 = 0, _Object$entries = Object.entries(item); _i10 < _Object$entries.length; _i10++) {
|
|
@@ -16790,16 +16886,16 @@ function _typeof(o) {
|
|
|
16790
16886
|
return flat;
|
|
16791
16887
|
})));
|
|
16792
16888
|
|
|
16793
|
-
case
|
|
16794
|
-
_context12.prev =
|
|
16889
|
+
case 24:
|
|
16890
|
+
_context12.prev = 24;
|
|
16795
16891
|
_context12.t0 = _context12["catch"](0);
|
|
16796
16892
|
return _context12.abrupt("return", errorMessageHandler(_context12.t0, "FIREFLY"));
|
|
16797
16893
|
|
|
16798
|
-
case
|
|
16894
|
+
case 27:
|
|
16799
16895
|
case "end":
|
|
16800
16896
|
return _context12.stop();
|
|
16801
16897
|
}
|
|
16802
|
-
}), _callee12, null, [ [ 0,
|
|
16898
|
+
}), _callee12, null, [ [ 0, 24 ] ]);
|
|
16803
16899
|
})));
|
|
16804
16900
|
return _FIREFLY.apply(this, arguments);
|
|
16805
16901
|
}
|
|
@@ -16808,7 +16904,7 @@ function _typeof(o) {
|
|
|
16808
16904
|
}
|
|
16809
16905
|
function _LENS() {
|
|
16810
16906
|
_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;
|
|
16907
|
+
var _argsToArray5, _argsToArray6, contentType, identifier, _argsToArray6$, start, _argsToArray6$2, end, apiKey, url, typeMap, _getUrlAndHeaders5, finalUrl, HEADERS, response, _yield$response$json2, _data2, _args13 = arguments;
|
|
16812
16908
|
return _regeneratorRuntime().wrap((function _callee13$(_context13) {
|
|
16813
16909
|
while (1) switch (_context13.prev = _context13.next) {
|
|
16814
16910
|
case 0:
|
|
@@ -16824,13 +16920,6 @@ function _typeof(o) {
|
|
|
16824
16920
|
end: end
|
|
16825
16921
|
});
|
|
16826
16922
|
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
16923
|
url = new URL("https://openapi.firefly.land/v1/fileverse/fetch");
|
|
16835
16924
|
url.searchParams.set("query", identifier.split(",").map((function(s) {
|
|
16836
16925
|
return s.trim();
|
|
@@ -16842,35 +16931,41 @@ function _typeof(o) {
|
|
|
16842
16931
|
url.searchParams.set("type", typeMap[contentType]);
|
|
16843
16932
|
url.searchParams.set("start", String(start));
|
|
16844
16933
|
url.searchParams.set("end", String(end));
|
|
16845
|
-
|
|
16846
|
-
|
|
16934
|
+
_getUrlAndHeaders5 = getUrlAndHeaders({
|
|
16935
|
+
url: url.toString(),
|
|
16936
|
+
serviceName: "Firefly",
|
|
16847
16937
|
headers: {
|
|
16848
16938
|
"x-api-key": apiKey
|
|
16849
16939
|
}
|
|
16940
|
+
}), finalUrl = _getUrlAndHeaders5.URL, HEADERS = _getUrlAndHeaders5.HEADERS;
|
|
16941
|
+
_context13.next = 13;
|
|
16942
|
+
return fetch(finalUrl, {
|
|
16943
|
+
method: "GET",
|
|
16944
|
+
headers: HEADERS
|
|
16850
16945
|
});
|
|
16851
16946
|
|
|
16852
|
-
case
|
|
16947
|
+
case 13:
|
|
16853
16948
|
response = _context13.sent;
|
|
16854
16949
|
if (response.ok) {
|
|
16855
|
-
_context13.next =
|
|
16950
|
+
_context13.next = 16;
|
|
16856
16951
|
break;
|
|
16857
16952
|
}
|
|
16858
16953
|
throw new NetworkError(SERVICES_API_KEY.Firefly, response.status);
|
|
16859
16954
|
|
|
16860
|
-
case
|
|
16861
|
-
_context13.next =
|
|
16955
|
+
case 16:
|
|
16956
|
+
_context13.next = 18;
|
|
16862
16957
|
return response.json();
|
|
16863
16958
|
|
|
16864
|
-
case
|
|
16959
|
+
case 18:
|
|
16865
16960
|
_yield$response$json2 = _context13.sent;
|
|
16866
16961
|
_data2 = _yield$response$json2.data;
|
|
16867
16962
|
if (Array.isArray(_data2)) {
|
|
16868
|
-
_context13.next =
|
|
16963
|
+
_context13.next = 22;
|
|
16869
16964
|
break;
|
|
16870
16965
|
}
|
|
16871
16966
|
return _context13.abrupt("return", []);
|
|
16872
16967
|
|
|
16873
|
-
case
|
|
16968
|
+
case 22:
|
|
16874
16969
|
return _context13.abrupt("return", _data2.map((function(item) {
|
|
16875
16970
|
var flat = {};
|
|
16876
16971
|
for (var _i11 = 0, _Object$entries2 = Object.entries(item); _i11 < _Object$entries2.length; _i11++) {
|
|
@@ -16883,16 +16978,16 @@ function _typeof(o) {
|
|
|
16883
16978
|
return flat;
|
|
16884
16979
|
})));
|
|
16885
16980
|
|
|
16886
|
-
case
|
|
16887
|
-
_context13.prev =
|
|
16981
|
+
case 25:
|
|
16982
|
+
_context13.prev = 25;
|
|
16888
16983
|
_context13.t0 = _context13["catch"](0);
|
|
16889
16984
|
return _context13.abrupt("return", errorMessageHandler(_context13.t0, "LENS"));
|
|
16890
16985
|
|
|
16891
|
-
case
|
|
16986
|
+
case 28:
|
|
16892
16987
|
case "end":
|
|
16893
16988
|
return _context13.stop();
|
|
16894
16989
|
}
|
|
16895
|
-
}), _callee13, null, [ [ 0,
|
|
16990
|
+
}), _callee13, null, [ [ 0, 25 ] ]);
|
|
16896
16991
|
})));
|
|
16897
16992
|
return _LENS.apply(this, arguments);
|
|
16898
16993
|
}
|
|
@@ -16901,7 +16996,7 @@ function _typeof(o) {
|
|
|
16901
16996
|
}
|
|
16902
16997
|
function _FARCASTER() {
|
|
16903
16998
|
_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;
|
|
16999
|
+
var _argsToArray7, _argsToArray8, contentType, identifier, _argsToArray8$, start, _argsToArray8$2, end, apiKey, url, typeMap, _getUrlAndHeaders6, finalUrl, HEADERS, response, _yield$response$json3, _data3, _args14 = arguments;
|
|
16905
17000
|
return _regeneratorRuntime().wrap((function _callee14$(_context14) {
|
|
16906
17001
|
while (1) switch (_context14.prev = _context14.next) {
|
|
16907
17002
|
case 0:
|
|
@@ -16917,13 +17012,6 @@ function _typeof(o) {
|
|
|
16917
17012
|
end: end
|
|
16918
17013
|
});
|
|
16919
17014
|
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
17015
|
url = new URL("https://openapi.firefly.land/v1/fileverse/fetch");
|
|
16928
17016
|
url.searchParams.set("query", identifier.split(",").map((function(s) {
|
|
16929
17017
|
return s.trim();
|
|
@@ -16936,35 +17024,41 @@ function _typeof(o) {
|
|
|
16936
17024
|
url.searchParams.set("type", typeMap[contentType]);
|
|
16937
17025
|
url.searchParams.set("start", String(start));
|
|
16938
17026
|
url.searchParams.set("end", String(end));
|
|
16939
|
-
|
|
16940
|
-
|
|
17027
|
+
_getUrlAndHeaders6 = getUrlAndHeaders({
|
|
17028
|
+
url: url.toString(),
|
|
17029
|
+
serviceName: "Firefly",
|
|
16941
17030
|
headers: {
|
|
16942
17031
|
"x-api-key": apiKey
|
|
16943
17032
|
}
|
|
17033
|
+
}), finalUrl = _getUrlAndHeaders6.URL, HEADERS = _getUrlAndHeaders6.HEADERS;
|
|
17034
|
+
_context14.next = 13;
|
|
17035
|
+
return fetch(finalUrl, {
|
|
17036
|
+
method: "GET",
|
|
17037
|
+
headers: HEADERS
|
|
16944
17038
|
});
|
|
16945
17039
|
|
|
16946
|
-
case
|
|
17040
|
+
case 13:
|
|
16947
17041
|
response = _context14.sent;
|
|
16948
17042
|
if (response.ok) {
|
|
16949
|
-
_context14.next =
|
|
17043
|
+
_context14.next = 16;
|
|
16950
17044
|
break;
|
|
16951
17045
|
}
|
|
16952
17046
|
throw new NetworkError(SERVICES_API_KEY.Firefly, response.status);
|
|
16953
17047
|
|
|
16954
|
-
case
|
|
16955
|
-
_context14.next =
|
|
17048
|
+
case 16:
|
|
17049
|
+
_context14.next = 18;
|
|
16956
17050
|
return response.json();
|
|
16957
17051
|
|
|
16958
|
-
case
|
|
17052
|
+
case 18:
|
|
16959
17053
|
_yield$response$json3 = _context14.sent;
|
|
16960
17054
|
_data3 = _yield$response$json3.data;
|
|
16961
17055
|
if (Array.isArray(_data3)) {
|
|
16962
|
-
_context14.next =
|
|
17056
|
+
_context14.next = 22;
|
|
16963
17057
|
break;
|
|
16964
17058
|
}
|
|
16965
17059
|
return _context14.abrupt("return", []);
|
|
16966
17060
|
|
|
16967
|
-
case
|
|
17061
|
+
case 22:
|
|
16968
17062
|
return _context14.abrupt("return", _data3.map((function(item) {
|
|
16969
17063
|
var flat = {};
|
|
16970
17064
|
for (var _i12 = 0, _Object$entries3 = Object.entries(item); _i12 < _Object$entries3.length; _i12++) {
|
|
@@ -16977,16 +17071,16 @@ function _typeof(o) {
|
|
|
16977
17071
|
return flat;
|
|
16978
17072
|
})));
|
|
16979
17073
|
|
|
16980
|
-
case
|
|
16981
|
-
_context14.prev =
|
|
17074
|
+
case 25:
|
|
17075
|
+
_context14.prev = 25;
|
|
16982
17076
|
_context14.t0 = _context14["catch"](0);
|
|
16983
17077
|
return _context14.abrupt("return", errorMessageHandler(_context14.t0, "FARCASTER"));
|
|
16984
17078
|
|
|
16985
|
-
case
|
|
17079
|
+
case 28:
|
|
16986
17080
|
case "end":
|
|
16987
17081
|
return _context14.stop();
|
|
16988
17082
|
}
|
|
16989
|
-
}), _callee14, null, [ [ 0,
|
|
17083
|
+
}), _callee14, null, [ [ 0, 25 ] ]);
|
|
16990
17084
|
})));
|
|
16991
17085
|
return _FARCASTER.apply(this, arguments);
|
|
16992
17086
|
}
|
|
@@ -17106,14 +17200,7 @@ function _typeof(o) {
|
|
|
17106
17200
|
limit: limit
|
|
17107
17201
|
});
|
|
17108
17202
|
API_KEY = window.localStorage.getItem(SERVICES_API_KEY.Basescan);
|
|
17109
|
-
|
|
17110
|
-
_context16.next = 6;
|
|
17111
|
-
break;
|
|
17112
|
-
}
|
|
17113
|
-
throw new MissingApiKeyError(SERVICES_API_KEY.Basescan);
|
|
17114
|
-
|
|
17115
|
-
case 6:
|
|
17116
|
-
_context16.next = 8;
|
|
17203
|
+
_context16.next = 6;
|
|
17117
17204
|
return handleScanRequest({
|
|
17118
17205
|
type: type,
|
|
17119
17206
|
address: address,
|
|
@@ -17127,19 +17214,19 @@ function _typeof(o) {
|
|
|
17127
17214
|
network: "base"
|
|
17128
17215
|
});
|
|
17129
17216
|
|
|
17130
|
-
case
|
|
17217
|
+
case 6:
|
|
17131
17218
|
return _context16.abrupt("return", _context16.sent);
|
|
17132
17219
|
|
|
17133
|
-
case
|
|
17134
|
-
_context16.prev =
|
|
17220
|
+
case 9:
|
|
17221
|
+
_context16.prev = 9;
|
|
17135
17222
|
_context16.t0 = _context16["catch"](0);
|
|
17136
17223
|
return _context16.abrupt("return", errorMessageHandler(_context16.t0, "BASE"));
|
|
17137
17224
|
|
|
17138
|
-
case
|
|
17225
|
+
case 12:
|
|
17139
17226
|
case "end":
|
|
17140
17227
|
return _context16.stop();
|
|
17141
17228
|
}
|
|
17142
|
-
}), _callee16, null, [ [ 0,
|
|
17229
|
+
}), _callee16, null, [ [ 0, 9 ] ]);
|
|
17143
17230
|
})));
|
|
17144
17231
|
return _BASE.apply(this, arguments);
|
|
17145
17232
|
}
|
|
@@ -17166,14 +17253,7 @@ function _typeof(o) {
|
|
|
17166
17253
|
limit: limit
|
|
17167
17254
|
});
|
|
17168
17255
|
apiKey = window.localStorage.getItem(SERVICES_API_KEY.Gnosisscan);
|
|
17169
|
-
|
|
17170
|
-
_context17.next = 6;
|
|
17171
|
-
break;
|
|
17172
|
-
}
|
|
17173
|
-
throw new MissingApiKeyError(SERVICES_API_KEY.Gnosisscan);
|
|
17174
|
-
|
|
17175
|
-
case 6:
|
|
17176
|
-
_context17.next = 8;
|
|
17256
|
+
_context17.next = 6;
|
|
17177
17257
|
return handleScanRequest({
|
|
17178
17258
|
type: type,
|
|
17179
17259
|
address: address,
|
|
@@ -17187,19 +17267,19 @@ function _typeof(o) {
|
|
|
17187
17267
|
network: "gnosis"
|
|
17188
17268
|
});
|
|
17189
17269
|
|
|
17190
|
-
case
|
|
17270
|
+
case 6:
|
|
17191
17271
|
return _context17.abrupt("return", _context17.sent);
|
|
17192
17272
|
|
|
17193
|
-
case
|
|
17194
|
-
_context17.prev =
|
|
17273
|
+
case 9:
|
|
17274
|
+
_context17.prev = 9;
|
|
17195
17275
|
_context17.t0 = _context17["catch"](0);
|
|
17196
17276
|
return _context17.abrupt("return", errorMessageHandler(_context17.t0, "GNOSIS"));
|
|
17197
17277
|
|
|
17198
|
-
case
|
|
17278
|
+
case 12:
|
|
17199
17279
|
case "end":
|
|
17200
17280
|
return _context17.stop();
|
|
17201
17281
|
}
|
|
17202
|
-
}), _callee17, null, [ [ 0,
|
|
17282
|
+
}), _callee17, null, [ [ 0, 9 ] ]);
|
|
17203
17283
|
})));
|
|
17204
17284
|
return _GNOSIS.apply(this, arguments);
|
|
17205
17285
|
}
|
|
@@ -17208,7 +17288,7 @@ function _typeof(o) {
|
|
|
17208
17288
|
}
|
|
17209
17289
|
function _NEYNAR() {
|
|
17210
17290
|
_NEYNAR = _asyncToGenerator(_regeneratorRuntime().mark((function _callee18() {
|
|
17211
|
-
var neynarParamsSchema, _argsToArray13, _argsToArray14, username, apiKey, fid, url, response, json, users, _args18 = arguments;
|
|
17291
|
+
var neynarParamsSchema, _argsToArray13, _argsToArray14, username, apiKey, fid, url, _getUrlAndHeaders7, finalUrl, HEADERS, response, json, users, _args18 = arguments;
|
|
17212
17292
|
return _regeneratorRuntime().wrap((function _callee18$(_context18) {
|
|
17213
17293
|
while (1) switch (_context18.prev = _context18.next) {
|
|
17214
17294
|
case 0:
|
|
@@ -17222,59 +17302,58 @@ function _typeof(o) {
|
|
|
17222
17302
|
username: username
|
|
17223
17303
|
});
|
|
17224
17304
|
apiKey = window.localStorage.getItem(SERVICES_API_KEY.Neynar);
|
|
17225
|
-
|
|
17226
|
-
_context18.next = 7;
|
|
17227
|
-
break;
|
|
17228
|
-
}
|
|
17229
|
-
throw new MissingApiKeyError(SERVICES_API_KEY.Neynar);
|
|
17230
|
-
|
|
17231
|
-
case 7:
|
|
17232
|
-
_context18.next = 9;
|
|
17305
|
+
_context18.next = 7;
|
|
17233
17306
|
return fromUsernameToFid$1.fromUsernameToFid(username, apiKey);
|
|
17234
17307
|
|
|
17235
|
-
case
|
|
17308
|
+
case 7:
|
|
17236
17309
|
fid = _context18.sent;
|
|
17237
17310
|
if (fid) {
|
|
17238
|
-
_context18.next =
|
|
17311
|
+
_context18.next = 10;
|
|
17239
17312
|
break;
|
|
17240
17313
|
}
|
|
17241
17314
|
throw new ValidationError("Invalid username: ".concat(username));
|
|
17242
17315
|
|
|
17243
|
-
case
|
|
17316
|
+
case 10:
|
|
17244
17317
|
url = "https://api.neynar.com/v2/farcaster/followers?fid=".concat(fid);
|
|
17245
|
-
|
|
17246
|
-
|
|
17318
|
+
_getUrlAndHeaders7 = getUrlAndHeaders({
|
|
17319
|
+
url: url.toString(),
|
|
17320
|
+
serviceName: "Neynar",
|
|
17247
17321
|
headers: {
|
|
17248
17322
|
"x-api-key": apiKey,
|
|
17249
17323
|
"x-neynar-experimental": "false"
|
|
17250
17324
|
}
|
|
17325
|
+
}), finalUrl = _getUrlAndHeaders7.URL, HEADERS = _getUrlAndHeaders7.HEADERS;
|
|
17326
|
+
_context18.next = 14;
|
|
17327
|
+
return fetch(finalUrl, {
|
|
17328
|
+
method: "GET",
|
|
17329
|
+
headers: HEADERS
|
|
17251
17330
|
});
|
|
17252
17331
|
|
|
17253
|
-
case
|
|
17332
|
+
case 14:
|
|
17254
17333
|
response = _context18.sent;
|
|
17255
17334
|
if (response.ok) {
|
|
17256
|
-
_context18.next =
|
|
17335
|
+
_context18.next = 17;
|
|
17257
17336
|
break;
|
|
17258
17337
|
}
|
|
17259
17338
|
throw new NetworkError(SERVICES_API_KEY.Neynar, response.status);
|
|
17260
17339
|
|
|
17261
|
-
case
|
|
17262
|
-
_context18.next =
|
|
17340
|
+
case 17:
|
|
17341
|
+
_context18.next = 19;
|
|
17263
17342
|
return response.json();
|
|
17264
17343
|
|
|
17265
|
-
case
|
|
17344
|
+
case 19:
|
|
17266
17345
|
json = _context18.sent;
|
|
17267
17346
|
users = (json === null || json === void 0 ? void 0 : json.users) || [];
|
|
17268
17347
|
if (users.length) {
|
|
17269
|
-
_context18.next =
|
|
17348
|
+
_context18.next = 23;
|
|
17270
17349
|
break;
|
|
17271
17350
|
}
|
|
17272
17351
|
return _context18.abrupt("return", []);
|
|
17273
17352
|
|
|
17274
|
-
case
|
|
17275
|
-
return _context18.abrupt("return", users.map((function(
|
|
17353
|
+
case 23:
|
|
17354
|
+
return _context18.abrupt("return", users.map((function(_ref15) {
|
|
17276
17355
|
var _user$profile, _user$profile2;
|
|
17277
|
-
var user =
|
|
17356
|
+
var user = _ref15.user;
|
|
17278
17357
|
return {
|
|
17279
17358
|
username: user.username,
|
|
17280
17359
|
custody_address: user.custody_address,
|
|
@@ -17284,16 +17363,16 @@ function _typeof(o) {
|
|
|
17284
17363
|
};
|
|
17285
17364
|
})));
|
|
17286
17365
|
|
|
17287
|
-
case
|
|
17288
|
-
_context18.prev =
|
|
17366
|
+
case 26:
|
|
17367
|
+
_context18.prev = 26;
|
|
17289
17368
|
_context18.t0 = _context18["catch"](0);
|
|
17290
17369
|
return _context18.abrupt("return", errorMessageHandler(_context18.t0, "NEYNAR"));
|
|
17291
17370
|
|
|
17292
|
-
case
|
|
17371
|
+
case 29:
|
|
17293
17372
|
case "end":
|
|
17294
17373
|
return _context18.stop();
|
|
17295
17374
|
}
|
|
17296
|
-
}), _callee18, null, [ [ 0,
|
|
17375
|
+
}), _callee18, null, [ [ 0, 26 ] ]);
|
|
17297
17376
|
})));
|
|
17298
17377
|
return _NEYNAR.apply(this, arguments);
|
|
17299
17378
|
}
|
|
@@ -17330,14 +17409,7 @@ function _typeof(o) {
|
|
|
17330
17409
|
|
|
17331
17410
|
case 6:
|
|
17332
17411
|
apiKey = window.localStorage.getItem(SERVICES_API_KEY.Etherscan);
|
|
17333
|
-
|
|
17334
|
-
_context19.next = 9;
|
|
17335
|
-
break;
|
|
17336
|
-
}
|
|
17337
|
-
throw new MissingApiKeyError(SERVICES_API_KEY.Etherscan);
|
|
17338
|
-
|
|
17339
|
-
case 9:
|
|
17340
|
-
_context19.next = 11;
|
|
17412
|
+
_context19.next = 9;
|
|
17341
17413
|
return handleScanRequest({
|
|
17342
17414
|
type: type,
|
|
17343
17415
|
address: address,
|
|
@@ -17351,19 +17423,19 @@ function _typeof(o) {
|
|
|
17351
17423
|
network: chain
|
|
17352
17424
|
});
|
|
17353
17425
|
|
|
17354
|
-
case
|
|
17426
|
+
case 9:
|
|
17355
17427
|
return _context19.abrupt("return", _context19.sent);
|
|
17356
17428
|
|
|
17357
|
-
case
|
|
17358
|
-
_context19.prev =
|
|
17429
|
+
case 12:
|
|
17430
|
+
_context19.prev = 12;
|
|
17359
17431
|
_context19.t0 = _context19["catch"](0);
|
|
17360
17432
|
return _context19.abrupt("return", errorMessageHandler(_context19.t0, "ETHERSCAN"));
|
|
17361
17433
|
|
|
17362
|
-
case
|
|
17434
|
+
case 15:
|
|
17363
17435
|
case "end":
|
|
17364
17436
|
return _context19.stop();
|
|
17365
17437
|
}
|
|
17366
|
-
}), _callee19, null, [ [ 0,
|
|
17438
|
+
}), _callee19, null, [ [ 0, 12 ] ]);
|
|
17367
17439
|
})));
|
|
17368
17440
|
return _ETHERSCAN.apply(this, arguments);
|
|
17369
17441
|
}
|
|
@@ -17372,7 +17444,7 @@ function _typeof(o) {
|
|
|
17372
17444
|
}
|
|
17373
17445
|
function _COINGECKO() {
|
|
17374
17446
|
_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;
|
|
17447
|
+
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
17448
|
return _regeneratorRuntime().wrap((function _callee20$(_context20) {
|
|
17377
17449
|
while (1) switch (_context20.prev = _context20.next) {
|
|
17378
17450
|
case 0:
|
|
@@ -17385,28 +17457,21 @@ function _typeof(o) {
|
|
|
17385
17457
|
param2: param2
|
|
17386
17458
|
});
|
|
17387
17459
|
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
17460
|
headers = {
|
|
17396
17461
|
accept: "application/json",
|
|
17397
17462
|
"x-cg-demo-api-key": apiKey
|
|
17398
17463
|
};
|
|
17399
17464
|
url = "";
|
|
17400
17465
|
_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" ?
|
|
17466
|
+
_context20.next = _context20.t0 === "price" ? 9 : _context20.t0 === "market" ? 12 : _context20.t0 === "stablecoins" ? 17 : _context20.t0 === "derivatives" ? 21 : 23;
|
|
17402
17467
|
break;
|
|
17403
17468
|
|
|
17404
|
-
case
|
|
17469
|
+
case 9:
|
|
17405
17470
|
vs = param2 || "usd";
|
|
17406
17471
|
url = "https://api.coingecko.com/api/v3/simple/price?vs_currencies=".concat(vs, "&symbols=").concat(param1);
|
|
17407
|
-
return _context20.abrupt("break",
|
|
17472
|
+
return _context20.abrupt("break", 23);
|
|
17408
17473
|
|
|
17409
|
-
case
|
|
17474
|
+
case 12:
|
|
17410
17475
|
map = {
|
|
17411
17476
|
all: "",
|
|
17412
17477
|
base: "base-ecosystem",
|
|
@@ -17421,48 +17486,53 @@ function _typeof(o) {
|
|
|
17421
17486
|
_category = map[param1] || "";
|
|
17422
17487
|
trend = param2 ? "&price_change_percentage=".concat(param2) : "";
|
|
17423
17488
|
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",
|
|
17489
|
+
return _context20.abrupt("break", 23);
|
|
17425
17490
|
|
|
17426
|
-
case
|
|
17491
|
+
case 17:
|
|
17427
17492
|
_category2 = param1 === "all" ? "stablecoins" : param1;
|
|
17428
17493
|
_trend = param2 ? "&price_change_percentage=".concat(param2) : "";
|
|
17429
17494
|
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",
|
|
17495
|
+
return _context20.abrupt("break", 23);
|
|
17431
17496
|
|
|
17432
|
-
case
|
|
17497
|
+
case 21:
|
|
17433
17498
|
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",
|
|
17499
|
+
return _context20.abrupt("break", 23);
|
|
17435
17500
|
|
|
17436
|
-
case
|
|
17437
|
-
|
|
17438
|
-
|
|
17501
|
+
case 23:
|
|
17502
|
+
_getUrlAndHeaders8 = getUrlAndHeaders({
|
|
17503
|
+
url: url,
|
|
17504
|
+
serviceName: "Coingecko",
|
|
17439
17505
|
headers: headers
|
|
17506
|
+
}), finalUrl = _getUrlAndHeaders8.URL, HEADERS = _getUrlAndHeaders8.HEADERS;
|
|
17507
|
+
_context20.next = 26;
|
|
17508
|
+
return fetch(finalUrl, {
|
|
17509
|
+
headers: HEADERS
|
|
17440
17510
|
});
|
|
17441
17511
|
|
|
17442
|
-
case
|
|
17512
|
+
case 26:
|
|
17443
17513
|
res = _context20.sent;
|
|
17444
|
-
_context20.next =
|
|
17514
|
+
_context20.next = 29;
|
|
17445
17515
|
return res.json();
|
|
17446
17516
|
|
|
17447
|
-
case
|
|
17517
|
+
case 29:
|
|
17448
17518
|
json = _context20.sent;
|
|
17449
17519
|
if (res.ok) {
|
|
17450
|
-
_context20.next =
|
|
17520
|
+
_context20.next = 35;
|
|
17451
17521
|
break;
|
|
17452
17522
|
}
|
|
17453
17523
|
msg = (json === null || json === void 0 || (_json$status = json.status) === null || _json$status === void 0 ? void 0 : _json$status.error_message) || "";
|
|
17454
17524
|
if (!msg.includes("API Key Missing")) {
|
|
17455
|
-
_context20.next =
|
|
17525
|
+
_context20.next = 34;
|
|
17456
17526
|
break;
|
|
17457
17527
|
}
|
|
17458
17528
|
throw new InvalidApiKeyError(SERVICES_API_KEY.Coingecko);
|
|
17459
17529
|
|
|
17460
|
-
case
|
|
17530
|
+
case 34:
|
|
17461
17531
|
throw new NetworkError(SERVICES_API_KEY.Coingecko, res.status);
|
|
17462
17532
|
|
|
17463
|
-
case
|
|
17533
|
+
case 35:
|
|
17464
17534
|
if (!(category === "price")) {
|
|
17465
|
-
_context20.next =
|
|
17535
|
+
_context20.next = 39;
|
|
17466
17536
|
break;
|
|
17467
17537
|
}
|
|
17468
17538
|
out = {};
|
|
@@ -17477,7 +17547,7 @@ function _typeof(o) {
|
|
|
17477
17547
|
}
|
|
17478
17548
|
return _context20.abrupt("return", [ out ]);
|
|
17479
17549
|
|
|
17480
|
-
case
|
|
17550
|
+
case 39:
|
|
17481
17551
|
_data4 = Array.isArray(json) ? json : [ json ];
|
|
17482
17552
|
return _context20.abrupt("return", _data4.map((function(item) {
|
|
17483
17553
|
var flat = {};
|
|
@@ -17490,16 +17560,16 @@ function _typeof(o) {
|
|
|
17490
17560
|
return flat;
|
|
17491
17561
|
})));
|
|
17492
17562
|
|
|
17493
|
-
case
|
|
17494
|
-
_context20.prev =
|
|
17563
|
+
case 43:
|
|
17564
|
+
_context20.prev = 43;
|
|
17495
17565
|
_context20.t1 = _context20["catch"](0);
|
|
17496
17566
|
return _context20.abrupt("return", errorMessageHandler(_context20.t1, "COINGECKO"));
|
|
17497
17567
|
|
|
17498
|
-
case
|
|
17568
|
+
case 46:
|
|
17499
17569
|
case "end":
|
|
17500
17570
|
return _context20.stop();
|
|
17501
17571
|
}
|
|
17502
|
-
}), _callee20, null, [ [ 0,
|
|
17572
|
+
}), _callee20, null, [ [ 0, 43 ] ]);
|
|
17503
17573
|
})));
|
|
17504
17574
|
return _COINGECKO.apply(this, arguments);
|
|
17505
17575
|
}
|
|
@@ -17514,56 +17584,64 @@ function _typeof(o) {
|
|
|
17514
17584
|
case 0:
|
|
17515
17585
|
_context25.prev = 0;
|
|
17516
17586
|
fetchJSON = function() {
|
|
17517
|
-
var
|
|
17518
|
-
var res, json;
|
|
17587
|
+
var _ref16 = _asyncToGenerator(_regeneratorRuntime().mark((function _callee21(url) {
|
|
17588
|
+
var _getUrlAndHeaders9, finalUrl, HEADERS, res, json;
|
|
17519
17589
|
return _regeneratorRuntime().wrap((function _callee21$(_context21) {
|
|
17520
17590
|
while (1) switch (_context21.prev = _context21.next) {
|
|
17521
17591
|
case 0:
|
|
17522
|
-
|
|
17523
|
-
|
|
17592
|
+
_getUrlAndHeaders9 = getUrlAndHeaders({
|
|
17593
|
+
url: url,
|
|
17594
|
+
serviceName: "Etherscan",
|
|
17595
|
+
headers: {}
|
|
17596
|
+
}), finalUrl = _getUrlAndHeaders9.URL, HEADERS = _getUrlAndHeaders9.HEADERS;
|
|
17597
|
+
_context21.next = 3;
|
|
17598
|
+
return fetch(finalUrl, {
|
|
17599
|
+
method: "GET",
|
|
17600
|
+
headers: HEADERS
|
|
17601
|
+
});
|
|
17524
17602
|
|
|
17525
|
-
case
|
|
17603
|
+
case 3:
|
|
17526
17604
|
res = _context21.sent;
|
|
17527
17605
|
if (res.ok) {
|
|
17528
|
-
_context21.next =
|
|
17606
|
+
_context21.next = 6;
|
|
17529
17607
|
break;
|
|
17530
17608
|
}
|
|
17531
17609
|
throw new NetworkError(SERVICES_API_KEY.Etherscan, res.status);
|
|
17532
17610
|
|
|
17533
|
-
case
|
|
17534
|
-
_context21.next =
|
|
17611
|
+
case 6:
|
|
17612
|
+
_context21.next = 8;
|
|
17535
17613
|
return res.json();
|
|
17536
17614
|
|
|
17537
|
-
case
|
|
17615
|
+
case 8:
|
|
17538
17616
|
json = _context21.sent;
|
|
17539
17617
|
if (!(typeof json.result === "string")) {
|
|
17540
|
-
_context21.next =
|
|
17618
|
+
_context21.next = 14;
|
|
17541
17619
|
break;
|
|
17542
17620
|
}
|
|
17543
17621
|
if (!json.result.includes("Invalid API Key")) {
|
|
17544
|
-
_context21.next =
|
|
17622
|
+
_context21.next = 12;
|
|
17545
17623
|
break;
|
|
17546
17624
|
}
|
|
17547
17625
|
throw new InvalidApiKeyError(SERVICES_API_KEY.Etherscan);
|
|
17548
17626
|
|
|
17549
|
-
case
|
|
17627
|
+
case 12:
|
|
17550
17628
|
if (!json.result.includes("Max rate limit reached")) {
|
|
17551
|
-
_context21.next =
|
|
17629
|
+
_context21.next = 14;
|
|
17552
17630
|
break;
|
|
17553
17631
|
}
|
|
17554
17632
|
throw new RateLimitError(SERVICES_API_KEY.Etherscan);
|
|
17555
17633
|
|
|
17556
|
-
case
|
|
17634
|
+
case 14:
|
|
17557
17635
|
return _context21.abrupt("return", json.result);
|
|
17558
17636
|
|
|
17559
|
-
case
|
|
17637
|
+
case 15:
|
|
17560
17638
|
case "end":
|
|
17561
17639
|
return _context21.stop();
|
|
17562
17640
|
}
|
|
17563
17641
|
}), _callee21);
|
|
17564
17642
|
})));
|
|
17565
17643
|
return function fetchJSON(_x18) {
|
|
17566
|
-
return
|
|
17644
|
+
return _ref16.apply(this, arguments);
|
|
17567
17645
|
};
|
|
17568
17646
|
}();
|
|
17569
17647
|
_argsToArray19 = argsToArray(_args25), _argsToArray20 = _slicedToArray(_argsToArray19, 7),
|
|
@@ -17581,13 +17659,6 @@ function _typeof(o) {
|
|
|
17581
17659
|
offset: offset
|
|
17582
17660
|
});
|
|
17583
17661
|
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
17662
|
INPUTS = addresses.split(",").map((function(s) {
|
|
17592
17663
|
return s.trim();
|
|
17593
17664
|
})).filter(Boolean);
|
|
@@ -17596,54 +17667,54 @@ function _typeof(o) {
|
|
|
17596
17667
|
})).filter(Boolean);
|
|
17597
17668
|
ADDRESS_MAP = {};
|
|
17598
17669
|
_iterator41 = _createForOfIteratorHelper(INPUTS);
|
|
17599
|
-
_context25.prev =
|
|
17670
|
+
_context25.prev = 9;
|
|
17600
17671
|
_iterator41.s();
|
|
17601
17672
|
|
|
17602
|
-
case
|
|
17673
|
+
case 11:
|
|
17603
17674
|
if ((_step41 = _iterator41.n()).done) {
|
|
17604
|
-
_context25.next =
|
|
17675
|
+
_context25.next = 23;
|
|
17605
17676
|
break;
|
|
17606
17677
|
}
|
|
17607
17678
|
inp = _step41.value;
|
|
17608
17679
|
if (!isAddress$1.isAddress(inp)) {
|
|
17609
|
-
_context25.next =
|
|
17680
|
+
_context25.next = 17;
|
|
17610
17681
|
break;
|
|
17611
17682
|
}
|
|
17612
17683
|
ADDRESS_MAP[inp.toLowerCase()] = null;
|
|
17613
|
-
_context25.next =
|
|
17684
|
+
_context25.next = 21;
|
|
17614
17685
|
break;
|
|
17615
17686
|
|
|
17616
|
-
case
|
|
17617
|
-
_context25.next =
|
|
17687
|
+
case 17:
|
|
17688
|
+
_context25.next = 19;
|
|
17618
17689
|
return fromEnsNameToAddress$1.validateAndGetAddress(inp);
|
|
17619
17690
|
|
|
17620
|
-
case
|
|
17691
|
+
case 19:
|
|
17621
17692
|
_address = _context25.sent;
|
|
17622
17693
|
ADDRESS_MAP[_address.toLowerCase()] = _address;
|
|
17623
17694
|
|
|
17624
|
-
case
|
|
17625
|
-
_context25.next =
|
|
17695
|
+
case 21:
|
|
17696
|
+
_context25.next = 11;
|
|
17626
17697
|
break;
|
|
17627
17698
|
|
|
17628
|
-
case
|
|
17629
|
-
_context25.next =
|
|
17699
|
+
case 23:
|
|
17700
|
+
_context25.next = 28;
|
|
17630
17701
|
break;
|
|
17631
17702
|
|
|
17632
|
-
case
|
|
17633
|
-
_context25.prev =
|
|
17634
|
-
_context25.t0 = _context25["catch"](
|
|
17703
|
+
case 25:
|
|
17704
|
+
_context25.prev = 25;
|
|
17705
|
+
_context25.t0 = _context25["catch"](9);
|
|
17635
17706
|
_iterator41.e(_context25.t0);
|
|
17636
17707
|
|
|
17637
|
-
case
|
|
17638
|
-
_context25.prev =
|
|
17708
|
+
case 28:
|
|
17709
|
+
_context25.prev = 28;
|
|
17639
17710
|
_iterator41.f();
|
|
17640
|
-
return _context25.finish(
|
|
17711
|
+
return _context25.finish(28);
|
|
17641
17712
|
|
|
17642
|
-
case
|
|
17713
|
+
case 31:
|
|
17643
17714
|
ADDRS = Object.keys(ADDRESS_MAP);
|
|
17644
17715
|
out = [];
|
|
17645
17716
|
_iterator42 = _createForOfIteratorHelper(CHAINS);
|
|
17646
|
-
_context25.prev =
|
|
17717
|
+
_context25.prev = 34;
|
|
17647
17718
|
_loop = _regeneratorRuntime().mark((function _loop() {
|
|
17648
17719
|
var chain, chainId, _loop2, _ret2, i, sb, eb, _loop3, _ret3, _i16, _ADDRS;
|
|
17649
17720
|
return _regeneratorRuntime().wrap((function _loop$(_context24) {
|
|
@@ -17817,52 +17888,52 @@ function _typeof(o) {
|
|
|
17817
17888
|
}));
|
|
17818
17889
|
_iterator42.s();
|
|
17819
17890
|
|
|
17820
|
-
case
|
|
17891
|
+
case 37:
|
|
17821
17892
|
if ((_step42 = _iterator42.n()).done) {
|
|
17822
|
-
_context25.next =
|
|
17893
|
+
_context25.next = 44;
|
|
17823
17894
|
break;
|
|
17824
17895
|
}
|
|
17825
|
-
return _context25.delegateYield(_loop(), "t1",
|
|
17896
|
+
return _context25.delegateYield(_loop(), "t1", 39);
|
|
17826
17897
|
|
|
17827
|
-
case
|
|
17898
|
+
case 39:
|
|
17828
17899
|
_ret = _context25.t1;
|
|
17829
17900
|
if (!_ret) {
|
|
17830
|
-
_context25.next =
|
|
17901
|
+
_context25.next = 42;
|
|
17831
17902
|
break;
|
|
17832
17903
|
}
|
|
17833
17904
|
return _context25.abrupt("return", _ret.v);
|
|
17834
17905
|
|
|
17835
|
-
case
|
|
17836
|
-
_context25.next =
|
|
17906
|
+
case 42:
|
|
17907
|
+
_context25.next = 37;
|
|
17837
17908
|
break;
|
|
17838
17909
|
|
|
17839
|
-
case
|
|
17840
|
-
_context25.next =
|
|
17910
|
+
case 44:
|
|
17911
|
+
_context25.next = 49;
|
|
17841
17912
|
break;
|
|
17842
17913
|
|
|
17843
|
-
case
|
|
17844
|
-
_context25.prev =
|
|
17845
|
-
_context25.t2 = _context25["catch"](
|
|
17914
|
+
case 46:
|
|
17915
|
+
_context25.prev = 46;
|
|
17916
|
+
_context25.t2 = _context25["catch"](34);
|
|
17846
17917
|
_iterator42.e(_context25.t2);
|
|
17847
17918
|
|
|
17848
|
-
case
|
|
17849
|
-
_context25.prev =
|
|
17919
|
+
case 49:
|
|
17920
|
+
_context25.prev = 49;
|
|
17850
17921
|
_iterator42.f();
|
|
17851
|
-
return _context25.finish(
|
|
17922
|
+
return _context25.finish(49);
|
|
17852
17923
|
|
|
17853
|
-
case
|
|
17924
|
+
case 52:
|
|
17854
17925
|
return _context25.abrupt("return", out);
|
|
17855
17926
|
|
|
17856
|
-
case
|
|
17857
|
-
_context25.prev =
|
|
17927
|
+
case 55:
|
|
17928
|
+
_context25.prev = 55;
|
|
17858
17929
|
_context25.t3 = _context25["catch"](0);
|
|
17859
17930
|
return _context25.abrupt("return", errorMessageHandler(_context25.t3, "EOA"));
|
|
17860
17931
|
|
|
17861
|
-
case
|
|
17932
|
+
case 58:
|
|
17862
17933
|
case "end":
|
|
17863
17934
|
return _context25.stop();
|
|
17864
17935
|
}
|
|
17865
|
-
}), _callee22, null, [ [ 0,
|
|
17936
|
+
}), _callee22, null, [ [ 0, 55 ], [ 9, 25, 28, 31 ], [ 34, 46, 49, 52 ] ]);
|
|
17866
17937
|
})));
|
|
17867
17938
|
return _EOA.apply(this, arguments);
|
|
17868
17939
|
}
|
|
@@ -17895,7 +17966,7 @@ function _typeof(o) {
|
|
|
17895
17966
|
}
|
|
17896
17967
|
function _SAFE() {
|
|
17897
17968
|
_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;
|
|
17969
|
+
var _argsToArray21, _argsToArray22, address, utility, chain, _argsToArray22$, limit, _argsToArray22$2, offset, apiKey, chainId, resolved, url, _getUrlAndHeaders0, finalUrl, HEADERS, res, json, _args27 = arguments;
|
|
17899
17970
|
return _regeneratorRuntime().wrap((function _callee24$(_context27) {
|
|
17900
17971
|
while (1) switch (_context27.prev = _context27.next) {
|
|
17901
17972
|
case 0:
|
|
@@ -17912,70 +17983,68 @@ function _typeof(o) {
|
|
|
17912
17983
|
offset: offset
|
|
17913
17984
|
});
|
|
17914
17985
|
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
17986
|
chainId = SAFE_CHAIN_MAP[chain];
|
|
17923
17987
|
if (chainId) {
|
|
17924
|
-
_context27.next =
|
|
17988
|
+
_context27.next = 7;
|
|
17925
17989
|
break;
|
|
17926
17990
|
}
|
|
17927
17991
|
throw new ValidationError("Invalid chain: ".concat(chain));
|
|
17928
17992
|
|
|
17929
|
-
case
|
|
17930
|
-
_context27.next =
|
|
17993
|
+
case 7:
|
|
17994
|
+
_context27.next = 9;
|
|
17931
17995
|
return fromEnsNameToAddress$1.validateAndGetAddress(address);
|
|
17932
17996
|
|
|
17933
|
-
case
|
|
17997
|
+
case 9:
|
|
17934
17998
|
resolved = _context27.sent;
|
|
17935
17999
|
url = "https://api.safe.global/tx-service/".concat(chainId, "/api/v2/safes/").concat(resolved, "/multisig-transactions?limit=").concat(limit, "&offset=").concat(offset);
|
|
17936
|
-
|
|
17937
|
-
|
|
18000
|
+
_getUrlAndHeaders0 = getUrlAndHeaders({
|
|
18001
|
+
url: url,
|
|
18002
|
+
serviceName: "Etherscan",
|
|
17938
18003
|
headers: {
|
|
17939
18004
|
Authorization: "Bearer ".concat(apiKey)
|
|
17940
18005
|
}
|
|
18006
|
+
}), finalUrl = _getUrlAndHeaders0.URL, HEADERS = _getUrlAndHeaders0.HEADERS;
|
|
18007
|
+
_context27.next = 14;
|
|
18008
|
+
return fetch(finalUrl, {
|
|
18009
|
+
headers: HEADERS
|
|
17941
18010
|
});
|
|
17942
18011
|
|
|
17943
|
-
case
|
|
18012
|
+
case 14:
|
|
17944
18013
|
res = _context27.sent;
|
|
17945
18014
|
if (res.ok) {
|
|
17946
|
-
_context27.next =
|
|
18015
|
+
_context27.next = 17;
|
|
17947
18016
|
break;
|
|
17948
18017
|
}
|
|
17949
18018
|
throw new NetworkError(SERVICES_API_KEY.Safe, res.status);
|
|
17950
18019
|
|
|
17951
|
-
case
|
|
17952
|
-
_context27.next =
|
|
18020
|
+
case 17:
|
|
18021
|
+
_context27.next = 19;
|
|
17953
18022
|
return res.json();
|
|
17954
18023
|
|
|
17955
|
-
case
|
|
18024
|
+
case 19:
|
|
17956
18025
|
json = _context27.sent;
|
|
17957
18026
|
if (Array.isArray(json.results)) {
|
|
17958
|
-
_context27.next =
|
|
18027
|
+
_context27.next = 22;
|
|
17959
18028
|
break;
|
|
17960
18029
|
}
|
|
17961
18030
|
throw new ValidationError("Invalid API response");
|
|
17962
18031
|
|
|
17963
|
-
case
|
|
17964
|
-
return _context27.abrupt("return", json.results.map((function(
|
|
17965
|
-
var confirmations =
|
|
18032
|
+
case 22:
|
|
18033
|
+
return _context27.abrupt("return", json.results.map((function(_ref17) {
|
|
18034
|
+
var confirmations = _ref17.confirmations, dataDecoded = _ref17.dataDecoded, rest = _objectWithoutProperties(_ref17, _excluded);
|
|
17966
18035
|
return rest;
|
|
17967
18036
|
})));
|
|
17968
18037
|
|
|
17969
|
-
case
|
|
17970
|
-
_context27.prev =
|
|
18038
|
+
case 25:
|
|
18039
|
+
_context27.prev = 25;
|
|
17971
18040
|
_context27.t0 = _context27["catch"](0);
|
|
17972
18041
|
return _context27.abrupt("return", errorMessageHandler(_context27.t0, "SAFE"));
|
|
17973
18042
|
|
|
17974
|
-
case
|
|
18043
|
+
case 28:
|
|
17975
18044
|
case "end":
|
|
17976
18045
|
return _context27.stop();
|
|
17977
18046
|
}
|
|
17978
|
-
}), _callee24, null, [ [ 0,
|
|
18047
|
+
}), _callee24, null, [ [ 0, 25 ] ]);
|
|
17979
18048
|
})));
|
|
17980
18049
|
return _SAFE.apply(this, arguments);
|
|
17981
18050
|
}
|
|
@@ -17995,55 +18064,48 @@ function _typeof(o) {
|
|
|
17995
18064
|
category: category
|
|
17996
18065
|
});
|
|
17997
18066
|
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
18067
|
url = CATEGORY_URLS[category];
|
|
18006
18068
|
if (url) {
|
|
18007
|
-
_context28.next =
|
|
18069
|
+
_context28.next = 7;
|
|
18008
18070
|
break;
|
|
18009
18071
|
}
|
|
18010
18072
|
throw new ValidationError("Invalid category: ".concat(category));
|
|
18011
18073
|
|
|
18012
|
-
case
|
|
18013
|
-
_context28.next =
|
|
18074
|
+
case 7:
|
|
18075
|
+
_context28.next = 9;
|
|
18014
18076
|
return fetch(url);
|
|
18015
18077
|
|
|
18016
|
-
case
|
|
18078
|
+
case 9:
|
|
18017
18079
|
res = _context28.sent;
|
|
18018
18080
|
if (res.ok) {
|
|
18019
|
-
_context28.next =
|
|
18081
|
+
_context28.next = 12;
|
|
18020
18082
|
break;
|
|
18021
18083
|
}
|
|
18022
18084
|
throw new NetworkError(SERVICES_API_KEY.Defillama, res.status);
|
|
18023
18085
|
|
|
18024
|
-
case
|
|
18025
|
-
_context28.next =
|
|
18086
|
+
case 12:
|
|
18087
|
+
_context28.next = 14;
|
|
18026
18088
|
return res.json();
|
|
18027
18089
|
|
|
18028
|
-
case
|
|
18090
|
+
case 14:
|
|
18029
18091
|
json = _context28.sent;
|
|
18030
18092
|
_context28.t0 = category;
|
|
18031
|
-
_context28.next = _context28.t0 === "protocols" ?
|
|
18093
|
+
_context28.next = _context28.t0 === "protocols" ? 18 : _context28.t0 === "yields" ? 20 : _context28.t0 === "dex" ? 22 : _context28.t0 === "fees" ? 22 : 24;
|
|
18032
18094
|
break;
|
|
18033
18095
|
|
|
18034
|
-
case
|
|
18096
|
+
case 18:
|
|
18035
18097
|
json = Array.isArray(json) ? json.slice(0, 500) : [];
|
|
18036
|
-
return _context28.abrupt("break",
|
|
18098
|
+
return _context28.abrupt("break", 24);
|
|
18037
18099
|
|
|
18038
|
-
case
|
|
18100
|
+
case 20:
|
|
18039
18101
|
json = Array.isArray(json.data) ? json.data.slice(0, 500) : [];
|
|
18040
|
-
return _context28.abrupt("break",
|
|
18102
|
+
return _context28.abrupt("break", 24);
|
|
18041
18103
|
|
|
18042
|
-
case
|
|
18104
|
+
case 22:
|
|
18043
18105
|
json = Array.isArray(json.protocols) ? json.protocols.slice(0, 500) : [];
|
|
18044
|
-
return _context28.abrupt("break",
|
|
18106
|
+
return _context28.abrupt("break", 24);
|
|
18045
18107
|
|
|
18046
|
-
case
|
|
18108
|
+
case 24:
|
|
18047
18109
|
return _context28.abrupt("return", (Array.isArray(json) ? json : [ json ]).map((function(item) {
|
|
18048
18110
|
var out = {};
|
|
18049
18111
|
for (var _i17 = 0, _Object$entries7 = Object.entries(item); _i17 < _Object$entries7.length; _i17++) {
|
|
@@ -18053,16 +18115,16 @@ function _typeof(o) {
|
|
|
18053
18115
|
return out;
|
|
18054
18116
|
})));
|
|
18055
18117
|
|
|
18056
|
-
case
|
|
18057
|
-
_context28.prev =
|
|
18118
|
+
case 27:
|
|
18119
|
+
_context28.prev = 27;
|
|
18058
18120
|
_context28.t1 = _context28["catch"](0);
|
|
18059
18121
|
return _context28.abrupt("return", errorMessageHandler(_context28.t1, "DEFILLAMA"));
|
|
18060
18122
|
|
|
18061
|
-
case
|
|
18123
|
+
case 30:
|
|
18062
18124
|
case "end":
|
|
18063
18125
|
return _context28.stop();
|
|
18064
18126
|
}
|
|
18065
|
-
}), _callee25, null, [ [ 0,
|
|
18127
|
+
}), _callee25, null, [ [ 0, 27 ] ]);
|
|
18066
18128
|
})));
|
|
18067
18129
|
return _DEFILLAMA.apply(this, arguments);
|
|
18068
18130
|
}
|
|
@@ -18110,8 +18172,8 @@ function _typeof(o) {
|
|
|
18110
18172
|
}
|
|
18111
18173
|
return _context29.abrupt("return", json.map((function(item) {
|
|
18112
18174
|
var flat = {};
|
|
18113
|
-
Object.entries(item).forEach((function(
|
|
18114
|
-
var
|
|
18175
|
+
Object.entries(item).forEach((function(_ref18) {
|
|
18176
|
+
var _ref19 = _slicedToArray(_ref18, 2), k = _ref19[0], v = _ref19[1];
|
|
18115
18177
|
if (v === null || _typeof(v) !== "object") flat[k] = v;
|
|
18116
18178
|
}));
|
|
18117
18179
|
return flat;
|
|
@@ -18177,8 +18239,8 @@ function _typeof(o) {
|
|
|
18177
18239
|
}
|
|
18178
18240
|
return _context30.abrupt("return", json.map((function(item) {
|
|
18179
18241
|
var flat = {};
|
|
18180
|
-
Object.entries(item).forEach((function(
|
|
18181
|
-
var
|
|
18242
|
+
Object.entries(item).forEach((function(_ref20) {
|
|
18243
|
+
var _ref21 = _slicedToArray(_ref20, 2), k = _ref21[0], v = _ref21[1];
|
|
18182
18244
|
if (v === null || _typeof(v) !== "object") flat[k] = v;
|
|
18183
18245
|
}));
|
|
18184
18246
|
return flat;
|