@curvefi/api 2.68.23 → 2.68.24
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/router.js +5 -9
- package/package.json +1 -1
package/lib/router.js
CHANGED
|
@@ -390,7 +390,7 @@ export function swapEstimateGas(inputCoin, outputCoin, amount) {
|
|
|
390
390
|
return gas;
|
|
391
391
|
});
|
|
392
392
|
}
|
|
393
|
-
function
|
|
393
|
+
export function swap(inputCoin_1, outputCoin_1, amount_1) {
|
|
394
394
|
return __awaiter(this, arguments, void 0, function* (inputCoin, outputCoin, amount, slippage = 0.5) {
|
|
395
395
|
const [inputCoinAddress, outputCoinAddress] = _getCoinAddresses.call(this, inputCoin, outputCoin);
|
|
396
396
|
const [inputCoinDecimals, outputCoinDecimals] = _getCoinDecimals.call(this, inputCoinAddress, outputCoinAddress);
|
|
@@ -410,14 +410,10 @@ function prepareSwap(inputCoin_1, outputCoin_1, amount_1) {
|
|
|
410
410
|
const gasLimit = (DIGas(yield contract.exchange.estimateGas(_route, _swapParams, _amount, _minRecvAmount, _pools, Object.assign(Object.assign({}, this.constantOptions), { value })))) * (this.chainId === 1 ? this.parseUnits("130", 0) : this.parseUnits("160", 0)) / this.parseUnits("100", 0);
|
|
411
411
|
return yield contract.exchange(_route, _swapParams, _amount, _minRecvAmount, _pools, Object.assign(Object.assign({}, this.options), { value, gasLimit }));
|
|
412
412
|
}
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
}
|
|
417
|
-
export function swap(inputCoin_1, outputCoin_1, amount_1) {
|
|
418
|
-
return __awaiter(this, arguments, void 0, function* (inputCoin, outputCoin, amount, slippage = 0.5) {
|
|
419
|
-
const [contract, params, options] = yield prepareSwap.call(this, inputCoin, outputCoin, amount, slippage);
|
|
420
|
-
return yield contract.exchange(...params, options);
|
|
413
|
+
else {
|
|
414
|
+
const gasLimit = (DIGas(yield contract.exchange.estimateGas(_route, _swapParams, _amount, _minRecvAmount, Object.assign(Object.assign({}, this.constantOptions), { value })))) * this.parseUnits("160", 0) / this.parseUnits("100", 0);
|
|
415
|
+
return yield contract.exchange(_route, _swapParams, _amount, _minRecvAmount, Object.assign(Object.assign({}, this.options), { value, gasLimit }));
|
|
416
|
+
}
|
|
421
417
|
});
|
|
422
418
|
}
|
|
423
419
|
export function populateSwap(inputCoin_1, outputCoin_1, amount_1) {
|