From 2620230d01b4a81640fc0e9afb36f3c2562b7018 Mon Sep 17 00:00:00 2001 From: "Trunks @ Carbonable" Date: Fri, 6 Sep 2024 20:46:40 +0200 Subject: [PATCH] Fix balance display off-by-one (#138) --- packages/nextjs/hooks/scaffold-stark/useScaffoldEthBalance.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/nextjs/hooks/scaffold-stark/useScaffoldEthBalance.ts b/packages/nextjs/hooks/scaffold-stark/useScaffoldEthBalance.ts index 01b345c3..846a0c83 100644 --- a/packages/nextjs/hooks/scaffold-stark/useScaffoldEthBalance.ts +++ b/packages/nextjs/hooks/scaffold-stark/useScaffoldEthBalance.ts @@ -32,7 +32,7 @@ const useScaffoldEthBalance = ({ address }: UseScaffoldEthBalanceProps) => { const remainderStr = remainder .toString() - .padStart(ethDecimals.toString().length, "0"); + .padStart(ethDecimals.toString().length - 1, "0"); const decimalPart = remainderStr.slice(0, 4); setBalance(`${integerPart}.${decimalPart}`);