fix bug with decimal in trade form

This commit is contained in:
tjs 2023-04-28 14:39:22 -04:00
parent 506433e539
commit 1f30784930
1 changed files with 7 additions and 1 deletions

View File

@ -104,7 +104,13 @@ const TradeSummary = ({
}, [balanceBank, mangoAccount, tradeForm])
const orderValue = useMemo(() => {
if (!quoteBank || !tradeForm.price || !tradeForm.baseSize) return 0
if (
!quoteBank ||
!tradeForm.price ||
!Number.isNaN(tradeForm.price) ||
!Number.isNaN(tradeForm.baseSize)
)
return 0
const basePriceDecimal = new Decimal(tradeForm.price)
const quotePriceDecimal = new Decimal(quoteBank.uiPrice)
const sizeDecimal = new Decimal(tradeForm.baseSize)