@curvefi/api 2.18.1 → 2.18.2

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.
Files changed (2) hide show
  1. package/lib/pools/utils.js +8 -10
  2. package/package.json +1 -1
@@ -172,9 +172,8 @@ var _isUserClaimableCacheExpired = function (address, poolId) { var _a, _b; retu
172
172
  var _getUserClaimable = function (pools, address, useCache) { return __awaiter(void 0, void 0, void 0, function () {
173
173
  var poolsToFetch, hasCrvReward, _i, poolsToFetch_3, poolId, pool, gaugeContract, rewardCount, _a, poolsToFetch_4, poolId, pool, gaugeContract, rewardTokenCalls, i, pool, count, gaugeContract, rewardContract, rewardMulticallContract, method, rawRewardTokens, rewardTokens, i, j, rewardAddress, rewardInfoCalls, i, poolId, pool, gaugeContract, gaugeMulticallContract, _b, _c, token, tokenMulticallContract, rawRewardInfo, i, poolId, pool, gaugeContract, token, symbol, decimals, _amount, amount, _d, _e, token, symbol, decimals, _amount, _claimedAmount, amount, _claimable, _f, pools_2, poolId;
174
174
  var _g;
175
- var _h;
176
- return __generator(this, function (_j) {
177
- switch (_j.label) {
175
+ return __generator(this, function (_h) {
176
+ switch (_h.label) {
178
177
  case 0:
179
178
  poolsToFetch = useCache ? pools.filter(function (poolId) { return _isUserClaimableCacheExpired(address, poolId); }) : pools;
180
179
  if (!(poolsToFetch.length > 0)) return [3 /*break*/, 3];
@@ -228,7 +227,7 @@ var _getUserClaimable = function (pools, address, useCache) { return __awaiter(v
228
227
  }
229
228
  return [4 /*yield*/, curve_1.curve.multicallProvider.all(rewardTokenCalls)];
230
229
  case 1:
231
- rawRewardTokens = (_j.sent()).map(function (t) { return t.toLowerCase(); });
230
+ rawRewardTokens = (_h.sent()).map(function (t) { return t.toLowerCase(); });
232
231
  rewardTokens = {};
233
232
  for (i = 0; i < poolsToFetch.length; i++) {
234
233
  rewardTokens[poolsToFetch[i]] = [];
@@ -265,14 +264,13 @@ var _getUserClaimable = function (pools, address, useCache) { return __awaiter(v
265
264
  }
266
265
  return [4 /*yield*/, curve_1.curve.multicallProvider.all(rewardInfoCalls)];
267
266
  case 2:
268
- rawRewardInfo = _j.sent();
267
+ rawRewardInfo = _h.sent();
269
268
  for (i = 0; i < poolsToFetch.length; i++) {
270
269
  poolId = poolsToFetch[i];
271
270
  pool = (0, poolConstructor_1.getPool)(poolId);
272
271
  if (!_userClaimableCache[address])
273
- _userClaimableCache[address] = (_g = {}, _g[poolId] = { rewards: [], time: Date.now() }, _g);
274
- if (!_userClaimableCache[address][poolId])
275
- _userClaimableCache[address][poolId] = { rewards: [], time: Date.now() };
272
+ _userClaimableCache[address] = {};
273
+ _userClaimableCache[address][poolId] = { rewards: [], time: Date.now() };
276
274
  if (pool.gauge === ethers_1.ethers.constants.AddressZero)
277
275
  continue;
278
276
  gaugeContract = curve_1.curve.contracts[pool.gauge].contract;
@@ -299,12 +297,12 @@ var _getUserClaimable = function (pools, address, useCache) { return __awaiter(v
299
297
  _userClaimableCache[address][poolId].rewards.push({ token: token, symbol: symbol, amount: amount });
300
298
  }
301
299
  }
302
- _j.label = 3;
300
+ _h.label = 3;
303
301
  case 3:
304
302
  _claimable = [];
305
303
  for (_f = 0, pools_2 = pools; _f < pools_2.length; _f++) {
306
304
  poolId = pools_2[_f];
307
- _claimable.push((_h = _userClaimableCache[address]) === null || _h === void 0 ? void 0 : _h[poolId].rewards);
305
+ _claimable.push((_g = _userClaimableCache[address]) === null || _g === void 0 ? void 0 : _g[poolId].rewards);
308
306
  }
309
307
  return [2 /*return*/, _claimable];
310
308
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@curvefi/api",
3
- "version": "2.18.1",
3
+ "version": "2.18.2",
4
4
  "description": "JavaScript library for curve.fi",
5
5
  "main": "lib/index.js",
6
6
  "author": "Macket",