mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-22 17:33:23 +01:00
Fix hashed address validation
This commit is contained in:
parent
d0f8a14ace
commit
272bea31b5
@ -78,11 +78,11 @@ describe('util', function() {
|
||||
})
|
||||
|
||||
it('should recognize this sample hashed address', function() {
|
||||
const address = '0x5Fda30Bb72B8Dfe20e48A00dFc108d0915BE9BbA'
|
||||
const address = '0x5Fda30Bb72B8Dfe20e48A00dFc108d0915BE9Bb0'
|
||||
const result = util.isValidAddress(address)
|
||||
const hashed = ethUtil.toChecksumAddress(address)
|
||||
const hashed = ethUtil.toChecksumAddress(address.toLowerCase())
|
||||
assert.equal(hashed, address, 'example is hashed correctly')
|
||||
assert.ok(result)
|
||||
assert.ok(result, 'is valid by our check')
|
||||
})
|
||||
})
|
||||
|
||||
|
@ -52,7 +52,7 @@ function addressSummary(address) {
|
||||
|
||||
function isValidAddress(address) {
|
||||
var prefixed = ethUtil.addHexPrefix(address)
|
||||
return isAllOneCase(prefixed) && ethUtil.isValidAddress(prefixed) || ethUtil.isValidChecksumAddress(prefixed)
|
||||
return (isAllOneCase(prefixed) && ethUtil.isValidAddress(prefixed)) || ethUtil.isValidChecksumAddress(prefixed)
|
||||
}
|
||||
|
||||
function isAllOneCase(address) {
|
||||
|
Loading…
Reference in New Issue
Block a user