@fileverse-dev/formulajs 4.4.11-mod-34 → 4.4.11-mod-36
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 +281 -253
- package/lib/browser/formula.min.js +2 -2
- package/lib/browser/formula.min.js.map +1 -1
- package/lib/cjs/index.cjs +65 -26
- package/lib/esm/crypto-constants.mjs +28 -28
- package/lib/esm/index.mjs +65 -26
- package/package.json +1 -1
- package/types/cjs/index.d.cts +7 -13
- package/types/esm/index.d.mts +7 -13
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-36 */
|
|
2
2
|
var _excluded = [ "confirmations", "dataDecoded" ];
|
|
3
3
|
|
|
4
4
|
function _objectWithoutProperties(e, t) {
|
|
@@ -115,6 +115,10 @@ function _createForOfIteratorHelper(r, e) {
|
|
|
115
115
|
};
|
|
116
116
|
}
|
|
117
117
|
|
|
118
|
+
function _readOnlyError(r) {
|
|
119
|
+
throw new TypeError('"' + r + '" is read-only');
|
|
120
|
+
}
|
|
121
|
+
|
|
118
122
|
function _regeneratorRuntime() {
|
|
119
123
|
"use strict";
|
|
120
124
|
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() {
|
|
@@ -11211,26 +11215,24 @@ function _typeof(o) {
|
|
|
11211
11215
|
})));
|
|
11212
11216
|
return _handleScanRequest.apply(this, arguments);
|
|
11213
11217
|
}
|
|
11214
|
-
function FIREFLY(
|
|
11218
|
+
function FIREFLY() {
|
|
11215
11219
|
return _FIREFLY.apply(this, arguments);
|
|
11216
11220
|
}
|
|
11217
11221
|
function _FIREFLY() {
|
|
11218
|
-
_FIREFLY = _asyncToGenerator(_regeneratorRuntime().mark((function _callee4(
|
|
11222
|
+
_FIREFLY = _asyncToGenerator(_regeneratorRuntime().mark((function _callee4() {
|
|
11219
11223
|
var _typeMap$platform;
|
|
11220
|
-
var
|
|
11224
|
+
var API_KEY, baseUrl, headers, typeMap, _argsToArray3, _argsToArray4, platform, contentType, identifier, _argsToArray4$, start, _argsToArray4$2, end, platformType, query, url, res, json, _args4 = arguments;
|
|
11221
11225
|
return _regeneratorRuntime().wrap((function _callee4$(_context4) {
|
|
11222
11226
|
while (1) switch (_context4.prev = _context4.next) {
|
|
11223
11227
|
case 0:
|
|
11224
|
-
start = _args4.length > 3 && _args4[3] !== undefined ? _args4[3] : 0;
|
|
11225
|
-
end = _args4.length > 4 && _args4[4] !== undefined ? _args4[4] : 10;
|
|
11226
11228
|
API_KEY = window.localStorage.getItem(SERVICE_API_KEY.Firefly);
|
|
11227
11229
|
if (API_KEY) {
|
|
11228
|
-
_context4.next =
|
|
11230
|
+
_context4.next = 3;
|
|
11229
11231
|
break;
|
|
11230
11232
|
}
|
|
11231
11233
|
return _context4.abrupt("return", "".concat(SERVICE_API_KEY.Firefly).concat(ERROR_MESSAGES_FLAG.MISSING_KEY));
|
|
11232
11234
|
|
|
11233
|
-
case
|
|
11235
|
+
case 3:
|
|
11234
11236
|
baseUrl = "https://openapi.firefly.land/v1/fileverse/fetch";
|
|
11235
11237
|
headers = {
|
|
11236
11238
|
"x-api-key": API_KEY
|
|
@@ -11246,14 +11248,18 @@ function _typeof(o) {
|
|
|
11246
11248
|
replies: "lenspostid"
|
|
11247
11249
|
}
|
|
11248
11250
|
};
|
|
11251
|
+
_argsToArray3 = argsToArray(_args4), _argsToArray4 = _slicedToArray(_argsToArray3, 5),
|
|
11252
|
+
platform = _argsToArray4[0], contentType = _argsToArray4[1], identifier = _argsToArray4[2],
|
|
11253
|
+
_argsToArray4$ = _argsToArray4[3], start = _argsToArray4$ === void 0 ? 0 : _argsToArray4$,
|
|
11254
|
+
_argsToArray4$2 = _argsToArray4[4], end = _argsToArray4$2 === void 0 ? 10 : _argsToArray4$2;
|
|
11249
11255
|
platformType = (_typeMap$platform = typeMap[platform]) === null || _typeMap$platform === void 0 ? void 0 : _typeMap$platform[contentType];
|
|
11250
11256
|
if (platformType) {
|
|
11251
|
-
_context4.next =
|
|
11257
|
+
_context4.next = 10;
|
|
11252
11258
|
break;
|
|
11253
11259
|
}
|
|
11254
11260
|
return _context4.abrupt("return", "".concat(SERVICE_API_KEY.Firefly).concat(ERROR_MESSAGES_FLAG.INVALID_TYPE));
|
|
11255
11261
|
|
|
11256
|
-
case
|
|
11262
|
+
case 10:
|
|
11257
11263
|
query = identifier.split(",").map((function(s) {
|
|
11258
11264
|
return s.trim();
|
|
11259
11265
|
})).filter(Boolean).join(",");
|
|
@@ -11262,33 +11268,33 @@ function _typeof(o) {
|
|
|
11262
11268
|
url.searchParams.set("type", platformType);
|
|
11263
11269
|
url.searchParams.set("start", String(start));
|
|
11264
11270
|
url.searchParams.set("end", String(end));
|
|
11265
|
-
_context4.prev =
|
|
11266
|
-
_context4.next =
|
|
11271
|
+
_context4.prev = 16;
|
|
11272
|
+
_context4.next = 19;
|
|
11267
11273
|
return fetch(url.toString(), {
|
|
11268
11274
|
headers: headers
|
|
11269
11275
|
});
|
|
11270
11276
|
|
|
11271
|
-
case
|
|
11277
|
+
case 19:
|
|
11272
11278
|
res = _context4.sent;
|
|
11273
11279
|
if (res.ok) {
|
|
11274
|
-
_context4.next =
|
|
11280
|
+
_context4.next = 22;
|
|
11275
11281
|
break;
|
|
11276
11282
|
}
|
|
11277
11283
|
throw new Error("HTTP ".concat(res.status));
|
|
11278
11284
|
|
|
11279
|
-
case
|
|
11280
|
-
_context4.next =
|
|
11285
|
+
case 22:
|
|
11286
|
+
_context4.next = 24;
|
|
11281
11287
|
return res.json();
|
|
11282
11288
|
|
|
11283
|
-
case
|
|
11289
|
+
case 24:
|
|
11284
11290
|
json = _context4.sent;
|
|
11285
11291
|
if (Array.isArray(json === null || json === void 0 ? void 0 : json.data)) {
|
|
11286
|
-
_context4.next =
|
|
11292
|
+
_context4.next = 27;
|
|
11287
11293
|
break;
|
|
11288
11294
|
}
|
|
11289
11295
|
return _context4.abrupt("return", []);
|
|
11290
11296
|
|
|
11291
|
-
case
|
|
11297
|
+
case 27:
|
|
11292
11298
|
return _context4.abrupt("return", json.data.map((function(item) {
|
|
11293
11299
|
var flat = {};
|
|
11294
11300
|
for (var _i10 = 0, _Object$entries = Object.entries(item); _i10 < _Object$entries.length; _i10++) {
|
|
@@ -11301,31 +11307,31 @@ function _typeof(o) {
|
|
|
11301
11307
|
return flat;
|
|
11302
11308
|
})));
|
|
11303
11309
|
|
|
11304
|
-
case
|
|
11305
|
-
_context4.prev =
|
|
11306
|
-
_context4.t0 = _context4["catch"](
|
|
11310
|
+
case 30:
|
|
11311
|
+
_context4.prev = 30;
|
|
11312
|
+
_context4.t0 = _context4["catch"](16);
|
|
11307
11313
|
console.error("FIREFLY fetch error:", _context4.t0);
|
|
11308
11314
|
return _context4.abrupt("return", ERROR_MESSAGES_FLAG.DEFAULT);
|
|
11309
11315
|
|
|
11310
|
-
case
|
|
11316
|
+
case 34:
|
|
11311
11317
|
case "end":
|
|
11312
11318
|
return _context4.stop();
|
|
11313
11319
|
}
|
|
11314
|
-
}), _callee4, null, [ [
|
|
11320
|
+
}), _callee4, null, [ [ 16, 30 ] ]);
|
|
11315
11321
|
})));
|
|
11316
11322
|
return _FIREFLY.apply(this, arguments);
|
|
11317
11323
|
}
|
|
11318
|
-
function BLOCKSCOUT(
|
|
11324
|
+
function BLOCKSCOUT() {
|
|
11319
11325
|
return _BLOCKSCOUT.apply(this, arguments);
|
|
11320
11326
|
}
|
|
11321
11327
|
function _BLOCKSCOUT() {
|
|
11322
|
-
_BLOCKSCOUT = _asyncToGenerator(_regeneratorRuntime().mark((function _callee5(
|
|
11323
|
-
var currentTimestamp, hostname, requestUrl, _json$result, _json$result2, response, json;
|
|
11328
|
+
_BLOCKSCOUT = _asyncToGenerator(_regeneratorRuntime().mark((function _callee5() {
|
|
11329
|
+
var _argsToArray5, _argsToArray6, address, type, chain, startTimestamp, endTimestamp, page, offset, currentTimestamp, hostname, requestUrl, _json$result, _json$result2, response, json, _args5 = arguments;
|
|
11324
11330
|
return _regeneratorRuntime().wrap((function _callee5$(_context5) {
|
|
11325
11331
|
while (1) switch (_context5.prev = _context5.next) {
|
|
11326
11332
|
case 0:
|
|
11327
11333
|
if (!chain) {
|
|
11328
|
-
|
|
11334
|
+
"ethereum", _readOnlyError("chain");
|
|
11329
11335
|
}
|
|
11330
11336
|
if (type) {
|
|
11331
11337
|
_context5.next = 3;
|
|
@@ -11334,108 +11340,111 @@ function _typeof(o) {
|
|
|
11334
11340
|
return _context5.abrupt("return", "TYPE_MISSING");
|
|
11335
11341
|
|
|
11336
11342
|
case 3:
|
|
11343
|
+
_argsToArray5 = argsToArray(_args5), _argsToArray6 = _slicedToArray(_argsToArray5, 7),
|
|
11344
|
+
address = _argsToArray6[0], type = _argsToArray6[1], chain = _argsToArray6[2], startTimestamp = _argsToArray6[3],
|
|
11345
|
+
endTimestamp = _argsToArray6[4], page = _argsToArray6[5], offset = _argsToArray6[6];
|
|
11337
11346
|
if (!startTimestamp) {
|
|
11338
11347
|
currentTimestamp = Date.now();
|
|
11339
|
-
|
|
11340
|
-
|
|
11348
|
+
currentTimestamp - 30 * 24 * 60 * 60 * 1e3, _readOnlyError("startTimestamp");
|
|
11349
|
+
Math.floor(startTimestamp / 1e3), _readOnlyError("startTimestamp");
|
|
11341
11350
|
}
|
|
11342
11351
|
if (isNaN(startTimestamp)) {
|
|
11343
|
-
startTimestamp
|
|
11352
|
+
toTimestamp(startTimestamp), _readOnlyError("startTimestamp");
|
|
11344
11353
|
}
|
|
11345
11354
|
if (isNaN(endTimestamp) && endTimestamp) {
|
|
11346
|
-
endTimestamp
|
|
11355
|
+
toTimestamp(endTimestamp), _readOnlyError("endTimestamp");
|
|
11347
11356
|
}
|
|
11348
11357
|
if (isAddress(address)) {
|
|
11349
|
-
_context5.next =
|
|
11358
|
+
_context5.next = 11;
|
|
11350
11359
|
break;
|
|
11351
11360
|
}
|
|
11352
|
-
_context5.next =
|
|
11361
|
+
_context5.next = 10;
|
|
11353
11362
|
return fromEnsNameToAddress(address);
|
|
11354
11363
|
|
|
11355
|
-
case 9:
|
|
11356
|
-
address = _context5.sent;
|
|
11357
|
-
|
|
11358
11364
|
case 10:
|
|
11365
|
+
_readOnlyError("address");
|
|
11366
|
+
|
|
11367
|
+
case 11:
|
|
11359
11368
|
if (address) {
|
|
11360
|
-
_context5.next =
|
|
11369
|
+
_context5.next = 13;
|
|
11361
11370
|
break;
|
|
11362
11371
|
}
|
|
11363
11372
|
return _context5.abrupt("return", "".concat(address).concat(ERROR_MESSAGES_FLAG.INVALID_PARAM));
|
|
11364
11373
|
|
|
11365
|
-
case
|
|
11374
|
+
case 13:
|
|
11366
11375
|
hostname = BLOCKSCOUT_CHAINS_MAP[chain];
|
|
11367
11376
|
_context5.t0 = type;
|
|
11368
|
-
_context5.next = _context5.t0 === "stat" ?
|
|
11377
|
+
_context5.next = _context5.t0 === "stat" ? 17 : _context5.t0 === "txns" ? 19 : _context5.t0 === "tokens" ? 21 : 23;
|
|
11369
11378
|
break;
|
|
11370
11379
|
|
|
11371
|
-
case
|
|
11380
|
+
case 17:
|
|
11372
11381
|
requestUrl = "".concat(hostname, "/api/v2/addresses/").concat(address, "/counters");
|
|
11373
|
-
return _context5.abrupt("break",
|
|
11382
|
+
return _context5.abrupt("break", 24);
|
|
11374
11383
|
|
|
11375
|
-
case
|
|
11384
|
+
case 19:
|
|
11376
11385
|
requestUrl = "".concat(hostname, "/api?module=account&action=txlist&address=").concat(address, "&start_timestamp=").concat(startTimestamp, "&end_timestamp=").concat(endTimestamp, "&page=").concat(page, "&offset=").concat(offset, "&sort=asc");
|
|
11377
|
-
return _context5.abrupt("break",
|
|
11386
|
+
return _context5.abrupt("break", 24);
|
|
11378
11387
|
|
|
11379
|
-
case
|
|
11388
|
+
case 21:
|
|
11380
11389
|
requestUrl = "".concat(hostname, "/api?module=account&action=tokenlist&address=").concat(address);
|
|
11381
|
-
return _context5.abrupt("break",
|
|
11390
|
+
return _context5.abrupt("break", 24);
|
|
11382
11391
|
|
|
11383
|
-
case
|
|
11392
|
+
case 23:
|
|
11384
11393
|
return _context5.abrupt("return", "INVALID_TYPE");
|
|
11385
11394
|
|
|
11386
|
-
case
|
|
11387
|
-
_context5.prev =
|
|
11388
|
-
_context5.next =
|
|
11395
|
+
case 24:
|
|
11396
|
+
_context5.prev = 24;
|
|
11397
|
+
_context5.next = 27;
|
|
11389
11398
|
return fetch(requestUrl);
|
|
11390
11399
|
|
|
11391
|
-
case
|
|
11400
|
+
case 27:
|
|
11392
11401
|
response = _context5.sent;
|
|
11393
11402
|
if (response.ok) {
|
|
11394
|
-
_context5.next =
|
|
11403
|
+
_context5.next = 30;
|
|
11395
11404
|
break;
|
|
11396
11405
|
}
|
|
11397
11406
|
throw new Error("HTTP error! Status: ".concat(response.status));
|
|
11398
11407
|
|
|
11399
|
-
case
|
|
11400
|
-
_context5.next =
|
|
11408
|
+
case 30:
|
|
11409
|
+
_context5.next = 32;
|
|
11401
11410
|
return response.json();
|
|
11402
11411
|
|
|
11403
|
-
case
|
|
11412
|
+
case 32:
|
|
11404
11413
|
json = _context5.sent;
|
|
11405
11414
|
console.log(json);
|
|
11406
11415
|
if (!(json !== null && json !== void 0 && (_json$result = json.result) !== null && _json$result !== void 0 && _json$result.includes("Invalid parameter(s)"))) {
|
|
11407
|
-
_context5.next =
|
|
11416
|
+
_context5.next = 36;
|
|
11408
11417
|
break;
|
|
11409
11418
|
}
|
|
11410
11419
|
return _context5.abrupt("return", "INVALID_REQUEST_PARAMS");
|
|
11411
11420
|
|
|
11412
|
-
case
|
|
11421
|
+
case 36:
|
|
11413
11422
|
if (!(json !== null && json !== void 0 && (_json$result2 = json.result) !== null && _json$result2 !== void 0 && _json$result2.includes("Not found"))) {
|
|
11414
|
-
_context5.next =
|
|
11423
|
+
_context5.next = 38;
|
|
11415
11424
|
break;
|
|
11416
11425
|
}
|
|
11417
11426
|
return _context5.abrupt("return", "ADDRESS_NOT_FOUND");
|
|
11418
11427
|
|
|
11419
|
-
case
|
|
11428
|
+
case 38:
|
|
11420
11429
|
if (!(type === "stat")) {
|
|
11421
|
-
_context5.next =
|
|
11430
|
+
_context5.next = 40;
|
|
11422
11431
|
break;
|
|
11423
11432
|
}
|
|
11424
11433
|
return _context5.abrupt("return", [ json ]);
|
|
11425
11434
|
|
|
11426
|
-
case
|
|
11435
|
+
case 40:
|
|
11427
11436
|
return _context5.abrupt("return", json.result);
|
|
11428
11437
|
|
|
11429
|
-
case
|
|
11430
|
-
_context5.prev =
|
|
11431
|
-
_context5.t1 = _context5["catch"](
|
|
11438
|
+
case 43:
|
|
11439
|
+
_context5.prev = 43;
|
|
11440
|
+
_context5.t1 = _context5["catch"](24);
|
|
11432
11441
|
return _context5.abrupt("return", "ERROR IN FETCHING");
|
|
11433
11442
|
|
|
11434
|
-
case
|
|
11443
|
+
case 46:
|
|
11435
11444
|
case "end":
|
|
11436
11445
|
return _context5.stop();
|
|
11437
11446
|
}
|
|
11438
|
-
}), _callee5, null, [ [
|
|
11447
|
+
}), _callee5, null, [ [ 24, 43 ] ]);
|
|
11439
11448
|
})));
|
|
11440
11449
|
return _BLOCKSCOUT.apply(this, arguments);
|
|
11441
11450
|
}
|
|
@@ -11444,15 +11453,13 @@ function _typeof(o) {
|
|
|
11444
11453
|
}
|
|
11445
11454
|
function _BASESCAN() {
|
|
11446
11455
|
_BASESCAN = _asyncToGenerator(_regeneratorRuntime().mark((function _callee6() {
|
|
11447
|
-
var
|
|
11456
|
+
var _argsToArray7, _argsToArray8, type, chain, address, startDate, endDate, page, limit, _args6 = arguments;
|
|
11448
11457
|
return _regeneratorRuntime().wrap((function _callee6$(_context6) {
|
|
11449
11458
|
while (1) switch (_context6.prev = _context6.next) {
|
|
11450
11459
|
case 0:
|
|
11451
|
-
|
|
11452
|
-
|
|
11453
|
-
|
|
11454
|
-
type = args[0], chain = args[1], address = args[2], startDate = args[3], endDate = args[4],
|
|
11455
|
-
page = args[5], limit = args[6];
|
|
11460
|
+
_argsToArray7 = argsToArray(_args6), _argsToArray8 = _slicedToArray(_argsToArray7, 7),
|
|
11461
|
+
type = _argsToArray8[0], chain = _argsToArray8[1], address = _argsToArray8[2], startDate = _argsToArray8[3],
|
|
11462
|
+
endDate = _argsToArray8[4], page = _argsToArray8[5], limit = _argsToArray8[6];
|
|
11456
11463
|
return _context6.abrupt("return", handleScanRequest({
|
|
11457
11464
|
scanKey: SERVICE_API_KEY.Basescan,
|
|
11458
11465
|
baseUrl: "https://api.basescan.org/api",
|
|
@@ -11465,7 +11472,7 @@ function _typeof(o) {
|
|
|
11465
11472
|
offset: limit
|
|
11466
11473
|
}));
|
|
11467
11474
|
|
|
11468
|
-
case
|
|
11475
|
+
case 2:
|
|
11469
11476
|
case "end":
|
|
11470
11477
|
return _context6.stop();
|
|
11471
11478
|
}
|
|
@@ -11478,15 +11485,13 @@ function _typeof(o) {
|
|
|
11478
11485
|
}
|
|
11479
11486
|
function _GNOSISSCAN() {
|
|
11480
11487
|
_GNOSISSCAN = _asyncToGenerator(_regeneratorRuntime().mark((function _callee7() {
|
|
11481
|
-
var
|
|
11488
|
+
var _argsToArray9, _argsToArray0, type, chain, address, startDate, endDate, page, limit, _args7 = arguments;
|
|
11482
11489
|
return _regeneratorRuntime().wrap((function _callee7$(_context7) {
|
|
11483
11490
|
while (1) switch (_context7.prev = _context7.next) {
|
|
11484
11491
|
case 0:
|
|
11485
|
-
|
|
11486
|
-
|
|
11487
|
-
|
|
11488
|
-
type = args[0], chain = args[1], address = args[2], startDate = args[3], endDate = args[4],
|
|
11489
|
-
page = args[5], limit = args[6];
|
|
11492
|
+
_argsToArray9 = argsToArray(_args7), _argsToArray0 = _slicedToArray(_argsToArray9, 7),
|
|
11493
|
+
type = _argsToArray0[0], chain = _argsToArray0[1], address = _argsToArray0[2], startDate = _argsToArray0[3],
|
|
11494
|
+
endDate = _argsToArray0[4], page = _argsToArray0[5], limit = _argsToArray0[6];
|
|
11490
11495
|
return _context7.abrupt("return", handleScanRequest({
|
|
11491
11496
|
scanKey: SERVICE_API_KEY.Gnosisscan,
|
|
11492
11497
|
baseUrl: "https://api.gnosisscan.io/api",
|
|
@@ -11499,7 +11504,7 @@ function _typeof(o) {
|
|
|
11499
11504
|
offset: limit
|
|
11500
11505
|
}));
|
|
11501
11506
|
|
|
11502
|
-
case
|
|
11507
|
+
case 2:
|
|
11503
11508
|
case "end":
|
|
11504
11509
|
return _context7.stop();
|
|
11505
11510
|
}
|
|
@@ -11507,12 +11512,12 @@ function _typeof(o) {
|
|
|
11507
11512
|
})));
|
|
11508
11513
|
return _GNOSISSCAN.apply(this, arguments);
|
|
11509
11514
|
}
|
|
11510
|
-
function NEYNAR(
|
|
11515
|
+
function NEYNAR() {
|
|
11511
11516
|
return _NEYNAR.apply(this, arguments);
|
|
11512
11517
|
}
|
|
11513
11518
|
function _NEYNAR() {
|
|
11514
|
-
_NEYNAR = _asyncToGenerator(_regeneratorRuntime().mark((function _callee8(
|
|
11515
|
-
var API_KEY, url, _json$users, response, json;
|
|
11519
|
+
_NEYNAR = _asyncToGenerator(_regeneratorRuntime().mark((function _callee8() {
|
|
11520
|
+
var API_KEY, _argsToArray1, _argsToArray10, fid, viewerFid, sortType, limit, cursor, url, _json$users, response, json, _args8 = arguments;
|
|
11516
11521
|
return _regeneratorRuntime().wrap((function _callee8$(_context8) {
|
|
11517
11522
|
while (1) switch (_context8.prev = _context8.next) {
|
|
11518
11523
|
case 0:
|
|
@@ -11524,14 +11529,17 @@ function _typeof(o) {
|
|
|
11524
11529
|
return _context8.abrupt("return", "".concat(SERVICE_API_KEY.Neynar).concat(ERROR_MESSAGES_FLAG.MISSING_KEY));
|
|
11525
11530
|
|
|
11526
11531
|
case 3:
|
|
11532
|
+
_argsToArray1 = argsToArray(_args8), _argsToArray10 = _slicedToArray(_argsToArray1, 5),
|
|
11533
|
+
fid = _argsToArray10[0], viewerFid = _argsToArray10[1], sortType = _argsToArray10[2],
|
|
11534
|
+
limit = _argsToArray10[3], cursor = _argsToArray10[4];
|
|
11527
11535
|
url = new URL("https://api.neynar.com/v2/farcaster/followers");
|
|
11528
11536
|
url.searchParams.set("fid", fid.toString());
|
|
11529
11537
|
url.searchParams.set("sort_type", sortType);
|
|
11530
11538
|
url.searchParams.set("limit", limit.toString());
|
|
11531
11539
|
if (viewerFid !== null) url.searchParams.set("viewer_fid", viewerFid.toString());
|
|
11532
11540
|
if (cursor) url.searchParams.set("cursor", cursor);
|
|
11533
|
-
_context8.prev =
|
|
11534
|
-
_context8.next =
|
|
11541
|
+
_context8.prev = 10;
|
|
11542
|
+
_context8.next = 13;
|
|
11535
11543
|
return fetch(url.toString(), {
|
|
11536
11544
|
headers: {
|
|
11537
11545
|
"x-api-key": API_KEY,
|
|
@@ -11539,30 +11547,30 @@ function _typeof(o) {
|
|
|
11539
11547
|
}
|
|
11540
11548
|
});
|
|
11541
11549
|
|
|
11542
|
-
case
|
|
11550
|
+
case 13:
|
|
11543
11551
|
response = _context8.sent;
|
|
11544
11552
|
if (response.ok) {
|
|
11545
|
-
_context8.next =
|
|
11553
|
+
_context8.next = 16;
|
|
11546
11554
|
break;
|
|
11547
11555
|
}
|
|
11548
11556
|
throw new Error("HTTP ".concat(response.status));
|
|
11549
11557
|
|
|
11550
|
-
case
|
|
11551
|
-
_context8.next =
|
|
11558
|
+
case 16:
|
|
11559
|
+
_context8.next = 18;
|
|
11552
11560
|
return response.json();
|
|
11553
11561
|
|
|
11554
|
-
case
|
|
11562
|
+
case 18:
|
|
11555
11563
|
json = _context8.sent;
|
|
11556
11564
|
if (json !== null && json !== void 0 && (_json$users = json.users) !== null && _json$users !== void 0 && _json$users.length) {
|
|
11557
|
-
_context8.next =
|
|
11565
|
+
_context8.next = 21;
|
|
11558
11566
|
break;
|
|
11559
11567
|
}
|
|
11560
11568
|
return _context8.abrupt("return", []);
|
|
11561
11569
|
|
|
11562
|
-
case
|
|
11563
|
-
return _context8.abrupt("return", json.users.map((function(
|
|
11570
|
+
case 21:
|
|
11571
|
+
return _context8.abrupt("return", json.users.map((function(_ref3) {
|
|
11564
11572
|
var _user$profile, _user$profile2;
|
|
11565
|
-
var user =
|
|
11573
|
+
var user = _ref3.user;
|
|
11566
11574
|
return {
|
|
11567
11575
|
username: user.username,
|
|
11568
11576
|
custody_address: user.custody_address,
|
|
@@ -11572,48 +11580,49 @@ function _typeof(o) {
|
|
|
11572
11580
|
};
|
|
11573
11581
|
})));
|
|
11574
11582
|
|
|
11575
|
-
case
|
|
11576
|
-
_context8.prev =
|
|
11577
|
-
_context8.t0 = _context8["catch"](
|
|
11583
|
+
case 24:
|
|
11584
|
+
_context8.prev = 24;
|
|
11585
|
+
_context8.t0 = _context8["catch"](10);
|
|
11578
11586
|
console.error("NEYNAR_FETCH_FOLLOWERS error:", _context8.t0);
|
|
11579
11587
|
return _context8.abrupt("return", ERROR_MESSAGES_FLAG.DEFAULT);
|
|
11580
11588
|
|
|
11581
|
-
case
|
|
11589
|
+
case 28:
|
|
11582
11590
|
case "end":
|
|
11583
11591
|
return _context8.stop();
|
|
11584
11592
|
}
|
|
11585
|
-
}), _callee8, null, [ [
|
|
11593
|
+
}), _callee8, null, [ [ 10, 24 ] ]);
|
|
11586
11594
|
})));
|
|
11587
11595
|
return _NEYNAR.apply(this, arguments);
|
|
11588
11596
|
}
|
|
11589
|
-
function GNOSISPAY(
|
|
11597
|
+
function GNOSISPAY() {
|
|
11590
11598
|
return _GNOSISPAY.apply(this, arguments);
|
|
11591
11599
|
}
|
|
11592
11600
|
function _GNOSISPAY() {
|
|
11593
|
-
_GNOSISPAY = _asyncToGenerator(_regeneratorRuntime().mark((function _callee9(
|
|
11594
|
-
var cardId, startDate, endDate,
|
|
11601
|
+
_GNOSISPAY = _asyncToGenerator(_regeneratorRuntime().mark((function _callee9() {
|
|
11602
|
+
var apiKeyKey, API_KEY, _argsToArray11, _argsToArray12, cardId, startDate, endDate, _argsToArray12$, limit, _argsToArray12$2, offset, url, res, json, _args9 = arguments;
|
|
11595
11603
|
return _regeneratorRuntime().wrap((function _callee9$(_context9) {
|
|
11596
11604
|
while (1) switch (_context9.prev = _context9.next) {
|
|
11597
11605
|
case 0:
|
|
11598
|
-
cardId = _ref3.cardId, startDate = _ref3.startDate, endDate = _ref3.endDate, _ref3$limit = _ref3.limit,
|
|
11599
|
-
limit = _ref3$limit === void 0 ? 20 : _ref3$limit, _ref3$offset = _ref3.offset,
|
|
11600
|
-
offset = _ref3$offset === void 0 ? 0 : _ref3$offset;
|
|
11601
11606
|
apiKeyKey = SERVICE_API_KEY.GnosisPay;
|
|
11602
11607
|
API_KEY = window.localStorage.getItem(apiKeyKey);
|
|
11603
11608
|
if (API_KEY) {
|
|
11604
|
-
_context9.next =
|
|
11609
|
+
_context9.next = 4;
|
|
11605
11610
|
break;
|
|
11606
11611
|
}
|
|
11607
11612
|
return _context9.abrupt("return", "".concat(apiKeyKey).concat(ERROR_MESSAGES_FLAG.MISSING_KEY));
|
|
11608
11613
|
|
|
11609
|
-
case
|
|
11614
|
+
case 4:
|
|
11610
11615
|
if (cardId) {
|
|
11611
|
-
_context9.next =
|
|
11616
|
+
_context9.next = 6;
|
|
11612
11617
|
break;
|
|
11613
11618
|
}
|
|
11614
11619
|
return _context9.abrupt("return", "".concat(apiKeyKey).concat(ERROR_MESSAGES_FLAG.INVALID_PARAM));
|
|
11615
11620
|
|
|
11616
|
-
case
|
|
11621
|
+
case 6:
|
|
11622
|
+
_argsToArray11 = argsToArray(_args9), _argsToArray12 = _slicedToArray(_argsToArray11, 5),
|
|
11623
|
+
cardId = _argsToArray12[0], startDate = _argsToArray12[1], endDate = _argsToArray12[2],
|
|
11624
|
+
_argsToArray12$ = _argsToArray12[3], limit = _argsToArray12$ === void 0 ? 20 : _argsToArray12$,
|
|
11625
|
+
_argsToArray12$2 = _argsToArray12[4], offset = _argsToArray12$2 === void 0 ? 0 : _argsToArray12$2;
|
|
11617
11626
|
url = new URL("https://api.gnosispay.com/cards/".concat(cardId, "/transactions"));
|
|
11618
11627
|
url.searchParams.set("limit", limit.toString());
|
|
11619
11628
|
url.searchParams.set("offset", offset.toString());
|
|
@@ -11689,15 +11698,14 @@ function _typeof(o) {
|
|
|
11689
11698
|
}
|
|
11690
11699
|
function _ETHERSCAN() {
|
|
11691
11700
|
_ETHERSCAN = _asyncToGenerator(_regeneratorRuntime().mark((function _callee0() {
|
|
11692
|
-
var
|
|
11701
|
+
var _argsToArray13, _argsToArray14, type, chain, address, startDate, endDate, page, limit, _args0 = arguments;
|
|
11693
11702
|
return _regeneratorRuntime().wrap((function _callee0$(_context0) {
|
|
11694
11703
|
while (1) switch (_context0.prev = _context0.next) {
|
|
11695
11704
|
case 0:
|
|
11696
|
-
|
|
11697
|
-
|
|
11698
|
-
|
|
11699
|
-
|
|
11700
|
-
page = args[5], limit = args[6];
|
|
11705
|
+
_argsToArray13 = argsToArray(_args0), _argsToArray14 = _slicedToArray(_argsToArray13, 7),
|
|
11706
|
+
type = _argsToArray14[0], chain = _argsToArray14[1], address = _argsToArray14[2],
|
|
11707
|
+
startDate = _argsToArray14[3], endDate = _argsToArray14[4], page = _argsToArray14[5],
|
|
11708
|
+
limit = _argsToArray14[6];
|
|
11701
11709
|
return _context0.abrupt("return", handleScanRequest({
|
|
11702
11710
|
scanKey: SERVICE_API_KEY.Etherscan,
|
|
11703
11711
|
baseUrl: "https://api.etherscan.io/v2/api",
|
|
@@ -11710,7 +11718,7 @@ function _typeof(o) {
|
|
|
11710
11718
|
offset: limit
|
|
11711
11719
|
}));
|
|
11712
11720
|
|
|
11713
|
-
case
|
|
11721
|
+
case 2:
|
|
11714
11722
|
case "end":
|
|
11715
11723
|
return _context0.stop();
|
|
11716
11724
|
}
|
|
@@ -11718,49 +11726,51 @@ function _typeof(o) {
|
|
|
11718
11726
|
})));
|
|
11719
11727
|
return _ETHERSCAN.apply(this, arguments);
|
|
11720
11728
|
}
|
|
11721
|
-
function COINGECKO(
|
|
11729
|
+
function COINGECKO() {
|
|
11722
11730
|
return _COINGECKO.apply(this, arguments);
|
|
11723
11731
|
}
|
|
11724
11732
|
function _COINGECKO() {
|
|
11725
|
-
_COINGECKO = _asyncToGenerator(_regeneratorRuntime().mark((function _callee1(
|
|
11726
|
-
var
|
|
11733
|
+
_COINGECKO = _asyncToGenerator(_regeneratorRuntime().mark((function _callee1() {
|
|
11734
|
+
var API_KEY, headers, url, _argsToArray15, _argsToArray16, category, param1, param2, _argsToArray16$, page, _argsToArray16$2, perPage, lowerCategory, token, vsCurrencies, ecosystemMap, key, categoryVal, trend, _category, _trend, exchange, response, json, _json$status, message, output, _i11, _Object$entries2, _Object$entries2$_i, _token, prices, _i12, _Object$entries3, _Object$entries3$_i, currency, _value6, _key2, flatArray, _args1 = arguments;
|
|
11727
11735
|
return _regeneratorRuntime().wrap((function _callee1$(_context1) {
|
|
11728
11736
|
while (1) switch (_context1.prev = _context1.next) {
|
|
11729
11737
|
case 0:
|
|
11730
|
-
page = _args1.length > 3 && _args1[3] !== undefined ? _args1[3] : 1;
|
|
11731
|
-
perPage = _args1.length > 4 && _args1[4] !== undefined ? _args1[4] : 2;
|
|
11732
11738
|
API_KEY = window.localStorage.getItem(SERVICE_API_KEY.Coingecko);
|
|
11733
11739
|
if (API_KEY) {
|
|
11734
|
-
_context1.next =
|
|
11740
|
+
_context1.next = 3;
|
|
11735
11741
|
break;
|
|
11736
11742
|
}
|
|
11737
11743
|
return _context1.abrupt("return", "".concat(SERVICE_API_KEY.Coingecko).concat(ERROR_MESSAGES_FLAG.MISSING_KEY));
|
|
11738
11744
|
|
|
11739
|
-
case
|
|
11745
|
+
case 3:
|
|
11740
11746
|
headers = {
|
|
11741
11747
|
accept: "application/json",
|
|
11742
11748
|
"x-cg-demo-api-key": API_KEY
|
|
11743
11749
|
};
|
|
11744
11750
|
url = "";
|
|
11751
|
+
_argsToArray15 = argsToArray(_args1), _argsToArray16 = _slicedToArray(_argsToArray15, 5),
|
|
11752
|
+
category = _argsToArray16[0], param1 = _argsToArray16[1], param2 = _argsToArray16[2],
|
|
11753
|
+
_argsToArray16$ = _argsToArray16[3], page = _argsToArray16$ === void 0 ? 1 : _argsToArray16$,
|
|
11754
|
+
_argsToArray16$2 = _argsToArray16[4], perPage = _argsToArray16$2 === void 0 ? 2 : _argsToArray16$2;
|
|
11745
11755
|
lowerCategory = (category || "").toLowerCase();
|
|
11746
11756
|
_context1.t0 = lowerCategory;
|
|
11747
|
-
_context1.next = _context1.t0 === "price" ?
|
|
11757
|
+
_context1.next = _context1.t0 === "price" ? 10 : _context1.t0 === "market" ? 16 : _context1.t0 === "stablecoins" ? 26 : _context1.t0 === "derivatives" ? 30 : 33;
|
|
11748
11758
|
break;
|
|
11749
11759
|
|
|
11750
|
-
case
|
|
11760
|
+
case 10:
|
|
11751
11761
|
token = param1;
|
|
11752
11762
|
vsCurrencies = param2;
|
|
11753
11763
|
if (!(!token || !vsCurrencies)) {
|
|
11754
|
-
_context1.next =
|
|
11764
|
+
_context1.next = 14;
|
|
11755
11765
|
break;
|
|
11756
11766
|
}
|
|
11757
11767
|
return _context1.abrupt("return", "".concat(SERVICE_API_KEY.Coingecko).concat(ERROR_MESSAGES_FLAG.INVALID_PARAM));
|
|
11758
11768
|
|
|
11759
|
-
case
|
|
11769
|
+
case 14:
|
|
11760
11770
|
url = "https://api.coingecko.com/api/v3/simple/price?vs_currencies=".concat(vsCurrencies, "&ids=").concat(token);
|
|
11761
|
-
return _context1.abrupt("break",
|
|
11771
|
+
return _context1.abrupt("break", 34);
|
|
11762
11772
|
|
|
11763
|
-
case
|
|
11773
|
+
case 16:
|
|
11764
11774
|
ecosystemMap = {
|
|
11765
11775
|
eth: "ethereum-ecosystem",
|
|
11766
11776
|
base: "base-ecosystem",
|
|
@@ -11777,70 +11787,70 @@ function _typeof(o) {
|
|
|
11777
11787
|
trend = param2 ? "&price_change_percentage=".concat(param2) : "";
|
|
11778
11788
|
url = "https://api.coingecko.com/api/v3/coins/markets?vs_currency=usd&include_tokens=top&page=".concat(page, "&per_page=").concat(perPage);
|
|
11779
11789
|
if (!(key && !categoryVal)) {
|
|
11780
|
-
_context1.next =
|
|
11790
|
+
_context1.next = 23;
|
|
11781
11791
|
break;
|
|
11782
11792
|
}
|
|
11783
11793
|
return _context1.abrupt("return", "".concat(SERVICE_API_KEY.Coingecko).concat(ERROR_MESSAGES_FLAG.INVALID_PARAM));
|
|
11784
11794
|
|
|
11785
|
-
case
|
|
11795
|
+
case 23:
|
|
11786
11796
|
if (categoryVal) url += "&category=".concat(categoryVal);
|
|
11787
11797
|
if (trend) url += trend;
|
|
11788
|
-
return _context1.abrupt("break",
|
|
11798
|
+
return _context1.abrupt("break", 34);
|
|
11789
11799
|
|
|
11790
|
-
case
|
|
11800
|
+
case 26:
|
|
11791
11801
|
_category = !param1 || param1.toLowerCase() === "all" ? "stablecoins" : param1.toLowerCase();
|
|
11792
11802
|
_trend = param2 ? "&price_change_percentage=".concat(param2) : "";
|
|
11793
11803
|
url = "https://api.coingecko.com/api/v3/coins/markets?vs_currency=usd&category=".concat(_category, "&order=market_cap_desc&page=").concat(page, "&per_page=").concat(perPage).concat(_trend);
|
|
11794
|
-
return _context1.abrupt("break",
|
|
11804
|
+
return _context1.abrupt("break", 34);
|
|
11795
11805
|
|
|
11796
|
-
case
|
|
11806
|
+
case 30:
|
|
11797
11807
|
exchange = param1;
|
|
11798
11808
|
if (exchange) {
|
|
11799
11809
|
url = "https://api.coingecko.com/api/v3/derivatives/exchanges/".concat(exchange, "?include_tickers=all");
|
|
11800
11810
|
} else {
|
|
11801
11811
|
url = "https://api.coingecko.com/api/v3/derivatives?page=".concat(page, "&per_page=").concat(perPage);
|
|
11802
11812
|
}
|
|
11803
|
-
return _context1.abrupt("break",
|
|
11813
|
+
return _context1.abrupt("break", 34);
|
|
11804
11814
|
|
|
11805
|
-
case
|
|
11815
|
+
case 33:
|
|
11806
11816
|
return _context1.abrupt("return", "".concat(SERVICE_API_KEY.Coingecko).concat(ERROR_MESSAGES_FLAG.INVALID_PARAMS));
|
|
11807
11817
|
|
|
11808
|
-
case
|
|
11809
|
-
_context1.prev =
|
|
11810
|
-
_context1.next =
|
|
11818
|
+
case 34:
|
|
11819
|
+
_context1.prev = 34;
|
|
11820
|
+
_context1.next = 37;
|
|
11811
11821
|
return fetch(url, {
|
|
11812
11822
|
method: "GET",
|
|
11813
11823
|
headers: headers
|
|
11814
11824
|
});
|
|
11815
11825
|
|
|
11816
|
-
case
|
|
11826
|
+
case 37:
|
|
11817
11827
|
response = _context1.sent;
|
|
11818
|
-
_context1.next =
|
|
11828
|
+
_context1.next = 40;
|
|
11819
11829
|
return response.json();
|
|
11820
11830
|
|
|
11821
|
-
case
|
|
11831
|
+
case 40:
|
|
11822
11832
|
json = _context1.sent;
|
|
11823
11833
|
if (response.ok) {
|
|
11824
|
-
_context1.next =
|
|
11834
|
+
_context1.next = 47;
|
|
11825
11835
|
break;
|
|
11826
11836
|
}
|
|
11827
11837
|
message = (json === null || json === void 0 || (_json$status = json.status) === null || _json$status === void 0 ? void 0 : _json$status.error_message) || "";
|
|
11828
11838
|
if (!message.includes("API Key Missing")) {
|
|
11829
|
-
_context1.next =
|
|
11839
|
+
_context1.next = 45;
|
|
11830
11840
|
break;
|
|
11831
11841
|
}
|
|
11832
11842
|
return _context1.abrupt("return", "".concat(SERVICE_API_KEY.Coingecko).concat(ERROR_MESSAGES_FLAG.INVALID_API_KEY));
|
|
11833
11843
|
|
|
11834
|
-
case
|
|
11844
|
+
case 45:
|
|
11835
11845
|
if (!(response.status === 429)) {
|
|
11836
|
-
_context1.next =
|
|
11846
|
+
_context1.next = 47;
|
|
11837
11847
|
break;
|
|
11838
11848
|
}
|
|
11839
11849
|
return _context1.abrupt("return", "".concat(SERVICE_API_KEY.Coingecko).concat(ERROR_MESSAGES_FLAG.RATE_LIMIT));
|
|
11840
11850
|
|
|
11841
|
-
case
|
|
11851
|
+
case 47:
|
|
11842
11852
|
if (!(lowerCategory === "price")) {
|
|
11843
|
-
_context1.next =
|
|
11853
|
+
_context1.next = 51;
|
|
11844
11854
|
break;
|
|
11845
11855
|
}
|
|
11846
11856
|
output = {};
|
|
@@ -11850,45 +11860,45 @@ function _typeof(o) {
|
|
|
11850
11860
|
for (_i12 = 0, _Object$entries3 = Object.entries(prices); _i12 < _Object$entries3.length; _i12++) {
|
|
11851
11861
|
_Object$entries3$_i = _slicedToArray(_Object$entries3[_i12], 2), currency = _Object$entries3$_i[0],
|
|
11852
11862
|
_value6 = _Object$entries3$_i[1];
|
|
11853
|
-
|
|
11854
|
-
output[
|
|
11863
|
+
_key2 = "".concat(_token.charAt(0).toUpperCase() + _token.slice(1), "_").concat(currency.toUpperCase());
|
|
11864
|
+
output[_key2] = _value6;
|
|
11855
11865
|
}
|
|
11856
11866
|
}
|
|
11857
11867
|
return _context1.abrupt("return", [ output ]);
|
|
11858
11868
|
|
|
11859
|
-
case
|
|
11869
|
+
case 51:
|
|
11860
11870
|
flatArray = Array.isArray(json) ? json : [ json ];
|
|
11861
11871
|
return _context1.abrupt("return", flatArray.map((function(item) {
|
|
11862
11872
|
var flat = {};
|
|
11863
11873
|
for (var _i13 = 0, _Object$entries4 = Object.entries(item); _i13 < _Object$entries4.length; _i13++) {
|
|
11864
|
-
var _Object$entries4$_i = _slicedToArray(_Object$entries4[_i13], 2),
|
|
11874
|
+
var _Object$entries4$_i = _slicedToArray(_Object$entries4[_i13], 2), _key3 = _Object$entries4$_i[0], _value7 = _Object$entries4$_i[1];
|
|
11865
11875
|
if (_typeof(_value7) !== "object" || _value7 === null) {
|
|
11866
|
-
flat[
|
|
11876
|
+
flat[_key3] = _value7;
|
|
11867
11877
|
}
|
|
11868
11878
|
}
|
|
11869
11879
|
return flat;
|
|
11870
11880
|
})));
|
|
11871
11881
|
|
|
11872
|
-
case
|
|
11873
|
-
_context1.prev =
|
|
11874
|
-
_context1.t1 = _context1["catch"](
|
|
11882
|
+
case 55:
|
|
11883
|
+
_context1.prev = 55;
|
|
11884
|
+
_context1.t1 = _context1["catch"](34);
|
|
11875
11885
|
console.error(_context1.t1);
|
|
11876
11886
|
return _context1.abrupt("return", ERROR_MESSAGES_FLAG.DEFAULT);
|
|
11877
11887
|
|
|
11878
|
-
case
|
|
11888
|
+
case 59:
|
|
11879
11889
|
case "end":
|
|
11880
11890
|
return _context1.stop();
|
|
11881
11891
|
}
|
|
11882
|
-
}), _callee1, null, [ [
|
|
11892
|
+
}), _callee1, null, [ [ 34, 55 ] ]);
|
|
11883
11893
|
})));
|
|
11884
11894
|
return _COINGECKO.apply(this, arguments);
|
|
11885
11895
|
}
|
|
11886
|
-
function EOA(
|
|
11896
|
+
function EOA() {
|
|
11887
11897
|
return _EOA.apply(this, arguments);
|
|
11888
11898
|
}
|
|
11889
11899
|
function _EOA() {
|
|
11890
|
-
_EOA = _asyncToGenerator(_regeneratorRuntime().mark((function _callee11(
|
|
11891
|
-
var page, offset, API_KEY, INPUTS, CHAINS, out, ADDRESS_MAP, _iterator, _step, input, resolved, ADDRS, _iterator2, _step2, _loop, _ret, fetchJSON, _fetchJSON, _args13 = arguments;
|
|
11900
|
+
_EOA = _asyncToGenerator(_regeneratorRuntime().mark((function _callee11() {
|
|
11901
|
+
var _argsToArray17, _argsToArray18, addresses, category, chains, startTime, endTime, _argsToArray18$, page, _argsToArray18$2, offset, someError, API_KEY, INPUTS, CHAINS, out, ADDRESS_MAP, _iterator, _step, input, resolved, ADDRS, _iterator2, _step2, _loop, _ret, fetchJSON, _fetchJSON, _args13 = arguments;
|
|
11892
11902
|
return _regeneratorRuntime().wrap((function _callee11$(_context13) {
|
|
11893
11903
|
while (1) switch (_context13.prev = _context13.next) {
|
|
11894
11904
|
case 0:
|
|
@@ -11952,83 +11962,98 @@ function _typeof(o) {
|
|
|
11952
11962
|
})));
|
|
11953
11963
|
return _fetchJSON.apply(this, arguments);
|
|
11954
11964
|
};
|
|
11955
|
-
fetchJSON = function _fetchJSON2(
|
|
11965
|
+
fetchJSON = function _fetchJSON2(_x8) {
|
|
11956
11966
|
return _fetchJSON.apply(this, arguments);
|
|
11957
11967
|
};
|
|
11958
|
-
|
|
11959
|
-
|
|
11968
|
+
_argsToArray17 = argsToArray(_args13), _argsToArray18 = _slicedToArray(_argsToArray17, 7),
|
|
11969
|
+
addresses = _argsToArray18[0], category = _argsToArray18[1], chains = _argsToArray18[2],
|
|
11970
|
+
startTime = _argsToArray18[3], endTime = _argsToArray18[4], _argsToArray18$ = _argsToArray18[5],
|
|
11971
|
+
page = _argsToArray18$ === void 0 ? 1 : _argsToArray18$, _argsToArray18$2 = _argsToArray18[6],
|
|
11972
|
+
offset = _argsToArray18$2 === void 0 ? 10 : _argsToArray18$2;
|
|
11973
|
+
someError = anyError(addresses, category, chains, startTime, endTime, page, offset);
|
|
11974
|
+
if (!someError) {
|
|
11975
|
+
_context13.next = 6;
|
|
11976
|
+
break;
|
|
11977
|
+
}
|
|
11978
|
+
return _context13.abrupt("return", someError);
|
|
11979
|
+
|
|
11980
|
+
case 6:
|
|
11960
11981
|
API_KEY = window.localStorage.getItem(SERVICE_API_KEY.Etherscan);
|
|
11961
11982
|
if (API_KEY) {
|
|
11962
|
-
_context13.next =
|
|
11983
|
+
_context13.next = 9;
|
|
11963
11984
|
break;
|
|
11964
11985
|
}
|
|
11965
11986
|
return _context13.abrupt("return", "".concat(SERVICE_API_KEY.Etherscan).concat(ERROR_MESSAGES_FLAG.MISSING_KEY));
|
|
11966
11987
|
|
|
11967
|
-
case
|
|
11968
|
-
|
|
11969
|
-
|
|
11970
|
-
|
|
11988
|
+
case 9:
|
|
11989
|
+
if (typeof addresses === "string") {
|
|
11990
|
+
INPUTS = addresses.split(",").map((function(a) {
|
|
11991
|
+
return a.trim();
|
|
11992
|
+
})).filter(Boolean);
|
|
11993
|
+
} else if (_typeof(addresses) === "object") {
|
|
11994
|
+
INPUTS = addresses;
|
|
11995
|
+
}
|
|
11971
11996
|
CHAINS = chains.split(",").map((function(c) {
|
|
11972
11997
|
return c.trim();
|
|
11973
11998
|
})).filter(Boolean);
|
|
11974
11999
|
out = [];
|
|
11975
12000
|
ADDRESS_MAP = {};
|
|
11976
12001
|
_iterator = _createForOfIteratorHelper(INPUTS);
|
|
11977
|
-
_context13.prev =
|
|
12002
|
+
_context13.prev = 14;
|
|
11978
12003
|
_iterator.s();
|
|
11979
12004
|
|
|
11980
|
-
case
|
|
12005
|
+
case 16:
|
|
11981
12006
|
if ((_step = _iterator.n()).done) {
|
|
11982
|
-
_context13.next =
|
|
12007
|
+
_context13.next = 34;
|
|
11983
12008
|
break;
|
|
11984
12009
|
}
|
|
11985
12010
|
input = _step.value;
|
|
11986
12011
|
if (!isAddress(input)) {
|
|
11987
|
-
_context13.next =
|
|
12012
|
+
_context13.next = 22;
|
|
11988
12013
|
break;
|
|
11989
12014
|
}
|
|
11990
12015
|
ADDRESS_MAP[input.toLowerCase()] = null;
|
|
11991
|
-
_context13.next =
|
|
12016
|
+
_context13.next = 32;
|
|
11992
12017
|
break;
|
|
11993
12018
|
|
|
11994
|
-
case
|
|
11995
|
-
_context13.prev =
|
|
11996
|
-
_context13.next =
|
|
12019
|
+
case 22:
|
|
12020
|
+
_context13.prev = 22;
|
|
12021
|
+
_context13.next = 25;
|
|
11997
12022
|
return fromEnsNameToAddress(input);
|
|
11998
12023
|
|
|
11999
|
-
case
|
|
12024
|
+
case 25:
|
|
12000
12025
|
resolved = _context13.sent;
|
|
12001
12026
|
if (resolved) ADDRESS_MAP[resolved.toLowerCase()] = input;
|
|
12002
|
-
_context13.next =
|
|
12027
|
+
_context13.next = 32;
|
|
12003
12028
|
break;
|
|
12004
12029
|
|
|
12005
|
-
case
|
|
12006
|
-
_context13.prev =
|
|
12007
|
-
_context13.t0 = _context13["catch"](
|
|
12030
|
+
case 29:
|
|
12031
|
+
_context13.prev = 29;
|
|
12032
|
+
_context13.t0 = _context13["catch"](22);
|
|
12008
12033
|
return _context13.abrupt("return", "".concat(input).concat(ERROR_MESSAGES_FLAG.INVALID_PARAM));
|
|
12009
12034
|
|
|
12010
|
-
case 30:
|
|
12011
|
-
_context13.next = 14;
|
|
12012
|
-
break;
|
|
12013
|
-
|
|
12014
12035
|
case 32:
|
|
12015
|
-
_context13.next =
|
|
12036
|
+
_context13.next = 16;
|
|
12016
12037
|
break;
|
|
12017
12038
|
|
|
12018
12039
|
case 34:
|
|
12019
|
-
_context13.
|
|
12020
|
-
|
|
12040
|
+
_context13.next = 39;
|
|
12041
|
+
break;
|
|
12042
|
+
|
|
12043
|
+
case 36:
|
|
12044
|
+
_context13.prev = 36;
|
|
12045
|
+
_context13.t1 = _context13["catch"](14);
|
|
12021
12046
|
_iterator.e(_context13.t1);
|
|
12022
12047
|
|
|
12023
|
-
case
|
|
12024
|
-
_context13.prev =
|
|
12048
|
+
case 39:
|
|
12049
|
+
_context13.prev = 39;
|
|
12025
12050
|
_iterator.f();
|
|
12026
|
-
return _context13.finish(
|
|
12051
|
+
return _context13.finish(39);
|
|
12027
12052
|
|
|
12028
|
-
case
|
|
12053
|
+
case 42:
|
|
12029
12054
|
ADDRS = Object.keys(ADDRESS_MAP);
|
|
12030
12055
|
_iterator2 = _createForOfIteratorHelper(CHAINS);
|
|
12031
|
-
_context13.prev =
|
|
12056
|
+
_context13.prev = 44;
|
|
12032
12057
|
_loop = _regeneratorRuntime().mark((function _loop() {
|
|
12033
12058
|
var chain, chainId, i, slice, action, url, _data, startBlock, endBlock, _loop2, _ret2, _i14, _ADDRS;
|
|
12034
12059
|
return _regeneratorRuntime().wrap((function _loop$(_context11) {
|
|
@@ -12179,58 +12204,58 @@ function _typeof(o) {
|
|
|
12179
12204
|
}));
|
|
12180
12205
|
_iterator2.s();
|
|
12181
12206
|
|
|
12182
|
-
case
|
|
12207
|
+
case 47:
|
|
12183
12208
|
if ((_step2 = _iterator2.n()).done) {
|
|
12184
|
-
_context13.next =
|
|
12209
|
+
_context13.next = 56;
|
|
12185
12210
|
break;
|
|
12186
12211
|
}
|
|
12187
|
-
return _context13.delegateYield(_loop(), "t2",
|
|
12212
|
+
return _context13.delegateYield(_loop(), "t2", 49);
|
|
12188
12213
|
|
|
12189
|
-
case
|
|
12214
|
+
case 49:
|
|
12190
12215
|
_ret = _context13.t2;
|
|
12191
12216
|
if (!(_ret === 0)) {
|
|
12192
|
-
_context13.next =
|
|
12217
|
+
_context13.next = 52;
|
|
12193
12218
|
break;
|
|
12194
12219
|
}
|
|
12195
|
-
return _context13.abrupt("continue",
|
|
12220
|
+
return _context13.abrupt("continue", 54);
|
|
12196
12221
|
|
|
12197
|
-
case
|
|
12222
|
+
case 52:
|
|
12198
12223
|
if (!_ret) {
|
|
12199
|
-
_context13.next =
|
|
12224
|
+
_context13.next = 54;
|
|
12200
12225
|
break;
|
|
12201
12226
|
}
|
|
12202
12227
|
return _context13.abrupt("return", _ret.v);
|
|
12203
12228
|
|
|
12204
|
-
case 52:
|
|
12205
|
-
_context13.next = 45;
|
|
12206
|
-
break;
|
|
12207
|
-
|
|
12208
12229
|
case 54:
|
|
12209
|
-
_context13.next =
|
|
12230
|
+
_context13.next = 47;
|
|
12210
12231
|
break;
|
|
12211
12232
|
|
|
12212
12233
|
case 56:
|
|
12213
|
-
_context13.
|
|
12214
|
-
|
|
12234
|
+
_context13.next = 61;
|
|
12235
|
+
break;
|
|
12236
|
+
|
|
12237
|
+
case 58:
|
|
12238
|
+
_context13.prev = 58;
|
|
12239
|
+
_context13.t3 = _context13["catch"](44);
|
|
12215
12240
|
_iterator2.e(_context13.t3);
|
|
12216
12241
|
|
|
12217
|
-
case
|
|
12218
|
-
_context13.prev =
|
|
12242
|
+
case 61:
|
|
12243
|
+
_context13.prev = 61;
|
|
12219
12244
|
_iterator2.f();
|
|
12220
|
-
return _context13.finish(
|
|
12245
|
+
return _context13.finish(61);
|
|
12221
12246
|
|
|
12222
|
-
case
|
|
12247
|
+
case 64:
|
|
12223
12248
|
return _context13.abrupt("return", out);
|
|
12224
12249
|
|
|
12225
|
-
case
|
|
12250
|
+
case 65:
|
|
12226
12251
|
case "end":
|
|
12227
12252
|
return _context13.stop();
|
|
12228
12253
|
}
|
|
12229
|
-
}), _callee11, null, [ [
|
|
12254
|
+
}), _callee11, null, [ [ 14, 36, 39, 42 ], [ 22, 29 ], [ 44, 58, 61, 64 ] ]);
|
|
12230
12255
|
})));
|
|
12231
12256
|
return _EOA.apply(this, arguments);
|
|
12232
12257
|
}
|
|
12233
|
-
function FLVURL(
|
|
12258
|
+
function FLVURL(_x6, _x7) {
|
|
12234
12259
|
return _FLVURL.apply(this, arguments);
|
|
12235
12260
|
}
|
|
12236
12261
|
function _FLVURL() {
|
|
@@ -12254,116 +12279,119 @@ function _typeof(o) {
|
|
|
12254
12279
|
})));
|
|
12255
12280
|
return _FLVURL.apply(this, arguments);
|
|
12256
12281
|
}
|
|
12257
|
-
function SAFE(
|
|
12282
|
+
function SAFE() {
|
|
12258
12283
|
return _SAFE.apply(this, arguments);
|
|
12259
12284
|
}
|
|
12260
12285
|
function _SAFE() {
|
|
12261
|
-
_SAFE = _asyncToGenerator(_regeneratorRuntime().mark((function _callee13(
|
|
12262
|
-
var apiKey, chainIdentifier, url, response, json;
|
|
12286
|
+
_SAFE = _asyncToGenerator(_regeneratorRuntime().mark((function _callee13() {
|
|
12287
|
+
var _argsToArray19, _argsToArray20, address, utility, chain, limit, offset, apiKey, chainIdentifier, url, response, json, _args15 = arguments;
|
|
12263
12288
|
return _regeneratorRuntime().wrap((function _callee13$(_context15) {
|
|
12264
12289
|
while (1) switch (_context15.prev = _context15.next) {
|
|
12265
12290
|
case 0:
|
|
12291
|
+
_argsToArray19 = argsToArray(_args15), _argsToArray20 = _slicedToArray(_argsToArray19, 5),
|
|
12292
|
+
address = _argsToArray20[0], utility = _argsToArray20[1], chain = _argsToArray20[2],
|
|
12293
|
+
limit = _argsToArray20[3], offset = _argsToArray20[4];
|
|
12266
12294
|
if (!(typeof limit !== "number" || limit < 0)) {
|
|
12267
|
-
_context15.next =
|
|
12295
|
+
_context15.next = 3;
|
|
12268
12296
|
break;
|
|
12269
12297
|
}
|
|
12270
12298
|
return _context15.abrupt("return", "INVALID_LIMIT");
|
|
12271
12299
|
|
|
12272
|
-
case
|
|
12300
|
+
case 3:
|
|
12273
12301
|
if (!(typeof offset !== "number" || offset < 0)) {
|
|
12274
|
-
_context15.next =
|
|
12302
|
+
_context15.next = 5;
|
|
12275
12303
|
break;
|
|
12276
12304
|
}
|
|
12277
12305
|
return _context15.abrupt("return", "INVALID_OFFSET");
|
|
12278
12306
|
|
|
12279
|
-
case
|
|
12307
|
+
case 5:
|
|
12280
12308
|
if (!(utility !== "txns")) {
|
|
12281
|
-
_context15.next =
|
|
12309
|
+
_context15.next = 7;
|
|
12282
12310
|
break;
|
|
12283
12311
|
}
|
|
12284
12312
|
return _context15.abrupt("return", "UTILITY IS NOT SUPPORTED");
|
|
12285
12313
|
|
|
12286
|
-
case
|
|
12314
|
+
case 7:
|
|
12287
12315
|
apiKey = window.localStorage.getItem(SERVICE_API_KEY.Safe);
|
|
12288
12316
|
chainIdentifier = SAFE_CHAIN_MAP[chain];
|
|
12289
12317
|
if (apiKey) {
|
|
12290
|
-
_context15.next =
|
|
12318
|
+
_context15.next = 11;
|
|
12291
12319
|
break;
|
|
12292
12320
|
}
|
|
12293
12321
|
return _context15.abrupt("return", "".concat(SERVICE_API_KEY.Safe, "_MISSING"));
|
|
12294
12322
|
|
|
12295
|
-
case
|
|
12323
|
+
case 11:
|
|
12296
12324
|
if (chainIdentifier) {
|
|
12297
|
-
_context15.next =
|
|
12325
|
+
_context15.next = 13;
|
|
12298
12326
|
break;
|
|
12299
12327
|
}
|
|
12300
12328
|
return _context15.abrupt("return", "CHAIN IS NOT SUPPORTED");
|
|
12301
12329
|
|
|
12302
|
-
case
|
|
12330
|
+
case 13:
|
|
12303
12331
|
if (isAddress(address)) {
|
|
12304
|
-
_context15.next =
|
|
12332
|
+
_context15.next = 17;
|
|
12305
12333
|
break;
|
|
12306
12334
|
}
|
|
12307
|
-
_context15.next =
|
|
12335
|
+
_context15.next = 16;
|
|
12308
12336
|
return fromEnsNameToAddress(address);
|
|
12309
12337
|
|
|
12310
|
-
case 15:
|
|
12311
|
-
address = _context15.sent;
|
|
12312
|
-
|
|
12313
12338
|
case 16:
|
|
12339
|
+
_readOnlyError("address");
|
|
12340
|
+
|
|
12341
|
+
case 17:
|
|
12314
12342
|
if (address) {
|
|
12315
|
-
_context15.next =
|
|
12343
|
+
_context15.next = 19;
|
|
12316
12344
|
break;
|
|
12317
12345
|
}
|
|
12318
12346
|
return _context15.abrupt("return", "".concat(address).concat(ERROR_MESSAGES_FLAG.INVALID_PARAM));
|
|
12319
12347
|
|
|
12320
|
-
case
|
|
12348
|
+
case 19:
|
|
12321
12349
|
url = "https://api.safe.global/tx-service/".concat(chainIdentifier, "/api/v2/safes/").concat(address, "/multisig-transactions?limit=").concat(limit, "&offset=").concat(offset);
|
|
12322
|
-
_context15.prev =
|
|
12323
|
-
_context15.next =
|
|
12350
|
+
_context15.prev = 20;
|
|
12351
|
+
_context15.next = 23;
|
|
12324
12352
|
return fetch(url, {
|
|
12325
12353
|
headers: {
|
|
12326
12354
|
Authorization: "Bearer ".concat(apiKey)
|
|
12327
12355
|
}
|
|
12328
12356
|
});
|
|
12329
12357
|
|
|
12330
|
-
case
|
|
12358
|
+
case 23:
|
|
12331
12359
|
response = _context15.sent;
|
|
12332
12360
|
if (response.ok) {
|
|
12333
|
-
_context15.next =
|
|
12361
|
+
_context15.next = 26;
|
|
12334
12362
|
break;
|
|
12335
12363
|
}
|
|
12336
12364
|
throw new Error("HTTP error! Status: ".concat(response.status));
|
|
12337
12365
|
|
|
12338
|
-
case
|
|
12339
|
-
_context15.next =
|
|
12366
|
+
case 26:
|
|
12367
|
+
_context15.next = 28;
|
|
12340
12368
|
return response.json();
|
|
12341
12369
|
|
|
12342
|
-
case
|
|
12370
|
+
case 28:
|
|
12343
12371
|
json = _context15.sent;
|
|
12344
12372
|
if (Array.isArray(json.results)) {
|
|
12345
|
-
_context15.next =
|
|
12373
|
+
_context15.next = 31;
|
|
12346
12374
|
break;
|
|
12347
12375
|
}
|
|
12348
12376
|
return _context15.abrupt("return", "INVALID API RESPONSE");
|
|
12349
12377
|
|
|
12350
|
-
case
|
|
12351
|
-
return _context15.abrupt("return", json.results.map((function(
|
|
12352
|
-
var confirmations =
|
|
12378
|
+
case 31:
|
|
12379
|
+
return _context15.abrupt("return", json.results.map((function(_ref4) {
|
|
12380
|
+
var confirmations = _ref4.confirmations, dataDecoded = _ref4.dataDecoded, rest = _objectWithoutProperties(_ref4, _excluded);
|
|
12353
12381
|
return rest;
|
|
12354
12382
|
})));
|
|
12355
12383
|
|
|
12356
|
-
case
|
|
12357
|
-
_context15.prev =
|
|
12358
|
-
_context15.t0 = _context15["catch"](
|
|
12384
|
+
case 34:
|
|
12385
|
+
_context15.prev = 34;
|
|
12386
|
+
_context15.t0 = _context15["catch"](20);
|
|
12359
12387
|
console.log(_context15.t0);
|
|
12360
12388
|
return _context15.abrupt("return", "ERROR IN FETCHING");
|
|
12361
12389
|
|
|
12362
|
-
case
|
|
12390
|
+
case 38:
|
|
12363
12391
|
case "end":
|
|
12364
12392
|
return _context15.stop();
|
|
12365
12393
|
}
|
|
12366
|
-
}), _callee13, null, [ [
|
|
12394
|
+
}), _callee13, null, [ [ 20, 34 ] ]);
|
|
12367
12395
|
})));
|
|
12368
12396
|
return _SAFE.apply(this, arguments);
|
|
12369
12397
|
}
|