1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-26 12:29:06 +01:00

Permit all-caps addresses (#9227)

* permit all-caps addresses

* handle empty address
This commit is contained in:
Patryk Łucka 2020-08-15 00:18:46 +02:00 committed by GitHub
parent f77151003e
commit aad840777d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -62,11 +62,11 @@ export function addressSummary (address, firstSegLength = 10, lastSegLength = 4,
}
export function isValidAddress (address) {
const prefixed = ethUtil.addHexPrefix(address)
if (address === '0x0000000000000000000000000000000000000000') {
if (!address || address === '0x0000000000000000000000000000000000000000') {
return false
}
return (isAllOneCase(prefixed) && ethUtil.isValidAddress(prefixed)) || ethUtil.isValidChecksumAddress(prefixed)
const prefixed = address.startsWith('0X') ? address : ethUtil.addHexPrefix(address)
return (isAllOneCase(prefixed.slice(2)) && ethUtil.isValidAddress(prefixed)) || ethUtil.isValidChecksumAddress(prefixed)
}
export function isValidDomainName (address) {