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