Skip to content

Commit

Permalink
Merge pull request #1032 from starknet-io/ivpavici_1031
Browse files Browse the repository at this point in the history
docs: validateChecksumAddress
  • Loading branch information
tabaktoni authored Mar 22, 2024
2 parents 6623ea5 + 2262b5e commit 60674d8
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/utils/address.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,14 @@ export function getChecksumAddress(address: BigNumberish): string {
return addHexPrefix(chars.join(''));
}

/**
* If the casing of an address is mixed, it is a Checksum Address, which uses a specific pattern of uppercase and lowercase letters within
* a given address to reduce the risk of errors introduced from typing an address or cut and paste issues.
*
* @param address string
*
* @returns true if the ChecksumAddress is valid
*/
export function validateChecksumAddress(address: string): boolean {
return getChecksumAddress(address) === address;
}

0 comments on commit 60674d8

Please sign in to comment.