@curvefi/api 2.50.6 → 2.50.8
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.
|
@@ -407,7 +407,7 @@ export var depositPlainMixin = {
|
|
|
407
407
|
if (estimateGas)
|
|
408
408
|
return [2 /*return*/, smartNumber(gas)];
|
|
409
409
|
gasLimit = mulBy1_3(DIGas(gas));
|
|
410
|
-
return [4 /*yield*/, contract.add_liquidity(_amounts, _minMintAmount,
|
|
410
|
+
return [4 /*yield*/, contract.add_liquidity(_amounts, _minMintAmount, __assign(__assign({}, curve.options), { gasLimit: gasLimit, value: value }))];
|
|
411
411
|
case 5: return [2 /*return*/, (_a.sent()).hash];
|
|
412
412
|
}
|
|
413
413
|
});
|
|
@@ -379,7 +379,7 @@ export var withdrawPlainMixin = {
|
|
|
379
379
|
if (estimateGas)
|
|
380
380
|
return [2 /*return*/, smartNumber(gas)];
|
|
381
381
|
gasLimit = mulBy1_3(DIGas(gas));
|
|
382
|
-
return [4 /*yield*/, contract.remove_liquidity(_lpTokenAmount, _minAmounts,
|
|
382
|
+
return [4 /*yield*/, contract.remove_liquidity(_lpTokenAmount, _minAmounts, __assign(__assign({}, curve.options), { gasLimit: gasLimit }))];
|
|
383
383
|
case 3: return [2 /*return*/, (_b.sent()).hash];
|
|
384
384
|
}
|
|
385
385
|
});
|
|
@@ -380,7 +380,7 @@ export var withdrawOneCoinPlainMixin = {
|
|
|
380
380
|
if (estimateGas)
|
|
381
381
|
return [2 /*return*/, smartNumber(gas)];
|
|
382
382
|
gasLimit = mulBy1_3(DIGas(gas));
|
|
383
|
-
return [4 /*yield*/, contract.remove_liquidity_one_coin(_lpTokenAmount, i, _minAmount,
|
|
383
|
+
return [4 /*yield*/, contract.remove_liquidity_one_coin(_lpTokenAmount, i, _minAmount, __assign(__assign({}, curve.options), { gasLimit: gasLimit }))];
|
|
384
384
|
case 3: return [2 /*return*/, (_a.sent()).hash];
|
|
385
385
|
}
|
|
386
386
|
});
|
|
@@ -29,7 +29,8 @@ import { withdrawOneCoinMetaFactoryMixin, withdrawOneCoinCryptoMetaFactoryMixin,
|
|
|
29
29
|
import { withdrawOneCoinWrappedExpected2argsMixin, withdrawOneCoinWrappedExpected3argsMixin } from "./mixins/withdrawOneCoinWrappedExpectedMixins.js";
|
|
30
30
|
import { withdrawOneCoinWrappedLendingOrCryptoMixin, withdrawOneCoinWrappedMixin } from "./mixins/withdrawOneCoinWrappedMixins.js";
|
|
31
31
|
import { swapTricrypto2Mixin, swapMetaFactoryMixin, swapCryptoMetaFactoryMixin, swapMixin } from "./mixins/swapMixins.js";
|
|
32
|
-
import { swapWrappedExpectedAndApproveMixin, swapWrappedTricrypto2Mixin, swapWrappedMixin, swapWrappedRequiredMixin } from "./mixins/swapWrappedMixins.js";
|
|
32
|
+
import { swapWrappedExpectedAndApproveMixin, swapWrappedTricrypto2Mixin, swapWrappedMixin, swapWrappedRequiredMixin, } from "./mixins/swapWrappedMixins.js";
|
|
33
|
+
import { getCountArgsOfMethodByContract } from "../utils.js";
|
|
33
34
|
export var getPool = function (poolId) {
|
|
34
35
|
var poolDummy = new PoolTemplate(poolId);
|
|
35
36
|
var Pool = /** @class */ (function (_super) {
|
|
@@ -74,7 +75,7 @@ export var getPool = function (poolId) {
|
|
|
74
75
|
else if (poolDummy.zap && poolId !== 'susd') {
|
|
75
76
|
Object.assign(Pool.prototype, depositZapMixin);
|
|
76
77
|
}
|
|
77
|
-
else if (poolDummy.
|
|
78
|
+
else if (getCountArgsOfMethodByContract(curve.contracts[poolDummy.address].contract, 'add_liquidity') > 2) {
|
|
78
79
|
Object.assign(Pool.prototype, depositLendingOrCryptoMixin);
|
|
79
80
|
}
|
|
80
81
|
else {
|
|
@@ -111,7 +112,7 @@ export var getPool = function (poolId) {
|
|
|
111
112
|
else if (poolDummy.zap && poolId !== 'susd') {
|
|
112
113
|
Object.assign(Pool.prototype, withdrawZapMixin);
|
|
113
114
|
}
|
|
114
|
-
else if (poolDummy.
|
|
115
|
+
else if (getCountArgsOfMethodByContract(curve.contracts[poolDummy.address].contract, 'remove_liquidity') > 2) {
|
|
115
116
|
Object.assign(Pool.prototype, withdrawLendingOrCryptoMixin);
|
|
116
117
|
}
|
|
117
118
|
else {
|
|
@@ -177,7 +178,7 @@ export var getPool = function (poolId) {
|
|
|
177
178
|
else if (poolDummy.zap) { // including susd
|
|
178
179
|
Object.assign(Pool.prototype, withdrawOneCoinZapMixin);
|
|
179
180
|
}
|
|
180
|
-
else if (poolDummy.
|
|
181
|
+
else if (getCountArgsOfMethodByContract(curve.contracts[poolDummy.address].contract, 'remove_liquidity_one_coin') > 3) {
|
|
181
182
|
Object.assign(Pool.prototype, withdrawOneCoinLendingOrCryptoMixin);
|
|
182
183
|
}
|
|
183
184
|
else {
|
package/lib/utils.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Contract } from 'ethers';
|
|
1
2
|
import BigNumber from 'bignumber.js';
|
|
2
3
|
import { IChainId, IDict, INetworkName, IRewardFromApi } from './interfaces';
|
|
3
4
|
export declare const ETH_ADDRESS = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";
|
|
@@ -54,3 +55,4 @@ export declare const getCoinsData: (...coins: string[] | string[][]) => Promise<
|
|
|
54
55
|
}[]>;
|
|
55
56
|
export declare const hasDepositAndStake: () => boolean;
|
|
56
57
|
export declare const hasRouter: () => boolean;
|
|
58
|
+
export declare const getCountArgsOfMethodByContract: (contract: Contract, methodName: string) => number;
|
package/lib/utils.js
CHANGED
|
@@ -889,3 +889,12 @@ export var getCoinsData = function () {
|
|
|
889
889
|
};
|
|
890
890
|
export var hasDepositAndStake = function () { return curve.constants.ALIASES.deposit_and_stake !== curve.constants.ZERO_ADDRESS; };
|
|
891
891
|
export var hasRouter = function () { return curve.constants.ALIASES.router !== curve.constants.ZERO_ADDRESS; };
|
|
892
|
+
export var getCountArgsOfMethodByContract = function (contract, methodName) {
|
|
893
|
+
var func = contract.interface.fragments.find(function (item) { return item.name === methodName; });
|
|
894
|
+
if (func) {
|
|
895
|
+
return func.inputs.length;
|
|
896
|
+
}
|
|
897
|
+
else {
|
|
898
|
+
return -1;
|
|
899
|
+
}
|
|
900
|
+
};
|