@fileverse-dev/formulajs 4.4.11-mod-46 → 4.4.11-mod-48
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 +307 -260
- package/lib/browser/formula.min.js +2 -2
- package/lib/browser/formula.min.js.map +1 -1
- package/lib/cjs/index.cjs +63 -51
- package/lib/esm/crypto-constants.mjs +7 -6
- package/lib/esm/index.mjs +63 -51
- package/package.json +1 -1
package/lib/browser/formula.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* @fileverse-dev/formulajs v4.4.11-mod-
|
|
1
|
+
/* @fileverse-dev/formulajs v4.4.11-mod-48 */
|
|
2
2
|
var _excluded = [ "confirmations", "dataDecoded" ];
|
|
3
3
|
|
|
4
4
|
function _objectWithoutProperties(e, t) {
|
|
@@ -21,6 +21,52 @@ function _objectWithoutPropertiesLoose(r, e) {
|
|
|
21
21
|
return t;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
+
function _createForOfIteratorHelper(r, e) {
|
|
25
|
+
var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
26
|
+
if (!t) {
|
|
27
|
+
if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) {
|
|
28
|
+
t && (r = t);
|
|
29
|
+
var _n = 0, F = function F() {};
|
|
30
|
+
return {
|
|
31
|
+
s: F,
|
|
32
|
+
n: function n() {
|
|
33
|
+
return _n >= r.length ? {
|
|
34
|
+
done: !0
|
|
35
|
+
} : {
|
|
36
|
+
done: !1,
|
|
37
|
+
value: r[_n++]
|
|
38
|
+
};
|
|
39
|
+
},
|
|
40
|
+
e: function e(r) {
|
|
41
|
+
throw r;
|
|
42
|
+
},
|
|
43
|
+
f: F
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
47
|
+
}
|
|
48
|
+
var o, a = !0, u = !1;
|
|
49
|
+
return {
|
|
50
|
+
s: function s() {
|
|
51
|
+
t = t.call(r);
|
|
52
|
+
},
|
|
53
|
+
n: function n() {
|
|
54
|
+
var r = t.next();
|
|
55
|
+
return a = r.done, r;
|
|
56
|
+
},
|
|
57
|
+
e: function e(r) {
|
|
58
|
+
u = !0, o = r;
|
|
59
|
+
},
|
|
60
|
+
f: function f() {
|
|
61
|
+
try {
|
|
62
|
+
a || null == t["return"] || t["return"]();
|
|
63
|
+
} finally {
|
|
64
|
+
if (u) throw o;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
|
|
24
70
|
function ownKeys(e, r) {
|
|
25
71
|
var t = Object.keys(e);
|
|
26
72
|
if (Object.getOwnPropertySymbols) {
|
|
@@ -69,52 +115,6 @@ function _toPrimitive(t, r) {
|
|
|
69
115
|
return ("string" === r ? String : Number)(t);
|
|
70
116
|
}
|
|
71
117
|
|
|
72
|
-
function _createForOfIteratorHelper(r, e) {
|
|
73
|
-
var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
74
|
-
if (!t) {
|
|
75
|
-
if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) {
|
|
76
|
-
t && (r = t);
|
|
77
|
-
var _n = 0, F = function F() {};
|
|
78
|
-
return {
|
|
79
|
-
s: F,
|
|
80
|
-
n: function n() {
|
|
81
|
-
return _n >= r.length ? {
|
|
82
|
-
done: !0
|
|
83
|
-
} : {
|
|
84
|
-
done: !1,
|
|
85
|
-
value: r[_n++]
|
|
86
|
-
};
|
|
87
|
-
},
|
|
88
|
-
e: function e(r) {
|
|
89
|
-
throw r;
|
|
90
|
-
},
|
|
91
|
-
f: F
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
95
|
-
}
|
|
96
|
-
var o, a = !0, u = !1;
|
|
97
|
-
return {
|
|
98
|
-
s: function s() {
|
|
99
|
-
t = t.call(r);
|
|
100
|
-
},
|
|
101
|
-
n: function n() {
|
|
102
|
-
var r = t.next();
|
|
103
|
-
return a = r.done, r;
|
|
104
|
-
},
|
|
105
|
-
e: function e(r) {
|
|
106
|
-
u = !0, o = r;
|
|
107
|
-
},
|
|
108
|
-
f: function f() {
|
|
109
|
-
try {
|
|
110
|
-
a || null == t["return"] || t["return"]();
|
|
111
|
-
} finally {
|
|
112
|
-
if (u) throw o;
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
|
-
|
|
118
118
|
function _regeneratorRuntime() {
|
|
119
119
|
"use strict";
|
|
120
120
|
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() {
|
|
@@ -10945,7 +10945,8 @@ function _typeof(o) {
|
|
|
10945
10945
|
Firefly: "FIRE_FLY_API_KEY",
|
|
10946
10946
|
GnosisPay: "GNOSIS_API_KEY",
|
|
10947
10947
|
Neynar: "NEYNAR_API_KEY",
|
|
10948
|
-
Defillama: "DEFILLAMA_API_KEY"
|
|
10948
|
+
Defillama: "DEFILLAMA_API_KEY",
|
|
10949
|
+
Uniswap: "UNISWAP_API_KEY"
|
|
10949
10950
|
};
|
|
10950
10951
|
var fromTimeStampToBlock = function() {
|
|
10951
10952
|
var _ref = _asyncToGenerator(_regeneratorRuntime().mark((function _callee(timestamp, chain, apiKey) {
|
|
@@ -11200,7 +11201,7 @@ function _typeof(o) {
|
|
|
11200
11201
|
return _handleScanRequest.apply(this, arguments);
|
|
11201
11202
|
}
|
|
11202
11203
|
var fromUsernameToFid = function() {
|
|
11203
|
-
var _ref3 = _asyncToGenerator(_regeneratorRuntime().mark((function _callee2(username) {
|
|
11204
|
+
var _ref3 = _asyncToGenerator(_regeneratorRuntime().mark((function _callee2(username, apiKey) {
|
|
11204
11205
|
var url, res, json, users, user;
|
|
11205
11206
|
return _regeneratorRuntime().wrap((function _callee2$(_context2) {
|
|
11206
11207
|
while (1) switch (_context2.prev = _context2.next) {
|
|
@@ -11212,12 +11213,9 @@ function _typeof(o) {
|
|
|
11212
11213
|
return _context2.abrupt("return", null);
|
|
11213
11214
|
|
|
11214
11215
|
case 2:
|
|
11215
|
-
url = "https://api.neynar.com/v2/farcaster/user/search
|
|
11216
|
+
url = "https://api.neynar.com/v2/farcaster/user/search/?q=".concat(username, "&limit=5");
|
|
11216
11217
|
_context2.next = 5;
|
|
11217
11218
|
return fetch(url, {
|
|
11218
|
-
query: {
|
|
11219
|
-
q: username
|
|
11220
|
-
},
|
|
11221
11219
|
headers: {
|
|
11222
11220
|
"x-api-key": API_KEY,
|
|
11223
11221
|
"x-neynar-experimental": "false"
|
|
@@ -11243,7 +11241,7 @@ function _typeof(o) {
|
|
|
11243
11241
|
}
|
|
11244
11242
|
}), _callee2);
|
|
11245
11243
|
})));
|
|
11246
|
-
return function fromUsernameToFid(_x6) {
|
|
11244
|
+
return function fromUsernameToFid(_x6, _x7) {
|
|
11247
11245
|
return _ref3.apply(this, arguments);
|
|
11248
11246
|
};
|
|
11249
11247
|
}();
|
|
@@ -11445,7 +11443,7 @@ function _typeof(o) {
|
|
|
11445
11443
|
flat[key] = _value7;
|
|
11446
11444
|
}
|
|
11447
11445
|
}
|
|
11448
|
-
flat.platform =
|
|
11446
|
+
flat.platform = "lens";
|
|
11449
11447
|
return flat;
|
|
11450
11448
|
})));
|
|
11451
11449
|
|
|
@@ -11544,7 +11542,7 @@ function _typeof(o) {
|
|
|
11544
11542
|
flat[key] = _value8;
|
|
11545
11543
|
}
|
|
11546
11544
|
}
|
|
11547
|
-
flat.platform =
|
|
11545
|
+
flat.platform = "farcaster";
|
|
11548
11546
|
return flat;
|
|
11549
11547
|
})));
|
|
11550
11548
|
|
|
@@ -11817,7 +11815,7 @@ function _typeof(o) {
|
|
|
11817
11815
|
})));
|
|
11818
11816
|
return _NEYNAR.apply(this, arguments);
|
|
11819
11817
|
}
|
|
11820
|
-
function GNOSISPAY(
|
|
11818
|
+
function GNOSISPAY(_x8) {
|
|
11821
11819
|
return _GNOSISPAY.apply(this, arguments);
|
|
11822
11820
|
}
|
|
11823
11821
|
function _GNOSISPAY() {
|
|
@@ -11949,12 +11947,12 @@ function _typeof(o) {
|
|
|
11949
11947
|
})));
|
|
11950
11948
|
return _ETHERSCAN.apply(this, arguments);
|
|
11951
11949
|
}
|
|
11952
|
-
function COINGECKO(
|
|
11950
|
+
function COINGECKO(_x9, _x0, _x1) {
|
|
11953
11951
|
return _COINGECKO.apply(this, arguments);
|
|
11954
11952
|
}
|
|
11955
11953
|
function _COINGECKO() {
|
|
11956
11954
|
_COINGECKO = _asyncToGenerator(_regeneratorRuntime().mark((function _callee11(category, param1, param2) {
|
|
11957
|
-
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, flatArray;
|
|
11955
|
+
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;
|
|
11958
11956
|
return _regeneratorRuntime().wrap((function _callee11$(_context11) {
|
|
11959
11957
|
while (1) switch (_context11.prev = _context11.next) {
|
|
11960
11958
|
case 0:
|
|
@@ -12092,8 +12090,22 @@ function _typeof(o) {
|
|
|
12092
12090
|
if (json.length > 200) {
|
|
12093
12091
|
_data = json.slice(0, 200);
|
|
12094
12092
|
}
|
|
12095
|
-
if (
|
|
12096
|
-
|
|
12093
|
+
if (param1 !== "all" && json && json.tickers) {
|
|
12094
|
+
exchangeDetails = {
|
|
12095
|
+
exchange_id: param1,
|
|
12096
|
+
exchange_name: json.name,
|
|
12097
|
+
exchange_logo: json.logo,
|
|
12098
|
+
exchange_url: json.url,
|
|
12099
|
+
exchange_trade_volume_24h_btc: json.trade_volume_24h_btc,
|
|
12100
|
+
exchange_number_of_futures_pairs: json.number_of_futures_pairs,
|
|
12101
|
+
exchange_number_of_perpetual_pairs: json.number_of_perpetual_pairs,
|
|
12102
|
+
exchange_open_interest_btc: json.open_interest_btc
|
|
12103
|
+
};
|
|
12104
|
+
_data = json.tickers.slice(0, 200).map((function(item) {
|
|
12105
|
+
return _objectSpread(_objectSpread(_objectSpread({}, item), exchangeDetails), {}, {
|
|
12106
|
+
usd_volume: item.converted_volume && item.converted_volume.usd
|
|
12107
|
+
});
|
|
12108
|
+
}));
|
|
12097
12109
|
}
|
|
12098
12110
|
}
|
|
12099
12111
|
flatArray = Array.isArray(_data) ? _data : [ _data ];
|
|
@@ -12127,82 +12139,82 @@ function _typeof(o) {
|
|
|
12127
12139
|
}
|
|
12128
12140
|
function _EOA() {
|
|
12129
12141
|
_EOA = _asyncToGenerator(_regeneratorRuntime().mark((function _callee13() {
|
|
12130
|
-
var API_KEY, _argsToArray13, _argsToArray14, addresses, category, chains, startTime, endTime, _argsToArray14$, page, _argsToArray14$2, offset, INPUTS, CHAINS, out, ADDRESS_MAP, _iterator, _step, input, resolved, ADDRS, _iterator2, _step2, _loop, _ret, fetchJSON, _fetchJSON,
|
|
12131
|
-
return _regeneratorRuntime().wrap((function _callee13$(
|
|
12132
|
-
while (1) switch (
|
|
12142
|
+
var API_KEY, _argsToArray13, _argsToArray14, addresses, category, chains, startTime, endTime, _argsToArray14$, page, _argsToArray14$2, offset, INPUTS, CHAINS, out, ADDRESS_MAP, _iterator, _step, input, resolved, ADDRS, _iterator2, _step2, _loop, _ret, fetchJSON, _fetchJSON, _args16 = arguments;
|
|
12143
|
+
return _regeneratorRuntime().wrap((function _callee13$(_context16) {
|
|
12144
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
12133
12145
|
case 0:
|
|
12134
12146
|
_fetchJSON = function _fetchJSON3() {
|
|
12135
12147
|
_fetchJSON = _asyncToGenerator(_regeneratorRuntime().mark((function _callee12(url) {
|
|
12136
12148
|
var _json$result3, _json$result3$include, _json$result4, _json$result4$include, res, json;
|
|
12137
|
-
return _regeneratorRuntime().wrap((function _callee12$(
|
|
12138
|
-
while (1) switch (
|
|
12149
|
+
return _regeneratorRuntime().wrap((function _callee12$(_context15) {
|
|
12150
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
12139
12151
|
case 0:
|
|
12140
|
-
|
|
12141
|
-
|
|
12152
|
+
_context15.prev = 0;
|
|
12153
|
+
_context15.next = 3;
|
|
12142
12154
|
return fetch(url);
|
|
12143
12155
|
|
|
12144
12156
|
case 3:
|
|
12145
|
-
res =
|
|
12157
|
+
res = _context15.sent;
|
|
12146
12158
|
if (res.ok) {
|
|
12147
|
-
|
|
12159
|
+
_context15.next = 6;
|
|
12148
12160
|
break;
|
|
12149
12161
|
}
|
|
12150
|
-
return
|
|
12162
|
+
return _context15.abrupt("return", "HTTP_".concat(res.status));
|
|
12151
12163
|
|
|
12152
12164
|
case 6:
|
|
12153
|
-
|
|
12165
|
+
_context15.next = 8;
|
|
12154
12166
|
return res.json();
|
|
12155
12167
|
|
|
12156
12168
|
case 8:
|
|
12157
|
-
json =
|
|
12169
|
+
json = _context15.sent;
|
|
12158
12170
|
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"))) {
|
|
12159
|
-
|
|
12171
|
+
_context15.next = 11;
|
|
12160
12172
|
break;
|
|
12161
12173
|
}
|
|
12162
|
-
return
|
|
12174
|
+
return _context15.abrupt("return", "".concat(SERVICE_API_KEY.Etherscan).concat(ERROR_MESSAGES_FLAG.INVALID_API_KEY));
|
|
12163
12175
|
|
|
12164
12176
|
case 11:
|
|
12165
12177
|
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"))) {
|
|
12166
|
-
|
|
12178
|
+
_context15.next = 13;
|
|
12167
12179
|
break;
|
|
12168
12180
|
}
|
|
12169
|
-
return
|
|
12181
|
+
return _context15.abrupt("return", "".concat(SERVICE_API_KEY.Etherscan).concat(ERROR_MESSAGES_FLAG.RATE_LIMIT));
|
|
12170
12182
|
|
|
12171
12183
|
case 13:
|
|
12172
12184
|
if (!(json.status === "0" && json.message !== "No transactions found")) {
|
|
12173
|
-
|
|
12185
|
+
_context15.next = 15;
|
|
12174
12186
|
break;
|
|
12175
12187
|
}
|
|
12176
|
-
return
|
|
12188
|
+
return _context15.abrupt("return", ERROR_MESSAGES_FLAG.DEFAULT);
|
|
12177
12189
|
|
|
12178
12190
|
case 15:
|
|
12179
|
-
return
|
|
12191
|
+
return _context15.abrupt("return", json.result);
|
|
12180
12192
|
|
|
12181
12193
|
case 18:
|
|
12182
|
-
|
|
12183
|
-
|
|
12184
|
-
return
|
|
12194
|
+
_context15.prev = 18;
|
|
12195
|
+
_context15.t0 = _context15["catch"](0);
|
|
12196
|
+
return _context15.abrupt("return", ERROR_MESSAGES_FLAG.DEFAULT);
|
|
12185
12197
|
|
|
12186
12198
|
case 21:
|
|
12187
12199
|
case "end":
|
|
12188
|
-
return
|
|
12200
|
+
return _context15.stop();
|
|
12189
12201
|
}
|
|
12190
12202
|
}), _callee12, null, [ [ 0, 18 ] ]);
|
|
12191
12203
|
})));
|
|
12192
12204
|
return _fetchJSON.apply(this, arguments);
|
|
12193
12205
|
};
|
|
12194
|
-
fetchJSON = function _fetchJSON2(
|
|
12206
|
+
fetchJSON = function _fetchJSON2(_x12) {
|
|
12195
12207
|
return _fetchJSON.apply(this, arguments);
|
|
12196
12208
|
};
|
|
12197
12209
|
API_KEY = window.localStorage.getItem(SERVICE_API_KEY.Etherscan);
|
|
12198
12210
|
if (API_KEY) {
|
|
12199
|
-
|
|
12211
|
+
_context16.next = 5;
|
|
12200
12212
|
break;
|
|
12201
12213
|
}
|
|
12202
|
-
return
|
|
12214
|
+
return _context16.abrupt("return", "".concat(SERVICE_API_KEY.Etherscan).concat(ERROR_MESSAGES_FLAG.MISSING_KEY));
|
|
12203
12215
|
|
|
12204
12216
|
case 5:
|
|
12205
|
-
_argsToArray13 = argsToArray(
|
|
12217
|
+
_argsToArray13 = argsToArray(_args16), _argsToArray14 = _slicedToArray(_argsToArray13, 7),
|
|
12206
12218
|
addresses = _argsToArray14[0], category = _argsToArray14[1], chains = _argsToArray14[2],
|
|
12207
12219
|
startTime = _argsToArray14[3], endTime = _argsToArray14[4], _argsToArray14$ = _argsToArray14[5],
|
|
12208
12220
|
page = _argsToArray14$ === void 0 ? 1 : _argsToArray14$, _argsToArray14$2 = _argsToArray14[6],
|
|
@@ -12216,153 +12228,176 @@ function _typeof(o) {
|
|
|
12216
12228
|
out = [];
|
|
12217
12229
|
ADDRESS_MAP = {};
|
|
12218
12230
|
_iterator = _createForOfIteratorHelper(INPUTS);
|
|
12219
|
-
|
|
12231
|
+
_context16.prev = 11;
|
|
12220
12232
|
_iterator.s();
|
|
12221
12233
|
|
|
12222
12234
|
case 13:
|
|
12223
12235
|
if ((_step = _iterator.n()).done) {
|
|
12224
|
-
|
|
12236
|
+
_context16.next = 31;
|
|
12225
12237
|
break;
|
|
12226
12238
|
}
|
|
12227
12239
|
input = _step.value;
|
|
12228
12240
|
if (!isAddress(input)) {
|
|
12229
|
-
|
|
12241
|
+
_context16.next = 19;
|
|
12230
12242
|
break;
|
|
12231
12243
|
}
|
|
12232
12244
|
ADDRESS_MAP[input.toLowerCase()] = null;
|
|
12233
|
-
|
|
12245
|
+
_context16.next = 29;
|
|
12234
12246
|
break;
|
|
12235
12247
|
|
|
12236
12248
|
case 19:
|
|
12237
|
-
|
|
12238
|
-
|
|
12249
|
+
_context16.prev = 19;
|
|
12250
|
+
_context16.next = 22;
|
|
12239
12251
|
return fromEnsNameToAddress(input);
|
|
12240
12252
|
|
|
12241
12253
|
case 22:
|
|
12242
|
-
resolved =
|
|
12254
|
+
resolved = _context16.sent;
|
|
12243
12255
|
if (resolved) ADDRESS_MAP[resolved.toLowerCase()] = input;
|
|
12244
|
-
|
|
12256
|
+
_context16.next = 29;
|
|
12245
12257
|
break;
|
|
12246
12258
|
|
|
12247
12259
|
case 26:
|
|
12248
|
-
|
|
12249
|
-
|
|
12250
|
-
return
|
|
12260
|
+
_context16.prev = 26;
|
|
12261
|
+
_context16.t0 = _context16["catch"](19);
|
|
12262
|
+
return _context16.abrupt("return", "".concat(input).concat(ERROR_MESSAGES_FLAG.INVALID_PARAM));
|
|
12251
12263
|
|
|
12252
12264
|
case 29:
|
|
12253
|
-
|
|
12265
|
+
_context16.next = 13;
|
|
12254
12266
|
break;
|
|
12255
12267
|
|
|
12256
12268
|
case 31:
|
|
12257
|
-
|
|
12269
|
+
_context16.next = 36;
|
|
12258
12270
|
break;
|
|
12259
12271
|
|
|
12260
12272
|
case 33:
|
|
12261
|
-
|
|
12262
|
-
|
|
12263
|
-
_iterator.e(
|
|
12273
|
+
_context16.prev = 33;
|
|
12274
|
+
_context16.t1 = _context16["catch"](11);
|
|
12275
|
+
_iterator.e(_context16.t1);
|
|
12264
12276
|
|
|
12265
12277
|
case 36:
|
|
12266
|
-
|
|
12278
|
+
_context16.prev = 36;
|
|
12267
12279
|
_iterator.f();
|
|
12268
|
-
return
|
|
12280
|
+
return _context16.finish(36);
|
|
12269
12281
|
|
|
12270
12282
|
case 39:
|
|
12271
12283
|
ADDRS = Object.keys(ADDRESS_MAP);
|
|
12272
12284
|
_iterator2 = _createForOfIteratorHelper(CHAINS);
|
|
12273
|
-
|
|
12285
|
+
_context16.prev = 41;
|
|
12274
12286
|
_loop = _regeneratorRuntime().mark((function _loop() {
|
|
12275
|
-
var chain, chainId,
|
|
12276
|
-
return _regeneratorRuntime().wrap((function _loop$(
|
|
12277
|
-
while (1) switch (
|
|
12287
|
+
var chain, chainId, _loop2, _ret2, i, startBlock, endBlock, _loop3, _ret3, _i17, _ADDRS;
|
|
12288
|
+
return _regeneratorRuntime().wrap((function _loop$(_context14) {
|
|
12289
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
12278
12290
|
case 0:
|
|
12279
12291
|
chain = _step2.value;
|
|
12280
12292
|
chainId = CHAIN_ID_MAP[chain];
|
|
12281
12293
|
if (chainId) {
|
|
12282
|
-
|
|
12294
|
+
_context14.next = 4;
|
|
12283
12295
|
break;
|
|
12284
12296
|
}
|
|
12285
|
-
return
|
|
12297
|
+
return _context14.abrupt("return", {
|
|
12286
12298
|
v: ERROR_MESSAGES_FLAG.UNSUPPORTED_CHAIN
|
|
12287
12299
|
});
|
|
12288
12300
|
|
|
12289
12301
|
case 4:
|
|
12290
12302
|
if (!(category === "balance")) {
|
|
12291
|
-
|
|
12303
|
+
_context14.next = 16;
|
|
12292
12304
|
break;
|
|
12293
12305
|
}
|
|
12306
|
+
_loop2 = _regeneratorRuntime().mark((function _loop2(i) {
|
|
12307
|
+
var slice, action, url, data;
|
|
12308
|
+
return _regeneratorRuntime().wrap((function _loop2$(_context12) {
|
|
12309
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
12310
|
+
case 0:
|
|
12311
|
+
slice = ADDRS.slice(i, i + 20).join(",");
|
|
12312
|
+
action = "addresstokenbalance";
|
|
12313
|
+
url = "https://api.etherscan.io/v2/api?chainid=".concat(chainId) + "&module=account&action=".concat(action, "&address=").concat(slice) + "&page=".concat(page, "&offset=").concat(offset, "&apikey=").concat(API_KEY);
|
|
12314
|
+
_context12.next = 5;
|
|
12315
|
+
return fetchJSON(url);
|
|
12316
|
+
|
|
12317
|
+
case 5:
|
|
12318
|
+
data = _context12.sent;
|
|
12319
|
+
if (!(typeof data === "string")) {
|
|
12320
|
+
_context12.next = 8;
|
|
12321
|
+
break;
|
|
12322
|
+
}
|
|
12323
|
+
return _context12.abrupt("return", {
|
|
12324
|
+
v: {
|
|
12325
|
+
v: data
|
|
12326
|
+
}
|
|
12327
|
+
});
|
|
12328
|
+
|
|
12329
|
+
case 8:
|
|
12330
|
+
data.forEach((function(tx) {
|
|
12331
|
+
return out.push(_objectSpread({
|
|
12332
|
+
chain: chain,
|
|
12333
|
+
address: ADDRS[i],
|
|
12334
|
+
name: ADDRESS_MAP[ADDRS[i]]
|
|
12335
|
+
}, tx));
|
|
12336
|
+
}));
|
|
12337
|
+
|
|
12338
|
+
case 9:
|
|
12339
|
+
case "end":
|
|
12340
|
+
return _context12.stop();
|
|
12341
|
+
}
|
|
12342
|
+
}), _loop2);
|
|
12343
|
+
}));
|
|
12294
12344
|
i = 0;
|
|
12295
12345
|
|
|
12296
|
-
case
|
|
12346
|
+
case 7:
|
|
12297
12347
|
if (!(i < ADDRS.length)) {
|
|
12298
|
-
|
|
12348
|
+
_context14.next = 15;
|
|
12299
12349
|
break;
|
|
12300
12350
|
}
|
|
12301
|
-
|
|
12302
|
-
action = ADDRS.length > 1 ? "balancemulti" : "balance";
|
|
12303
|
-
url = "https://api.etherscan.io/v2/api?chainid=".concat(chainId) + "&module=account&action=".concat(action, "&address=").concat(slice) + "&tag=latest&apikey=".concat(API_KEY);
|
|
12304
|
-
_context13.next = 12;
|
|
12305
|
-
return fetchJSON(url);
|
|
12351
|
+
return _context14.delegateYield(_loop2(i), "t0", 9);
|
|
12306
12352
|
|
|
12307
|
-
case
|
|
12308
|
-
|
|
12309
|
-
if (!
|
|
12310
|
-
|
|
12353
|
+
case 9:
|
|
12354
|
+
_ret2 = _context14.t0;
|
|
12355
|
+
if (!_ret2) {
|
|
12356
|
+
_context14.next = 12;
|
|
12311
12357
|
break;
|
|
12312
12358
|
}
|
|
12313
|
-
return
|
|
12314
|
-
v: _data2
|
|
12315
|
-
});
|
|
12359
|
+
return _context14.abrupt("return", _ret2.v);
|
|
12316
12360
|
|
|
12317
|
-
case
|
|
12318
|
-
(Array.isArray(_data2) ? _data2 : [ _data2 ]).forEach((function(r) {
|
|
12319
|
-
return out.push(_objectSpread(_objectSpread({
|
|
12320
|
-
chain: chain
|
|
12321
|
-
}, r), {}, {
|
|
12322
|
-
name: ADDRESS_MAP[(r.account || r.address || "").toLowerCase()] || null
|
|
12323
|
-
}));
|
|
12324
|
-
}));
|
|
12325
|
-
|
|
12326
|
-
case 16:
|
|
12361
|
+
case 12:
|
|
12327
12362
|
i += 20;
|
|
12328
|
-
|
|
12363
|
+
_context14.next = 7;
|
|
12329
12364
|
break;
|
|
12330
12365
|
|
|
12331
|
-
case
|
|
12332
|
-
return
|
|
12366
|
+
case 15:
|
|
12367
|
+
return _context14.abrupt("return", 0);
|
|
12333
12368
|
|
|
12334
|
-
case
|
|
12369
|
+
case 16:
|
|
12335
12370
|
if (!(category === "txns")) {
|
|
12336
|
-
|
|
12371
|
+
_context14.next = 34;
|
|
12337
12372
|
break;
|
|
12338
12373
|
}
|
|
12339
|
-
|
|
12374
|
+
_context14.next = 19;
|
|
12340
12375
|
return fromTimeStampToBlock(toTimestamp(startTime), chain, API_KEY);
|
|
12341
12376
|
|
|
12342
|
-
case
|
|
12343
|
-
startBlock =
|
|
12344
|
-
|
|
12377
|
+
case 19:
|
|
12378
|
+
startBlock = _context14.sent;
|
|
12379
|
+
_context14.next = 22;
|
|
12345
12380
|
return fromTimeStampToBlock(toTimestamp(endTime), chain, API_KEY);
|
|
12346
12381
|
|
|
12347
|
-
case
|
|
12348
|
-
endBlock =
|
|
12349
|
-
|
|
12382
|
+
case 22:
|
|
12383
|
+
endBlock = _context14.sent;
|
|
12384
|
+
_loop3 = _regeneratorRuntime().mark((function _loop3() {
|
|
12350
12385
|
var addr, url, data;
|
|
12351
|
-
return _regeneratorRuntime().wrap((function
|
|
12352
|
-
while (1) switch (
|
|
12386
|
+
return _regeneratorRuntime().wrap((function _loop3$(_context13) {
|
|
12387
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
12353
12388
|
case 0:
|
|
12354
12389
|
addr = _ADDRS[_i17];
|
|
12355
12390
|
url = "https://api.etherscan.io/v2/api?chainid=".concat(chainId) + "&module=account&action=txlist&address=".concat(addr) + "&startblock=".concat(startBlock, "&endblock=").concat(endBlock) + "&page=".concat(page, "&offset=").concat(offset, "&sort=asc&apikey=").concat(API_KEY);
|
|
12356
|
-
|
|
12391
|
+
_context13.next = 4;
|
|
12357
12392
|
return fetchJSON(url);
|
|
12358
12393
|
|
|
12359
12394
|
case 4:
|
|
12360
|
-
data =
|
|
12395
|
+
data = _context13.sent;
|
|
12361
12396
|
if (!(typeof data === "string")) {
|
|
12362
|
-
|
|
12397
|
+
_context13.next = 7;
|
|
12363
12398
|
break;
|
|
12364
12399
|
}
|
|
12365
|
-
return
|
|
12400
|
+
return _context13.abrupt("return", {
|
|
12366
12401
|
v: {
|
|
12367
12402
|
v: data
|
|
12368
12403
|
}
|
|
@@ -12379,43 +12414,43 @@ function _typeof(o) {
|
|
|
12379
12414
|
|
|
12380
12415
|
case 8:
|
|
12381
12416
|
case "end":
|
|
12382
|
-
return
|
|
12417
|
+
return _context13.stop();
|
|
12383
12418
|
}
|
|
12384
|
-
}),
|
|
12419
|
+
}), _loop3);
|
|
12385
12420
|
}));
|
|
12386
12421
|
_i17 = 0, _ADDRS = ADDRS;
|
|
12387
12422
|
|
|
12388
|
-
case
|
|
12423
|
+
case 25:
|
|
12389
12424
|
if (!(_i17 < _ADDRS.length)) {
|
|
12390
|
-
|
|
12425
|
+
_context14.next = 33;
|
|
12391
12426
|
break;
|
|
12392
12427
|
}
|
|
12393
|
-
return
|
|
12428
|
+
return _context14.delegateYield(_loop3(), "t1", 27);
|
|
12394
12429
|
|
|
12395
|
-
case
|
|
12396
|
-
|
|
12397
|
-
if (!
|
|
12398
|
-
|
|
12430
|
+
case 27:
|
|
12431
|
+
_ret3 = _context14.t1;
|
|
12432
|
+
if (!_ret3) {
|
|
12433
|
+
_context14.next = 30;
|
|
12399
12434
|
break;
|
|
12400
12435
|
}
|
|
12401
|
-
return
|
|
12436
|
+
return _context14.abrupt("return", _ret3.v);
|
|
12402
12437
|
|
|
12403
|
-
case
|
|
12438
|
+
case 30:
|
|
12404
12439
|
_i17++;
|
|
12405
|
-
|
|
12440
|
+
_context14.next = 25;
|
|
12406
12441
|
break;
|
|
12407
12442
|
|
|
12408
|
-
case
|
|
12409
|
-
return
|
|
12443
|
+
case 33:
|
|
12444
|
+
return _context14.abrupt("return", 0);
|
|
12410
12445
|
|
|
12411
|
-
case
|
|
12412
|
-
return
|
|
12446
|
+
case 34:
|
|
12447
|
+
return _context14.abrupt("return", {
|
|
12413
12448
|
v: ERROR_MESSAGES_FLAG.INVALID_CATEGORY
|
|
12414
12449
|
});
|
|
12415
12450
|
|
|
12416
|
-
case
|
|
12451
|
+
case 35:
|
|
12417
12452
|
case "end":
|
|
12418
|
-
return
|
|
12453
|
+
return _context14.stop();
|
|
12419
12454
|
}
|
|
12420
12455
|
}), _loop);
|
|
12421
12456
|
}));
|
|
@@ -12423,64 +12458,64 @@ function _typeof(o) {
|
|
|
12423
12458
|
|
|
12424
12459
|
case 44:
|
|
12425
12460
|
if ((_step2 = _iterator2.n()).done) {
|
|
12426
|
-
|
|
12461
|
+
_context16.next = 53;
|
|
12427
12462
|
break;
|
|
12428
12463
|
}
|
|
12429
|
-
return
|
|
12464
|
+
return _context16.delegateYield(_loop(), "t2", 46);
|
|
12430
12465
|
|
|
12431
12466
|
case 46:
|
|
12432
|
-
_ret =
|
|
12467
|
+
_ret = _context16.t2;
|
|
12433
12468
|
if (!(_ret === 0)) {
|
|
12434
|
-
|
|
12469
|
+
_context16.next = 49;
|
|
12435
12470
|
break;
|
|
12436
12471
|
}
|
|
12437
|
-
return
|
|
12472
|
+
return _context16.abrupt("continue", 51);
|
|
12438
12473
|
|
|
12439
12474
|
case 49:
|
|
12440
12475
|
if (!_ret) {
|
|
12441
|
-
|
|
12476
|
+
_context16.next = 51;
|
|
12442
12477
|
break;
|
|
12443
12478
|
}
|
|
12444
|
-
return
|
|
12479
|
+
return _context16.abrupt("return", _ret.v);
|
|
12445
12480
|
|
|
12446
12481
|
case 51:
|
|
12447
|
-
|
|
12482
|
+
_context16.next = 44;
|
|
12448
12483
|
break;
|
|
12449
12484
|
|
|
12450
12485
|
case 53:
|
|
12451
|
-
|
|
12486
|
+
_context16.next = 58;
|
|
12452
12487
|
break;
|
|
12453
12488
|
|
|
12454
12489
|
case 55:
|
|
12455
|
-
|
|
12456
|
-
|
|
12457
|
-
_iterator2.e(
|
|
12490
|
+
_context16.prev = 55;
|
|
12491
|
+
_context16.t3 = _context16["catch"](41);
|
|
12492
|
+
_iterator2.e(_context16.t3);
|
|
12458
12493
|
|
|
12459
12494
|
case 58:
|
|
12460
|
-
|
|
12495
|
+
_context16.prev = 58;
|
|
12461
12496
|
_iterator2.f();
|
|
12462
|
-
return
|
|
12497
|
+
return _context16.finish(58);
|
|
12463
12498
|
|
|
12464
12499
|
case 61:
|
|
12465
|
-
return
|
|
12500
|
+
return _context16.abrupt("return", out);
|
|
12466
12501
|
|
|
12467
12502
|
case 62:
|
|
12468
12503
|
case "end":
|
|
12469
|
-
return
|
|
12504
|
+
return _context16.stop();
|
|
12470
12505
|
}
|
|
12471
12506
|
}), _callee13, null, [ [ 11, 33, 36, 39 ], [ 19, 26 ], [ 41, 55, 58, 61 ] ]);
|
|
12472
12507
|
})));
|
|
12473
12508
|
return _EOA.apply(this, arguments);
|
|
12474
12509
|
}
|
|
12475
|
-
function FLVURL(
|
|
12510
|
+
function FLVURL(_x10, _x11) {
|
|
12476
12511
|
return _FLVURL.apply(this, arguments);
|
|
12477
12512
|
}
|
|
12478
12513
|
function _FLVURL() {
|
|
12479
12514
|
_FLVURL = _asyncToGenerator(_regeneratorRuntime().mark((function _callee14(token, vs_currencies) {
|
|
12480
|
-
return _regeneratorRuntime().wrap((function _callee14$(
|
|
12481
|
-
while (1) switch (
|
|
12515
|
+
return _regeneratorRuntime().wrap((function _callee14$(_context17) {
|
|
12516
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
12482
12517
|
case 0:
|
|
12483
|
-
return
|
|
12518
|
+
return _context17.abrupt("return", new Promise((function(resolve) {
|
|
12484
12519
|
setTimeout((function() {
|
|
12485
12520
|
resolve([ {
|
|
12486
12521
|
Yoo: "gotcha"
|
|
@@ -12490,7 +12525,7 @@ function _typeof(o) {
|
|
|
12490
12525
|
|
|
12491
12526
|
case 1:
|
|
12492
12527
|
case "end":
|
|
12493
|
-
return
|
|
12528
|
+
return _context17.stop();
|
|
12494
12529
|
}
|
|
12495
12530
|
}), _callee14);
|
|
12496
12531
|
})));
|
|
@@ -12501,71 +12536,71 @@ function _typeof(o) {
|
|
|
12501
12536
|
}
|
|
12502
12537
|
function _SAFE() {
|
|
12503
12538
|
_SAFE = _asyncToGenerator(_regeneratorRuntime().mark((function _callee15() {
|
|
12504
|
-
var _argsToArray15, _argsToArray16, address, utility, chain, limit, offset, apiKey, chainIdentifier, url, response, json,
|
|
12505
|
-
return _regeneratorRuntime().wrap((function _callee15$(
|
|
12506
|
-
while (1) switch (
|
|
12539
|
+
var _argsToArray15, _argsToArray16, address, utility, chain, limit, offset, apiKey, chainIdentifier, url, response, json, _args18 = arguments;
|
|
12540
|
+
return _regeneratorRuntime().wrap((function _callee15$(_context18) {
|
|
12541
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
12507
12542
|
case 0:
|
|
12508
|
-
_argsToArray15 = argsToArray(
|
|
12543
|
+
_argsToArray15 = argsToArray(_args18), _argsToArray16 = _slicedToArray(_argsToArray15, 5),
|
|
12509
12544
|
address = _argsToArray16[0], utility = _argsToArray16[1], chain = _argsToArray16[2],
|
|
12510
12545
|
limit = _argsToArray16[3], offset = _argsToArray16[4];
|
|
12511
12546
|
if (!(typeof limit !== "number" || limit < 0)) {
|
|
12512
|
-
|
|
12547
|
+
_context18.next = 3;
|
|
12513
12548
|
break;
|
|
12514
12549
|
}
|
|
12515
|
-
return
|
|
12550
|
+
return _context18.abrupt("return", "INVALID_LIMIT");
|
|
12516
12551
|
|
|
12517
12552
|
case 3:
|
|
12518
12553
|
if (!(typeof offset !== "number" || offset < 0)) {
|
|
12519
|
-
|
|
12554
|
+
_context18.next = 5;
|
|
12520
12555
|
break;
|
|
12521
12556
|
}
|
|
12522
|
-
return
|
|
12557
|
+
return _context18.abrupt("return", "INVALID_OFFSET");
|
|
12523
12558
|
|
|
12524
12559
|
case 5:
|
|
12525
12560
|
if (!(utility !== "txns")) {
|
|
12526
|
-
|
|
12561
|
+
_context18.next = 7;
|
|
12527
12562
|
break;
|
|
12528
12563
|
}
|
|
12529
|
-
return
|
|
12564
|
+
return _context18.abrupt("return", "UTILITY IS NOT SUPPORTED");
|
|
12530
12565
|
|
|
12531
12566
|
case 7:
|
|
12532
12567
|
apiKey = window.localStorage.getItem(SERVICE_API_KEY.Safe);
|
|
12533
12568
|
chainIdentifier = SAFE_CHAIN_MAP[chain];
|
|
12534
12569
|
if (apiKey) {
|
|
12535
|
-
|
|
12570
|
+
_context18.next = 11;
|
|
12536
12571
|
break;
|
|
12537
12572
|
}
|
|
12538
|
-
return
|
|
12573
|
+
return _context18.abrupt("return", "".concat(SERVICE_API_KEY.Safe, "_MISSING"));
|
|
12539
12574
|
|
|
12540
12575
|
case 11:
|
|
12541
12576
|
if (chainIdentifier) {
|
|
12542
|
-
|
|
12577
|
+
_context18.next = 13;
|
|
12543
12578
|
break;
|
|
12544
12579
|
}
|
|
12545
|
-
return
|
|
12580
|
+
return _context18.abrupt("return", "CHAIN IS NOT SUPPORTED");
|
|
12546
12581
|
|
|
12547
12582
|
case 13:
|
|
12548
12583
|
if (isAddress(address)) {
|
|
12549
|
-
|
|
12584
|
+
_context18.next = 17;
|
|
12550
12585
|
break;
|
|
12551
12586
|
}
|
|
12552
|
-
|
|
12587
|
+
_context18.next = 16;
|
|
12553
12588
|
return fromEnsNameToAddress(address);
|
|
12554
12589
|
|
|
12555
12590
|
case 16:
|
|
12556
|
-
address =
|
|
12591
|
+
address = _context18.sent;
|
|
12557
12592
|
|
|
12558
12593
|
case 17:
|
|
12559
12594
|
if (address) {
|
|
12560
|
-
|
|
12595
|
+
_context18.next = 19;
|
|
12561
12596
|
break;
|
|
12562
12597
|
}
|
|
12563
|
-
return
|
|
12598
|
+
return _context18.abrupt("return", "".concat(address).concat(ERROR_MESSAGES_FLAG.INVALID_PARAM));
|
|
12564
12599
|
|
|
12565
12600
|
case 19:
|
|
12566
12601
|
url = "https://api.safe.global/tx-service/".concat(chainIdentifier, "/api/v2/safes/").concat(address, "/multisig-transactions?limit=").concat(limit, "&offset=").concat(offset);
|
|
12567
|
-
|
|
12568
|
-
|
|
12602
|
+
_context18.prev = 20;
|
|
12603
|
+
_context18.next = 23;
|
|
12569
12604
|
return fetch(url, {
|
|
12570
12605
|
headers: {
|
|
12571
12606
|
Authorization: "Bearer ".concat(apiKey)
|
|
@@ -12573,40 +12608,40 @@ function _typeof(o) {
|
|
|
12573
12608
|
});
|
|
12574
12609
|
|
|
12575
12610
|
case 23:
|
|
12576
|
-
response =
|
|
12611
|
+
response = _context18.sent;
|
|
12577
12612
|
if (response.ok) {
|
|
12578
|
-
|
|
12613
|
+
_context18.next = 26;
|
|
12579
12614
|
break;
|
|
12580
12615
|
}
|
|
12581
12616
|
throw new Error("HTTP error! Status: ".concat(response.status));
|
|
12582
12617
|
|
|
12583
12618
|
case 26:
|
|
12584
|
-
|
|
12619
|
+
_context18.next = 28;
|
|
12585
12620
|
return response.json();
|
|
12586
12621
|
|
|
12587
12622
|
case 28:
|
|
12588
|
-
json =
|
|
12623
|
+
json = _context18.sent;
|
|
12589
12624
|
if (Array.isArray(json.results)) {
|
|
12590
|
-
|
|
12625
|
+
_context18.next = 31;
|
|
12591
12626
|
break;
|
|
12592
12627
|
}
|
|
12593
|
-
return
|
|
12628
|
+
return _context18.abrupt("return", "INVALID API RESPONSE");
|
|
12594
12629
|
|
|
12595
12630
|
case 31:
|
|
12596
|
-
return
|
|
12631
|
+
return _context18.abrupt("return", json.results.map((function(_ref6) {
|
|
12597
12632
|
var confirmations = _ref6.confirmations, dataDecoded = _ref6.dataDecoded, rest = _objectWithoutProperties(_ref6, _excluded);
|
|
12598
12633
|
return rest;
|
|
12599
12634
|
})));
|
|
12600
12635
|
|
|
12601
12636
|
case 34:
|
|
12602
|
-
|
|
12603
|
-
|
|
12604
|
-
console.log(
|
|
12605
|
-
return
|
|
12637
|
+
_context18.prev = 34;
|
|
12638
|
+
_context18.t0 = _context18["catch"](20);
|
|
12639
|
+
console.log(_context18.t0);
|
|
12640
|
+
return _context18.abrupt("return", "ERROR IN FETCHING");
|
|
12606
12641
|
|
|
12607
12642
|
case 38:
|
|
12608
12643
|
case "end":
|
|
12609
|
-
return
|
|
12644
|
+
return _context18.stop();
|
|
12610
12645
|
}
|
|
12611
12646
|
}), _callee15, null, [ [ 20, 34 ] ]);
|
|
12612
12647
|
})));
|
|
@@ -12617,61 +12652,73 @@ function _typeof(o) {
|
|
|
12617
12652
|
}
|
|
12618
12653
|
function _DEFILLAMA() {
|
|
12619
12654
|
_DEFILLAMA = _asyncToGenerator(_regeneratorRuntime().mark((function _callee16() {
|
|
12620
|
-
var _argsToArray17, _argsToArray18, category,
|
|
12621
|
-
return _regeneratorRuntime().wrap((function _callee16$(
|
|
12622
|
-
while (1) switch (
|
|
12655
|
+
var _argsToArray17, _argsToArray18, category, apiKey, categoryList, categoryMap, url, response, json, _args19 = arguments;
|
|
12656
|
+
return _regeneratorRuntime().wrap((function _callee16$(_context19) {
|
|
12657
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
12623
12658
|
case 0:
|
|
12624
|
-
_argsToArray17 = argsToArray(
|
|
12625
|
-
category = _argsToArray18[0]
|
|
12659
|
+
_argsToArray17 = argsToArray(_args19), _argsToArray18 = _slicedToArray(_argsToArray17, 1),
|
|
12660
|
+
category = _argsToArray18[0];
|
|
12626
12661
|
apiKey = window.localStorage.getItem(SERVICE_API_KEY.Defillama);
|
|
12627
12662
|
if (apiKey) {
|
|
12628
|
-
|
|
12663
|
+
_context19.next = 4;
|
|
12629
12664
|
break;
|
|
12630
12665
|
}
|
|
12631
|
-
return
|
|
12666
|
+
return _context19.abrupt("return", "".concat(SERVICE_API_KEY.Defillama, "_MISSING"));
|
|
12632
12667
|
|
|
12633
12668
|
case 4:
|
|
12634
|
-
baseUrl = "https://api.llama.fi/";
|
|
12635
12669
|
categoryList = [ "protocols", "yields", "dex" ];
|
|
12636
|
-
categoryMap = _defineProperty(_defineProperty(_defineProperty({}, categoryList[0], "protocols"), categoryList[1], "pools"), categoryList[2], "overview/dexs?excludeTotalDataChart=true&excludeTotalDataChartBreakdown=true");
|
|
12637
|
-
url =
|
|
12638
|
-
|
|
12639
|
-
|
|
12640
|
-
}
|
|
12641
|
-
_context18.prev = 9;
|
|
12642
|
-
_context18.next = 12;
|
|
12670
|
+
categoryMap = _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");
|
|
12671
|
+
url = categoryMap[category];
|
|
12672
|
+
_context19.prev = 7;
|
|
12673
|
+
_context19.next = 10;
|
|
12643
12674
|
return fetch(url);
|
|
12644
12675
|
|
|
12645
|
-
case
|
|
12646
|
-
response =
|
|
12676
|
+
case 10:
|
|
12677
|
+
response = _context19.sent;
|
|
12647
12678
|
if (response.ok) {
|
|
12648
|
-
|
|
12679
|
+
_context19.next = 13;
|
|
12649
12680
|
break;
|
|
12650
12681
|
}
|
|
12651
12682
|
throw new Error("HTTP error! Status: ".concat(response.status));
|
|
12652
12683
|
|
|
12653
|
-
case
|
|
12654
|
-
|
|
12684
|
+
case 13:
|
|
12685
|
+
_context19.next = 15;
|
|
12655
12686
|
return response.json();
|
|
12656
12687
|
|
|
12657
|
-
case
|
|
12658
|
-
json =
|
|
12659
|
-
|
|
12660
|
-
|
|
12688
|
+
case 15:
|
|
12689
|
+
json = _context19.sent;
|
|
12690
|
+
_context19.t0 = category;
|
|
12691
|
+
_context19.next = _context19.t0 === categoryList[0] ? 19 : _context19.t0 === categoryList[1] ? 21 : _context19.t0 === categoryList[2] ? 23 : 25;
|
|
12692
|
+
break;
|
|
12693
|
+
|
|
12694
|
+
case 19:
|
|
12695
|
+
if (json.length > 500) {
|
|
12696
|
+
json = json.slice(0, 500);
|
|
12661
12697
|
}
|
|
12662
|
-
return
|
|
12698
|
+
return _context19.abrupt("break", 25);
|
|
12663
12699
|
|
|
12664
|
-
case
|
|
12665
|
-
|
|
12666
|
-
|
|
12667
|
-
console.log(_context18.t0);
|
|
12668
|
-
return _context18.abrupt("return", "ERROR IN FETCHING");
|
|
12700
|
+
case 21:
|
|
12701
|
+
json = json.data.slice(0, 500);
|
|
12702
|
+
return _context19.abrupt("break", 25);
|
|
12669
12703
|
|
|
12670
|
-
case
|
|
12704
|
+
case 23:
|
|
12705
|
+
json = json.protocols.slice(0, 500);
|
|
12706
|
+
return _context19.abrupt("break", 25);
|
|
12707
|
+
|
|
12708
|
+
case 25:
|
|
12709
|
+
return _context19.abrupt("return", removeNestedStructure(Array.isArray(json) ? json : [ json ]));
|
|
12710
|
+
|
|
12711
|
+
case 28:
|
|
12712
|
+
_context19.prev = 28;
|
|
12713
|
+
_context19.t1 = _context19["catch"](7);
|
|
12714
|
+
console.log(_context19.t1);
|
|
12715
|
+
return _context19.abrupt("return", "ERROR IN FETCHING");
|
|
12716
|
+
|
|
12717
|
+
case 32:
|
|
12671
12718
|
case "end":
|
|
12672
|
-
return
|
|
12719
|
+
return _context19.stop();
|
|
12673
12720
|
}
|
|
12674
|
-
}), _callee16, null, [ [
|
|
12721
|
+
}), _callee16, null, [ [ 7, 28 ] ]);
|
|
12675
12722
|
})));
|
|
12676
12723
|
return _DEFILLAMA.apply(this, arguments);
|
|
12677
12724
|
}
|