back to promisification

Signed-off-by: VoR0220 <catalanor0220@gmail.com>
This commit is contained in:
VoR0220 2018-06-18 14:57:43 -05:00 committed by Iuri Matias
parent 88133b01a9
commit cca71a1c66
1 changed files with 3 additions and 8 deletions

View File

@ -198,11 +198,11 @@ __embarkENS.resolve = function (name) {
}).catch(err => err);
};
__embarkENS.lookup = function (address, cb) {
__embarkENS.lookup = function (address) {
const self = this;
if (!self.ens) {
console.log("ENS provider not set. Exitting.");
console.log("ENS provider not set. Exiting.")
return;
}
if (address.startsWith("0x")) address = address.slice(2);
@ -212,10 +212,5 @@ __embarkENS.lookup = function (address, cb) {
return self.ens.methods.resolver(node).call().then((resolverAddress) => {
let resolverContract = new EmbarkJS.Contract({abi: self.resolverInterface, address: resolverAddress});
return resolverContract.methods.name(node).call();
}).then((name) => {
if (name === "" || name === undefined) {
return cb(new Error("Name not found"));
}
return cb(null, name);
}).catch(cb);
}).catch(err => err);
};