Skip to content

Commit

Permalink
Remove int conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
OGPoyraz committed Jun 24, 2024
1 parent a8e8e71 commit ba7ec73
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/utils/normalize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,12 @@ function normalizeContractAddress(address: string): Hex | string {
}

// Check if the address is in decimal format, convert to hexadecimal
const parsedAddress = parseInt(address, 10);
if (!isNaN(parsedAddress)) {
const hexString = new BN(address.toString(), 10).toString(16);
try {
const decimalBN = new BN(address, 10);
const hexString = decimalBN.toString(16);
return add0x(hexString);
} catch (e) {
// Ignore errors and return the original address
}

// Returning the original address without normalization
Expand Down

0 comments on commit ba7ec73

Please sign in to comment.