Skip to content

Commit

Permalink
Fixed formatUnits and parseUnits for values over 128 bits (ethers-io#…
Browse files Browse the repository at this point in the history
  • Loading branch information
ricmoo authored and Woodpile37 committed Jan 14, 2024
1 parent f48d59f commit adc20fc
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 adc20fc

Please sign in to comment.