diff --git a/lib/modules/ens/embarkjs.js b/lib/modules/ens/embarkjs.js index 4ca66db0..f04f92d5 100644 --- a/lib/modules/ens/embarkjs.js +++ b/lib/modules/ens/embarkjs.js @@ -1,4 +1,5 @@ const namehash = require('eth-ens-namehash'); +const Web3 = require('web3'); /*global web3*/ let __embarkENS = {}; @@ -250,8 +251,9 @@ var registryAddresses = { "4": "0xe7410170f87102DF0055eB195163A03B7F2Bff4A" }; -__embarkENS.setProvider = function (options) { +__embarkENS.setProvider = function () { const self = this; + // get network id and then assign ENS contract based on that self.ens = web3.eth.net.getId().then(id => { if (registryAddresses[id] !== undefined) { @@ -265,8 +267,7 @@ __embarkENS.setProvider = function (options) { __embarkENS.resolve = function(name) { const self = this; - if (self.ens === undefined) - return undefined; + if (self.ens === undefined) return undefined; let node = namehash(name); diff --git a/lib/modules/ens/index.js b/lib/modules/ens/index.js index 5808231e..e6ba7295 100644 --- a/lib/modules/ens/index.js +++ b/lib/modules/ens/index.js @@ -41,15 +41,12 @@ class ENS { } addSetProvider() { - let config = JSON.stringify({ - server: this.storageConfig.host, - port: this.storageConfig.port - }); + let config = JSON.stringify({}); let code = "\nEmbarkJS.Names.setProvider('ens'," + config + ");"; - let shouldInit = (storageConfig) => { - return (namesConfig.provider === 'ens' && storageConfig.enabled === true); + let shouldInit = (namesConfig) => { + return (namesConfig.provider === 'ens' && namesConfig.enabled === true); }; this.embark.addProviderInit('names', code, shouldInit);