diff --git a/lib/modules/ens/embarkjs.js b/lib/modules/ens/embarkjs.js index 7034fbac3..9ac7d3d8d 100644 --- a/lib/modules/ens/embarkjs.js +++ b/lib/modules/ens/embarkjs.js @@ -252,11 +252,13 @@ __embarkENS.registryAddresses = { }; __embarkENS.setProvider = function () { + const self = this; // get network id and then assign ENS contract based on that let registryAddresses = this.registryAddresses; - this.ens = web3.eth.net.getId().then(id => { + this.ens = null + web3.eth.net.getId().then(id => { if (registryAddresses[id] !== undefined) { - return new web3.eth.Contract(this.registryInterface, registryAddresses[id]); + self.ens = new web3.eth.Contract(self.registryInterface, registryAddresses[id]); } // todo: deploy at this point return undefined; @@ -268,7 +270,7 @@ __embarkENS.resolve = function(name) { if (self.ens === undefined) return undefined; - let node = namehash(name); + let node = namehash.hash(name); self.ens.methods.resolver(node).call().then((resolverAddress) => { let resolverContract = new web3.eth.Contract(self.resolverInterface, resolverAddress); @@ -285,7 +287,7 @@ __embarkENS.lookup = function(address) { if (address.startsWith("0x")) address = address.slice(2); - let node = namehash(address.toLowerCase() + ".addr.reverse"); + let node = namehash.hash(address.toLowerCase() + ".addr.reverse"); self.ens.methods.resolver(node).call().then((resolverAddress) => { let resolverContract = new web3.eth.Contract(self.resolverInterface, resolverAddress);