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