@curvefi/api 2.72.0 → 2.72.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.
package/lib/boosting.js CHANGED
@@ -69,9 +69,10 @@ export function getUserBoosts(pools_1) {
69
69
  return {};
70
70
  const poolsData = this.getPoolsData();
71
71
  const poolIds = pools.map((poolAddress) => getPoolIdBySwapAddress.call(this, poolAddress));
72
- if (poolIds.some((poolId) => !poolId))
73
- throw new Error("One or more pool addresses doesn't have pool data");
74
- const boosts = yield _getUserBoosts.call(this, poolIds.map((poolId) => poolsData[poolId]), userAddress, throwOnError);
72
+ const boosts = yield _getUserBoosts.call(this,
73
+ // If a pool id is empty, the inner function will throw an error when throwOnError is true.
74
+ // If throwOnError is false, we will consider the pool as having no gauge and thus no boost.
75
+ poolIds.map((poolId, index) => { var _a; return (_a = poolsData[poolId]) !== null && _a !== void 0 ? _a : { name: pools[index], gauge_address: this.constants.ZERO_ADDRESS }; }), userAddress, throwOnError);
75
76
  return Object.fromEntries(pools.map((poolAddress, index) => [poolAddress, boosts[index]]));
76
77
  });
77
78
  }
@@ -16,7 +16,7 @@ import { swapCryptoMetaFactoryMixin, swapMetaFactoryMixin, swapMixin, swapTricry
16
16
  import { swapWrappedExpectedAndApproveMixin, swapWrappedMixin, swapWrappedRequiredMixin, swapWrappedTricrypto2Mixin, } from "./mixins/swapWrappedMixins.js";
17
17
  import { findAbiSignature, getCountArgsOfMethodByAbi, getPoolIdBySwapAddress } from "../utils.js";
18
18
  import { StatsPool } from "./subClasses/statsPool.js";
19
- import { extractDecimals, lowerCasePoolDataAddresses } from "../constants/utils.js";
19
+ import { lowerCasePoolDataAddresses } from "../constants/utils.js";
20
20
  import { buildFactoryPoolsData, lowerCasePoolDataAddresses as lowerCaseApiPoolAddresses } from "../factory/factory-api.js";
21
21
  export function getPool(poolIdOrAddress) {
22
22
  const poolId = poolIdOrAddress.toLowerCase().startsWith('0x') ? getPoolIdBySwapAddress.call(this, poolIdOrAddress.toLowerCase()) : poolIdOrAddress;
@@ -281,6 +281,6 @@ export function getPoolByData(data) {
281
281
  throw new Error(`Could not resolve ABI for pool ${id} (poolType=${data.poolType}, implementation=${(_j = data.implementationAddress) !== null && _j !== void 0 ? _j : "none"}). The implementation is unknown to curve for this poolType.`);
282
282
  }
283
283
  this.constants.EXTERNAL_POOLS_DATA = Object.assign(Object.assign({}, this.constants.EXTERNAL_POOLS_DATA), builtData);
284
- this.constants.DECIMALS = Object.assign(Object.assign({}, this.constants.DECIMALS), extractDecimals(builtData));
284
+ this._updateDecimalsAndGauges(builtData);
285
285
  return getPool.call(this, id);
286
286
  }
@@ -15,6 +15,7 @@ export interface IPricesGauge {
15
15
  is_killed: boolean;
16
16
  gauge_weight: string;
17
17
  gauge_relative_weight: number;
18
+ gauge_type: string;
18
19
  }
19
20
  export declare const getGaugesOverview: () => Promise<IPricesGauge[]>;
20
21
  export declare const getPoolsFromPricesApi: (network: INetworkName, poolType: IPoolType) => Promise<IExtendedPoolDataFromApi>;
package/lib/prices-api.js CHANGED
@@ -49,8 +49,9 @@ const getGaugeAddressByPoolAddress = (network) => __awaiter(void 0, void 0, void
49
49
  const { gauges } = yield _getGaugesOverview();
50
50
  const map = new Map();
51
51
  for (const gauge of gauges !== null && gauges !== void 0 ? gauges : []) {
52
- if (((_a = gauge.pool) === null || _a === void 0 ? void 0 : _a.chain) === network)
53
- map.set(gauge.pool.address.toLowerCase(), ((_b = gauge.effective_address) !== null && _b !== void 0 ? _b : gauge.address).toLowerCase());
52
+ if (((_a = gauge.pool) === null || _a === void 0 ? void 0 : _a.chain) !== network || gauge.gauge_type !== "Liquidity")
53
+ continue;
54
+ map.set(gauge.pool.address.toLowerCase(), ((_b = gauge.effective_address) !== null && _b !== void 0 ? _b : gauge.address).toLowerCase());
54
55
  }
55
56
  return map;
56
57
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@curvefi/api",
3
- "version": "2.72.0",
3
+ "version": "2.72.2",
4
4
  "description": "JavaScript library for curve.finance",
5
5
  "main": "lib/index.js",
6
6
  "author": "Macket",