mirror of
https://github.com/status-im/embark-area-51.git
synced 2025-02-03 02:43:25 +00:00
should work to create the reverse lookup
Signed-off-by: VoR0220 <catalanor0220@gmail.com>
This commit is contained in:
parent
fe84cc8de4
commit
8b07039907
@ -277,3 +277,23 @@ __embarkENS.resolve = function(name) {
|
|||||||
return addr;
|
return addr;
|
||||||
}).catch(err => err);
|
}).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"))
|
||||||
|
address = address.slice(2);
|
||||||
|
|
||||||
|
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) => {
|
||||||
|
return name;
|
||||||
|
}).catch(err => err);
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user