@curvefi/api 2.69.10 → 2.69.11

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.
@@ -56,6 +56,7 @@ export declare class PoolTemplate extends CorePool {
56
56
  private calcLpTokenAmountBigInt;
57
57
  private calcLpTokenAmountWrapped;
58
58
  private calcLpTokenAmountWrappedBigInt;
59
+ _isPoolFiltered(): Promise<boolean>;
59
60
  getSeedAmounts(amount1: number | string, useUnderlying?: boolean): Promise<string[]>;
60
61
  depositBalancedAmounts(): Promise<string[]>;
61
62
  depositExpected(amounts: (number | string)[]): Promise<string>;
@@ -8,7 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  });
9
9
  };
10
10
  import memoize from "memoizee";
11
- import { _getAllGaugesFormatted } from '../external-api.js';
11
+ import { _getAllGaugesFormatted, _getPoolFilters } from '../external-api.js';
12
12
  import { _cutZeros, _ensureAllowance, _get_price_impact, _get_small_x, _getAddress, _getCoinAddresses, _getRewardsFromApi, _getUsdRate, _setContracts, BN, checkNumber, DIGas, ensureAllowance, ensureAllowanceEstimateGas, findAbiFunction, fromBN, hasAllowance, mulBy1_3, parseUnits, PERIODS, smartNumber, toBN, toStringFromBN, } from '../utils.js';
13
13
  import { OLD_CHAINS } from "../curve.js";
14
14
  import ERC20Abi from '../constants/abis/ERC20.json' with { type: 'json' };
@@ -655,6 +655,14 @@ export class PoolTemplate extends CorePool {
655
655
  return yield this._calcLpTokenAmount(amounts, isDeposit, false);
656
656
  });
657
657
  }
658
+ _isPoolFiltered() {
659
+ return __awaiter(this, void 0, void 0, function* () {
660
+ var _c;
661
+ const poolFilters = yield _getPoolFilters();
662
+ const filteredAddresses = poolFilters[this.curve.constants.NETWORK_NAME];
663
+ return (_c = filteredAddresses === null || filteredAddresses === void 0 ? void 0 : filteredAddresses.includes(this.address)) !== null && _c !== void 0 ? _c : false;
664
+ });
665
+ }
658
666
  // ---------------- DEPOSIT ----------------
659
667
  getSeedAmounts(amount1_1) {
660
668
  return __awaiter(this, arguments, void 0, function* (amount1, useUnderlying = false) {
@@ -712,6 +720,8 @@ export class PoolTemplate extends CorePool {
712
720
  }
713
721
  depositExpectedBigInt(amounts) {
714
722
  return __awaiter(this, void 0, void 0, function* () {
723
+ if (yield this._isPoolFiltered())
724
+ return BigInt(0);
715
725
  return yield this.calcLpTokenAmountBigInt(amounts);
716
726
  });
717
727
  }
@@ -824,6 +834,8 @@ export class PoolTemplate extends CorePool {
824
834
  if (this.isFake) {
825
835
  throw Error(`depositWrappedExpectedBigInt method doesn't exist for pool ${this.name} (id: ${this.name})`);
826
836
  }
837
+ if (yield this._isPoolFiltered())
838
+ return BigInt(0);
827
839
  return yield this.calcLpTokenAmountWrappedBigInt(amounts);
828
840
  });
829
841
  }
@@ -1524,6 +1536,8 @@ export class PoolTemplate extends CorePool {
1524
1536
  }
1525
1537
  withdrawOneCoinExpectedBigInt(lpTokenAmount, coin) {
1526
1538
  return __awaiter(this, void 0, void 0, function* () {
1539
+ if (yield this._isPoolFiltered())
1540
+ return BigInt(0);
1527
1541
  const i = this._getCoinIdx(coin);
1528
1542
  return yield this._withdrawOneCoinExpected(lpTokenAmount, i);
1529
1543
  });
@@ -1765,6 +1779,8 @@ export class PoolTemplate extends CorePool {
1765
1779
  }
1766
1780
  swapExpectedBigInt(inputCoin, outputCoin, amount) {
1767
1781
  return __awaiter(this, void 0, void 0, function* () {
1782
+ if (yield this._isPoolFiltered())
1783
+ return BigInt(0);
1768
1784
  const i = this._getCoinIdx(inputCoin);
1769
1785
  const j = this._getCoinIdx(outputCoin);
1770
1786
  const _expected = yield this._swapExpected(i, j, amount);
@@ -117,6 +117,8 @@ export const swapWrappedExpectedAndApproveMixin = {
117
117
  },
118
118
  swapWrappedExpectedBigInt(inputCoin, outputCoin, amount) {
119
119
  return __awaiter(this, void 0, void 0, function* () {
120
+ if (yield this._isPoolFiltered())
121
+ return BigInt(0);
120
122
  const i = this._getCoinIdx(inputCoin, false);
121
123
  const j = this._getCoinIdx(outputCoin, false);
122
124
  const _expected = yield this._swapWrappedExpected.call(this, i, j, amount);
@@ -20,6 +20,8 @@ export const withdrawExpectedMixin = {
20
20
  },
21
21
  withdrawExpectedBigInt(lpTokenAmount) {
22
22
  return __awaiter(this, void 0, void 0, function* () {
23
+ if (yield this._isPoolFiltered())
24
+ return this.underlyingCoins.map(() => BigInt(0));
23
25
  return yield _calcExpectedAmounts.call(this, lpTokenAmount);
24
26
  });
25
27
  },
@@ -36,6 +38,8 @@ export const withdrawExpectedLendingOrCryptoMixin = {
36
38
  },
37
39
  withdrawExpectedBigInt(lpTokenAmount) {
38
40
  return __awaiter(this, void 0, void 0, function* () {
41
+ if (yield this._isPoolFiltered())
42
+ return this.underlyingCoins.map(() => BigInt(0));
39
43
  const _expectedAmounts = yield _calcExpectedAmounts.call(this, lpTokenAmount);
40
44
  const _rates = yield this._getRates();
41
45
  return _expectedAmounts.map((_amount, i) => _amount * _rates[i] / parseUnits(String(Math.pow(10, 18)), 0));
@@ -52,6 +56,8 @@ export const withdrawExpectedMetaMixin = {
52
56
  },
53
57
  withdrawExpectedBigInt(lpTokenAmount) {
54
58
  return __awaiter(this, void 0, void 0, function* () {
59
+ if (yield this._isPoolFiltered())
60
+ return this.underlyingCoins.map(() => BigInt(0));
55
61
  return yield _calcExpectedUnderlyingAmountsMeta.call(this, lpTokenAmount);
56
62
  });
57
63
  },
@@ -66,6 +72,8 @@ export const withdrawWrappedExpectedMixin = {
66
72
  },
67
73
  withdrawWrappedExpectedBigInt(lpTokenAmount) {
68
74
  return __awaiter(this, void 0, void 0, function* () {
75
+ if (yield this._isPoolFiltered())
76
+ return this.wrappedCoins.map(() => BigInt(0));
69
77
  return yield _calcExpectedAmounts.call(this, lpTokenAmount);
70
78
  });
71
79
  },
@@ -16,6 +16,8 @@ export const withdrawOneCoinWrappedExpected2argsMixin = {
16
16
  },
17
17
  withdrawOneCoinWrappedExpectedBigInt(lpTokenAmount, coin) {
18
18
  return __awaiter(this, void 0, void 0, function* () {
19
+ if (yield this._isPoolFiltered())
20
+ return BigInt(0);
19
21
  const i = this._getCoinIdx(coin, false);
20
22
  return yield this._withdrawOneCoinWrappedExpected(lpTokenAmount, i);
21
23
  });
@@ -30,6 +32,8 @@ export const withdrawOneCoinWrappedExpected3argsMixin = {
30
32
  },
31
33
  withdrawOneCoinWrappedExpectedBigInt(lpTokenAmount, coin) {
32
34
  return __awaiter(this, void 0, void 0, function* () {
35
+ if (yield this._isPoolFiltered())
36
+ return BigInt(0);
33
37
  const i = this._getCoinIdx(coin, false);
34
38
  return yield this._withdrawOneCoinWrappedExpected(lpTokenAmount, i);
35
39
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@curvefi/api",
3
- "version": "2.69.10",
3
+ "version": "2.69.11",
4
4
  "description": "JavaScript library for curve.finance",
5
5
  "main": "lib/index.js",
6
6
  "author": "Macket",