added some logic for error handling in lookup and fixed some linting issues
Signed-off-by: VoR0220 <catalanor0220@gmail.com>
This commit is contained in:
parent
8b07039907
commit
16e7fe9fde
|
@ -278,8 +278,6 @@ __embarkENS.resolve = function(name) {
|
|||
}).catch(err => err);
|
||||
};
|
||||
|
||||
__embarkENS.NameNotFound = Error("ENS name not found");
|
||||
|
||||
__embarkENS.lookup = function(address) {
|
||||
const self = this;
|
||||
|
||||
|
@ -288,12 +286,13 @@ __embarkENS.lookup = function(address) {
|
|||
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);
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue