@curvefi/api 2.68.4 → 2.68.6

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.
@@ -0,0 +1,6 @@
1
+ import { IChainId } from "../interfaces";
2
+ export interface IRewardNetworks {
3
+ tokenApyLiteChainExceptions: IChainId[];
4
+ tokenApyDisabledChains: IChainId[];
5
+ }
6
+ export declare const rewardNetworks: IRewardNetworks;
@@ -0,0 +1,4 @@
1
+ export const rewardNetworks = {
2
+ tokenApyLiteChainExceptions: [146, 167000], // Sonic, Taiko
3
+ tokenApyDisabledChains: [1313161554], // Aurora
4
+ };
@@ -9,6 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  };
10
10
  import { _getPoolsFromApi, _getCrvApyFromApi } from '../../cached.js';
11
11
  import { _getUsdRate, BN, toBN, _getRewardsFromApi, getVolumeApiController, } from '../../utils.js';
12
+ import { rewardNetworks } from '../../constants/rewardNetworks.js';
12
13
  import memoize from "memoizee";
13
14
  export class StatsPool {
14
15
  constructor(pool) {
@@ -165,12 +166,12 @@ export class StatsPool {
165
166
  this.tokenApy = (...args_1) => __awaiter(this, [...args_1], void 0, function* (useApi = true) {
166
167
  var _a;
167
168
  const curve = this.pool.curve;
168
- if (curve.isLiteChain && curve.chainId !== 146) {
169
+ if (curve.isLiteChain && !rewardNetworks.tokenApyLiteChainExceptions.includes(curve.chainId)) {
169
170
  throw Error('tokenApy is not supported for the lite version');
170
171
  }
171
172
  if (this.pool.rewardsOnly())
172
173
  throw Error(`${this.pool.name} has Rewards-Only Gauge. Use stats.rewardsApy instead`);
173
- const isDisabledChain = [1313161554].includes(curve.chainId); // Disable Aurora
174
+ const isDisabledChain = rewardNetworks.tokenApyDisabledChains.includes(curve.chainId);
174
175
  if (useApi && !isDisabledChain) {
175
176
  const crvAPYs = yield _getCrvApyFromApi(curve.constants.NETWORK_NAME, curve.isLiteChain);
176
177
  const poolCrvApy = (_a = crvAPYs[this.pool.gauge.address]) !== null && _a !== void 0 ? _a : [0, 0]; // new pools might be missing
@@ -223,11 +224,12 @@ export class StatsPool {
223
224
  wrappedBalances() {
224
225
  return __awaiter(this, void 0, void 0, function* () {
225
226
  const curve = this.pool.curve;
226
- const contract = curve.contracts[this.pool.address].multicallContract;
227
- const calls = [];
228
- for (let i = 0; i < this.pool.wrappedCoins.length; i++)
229
- calls.push(contract.balances(i));
230
- const _wrappedBalances = yield curve.multicallProvider.all(calls);
227
+ const contract = curve.contracts[this.pool.address].contract;
228
+ const promises = [];
229
+ for (let i = 0; i < this.pool.wrappedCoins.length; i++) {
230
+ promises.push(contract.balances(i));
231
+ }
232
+ const _wrappedBalances = yield Promise.all(promises);
231
233
  return _wrappedBalances.map((_b, i) => curve.formatUnits(_b, this.pool.wrappedDecimals[i]));
232
234
  });
233
235
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@curvefi/api",
3
- "version": "2.68.4",
3
+ "version": "2.68.6",
4
4
  "description": "JavaScript library for curve.finance",
5
5
  "main": "lib/index.js",
6
6
  "author": "Macket",