resetting maxAmount to what the user inputs into the input field
This commit is contained in:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user