@fileverse-dev/formulajs 4.4.11-mod-60 → 4.4.11-mod-61
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 +269 -210
- package/lib/browser/formula.min.js +2 -2
- package/lib/browser/formula.min.js.map +1 -1
- package/lib/cjs/index.cjs +31 -5
- package/lib/esm/crypto-constants.mjs +4 -1
- package/lib/esm/index.mjs +31 -5
- package/package.json +1 -1
package/lib/browser/formula.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* @fileverse-dev/formulajs v4.4.11-mod-
|
|
1
|
+
/* @fileverse-dev/formulajs v4.4.11-mod-61 */
|
|
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,96 +11630,96 @@ 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
|
}
|
|
@@ -11842,6 +11879,13 @@ function _typeof(o) {
|
|
|
11842
11879
|
return _context1.abrupt("return", "".concat(apiKeyKey).concat(ERROR_MESSAGES_FLAG.INVALID_PARAM));
|
|
11843
11880
|
|
|
11844
11881
|
case 7:
|
|
11882
|
+
if (!(limit > MAX_PAGE_LIMIT)) {
|
|
11883
|
+
_context1.next = 9;
|
|
11884
|
+
break;
|
|
11885
|
+
}
|
|
11886
|
+
return _context1.abrupt("return", ERROR_MESSAGES_FLAG.MAX_PAGE_LIMIT);
|
|
11887
|
+
|
|
11888
|
+
case 9:
|
|
11845
11889
|
url = new URL("https://api.gnosispay.com/cards/".concat(cardId, "/transactions"));
|
|
11846
11890
|
url.searchParams.set("limit", limit.toString());
|
|
11847
11891
|
url.searchParams.set("offset", offset.toString());
|
|
@@ -11851,8 +11895,8 @@ function _typeof(o) {
|
|
|
11851
11895
|
if (!isNaN(toTimestamp(endDate))) {
|
|
11852
11896
|
url.searchParams.set("endDate", new Date(endDate * 1e3).toISOString());
|
|
11853
11897
|
}
|
|
11854
|
-
_context1.prev =
|
|
11855
|
-
_context1.next =
|
|
11898
|
+
_context1.prev = 14;
|
|
11899
|
+
_context1.next = 17;
|
|
11856
11900
|
return fetch(url.toString(), {
|
|
11857
11901
|
headers: {
|
|
11858
11902
|
Authorization: "Bearer ".concat(API_KEY),
|
|
@@ -11860,27 +11904,27 @@ function _typeof(o) {
|
|
|
11860
11904
|
}
|
|
11861
11905
|
});
|
|
11862
11906
|
|
|
11863
|
-
case
|
|
11907
|
+
case 17:
|
|
11864
11908
|
res = _context1.sent;
|
|
11865
11909
|
if (res.ok) {
|
|
11866
|
-
_context1.next =
|
|
11910
|
+
_context1.next = 20;
|
|
11867
11911
|
break;
|
|
11868
11912
|
}
|
|
11869
11913
|
throw new Error("HTTP error! Status: ".concat(res.status));
|
|
11870
11914
|
|
|
11871
|
-
case
|
|
11872
|
-
_context1.next =
|
|
11915
|
+
case 20:
|
|
11916
|
+
_context1.next = 22;
|
|
11873
11917
|
return res.json();
|
|
11874
11918
|
|
|
11875
|
-
case
|
|
11919
|
+
case 22:
|
|
11876
11920
|
json = _context1.sent;
|
|
11877
11921
|
if (Array.isArray(json)) {
|
|
11878
|
-
_context1.next =
|
|
11922
|
+
_context1.next = 25;
|
|
11879
11923
|
break;
|
|
11880
11924
|
}
|
|
11881
11925
|
return _context1.abrupt("return", []);
|
|
11882
11926
|
|
|
11883
|
-
case
|
|
11927
|
+
case 25:
|
|
11884
11928
|
return _context1.abrupt("return", json.map((function(tx) {
|
|
11885
11929
|
return {
|
|
11886
11930
|
createdAt: tx.createdAt,
|
|
@@ -11898,17 +11942,17 @@ function _typeof(o) {
|
|
|
11898
11942
|
};
|
|
11899
11943
|
})));
|
|
11900
11944
|
|
|
11901
|
-
case
|
|
11902
|
-
_context1.prev =
|
|
11903
|
-
_context1.t0 = _context1["catch"](
|
|
11945
|
+
case 28:
|
|
11946
|
+
_context1.prev = 28;
|
|
11947
|
+
_context1.t0 = _context1["catch"](14);
|
|
11904
11948
|
console.error("GNOSISPAY_CARD_TXNS error:", _context1.t0);
|
|
11905
11949
|
return _context1.abrupt("return", ERROR_MESSAGES_FLAG.DEFAULT);
|
|
11906
11950
|
|
|
11907
|
-
case
|
|
11951
|
+
case 32:
|
|
11908
11952
|
case "end":
|
|
11909
11953
|
return _context1.stop();
|
|
11910
11954
|
}
|
|
11911
|
-
}), _callee1, null, [ [
|
|
11955
|
+
}), _callee1, null, [ [ 14, 28 ] ]);
|
|
11912
11956
|
})));
|
|
11913
11957
|
return _GNOSISPAY.apply(this, arguments);
|
|
11914
11958
|
}
|
|
@@ -12211,6 +12255,13 @@ function _typeof(o) {
|
|
|
12211
12255
|
startTime = _argsToArray14[3], endTime = _argsToArray14[4], _argsToArray14$ = _argsToArray14[5],
|
|
12212
12256
|
page = _argsToArray14$ === void 0 ? 1 : _argsToArray14$, _argsToArray14$2 = _argsToArray14[6],
|
|
12213
12257
|
offset = _argsToArray14$2 === void 0 ? 10 : _argsToArray14$2;
|
|
12258
|
+
if (!(offset > MAX_PAGE_LIMIT)) {
|
|
12259
|
+
_context16.next = 8;
|
|
12260
|
+
break;
|
|
12261
|
+
}
|
|
12262
|
+
return _context16.abrupt("return", ERROR_MESSAGES_FLAG.MAX_PAGE_LIMIT);
|
|
12263
|
+
|
|
12264
|
+
case 8:
|
|
12214
12265
|
INPUTS = addresses.split(",").map((function(a) {
|
|
12215
12266
|
return a.trim();
|
|
12216
12267
|
})).filter(Boolean);
|
|
@@ -12220,61 +12271,61 @@ function _typeof(o) {
|
|
|
12220
12271
|
out = [];
|
|
12221
12272
|
ADDRESS_MAP = {};
|
|
12222
12273
|
_iterator = _createForOfIteratorHelper(INPUTS);
|
|
12223
|
-
_context16.prev =
|
|
12274
|
+
_context16.prev = 13;
|
|
12224
12275
|
_iterator.s();
|
|
12225
12276
|
|
|
12226
|
-
case
|
|
12277
|
+
case 15:
|
|
12227
12278
|
if ((_step = _iterator.n()).done) {
|
|
12228
|
-
_context16.next =
|
|
12279
|
+
_context16.next = 33;
|
|
12229
12280
|
break;
|
|
12230
12281
|
}
|
|
12231
12282
|
input = _step.value;
|
|
12232
12283
|
if (!isAddress(input)) {
|
|
12233
|
-
_context16.next =
|
|
12284
|
+
_context16.next = 21;
|
|
12234
12285
|
break;
|
|
12235
12286
|
}
|
|
12236
12287
|
ADDRESS_MAP[input.toLowerCase()] = null;
|
|
12237
|
-
_context16.next =
|
|
12288
|
+
_context16.next = 31;
|
|
12238
12289
|
break;
|
|
12239
12290
|
|
|
12240
|
-
case
|
|
12241
|
-
_context16.prev =
|
|
12242
|
-
_context16.next =
|
|
12291
|
+
case 21:
|
|
12292
|
+
_context16.prev = 21;
|
|
12293
|
+
_context16.next = 24;
|
|
12243
12294
|
return fromEnsNameToAddress(input);
|
|
12244
12295
|
|
|
12245
|
-
case
|
|
12296
|
+
case 24:
|
|
12246
12297
|
resolved = _context16.sent;
|
|
12247
12298
|
if (resolved) ADDRESS_MAP[resolved.toLowerCase()] = input;
|
|
12248
|
-
_context16.next =
|
|
12299
|
+
_context16.next = 31;
|
|
12249
12300
|
break;
|
|
12250
12301
|
|
|
12251
|
-
case
|
|
12252
|
-
_context16.prev =
|
|
12253
|
-
_context16.t0 = _context16["catch"](
|
|
12302
|
+
case 28:
|
|
12303
|
+
_context16.prev = 28;
|
|
12304
|
+
_context16.t0 = _context16["catch"](21);
|
|
12254
12305
|
return _context16.abrupt("return", "".concat(input).concat(ERROR_MESSAGES_FLAG.INVALID_PARAM));
|
|
12255
12306
|
|
|
12256
|
-
case 29:
|
|
12257
|
-
_context16.next = 13;
|
|
12258
|
-
break;
|
|
12259
|
-
|
|
12260
12307
|
case 31:
|
|
12261
|
-
_context16.next =
|
|
12308
|
+
_context16.next = 15;
|
|
12262
12309
|
break;
|
|
12263
12310
|
|
|
12264
12311
|
case 33:
|
|
12265
|
-
_context16.
|
|
12266
|
-
|
|
12312
|
+
_context16.next = 38;
|
|
12313
|
+
break;
|
|
12314
|
+
|
|
12315
|
+
case 35:
|
|
12316
|
+
_context16.prev = 35;
|
|
12317
|
+
_context16.t1 = _context16["catch"](13);
|
|
12267
12318
|
_iterator.e(_context16.t1);
|
|
12268
12319
|
|
|
12269
|
-
case
|
|
12270
|
-
_context16.prev =
|
|
12320
|
+
case 38:
|
|
12321
|
+
_context16.prev = 38;
|
|
12271
12322
|
_iterator.f();
|
|
12272
|
-
return _context16.finish(
|
|
12323
|
+
return _context16.finish(38);
|
|
12273
12324
|
|
|
12274
|
-
case
|
|
12325
|
+
case 41:
|
|
12275
12326
|
ADDRS = Object.keys(ADDRESS_MAP);
|
|
12276
12327
|
_iterator2 = _createForOfIteratorHelper(CHAINS);
|
|
12277
|
-
_context16.prev =
|
|
12328
|
+
_context16.prev = 43;
|
|
12278
12329
|
_loop = _regeneratorRuntime().mark((function _loop() {
|
|
12279
12330
|
var chain, chainId, _loop2, _ret2, i, startBlock, endBlock, _loop3, _ret3, _i17, _ADDRS;
|
|
12280
12331
|
return _regeneratorRuntime().wrap((function _loop$(_context14) {
|
|
@@ -12448,54 +12499,54 @@ function _typeof(o) {
|
|
|
12448
12499
|
}));
|
|
12449
12500
|
_iterator2.s();
|
|
12450
12501
|
|
|
12451
|
-
case
|
|
12502
|
+
case 46:
|
|
12452
12503
|
if ((_step2 = _iterator2.n()).done) {
|
|
12453
|
-
_context16.next =
|
|
12504
|
+
_context16.next = 55;
|
|
12454
12505
|
break;
|
|
12455
12506
|
}
|
|
12456
|
-
return _context16.delegateYield(_loop(), "t2",
|
|
12507
|
+
return _context16.delegateYield(_loop(), "t2", 48);
|
|
12457
12508
|
|
|
12458
|
-
case
|
|
12509
|
+
case 48:
|
|
12459
12510
|
_ret = _context16.t2;
|
|
12460
12511
|
if (!(_ret === 0)) {
|
|
12461
|
-
_context16.next =
|
|
12512
|
+
_context16.next = 51;
|
|
12462
12513
|
break;
|
|
12463
12514
|
}
|
|
12464
|
-
return _context16.abrupt("continue",
|
|
12515
|
+
return _context16.abrupt("continue", 53);
|
|
12465
12516
|
|
|
12466
|
-
case
|
|
12517
|
+
case 51:
|
|
12467
12518
|
if (!_ret) {
|
|
12468
|
-
_context16.next =
|
|
12519
|
+
_context16.next = 53;
|
|
12469
12520
|
break;
|
|
12470
12521
|
}
|
|
12471
12522
|
return _context16.abrupt("return", _ret.v);
|
|
12472
12523
|
|
|
12473
|
-
case 51:
|
|
12474
|
-
_context16.next = 44;
|
|
12475
|
-
break;
|
|
12476
|
-
|
|
12477
12524
|
case 53:
|
|
12478
|
-
_context16.next =
|
|
12525
|
+
_context16.next = 46;
|
|
12479
12526
|
break;
|
|
12480
12527
|
|
|
12481
12528
|
case 55:
|
|
12482
|
-
_context16.
|
|
12483
|
-
|
|
12529
|
+
_context16.next = 60;
|
|
12530
|
+
break;
|
|
12531
|
+
|
|
12532
|
+
case 57:
|
|
12533
|
+
_context16.prev = 57;
|
|
12534
|
+
_context16.t3 = _context16["catch"](43);
|
|
12484
12535
|
_iterator2.e(_context16.t3);
|
|
12485
12536
|
|
|
12486
|
-
case
|
|
12487
|
-
_context16.prev =
|
|
12537
|
+
case 60:
|
|
12538
|
+
_context16.prev = 60;
|
|
12488
12539
|
_iterator2.f();
|
|
12489
|
-
return _context16.finish(
|
|
12540
|
+
return _context16.finish(60);
|
|
12490
12541
|
|
|
12491
|
-
case
|
|
12542
|
+
case 63:
|
|
12492
12543
|
return _context16.abrupt("return", out);
|
|
12493
12544
|
|
|
12494
|
-
case
|
|
12545
|
+
case 64:
|
|
12495
12546
|
case "end":
|
|
12496
12547
|
return _context16.stop();
|
|
12497
12548
|
}
|
|
12498
|
-
}), _callee13, null, [ [
|
|
12549
|
+
}), _callee13, null, [ [ 13, 35, 38, 41 ], [ 21, 28 ], [ 43, 57, 60, 63 ] ]);
|
|
12499
12550
|
})));
|
|
12500
12551
|
return _EOA.apply(this, arguments);
|
|
12501
12552
|
}
|
|
@@ -12528,13 +12579,14 @@ function _typeof(o) {
|
|
|
12528
12579
|
}
|
|
12529
12580
|
function _SAFE() {
|
|
12530
12581
|
_SAFE = _asyncToGenerator(_regeneratorRuntime().mark((function _callee15() {
|
|
12531
|
-
var _argsToArray15, _argsToArray16, address, utility, chain, limit, offset, apiKey, chainIdentifier, url, response, json, _args18 = arguments;
|
|
12582
|
+
var _argsToArray15, _argsToArray16, address, utility, chain, _argsToArray16$, limit, _argsToArray16$2, offset, apiKey, chainIdentifier, url, response, json, _args18 = arguments;
|
|
12532
12583
|
return _regeneratorRuntime().wrap((function _callee15$(_context18) {
|
|
12533
12584
|
while (1) switch (_context18.prev = _context18.next) {
|
|
12534
12585
|
case 0:
|
|
12535
12586
|
_argsToArray15 = argsToArray(_args18), _argsToArray16 = _slicedToArray(_argsToArray15, 5),
|
|
12536
12587
|
address = _argsToArray16[0], utility = _argsToArray16[1], chain = _argsToArray16[2],
|
|
12537
|
-
|
|
12588
|
+
_argsToArray16$ = _argsToArray16[3], limit = _argsToArray16$ === void 0 ? 10 : _argsToArray16$,
|
|
12589
|
+
_argsToArray16$2 = _argsToArray16[4], offset = _argsToArray16$2 === void 0 ? 0 : _argsToArray16$2;
|
|
12538
12590
|
if (!(typeof limit !== "number" || limit < 0)) {
|
|
12539
12591
|
_context18.next = 3;
|
|
12540
12592
|
break;
|
|
@@ -12556,86 +12608,93 @@ function _typeof(o) {
|
|
|
12556
12608
|
return _context18.abrupt("return", "UTILITY IS NOT SUPPORTED");
|
|
12557
12609
|
|
|
12558
12610
|
case 7:
|
|
12611
|
+
if (!(limit > MAX_PAGE_LIMIT)) {
|
|
12612
|
+
_context18.next = 9;
|
|
12613
|
+
break;
|
|
12614
|
+
}
|
|
12615
|
+
return _context18.abrupt("return", ERROR_MESSAGES_FLAG.MAX_PAGE_LIMIT);
|
|
12616
|
+
|
|
12617
|
+
case 9:
|
|
12559
12618
|
apiKey = window.localStorage.getItem(SERVICE_API_KEY.Safe);
|
|
12560
12619
|
chainIdentifier = SAFE_CHAIN_MAP[chain];
|
|
12561
12620
|
if (apiKey) {
|
|
12562
|
-
_context18.next =
|
|
12621
|
+
_context18.next = 13;
|
|
12563
12622
|
break;
|
|
12564
12623
|
}
|
|
12565
12624
|
return _context18.abrupt("return", "".concat(SERVICE_API_KEY.Safe, "_MISSING"));
|
|
12566
12625
|
|
|
12567
|
-
case
|
|
12626
|
+
case 13:
|
|
12568
12627
|
if (chainIdentifier) {
|
|
12569
|
-
_context18.next =
|
|
12628
|
+
_context18.next = 15;
|
|
12570
12629
|
break;
|
|
12571
12630
|
}
|
|
12572
12631
|
return _context18.abrupt("return", "CHAIN IS NOT SUPPORTED");
|
|
12573
12632
|
|
|
12574
|
-
case
|
|
12633
|
+
case 15:
|
|
12575
12634
|
if (isAddress(address)) {
|
|
12576
|
-
_context18.next =
|
|
12635
|
+
_context18.next = 19;
|
|
12577
12636
|
break;
|
|
12578
12637
|
}
|
|
12579
|
-
_context18.next =
|
|
12638
|
+
_context18.next = 18;
|
|
12580
12639
|
return fromEnsNameToAddress(address);
|
|
12581
12640
|
|
|
12582
|
-
case
|
|
12641
|
+
case 18:
|
|
12583
12642
|
address = _context18.sent;
|
|
12584
12643
|
|
|
12585
|
-
case
|
|
12644
|
+
case 19:
|
|
12586
12645
|
if (address) {
|
|
12587
|
-
_context18.next =
|
|
12646
|
+
_context18.next = 21;
|
|
12588
12647
|
break;
|
|
12589
12648
|
}
|
|
12590
12649
|
return _context18.abrupt("return", "".concat(address).concat(ERROR_MESSAGES_FLAG.INVALID_PARAM));
|
|
12591
12650
|
|
|
12592
|
-
case
|
|
12651
|
+
case 21:
|
|
12593
12652
|
url = "https://api.safe.global/tx-service/".concat(chainIdentifier, "/api/v2/safes/").concat(address, "/multisig-transactions?limit=").concat(limit, "&offset=").concat(offset);
|
|
12594
|
-
_context18.prev =
|
|
12595
|
-
_context18.next =
|
|
12653
|
+
_context18.prev = 22;
|
|
12654
|
+
_context18.next = 25;
|
|
12596
12655
|
return fetch(url, {
|
|
12597
12656
|
headers: {
|
|
12598
12657
|
Authorization: "Bearer ".concat(apiKey)
|
|
12599
12658
|
}
|
|
12600
12659
|
});
|
|
12601
12660
|
|
|
12602
|
-
case
|
|
12661
|
+
case 25:
|
|
12603
12662
|
response = _context18.sent;
|
|
12604
12663
|
if (response.ok) {
|
|
12605
|
-
_context18.next =
|
|
12664
|
+
_context18.next = 28;
|
|
12606
12665
|
break;
|
|
12607
12666
|
}
|
|
12608
12667
|
throw new Error("HTTP error! Status: ".concat(response.status));
|
|
12609
12668
|
|
|
12610
|
-
case
|
|
12611
|
-
_context18.next =
|
|
12669
|
+
case 28:
|
|
12670
|
+
_context18.next = 30;
|
|
12612
12671
|
return response.json();
|
|
12613
12672
|
|
|
12614
|
-
case
|
|
12673
|
+
case 30:
|
|
12615
12674
|
json = _context18.sent;
|
|
12616
12675
|
if (Array.isArray(json.results)) {
|
|
12617
|
-
_context18.next =
|
|
12676
|
+
_context18.next = 33;
|
|
12618
12677
|
break;
|
|
12619
12678
|
}
|
|
12620
12679
|
return _context18.abrupt("return", "INVALID API RESPONSE");
|
|
12621
12680
|
|
|
12622
|
-
case
|
|
12681
|
+
case 33:
|
|
12623
12682
|
return _context18.abrupt("return", json.results.map((function(_ref6) {
|
|
12624
12683
|
var confirmations = _ref6.confirmations, dataDecoded = _ref6.dataDecoded, rest = _objectWithoutProperties(_ref6, _excluded);
|
|
12625
12684
|
return rest;
|
|
12626
12685
|
})));
|
|
12627
12686
|
|
|
12628
|
-
case
|
|
12629
|
-
_context18.prev =
|
|
12630
|
-
_context18.t0 = _context18["catch"](
|
|
12687
|
+
case 36:
|
|
12688
|
+
_context18.prev = 36;
|
|
12689
|
+
_context18.t0 = _context18["catch"](22);
|
|
12631
12690
|
console.log(_context18.t0);
|
|
12632
12691
|
return _context18.abrupt("return", "ERROR IN FETCHING");
|
|
12633
12692
|
|
|
12634
|
-
case
|
|
12693
|
+
case 40:
|
|
12635
12694
|
case "end":
|
|
12636
12695
|
return _context18.stop();
|
|
12637
12696
|
}
|
|
12638
|
-
}), _callee15, null, [ [
|
|
12697
|
+
}), _callee15, null, [ [ 22, 36 ] ]);
|
|
12639
12698
|
})));
|
|
12640
12699
|
return _SAFE.apply(this, arguments);
|
|
12641
12700
|
}
|
|
@@ -12655,7 +12714,7 @@ function _typeof(o) {
|
|
|
12655
12714
|
_context19.next = 4;
|
|
12656
12715
|
break;
|
|
12657
12716
|
}
|
|
12658
|
-
return _context19.abrupt("return", "".concat(SERVICE_API_KEY.Defillama
|
|
12717
|
+
return _context19.abrupt("return", "".concat(SERVICE_API_KEY.Defillama).concat(ERROR_MESSAGES_FLAG.MISSING_KEY));
|
|
12659
12718
|
|
|
12660
12719
|
case 4:
|
|
12661
12720
|
categoryList = [ "protocols", "yields", "dex", "fees" ];
|