@fileverse-dev/formulajs 4.4.11-mod-23 → 4.4.11-mod-23-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 +654 -244
- package/lib/browser/formula.min.js +2 -2
- package/lib/browser/formula.min.js.map +1 -1
- package/lib/cjs/index.cjs +259 -52
- package/lib/esm/crypto-constants.mjs +122 -3
- package/lib/esm/index.mjs +255 -53
- package/package.json +2 -1
- package/types/cjs/index.d.cts +24 -0
- package/types/esm/index.d.mts +24 -0
package/lib/browser/formula.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* @fileverse-dev/formulajs v4.4.11-mod-23 */
|
|
1
|
+
/* @fileverse-dev/formulajs v4.4.11-mod-23-patch-1 */
|
|
2
2
|
var _excluded = [ "confirmations", "dataDecoded" ];
|
|
3
3
|
|
|
4
4
|
function _objectWithoutProperties(e, t) {
|
|
@@ -10944,12 +10944,16 @@ function _typeof(o) {
|
|
|
10944
10944
|
MISSING_KEY: "_MISSING",
|
|
10945
10945
|
INVALID_CHAIN: "_INVALID_CHAIN",
|
|
10946
10946
|
INVALID_TYPE: "_INVALID_TYPE",
|
|
10947
|
-
INVALID_ADDRESS: "_INVALID_ADDRESS"
|
|
10947
|
+
INVALID_ADDRESS: "_INVALID_ADDRESS",
|
|
10948
|
+
INVALID_PARAM: "_INVALID_PARAM"
|
|
10948
10949
|
};
|
|
10949
10950
|
var SERVICE_API_KEY = {
|
|
10950
10951
|
Etherscan: "ETHERSCAN_API_KEY",
|
|
10951
10952
|
Coingecko: "COINGECKO_API_KEY",
|
|
10952
|
-
Safe: "SAFE_API_KEY"
|
|
10953
|
+
Safe: "SAFE_API_KEY",
|
|
10954
|
+
Basescan: "BASESCAN_API_KEY",
|
|
10955
|
+
Gnosisscan: "GNOSIS_API_KEY",
|
|
10956
|
+
Firefly: "FIRE_FLY_API_KEY"
|
|
10953
10957
|
};
|
|
10954
10958
|
var fromTimeStampToBlock = function() {
|
|
10955
10959
|
var _ref = _asyncToGenerator(_regeneratorRuntime().mark((function _callee(timestamp, chain, apiKey) {
|
|
@@ -10988,23 +10992,291 @@ function _typeof(o) {
|
|
|
10988
10992
|
return _ref.apply(this, arguments);
|
|
10989
10993
|
};
|
|
10990
10994
|
}();
|
|
10991
|
-
function
|
|
10995
|
+
function handleScanRequest(_x4) {
|
|
10996
|
+
return _handleScanRequest.apply(this, arguments);
|
|
10997
|
+
}
|
|
10998
|
+
function _handleScanRequest() {
|
|
10999
|
+
_handleScanRequest = _asyncToGenerator(_regeneratorRuntime().mark((function _callee2(_ref2) {
|
|
11000
|
+
var scanKey, baseUrl, type, chain, address, startDate, endDate, API_KEY, chainId, ACTION_MAP, action, url, _yield$Promise$all, _yield$Promise$all2, startBlock, endBlock, res, json;
|
|
11001
|
+
return _regeneratorRuntime().wrap((function _callee2$(_context2) {
|
|
11002
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
11003
|
+
case 0:
|
|
11004
|
+
scanKey = _ref2.scanKey, baseUrl = _ref2.baseUrl, type = _ref2.type, chain = _ref2.chain,
|
|
11005
|
+
address = _ref2.address, startDate = _ref2.startDate, endDate = _ref2.endDate;
|
|
11006
|
+
API_KEY = window.localStorage.getItem(scanKey);
|
|
11007
|
+
if (API_KEY) {
|
|
11008
|
+
_context2.next = 4;
|
|
11009
|
+
break;
|
|
11010
|
+
}
|
|
11011
|
+
return _context2.abrupt("return", "".concat(scanKey).concat(ERROR_MESSAGES_FLAG.MISSING_KEY));
|
|
11012
|
+
|
|
11013
|
+
case 4:
|
|
11014
|
+
if (!(API_KEY === "xxxx")) {
|
|
11015
|
+
_context2.next = 6;
|
|
11016
|
+
break;
|
|
11017
|
+
}
|
|
11018
|
+
return _context2.abrupt("return", "".concat(scanKey).concat(ERROR_MESSAGES_FLAG.RATE_LIMIT));
|
|
11019
|
+
|
|
11020
|
+
case 6:
|
|
11021
|
+
chainId = CHAIN_ID_MAP[chain === null || chain === void 0 ? void 0 : chain.toLowerCase()];
|
|
11022
|
+
if (chainId) {
|
|
11023
|
+
_context2.next = 9;
|
|
11024
|
+
break;
|
|
11025
|
+
}
|
|
11026
|
+
return _context2.abrupt("return", "".concat(scanKey).concat(ERROR_MESSAGES_FLAG.INVALID_CHAIN));
|
|
11027
|
+
|
|
11028
|
+
case 9:
|
|
11029
|
+
ACTION_MAP = {
|
|
11030
|
+
"all-txns": "txlist",
|
|
11031
|
+
"token-txns": "tokentx",
|
|
11032
|
+
"nft-txns": "tokennfttx",
|
|
11033
|
+
gas: "gastracker"
|
|
11034
|
+
};
|
|
11035
|
+
action = ACTION_MAP[type];
|
|
11036
|
+
if (action) {
|
|
11037
|
+
_context2.next = 13;
|
|
11038
|
+
break;
|
|
11039
|
+
}
|
|
11040
|
+
return _context2.abrupt("return", "".concat(scanKey).concat(ERROR_MESSAGES_FLAG.INVALID_TYPE));
|
|
11041
|
+
|
|
11042
|
+
case 13:
|
|
11043
|
+
url = "".concat(baseUrl, "?chainid=").concat(chainId, "&module=account&action=").concat(action, "&apikey=").concat(API_KEY);
|
|
11044
|
+
if (![ "all-txns", "token-txns", "nft-txns" ].includes(type)) {
|
|
11045
|
+
_context2.next = 26;
|
|
11046
|
+
break;
|
|
11047
|
+
}
|
|
11048
|
+
if (address) {
|
|
11049
|
+
_context2.next = 17;
|
|
11050
|
+
break;
|
|
11051
|
+
}
|
|
11052
|
+
return _context2.abrupt("return", "".concat(scanKey).concat(ERROR_MESSAGES_FLAG.INVALID_ADDRESS));
|
|
11053
|
+
|
|
11054
|
+
case 17:
|
|
11055
|
+
url += "&address=".concat(address, "&startblock=0&endblock=99999999&sort=asc");
|
|
11056
|
+
if (!(!isNaN(startDate) && !isNaN(endDate))) {
|
|
11057
|
+
_context2.next = 26;
|
|
11058
|
+
break;
|
|
11059
|
+
}
|
|
11060
|
+
_context2.next = 21;
|
|
11061
|
+
return Promise.all([ fromTimeStampToBlock(startDate, chain, API_KEY), fromTimeStampToBlock(endDate, chain, API_KEY) ]);
|
|
11062
|
+
|
|
11063
|
+
case 21:
|
|
11064
|
+
_yield$Promise$all = _context2.sent;
|
|
11065
|
+
_yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 2);
|
|
11066
|
+
startBlock = _yield$Promise$all2[0];
|
|
11067
|
+
endBlock = _yield$Promise$all2[1];
|
|
11068
|
+
url += "&startblock=".concat(startBlock, "&endblock=").concat(endBlock);
|
|
11069
|
+
|
|
11070
|
+
case 26:
|
|
11071
|
+
_context2.prev = 26;
|
|
11072
|
+
_context2.next = 29;
|
|
11073
|
+
return fetch(url);
|
|
11074
|
+
|
|
11075
|
+
case 29:
|
|
11076
|
+
res = _context2.sent;
|
|
11077
|
+
if (res.ok) {
|
|
11078
|
+
_context2.next = 32;
|
|
11079
|
+
break;
|
|
11080
|
+
}
|
|
11081
|
+
throw new Error("HTTP error: ".concat(res.status));
|
|
11082
|
+
|
|
11083
|
+
case 32:
|
|
11084
|
+
_context2.next = 34;
|
|
11085
|
+
return res.json();
|
|
11086
|
+
|
|
11087
|
+
case 34:
|
|
11088
|
+
json = _context2.sent;
|
|
11089
|
+
if (!(typeof json.result === "string")) {
|
|
11090
|
+
_context2.next = 40;
|
|
11091
|
+
break;
|
|
11092
|
+
}
|
|
11093
|
+
if (!json.result.includes("Invalid API Key")) {
|
|
11094
|
+
_context2.next = 38;
|
|
11095
|
+
break;
|
|
11096
|
+
}
|
|
11097
|
+
return _context2.abrupt("return", "".concat(scanKey).concat(ERROR_MESSAGES_FLAG.INVALID_API_KEY));
|
|
11098
|
+
|
|
11099
|
+
case 38:
|
|
11100
|
+
if (!json.result.includes("Max rate limit reached")) {
|
|
11101
|
+
_context2.next = 40;
|
|
11102
|
+
break;
|
|
11103
|
+
}
|
|
11104
|
+
return _context2.abrupt("return", "".concat(scanKey).concat(ERROR_MESSAGES_FLAG.RATE_LIMIT));
|
|
11105
|
+
|
|
11106
|
+
case 40:
|
|
11107
|
+
return _context2.abrupt("return", json.result);
|
|
11108
|
+
|
|
11109
|
+
case 43:
|
|
11110
|
+
_context2.prev = 43;
|
|
11111
|
+
_context2.t0 = _context2["catch"](26);
|
|
11112
|
+
console.error("[".concat(scanKey, "]"), _context2.t0);
|
|
11113
|
+
return _context2.abrupt("return", ERROR_MESSAGES_FLAG.DEFAULT);
|
|
11114
|
+
|
|
11115
|
+
case 47:
|
|
11116
|
+
case "end":
|
|
11117
|
+
return _context2.stop();
|
|
11118
|
+
}
|
|
11119
|
+
}), _callee2, null, [ [ 26, 43 ] ]);
|
|
11120
|
+
})));
|
|
11121
|
+
return _handleScanRequest.apply(this, arguments);
|
|
11122
|
+
}
|
|
11123
|
+
function FIREFLY(_x5, _x6, _x7) {
|
|
11124
|
+
return _FIREFLY.apply(this, arguments);
|
|
11125
|
+
}
|
|
11126
|
+
function _FIREFLY() {
|
|
11127
|
+
_FIREFLY = _asyncToGenerator(_regeneratorRuntime().mark((function _callee3(platform, contentType, identifier) {
|
|
11128
|
+
var API_KEY, baseUrl, headers, query, type, normalizedId, url, res, json, flattened;
|
|
11129
|
+
return _regeneratorRuntime().wrap((function _callee3$(_context3) {
|
|
11130
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
11131
|
+
case 0:
|
|
11132
|
+
API_KEY = window.localStorage.getItem(SERVICE_API_KEY.Firefly);
|
|
11133
|
+
if (API_KEY) {
|
|
11134
|
+
_context3.next = 3;
|
|
11135
|
+
break;
|
|
11136
|
+
}
|
|
11137
|
+
return _context3.abrupt("return", "".concat(SERVICE_API_KEY.Firefly).concat(ERROR_MESSAGES_FLAG.MISSING_KEY));
|
|
11138
|
+
|
|
11139
|
+
case 3:
|
|
11140
|
+
baseUrl = "https://openapi.firefly.land/v1/fileverse/fetch";
|
|
11141
|
+
headers = {
|
|
11142
|
+
"x-api-key": API_KEY
|
|
11143
|
+
};
|
|
11144
|
+
query = "";
|
|
11145
|
+
type = "";
|
|
11146
|
+
normalizedId = identifier.trim().replace(/.*\/([^\/]+)$/, "$1");
|
|
11147
|
+
if (!(platform === "farcaster")) {
|
|
11148
|
+
_context3.next = 22;
|
|
11149
|
+
break;
|
|
11150
|
+
}
|
|
11151
|
+
if (!(contentType === "posts")) {
|
|
11152
|
+
_context3.next = 14;
|
|
11153
|
+
break;
|
|
11154
|
+
}
|
|
11155
|
+
type = "farcasterid";
|
|
11156
|
+
query = normalizedId;
|
|
11157
|
+
_context3.next = 20;
|
|
11158
|
+
break;
|
|
11159
|
+
|
|
11160
|
+
case 14:
|
|
11161
|
+
if (!(contentType === "replies")) {
|
|
11162
|
+
_context3.next = 19;
|
|
11163
|
+
break;
|
|
11164
|
+
}
|
|
11165
|
+
type = "farcasterpostid";
|
|
11166
|
+
query = normalizedId.startsWith("0x") ? normalizedId : Number(normalizedId).toString();
|
|
11167
|
+
_context3.next = 20;
|
|
11168
|
+
break;
|
|
11169
|
+
|
|
11170
|
+
case 19:
|
|
11171
|
+
return _context3.abrupt("return", "".concat(SERVICE_API_KEY.Firefly).concat(ERROR_MESSAGES_FLAG.INVALID_TYPE));
|
|
11172
|
+
|
|
11173
|
+
case 20:
|
|
11174
|
+
_context3.next = 37;
|
|
11175
|
+
break;
|
|
11176
|
+
|
|
11177
|
+
case 22:
|
|
11178
|
+
if (!(platform === "lens")) {
|
|
11179
|
+
_context3.next = 36;
|
|
11180
|
+
break;
|
|
11181
|
+
}
|
|
11182
|
+
if (!(contentType === "posts")) {
|
|
11183
|
+
_context3.next = 28;
|
|
11184
|
+
break;
|
|
11185
|
+
}
|
|
11186
|
+
type = "lensid";
|
|
11187
|
+
query = normalizedId;
|
|
11188
|
+
_context3.next = 34;
|
|
11189
|
+
break;
|
|
11190
|
+
|
|
11191
|
+
case 28:
|
|
11192
|
+
if (!(contentType === "replies")) {
|
|
11193
|
+
_context3.next = 33;
|
|
11194
|
+
break;
|
|
11195
|
+
}
|
|
11196
|
+
type = "lenspostid";
|
|
11197
|
+
query = normalizedId;
|
|
11198
|
+
_context3.next = 34;
|
|
11199
|
+
break;
|
|
11200
|
+
|
|
11201
|
+
case 33:
|
|
11202
|
+
return _context3.abrupt("return", "".concat(SERVICE_API_KEY.Firefly).concat(ERROR_MESSAGES_FLAG.INVALID_TYPE));
|
|
11203
|
+
|
|
11204
|
+
case 34:
|
|
11205
|
+
_context3.next = 37;
|
|
11206
|
+
break;
|
|
11207
|
+
|
|
11208
|
+
case 36:
|
|
11209
|
+
return _context3.abrupt("return", "".concat(SERVICE_API_KEY.Firefly).concat(ERROR_MESSAGES_FLAG.INVALID_PARAM));
|
|
11210
|
+
|
|
11211
|
+
case 37:
|
|
11212
|
+
url = new URL(baseUrl);
|
|
11213
|
+
url.searchParams.set("query", query);
|
|
11214
|
+
url.searchParams.set("type", type);
|
|
11215
|
+
url.searchParams.set("size", "10");
|
|
11216
|
+
url.searchParams.set("cursor", "0");
|
|
11217
|
+
_context3.prev = 42;
|
|
11218
|
+
_context3.next = 45;
|
|
11219
|
+
return fetch(url.toString(), {
|
|
11220
|
+
headers: headers
|
|
11221
|
+
});
|
|
11222
|
+
|
|
11223
|
+
case 45:
|
|
11224
|
+
res = _context3.sent;
|
|
11225
|
+
if (res.ok) {
|
|
11226
|
+
_context3.next = 48;
|
|
11227
|
+
break;
|
|
11228
|
+
}
|
|
11229
|
+
throw new Error("HTTP ".concat(res.status));
|
|
11230
|
+
|
|
11231
|
+
case 48:
|
|
11232
|
+
_context3.next = 50;
|
|
11233
|
+
return res.json();
|
|
11234
|
+
|
|
11235
|
+
case 50:
|
|
11236
|
+
json = _context3.sent;
|
|
11237
|
+
flattened = Array.isArray(json === null || json === void 0 ? void 0 : json.data) ? json.data.map((function(item) {
|
|
11238
|
+
var _item$author, _item$author2, _item$metadata;
|
|
11239
|
+
return {
|
|
11240
|
+
id: (item === null || item === void 0 ? void 0 : item.id) || null,
|
|
11241
|
+
author: (item === null || item === void 0 || (_item$author = item.author) === null || _item$author === void 0 ? void 0 : _item$author.username) || (item === null || item === void 0 || (_item$author2 = item.author) === null || _item$author2 === void 0 ? void 0 : _item$author2.handle) || "",
|
|
11242
|
+
text: (item === null || item === void 0 ? void 0 : item.text) || (item === null || item === void 0 || (_item$metadata = item.metadata) === null || _item$metadata === void 0 || (_item$metadata = _item$metadata.content) === null || _item$metadata === void 0 ? void 0 : _item$metadata.content) || "",
|
|
11243
|
+
createdAt: (item === null || item === void 0 ? void 0 : item.createdAt) || "",
|
|
11244
|
+
platform: platform
|
|
11245
|
+
};
|
|
11246
|
+
})) : [];
|
|
11247
|
+
return _context3.abrupt("return", flattened);
|
|
11248
|
+
|
|
11249
|
+
case 55:
|
|
11250
|
+
_context3.prev = 55;
|
|
11251
|
+
_context3.t0 = _context3["catch"](42);
|
|
11252
|
+
console.error("FIREFLY fetch error:", _context3.t0);
|
|
11253
|
+
return _context3.abrupt("return", ERROR_MESSAGES_FLAG.DEFAULT);
|
|
11254
|
+
|
|
11255
|
+
case 59:
|
|
11256
|
+
case "end":
|
|
11257
|
+
return _context3.stop();
|
|
11258
|
+
}
|
|
11259
|
+
}), _callee3, null, [ [ 42, 55 ] ]);
|
|
11260
|
+
})));
|
|
11261
|
+
return _FIREFLY.apply(this, arguments);
|
|
11262
|
+
}
|
|
11263
|
+
function BLOCKSCOUT(_x8, _x9, _x0, _x1, _x10, _x11, _x12) {
|
|
10992
11264
|
return _BLOCKSCOUT.apply(this, arguments);
|
|
10993
11265
|
}
|
|
10994
11266
|
function _BLOCKSCOUT() {
|
|
10995
|
-
_BLOCKSCOUT = _asyncToGenerator(_regeneratorRuntime().mark((function
|
|
11267
|
+
_BLOCKSCOUT = _asyncToGenerator(_regeneratorRuntime().mark((function _callee4(address, type, chain, startTimestamp, endTimestamp, page, offset) {
|
|
10996
11268
|
var currentTimestamp, hostname, requestUrl, _json$result, _json$result2, response, json;
|
|
10997
|
-
return _regeneratorRuntime().wrap((function
|
|
10998
|
-
while (1) switch (
|
|
11269
|
+
return _regeneratorRuntime().wrap((function _callee4$(_context4) {
|
|
11270
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
10999
11271
|
case 0:
|
|
11000
11272
|
if (!chain) {
|
|
11001
11273
|
chain = "ethereum";
|
|
11002
11274
|
}
|
|
11003
11275
|
if (type) {
|
|
11004
|
-
|
|
11276
|
+
_context4.next = 3;
|
|
11005
11277
|
break;
|
|
11006
11278
|
}
|
|
11007
|
-
return
|
|
11279
|
+
return _context4.abrupt("return", "TYPE_MISSING");
|
|
11008
11280
|
|
|
11009
11281
|
case 3:
|
|
11010
11282
|
if (!startTimestamp) {
|
|
@@ -11013,226 +11285,359 @@ function _typeof(o) {
|
|
|
11013
11285
|
startTimestamp = Math.floor(startTimestamp / 1e3);
|
|
11014
11286
|
}
|
|
11015
11287
|
hostname = BLOCKSCOUT_CHAINS_MAP[chain];
|
|
11016
|
-
|
|
11017
|
-
|
|
11288
|
+
_context4.t0 = type;
|
|
11289
|
+
_context4.next = _context4.t0 === "stat" ? 8 : _context4.t0 === "txns" ? 10 : _context4.t0 === "tokens" ? 12 : 14;
|
|
11018
11290
|
break;
|
|
11019
11291
|
|
|
11020
11292
|
case 8:
|
|
11021
11293
|
requestUrl = "".concat(hostname, "/api/v2/addresses/").concat(address, "/counters");
|
|
11022
|
-
return
|
|
11294
|
+
return _context4.abrupt("break", 15);
|
|
11023
11295
|
|
|
11024
11296
|
case 10:
|
|
11025
11297
|
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");
|
|
11026
|
-
return
|
|
11298
|
+
return _context4.abrupt("break", 15);
|
|
11027
11299
|
|
|
11028
11300
|
case 12:
|
|
11029
11301
|
requestUrl = "".concat(hostname, "/api?module=account&action=tokenlist&address=").concat(address);
|
|
11030
|
-
return
|
|
11302
|
+
return _context4.abrupt("break", 15);
|
|
11031
11303
|
|
|
11032
11304
|
case 14:
|
|
11033
|
-
return
|
|
11305
|
+
return _context4.abrupt("return", "INVALID_TYPE");
|
|
11034
11306
|
|
|
11035
11307
|
case 15:
|
|
11036
|
-
|
|
11037
|
-
|
|
11308
|
+
_context4.prev = 15;
|
|
11309
|
+
_context4.next = 18;
|
|
11038
11310
|
return fetch(requestUrl);
|
|
11039
11311
|
|
|
11040
11312
|
case 18:
|
|
11041
|
-
response =
|
|
11313
|
+
response = _context4.sent;
|
|
11042
11314
|
if (response.ok) {
|
|
11043
|
-
|
|
11315
|
+
_context4.next = 21;
|
|
11044
11316
|
break;
|
|
11045
11317
|
}
|
|
11046
11318
|
throw new Error("HTTP error! Status: ".concat(response.status));
|
|
11047
11319
|
|
|
11048
11320
|
case 21:
|
|
11049
|
-
|
|
11321
|
+
_context4.next = 23;
|
|
11050
11322
|
return response.json();
|
|
11051
11323
|
|
|
11052
11324
|
case 23:
|
|
11053
|
-
json =
|
|
11325
|
+
json = _context4.sent;
|
|
11054
11326
|
console.log(json);
|
|
11055
11327
|
if (!(json !== null && json !== void 0 && (_json$result = json.result) !== null && _json$result !== void 0 && _json$result.includes("Invalid parameter(s)"))) {
|
|
11056
|
-
|
|
11328
|
+
_context4.next = 27;
|
|
11057
11329
|
break;
|
|
11058
11330
|
}
|
|
11059
|
-
return
|
|
11331
|
+
return _context4.abrupt("return", "INVALID_REQUEST_PARAMS");
|
|
11060
11332
|
|
|
11061
11333
|
case 27:
|
|
11062
11334
|
if (!(json !== null && json !== void 0 && (_json$result2 = json.result) !== null && _json$result2 !== void 0 && _json$result2.includes("Not found"))) {
|
|
11063
|
-
|
|
11335
|
+
_context4.next = 29;
|
|
11064
11336
|
break;
|
|
11065
11337
|
}
|
|
11066
|
-
return
|
|
11338
|
+
return _context4.abrupt("return", "ADDRESS_NOT_FOUND");
|
|
11067
11339
|
|
|
11068
11340
|
case 29:
|
|
11069
11341
|
if (!(type === "stat")) {
|
|
11070
|
-
|
|
11342
|
+
_context4.next = 31;
|
|
11071
11343
|
break;
|
|
11072
11344
|
}
|
|
11073
|
-
return
|
|
11345
|
+
return _context4.abrupt("return", [ json ]);
|
|
11074
11346
|
|
|
11075
11347
|
case 31:
|
|
11076
|
-
return
|
|
11348
|
+
return _context4.abrupt("return", json.result);
|
|
11077
11349
|
|
|
11078
11350
|
case 34:
|
|
11079
|
-
|
|
11080
|
-
|
|
11081
|
-
return
|
|
11351
|
+
_context4.prev = 34;
|
|
11352
|
+
_context4.t1 = _context4["catch"](15);
|
|
11353
|
+
return _context4.abrupt("return", "ERROR IN FETCHING");
|
|
11082
11354
|
|
|
11083
11355
|
case 37:
|
|
11084
11356
|
case "end":
|
|
11085
|
-
return
|
|
11357
|
+
return _context4.stop();
|
|
11086
11358
|
}
|
|
11087
|
-
}),
|
|
11359
|
+
}), _callee4, null, [ [ 15, 34 ] ]);
|
|
11088
11360
|
})));
|
|
11089
11361
|
return _BLOCKSCOUT.apply(this, arguments);
|
|
11090
11362
|
}
|
|
11091
|
-
function
|
|
11092
|
-
return
|
|
11363
|
+
function BASESCAN() {
|
|
11364
|
+
return _BASESCAN.apply(this, arguments);
|
|
11093
11365
|
}
|
|
11094
|
-
function
|
|
11095
|
-
|
|
11096
|
-
var _len2, args, _key2, type, chain, address, startDate, endDate,
|
|
11097
|
-
return _regeneratorRuntime().wrap((function
|
|
11098
|
-
while (1) switch (
|
|
11366
|
+
function _BASESCAN() {
|
|
11367
|
+
_BASESCAN = _asyncToGenerator(_regeneratorRuntime().mark((function _callee5() {
|
|
11368
|
+
var _len2, args, _key2, type, chain, address, startDate, endDate, _args5 = arguments;
|
|
11369
|
+
return _regeneratorRuntime().wrap((function _callee5$(_context5) {
|
|
11370
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
11099
11371
|
case 0:
|
|
11100
|
-
for (_len2 =
|
|
11101
|
-
args[_key2] =
|
|
11372
|
+
for (_len2 = _args5.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
11373
|
+
args[_key2] = _args5[_key2];
|
|
11102
11374
|
}
|
|
11103
11375
|
type = args[0], chain = args[1], address = args[2], startDate = args[3], endDate = args[4];
|
|
11104
|
-
|
|
11105
|
-
|
|
11106
|
-
|
|
11107
|
-
|
|
11108
|
-
|
|
11109
|
-
|
|
11376
|
+
return _context5.abrupt("return", handleScanRequest({
|
|
11377
|
+
scanKey: SERVICE_API_KEY.Basescan,
|
|
11378
|
+
baseUrl: "https://api.basescan.org/api",
|
|
11379
|
+
type: type,
|
|
11380
|
+
chain: chain,
|
|
11381
|
+
address: address,
|
|
11382
|
+
startDate: startDate,
|
|
11383
|
+
endDate: endDate
|
|
11384
|
+
}));
|
|
11110
11385
|
|
|
11111
|
-
case
|
|
11112
|
-
|
|
11113
|
-
|
|
11114
|
-
|
|
11386
|
+
case 3:
|
|
11387
|
+
case "end":
|
|
11388
|
+
return _context5.stop();
|
|
11389
|
+
}
|
|
11390
|
+
}), _callee5);
|
|
11391
|
+
})));
|
|
11392
|
+
return _BASESCAN.apply(this, arguments);
|
|
11393
|
+
}
|
|
11394
|
+
function GNOSISSCAN() {
|
|
11395
|
+
return _GNOSISSCAN.apply(this, arguments);
|
|
11396
|
+
}
|
|
11397
|
+
function _GNOSISSCAN() {
|
|
11398
|
+
_GNOSISSCAN = _asyncToGenerator(_regeneratorRuntime().mark((function _callee6() {
|
|
11399
|
+
var _len3, args, _key3, type, chain, address, startDate, endDate, _args6 = arguments;
|
|
11400
|
+
return _regeneratorRuntime().wrap((function _callee6$(_context6) {
|
|
11401
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
11402
|
+
case 0:
|
|
11403
|
+
for (_len3 = _args6.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
11404
|
+
args[_key3] = _args6[_key3];
|
|
11115
11405
|
}
|
|
11116
|
-
|
|
11406
|
+
type = args[0], chain = args[1], address = args[2], startDate = args[3], endDate = args[4];
|
|
11407
|
+
return _context6.abrupt("return", handleScanRequest({
|
|
11408
|
+
scanKey: SERVICE_API_KEY.Gnosisscan,
|
|
11409
|
+
baseUrl: "https://api.gnosisscan.io/api",
|
|
11410
|
+
type: type,
|
|
11411
|
+
chain: chain,
|
|
11412
|
+
address: address,
|
|
11413
|
+
startDate: startDate,
|
|
11414
|
+
endDate: endDate
|
|
11415
|
+
}));
|
|
11117
11416
|
|
|
11118
|
-
case
|
|
11119
|
-
|
|
11120
|
-
|
|
11121
|
-
|
|
11417
|
+
case 3:
|
|
11418
|
+
case "end":
|
|
11419
|
+
return _context6.stop();
|
|
11420
|
+
}
|
|
11421
|
+
}), _callee6);
|
|
11422
|
+
})));
|
|
11423
|
+
return _GNOSISSCAN.apply(this, arguments);
|
|
11424
|
+
}
|
|
11425
|
+
function NEYNAR(_x13, _x14, _x15, _x16, _x17) {
|
|
11426
|
+
return _NEYNAR.apply(this, arguments);
|
|
11427
|
+
}
|
|
11428
|
+
function _NEYNAR() {
|
|
11429
|
+
_NEYNAR = _asyncToGenerator(_regeneratorRuntime().mark((function _callee7(fid, viewerFid, sortType, limit, cursor) {
|
|
11430
|
+
var API_KEY, url, _json$users, response, json;
|
|
11431
|
+
return _regeneratorRuntime().wrap((function _callee7$(_context7) {
|
|
11432
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
11433
|
+
case 0:
|
|
11434
|
+
API_KEY = window.localStorage.getItem(SERVICE_API_KEY.Neynar);
|
|
11435
|
+
if (API_KEY) {
|
|
11436
|
+
_context7.next = 3;
|
|
11122
11437
|
break;
|
|
11123
11438
|
}
|
|
11124
|
-
return
|
|
11439
|
+
return _context7.abrupt("return", "".concat(SERVICE_API_KEY.Neynar).concat(ERROR_MESSAGES_FLAG.MISSING_KEY));
|
|
11125
11440
|
|
|
11126
|
-
case
|
|
11127
|
-
|
|
11128
|
-
|
|
11129
|
-
|
|
11441
|
+
case 3:
|
|
11442
|
+
url = new URL("https://api.neynar.com/v2/farcaster/followers");
|
|
11443
|
+
url.searchParams.set("fid", fid.toString());
|
|
11444
|
+
url.searchParams.set("sort_type", sortType);
|
|
11445
|
+
url.searchParams.set("limit", limit.toString());
|
|
11446
|
+
if (viewerFid !== null) url.searchParams.set("viewer_fid", viewerFid.toString());
|
|
11447
|
+
if (cursor) url.searchParams.set("cursor", cursor);
|
|
11448
|
+
_context7.prev = 9;
|
|
11449
|
+
_context7.next = 12;
|
|
11450
|
+
return fetch(url.toString(), {
|
|
11451
|
+
headers: {
|
|
11452
|
+
"x-api-key": API_KEY,
|
|
11453
|
+
"x-neynar-experimental": "false"
|
|
11454
|
+
}
|
|
11455
|
+
});
|
|
11130
11456
|
|
|
11131
|
-
case
|
|
11132
|
-
|
|
11133
|
-
|
|
11457
|
+
case 12:
|
|
11458
|
+
response = _context7.sent;
|
|
11459
|
+
if (response.ok) {
|
|
11460
|
+
_context7.next = 15;
|
|
11461
|
+
break;
|
|
11462
|
+
}
|
|
11463
|
+
throw new Error("HTTP ".concat(response.status));
|
|
11134
11464
|
|
|
11135
11465
|
case 15:
|
|
11136
|
-
|
|
11137
|
-
return
|
|
11466
|
+
_context7.next = 17;
|
|
11467
|
+
return response.json();
|
|
11138
11468
|
|
|
11139
11469
|
case 17:
|
|
11140
|
-
|
|
11141
|
-
|
|
11470
|
+
json = _context7.sent;
|
|
11471
|
+
if (json !== null && json !== void 0 && (_json$users = json.users) !== null && _json$users !== void 0 && _json$users.length) {
|
|
11472
|
+
_context7.next = 20;
|
|
11473
|
+
break;
|
|
11474
|
+
}
|
|
11475
|
+
return _context7.abrupt("return", []);
|
|
11142
11476
|
|
|
11143
|
-
case
|
|
11144
|
-
|
|
11145
|
-
|
|
11477
|
+
case 20:
|
|
11478
|
+
return _context7.abrupt("return", json.users.map((function(_ref4) {
|
|
11479
|
+
var _user$profile, _user$profile2;
|
|
11480
|
+
var user = _ref4.user;
|
|
11481
|
+
return {
|
|
11482
|
+
username: user.username,
|
|
11483
|
+
custody_address: user.custody_address,
|
|
11484
|
+
follower_count: user.follower_count,
|
|
11485
|
+
country: ((_user$profile = user.profile) === null || _user$profile === void 0 || (_user$profile = _user$profile.location) === null || _user$profile === void 0 || (_user$profile = _user$profile.address) === null || _user$profile === void 0 ? void 0 : _user$profile.country) || "",
|
|
11486
|
+
city: ((_user$profile2 = user.profile) === null || _user$profile2 === void 0 || (_user$profile2 = _user$profile2.location) === null || _user$profile2 === void 0 || (_user$profile2 = _user$profile2.address) === null || _user$profile2 === void 0 ? void 0 : _user$profile2.city) || ""
|
|
11487
|
+
};
|
|
11488
|
+
})));
|
|
11146
11489
|
|
|
11147
|
-
case
|
|
11148
|
-
|
|
11490
|
+
case 23:
|
|
11491
|
+
_context7.prev = 23;
|
|
11492
|
+
_context7.t0 = _context7["catch"](9);
|
|
11493
|
+
console.error("NEYNAR_FETCH_FOLLOWERS error:", _context7.t0);
|
|
11494
|
+
return _context7.abrupt("return", ERROR_MESSAGES_FLAG.DEFAULT);
|
|
11149
11495
|
|
|
11150
|
-
case
|
|
11151
|
-
|
|
11152
|
-
|
|
11153
|
-
|
|
11154
|
-
|
|
11155
|
-
|
|
11156
|
-
|
|
11157
|
-
|
|
11496
|
+
case 27:
|
|
11497
|
+
case "end":
|
|
11498
|
+
return _context7.stop();
|
|
11499
|
+
}
|
|
11500
|
+
}), _callee7, null, [ [ 9, 23 ] ]);
|
|
11501
|
+
})));
|
|
11502
|
+
return _NEYNAR.apply(this, arguments);
|
|
11503
|
+
}
|
|
11504
|
+
function GNOSIS(_x18) {
|
|
11505
|
+
return _GNOSIS.apply(this, arguments);
|
|
11506
|
+
}
|
|
11507
|
+
function _GNOSIS() {
|
|
11508
|
+
_GNOSIS = _asyncToGenerator(_regeneratorRuntime().mark((function _callee8(_ref3) {
|
|
11509
|
+
var cardId, startDate, endDate, _ref3$limit, limit, _ref3$offset, offset, apiKeyKey, API_KEY, url, res, json;
|
|
11510
|
+
return _regeneratorRuntime().wrap((function _callee8$(_context8) {
|
|
11511
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
11512
|
+
case 0:
|
|
11513
|
+
cardId = _ref3.cardId, startDate = _ref3.startDate, endDate = _ref3.endDate, _ref3$limit = _ref3.limit,
|
|
11514
|
+
limit = _ref3$limit === void 0 ? 20 : _ref3$limit, _ref3$offset = _ref3.offset,
|
|
11515
|
+
offset = _ref3$offset === void 0 ? 0 : _ref3$offset;
|
|
11516
|
+
apiKeyKey = SERVICE_API_KEY.GnosisPay;
|
|
11517
|
+
API_KEY = window.localStorage.getItem(apiKeyKey);
|
|
11518
|
+
if (API_KEY) {
|
|
11519
|
+
_context8.next = 5;
|
|
11158
11520
|
break;
|
|
11159
11521
|
}
|
|
11160
|
-
return
|
|
11522
|
+
return _context8.abrupt("return", "".concat(apiKeyKey).concat(ERROR_MESSAGES_FLAG.MISSING_KEY));
|
|
11161
11523
|
|
|
11162
|
-
case
|
|
11163
|
-
|
|
11164
|
-
|
|
11165
|
-
_context3.next = 35;
|
|
11524
|
+
case 5:
|
|
11525
|
+
if (cardId) {
|
|
11526
|
+
_context8.next = 7;
|
|
11166
11527
|
break;
|
|
11167
11528
|
}
|
|
11168
|
-
|
|
11169
|
-
return fromTimeStampToBlock(startDate, chain, API_KEY);
|
|
11529
|
+
return _context8.abrupt("return", "".concat(apiKeyKey).concat(ERROR_MESSAGES_FLAG.INVALID_PARAM));
|
|
11170
11530
|
|
|
11171
|
-
case
|
|
11172
|
-
|
|
11173
|
-
|
|
11174
|
-
|
|
11175
|
-
|
|
11176
|
-
|
|
11177
|
-
|
|
11178
|
-
|
|
11179
|
-
|
|
11180
|
-
|
|
11181
|
-
|
|
11182
|
-
|
|
11183
|
-
return fetch(url)
|
|
11531
|
+
case 7:
|
|
11532
|
+
url = new URL("https://api.gnosispay.com/cards/".concat(cardId, "/transactions"));
|
|
11533
|
+
url.searchParams.set("limit", limit.toString());
|
|
11534
|
+
url.searchParams.set("offset", offset.toString());
|
|
11535
|
+
if (!isNaN(startDate)) {
|
|
11536
|
+
url.searchParams.set("startDate", new Date(startDate * 1e3).toISOString());
|
|
11537
|
+
}
|
|
11538
|
+
if (!isNaN(endDate)) {
|
|
11539
|
+
url.searchParams.set("endDate", new Date(endDate * 1e3).toISOString());
|
|
11540
|
+
}
|
|
11541
|
+
_context8.prev = 12;
|
|
11542
|
+
_context8.next = 15;
|
|
11543
|
+
return fetch(url.toString(), {
|
|
11544
|
+
headers: {
|
|
11545
|
+
Authorization: "Bearer ".concat(API_KEY),
|
|
11546
|
+
"Content-Type": "application/json"
|
|
11547
|
+
}
|
|
11548
|
+
});
|
|
11184
11549
|
|
|
11185
|
-
case
|
|
11186
|
-
|
|
11187
|
-
if (
|
|
11188
|
-
|
|
11550
|
+
case 15:
|
|
11551
|
+
res = _context8.sent;
|
|
11552
|
+
if (res.ok) {
|
|
11553
|
+
_context8.next = 18;
|
|
11189
11554
|
break;
|
|
11190
11555
|
}
|
|
11191
|
-
throw new Error("HTTP error! Status: ".concat(
|
|
11556
|
+
throw new Error("HTTP error! Status: ".concat(res.status));
|
|
11192
11557
|
|
|
11193
|
-
case
|
|
11194
|
-
|
|
11195
|
-
return
|
|
11558
|
+
case 18:
|
|
11559
|
+
_context8.next = 20;
|
|
11560
|
+
return res.json();
|
|
11196
11561
|
|
|
11197
|
-
case
|
|
11198
|
-
json =
|
|
11199
|
-
if (
|
|
11200
|
-
|
|
11562
|
+
case 20:
|
|
11563
|
+
json = _context8.sent;
|
|
11564
|
+
if (Array.isArray(json)) {
|
|
11565
|
+
_context8.next = 23;
|
|
11201
11566
|
break;
|
|
11202
11567
|
}
|
|
11203
|
-
return
|
|
11568
|
+
return _context8.abrupt("return", []);
|
|
11204
11569
|
|
|
11205
|
-
case
|
|
11206
|
-
|
|
11207
|
-
|
|
11208
|
-
|
|
11209
|
-
|
|
11210
|
-
|
|
11570
|
+
case 23:
|
|
11571
|
+
return _context8.abrupt("return", json.map((function(tx) {
|
|
11572
|
+
return {
|
|
11573
|
+
createdAt: tx.createdAt,
|
|
11574
|
+
clearedAt: tx.clearedAt,
|
|
11575
|
+
country: tx.country,
|
|
11576
|
+
merchant: tx.merchant,
|
|
11577
|
+
billingAmount: tx.billingAmount,
|
|
11578
|
+
billingCurrency: tx.billingCurrency,
|
|
11579
|
+
transactionAmount: tx.transactionAmount,
|
|
11580
|
+
transactionCurrency: tx.transactionCurrency,
|
|
11581
|
+
transactionType: tx.transactionType,
|
|
11582
|
+
kind: tx.kind,
|
|
11583
|
+
status: tx.status || null,
|
|
11584
|
+
mcc: tx.mcc
|
|
11585
|
+
};
|
|
11586
|
+
})));
|
|
11211
11587
|
|
|
11212
|
-
case
|
|
11213
|
-
|
|
11588
|
+
case 26:
|
|
11589
|
+
_context8.prev = 26;
|
|
11590
|
+
_context8.t0 = _context8["catch"](12);
|
|
11591
|
+
console.error("GNOSISPAY_CARD_TXNS error:", _context8.t0);
|
|
11592
|
+
return _context8.abrupt("return", ERROR_MESSAGES_FLAG.DEFAULT);
|
|
11214
11593
|
|
|
11215
|
-
case
|
|
11216
|
-
|
|
11217
|
-
|
|
11218
|
-
|
|
11594
|
+
case 30:
|
|
11595
|
+
case "end":
|
|
11596
|
+
return _context8.stop();
|
|
11597
|
+
}
|
|
11598
|
+
}), _callee8, null, [ [ 12, 26 ] ]);
|
|
11599
|
+
})));
|
|
11600
|
+
return _GNOSIS.apply(this, arguments);
|
|
11601
|
+
}
|
|
11602
|
+
function ETHERSCAN() {
|
|
11603
|
+
return _ETHERSCAN.apply(this, arguments);
|
|
11604
|
+
}
|
|
11605
|
+
function _ETHERSCAN() {
|
|
11606
|
+
_ETHERSCAN = _asyncToGenerator(_regeneratorRuntime().mark((function _callee9() {
|
|
11607
|
+
var _len4, args, _key4, type, chain, address, startDate, endDate, _args9 = arguments;
|
|
11608
|
+
return _regeneratorRuntime().wrap((function _callee9$(_context9) {
|
|
11609
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
11610
|
+
case 0:
|
|
11611
|
+
for (_len4 = _args9.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
|
11612
|
+
args[_key4] = _args9[_key4];
|
|
11613
|
+
}
|
|
11614
|
+
type = args[0], chain = args[1], address = args[2], startDate = args[3], endDate = args[4];
|
|
11615
|
+
return _context9.abrupt("return", handleScanRequest({
|
|
11616
|
+
scanKey: SERVICE_API_KEY.Etherscan,
|
|
11617
|
+
baseUrl: "https://api.etherscan.io/v2/api",
|
|
11618
|
+
type: type,
|
|
11619
|
+
chain: chain,
|
|
11620
|
+
address: address,
|
|
11621
|
+
startDate: startDate,
|
|
11622
|
+
endDate: endDate
|
|
11623
|
+
}));
|
|
11219
11624
|
|
|
11220
|
-
case
|
|
11625
|
+
case 3:
|
|
11221
11626
|
case "end":
|
|
11222
|
-
return
|
|
11627
|
+
return _context9.stop();
|
|
11223
11628
|
}
|
|
11224
|
-
}),
|
|
11629
|
+
}), _callee9);
|
|
11225
11630
|
})));
|
|
11226
11631
|
return _ETHERSCAN.apply(this, arguments);
|
|
11227
11632
|
}
|
|
11228
|
-
function COINGECKO(
|
|
11633
|
+
function COINGECKO(_x19, _x20) {
|
|
11229
11634
|
return _COINGECKO.apply(this, arguments);
|
|
11230
11635
|
}
|
|
11231
11636
|
function _COINGECKO() {
|
|
11232
|
-
_COINGECKO = _asyncToGenerator(_regeneratorRuntime().mark((function
|
|
11637
|
+
_COINGECKO = _asyncToGenerator(_regeneratorRuntime().mark((function _callee0(token, vs_currencies) {
|
|
11233
11638
|
var API_KEY, url, options, response, json, jsonResponse, output, _i10, _Object$entries, _Object$entries$_i, coin, prices, _i11, _Object$entries2, _Object$entries2$_i, currency, _value5, key;
|
|
11234
|
-
return _regeneratorRuntime().wrap((function
|
|
11235
|
-
while (1) switch (
|
|
11639
|
+
return _regeneratorRuntime().wrap((function _callee0$(_context0) {
|
|
11640
|
+
while (1) switch (_context0.prev = _context0.next) {
|
|
11236
11641
|
case 0:
|
|
11237
11642
|
API_KEY = window.localStorage.getItem(SERVICE_API_KEY.Coingecko);
|
|
11238
11643
|
url = "https://api.coingecko.com/api/v3/simple/price?vs_currencies=".concat(vs_currencies, "&ids=").concat(token);
|
|
@@ -11243,40 +11648,40 @@ function _typeof(o) {
|
|
|
11243
11648
|
"x-cg-demo-api-key": "".concat(API_KEY)
|
|
11244
11649
|
}
|
|
11245
11650
|
};
|
|
11246
|
-
|
|
11247
|
-
|
|
11651
|
+
_context0.prev = 3;
|
|
11652
|
+
_context0.next = 6;
|
|
11248
11653
|
return fetch(url, options);
|
|
11249
11654
|
|
|
11250
11655
|
case 6:
|
|
11251
|
-
response =
|
|
11656
|
+
response = _context0.sent;
|
|
11252
11657
|
if (response.ok) {
|
|
11253
|
-
|
|
11658
|
+
_context0.next = 15;
|
|
11254
11659
|
break;
|
|
11255
11660
|
}
|
|
11256
|
-
|
|
11661
|
+
_context0.next = 10;
|
|
11257
11662
|
return response.json();
|
|
11258
11663
|
|
|
11259
11664
|
case 10:
|
|
11260
|
-
json =
|
|
11665
|
+
json = _context0.sent;
|
|
11261
11666
|
if (!json.status.error_message.includes("API Key Missing")) {
|
|
11262
|
-
|
|
11667
|
+
_context0.next = 13;
|
|
11263
11668
|
break;
|
|
11264
11669
|
}
|
|
11265
|
-
return
|
|
11670
|
+
return _context0.abrupt("return", "".concat(SERVICE_API_KEY.Coingecko).concat(ERROR_MESSAGES_FLAG.INVALID_API_KEY));
|
|
11266
11671
|
|
|
11267
11672
|
case 13:
|
|
11268
11673
|
if (!(response.status === 429)) {
|
|
11269
|
-
|
|
11674
|
+
_context0.next = 15;
|
|
11270
11675
|
break;
|
|
11271
11676
|
}
|
|
11272
|
-
return
|
|
11677
|
+
return _context0.abrupt("return", "".concat(SERVICE_API_KEY.Coingecko).concat(ERROR_MESSAGES_FLAG.RATE_LIMIT));
|
|
11273
11678
|
|
|
11274
11679
|
case 15:
|
|
11275
|
-
|
|
11680
|
+
_context0.next = 17;
|
|
11276
11681
|
return response.json();
|
|
11277
11682
|
|
|
11278
11683
|
case 17:
|
|
11279
|
-
jsonResponse =
|
|
11684
|
+
jsonResponse = _context0.sent;
|
|
11280
11685
|
output = {};
|
|
11281
11686
|
for (_i10 = 0, _Object$entries = Object.entries(jsonResponse); _i10 < _Object$entries.length; _i10++) {
|
|
11282
11687
|
_Object$entries$_i = _slicedToArray(_Object$entries[_i10], 2), coin = _Object$entries$_i[0],
|
|
@@ -11288,32 +11693,32 @@ function _typeof(o) {
|
|
|
11288
11693
|
output[key] = _value5;
|
|
11289
11694
|
}
|
|
11290
11695
|
}
|
|
11291
|
-
return
|
|
11696
|
+
return _context0.abrupt("return", [ output ]);
|
|
11292
11697
|
|
|
11293
11698
|
case 23:
|
|
11294
|
-
|
|
11295
|
-
|
|
11296
|
-
console.log(
|
|
11297
|
-
return
|
|
11699
|
+
_context0.prev = 23;
|
|
11700
|
+
_context0.t0 = _context0["catch"](3);
|
|
11701
|
+
console.log(_context0.t0);
|
|
11702
|
+
return _context0.abrupt("return", ERROR_MESSAGES_FLAG.DEFAULT);
|
|
11298
11703
|
|
|
11299
11704
|
case 27:
|
|
11300
11705
|
case "end":
|
|
11301
|
-
return
|
|
11706
|
+
return _context0.stop();
|
|
11302
11707
|
}
|
|
11303
|
-
}),
|
|
11708
|
+
}), _callee0, null, [ [ 3, 23 ] ]);
|
|
11304
11709
|
})));
|
|
11305
11710
|
return _COINGECKO.apply(this, arguments);
|
|
11306
11711
|
}
|
|
11307
|
-
function EOA(
|
|
11712
|
+
function EOA(_x21, _x22, _x23, _x24, _x25) {
|
|
11308
11713
|
return _EOA.apply(this, arguments);
|
|
11309
11714
|
}
|
|
11310
11715
|
function _EOA() {
|
|
11311
|
-
_EOA = _asyncToGenerator(_regeneratorRuntime().mark((function
|
|
11716
|
+
_EOA = _asyncToGenerator(_regeneratorRuntime().mark((function _callee1(addresses, category, chains, startTime, endTime) {
|
|
11312
11717
|
var ADDRESSES, CHAINS, flatResults, API_KEY, _iterator, _step, chain, chainId, _iterator2, _step2, address, action, timeQuery, startBlock, endBlock, url, _json$result3, _json$result3$include, _json$result4, _json$result4$include, response, json, entries, _iterator3, _step3, entry;
|
|
11313
|
-
return _regeneratorRuntime().wrap((function
|
|
11314
|
-
while (1) switch (
|
|
11718
|
+
return _regeneratorRuntime().wrap((function _callee1$(_context1) {
|
|
11719
|
+
while (1) switch (_context1.prev = _context1.next) {
|
|
11315
11720
|
case 0:
|
|
11316
|
-
|
|
11721
|
+
_context1.prev = 0;
|
|
11317
11722
|
ADDRESSES = addresses.split(",").map((function(a) {
|
|
11318
11723
|
return a.trim();
|
|
11319
11724
|
}));
|
|
@@ -11323,58 +11728,58 @@ function _typeof(o) {
|
|
|
11323
11728
|
flatResults = [];
|
|
11324
11729
|
API_KEY = window.localStorage.getItem(SERVICE_API_KEY.Etherscan);
|
|
11325
11730
|
if (API_KEY) {
|
|
11326
|
-
|
|
11731
|
+
_context1.next = 7;
|
|
11327
11732
|
break;
|
|
11328
11733
|
}
|
|
11329
|
-
return
|
|
11734
|
+
return _context1.abrupt("return", "".concat(SERVICE_API_KEY.Etherscan).concat(ERROR_MESSAGES_FLAG.MISSING_KEY));
|
|
11330
11735
|
|
|
11331
11736
|
case 7:
|
|
11332
11737
|
_iterator = _createForOfIteratorHelper(CHAINS);
|
|
11333
|
-
|
|
11738
|
+
_context1.prev = 8;
|
|
11334
11739
|
_iterator.s();
|
|
11335
11740
|
|
|
11336
11741
|
case 10:
|
|
11337
11742
|
if ((_step = _iterator.n()).done) {
|
|
11338
|
-
|
|
11743
|
+
_context1.next = 67;
|
|
11339
11744
|
break;
|
|
11340
11745
|
}
|
|
11341
11746
|
chain = _step.value;
|
|
11342
11747
|
chainId = CHAIN_ID_MAP[chain];
|
|
11343
11748
|
if (chainId) {
|
|
11344
|
-
|
|
11749
|
+
_context1.next = 15;
|
|
11345
11750
|
break;
|
|
11346
11751
|
}
|
|
11347
11752
|
throw new Error("Unsupported chain");
|
|
11348
11753
|
|
|
11349
11754
|
case 15:
|
|
11350
11755
|
_iterator2 = _createForOfIteratorHelper(ADDRESSES);
|
|
11351
|
-
|
|
11756
|
+
_context1.prev = 16;
|
|
11352
11757
|
_iterator2.s();
|
|
11353
11758
|
|
|
11354
11759
|
case 18:
|
|
11355
11760
|
if ((_step2 = _iterator2.n()).done) {
|
|
11356
|
-
|
|
11761
|
+
_context1.next = 57;
|
|
11357
11762
|
break;
|
|
11358
11763
|
}
|
|
11359
11764
|
address = _step2.value;
|
|
11360
11765
|
action = category === "txns" ? "account.txlist" : "account.balance";
|
|
11361
11766
|
timeQuery = "";
|
|
11362
11767
|
if (!(category === "txns")) {
|
|
11363
|
-
|
|
11768
|
+
_context1.next = 32;
|
|
11364
11769
|
break;
|
|
11365
11770
|
}
|
|
11366
|
-
|
|
11771
|
+
_context1.next = 25;
|
|
11367
11772
|
return fromTimeStampToBlock(startTime, chain, API_KEY);
|
|
11368
11773
|
|
|
11369
11774
|
case 25:
|
|
11370
|
-
startBlock =
|
|
11371
|
-
|
|
11775
|
+
startBlock = _context1.sent;
|
|
11776
|
+
_context1.next = 28;
|
|
11372
11777
|
return fromTimeStampToBlock(endTime, chain, API_KEY);
|
|
11373
11778
|
|
|
11374
11779
|
case 28:
|
|
11375
|
-
endBlock =
|
|
11780
|
+
endBlock = _context1.sent;
|
|
11376
11781
|
timeQuery = "&startblock=".concat(startBlock, "&endblock=").concat(endBlock);
|
|
11377
|
-
|
|
11782
|
+
_context1.next = 33;
|
|
11378
11783
|
break;
|
|
11379
11784
|
|
|
11380
11785
|
case 32:
|
|
@@ -11382,36 +11787,36 @@ function _typeof(o) {
|
|
|
11382
11787
|
|
|
11383
11788
|
case 33:
|
|
11384
11789
|
url = "https://api.etherscan.io/v2/api?module=".concat(action.split(".")[0], "&action=").concat(action.split(".")[1], "&address=").concat(address, "&sort=asc&chainid=").concat(chainId, "&apikey=").concat(API_KEY).concat(timeQuery);
|
|
11385
|
-
|
|
11386
|
-
|
|
11790
|
+
_context1.prev = 34;
|
|
11791
|
+
_context1.next = 37;
|
|
11387
11792
|
return fetch(url);
|
|
11388
11793
|
|
|
11389
11794
|
case 37:
|
|
11390
|
-
response =
|
|
11795
|
+
response = _context1.sent;
|
|
11391
11796
|
if (response.ok) {
|
|
11392
|
-
|
|
11797
|
+
_context1.next = 40;
|
|
11393
11798
|
break;
|
|
11394
11799
|
}
|
|
11395
|
-
return
|
|
11800
|
+
return _context1.abrupt("return", "HTTP_".concat(response.status));
|
|
11396
11801
|
|
|
11397
11802
|
case 40:
|
|
11398
|
-
|
|
11803
|
+
_context1.next = 42;
|
|
11399
11804
|
return response.json();
|
|
11400
11805
|
|
|
11401
11806
|
case 42:
|
|
11402
|
-
json =
|
|
11807
|
+
json = _context1.sent;
|
|
11403
11808
|
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"))) {
|
|
11404
|
-
|
|
11809
|
+
_context1.next = 45;
|
|
11405
11810
|
break;
|
|
11406
11811
|
}
|
|
11407
|
-
return
|
|
11812
|
+
return _context1.abrupt("return", "".concat(SERVICE_API_KEY.Etherscan).concat(ERROR_MESSAGES_FLAG.INVALID_API_KEY));
|
|
11408
11813
|
|
|
11409
11814
|
case 45:
|
|
11410
11815
|
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"))) {
|
|
11411
|
-
|
|
11816
|
+
_context1.next = 47;
|
|
11412
11817
|
break;
|
|
11413
11818
|
}
|
|
11414
|
-
return
|
|
11819
|
+
return _context1.abrupt("return", "".concat(SERVICE_API_KEY.Etherscan).concat(ERROR_MESSAGES_FLAG.RATE_LIMIT));
|
|
11415
11820
|
|
|
11416
11821
|
case 47:
|
|
11417
11822
|
entries = Array.isArray(json.result) ? json.result : [ json.result ];
|
|
@@ -11429,76 +11834,76 @@ function _typeof(o) {
|
|
|
11429
11834
|
} finally {
|
|
11430
11835
|
_iterator3.f();
|
|
11431
11836
|
}
|
|
11432
|
-
|
|
11837
|
+
_context1.next = 55;
|
|
11433
11838
|
break;
|
|
11434
11839
|
|
|
11435
11840
|
case 52:
|
|
11436
|
-
|
|
11437
|
-
|
|
11438
|
-
return
|
|
11841
|
+
_context1.prev = 52;
|
|
11842
|
+
_context1.t0 = _context1["catch"](34);
|
|
11843
|
+
return _context1.abrupt("return", ERROR_MESSAGES_FLAG.DEFAULT);
|
|
11439
11844
|
|
|
11440
11845
|
case 55:
|
|
11441
|
-
|
|
11846
|
+
_context1.next = 18;
|
|
11442
11847
|
break;
|
|
11443
11848
|
|
|
11444
11849
|
case 57:
|
|
11445
|
-
|
|
11850
|
+
_context1.next = 62;
|
|
11446
11851
|
break;
|
|
11447
11852
|
|
|
11448
11853
|
case 59:
|
|
11449
|
-
|
|
11450
|
-
|
|
11451
|
-
_iterator2.e(
|
|
11854
|
+
_context1.prev = 59;
|
|
11855
|
+
_context1.t1 = _context1["catch"](16);
|
|
11856
|
+
_iterator2.e(_context1.t1);
|
|
11452
11857
|
|
|
11453
11858
|
case 62:
|
|
11454
|
-
|
|
11859
|
+
_context1.prev = 62;
|
|
11455
11860
|
_iterator2.f();
|
|
11456
|
-
return
|
|
11861
|
+
return _context1.finish(62);
|
|
11457
11862
|
|
|
11458
11863
|
case 65:
|
|
11459
|
-
|
|
11864
|
+
_context1.next = 10;
|
|
11460
11865
|
break;
|
|
11461
11866
|
|
|
11462
11867
|
case 67:
|
|
11463
|
-
|
|
11868
|
+
_context1.next = 72;
|
|
11464
11869
|
break;
|
|
11465
11870
|
|
|
11466
11871
|
case 69:
|
|
11467
|
-
|
|
11468
|
-
|
|
11469
|
-
_iterator.e(
|
|
11872
|
+
_context1.prev = 69;
|
|
11873
|
+
_context1.t2 = _context1["catch"](8);
|
|
11874
|
+
_iterator.e(_context1.t2);
|
|
11470
11875
|
|
|
11471
11876
|
case 72:
|
|
11472
|
-
|
|
11877
|
+
_context1.prev = 72;
|
|
11473
11878
|
_iterator.f();
|
|
11474
|
-
return
|
|
11879
|
+
return _context1.finish(72);
|
|
11475
11880
|
|
|
11476
11881
|
case 75:
|
|
11477
|
-
return
|
|
11882
|
+
return _context1.abrupt("return", flatResults);
|
|
11478
11883
|
|
|
11479
11884
|
case 78:
|
|
11480
|
-
|
|
11481
|
-
|
|
11482
|
-
console.log(
|
|
11483
|
-
return
|
|
11885
|
+
_context1.prev = 78;
|
|
11886
|
+
_context1.t3 = _context1["catch"](0);
|
|
11887
|
+
console.log(_context1.t3);
|
|
11888
|
+
return _context1.abrupt("return", ERROR_MESSAGES_FLAG.DEFAULT);
|
|
11484
11889
|
|
|
11485
11890
|
case 82:
|
|
11486
11891
|
case "end":
|
|
11487
|
-
return
|
|
11892
|
+
return _context1.stop();
|
|
11488
11893
|
}
|
|
11489
|
-
}),
|
|
11894
|
+
}), _callee1, null, [ [ 0, 78 ], [ 8, 69, 72, 75 ], [ 16, 59, 62, 65 ], [ 34, 52 ] ]);
|
|
11490
11895
|
})));
|
|
11491
11896
|
return _EOA.apply(this, arguments);
|
|
11492
11897
|
}
|
|
11493
|
-
function FLVURL(
|
|
11898
|
+
function FLVURL(_x26, _x27) {
|
|
11494
11899
|
return _FLVURL.apply(this, arguments);
|
|
11495
11900
|
}
|
|
11496
11901
|
function _FLVURL() {
|
|
11497
|
-
_FLVURL = _asyncToGenerator(_regeneratorRuntime().mark((function
|
|
11498
|
-
return _regeneratorRuntime().wrap((function
|
|
11499
|
-
while (1) switch (
|
|
11902
|
+
_FLVURL = _asyncToGenerator(_regeneratorRuntime().mark((function _callee10(token, vs_currencies) {
|
|
11903
|
+
return _regeneratorRuntime().wrap((function _callee10$(_context10) {
|
|
11904
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
11500
11905
|
case 0:
|
|
11501
|
-
return
|
|
11906
|
+
return _context10.abrupt("return", new Promise((function(resolve) {
|
|
11502
11907
|
setTimeout((function() {
|
|
11503
11908
|
resolve([ {
|
|
11504
11909
|
Yoo: "gotcha"
|
|
@@ -11508,61 +11913,61 @@ function _typeof(o) {
|
|
|
11508
11913
|
|
|
11509
11914
|
case 1:
|
|
11510
11915
|
case "end":
|
|
11511
|
-
return
|
|
11916
|
+
return _context10.stop();
|
|
11512
11917
|
}
|
|
11513
|
-
}),
|
|
11918
|
+
}), _callee10);
|
|
11514
11919
|
})));
|
|
11515
11920
|
return _FLVURL.apply(this, arguments);
|
|
11516
11921
|
}
|
|
11517
|
-
function SAFE(
|
|
11922
|
+
function SAFE(_x28, _x29, _x30, _x31, _x32) {
|
|
11518
11923
|
return _SAFE.apply(this, arguments);
|
|
11519
11924
|
}
|
|
11520
11925
|
function _SAFE() {
|
|
11521
|
-
_SAFE = _asyncToGenerator(_regeneratorRuntime().mark((function
|
|
11926
|
+
_SAFE = _asyncToGenerator(_regeneratorRuntime().mark((function _callee11(address, utility, chain, limit, offset) {
|
|
11522
11927
|
var apiKey, chainIdentifier, url, response, json;
|
|
11523
|
-
return _regeneratorRuntime().wrap((function
|
|
11524
|
-
while (1) switch (
|
|
11928
|
+
return _regeneratorRuntime().wrap((function _callee11$(_context11) {
|
|
11929
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
11525
11930
|
case 0:
|
|
11526
11931
|
if (!(typeof limit !== "number" || limit < 0)) {
|
|
11527
|
-
|
|
11932
|
+
_context11.next = 2;
|
|
11528
11933
|
break;
|
|
11529
11934
|
}
|
|
11530
|
-
return
|
|
11935
|
+
return _context11.abrupt("return", "INVALID_LIMIT");
|
|
11531
11936
|
|
|
11532
11937
|
case 2:
|
|
11533
11938
|
if (!(typeof offset !== "number" || offset < 0)) {
|
|
11534
|
-
|
|
11939
|
+
_context11.next = 4;
|
|
11535
11940
|
break;
|
|
11536
11941
|
}
|
|
11537
|
-
return
|
|
11942
|
+
return _context11.abrupt("return", "INVALID_OFFSET");
|
|
11538
11943
|
|
|
11539
11944
|
case 4:
|
|
11540
11945
|
if (!(utility !== "txns")) {
|
|
11541
|
-
|
|
11946
|
+
_context11.next = 6;
|
|
11542
11947
|
break;
|
|
11543
11948
|
}
|
|
11544
|
-
return
|
|
11949
|
+
return _context11.abrupt("return", "UTILITY IS NOT SUPPORTED");
|
|
11545
11950
|
|
|
11546
11951
|
case 6:
|
|
11547
11952
|
apiKey = window.localStorage.getItem(SERVICE_API_KEY.Safe);
|
|
11548
11953
|
chainIdentifier = SAFE_CHAIN_MAP[chain];
|
|
11549
11954
|
if (apiKey) {
|
|
11550
|
-
|
|
11955
|
+
_context11.next = 10;
|
|
11551
11956
|
break;
|
|
11552
11957
|
}
|
|
11553
|
-
return
|
|
11958
|
+
return _context11.abrupt("return", "".concat(SERVICE_API_KEY.Safe, "_MISSING"));
|
|
11554
11959
|
|
|
11555
11960
|
case 10:
|
|
11556
11961
|
if (chainIdentifier) {
|
|
11557
|
-
|
|
11962
|
+
_context11.next = 12;
|
|
11558
11963
|
break;
|
|
11559
11964
|
}
|
|
11560
|
-
return
|
|
11965
|
+
return _context11.abrupt("return", "CHAIN IS NOT SUPPORTED");
|
|
11561
11966
|
|
|
11562
11967
|
case 12:
|
|
11563
11968
|
url = "https://api.safe.global/tx-service/".concat(chainIdentifier, "/api/v2/safes/").concat(address, "/multisig-transactions?limit=").concat(limit, "&offset=").concat(offset);
|
|
11564
|
-
|
|
11565
|
-
|
|
11969
|
+
_context11.prev = 13;
|
|
11970
|
+
_context11.next = 16;
|
|
11566
11971
|
return fetch(url, {
|
|
11567
11972
|
headers: {
|
|
11568
11973
|
Authorization: "Bearer ".concat(apiKey)
|
|
@@ -11570,42 +11975,42 @@ function _typeof(o) {
|
|
|
11570
11975
|
});
|
|
11571
11976
|
|
|
11572
11977
|
case 16:
|
|
11573
|
-
response =
|
|
11978
|
+
response = _context11.sent;
|
|
11574
11979
|
if (response.ok) {
|
|
11575
|
-
|
|
11980
|
+
_context11.next = 19;
|
|
11576
11981
|
break;
|
|
11577
11982
|
}
|
|
11578
11983
|
throw new Error("HTTP error! Status: ".concat(response.status));
|
|
11579
11984
|
|
|
11580
11985
|
case 19:
|
|
11581
|
-
|
|
11986
|
+
_context11.next = 21;
|
|
11582
11987
|
return response.json();
|
|
11583
11988
|
|
|
11584
11989
|
case 21:
|
|
11585
|
-
json =
|
|
11990
|
+
json = _context11.sent;
|
|
11586
11991
|
if (Array.isArray(json.results)) {
|
|
11587
|
-
|
|
11992
|
+
_context11.next = 24;
|
|
11588
11993
|
break;
|
|
11589
11994
|
}
|
|
11590
|
-
return
|
|
11995
|
+
return _context11.abrupt("return", "INVALID API RESPONSE");
|
|
11591
11996
|
|
|
11592
11997
|
case 24:
|
|
11593
|
-
return
|
|
11594
|
-
var confirmations =
|
|
11998
|
+
return _context11.abrupt("return", json.results.map((function(_ref5) {
|
|
11999
|
+
var confirmations = _ref5.confirmations, dataDecoded = _ref5.dataDecoded, rest = _objectWithoutProperties(_ref5, _excluded);
|
|
11595
12000
|
return rest;
|
|
11596
12001
|
})));
|
|
11597
12002
|
|
|
11598
12003
|
case 27:
|
|
11599
|
-
|
|
11600
|
-
|
|
11601
|
-
console.log(
|
|
11602
|
-
return
|
|
12004
|
+
_context11.prev = 27;
|
|
12005
|
+
_context11.t0 = _context11["catch"](13);
|
|
12006
|
+
console.log(_context11.t0);
|
|
12007
|
+
return _context11.abrupt("return", "ERROR IN FETCHING");
|
|
11603
12008
|
|
|
11604
12009
|
case 31:
|
|
11605
12010
|
case "end":
|
|
11606
|
-
return
|
|
12011
|
+
return _context11.stop();
|
|
11607
12012
|
}
|
|
11608
|
-
}),
|
|
12013
|
+
}), _callee11, null, [ [ 13, 27 ] ]);
|
|
11609
12014
|
})));
|
|
11610
12015
|
return _SAFE.apply(this, arguments);
|
|
11611
12016
|
}
|
|
@@ -11634,6 +12039,7 @@ function _typeof(o) {
|
|
|
11634
12039
|
exports.AVERAGEIF = AVERAGEIF;
|
|
11635
12040
|
exports.AVERAGEIFS = AVERAGEIFS;
|
|
11636
12041
|
exports.BASE = BASE;
|
|
12042
|
+
exports.BASESCAN = BASESCAN;
|
|
11637
12043
|
exports.BESSELI = BESSELI;
|
|
11638
12044
|
exports.BESSELJ = BESSELJ;
|
|
11639
12045
|
exports.BESSELK = BESSELK;
|
|
@@ -11750,6 +12156,7 @@ function _typeof(o) {
|
|
|
11750
12156
|
exports.FIND = FIND;
|
|
11751
12157
|
exports.FINV = FINV;
|
|
11752
12158
|
exports.FINVRT = FINVRT;
|
|
12159
|
+
exports.FIREFLY = FIREFLY;
|
|
11753
12160
|
exports.FISHER = FISHER;
|
|
11754
12161
|
exports.FISHERINV = FISHERINV;
|
|
11755
12162
|
exports.FIXED = FIXED;
|
|
@@ -11771,6 +12178,8 @@ function _typeof(o) {
|
|
|
11771
12178
|
exports.GCD = GCD;
|
|
11772
12179
|
exports.GEOMEAN = GEOMEAN;
|
|
11773
12180
|
exports.GESTEP = GESTEP;
|
|
12181
|
+
exports.GNOSIS = GNOSIS;
|
|
12182
|
+
exports.GNOSISSCAN = GNOSISSCAN;
|
|
11774
12183
|
exports.GROWTH = GROWTH;
|
|
11775
12184
|
exports.HARMEAN = HARMEAN;
|
|
11776
12185
|
exports.HEX2BIN = HEX2BIN;
|
|
@@ -11871,6 +12280,7 @@ function _typeof(o) {
|
|
|
11871
12280
|
exports.NETWORKDAYS = NETWORKDAYS;
|
|
11872
12281
|
exports.NETWORKDAYSINTL = NETWORKDAYSINTL;
|
|
11873
12282
|
exports.NETWORKDAYS_INTL = NETWORKDAYS_INTL;
|
|
12283
|
+
exports.NEYNAR = NEYNAR;
|
|
11874
12284
|
exports.NOMINAL = NOMINAL;
|
|
11875
12285
|
exports.NORM = NORM;
|
|
11876
12286
|
exports.NORMDIST = NORMDIST;
|