Skip to content

Commit

Permalink
Fixed formatUnits and parseUnits for values over 128 bits (#4037, #4133
Browse files Browse the repository at this point in the history
…).
  • Loading branch information
ricmoo committed Jun 27, 2023
1 parent d2b5f1d commit 3d141b4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src.ts/utils/units.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

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

/**
Expand Down

0 comments on commit 3d141b4

Please sign in to comment.