updating calcuated fees formula

This commit is contained in:
2025-11-03 22:31:02 -04:00
parent 292f675039
commit ed6426fad7

View File

@@ -346,13 +346,23 @@ export function SwapForm() {
<span className="text-muted-foreground">Max Slippage:</span>
<span className="font-medium">{maxSlippage}%</span>
</div>
{swapAmounts && swapAmounts.length > 0 && selectedToToken && (
<div className="flex justify-between text-sm">
<span className="text-muted-foreground">Fee:</span>
<span className="font-medium">
{(Number(swapAmounts[0].fee) / Math.pow(10, selectedToToken.decimals)).toFixed(6)} {selectedToToken.symbol}
</span>
</div>
{swapAmounts && swapAmounts.length > 0 && selectedFromToken && fromAmount && (
<>
<div className="flex justify-between text-sm">
<span className="text-muted-foreground">Fee:</span>
<span className="font-medium">
{(Number(swapAmounts[0].fee) / Math.pow(10, selectedFromToken.decimals)).toFixed(6)} {selectedFromToken.symbol}
{' '}
({((Number(swapAmounts[0].fee) / Number(parseUnits(fromAmount, selectedFromToken.decimals))) * 100).toFixed(2)}%)
</span>
</div>
<div className="flex justify-between text-sm">
<span className="text-muted-foreground">Total Amount In:</span>
<span className="font-medium">
{((Number(parseUnits(fromAmount, selectedFromToken.decimals)) + Number(swapAmounts[0].fee)) / Math.pow(10, selectedFromToken.decimals)).toFixed(6)} {selectedFromToken.symbol}
</span>
</div>
</>
)}
</div>
)}