add in new api for ens

Signed-off-by: VoR0220 <catalanor0220@gmail.com>
This commit is contained in:
VoR0220 2018-06-18 10:45:20 -05:00 committed by Iuri Matias
parent e80ba7873a
commit 734dc85825
1 changed files with 23 additions and 16 deletions

View File

@ -13,10 +13,16 @@ class ENS {
this.ensResolver = null;
this.addENSToEmbarkJS();
this.configureENSRegistry((abi, addr) => {
self.addSetProvider({
abi: abi,
address: addr
this.configureENSRegistry();
self.embark.registerActionForEvent("contracts:deploy:afterAll", (cb) => {
self.events.request('contracts:contract', "ENSRegistry", (contract) => {
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);
}
configureENSRegistry(cb) {
configureENSRegistry() {
const self = this;
self.embark.addContractFile('./contracts/ENSRegistry.sol');
console.log("DIS DIR RIGHT HEYA: ", __dirname);
self.embark.registerContractConfiguration({
"default": {
"gas": "auto",
"ENSRegistry": {
"deploy": true
"deploy": true,
"args": []
}
},
"ropsten": {
"ENSRegistry": {
"address": "0x112234455c3a32fd11230c42e7bccd4a84e02010"
"address": "0x112234455c3a32fd11230c42e7bccd4a84e02010",
"args": []
}
},
"rinkeby": {
"ENSRegistry": {
"address": "0xe7410170f87102DF0055eB195163A03B7F2Bff4A"
"address": "0xe7410170f87102DF0055eB195163A03B7F2Bff4A",
"args": []
}
},
"mainnet": {
"livenet": {
"ENSRegistry": {
"address": "0x314159265dd8dbb310642f98f50c066173c1259b"
"address": "0x314159265dd8dbb310642f98f50c066173c1259b",
"args": []
}
}
});
self.events.on("contracts:deploy:afterAll", (contract) => {
if (contract.className === "ENSRegistry") {
cb(contract.abiDefinition, contract.address);
}
});
self.embark.events.request("config:contractsFiles:add", embark.pathToFile('./contracts/ENSRegistry.sol'));
}
addSetProvider(config) {
let code = "\nEmbarkJS.Names.setProvider('ens'," + config + ");";
let shouldInit = (namesConfig) => {