fix(trading): deal ticket validation on zero account balance and margin warnings (#3177)
This commit is contained in:
parent
52ee998bf0
commit
676aeb07a4
@ -116,7 +116,7 @@ export const DealTicket = ({
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const hasNoBalance = generalAccountBalance === '0';
|
const hasNoBalance = !BigInt(generalAccountBalance);
|
||||||
if (hasNoBalance) {
|
if (hasNoBalance) {
|
||||||
setError('summary', {
|
setError('summary', {
|
||||||
message: SummaryValidationType.NoCollateral,
|
message: SummaryValidationType.NoCollateral,
|
||||||
@ -141,7 +141,6 @@ export const DealTicket = ({
|
|||||||
pubKey,
|
pubKey,
|
||||||
setError,
|
setError,
|
||||||
clearErrors,
|
clearErrors,
|
||||||
errors.summary,
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const onSubmit = useCallback(
|
const onSubmit = useCallback(
|
||||||
@ -386,8 +385,12 @@ const SummaryMessage = memo(
|
|||||||
|
|
||||||
// If there is no blocking error but user doesn't have enough
|
// If there is no blocking error but user doesn't have enough
|
||||||
// balance render the margin warning, but still allow submission
|
// balance render the margin warning, but still allow submission
|
||||||
if (BigInt(balance) < BigInt(margin)) {
|
if (BigInt(balance) < BigInt(margin) && BigInt(balance) > BigInt(0)) {
|
||||||
return <MarginWarning balance={balance} margin={margin} asset={asset} />;
|
return (
|
||||||
|
<div className="mb-2">
|
||||||
|
<MarginWarning balance={balance} margin={margin} asset={asset} />
|
||||||
|
</div>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
// Show auction mode warning
|
// Show auction mode warning
|
||||||
if (
|
if (
|
||||||
|
Loading…
Reference in New Issue
Block a user