@@ -8,6 +8,7 @@ import { Badge } from "@workspace/ui/components/badge"
88import { useTradeState } from "../../hooks/useTradeState"
99import { useTokenPrices } from "../../hooks/useTokenPrices"
1010import { useTradeFees } from "../../hooks/useTradeFees"
11+ import { useTokenBalances } from "../../../wallet/hooks/useTokenBalances"
1112import { TradeInfoRows } from "./TradeInfoRows"
1213import { ConfirmationDialog } from "./ConfirmationDialog"
1314import {
@@ -191,17 +192,30 @@ export function TradePanel() {
191192function TradeInputs ( { trade } : { trade : ReturnType < typeof useTradeState > } ) {
192193 const { fromAmount, fromTokenAddress, toTokenAddress, tradeFlags, setFromAmount, switchTokens } = trade
193194 const { getMidPrice } = useTokenPrices ( )
195+ const { data : balances } = useTokenBalances ( )
194196
195197 const fromPrice = getMidPrice ( fromTokenAddress )
196198 const fromUsd = parseFloat ( fromAmount || "0" ) * fromPrice
199+ const walletBalance = balances ?. [ fromTokenAddress ]
197200
198201 return (
199202 < div className = "mt-3 space-y-2" >
200203 { /* Pay */ }
201204 < div className = "space-y-1" >
202- < label className = "text-xs text-muted-foreground" >
203- { tradeFlags . isSwap ? "Pay" : "Collateral" }
204- </ label >
205+ < div className = "flex items-center justify-between" >
206+ < label className = "text-xs text-muted-foreground" >
207+ { tradeFlags . isSwap ? "Pay" : "Collateral" }
208+ </ label >
209+ { walletBalance !== undefined && (
210+ < span className = "text-xs text-muted-foreground" >
211+ Balance:{ " " }
212+ < span className = "font-mono font-medium text-foreground" >
213+ { walletBalance . toLocaleString ( undefined , { maximumFractionDigits : 6 } ) } { " " }
214+ { fromTokenAddress }
215+ </ span >
216+ </ span >
217+ ) }
218+ </ div >
205219 < div className = "relative" >
206220 < Input
207221 type = "number"
0 commit comments