Skip to content

Commit

Permalink
wrap with hexValue instead
Browse files Browse the repository at this point in the history
  • Loading branch information
derHowie committed Mar 19, 2024
1 parent b069a71 commit 92c3b71
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/utils/hex.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
import { BigNumber } from '@ethersproject/bignumber';
import { hexValue } from '@ethersproject/bytes';

export const trimHex = (stringToTrim: string) => {
if (stringToTrim === '0x0') return stringToTrim;
return stringToTrim.replace(/^0x0+/, '0x');
};
export const toHex = (stringToConvert: string | number | BigNumber): string => {
const hexString = BigNumber.from(stringToConvert).toHexString();
return trimHex(hexString);
return hexValue(BigNumber.from(stringToConvert).toHexString());
};

0 comments on commit 92c3b71

Please sign in to comment.