From 6bdb4c87288a522d9ea2e984bc1f6436d6c7369a Mon Sep 17 00:00:00 2001 From: Thomas Huang Date: Wed, 26 Apr 2017 21:05:45 -0700 Subject: Fix linting warnings --- ui/app/components/ens-input.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'ui/app/components/ens-input.js') diff --git a/ui/app/components/ens-input.js b/ui/app/components/ens-input.js index facf29d97..f1cf49998 100644 --- a/ui/app/components/ens-input.js +++ b/ui/app/components/ens-input.js @@ -24,7 +24,7 @@ EnsInput.prototype.render = function () { list: 'addresses', onChange: () => { const network = this.props.network - let resolverAddress = networkResolvers[network] + const resolverAddress = networkResolvers[network] if (!resolverAddress) return const recipient = document.querySelector('input[name="address"]').value @@ -52,7 +52,7 @@ EnsInput.prototype.render = function () { [ // Corresponds to the addresses owned. Object.keys(props.identities).map((key) => { - let identity = props.identities[key] + const identity = props.identities[key] return h('option', { value: identity.address, label: identity.name, @@ -72,7 +72,7 @@ EnsInput.prototype.render = function () { EnsInput.prototype.componentDidMount = function () { const network = this.props.network - let resolverAddress = networkResolvers[network] + const resolverAddress = networkResolvers[network] if (resolverAddress) { const provider = web3.currentProvider -- cgit v1.2.3 From f17c6b4eef8defe55e316ee782b499072e1e795a Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Sun, 7 May 2017 16:44:43 -0700 Subject: Fix ens iterated element without key error --- ui/app/components/ens-input.js | 1 + 1 file changed, 1 insertion(+) (limited to 'ui/app/components/ens-input.js') diff --git a/ui/app/components/ens-input.js b/ui/app/components/ens-input.js index f1cf49998..001c227c4 100644 --- a/ui/app/components/ens-input.js +++ b/ui/app/components/ens-input.js @@ -63,6 +63,7 @@ EnsInput.prototype.render = function () { return h('option', { value: identity.address, label: identity.name, + key: identity.address, }) }), ]), -- cgit v1.2.3 From 68be86abe959afd26ea50e0833c552c442bfce51 Mon Sep 17 00:00:00 2001 From: kumavis Date: Mon, 8 May 2017 12:29:08 -0700 Subject: ui - remove web3, use eth-query --- ui/app/components/ens-input.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ui/app/components/ens-input.js') diff --git a/ui/app/components/ens-input.js b/ui/app/components/ens-input.js index f1cf49998..0457bde2e 100644 --- a/ui/app/components/ens-input.js +++ b/ui/app/components/ens-input.js @@ -75,7 +75,7 @@ EnsInput.prototype.componentDidMount = function () { const resolverAddress = networkResolvers[network] if (resolverAddress) { - const provider = web3.currentProvider + const provider = global.ethereumProvider this.ens = new ENS({ provider, network }) this.checkName = debounce(this.lookupEnsName.bind(this), 200) } -- cgit v1.2.3 From ac54c7d96b503e8d79fae4a67289ae95d09c3c75 Mon Sep 17 00:00:00 2001 From: kumavis Date: Tue, 9 May 2017 11:28:39 -0700 Subject: ens - add mainnet ens support --- ui/app/components/ens-input.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'ui/app/components/ens-input.js') diff --git a/ui/app/components/ens-input.js b/ui/app/components/ens-input.js index ec3cd60ed..04c6222c2 100644 --- a/ui/app/components/ens-input.js +++ b/ui/app/components/ens-input.js @@ -5,11 +5,9 @@ const extend = require('xtend') const debounce = require('debounce') const copyToClipboard = require('copy-to-clipboard') const ENS = require('ethjs-ens') +const networkMap = require('ethjs-ens/lib/network-map.json') const ensRE = /.+\.eth$/ -const networkResolvers = { - '3': '112234455c3a32fd11230c42e7bccd4a84e02010', -} module.exports = EnsInput @@ -24,8 +22,8 @@ EnsInput.prototype.render = function () { list: 'addresses', onChange: () => { const network = this.props.network - const resolverAddress = networkResolvers[network] - if (!resolverAddress) return + const networkHasEnsSupport = getNetworkEnsSupport(network) + if (!networkHasEnsSupport) return const recipient = document.querySelector('input[name="address"]').value if (recipient.match(ensRE) === null) { @@ -73,9 +71,9 @@ EnsInput.prototype.render = function () { EnsInput.prototype.componentDidMount = function () { const network = this.props.network - const resolverAddress = networkResolvers[network] + const networkHasEnsSupport = getNetworkEnsSupport(network) - if (resolverAddress) { + if (networkHasEnsSupport) { const provider = global.ethereumProvider this.ens = new ENS({ provider, network }) this.checkName = debounce(this.lookupEnsName.bind(this), 200) @@ -169,3 +167,7 @@ EnsInput.prototype.ensIconContents = function (recipient) { }) } } + +function getNetworkEnsSupport(network) { + return Boolean(networkMap[network]) +} \ No newline at end of file -- cgit v1.2.3 From fc7b4cb4bc5141f920131f8d79c56ca9ff3b6d2c Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Mon, 15 May 2017 15:22:49 -0700 Subject: Linted --- ui/app/components/ens-input.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'ui/app/components/ens-input.js') diff --git a/ui/app/components/ens-input.js b/ui/app/components/ens-input.js index 04c6222c2..3e44d83af 100644 --- a/ui/app/components/ens-input.js +++ b/ui/app/components/ens-input.js @@ -168,6 +168,7 @@ EnsInput.prototype.ensIconContents = function (recipient) { } } -function getNetworkEnsSupport(network) { +function getNetworkEnsSupport (network) { return Boolean(networkMap[network]) -} \ No newline at end of file +} + -- cgit v1.2.3 From bb6e41963d42a91ecc34a728b7c0c18d26e6cd9f Mon Sep 17 00:00:00 2001 From: frankiebee Date: Mon, 5 Jun 2017 11:40:20 -0700 Subject: Dissallow transactions to be sent to 0x0000000000000000000000000000000000000000 --- ui/app/components/ens-input.js | 1 + 1 file changed, 1 insertion(+) (limited to 'ui/app/components/ens-input.js') diff --git a/ui/app/components/ens-input.js b/ui/app/components/ens-input.js index 3e44d83af..11e0fb36d 100644 --- a/ui/app/components/ens-input.js +++ b/ui/app/components/ens-input.js @@ -95,6 +95,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 !== ensResolution) { this.setState({ loadingEns: false, -- cgit v1.2.3 From ec99bfd5531922e7d153709c1a77f1c40cae9e99 Mon Sep 17 00:00:00 2001 From: frankiebee Date: Mon, 5 Jun 2017 12:37:29 -0700 Subject: set the ensResolution to an invalid address if an error ocurs durring look up --- ui/app/components/ens-input.js | 1 + 1 file changed, 1 insertion(+) (limited to 'ui/app/components/ens-input.js') diff --git a/ui/app/components/ens-input.js b/ui/app/components/ens-input.js index 11e0fb36d..16a3a684c 100644 --- a/ui/app/components/ens-input.js +++ b/ui/app/components/ens-input.js @@ -109,6 +109,7 @@ EnsInput.prototype.lookupEnsName = function () { log.error(reason) return this.setState({ loadingEns: false, + ensResolution: '0x0000000000000000000000000000000000000000', ensFailure: true, hoverText: reason.message, }) -- cgit v1.2.3 From 94fedd1fc9d44054670b9f60ae6f92b409e7b25e Mon Sep 17 00:00:00 2001 From: frankiebee Date: Mon, 5 Jun 2017 13:00:15 -0700 Subject: Fix for quick switch on ENS names --- ui/app/components/ens-input.js | 2 ++ 1 file changed, 2 insertions(+) (limited to 'ui/app/components/ens-input.js') diff --git a/ui/app/components/ens-input.js b/ui/app/components/ens-input.js index 16a3a684c..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 @@ -102,6 +103,7 @@ EnsInput.prototype.lookupEnsName = function () { ensResolution: address, nickname: recipient.trim(), hoverText: address + '\nClick to Copy', + ensFailure: false, }) } }) -- cgit v1.2.3