Fixed formatUnits and parseUnits for values over 128 bits (#4037, #4133).

This commit is contained in:
Richard Moore 2023-06-27 10:58:22 -03:00
parent d2b5f1da02
commit 3d141b44b5

View File

@ -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;
}
/**