add in new api for ens
Signed-off-by: VoR0220 <catalanor0220@gmail.com>
This commit is contained in:
parent
e80ba7873a
commit
734dc85825
|
@ -13,10 +13,16 @@ class ENS {
|
||||||
this.ensResolver = null;
|
this.ensResolver = null;
|
||||||
|
|
||||||
this.addENSToEmbarkJS();
|
this.addENSToEmbarkJS();
|
||||||
this.configureENSRegistry((abi, addr) => {
|
this.configureENSRegistry();
|
||||||
self.addSetProvider({
|
self.embark.registerActionForEvent("contracts:deploy:afterAll", (cb) => {
|
||||||
abi: abi,
|
self.events.request('contracts:contract', "ENSRegistry", (contract) => {
|
||||||
address: addr
|
console.log("CONTRACT: ", contract);
|
||||||
|
/*let config = {
|
||||||
|
abi: contract.abiDefinition,
|
||||||
|
address: contract.deployedAddress
|
||||||
|
};*/
|
||||||
|
//self.addSetProvider(config);
|
||||||
|
return cb();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -49,40 +55,41 @@ class ENS {
|
||||||
this.embark.addCodeToEmbarkJS(code);
|
this.embark.addCodeToEmbarkJS(code);
|
||||||
}
|
}
|
||||||
|
|
||||||
configureENSRegistry(cb) {
|
configureENSRegistry() {
|
||||||
const self = this;
|
const self = this;
|
||||||
self.embark.addContractFile('./contracts/ENSRegistry.sol');
|
console.log("DIS DIR RIGHT HEYA: ", __dirname);
|
||||||
self.embark.registerContractConfiguration({
|
self.embark.registerContractConfiguration({
|
||||||
"default": {
|
"default": {
|
||||||
"gas": "auto",
|
"gas": "auto",
|
||||||
"ENSRegistry": {
|
"ENSRegistry": {
|
||||||
"deploy": true
|
"deploy": true,
|
||||||
|
"args": []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"ropsten": {
|
"ropsten": {
|
||||||
"ENSRegistry": {
|
"ENSRegistry": {
|
||||||
"address": "0x112234455c3a32fd11230c42e7bccd4a84e02010"
|
"address": "0x112234455c3a32fd11230c42e7bccd4a84e02010",
|
||||||
|
"args": []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"rinkeby": {
|
"rinkeby": {
|
||||||
"ENSRegistry": {
|
"ENSRegistry": {
|
||||||
"address": "0xe7410170f87102DF0055eB195163A03B7F2Bff4A"
|
"address": "0xe7410170f87102DF0055eB195163A03B7F2Bff4A",
|
||||||
|
"args": []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"mainnet": {
|
"livenet": {
|
||||||
"ENSRegistry": {
|
"ENSRegistry": {
|
||||||
"address": "0x314159265dd8dbb310642f98f50c066173c1259b"
|
"address": "0x314159265dd8dbb310642f98f50c066173c1259b",
|
||||||
|
"args": []
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
self.events.on("contracts:deploy:afterAll", (contract) => {
|
self.embark.events.request("config:contractsFiles:add", embark.pathToFile('./contracts/ENSRegistry.sol'));
|
||||||
if (contract.className === "ENSRegistry") {
|
|
||||||
cb(contract.abiDefinition, contract.address);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
addSetProvider(config) {
|
addSetProvider(config) {
|
||||||
|
|
||||||
let code = "\nEmbarkJS.Names.setProvider('ens'," + config + ");";
|
let code = "\nEmbarkJS.Names.setProvider('ens'," + config + ");";
|
||||||
|
|
||||||
let shouldInit = (namesConfig) => {
|
let shouldInit = (namesConfig) => {
|
||||||
|
|
Loading…
Reference in New Issue