@fileverse-dev/formulajs 4.4.11-mod-60 → 4.4.11-mod-61-patch-1
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 +571 -478
- package/lib/browser/formula.min.js +2 -2
- package/lib/browser/formula.min.js.map +1 -1
- package/lib/cjs/index.cjs +79 -8
- package/lib/esm/crypto-constants.mjs +4 -1
- package/lib/esm/index.mjs +79 -9
- package/package.json +1 -1
- package/types/cjs/index.d.cts +11 -0
- package/types/esm/index.d.mts +11 -0
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-61-patch-1 */
|
|
2
2
|
var _excluded = [ "confirmations", "dataDecoded" ];
|
|
3
3
|
|
|
4
4
|
function _objectWithoutProperties(e, t) {
|
|
@@ -10931,11 +10931,13 @@ function _typeof(o) {
|
|
|
10931
10931
|
INVALID_CHAIN: "_INVALID_CHAIN",
|
|
10932
10932
|
INVALID_TYPE: "_INVALID_TYPE",
|
|
10933
10933
|
INVALID_ADDRESS: "_INVALID_ADDRESS",
|
|
10934
|
-
INVALID_PARAM: "_INVALID_PARAM"
|
|
10934
|
+
INVALID_PARAM: "_INVALID_PARAM",
|
|
10935
|
+
MAX_PAGE_LIMIT: "Max page limit is 250"
|
|
10935
10936
|
};
|
|
10936
10937
|
var UTILITY = {
|
|
10937
10938
|
ALCHEMY_API_KEY: "ALCHEMY_API_KEY"
|
|
10938
10939
|
};
|
|
10940
|
+
var MAX_PAGE_LIMIT = 250;
|
|
10939
10941
|
var SERVICE_API_KEY = {
|
|
10940
10942
|
Etherscan: "ETHERSCAN_API_KEY",
|
|
10941
10943
|
Coingecko: "COINGECKO_API_KEY",
|
|
@@ -11074,32 +11076,39 @@ function _typeof(o) {
|
|
|
11074
11076
|
return _context4.abrupt("return", "".concat(scanKey).concat(ERROR_MESSAGES_FLAG.RATE_LIMIT));
|
|
11075
11077
|
|
|
11076
11078
|
case 6:
|
|
11079
|
+
if (!(offset > MAX_PAGE_LIMIT)) {
|
|
11080
|
+
_context4.next = 8;
|
|
11081
|
+
break;
|
|
11082
|
+
}
|
|
11083
|
+
return _context4.abrupt("return", ERROR_MESSAGES_FLAG.MAX_PAGE_LIMIT);
|
|
11084
|
+
|
|
11085
|
+
case 8:
|
|
11077
11086
|
chainId = CHAIN_ID_MAP[chain === null || chain === void 0 ? void 0 : chain.toLowerCase()];
|
|
11078
11087
|
if (chainId) {
|
|
11079
|
-
_context4.next =
|
|
11088
|
+
_context4.next = 11;
|
|
11080
11089
|
break;
|
|
11081
11090
|
}
|
|
11082
11091
|
return _context4.abrupt("return", "".concat(scanKey).concat(ERROR_MESSAGES_FLAG.INVALID_CHAIN));
|
|
11083
11092
|
|
|
11084
|
-
case
|
|
11093
|
+
case 11:
|
|
11085
11094
|
if (isAddress(address)) {
|
|
11086
|
-
_context4.next =
|
|
11095
|
+
_context4.next = 15;
|
|
11087
11096
|
break;
|
|
11088
11097
|
}
|
|
11089
|
-
_context4.next =
|
|
11098
|
+
_context4.next = 14;
|
|
11090
11099
|
return fromEnsNameToAddress(address);
|
|
11091
11100
|
|
|
11092
|
-
case
|
|
11101
|
+
case 14:
|
|
11093
11102
|
address = _context4.sent;
|
|
11094
11103
|
|
|
11095
|
-
case
|
|
11104
|
+
case 15:
|
|
11096
11105
|
if (address) {
|
|
11097
|
-
_context4.next =
|
|
11106
|
+
_context4.next = 17;
|
|
11098
11107
|
break;
|
|
11099
11108
|
}
|
|
11100
11109
|
return _context4.abrupt("return", "".concat(address).concat(ERROR_MESSAGES_FLAG.INVALID_PARAM));
|
|
11101
11110
|
|
|
11102
|
-
case
|
|
11111
|
+
case 17:
|
|
11103
11112
|
ACTION_MAP = {
|
|
11104
11113
|
"all-txns": "txlist",
|
|
11105
11114
|
"token-txns": "tokentx",
|
|
@@ -11108,94 +11117,94 @@ function _typeof(o) {
|
|
|
11108
11117
|
};
|
|
11109
11118
|
action = ACTION_MAP[type];
|
|
11110
11119
|
if (action) {
|
|
11111
|
-
_context4.next =
|
|
11120
|
+
_context4.next = 21;
|
|
11112
11121
|
break;
|
|
11113
11122
|
}
|
|
11114
11123
|
return _context4.abrupt("return", "".concat(scanKey).concat(ERROR_MESSAGES_FLAG.INVALID_TYPE));
|
|
11115
11124
|
|
|
11116
|
-
case
|
|
11125
|
+
case 21:
|
|
11117
11126
|
if (scanKey === SERVICE_API_KEY.Basescan) chainId = "base";
|
|
11118
11127
|
if (scanKey === SERVICE_API_KEY.Gnosisscan) chainId = "gnosis";
|
|
11119
11128
|
url = "".concat(baseUrl, "?chainid=").concat(chainId, "&module=account&action=").concat(action, "&apikey=").concat(API_KEY);
|
|
11120
11129
|
if (![ "all-txns", "token-txns", "nft-txns" ].includes(type)) {
|
|
11121
|
-
_context4.next =
|
|
11130
|
+
_context4.next = 37;
|
|
11122
11131
|
break;
|
|
11123
11132
|
}
|
|
11124
11133
|
if (address) {
|
|
11125
|
-
_context4.next =
|
|
11134
|
+
_context4.next = 27;
|
|
11126
11135
|
break;
|
|
11127
11136
|
}
|
|
11128
11137
|
return _context4.abrupt("return", "".concat(scanKey).concat(ERROR_MESSAGES_FLAG.INVALID_ADDRESS));
|
|
11129
11138
|
|
|
11130
|
-
case
|
|
11139
|
+
case 27:
|
|
11131
11140
|
url += "&address=".concat(address, "&startblock=0&endblock=99999999&sort=asc");
|
|
11132
11141
|
if (!(!isNaN(startDate) && !isNaN(endDate))) {
|
|
11133
|
-
_context4.next =
|
|
11142
|
+
_context4.next = 36;
|
|
11134
11143
|
break;
|
|
11135
11144
|
}
|
|
11136
|
-
_context4.next =
|
|
11145
|
+
_context4.next = 31;
|
|
11137
11146
|
return Promise.all([ fromTimeStampToBlock(toTimestamp(startDate), chain, API_KEY), fromTimeStampToBlock(toTimestamp(endDate), chain, API_KEY) ]);
|
|
11138
11147
|
|
|
11139
|
-
case
|
|
11148
|
+
case 31:
|
|
11140
11149
|
_yield$Promise$all = _context4.sent;
|
|
11141
11150
|
_yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 2);
|
|
11142
11151
|
startBlock = _yield$Promise$all2[0];
|
|
11143
11152
|
endBlock = _yield$Promise$all2[1];
|
|
11144
11153
|
url += "&startblock=".concat(startBlock, "&endblock=").concat(endBlock);
|
|
11145
11154
|
|
|
11146
|
-
case
|
|
11155
|
+
case 36:
|
|
11147
11156
|
url += "&page=".concat(page, "&offset=").concat(offset);
|
|
11148
11157
|
|
|
11149
|
-
case
|
|
11150
|
-
_context4.prev =
|
|
11151
|
-
_context4.next =
|
|
11158
|
+
case 37:
|
|
11159
|
+
_context4.prev = 37;
|
|
11160
|
+
_context4.next = 40;
|
|
11152
11161
|
return fetch(url);
|
|
11153
11162
|
|
|
11154
|
-
case
|
|
11163
|
+
case 40:
|
|
11155
11164
|
res = _context4.sent;
|
|
11156
11165
|
if (res.ok) {
|
|
11157
|
-
_context4.next =
|
|
11166
|
+
_context4.next = 43;
|
|
11158
11167
|
break;
|
|
11159
11168
|
}
|
|
11160
11169
|
throw new Error("HTTP error: ".concat(res.status));
|
|
11161
11170
|
|
|
11162
|
-
case
|
|
11163
|
-
_context4.next =
|
|
11171
|
+
case 43:
|
|
11172
|
+
_context4.next = 45;
|
|
11164
11173
|
return res.json();
|
|
11165
11174
|
|
|
11166
|
-
case
|
|
11175
|
+
case 45:
|
|
11167
11176
|
json = _context4.sent;
|
|
11168
11177
|
if (!(typeof json.result === "string")) {
|
|
11169
|
-
_context4.next =
|
|
11178
|
+
_context4.next = 51;
|
|
11170
11179
|
break;
|
|
11171
11180
|
}
|
|
11172
11181
|
if (!json.result.includes("Invalid API Key")) {
|
|
11173
|
-
_context4.next =
|
|
11182
|
+
_context4.next = 49;
|
|
11174
11183
|
break;
|
|
11175
11184
|
}
|
|
11176
11185
|
return _context4.abrupt("return", "".concat(scanKey).concat(ERROR_MESSAGES_FLAG.INVALID_API_KEY));
|
|
11177
11186
|
|
|
11178
|
-
case
|
|
11187
|
+
case 49:
|
|
11179
11188
|
if (!json.result.includes("Max rate limit reached")) {
|
|
11180
|
-
_context4.next =
|
|
11189
|
+
_context4.next = 51;
|
|
11181
11190
|
break;
|
|
11182
11191
|
}
|
|
11183
11192
|
return _context4.abrupt("return", "".concat(scanKey).concat(ERROR_MESSAGES_FLAG.RATE_LIMIT));
|
|
11184
11193
|
|
|
11185
|
-
case
|
|
11194
|
+
case 51:
|
|
11186
11195
|
return _context4.abrupt("return", json.result);
|
|
11187
11196
|
|
|
11188
|
-
case
|
|
11189
|
-
_context4.prev =
|
|
11190
|
-
_context4.t0 = _context4["catch"](
|
|
11197
|
+
case 54:
|
|
11198
|
+
_context4.prev = 54;
|
|
11199
|
+
_context4.t0 = _context4["catch"](37);
|
|
11191
11200
|
console.error("[".concat(scanKey, "]"), _context4.t0);
|
|
11192
11201
|
return _context4.abrupt("return", ERROR_MESSAGES_FLAG.DEFAULT);
|
|
11193
11202
|
|
|
11194
|
-
case
|
|
11203
|
+
case 58:
|
|
11195
11204
|
case "end":
|
|
11196
11205
|
return _context4.stop();
|
|
11197
11206
|
}
|
|
11198
|
-
}), _callee4, null, [ [
|
|
11207
|
+
}), _callee4, null, [ [ 37, 54 ] ]);
|
|
11199
11208
|
})));
|
|
11200
11209
|
return _handleScanRequest.apply(this, arguments);
|
|
11201
11210
|
}
|
|
@@ -11228,7 +11237,7 @@ function _typeof(o) {
|
|
|
11228
11237
|
|
|
11229
11238
|
case 8:
|
|
11230
11239
|
json = _context2.sent;
|
|
11231
|
-
users = json.result
|
|
11240
|
+
users = json.result ? json.result.users : [];
|
|
11232
11241
|
user = users.find((function(user) {
|
|
11233
11242
|
return user.username === username;
|
|
11234
11243
|
}));
|
|
@@ -11270,14 +11279,21 @@ function _typeof(o) {
|
|
|
11270
11279
|
platform = _argsToArray4[0], contentType = _argsToArray4[1], identifier = _argsToArray4[2],
|
|
11271
11280
|
_argsToArray4$ = _argsToArray4[3], start = _argsToArray4$ === void 0 ? 0 : _argsToArray4$,
|
|
11272
11281
|
_argsToArray4$2 = _argsToArray4[4], end = _argsToArray4$2 === void 0 ? 10 : _argsToArray4$2;
|
|
11282
|
+
if (!(end > MAX_PAGE_LIMIT)) {
|
|
11283
|
+
_context5.next = 3;
|
|
11284
|
+
break;
|
|
11285
|
+
}
|
|
11286
|
+
return _context5.abrupt("return", ERROR_MESSAGES_FLAG.MAX_PAGE_LIMIT);
|
|
11287
|
+
|
|
11288
|
+
case 3:
|
|
11273
11289
|
API_KEY = window.localStorage.getItem(SERVICE_API_KEY.Firefly);
|
|
11274
11290
|
if (API_KEY) {
|
|
11275
|
-
_context5.next =
|
|
11291
|
+
_context5.next = 6;
|
|
11276
11292
|
break;
|
|
11277
11293
|
}
|
|
11278
11294
|
return _context5.abrupt("return", "".concat(SERVICE_API_KEY.Firefly).concat(ERROR_MESSAGES_FLAG.MISSING_KEY));
|
|
11279
11295
|
|
|
11280
|
-
case
|
|
11296
|
+
case 6:
|
|
11281
11297
|
baseUrl = "https://openapi.firefly.land/v1/fileverse/fetch";
|
|
11282
11298
|
headers = {
|
|
11283
11299
|
"x-api-key": API_KEY
|
|
@@ -11295,12 +11311,12 @@ function _typeof(o) {
|
|
|
11295
11311
|
};
|
|
11296
11312
|
platformType = (_typeMap$platform = typeMap[platform]) === null || _typeMap$platform === void 0 ? void 0 : _typeMap$platform[contentType];
|
|
11297
11313
|
if (platformType) {
|
|
11298
|
-
_context5.next =
|
|
11314
|
+
_context5.next = 12;
|
|
11299
11315
|
break;
|
|
11300
11316
|
}
|
|
11301
11317
|
return _context5.abrupt("return", "".concat(SERVICE_API_KEY.Firefly).concat(ERROR_MESSAGES_FLAG.INVALID_TYPE));
|
|
11302
11318
|
|
|
11303
|
-
case
|
|
11319
|
+
case 12:
|
|
11304
11320
|
query = identifier.split(",").map((function(s) {
|
|
11305
11321
|
return s.trim();
|
|
11306
11322
|
})).filter(Boolean).join(",");
|
|
@@ -11309,33 +11325,33 @@ function _typeof(o) {
|
|
|
11309
11325
|
url.searchParams.set("type", platformType);
|
|
11310
11326
|
url.searchParams.set("start", String(start));
|
|
11311
11327
|
url.searchParams.set("end", String(end));
|
|
11312
|
-
_context5.prev =
|
|
11313
|
-
_context5.next =
|
|
11328
|
+
_context5.prev = 18;
|
|
11329
|
+
_context5.next = 21;
|
|
11314
11330
|
return fetch(url.toString(), {
|
|
11315
11331
|
headers: headers
|
|
11316
11332
|
});
|
|
11317
11333
|
|
|
11318
|
-
case
|
|
11334
|
+
case 21:
|
|
11319
11335
|
res = _context5.sent;
|
|
11320
11336
|
if (res.ok) {
|
|
11321
|
-
_context5.next =
|
|
11337
|
+
_context5.next = 24;
|
|
11322
11338
|
break;
|
|
11323
11339
|
}
|
|
11324
11340
|
throw new Error("HTTP ".concat(res.status));
|
|
11325
11341
|
|
|
11326
|
-
case
|
|
11327
|
-
_context5.next =
|
|
11342
|
+
case 24:
|
|
11343
|
+
_context5.next = 26;
|
|
11328
11344
|
return res.json();
|
|
11329
11345
|
|
|
11330
|
-
case
|
|
11346
|
+
case 26:
|
|
11331
11347
|
json = _context5.sent;
|
|
11332
11348
|
if (Array.isArray(json === null || json === void 0 ? void 0 : json.data)) {
|
|
11333
|
-
_context5.next =
|
|
11349
|
+
_context5.next = 29;
|
|
11334
11350
|
break;
|
|
11335
11351
|
}
|
|
11336
11352
|
return _context5.abrupt("return", []);
|
|
11337
11353
|
|
|
11338
|
-
case
|
|
11354
|
+
case 29:
|
|
11339
11355
|
return _context5.abrupt("return", json.data.map((function(item) {
|
|
11340
11356
|
var flat = {};
|
|
11341
11357
|
for (var _i11 = 0, _Object$entries2 = Object.entries(item); _i11 < _Object$entries2.length; _i11++) {
|
|
@@ -11348,17 +11364,17 @@ function _typeof(o) {
|
|
|
11348
11364
|
return flat;
|
|
11349
11365
|
})));
|
|
11350
11366
|
|
|
11351
|
-
case
|
|
11352
|
-
_context5.prev =
|
|
11353
|
-
_context5.t0 = _context5["catch"](
|
|
11367
|
+
case 32:
|
|
11368
|
+
_context5.prev = 32;
|
|
11369
|
+
_context5.t0 = _context5["catch"](18);
|
|
11354
11370
|
console.error("FIREFLY fetch error:", _context5.t0);
|
|
11355
11371
|
return _context5.abrupt("return", ERROR_MESSAGES_FLAG.DEFAULT);
|
|
11356
11372
|
|
|
11357
|
-
case
|
|
11373
|
+
case 36:
|
|
11358
11374
|
case "end":
|
|
11359
11375
|
return _context5.stop();
|
|
11360
11376
|
}
|
|
11361
|
-
}), _callee5, null, [ [
|
|
11377
|
+
}), _callee5, null, [ [ 18, 32 ] ]);
|
|
11362
11378
|
})));
|
|
11363
11379
|
return _FIREFLY.apply(this, arguments);
|
|
11364
11380
|
}
|
|
@@ -11383,6 +11399,13 @@ function _typeof(o) {
|
|
|
11383
11399
|
return _context6.abrupt("return", "".concat(SERVICE_API_KEY.Firefly).concat(ERROR_MESSAGES_FLAG.MISSING_KEY));
|
|
11384
11400
|
|
|
11385
11401
|
case 4:
|
|
11402
|
+
if (!(end > MAX_PAGE_LIMIT)) {
|
|
11403
|
+
_context6.next = 6;
|
|
11404
|
+
break;
|
|
11405
|
+
}
|
|
11406
|
+
return _context6.abrupt("return", ERROR_MESSAGES_FLAG.MAX_PAGE_LIMIT);
|
|
11407
|
+
|
|
11408
|
+
case 6:
|
|
11386
11409
|
baseUrl = "https://openapi.firefly.land/v1/fileverse/fetch";
|
|
11387
11410
|
headers = {
|
|
11388
11411
|
"x-api-key": API_KEY
|
|
@@ -11393,12 +11416,12 @@ function _typeof(o) {
|
|
|
11393
11416
|
};
|
|
11394
11417
|
platformType = typeMap[contentType];
|
|
11395
11418
|
if (platformType) {
|
|
11396
|
-
_context6.next =
|
|
11419
|
+
_context6.next = 12;
|
|
11397
11420
|
break;
|
|
11398
11421
|
}
|
|
11399
11422
|
return _context6.abrupt("return", "Lens: ".concat(ERROR_MESSAGES_FLAG.INVALID_TYPE));
|
|
11400
11423
|
|
|
11401
|
-
case
|
|
11424
|
+
case 12:
|
|
11402
11425
|
query = identifier.split(",").map((function(s) {
|
|
11403
11426
|
return s.trim();
|
|
11404
11427
|
})).filter(Boolean).join(",");
|
|
@@ -11407,33 +11430,33 @@ function _typeof(o) {
|
|
|
11407
11430
|
url.searchParams.set("type", platformType);
|
|
11408
11431
|
url.searchParams.set("start", String(start));
|
|
11409
11432
|
url.searchParams.set("end", String(end));
|
|
11410
|
-
_context6.prev =
|
|
11411
|
-
_context6.next =
|
|
11433
|
+
_context6.prev = 18;
|
|
11434
|
+
_context6.next = 21;
|
|
11412
11435
|
return fetch(url.toString(), {
|
|
11413
11436
|
headers: headers
|
|
11414
11437
|
});
|
|
11415
11438
|
|
|
11416
|
-
case
|
|
11439
|
+
case 21:
|
|
11417
11440
|
res = _context6.sent;
|
|
11418
11441
|
if (res.ok) {
|
|
11419
|
-
_context6.next =
|
|
11442
|
+
_context6.next = 24;
|
|
11420
11443
|
break;
|
|
11421
11444
|
}
|
|
11422
11445
|
throw new Error("HTTP ".concat(res.status));
|
|
11423
11446
|
|
|
11424
|
-
case
|
|
11425
|
-
_context6.next =
|
|
11447
|
+
case 24:
|
|
11448
|
+
_context6.next = 26;
|
|
11426
11449
|
return res.json();
|
|
11427
11450
|
|
|
11428
|
-
case
|
|
11451
|
+
case 26:
|
|
11429
11452
|
json = _context6.sent;
|
|
11430
11453
|
if (Array.isArray(json === null || json === void 0 ? void 0 : json.data)) {
|
|
11431
|
-
_context6.next =
|
|
11454
|
+
_context6.next = 29;
|
|
11432
11455
|
break;
|
|
11433
11456
|
}
|
|
11434
11457
|
return _context6.abrupt("return", []);
|
|
11435
11458
|
|
|
11436
|
-
case
|
|
11459
|
+
case 29:
|
|
11437
11460
|
return _context6.abrupt("return", json.data.map((function(item) {
|
|
11438
11461
|
var flat = {};
|
|
11439
11462
|
for (var _i12 = 0, _Object$entries3 = Object.entries(item); _i12 < _Object$entries3.length; _i12++) {
|
|
@@ -11446,17 +11469,17 @@ function _typeof(o) {
|
|
|
11446
11469
|
return flat;
|
|
11447
11470
|
})));
|
|
11448
11471
|
|
|
11449
|
-
case
|
|
11450
|
-
_context6.prev =
|
|
11451
|
-
_context6.t0 = _context6["catch"](
|
|
11472
|
+
case 32:
|
|
11473
|
+
_context6.prev = 32;
|
|
11474
|
+
_context6.t0 = _context6["catch"](18);
|
|
11452
11475
|
console.error("LENS fetch error:", _context6.t0);
|
|
11453
11476
|
return _context6.abrupt("return", ERROR_MESSAGES_FLAG.DEFAULT);
|
|
11454
11477
|
|
|
11455
|
-
case
|
|
11478
|
+
case 36:
|
|
11456
11479
|
case "end":
|
|
11457
11480
|
return _context6.stop();
|
|
11458
11481
|
}
|
|
11459
|
-
}), _callee6, null, [ [
|
|
11482
|
+
}), _callee6, null, [ [ 18, 32 ] ]);
|
|
11460
11483
|
})));
|
|
11461
11484
|
return _LENS.apply(this, arguments);
|
|
11462
11485
|
}
|
|
@@ -11481,6 +11504,13 @@ function _typeof(o) {
|
|
|
11481
11504
|
return _context7.abrupt("return", "".concat(SERVICE_API_KEY.Firefly).concat(ERROR_MESSAGES_FLAG.MISSING_KEY));
|
|
11482
11505
|
|
|
11483
11506
|
case 4:
|
|
11507
|
+
if (!(end > MAX_PAGE_LIMIT)) {
|
|
11508
|
+
_context7.next = 6;
|
|
11509
|
+
break;
|
|
11510
|
+
}
|
|
11511
|
+
return _context7.abrupt("return", ERROR_MESSAGES_FLAG.MAX_PAGE_LIMIT);
|
|
11512
|
+
|
|
11513
|
+
case 6:
|
|
11484
11514
|
baseUrl = "https://openapi.firefly.land/v1/fileverse/fetch";
|
|
11485
11515
|
headers = {
|
|
11486
11516
|
"x-api-key": API_KEY
|
|
@@ -11492,12 +11522,12 @@ function _typeof(o) {
|
|
|
11492
11522
|
};
|
|
11493
11523
|
platformType = typeMap[contentType];
|
|
11494
11524
|
if (platformType) {
|
|
11495
|
-
_context7.next =
|
|
11525
|
+
_context7.next = 12;
|
|
11496
11526
|
break;
|
|
11497
11527
|
}
|
|
11498
11528
|
return _context7.abrupt("return", "Farcaster: ".concat(ERROR_MESSAGES_FLAG.INVALID_TYPE));
|
|
11499
11529
|
|
|
11500
|
-
case
|
|
11530
|
+
case 12:
|
|
11501
11531
|
query = identifier.split(",").map((function(s) {
|
|
11502
11532
|
return s.trim();
|
|
11503
11533
|
})).filter(Boolean).join(",");
|
|
@@ -11506,33 +11536,33 @@ function _typeof(o) {
|
|
|
11506
11536
|
url.searchParams.set("type", platformType);
|
|
11507
11537
|
url.searchParams.set("start", String(start));
|
|
11508
11538
|
url.searchParams.set("end", String(end));
|
|
11509
|
-
_context7.prev =
|
|
11510
|
-
_context7.next =
|
|
11539
|
+
_context7.prev = 18;
|
|
11540
|
+
_context7.next = 21;
|
|
11511
11541
|
return fetch(url.toString(), {
|
|
11512
11542
|
headers: headers
|
|
11513
11543
|
});
|
|
11514
11544
|
|
|
11515
|
-
case
|
|
11545
|
+
case 21:
|
|
11516
11546
|
res = _context7.sent;
|
|
11517
11547
|
if (res.ok) {
|
|
11518
|
-
_context7.next =
|
|
11548
|
+
_context7.next = 24;
|
|
11519
11549
|
break;
|
|
11520
11550
|
}
|
|
11521
11551
|
throw new Error("HTTP ".concat(res.status));
|
|
11522
11552
|
|
|
11523
|
-
case
|
|
11524
|
-
_context7.next =
|
|
11553
|
+
case 24:
|
|
11554
|
+
_context7.next = 26;
|
|
11525
11555
|
return res.json();
|
|
11526
11556
|
|
|
11527
|
-
case
|
|
11557
|
+
case 26:
|
|
11528
11558
|
json = _context7.sent;
|
|
11529
11559
|
if (Array.isArray(json === null || json === void 0 ? void 0 : json.data)) {
|
|
11530
|
-
_context7.next =
|
|
11560
|
+
_context7.next = 29;
|
|
11531
11561
|
break;
|
|
11532
11562
|
}
|
|
11533
11563
|
return _context7.abrupt("return", []);
|
|
11534
11564
|
|
|
11535
|
-
case
|
|
11565
|
+
case 29:
|
|
11536
11566
|
return _context7.abrupt("return", json.data.map((function(item) {
|
|
11537
11567
|
var flat = {};
|
|
11538
11568
|
for (var _i13 = 0, _Object$entries4 = Object.entries(item); _i13 < _Object$entries4.length; _i13++) {
|
|
@@ -11545,17 +11575,17 @@ function _typeof(o) {
|
|
|
11545
11575
|
return flat;
|
|
11546
11576
|
})));
|
|
11547
11577
|
|
|
11548
|
-
case
|
|
11549
|
-
_context7.prev =
|
|
11550
|
-
_context7.t0 = _context7["catch"](
|
|
11578
|
+
case 32:
|
|
11579
|
+
_context7.prev = 32;
|
|
11580
|
+
_context7.t0 = _context7["catch"](18);
|
|
11551
11581
|
console.error("Farcaster fetch error:", _context7.t0);
|
|
11552
11582
|
return _context7.abrupt("return", ERROR_MESSAGES_FLAG.DEFAULT);
|
|
11553
11583
|
|
|
11554
|
-
case
|
|
11584
|
+
case 36:
|
|
11555
11585
|
case "end":
|
|
11556
11586
|
return _context7.stop();
|
|
11557
11587
|
}
|
|
11558
|
-
}), _callee7, null, [ [
|
|
11588
|
+
}), _callee7, null, [ [ 18, 32 ] ]);
|
|
11559
11589
|
})));
|
|
11560
11590
|
return _FARCASTER.apply(this, arguments);
|
|
11561
11591
|
}
|
|
@@ -11571,16 +11601,23 @@ function _typeof(o) {
|
|
|
11571
11601
|
_argsToArray9 = argsToArray(_args8), _argsToArray0 = _slicedToArray(_argsToArray9, 7),
|
|
11572
11602
|
address = _argsToArray0[0], type = _argsToArray0[1], chain = _argsToArray0[2], startTimestamp = _argsToArray0[3],
|
|
11573
11603
|
endTimestamp = _argsToArray0[4], page = _argsToArray0[5], offset = _argsToArray0[6];
|
|
11604
|
+
if (!(offset > MAX_PAGE_LIMIT)) {
|
|
11605
|
+
_context8.next = 3;
|
|
11606
|
+
break;
|
|
11607
|
+
}
|
|
11608
|
+
return _context8.abrupt("return", ERROR_MESSAGES_FLAG.MAX_PAGE_LIMIT);
|
|
11609
|
+
|
|
11610
|
+
case 3:
|
|
11574
11611
|
if (!chain) {
|
|
11575
11612
|
chain = "ethereum";
|
|
11576
11613
|
}
|
|
11577
11614
|
if (type) {
|
|
11578
|
-
_context8.next =
|
|
11615
|
+
_context8.next = 6;
|
|
11579
11616
|
break;
|
|
11580
11617
|
}
|
|
11581
11618
|
return _context8.abrupt("return", "TYPE_MISSING");
|
|
11582
11619
|
|
|
11583
|
-
case
|
|
11620
|
+
case 6:
|
|
11584
11621
|
if (!startTimestamp) {
|
|
11585
11622
|
currentTimestamp = Date.now();
|
|
11586
11623
|
startTimestamp = currentTimestamp - 30 * 24 * 60 * 60 * 1e3;
|
|
@@ -11593,104 +11630,104 @@ function _typeof(o) {
|
|
|
11593
11630
|
endTimestamp = toTimestamp(endTimestamp);
|
|
11594
11631
|
}
|
|
11595
11632
|
if (isAddress(address)) {
|
|
11596
|
-
_context8.next =
|
|
11633
|
+
_context8.next = 13;
|
|
11597
11634
|
break;
|
|
11598
11635
|
}
|
|
11599
|
-
_context8.next =
|
|
11636
|
+
_context8.next = 12;
|
|
11600
11637
|
return fromEnsNameToAddress(address);
|
|
11601
11638
|
|
|
11602
|
-
case
|
|
11639
|
+
case 12:
|
|
11603
11640
|
address = _context8.sent;
|
|
11604
11641
|
|
|
11605
|
-
case
|
|
11642
|
+
case 13:
|
|
11606
11643
|
if (address) {
|
|
11607
|
-
_context8.next =
|
|
11644
|
+
_context8.next = 15;
|
|
11608
11645
|
break;
|
|
11609
11646
|
}
|
|
11610
11647
|
return _context8.abrupt("return", "".concat(address).concat(ERROR_MESSAGES_FLAG.INVALID_PARAM));
|
|
11611
11648
|
|
|
11612
|
-
case
|
|
11649
|
+
case 15:
|
|
11613
11650
|
hostname = BLOCKSCOUT_CHAINS_MAP[chain];
|
|
11614
11651
|
_context8.t0 = type;
|
|
11615
|
-
_context8.next = _context8.t0 === "stat" ?
|
|
11652
|
+
_context8.next = _context8.t0 === "stat" ? 19 : _context8.t0 === "txns" ? 21 : _context8.t0 === "tokens" ? 23 : 25;
|
|
11616
11653
|
break;
|
|
11617
11654
|
|
|
11618
|
-
case
|
|
11655
|
+
case 19:
|
|
11619
11656
|
requestUrl = "".concat(hostname, "/api/v2/addresses/").concat(address, "/counters");
|
|
11620
|
-
return _context8.abrupt("break",
|
|
11657
|
+
return _context8.abrupt("break", 26);
|
|
11621
11658
|
|
|
11622
|
-
case
|
|
11659
|
+
case 21:
|
|
11623
11660
|
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");
|
|
11624
|
-
return _context8.abrupt("break",
|
|
11661
|
+
return _context8.abrupt("break", 26);
|
|
11625
11662
|
|
|
11626
|
-
case
|
|
11663
|
+
case 23:
|
|
11627
11664
|
requestUrl = "".concat(hostname, "/api?module=account&action=tokenlist&address=").concat(address);
|
|
11628
|
-
return _context8.abrupt("break",
|
|
11665
|
+
return _context8.abrupt("break", 26);
|
|
11629
11666
|
|
|
11630
|
-
case
|
|
11667
|
+
case 25:
|
|
11631
11668
|
return _context8.abrupt("return", "INVALID_TYPE");
|
|
11632
11669
|
|
|
11633
|
-
case
|
|
11634
|
-
_context8.prev =
|
|
11635
|
-
_context8.next =
|
|
11670
|
+
case 26:
|
|
11671
|
+
_context8.prev = 26;
|
|
11672
|
+
_context8.next = 29;
|
|
11636
11673
|
return fetch(requestUrl);
|
|
11637
11674
|
|
|
11638
|
-
case
|
|
11675
|
+
case 29:
|
|
11639
11676
|
response = _context8.sent;
|
|
11640
11677
|
if (response.ok) {
|
|
11641
|
-
_context8.next =
|
|
11678
|
+
_context8.next = 32;
|
|
11642
11679
|
break;
|
|
11643
11680
|
}
|
|
11644
11681
|
throw new Error("HTTP error! Status: ".concat(response.status));
|
|
11645
11682
|
|
|
11646
|
-
case
|
|
11647
|
-
_context8.next =
|
|
11683
|
+
case 32:
|
|
11684
|
+
_context8.next = 34;
|
|
11648
11685
|
return response.json();
|
|
11649
11686
|
|
|
11650
|
-
case
|
|
11687
|
+
case 34:
|
|
11651
11688
|
json = _context8.sent;
|
|
11652
11689
|
console.log(json);
|
|
11653
11690
|
if (!(json !== null && json !== void 0 && (_json$result = json.result) !== null && _json$result !== void 0 && _json$result.includes("Invalid parameter(s)"))) {
|
|
11654
|
-
_context8.next =
|
|
11691
|
+
_context8.next = 38;
|
|
11655
11692
|
break;
|
|
11656
11693
|
}
|
|
11657
11694
|
return _context8.abrupt("return", "INVALID_REQUEST_PARAMS");
|
|
11658
11695
|
|
|
11659
|
-
case
|
|
11696
|
+
case 38:
|
|
11660
11697
|
if (!(json !== null && json !== void 0 && (_json$result2 = json.result) !== null && _json$result2 !== void 0 && _json$result2.includes("Not found"))) {
|
|
11661
|
-
_context8.next =
|
|
11698
|
+
_context8.next = 40;
|
|
11662
11699
|
break;
|
|
11663
11700
|
}
|
|
11664
11701
|
return _context8.abrupt("return", "ADDRESS_NOT_FOUND");
|
|
11665
11702
|
|
|
11666
|
-
case
|
|
11703
|
+
case 40:
|
|
11667
11704
|
if (!(type === "stat")) {
|
|
11668
|
-
_context8.next =
|
|
11705
|
+
_context8.next = 42;
|
|
11669
11706
|
break;
|
|
11670
11707
|
}
|
|
11671
11708
|
return _context8.abrupt("return", [ json ]);
|
|
11672
11709
|
|
|
11673
|
-
case
|
|
11710
|
+
case 42:
|
|
11674
11711
|
return _context8.abrupt("return", json.result);
|
|
11675
11712
|
|
|
11676
|
-
case
|
|
11677
|
-
_context8.prev =
|
|
11678
|
-
_context8.t1 = _context8["catch"](
|
|
11713
|
+
case 45:
|
|
11714
|
+
_context8.prev = 45;
|
|
11715
|
+
_context8.t1 = _context8["catch"](26);
|
|
11679
11716
|
return _context8.abrupt("return", "ERROR IN FETCHING");
|
|
11680
11717
|
|
|
11681
|
-
case
|
|
11718
|
+
case 48:
|
|
11682
11719
|
case "end":
|
|
11683
11720
|
return _context8.stop();
|
|
11684
11721
|
}
|
|
11685
|
-
}), _callee8, null, [ [
|
|
11722
|
+
}), _callee8, null, [ [ 26, 45 ] ]);
|
|
11686
11723
|
})));
|
|
11687
11724
|
return _BLOCKSCOUT.apply(this, arguments);
|
|
11688
11725
|
}
|
|
11689
|
-
function
|
|
11690
|
-
return
|
|
11726
|
+
function BASE() {
|
|
11727
|
+
return _BASE.apply(this, arguments);
|
|
11691
11728
|
}
|
|
11692
|
-
function
|
|
11693
|
-
|
|
11729
|
+
function _BASE() {
|
|
11730
|
+
_BASE = _asyncToGenerator(_regeneratorRuntime().mark((function _callee9() {
|
|
11694
11731
|
var _argsToArray1, _argsToArray10, type, chain, address, startDate, endDate, page, limit, _args9 = arguments;
|
|
11695
11732
|
return _regeneratorRuntime().wrap((function _callee9$(_context9) {
|
|
11696
11733
|
while (1) switch (_context9.prev = _context9.next) {
|
|
@@ -11700,8 +11737,8 @@ function _typeof(o) {
|
|
|
11700
11737
|
startDate = _argsToArray10[3], endDate = _argsToArray10[4], page = _argsToArray10[5],
|
|
11701
11738
|
limit = _argsToArray10[6];
|
|
11702
11739
|
return _context9.abrupt("return", handleScanRequest({
|
|
11703
|
-
scanKey: SERVICE_API_KEY.
|
|
11704
|
-
baseUrl: "https://api.
|
|
11740
|
+
scanKey: SERVICE_API_KEY.Basescan,
|
|
11741
|
+
baseUrl: "https://api.basescan.org/api",
|
|
11705
11742
|
type: type,
|
|
11706
11743
|
chain: chain,
|
|
11707
11744
|
address: address,
|
|
@@ -11717,49 +11754,82 @@ function _typeof(o) {
|
|
|
11717
11754
|
}
|
|
11718
11755
|
}), _callee9);
|
|
11719
11756
|
})));
|
|
11757
|
+
return _BASE.apply(this, arguments);
|
|
11758
|
+
}
|
|
11759
|
+
function GNOSIS() {
|
|
11760
|
+
return _GNOSIS.apply(this, arguments);
|
|
11761
|
+
}
|
|
11762
|
+
function _GNOSIS() {
|
|
11763
|
+
_GNOSIS = _asyncToGenerator(_regeneratorRuntime().mark((function _callee0() {
|
|
11764
|
+
var _argsToArray11, _argsToArray12, type, chain, address, startDate, endDate, page, limit, _args0 = arguments;
|
|
11765
|
+
return _regeneratorRuntime().wrap((function _callee0$(_context0) {
|
|
11766
|
+
while (1) switch (_context0.prev = _context0.next) {
|
|
11767
|
+
case 0:
|
|
11768
|
+
_argsToArray11 = argsToArray(_args0), _argsToArray12 = _slicedToArray(_argsToArray11, 7),
|
|
11769
|
+
type = _argsToArray12[0], chain = _argsToArray12[1], address = _argsToArray12[2],
|
|
11770
|
+
startDate = _argsToArray12[3], endDate = _argsToArray12[4], page = _argsToArray12[5],
|
|
11771
|
+
limit = _argsToArray12[6];
|
|
11772
|
+
return _context0.abrupt("return", handleScanRequest({
|
|
11773
|
+
scanKey: SERVICE_API_KEY.Gnosisscan,
|
|
11774
|
+
baseUrl: "https://api.gnosisscan.io/api",
|
|
11775
|
+
type: type,
|
|
11776
|
+
chain: chain,
|
|
11777
|
+
address: address,
|
|
11778
|
+
startDate: startDate,
|
|
11779
|
+
endDate: endDate,
|
|
11780
|
+
page: page,
|
|
11781
|
+
offset: limit
|
|
11782
|
+
}));
|
|
11783
|
+
|
|
11784
|
+
case 2:
|
|
11785
|
+
case "end":
|
|
11786
|
+
return _context0.stop();
|
|
11787
|
+
}
|
|
11788
|
+
}), _callee0);
|
|
11789
|
+
})));
|
|
11720
11790
|
return _GNOSIS.apply(this, arguments);
|
|
11721
11791
|
}
|
|
11722
11792
|
function NEYNAR() {
|
|
11723
11793
|
return _NEYNAR.apply(this, arguments);
|
|
11724
11794
|
}
|
|
11725
11795
|
function _NEYNAR() {
|
|
11726
|
-
_NEYNAR = _asyncToGenerator(_regeneratorRuntime().mark((function
|
|
11727
|
-
var
|
|
11728
|
-
return _regeneratorRuntime().wrap((function
|
|
11729
|
-
while (1) switch (
|
|
11796
|
+
_NEYNAR = _asyncToGenerator(_regeneratorRuntime().mark((function _callee1() {
|
|
11797
|
+
var _argsToArray13, _argsToArray14, username, API_KEY, fid, url, _json$users, response, json, _args1 = arguments;
|
|
11798
|
+
return _regeneratorRuntime().wrap((function _callee1$(_context1) {
|
|
11799
|
+
while (1) switch (_context1.prev = _context1.next) {
|
|
11730
11800
|
case 0:
|
|
11731
|
-
|
|
11732
|
-
username =
|
|
11801
|
+
_argsToArray13 = argsToArray(_args1), _argsToArray14 = _slicedToArray(_argsToArray13, 1),
|
|
11802
|
+
username = _argsToArray14[0];
|
|
11733
11803
|
API_KEY = window.localStorage.getItem(SERVICE_API_KEY.Neynar);
|
|
11734
11804
|
if (API_KEY) {
|
|
11735
|
-
|
|
11805
|
+
_context1.next = 4;
|
|
11736
11806
|
break;
|
|
11737
11807
|
}
|
|
11738
|
-
return
|
|
11808
|
+
return _context1.abrupt("return", "".concat(SERVICE_API_KEY.Neynar).concat(ERROR_MESSAGES_FLAG.MISSING_KEY));
|
|
11739
11809
|
|
|
11740
11810
|
case 4:
|
|
11741
11811
|
if (username) {
|
|
11742
|
-
|
|
11812
|
+
_context1.next = 6;
|
|
11743
11813
|
break;
|
|
11744
11814
|
}
|
|
11745
|
-
return
|
|
11815
|
+
return _context1.abrupt("return", "".concat(SERVICE_API_KEY.Neynar).concat(ERROR_MESSAGES_FLAG.INVALID_PARAM));
|
|
11746
11816
|
|
|
11747
11817
|
case 6:
|
|
11748
|
-
|
|
11818
|
+
_context1.next = 8;
|
|
11749
11819
|
return fromUsernameToFid(username, API_KEY);
|
|
11750
11820
|
|
|
11751
11821
|
case 8:
|
|
11752
|
-
fid =
|
|
11822
|
+
fid = _context1.sent;
|
|
11753
11823
|
if (fid) {
|
|
11754
|
-
|
|
11824
|
+
_context1.next = 11;
|
|
11755
11825
|
break;
|
|
11756
11826
|
}
|
|
11757
|
-
return
|
|
11827
|
+
return _context1.abrupt("return", "".concat(SERVICE_API_KEY.Neynar).concat(ERROR_MESSAGES_FLAG.INVALID_PARAM));
|
|
11758
11828
|
|
|
11759
11829
|
case 11:
|
|
11760
11830
|
url = "https://api.neynar.com/v2/farcaster/followers?fid=".concat(fid);
|
|
11761
|
-
|
|
11762
|
-
|
|
11831
|
+
_context1.prev = 12;
|
|
11832
|
+
_context1.next = 15;
|
|
11763
11833
|
return fetch(url, {
|
|
11764
11834
|
headers: {
|
|
11765
11835
|
"x-api-key": API_KEY,
|
|
@@ -11768,27 +11838,27 @@ function _typeof(o) {
|
|
|
11768
11838
|
});
|
|
11769
11839
|
|
|
11770
11840
|
case 15:
|
|
11771
|
-
response =
|
|
11841
|
+
response = _context1.sent;
|
|
11772
11842
|
if (response.ok) {
|
|
11773
|
-
|
|
11843
|
+
_context1.next = 18;
|
|
11774
11844
|
break;
|
|
11775
11845
|
}
|
|
11776
11846
|
throw new Error("HTTP ".concat(response.status));
|
|
11777
11847
|
|
|
11778
11848
|
case 18:
|
|
11779
|
-
|
|
11849
|
+
_context1.next = 20;
|
|
11780
11850
|
return response.json();
|
|
11781
11851
|
|
|
11782
11852
|
case 20:
|
|
11783
|
-
json =
|
|
11853
|
+
json = _context1.sent;
|
|
11784
11854
|
if (json !== null && json !== void 0 && (_json$users = json.users) !== null && _json$users !== void 0 && _json$users.length) {
|
|
11785
|
-
|
|
11855
|
+
_context1.next = 23;
|
|
11786
11856
|
break;
|
|
11787
11857
|
}
|
|
11788
|
-
return
|
|
11858
|
+
return _context1.abrupt("return", []);
|
|
11789
11859
|
|
|
11790
11860
|
case 23:
|
|
11791
|
-
return
|
|
11861
|
+
return _context1.abrupt("return", json.users.map((function(_ref5) {
|
|
11792
11862
|
var _user$profile, _user$profile2;
|
|
11793
11863
|
var user = _ref5.user;
|
|
11794
11864
|
return {
|
|
@@ -11801,16 +11871,16 @@ function _typeof(o) {
|
|
|
11801
11871
|
})));
|
|
11802
11872
|
|
|
11803
11873
|
case 26:
|
|
11804
|
-
|
|
11805
|
-
|
|
11806
|
-
console.error("NEYNAR_FETCH_FOLLOWERS error:",
|
|
11807
|
-
return
|
|
11874
|
+
_context1.prev = 26;
|
|
11875
|
+
_context1.t0 = _context1["catch"](12);
|
|
11876
|
+
console.error("NEYNAR_FETCH_FOLLOWERS error:", _context1.t0);
|
|
11877
|
+
return _context1.abrupt("return", ERROR_MESSAGES_FLAG.DEFAULT);
|
|
11808
11878
|
|
|
11809
11879
|
case 30:
|
|
11810
11880
|
case "end":
|
|
11811
|
-
return
|
|
11881
|
+
return _context1.stop();
|
|
11812
11882
|
}
|
|
11813
|
-
}),
|
|
11883
|
+
}), _callee1, null, [ [ 12, 26 ] ]);
|
|
11814
11884
|
})));
|
|
11815
11885
|
return _NEYNAR.apply(this, arguments);
|
|
11816
11886
|
}
|
|
@@ -11818,10 +11888,10 @@ function _typeof(o) {
|
|
|
11818
11888
|
return _GNOSISPAY.apply(this, arguments);
|
|
11819
11889
|
}
|
|
11820
11890
|
function _GNOSISPAY() {
|
|
11821
|
-
_GNOSISPAY = _asyncToGenerator(_regeneratorRuntime().mark((function
|
|
11891
|
+
_GNOSISPAY = _asyncToGenerator(_regeneratorRuntime().mark((function _callee10(_ref4) {
|
|
11822
11892
|
var cardId, startDate, endDate, _ref4$limit, limit, _ref4$offset, offset, apiKeyKey, API_KEY, url, res, json;
|
|
11823
|
-
return _regeneratorRuntime().wrap((function
|
|
11824
|
-
while (1) switch (
|
|
11893
|
+
return _regeneratorRuntime().wrap((function _callee10$(_context10) {
|
|
11894
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
11825
11895
|
case 0:
|
|
11826
11896
|
cardId = _ref4.cardId, startDate = _ref4.startDate, endDate = _ref4.endDate, _ref4$limit = _ref4.limit,
|
|
11827
11897
|
limit = _ref4$limit === void 0 ? 20 : _ref4$limit, _ref4$offset = _ref4.offset,
|
|
@@ -11829,19 +11899,26 @@ function _typeof(o) {
|
|
|
11829
11899
|
apiKeyKey = SERVICE_API_KEY.GnosisPay;
|
|
11830
11900
|
API_KEY = window.localStorage.getItem(apiKeyKey);
|
|
11831
11901
|
if (API_KEY) {
|
|
11832
|
-
|
|
11902
|
+
_context10.next = 5;
|
|
11833
11903
|
break;
|
|
11834
11904
|
}
|
|
11835
|
-
return
|
|
11905
|
+
return _context10.abrupt("return", "".concat(apiKeyKey).concat(ERROR_MESSAGES_FLAG.MISSING_KEY));
|
|
11836
11906
|
|
|
11837
11907
|
case 5:
|
|
11838
11908
|
if (cardId) {
|
|
11839
|
-
|
|
11909
|
+
_context10.next = 7;
|
|
11840
11910
|
break;
|
|
11841
11911
|
}
|
|
11842
|
-
return
|
|
11912
|
+
return _context10.abrupt("return", "".concat(apiKeyKey).concat(ERROR_MESSAGES_FLAG.INVALID_PARAM));
|
|
11843
11913
|
|
|
11844
11914
|
case 7:
|
|
11915
|
+
if (!(limit > MAX_PAGE_LIMIT)) {
|
|
11916
|
+
_context10.next = 9;
|
|
11917
|
+
break;
|
|
11918
|
+
}
|
|
11919
|
+
return _context10.abrupt("return", ERROR_MESSAGES_FLAG.MAX_PAGE_LIMIT);
|
|
11920
|
+
|
|
11921
|
+
case 9:
|
|
11845
11922
|
url = new URL("https://api.gnosispay.com/cards/".concat(cardId, "/transactions"));
|
|
11846
11923
|
url.searchParams.set("limit", limit.toString());
|
|
11847
11924
|
url.searchParams.set("offset", offset.toString());
|
|
@@ -11851,8 +11928,8 @@ function _typeof(o) {
|
|
|
11851
11928
|
if (!isNaN(toTimestamp(endDate))) {
|
|
11852
11929
|
url.searchParams.set("endDate", new Date(endDate * 1e3).toISOString());
|
|
11853
11930
|
}
|
|
11854
|
-
|
|
11855
|
-
|
|
11931
|
+
_context10.prev = 14;
|
|
11932
|
+
_context10.next = 17;
|
|
11856
11933
|
return fetch(url.toString(), {
|
|
11857
11934
|
headers: {
|
|
11858
11935
|
Authorization: "Bearer ".concat(API_KEY),
|
|
@@ -11860,28 +11937,28 @@ function _typeof(o) {
|
|
|
11860
11937
|
}
|
|
11861
11938
|
});
|
|
11862
11939
|
|
|
11863
|
-
case
|
|
11864
|
-
res =
|
|
11940
|
+
case 17:
|
|
11941
|
+
res = _context10.sent;
|
|
11865
11942
|
if (res.ok) {
|
|
11866
|
-
|
|
11943
|
+
_context10.next = 20;
|
|
11867
11944
|
break;
|
|
11868
11945
|
}
|
|
11869
11946
|
throw new Error("HTTP error! Status: ".concat(res.status));
|
|
11870
11947
|
|
|
11871
|
-
case
|
|
11872
|
-
|
|
11948
|
+
case 20:
|
|
11949
|
+
_context10.next = 22;
|
|
11873
11950
|
return res.json();
|
|
11874
11951
|
|
|
11875
|
-
case
|
|
11876
|
-
json =
|
|
11952
|
+
case 22:
|
|
11953
|
+
json = _context10.sent;
|
|
11877
11954
|
if (Array.isArray(json)) {
|
|
11878
|
-
|
|
11955
|
+
_context10.next = 25;
|
|
11879
11956
|
break;
|
|
11880
11957
|
}
|
|
11881
|
-
return
|
|
11958
|
+
return _context10.abrupt("return", []);
|
|
11882
11959
|
|
|
11883
|
-
case
|
|
11884
|
-
return
|
|
11960
|
+
case 25:
|
|
11961
|
+
return _context10.abrupt("return", json.map((function(tx) {
|
|
11885
11962
|
return {
|
|
11886
11963
|
createdAt: tx.createdAt,
|
|
11887
11964
|
clearedAt: tx.clearedAt,
|
|
@@ -11898,17 +11975,17 @@ function _typeof(o) {
|
|
|
11898
11975
|
};
|
|
11899
11976
|
})));
|
|
11900
11977
|
|
|
11901
|
-
case
|
|
11902
|
-
|
|
11903
|
-
|
|
11904
|
-
console.error("GNOSISPAY_CARD_TXNS error:",
|
|
11905
|
-
return
|
|
11978
|
+
case 28:
|
|
11979
|
+
_context10.prev = 28;
|
|
11980
|
+
_context10.t0 = _context10["catch"](14);
|
|
11981
|
+
console.error("GNOSISPAY_CARD_TXNS error:", _context10.t0);
|
|
11982
|
+
return _context10.abrupt("return", ERROR_MESSAGES_FLAG.DEFAULT);
|
|
11906
11983
|
|
|
11907
|
-
case
|
|
11984
|
+
case 32:
|
|
11908
11985
|
case "end":
|
|
11909
|
-
return
|
|
11986
|
+
return _context10.stop();
|
|
11910
11987
|
}
|
|
11911
|
-
}),
|
|
11988
|
+
}), _callee10, null, [ [ 14, 28 ] ]);
|
|
11912
11989
|
})));
|
|
11913
11990
|
return _GNOSISPAY.apply(this, arguments);
|
|
11914
11991
|
}
|
|
@@ -11916,17 +11993,17 @@ function _typeof(o) {
|
|
|
11916
11993
|
return _ETHERSCAN.apply(this, arguments);
|
|
11917
11994
|
}
|
|
11918
11995
|
function _ETHERSCAN() {
|
|
11919
|
-
_ETHERSCAN = _asyncToGenerator(_regeneratorRuntime().mark((function
|
|
11920
|
-
var _len2, args, _key2, type, chain, address, startDate, endDate, page, limit,
|
|
11921
|
-
return _regeneratorRuntime().wrap((function
|
|
11922
|
-
while (1) switch (
|
|
11996
|
+
_ETHERSCAN = _asyncToGenerator(_regeneratorRuntime().mark((function _callee11() {
|
|
11997
|
+
var _len2, args, _key2, type, chain, address, startDate, endDate, page, limit, _args11 = arguments;
|
|
11998
|
+
return _regeneratorRuntime().wrap((function _callee11$(_context11) {
|
|
11999
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
11923
12000
|
case 0:
|
|
11924
|
-
for (_len2 =
|
|
11925
|
-
args[_key2] =
|
|
12001
|
+
for (_len2 = _args11.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
12002
|
+
args[_key2] = _args11[_key2];
|
|
11926
12003
|
}
|
|
11927
12004
|
type = args[0], chain = args[1], address = args[2], startDate = args[3], endDate = args[4],
|
|
11928
12005
|
page = args[5], limit = args[6];
|
|
11929
|
-
return
|
|
12006
|
+
return _context11.abrupt("return", handleScanRequest({
|
|
11930
12007
|
scanKey: SERVICE_API_KEY.Etherscan,
|
|
11931
12008
|
baseUrl: "https://api.etherscan.io/v2/api",
|
|
11932
12009
|
type: type,
|
|
@@ -11940,9 +12017,9 @@ function _typeof(o) {
|
|
|
11940
12017
|
|
|
11941
12018
|
case 3:
|
|
11942
12019
|
case "end":
|
|
11943
|
-
return
|
|
12020
|
+
return _context11.stop();
|
|
11944
12021
|
}
|
|
11945
|
-
}),
|
|
12022
|
+
}), _callee11);
|
|
11946
12023
|
})));
|
|
11947
12024
|
return _ETHERSCAN.apply(this, arguments);
|
|
11948
12025
|
}
|
|
@@ -11950,17 +12027,17 @@ function _typeof(o) {
|
|
|
11950
12027
|
return _COINGECKO.apply(this, arguments);
|
|
11951
12028
|
}
|
|
11952
12029
|
function _COINGECKO() {
|
|
11953
|
-
_COINGECKO = _asyncToGenerator(_regeneratorRuntime().mark((function
|
|
12030
|
+
_COINGECKO = _asyncToGenerator(_regeneratorRuntime().mark((function _callee12(category, param1, param2) {
|
|
11954
12031
|
var API_KEY, headers, url, lowerCategory, token, vsCurrencies, ecosystemMap, key, categoryVal, trend, _category, _trend, exchange, response, json, _json$status, message, output, _i14, _Object$entries5, _Object$entries5$_i, _token, prices, _i15, _Object$entries6, _Object$entries6$_i, currency, _value9, _key3, _data, exchangeDetails, flatArray;
|
|
11955
|
-
return _regeneratorRuntime().wrap((function
|
|
11956
|
-
while (1) switch (
|
|
12032
|
+
return _regeneratorRuntime().wrap((function _callee12$(_context12) {
|
|
12033
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
11957
12034
|
case 0:
|
|
11958
12035
|
API_KEY = window.localStorage.getItem(SERVICE_API_KEY.Coingecko);
|
|
11959
12036
|
if (API_KEY) {
|
|
11960
|
-
|
|
12037
|
+
_context12.next = 3;
|
|
11961
12038
|
break;
|
|
11962
12039
|
}
|
|
11963
|
-
return
|
|
12040
|
+
return _context12.abrupt("return", "".concat(SERVICE_API_KEY.Coingecko).concat(ERROR_MESSAGES_FLAG.MISSING_KEY));
|
|
11964
12041
|
|
|
11965
12042
|
case 3:
|
|
11966
12043
|
headers = {
|
|
@@ -11969,22 +12046,22 @@ function _typeof(o) {
|
|
|
11969
12046
|
};
|
|
11970
12047
|
url = "";
|
|
11971
12048
|
lowerCategory = (category || "").toLowerCase();
|
|
11972
|
-
|
|
11973
|
-
|
|
12049
|
+
_context12.t0 = lowerCategory;
|
|
12050
|
+
_context12.next = _context12.t0 === "price" ? 9 : _context12.t0 === "market" ? 15 : _context12.t0 === "stablecoins" ? 23 : _context12.t0 === "derivatives" ? 27 : 30;
|
|
11974
12051
|
break;
|
|
11975
12052
|
|
|
11976
12053
|
case 9:
|
|
11977
12054
|
token = param1;
|
|
11978
12055
|
vsCurrencies = param2;
|
|
11979
12056
|
if (token) {
|
|
11980
|
-
|
|
12057
|
+
_context12.next = 13;
|
|
11981
12058
|
break;
|
|
11982
12059
|
}
|
|
11983
|
-
return
|
|
12060
|
+
return _context12.abrupt("return", "".concat(SERVICE_API_KEY.Coingecko).concat(ERROR_MESSAGES_FLAG.INVALID_PARAM));
|
|
11984
12061
|
|
|
11985
12062
|
case 13:
|
|
11986
12063
|
url = "https://api.coingecko.com/api/v3/simple/price?vs_currencies=".concat(vsCurrencies ? vsCurrencies : "usd", "&symbols=").concat(token);
|
|
11987
|
-
return
|
|
12064
|
+
return _context12.abrupt("break", 31);
|
|
11988
12065
|
|
|
11989
12066
|
case 15:
|
|
11990
12067
|
ecosystemMap = {
|
|
@@ -12005,13 +12082,13 @@ function _typeof(o) {
|
|
|
12005
12082
|
url = "https://api.coingecko.com/api/v3/coins/markets?vs_currency=usd&include_tokens=top&page=1&per_page=100";
|
|
12006
12083
|
if (categoryVal) url += "&category=".concat(categoryVal);
|
|
12007
12084
|
if (trend) url += trend;
|
|
12008
|
-
return
|
|
12085
|
+
return _context12.abrupt("break", 31);
|
|
12009
12086
|
|
|
12010
12087
|
case 23:
|
|
12011
12088
|
_category = !param1 || param1.toLowerCase() === "all" ? "stablecoins" : param1.toLowerCase();
|
|
12012
12089
|
_trend = param2 ? "&price_change_percentage=".concat(param2) : "";
|
|
12013
12090
|
url = "https://api.coingecko.com/api/v3/coins/markets?vs_currency=usd&category=".concat(_category, "&order=market_cap_desc&page=1&per_page=100").concat(_trend);
|
|
12014
|
-
return
|
|
12091
|
+
return _context12.abrupt("break", 31);
|
|
12015
12092
|
|
|
12016
12093
|
case 27:
|
|
12017
12094
|
exchange = param1;
|
|
@@ -12020,47 +12097,47 @@ function _typeof(o) {
|
|
|
12020
12097
|
} else {
|
|
12021
12098
|
url = "https://api.coingecko.com/api/v3/derivatives/exchanges/".concat(exchange, "?include_tickers=all");
|
|
12022
12099
|
}
|
|
12023
|
-
return
|
|
12100
|
+
return _context12.abrupt("break", 31);
|
|
12024
12101
|
|
|
12025
12102
|
case 30:
|
|
12026
|
-
return
|
|
12103
|
+
return _context12.abrupt("return", "".concat(SERVICE_API_KEY.Coingecko).concat(ERROR_MESSAGES_FLAG.INVALID_PARAM));
|
|
12027
12104
|
|
|
12028
12105
|
case 31:
|
|
12029
|
-
|
|
12030
|
-
|
|
12106
|
+
_context12.prev = 31;
|
|
12107
|
+
_context12.next = 34;
|
|
12031
12108
|
return fetch(url, {
|
|
12032
12109
|
method: "GET",
|
|
12033
12110
|
headers: headers
|
|
12034
12111
|
});
|
|
12035
12112
|
|
|
12036
12113
|
case 34:
|
|
12037
|
-
response =
|
|
12038
|
-
|
|
12114
|
+
response = _context12.sent;
|
|
12115
|
+
_context12.next = 37;
|
|
12039
12116
|
return response.json();
|
|
12040
12117
|
|
|
12041
12118
|
case 37:
|
|
12042
|
-
json =
|
|
12119
|
+
json = _context12.sent;
|
|
12043
12120
|
if (response.ok) {
|
|
12044
|
-
|
|
12121
|
+
_context12.next = 44;
|
|
12045
12122
|
break;
|
|
12046
12123
|
}
|
|
12047
12124
|
message = (json === null || json === void 0 || (_json$status = json.status) === null || _json$status === void 0 ? void 0 : _json$status.error_message) || "";
|
|
12048
|
-
if (!
|
|
12049
|
-
|
|
12125
|
+
if (!(response.status === 429)) {
|
|
12126
|
+
_context12.next = 42;
|
|
12050
12127
|
break;
|
|
12051
12128
|
}
|
|
12052
|
-
return
|
|
12129
|
+
return _context12.abrupt("return", "".concat(SERVICE_API_KEY.Coingecko).concat(ERROR_MESSAGES_FLAG.RATE_LIMIT));
|
|
12053
12130
|
|
|
12054
12131
|
case 42:
|
|
12055
|
-
if (!(
|
|
12056
|
-
|
|
12132
|
+
if (!message.includes("API Key Missing")) {
|
|
12133
|
+
_context12.next = 44;
|
|
12057
12134
|
break;
|
|
12058
12135
|
}
|
|
12059
|
-
return
|
|
12136
|
+
return _context12.abrupt("return", "".concat(SERVICE_API_KEY.Coingecko).concat(ERROR_MESSAGES_FLAG.INVALID_API_KEY));
|
|
12060
12137
|
|
|
12061
12138
|
case 44:
|
|
12062
12139
|
if (!(lowerCategory === "price")) {
|
|
12063
|
-
|
|
12140
|
+
_context12.next = 48;
|
|
12064
12141
|
break;
|
|
12065
12142
|
}
|
|
12066
12143
|
output = {};
|
|
@@ -12074,7 +12151,7 @@ function _typeof(o) {
|
|
|
12074
12151
|
output[_key3] = _value9;
|
|
12075
12152
|
}
|
|
12076
12153
|
}
|
|
12077
|
-
return
|
|
12154
|
+
return _context12.abrupt("return", [ output ]);
|
|
12078
12155
|
|
|
12079
12156
|
case 48:
|
|
12080
12157
|
_data = json;
|
|
@@ -12101,7 +12178,7 @@ function _typeof(o) {
|
|
|
12101
12178
|
}
|
|
12102
12179
|
}
|
|
12103
12180
|
flatArray = Array.isArray(_data) ? _data : [ _data ];
|
|
12104
|
-
return
|
|
12181
|
+
return _context12.abrupt("return", flatArray.map((function(item) {
|
|
12105
12182
|
var flat = {};
|
|
12106
12183
|
for (var _i16 = 0, _Object$entries7 = Object.entries(item); _i16 < _Object$entries7.length; _i16++) {
|
|
12107
12184
|
var _Object$entries7$_i = _slicedToArray(_Object$entries7[_i16], 2), _key4 = _Object$entries7$_i[0], _value0 = _Object$entries7$_i[1];
|
|
@@ -12113,16 +12190,16 @@ function _typeof(o) {
|
|
|
12113
12190
|
})));
|
|
12114
12191
|
|
|
12115
12192
|
case 54:
|
|
12116
|
-
|
|
12117
|
-
|
|
12118
|
-
console.error(
|
|
12119
|
-
return
|
|
12193
|
+
_context12.prev = 54;
|
|
12194
|
+
_context12.t1 = _context12["catch"](31);
|
|
12195
|
+
console.error(_context12.t1);
|
|
12196
|
+
return _context12.abrupt("return", ERROR_MESSAGES_FLAG.DEFAULT);
|
|
12120
12197
|
|
|
12121
12198
|
case 58:
|
|
12122
12199
|
case "end":
|
|
12123
|
-
return
|
|
12200
|
+
return _context12.stop();
|
|
12124
12201
|
}
|
|
12125
|
-
}),
|
|
12202
|
+
}), _callee12, null, [ [ 31, 54 ] ]);
|
|
12126
12203
|
})));
|
|
12127
12204
|
return _COINGECKO.apply(this, arguments);
|
|
12128
12205
|
}
|
|
@@ -12130,68 +12207,68 @@ function _typeof(o) {
|
|
|
12130
12207
|
return _EOA.apply(this, arguments);
|
|
12131
12208
|
}
|
|
12132
12209
|
function _EOA() {
|
|
12133
|
-
_EOA = _asyncToGenerator(_regeneratorRuntime().mark((function
|
|
12134
|
-
var API_KEY,
|
|
12135
|
-
return _regeneratorRuntime().wrap((function
|
|
12136
|
-
while (1) switch (
|
|
12210
|
+
_EOA = _asyncToGenerator(_regeneratorRuntime().mark((function _callee14() {
|
|
12211
|
+
var API_KEY, _argsToArray15, _argsToArray16, addresses, category, chains, startTime, endTime, _argsToArray16$, page, _argsToArray16$2, offset, INPUTS, CHAINS, out, ADDRESS_MAP, _iterator, _step, input, resolved, ADDRS, _iterator2, _step2, _loop, _ret, fetchJSON, _fetchJSON, _args17 = arguments;
|
|
12212
|
+
return _regeneratorRuntime().wrap((function _callee14$(_context17) {
|
|
12213
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
12137
12214
|
case 0:
|
|
12138
12215
|
_fetchJSON = function _fetchJSON3() {
|
|
12139
|
-
_fetchJSON = _asyncToGenerator(_regeneratorRuntime().mark((function
|
|
12216
|
+
_fetchJSON = _asyncToGenerator(_regeneratorRuntime().mark((function _callee13(url) {
|
|
12140
12217
|
var _json$result3, _json$result3$include, _json$result4, _json$result4$include, res, json;
|
|
12141
|
-
return _regeneratorRuntime().wrap((function
|
|
12142
|
-
while (1) switch (
|
|
12218
|
+
return _regeneratorRuntime().wrap((function _callee13$(_context16) {
|
|
12219
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
12143
12220
|
case 0:
|
|
12144
|
-
|
|
12145
|
-
|
|
12221
|
+
_context16.prev = 0;
|
|
12222
|
+
_context16.next = 3;
|
|
12146
12223
|
return fetch(url);
|
|
12147
12224
|
|
|
12148
12225
|
case 3:
|
|
12149
|
-
res =
|
|
12226
|
+
res = _context16.sent;
|
|
12150
12227
|
if (res.ok) {
|
|
12151
|
-
|
|
12228
|
+
_context16.next = 6;
|
|
12152
12229
|
break;
|
|
12153
12230
|
}
|
|
12154
|
-
return
|
|
12231
|
+
return _context16.abrupt("return", "HTTP_".concat(res.status));
|
|
12155
12232
|
|
|
12156
12233
|
case 6:
|
|
12157
|
-
|
|
12234
|
+
_context16.next = 8;
|
|
12158
12235
|
return res.json();
|
|
12159
12236
|
|
|
12160
12237
|
case 8:
|
|
12161
|
-
json =
|
|
12238
|
+
json = _context16.sent;
|
|
12162
12239
|
if (!((_json$result3 = json.result) !== null && _json$result3 !== void 0 && (_json$result3$include = _json$result3.includes) !== null && _json$result3$include !== void 0 && _json$result3$include.call(_json$result3, "Invalid API Key"))) {
|
|
12163
|
-
|
|
12240
|
+
_context16.next = 11;
|
|
12164
12241
|
break;
|
|
12165
12242
|
}
|
|
12166
|
-
return
|
|
12243
|
+
return _context16.abrupt("return", "".concat(SERVICE_API_KEY.Etherscan).concat(ERROR_MESSAGES_FLAG.INVALID_API_KEY));
|
|
12167
12244
|
|
|
12168
12245
|
case 11:
|
|
12169
12246
|
if (!((_json$result4 = json.result) !== null && _json$result4 !== void 0 && (_json$result4$include = _json$result4.includes) !== null && _json$result4$include !== void 0 && _json$result4$include.call(_json$result4, "Max rate limit reached"))) {
|
|
12170
|
-
|
|
12247
|
+
_context16.next = 13;
|
|
12171
12248
|
break;
|
|
12172
12249
|
}
|
|
12173
|
-
return
|
|
12250
|
+
return _context16.abrupt("return", "".concat(SERVICE_API_KEY.Etherscan).concat(ERROR_MESSAGES_FLAG.RATE_LIMIT));
|
|
12174
12251
|
|
|
12175
12252
|
case 13:
|
|
12176
12253
|
if (!(json.status === "0" && json.message !== "No transactions found")) {
|
|
12177
|
-
|
|
12254
|
+
_context16.next = 15;
|
|
12178
12255
|
break;
|
|
12179
12256
|
}
|
|
12180
|
-
return
|
|
12257
|
+
return _context16.abrupt("return", ERROR_MESSAGES_FLAG.DEFAULT);
|
|
12181
12258
|
|
|
12182
12259
|
case 15:
|
|
12183
|
-
return
|
|
12260
|
+
return _context16.abrupt("return", json.result);
|
|
12184
12261
|
|
|
12185
12262
|
case 18:
|
|
12186
|
-
|
|
12187
|
-
|
|
12188
|
-
return
|
|
12263
|
+
_context16.prev = 18;
|
|
12264
|
+
_context16.t0 = _context16["catch"](0);
|
|
12265
|
+
return _context16.abrupt("return", ERROR_MESSAGES_FLAG.DEFAULT);
|
|
12189
12266
|
|
|
12190
12267
|
case 21:
|
|
12191
12268
|
case "end":
|
|
12192
|
-
return
|
|
12269
|
+
return _context16.stop();
|
|
12193
12270
|
}
|
|
12194
|
-
}),
|
|
12271
|
+
}), _callee13, null, [ [ 0, 18 ] ]);
|
|
12195
12272
|
})));
|
|
12196
12273
|
return _fetchJSON.apply(this, arguments);
|
|
12197
12274
|
};
|
|
@@ -12200,17 +12277,24 @@ function _typeof(o) {
|
|
|
12200
12277
|
};
|
|
12201
12278
|
API_KEY = window.localStorage.getItem(SERVICE_API_KEY.Etherscan);
|
|
12202
12279
|
if (API_KEY) {
|
|
12203
|
-
|
|
12280
|
+
_context17.next = 5;
|
|
12204
12281
|
break;
|
|
12205
12282
|
}
|
|
12206
|
-
return
|
|
12283
|
+
return _context17.abrupt("return", "".concat(SERVICE_API_KEY.Etherscan).concat(ERROR_MESSAGES_FLAG.MISSING_KEY));
|
|
12207
12284
|
|
|
12208
12285
|
case 5:
|
|
12209
|
-
|
|
12210
|
-
addresses =
|
|
12211
|
-
startTime =
|
|
12212
|
-
page =
|
|
12213
|
-
offset =
|
|
12286
|
+
_argsToArray15 = argsToArray(_args17), _argsToArray16 = _slicedToArray(_argsToArray15, 7),
|
|
12287
|
+
addresses = _argsToArray16[0], category = _argsToArray16[1], chains = _argsToArray16[2],
|
|
12288
|
+
startTime = _argsToArray16[3], endTime = _argsToArray16[4], _argsToArray16$ = _argsToArray16[5],
|
|
12289
|
+
page = _argsToArray16$ === void 0 ? 1 : _argsToArray16$, _argsToArray16$2 = _argsToArray16[6],
|
|
12290
|
+
offset = _argsToArray16$2 === void 0 ? 10 : _argsToArray16$2;
|
|
12291
|
+
if (!(offset > MAX_PAGE_LIMIT)) {
|
|
12292
|
+
_context17.next = 8;
|
|
12293
|
+
break;
|
|
12294
|
+
}
|
|
12295
|
+
return _context17.abrupt("return", ERROR_MESSAGES_FLAG.MAX_PAGE_LIMIT);
|
|
12296
|
+
|
|
12297
|
+
case 8:
|
|
12214
12298
|
INPUTS = addresses.split(",").map((function(a) {
|
|
12215
12299
|
return a.trim();
|
|
12216
12300
|
})).filter(Boolean);
|
|
@@ -12220,99 +12304,99 @@ function _typeof(o) {
|
|
|
12220
12304
|
out = [];
|
|
12221
12305
|
ADDRESS_MAP = {};
|
|
12222
12306
|
_iterator = _createForOfIteratorHelper(INPUTS);
|
|
12223
|
-
|
|
12307
|
+
_context17.prev = 13;
|
|
12224
12308
|
_iterator.s();
|
|
12225
12309
|
|
|
12226
|
-
case
|
|
12310
|
+
case 15:
|
|
12227
12311
|
if ((_step = _iterator.n()).done) {
|
|
12228
|
-
|
|
12312
|
+
_context17.next = 33;
|
|
12229
12313
|
break;
|
|
12230
12314
|
}
|
|
12231
12315
|
input = _step.value;
|
|
12232
12316
|
if (!isAddress(input)) {
|
|
12233
|
-
|
|
12317
|
+
_context17.next = 21;
|
|
12234
12318
|
break;
|
|
12235
12319
|
}
|
|
12236
12320
|
ADDRESS_MAP[input.toLowerCase()] = null;
|
|
12237
|
-
|
|
12321
|
+
_context17.next = 31;
|
|
12238
12322
|
break;
|
|
12239
12323
|
|
|
12240
|
-
case
|
|
12241
|
-
|
|
12242
|
-
|
|
12324
|
+
case 21:
|
|
12325
|
+
_context17.prev = 21;
|
|
12326
|
+
_context17.next = 24;
|
|
12243
12327
|
return fromEnsNameToAddress(input);
|
|
12244
12328
|
|
|
12245
|
-
case
|
|
12246
|
-
resolved =
|
|
12329
|
+
case 24:
|
|
12330
|
+
resolved = _context17.sent;
|
|
12247
12331
|
if (resolved) ADDRESS_MAP[resolved.toLowerCase()] = input;
|
|
12248
|
-
|
|
12332
|
+
_context17.next = 31;
|
|
12249
12333
|
break;
|
|
12250
12334
|
|
|
12251
|
-
case
|
|
12252
|
-
|
|
12253
|
-
|
|
12254
|
-
return
|
|
12255
|
-
|
|
12256
|
-
case 29:
|
|
12257
|
-
_context16.next = 13;
|
|
12258
|
-
break;
|
|
12335
|
+
case 28:
|
|
12336
|
+
_context17.prev = 28;
|
|
12337
|
+
_context17.t0 = _context17["catch"](21);
|
|
12338
|
+
return _context17.abrupt("return", "".concat(input).concat(ERROR_MESSAGES_FLAG.INVALID_PARAM));
|
|
12259
12339
|
|
|
12260
12340
|
case 31:
|
|
12261
|
-
|
|
12341
|
+
_context17.next = 15;
|
|
12262
12342
|
break;
|
|
12263
12343
|
|
|
12264
12344
|
case 33:
|
|
12265
|
-
|
|
12266
|
-
|
|
12267
|
-
_iterator.e(_context16.t1);
|
|
12345
|
+
_context17.next = 38;
|
|
12346
|
+
break;
|
|
12268
12347
|
|
|
12269
|
-
case
|
|
12270
|
-
|
|
12348
|
+
case 35:
|
|
12349
|
+
_context17.prev = 35;
|
|
12350
|
+
_context17.t1 = _context17["catch"](13);
|
|
12351
|
+
_iterator.e(_context17.t1);
|
|
12352
|
+
|
|
12353
|
+
case 38:
|
|
12354
|
+
_context17.prev = 38;
|
|
12271
12355
|
_iterator.f();
|
|
12272
|
-
return
|
|
12356
|
+
return _context17.finish(38);
|
|
12273
12357
|
|
|
12274
|
-
case
|
|
12358
|
+
case 41:
|
|
12275
12359
|
ADDRS = Object.keys(ADDRESS_MAP);
|
|
12276
12360
|
_iterator2 = _createForOfIteratorHelper(CHAINS);
|
|
12277
|
-
|
|
12361
|
+
_context17.prev = 43;
|
|
12278
12362
|
_loop = _regeneratorRuntime().mark((function _loop() {
|
|
12279
12363
|
var chain, chainId, _loop2, _ret2, i, startBlock, endBlock, _loop3, _ret3, _i17, _ADDRS;
|
|
12280
|
-
return _regeneratorRuntime().wrap((function _loop$(
|
|
12281
|
-
while (1) switch (
|
|
12364
|
+
return _regeneratorRuntime().wrap((function _loop$(_context15) {
|
|
12365
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
12282
12366
|
case 0:
|
|
12283
12367
|
chain = _step2.value;
|
|
12284
12368
|
chainId = CHAIN_ID_MAP[chain];
|
|
12285
12369
|
if (chainId) {
|
|
12286
|
-
|
|
12370
|
+
_context15.next = 4;
|
|
12287
12371
|
break;
|
|
12288
12372
|
}
|
|
12289
|
-
return
|
|
12373
|
+
return _context15.abrupt("return", {
|
|
12290
12374
|
v: ERROR_MESSAGES_FLAG.UNSUPPORTED_CHAIN
|
|
12291
12375
|
});
|
|
12292
12376
|
|
|
12293
12377
|
case 4:
|
|
12294
12378
|
if (!(category === "balance")) {
|
|
12295
|
-
|
|
12379
|
+
_context15.next = 16;
|
|
12296
12380
|
break;
|
|
12297
12381
|
}
|
|
12298
12382
|
_loop2 = _regeneratorRuntime().mark((function _loop2(i) {
|
|
12299
12383
|
var slice, action, url, data;
|
|
12300
|
-
return _regeneratorRuntime().wrap((function _loop2$(
|
|
12301
|
-
while (1) switch (
|
|
12384
|
+
return _regeneratorRuntime().wrap((function _loop2$(_context13) {
|
|
12385
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
12302
12386
|
case 0:
|
|
12303
12387
|
slice = ADDRS.slice(i, i + 20).join(",");
|
|
12304
12388
|
action = "addresstokenbalance";
|
|
12305
12389
|
url = "https://api.etherscan.io/v2/api?chainid=".concat(chainId) + "&module=account&action=".concat(action, "&address=").concat(slice) + "&page=".concat(page, "&offset=100&apikey=").concat(API_KEY);
|
|
12306
|
-
|
|
12390
|
+
_context13.next = 5;
|
|
12307
12391
|
return fetchJSON(url);
|
|
12308
12392
|
|
|
12309
12393
|
case 5:
|
|
12310
|
-
data =
|
|
12394
|
+
data = _context13.sent;
|
|
12311
12395
|
if (!(typeof data === "string")) {
|
|
12312
|
-
|
|
12396
|
+
_context13.next = 8;
|
|
12313
12397
|
break;
|
|
12314
12398
|
}
|
|
12315
|
-
return
|
|
12399
|
+
return _context13.abrupt("return", {
|
|
12316
12400
|
v: {
|
|
12317
12401
|
v: data
|
|
12318
12402
|
}
|
|
@@ -12329,7 +12413,7 @@ function _typeof(o) {
|
|
|
12329
12413
|
|
|
12330
12414
|
case 9:
|
|
12331
12415
|
case "end":
|
|
12332
|
-
return
|
|
12416
|
+
return _context13.stop();
|
|
12333
12417
|
}
|
|
12334
12418
|
}), _loop2);
|
|
12335
12419
|
}));
|
|
@@ -12337,59 +12421,59 @@ function _typeof(o) {
|
|
|
12337
12421
|
|
|
12338
12422
|
case 7:
|
|
12339
12423
|
if (!(i < ADDRS.length)) {
|
|
12340
|
-
|
|
12424
|
+
_context15.next = 15;
|
|
12341
12425
|
break;
|
|
12342
12426
|
}
|
|
12343
|
-
return
|
|
12427
|
+
return _context15.delegateYield(_loop2(i), "t0", 9);
|
|
12344
12428
|
|
|
12345
12429
|
case 9:
|
|
12346
|
-
_ret2 =
|
|
12430
|
+
_ret2 = _context15.t0;
|
|
12347
12431
|
if (!_ret2) {
|
|
12348
|
-
|
|
12432
|
+
_context15.next = 12;
|
|
12349
12433
|
break;
|
|
12350
12434
|
}
|
|
12351
|
-
return
|
|
12435
|
+
return _context15.abrupt("return", _ret2.v);
|
|
12352
12436
|
|
|
12353
12437
|
case 12:
|
|
12354
12438
|
i += 20;
|
|
12355
|
-
|
|
12439
|
+
_context15.next = 7;
|
|
12356
12440
|
break;
|
|
12357
12441
|
|
|
12358
12442
|
case 15:
|
|
12359
|
-
return
|
|
12443
|
+
return _context15.abrupt("return", 0);
|
|
12360
12444
|
|
|
12361
12445
|
case 16:
|
|
12362
12446
|
if (!(category === "txns")) {
|
|
12363
|
-
|
|
12447
|
+
_context15.next = 34;
|
|
12364
12448
|
break;
|
|
12365
12449
|
}
|
|
12366
|
-
|
|
12450
|
+
_context15.next = 19;
|
|
12367
12451
|
return fromTimeStampToBlock(toTimestamp(startTime), chain, API_KEY);
|
|
12368
12452
|
|
|
12369
12453
|
case 19:
|
|
12370
|
-
startBlock =
|
|
12371
|
-
|
|
12454
|
+
startBlock = _context15.sent;
|
|
12455
|
+
_context15.next = 22;
|
|
12372
12456
|
return fromTimeStampToBlock(toTimestamp(endTime), chain, API_KEY);
|
|
12373
12457
|
|
|
12374
12458
|
case 22:
|
|
12375
|
-
endBlock =
|
|
12459
|
+
endBlock = _context15.sent;
|
|
12376
12460
|
_loop3 = _regeneratorRuntime().mark((function _loop3() {
|
|
12377
12461
|
var addr, url, data;
|
|
12378
|
-
return _regeneratorRuntime().wrap((function _loop3$(
|
|
12379
|
-
while (1) switch (
|
|
12462
|
+
return _regeneratorRuntime().wrap((function _loop3$(_context14) {
|
|
12463
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
12380
12464
|
case 0:
|
|
12381
12465
|
addr = _ADDRS[_i17];
|
|
12382
12466
|
url = "https://api.etherscan.io/v2/api?chainid=".concat(chainId) + "&module=account&action=tokentx&address=".concat(addr) + "&startblock=".concat(startBlock, "&endblock=").concat(endBlock) + "&page=".concat(page, "&offset=").concat(offset, "&sort=asc&apikey=").concat(API_KEY);
|
|
12383
|
-
|
|
12467
|
+
_context14.next = 4;
|
|
12384
12468
|
return fetchJSON(url);
|
|
12385
12469
|
|
|
12386
12470
|
case 4:
|
|
12387
|
-
data =
|
|
12471
|
+
data = _context14.sent;
|
|
12388
12472
|
if (!(typeof data === "string")) {
|
|
12389
|
-
|
|
12473
|
+
_context14.next = 7;
|
|
12390
12474
|
break;
|
|
12391
12475
|
}
|
|
12392
|
-
return
|
|
12476
|
+
return _context14.abrupt("return", {
|
|
12393
12477
|
v: {
|
|
12394
12478
|
v: data
|
|
12395
12479
|
}
|
|
@@ -12406,7 +12490,7 @@ function _typeof(o) {
|
|
|
12406
12490
|
|
|
12407
12491
|
case 8:
|
|
12408
12492
|
case "end":
|
|
12409
|
-
return
|
|
12493
|
+
return _context14.stop();
|
|
12410
12494
|
}
|
|
12411
12495
|
}), _loop3);
|
|
12412
12496
|
}));
|
|
@@ -12414,88 +12498,88 @@ function _typeof(o) {
|
|
|
12414
12498
|
|
|
12415
12499
|
case 25:
|
|
12416
12500
|
if (!(_i17 < _ADDRS.length)) {
|
|
12417
|
-
|
|
12501
|
+
_context15.next = 33;
|
|
12418
12502
|
break;
|
|
12419
12503
|
}
|
|
12420
|
-
return
|
|
12504
|
+
return _context15.delegateYield(_loop3(), "t1", 27);
|
|
12421
12505
|
|
|
12422
12506
|
case 27:
|
|
12423
|
-
_ret3 =
|
|
12507
|
+
_ret3 = _context15.t1;
|
|
12424
12508
|
if (!_ret3) {
|
|
12425
|
-
|
|
12509
|
+
_context15.next = 30;
|
|
12426
12510
|
break;
|
|
12427
12511
|
}
|
|
12428
|
-
return
|
|
12512
|
+
return _context15.abrupt("return", _ret3.v);
|
|
12429
12513
|
|
|
12430
12514
|
case 30:
|
|
12431
12515
|
_i17++;
|
|
12432
|
-
|
|
12516
|
+
_context15.next = 25;
|
|
12433
12517
|
break;
|
|
12434
12518
|
|
|
12435
12519
|
case 33:
|
|
12436
|
-
return
|
|
12520
|
+
return _context15.abrupt("return", 0);
|
|
12437
12521
|
|
|
12438
12522
|
case 34:
|
|
12439
|
-
return
|
|
12523
|
+
return _context15.abrupt("return", {
|
|
12440
12524
|
v: ERROR_MESSAGES_FLAG.INVALID_CATEGORY
|
|
12441
12525
|
});
|
|
12442
12526
|
|
|
12443
12527
|
case 35:
|
|
12444
12528
|
case "end":
|
|
12445
|
-
return
|
|
12529
|
+
return _context15.stop();
|
|
12446
12530
|
}
|
|
12447
12531
|
}), _loop);
|
|
12448
12532
|
}));
|
|
12449
12533
|
_iterator2.s();
|
|
12450
12534
|
|
|
12451
|
-
case
|
|
12535
|
+
case 46:
|
|
12452
12536
|
if ((_step2 = _iterator2.n()).done) {
|
|
12453
|
-
|
|
12537
|
+
_context17.next = 55;
|
|
12454
12538
|
break;
|
|
12455
12539
|
}
|
|
12456
|
-
return
|
|
12540
|
+
return _context17.delegateYield(_loop(), "t2", 48);
|
|
12457
12541
|
|
|
12458
|
-
case
|
|
12459
|
-
_ret =
|
|
12542
|
+
case 48:
|
|
12543
|
+
_ret = _context17.t2;
|
|
12460
12544
|
if (!(_ret === 0)) {
|
|
12461
|
-
|
|
12545
|
+
_context17.next = 51;
|
|
12462
12546
|
break;
|
|
12463
12547
|
}
|
|
12464
|
-
return
|
|
12548
|
+
return _context17.abrupt("continue", 53);
|
|
12465
12549
|
|
|
12466
|
-
case
|
|
12550
|
+
case 51:
|
|
12467
12551
|
if (!_ret) {
|
|
12468
|
-
|
|
12552
|
+
_context17.next = 53;
|
|
12469
12553
|
break;
|
|
12470
12554
|
}
|
|
12471
|
-
return
|
|
12472
|
-
|
|
12473
|
-
case 51:
|
|
12474
|
-
_context16.next = 44;
|
|
12475
|
-
break;
|
|
12555
|
+
return _context17.abrupt("return", _ret.v);
|
|
12476
12556
|
|
|
12477
12557
|
case 53:
|
|
12478
|
-
|
|
12558
|
+
_context17.next = 46;
|
|
12479
12559
|
break;
|
|
12480
12560
|
|
|
12481
12561
|
case 55:
|
|
12482
|
-
|
|
12483
|
-
|
|
12484
|
-
_iterator2.e(_context16.t3);
|
|
12562
|
+
_context17.next = 60;
|
|
12563
|
+
break;
|
|
12485
12564
|
|
|
12486
|
-
case
|
|
12487
|
-
|
|
12565
|
+
case 57:
|
|
12566
|
+
_context17.prev = 57;
|
|
12567
|
+
_context17.t3 = _context17["catch"](43);
|
|
12568
|
+
_iterator2.e(_context17.t3);
|
|
12569
|
+
|
|
12570
|
+
case 60:
|
|
12571
|
+
_context17.prev = 60;
|
|
12488
12572
|
_iterator2.f();
|
|
12489
|
-
return
|
|
12573
|
+
return _context17.finish(60);
|
|
12490
12574
|
|
|
12491
|
-
case
|
|
12492
|
-
return
|
|
12575
|
+
case 63:
|
|
12576
|
+
return _context17.abrupt("return", out);
|
|
12493
12577
|
|
|
12494
|
-
case
|
|
12578
|
+
case 64:
|
|
12495
12579
|
case "end":
|
|
12496
|
-
return
|
|
12580
|
+
return _context17.stop();
|
|
12497
12581
|
}
|
|
12498
|
-
}),
|
|
12582
|
+
}), _callee14, null, [ [ 13, 35, 38, 41 ], [ 21, 28 ], [ 43, 57, 60, 63 ] ]);
|
|
12499
12583
|
})));
|
|
12500
12584
|
return _EOA.apply(this, arguments);
|
|
12501
12585
|
}
|
|
@@ -12503,11 +12587,11 @@ function _typeof(o) {
|
|
|
12503
12587
|
return _FLVURL.apply(this, arguments);
|
|
12504
12588
|
}
|
|
12505
12589
|
function _FLVURL() {
|
|
12506
|
-
_FLVURL = _asyncToGenerator(_regeneratorRuntime().mark((function
|
|
12507
|
-
return _regeneratorRuntime().wrap((function
|
|
12508
|
-
while (1) switch (
|
|
12590
|
+
_FLVURL = _asyncToGenerator(_regeneratorRuntime().mark((function _callee15(token, vs_currencies) {
|
|
12591
|
+
return _regeneratorRuntime().wrap((function _callee15$(_context18) {
|
|
12592
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
12509
12593
|
case 0:
|
|
12510
|
-
return
|
|
12594
|
+
return _context18.abrupt("return", new Promise((function(resolve) {
|
|
12511
12595
|
setTimeout((function() {
|
|
12512
12596
|
resolve([ {
|
|
12513
12597
|
Yoo: "gotcha"
|
|
@@ -12517,9 +12601,9 @@ function _typeof(o) {
|
|
|
12517
12601
|
|
|
12518
12602
|
case 1:
|
|
12519
12603
|
case "end":
|
|
12520
|
-
return
|
|
12604
|
+
return _context18.stop();
|
|
12521
12605
|
}
|
|
12522
|
-
}),
|
|
12606
|
+
}), _callee15);
|
|
12523
12607
|
})));
|
|
12524
12608
|
return _FLVURL.apply(this, arguments);
|
|
12525
12609
|
}
|
|
@@ -12527,115 +12611,123 @@ function _typeof(o) {
|
|
|
12527
12611
|
return _SAFE.apply(this, arguments);
|
|
12528
12612
|
}
|
|
12529
12613
|
function _SAFE() {
|
|
12530
|
-
_SAFE = _asyncToGenerator(_regeneratorRuntime().mark((function
|
|
12531
|
-
var
|
|
12532
|
-
return _regeneratorRuntime().wrap((function
|
|
12533
|
-
while (1) switch (
|
|
12614
|
+
_SAFE = _asyncToGenerator(_regeneratorRuntime().mark((function _callee16() {
|
|
12615
|
+
var _argsToArray17, _argsToArray18, address, utility, chain, _argsToArray18$, limit, _argsToArray18$2, offset, apiKey, chainIdentifier, url, response, json, _args19 = arguments;
|
|
12616
|
+
return _regeneratorRuntime().wrap((function _callee16$(_context19) {
|
|
12617
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
12534
12618
|
case 0:
|
|
12535
|
-
|
|
12536
|
-
address =
|
|
12537
|
-
|
|
12619
|
+
_argsToArray17 = argsToArray(_args19), _argsToArray18 = _slicedToArray(_argsToArray17, 5),
|
|
12620
|
+
address = _argsToArray18[0], utility = _argsToArray18[1], chain = _argsToArray18[2],
|
|
12621
|
+
_argsToArray18$ = _argsToArray18[3], limit = _argsToArray18$ === void 0 ? 10 : _argsToArray18$,
|
|
12622
|
+
_argsToArray18$2 = _argsToArray18[4], offset = _argsToArray18$2 === void 0 ? 0 : _argsToArray18$2;
|
|
12538
12623
|
if (!(typeof limit !== "number" || limit < 0)) {
|
|
12539
|
-
|
|
12624
|
+
_context19.next = 3;
|
|
12540
12625
|
break;
|
|
12541
12626
|
}
|
|
12542
|
-
return
|
|
12627
|
+
return _context19.abrupt("return", "INVALID_LIMIT");
|
|
12543
12628
|
|
|
12544
12629
|
case 3:
|
|
12545
12630
|
if (!(typeof offset !== "number" || offset < 0)) {
|
|
12546
|
-
|
|
12631
|
+
_context19.next = 5;
|
|
12547
12632
|
break;
|
|
12548
12633
|
}
|
|
12549
|
-
return
|
|
12634
|
+
return _context19.abrupt("return", "INVALID_OFFSET");
|
|
12550
12635
|
|
|
12551
12636
|
case 5:
|
|
12552
12637
|
if (!(utility !== "txns")) {
|
|
12553
|
-
|
|
12638
|
+
_context19.next = 7;
|
|
12554
12639
|
break;
|
|
12555
12640
|
}
|
|
12556
|
-
return
|
|
12641
|
+
return _context19.abrupt("return", "UTILITY IS NOT SUPPORTED");
|
|
12557
12642
|
|
|
12558
12643
|
case 7:
|
|
12644
|
+
if (!(limit > MAX_PAGE_LIMIT)) {
|
|
12645
|
+
_context19.next = 9;
|
|
12646
|
+
break;
|
|
12647
|
+
}
|
|
12648
|
+
return _context19.abrupt("return", ERROR_MESSAGES_FLAG.MAX_PAGE_LIMIT);
|
|
12649
|
+
|
|
12650
|
+
case 9:
|
|
12559
12651
|
apiKey = window.localStorage.getItem(SERVICE_API_KEY.Safe);
|
|
12560
12652
|
chainIdentifier = SAFE_CHAIN_MAP[chain];
|
|
12561
12653
|
if (apiKey) {
|
|
12562
|
-
|
|
12654
|
+
_context19.next = 13;
|
|
12563
12655
|
break;
|
|
12564
12656
|
}
|
|
12565
|
-
return
|
|
12657
|
+
return _context19.abrupt("return", "".concat(SERVICE_API_KEY.Safe, "_MISSING"));
|
|
12566
12658
|
|
|
12567
|
-
case
|
|
12659
|
+
case 13:
|
|
12568
12660
|
if (chainIdentifier) {
|
|
12569
|
-
|
|
12661
|
+
_context19.next = 15;
|
|
12570
12662
|
break;
|
|
12571
12663
|
}
|
|
12572
|
-
return
|
|
12664
|
+
return _context19.abrupt("return", "CHAIN IS NOT SUPPORTED");
|
|
12573
12665
|
|
|
12574
|
-
case
|
|
12666
|
+
case 15:
|
|
12575
12667
|
if (isAddress(address)) {
|
|
12576
|
-
|
|
12668
|
+
_context19.next = 19;
|
|
12577
12669
|
break;
|
|
12578
12670
|
}
|
|
12579
|
-
|
|
12671
|
+
_context19.next = 18;
|
|
12580
12672
|
return fromEnsNameToAddress(address);
|
|
12581
12673
|
|
|
12582
|
-
case
|
|
12583
|
-
address =
|
|
12674
|
+
case 18:
|
|
12675
|
+
address = _context19.sent;
|
|
12584
12676
|
|
|
12585
|
-
case
|
|
12677
|
+
case 19:
|
|
12586
12678
|
if (address) {
|
|
12587
|
-
|
|
12679
|
+
_context19.next = 21;
|
|
12588
12680
|
break;
|
|
12589
12681
|
}
|
|
12590
|
-
return
|
|
12682
|
+
return _context19.abrupt("return", "".concat(address).concat(ERROR_MESSAGES_FLAG.INVALID_PARAM));
|
|
12591
12683
|
|
|
12592
|
-
case
|
|
12684
|
+
case 21:
|
|
12593
12685
|
url = "https://api.safe.global/tx-service/".concat(chainIdentifier, "/api/v2/safes/").concat(address, "/multisig-transactions?limit=").concat(limit, "&offset=").concat(offset);
|
|
12594
|
-
|
|
12595
|
-
|
|
12686
|
+
_context19.prev = 22;
|
|
12687
|
+
_context19.next = 25;
|
|
12596
12688
|
return fetch(url, {
|
|
12597
12689
|
headers: {
|
|
12598
12690
|
Authorization: "Bearer ".concat(apiKey)
|
|
12599
12691
|
}
|
|
12600
12692
|
});
|
|
12601
12693
|
|
|
12602
|
-
case
|
|
12603
|
-
response =
|
|
12694
|
+
case 25:
|
|
12695
|
+
response = _context19.sent;
|
|
12604
12696
|
if (response.ok) {
|
|
12605
|
-
|
|
12697
|
+
_context19.next = 28;
|
|
12606
12698
|
break;
|
|
12607
12699
|
}
|
|
12608
12700
|
throw new Error("HTTP error! Status: ".concat(response.status));
|
|
12609
12701
|
|
|
12610
|
-
case
|
|
12611
|
-
|
|
12702
|
+
case 28:
|
|
12703
|
+
_context19.next = 30;
|
|
12612
12704
|
return response.json();
|
|
12613
12705
|
|
|
12614
|
-
case
|
|
12615
|
-
json =
|
|
12706
|
+
case 30:
|
|
12707
|
+
json = _context19.sent;
|
|
12616
12708
|
if (Array.isArray(json.results)) {
|
|
12617
|
-
|
|
12709
|
+
_context19.next = 33;
|
|
12618
12710
|
break;
|
|
12619
12711
|
}
|
|
12620
|
-
return
|
|
12712
|
+
return _context19.abrupt("return", "INVALID API RESPONSE");
|
|
12621
12713
|
|
|
12622
|
-
case
|
|
12623
|
-
return
|
|
12714
|
+
case 33:
|
|
12715
|
+
return _context19.abrupt("return", json.results.map((function(_ref6) {
|
|
12624
12716
|
var confirmations = _ref6.confirmations, dataDecoded = _ref6.dataDecoded, rest = _objectWithoutProperties(_ref6, _excluded);
|
|
12625
12717
|
return rest;
|
|
12626
12718
|
})));
|
|
12627
12719
|
|
|
12628
|
-
case
|
|
12629
|
-
|
|
12630
|
-
|
|
12631
|
-
console.log(
|
|
12632
|
-
return
|
|
12720
|
+
case 36:
|
|
12721
|
+
_context19.prev = 36;
|
|
12722
|
+
_context19.t0 = _context19["catch"](22);
|
|
12723
|
+
console.log(_context19.t0);
|
|
12724
|
+
return _context19.abrupt("return", "ERROR IN FETCHING");
|
|
12633
12725
|
|
|
12634
|
-
case
|
|
12726
|
+
case 40:
|
|
12635
12727
|
case "end":
|
|
12636
|
-
return
|
|
12728
|
+
return _context19.stop();
|
|
12637
12729
|
}
|
|
12638
|
-
}),
|
|
12730
|
+
}), _callee16, null, [ [ 22, 36 ] ]);
|
|
12639
12731
|
})));
|
|
12640
12732
|
return _SAFE.apply(this, arguments);
|
|
12641
12733
|
}
|
|
@@ -12643,78 +12735,78 @@ function _typeof(o) {
|
|
|
12643
12735
|
return _DEFILLAMA.apply(this, arguments);
|
|
12644
12736
|
}
|
|
12645
12737
|
function _DEFILLAMA() {
|
|
12646
|
-
_DEFILLAMA = _asyncToGenerator(_regeneratorRuntime().mark((function
|
|
12647
|
-
var
|
|
12648
|
-
return _regeneratorRuntime().wrap((function
|
|
12649
|
-
while (1) switch (
|
|
12738
|
+
_DEFILLAMA = _asyncToGenerator(_regeneratorRuntime().mark((function _callee17() {
|
|
12739
|
+
var _argsToArray19, _argsToArray20, category, apiKey, categoryList, categoryMap, url, response, json, _args20 = arguments;
|
|
12740
|
+
return _regeneratorRuntime().wrap((function _callee17$(_context20) {
|
|
12741
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
12650
12742
|
case 0:
|
|
12651
|
-
|
|
12652
|
-
category =
|
|
12743
|
+
_argsToArray19 = argsToArray(_args20), _argsToArray20 = _slicedToArray(_argsToArray19, 1),
|
|
12744
|
+
category = _argsToArray20[0];
|
|
12653
12745
|
apiKey = window.localStorage.getItem(SERVICE_API_KEY.Defillama);
|
|
12654
12746
|
if (apiKey) {
|
|
12655
|
-
|
|
12747
|
+
_context20.next = 4;
|
|
12656
12748
|
break;
|
|
12657
12749
|
}
|
|
12658
|
-
return
|
|
12750
|
+
return _context20.abrupt("return", "".concat(SERVICE_API_KEY.Defillama).concat(ERROR_MESSAGES_FLAG.MISSING_KEY));
|
|
12659
12751
|
|
|
12660
12752
|
case 4:
|
|
12661
12753
|
categoryList = [ "protocols", "yields", "dex", "fees" ];
|
|
12662
12754
|
categoryMap = _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, categoryList[0], "https://api.llama.fi/protocols"), categoryList[1], "https://yields.llama.fi/pools"), categoryList[2], "https://api.llama.fi/overview/dexs?excludeTotalDataChart=true&excludeTotalDataChartBreakdown=true"), categoryList[3], "https://api.llama.fi/overview/fees?excludeTotalDataChart=true&excludeTotalDataChartBreakdown=true&dataType=dailyFees");
|
|
12663
12755
|
url = categoryMap[category];
|
|
12664
|
-
|
|
12665
|
-
|
|
12756
|
+
_context20.prev = 7;
|
|
12757
|
+
_context20.next = 10;
|
|
12666
12758
|
return fetch(url);
|
|
12667
12759
|
|
|
12668
12760
|
case 10:
|
|
12669
|
-
response =
|
|
12761
|
+
response = _context20.sent;
|
|
12670
12762
|
if (response.ok) {
|
|
12671
|
-
|
|
12763
|
+
_context20.next = 13;
|
|
12672
12764
|
break;
|
|
12673
12765
|
}
|
|
12674
12766
|
throw new Error("HTTP error! Status: ".concat(response.status));
|
|
12675
12767
|
|
|
12676
12768
|
case 13:
|
|
12677
|
-
|
|
12769
|
+
_context20.next = 15;
|
|
12678
12770
|
return response.json();
|
|
12679
12771
|
|
|
12680
12772
|
case 15:
|
|
12681
|
-
json =
|
|
12682
|
-
|
|
12683
|
-
|
|
12773
|
+
json = _context20.sent;
|
|
12774
|
+
_context20.t0 = category;
|
|
12775
|
+
_context20.next = _context20.t0 === categoryList[0] ? 19 : _context20.t0 === categoryList[1] ? 21 : _context20.t0 === categoryList[2] ? 23 : _context20.t0 === categoryList[3] ? 25 : 27;
|
|
12684
12776
|
break;
|
|
12685
12777
|
|
|
12686
12778
|
case 19:
|
|
12687
12779
|
if (json.length > 500) {
|
|
12688
12780
|
json = json.slice(0, 500);
|
|
12689
12781
|
}
|
|
12690
|
-
return
|
|
12782
|
+
return _context20.abrupt("break", 27);
|
|
12691
12783
|
|
|
12692
12784
|
case 21:
|
|
12693
12785
|
json = json.data.slice(0, 500);
|
|
12694
|
-
return
|
|
12786
|
+
return _context20.abrupt("break", 27);
|
|
12695
12787
|
|
|
12696
12788
|
case 23:
|
|
12697
12789
|
json = json.protocols.slice(0, 500);
|
|
12698
|
-
return
|
|
12790
|
+
return _context20.abrupt("break", 27);
|
|
12699
12791
|
|
|
12700
12792
|
case 25:
|
|
12701
12793
|
json = json.protocols.slice(0, 500);
|
|
12702
|
-
return
|
|
12794
|
+
return _context20.abrupt("break", 27);
|
|
12703
12795
|
|
|
12704
12796
|
case 27:
|
|
12705
|
-
return
|
|
12797
|
+
return _context20.abrupt("return", removeNestedStructure(Array.isArray(json) ? json : [ json ]));
|
|
12706
12798
|
|
|
12707
12799
|
case 30:
|
|
12708
|
-
|
|
12709
|
-
|
|
12710
|
-
console.log(
|
|
12711
|
-
return
|
|
12800
|
+
_context20.prev = 30;
|
|
12801
|
+
_context20.t1 = _context20["catch"](7);
|
|
12802
|
+
console.log(_context20.t1);
|
|
12803
|
+
return _context20.abrupt("return", "ERROR IN FETCHING");
|
|
12712
12804
|
|
|
12713
12805
|
case 34:
|
|
12714
12806
|
case "end":
|
|
12715
|
-
return
|
|
12807
|
+
return _context20.stop();
|
|
12716
12808
|
}
|
|
12717
|
-
}),
|
|
12809
|
+
}), _callee17, null, [ [ 7, 30 ] ]);
|
|
12718
12810
|
})));
|
|
12719
12811
|
return _DEFILLAMA.apply(this, arguments);
|
|
12720
12812
|
}
|
|
@@ -12722,47 +12814,47 @@ function _typeof(o) {
|
|
|
12722
12814
|
return _UNISWAP.apply(this, arguments);
|
|
12723
12815
|
}
|
|
12724
12816
|
function _UNISWAP() {
|
|
12725
|
-
_UNISWAP = _asyncToGenerator(_regeneratorRuntime().mark((function
|
|
12726
|
-
var
|
|
12727
|
-
return _regeneratorRuntime().wrap((function
|
|
12728
|
-
while (1) switch (
|
|
12817
|
+
_UNISWAP = _asyncToGenerator(_regeneratorRuntime().mark((function _callee18() {
|
|
12818
|
+
var _argsToArray21, _argsToArray22, graphType, category, param1, param2, baseUrl, url, res, json, _args21 = arguments;
|
|
12819
|
+
return _regeneratorRuntime().wrap((function _callee18$(_context21) {
|
|
12820
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
12729
12821
|
case 0:
|
|
12730
|
-
|
|
12731
|
-
graphType =
|
|
12732
|
-
param2 =
|
|
12822
|
+
_argsToArray21 = argsToArray(_args21), _argsToArray22 = _slicedToArray(_argsToArray21, 4),
|
|
12823
|
+
graphType = _argsToArray22[0], category = _argsToArray22[1], param1 = _argsToArray22[2],
|
|
12824
|
+
param2 = _argsToArray22[3];
|
|
12733
12825
|
baseUrl = "https://onchain-proxy.fileverse.io/third-party";
|
|
12734
|
-
|
|
12826
|
+
_context21.prev = 2;
|
|
12735
12827
|
url = "".concat(baseUrl, "?service=uniswap&graphType=").concat(graphType, "&category=").concat(category, "&input1=").concat(param1, "&input2=").concat(param2);
|
|
12736
|
-
|
|
12828
|
+
_context21.next = 6;
|
|
12737
12829
|
return fetch(url);
|
|
12738
12830
|
|
|
12739
12831
|
case 6:
|
|
12740
|
-
res =
|
|
12832
|
+
res = _context21.sent;
|
|
12741
12833
|
if (res.ok) {
|
|
12742
|
-
|
|
12834
|
+
_context21.next = 9;
|
|
12743
12835
|
break;
|
|
12744
12836
|
}
|
|
12745
12837
|
throw new Error("HTTP ".concat(res.status));
|
|
12746
12838
|
|
|
12747
12839
|
case 9:
|
|
12748
|
-
|
|
12840
|
+
_context21.next = 11;
|
|
12749
12841
|
return res.json();
|
|
12750
12842
|
|
|
12751
12843
|
case 11:
|
|
12752
|
-
json =
|
|
12753
|
-
return
|
|
12844
|
+
json = _context21.sent;
|
|
12845
|
+
return _context21.abrupt("return", removeNestedStructure(json));
|
|
12754
12846
|
|
|
12755
12847
|
case 15:
|
|
12756
|
-
|
|
12757
|
-
|
|
12758
|
-
console.error("UNISWAP fetch error:",
|
|
12759
|
-
return
|
|
12848
|
+
_context21.prev = 15;
|
|
12849
|
+
_context21.t0 = _context21["catch"](2);
|
|
12850
|
+
console.error("UNISWAP fetch error:", _context21.t0);
|
|
12851
|
+
return _context21.abrupt("return", ERROR_MESSAGES_FLAG.DEFAULT);
|
|
12760
12852
|
|
|
12761
12853
|
case 19:
|
|
12762
12854
|
case "end":
|
|
12763
|
-
return
|
|
12855
|
+
return _context21.stop();
|
|
12764
12856
|
}
|
|
12765
|
-
}),
|
|
12857
|
+
}), _callee18, null, [ [ 2, 15 ] ]);
|
|
12766
12858
|
})));
|
|
12767
12859
|
return _UNISWAP.apply(this, arguments);
|
|
12768
12860
|
}
|
|
@@ -12770,47 +12862,47 @@ function _typeof(o) {
|
|
|
12770
12862
|
return _AAVE.apply(this, arguments);
|
|
12771
12863
|
}
|
|
12772
12864
|
function _AAVE() {
|
|
12773
|
-
_AAVE = _asyncToGenerator(_regeneratorRuntime().mark((function
|
|
12774
|
-
var
|
|
12775
|
-
return _regeneratorRuntime().wrap((function
|
|
12776
|
-
while (1) switch (
|
|
12865
|
+
_AAVE = _asyncToGenerator(_regeneratorRuntime().mark((function _callee19() {
|
|
12866
|
+
var _argsToArray23, _argsToArray24, graphType, category, param1, param2, baseUrl, url, res, json, _args22 = arguments;
|
|
12867
|
+
return _regeneratorRuntime().wrap((function _callee19$(_context22) {
|
|
12868
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
12777
12869
|
case 0:
|
|
12778
|
-
|
|
12779
|
-
graphType =
|
|
12780
|
-
param2 =
|
|
12870
|
+
_argsToArray23 = argsToArray(_args22), _argsToArray24 = _slicedToArray(_argsToArray23, 4),
|
|
12871
|
+
graphType = _argsToArray24[0], category = _argsToArray24[1], param1 = _argsToArray24[2],
|
|
12872
|
+
param2 = _argsToArray24[3];
|
|
12781
12873
|
baseUrl = "https://onchain-proxy.fileverse.io/third-party";
|
|
12782
|
-
|
|
12874
|
+
_context22.prev = 2;
|
|
12783
12875
|
url = "".concat(baseUrl, "?service=aave&graphType=").concat(graphType, "&category=").concat(category, "&input1=").concat(param1, "&input2=").concat(param2);
|
|
12784
|
-
|
|
12876
|
+
_context22.next = 6;
|
|
12785
12877
|
return fetch(url);
|
|
12786
12878
|
|
|
12787
12879
|
case 6:
|
|
12788
|
-
res =
|
|
12880
|
+
res = _context22.sent;
|
|
12789
12881
|
if (res.ok) {
|
|
12790
|
-
|
|
12882
|
+
_context22.next = 9;
|
|
12791
12883
|
break;
|
|
12792
12884
|
}
|
|
12793
12885
|
throw new Error("HTTP ".concat(res.status));
|
|
12794
12886
|
|
|
12795
12887
|
case 9:
|
|
12796
|
-
|
|
12888
|
+
_context22.next = 11;
|
|
12797
12889
|
return res.json();
|
|
12798
12890
|
|
|
12799
12891
|
case 11:
|
|
12800
|
-
json =
|
|
12801
|
-
return
|
|
12892
|
+
json = _context22.sent;
|
|
12893
|
+
return _context22.abrupt("return", removeNestedStructure(json));
|
|
12802
12894
|
|
|
12803
12895
|
case 15:
|
|
12804
|
-
|
|
12805
|
-
|
|
12806
|
-
console.error("AAVE fetch error:",
|
|
12807
|
-
return
|
|
12896
|
+
_context22.prev = 15;
|
|
12897
|
+
_context22.t0 = _context22["catch"](2);
|
|
12898
|
+
console.error("AAVE fetch error:", _context22.t0);
|
|
12899
|
+
return _context22.abrupt("return", ERROR_MESSAGES_FLAG.DEFAULT);
|
|
12808
12900
|
|
|
12809
12901
|
case 19:
|
|
12810
12902
|
case "end":
|
|
12811
|
-
return
|
|
12903
|
+
return _context22.stop();
|
|
12812
12904
|
}
|
|
12813
|
-
}),
|
|
12905
|
+
}), _callee19, null, [ [ 2, 15 ] ]);
|
|
12814
12906
|
})));
|
|
12815
12907
|
return _AAVE.apply(this, arguments);
|
|
12816
12908
|
}
|
|
@@ -12861,6 +12953,7 @@ function _typeof(o) {
|
|
|
12861
12953
|
exports.AVERAGEA = AVERAGEA;
|
|
12862
12954
|
exports.AVERAGEIF = AVERAGEIF;
|
|
12863
12955
|
exports.AVERAGEIFS = AVERAGEIFS;
|
|
12956
|
+
exports.BASE = BASE;
|
|
12864
12957
|
exports.BESSELI = BESSELI;
|
|
12865
12958
|
exports.BESSELJ = BESSELJ;
|
|
12866
12959
|
exports.BESSELK = BESSELK;
|