@fileverse-dev/formulajs 4.4.11-mod-47 → 4.4.11-mod-49

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