diff options
author | Kevin Serrano <kevgagser@gmail.com> | 2017-05-10 02:38:18 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-05-10 02:38:18 +0800 |
commit | 66fcf35ad7b3405b4eb58f7d84bf67801b503953 (patch) | |
tree | af22ab5efa88fa7c9df706513e23c39d7ec63890 | |
parent | 03d454f73baa27f9b44ec4bee0ba8f3c71414aa6 (diff) | |
parent | ac54c7d96b503e8d79fae4a67289ae95d09c3c75 (diff) | |
download | tangerine-wallet-browser-66fcf35ad7b3405b4eb58f7d84bf67801b503953.tar tangerine-wallet-browser-66fcf35ad7b3405b4eb58f7d84bf67801b503953.tar.gz tangerine-wallet-browser-66fcf35ad7b3405b4eb58f7d84bf67801b503953.tar.bz2 tangerine-wallet-browser-66fcf35ad7b3405b4eb58f7d84bf67801b503953.tar.lz tangerine-wallet-browser-66fcf35ad7b3405b4eb58f7d84bf67801b503953.tar.xz tangerine-wallet-browser-66fcf35ad7b3405b4eb58f7d84bf67801b503953.tar.zst tangerine-wallet-browser-66fcf35ad7b3405b4eb58f7d84bf67801b503953.zip |
Merge pull request #1402 from MetaMask/ens-fix
ens - add mainnet ens support
-rw-r--r-- | ui/app/components/ens-input.js | 16 |
1 files changed, 9 insertions, 7 deletions
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 |