@curvefi/api 1.4.0 → 1.5.1
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 +8 -8
- package/lib/constants/abis/json/busd/swap.json +1 -2
- package/lib/constants/abis/json/compound/swap.json +1 -2
- package/lib/constants/abis/json/iearn/swap.json +1 -2
- package/lib/constants/abis/json/pax/swap.json +1 -2
- package/lib/constants/abis/json/ren/swap.json +1 -2
- package/lib/constants/abis/json/sbtc/swap.json +1 -2
- package/lib/constants/abis/json/susdv2/swap.json +1 -2
- package/lib/constants/abis/json/usdt/swap.json +1 -2
- package/lib/curve.d.ts +3 -1
- package/lib/curve.js +3 -2
- package/lib/pools.d.ts +45 -1
- package/lib/pools.js +734 -282
- package/lib/utils.js +4 -4
- package/package.json +1 -1
package/lib/boosting.js
CHANGED
|
@@ -181,7 +181,7 @@ var createLockEstimateGas = function (amount, days) { return __awaiter(void 0, v
|
|
|
181
181
|
}
|
|
182
182
|
_amount = ethers_1.ethers.utils.parseUnits(amount);
|
|
183
183
|
unlockTime = Math.floor(Date.now() / 1000) + (days * 86400);
|
|
184
|
-
return [4 /*yield*/, curve_1.curve.contracts[curve_1.ALIASES.voting_escrow].contract.estimateGas.create_lock(_amount, unlockTime)];
|
|
184
|
+
return [4 /*yield*/, curve_1.curve.contracts[curve_1.ALIASES.voting_escrow].contract.estimateGas.create_lock(_amount, unlockTime, curve_1.curve.constantOptions)];
|
|
185
185
|
case 3: return [2 /*return*/, (_a.sent()).toNumber()];
|
|
186
186
|
}
|
|
187
187
|
});
|
|
@@ -201,7 +201,7 @@ var createLock = function (amount, days) { return __awaiter(void 0, void 0, void
|
|
|
201
201
|
return [4 /*yield*/, curve_1.curve.updateFeeData()];
|
|
202
202
|
case 2:
|
|
203
203
|
_a.sent();
|
|
204
|
-
return [4 /*yield*/, contract.estimateGas.create_lock(_amount, unlockTime)];
|
|
204
|
+
return [4 /*yield*/, contract.estimateGas.create_lock(_amount, unlockTime, curve_1.curve.constantOptions)];
|
|
205
205
|
case 3:
|
|
206
206
|
gasLimit = (_a.sent()).mul(130).div(100);
|
|
207
207
|
return [4 /*yield*/, contract.create_lock(_amount, unlockTime, __assign(__assign({}, curve_1.curve.options), { gasLimit: gasLimit }))];
|
|
@@ -227,7 +227,7 @@ var increaseAmountEstimateGas = function (amount) { return __awaiter(void 0, voi
|
|
|
227
227
|
}
|
|
228
228
|
_amount = ethers_1.ethers.utils.parseUnits(amount);
|
|
229
229
|
contract = curve_1.curve.contracts[curve_1.ALIASES.voting_escrow].contract;
|
|
230
|
-
return [4 /*yield*/, contract.estimateGas.increase_amount(_amount)];
|
|
230
|
+
return [4 /*yield*/, contract.estimateGas.increase_amount(_amount, curve_1.curve.constantOptions)];
|
|
231
231
|
case 3: return [2 /*return*/, (_a.sent()).toNumber()];
|
|
232
232
|
}
|
|
233
233
|
});
|
|
@@ -246,7 +246,7 @@ var increaseAmount = function (amount) { return __awaiter(void 0, void 0, void 0
|
|
|
246
246
|
return [4 /*yield*/, curve_1.curve.updateFeeData()];
|
|
247
247
|
case 2:
|
|
248
248
|
_a.sent();
|
|
249
|
-
return [4 /*yield*/, contract.estimateGas.increase_amount(_amount)];
|
|
249
|
+
return [4 /*yield*/, contract.estimateGas.increase_amount(_amount, curve_1.curve.constantOptions)];
|
|
250
250
|
case 3:
|
|
251
251
|
gasLimit = (_a.sent()).mul(130).div(100);
|
|
252
252
|
return [4 /*yield*/, contract.increase_amount(_amount, __assign(__assign({}, curve_1.curve.options), { gasLimit: gasLimit }))];
|
|
@@ -264,7 +264,7 @@ var increaseUnlockTimeEstimateGas = function (days) { return __awaiter(void 0, v
|
|
|
264
264
|
unlockTime = (_a.sent()).unlockTime;
|
|
265
265
|
newUnlockTime = Math.floor(unlockTime / 1000) + (days * 86400);
|
|
266
266
|
contract = curve_1.curve.contracts[curve_1.ALIASES.voting_escrow].contract;
|
|
267
|
-
return [4 /*yield*/, contract.estimateGas.increase_unlock_time(newUnlockTime)];
|
|
267
|
+
return [4 /*yield*/, contract.estimateGas.increase_unlock_time(newUnlockTime, curve_1.curve.constantOptions)];
|
|
268
268
|
case 2: return [2 /*return*/, (_a.sent()).toNumber()];
|
|
269
269
|
}
|
|
270
270
|
});
|
|
@@ -282,7 +282,7 @@ var increaseUnlockTime = function (days) { return __awaiter(void 0, void 0, void
|
|
|
282
282
|
return [4 /*yield*/, curve_1.curve.updateFeeData()];
|
|
283
283
|
case 2:
|
|
284
284
|
_a.sent();
|
|
285
|
-
return [4 /*yield*/, contract.estimateGas.increase_unlock_time(newUnlockTime)];
|
|
285
|
+
return [4 /*yield*/, contract.estimateGas.increase_unlock_time(newUnlockTime, curve_1.curve.constantOptions)];
|
|
286
286
|
case 3:
|
|
287
287
|
gasLimit = (_a.sent()).mul(130).div(100);
|
|
288
288
|
return [4 /*yield*/, contract.increase_unlock_time(newUnlockTime, __assign(__assign({}, curve_1.curve.options), { gasLimit: gasLimit }))];
|
|
@@ -297,7 +297,7 @@ var withdrawLockedCrvEstimateGas = function () { return __awaiter(void 0, void 0
|
|
|
297
297
|
switch (_a.label) {
|
|
298
298
|
case 0:
|
|
299
299
|
contract = curve_1.curve.contracts[curve_1.ALIASES.voting_escrow].contract;
|
|
300
|
-
return [4 /*yield*/, contract.estimateGas.withdraw()];
|
|
300
|
+
return [4 /*yield*/, contract.estimateGas.withdraw(curve_1.curve.constantOptions)];
|
|
301
301
|
case 1: return [2 /*return*/, (_a.sent()).toNumber()];
|
|
302
302
|
}
|
|
303
303
|
});
|
|
@@ -312,7 +312,7 @@ var withdrawLockedCrv = function () { return __awaiter(void 0, void 0, void 0, f
|
|
|
312
312
|
return [4 /*yield*/, curve_1.curve.updateFeeData()];
|
|
313
313
|
case 1:
|
|
314
314
|
_a.sent();
|
|
315
|
-
return [4 /*yield*/, contract.estimateGas.withdraw()];
|
|
315
|
+
return [4 /*yield*/, contract.estimateGas.withdraw(curve_1.curve.constantOptions)];
|
|
316
316
|
case 2:
|
|
317
317
|
gasLimit = (_a.sent()).mul(130).div(100);
|
|
318
318
|
return [4 /*yield*/, contract.withdraw(__assign(__assign({}, curve_1.curve.options), { gasLimit: gasLimit }))];
|
package/lib/curve.d.ts
CHANGED
|
@@ -28,8 +28,10 @@ declare class Curve {
|
|
|
28
28
|
maxFeePerGas?: number;
|
|
29
29
|
maxPriorityFeePerGas?: number;
|
|
30
30
|
};
|
|
31
|
-
|
|
31
|
+
constantOptions: {
|
|
32
32
|
gasLimit: number;
|
|
33
|
+
};
|
|
34
|
+
options: {
|
|
33
35
|
gasPrice?: number | ethers.BigNumber;
|
|
34
36
|
maxFeePerGas?: number | ethers.BigNumber;
|
|
35
37
|
maxPriorityFeePerGas?: number | ethers.BigNumber;
|
package/lib/curve.js
CHANGED
|
@@ -71,7 +71,7 @@ exports.ALIASES = {
|
|
|
71
71
|
"minter": "0xd061D61a4d941c39E5453435B6345Dc261C2fcE0",
|
|
72
72
|
"fee_distributor": "0xA464e6DCda8AC41e03616F95f4BC98a13b8922Dc",
|
|
73
73
|
"address_provider": "0x0000000022d53366457f9d5e68ec105046fc4383",
|
|
74
|
-
"router": "
|
|
74
|
+
"router": "0xfA9a30350048B2BF66865ee20363067c66f67e58",
|
|
75
75
|
};
|
|
76
76
|
var cTokens = [
|
|
77
77
|
'0x5d3a536E4D6DbD6114cc1Ead35777bAB948E3643',
|
|
@@ -112,7 +112,8 @@ var Curve = /** @class */ (function () {
|
|
|
112
112
|
this.multicallProvider = null;
|
|
113
113
|
this.contracts = {};
|
|
114
114
|
this.feeData = {};
|
|
115
|
-
this.
|
|
115
|
+
this.constantOptions = { gasLimit: 12000000 };
|
|
116
|
+
this.options = {};
|
|
116
117
|
}
|
|
117
118
|
Curve.prototype.init = function (providerType, providerSettings, options // gasPrice in Gwei
|
|
118
119
|
) {
|
package/lib/pools.d.ts
CHANGED
|
@@ -18,46 +18,80 @@ export declare class Pool {
|
|
|
18
18
|
basePool: string;
|
|
19
19
|
isFactory: boolean;
|
|
20
20
|
estimateGas: {
|
|
21
|
+
addLiquidityApprove: (amounts: string[]) => Promise<number>;
|
|
21
22
|
addLiquidity: (amounts: string[]) => Promise<number>;
|
|
23
|
+
addLiquidityWrappedApprove: (amounts: string[]) => Promise<number>;
|
|
22
24
|
addLiquidityWrapped: (amounts: string[]) => Promise<number>;
|
|
25
|
+
gaugeDepositApprove: (lpTokenAmount: string) => Promise<number>;
|
|
26
|
+
gaugeDeposit: (lpTokenAmount: string) => Promise<number>;
|
|
27
|
+
gaugeWithdraw: (lpTokenAmount: string) => Promise<number>;
|
|
28
|
+
removeLiquidityApprove: (lpTokenAmount: string) => Promise<number>;
|
|
23
29
|
removeLiquidity: (lpTokenAmount: string) => Promise<number>;
|
|
24
30
|
removeLiquidityWrapped: (lpTokenAmount: string) => Promise<number>;
|
|
31
|
+
removeLiquidityImbalanceApprove: (amounts: string[]) => Promise<number>;
|
|
25
32
|
removeLiquidityImbalance: (amounts: string[]) => Promise<number>;
|
|
26
33
|
removeLiquidityImbalanceWrapped: (amounts: string[]) => Promise<number>;
|
|
34
|
+
removeLiquidityOneCoinApprove: (lpTokenAmount: string, coin: string | number) => Promise<number>;
|
|
27
35
|
removeLiquidityOneCoin: (lpTokenAmount: string, coin: string | number) => Promise<number>;
|
|
28
36
|
removeLiquidityOneCoinWrapped: (lpTokenAmount: string, coin: string | number) => Promise<number>;
|
|
37
|
+
exchangeApprove: (inputCoin: string | number, amount: string) => Promise<number>;
|
|
29
38
|
exchange: (inputCoin: string | number, outputCoin: string | number, amount: string, maxSlippage: number) => Promise<number>;
|
|
30
|
-
|
|
39
|
+
exchangeTricryptoApprove: (inputCoin: string | number, amount: string, useEth?: boolean) => Promise<number>;
|
|
40
|
+
exchangeTricrypto: (inputCoin: string | number, outputCoin: string | number, amount: string, maxSlippage: number, useEth?: boolean) => Promise<number>;
|
|
41
|
+
exchangeWrappedApprove: (inputCoin: string | number, amount: string) => Promise<number>;
|
|
31
42
|
exchangeWrapped: (inputCoin: string | number, outputCoin: string | number, amount: string, maxSlippage: number) => Promise<number>;
|
|
32
43
|
};
|
|
33
44
|
constructor(name: string);
|
|
34
45
|
calcLpTokenAmount: (amounts: string[], isDeposit?: boolean) => Promise<string>;
|
|
35
46
|
calcLpTokenAmountWrapped: (amounts: string[], isDeposit?: boolean) => Promise<string>;
|
|
47
|
+
getVirtualPrice: () => Promise<string>;
|
|
36
48
|
addLiquidityExpected: (amounts: string[]) => Promise<string>;
|
|
49
|
+
addLiquidityIsApproved: (amounts: string[]) => Promise<boolean>;
|
|
50
|
+
private addLiquidityApproveEstimateGas;
|
|
51
|
+
addLiquidityApprove: (amounts: string[]) => Promise<string[]>;
|
|
37
52
|
private addLiquidityEstimateGas;
|
|
53
|
+
balancedAmounts: () => Promise<string[]>;
|
|
38
54
|
addLiquidity: (amounts: string[]) => Promise<string>;
|
|
55
|
+
balancedWrappedAmounts: (address?: string | undefined) => Promise<string[]>;
|
|
39
56
|
addLiquidityWrappedExpected: (amounts: string[]) => Promise<string>;
|
|
57
|
+
addLiquidityWrappedIsApproved: (amounts: string[]) => Promise<boolean>;
|
|
58
|
+
private addLiquidityWrappedApproveEstimateGas;
|
|
59
|
+
addLiquidityWrappedApprove: (amounts: string[]) => Promise<string[]>;
|
|
40
60
|
private addLiquidityWrappedEstimateGas;
|
|
41
61
|
addLiquidityWrapped: (amounts: string[]) => Promise<string>;
|
|
42
62
|
removeLiquidityExpected: (lpTokenAmount: string) => Promise<string[]>;
|
|
63
|
+
removeLiquidityIsApproved: (lpTokenAmount: string) => Promise<boolean>;
|
|
64
|
+
private removeLiquidityApproveEstimateGas;
|
|
65
|
+
removeLiquidityApprove: (lpTokenAmount: string) => Promise<string[]>;
|
|
43
66
|
private removeLiquidityEstimateGas;
|
|
44
67
|
removeLiquidity: (lpTokenAmount: string) => Promise<string>;
|
|
45
68
|
removeLiquidityWrappedExpected: (lpTokenAmount: string) => Promise<string[]>;
|
|
46
69
|
private removeLiquidityWrappedEstimateGas;
|
|
47
70
|
removeLiquidityWrapped: (lpTokenAmount: string) => Promise<string>;
|
|
48
71
|
removeLiquidityImbalanceExpected: (amounts: string[]) => Promise<string>;
|
|
72
|
+
removeLiquidityImbalanceIsApproved: (amounts: string[]) => Promise<boolean>;
|
|
73
|
+
private removeLiquidityImbalanceApproveEstimateGas;
|
|
74
|
+
removeLiquidityImbalanceApprove: (amounts: string[]) => Promise<string[]>;
|
|
49
75
|
private removeLiquidityImbalanceEstimateGas;
|
|
50
76
|
removeLiquidityImbalance: (amounts: string[]) => Promise<string>;
|
|
51
77
|
removeLiquidityImbalanceWrappedExpected: (amounts: string[]) => Promise<string>;
|
|
52
78
|
private removeLiquidityImbalanceWrappedEstimateGas;
|
|
53
79
|
removeLiquidityImbalanceWrapped: (amounts: string[], estimateGas?: boolean) => Promise<string | number>;
|
|
54
80
|
removeLiquidityOneCoinExpected: (lpTokenAmount: string, coin: string | number) => Promise<string>;
|
|
81
|
+
removeLiquidityOneCoinIsApproved: (lpTokenAmount: string) => Promise<boolean>;
|
|
82
|
+
private removeLiquidityOneCoinApproveEstimateGas;
|
|
83
|
+
removeLiquidityOneCoinApprove: (lpTokenAmount: string) => Promise<string[]>;
|
|
55
84
|
private removeLiquidityOneCoinEstimateGas;
|
|
56
85
|
removeLiquidityOneCoin: (lpTokenAmount: string, coin: string | number) => Promise<string>;
|
|
57
86
|
removeLiquidityOneCoinWrappedExpected: (lpTokenAmount: string, coin: string | number) => Promise<string>;
|
|
58
87
|
private removeLiquidityOneCoinWrappedEstimateGas;
|
|
59
88
|
removeLiquidityOneCoinWrapped: (lpTokenAmount: string, coin: string | number) => Promise<string>;
|
|
89
|
+
gaugeDepositIsApproved: (lpTokenAmount: string) => Promise<boolean>;
|
|
90
|
+
private gaugeDepositApproveEstimateGas;
|
|
91
|
+
gaugeDepositApprove: (lpTokenAmount: string) => Promise<string[]>;
|
|
92
|
+
private gaugeDepositEstimateGas;
|
|
60
93
|
gaugeDeposit: (lpTokenAmount: string) => Promise<string>;
|
|
94
|
+
private gaugeWithdrawEstimateGas;
|
|
61
95
|
gaugeWithdraw: (lpTokenAmount: string) => Promise<string>;
|
|
62
96
|
balances: (...addresses: string[] | string[][]) => Promise<DictInterface<DictInterface<string>> | DictInterface<string>>;
|
|
63
97
|
lpTokenBalances: (...addresses: string[] | string[][]) => Promise<DictInterface<DictInterface<string>> | DictInterface<string>>;
|
|
@@ -65,11 +99,20 @@ export declare class Pool {
|
|
|
65
99
|
coinBalances: (...addresses: string[] | string[][]) => Promise<DictInterface<DictInterface<string>> | DictInterface<string>>;
|
|
66
100
|
allCoinBalances: (...addresses: string[] | string[][]) => Promise<DictInterface<DictInterface<string>> | DictInterface<string>>;
|
|
67
101
|
exchangeExpected: (inputCoin: string | number, outputCoin: string | number, amount: string) => Promise<string>;
|
|
102
|
+
exchangeIsApproved: (inputCoin: string | number, amount: string) => Promise<boolean>;
|
|
103
|
+
private exchangeApproveEstimateGas;
|
|
104
|
+
exchangeApprove: (inputCoin: string | number, amount: string) => Promise<string[]>;
|
|
68
105
|
private exchangeEstimateGas;
|
|
69
106
|
exchange: (inputCoin: string | number, outputCoin: string | number, amount: string, maxSlippage?: number) => Promise<string>;
|
|
107
|
+
exchangeTricryptoIsApproved: (inputCoin: string | number, amount: string, useEth?: boolean) => Promise<boolean>;
|
|
108
|
+
private exchangeTricryptoApproveEstimateGas;
|
|
109
|
+
exchangeTricryptoApprove: (inputCoin: string | number, amount: string, useEth?: boolean) => Promise<string[]>;
|
|
70
110
|
private exchangeTricryptoEstimateGas;
|
|
71
111
|
exchangeTricrypto: (inputCoin: string | number, outputCoin: string | number, amount: string, maxSlippage?: number, useEth?: boolean) => Promise<string>;
|
|
72
112
|
exchangeWrappedExpected: (inputCoin: string | number, outputCoin: string | number, amount: string) => Promise<string>;
|
|
113
|
+
exchangeWrappedIsApproved: (inputCoin: string | number, amount: string) => Promise<boolean>;
|
|
114
|
+
private exchangeWrappedApproveEstimateGas;
|
|
115
|
+
exchangeWrappedApprove: (inputCoin: string | number, amount: string) => Promise<string[]>;
|
|
73
116
|
private exchangeWrappedEstimateGas;
|
|
74
117
|
exchangeWrapped: (inputCoin: string | number, outputCoin: string | number, amount: string, maxSlippage?: number) => Promise<string>;
|
|
75
118
|
gaugeMaxBoostedDeposit: (...addresses: string[]) => Promise<DictInterface<string>>;
|
|
@@ -79,6 +122,7 @@ export declare class Pool {
|
|
|
79
122
|
private _getCoinIdx;
|
|
80
123
|
private _getRates;
|
|
81
124
|
private _balances;
|
|
125
|
+
private _balancedAmounts;
|
|
82
126
|
private _calcLpTokenAmount;
|
|
83
127
|
private _calcLpTokenAmountZap;
|
|
84
128
|
private _calcLpTokenAmountWithUnderlying;
|