From 7810880f0c96ff8628cfd87bf7e6cb8145bb147a Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Tue, 12 Sep 2017 12:23:21 -0700 Subject: [PATCH 1/3] Add specific error message for failed address checksum. --- ui/app/send.js | 5 +++++ ui/app/util.js | 7 +++++++ 2 files changed, 12 insertions(+) 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..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() From 243be92ac165d028d532a02f5b32ff9edc526f23 Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Tue, 12 Sep 2017 12:24:02 -0700 Subject: [PATCH 2/3] Changelogaroo. --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 89eaefa79..54ddb4a1b 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. ## 3.10.0 2017-9-11 From ef6967325e43de26edc0d99ac5853804648024ae Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Tue, 12 Sep 2017 12:52:13 -0700 Subject: [PATCH 3/3] Check if all lower or upper before doing checksum. --- ui/app/util.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/app/util.js b/ui/app/util.js index 860a17224..3f8b4dcc3 100644 --- a/ui/app/util.js +++ b/ui/app/util.js @@ -70,7 +70,7 @@ function isValidAddress (address) { function isInvalidChecksumAddress (address) { var prefixed = ethUtil.addHexPrefix(address) if (address === '0x0000000000000000000000000000000000000000') return false - return ethUtil.isValidAddress(prefixed) && !ethUtil.isValidChecksumAddress(prefixed) + return !isAllOneCase(prefixed) && !ethUtil.isValidChecksumAddress(prefixed) && ethUtil.isValidAddress(prefixed) } function isAllOneCase (address) {