aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Serrano <kevin.serrano@consensys.net>2017-06-14 04:38:27 +0800
committerKevin Serrano <kevin.serrano@consensys.net>2017-06-14 04:38:27 +0800
commit790712e6fd4b76017e11de08ccfa474c9a7e4a6f (patch)
tree2a73b7ff989463ac0a7c22a0626cbd3d562676c4
parente9e43637df0132804a4a1fe031d1734029c19bf5 (diff)
downloadtangerine-wallet-browser-790712e6fd4b76017e11de08ccfa474c9a7e4a6f.tar
tangerine-wallet-browser-790712e6fd4b76017e11de08ccfa474c9a7e4a6f.tar.gz
tangerine-wallet-browser-790712e6fd4b76017e11de08ccfa474c9a7e4a6f.tar.bz2
tangerine-wallet-browser-790712e6fd4b76017e11de08ccfa474c9a7e4a6f.tar.lz
tangerine-wallet-browser-790712e6fd4b76017e11de08ccfa474c9a7e4a6f.tar.xz
tangerine-wallet-browser-790712e6fd4b76017e11de08ccfa474c9a7e4a6f.tar.zst
tangerine-wallet-browser-790712e6fd4b76017e11de08ccfa474c9a7e4a6f.zip
Cleanup zero addresses.
-rw-r--r--ui/app/components/ens-input.js11
1 files changed, 6 insertions, 5 deletions
diff --git a/ui/app/components/ens-input.js b/ui/app/components/ens-input.js
index 52ad8943b..16c50db84 100644
--- a/ui/app/components/ens-input.js
+++ b/ui/app/components/ens-input.js
@@ -7,6 +7,7 @@ const copyToClipboard = require('copy-to-clipboard')
const ENS = require('ethjs-ens')
const networkMap = require('ethjs-ens/lib/network-map.json')
const ensRE = /.+\.eth$/
+const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000'
module.exports = EnsInput
@@ -72,7 +73,7 @@ EnsInput.prototype.render = function () {
EnsInput.prototype.componentDidMount = function () {
const network = this.props.network
const networkHasEnsSupport = getNetworkEnsSupport(network)
- this.setState({ ensResolution: '0x0000000000000000000000000000000000000000' })
+ this.setState({ ensResolution: ZERO_ADDRESS })
if (networkHasEnsSupport) {
const provider = global.ethereumProvider
@@ -88,7 +89,7 @@ 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 === ZERO_ADDRESS) throw new Error('No address has been set for this name.')
if (address !== ensResolution) {
this.setState({
loadingEns: false,
@@ -103,7 +104,7 @@ EnsInput.prototype.lookupEnsName = function () {
log.error(reason)
return this.setState({
loadingEns: false,
- ensResolution: '0x0000000000000000000000000000000000000000',
+ ensResolution: ZERO_ADDRESS,
ensFailure: true,
hoverText: reason.message,
})
@@ -135,7 +136,7 @@ EnsInput.prototype.ensIcon = function (recipient) {
}
EnsInput.prototype.ensIconContents = function (recipient) {
- const { loadingEns, ensFailure, ensResolution } = this.state || { ensResolution: '0x0000000000000000000000000000000000000000'}
+ const { loadingEns, ensFailure, ensResolution } = this.state || { ensResolution: ZERO_ADDRESS}
if (loadingEns) {
return h('img', {
@@ -152,7 +153,7 @@ EnsInput.prototype.ensIconContents = function (recipient) {
return h('i.fa.fa-warning.fa-lg.warning')
}
- if (ensResolution && (ensResolution !== '0x0000000000000000000000000000000000000000')) {
+ if (ensResolution && (ensResolution !== ZERO_ADDRESS)) {
return h('i.fa.fa-check-circle.fa-lg.cursor-pointer', {
style: { color: 'green' },
onClick: (event) => {