aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorkumavis <kumavis@users.noreply.github.com>2017-06-06 04:11:20 +0800
committerGitHub <noreply@github.com>2017-06-06 04:11:20 +0800
commit95d20e9b76f7db315b3459303e1738303a5cc6db (patch)
tree663507e8e484a5a3256b75b90e5fc178f2f73134 /ui
parentf5faeed2c96f25333a83631833ccb8805fea3c47 (diff)
parent94fedd1fc9d44054670b9f60ae6f92b409e7b25e (diff)
downloadtangerine-wallet-browser-95d20e9b76f7db315b3459303e1738303a5cc6db.tar
tangerine-wallet-browser-95d20e9b76f7db315b3459303e1738303a5cc6db.tar.gz
tangerine-wallet-browser-95d20e9b76f7db315b3459303e1738303a5cc6db.tar.bz2
tangerine-wallet-browser-95d20e9b76f7db315b3459303e1738303a5cc6db.tar.lz
tangerine-wallet-browser-95d20e9b76f7db315b3459303e1738303a5cc6db.tar.xz
tangerine-wallet-browser-95d20e9b76f7db315b3459303e1738303a5cc6db.tar.zst
tangerine-wallet-browser-95d20e9b76f7db315b3459303e1738303a5cc6db.zip
Merge pull request #1545 from MetaMask/inValidAddressFix
Dissallow transactions to be sent to 0x000...
Diffstat (limited to 'ui')
-rw-r--r--ui/app/components/ens-input.js4
-rw-r--r--ui/app/components/pending-tx.js17
-rw-r--r--ui/app/conf-tx.js1
-rw-r--r--ui/app/util.js1
4 files changed, 20 insertions, 3 deletions
diff --git a/ui/app/components/ens-input.js b/ui/app/components/ens-input.js
index 3e44d83af..43bb7ab22 100644
--- a/ui/app/components/ens-input.js
+++ b/ui/app/components/ens-input.js
@@ -21,6 +21,7 @@ EnsInput.prototype.render = function () {
const opts = extend(props, {
list: 'addresses',
onChange: () => {
+ this.setState({ ensResolution: '0x0000000000000000000000000000000000000000' })
const network = this.props.network
const networkHasEnsSupport = getNetworkEnsSupport(network)
if (!networkHasEnsSupport) return
@@ -95,12 +96,14 @@ EnsInput.prototype.lookupEnsName = function () {
log.info(`ENS attempting to resolve name: ${recipient}`)
this.ens.lookup(recipient.trim())
.then((address) => {
+ if (address === '0x0000000000000000000000000000000000000000') throw new Error('No address has been set for this name.')
if (address !== ensResolution) {
this.setState({
loadingEns: false,
ensResolution: address,
nickname: recipient.trim(),
hoverText: address + '\nClick to Copy',
+ ensFailure: false,
})
}
})
@@ -108,6 +111,7 @@ EnsInput.prototype.lookupEnsName = function () {
log.error(reason)
return this.setState({
loadingEns: false,
+ ensResolution: '0x0000000000000000000000000000000000000000',
ensFailure: true,
hoverText: reason.message,
})
diff --git a/ui/app/components/pending-tx.js b/ui/app/components/pending-tx.js
index 4961db5de..a106f245b 100644
--- a/ui/app/components/pending-tx.js
+++ b/ui/app/components/pending-tx.js
@@ -7,11 +7,10 @@ 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 Copyable = require('./copyable')
const EthBalance = require('./eth-balance')
-const util = require('../util')
const addressSummary = util.addressSummary
const nameForAddress = require('../../lib/contract-namer')
const BNInput = require('./bn-as-decimal-input')
@@ -45,6 +44,9 @@ PendingTx.prototype.render = function () {
const account = props.accounts[address]
const balance = account ? account.balance : '0x0'
+ // recipient check
+ const isValidAddress = util.isValidAddress(txParams.to)
+
// Gas
const gas = txParams.gas
const gasBn = hexToBn(gas)
@@ -267,6 +269,15 @@ PendingTx.prototype.render = function () {
}, 'Transaction Error. Exception thrown in contract code.')
: null,
+ !isValidAddress ?
+ h('.error', {
+ style: {
+ marginLeft: 50,
+ fontSize: '0.9em',
+ },
+ }, 'Recipient address is invalid. Sending this transaction will result in a loss of ETH.')
+ : null,
+
insufficientBalance ?
h('span.error', {
style: {
@@ -304,7 +315,7 @@ PendingTx.prototype.render = function () {
type: 'submit',
value: 'ACCEPT',
style: { marginLeft: '10px' },
- disabled: insufficientBalance || !this.state.valid,
+ disabled: insufficientBalance || !this.state.valid || !isValidAddress,
}),
h('button.cancel.btn-red', {
diff --git a/ui/app/conf-tx.js b/ui/app/conf-tx.js
index 008627ce6..4ae81f35f 100644
--- a/ui/app/conf-tx.js
+++ b/ui/app/conf-tx.js
@@ -48,6 +48,7 @@ ConfirmTxScreen.prototype.render = function () {
var txParams = txData.params || {}
var isNotification = isPopupOrNotification() === 'notification'
+
log.info(`rendering a combined ${unconfTxList.length} unconf msg & txs`)
if (unconfTxList.length === 0) return h(Loading, { isLoading: true })
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)
}