Skip to content

Commit

Permalink
fix: allow hex to be mixed case
Browse files Browse the repository at this point in the history
  • Loading branch information
janek26 committed Jul 14, 2022
1 parent 41eea22 commit fa84e55
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/utils/number.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ export function isHex(hex: string): boolean {
}

export function toBN(number: BigNumberish, base?: number | 'hex') {
if (typeof number === 'string') {
// eslint-disable-next-line no-param-reassign
number = number.toLowerCase();
}
if (typeof number === 'string' && isHex(number) && !base)
return new BN(removeHexPrefix(number), 'hex');
return new BN(number, base);
Expand Down

0 comments on commit fa84e55

Please sign in to comment.