From adc20fc88a3677e3ac5b7f83dcf33c54c1d0b19d Mon Sep 17 00:00:00 2001 From: Richard Moore Date: Tue, 27 Jun 2023 10:58:22 -0300 Subject: [PATCH] Fixed formatUnits and parseUnits for values over 128 bits (#4037, #4133). --- src.ts/utils/units.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src.ts/utils/units.ts b/src.ts/utils/units.ts index 1d150b2279..feb9fba568 100644 --- a/src.ts/utils/units.ts +++ b/src.ts/utils/units.ts @@ -52,7 +52,7 @@ export function formatUnits(value: BigNumberish, unit?: string | Numeric): strin decimals = getNumber(unit, "unit"); } - return FixedNumber.fromValue(value, decimals, { decimals }).toString(); + return FixedNumber.fromValue(value, decimals, { decimals, width: 512 }).toString(); } /** @@ -72,7 +72,7 @@ export function parseUnits(value: string, unit?: string | Numeric): bigint { decimals = getNumber(unit, "unit"); } - return FixedNumber.fromString(value, { decimals }).value; + return FixedNumber.fromString(value, { decimals, width: 512 }).value; } /**