diff options
author | Kevin Serrano <kevin.serrano@consensys.net> | 2017-09-13 03:23:21 +0800 |
---|---|---|
committer | Kevin Serrano <kevin.serrano@consensys.net> | 2017-09-13 03:23:21 +0800 |
commit | 7810880f0c96ff8628cfd87bf7e6cb8145bb147a (patch) | |
tree | 3a8d56836040590940679a5a087579440383325c /ui/app/util.js | |
parent | cafebb6417331d9d0a0a83fdc1cc4fdb04d0a5ec (diff) | |
download | tangerine-wallet-browser-7810880f0c96ff8628cfd87bf7e6cb8145bb147a.tar tangerine-wallet-browser-7810880f0c96ff8628cfd87bf7e6cb8145bb147a.tar.gz tangerine-wallet-browser-7810880f0c96ff8628cfd87bf7e6cb8145bb147a.tar.bz2 tangerine-wallet-browser-7810880f0c96ff8628cfd87bf7e6cb8145bb147a.tar.lz tangerine-wallet-browser-7810880f0c96ff8628cfd87bf7e6cb8145bb147a.tar.xz tangerine-wallet-browser-7810880f0c96ff8628cfd87bf7e6cb8145bb147a.tar.zst tangerine-wallet-browser-7810880f0c96ff8628cfd87bf7e6cb8145bb147a.zip |
Add specific error message for failed address checksum.
Diffstat (limited to 'ui/app/util.js')
-rw-r--r-- | ui/app/util.js | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/ui/app/util.js b/ui/app/util.js index 1368ebf11..860a17224 100644 --- a/ui/app/util.js +++ b/ui/app/util.js @@ -37,6 +37,7 @@ module.exports = { bnTable: bnTable, isHex: isHex, exportAsFile: exportAsFile, + isInvalidChecksumAddress, } function valuesFor (obj) { @@ -66,6 +67,12 @@ function isValidAddress (address) { return (isAllOneCase(prefixed) && ethUtil.isValidAddress(prefixed)) || ethUtil.isValidChecksumAddress(prefixed) } +function isInvalidChecksumAddress (address) { + var prefixed = ethUtil.addHexPrefix(address) + if (address === '0x0000000000000000000000000000000000000000') return false + return ethUtil.isValidAddress(prefixed) && !ethUtil.isValidChecksumAddress(prefixed) +} + function isAllOneCase (address) { if (!address) return true var lower = address.toLowerCase() |