diff --git a/src/lib/components/Swap/Toolbar/index.tsx b/src/lib/components/Swap/Toolbar/index.tsx
index 76f8b3c8cd..1774d32724 100644
--- a/src/lib/components/Swap/Toolbar/index.tsx
+++ b/src/lib/components/Swap/Toolbar/index.tsx
@@ -40,10 +40,6 @@ export default function Toolbar({ disabled }: { disabled?: boolean }) {
return
}
- if (balance && trade?.inputAmount.greaterThan(balance)) {
- return
- }
-
if (inputCurrency && outputCurrency && isAmountPopulated) {
if (!trade || routeIsLoading) {
return
@@ -51,6 +47,9 @@ export default function Toolbar({ disabled }: { disabled?: boolean }) {
if (!routeFound) {
return
}
+ if (balance && trade?.inputAmount.greaterThan(balance)) {
+ return
+ }
if (trade.inputAmount && trade.outputAmount) {
return
}
diff --git a/src/lib/hooks/swap/useSwapInfo.tsx b/src/lib/hooks/swap/useSwapInfo.tsx
index 6ae4e9f544..ec8e35da2c 100644
--- a/src/lib/hooks/swap/useSwapInfo.tsx
+++ b/src/lib/hooks/swap/useSwapInfo.tsx
@@ -57,6 +57,8 @@ function useComputeSwapInfo(): SwapInfo {
() => tryParseCurrencyAmount(amount, (isExactIn ? inputCurrency : outputCurrency) ?? undefined),
[inputCurrency, isExactIn, outputCurrency, amount]
)
+ const parsedAmountIn = isExactIn ? parsedAmount : undefined
+ const parsedAmountOut = isExactIn ? undefined : parsedAmount
//@TODO(ianlapham): this would eventually be replaced with routing api logic.
const trade = useBestTrade(
@@ -83,10 +85,10 @@ function useComputeSwapInfo(): SwapInfo {
const currencyAmounts = useMemo(
() => ({
- [Field.INPUT]: trade.trade?.inputAmount,
- [Field.OUTPUT]: trade.trade?.outputAmount,
+ [Field.INPUT]: parsedAmountIn || trade.trade?.inputAmount,
+ [Field.OUTPUT]: parsedAmountOut || trade.trade?.outputAmount,
}),
- [trade.trade?.inputAmount, trade.trade?.outputAmount]
+ [parsedAmountIn, parsedAmountOut, trade.trade?.inputAmount, trade.trade?.outputAmount]
)
const allowedSlippage = useAllowedSlippage(trade.trade)