aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorfrankiebee <frankie.diamond@gmail.com>2017-06-06 03:09:19 +0800
committerfrankiebee <frankie.diamond@gmail.com>2017-06-06 03:09:19 +0800
commit653319be1055b8ff0a36cb334c93ac7435f1fc5c (patch)
treed686e751fbdfde49559efb575ab322f6f8f21115 /ui
parent37fd32025f9cb5dffb601011e2442efee59e3595 (diff)
downloadtangerine-wallet-browser-653319be1055b8ff0a36cb334c93ac7435f1fc5c.tar
tangerine-wallet-browser-653319be1055b8ff0a36cb334c93ac7435f1fc5c.tar.gz
tangerine-wallet-browser-653319be1055b8ff0a36cb334c93ac7435f1fc5c.tar.bz2
tangerine-wallet-browser-653319be1055b8ff0a36cb334c93ac7435f1fc5c.tar.lz
tangerine-wallet-browser-653319be1055b8ff0a36cb334c93ac7435f1fc5c.tar.xz
tangerine-wallet-browser-653319be1055b8ff0a36cb334c93ac7435f1fc5c.tar.zst
tangerine-wallet-browser-653319be1055b8ff0a36cb334c93ac7435f1fc5c.zip
move address check to util.isValidAddress
Diffstat (limited to 'ui')
-rw-r--r--ui/app/components/pending-tx.js4
-rw-r--r--ui/app/send.js2
-rw-r--r--ui/app/util.js1
3 files changed, 4 insertions, 3 deletions
diff --git a/ui/app/components/pending-tx.js b/ui/app/components/pending-tx.js
index 2d4dc26a2..56c466506 100644
--- a/ui/app/components/pending-tx.js
+++ b/ui/app/components/pending-tx.js
@@ -7,7 +7,7 @@ const clone = require('clone')
const ethUtil = require('ethereumjs-util')
const BN = ethUtil.BN
const hexToBn = require('../../../app/scripts/lib/hex-to-bn')
-
+const util = require('../util')
const MiniAccountPanel = require('./mini-account-panel')
const EthBalance = require('./eth-balance')
const util = require('../util')
@@ -45,7 +45,7 @@ PendingTx.prototype.render = function () {
const balance = account ? account.balance : '0x0'
// recipient check
- const isValidAddress = !(txParams.to === '0x0000000000000000000000000000000000000000')
+ const isValidAddress = util.isValidAddress(txParams.to)
// Gas
const gas = txParams.gas
diff --git a/ui/app/send.js b/ui/app/send.js
index e0896035e..75a600dee 100644
--- a/ui/app/send.js
+++ b/ui/app/send.js
@@ -262,7 +262,7 @@ SendTransactionScreen.prototype.onSubmit = function () {
return this.props.dispatch(actions.displayWarning(message))
}
- if ((!util.isValidAddress(recipient) && !txData) || (!recipient && !txData) || (recipient === '0x0000000000000000000000000000000000000000')) {
+ 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 7a56bf6a0..ac3f42c6b 100644
--- a/ui/app/util.js
+++ b/ui/app/util.js
@@ -61,6 +61,7 @@ function miniAddressSummary (address) {
function isValidAddress (address) {
var prefixed = ethUtil.addHexPrefix(address)
+ if (address === '0x0000000000000000000000000000000000000000') return false
return (isAllOneCase(prefixed) && ethUtil.isValidAddress(prefixed)) || ethUtil.isValidChecksumAddress(prefixed)
}