@curvefi/api 2.25.1 → 2.25.3

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,51 @@
1
+ [
2
+ {
3
+ "stateMutability": "payable",
4
+ "type": "function",
5
+ "name": "deposit_and_stake",
6
+ "inputs": [
7
+ {
8
+ "name": "deposit",
9
+ "type": "address"
10
+ },
11
+ {
12
+ "name": "lp_token",
13
+ "type": "address"
14
+ },
15
+ {
16
+ "name": "gauge",
17
+ "type": "address"
18
+ },
19
+ {
20
+ "name": "n_coins",
21
+ "type": "uint256"
22
+ },
23
+ {
24
+ "name": "coins",
25
+ "type": "address[6]"
26
+ },
27
+ {
28
+ "name": "amounts",
29
+ "type": "uint256[6]"
30
+ },
31
+ {
32
+ "name": "min_mint_amount",
33
+ "type": "uint256"
34
+ },
35
+ {
36
+ "name": "use_underlying",
37
+ "type": "bool"
38
+ },
39
+ {
40
+ "name": "pool",
41
+ "type": "address"
42
+ }
43
+ ],
44
+ "outputs": [],
45
+ "gas": "409532"
46
+ },
47
+ {
48
+ "stateMutability": "payable",
49
+ "type": "fallback"
50
+ }
51
+ ]
@@ -23,7 +23,7 @@ exports.ALIASES_POLYGON = (0, utils_1.lowerCaseValues)({
23
23
  "gauge_controller": "0x2F50D538606Fa9EDD2B11E2446BEb18C9D5846bB",
24
24
  "address_provider": "0x0000000022d53366457f9d5e68ec105046fc4383",
25
25
  "router": "0xfA9a30350048B2BF66865ee20363067c66f67e58",
26
- "deposit_and_stake": "0x43FF7b96808988C9d19C1d05Ef19658B03e8a143",
26
+ "deposit_and_stake": "0xB7De33440B7171159a9718CBE748086cecDd9685",
27
27
  "factory": '0x722272d36ef0da72ff51c5a65db7b870e2e8d4ee',
28
28
  "crypto_factory": "0xE5De15A9C9bBedb4F5EC13B131E61245f2983A69",
29
29
  "registry_exchange": "",
@@ -117,8 +117,8 @@ exports.POOLS_DATA_XDAI = (0, utils_1.lowerCasePoolDataAddresses)({
117
117
  is_meta: true,
118
118
  is_crypto: true,
119
119
  base_pool: '3pool',
120
- underlying_coins: ['EURe', 'DAI', 'USDC', 'USDT'],
121
- wrapped_coins: ['EURe', '3Crv'],
120
+ underlying_coins: ['EURe', 'WXDAI', 'USDC', 'USDT'],
121
+ wrapped_coins: ['EURe', 'x3CRV'],
122
122
  underlying_coin_addresses: [
123
123
  '0xcB444e90D8198415266c6a2724b7900fb12FC56E',
124
124
  '0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d',
package/lib/curve.d.ts CHANGED
@@ -70,6 +70,7 @@ declare class Curve implements ICurve {
70
70
  chainId?: number;
71
71
  }): Promise<void>;
72
72
  setContract(address: string, abi: any): void;
73
+ _filterHiddenPools(pools: IDict<IPoolData>): Promise<IDict<IPoolData>>;
73
74
  fetchFactoryPools(useApi?: boolean): Promise<void>;
74
75
  fetchCryptoFactoryPools(useApi?: boolean): Promise<void>;
75
76
  fetchRecentlyDeployedFactoryPool(poolAddress: string): Promise<string>;
package/lib/curve.js CHANGED
@@ -76,6 +76,7 @@ var address_provider_json_1 = __importDefault(require("./constants/abis/address_
76
76
  var gaugecontroller_json_1 = __importDefault(require("./constants/abis/gaugecontroller.json"));
77
77
  var router_json_1 = __importDefault(require("./constants/abis/router.json"));
78
78
  var deposit_and_stake_json_1 = __importDefault(require("./constants/abis/deposit_and_stake.json"));
79
+ var deposit_and_stake_6coins_json_1 = __importDefault(require("./constants/abis/deposit_and_stake_6coins.json"));
79
80
  var registry_exchange_json_1 = __importDefault(require("./constants/abis/registry_exchange.json"));
80
81
  var streamer_json_1 = __importDefault(require("./constants/abis/streamer.json"));
81
82
  var factory_json_1 = __importDefault(require("./constants/abis/factory.json"));
@@ -588,14 +589,14 @@ var Curve = /** @class */ (function () {
588
589
  contract: new ethers_1.Contract(this.constants.ALIASES.router, router_json_1.default, this.signer || this.provider),
589
590
  multicallContract: new ethcall_1.Contract(this.constants.ALIASES.router, router_json_1.default),
590
591
  };
591
- this.contracts[this.constants.ALIASES.deposit_and_stake] = {
592
- contract: new ethers_1.Contract(this.constants.ALIASES.deposit_and_stake, deposit_and_stake_json_1.default, this.signer || this.provider),
593
- multicallContract: new ethcall_1.Contract(this.constants.ALIASES.deposit_and_stake, deposit_and_stake_json_1.default),
594
- };
595
- this.contracts[this.constants.ALIASES.deposit_and_stake.toLowerCase()] = {
596
- contract: new ethers_1.Contract(this.constants.ALIASES.deposit_and_stake, deposit_and_stake_json_1.default, this.signer || this.provider),
597
- multicallContract: new ethcall_1.Contract(this.constants.ALIASES.deposit_and_stake, deposit_and_stake_json_1.default),
598
- };
592
+ if (this.chainId === 137) {
593
+ this.setContract(this.constants.ALIASES.deposit_and_stake, deposit_and_stake_6coins_json_1.default);
594
+ this.setContract(this.constants.ALIASES.deposit_and_stake.toLowerCase(), deposit_and_stake_6coins_json_1.default);
595
+ }
596
+ else {
597
+ this.setContract(this.constants.ALIASES.deposit_and_stake, deposit_and_stake_json_1.default);
598
+ this.setContract(this.constants.ALIASES.deposit_and_stake.toLowerCase(), deposit_and_stake_json_1.default);
599
+ }
599
600
  this.contracts[this.constants.ALIASES.factory] = {
600
601
  contract: new ethers_1.Contract(this.constants.ALIASES.factory, factory_json_1.default, this.signer || this.provider),
601
602
  multicallContract: new ethcall_1.Contract(this.constants.ALIASES.factory, factory_json_1.default),
@@ -623,12 +624,29 @@ var Curve = /** @class */ (function () {
623
624
  multicallContract: new ethcall_1.Contract(address, abi),
624
625
  };
625
626
  };
627
+ Curve.prototype._filterHiddenPools = function (pools) {
628
+ return __awaiter(this, void 0, void 0, function () {
629
+ var hiddenPools;
630
+ return __generator(this, function (_a) {
631
+ switch (_a.label) {
632
+ case 0: return [4 /*yield*/, (0, external_api_1._getHiddenPools)()];
633
+ case 1:
634
+ hiddenPools = (_a.sent())[this.constants.NETWORK_NAME] || [];
635
+ // @ts-ignore
636
+ return [2 /*return*/, Object.fromEntries(Object.entries(pools).filter(function (_a) {
637
+ var id = _a[0];
638
+ return !hiddenPools.includes(id);
639
+ }))];
640
+ }
641
+ });
642
+ });
643
+ };
626
644
  Curve.prototype.fetchFactoryPools = function (useApi) {
627
645
  if (useApi === void 0) { useApi = true; }
628
646
  return __awaiter(this, void 0, void 0, function () {
629
- var _a, _b, _c, _d;
630
- return __generator(this, function (_e) {
631
- switch (_e.label) {
647
+ var _a, _b, _c, _d, _e;
648
+ return __generator(this, function (_f) {
649
+ switch (_f.label) {
632
650
  case 0:
633
651
  if (this.chainId === 1313161554)
634
652
  return [2 /*return*/];
@@ -637,21 +655,25 @@ var Curve = /** @class */ (function () {
637
655
  _b = utils_1.lowerCasePoolDataAddresses;
638
656
  return [4 /*yield*/, factory_api_1.getFactoryPoolsDataFromApi.call(this, false)];
639
657
  case 1:
640
- _a.FACTORY_POOLS_DATA = _b.apply(void 0, [_e.sent()]);
658
+ _a.FACTORY_POOLS_DATA = _b.apply(void 0, [_f.sent()]);
641
659
  return [3 /*break*/, 4];
642
660
  case 2:
643
661
  _c = this.constants;
644
662
  _d = utils_1.lowerCasePoolDataAddresses;
645
663
  return [4 /*yield*/, factory_1.getFactoryPoolData.call(this)];
646
664
  case 3:
647
- _c.FACTORY_POOLS_DATA = _d.apply(void 0, [_e.sent()]);
648
- _e.label = 4;
665
+ _c.FACTORY_POOLS_DATA = _d.apply(void 0, [_f.sent()]);
666
+ _f.label = 4;
649
667
  case 4:
668
+ _e = this.constants;
669
+ return [4 /*yield*/, this._filterHiddenPools(this.constants.FACTORY_POOLS_DATA)];
670
+ case 5:
671
+ _e.FACTORY_POOLS_DATA = _f.sent();
650
672
  this.constants.DECIMALS = __assign(__assign({}, this.constants.DECIMALS), (0, utils_1.extractDecimals)(this.constants.FACTORY_POOLS_DATA));
651
673
  this.constants.GAUGES = __spreadArray(__spreadArray([], this.constants.GAUGES, true), (0, utils_1.extractGauges)(this.constants.FACTORY_POOLS_DATA), true);
652
674
  return [4 /*yield*/, _killGauges(this.constants.FACTORY_POOLS_DATA)];
653
- case 5:
654
- _e.sent();
675
+ case 6:
676
+ _f.sent();
655
677
  return [2 /*return*/];
656
678
  }
657
679
  });
@@ -660,9 +682,9 @@ var Curve = /** @class */ (function () {
660
682
  Curve.prototype.fetchCryptoFactoryPools = function (useApi) {
661
683
  if (useApi === void 0) { useApi = true; }
662
684
  return __awaiter(this, void 0, void 0, function () {
663
- var _a, _b, _c, _d;
664
- return __generator(this, function (_e) {
665
- switch (_e.label) {
685
+ var _a, _b, _c, _d, _e;
686
+ return __generator(this, function (_f) {
687
+ switch (_f.label) {
666
688
  case 0:
667
689
  if (![1, 137, 250].includes(this.chainId))
668
690
  return [2 /*return*/];
@@ -671,21 +693,25 @@ var Curve = /** @class */ (function () {
671
693
  _b = utils_1.lowerCasePoolDataAddresses;
672
694
  return [4 /*yield*/, factory_api_1.getFactoryPoolsDataFromApi.call(this, true)];
673
695
  case 1:
674
- _a.CRYPTO_FACTORY_POOLS_DATA = _b.apply(void 0, [_e.sent()]);
696
+ _a.CRYPTO_FACTORY_POOLS_DATA = _b.apply(void 0, [_f.sent()]);
675
697
  return [3 /*break*/, 4];
676
698
  case 2:
677
699
  _c = this.constants;
678
700
  _d = utils_1.lowerCasePoolDataAddresses;
679
701
  return [4 /*yield*/, factory_crypto_1.getCryptoFactoryPoolData.call(this)];
680
702
  case 3:
681
- _c.CRYPTO_FACTORY_POOLS_DATA = _d.apply(void 0, [_e.sent()]);
682
- _e.label = 4;
703
+ _c.CRYPTO_FACTORY_POOLS_DATA = _d.apply(void 0, [_f.sent()]);
704
+ _f.label = 4;
683
705
  case 4:
706
+ _e = this.constants;
707
+ return [4 /*yield*/, this._filterHiddenPools(this.constants.CRYPTO_FACTORY_POOLS_DATA)];
708
+ case 5:
709
+ _e.CRYPTO_FACTORY_POOLS_DATA = _f.sent();
684
710
  this.constants.DECIMALS = __assign(__assign({}, this.constants.DECIMALS), (0, utils_1.extractDecimals)(this.constants.CRYPTO_FACTORY_POOLS_DATA));
685
711
  this.constants.GAUGES = __spreadArray(__spreadArray([], this.constants.GAUGES, true), (0, utils_1.extractGauges)(this.constants.CRYPTO_FACTORY_POOLS_DATA), true);
686
712
  return [4 /*yield*/, _killGauges(this.constants.CRYPTO_FACTORY_POOLS_DATA)];
687
- case 5:
688
- _e.sent();
713
+ case 6:
714
+ _f.sent();
689
715
  return [2 /*return*/];
690
716
  }
691
717
  });
@@ -723,9 +749,9 @@ var Curve = /** @class */ (function () {
723
749
  return [4 /*yield*/, factory_crypto_1.getCryptoFactoryPoolData.call(this, poolAddress)];
724
750
  case 1:
725
751
  poolData = _a.apply(void 0, [_b.sent()]);
726
- this.constants.FACTORY_POOLS_DATA = __assign(__assign({}, this.constants.FACTORY_POOLS_DATA), poolData);
727
- this.constants.DECIMALS = __assign(__assign({}, this.constants.DECIMALS), (0, utils_1.extractDecimals)(this.constants.FACTORY_POOLS_DATA));
728
- this.constants.GAUGES = __spreadArray(__spreadArray([], this.constants.GAUGES, true), (0, utils_1.extractGauges)(this.constants.FACTORY_POOLS_DATA), true);
752
+ this.constants.CRYPTO_FACTORY_POOLS_DATA = __assign(__assign({}, this.constants.CRYPTO_FACTORY_POOLS_DATA), poolData);
753
+ this.constants.DECIMALS = __assign(__assign({}, this.constants.DECIMALS), (0, utils_1.extractDecimals)(this.constants.CRYPTO_FACTORY_POOLS_DATA));
754
+ this.constants.GAUGES = __spreadArray(__spreadArray([], this.constants.GAUGES, true), (0, utils_1.extractGauges)(this.constants.CRYPTO_FACTORY_POOLS_DATA), true);
729
755
  return [2 /*return*/, Object.keys(poolData)[0]]; // id
730
756
  }
731
757
  });
@@ -31,3 +31,4 @@ export declare const _getAllGauges: (() => Promise<IDict<{
31
31
  gauge: string;
32
32
  is_killed?: boolean;
33
33
  }>>>;
34
+ export declare const _getHiddenPools: (() => Promise<IDict<string[]>>) & memoize.Memoized<() => Promise<IDict<string[]>>>;
@@ -39,7 +39,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
39
39
  return (mod && mod.__esModule) ? mod : { "default": mod };
40
40
  };
41
41
  Object.defineProperty(exports, "__esModule", { value: true });
42
- exports._getAllGauges = exports._getFactoryAPYsAndVolumes = exports._getLegacyAPYsAndVolumes = exports._getSubgraphData = exports._getPoolsFromApi = void 0;
42
+ exports._getHiddenPools = exports._getAllGauges = exports._getFactoryAPYsAndVolumes = exports._getLegacyAPYsAndVolumes = exports._getSubgraphData = exports._getPoolsFromApi = void 0;
43
43
  var axios_1 = __importDefault(require("axios"));
44
44
  var memoizee_1 = __importDefault(require("memoizee"));
45
45
  var curve_1 = require("./curve");
@@ -139,3 +139,19 @@ exports._getAllGauges = (0, memoizee_1.default)(function () { return __awaiter(v
139
139
  promise: true,
140
140
  maxAge: 5 * 60 * 1000, // 5m
141
141
  });
142
+ exports._getHiddenPools = (0, memoizee_1.default)(function () { return __awaiter(void 0, void 0, void 0, function () {
143
+ var url, response;
144
+ return __generator(this, function (_a) {
145
+ switch (_a.label) {
146
+ case 0:
147
+ url = "https://api.curve.fi/api/getHiddenPools";
148
+ return [4 /*yield*/, axios_1.default.get(url, { validateStatus: function () { return true; } })];
149
+ case 1:
150
+ response = _a.sent();
151
+ return [2 /*return*/, response.data.data];
152
+ }
153
+ });
154
+ }); }, {
155
+ promise: true,
156
+ maxAge: 5 * 60 * 1000, // 5m
157
+ });
@@ -282,7 +282,7 @@ var PoolTemplate = /** @class */ (function () {
282
282
  this.statsTokenApy = function (useApi) {
283
283
  if (useApi === void 0) { useApi = true; }
284
284
  return __awaiter(_this, void 0, void 0, function () {
285
- var isDisabledChain, dontUseApi, crvAPYs, poolCrvApy, totalLiquidityUSD, inflationRateBN, workingSupplyBN, totalSupplyBN, gaugeContract, lpTokenContract, crvContract, currentWeek, _c, gaugeContract, lpTokenContract, gaugeControllerContract, weightBN, rateBN, crvPrice, baseApyBN, boostedApyBN;
285
+ var isDisabledChain, crvAPYs, poolCrvApy, totalLiquidityUSD, inflationRateBN, workingSupplyBN, totalSupplyBN, gaugeContract, lpTokenContract, crvContract, currentWeek, _c, gaugeContract, lpTokenContract, gaugeControllerContract, weightBN, rateBN, crvPrice, baseApyBN, boostedApyBN;
286
286
  var _d, _e;
287
287
  var _f;
288
288
  return __generator(this, function (_g) {
@@ -290,9 +290,8 @@ var PoolTemplate = /** @class */ (function () {
290
290
  case 0:
291
291
  if (this.rewardsOnly())
292
292
  throw Error("".concat(this.name, " has Rewards-Only Gauge. Use stats.rewardsApy instead"));
293
- isDisabledChain = [1284, 2222, 42220, 1313161554].includes(curve_1.curve.chainId);
294
- dontUseApi = (curve_1.curve.chainId === 250 && this.id === 'factory-v2-42') || (curve_1.curve.chainId === 42161 && this.id === 'ren') || isDisabledChain;
295
- if (!(useApi && !dontUseApi)) return [3 /*break*/, 2];
293
+ isDisabledChain = [1313161554].includes(curve_1.curve.chainId);
294
+ if (!(useApi && !isDisabledChain)) return [3 /*break*/, 2];
296
295
  return [4 /*yield*/, (0, utils_1._getCrvApyFromApi)()];
297
296
  case 1:
298
297
  crvAPYs = _g.sent();
@@ -354,18 +353,17 @@ var PoolTemplate = /** @class */ (function () {
354
353
  this.statsRewardsApy = function (useApi) {
355
354
  if (useApi === void 0) { useApi = true; }
356
355
  return __awaiter(_this, void 0, void 0, function () {
357
- var isDisabledChain, dontUseApi, rewards, apy, rewardTokens, _i, rewardTokens_1, rewardToken, contract, totalLiquidityUSD, rewardRate, rewardData, periodFinish, inflation, baseApy;
358
- return __generator(this, function (_c) {
359
- switch (_c.label) {
356
+ var isDisabledChain, rewards, apy, rewardTokens, _i, rewardTokens_1, rewardToken, gaugeContract, lpTokenContract, rewardContract, totalLiquidityUSD, rewardRate, _c, rewardData, _stakedSupply, _totalSupply, stakedSupplyBN, totalSupplyBN, inflationBN, periodFinish, baseApy;
357
+ return __generator(this, function (_d) {
358
+ switch (_d.label) {
360
359
  case 0:
361
360
  if (this.gauge === ethers_1.ethers.constants.AddressZero)
362
361
  return [2 /*return*/, []];
363
- isDisabledChain = [1284, 2222, 42220, 1313161554].includes(curve_1.curve.chainId);
364
- dontUseApi = (curve_1.curve.chainId === 10 && this.id === 'factory-v2-0') || (curve_1.curve.chainId === 1284 && this.id === 'factory-v2-14') || isDisabledChain;
365
- if (!(curve_1.curve.chainId === 1 || (useApi && !dontUseApi))) return [3 /*break*/, 2];
362
+ isDisabledChain = [1313161554].includes(curve_1.curve.chainId);
363
+ if (!(curve_1.curve.chainId === 1 || (useApi && !isDisabledChain))) return [3 /*break*/, 2];
366
364
  return [4 /*yield*/, (0, utils_1._getRewardsFromApi)()];
367
365
  case 1:
368
- rewards = _c.sent();
366
+ rewards = _d.sent();
369
367
  if (!rewards[this.gauge])
370
368
  return [2 /*return*/, []];
371
369
  return [2 /*return*/, rewards[this.gauge].map(function (r) { return ({ gaugeAddress: r.gaugeAddress, tokenAddress: r.tokenAddress, symbol: r.symbol, apy: r.apy }); })];
@@ -373,32 +371,42 @@ var PoolTemplate = /** @class */ (function () {
373
371
  apy = [];
374
372
  return [4 /*yield*/, this.rewardTokens(false)];
375
373
  case 3:
376
- rewardTokens = _c.sent();
374
+ rewardTokens = _d.sent();
377
375
  _i = 0, rewardTokens_1 = rewardTokens;
378
- _c.label = 4;
376
+ _d.label = 4;
379
377
  case 4:
380
378
  if (!(_i < rewardTokens_1.length)) return [3 /*break*/, 9];
381
379
  rewardToken = rewardTokens_1[_i];
382
- contract = curve_1.curve.contracts[this.sRewardContract || this.gauge].contract;
380
+ gaugeContract = curve_1.curve.contracts[this.gauge].multicallContract;
381
+ lpTokenContract = curve_1.curve.contracts[this.lpToken].multicallContract;
382
+ rewardContract = curve_1.curve.contracts[this.sRewardContract || this.gauge].multicallContract;
383
383
  return [4 /*yield*/, this.statsTotalLiquidity()];
384
384
  case 5:
385
- totalLiquidityUSD = _c.sent();
385
+ totalLiquidityUSD = _d.sent();
386
386
  return [4 /*yield*/, (0, utils_1._getUsdRate)(rewardToken.token)];
387
387
  case 6:
388
- rewardRate = _c.sent();
389
- return [4 /*yield*/, contract.reward_data(rewardToken.token, curve_1.curve.constantOptions)];
388
+ rewardRate = _d.sent();
389
+ return [4 /*yield*/, curve_1.curve.multicallProvider.all([
390
+ rewardContract.reward_data(rewardToken.token),
391
+ gaugeContract.totalSupply(),
392
+ lpTokenContract.totalSupply(),
393
+ ])];
390
394
  case 7:
391
- rewardData = _c.sent();
395
+ _c = _d.sent(), rewardData = _c[0], _stakedSupply = _c[1], _totalSupply = _c[2];
396
+ stakedSupplyBN = (0, utils_1.toBN)(_stakedSupply);
397
+ totalSupplyBN = (0, utils_1.toBN)(_totalSupply);
398
+ inflationBN = (0, utils_1.toBN)(rewardData.rate, rewardToken.decimals);
392
399
  periodFinish = Number(ethers_1.ethers.utils.formatUnits(rewardData.period_finish, 0)) * 1000;
393
- inflation = (0, utils_1.toBN)(rewardData.rate, rewardToken.decimals);
394
- baseApy = periodFinish > Date.now() ? inflation.times(31536000).times(rewardRate).div(Number(totalLiquidityUSD)) : (0, utils_1.BN)(0);
400
+ baseApy = periodFinish > Date.now() ?
401
+ inflationBN.times(31536000).times(rewardRate).div(stakedSupplyBN).times(totalSupplyBN).div(Number(totalLiquidityUSD)) :
402
+ (0, utils_1.BN)(0);
395
403
  apy.push({
396
404
  gaugeAddress: this.gauge,
397
405
  tokenAddress: rewardToken.token,
398
406
  symbol: rewardToken.symbol,
399
407
  apy: baseApy.times(100).toNumber(),
400
408
  });
401
- _c.label = 8;
409
+ _d.label = 8;
402
410
  case 8:
403
411
  _i++;
404
412
  return [3 /*break*/, 4];
@@ -2116,7 +2124,7 @@ var PoolTemplate = /** @class */ (function () {
2116
2124
  };
2117
2125
  PoolTemplate.prototype._depositAndStake = function (amounts, slippage, isUnderlying, estimateGas) {
2118
2126
  return __awaiter(this, void 0, void 0, function () {
2119
- var coinAddresses, coins, decimals, depositAddress, balances, _c, _d, _e, _f, _g, i, allowance, _h, _amounts, contract, useUnderlying, _expectedLpTokenAmount, _j, _k, _l, _m, _o, minAmountBN, _minMintAmount, ethIndex, value, i, _gas, gasLimit;
2127
+ var coinAddresses, coins, decimals, depositAddress, balances, _c, _d, _e, _f, _g, i, allowance, _h, _amounts, contract, useUnderlying, _expectedLpTokenAmount, _j, _k, _l, _m, _o, minAmountBN, _minMintAmount, ethIndex, value, maxCoins, i, _gas, gasLimit;
2120
2128
  return __generator(this, function (_q) {
2121
2129
  switch (_q.label) {
2122
2130
  case 0:
@@ -2192,7 +2200,8 @@ var PoolTemplate = /** @class */ (function () {
2192
2200
  _minMintAmount = (0, utils_1.fromBN)(minAmountBN);
2193
2201
  ethIndex = (0, utils_1.getEthIndex)(coinAddresses);
2194
2202
  value = _amounts[ethIndex] || ethers_1.ethers.BigNumber.from(0);
2195
- for (i = 0; i < 5; i++) {
2203
+ maxCoins = curve_1.curve.chainId === 137 ? 6 : 5;
2204
+ for (i = 0; i < maxCoins; i++) {
2196
2205
  coinAddresses[i] = coinAddresses[i] || ethers_1.ethers.constants.AddressZero;
2197
2206
  _amounts[i] = _amounts[i] || ethers_1.ethers.BigNumber.from(0);
2198
2207
  }
@@ -2786,7 +2795,7 @@ var PoolTemplate = /** @class */ (function () {
2786
2795
  case 1:
2787
2796
  lpTotalBalanceBN = _c.sent();
2788
2797
  if (lpTotalBalanceBN.eq(0))
2789
- return [2 /*return*/, this.underlyingCoins.map(function () { return "0"; })];
2798
+ return [2 /*return*/, this.wrappedCoins.map(function () { return "0"; })];
2790
2799
  return [4 /*yield*/, this.withdrawWrappedExpected(lpTotalBalanceBN.toFixed(18))];
2791
2800
  case 2: return [2 /*return*/, _c.sent()];
2792
2801
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@curvefi/api",
3
- "version": "2.25.1",
3
+ "version": "2.25.3",
4
4
  "description": "JavaScript library for curve.fi",
5
5
  "main": "lib/index.js",
6
6
  "author": "Macket",