diff --git a/lib/modules/ens/embarkjs.js b/lib/modules/ens/embarkjs.js index b6444c96..d394377a 100644 --- a/lib/modules/ens/embarkjs.js +++ b/lib/modules/ens/embarkjs.js @@ -278,22 +278,21 @@ __embarkENS.resolve = function(name) { }).catch(err => err); }; -__embarkENS.NameNotFound = Error("ENS name not found"); - __embarkENS.lookup = function(address) { const self = this; if (self.ens === undefined) return undefined; - if(address.startsWith("0x")) + if (address.startsWith("0x")) address = address.slice(2); - let node = namehash(address.toLowerCase() + ".addr.reverse") + let node = namehash(address.toLowerCase() + ".addr.reverse"); self.ens.methods.resolver(node).call().then((resolverAddress) => { let resolverContract = new web3.eth.Contract(resolverInterface, resolverAddress); return resolverContract.methods.name(node).call(); }).then((name) => { + if (name === "" || name === undefined) throw Error("ENS name not found"); return name; }).catch(err => err); -} +};