@curvefi/api 2.50.1 → 2.50.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.
|
@@ -39,25 +39,25 @@ export declare class PoolTemplate {
|
|
|
39
39
|
depositWrappedApprove: (amounts: (number | string)[]) => Promise<number | number[]>;
|
|
40
40
|
depositWrapped: (amounts: (number | string)[]) => Promise<number | number[]>;
|
|
41
41
|
stakeApprove: (lpTokenAmount: number | string) => Promise<number | number[]>;
|
|
42
|
-
stake: (lpTokenAmount: number | string) => Promise<number>;
|
|
42
|
+
stake: (lpTokenAmount: number | string) => Promise<number | number[]>;
|
|
43
43
|
unstake: (lpTokenAmount: number | string) => Promise<number | number[]>;
|
|
44
44
|
claimCrv: () => Promise<number | number[]>;
|
|
45
|
-
claimRewards: () => Promise<number>;
|
|
45
|
+
claimRewards: () => Promise<number | number[]>;
|
|
46
46
|
depositAndStakeApprove: (amounts: (number | string)[]) => Promise<number | number[]>;
|
|
47
47
|
depositAndStake: (amounts: (number | string)[]) => Promise<number>;
|
|
48
48
|
depositAndStakeWrappedApprove: (amounts: (number | string)[]) => Promise<number | number[]>;
|
|
49
|
-
depositAndStakeWrapped: (amounts: (number | string)[]) => Promise<number>;
|
|
49
|
+
depositAndStakeWrapped: (amounts: (number | string)[]) => Promise<number | number[]>;
|
|
50
50
|
withdrawApprove: (lpTokenAmount: number | string) => Promise<number | number[]>;
|
|
51
|
-
withdraw: (lpTokenAmount: number | string) => Promise<number>;
|
|
52
|
-
withdrawWrapped: (lpTokenAmount: number | string) => Promise<number>;
|
|
51
|
+
withdraw: (lpTokenAmount: number | string) => Promise<number | number[]>;
|
|
52
|
+
withdrawWrapped: (lpTokenAmount: number | string) => Promise<number | number[]>;
|
|
53
53
|
withdrawImbalanceApprove: (amounts: (number | string)[]) => Promise<number | number[]>;
|
|
54
|
-
withdrawImbalance: (amounts: (number | string)[]) => Promise<number>;
|
|
55
|
-
withdrawImbalanceWrapped: (amounts: (number | string)[]) => Promise<number>;
|
|
54
|
+
withdrawImbalance: (amounts: (number | string)[]) => Promise<number | number[]>;
|
|
55
|
+
withdrawImbalanceWrapped: (amounts: (number | string)[]) => Promise<number | number[]>;
|
|
56
56
|
withdrawOneCoinApprove: (lpTokenAmount: number | string) => Promise<number | number[]>;
|
|
57
|
-
withdrawOneCoin: (lpTokenAmount: number | string, coin: string | number) => Promise<number>;
|
|
58
|
-
withdrawOneCoinWrapped: (lpTokenAmount: number | string, coin: string | number) => Promise<number>;
|
|
57
|
+
withdrawOneCoin: (lpTokenAmount: number | string, coin: string | number) => Promise<number | number[]>;
|
|
58
|
+
withdrawOneCoinWrapped: (lpTokenAmount: number | string, coin: string | number) => Promise<number | number[]>;
|
|
59
59
|
swapApprove: (inputCoin: string | number, amount: number | string) => Promise<number | number[]>;
|
|
60
|
-
swap: (inputCoin: string | number, outputCoin: string | number, amount: number | string, slippage: number) => Promise<number>;
|
|
60
|
+
swap: (inputCoin: string | number, outputCoin: string | number, amount: number | string, slippage: number) => Promise<number | number[]>;
|
|
61
61
|
swapWrappedApprove: (inputCoin: string | number, amount: number | string) => Promise<number | number[]>;
|
|
62
62
|
swapWrapped: (inputCoin: string | number, outputCoin: string | number, amount: number | string, slippage: number) => Promise<number | number[]>;
|
|
63
63
|
};
|
|
@@ -157,7 +157,7 @@ export declare class PoolTemplate {
|
|
|
157
157
|
symbol: string;
|
|
158
158
|
amount: string;
|
|
159
159
|
}[]>;
|
|
160
|
-
claimRewardsEstimateGas(): Promise<number>;
|
|
160
|
+
claimRewardsEstimateGas(): Promise<number | number[]>;
|
|
161
161
|
claimRewards(): Promise<string>;
|
|
162
162
|
depositAndStakeExpected(amounts: (number | string)[]): Promise<string>;
|
|
163
163
|
depositAndStakeBonus(amounts: (number | string)[]): Promise<string>;
|
|
@@ -1646,7 +1646,7 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
1646
1646
|
throw Error("stakeEstimateGas method doesn't exist for pool ".concat(this.name, " (id: ").concat(this.name, "). There is no gauge"));
|
|
1647
1647
|
}
|
|
1648
1648
|
_lpTokenAmount = parseUnits(lpTokenAmount);
|
|
1649
|
-
_c =
|
|
1649
|
+
_c = smartNumber;
|
|
1650
1650
|
return [4 /*yield*/, curve.contracts[this.gauge].contract.deposit.estimateGas(_lpTokenAmount, curve.constantOptions)];
|
|
1651
1651
|
case 1: return [2 /*return*/, _c.apply(void 0, [_d.sent()])];
|
|
1652
1652
|
}
|
|
@@ -1655,9 +1655,9 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
1655
1655
|
};
|
|
1656
1656
|
PoolTemplate.prototype.stake = function (lpTokenAmount) {
|
|
1657
1657
|
return __awaiter(this, void 0, void 0, function () {
|
|
1658
|
-
var _lpTokenAmount, gasLimit, _c;
|
|
1659
|
-
return __generator(this, function (
|
|
1660
|
-
switch (
|
|
1658
|
+
var _lpTokenAmount, gasLimit, _c, _d;
|
|
1659
|
+
return __generator(this, function (_e) {
|
|
1660
|
+
switch (_e.label) {
|
|
1661
1661
|
case 0:
|
|
1662
1662
|
if (this.gauge === curve.constants.ZERO_ADDRESS) {
|
|
1663
1663
|
throw Error("stake method doesn't exist for pool ".concat(this.name, " (id: ").concat(this.name, "). There is no gauge"));
|
|
@@ -1665,16 +1665,17 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
1665
1665
|
_lpTokenAmount = parseUnits(lpTokenAmount);
|
|
1666
1666
|
return [4 /*yield*/, _ensureAllowance([this.lpToken], [_lpTokenAmount], this.gauge)];
|
|
1667
1667
|
case 1:
|
|
1668
|
-
|
|
1668
|
+
_e.sent();
|
|
1669
1669
|
return [4 /*yield*/, curve.updateFeeData()];
|
|
1670
1670
|
case 2:
|
|
1671
|
-
|
|
1671
|
+
_e.sent();
|
|
1672
1672
|
_c = mulBy1_3;
|
|
1673
|
+
_d = DIGas;
|
|
1673
1674
|
return [4 /*yield*/, curve.contracts[this.gauge].contract.deposit.estimateGas(_lpTokenAmount, curve.constantOptions)];
|
|
1674
1675
|
case 3:
|
|
1675
|
-
gasLimit = _c.apply(void 0, [_d.sent()]);
|
|
1676
|
+
gasLimit = _c.apply(void 0, [_d.apply(void 0, [_e.sent()])]);
|
|
1676
1677
|
return [4 /*yield*/, curve.contracts[this.gauge].contract.deposit(_lpTokenAmount, __assign(__assign({}, curve.options), { gasLimit: gasLimit }))];
|
|
1677
|
-
case 4: return [2 /*return*/, (
|
|
1678
|
+
case 4: return [2 /*return*/, (_e.sent()).hash];
|
|
1678
1679
|
}
|
|
1679
1680
|
});
|
|
1680
1681
|
});
|
|
@@ -1848,7 +1849,7 @@ var PoolTemplate = /** @class */ (function () {
|
|
|
1848
1849
|
gaugeContract = curve.contracts[this.gauge].contract;
|
|
1849
1850
|
if (!("claim_rewards()" in gaugeContract))
|
|
1850
1851
|
throw Error("".concat(this.name, " pool doesn't have such method"));
|
|
1851
|
-
_c =
|
|
1852
|
+
_c = smartNumber;
|
|
1852
1853
|
return [4 /*yield*/, gaugeContract.claim_rewards.estimateGas(curve.constantOptions)];
|
|
1853
1854
|
case 1: return [2 /*return*/, _c.apply(void 0, [_d.sent()])];
|
|
1854
1855
|
}
|
|
@@ -321,7 +321,7 @@ export var withdrawOneCoinLendingOrCryptoMixin = {
|
|
|
321
321
|
gas = _a.sent();
|
|
322
322
|
if (estimateGas)
|
|
323
323
|
return [2 /*return*/, smartNumber(gas)];
|
|
324
|
-
gasLimit = curve.chainId === 137 && this.id === 'ren' ? gas * curve.parseUnits("160", 0) / curve.parseUnits("100", 0) : mulBy1_3(DIGas(gas));
|
|
324
|
+
gasLimit = curve.chainId === 137 && this.id === 'ren' ? DIGas(gas) * curve.parseUnits("160", 0) / curve.parseUnits("100", 0) : mulBy1_3(DIGas(gas));
|
|
325
325
|
return [4 /*yield*/, contract.remove_liquidity_one_coin(_lpTokenAmount, i, _minAmount, true, __assign(__assign({}, curve.options), { gasLimit: gasLimit }))];
|
|
326
326
|
case 3: return [2 /*return*/, (_a.sent()).hash];
|
|
327
327
|
}
|
package/lib/router.js
CHANGED
|
@@ -115,7 +115,7 @@ var SNX = {
|
|
|
115
115
|
},
|
|
116
116
|
};
|
|
117
117
|
var _buildRouteGraph = memoize(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
118
|
-
var routerGraph, _i, _a, outCoin, _b, _c, inCoin, _d, _e, outCoin, ALL_POOLS, amplificationCoefficientDict, _f, ALL_POOLS_1, _h, poolId, poolData, wrappedCoinAddresses, underlyingCoinAddresses, poolAddress, tokenAddress, isAaveLikeLending, poolType, tvlMultiplier, basePool, basePoolAddress, baseTokenAddress, secondBasePool, secondBasePoolAddress, secondBaseTokenAddress, metaCoinAddresses, swapAddress, tvl, coins, k, l, i, j, swapType, coins, k, l, i, j, swapType, i, j, i, j, hasEth, swapType;
|
|
118
|
+
var routerGraph, _i, _a, outCoin, _b, _c, inCoin, _d, _e, outCoin, ALL_POOLS, amplificationCoefficientDict, _f, ALL_POOLS_1, _h, poolId, poolData, wrappedCoinAddresses, underlyingCoinAddresses, poolAddress, tokenAddress, isAaveLikeLending, poolType, tvlMultiplier, basePool, basePoolAddress, baseTokenAddress, secondBasePool, secondBasePoolAddress, secondBaseTokenAddress, metaCoinAddresses, swapAddress, tvl, excludedUnderlyingSwaps, coins, k, l, i, j, swapType, coins, k, l, i, j, swapType, i, j, i, j, hasEth, swapType;
|
|
119
119
|
var _j, _k, _l;
|
|
120
120
|
return __generator(this, function (_m) {
|
|
121
121
|
switch (_m.label) {
|
|
@@ -300,6 +300,7 @@ var _buildRouteGraph = memoize(function () { return __awaiter(void 0, void 0, vo
|
|
|
300
300
|
return [3 /*break*/, 4];
|
|
301
301
|
if (curve.chainId !== 1 && tvl < 100)
|
|
302
302
|
return [3 /*break*/, 4];
|
|
303
|
+
excludedUnderlyingSwaps = (poolId === 'aave' && curve.chainId === 1) || (poolId === 'geist' && curve.chainId === 250);
|
|
303
304
|
// Wrapped coin <-> LP "swaps" (actually add_liquidity/remove_liquidity_one_coin)
|
|
304
305
|
if (!poolData.is_fake && !poolData.is_llamma && wrappedCoinAddresses.length < 6) {
|
|
305
306
|
coins = __spreadArray([tokenAddress], wrappedCoinAddresses, true);
|
|
@@ -333,7 +334,7 @@ var _buildRouteGraph = memoize(function () { return __awaiter(void 0, void 0, vo
|
|
|
333
334
|
}
|
|
334
335
|
}
|
|
335
336
|
// Underlying coin <-> LP "swaps" (actually add_liquidity/remove_liquidity_one_coin)
|
|
336
|
-
if ((poolData.is_fake || isAaveLikeLending) &&
|
|
337
|
+
if ((poolData.is_fake || isAaveLikeLending) && underlyingCoinAddresses.length < 6 && !excludedUnderlyingSwaps) {
|
|
337
338
|
coins = __spreadArray([tokenAddress], underlyingCoinAddresses, true);
|
|
338
339
|
for (k = 0; k < coins.length; k++) {
|
|
339
340
|
for (l = 0; l < coins.length; l++) {
|
|
@@ -396,7 +397,7 @@ var _buildRouteGraph = memoize(function () { return __awaiter(void 0, void 0, vo
|
|
|
396
397
|
swapAddress = (poolData.is_crypto && poolData.is_meta) || ((basePool === null || basePool === void 0 ? void 0 : basePool.is_lending) && poolData.is_factory) ?
|
|
397
398
|
poolData.deposit_address : poolData.swap_address;
|
|
398
399
|
// Underlying swaps
|
|
399
|
-
if (!poolData.is_plain &&
|
|
400
|
+
if (!poolData.is_plain && !excludedUnderlyingSwaps) {
|
|
400
401
|
for (i = 0; i < underlyingCoinAddresses.length; i++) {
|
|
401
402
|
for (j = 0; j < underlyingCoinAddresses.length; j++) {
|
|
402
403
|
if (i === j)
|
|
@@ -404,7 +405,7 @@ var _buildRouteGraph = memoize(function () { return __awaiter(void 0, void 0, vo
|
|
|
404
405
|
// Don't swap metacoins since they can be swapped directly in base pool
|
|
405
406
|
if (metaCoinAddresses.includes(underlyingCoinAddresses[i]) && metaCoinAddresses.includes(underlyingCoinAddresses[j]))
|
|
406
407
|
continue;
|
|
407
|
-
hasEth =
|
|
408
|
+
hasEth = underlyingCoinAddresses.includes(curve.constants.NATIVE_TOKEN.address);
|
|
408
409
|
swapType = (poolData.is_crypto && poolData.is_meta && poolData.is_factory) || ((basePool === null || basePool === void 0 ? void 0 : basePool.is_lending) && poolData.is_factory) ? 3
|
|
409
410
|
: hasEth && poolId !== 'avaxcrypto' ? 1 : 2;
|
|
410
411
|
if (!routerGraph[underlyingCoinAddresses[i]])
|