@curvefi/api 2.24.4 → 2.24.5
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 +10 -2
- package/package.json +1 -1
package/lib/router.js
CHANGED
|
@@ -876,7 +876,7 @@ var swap = function (inputCoin, outputCoin, amount, slippage) {
|
|
|
876
876
|
};
|
|
877
877
|
exports.swap = swap;
|
|
878
878
|
var getSwappedAmount = function (tx, outputCoin) { return __awaiter(void 0, void 0, void 0, function () {
|
|
879
|
-
var outputCoinAddress, outputCoinDecimals, txInfo, res;
|
|
879
|
+
var outputCoinAddress, outputCoinDecimals, txInfo, res, i;
|
|
880
880
|
return __generator(this, function (_a) {
|
|
881
881
|
switch (_a.label) {
|
|
882
882
|
case 0:
|
|
@@ -885,7 +885,15 @@ var getSwappedAmount = function (tx, outputCoin) { return __awaiter(void 0, void
|
|
|
885
885
|
return [4 /*yield*/, tx.wait()];
|
|
886
886
|
case 1:
|
|
887
887
|
txInfo = _a.sent();
|
|
888
|
-
|
|
888
|
+
for (i = 1; i <= txInfo.logs.length; i++) {
|
|
889
|
+
try {
|
|
890
|
+
res = ethers_1.ethers.utils.defaultAbiCoder.decode(['address[9]', 'uint256[3][4]', 'address[4]', 'uint256', 'uint256'], ethers_1.ethers.utils.hexDataSlice(txInfo.logs[txInfo.logs.length - i].data, 0));
|
|
891
|
+
break;
|
|
892
|
+
}
|
|
893
|
+
catch (err) { }
|
|
894
|
+
}
|
|
895
|
+
if (res === undefined)
|
|
896
|
+
return [2 /*return*/, '0'];
|
|
889
897
|
return [2 /*return*/, ethers_1.ethers.utils.formatUnits(res[res.length - 1], outputCoinDecimals)];
|
|
890
898
|
}
|
|
891
899
|
});
|