mirror of https://github.com/embarklabs/embark.git
fix reference to ens object
This commit is contained in:
parent
e988bd6b4a
commit
32a9b25fe3
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue