From 2afcfb1611ea5b0c0db9e800ecdfd4a35bd90968 Mon Sep 17 00:00:00 2001 From: Ahmed Date: Tue, 24 Dec 2024 00:34:06 -0600 Subject: [PATCH] truncate stake input to 15 places after decimal --- components/molecules/AddStakeModal.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/components/molecules/AddStakeModal.tsx b/components/molecules/AddStakeModal.tsx index 66128a9..3243f63 100644 --- a/components/molecules/AddStakeModal.tsx +++ b/components/molecules/AddStakeModal.tsx @@ -126,7 +126,11 @@ export const AddStakeModal = () => { onChange={(e) => { const amount = e.target.value; if (amount) { - setStakedAmount(parseFloat(e.target.value)); + const trunc = (num: string, pres: number) => { + const split = num.split(".") + return split.length > 1 ? split[0] + "." + split[1].substring(0, pres) : num + } + setStakedAmount(parseFloat(trunc(amount, 15))); } handleStakeChange(e); }}