diff --git a/src/utils/helpers/number.test.ts b/src/utils/helpers/number.test.ts index 59c4114d8..ba1d505de 100644 --- a/src/utils/helpers/number.test.ts +++ b/src/utils/helpers/number.test.ts @@ -323,6 +323,11 @@ describe('Test helpers', () => { '0.00000012345' ); }); + + // Very large numbers + test('should return "100.00E18" for input 1e20', () => { + expect(prettifyNumber(1e20)).toEqual('100.00E18'); + }); }); }); diff --git a/src/utils/helpers/number.ts b/src/utils/helpers/number.ts index 56a7265ed..7849a6ad1 100644 --- a/src/utils/helpers/number.ts +++ b/src/utils/helpers/number.ts @@ -134,6 +134,10 @@ const getIntlOptions = (value: SafeDecimal, options: PrettifyNumberOptions) => { if (options.abbreviate && value.gte(1_000_000)) { intlOptions.notation = 'compact'; } + // When ludicrous numbers, use 1E16 notation + if (value.gt(1e17)) { + intlOptions.notation = 'engineering'; + } return intlOptions; };