From 676aeb07a409ea5500d5e524e0239b2e98a77ad3 Mon Sep 17 00:00:00 2001 From: "m.ray" <16125548+MadalinaRaicu@users.noreply.github.com> Date: Mon, 13 Mar 2023 13:58:51 -0400 Subject: [PATCH] fix(trading): deal ticket validation on zero account balance and margin warnings (#3177) --- .../src/components/deal-ticket/deal-ticket.tsx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/libs/deal-ticket/src/components/deal-ticket/deal-ticket.tsx b/libs/deal-ticket/src/components/deal-ticket/deal-ticket.tsx index 7acf78372..d5f0c060a 100644 --- a/libs/deal-ticket/src/components/deal-ticket/deal-ticket.tsx +++ b/libs/deal-ticket/src/components/deal-ticket/deal-ticket.tsx @@ -116,7 +116,7 @@ export const DealTicket = ({ return; } - const hasNoBalance = generalAccountBalance === '0'; + const hasNoBalance = !BigInt(generalAccountBalance); if (hasNoBalance) { setError('summary', { message: SummaryValidationType.NoCollateral, @@ -141,7 +141,6 @@ export const DealTicket = ({ pubKey, setError, clearErrors, - errors.summary, ]); const onSubmit = useCallback( @@ -386,8 +385,12 @@ const SummaryMessage = memo( // If there is no blocking error but user doesn't have enough // balance render the margin warning, but still allow submission - if (BigInt(balance) < BigInt(margin)) { - return ; + if (BigInt(balance) < BigInt(margin) && BigInt(balance) > BigInt(0)) { + return ( +
+ +
+ ); } // Show auction mode warning if (