aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Finlay <flyswatter@users.noreply.github.com>2017-09-19 02:46:50 +0800
committerGitHub <noreply@github.com>2017-09-19 02:46:50 +0800
commitfa50bf9587882837af312fb18123cc98d1576313 (patch)
tree81474f053c88d9a55087cec95825390987f5aab2
parentc463647ad7a825eb954a56599ec205a3ba6cd3e6 (diff)
parent67accea693cb5f3167279ecdbe869cc464f7665a (diff)
downloadtangerine-wallet-browser-fa50bf9587882837af312fb18123cc98d1576313.tar.gz
tangerine-wallet-browser-fa50bf9587882837af312fb18123cc98d1576313.tar.zst
tangerine-wallet-browser-fa50bf9587882837af312fb18123cc98d1576313.zip
Merge pull request #2075 from MetaMask/mixed-case
Specific error for send screen: address checksum fails
-rw-r--r--CHANGELOG.md1
-rw-r--r--ui/app/send.js5
-rw-r--r--ui/app/util.js7
3 files changed, 13 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 5928d5cb4..ce2327c24 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,7 @@
- Add ability to export private keys as a file.
- Add ability to export seed words as a file.
- Changed state logs to a file download than a clipboard copy.
+- Add specific error for failed recipient address checksum.
- Fixed a long standing memory leak associated with filters installed by dapps
- Fix link to support center.
- Fixed tooltip icon locations to avoid overflow.
diff --git a/ui/app/send.js b/ui/app/send.js
index a21a219eb..e59c1130e 100644
--- a/ui/app/send.js
+++ b/ui/app/send.js
@@ -262,6 +262,11 @@ SendTransactionScreen.prototype.onSubmit = function () {
return this.props.dispatch(actions.displayWarning(message))
}
+ if ((util.isInvalidChecksumAddress(recipient))) {
+ message = 'Recipient address checksum is invalid.'
+ return this.props.dispatch(actions.displayWarning(message))
+ }
+
if ((!util.isValidAddress(recipient) && !txData) || (!recipient && !txData)) {
message = 'Recipient address is invalid.'
return this.props.dispatch(actions.displayWarning(message))
diff --git a/ui/app/util.js b/ui/app/util.js
index 1368ebf11..3f8b4dcc3 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 !isAllOneCase(prefixed) && !ethUtil.isValidChecksumAddress(prefixed) && ethUtil.isValidAddress(prefixed)
+}
+
function isAllOneCase (address) {
if (!address) return true
var lower = address.toLowerCase()