Skip to content

Commit 378c2b0

Browse files
committed
chore: dont cast to number to avoid losing precision
1 parent 97c7d3d commit 378c2b0

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

web/src/pages/Courts/CourtDetails/StakePanel/InputDisplay.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,9 @@ const InputDisplay: React.FC<IInputDisplay> = ({ action, amount, setAmount }) =>
8282
const parsedBalance = formatPNK(balance ?? 0n, 0, true);
8383

8484
const maxWithdrawAmount = jurorBalance
85-
? BigInt(Math.min(Number(jurorBalance[2]), Number(jurorBalance[0] - jurorBalance[1])))
85+
? jurorBalance[2] < jurorBalance[0] - jurorBalance[1]
86+
? jurorBalance[2]
87+
: jurorBalance[0] - jurorBalance[1]
8688
: 0n;
8789
const parsedMaxWithdrawAmount = formatPNK(maxWithdrawAmount, 0, true);
8890
const isStaking = useMemo(() => action === ActionType.stake, [action]);

0 commit comments

Comments
 (0)