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; return;
} }
// Calculate maxAmountIn by subtracting fees from user's input // Use the user's input directly as maxAmountIn
// User's input is the total amount they want to spend (including fees) const maxAmountIn = parseUnits(fromAmount, selectedFromToken.decimals);
// So we subtract the fee to get the actual amount to swap
const userInputInWei = parseUnits(fromAmount, selectedFromToken.decimals);
const maxAmountIn = userInputInWei - bestRoute.fee;
// Execute the swap // Execute the swap
await executeSwap( await executeSwap(