@curvefi/api 2.65.26 → 2.65.28

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,5 +1,5 @@
1
1
  export const volumeNetworks = {
2
- getVolumes: [1, 137, 252, 8453, 42161],
3
- getSubgraphData: [10, 100, 250, 43114],
2
+ getVolumes: [1, 10, 100, 137, 250, 252, 8453, 42161],
3
+ getSubgraphData: [43114],
4
4
  getFactoryAPYs: [56, 196, 324, 1284, 2222, 5000, 42220, 1313161554],
5
5
  };
@@ -155,6 +155,7 @@ export interface IPoolDataFromApi {
155
155
  implementationAddress: string;
156
156
  coins: ICoinFromPoolDataApi[];
157
157
  gaugeRewards: IRewardFromApi[];
158
+ gaugeExtraRewards?: IRewardFromApi[];
158
159
  usdTotal: number;
159
160
  totalSupply: number;
160
161
  amplificationCoefficient: string;
package/lib/utils.js CHANGED
@@ -350,14 +350,14 @@ export const _getCrvApyFromApi = () => __awaiter(void 0, void 0, void 0, functio
350
350
  return apyDict;
351
351
  });
352
352
  export const _getRewardsFromApi = () => __awaiter(void 0, void 0, void 0, function* () {
353
- var _e;
353
+ var _e, _f;
354
354
  const network = curve.constants.NETWORK_NAME;
355
355
  const allTypesExtendedPoolData = yield _getAllPoolsFromApi(network, curve.isLiteChain);
356
356
  const rewardsDict = {};
357
357
  for (const extendedPoolData of allTypesExtendedPoolData) {
358
358
  for (const pool of extendedPoolData.poolData) {
359
359
  if (pool.gaugeAddress) {
360
- rewardsDict[pool.gaugeAddress.toLowerCase()] = ((_e = pool.gaugeRewards) !== null && _e !== void 0 ? _e : [])
360
+ rewardsDict[pool.gaugeAddress.toLowerCase()] = ((_f = (_e = pool.gaugeRewards) !== null && _e !== void 0 ? _e : pool.gaugeExtraRewards) !== null && _f !== void 0 ? _f : [])
361
361
  .filter((r) => curve.chainId === 1 || r.tokenAddress.toLowerCase() !== curve.constants.COINS.crv);
362
362
  }
363
363
  }
@@ -366,7 +366,7 @@ export const _getRewardsFromApi = () => __awaiter(void 0, void 0, void 0, functi
366
366
  });
367
367
  const _usdRatesCache = {};
368
368
  export const _getUsdRate = (assetId) => __awaiter(void 0, void 0, void 0, function* () {
369
- var _f, _g, _h, _j, _k, _l, _m, _o;
369
+ var _g, _h, _j, _k, _l, _m, _o, _p;
370
370
  if (curve.chainId === 1 && assetId.toLowerCase() === '0x8762db106b2c2a0bccb3a80d1ed41273552616e8')
371
371
  return 0; // RSR
372
372
  const pricesFromApi = yield _getUsdPricesFromApi();
@@ -393,7 +393,7 @@ export const _getUsdRate = (assetId) => __awaiter(void 0, void 0, void 0, functi
393
393
  42161: 'arbitrum-one',
394
394
  1313161554: 'aurora',
395
395
  }[curve.chainId];
396
- const nativeTokenName = curve.isLiteChain ? (_g = (_f = curve.constants) === null || _f === void 0 ? void 0 : _f.API_CONSTANTS) === null || _g === void 0 ? void 0 : _g.nativeTokenName : {
396
+ const nativeTokenName = curve.isLiteChain ? (_h = (_g = curve.constants) === null || _g === void 0 ? void 0 : _g.API_CONSTANTS) === null || _h === void 0 ? void 0 : _h.nativeTokenName : {
397
397
  1: 'ethereum',
398
398
  10: 'ethereum',
399
399
  56: 'binancecoin',
@@ -416,8 +416,8 @@ export const _getUsdRate = (assetId) => __awaiter(void 0, void 0, void 0, functi
416
416
  throw Error('curve object is not initialized');
417
417
  }
418
418
  if (nativeTokenName === undefined) {
419
- if (curve.isLiteChain && ((_h = curve.constants.API_CONSTANTS) === null || _h === void 0 ? void 0 : _h.wrappedNativeTokenAddress.toLowerCase()) && ((_j = curve.constants.API_CONSTANTS) === null || _j === void 0 ? void 0 : _j.wrappedNativeTokenAddress.toLowerCase()) in pricesFromApi) {
420
- return pricesFromApi[(_k = curve.constants.API_CONSTANTS) === null || _k === void 0 ? void 0 : _k.wrappedNativeTokenAddress.toLowerCase()];
419
+ if (curve.isLiteChain && ((_j = curve.constants.API_CONSTANTS) === null || _j === void 0 ? void 0 : _j.wrappedNativeTokenAddress.toLowerCase()) && ((_k = curve.constants.API_CONSTANTS) === null || _k === void 0 ? void 0 : _k.wrappedNativeTokenAddress.toLowerCase()) in pricesFromApi) {
420
+ return pricesFromApi[(_l = curve.constants.API_CONSTANTS) === null || _l === void 0 ? void 0 : _l.wrappedNativeTokenAddress.toLowerCase()];
421
421
  }
422
422
  else {
423
423
  throw Error('nativeTokenName not found');
@@ -440,10 +440,10 @@ export const _getUsdRate = (assetId) => __awaiter(void 0, void 0, void 0, functi
440
440
  if (assetId.toLowerCase() === curve.constants.ALIASES.crv) {
441
441
  assetId = 'curve-dao-token';
442
442
  }
443
- if (curve.isLiteChain && assetId.toLowerCase() === ((_l = curve.constants.API_CONSTANTS) === null || _l === void 0 ? void 0 : _l.wrappedNativeTokenAddress.toLowerCase())) {
443
+ if (curve.isLiteChain && assetId.toLowerCase() === ((_m = curve.constants.API_CONSTANTS) === null || _m === void 0 ? void 0 : _m.wrappedNativeTokenAddress.toLowerCase())) {
444
444
  assetId = nativeTokenName;
445
445
  }
446
- if ((((_m = _usdRatesCache[assetId]) === null || _m === void 0 ? void 0 : _m.time) || 0) + 600000 < Date.now()) {
446
+ if ((((_o = _usdRatesCache[assetId]) === null || _o === void 0 ? void 0 : _o.time) || 0) + 600000 < Date.now()) {
447
447
  const url = [nativeTokenName, 'ethereum', 'bitcoin', 'link', 'curve-dao-token', 'stasis-eurs'].includes(assetId.toLowerCase()) ?
448
448
  `https://api.coingecko.com/api/v3/simple/price?ids=${assetId}&vs_currencies=usd` :
449
449
  `https://api.coingecko.com/api/v3/simple/token_price/${chainName}?contract_addresses=${assetId}&vs_currencies=usd`;
@@ -451,7 +451,7 @@ export const _getUsdRate = (assetId) => __awaiter(void 0, void 0, void 0, functi
451
451
  const response = yield axios.get(url, {
452
452
  validateStatus: (status) => status < 500,
453
453
  });
454
- if (response.status === 200 && ((_o = response.data[assetId]) === null || _o === void 0 ? void 0 : _o.usd) !== undefined) {
454
+ if (response.status === 200 && ((_p = response.data[assetId]) === null || _p === void 0 ? void 0 : _p.usd) !== undefined) {
455
455
  _usdRatesCache[assetId] = {
456
456
  'rate': response.data[assetId].usd,
457
457
  'time': Date.now(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@curvefi/api",
3
- "version": "2.65.26",
3
+ "version": "2.65.28",
4
4
  "description": "JavaScript library for curve.fi",
5
5
  "main": "lib/index.js",
6
6
  "author": "Macket",