Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export const formatDecimals = (balance: bigint, decimals: number = 18): string => {
const newBalance = formatUnits(balance.toString(10), decimals);
if (newBalance === '0.0') {
return '0';
}
return newBalance;
};