resetting maxAmount to what the user inputs into the input field

This commit is contained in:
2025-11-04 14:36:24 -04:00
parent 1d6ebadcb2
commit 9707c4892b

View File

@@ -111,11 +111,8 @@ export function SwapForm() {
return;
}
// Calculate maxAmountIn by subtracting fees from user's input
// User's input is the total amount they want to spend (including fees)
// So we subtract the fee to get the actual amount to swap
const userInputInWei = parseUnits(fromAmount, selectedFromToken.decimals);
const maxAmountIn = userInputInWei - bestRoute.fee;
// Use the user's input directly as maxAmountIn
const maxAmountIn = parseUnits(fromAmount, selectedFromToken.decimals);
// Execute the swap
await executeSwap(