@curvefi/api 1.2.0 → 1.4.2
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.d.ts +4 -0
- package/lib/boosting.js +136 -22
- package/lib/constants/coins.js +4 -2
- package/lib/curve.d.ts +18 -2
- package/lib/curve.js +76 -27
- package/lib/index.d.ts +19 -2
- package/lib/index.js +14 -3
- package/lib/pools.d.ts +31 -1
- package/lib/pools.js +1062 -397
- package/lib/utils.d.ts +1 -0
- package/lib/utils.js +85 -38
- package/package.json +2 -2
package/lib/boosting.d.ts
CHANGED
|
@@ -9,7 +9,11 @@ export declare const getLockedAmountAndUnlockTime: (...addresses: string[] | str
|
|
|
9
9
|
}>;
|
|
10
10
|
export declare const getVeCrv: (...addresses: string[] | string[][]) => Promise<DictInterface<string> | string>;
|
|
11
11
|
export declare const getVeCrvPct: (...addresses: string[] | string[][]) => Promise<DictInterface<string> | string>;
|
|
12
|
+
export declare const createLockEstimateGas: (amount: string, days: number) => Promise<number>;
|
|
12
13
|
export declare const createLock: (amount: string, days: number) => Promise<string>;
|
|
14
|
+
export declare const increaseAmountEstimateGas: (amount: string) => Promise<number>;
|
|
13
15
|
export declare const increaseAmount: (amount: string) => Promise<string>;
|
|
16
|
+
export declare const increaseUnlockTimeEstimateGas: (days: number) => Promise<number>;
|
|
14
17
|
export declare const increaseUnlockTime: (days: number) => Promise<string>;
|
|
18
|
+
export declare const withdrawLockedCrvEstimateGas: () => Promise<number>;
|
|
15
19
|
export declare const withdrawLockedCrv: () => Promise<string>;
|
package/lib/boosting.js
CHANGED
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
2
13
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
14
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
15
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -36,7 +47,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
36
47
|
}
|
|
37
48
|
};
|
|
38
49
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.withdrawLockedCrv = exports.increaseUnlockTime = exports.increaseAmount = exports.createLock = exports.getVeCrvPct = exports.getVeCrv = exports.getLockedAmountAndUnlockTime = exports.getCrv = void 0;
|
|
50
|
+
exports.withdrawLockedCrv = exports.withdrawLockedCrvEstimateGas = exports.increaseUnlockTime = exports.increaseUnlockTimeEstimateGas = exports.increaseAmount = exports.increaseAmountEstimateGas = exports.createLock = exports.createLockEstimateGas = exports.getVeCrvPct = exports.getVeCrv = exports.getLockedAmountAndUnlockTime = exports.getCrv = void 0;
|
|
40
51
|
var ethers_1 = require("ethers");
|
|
41
52
|
var utils_1 = require("./utils");
|
|
42
53
|
var utils_2 = require("./utils");
|
|
@@ -51,8 +62,8 @@ var getCrv = function () {
|
|
|
51
62
|
return __generator(this, function (_b) {
|
|
52
63
|
switch (_b.label) {
|
|
53
64
|
case 0:
|
|
54
|
-
addresses = utils_1._prepareAddresses(addresses);
|
|
55
|
-
return [4 /*yield*/, utils_1._getBalances([curve_1.ALIASES.crv], addresses)];
|
|
65
|
+
addresses = (0, utils_1._prepareAddresses)(addresses);
|
|
66
|
+
return [4 /*yield*/, (0, utils_1._getBalances)([curve_1.ALIASES.crv], addresses)];
|
|
56
67
|
case 1:
|
|
57
68
|
rawBalances = (_b.sent());
|
|
58
69
|
balances = {};
|
|
@@ -76,7 +87,7 @@ var getLockedAmountAndUnlockTime = function () {
|
|
|
76
87
|
return __generator(this, function (_a) {
|
|
77
88
|
switch (_a.label) {
|
|
78
89
|
case 0:
|
|
79
|
-
addresses = utils_1._prepareAddresses(addresses);
|
|
90
|
+
addresses = (0, utils_1._prepareAddresses)(addresses);
|
|
80
91
|
veContract = curve_1.curve.contracts[curve_1.ALIASES.voting_escrow].multicallContract;
|
|
81
92
|
contractCalls = addresses.map(function (address) { return veContract.locked(address); });
|
|
82
93
|
return [4 /*yield*/, curve_1.curve.multicallProvider.all(contractCalls)];
|
|
@@ -102,7 +113,7 @@ var getVeCrv = function () {
|
|
|
102
113
|
return __generator(this, function (_a) {
|
|
103
114
|
switch (_a.label) {
|
|
104
115
|
case 0:
|
|
105
|
-
addresses = utils_1._prepareAddresses(addresses);
|
|
116
|
+
addresses = (0, utils_1._prepareAddresses)(addresses);
|
|
106
117
|
veContract = curve_1.curve.contracts[curve_1.ALIASES.voting_escrow].multicallContract;
|
|
107
118
|
contractCalls = addresses.map(function (address) { return veContract.balanceOf(address); });
|
|
108
119
|
return [4 /*yield*/, curve_1.curve.multicallProvider.all(contractCalls)];
|
|
@@ -128,7 +139,7 @@ var getVeCrvPct = function () {
|
|
|
128
139
|
return __generator(this, function (_c) {
|
|
129
140
|
switch (_c.label) {
|
|
130
141
|
case 0:
|
|
131
|
-
addresses = utils_1._prepareAddresses(addresses);
|
|
142
|
+
addresses = (0, utils_1._prepareAddresses)(addresses);
|
|
132
143
|
veContract = curve_1.curve.contracts[curve_1.ALIASES.voting_escrow].multicallContract;
|
|
133
144
|
contractCalls = [veContract.totalSupply()];
|
|
134
145
|
addresses.forEach(function (address) {
|
|
@@ -136,7 +147,7 @@ var getVeCrvPct = function () {
|
|
|
136
147
|
});
|
|
137
148
|
return [4 /*yield*/, curve_1.curve.multicallProvider.all(contractCalls)];
|
|
138
149
|
case 1:
|
|
139
|
-
response = (_c.sent()).map(function (value) { return utils_2.toBN(value); });
|
|
150
|
+
response = (_c.sent()).map(function (value) { return (0, utils_2.toBN)(value); });
|
|
140
151
|
veTotalSupply = response.splice(0, 1)[0];
|
|
141
152
|
resultBN = {};
|
|
142
153
|
addresses.forEach(function (acct, i) {
|
|
@@ -145,7 +156,7 @@ var getVeCrvPct = function () {
|
|
|
145
156
|
result = {};
|
|
146
157
|
for (_a = 0, _b = Object.entries(resultBN); _a < _b.length; _a++) {
|
|
147
158
|
entry = _b[_a];
|
|
148
|
-
result[entry[0]] = utils_2.toStringFromBN(entry[1]);
|
|
159
|
+
result[entry[0]] = (0, utils_2.toStringFromBN)(entry[1]);
|
|
149
160
|
}
|
|
150
161
|
return [2 /*return*/, addresses.length === 1 ? result[addresses[0]] : result];
|
|
151
162
|
}
|
|
@@ -153,56 +164,159 @@ var getVeCrvPct = function () {
|
|
|
153
164
|
});
|
|
154
165
|
};
|
|
155
166
|
exports.getVeCrvPct = getVeCrvPct;
|
|
167
|
+
var createLockEstimateGas = function (amount, days) { return __awaiter(void 0, void 0, void 0, function () {
|
|
168
|
+
var crvBalance, _amount, unlockTime;
|
|
169
|
+
return __generator(this, function (_a) {
|
|
170
|
+
switch (_a.label) {
|
|
171
|
+
case 0: return [4 /*yield*/, (0, exports.getCrv)()];
|
|
172
|
+
case 1:
|
|
173
|
+
crvBalance = _a.sent();
|
|
174
|
+
if (Number(crvBalance) < Number(amount)) {
|
|
175
|
+
throw Error("Not enough . Actual: " + crvBalance + ", required: " + amount);
|
|
176
|
+
}
|
|
177
|
+
return [4 /*yield*/, (0, utils_1.hasAllowance)([curve_1.ALIASES.crv], [amount], curve_1.curve.signerAddress, curve_1.ALIASES.voting_escrow)];
|
|
178
|
+
case 2:
|
|
179
|
+
if (!(_a.sent())) {
|
|
180
|
+
throw Error("Token allowance is needed to estimate gas");
|
|
181
|
+
}
|
|
182
|
+
_amount = ethers_1.ethers.utils.parseUnits(amount);
|
|
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, curve_1.curve.constantOptions)];
|
|
185
|
+
case 3: return [2 /*return*/, (_a.sent()).toNumber()];
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
}); };
|
|
189
|
+
exports.createLockEstimateGas = createLockEstimateGas;
|
|
156
190
|
var createLock = function (amount, days) { return __awaiter(void 0, void 0, void 0, function () {
|
|
157
|
-
var _amount, unlockTime;
|
|
191
|
+
var _amount, unlockTime, contract, gasLimit;
|
|
158
192
|
return __generator(this, function (_a) {
|
|
159
193
|
switch (_a.label) {
|
|
160
194
|
case 0:
|
|
161
195
|
_amount = ethers_1.ethers.utils.parseUnits(amount);
|
|
162
196
|
unlockTime = Math.floor(Date.now() / 1000) + (days * 86400);
|
|
163
|
-
return [4 /*yield*/, utils_2._ensureAllowance([curve_1.ALIASES.crv], [_amount], curve_1.ALIASES.voting_escrow)];
|
|
197
|
+
return [4 /*yield*/, (0, utils_2._ensureAllowance)([curve_1.ALIASES.crv], [_amount], curve_1.ALIASES.voting_escrow)];
|
|
164
198
|
case 1:
|
|
165
199
|
_a.sent();
|
|
166
|
-
|
|
167
|
-
|
|
200
|
+
contract = curve_1.curve.contracts[curve_1.ALIASES.voting_escrow].contract;
|
|
201
|
+
return [4 /*yield*/, curve_1.curve.updateFeeData()];
|
|
202
|
+
case 2:
|
|
203
|
+
_a.sent();
|
|
204
|
+
return [4 /*yield*/, contract.estimateGas.create_lock(_amount, unlockTime, curve_1.curve.constantOptions)];
|
|
205
|
+
case 3:
|
|
206
|
+
gasLimit = (_a.sent()).mul(130).div(100);
|
|
207
|
+
return [4 /*yield*/, contract.create_lock(_amount, unlockTime, __assign(__assign({}, curve_1.curve.options), { gasLimit: gasLimit }))];
|
|
208
|
+
case 4: return [2 /*return*/, (_a.sent()).hash];
|
|
168
209
|
}
|
|
169
210
|
});
|
|
170
211
|
}); };
|
|
171
212
|
exports.createLock = createLock;
|
|
213
|
+
var increaseAmountEstimateGas = function (amount) { return __awaiter(void 0, void 0, void 0, function () {
|
|
214
|
+
var crvBalance, _amount, contract;
|
|
215
|
+
return __generator(this, function (_a) {
|
|
216
|
+
switch (_a.label) {
|
|
217
|
+
case 0: return [4 /*yield*/, (0, exports.getCrv)()];
|
|
218
|
+
case 1:
|
|
219
|
+
crvBalance = _a.sent();
|
|
220
|
+
if (Number(crvBalance) < Number(amount)) {
|
|
221
|
+
throw Error("Not enough. Actual: " + crvBalance + ", required: " + amount);
|
|
222
|
+
}
|
|
223
|
+
return [4 /*yield*/, (0, utils_1.hasAllowance)([curve_1.ALIASES.crv], [amount], curve_1.curve.signerAddress, curve_1.ALIASES.voting_escrow)];
|
|
224
|
+
case 2:
|
|
225
|
+
if (!(_a.sent())) {
|
|
226
|
+
throw Error("Token allowance is needed to estimate gas");
|
|
227
|
+
}
|
|
228
|
+
_amount = ethers_1.ethers.utils.parseUnits(amount);
|
|
229
|
+
contract = curve_1.curve.contracts[curve_1.ALIASES.voting_escrow].contract;
|
|
230
|
+
return [4 /*yield*/, contract.estimateGas.increase_amount(_amount, curve_1.curve.constantOptions)];
|
|
231
|
+
case 3: return [2 /*return*/, (_a.sent()).toNumber()];
|
|
232
|
+
}
|
|
233
|
+
});
|
|
234
|
+
}); };
|
|
235
|
+
exports.increaseAmountEstimateGas = increaseAmountEstimateGas;
|
|
172
236
|
var increaseAmount = function (amount) { return __awaiter(void 0, void 0, void 0, function () {
|
|
173
|
-
var _amount;
|
|
237
|
+
var _amount, contract, gasLimit;
|
|
174
238
|
return __generator(this, function (_a) {
|
|
175
239
|
switch (_a.label) {
|
|
176
240
|
case 0:
|
|
177
241
|
_amount = ethers_1.ethers.utils.parseUnits(amount);
|
|
178
|
-
return [4 /*yield*/, utils_2._ensureAllowance([curve_1.ALIASES.crv], [_amount], curve_1.ALIASES.voting_escrow)];
|
|
242
|
+
return [4 /*yield*/, (0, utils_2._ensureAllowance)([curve_1.ALIASES.crv], [_amount], curve_1.ALIASES.voting_escrow)];
|
|
179
243
|
case 1:
|
|
180
244
|
_a.sent();
|
|
181
|
-
|
|
182
|
-
|
|
245
|
+
contract = curve_1.curve.contracts[curve_1.ALIASES.voting_escrow].contract;
|
|
246
|
+
return [4 /*yield*/, curve_1.curve.updateFeeData()];
|
|
247
|
+
case 2:
|
|
248
|
+
_a.sent();
|
|
249
|
+
return [4 /*yield*/, contract.estimateGas.increase_amount(_amount, curve_1.curve.constantOptions)];
|
|
250
|
+
case 3:
|
|
251
|
+
gasLimit = (_a.sent()).mul(130).div(100);
|
|
252
|
+
return [4 /*yield*/, contract.increase_amount(_amount, __assign(__assign({}, curve_1.curve.options), { gasLimit: gasLimit }))];
|
|
253
|
+
case 4: return [2 /*return*/, (_a.sent()).hash];
|
|
183
254
|
}
|
|
184
255
|
});
|
|
185
256
|
}); };
|
|
186
257
|
exports.increaseAmount = increaseAmount;
|
|
258
|
+
var increaseUnlockTimeEstimateGas = function (days) { return __awaiter(void 0, void 0, void 0, function () {
|
|
259
|
+
var unlockTime, newUnlockTime, contract;
|
|
260
|
+
return __generator(this, function (_a) {
|
|
261
|
+
switch (_a.label) {
|
|
262
|
+
case 0: return [4 /*yield*/, (0, exports.getLockedAmountAndUnlockTime)()];
|
|
263
|
+
case 1:
|
|
264
|
+
unlockTime = (_a.sent()).unlockTime;
|
|
265
|
+
newUnlockTime = Math.floor(unlockTime / 1000) + (days * 86400);
|
|
266
|
+
contract = curve_1.curve.contracts[curve_1.ALIASES.voting_escrow].contract;
|
|
267
|
+
return [4 /*yield*/, contract.estimateGas.increase_unlock_time(newUnlockTime, curve_1.curve.constantOptions)];
|
|
268
|
+
case 2: return [2 /*return*/, (_a.sent()).toNumber()];
|
|
269
|
+
}
|
|
270
|
+
});
|
|
271
|
+
}); };
|
|
272
|
+
exports.increaseUnlockTimeEstimateGas = increaseUnlockTimeEstimateGas;
|
|
187
273
|
var increaseUnlockTime = function (days) { return __awaiter(void 0, void 0, void 0, function () {
|
|
188
|
-
var unlockTime, newUnlockTime;
|
|
274
|
+
var unlockTime, newUnlockTime, contract, gasLimit;
|
|
189
275
|
return __generator(this, function (_a) {
|
|
190
276
|
switch (_a.label) {
|
|
191
|
-
case 0: return [4 /*yield*/, exports.getLockedAmountAndUnlockTime()];
|
|
277
|
+
case 0: return [4 /*yield*/, (0, exports.getLockedAmountAndUnlockTime)()];
|
|
192
278
|
case 1:
|
|
193
279
|
unlockTime = (_a.sent()).unlockTime;
|
|
194
280
|
newUnlockTime = Math.floor(unlockTime / 1000) + (days * 86400);
|
|
195
|
-
|
|
196
|
-
|
|
281
|
+
contract = curve_1.curve.contracts[curve_1.ALIASES.voting_escrow].contract;
|
|
282
|
+
return [4 /*yield*/, curve_1.curve.updateFeeData()];
|
|
283
|
+
case 2:
|
|
284
|
+
_a.sent();
|
|
285
|
+
return [4 /*yield*/, contract.estimateGas.increase_unlock_time(newUnlockTime, curve_1.curve.constantOptions)];
|
|
286
|
+
case 3:
|
|
287
|
+
gasLimit = (_a.sent()).mul(130).div(100);
|
|
288
|
+
return [4 /*yield*/, contract.increase_unlock_time(newUnlockTime, __assign(__assign({}, curve_1.curve.options), { gasLimit: gasLimit }))];
|
|
289
|
+
case 4: return [2 /*return*/, (_a.sent()).hash];
|
|
197
290
|
}
|
|
198
291
|
});
|
|
199
292
|
}); };
|
|
200
293
|
exports.increaseUnlockTime = increaseUnlockTime;
|
|
294
|
+
var withdrawLockedCrvEstimateGas = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
295
|
+
var contract;
|
|
296
|
+
return __generator(this, function (_a) {
|
|
297
|
+
switch (_a.label) {
|
|
298
|
+
case 0:
|
|
299
|
+
contract = curve_1.curve.contracts[curve_1.ALIASES.voting_escrow].contract;
|
|
300
|
+
return [4 /*yield*/, contract.estimateGas.withdraw(curve_1.curve.constantOptions)];
|
|
301
|
+
case 1: return [2 /*return*/, (_a.sent()).toNumber()];
|
|
302
|
+
}
|
|
303
|
+
});
|
|
304
|
+
}); };
|
|
305
|
+
exports.withdrawLockedCrvEstimateGas = withdrawLockedCrvEstimateGas;
|
|
201
306
|
var withdrawLockedCrv = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
307
|
+
var contract, gasLimit;
|
|
202
308
|
return __generator(this, function (_a) {
|
|
203
309
|
switch (_a.label) {
|
|
204
|
-
case 0:
|
|
205
|
-
|
|
310
|
+
case 0:
|
|
311
|
+
contract = curve_1.curve.contracts[curve_1.ALIASES.voting_escrow].contract;
|
|
312
|
+
return [4 /*yield*/, curve_1.curve.updateFeeData()];
|
|
313
|
+
case 1:
|
|
314
|
+
_a.sent();
|
|
315
|
+
return [4 /*yield*/, contract.estimateGas.withdraw(curve_1.curve.constantOptions)];
|
|
316
|
+
case 2:
|
|
317
|
+
gasLimit = (_a.sent()).mul(130).div(100);
|
|
318
|
+
return [4 /*yield*/, contract.withdraw(__assign(__assign({}, curve_1.curve.options), { gasLimit: gasLimit }))];
|
|
319
|
+
case 3: return [2 /*return*/, (_a.sent()).hash];
|
|
206
320
|
}
|
|
207
321
|
});
|
|
208
322
|
}); };
|
package/lib/constants/coins.js
CHANGED
|
@@ -86,7 +86,8 @@ exports.USD_COINS = {
|
|
|
86
86
|
busd: "0x4Fabb145d64652a948d72533023f6E7A623C7C53",
|
|
87
87
|
alusd: "0xbc6da0fe9ad5f3b0d58160288917aa56653660e9",
|
|
88
88
|
mim: "0x99d8a9c45b2eca8864373a26d1459e3dff1e17f3",
|
|
89
|
-
'3crv': "0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490",
|
|
89
|
+
'3crv': "0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490",
|
|
90
|
+
crv: "0xD533a949740bb3306d119CC777fa900bA034cd52", // CRV
|
|
90
91
|
};
|
|
91
92
|
exports.COINS = __assign(__assign(__assign(__assign(__assign(__assign({}, exports.BTC_COINS), exports.ETH_COINS), exports.LINK_COINS), exports.EUR_COINS), exports.USD_COINS), { snx: "0xc011a73ee8576fb46f5e1c5751ca3b9fe0af2a6f" });
|
|
92
93
|
exports.DECIMALS = {
|
|
@@ -150,7 +151,8 @@ exports.DECIMALS = {
|
|
|
150
151
|
"0x4Fabb145d64652a948d72533023f6E7A623C7C53": 18,
|
|
151
152
|
"0xbc6da0fe9ad5f3b0d58160288917aa56653660e9": 18,
|
|
152
153
|
"0x99d8a9c45b2eca8864373a26d1459e3dff1e17f3": 18,
|
|
153
|
-
"0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490": 18,
|
|
154
|
+
"0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490": 18,
|
|
155
|
+
"0xD533a949740bb3306d119CC777fa900bA034cd52": 18, // CRV
|
|
154
156
|
};
|
|
155
157
|
// @ts-ignore
|
|
156
158
|
exports.LOWER_CASE_DECIMALS = Object.fromEntries(Object.entries(exports.DECIMALS).map(function (entry) { return [entry[0].toLowerCase(), entry[1]]; }));
|
package/lib/curve.d.ts
CHANGED
|
@@ -23,9 +23,18 @@ declare class Curve {
|
|
|
23
23
|
multicallContract: MulticallContract;
|
|
24
24
|
};
|
|
25
25
|
};
|
|
26
|
-
|
|
26
|
+
feeData: {
|
|
27
|
+
gasPrice?: number;
|
|
28
|
+
maxFeePerGas?: number;
|
|
29
|
+
maxPriorityFeePerGas?: number;
|
|
30
|
+
};
|
|
31
|
+
constantOptions: {
|
|
27
32
|
gasLimit: number;
|
|
33
|
+
};
|
|
34
|
+
options: {
|
|
28
35
|
gasPrice?: number | ethers.BigNumber;
|
|
36
|
+
maxFeePerGas?: number | ethers.BigNumber;
|
|
37
|
+
maxPriorityFeePerGas?: number | ethers.BigNumber;
|
|
29
38
|
};
|
|
30
39
|
constructor();
|
|
31
40
|
init(providerType: 'JsonRpc' | 'Web3' | 'Infura', providerSettings: {
|
|
@@ -38,9 +47,16 @@ declare class Curve {
|
|
|
38
47
|
apiKey?: string;
|
|
39
48
|
}, options?: {
|
|
40
49
|
gasPrice?: number;
|
|
50
|
+
maxFeePerGas?: number;
|
|
51
|
+
maxPriorityFeePerGas?: number;
|
|
41
52
|
chainId?: number;
|
|
42
53
|
}): Promise<void>;
|
|
43
|
-
|
|
54
|
+
setCustomFeeData(customFeeData: {
|
|
55
|
+
gasPrice?: number;
|
|
56
|
+
maxFeePerGas?: number;
|
|
57
|
+
maxPriorityFeePerGas?: number;
|
|
58
|
+
}): void;
|
|
59
|
+
updateFeeData(): Promise<void>;
|
|
44
60
|
}
|
|
45
61
|
export declare const curve: Curve;
|
|
46
62
|
export {};
|
package/lib/curve.js
CHANGED
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
2
13
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
14
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
15
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -60,7 +71,7 @@ exports.ALIASES = {
|
|
|
60
71
|
"minter": "0xd061D61a4d941c39E5453435B6345Dc261C2fcE0",
|
|
61
72
|
"fee_distributor": "0xA464e6DCda8AC41e03616F95f4BC98a13b8922Dc",
|
|
62
73
|
"address_provider": "0x0000000022d53366457f9d5e68ec105046fc4383",
|
|
63
|
-
"router": "
|
|
74
|
+
"router": "0xfA9a30350048B2BF66865ee20363067c66f67e58",
|
|
64
75
|
};
|
|
65
76
|
var cTokens = [
|
|
66
77
|
'0x5d3a536E4D6DbD6114cc1Ead35777bAB948E3643',
|
|
@@ -100,15 +111,17 @@ var Curve = /** @class */ (function () {
|
|
|
100
111
|
// @ts-ignore
|
|
101
112
|
this.multicallProvider = null;
|
|
102
113
|
this.contracts = {};
|
|
103
|
-
this.
|
|
114
|
+
this.feeData = {};
|
|
115
|
+
this.constantOptions = { gasLimit: 12000000 };
|
|
116
|
+
this.options = {};
|
|
104
117
|
}
|
|
105
118
|
Curve.prototype.init = function (providerType, providerSettings, options // gasPrice in Gwei
|
|
106
119
|
) {
|
|
107
120
|
if (options === void 0) { options = {}; }
|
|
108
121
|
return __awaiter(this, void 0, void 0, function () {
|
|
109
|
-
var _a,
|
|
110
|
-
return __generator(this, function (
|
|
111
|
-
switch (
|
|
122
|
+
var _a, _i, _b, pool, _c, _d, coinAddr, _e, _f, coinAddr;
|
|
123
|
+
return __generator(this, function (_g) {
|
|
124
|
+
switch (_g.label) {
|
|
112
125
|
case 0:
|
|
113
126
|
// JsonRpc provider
|
|
114
127
|
if (providerType.toLowerCase() === 'JsonRpc'.toLowerCase()) {
|
|
@@ -147,29 +160,23 @@ var Curve = /** @class */ (function () {
|
|
|
147
160
|
this.multicallProvider = new ethers_multicall_1.Provider(this.provider);
|
|
148
161
|
return [4 /*yield*/, this.multicallProvider.init()];
|
|
149
162
|
case 2:
|
|
150
|
-
|
|
151
|
-
|
|
163
|
+
_g.sent();
|
|
164
|
+
_g.label = 3;
|
|
152
165
|
case 3:
|
|
153
166
|
if (!this.signer) return [3 /*break*/, 5];
|
|
154
167
|
_a = this;
|
|
155
168
|
return [4 /*yield*/, this.signer.getAddress()];
|
|
156
169
|
case 4:
|
|
157
|
-
_a.signerAddress =
|
|
158
|
-
|
|
170
|
+
_a.signerAddress = _g.sent();
|
|
171
|
+
_g.label = 5;
|
|
159
172
|
case 5:
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
case 6: return [4 /*yield*/, this.provider.getGasPrice()];
|
|
165
|
-
case 7:
|
|
166
|
-
_c = _j.sent();
|
|
167
|
-
_j.label = 8;
|
|
168
|
-
case 8:
|
|
169
|
-
_b.gasPrice = _c;
|
|
173
|
+
this.feeData = { gasPrice: options.gasPrice, maxFeePerGas: options.maxFeePerGas, maxPriorityFeePerGas: options.maxPriorityFeePerGas };
|
|
174
|
+
return [4 /*yield*/, this.updateFeeData()];
|
|
175
|
+
case 6:
|
|
176
|
+
_g.sent();
|
|
170
177
|
// TODO delete toLowerCase()
|
|
171
|
-
for (_i = 0,
|
|
172
|
-
pool =
|
|
178
|
+
for (_i = 0, _b = Object.values(abis_ethereum_1.poolsData); _i < _b.length; _i++) {
|
|
179
|
+
pool = _b[_i];
|
|
173
180
|
this.contracts[pool.swap_address] = {
|
|
174
181
|
contract: new ethers_1.Contract(pool.swap_address, pool.swap_abi, this.signer || this.provider),
|
|
175
182
|
multicallContract: new ethers_multicall_1.Contract(pool.swap_address, pool.swap_abi),
|
|
@@ -206,8 +213,8 @@ var Curve = /** @class */ (function () {
|
|
|
206
213
|
multicallContract: new ethers_multicall_1.Contract(pool.deposit_address, pool.deposit_abi),
|
|
207
214
|
};
|
|
208
215
|
}
|
|
209
|
-
for (
|
|
210
|
-
coinAddr =
|
|
216
|
+
for (_c = 0, _d = pool.underlying_coin_addresses; _c < _d.length; _c++) {
|
|
217
|
+
coinAddr = _d[_c];
|
|
211
218
|
this.contracts[coinAddr] = {
|
|
212
219
|
contract: new ethers_1.Contract(coinAddr, ERC20_json_1.default, this.signer || this.provider),
|
|
213
220
|
multicallContract: new ethers_multicall_1.Contract(coinAddr, ERC20_json_1.default),
|
|
@@ -218,8 +225,8 @@ var Curve = /** @class */ (function () {
|
|
|
218
225
|
};
|
|
219
226
|
}
|
|
220
227
|
// TODO add all coins
|
|
221
|
-
for (
|
|
222
|
-
coinAddr =
|
|
228
|
+
for (_e = 0, _f = pool.coin_addresses; _e < _f.length; _e++) {
|
|
229
|
+
coinAddr = _f[_e];
|
|
223
230
|
if (cTokens.includes(coinAddr)) {
|
|
224
231
|
this.contracts[coinAddr] = {
|
|
225
232
|
contract: new ethers_1.Contract(coinAddr, cERC20_json_1.default, this.signer || this.provider),
|
|
@@ -297,8 +304,50 @@ var Curve = /** @class */ (function () {
|
|
|
297
304
|
});
|
|
298
305
|
});
|
|
299
306
|
};
|
|
300
|
-
Curve.prototype.
|
|
301
|
-
this.
|
|
307
|
+
Curve.prototype.setCustomFeeData = function (customFeeData) {
|
|
308
|
+
this.feeData = __assign(__assign({}, this.feeData), customFeeData);
|
|
309
|
+
};
|
|
310
|
+
Curve.prototype.updateFeeData = function () {
|
|
311
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
312
|
+
var feeData, _a, _b, _c;
|
|
313
|
+
return __generator(this, function (_d) {
|
|
314
|
+
switch (_d.label) {
|
|
315
|
+
case 0: return [4 /*yield*/, this.provider.getFeeData()];
|
|
316
|
+
case 1:
|
|
317
|
+
feeData = _d.sent();
|
|
318
|
+
if (!(feeData.maxFeePerGas === null || feeData.maxPriorityFeePerGas === null)) return [3 /*break*/, 6];
|
|
319
|
+
delete this.options.maxFeePerGas;
|
|
320
|
+
delete this.options.maxPriorityFeePerGas;
|
|
321
|
+
_a = this.options;
|
|
322
|
+
if (!(this.feeData.gasPrice !== undefined)) return [3 /*break*/, 2];
|
|
323
|
+
_b = ethers_1.ethers.utils.parseUnits(this.feeData.gasPrice.toString(), "gwei");
|
|
324
|
+
return [3 /*break*/, 5];
|
|
325
|
+
case 2:
|
|
326
|
+
_c = feeData.gasPrice;
|
|
327
|
+
if (_c) return [3 /*break*/, 4];
|
|
328
|
+
return [4 /*yield*/, this.provider.getGasPrice()];
|
|
329
|
+
case 3:
|
|
330
|
+
_c = (_d.sent());
|
|
331
|
+
_d.label = 4;
|
|
332
|
+
case 4:
|
|
333
|
+
_b = (_c);
|
|
334
|
+
_d.label = 5;
|
|
335
|
+
case 5:
|
|
336
|
+
_a.gasPrice = _b;
|
|
337
|
+
return [3 /*break*/, 7];
|
|
338
|
+
case 6:
|
|
339
|
+
delete this.options.gasPrice;
|
|
340
|
+
this.options.maxFeePerGas = this.feeData.maxFeePerGas !== undefined ?
|
|
341
|
+
ethers_1.ethers.utils.parseUnits(this.feeData.maxFeePerGas.toString(), "gwei") :
|
|
342
|
+
feeData.maxFeePerGas;
|
|
343
|
+
this.options.maxPriorityFeePerGas = this.feeData.maxPriorityFeePerGas !== undefined ?
|
|
344
|
+
ethers_1.ethers.utils.parseUnits(this.feeData.maxPriorityFeePerGas.toString(), "gwei") :
|
|
345
|
+
feeData.maxFeePerGas;
|
|
346
|
+
_d.label = 7;
|
|
347
|
+
case 7: return [2 /*return*/];
|
|
348
|
+
}
|
|
349
|
+
});
|
|
350
|
+
});
|
|
302
351
|
};
|
|
303
352
|
return Curve;
|
|
304
353
|
}());
|
package/lib/index.d.ts
CHANGED
|
@@ -11,12 +11,18 @@ declare function init(providerType: 'JsonRpc' | 'Web3' | 'Infura', providerSetti
|
|
|
11
11
|
apiKey?: string;
|
|
12
12
|
}, options?: {
|
|
13
13
|
gasPrice?: number;
|
|
14
|
+
maxFeePerGas?: number;
|
|
15
|
+
maxPriorityFeePerGas?: number;
|
|
14
16
|
chainId?: number;
|
|
15
17
|
}): Promise<void>;
|
|
16
|
-
declare function
|
|
18
|
+
declare function setCustomFeeData(customFeeData: {
|
|
19
|
+
gasPrice?: number;
|
|
20
|
+
maxFeePerGas?: number;
|
|
21
|
+
maxPriorityFeePerGas?: number;
|
|
22
|
+
}): void;
|
|
17
23
|
declare const curve: {
|
|
18
24
|
init: typeof init;
|
|
19
|
-
|
|
25
|
+
setCustomFeeData: typeof setCustomFeeData;
|
|
20
26
|
signerAddress: string;
|
|
21
27
|
Pool: typeof Pool;
|
|
22
28
|
getBalances: (coins: string[], ...addresses: string[] | string[][]) => Promise<string[] | import("./interfaces").DictInterface<string[]>>;
|
|
@@ -36,6 +42,11 @@ declare const curve: {
|
|
|
36
42
|
}>;
|
|
37
43
|
crossAssetExchangeExpected: (inputCoin: string, outputCoin: string, amount: string) => Promise<string>;
|
|
38
44
|
crossAssetExchange: (inputCoin: string, outputCoin: string, amount: string, maxSlippage?: number) => Promise<string>;
|
|
45
|
+
estimateGas: {
|
|
46
|
+
ensureAllowance: (coins: string[], amounts: string[], spender: string) => Promise<number>;
|
|
47
|
+
exchange: (inputCoin: string, outputCoin: string, amount: string, maxSlippage?: number) => Promise<number>;
|
|
48
|
+
crossAssetExchange: (inputCoin: string, outputCoin: string, amount: string, maxSlippage?: number) => Promise<number>;
|
|
49
|
+
};
|
|
39
50
|
boosting: {
|
|
40
51
|
getCrv: (...addresses: string[] | string[][]) => Promise<string | import("./interfaces").DictInterface<string>>;
|
|
41
52
|
getLockedAmountAndUnlockTime: (...addresses: string[] | string[][]) => Promise<import("./interfaces").DictInterface<{
|
|
@@ -51,6 +62,12 @@ declare const curve: {
|
|
|
51
62
|
increaseAmount: (amount: string) => Promise<string>;
|
|
52
63
|
increaseUnlockTime: (days: number) => Promise<string>;
|
|
53
64
|
withdrawLockedCrv: () => Promise<string>;
|
|
65
|
+
estimateGas: {
|
|
66
|
+
createLock: (amount: string, days: number) => Promise<number>;
|
|
67
|
+
increaseAmount: (amount: string) => Promise<number>;
|
|
68
|
+
increaseUnlockTime: (days: number) => Promise<number>;
|
|
69
|
+
withdrawLockedCrv: () => Promise<number>;
|
|
70
|
+
};
|
|
54
71
|
};
|
|
55
72
|
};
|
|
56
73
|
export default curve;
|
package/lib/index.js
CHANGED
|
@@ -55,12 +55,12 @@ function init(providerType, providerSettings, options) {
|
|
|
55
55
|
});
|
|
56
56
|
});
|
|
57
57
|
}
|
|
58
|
-
function
|
|
59
|
-
curve_1.curve.
|
|
58
|
+
function setCustomFeeData(customFeeData) {
|
|
59
|
+
curve_1.curve.setCustomFeeData(customFeeData);
|
|
60
60
|
}
|
|
61
61
|
var curve = {
|
|
62
62
|
init: init,
|
|
63
|
-
|
|
63
|
+
setCustomFeeData: setCustomFeeData,
|
|
64
64
|
signerAddress: '',
|
|
65
65
|
Pool: pools_1.Pool,
|
|
66
66
|
getBalances: utils_1.getBalances,
|
|
@@ -74,6 +74,11 @@ var curve = {
|
|
|
74
74
|
crossAssetExchangeOutputAndSlippage: pools_1.crossAssetExchangeOutputAndSlippage,
|
|
75
75
|
crossAssetExchangeExpected: pools_1.crossAssetExchangeExpected,
|
|
76
76
|
crossAssetExchange: pools_1.crossAssetExchange,
|
|
77
|
+
estimateGas: {
|
|
78
|
+
ensureAllowance: utils_1.ensureAllowanceEstimateGas,
|
|
79
|
+
exchange: pools_1.exchangeEstimateGas,
|
|
80
|
+
crossAssetExchange: pools_1.crossAssetExchangeEstimateGas,
|
|
81
|
+
},
|
|
77
82
|
boosting: {
|
|
78
83
|
getCrv: boosting_1.getCrv,
|
|
79
84
|
getLockedAmountAndUnlockTime: boosting_1.getLockedAmountAndUnlockTime,
|
|
@@ -83,6 +88,12 @@ var curve = {
|
|
|
83
88
|
increaseAmount: boosting_1.increaseAmount,
|
|
84
89
|
increaseUnlockTime: boosting_1.increaseUnlockTime,
|
|
85
90
|
withdrawLockedCrv: boosting_1.withdrawLockedCrv,
|
|
91
|
+
estimateGas: {
|
|
92
|
+
createLock: boosting_1.createLockEstimateGas,
|
|
93
|
+
increaseAmount: boosting_1.increaseAmountEstimateGas,
|
|
94
|
+
increaseUnlockTime: boosting_1.increaseUnlockTimeEstimateGas,
|
|
95
|
+
withdrawLockedCrv: boosting_1.withdrawLockedCrvEstimateGas,
|
|
96
|
+
},
|
|
86
97
|
},
|
|
87
98
|
};
|
|
88
99
|
exports.default = curve;
|
package/lib/pools.d.ts
CHANGED
|
@@ -17,26 +17,51 @@ export declare class Pool {
|
|
|
17
17
|
isMeta: boolean;
|
|
18
18
|
basePool: string;
|
|
19
19
|
isFactory: boolean;
|
|
20
|
+
estimateGas: {
|
|
21
|
+
addLiquidity: (amounts: string[]) => Promise<number>;
|
|
22
|
+
addLiquidityWrapped: (amounts: string[]) => Promise<number>;
|
|
23
|
+
gaugeDeposit: (lpTokenAmount: string) => Promise<number>;
|
|
24
|
+
gaugeWithdraw: (lpTokenAmount: string) => Promise<number>;
|
|
25
|
+
removeLiquidity: (lpTokenAmount: string) => Promise<number>;
|
|
26
|
+
removeLiquidityWrapped: (lpTokenAmount: string) => Promise<number>;
|
|
27
|
+
removeLiquidityImbalance: (amounts: string[]) => Promise<number>;
|
|
28
|
+
removeLiquidityImbalanceWrapped: (amounts: string[]) => Promise<number>;
|
|
29
|
+
removeLiquidityOneCoin: (lpTokenAmount: string, coin: string | number) => Promise<number>;
|
|
30
|
+
removeLiquidityOneCoinWrapped: (lpTokenAmount: string, coin: string | number) => Promise<number>;
|
|
31
|
+
exchange: (inputCoin: string | number, outputCoin: string | number, amount: string, maxSlippage: number) => Promise<number>;
|
|
32
|
+
exchangeTricrypto: (inputCoin: string | number, outputCoin: string | number, amount: string, maxSlippage: number, useEth: boolean) => Promise<number>;
|
|
33
|
+
exchangeWrapped: (inputCoin: string | number, outputCoin: string | number, amount: string, maxSlippage: number) => Promise<number>;
|
|
34
|
+
};
|
|
20
35
|
constructor(name: string);
|
|
21
36
|
calcLpTokenAmount: (amounts: string[], isDeposit?: boolean) => Promise<string>;
|
|
22
37
|
calcLpTokenAmountWrapped: (amounts: string[], isDeposit?: boolean) => Promise<string>;
|
|
23
38
|
addLiquidityExpected: (amounts: string[]) => Promise<string>;
|
|
39
|
+
private addLiquidityEstimateGas;
|
|
24
40
|
addLiquidity: (amounts: string[]) => Promise<string>;
|
|
25
41
|
addLiquidityWrappedExpected: (amounts: string[]) => Promise<string>;
|
|
42
|
+
private addLiquidityWrappedEstimateGas;
|
|
26
43
|
addLiquidityWrapped: (amounts: string[]) => Promise<string>;
|
|
27
44
|
removeLiquidityExpected: (lpTokenAmount: string) => Promise<string[]>;
|
|
45
|
+
private removeLiquidityEstimateGas;
|
|
28
46
|
removeLiquidity: (lpTokenAmount: string) => Promise<string>;
|
|
29
47
|
removeLiquidityWrappedExpected: (lpTokenAmount: string) => Promise<string[]>;
|
|
48
|
+
private removeLiquidityWrappedEstimateGas;
|
|
30
49
|
removeLiquidityWrapped: (lpTokenAmount: string) => Promise<string>;
|
|
31
50
|
removeLiquidityImbalanceExpected: (amounts: string[]) => Promise<string>;
|
|
51
|
+
private removeLiquidityImbalanceEstimateGas;
|
|
32
52
|
removeLiquidityImbalance: (amounts: string[]) => Promise<string>;
|
|
33
53
|
removeLiquidityImbalanceWrappedExpected: (amounts: string[]) => Promise<string>;
|
|
34
|
-
|
|
54
|
+
private removeLiquidityImbalanceWrappedEstimateGas;
|
|
55
|
+
removeLiquidityImbalanceWrapped: (amounts: string[], estimateGas?: boolean) => Promise<string | number>;
|
|
35
56
|
removeLiquidityOneCoinExpected: (lpTokenAmount: string, coin: string | number) => Promise<string>;
|
|
57
|
+
private removeLiquidityOneCoinEstimateGas;
|
|
36
58
|
removeLiquidityOneCoin: (lpTokenAmount: string, coin: string | number) => Promise<string>;
|
|
37
59
|
removeLiquidityOneCoinWrappedExpected: (lpTokenAmount: string, coin: string | number) => Promise<string>;
|
|
60
|
+
private removeLiquidityOneCoinWrappedEstimateGas;
|
|
38
61
|
removeLiquidityOneCoinWrapped: (lpTokenAmount: string, coin: string | number) => Promise<string>;
|
|
62
|
+
private gaugeDepositEstimateGas;
|
|
39
63
|
gaugeDeposit: (lpTokenAmount: string) => Promise<string>;
|
|
64
|
+
private gaugeWithdrawEstimateGas;
|
|
40
65
|
gaugeWithdraw: (lpTokenAmount: string) => Promise<string>;
|
|
41
66
|
balances: (...addresses: string[] | string[][]) => Promise<DictInterface<DictInterface<string>> | DictInterface<string>>;
|
|
42
67
|
lpTokenBalances: (...addresses: string[] | string[][]) => Promise<DictInterface<DictInterface<string>> | DictInterface<string>>;
|
|
@@ -44,9 +69,12 @@ export declare class Pool {
|
|
|
44
69
|
coinBalances: (...addresses: string[] | string[][]) => Promise<DictInterface<DictInterface<string>> | DictInterface<string>>;
|
|
45
70
|
allCoinBalances: (...addresses: string[] | string[][]) => Promise<DictInterface<DictInterface<string>> | DictInterface<string>>;
|
|
46
71
|
exchangeExpected: (inputCoin: string | number, outputCoin: string | number, amount: string) => Promise<string>;
|
|
72
|
+
private exchangeEstimateGas;
|
|
47
73
|
exchange: (inputCoin: string | number, outputCoin: string | number, amount: string, maxSlippage?: number) => Promise<string>;
|
|
74
|
+
private exchangeTricryptoEstimateGas;
|
|
48
75
|
exchangeTricrypto: (inputCoin: string | number, outputCoin: string | number, amount: string, maxSlippage?: number, useEth?: boolean) => Promise<string>;
|
|
49
76
|
exchangeWrappedExpected: (inputCoin: string | number, outputCoin: string | number, amount: string) => Promise<string>;
|
|
77
|
+
private exchangeWrappedEstimateGas;
|
|
50
78
|
exchangeWrapped: (inputCoin: string | number, outputCoin: string | number, amount: string, maxSlippage?: number) => Promise<string>;
|
|
51
79
|
gaugeMaxBoostedDeposit: (...addresses: string[]) => Promise<DictInterface<string>>;
|
|
52
80
|
gaugeOptimalDeposits: (...accounts: string[]) => Promise<DictInterface<string>>;
|
|
@@ -94,6 +122,7 @@ export declare const getBestPoolAndOutput: (inputCoin: string, outputCoin: strin
|
|
|
94
122
|
output: string;
|
|
95
123
|
}>;
|
|
96
124
|
export declare const exchangeExpected: (inputCoin: string, outputCoin: string, amount: string) => Promise<string>;
|
|
125
|
+
export declare const exchangeEstimateGas: (inputCoin: string, outputCoin: string, amount: string, maxSlippage?: number) => Promise<number>;
|
|
97
126
|
export declare const exchange: (inputCoin: string, outputCoin: string, amount: string, maxSlippage?: number) => Promise<string>;
|
|
98
127
|
export declare const crossAssetExchangeAvailable: (inputCoin: string, outputCoin: string) => Promise<boolean>;
|
|
99
128
|
export declare const _getSmallAmountForCoin: (coinAddress: string) => string;
|
|
@@ -108,4 +137,5 @@ export declare const crossAssetExchangeOutputAndSlippage: (inputCoin: string, ou
|
|
|
108
137
|
output: string;
|
|
109
138
|
}>;
|
|
110
139
|
export declare const crossAssetExchangeExpected: (inputCoin: string, outputCoin: string, amount: string) => Promise<string>;
|
|
140
|
+
export declare const crossAssetExchangeEstimateGas: (inputCoin: string, outputCoin: string, amount: string, maxSlippage?: number) => Promise<number>;
|
|
111
141
|
export declare const crossAssetExchange: (inputCoin: string, outputCoin: string, amount: string, maxSlippage?: number) => Promise<string>;
|