@fileverse-dev/formulajs 4.4.11-mod-64-patch-2 → 4.4.11-mod-66
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 +810 -1104
- package/lib/browser/formula.min.js +2 -2
- package/lib/browser/formula.min.js.map +1 -1
- package/lib/cjs/index.cjs +255 -531
- package/lib/esm/crypto-constants.mjs +51 -41
- package/lib/esm/index.mjs +254 -532
- package/package.json +3 -5
- package/types/cjs/index.d.cts +23 -12
- package/types/esm/index.d.mts +23 -12
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-66 */
|
|
2
2
|
var _excluded = [ "confirmations", "dataDecoded" ];
|
|
3
3
|
|
|
4
4
|
function _objectWithoutProperties(e, t) {
|
|
@@ -7656,6 +7656,21 @@ function _typeof(o) {
|
|
|
7656
7656
|
}));
|
|
7657
7657
|
return result;
|
|
7658
7658
|
}
|
|
7659
|
+
function MINUS$1() {
|
|
7660
|
+
var args = argsToArray(arguments);
|
|
7661
|
+
if (args.length !== 2) {
|
|
7662
|
+
return value;
|
|
7663
|
+
}
|
|
7664
|
+
var num1 = args[0];
|
|
7665
|
+
var num2 = args[1];
|
|
7666
|
+
if (num1 instanceof Error || num2 instanceof Error) {
|
|
7667
|
+
return num1 instanceof Error ? num1 : num2;
|
|
7668
|
+
}
|
|
7669
|
+
if (typeof num1 !== "number" || typeof num2 !== "number") {
|
|
7670
|
+
return value;
|
|
7671
|
+
}
|
|
7672
|
+
return num1 - num2;
|
|
7673
|
+
}
|
|
7659
7674
|
function SUMIF(range, criteria, sum_range) {
|
|
7660
7675
|
range = flatten(range);
|
|
7661
7676
|
sum_range = sum_range ? flatten(sum_range) : range;
|
|
@@ -10924,34 +10939,30 @@ function _typeof(o) {
|
|
|
10924
10939
|
gnosis: "gno"
|
|
10925
10940
|
};
|
|
10926
10941
|
var ERROR_MESSAGES_FLAG = {
|
|
10927
|
-
INVALID_API_KEY: "
|
|
10928
|
-
RATE_LIMIT: "
|
|
10929
|
-
DEFAULT: "
|
|
10930
|
-
MISSING_KEY: "
|
|
10931
|
-
INVALID_CHAIN: "
|
|
10932
|
-
INVALID_TYPE: "
|
|
10933
|
-
INVALID_ADDRESS: "
|
|
10934
|
-
INVALID_PARAM: "
|
|
10935
|
-
MAX_PAGE_LIMIT: "
|
|
10936
|
-
NETWORK_ERROR: "NETWORK_ERROR",
|
|
10937
|
-
ENS: "ENS",
|
|
10938
|
-
CUSTOM: "CUSTOM",
|
|
10939
|
-
MISSING_PARAM: "MISSING_PARAM"
|
|
10942
|
+
INVALID_API_KEY: "_INVALID_KEY",
|
|
10943
|
+
RATE_LIMIT: "_RATE_LIMIT_REACHED",
|
|
10944
|
+
DEFAULT: "FETCH_ERROR",
|
|
10945
|
+
MISSING_KEY: "_MISSING",
|
|
10946
|
+
INVALID_CHAIN: "_INVALID_CHAIN",
|
|
10947
|
+
INVALID_TYPE: "_INVALID_TYPE",
|
|
10948
|
+
INVALID_ADDRESS: "_INVALID_ADDRESS",
|
|
10949
|
+
INVALID_PARAM: "_INVALID_PARAM",
|
|
10950
|
+
MAX_PAGE_LIMIT: "Max page limit is 250"
|
|
10940
10951
|
};
|
|
10941
10952
|
var UTILITY = {
|
|
10942
10953
|
ALCHEMY_API_KEY: "ALCHEMY_API_KEY"
|
|
10943
10954
|
};
|
|
10944
10955
|
var MAX_PAGE_LIMIT = 250;
|
|
10945
|
-
var
|
|
10946
|
-
Etherscan: "
|
|
10947
|
-
Coingecko: "
|
|
10948
|
-
Safe: "
|
|
10949
|
-
Basescan: "
|
|
10950
|
-
Gnosisscan: "
|
|
10951
|
-
Firefly: "
|
|
10952
|
-
GnosisPay: "
|
|
10953
|
-
Neynar: "
|
|
10954
|
-
Defillama: "
|
|
10956
|
+
var SERVICE_API_KEY = {
|
|
10957
|
+
Etherscan: "ETHERSCAN_API_KEY",
|
|
10958
|
+
Coingecko: "COINGECKO_API_KEY",
|
|
10959
|
+
Safe: "SAFE_API_KEY",
|
|
10960
|
+
Basescan: "BASESCAN_API_KEY",
|
|
10961
|
+
Gnosisscan: "GNOSIS_API_KEY",
|
|
10962
|
+
Firefly: "FIRE_FLY_API_KEY",
|
|
10963
|
+
GnosisPay: "GNOSIS_API_KEY",
|
|
10964
|
+
Neynar: "NEYNAR_API_KEY",
|
|
10965
|
+
Defillama: "DEFILLAMA_API_KEY"
|
|
10955
10966
|
};
|
|
10956
10967
|
var fromTimeStampToBlock = function() {
|
|
10957
10968
|
var _ref = _asyncToGenerator(_regeneratorRuntime().mark((function _callee(timestamp, chain, apiKey) {
|
|
@@ -10990,9 +11001,6 @@ function _typeof(o) {
|
|
|
10990
11001
|
return _ref.apply(this, arguments);
|
|
10991
11002
|
};
|
|
10992
11003
|
}();
|
|
10993
|
-
var fromTimestampToBlock = {
|
|
10994
|
-
fromTimeStampToBlock: fromTimeStampToBlock
|
|
10995
|
-
};
|
|
10996
11004
|
function toTimestamp(dateStr) {
|
|
10997
11005
|
var _dateStr$split$map = dateStr.split("/").map(Number), _dateStr$split$map2 = _slicedToArray(_dateStr$split$map, 3), day = _dateStr$split$map2[0], month = _dateStr$split$map2[1], year = _dateStr$split$map2[2];
|
|
10998
11006
|
var date = new Date(year, month - 1, day);
|
|
@@ -11001,9 +11009,6 @@ function _typeof(o) {
|
|
|
11001
11009
|
var isAddress = function isAddress(input) {
|
|
11002
11010
|
return /^0x[a-fA-F0-9]{40}$/.test(input);
|
|
11003
11011
|
};
|
|
11004
|
-
var isAddress$1 = {
|
|
11005
|
-
isAddress: isAddress
|
|
11006
|
-
};
|
|
11007
11012
|
function fromEnsNameToAddress(_x4) {
|
|
11008
11013
|
return _fromEnsNameToAddress.apply(this, arguments);
|
|
11009
11014
|
}
|
|
@@ -11059,185 +11064,66 @@ function _typeof(o) {
|
|
|
11059
11064
|
})));
|
|
11060
11065
|
return _fromEnsNameToAddress.apply(this, arguments);
|
|
11061
11066
|
}
|
|
11062
|
-
var fromEnsNameToAddress$1 = {
|
|
11063
|
-
fromEnsNameToAddress: fromEnsNameToAddress
|
|
11064
|
-
};
|
|
11065
|
-
var errorMessageHandler = function errorMessageHandler(errorFlag, input, functionName) {
|
|
11066
|
-
if (!functionName) {
|
|
11067
|
-
var _Error$stack;
|
|
11068
|
-
var stack = (_Error$stack = (new Error).stack) === null || _Error$stack === void 0 ? void 0 : _Error$stack.split("\n")[2];
|
|
11069
|
-
var match = stack === null || stack === void 0 ? void 0 : stack.match(/at (\w+)/);
|
|
11070
|
-
functionName = match === null || match === void 0 ? void 0 : match[1];
|
|
11071
|
-
}
|
|
11072
|
-
switch (errorFlag) {
|
|
11073
|
-
case ERROR_MESSAGES_FLAG.INVALID_ADDRESS:
|
|
11074
|
-
return {
|
|
11075
|
-
message: "".concat(input, " is not a supported address"),
|
|
11076
|
-
functionName: functionName,
|
|
11077
|
-
type: errorFlag
|
|
11078
|
-
};
|
|
11079
|
-
|
|
11080
|
-
case ERROR_MESSAGES_FLAG.INVALID_PARAM:
|
|
11081
|
-
{
|
|
11082
|
-
var key = Object.keys(input)[0];
|
|
11083
|
-
var _value5 = input[key];
|
|
11084
|
-
return {
|
|
11085
|
-
message: "".concat(_value5, " is an invalid value for ").concat(key),
|
|
11086
|
-
functionName: functionName,
|
|
11087
|
-
type: errorFlag
|
|
11088
|
-
};
|
|
11089
|
-
}
|
|
11090
|
-
|
|
11091
|
-
case ERROR_MESSAGES_FLAG.INVALID_CHAIN:
|
|
11092
|
-
return {
|
|
11093
|
-
message: "".concat(input, " is not a supported chain for this function "),
|
|
11094
|
-
functionName: functionName,
|
|
11095
|
-
type: errorFlag
|
|
11096
|
-
};
|
|
11097
|
-
|
|
11098
|
-
case ERROR_MESSAGES_FLAG.RATE_LIMIT:
|
|
11099
|
-
return {
|
|
11100
|
-
message: "Rate limit for ".concat(input || functionName || "this api", " has been reached"),
|
|
11101
|
-
functionName: functionName,
|
|
11102
|
-
type: errorFlag
|
|
11103
|
-
};
|
|
11104
|
-
|
|
11105
|
-
case ERROR_MESSAGES_FLAG.MISSING_KEY:
|
|
11106
|
-
return {
|
|
11107
|
-
message: "Api key for ".concat(input || functionName || "this api", " is missing"),
|
|
11108
|
-
functionName: functionName,
|
|
11109
|
-
type: errorFlag
|
|
11110
|
-
};
|
|
11111
|
-
|
|
11112
|
-
case ERROR_MESSAGES_FLAG.NETWORK_ERROR:
|
|
11113
|
-
if (input === 429) {
|
|
11114
|
-
return {
|
|
11115
|
-
message: "Rate limit for ".concat(functionName || "this function", " has been reached"),
|
|
11116
|
-
functionName: functionName,
|
|
11117
|
-
type: ERROR_MESSAGES_FLAG.RATE_LIMIT
|
|
11118
|
-
};
|
|
11119
|
-
}
|
|
11120
|
-
return {
|
|
11121
|
-
message: "Api failed with status code ".concat(input),
|
|
11122
|
-
functionName: functionName,
|
|
11123
|
-
type: errorFlag
|
|
11124
|
-
};
|
|
11125
|
-
|
|
11126
|
-
case ERROR_MESSAGES_FLAG.MISSING_PARAM:
|
|
11127
|
-
return {
|
|
11128
|
-
message: "Missing param: ".concat(input),
|
|
11129
|
-
functionName: functionName,
|
|
11130
|
-
type: errorFlag
|
|
11131
|
-
};
|
|
11132
|
-
|
|
11133
|
-
case ERROR_MESSAGES_FLAG.ENS:
|
|
11134
|
-
return {
|
|
11135
|
-
message: "".concat(input, " is not a supported ens name"),
|
|
11136
|
-
functionName: functionName,
|
|
11137
|
-
type: errorFlag
|
|
11138
|
-
};
|
|
11139
|
-
|
|
11140
|
-
case ERROR_MESSAGES_FLAG.CUSTOM:
|
|
11141
|
-
return {
|
|
11142
|
-
message: input.message,
|
|
11143
|
-
functionName: functionName,
|
|
11144
|
-
type: errorFlag,
|
|
11145
|
-
reason: input.reason || input.message
|
|
11146
|
-
};
|
|
11147
|
-
|
|
11148
|
-
case ERROR_MESSAGES_FLAG.MAX_PAGE_LIMIT:
|
|
11149
|
-
return {
|
|
11150
|
-
message: "Max page limit is ".concat(MAX_PAGE_LIMIT),
|
|
11151
|
-
functionName: functionName,
|
|
11152
|
-
type: errorFlag
|
|
11153
|
-
};
|
|
11154
|
-
|
|
11155
|
-
case ERROR_MESSAGES_FLAG.INVALID_API_KEY:
|
|
11156
|
-
return {
|
|
11157
|
-
message: "".concat(input, ": Invalid API key"),
|
|
11158
|
-
functionName: functionName,
|
|
11159
|
-
type: errorFlag
|
|
11160
|
-
};
|
|
11161
|
-
|
|
11162
|
-
default:
|
|
11163
|
-
return {
|
|
11164
|
-
message: "An unexpected error occured",
|
|
11165
|
-
functionName: functionName,
|
|
11166
|
-
type: errorFlag,
|
|
11167
|
-
reason: input
|
|
11168
|
-
};
|
|
11169
|
-
}
|
|
11170
|
-
};
|
|
11171
|
-
var checkRequiredParams = function checkRequiredParams(inputMap) {
|
|
11172
|
-
for (var key in inputMap) {
|
|
11173
|
-
if (!inputMap[key]) {
|
|
11174
|
-
var _Error$stack2;
|
|
11175
|
-
var stack = (_Error$stack2 = (new Error).stack) === null || _Error$stack2 === void 0 ? void 0 : _Error$stack2.split("\n")[2];
|
|
11176
|
-
console.log("STACK LINE:", stack);
|
|
11177
|
-
var match = stack === null || stack === void 0 ? void 0 : stack.match(/at (.+?) \(/);
|
|
11178
|
-
var rawFnName = match === null || match === void 0 ? void 0 : match[1];
|
|
11179
|
-
var parentFunctionName = (rawFnName === null || rawFnName === void 0 ? void 0 : rawFnName.split(".").pop()) || "anonymous";
|
|
11180
|
-
var paramName = key;
|
|
11181
|
-
return errorMessageHandler(ERROR_MESSAGES_FLAG.MISSING_PARAM, paramName, parentFunctionName);
|
|
11182
|
-
}
|
|
11183
|
-
}
|
|
11184
|
-
};
|
|
11185
11067
|
function handleScanRequest(_x5) {
|
|
11186
11068
|
return _handleScanRequest.apply(this, arguments);
|
|
11187
11069
|
}
|
|
11188
11070
|
function _handleScanRequest() {
|
|
11189
11071
|
_handleScanRequest = _asyncToGenerator(_regeneratorRuntime().mark((function _callee4(_ref2) {
|
|
11190
|
-
var type, address, startDate, endDate, _ref2$page, page, _ref2$offset, offset,
|
|
11072
|
+
var scanKey, baseUrl, type, chain, address, startDate, endDate, _ref2$page, page, _ref2$offset, offset, API_KEY, chainId, ACTION_MAP, action, url, _yield$Promise$all, _yield$Promise$all2, startBlock, endBlock, res, json;
|
|
11191
11073
|
return _regeneratorRuntime().wrap((function _callee4$(_context4) {
|
|
11192
11074
|
while (1) switch (_context4.prev = _context4.next) {
|
|
11193
11075
|
case 0:
|
|
11194
|
-
|
|
11195
|
-
|
|
11196
|
-
|
|
11197
|
-
|
|
11198
|
-
|
|
11199
|
-
|
|
11200
|
-
|
|
11201
|
-
|
|
11202
|
-
|
|
11203
|
-
|
|
11204
|
-
|
|
11205
|
-
|
|
11206
|
-
|
|
11207
|
-
GNOSIS: {
|
|
11208
|
-
url: "https://api.gnosisscan.io/api",
|
|
11209
|
-
apiKeyName: SERVICES_API_KEY.Gnosisscan
|
|
11210
|
-
}
|
|
11211
|
-
};
|
|
11212
|
-
if (isAddress$1.isAddress(address)) {
|
|
11213
|
-
_context4.next = 9;
|
|
11076
|
+
scanKey = _ref2.scanKey, baseUrl = _ref2.baseUrl, type = _ref2.type, chain = _ref2.chain,
|
|
11077
|
+
address = _ref2.address, startDate = _ref2.startDate, endDate = _ref2.endDate, _ref2$page = _ref2.page,
|
|
11078
|
+
page = _ref2$page === void 0 ? 1 : _ref2$page, _ref2$offset = _ref2.offset, offset = _ref2$offset === void 0 ? 10 : _ref2$offset;
|
|
11079
|
+
API_KEY = window.localStorage.getItem(scanKey);
|
|
11080
|
+
if (API_KEY) {
|
|
11081
|
+
_context4.next = 4;
|
|
11082
|
+
break;
|
|
11083
|
+
}
|
|
11084
|
+
return _context4.abrupt("return", "".concat(scanKey).concat(ERROR_MESSAGES_FLAG.MISSING_KEY));
|
|
11085
|
+
|
|
11086
|
+
case 4:
|
|
11087
|
+
if (!(API_KEY === "xxxx")) {
|
|
11088
|
+
_context4.next = 6;
|
|
11214
11089
|
break;
|
|
11215
11090
|
}
|
|
11216
|
-
|
|
11217
|
-
_context4.next = 6;
|
|
11218
|
-
return fromEnsNameToAddress$1.fromEnsNameToAddress(address);
|
|
11091
|
+
return _context4.abrupt("return", "".concat(scanKey).concat(ERROR_MESSAGES_FLAG.RATE_LIMIT));
|
|
11219
11092
|
|
|
11220
11093
|
case 6:
|
|
11221
|
-
|
|
11222
|
-
|
|
11223
|
-
_context4.next = 9;
|
|
11094
|
+
if (!(offset > MAX_PAGE_LIMIT)) {
|
|
11095
|
+
_context4.next = 8;
|
|
11224
11096
|
break;
|
|
11225
11097
|
}
|
|
11226
|
-
return _context4.abrupt("return",
|
|
11098
|
+
return _context4.abrupt("return", ERROR_MESSAGES_FLAG.MAX_PAGE_LIMIT);
|
|
11227
11099
|
|
|
11228
|
-
case
|
|
11229
|
-
|
|
11230
|
-
|
|
11231
|
-
|
|
11232
|
-
_context4.next = 13;
|
|
11100
|
+
case 8:
|
|
11101
|
+
chainId = CHAIN_ID_MAP[chain === null || chain === void 0 ? void 0 : chain.toLowerCase()];
|
|
11102
|
+
if (chainId) {
|
|
11103
|
+
_context4.next = 11;
|
|
11233
11104
|
break;
|
|
11234
11105
|
}
|
|
11235
|
-
return _context4.abrupt("return",
|
|
11236
|
-
message: "Api not found",
|
|
11237
|
-
reason: " Api not found for: ".concat(functionName)
|
|
11238
|
-
}, functionName));
|
|
11106
|
+
return _context4.abrupt("return", "".concat(scanKey).concat(ERROR_MESSAGES_FLAG.INVALID_CHAIN));
|
|
11239
11107
|
|
|
11240
|
-
case
|
|
11108
|
+
case 11:
|
|
11109
|
+
if (isAddress(address)) {
|
|
11110
|
+
_context4.next = 15;
|
|
11111
|
+
break;
|
|
11112
|
+
}
|
|
11113
|
+
_context4.next = 14;
|
|
11114
|
+
return fromEnsNameToAddress(address);
|
|
11115
|
+
|
|
11116
|
+
case 14:
|
|
11117
|
+
address = _context4.sent;
|
|
11118
|
+
|
|
11119
|
+
case 15:
|
|
11120
|
+
if (address) {
|
|
11121
|
+
_context4.next = 17;
|
|
11122
|
+
break;
|
|
11123
|
+
}
|
|
11124
|
+
return _context4.abrupt("return", "".concat(address).concat(ERROR_MESSAGES_FLAG.INVALID_PARAM));
|
|
11125
|
+
|
|
11126
|
+
case 17:
|
|
11241
11127
|
ACTION_MAP = {
|
|
11242
11128
|
"all-txns": "txlist",
|
|
11243
11129
|
"token-txns": "tokentx",
|
|
@@ -11246,86 +11132,94 @@ function _typeof(o) {
|
|
|
11246
11132
|
};
|
|
11247
11133
|
action = ACTION_MAP[type];
|
|
11248
11134
|
if (action) {
|
|
11249
|
-
_context4.next =
|
|
11135
|
+
_context4.next = 21;
|
|
11250
11136
|
break;
|
|
11251
11137
|
}
|
|
11252
|
-
return _context4.abrupt("return",
|
|
11253
|
-
type: type
|
|
11254
|
-
}, functionName));
|
|
11138
|
+
return _context4.abrupt("return", "".concat(scanKey).concat(ERROR_MESSAGES_FLAG.INVALID_TYPE));
|
|
11255
11139
|
|
|
11256
|
-
case
|
|
11257
|
-
|
|
11140
|
+
case 21:
|
|
11141
|
+
if (scanKey === SERVICE_API_KEY.Basescan) chainId = "base";
|
|
11142
|
+
if (scanKey === SERVICE_API_KEY.Gnosisscan) chainId = "gnosis";
|
|
11143
|
+
url = "".concat(baseUrl, "?chainid=").concat(chainId, "&module=account&action=").concat(action, "&apikey=").concat(API_KEY);
|
|
11258
11144
|
if (![ "all-txns", "token-txns", "nft-txns" ].includes(type)) {
|
|
11259
|
-
_context4.next =
|
|
11145
|
+
_context4.next = 37;
|
|
11146
|
+
break;
|
|
11147
|
+
}
|
|
11148
|
+
if (address) {
|
|
11149
|
+
_context4.next = 27;
|
|
11260
11150
|
break;
|
|
11261
11151
|
}
|
|
11152
|
+
return _context4.abrupt("return", "".concat(scanKey).concat(ERROR_MESSAGES_FLAG.INVALID_ADDRESS));
|
|
11153
|
+
|
|
11154
|
+
case 27:
|
|
11262
11155
|
url += "&address=".concat(address, "&startblock=0&endblock=99999999&sort=asc");
|
|
11263
11156
|
if (!(!isNaN(startDate) && !isNaN(endDate))) {
|
|
11264
|
-
_context4.next =
|
|
11157
|
+
_context4.next = 36;
|
|
11265
11158
|
break;
|
|
11266
11159
|
}
|
|
11267
|
-
_context4.next =
|
|
11268
|
-
return Promise.all([
|
|
11160
|
+
_context4.next = 31;
|
|
11161
|
+
return Promise.all([ fromTimeStampToBlock(toTimestamp(startDate), chain, API_KEY), fromTimeStampToBlock(toTimestamp(endDate), chain, API_KEY) ]);
|
|
11269
11162
|
|
|
11270
|
-
case
|
|
11163
|
+
case 31:
|
|
11271
11164
|
_yield$Promise$all = _context4.sent;
|
|
11272
11165
|
_yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 2);
|
|
11273
11166
|
startBlock = _yield$Promise$all2[0];
|
|
11274
11167
|
endBlock = _yield$Promise$all2[1];
|
|
11275
|
-
url += "&startblock=".concat(startBlock
|
|
11168
|
+
url += "&startblock=".concat(startBlock, "&endblock=").concat(endBlock);
|
|
11276
11169
|
|
|
11277
|
-
case
|
|
11170
|
+
case 36:
|
|
11278
11171
|
url += "&page=".concat(page, "&offset=").concat(offset);
|
|
11279
11172
|
|
|
11280
|
-
case
|
|
11281
|
-
_context4.prev =
|
|
11282
|
-
_context4.next =
|
|
11173
|
+
case 37:
|
|
11174
|
+
_context4.prev = 37;
|
|
11175
|
+
_context4.next = 40;
|
|
11283
11176
|
return fetch(url);
|
|
11284
11177
|
|
|
11285
|
-
case
|
|
11178
|
+
case 40:
|
|
11286
11179
|
res = _context4.sent;
|
|
11287
11180
|
if (res.ok) {
|
|
11288
|
-
_context4.next =
|
|
11181
|
+
_context4.next = 43;
|
|
11289
11182
|
break;
|
|
11290
11183
|
}
|
|
11291
|
-
|
|
11184
|
+
throw new Error("HTTP error: ".concat(res.status));
|
|
11292
11185
|
|
|
11293
|
-
case
|
|
11294
|
-
_context4.next =
|
|
11186
|
+
case 43:
|
|
11187
|
+
_context4.next = 45;
|
|
11295
11188
|
return res.json();
|
|
11296
11189
|
|
|
11297
|
-
case
|
|
11190
|
+
case 45:
|
|
11298
11191
|
json = _context4.sent;
|
|
11299
11192
|
if (!(typeof json.result === "string")) {
|
|
11300
|
-
_context4.next =
|
|
11193
|
+
_context4.next = 51;
|
|
11301
11194
|
break;
|
|
11302
11195
|
}
|
|
11303
11196
|
if (!json.result.includes("Invalid API Key")) {
|
|
11304
|
-
_context4.next =
|
|
11197
|
+
_context4.next = 49;
|
|
11305
11198
|
break;
|
|
11306
11199
|
}
|
|
11307
|
-
return _context4.abrupt("return",
|
|
11200
|
+
return _context4.abrupt("return", "".concat(scanKey).concat(ERROR_MESSAGES_FLAG.INVALID_API_KEY));
|
|
11308
11201
|
|
|
11309
|
-
case
|
|
11202
|
+
case 49:
|
|
11310
11203
|
if (!json.result.includes("Max rate limit reached")) {
|
|
11311
|
-
_context4.next =
|
|
11204
|
+
_context4.next = 51;
|
|
11312
11205
|
break;
|
|
11313
11206
|
}
|
|
11314
|
-
return _context4.abrupt("return",
|
|
11207
|
+
return _context4.abrupt("return", "".concat(scanKey).concat(ERROR_MESSAGES_FLAG.RATE_LIMIT));
|
|
11315
11208
|
|
|
11316
|
-
case
|
|
11209
|
+
case 51:
|
|
11317
11210
|
return _context4.abrupt("return", json.result);
|
|
11318
11211
|
|
|
11319
|
-
case
|
|
11320
|
-
_context4.prev =
|
|
11321
|
-
_context4.t0 = _context4["catch"](
|
|
11322
|
-
|
|
11212
|
+
case 54:
|
|
11213
|
+
_context4.prev = 54;
|
|
11214
|
+
_context4.t0 = _context4["catch"](37);
|
|
11215
|
+
console.error("[".concat(scanKey, "]"), _context4.t0);
|
|
11216
|
+
return _context4.abrupt("return", ERROR_MESSAGES_FLAG.DEFAULT);
|
|
11323
11217
|
|
|
11324
|
-
case
|
|
11218
|
+
case 58:
|
|
11325
11219
|
case "end":
|
|
11326
11220
|
return _context4.stop();
|
|
11327
11221
|
}
|
|
11328
|
-
}), _callee4, null, [ [
|
|
11222
|
+
}), _callee4, null, [ [ 37, 54 ] ]);
|
|
11329
11223
|
})));
|
|
11330
11224
|
return _handleScanRequest.apply(this, arguments);
|
|
11331
11225
|
}
|
|
@@ -11374,16 +11268,13 @@ function _typeof(o) {
|
|
|
11374
11268
|
return _ref3.apply(this, arguments);
|
|
11375
11269
|
};
|
|
11376
11270
|
}();
|
|
11377
|
-
var fromUsernameToFid$1 = {
|
|
11378
|
-
fromUsernameToFid: fromUsernameToFid
|
|
11379
|
-
};
|
|
11380
11271
|
var removeNestedStructure = function removeNestedStructure(json) {
|
|
11381
11272
|
return json.map((function(item) {
|
|
11382
11273
|
var flat = {};
|
|
11383
11274
|
for (var _i10 = 0, _Object$entries = Object.entries(item); _i10 < _Object$entries.length; _i10++) {
|
|
11384
|
-
var _Object$entries$_i = _slicedToArray(_Object$entries[_i10], 2), key = _Object$entries$_i[0],
|
|
11385
|
-
if (_typeof(
|
|
11386
|
-
flat[key] =
|
|
11275
|
+
var _Object$entries$_i = _slicedToArray(_Object$entries[_i10], 2), key = _Object$entries$_i[0], _value5 = _Object$entries$_i[1];
|
|
11276
|
+
if (_typeof(_value5) !== "object" || _value5 === null) {
|
|
11277
|
+
flat[key] = _value5;
|
|
11387
11278
|
}
|
|
11388
11279
|
}
|
|
11389
11280
|
return flat;
|
|
@@ -11394,7 +11285,8 @@ function _typeof(o) {
|
|
|
11394
11285
|
}
|
|
11395
11286
|
function _FIREFLY() {
|
|
11396
11287
|
_FIREFLY = _asyncToGenerator(_regeneratorRuntime().mark((function _callee5() {
|
|
11397
|
-
var
|
|
11288
|
+
var _typeMap$platform;
|
|
11289
|
+
var _argsToArray3, _argsToArray4, platform, contentType, identifier, _argsToArray4$, start, _argsToArray4$2, end, API_KEY, baseUrl, headers, typeMap, platformType, query, url, res, json, _args5 = arguments;
|
|
11398
11290
|
return _regeneratorRuntime().wrap((function _callee5$(_context5) {
|
|
11399
11291
|
while (1) switch (_context5.prev = _context5.next) {
|
|
11400
11292
|
case 0:
|
|
@@ -11402,33 +11294,21 @@ function _typeof(o) {
|
|
|
11402
11294
|
platform = _argsToArray4[0], contentType = _argsToArray4[1], identifier = _argsToArray4[2],
|
|
11403
11295
|
_argsToArray4$ = _argsToArray4[3], start = _argsToArray4$ === void 0 ? 0 : _argsToArray4$,
|
|
11404
11296
|
_argsToArray4$2 = _argsToArray4[4], end = _argsToArray4$2 === void 0 ? 10 : _argsToArray4$2;
|
|
11405
|
-
missingParamsError = checkRequiredParams({
|
|
11406
|
-
platform: platform,
|
|
11407
|
-
contentType: contentType,
|
|
11408
|
-
identifier: identifier
|
|
11409
|
-
});
|
|
11410
|
-
if (!missingParamsError) {
|
|
11411
|
-
_context5.next = 4;
|
|
11412
|
-
break;
|
|
11413
|
-
}
|
|
11414
|
-
return _context5.abrupt("return", missingParamsError);
|
|
11415
|
-
|
|
11416
|
-
case 4:
|
|
11417
11297
|
if (!(end > MAX_PAGE_LIMIT)) {
|
|
11418
|
-
_context5.next =
|
|
11298
|
+
_context5.next = 3;
|
|
11419
11299
|
break;
|
|
11420
11300
|
}
|
|
11421
|
-
return _context5.abrupt("return",
|
|
11301
|
+
return _context5.abrupt("return", ERROR_MESSAGES_FLAG.MAX_PAGE_LIMIT);
|
|
11422
11302
|
|
|
11423
|
-
case
|
|
11424
|
-
API_KEY = window.localStorage.getItem(
|
|
11303
|
+
case 3:
|
|
11304
|
+
API_KEY = window.localStorage.getItem(SERVICE_API_KEY.Firefly);
|
|
11425
11305
|
if (API_KEY) {
|
|
11426
|
-
_context5.next =
|
|
11306
|
+
_context5.next = 6;
|
|
11427
11307
|
break;
|
|
11428
11308
|
}
|
|
11429
|
-
return _context5.abrupt("return",
|
|
11309
|
+
return _context5.abrupt("return", "".concat(SERVICE_API_KEY.Firefly).concat(ERROR_MESSAGES_FLAG.MISSING_KEY));
|
|
11430
11310
|
|
|
11431
|
-
case
|
|
11311
|
+
case 6:
|
|
11432
11312
|
baseUrl = "https://openapi.firefly.land/v1/fileverse/fetch";
|
|
11433
11313
|
headers = {
|
|
11434
11314
|
"x-api-key": API_KEY
|
|
@@ -11444,26 +11324,14 @@ function _typeof(o) {
|
|
|
11444
11324
|
replies: "lenspostid"
|
|
11445
11325
|
}
|
|
11446
11326
|
};
|
|
11447
|
-
platformType = typeMap[platform];
|
|
11327
|
+
platformType = (_typeMap$platform = typeMap[platform]) === null || _typeMap$platform === void 0 ? void 0 : _typeMap$platform[contentType];
|
|
11448
11328
|
if (platformType) {
|
|
11449
|
-
_context5.next =
|
|
11450
|
-
break;
|
|
11451
|
-
}
|
|
11452
|
-
return _context5.abrupt("return", errorMessageHandler(ERROR_MESSAGES_FLAG.INVALID_PARAM, {
|
|
11453
|
-
platform: platform
|
|
11454
|
-
}));
|
|
11455
|
-
|
|
11456
|
-
case 15:
|
|
11457
|
-
platformContentType = platformType[contentType];
|
|
11458
|
-
if (platformContentType) {
|
|
11459
|
-
_context5.next = 18;
|
|
11329
|
+
_context5.next = 12;
|
|
11460
11330
|
break;
|
|
11461
11331
|
}
|
|
11462
|
-
return _context5.abrupt("return",
|
|
11463
|
-
contentType: contentType
|
|
11464
|
-
}));
|
|
11332
|
+
return _context5.abrupt("return", "".concat(SERVICE_API_KEY.Firefly).concat(ERROR_MESSAGES_FLAG.INVALID_TYPE));
|
|
11465
11333
|
|
|
11466
|
-
case
|
|
11334
|
+
case 12:
|
|
11467
11335
|
query = identifier.split(",").map((function(s) {
|
|
11468
11336
|
return s.trim();
|
|
11469
11337
|
})).filter(Boolean).join(",");
|
|
@@ -11472,55 +11340,56 @@ function _typeof(o) {
|
|
|
11472
11340
|
url.searchParams.set("type", platformType);
|
|
11473
11341
|
url.searchParams.set("start", String(start));
|
|
11474
11342
|
url.searchParams.set("end", String(end));
|
|
11475
|
-
_context5.prev =
|
|
11476
|
-
_context5.next =
|
|
11343
|
+
_context5.prev = 18;
|
|
11344
|
+
_context5.next = 21;
|
|
11477
11345
|
return fetch(url.toString(), {
|
|
11478
11346
|
headers: headers
|
|
11479
11347
|
});
|
|
11480
11348
|
|
|
11481
|
-
case
|
|
11349
|
+
case 21:
|
|
11482
11350
|
res = _context5.sent;
|
|
11483
11351
|
if (res.ok) {
|
|
11484
|
-
_context5.next =
|
|
11352
|
+
_context5.next = 24;
|
|
11485
11353
|
break;
|
|
11486
11354
|
}
|
|
11487
|
-
|
|
11355
|
+
throw new Error("HTTP ".concat(res.status));
|
|
11488
11356
|
|
|
11489
|
-
case
|
|
11490
|
-
_context5.next =
|
|
11357
|
+
case 24:
|
|
11358
|
+
_context5.next = 26;
|
|
11491
11359
|
return res.json();
|
|
11492
11360
|
|
|
11493
|
-
case
|
|
11361
|
+
case 26:
|
|
11494
11362
|
json = _context5.sent;
|
|
11495
11363
|
if (Array.isArray(json === null || json === void 0 ? void 0 : json.data)) {
|
|
11496
|
-
_context5.next =
|
|
11364
|
+
_context5.next = 29;
|
|
11497
11365
|
break;
|
|
11498
11366
|
}
|
|
11499
11367
|
return _context5.abrupt("return", []);
|
|
11500
11368
|
|
|
11501
|
-
case
|
|
11369
|
+
case 29:
|
|
11502
11370
|
return _context5.abrupt("return", json.data.map((function(item) {
|
|
11503
11371
|
var flat = {};
|
|
11504
11372
|
for (var _i11 = 0, _Object$entries2 = Object.entries(item); _i11 < _Object$entries2.length; _i11++) {
|
|
11505
|
-
var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i11], 2), key = _Object$entries2$_i[0],
|
|
11506
|
-
if (_typeof(
|
|
11507
|
-
flat[key] =
|
|
11373
|
+
var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i11], 2), key = _Object$entries2$_i[0], _value6 = _Object$entries2$_i[1];
|
|
11374
|
+
if (_typeof(_value6) !== "object" || _value6 === null) {
|
|
11375
|
+
flat[key] = _value6;
|
|
11508
11376
|
}
|
|
11509
11377
|
}
|
|
11510
11378
|
flat.platform = platform;
|
|
11511
11379
|
return flat;
|
|
11512
11380
|
})));
|
|
11513
11381
|
|
|
11514
|
-
case
|
|
11515
|
-
_context5.prev =
|
|
11516
|
-
_context5.t0 = _context5["catch"](
|
|
11517
|
-
|
|
11382
|
+
case 32:
|
|
11383
|
+
_context5.prev = 32;
|
|
11384
|
+
_context5.t0 = _context5["catch"](18);
|
|
11385
|
+
console.error("FIREFLY fetch error:", _context5.t0);
|
|
11386
|
+
return _context5.abrupt("return", ERROR_MESSAGES_FLAG.DEFAULT);
|
|
11518
11387
|
|
|
11519
|
-
case
|
|
11388
|
+
case 36:
|
|
11520
11389
|
case "end":
|
|
11521
11390
|
return _context5.stop();
|
|
11522
11391
|
}
|
|
11523
|
-
}), _callee5, null, [ [
|
|
11392
|
+
}), _callee5, null, [ [ 18, 32 ] ]);
|
|
11524
11393
|
})));
|
|
11525
11394
|
return _FIREFLY.apply(this, arguments);
|
|
11526
11395
|
}
|
|
@@ -11529,7 +11398,7 @@ function _typeof(o) {
|
|
|
11529
11398
|
}
|
|
11530
11399
|
function _LENS() {
|
|
11531
11400
|
_LENS = _asyncToGenerator(_regeneratorRuntime().mark((function _callee6() {
|
|
11532
|
-
var _argsToArray5, _argsToArray6, contentType, identifier, _argsToArray6$, start, _argsToArray6$2, end,
|
|
11401
|
+
var _argsToArray5, _argsToArray6, contentType, identifier, _argsToArray6$, start, _argsToArray6$2, end, API_KEY, baseUrl, headers, typeMap, platformType, query, url, res, json, _args6 = arguments;
|
|
11533
11402
|
return _regeneratorRuntime().wrap((function _callee6$(_context6) {
|
|
11534
11403
|
while (1) switch (_context6.prev = _context6.next) {
|
|
11535
11404
|
case 0:
|
|
@@ -11537,32 +11406,21 @@ function _typeof(o) {
|
|
|
11537
11406
|
contentType = _argsToArray6[0], identifier = _argsToArray6[1], _argsToArray6$ = _argsToArray6[2],
|
|
11538
11407
|
start = _argsToArray6$ === void 0 ? 0 : _argsToArray6$, _argsToArray6$2 = _argsToArray6[3],
|
|
11539
11408
|
end = _argsToArray6$2 === void 0 ? 10 : _argsToArray6$2;
|
|
11540
|
-
|
|
11541
|
-
|
|
11542
|
-
identifier: identifier
|
|
11543
|
-
});
|
|
11544
|
-
if (!missingParamsError) {
|
|
11409
|
+
API_KEY = window.localStorage.getItem(SERVICE_API_KEY.Firefly);
|
|
11410
|
+
if (API_KEY) {
|
|
11545
11411
|
_context6.next = 4;
|
|
11546
11412
|
break;
|
|
11547
11413
|
}
|
|
11548
|
-
return _context6.abrupt("return",
|
|
11414
|
+
return _context6.abrupt("return", "".concat(SERVICE_API_KEY.Firefly).concat(ERROR_MESSAGES_FLAG.MISSING_KEY));
|
|
11549
11415
|
|
|
11550
11416
|
case 4:
|
|
11551
11417
|
if (!(end > MAX_PAGE_LIMIT)) {
|
|
11552
11418
|
_context6.next = 6;
|
|
11553
11419
|
break;
|
|
11554
11420
|
}
|
|
11555
|
-
return _context6.abrupt("return",
|
|
11421
|
+
return _context6.abrupt("return", ERROR_MESSAGES_FLAG.MAX_PAGE_LIMIT);
|
|
11556
11422
|
|
|
11557
11423
|
case 6:
|
|
11558
|
-
API_KEY = window.localStorage.getItem(SERVICES_API_KEY.Firefly);
|
|
11559
|
-
if (API_KEY) {
|
|
11560
|
-
_context6.next = 9;
|
|
11561
|
-
break;
|
|
11562
|
-
}
|
|
11563
|
-
return _context6.abrupt("return", errorMessageHandler(ERROR_MESSAGES_FLAG.MISSING_KEY, SERVICES_API_KEY.Firefly));
|
|
11564
|
-
|
|
11565
|
-
case 9:
|
|
11566
11424
|
baseUrl = "https://openapi.firefly.land/v1/fileverse/fetch";
|
|
11567
11425
|
headers = {
|
|
11568
11426
|
"x-api-key": API_KEY
|
|
@@ -11571,73 +11429,72 @@ function _typeof(o) {
|
|
|
11571
11429
|
posts: "lensid",
|
|
11572
11430
|
replies: "lenspostid"
|
|
11573
11431
|
};
|
|
11574
|
-
|
|
11575
|
-
if (
|
|
11576
|
-
_context6.next =
|
|
11432
|
+
platformType = typeMap[contentType];
|
|
11433
|
+
if (platformType) {
|
|
11434
|
+
_context6.next = 12;
|
|
11577
11435
|
break;
|
|
11578
11436
|
}
|
|
11579
|
-
return _context6.abrupt("return",
|
|
11580
|
-
contentType: contentType
|
|
11581
|
-
}));
|
|
11437
|
+
return _context6.abrupt("return", "Lens: ".concat(ERROR_MESSAGES_FLAG.INVALID_TYPE));
|
|
11582
11438
|
|
|
11583
|
-
case
|
|
11439
|
+
case 12:
|
|
11584
11440
|
query = identifier.split(",").map((function(s) {
|
|
11585
11441
|
return s.trim();
|
|
11586
11442
|
})).filter(Boolean).join(",");
|
|
11587
11443
|
url = new URL(baseUrl);
|
|
11588
11444
|
url.searchParams.set("query", query);
|
|
11589
|
-
url.searchParams.set("type",
|
|
11445
|
+
url.searchParams.set("type", platformType);
|
|
11590
11446
|
url.searchParams.set("start", String(start));
|
|
11591
11447
|
url.searchParams.set("end", String(end));
|
|
11592
|
-
_context6.prev =
|
|
11593
|
-
_context6.next =
|
|
11448
|
+
_context6.prev = 18;
|
|
11449
|
+
_context6.next = 21;
|
|
11594
11450
|
return fetch(url.toString(), {
|
|
11595
11451
|
headers: headers
|
|
11596
11452
|
});
|
|
11597
11453
|
|
|
11598
|
-
case
|
|
11454
|
+
case 21:
|
|
11599
11455
|
res = _context6.sent;
|
|
11600
11456
|
if (res.ok) {
|
|
11601
|
-
_context6.next =
|
|
11457
|
+
_context6.next = 24;
|
|
11602
11458
|
break;
|
|
11603
11459
|
}
|
|
11604
|
-
|
|
11460
|
+
throw new Error("HTTP ".concat(res.status));
|
|
11605
11461
|
|
|
11606
|
-
case
|
|
11607
|
-
_context6.next =
|
|
11462
|
+
case 24:
|
|
11463
|
+
_context6.next = 26;
|
|
11608
11464
|
return res.json();
|
|
11609
11465
|
|
|
11610
|
-
case
|
|
11466
|
+
case 26:
|
|
11611
11467
|
json = _context6.sent;
|
|
11612
11468
|
if (Array.isArray(json === null || json === void 0 ? void 0 : json.data)) {
|
|
11613
|
-
_context6.next =
|
|
11469
|
+
_context6.next = 29;
|
|
11614
11470
|
break;
|
|
11615
11471
|
}
|
|
11616
11472
|
return _context6.abrupt("return", []);
|
|
11617
11473
|
|
|
11618
|
-
case
|
|
11474
|
+
case 29:
|
|
11619
11475
|
return _context6.abrupt("return", json.data.map((function(item) {
|
|
11620
11476
|
var flat = {};
|
|
11621
11477
|
for (var _i12 = 0, _Object$entries3 = Object.entries(item); _i12 < _Object$entries3.length; _i12++) {
|
|
11622
|
-
var _Object$entries3$_i = _slicedToArray(_Object$entries3[_i12], 2), key = _Object$entries3$_i[0],
|
|
11623
|
-
if (_typeof(
|
|
11624
|
-
flat[key] =
|
|
11478
|
+
var _Object$entries3$_i = _slicedToArray(_Object$entries3[_i12], 2), key = _Object$entries3$_i[0], _value7 = _Object$entries3$_i[1];
|
|
11479
|
+
if (_typeof(_value7) !== "object" || _value7 === null) {
|
|
11480
|
+
flat[key] = _value7;
|
|
11625
11481
|
}
|
|
11626
11482
|
}
|
|
11627
11483
|
flat.platform = "lens";
|
|
11628
11484
|
return flat;
|
|
11629
11485
|
})));
|
|
11630
11486
|
|
|
11631
|
-
case
|
|
11632
|
-
_context6.prev =
|
|
11633
|
-
_context6.t0 = _context6["catch"](
|
|
11634
|
-
|
|
11487
|
+
case 32:
|
|
11488
|
+
_context6.prev = 32;
|
|
11489
|
+
_context6.t0 = _context6["catch"](18);
|
|
11490
|
+
console.error("LENS fetch error:", _context6.t0);
|
|
11491
|
+
return _context6.abrupt("return", ERROR_MESSAGES_FLAG.DEFAULT);
|
|
11635
11492
|
|
|
11636
|
-
case
|
|
11493
|
+
case 36:
|
|
11637
11494
|
case "end":
|
|
11638
11495
|
return _context6.stop();
|
|
11639
11496
|
}
|
|
11640
|
-
}), _callee6, null, [ [
|
|
11497
|
+
}), _callee6, null, [ [ 18, 32 ] ]);
|
|
11641
11498
|
})));
|
|
11642
11499
|
return _LENS.apply(this, arguments);
|
|
11643
11500
|
}
|
|
@@ -11646,7 +11503,7 @@ function _typeof(o) {
|
|
|
11646
11503
|
}
|
|
11647
11504
|
function _FARCASTER() {
|
|
11648
11505
|
_FARCASTER = _asyncToGenerator(_regeneratorRuntime().mark((function _callee7() {
|
|
11649
|
-
var _argsToArray7, _argsToArray8, contentType, identifier, _argsToArray8$, start, _argsToArray8$2, end,
|
|
11506
|
+
var _argsToArray7, _argsToArray8, contentType, identifier, _argsToArray8$, start, _argsToArray8$2, end, API_KEY, baseUrl, headers, typeMap, platformType, query, url, res, json, _args7 = arguments;
|
|
11650
11507
|
return _regeneratorRuntime().wrap((function _callee7$(_context7) {
|
|
11651
11508
|
while (1) switch (_context7.prev = _context7.next) {
|
|
11652
11509
|
case 0:
|
|
@@ -11654,32 +11511,21 @@ function _typeof(o) {
|
|
|
11654
11511
|
contentType = _argsToArray8[0], identifier = _argsToArray8[1], _argsToArray8$ = _argsToArray8[2],
|
|
11655
11512
|
start = _argsToArray8$ === void 0 ? 0 : _argsToArray8$, _argsToArray8$2 = _argsToArray8[3],
|
|
11656
11513
|
end = _argsToArray8$2 === void 0 ? 10 : _argsToArray8$2;
|
|
11657
|
-
|
|
11658
|
-
|
|
11659
|
-
identifier: identifier
|
|
11660
|
-
});
|
|
11661
|
-
if (!missingParamsError) {
|
|
11514
|
+
API_KEY = window.localStorage.getItem(SERVICE_API_KEY.Firefly);
|
|
11515
|
+
if (API_KEY) {
|
|
11662
11516
|
_context7.next = 4;
|
|
11663
11517
|
break;
|
|
11664
11518
|
}
|
|
11665
|
-
return _context7.abrupt("return",
|
|
11519
|
+
return _context7.abrupt("return", "".concat(SERVICE_API_KEY.Firefly).concat(ERROR_MESSAGES_FLAG.MISSING_KEY));
|
|
11666
11520
|
|
|
11667
11521
|
case 4:
|
|
11668
11522
|
if (!(end > MAX_PAGE_LIMIT)) {
|
|
11669
11523
|
_context7.next = 6;
|
|
11670
11524
|
break;
|
|
11671
11525
|
}
|
|
11672
|
-
return _context7.abrupt("return",
|
|
11526
|
+
return _context7.abrupt("return", ERROR_MESSAGES_FLAG.MAX_PAGE_LIMIT);
|
|
11673
11527
|
|
|
11674
11528
|
case 6:
|
|
11675
|
-
API_KEY = window.localStorage.getItem(SERVICES_API_KEY.Firefly);
|
|
11676
|
-
if (API_KEY) {
|
|
11677
|
-
_context7.next = 9;
|
|
11678
|
-
break;
|
|
11679
|
-
}
|
|
11680
|
-
return _context7.abrupt("return", errorMessageHandler(ERROR_MESSAGES_FLAG.MISSING_KEY, SERVICES_API_KEY.Firefly));
|
|
11681
|
-
|
|
11682
|
-
case 9:
|
|
11683
11529
|
baseUrl = "https://openapi.firefly.land/v1/fileverse/fetch";
|
|
11684
11530
|
headers = {
|
|
11685
11531
|
"x-api-key": API_KEY
|
|
@@ -11689,73 +11535,72 @@ function _typeof(o) {
|
|
|
11689
11535
|
replies: "farcasterpostid",
|
|
11690
11536
|
channels: "farcasterchannels"
|
|
11691
11537
|
};
|
|
11692
|
-
|
|
11693
|
-
if (
|
|
11694
|
-
_context7.next =
|
|
11538
|
+
platformType = typeMap[contentType];
|
|
11539
|
+
if (platformType) {
|
|
11540
|
+
_context7.next = 12;
|
|
11695
11541
|
break;
|
|
11696
11542
|
}
|
|
11697
|
-
return _context7.abrupt("return",
|
|
11698
|
-
contentType: contentType
|
|
11699
|
-
}));
|
|
11543
|
+
return _context7.abrupt("return", "Farcaster: ".concat(ERROR_MESSAGES_FLAG.INVALID_TYPE));
|
|
11700
11544
|
|
|
11701
|
-
case
|
|
11545
|
+
case 12:
|
|
11702
11546
|
query = identifier.split(",").map((function(s) {
|
|
11703
11547
|
return s.trim();
|
|
11704
11548
|
})).filter(Boolean).join(",");
|
|
11705
11549
|
url = new URL(baseUrl);
|
|
11706
11550
|
url.searchParams.set("query", query);
|
|
11707
|
-
url.searchParams.set("type",
|
|
11551
|
+
url.searchParams.set("type", platformType);
|
|
11708
11552
|
url.searchParams.set("start", String(start));
|
|
11709
11553
|
url.searchParams.set("end", String(end));
|
|
11710
|
-
_context7.prev =
|
|
11711
|
-
_context7.next =
|
|
11554
|
+
_context7.prev = 18;
|
|
11555
|
+
_context7.next = 21;
|
|
11712
11556
|
return fetch(url.toString(), {
|
|
11713
11557
|
headers: headers
|
|
11714
11558
|
});
|
|
11715
11559
|
|
|
11716
|
-
case
|
|
11560
|
+
case 21:
|
|
11717
11561
|
res = _context7.sent;
|
|
11718
11562
|
if (res.ok) {
|
|
11719
|
-
_context7.next =
|
|
11563
|
+
_context7.next = 24;
|
|
11720
11564
|
break;
|
|
11721
11565
|
}
|
|
11722
|
-
|
|
11566
|
+
throw new Error("HTTP ".concat(res.status));
|
|
11723
11567
|
|
|
11724
|
-
case
|
|
11725
|
-
_context7.next =
|
|
11568
|
+
case 24:
|
|
11569
|
+
_context7.next = 26;
|
|
11726
11570
|
return res.json();
|
|
11727
11571
|
|
|
11728
|
-
case
|
|
11572
|
+
case 26:
|
|
11729
11573
|
json = _context7.sent;
|
|
11730
11574
|
if (Array.isArray(json === null || json === void 0 ? void 0 : json.data)) {
|
|
11731
|
-
_context7.next =
|
|
11575
|
+
_context7.next = 29;
|
|
11732
11576
|
break;
|
|
11733
11577
|
}
|
|
11734
11578
|
return _context7.abrupt("return", []);
|
|
11735
11579
|
|
|
11736
|
-
case
|
|
11580
|
+
case 29:
|
|
11737
11581
|
return _context7.abrupt("return", json.data.map((function(item) {
|
|
11738
11582
|
var flat = {};
|
|
11739
11583
|
for (var _i13 = 0, _Object$entries4 = Object.entries(item); _i13 < _Object$entries4.length; _i13++) {
|
|
11740
|
-
var _Object$entries4$_i = _slicedToArray(_Object$entries4[_i13], 2), key = _Object$entries4$_i[0],
|
|
11741
|
-
if (_typeof(
|
|
11742
|
-
flat[key] =
|
|
11584
|
+
var _Object$entries4$_i = _slicedToArray(_Object$entries4[_i13], 2), key = _Object$entries4$_i[0], _value8 = _Object$entries4$_i[1];
|
|
11585
|
+
if (_typeof(_value8) !== "object" || _value8 === null) {
|
|
11586
|
+
flat[key] = _value8;
|
|
11743
11587
|
}
|
|
11744
11588
|
}
|
|
11745
11589
|
flat.platform = "farcaster";
|
|
11746
11590
|
return flat;
|
|
11747
11591
|
})));
|
|
11748
11592
|
|
|
11749
|
-
case
|
|
11750
|
-
_context7.prev =
|
|
11751
|
-
_context7.t0 = _context7["catch"](
|
|
11752
|
-
|
|
11593
|
+
case 32:
|
|
11594
|
+
_context7.prev = 32;
|
|
11595
|
+
_context7.t0 = _context7["catch"](18);
|
|
11596
|
+
console.error("Farcaster fetch error:", _context7.t0);
|
|
11597
|
+
return _context7.abrupt("return", ERROR_MESSAGES_FLAG.DEFAULT);
|
|
11753
11598
|
|
|
11754
|
-
case
|
|
11599
|
+
case 36:
|
|
11755
11600
|
case "end":
|
|
11756
11601
|
return _context7.stop();
|
|
11757
11602
|
}
|
|
11758
|
-
}), _callee7, null, [ [
|
|
11603
|
+
}), _callee7, null, [ [ 18, 32 ] ]);
|
|
11759
11604
|
})));
|
|
11760
11605
|
return _FARCASTER.apply(this, arguments);
|
|
11761
11606
|
}
|
|
@@ -11764,7 +11609,7 @@ function _typeof(o) {
|
|
|
11764
11609
|
}
|
|
11765
11610
|
function _BLOCKSCOUT() {
|
|
11766
11611
|
_BLOCKSCOUT = _asyncToGenerator(_regeneratorRuntime().mark((function _callee8() {
|
|
11767
|
-
var _argsToArray9, _argsToArray0, address, type, chain, startTimestamp, endTimestamp, _argsToArray0$, page, _argsToArray0$2, offset,
|
|
11612
|
+
var _argsToArray9, _argsToArray0, address, type, chain, startTimestamp, endTimestamp, _argsToArray0$, page, _argsToArray0$2, offset, currentTimestamp, hostname, requestUrl, _json$result, _json$result2, response, json, _args8 = arguments;
|
|
11768
11613
|
return _regeneratorRuntime().wrap((function _callee8$(_context8) {
|
|
11769
11614
|
while (1) switch (_context8.prev = _context8.next) {
|
|
11770
11615
|
case 0:
|
|
@@ -11772,27 +11617,23 @@ function _typeof(o) {
|
|
|
11772
11617
|
address = _argsToArray0[0], type = _argsToArray0[1], chain = _argsToArray0[2], startTimestamp = _argsToArray0[3],
|
|
11773
11618
|
endTimestamp = _argsToArray0[4], _argsToArray0$ = _argsToArray0[5], page = _argsToArray0$ === void 0 ? 1 : _argsToArray0$,
|
|
11774
11619
|
_argsToArray0$2 = _argsToArray0[6], offset = _argsToArray0$2 === void 0 ? 10 : _argsToArray0$2;
|
|
11775
|
-
|
|
11776
|
-
|
|
11777
|
-
type: type
|
|
11778
|
-
});
|
|
11779
|
-
if (!missingParamsError) {
|
|
11780
|
-
_context8.next = 4;
|
|
11620
|
+
if (!(offset > MAX_PAGE_LIMIT)) {
|
|
11621
|
+
_context8.next = 3;
|
|
11781
11622
|
break;
|
|
11782
11623
|
}
|
|
11783
|
-
return _context8.abrupt("return",
|
|
11624
|
+
return _context8.abrupt("return", ERROR_MESSAGES_FLAG.MAX_PAGE_LIMIT);
|
|
11784
11625
|
|
|
11785
|
-
case
|
|
11786
|
-
if (!
|
|
11626
|
+
case 3:
|
|
11627
|
+
if (!chain) {
|
|
11628
|
+
chain = "ethereum";
|
|
11629
|
+
}
|
|
11630
|
+
if (type) {
|
|
11787
11631
|
_context8.next = 6;
|
|
11788
11632
|
break;
|
|
11789
11633
|
}
|
|
11790
|
-
return _context8.abrupt("return",
|
|
11634
|
+
return _context8.abrupt("return", "TYPE_MISSING");
|
|
11791
11635
|
|
|
11792
11636
|
case 6:
|
|
11793
|
-
if (!chain) {
|
|
11794
|
-
chain = "ethereum";
|
|
11795
|
-
}
|
|
11796
11637
|
if (!startTimestamp) {
|
|
11797
11638
|
currentTimestamp = Date.now();
|
|
11798
11639
|
startTimestamp = currentTimestamp - 30 * 24 * 60 * 60 * 1e3;
|
|
@@ -11804,110 +11645,97 @@ function _typeof(o) {
|
|
|
11804
11645
|
if (isNaN(endTimestamp) && endTimestamp) {
|
|
11805
11646
|
endTimestamp = toTimestamp(endTimestamp);
|
|
11806
11647
|
}
|
|
11807
|
-
if (isAddress
|
|
11808
|
-
_context8.next =
|
|
11648
|
+
if (isAddress(address)) {
|
|
11649
|
+
_context8.next = 13;
|
|
11809
11650
|
break;
|
|
11810
11651
|
}
|
|
11811
|
-
|
|
11812
|
-
|
|
11813
|
-
return fromEnsNameToAddress$1.fromEnsNameToAddress(address);
|
|
11652
|
+
_context8.next = 12;
|
|
11653
|
+
return fromEnsNameToAddress(address);
|
|
11814
11654
|
|
|
11815
|
-
case
|
|
11655
|
+
case 12:
|
|
11816
11656
|
address = _context8.sent;
|
|
11657
|
+
|
|
11658
|
+
case 13:
|
|
11817
11659
|
if (address) {
|
|
11818
|
-
_context8.next =
|
|
11660
|
+
_context8.next = 15;
|
|
11819
11661
|
break;
|
|
11820
11662
|
}
|
|
11821
|
-
return _context8.abrupt("return",
|
|
11663
|
+
return _context8.abrupt("return", "".concat(address).concat(ERROR_MESSAGES_FLAG.INVALID_PARAM));
|
|
11822
11664
|
|
|
11823
|
-
case
|
|
11665
|
+
case 15:
|
|
11824
11666
|
hostname = BLOCKSCOUT_CHAINS_MAP[chain];
|
|
11825
|
-
if (hostname) {
|
|
11826
|
-
_context8.next = 20;
|
|
11827
|
-
break;
|
|
11828
|
-
}
|
|
11829
|
-
return _context8.abrupt("return", errorMessageHandler(ERROR_MESSAGES_FLAG.INVALID_CHAIN, chain));
|
|
11830
|
-
|
|
11831
|
-
case 20:
|
|
11832
11667
|
_context8.t0 = type;
|
|
11833
|
-
_context8.next = _context8.t0 === "stat" ?
|
|
11668
|
+
_context8.next = _context8.t0 === "stat" ? 19 : _context8.t0 === "txns" ? 21 : _context8.t0 === "tokens" ? 23 : 25;
|
|
11834
11669
|
break;
|
|
11835
11670
|
|
|
11836
|
-
case
|
|
11671
|
+
case 19:
|
|
11837
11672
|
requestUrl = "".concat(hostname, "/api/v2/addresses/").concat(address, "/counters");
|
|
11838
|
-
return _context8.abrupt("break",
|
|
11673
|
+
return _context8.abrupt("break", 26);
|
|
11839
11674
|
|
|
11840
|
-
case
|
|
11675
|
+
case 21:
|
|
11841
11676
|
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");
|
|
11842
|
-
return _context8.abrupt("break",
|
|
11677
|
+
return _context8.abrupt("break", 26);
|
|
11843
11678
|
|
|
11844
|
-
case
|
|
11679
|
+
case 23:
|
|
11845
11680
|
requestUrl = "".concat(hostname, "/api?module=account&action=tokenlist&address=").concat(address);
|
|
11846
|
-
return _context8.abrupt("break",
|
|
11681
|
+
return _context8.abrupt("break", 26);
|
|
11847
11682
|
|
|
11848
|
-
case
|
|
11849
|
-
return _context8.abrupt("return",
|
|
11850
|
-
type: type
|
|
11851
|
-
}));
|
|
11683
|
+
case 25:
|
|
11684
|
+
return _context8.abrupt("return", "INVALID_TYPE");
|
|
11852
11685
|
|
|
11853
|
-
case
|
|
11854
|
-
_context8.prev =
|
|
11855
|
-
_context8.next =
|
|
11686
|
+
case 26:
|
|
11687
|
+
_context8.prev = 26;
|
|
11688
|
+
_context8.next = 29;
|
|
11856
11689
|
return fetch(requestUrl);
|
|
11857
11690
|
|
|
11858
|
-
case
|
|
11691
|
+
case 29:
|
|
11859
11692
|
response = _context8.sent;
|
|
11860
11693
|
if (response.ok) {
|
|
11861
|
-
_context8.next =
|
|
11694
|
+
_context8.next = 32;
|
|
11862
11695
|
break;
|
|
11863
11696
|
}
|
|
11864
|
-
|
|
11697
|
+
throw new Error("HTTP error! Status: ".concat(response.status));
|
|
11865
11698
|
|
|
11866
|
-
case
|
|
11867
|
-
_context8.next =
|
|
11699
|
+
case 32:
|
|
11700
|
+
_context8.next = 34;
|
|
11868
11701
|
return response.json();
|
|
11869
11702
|
|
|
11870
|
-
case
|
|
11703
|
+
case 34:
|
|
11871
11704
|
json = _context8.sent;
|
|
11705
|
+
console.log(json);
|
|
11872
11706
|
if (!(json !== null && json !== void 0 && (_json$result = json.result) !== null && _json$result !== void 0 && _json$result.includes("Invalid parameter(s)"))) {
|
|
11873
|
-
_context8.next =
|
|
11707
|
+
_context8.next = 38;
|
|
11874
11708
|
break;
|
|
11875
11709
|
}
|
|
11876
|
-
return _context8.abrupt("return",
|
|
11877
|
-
message: "Invalid parameters",
|
|
11878
|
-
reason: json.result
|
|
11879
|
-
}));
|
|
11710
|
+
return _context8.abrupt("return", "INVALID_REQUEST_PARAMS");
|
|
11880
11711
|
|
|
11881
|
-
case
|
|
11712
|
+
case 38:
|
|
11882
11713
|
if (!(json !== null && json !== void 0 && (_json$result2 = json.result) !== null && _json$result2 !== void 0 && _json$result2.includes("Not found"))) {
|
|
11883
|
-
_context8.next =
|
|
11714
|
+
_context8.next = 40;
|
|
11884
11715
|
break;
|
|
11885
11716
|
}
|
|
11886
|
-
return _context8.abrupt("return",
|
|
11887
|
-
message: "Address information not found",
|
|
11888
|
-
reason: json.result
|
|
11889
|
-
}));
|
|
11717
|
+
return _context8.abrupt("return", "ADDRESS_NOT_FOUND");
|
|
11890
11718
|
|
|
11891
|
-
case
|
|
11719
|
+
case 40:
|
|
11892
11720
|
if (!(type === "stat")) {
|
|
11893
|
-
_context8.next =
|
|
11721
|
+
_context8.next = 42;
|
|
11894
11722
|
break;
|
|
11895
11723
|
}
|
|
11896
11724
|
return _context8.abrupt("return", [ json ]);
|
|
11897
11725
|
|
|
11898
|
-
case
|
|
11726
|
+
case 42:
|
|
11899
11727
|
return _context8.abrupt("return", json.result);
|
|
11900
11728
|
|
|
11901
|
-
case
|
|
11902
|
-
_context8.prev =
|
|
11903
|
-
_context8.t1 = _context8["catch"](
|
|
11904
|
-
return _context8.abrupt("return",
|
|
11729
|
+
case 45:
|
|
11730
|
+
_context8.prev = 45;
|
|
11731
|
+
_context8.t1 = _context8["catch"](26);
|
|
11732
|
+
return _context8.abrupt("return", "ERROR IN FETCHING");
|
|
11905
11733
|
|
|
11906
|
-
case
|
|
11734
|
+
case 48:
|
|
11907
11735
|
case "end":
|
|
11908
11736
|
return _context8.stop();
|
|
11909
11737
|
}
|
|
11910
|
-
}), _callee8, null, [ [
|
|
11738
|
+
}), _callee8, null, [ [ 26, 45 ] ]);
|
|
11911
11739
|
})));
|
|
11912
11740
|
return _BLOCKSCOUT.apply(this, arguments);
|
|
11913
11741
|
}
|
|
@@ -11916,53 +11744,27 @@ function _typeof(o) {
|
|
|
11916
11744
|
}
|
|
11917
11745
|
function _BASE() {
|
|
11918
11746
|
_BASE = _asyncToGenerator(_regeneratorRuntime().mark((function _callee9() {
|
|
11919
|
-
var _argsToArray1, _argsToArray10, type, address, startDate, endDate, page, limit,
|
|
11747
|
+
var _argsToArray1, _argsToArray10, type, chain, address, startDate, endDate, page, limit, _args9 = arguments;
|
|
11920
11748
|
return _regeneratorRuntime().wrap((function _callee9$(_context9) {
|
|
11921
11749
|
while (1) switch (_context9.prev = _context9.next) {
|
|
11922
11750
|
case 0:
|
|
11923
|
-
_argsToArray1 = argsToArray(_args9), _argsToArray10 = _slicedToArray(_argsToArray1,
|
|
11924
|
-
type = _argsToArray10[0],
|
|
11925
|
-
|
|
11926
|
-
|
|
11927
|
-
|
|
11928
|
-
|
|
11929
|
-
|
|
11930
|
-
if (!missingParamsError) {
|
|
11931
|
-
_context9.next = 4;
|
|
11932
|
-
break;
|
|
11933
|
-
}
|
|
11934
|
-
return _context9.abrupt("return", missingParamsError);
|
|
11935
|
-
|
|
11936
|
-
case 4:
|
|
11937
|
-
API_KEY = window.localStorage.getItem(SERVICES_API_KEY.Basescan);
|
|
11938
|
-
if (API_KEY) {
|
|
11939
|
-
_context9.next = 7;
|
|
11940
|
-
break;
|
|
11941
|
-
}
|
|
11942
|
-
return _context9.abrupt("return", errorMessageHandler(ERROR_MESSAGES_FLAG.MISSING_KEY, SERVICES_API_KEY.Basescan));
|
|
11943
|
-
|
|
11944
|
-
case 7:
|
|
11945
|
-
if (!(limit > MAX_PAGE_LIMIT)) {
|
|
11946
|
-
_context9.next = 9;
|
|
11947
|
-
break;
|
|
11948
|
-
}
|
|
11949
|
-
return _context9.abrupt("return", errorMessageHandler(ERROR_MESSAGES_FLAG.MAX_PAGE_LIMIT));
|
|
11950
|
-
|
|
11951
|
-
case 9:
|
|
11952
|
-
return _context9.abrupt("return", handleScanRequest({
|
|
11751
|
+
_argsToArray1 = argsToArray(_args9), _argsToArray10 = _slicedToArray(_argsToArray1, 7),
|
|
11752
|
+
type = _argsToArray10[0], chain = _argsToArray10[1], address = _argsToArray10[2],
|
|
11753
|
+
startDate = _argsToArray10[3], endDate = _argsToArray10[4], page = _argsToArray10[5],
|
|
11754
|
+
limit = _argsToArray10[6];
|
|
11755
|
+
return _context9.abrupt("return", handleScanRequest({
|
|
11756
|
+
scanKey: SERVICE_API_KEY.Basescan,
|
|
11757
|
+
baseUrl: "https://api.basescan.org/api",
|
|
11953
11758
|
type: type,
|
|
11759
|
+
chain: chain,
|
|
11954
11760
|
address: address,
|
|
11955
11761
|
startDate: startDate,
|
|
11956
11762
|
endDate: endDate,
|
|
11957
11763
|
page: page,
|
|
11958
|
-
offset: limit
|
|
11959
|
-
apiKey: API_KEY,
|
|
11960
|
-
functionName: "BASE",
|
|
11961
|
-
chainId: CHAIN_ID_MAP.base,
|
|
11962
|
-
network: "base"
|
|
11764
|
+
offset: limit
|
|
11963
11765
|
}));
|
|
11964
11766
|
|
|
11965
|
-
case
|
|
11767
|
+
case 2:
|
|
11966
11768
|
case "end":
|
|
11967
11769
|
return _context9.stop();
|
|
11968
11770
|
}
|
|
@@ -11975,53 +11777,27 @@ function _typeof(o) {
|
|
|
11975
11777
|
}
|
|
11976
11778
|
function _GNOSIS() {
|
|
11977
11779
|
_GNOSIS = _asyncToGenerator(_regeneratorRuntime().mark((function _callee0() {
|
|
11978
|
-
var _argsToArray11, _argsToArray12, type, address, startDate, endDate, page, limit,
|
|
11780
|
+
var _argsToArray11, _argsToArray12, type, chain, address, startDate, endDate, page, limit, _args0 = arguments;
|
|
11979
11781
|
return _regeneratorRuntime().wrap((function _callee0$(_context0) {
|
|
11980
11782
|
while (1) switch (_context0.prev = _context0.next) {
|
|
11981
11783
|
case 0:
|
|
11982
|
-
_argsToArray11 = argsToArray(_args0), _argsToArray12 = _slicedToArray(_argsToArray11,
|
|
11983
|
-
type = _argsToArray12[0],
|
|
11984
|
-
|
|
11985
|
-
|
|
11986
|
-
type: type,
|
|
11987
|
-
address: address
|
|
11988
|
-
});
|
|
11989
|
-
if (!missingParamsError) {
|
|
11990
|
-
_context0.next = 4;
|
|
11991
|
-
break;
|
|
11992
|
-
}
|
|
11993
|
-
return _context0.abrupt("return", missingParamsError);
|
|
11994
|
-
|
|
11995
|
-
case 4:
|
|
11996
|
-
API_KEY = window.localStorage.getItem(SERVICES_API_KEY.Gnosisscan);
|
|
11997
|
-
if (API_KEY) {
|
|
11998
|
-
_context0.next = 7;
|
|
11999
|
-
break;
|
|
12000
|
-
}
|
|
12001
|
-
return _context0.abrupt("return", errorMessageHandler(ERROR_MESSAGES_FLAG.MISSING_KEY, SERVICES_API_KEY.Gnosisscan));
|
|
12002
|
-
|
|
12003
|
-
case 7:
|
|
12004
|
-
if (!(limit > MAX_PAGE_LIMIT)) {
|
|
12005
|
-
_context0.next = 9;
|
|
12006
|
-
break;
|
|
12007
|
-
}
|
|
12008
|
-
return _context0.abrupt("return", errorMessageHandler(ERROR_MESSAGES_FLAG.MAX_PAGE_LIMIT));
|
|
12009
|
-
|
|
12010
|
-
case 9:
|
|
11784
|
+
_argsToArray11 = argsToArray(_args0), _argsToArray12 = _slicedToArray(_argsToArray11, 7),
|
|
11785
|
+
type = _argsToArray12[0], chain = _argsToArray12[1], address = _argsToArray12[2],
|
|
11786
|
+
startDate = _argsToArray12[3], endDate = _argsToArray12[4], page = _argsToArray12[5],
|
|
11787
|
+
limit = _argsToArray12[6];
|
|
12011
11788
|
return _context0.abrupt("return", handleScanRequest({
|
|
11789
|
+
scanKey: SERVICE_API_KEY.Gnosisscan,
|
|
11790
|
+
baseUrl: "https://api.gnosisscan.io/api",
|
|
12012
11791
|
type: type,
|
|
12013
|
-
|
|
11792
|
+
chain: chain,
|
|
12014
11793
|
address: address,
|
|
12015
11794
|
startDate: startDate,
|
|
12016
11795
|
endDate: endDate,
|
|
12017
11796
|
page: page,
|
|
12018
|
-
|
|
12019
|
-
offset: limit,
|
|
12020
|
-
chainId: CHAIN_ID_MAP.gnosis,
|
|
12021
|
-
functionName: "GNOSIS"
|
|
11797
|
+
offset: limit
|
|
12022
11798
|
}));
|
|
12023
11799
|
|
|
12024
|
-
case
|
|
11800
|
+
case 2:
|
|
12025
11801
|
case "end":
|
|
12026
11802
|
return _context0.stop();
|
|
12027
11803
|
}
|
|
@@ -12034,47 +11810,42 @@ function _typeof(o) {
|
|
|
12034
11810
|
}
|
|
12035
11811
|
function _NEYNAR() {
|
|
12036
11812
|
_NEYNAR = _asyncToGenerator(_regeneratorRuntime().mark((function _callee1() {
|
|
12037
|
-
var _argsToArray13, _argsToArray14, username,
|
|
11813
|
+
var _argsToArray13, _argsToArray14, username, API_KEY, fid, url, _json$users, response, json, _args1 = arguments;
|
|
12038
11814
|
return _regeneratorRuntime().wrap((function _callee1$(_context1) {
|
|
12039
11815
|
while (1) switch (_context1.prev = _context1.next) {
|
|
12040
11816
|
case 0:
|
|
12041
11817
|
_argsToArray13 = argsToArray(_args1), _argsToArray14 = _slicedToArray(_argsToArray13, 1),
|
|
12042
11818
|
username = _argsToArray14[0];
|
|
12043
|
-
|
|
12044
|
-
|
|
12045
|
-
});
|
|
12046
|
-
if (!missingParamsError) {
|
|
11819
|
+
API_KEY = window.localStorage.getItem(SERVICE_API_KEY.Neynar);
|
|
11820
|
+
if (API_KEY) {
|
|
12047
11821
|
_context1.next = 4;
|
|
12048
11822
|
break;
|
|
12049
11823
|
}
|
|
12050
|
-
return _context1.abrupt("return",
|
|
11824
|
+
return _context1.abrupt("return", "".concat(SERVICE_API_KEY.Neynar).concat(ERROR_MESSAGES_FLAG.MISSING_KEY));
|
|
12051
11825
|
|
|
12052
11826
|
case 4:
|
|
12053
|
-
|
|
12054
|
-
|
|
12055
|
-
_context1.next = 7;
|
|
11827
|
+
if (username) {
|
|
11828
|
+
_context1.next = 6;
|
|
12056
11829
|
break;
|
|
12057
11830
|
}
|
|
12058
|
-
return _context1.abrupt("return",
|
|
11831
|
+
return _context1.abrupt("return", "".concat(SERVICE_API_KEY.Neynar).concat(ERROR_MESSAGES_FLAG.INVALID_PARAM));
|
|
12059
11832
|
|
|
12060
|
-
case
|
|
12061
|
-
_context1.next =
|
|
12062
|
-
return fromUsernameToFid
|
|
11833
|
+
case 6:
|
|
11834
|
+
_context1.next = 8;
|
|
11835
|
+
return fromUsernameToFid(username, API_KEY);
|
|
12063
11836
|
|
|
12064
|
-
case
|
|
11837
|
+
case 8:
|
|
12065
11838
|
fid = _context1.sent;
|
|
12066
11839
|
if (fid) {
|
|
12067
|
-
_context1.next =
|
|
11840
|
+
_context1.next = 11;
|
|
12068
11841
|
break;
|
|
12069
11842
|
}
|
|
12070
|
-
return _context1.abrupt("return",
|
|
12071
|
-
username: username
|
|
12072
|
-
}));
|
|
11843
|
+
return _context1.abrupt("return", "".concat(SERVICE_API_KEY.Neynar).concat(ERROR_MESSAGES_FLAG.INVALID_PARAM));
|
|
12073
11844
|
|
|
12074
|
-
case
|
|
11845
|
+
case 11:
|
|
12075
11846
|
url = "https://api.neynar.com/v2/farcaster/followers?fid=".concat(fid);
|
|
12076
|
-
_context1.prev =
|
|
12077
|
-
_context1.next =
|
|
11847
|
+
_context1.prev = 12;
|
|
11848
|
+
_context1.next = 15;
|
|
12078
11849
|
return fetch(url, {
|
|
12079
11850
|
headers: {
|
|
12080
11851
|
"x-api-key": API_KEY,
|
|
@@ -12082,30 +11853,30 @@ function _typeof(o) {
|
|
|
12082
11853
|
}
|
|
12083
11854
|
});
|
|
12084
11855
|
|
|
12085
|
-
case
|
|
11856
|
+
case 15:
|
|
12086
11857
|
response = _context1.sent;
|
|
12087
11858
|
if (response.ok) {
|
|
12088
|
-
_context1.next =
|
|
11859
|
+
_context1.next = 18;
|
|
12089
11860
|
break;
|
|
12090
11861
|
}
|
|
12091
|
-
|
|
11862
|
+
throw new Error("HTTP ".concat(response.status));
|
|
12092
11863
|
|
|
12093
|
-
case
|
|
12094
|
-
_context1.next =
|
|
11864
|
+
case 18:
|
|
11865
|
+
_context1.next = 20;
|
|
12095
11866
|
return response.json();
|
|
12096
11867
|
|
|
12097
|
-
case
|
|
11868
|
+
case 20:
|
|
12098
11869
|
json = _context1.sent;
|
|
12099
11870
|
if (json !== null && json !== void 0 && (_json$users = json.users) !== null && _json$users !== void 0 && _json$users.length) {
|
|
12100
|
-
_context1.next =
|
|
11871
|
+
_context1.next = 23;
|
|
12101
11872
|
break;
|
|
12102
11873
|
}
|
|
12103
11874
|
return _context1.abrupt("return", []);
|
|
12104
11875
|
|
|
12105
|
-
case
|
|
12106
|
-
return _context1.abrupt("return", json.users.map((function(
|
|
11876
|
+
case 23:
|
|
11877
|
+
return _context1.abrupt("return", json.users.map((function(_ref5) {
|
|
12107
11878
|
var _user$profile, _user$profile2;
|
|
12108
|
-
var user =
|
|
11879
|
+
var user = _ref5.user;
|
|
12109
11880
|
return {
|
|
12110
11881
|
username: user.username,
|
|
12111
11882
|
custody_address: user.custody_address,
|
|
@@ -12115,138 +11886,200 @@ function _typeof(o) {
|
|
|
12115
11886
|
};
|
|
12116
11887
|
})));
|
|
12117
11888
|
|
|
12118
|
-
case
|
|
12119
|
-
_context1.prev =
|
|
12120
|
-
_context1.t0 = _context1["catch"](
|
|
12121
|
-
|
|
11889
|
+
case 26:
|
|
11890
|
+
_context1.prev = 26;
|
|
11891
|
+
_context1.t0 = _context1["catch"](12);
|
|
11892
|
+
console.error("NEYNAR_FETCH_FOLLOWERS error:", _context1.t0);
|
|
11893
|
+
return _context1.abrupt("return", ERROR_MESSAGES_FLAG.DEFAULT);
|
|
12122
11894
|
|
|
12123
11895
|
case 30:
|
|
12124
11896
|
case "end":
|
|
12125
11897
|
return _context1.stop();
|
|
12126
11898
|
}
|
|
12127
|
-
}), _callee1, null, [ [
|
|
11899
|
+
}), _callee1, null, [ [ 12, 26 ] ]);
|
|
12128
11900
|
})));
|
|
12129
11901
|
return _NEYNAR.apply(this, arguments);
|
|
12130
11902
|
}
|
|
12131
|
-
function
|
|
12132
|
-
return
|
|
11903
|
+
function GNOSISPAY(_x8) {
|
|
11904
|
+
return _GNOSISPAY.apply(this, arguments);
|
|
12133
11905
|
}
|
|
12134
|
-
function
|
|
12135
|
-
|
|
12136
|
-
var
|
|
11906
|
+
function _GNOSISPAY() {
|
|
11907
|
+
_GNOSISPAY = _asyncToGenerator(_regeneratorRuntime().mark((function _callee10(_ref4) {
|
|
11908
|
+
var cardId, startDate, endDate, _ref4$limit, limit, _ref4$offset, offset, apiKeyKey, API_KEY, url, res, json;
|
|
12137
11909
|
return _regeneratorRuntime().wrap((function _callee10$(_context10) {
|
|
12138
11910
|
while (1) switch (_context10.prev = _context10.next) {
|
|
12139
11911
|
case 0:
|
|
12140
|
-
|
|
12141
|
-
|
|
12142
|
-
|
|
12143
|
-
|
|
12144
|
-
|
|
12145
|
-
|
|
12146
|
-
type: type,
|
|
12147
|
-
address: address,
|
|
12148
|
-
chain: chain
|
|
12149
|
-
});
|
|
12150
|
-
if (!missingParamsError) {
|
|
11912
|
+
cardId = _ref4.cardId, startDate = _ref4.startDate, endDate = _ref4.endDate, _ref4$limit = _ref4.limit,
|
|
11913
|
+
limit = _ref4$limit === void 0 ? 20 : _ref4$limit, _ref4$offset = _ref4.offset,
|
|
11914
|
+
offset = _ref4$offset === void 0 ? 0 : _ref4$offset;
|
|
11915
|
+
apiKeyKey = SERVICE_API_KEY.GnosisPay;
|
|
11916
|
+
API_KEY = window.localStorage.getItem(apiKeyKey);
|
|
11917
|
+
if (API_KEY) {
|
|
12151
11918
|
_context10.next = 5;
|
|
12152
11919
|
break;
|
|
12153
11920
|
}
|
|
12154
|
-
return _context10.abrupt("return",
|
|
11921
|
+
return _context10.abrupt("return", "".concat(apiKeyKey).concat(ERROR_MESSAGES_FLAG.MISSING_KEY));
|
|
12155
11922
|
|
|
12156
11923
|
case 5:
|
|
12157
|
-
|
|
12158
|
-
|
|
12159
|
-
_context10.next = 8;
|
|
11924
|
+
if (cardId) {
|
|
11925
|
+
_context10.next = 7;
|
|
12160
11926
|
break;
|
|
12161
11927
|
}
|
|
12162
|
-
return _context10.abrupt("return",
|
|
11928
|
+
return _context10.abrupt("return", "".concat(apiKeyKey).concat(ERROR_MESSAGES_FLAG.INVALID_PARAM));
|
|
12163
11929
|
|
|
12164
|
-
case
|
|
12165
|
-
|
|
12166
|
-
|
|
12167
|
-
_context10.next = 11;
|
|
11930
|
+
case 7:
|
|
11931
|
+
if (!(limit > MAX_PAGE_LIMIT)) {
|
|
11932
|
+
_context10.next = 9;
|
|
12168
11933
|
break;
|
|
12169
11934
|
}
|
|
12170
|
-
return _context10.abrupt("return",
|
|
11935
|
+
return _context10.abrupt("return", ERROR_MESSAGES_FLAG.MAX_PAGE_LIMIT);
|
|
12171
11936
|
|
|
12172
|
-
case
|
|
12173
|
-
|
|
11937
|
+
case 9:
|
|
11938
|
+
url = new URL("https://api.gnosispay.com/cards/".concat(cardId, "/transactions"));
|
|
11939
|
+
url.searchParams.set("limit", limit.toString());
|
|
11940
|
+
url.searchParams.set("offset", offset.toString());
|
|
11941
|
+
if (!isNaN(toTimestamp(startDate))) {
|
|
11942
|
+
url.searchParams.set("startDate", new Date(startDate * 1e3).toISOString());
|
|
11943
|
+
}
|
|
11944
|
+
if (!isNaN(toTimestamp(endDate))) {
|
|
11945
|
+
url.searchParams.set("endDate", new Date(endDate * 1e3).toISOString());
|
|
11946
|
+
}
|
|
11947
|
+
_context10.prev = 14;
|
|
11948
|
+
_context10.next = 17;
|
|
11949
|
+
return fetch(url.toString(), {
|
|
11950
|
+
headers: {
|
|
11951
|
+
Authorization: "Bearer ".concat(API_KEY),
|
|
11952
|
+
"Content-Type": "application/json"
|
|
11953
|
+
}
|
|
11954
|
+
});
|
|
11955
|
+
|
|
11956
|
+
case 17:
|
|
11957
|
+
res = _context10.sent;
|
|
11958
|
+
if (res.ok) {
|
|
11959
|
+
_context10.next = 20;
|
|
11960
|
+
break;
|
|
11961
|
+
}
|
|
11962
|
+
throw new Error("HTTP error! Status: ".concat(res.status));
|
|
11963
|
+
|
|
11964
|
+
case 20:
|
|
11965
|
+
_context10.next = 22;
|
|
11966
|
+
return res.json();
|
|
11967
|
+
|
|
11968
|
+
case 22:
|
|
11969
|
+
json = _context10.sent;
|
|
11970
|
+
if (Array.isArray(json)) {
|
|
11971
|
+
_context10.next = 25;
|
|
11972
|
+
break;
|
|
11973
|
+
}
|
|
11974
|
+
return _context10.abrupt("return", []);
|
|
11975
|
+
|
|
11976
|
+
case 25:
|
|
11977
|
+
return _context10.abrupt("return", json.map((function(tx) {
|
|
11978
|
+
return {
|
|
11979
|
+
createdAt: tx.createdAt,
|
|
11980
|
+
clearedAt: tx.clearedAt,
|
|
11981
|
+
country: tx.country,
|
|
11982
|
+
merchant: tx.merchant,
|
|
11983
|
+
billingAmount: tx.billingAmount,
|
|
11984
|
+
billingCurrency: tx.billingCurrency,
|
|
11985
|
+
transactionAmount: tx.transactionAmount,
|
|
11986
|
+
transactionCurrency: tx.transactionCurrency,
|
|
11987
|
+
transactionType: tx.transactionType,
|
|
11988
|
+
kind: tx.kind,
|
|
11989
|
+
status: tx.status || null,
|
|
11990
|
+
mcc: tx.mcc
|
|
11991
|
+
};
|
|
11992
|
+
})));
|
|
11993
|
+
|
|
11994
|
+
case 28:
|
|
11995
|
+
_context10.prev = 28;
|
|
11996
|
+
_context10.t0 = _context10["catch"](14);
|
|
11997
|
+
console.error("GNOSISPAY_CARD_TXNS error:", _context10.t0);
|
|
11998
|
+
return _context10.abrupt("return", ERROR_MESSAGES_FLAG.DEFAULT);
|
|
11999
|
+
|
|
12000
|
+
case 32:
|
|
12001
|
+
case "end":
|
|
12002
|
+
return _context10.stop();
|
|
12003
|
+
}
|
|
12004
|
+
}), _callee10, null, [ [ 14, 28 ] ]);
|
|
12005
|
+
})));
|
|
12006
|
+
return _GNOSISPAY.apply(this, arguments);
|
|
12007
|
+
}
|
|
12008
|
+
function ETHERSCAN() {
|
|
12009
|
+
return _ETHERSCAN.apply(this, arguments);
|
|
12010
|
+
}
|
|
12011
|
+
function _ETHERSCAN() {
|
|
12012
|
+
_ETHERSCAN = _asyncToGenerator(_regeneratorRuntime().mark((function _callee11() {
|
|
12013
|
+
var _len2, args, _key2, type, chain, address, startDate, endDate, page, limit, _args11 = arguments;
|
|
12014
|
+
return _regeneratorRuntime().wrap((function _callee11$(_context11) {
|
|
12015
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
12016
|
+
case 0:
|
|
12017
|
+
for (_len2 = _args11.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
12018
|
+
args[_key2] = _args11[_key2];
|
|
12019
|
+
}
|
|
12020
|
+
type = args[0], chain = args[1], address = args[2], startDate = args[3], endDate = args[4],
|
|
12021
|
+
page = args[5], limit = args[6];
|
|
12022
|
+
return _context11.abrupt("return", handleScanRequest({
|
|
12023
|
+
scanKey: SERVICE_API_KEY.Etherscan,
|
|
12024
|
+
baseUrl: "https://api.etherscan.io/v2/api",
|
|
12174
12025
|
type: type,
|
|
12026
|
+
chain: chain,
|
|
12175
12027
|
address: address,
|
|
12176
12028
|
startDate: startDate,
|
|
12177
12029
|
endDate: endDate,
|
|
12178
12030
|
page: page,
|
|
12179
|
-
offset: limit
|
|
12180
|
-
chainId: chainId,
|
|
12181
|
-
network: chain,
|
|
12182
|
-
functionName: "ETHERSCAN",
|
|
12183
|
-
apiKey: API_KEY
|
|
12031
|
+
offset: limit
|
|
12184
12032
|
}));
|
|
12185
12033
|
|
|
12186
|
-
case
|
|
12034
|
+
case 3:
|
|
12187
12035
|
case "end":
|
|
12188
|
-
return
|
|
12036
|
+
return _context11.stop();
|
|
12189
12037
|
}
|
|
12190
|
-
}),
|
|
12038
|
+
}), _callee11);
|
|
12191
12039
|
})));
|
|
12192
12040
|
return _ETHERSCAN.apply(this, arguments);
|
|
12193
12041
|
}
|
|
12194
|
-
function COINGECKO() {
|
|
12042
|
+
function COINGECKO(_x9, _x0, _x1) {
|
|
12195
12043
|
return _COINGECKO.apply(this, arguments);
|
|
12196
12044
|
}
|
|
12197
12045
|
function _COINGECKO() {
|
|
12198
|
-
_COINGECKO = _asyncToGenerator(_regeneratorRuntime().mark((function
|
|
12199
|
-
var
|
|
12200
|
-
return _regeneratorRuntime().wrap((function
|
|
12201
|
-
while (1) switch (
|
|
12046
|
+
_COINGECKO = _asyncToGenerator(_regeneratorRuntime().mark((function _callee12(category, param1, param2) {
|
|
12047
|
+
var API_KEY, headers, url, lowerCategory, token, vsCurrencies, ecosystemMap, key, categoryVal, trend, _category, _trend, exchange, response, json, _json$status, message, output, _i14, _Object$entries5, _Object$entries5$_i, _token, prices, _i15, _Object$entries6, _Object$entries6$_i, currency, _value9, _key3, _data, exchangeDetails, flatArray;
|
|
12048
|
+
return _regeneratorRuntime().wrap((function _callee12$(_context12) {
|
|
12049
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
12202
12050
|
case 0:
|
|
12203
|
-
|
|
12204
|
-
category = _argsToArray16[0], param1 = _argsToArray16[1], param2 = _argsToArray16[2];
|
|
12205
|
-
missingParamsError = checkRequiredParams({
|
|
12206
|
-
category: category,
|
|
12207
|
-
param1: param1
|
|
12208
|
-
});
|
|
12209
|
-
if (!missingParamsError) {
|
|
12210
|
-
_context11.next = 4;
|
|
12211
|
-
break;
|
|
12212
|
-
}
|
|
12213
|
-
return _context11.abrupt("return", missingParamsError);
|
|
12214
|
-
|
|
12215
|
-
case 4:
|
|
12216
|
-
API_KEY = window.localStorage.getItem(SERVICES_API_KEY.Coingecko);
|
|
12051
|
+
API_KEY = window.localStorage.getItem(SERVICE_API_KEY.Coingecko);
|
|
12217
12052
|
if (API_KEY) {
|
|
12218
|
-
|
|
12053
|
+
_context12.next = 3;
|
|
12219
12054
|
break;
|
|
12220
12055
|
}
|
|
12221
|
-
return
|
|
12056
|
+
return _context12.abrupt("return", "".concat(SERVICE_API_KEY.Coingecko).concat(ERROR_MESSAGES_FLAG.MISSING_KEY));
|
|
12222
12057
|
|
|
12223
|
-
case
|
|
12058
|
+
case 3:
|
|
12224
12059
|
headers = {
|
|
12225
12060
|
accept: "application/json",
|
|
12226
12061
|
"x-cg-demo-api-key": API_KEY
|
|
12227
12062
|
};
|
|
12228
12063
|
url = "";
|
|
12229
12064
|
lowerCategory = (category || "").toLowerCase();
|
|
12230
|
-
|
|
12231
|
-
|
|
12065
|
+
_context12.t0 = lowerCategory;
|
|
12066
|
+
_context12.next = _context12.t0 === "price" ? 9 : _context12.t0 === "market" ? 15 : _context12.t0 === "stablecoins" ? 23 : _context12.t0 === "derivatives" ? 27 : 30;
|
|
12232
12067
|
break;
|
|
12233
12068
|
|
|
12234
|
-
case
|
|
12069
|
+
case 9:
|
|
12235
12070
|
token = param1;
|
|
12236
12071
|
vsCurrencies = param2;
|
|
12237
12072
|
if (token) {
|
|
12238
|
-
|
|
12073
|
+
_context12.next = 13;
|
|
12239
12074
|
break;
|
|
12240
12075
|
}
|
|
12241
|
-
return
|
|
12242
|
-
param1: param1
|
|
12243
|
-
}));
|
|
12076
|
+
return _context12.abrupt("return", "".concat(SERVICE_API_KEY.Coingecko).concat(ERROR_MESSAGES_FLAG.INVALID_PARAM));
|
|
12244
12077
|
|
|
12245
|
-
case
|
|
12078
|
+
case 13:
|
|
12246
12079
|
url = "https://api.coingecko.com/api/v3/simple/price?vs_currencies=".concat(vsCurrencies ? vsCurrencies : "usd", "&symbols=").concat(token);
|
|
12247
|
-
return
|
|
12080
|
+
return _context12.abrupt("break", 31);
|
|
12248
12081
|
|
|
12249
|
-
case
|
|
12082
|
+
case 15:
|
|
12250
12083
|
ecosystemMap = {
|
|
12251
12084
|
all: "",
|
|
12252
12085
|
ethereum: "ethereum-ecosystem",
|
|
@@ -12265,60 +12098,62 @@ function _typeof(o) {
|
|
|
12265
12098
|
url = "https://api.coingecko.com/api/v3/coins/markets?vs_currency=usd&include_tokens=top&page=1&per_page=100";
|
|
12266
12099
|
if (categoryVal) url += "&category=".concat(categoryVal);
|
|
12267
12100
|
if (trend) url += trend;
|
|
12268
|
-
return
|
|
12101
|
+
return _context12.abrupt("break", 31);
|
|
12269
12102
|
|
|
12270
|
-
case
|
|
12103
|
+
case 23:
|
|
12271
12104
|
_category = !param1 || param1.toLowerCase() === "all" ? "stablecoins" : param1.toLowerCase();
|
|
12272
12105
|
_trend = param2 ? "&price_change_percentage=".concat(param2) : "";
|
|
12273
12106
|
url = "https://api.coingecko.com/api/v3/coins/markets?vs_currency=usd&category=".concat(_category, "&order=market_cap_desc&page=1&per_page=100").concat(_trend);
|
|
12274
|
-
return
|
|
12107
|
+
return _context12.abrupt("break", 31);
|
|
12275
12108
|
|
|
12276
|
-
case
|
|
12109
|
+
case 27:
|
|
12277
12110
|
exchange = param1;
|
|
12278
12111
|
if (!exchange || exchange === "all") {
|
|
12279
12112
|
url = "https://api.coingecko.com/api/v3/derivatives";
|
|
12280
12113
|
} else {
|
|
12281
12114
|
url = "https://api.coingecko.com/api/v3/derivatives/exchanges/".concat(exchange, "?include_tickers=all");
|
|
12282
12115
|
}
|
|
12283
|
-
return
|
|
12116
|
+
return _context12.abrupt("break", 31);
|
|
12284
12117
|
|
|
12285
|
-
case
|
|
12286
|
-
return
|
|
12287
|
-
category: category
|
|
12288
|
-
}));
|
|
12118
|
+
case 30:
|
|
12119
|
+
return _context12.abrupt("return", "".concat(SERVICE_API_KEY.Coingecko).concat(ERROR_MESSAGES_FLAG.INVALID_PARAM));
|
|
12289
12120
|
|
|
12290
|
-
case
|
|
12291
|
-
|
|
12292
|
-
|
|
12121
|
+
case 31:
|
|
12122
|
+
_context12.prev = 31;
|
|
12123
|
+
_context12.next = 34;
|
|
12293
12124
|
return fetch(url, {
|
|
12294
12125
|
method: "GET",
|
|
12295
12126
|
headers: headers
|
|
12296
12127
|
});
|
|
12297
12128
|
|
|
12298
|
-
case
|
|
12299
|
-
response =
|
|
12300
|
-
|
|
12129
|
+
case 34:
|
|
12130
|
+
response = _context12.sent;
|
|
12131
|
+
_context12.next = 37;
|
|
12301
12132
|
return response.json();
|
|
12302
12133
|
|
|
12303
|
-
case
|
|
12304
|
-
json =
|
|
12134
|
+
case 37:
|
|
12135
|
+
json = _context12.sent;
|
|
12305
12136
|
if (response.ok) {
|
|
12306
|
-
|
|
12137
|
+
_context12.next = 44;
|
|
12307
12138
|
break;
|
|
12308
12139
|
}
|
|
12309
12140
|
message = (json === null || json === void 0 || (_json$status = json.status) === null || _json$status === void 0 ? void 0 : _json$status.error_message) || "";
|
|
12310
|
-
if (!
|
|
12311
|
-
|
|
12141
|
+
if (!(response.status === 429)) {
|
|
12142
|
+
_context12.next = 42;
|
|
12312
12143
|
break;
|
|
12313
12144
|
}
|
|
12314
|
-
return
|
|
12145
|
+
return _context12.abrupt("return", "".concat(SERVICE_API_KEY.Coingecko).concat(ERROR_MESSAGES_FLAG.RATE_LIMIT));
|
|
12315
12146
|
|
|
12316
|
-
case
|
|
12317
|
-
|
|
12147
|
+
case 42:
|
|
12148
|
+
if (!message.includes("API Key Missing")) {
|
|
12149
|
+
_context12.next = 44;
|
|
12150
|
+
break;
|
|
12151
|
+
}
|
|
12152
|
+
return _context12.abrupt("return", "".concat(SERVICE_API_KEY.Coingecko).concat(ERROR_MESSAGES_FLAG.INVALID_API_KEY));
|
|
12318
12153
|
|
|
12319
|
-
case
|
|
12154
|
+
case 44:
|
|
12320
12155
|
if (!(lowerCategory === "price")) {
|
|
12321
|
-
|
|
12156
|
+
_context12.next = 48;
|
|
12322
12157
|
break;
|
|
12323
12158
|
}
|
|
12324
12159
|
output = {};
|
|
@@ -12327,14 +12162,14 @@ function _typeof(o) {
|
|
|
12327
12162
|
prices = _Object$entries5$_i[1];
|
|
12328
12163
|
for (_i15 = 0, _Object$entries6 = Object.entries(prices); _i15 < _Object$entries6.length; _i15++) {
|
|
12329
12164
|
_Object$entries6$_i = _slicedToArray(_Object$entries6[_i15], 2), currency = _Object$entries6$_i[0],
|
|
12330
|
-
|
|
12165
|
+
_value9 = _Object$entries6$_i[1];
|
|
12331
12166
|
_key3 = "".concat(_token.charAt(0).toUpperCase() + _token.slice(1), "_").concat(currency.toUpperCase());
|
|
12332
|
-
output[_key3] =
|
|
12167
|
+
output[_key3] = _value9;
|
|
12333
12168
|
}
|
|
12334
12169
|
}
|
|
12335
|
-
return
|
|
12170
|
+
return _context12.abrupt("return", [ output ]);
|
|
12336
12171
|
|
|
12337
|
-
case
|
|
12172
|
+
case 48:
|
|
12338
12173
|
_data = json;
|
|
12339
12174
|
if (lowerCategory === "derivatives") {
|
|
12340
12175
|
if (json.length > 200) {
|
|
@@ -12359,27 +12194,28 @@ function _typeof(o) {
|
|
|
12359
12194
|
}
|
|
12360
12195
|
}
|
|
12361
12196
|
flatArray = Array.isArray(_data) ? _data : [ _data ];
|
|
12362
|
-
return
|
|
12197
|
+
return _context12.abrupt("return", flatArray.map((function(item) {
|
|
12363
12198
|
var flat = {};
|
|
12364
12199
|
for (var _i16 = 0, _Object$entries7 = Object.entries(item); _i16 < _Object$entries7.length; _i16++) {
|
|
12365
|
-
var _Object$entries7$_i = _slicedToArray(_Object$entries7[_i16], 2), _key4 = _Object$entries7$_i[0],
|
|
12366
|
-
if (_typeof(
|
|
12367
|
-
flat[_key4] =
|
|
12200
|
+
var _Object$entries7$_i = _slicedToArray(_Object$entries7[_i16], 2), _key4 = _Object$entries7$_i[0], _value0 = _Object$entries7$_i[1];
|
|
12201
|
+
if (_typeof(_value0) !== "object" || _value0 === null) {
|
|
12202
|
+
flat[_key4] = _value0;
|
|
12368
12203
|
}
|
|
12369
12204
|
}
|
|
12370
12205
|
return flat;
|
|
12371
12206
|
})));
|
|
12372
12207
|
|
|
12373
|
-
case
|
|
12374
|
-
|
|
12375
|
-
|
|
12376
|
-
|
|
12208
|
+
case 54:
|
|
12209
|
+
_context12.prev = 54;
|
|
12210
|
+
_context12.t1 = _context12["catch"](31);
|
|
12211
|
+
console.error(_context12.t1);
|
|
12212
|
+
return _context12.abrupt("return", ERROR_MESSAGES_FLAG.DEFAULT);
|
|
12377
12213
|
|
|
12378
|
-
case
|
|
12214
|
+
case 58:
|
|
12379
12215
|
case "end":
|
|
12380
|
-
return
|
|
12216
|
+
return _context12.stop();
|
|
12381
12217
|
}
|
|
12382
|
-
}),
|
|
12218
|
+
}), _callee12, null, [ [ 31, 54 ] ]);
|
|
12383
12219
|
})));
|
|
12384
12220
|
return _COINGECKO.apply(this, arguments);
|
|
12385
12221
|
}
|
|
@@ -12387,113 +12223,94 @@ function _typeof(o) {
|
|
|
12387
12223
|
return _EOA.apply(this, arguments);
|
|
12388
12224
|
}
|
|
12389
12225
|
function _EOA() {
|
|
12390
|
-
_EOA = _asyncToGenerator(_regeneratorRuntime().mark((function
|
|
12391
|
-
var
|
|
12392
|
-
return _regeneratorRuntime().wrap((function
|
|
12393
|
-
while (1) switch (
|
|
12226
|
+
_EOA = _asyncToGenerator(_regeneratorRuntime().mark((function _callee14() {
|
|
12227
|
+
var API_KEY, _argsToArray15, _argsToArray16, addresses, category, chains, startTime, endTime, _argsToArray16$, page, _argsToArray16$2, offset, INPUTS, CHAINS, out, ADDRESS_MAP, _iterator, _step, input, resolved, ADDRS, _iterator2, _step2, _loop, _ret, fetchJSON, _fetchJSON, _args17 = arguments;
|
|
12228
|
+
return _regeneratorRuntime().wrap((function _callee14$(_context17) {
|
|
12229
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
12394
12230
|
case 0:
|
|
12395
12231
|
_fetchJSON = function _fetchJSON3() {
|
|
12396
|
-
_fetchJSON = _asyncToGenerator(_regeneratorRuntime().mark((function
|
|
12232
|
+
_fetchJSON = _asyncToGenerator(_regeneratorRuntime().mark((function _callee13(url) {
|
|
12397
12233
|
var _json$result3, _json$result3$include, _json$result4, _json$result4$include, res, json;
|
|
12398
|
-
return _regeneratorRuntime().wrap((function
|
|
12399
|
-
while (1) switch (
|
|
12234
|
+
return _regeneratorRuntime().wrap((function _callee13$(_context16) {
|
|
12235
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
12400
12236
|
case 0:
|
|
12401
|
-
|
|
12402
|
-
|
|
12237
|
+
_context16.prev = 0;
|
|
12238
|
+
_context16.next = 3;
|
|
12403
12239
|
return fetch(url);
|
|
12404
12240
|
|
|
12405
12241
|
case 3:
|
|
12406
|
-
res =
|
|
12242
|
+
res = _context16.sent;
|
|
12407
12243
|
if (res.ok) {
|
|
12408
|
-
|
|
12244
|
+
_context16.next = 6;
|
|
12409
12245
|
break;
|
|
12410
12246
|
}
|
|
12411
|
-
return
|
|
12247
|
+
return _context16.abrupt("return", "HTTP_".concat(res.status));
|
|
12412
12248
|
|
|
12413
12249
|
case 6:
|
|
12414
|
-
|
|
12250
|
+
_context16.next = 8;
|
|
12415
12251
|
return res.json();
|
|
12416
12252
|
|
|
12417
12253
|
case 8:
|
|
12418
|
-
json =
|
|
12254
|
+
json = _context16.sent;
|
|
12419
12255
|
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"))) {
|
|
12420
|
-
|
|
12256
|
+
_context16.next = 11;
|
|
12421
12257
|
break;
|
|
12422
12258
|
}
|
|
12423
|
-
return
|
|
12259
|
+
return _context16.abrupt("return", "".concat(SERVICE_API_KEY.Etherscan).concat(ERROR_MESSAGES_FLAG.INVALID_API_KEY));
|
|
12424
12260
|
|
|
12425
12261
|
case 11:
|
|
12426
12262
|
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"))) {
|
|
12427
|
-
|
|
12263
|
+
_context16.next = 13;
|
|
12428
12264
|
break;
|
|
12429
12265
|
}
|
|
12430
|
-
return
|
|
12266
|
+
return _context16.abrupt("return", "".concat(SERVICE_API_KEY.Etherscan).concat(ERROR_MESSAGES_FLAG.RATE_LIMIT));
|
|
12431
12267
|
|
|
12432
12268
|
case 13:
|
|
12433
12269
|
if (!(json.status === "0" && json.message !== "No transactions found")) {
|
|
12434
|
-
|
|
12270
|
+
_context16.next = 15;
|
|
12435
12271
|
break;
|
|
12436
12272
|
}
|
|
12437
|
-
return
|
|
12438
|
-
message: json.message || "Api Error",
|
|
12439
|
-
reason: json.message || 'json.status === "0" && json.message !== "No transactions found"'
|
|
12440
|
-
}));
|
|
12273
|
+
return _context16.abrupt("return", ERROR_MESSAGES_FLAG.DEFAULT);
|
|
12441
12274
|
|
|
12442
12275
|
case 15:
|
|
12443
|
-
return
|
|
12276
|
+
return _context16.abrupt("return", json.result);
|
|
12444
12277
|
|
|
12445
12278
|
case 18:
|
|
12446
|
-
|
|
12447
|
-
|
|
12448
|
-
return
|
|
12279
|
+
_context16.prev = 18;
|
|
12280
|
+
_context16.t0 = _context16["catch"](0);
|
|
12281
|
+
return _context16.abrupt("return", ERROR_MESSAGES_FLAG.DEFAULT);
|
|
12449
12282
|
|
|
12450
12283
|
case 21:
|
|
12451
12284
|
case "end":
|
|
12452
|
-
return
|
|
12285
|
+
return _context16.stop();
|
|
12453
12286
|
}
|
|
12454
|
-
}),
|
|
12287
|
+
}), _callee13, null, [ [ 0, 18 ] ]);
|
|
12455
12288
|
})));
|
|
12456
12289
|
return _fetchJSON.apply(this, arguments);
|
|
12457
12290
|
};
|
|
12458
|
-
fetchJSON = function _fetchJSON2(
|
|
12291
|
+
fetchJSON = function _fetchJSON2(_x12) {
|
|
12459
12292
|
return _fetchJSON.apply(this, arguments);
|
|
12460
12293
|
};
|
|
12461
|
-
|
|
12462
|
-
|
|
12463
|
-
|
|
12464
|
-
page = _argsToArray18$ === void 0 ? 1 : _argsToArray18$, _argsToArray18$2 = _argsToArray18[6],
|
|
12465
|
-
offset = _argsToArray18$2 === void 0 ? 10 : _argsToArray18$2;
|
|
12466
|
-
optionalParams = category === "balance" ? {} : {
|
|
12467
|
-
startTime: startTime,
|
|
12468
|
-
endTime: endTime
|
|
12469
|
-
};
|
|
12470
|
-
missingParamsError = checkRequiredParams(_objectSpread({
|
|
12471
|
-
addresses: addresses,
|
|
12472
|
-
category: category,
|
|
12473
|
-
chains: chains
|
|
12474
|
-
}, optionalParams));
|
|
12475
|
-
if (!missingParamsError) {
|
|
12476
|
-
_context16.next = 7;
|
|
12294
|
+
API_KEY = window.localStorage.getItem(SERVICE_API_KEY.Etherscan);
|
|
12295
|
+
if (API_KEY) {
|
|
12296
|
+
_context17.next = 5;
|
|
12477
12297
|
break;
|
|
12478
12298
|
}
|
|
12479
|
-
return
|
|
12299
|
+
return _context17.abrupt("return", "".concat(SERVICE_API_KEY.Etherscan).concat(ERROR_MESSAGES_FLAG.MISSING_KEY));
|
|
12480
12300
|
|
|
12481
|
-
case
|
|
12301
|
+
case 5:
|
|
12302
|
+
_argsToArray15 = argsToArray(_args17), _argsToArray16 = _slicedToArray(_argsToArray15, 7),
|
|
12303
|
+
addresses = _argsToArray16[0], category = _argsToArray16[1], chains = _argsToArray16[2],
|
|
12304
|
+
startTime = _argsToArray16[3], endTime = _argsToArray16[4], _argsToArray16$ = _argsToArray16[5],
|
|
12305
|
+
page = _argsToArray16$ === void 0 ? 1 : _argsToArray16$, _argsToArray16$2 = _argsToArray16[6],
|
|
12306
|
+
offset = _argsToArray16$2 === void 0 ? 10 : _argsToArray16$2;
|
|
12482
12307
|
if (!(offset > MAX_PAGE_LIMIT)) {
|
|
12483
|
-
|
|
12308
|
+
_context17.next = 8;
|
|
12484
12309
|
break;
|
|
12485
12310
|
}
|
|
12486
|
-
return
|
|
12311
|
+
return _context17.abrupt("return", ERROR_MESSAGES_FLAG.MAX_PAGE_LIMIT);
|
|
12487
12312
|
|
|
12488
|
-
case
|
|
12489
|
-
API_KEY = window.localStorage.getItem(SERVICES_API_KEY.Etherscan);
|
|
12490
|
-
if (API_KEY) {
|
|
12491
|
-
_context16.next = 12;
|
|
12492
|
-
break;
|
|
12493
|
-
}
|
|
12494
|
-
return _context16.abrupt("return", errorMessageHandler(ERROR_MESSAGES_FLAG.MISSING_KEY, SERVICES_API_KEY.Etherscan));
|
|
12495
|
-
|
|
12496
|
-
case 12:
|
|
12313
|
+
case 8:
|
|
12497
12314
|
INPUTS = addresses.split(",").map((function(a) {
|
|
12498
12315
|
return a.trim();
|
|
12499
12316
|
})).filter(Boolean);
|
|
@@ -12503,101 +12320,99 @@ function _typeof(o) {
|
|
|
12503
12320
|
out = [];
|
|
12504
12321
|
ADDRESS_MAP = {};
|
|
12505
12322
|
_iterator = _createForOfIteratorHelper(INPUTS);
|
|
12506
|
-
|
|
12323
|
+
_context17.prev = 13;
|
|
12507
12324
|
_iterator.s();
|
|
12508
12325
|
|
|
12509
|
-
case
|
|
12326
|
+
case 15:
|
|
12510
12327
|
if ((_step = _iterator.n()).done) {
|
|
12511
|
-
|
|
12328
|
+
_context17.next = 33;
|
|
12512
12329
|
break;
|
|
12513
12330
|
}
|
|
12514
12331
|
input = _step.value;
|
|
12515
|
-
if (!isAddress
|
|
12516
|
-
|
|
12332
|
+
if (!isAddress(input)) {
|
|
12333
|
+
_context17.next = 21;
|
|
12517
12334
|
break;
|
|
12518
12335
|
}
|
|
12519
12336
|
ADDRESS_MAP[input.toLowerCase()] = null;
|
|
12520
|
-
|
|
12337
|
+
_context17.next = 31;
|
|
12521
12338
|
break;
|
|
12522
12339
|
|
|
12523
|
-
case
|
|
12524
|
-
|
|
12525
|
-
|
|
12526
|
-
return fromEnsNameToAddress
|
|
12340
|
+
case 21:
|
|
12341
|
+
_context17.prev = 21;
|
|
12342
|
+
_context17.next = 24;
|
|
12343
|
+
return fromEnsNameToAddress(input);
|
|
12527
12344
|
|
|
12528
|
-
case
|
|
12529
|
-
resolved =
|
|
12345
|
+
case 24:
|
|
12346
|
+
resolved = _context17.sent;
|
|
12530
12347
|
if (resolved) ADDRESS_MAP[resolved.toLowerCase()] = input;
|
|
12531
|
-
|
|
12348
|
+
_context17.next = 31;
|
|
12532
12349
|
break;
|
|
12533
12350
|
|
|
12534
|
-
case
|
|
12535
|
-
|
|
12536
|
-
|
|
12537
|
-
return
|
|
12538
|
-
addresses: addresses
|
|
12539
|
-
}));
|
|
12351
|
+
case 28:
|
|
12352
|
+
_context17.prev = 28;
|
|
12353
|
+
_context17.t0 = _context17["catch"](21);
|
|
12354
|
+
return _context17.abrupt("return", "".concat(input).concat(ERROR_MESSAGES_FLAG.INVALID_PARAM));
|
|
12540
12355
|
|
|
12541
|
-
case
|
|
12542
|
-
|
|
12356
|
+
case 31:
|
|
12357
|
+
_context17.next = 15;
|
|
12543
12358
|
break;
|
|
12544
12359
|
|
|
12545
|
-
case
|
|
12546
|
-
|
|
12360
|
+
case 33:
|
|
12361
|
+
_context17.next = 38;
|
|
12547
12362
|
break;
|
|
12548
12363
|
|
|
12549
|
-
case
|
|
12550
|
-
|
|
12551
|
-
|
|
12552
|
-
_iterator.e(
|
|
12364
|
+
case 35:
|
|
12365
|
+
_context17.prev = 35;
|
|
12366
|
+
_context17.t1 = _context17["catch"](13);
|
|
12367
|
+
_iterator.e(_context17.t1);
|
|
12553
12368
|
|
|
12554
|
-
case
|
|
12555
|
-
|
|
12369
|
+
case 38:
|
|
12370
|
+
_context17.prev = 38;
|
|
12556
12371
|
_iterator.f();
|
|
12557
|
-
return
|
|
12372
|
+
return _context17.finish(38);
|
|
12558
12373
|
|
|
12559
|
-
case
|
|
12374
|
+
case 41:
|
|
12560
12375
|
ADDRS = Object.keys(ADDRESS_MAP);
|
|
12561
12376
|
_iterator2 = _createForOfIteratorHelper(CHAINS);
|
|
12562
|
-
|
|
12377
|
+
_context17.prev = 43;
|
|
12563
12378
|
_loop = _regeneratorRuntime().mark((function _loop() {
|
|
12564
12379
|
var chain, chainId, _loop2, _ret2, i, startBlock, endBlock, _loop3, _ret3, _i17, _ADDRS;
|
|
12565
|
-
return _regeneratorRuntime().wrap((function _loop$(
|
|
12566
|
-
while (1) switch (
|
|
12380
|
+
return _regeneratorRuntime().wrap((function _loop$(_context15) {
|
|
12381
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
12567
12382
|
case 0:
|
|
12568
12383
|
chain = _step2.value;
|
|
12569
12384
|
chainId = CHAIN_ID_MAP[chain];
|
|
12570
12385
|
if (chainId) {
|
|
12571
|
-
|
|
12386
|
+
_context15.next = 4;
|
|
12572
12387
|
break;
|
|
12573
12388
|
}
|
|
12574
|
-
return
|
|
12575
|
-
v:
|
|
12389
|
+
return _context15.abrupt("return", {
|
|
12390
|
+
v: ERROR_MESSAGES_FLAG.UNSUPPORTED_CHAIN
|
|
12576
12391
|
});
|
|
12577
12392
|
|
|
12578
12393
|
case 4:
|
|
12579
12394
|
if (!(category === "balance")) {
|
|
12580
|
-
|
|
12395
|
+
_context15.next = 16;
|
|
12581
12396
|
break;
|
|
12582
12397
|
}
|
|
12583
12398
|
_loop2 = _regeneratorRuntime().mark((function _loop2(i) {
|
|
12584
12399
|
var slice, action, url, data;
|
|
12585
|
-
return _regeneratorRuntime().wrap((function _loop2$(
|
|
12586
|
-
while (1) switch (
|
|
12400
|
+
return _regeneratorRuntime().wrap((function _loop2$(_context13) {
|
|
12401
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
12587
12402
|
case 0:
|
|
12588
12403
|
slice = ADDRS.slice(i, i + 20).join(",");
|
|
12589
12404
|
action = "addresstokenbalance";
|
|
12590
12405
|
url = "https://api.etherscan.io/v2/api?chainid=".concat(chainId) + "&module=account&action=".concat(action, "&address=").concat(slice) + "&page=".concat(page, "&offset=100&apikey=").concat(API_KEY);
|
|
12591
|
-
|
|
12406
|
+
_context13.next = 5;
|
|
12592
12407
|
return fetchJSON(url);
|
|
12593
12408
|
|
|
12594
12409
|
case 5:
|
|
12595
|
-
data =
|
|
12596
|
-
if (
|
|
12597
|
-
|
|
12410
|
+
data = _context13.sent;
|
|
12411
|
+
if (!(typeof data === "string")) {
|
|
12412
|
+
_context13.next = 8;
|
|
12598
12413
|
break;
|
|
12599
12414
|
}
|
|
12600
|
-
return
|
|
12415
|
+
return _context13.abrupt("return", {
|
|
12601
12416
|
v: {
|
|
12602
12417
|
v: data
|
|
12603
12418
|
}
|
|
@@ -12614,7 +12429,7 @@ function _typeof(o) {
|
|
|
12614
12429
|
|
|
12615
12430
|
case 9:
|
|
12616
12431
|
case "end":
|
|
12617
|
-
return
|
|
12432
|
+
return _context13.stop();
|
|
12618
12433
|
}
|
|
12619
12434
|
}), _loop2);
|
|
12620
12435
|
}));
|
|
@@ -12622,81 +12437,59 @@ function _typeof(o) {
|
|
|
12622
12437
|
|
|
12623
12438
|
case 7:
|
|
12624
12439
|
if (!(i < ADDRS.length)) {
|
|
12625
|
-
|
|
12440
|
+
_context15.next = 15;
|
|
12626
12441
|
break;
|
|
12627
12442
|
}
|
|
12628
|
-
return
|
|
12443
|
+
return _context15.delegateYield(_loop2(i), "t0", 9);
|
|
12629
12444
|
|
|
12630
12445
|
case 9:
|
|
12631
|
-
_ret2 =
|
|
12446
|
+
_ret2 = _context15.t0;
|
|
12632
12447
|
if (!_ret2) {
|
|
12633
|
-
|
|
12448
|
+
_context15.next = 12;
|
|
12634
12449
|
break;
|
|
12635
12450
|
}
|
|
12636
|
-
return
|
|
12451
|
+
return _context15.abrupt("return", _ret2.v);
|
|
12637
12452
|
|
|
12638
12453
|
case 12:
|
|
12639
12454
|
i += 20;
|
|
12640
|
-
|
|
12455
|
+
_context15.next = 7;
|
|
12641
12456
|
break;
|
|
12642
12457
|
|
|
12643
12458
|
case 15:
|
|
12644
|
-
return
|
|
12459
|
+
return _context15.abrupt("return", 0);
|
|
12645
12460
|
|
|
12646
12461
|
case 16:
|
|
12647
12462
|
if (!(category === "txns")) {
|
|
12648
|
-
|
|
12463
|
+
_context15.next = 34;
|
|
12649
12464
|
break;
|
|
12650
12465
|
}
|
|
12651
|
-
|
|
12652
|
-
return
|
|
12466
|
+
_context15.next = 19;
|
|
12467
|
+
return fromTimeStampToBlock(toTimestamp(startTime), chain, API_KEY);
|
|
12653
12468
|
|
|
12654
12469
|
case 19:
|
|
12655
|
-
startBlock =
|
|
12656
|
-
|
|
12657
|
-
return
|
|
12470
|
+
startBlock = _context15.sent;
|
|
12471
|
+
_context15.next = 22;
|
|
12472
|
+
return fromTimeStampToBlock(toTimestamp(endTime), chain, API_KEY);
|
|
12658
12473
|
|
|
12659
12474
|
case 22:
|
|
12660
|
-
endBlock =
|
|
12661
|
-
if (startBlock !== null && startBlock !== void 0 && startBlock.toString()) {
|
|
12662
|
-
_context14.next = 25;
|
|
12663
|
-
break;
|
|
12664
|
-
}
|
|
12665
|
-
return _context14.abrupt("return", {
|
|
12666
|
-
v: errorMessageHandler(ERROR_MESSAGES_FLAG.INVALID_PARAM, {
|
|
12667
|
-
startTime: startTime
|
|
12668
|
-
})
|
|
12669
|
-
});
|
|
12670
|
-
|
|
12671
|
-
case 25:
|
|
12672
|
-
if (endBlock !== null && endBlock !== void 0 && endBlock.toString()) {
|
|
12673
|
-
_context14.next = 27;
|
|
12674
|
-
break;
|
|
12675
|
-
}
|
|
12676
|
-
return _context14.abrupt("return", {
|
|
12677
|
-
v: errorMessageHandler(ERROR_MESSAGES_FLAG.INVALID_PARAM, {
|
|
12678
|
-
endTime: endTime
|
|
12679
|
-
})
|
|
12680
|
-
});
|
|
12681
|
-
|
|
12682
|
-
case 27:
|
|
12475
|
+
endBlock = _context15.sent;
|
|
12683
12476
|
_loop3 = _regeneratorRuntime().mark((function _loop3() {
|
|
12684
12477
|
var addr, url, data;
|
|
12685
|
-
return _regeneratorRuntime().wrap((function _loop3$(
|
|
12686
|
-
while (1) switch (
|
|
12478
|
+
return _regeneratorRuntime().wrap((function _loop3$(_context14) {
|
|
12479
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
12687
12480
|
case 0:
|
|
12688
12481
|
addr = _ADDRS[_i17];
|
|
12689
12482
|
url = "https://api.etherscan.io/v2/api?chainid=".concat(chainId) + "&module=account&action=tokentx&address=".concat(addr) + "&startblock=".concat(startBlock, "&endblock=").concat(endBlock) + "&page=".concat(page, "&offset=").concat(offset, "&sort=asc&apikey=").concat(API_KEY);
|
|
12690
|
-
|
|
12483
|
+
_context14.next = 4;
|
|
12691
12484
|
return fetchJSON(url);
|
|
12692
12485
|
|
|
12693
12486
|
case 4:
|
|
12694
|
-
data =
|
|
12695
|
-
if (
|
|
12696
|
-
|
|
12487
|
+
data = _context14.sent;
|
|
12488
|
+
if (!(typeof data === "string")) {
|
|
12489
|
+
_context14.next = 7;
|
|
12697
12490
|
break;
|
|
12698
12491
|
}
|
|
12699
|
-
return
|
|
12492
|
+
return _context14.abrupt("return", {
|
|
12700
12493
|
v: {
|
|
12701
12494
|
v: data
|
|
12702
12495
|
}
|
|
@@ -12713,110 +12506,108 @@ function _typeof(o) {
|
|
|
12713
12506
|
|
|
12714
12507
|
case 8:
|
|
12715
12508
|
case "end":
|
|
12716
|
-
return
|
|
12509
|
+
return _context14.stop();
|
|
12717
12510
|
}
|
|
12718
12511
|
}), _loop3);
|
|
12719
12512
|
}));
|
|
12720
12513
|
_i17 = 0, _ADDRS = ADDRS;
|
|
12721
12514
|
|
|
12722
|
-
case
|
|
12515
|
+
case 25:
|
|
12723
12516
|
if (!(_i17 < _ADDRS.length)) {
|
|
12724
|
-
|
|
12517
|
+
_context15.next = 33;
|
|
12725
12518
|
break;
|
|
12726
12519
|
}
|
|
12727
|
-
return
|
|
12520
|
+
return _context15.delegateYield(_loop3(), "t1", 27);
|
|
12728
12521
|
|
|
12729
|
-
case
|
|
12730
|
-
_ret3 =
|
|
12522
|
+
case 27:
|
|
12523
|
+
_ret3 = _context15.t1;
|
|
12731
12524
|
if (!_ret3) {
|
|
12732
|
-
|
|
12525
|
+
_context15.next = 30;
|
|
12733
12526
|
break;
|
|
12734
12527
|
}
|
|
12735
|
-
return
|
|
12528
|
+
return _context15.abrupt("return", _ret3.v);
|
|
12736
12529
|
|
|
12737
|
-
case
|
|
12530
|
+
case 30:
|
|
12738
12531
|
_i17++;
|
|
12739
|
-
|
|
12532
|
+
_context15.next = 25;
|
|
12740
12533
|
break;
|
|
12741
12534
|
|
|
12742
|
-
case
|
|
12743
|
-
return
|
|
12535
|
+
case 33:
|
|
12536
|
+
return _context15.abrupt("return", 0);
|
|
12744
12537
|
|
|
12745
|
-
case
|
|
12746
|
-
return
|
|
12747
|
-
v:
|
|
12748
|
-
category: category
|
|
12749
|
-
})
|
|
12538
|
+
case 34:
|
|
12539
|
+
return _context15.abrupt("return", {
|
|
12540
|
+
v: ERROR_MESSAGES_FLAG.INVALID_CATEGORY
|
|
12750
12541
|
});
|
|
12751
12542
|
|
|
12752
|
-
case
|
|
12543
|
+
case 35:
|
|
12753
12544
|
case "end":
|
|
12754
|
-
return
|
|
12545
|
+
return _context15.stop();
|
|
12755
12546
|
}
|
|
12756
12547
|
}), _loop);
|
|
12757
12548
|
}));
|
|
12758
12549
|
_iterator2.s();
|
|
12759
12550
|
|
|
12760
|
-
case
|
|
12551
|
+
case 46:
|
|
12761
12552
|
if ((_step2 = _iterator2.n()).done) {
|
|
12762
|
-
|
|
12553
|
+
_context17.next = 55;
|
|
12763
12554
|
break;
|
|
12764
12555
|
}
|
|
12765
|
-
return
|
|
12556
|
+
return _context17.delegateYield(_loop(), "t2", 48);
|
|
12766
12557
|
|
|
12767
|
-
case
|
|
12768
|
-
_ret =
|
|
12558
|
+
case 48:
|
|
12559
|
+
_ret = _context17.t2;
|
|
12769
12560
|
if (!(_ret === 0)) {
|
|
12770
|
-
|
|
12561
|
+
_context17.next = 51;
|
|
12771
12562
|
break;
|
|
12772
12563
|
}
|
|
12773
|
-
return
|
|
12564
|
+
return _context17.abrupt("continue", 53);
|
|
12774
12565
|
|
|
12775
|
-
case
|
|
12566
|
+
case 51:
|
|
12776
12567
|
if (!_ret) {
|
|
12777
|
-
|
|
12568
|
+
_context17.next = 53;
|
|
12778
12569
|
break;
|
|
12779
12570
|
}
|
|
12780
|
-
return
|
|
12571
|
+
return _context17.abrupt("return", _ret.v);
|
|
12781
12572
|
|
|
12782
|
-
case
|
|
12783
|
-
|
|
12573
|
+
case 53:
|
|
12574
|
+
_context17.next = 46;
|
|
12784
12575
|
break;
|
|
12785
12576
|
|
|
12786
|
-
case
|
|
12787
|
-
|
|
12577
|
+
case 55:
|
|
12578
|
+
_context17.next = 60;
|
|
12788
12579
|
break;
|
|
12789
12580
|
|
|
12790
|
-
case
|
|
12791
|
-
|
|
12792
|
-
|
|
12793
|
-
_iterator2.e(
|
|
12581
|
+
case 57:
|
|
12582
|
+
_context17.prev = 57;
|
|
12583
|
+
_context17.t3 = _context17["catch"](43);
|
|
12584
|
+
_iterator2.e(_context17.t3);
|
|
12794
12585
|
|
|
12795
|
-
case
|
|
12796
|
-
|
|
12586
|
+
case 60:
|
|
12587
|
+
_context17.prev = 60;
|
|
12797
12588
|
_iterator2.f();
|
|
12798
|
-
return
|
|
12589
|
+
return _context17.finish(60);
|
|
12799
12590
|
|
|
12800
|
-
case
|
|
12801
|
-
return
|
|
12591
|
+
case 63:
|
|
12592
|
+
return _context17.abrupt("return", out);
|
|
12802
12593
|
|
|
12803
|
-
case
|
|
12594
|
+
case 64:
|
|
12804
12595
|
case "end":
|
|
12805
|
-
return
|
|
12596
|
+
return _context17.stop();
|
|
12806
12597
|
}
|
|
12807
|
-
}),
|
|
12598
|
+
}), _callee14, null, [ [ 13, 35, 38, 41 ], [ 21, 28 ], [ 43, 57, 60, 63 ] ]);
|
|
12808
12599
|
})));
|
|
12809
12600
|
return _EOA.apply(this, arguments);
|
|
12810
12601
|
}
|
|
12811
|
-
function FLVURL(
|
|
12602
|
+
function FLVURL(_x10, _x11) {
|
|
12812
12603
|
return _FLVURL.apply(this, arguments);
|
|
12813
12604
|
}
|
|
12814
12605
|
function _FLVURL() {
|
|
12815
|
-
_FLVURL = _asyncToGenerator(_regeneratorRuntime().mark((function
|
|
12816
|
-
return _regeneratorRuntime().wrap((function
|
|
12817
|
-
while (1) switch (
|
|
12606
|
+
_FLVURL = _asyncToGenerator(_regeneratorRuntime().mark((function _callee15(token, vs_currencies) {
|
|
12607
|
+
return _regeneratorRuntime().wrap((function _callee15$(_context18) {
|
|
12608
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
12818
12609
|
case 0:
|
|
12819
|
-
return
|
|
12610
|
+
return _context18.abrupt("return", new Promise((function(resolve) {
|
|
12820
12611
|
setTimeout((function() {
|
|
12821
12612
|
resolve([ {
|
|
12822
12613
|
Yoo: "gotcha"
|
|
@@ -12826,9 +12617,9 @@ function _typeof(o) {
|
|
|
12826
12617
|
|
|
12827
12618
|
case 1:
|
|
12828
12619
|
case "end":
|
|
12829
|
-
return
|
|
12620
|
+
return _context18.stop();
|
|
12830
12621
|
}
|
|
12831
|
-
}),
|
|
12622
|
+
}), _callee15);
|
|
12832
12623
|
})));
|
|
12833
12624
|
return _FLVURL.apply(this, arguments);
|
|
12834
12625
|
}
|
|
@@ -12836,148 +12627,123 @@ function _typeof(o) {
|
|
|
12836
12627
|
return _SAFE.apply(this, arguments);
|
|
12837
12628
|
}
|
|
12838
12629
|
function _SAFE() {
|
|
12839
|
-
_SAFE = _asyncToGenerator(_regeneratorRuntime().mark((function
|
|
12840
|
-
var
|
|
12841
|
-
return _regeneratorRuntime().wrap((function
|
|
12842
|
-
while (1) switch (
|
|
12630
|
+
_SAFE = _asyncToGenerator(_regeneratorRuntime().mark((function _callee16() {
|
|
12631
|
+
var _argsToArray17, _argsToArray18, address, utility, chain, _argsToArray18$, limit, _argsToArray18$2, offset, apiKey, chainIdentifier, url, response, json, _args19 = arguments;
|
|
12632
|
+
return _regeneratorRuntime().wrap((function _callee16$(_context19) {
|
|
12633
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
12843
12634
|
case 0:
|
|
12844
|
-
|
|
12845
|
-
address =
|
|
12846
|
-
|
|
12847
|
-
|
|
12848
|
-
missingParamsError = checkRequiredParams({
|
|
12849
|
-
address: address,
|
|
12850
|
-
utility: utility,
|
|
12851
|
-
chain: chain
|
|
12852
|
-
});
|
|
12853
|
-
if (!missingParamsError) {
|
|
12854
|
-
_context18.next = 4;
|
|
12855
|
-
break;
|
|
12856
|
-
}
|
|
12857
|
-
return _context18.abrupt("return", missingParamsError);
|
|
12858
|
-
|
|
12859
|
-
case 4:
|
|
12860
|
-
if (!(offset > MAX_PAGE_LIMIT)) {
|
|
12861
|
-
_context18.next = 6;
|
|
12862
|
-
break;
|
|
12863
|
-
}
|
|
12864
|
-
return _context18.abrupt("return", errorMessageHandler(ERROR_MESSAGES_FLAG.MAX_PAGE_LIMIT));
|
|
12865
|
-
|
|
12866
|
-
case 6:
|
|
12867
|
-
apiKey = window.localStorage.getItem(SERVICES_API_KEY.Safe);
|
|
12868
|
-
if (apiKey) {
|
|
12869
|
-
_context18.next = 9;
|
|
12870
|
-
break;
|
|
12871
|
-
}
|
|
12872
|
-
return _context18.abrupt("return", errorMessageHandler(ERROR_MESSAGES_FLAG.MISSING_KEY, SERVICES_API_KEY.Safe));
|
|
12873
|
-
|
|
12874
|
-
case 9:
|
|
12635
|
+
_argsToArray17 = argsToArray(_args19), _argsToArray18 = _slicedToArray(_argsToArray17, 5),
|
|
12636
|
+
address = _argsToArray18[0], utility = _argsToArray18[1], chain = _argsToArray18[2],
|
|
12637
|
+
_argsToArray18$ = _argsToArray18[3], limit = _argsToArray18$ === void 0 ? 10 : _argsToArray18$,
|
|
12638
|
+
_argsToArray18$2 = _argsToArray18[4], offset = _argsToArray18$2 === void 0 ? 0 : _argsToArray18$2;
|
|
12875
12639
|
if (!(typeof limit !== "number" || limit < 0)) {
|
|
12876
|
-
|
|
12640
|
+
_context19.next = 3;
|
|
12877
12641
|
break;
|
|
12878
12642
|
}
|
|
12879
|
-
return
|
|
12880
|
-
limit: limit
|
|
12881
|
-
}));
|
|
12643
|
+
return _context19.abrupt("return", "INVALID_LIMIT");
|
|
12882
12644
|
|
|
12883
|
-
case
|
|
12645
|
+
case 3:
|
|
12884
12646
|
if (!(typeof offset !== "number" || offset < 0)) {
|
|
12885
|
-
|
|
12647
|
+
_context19.next = 5;
|
|
12886
12648
|
break;
|
|
12887
12649
|
}
|
|
12888
|
-
return
|
|
12889
|
-
offset: offset
|
|
12890
|
-
}));
|
|
12650
|
+
return _context19.abrupt("return", "INVALID_OFFSET");
|
|
12891
12651
|
|
|
12892
|
-
case
|
|
12652
|
+
case 5:
|
|
12893
12653
|
if (!(utility !== "txns")) {
|
|
12894
|
-
|
|
12654
|
+
_context19.next = 7;
|
|
12895
12655
|
break;
|
|
12896
12656
|
}
|
|
12897
|
-
return
|
|
12898
|
-
utility: utility
|
|
12899
|
-
}));
|
|
12657
|
+
return _context19.abrupt("return", "UTILITY IS NOT SUPPORTED");
|
|
12900
12658
|
|
|
12901
|
-
case
|
|
12659
|
+
case 7:
|
|
12902
12660
|
if (!(limit > MAX_PAGE_LIMIT)) {
|
|
12903
|
-
|
|
12661
|
+
_context19.next = 9;
|
|
12904
12662
|
break;
|
|
12905
12663
|
}
|
|
12906
|
-
return
|
|
12664
|
+
return _context19.abrupt("return", ERROR_MESSAGES_FLAG.MAX_PAGE_LIMIT);
|
|
12907
12665
|
|
|
12908
|
-
case
|
|
12666
|
+
case 9:
|
|
12667
|
+
apiKey = window.localStorage.getItem(SERVICE_API_KEY.Safe);
|
|
12909
12668
|
chainIdentifier = SAFE_CHAIN_MAP[chain];
|
|
12669
|
+
if (apiKey) {
|
|
12670
|
+
_context19.next = 13;
|
|
12671
|
+
break;
|
|
12672
|
+
}
|
|
12673
|
+
return _context19.abrupt("return", "".concat(SERVICE_API_KEY.Safe, "_MISSING"));
|
|
12674
|
+
|
|
12675
|
+
case 13:
|
|
12910
12676
|
if (chainIdentifier) {
|
|
12911
|
-
|
|
12677
|
+
_context19.next = 15;
|
|
12912
12678
|
break;
|
|
12913
12679
|
}
|
|
12914
|
-
return
|
|
12680
|
+
return _context19.abrupt("return", "CHAIN IS NOT SUPPORTED");
|
|
12915
12681
|
|
|
12916
|
-
case
|
|
12917
|
-
if (isAddress
|
|
12918
|
-
|
|
12682
|
+
case 15:
|
|
12683
|
+
if (isAddress(address)) {
|
|
12684
|
+
_context19.next = 19;
|
|
12919
12685
|
break;
|
|
12920
12686
|
}
|
|
12921
|
-
|
|
12922
|
-
|
|
12923
|
-
return fromEnsNameToAddress$1.fromEnsNameToAddress(address);
|
|
12687
|
+
_context19.next = 18;
|
|
12688
|
+
return fromEnsNameToAddress(address);
|
|
12924
12689
|
|
|
12925
|
-
case
|
|
12926
|
-
address =
|
|
12690
|
+
case 18:
|
|
12691
|
+
address = _context19.sent;
|
|
12692
|
+
|
|
12693
|
+
case 19:
|
|
12927
12694
|
if (address) {
|
|
12928
|
-
|
|
12695
|
+
_context19.next = 21;
|
|
12929
12696
|
break;
|
|
12930
12697
|
}
|
|
12931
|
-
return
|
|
12698
|
+
return _context19.abrupt("return", "".concat(address).concat(ERROR_MESSAGES_FLAG.INVALID_PARAM));
|
|
12932
12699
|
|
|
12933
|
-
case
|
|
12700
|
+
case 21:
|
|
12934
12701
|
url = "https://api.safe.global/tx-service/".concat(chainIdentifier, "/api/v2/safes/").concat(address, "/multisig-transactions?limit=").concat(limit, "&offset=").concat(offset);
|
|
12935
|
-
|
|
12936
|
-
|
|
12702
|
+
_context19.prev = 22;
|
|
12703
|
+
_context19.next = 25;
|
|
12937
12704
|
return fetch(url, {
|
|
12938
12705
|
headers: {
|
|
12939
12706
|
Authorization: "Bearer ".concat(apiKey)
|
|
12940
12707
|
}
|
|
12941
12708
|
});
|
|
12942
12709
|
|
|
12943
|
-
case
|
|
12944
|
-
response =
|
|
12710
|
+
case 25:
|
|
12711
|
+
response = _context19.sent;
|
|
12945
12712
|
if (response.ok) {
|
|
12946
|
-
|
|
12713
|
+
_context19.next = 28;
|
|
12947
12714
|
break;
|
|
12948
12715
|
}
|
|
12949
|
-
|
|
12716
|
+
throw new Error("HTTP error! Status: ".concat(response.status));
|
|
12950
12717
|
|
|
12951
|
-
case
|
|
12952
|
-
|
|
12718
|
+
case 28:
|
|
12719
|
+
_context19.next = 30;
|
|
12953
12720
|
return response.json();
|
|
12954
12721
|
|
|
12955
|
-
case
|
|
12956
|
-
json =
|
|
12722
|
+
case 30:
|
|
12723
|
+
json = _context19.sent;
|
|
12957
12724
|
if (Array.isArray(json.results)) {
|
|
12958
|
-
|
|
12725
|
+
_context19.next = 33;
|
|
12959
12726
|
break;
|
|
12960
12727
|
}
|
|
12961
|
-
return
|
|
12962
|
-
message: "Invalid API response"
|
|
12963
|
-
}));
|
|
12728
|
+
return _context19.abrupt("return", "INVALID API RESPONSE");
|
|
12964
12729
|
|
|
12965
|
-
case
|
|
12966
|
-
return
|
|
12967
|
-
var confirmations =
|
|
12730
|
+
case 33:
|
|
12731
|
+
return _context19.abrupt("return", json.results.map((function(_ref6) {
|
|
12732
|
+
var confirmations = _ref6.confirmations, dataDecoded = _ref6.dataDecoded, rest = _objectWithoutProperties(_ref6, _excluded);
|
|
12968
12733
|
return rest;
|
|
12969
12734
|
})));
|
|
12970
12735
|
|
|
12971
|
-
case
|
|
12972
|
-
|
|
12973
|
-
|
|
12974
|
-
|
|
12736
|
+
case 36:
|
|
12737
|
+
_context19.prev = 36;
|
|
12738
|
+
_context19.t0 = _context19["catch"](22);
|
|
12739
|
+
console.log(_context19.t0);
|
|
12740
|
+
return _context19.abrupt("return", "ERROR IN FETCHING");
|
|
12975
12741
|
|
|
12976
|
-
case
|
|
12742
|
+
case 40:
|
|
12977
12743
|
case "end":
|
|
12978
|
-
return
|
|
12744
|
+
return _context19.stop();
|
|
12979
12745
|
}
|
|
12980
|
-
}),
|
|
12746
|
+
}), _callee16, null, [ [ 22, 36 ] ]);
|
|
12981
12747
|
})));
|
|
12982
12748
|
return _SAFE.apply(this, arguments);
|
|
12983
12749
|
}
|
|
@@ -12985,96 +12751,78 @@ function _typeof(o) {
|
|
|
12985
12751
|
return _DEFILLAMA.apply(this, arguments);
|
|
12986
12752
|
}
|
|
12987
12753
|
function _DEFILLAMA() {
|
|
12988
|
-
_DEFILLAMA = _asyncToGenerator(_regeneratorRuntime().mark((function
|
|
12989
|
-
var
|
|
12990
|
-
return _regeneratorRuntime().wrap((function
|
|
12991
|
-
while (1) switch (
|
|
12754
|
+
_DEFILLAMA = _asyncToGenerator(_regeneratorRuntime().mark((function _callee17() {
|
|
12755
|
+
var _argsToArray19, _argsToArray20, category, apiKey, categoryList, categoryMap, url, response, json, _args20 = arguments;
|
|
12756
|
+
return _regeneratorRuntime().wrap((function _callee17$(_context20) {
|
|
12757
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
12992
12758
|
case 0:
|
|
12993
|
-
|
|
12994
|
-
category =
|
|
12995
|
-
|
|
12996
|
-
category: category
|
|
12997
|
-
});
|
|
12998
|
-
if (!missingParamsError) {
|
|
12999
|
-
_context19.next = 4;
|
|
13000
|
-
break;
|
|
13001
|
-
}
|
|
13002
|
-
return _context19.abrupt("return", missingParamsError);
|
|
13003
|
-
|
|
13004
|
-
case 4:
|
|
13005
|
-
apiKey = window.localStorage.getItem(SERVICES_API_KEY.Defillama);
|
|
12759
|
+
_argsToArray19 = argsToArray(_args20), _argsToArray20 = _slicedToArray(_argsToArray19, 1),
|
|
12760
|
+
category = _argsToArray20[0];
|
|
12761
|
+
apiKey = window.localStorage.getItem(SERVICE_API_KEY.Defillama);
|
|
13006
12762
|
if (apiKey) {
|
|
13007
|
-
|
|
12763
|
+
_context20.next = 4;
|
|
13008
12764
|
break;
|
|
13009
12765
|
}
|
|
13010
|
-
return
|
|
12766
|
+
return _context20.abrupt("return", "".concat(SERVICE_API_KEY.Defillama).concat(ERROR_MESSAGES_FLAG.MISSING_KEY));
|
|
13011
12767
|
|
|
13012
|
-
case
|
|
12768
|
+
case 4:
|
|
13013
12769
|
categoryList = [ "protocols", "yields", "dex", "fees" ];
|
|
13014
12770
|
categoryMap = _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, categoryList[0], "https://api.llama.fi/protocols"), categoryList[1], "https://yields.llama.fi/pools"), categoryList[2], "https://api.llama.fi/overview/dexs?excludeTotalDataChart=true&excludeTotalDataChartBreakdown=true"), categoryList[3], "https://api.llama.fi/overview/fees?excludeTotalDataChart=true&excludeTotalDataChartBreakdown=true&dataType=dailyFees");
|
|
13015
12771
|
url = categoryMap[category];
|
|
13016
|
-
|
|
13017
|
-
|
|
13018
|
-
break;
|
|
13019
|
-
}
|
|
13020
|
-
return _context19.abrupt("return", errorMessageHandler(ERROR_MESSAGES_FLAG.INVALID_PARAM, {
|
|
13021
|
-
category: category
|
|
13022
|
-
}));
|
|
13023
|
-
|
|
13024
|
-
case 12:
|
|
13025
|
-
_context19.prev = 12;
|
|
13026
|
-
_context19.next = 15;
|
|
12772
|
+
_context20.prev = 7;
|
|
12773
|
+
_context20.next = 10;
|
|
13027
12774
|
return fetch(url);
|
|
13028
12775
|
|
|
13029
|
-
case
|
|
13030
|
-
response =
|
|
12776
|
+
case 10:
|
|
12777
|
+
response = _context20.sent;
|
|
13031
12778
|
if (response.ok) {
|
|
13032
|
-
|
|
12779
|
+
_context20.next = 13;
|
|
13033
12780
|
break;
|
|
13034
12781
|
}
|
|
13035
|
-
|
|
12782
|
+
throw new Error("HTTP error! Status: ".concat(response.status));
|
|
13036
12783
|
|
|
13037
|
-
case
|
|
13038
|
-
|
|
12784
|
+
case 13:
|
|
12785
|
+
_context20.next = 15;
|
|
13039
12786
|
return response.json();
|
|
13040
12787
|
|
|
13041
|
-
case
|
|
13042
|
-
json =
|
|
13043
|
-
|
|
13044
|
-
|
|
12788
|
+
case 15:
|
|
12789
|
+
json = _context20.sent;
|
|
12790
|
+
_context20.t0 = category;
|
|
12791
|
+
_context20.next = _context20.t0 === categoryList[0] ? 19 : _context20.t0 === categoryList[1] ? 21 : _context20.t0 === categoryList[2] ? 23 : _context20.t0 === categoryList[3] ? 25 : 27;
|
|
13045
12792
|
break;
|
|
13046
12793
|
|
|
13047
|
-
case
|
|
12794
|
+
case 19:
|
|
13048
12795
|
if (json.length > 500) {
|
|
13049
12796
|
json = json.slice(0, 500);
|
|
13050
12797
|
}
|
|
13051
|
-
return
|
|
12798
|
+
return _context20.abrupt("break", 27);
|
|
13052
12799
|
|
|
13053
|
-
case
|
|
12800
|
+
case 21:
|
|
13054
12801
|
json = json.data.slice(0, 500);
|
|
13055
|
-
return
|
|
12802
|
+
return _context20.abrupt("break", 27);
|
|
13056
12803
|
|
|
13057
|
-
case
|
|
12804
|
+
case 23:
|
|
13058
12805
|
json = json.protocols.slice(0, 500);
|
|
13059
|
-
return
|
|
12806
|
+
return _context20.abrupt("break", 27);
|
|
13060
12807
|
|
|
13061
|
-
case
|
|
12808
|
+
case 25:
|
|
13062
12809
|
json = json.protocols.slice(0, 500);
|
|
13063
|
-
return
|
|
12810
|
+
return _context20.abrupt("break", 27);
|
|
13064
12811
|
|
|
13065
|
-
case
|
|
13066
|
-
return
|
|
12812
|
+
case 27:
|
|
12813
|
+
return _context20.abrupt("return", removeNestedStructure(Array.isArray(json) ? json : [ json ]));
|
|
13067
12814
|
|
|
13068
|
-
case
|
|
13069
|
-
|
|
13070
|
-
|
|
13071
|
-
|
|
12815
|
+
case 30:
|
|
12816
|
+
_context20.prev = 30;
|
|
12817
|
+
_context20.t1 = _context20["catch"](7);
|
|
12818
|
+
console.log(_context20.t1);
|
|
12819
|
+
return _context20.abrupt("return", "ERROR IN FETCHING");
|
|
13072
12820
|
|
|
13073
|
-
case
|
|
12821
|
+
case 34:
|
|
13074
12822
|
case "end":
|
|
13075
|
-
return
|
|
12823
|
+
return _context20.stop();
|
|
13076
12824
|
}
|
|
13077
|
-
}),
|
|
12825
|
+
}), _callee17, null, [ [ 7, 30 ] ]);
|
|
13078
12826
|
})));
|
|
13079
12827
|
return _DEFILLAMA.apply(this, arguments);
|
|
13080
12828
|
}
|
|
@@ -13082,69 +12830,47 @@ function _typeof(o) {
|
|
|
13082
12830
|
return _UNISWAP.apply(this, arguments);
|
|
13083
12831
|
}
|
|
13084
12832
|
function _UNISWAP() {
|
|
13085
|
-
_UNISWAP = _asyncToGenerator(_regeneratorRuntime().mark((function
|
|
13086
|
-
var
|
|
13087
|
-
return _regeneratorRuntime().wrap((function
|
|
13088
|
-
while (1) switch (
|
|
12833
|
+
_UNISWAP = _asyncToGenerator(_regeneratorRuntime().mark((function _callee18() {
|
|
12834
|
+
var _argsToArray21, _argsToArray22, graphType, category, param1, param2, baseUrl, url, res, json, _args21 = arguments;
|
|
12835
|
+
return _regeneratorRuntime().wrap((function _callee18$(_context21) {
|
|
12836
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
13089
12837
|
case 0:
|
|
13090
|
-
|
|
13091
|
-
graphType =
|
|
13092
|
-
param2 =
|
|
13093
|
-
missingParamsError = checkRequiredParams({
|
|
13094
|
-
graphType: graphType,
|
|
13095
|
-
category: category,
|
|
13096
|
-
param1: param1
|
|
13097
|
-
});
|
|
13098
|
-
if (!missingParamsError) {
|
|
13099
|
-
_context20.next = 4;
|
|
13100
|
-
break;
|
|
13101
|
-
}
|
|
13102
|
-
return _context20.abrupt("return", missingParamsError);
|
|
13103
|
-
|
|
13104
|
-
case 4:
|
|
12838
|
+
_argsToArray21 = argsToArray(_args21), _argsToArray22 = _slicedToArray(_argsToArray21, 4),
|
|
12839
|
+
graphType = _argsToArray22[0], category = _argsToArray22[1], param1 = _argsToArray22[2],
|
|
12840
|
+
param2 = _argsToArray22[3];
|
|
13105
12841
|
baseUrl = "https://onchain-proxy.fileverse.io/third-party";
|
|
13106
|
-
|
|
12842
|
+
_context21.prev = 2;
|
|
13107
12843
|
url = "".concat(baseUrl, "?service=uniswap&graphType=").concat(graphType, "&category=").concat(category, "&input1=").concat(param1, "&input2=").concat(param2);
|
|
13108
|
-
|
|
12844
|
+
_context21.next = 6;
|
|
13109
12845
|
return fetch(url);
|
|
13110
12846
|
|
|
13111
|
-
case
|
|
13112
|
-
res =
|
|
12847
|
+
case 6:
|
|
12848
|
+
res = _context21.sent;
|
|
13113
12849
|
if (res.ok) {
|
|
13114
|
-
|
|
12850
|
+
_context21.next = 9;
|
|
13115
12851
|
break;
|
|
13116
12852
|
}
|
|
13117
|
-
|
|
12853
|
+
throw new Error("HTTP ".concat(res.status));
|
|
13118
12854
|
|
|
13119
|
-
case
|
|
13120
|
-
|
|
12855
|
+
case 9:
|
|
12856
|
+
_context21.next = 11;
|
|
13121
12857
|
return res.json();
|
|
13122
12858
|
|
|
13123
|
-
case
|
|
13124
|
-
json =
|
|
13125
|
-
|
|
13126
|
-
_context20.next = 19;
|
|
13127
|
-
break;
|
|
13128
|
-
}
|
|
13129
|
-
return _context20.abrupt("return", removeNestedStructure(json));
|
|
13130
|
-
|
|
13131
|
-
case 19:
|
|
13132
|
-
return _context20.abrupt("return", json);
|
|
13133
|
-
|
|
13134
|
-
case 20:
|
|
13135
|
-
_context20.next = 25;
|
|
13136
|
-
break;
|
|
12859
|
+
case 11:
|
|
12860
|
+
json = _context21.sent;
|
|
12861
|
+
return _context21.abrupt("return", removeNestedStructure(json));
|
|
13137
12862
|
|
|
13138
|
-
case
|
|
13139
|
-
|
|
13140
|
-
|
|
13141
|
-
|
|
12863
|
+
case 15:
|
|
12864
|
+
_context21.prev = 15;
|
|
12865
|
+
_context21.t0 = _context21["catch"](2);
|
|
12866
|
+
console.error("UNISWAP fetch error:", _context21.t0);
|
|
12867
|
+
return _context21.abrupt("return", ERROR_MESSAGES_FLAG.DEFAULT);
|
|
13142
12868
|
|
|
13143
|
-
case
|
|
12869
|
+
case 19:
|
|
13144
12870
|
case "end":
|
|
13145
|
-
return
|
|
12871
|
+
return _context21.stop();
|
|
13146
12872
|
}
|
|
13147
|
-
}),
|
|
12873
|
+
}), _callee18, null, [ [ 2, 15 ] ]);
|
|
13148
12874
|
})));
|
|
13149
12875
|
return _UNISWAP.apply(this, arguments);
|
|
13150
12876
|
}
|
|
@@ -13152,69 +12878,47 @@ function _typeof(o) {
|
|
|
13152
12878
|
return _AAVE.apply(this, arguments);
|
|
13153
12879
|
}
|
|
13154
12880
|
function _AAVE() {
|
|
13155
|
-
_AAVE = _asyncToGenerator(_regeneratorRuntime().mark((function
|
|
13156
|
-
var
|
|
13157
|
-
return _regeneratorRuntime().wrap((function
|
|
13158
|
-
while (1) switch (
|
|
12881
|
+
_AAVE = _asyncToGenerator(_regeneratorRuntime().mark((function _callee19() {
|
|
12882
|
+
var _argsToArray23, _argsToArray24, graphType, category, param1, param2, baseUrl, url, res, json, _args22 = arguments;
|
|
12883
|
+
return _regeneratorRuntime().wrap((function _callee19$(_context22) {
|
|
12884
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
13159
12885
|
case 0:
|
|
13160
|
-
|
|
13161
|
-
graphType =
|
|
13162
|
-
param2 =
|
|
13163
|
-
missingParamsError = checkRequiredParams({
|
|
13164
|
-
graphType: graphType,
|
|
13165
|
-
category: category,
|
|
13166
|
-
param1: param1
|
|
13167
|
-
});
|
|
13168
|
-
if (!missingParamsError) {
|
|
13169
|
-
_context21.next = 4;
|
|
13170
|
-
break;
|
|
13171
|
-
}
|
|
13172
|
-
return _context21.abrupt("return", missingParamsError);
|
|
13173
|
-
|
|
13174
|
-
case 4:
|
|
12886
|
+
_argsToArray23 = argsToArray(_args22), _argsToArray24 = _slicedToArray(_argsToArray23, 4),
|
|
12887
|
+
graphType = _argsToArray24[0], category = _argsToArray24[1], param1 = _argsToArray24[2],
|
|
12888
|
+
param2 = _argsToArray24[3];
|
|
13175
12889
|
baseUrl = "https://onchain-proxy.fileverse.io/third-party";
|
|
13176
|
-
|
|
12890
|
+
_context22.prev = 2;
|
|
13177
12891
|
url = "".concat(baseUrl, "?service=aave&graphType=").concat(graphType, "&category=").concat(category, "&input1=").concat(param1, "&input2=").concat(param2);
|
|
13178
|
-
|
|
12892
|
+
_context22.next = 6;
|
|
13179
12893
|
return fetch(url);
|
|
13180
12894
|
|
|
13181
|
-
case
|
|
13182
|
-
res =
|
|
12895
|
+
case 6:
|
|
12896
|
+
res = _context22.sent;
|
|
13183
12897
|
if (res.ok) {
|
|
13184
|
-
|
|
12898
|
+
_context22.next = 9;
|
|
13185
12899
|
break;
|
|
13186
12900
|
}
|
|
13187
|
-
|
|
12901
|
+
throw new Error("HTTP ".concat(res.status));
|
|
13188
12902
|
|
|
13189
|
-
case
|
|
13190
|
-
|
|
12903
|
+
case 9:
|
|
12904
|
+
_context22.next = 11;
|
|
13191
12905
|
return res.json();
|
|
13192
12906
|
|
|
13193
|
-
case
|
|
13194
|
-
json =
|
|
13195
|
-
|
|
13196
|
-
_context21.next = 19;
|
|
13197
|
-
break;
|
|
13198
|
-
}
|
|
13199
|
-
return _context21.abrupt("return", removeNestedStructure(json));
|
|
13200
|
-
|
|
13201
|
-
case 19:
|
|
13202
|
-
return _context21.abrupt("return", json);
|
|
13203
|
-
|
|
13204
|
-
case 20:
|
|
13205
|
-
_context21.next = 25;
|
|
13206
|
-
break;
|
|
12907
|
+
case 11:
|
|
12908
|
+
json = _context22.sent;
|
|
12909
|
+
return _context22.abrupt("return", removeNestedStructure(json));
|
|
13207
12910
|
|
|
13208
|
-
case
|
|
13209
|
-
|
|
13210
|
-
|
|
13211
|
-
|
|
12911
|
+
case 15:
|
|
12912
|
+
_context22.prev = 15;
|
|
12913
|
+
_context22.t0 = _context22["catch"](2);
|
|
12914
|
+
console.error("AAVE fetch error:", _context22.t0);
|
|
12915
|
+
return _context22.abrupt("return", ERROR_MESSAGES_FLAG.DEFAULT);
|
|
13212
12916
|
|
|
13213
|
-
case
|
|
12917
|
+
case 19:
|
|
13214
12918
|
case "end":
|
|
13215
|
-
return
|
|
12919
|
+
return _context22.stop();
|
|
13216
12920
|
}
|
|
13217
|
-
}),
|
|
12921
|
+
}), _callee19, null, [ [ 2, 15 ] ]);
|
|
13218
12922
|
})));
|
|
13219
12923
|
return _AAVE.apply(this, arguments);
|
|
13220
12924
|
}
|
|
@@ -13407,6 +13111,7 @@ function _typeof(o) {
|
|
|
13407
13111
|
exports.GEOMEAN = GEOMEAN;
|
|
13408
13112
|
exports.GESTEP = GESTEP;
|
|
13409
13113
|
exports.GNOSIS = GNOSIS;
|
|
13114
|
+
exports.GNOSISPAY = GNOSISPAY;
|
|
13410
13115
|
exports.GROWTH = GROWTH;
|
|
13411
13116
|
exports.HARMEAN = HARMEAN;
|
|
13412
13117
|
exports.HEX2BIN = HEX2BIN;
|
|
@@ -13491,6 +13196,7 @@ function _typeof(o) {
|
|
|
13491
13196
|
exports.MIN = MIN;
|
|
13492
13197
|
exports.MINA = MINA;
|
|
13493
13198
|
exports.MINIFS = MINIFS;
|
|
13199
|
+
exports.MINUS = MINUS$1;
|
|
13494
13200
|
exports.MINUTE = MINUTE;
|
|
13495
13201
|
exports.MIRR = MIRR;
|
|
13496
13202
|
exports.MMULT = MMULT;
|