Skip to content

Commit

Permalink
truncate stake input to 15 places after decimal
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmxdiqbal committed Dec 24, 2024
1 parent f5ba84d commit 2afcfb1
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion components/molecules/AddStakeModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}}
Expand Down

0 comments on commit 2afcfb1

Please sign in to comment.