diff --git a/package.json b/package.json index 2e4fe6255..b2391cec0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "scroll.io", - "version": "5.0.90", + "version": "5.0.91", "private": false, "license": "MIT", "scripts": { diff --git a/src/utils/format.ts b/src/utils/format.ts index 2c82a3670..2fabd90a0 100644 --- a/src/utils/format.ts +++ b/src/utils/format.ts @@ -17,7 +17,7 @@ export const commafy = (value: string | number | undefined, decimals: number = 2 try { return numbro(value).format({ thousandSeparated: true, - optionalMantissa: false, + optionalMantissa: true, mantissa: decimals, }) } catch (err) { @@ -67,7 +67,8 @@ export const toPrecision = (amount, precise = 8) => { } const withPrecision = commafy(amount, significantDecimals) // Remove trailing zeros after decimal point - return parseFloat(withPrecision).toString() + const withoutTrailingZero = withPrecision.replace(/(\.\d*?)0+$/, "$1").replace(/(\.\d+?)0+$/, "$10") + return withoutTrailingZero } export function sanitizeNumericalString(numStr: string) {