diff --git a/taker-frontend/src/App.tsx b/taker-frontend/src/App.tsx index 3ad8abf..afe2962 100644 --- a/taker-frontend/src/App.tsx +++ b/taker-frontend/src/App.tsx @@ -124,6 +124,7 @@ export const App = () => { margin={margin} leverage={leverage} liquidationPrice={liquidationPrice} + walletBalance={walletInfo ? walletInfo.balance : 0} onQuantityChange={(valueString: string) => { setUserHasEdited(true); setQuantity(valueString); diff --git a/taker-frontend/src/components/Trade.tsx b/taker-frontend/src/components/Trade.tsx index 186393e..d3c00fa 100644 --- a/taker-frontend/src/components/Trade.tsx +++ b/taker-frontend/src/components/Trade.tsx @@ -63,7 +63,7 @@ interface TradeProps { quantity: string; liquidationPrice?: number; onQuantityChange: any; - walletBalance?: number; + walletBalance: number; onLongSubmit: (payload: CfdOrderRequestPayload) => void; isLongSubmitting: boolean; } @@ -108,7 +108,7 @@ export default function Trade({ const parse = (val: any) => Number.parseInt(val.replace(/^\$/, "")); - const balanceTooLow = walletBalance && walletBalance < margin; + const balanceTooLow = walletBalance < margin; const quantityTooHigh = maxQuantity < parse(quantity); const quantityTooLow = minQuantity > parse(quantity); const quantityGreaterZero = parse(quantity) > 0; @@ -127,7 +127,7 @@ export default function Trade({ if (balanceTooLow) { alertBox = ; } if (quantityTooHigh) {