diff --git a/lib/modules/ens/index.js b/lib/modules/ens/index.js index 6d1336cc..09d889d0 100644 --- a/lib/modules/ens/index.js +++ b/lib/modules/ens/index.js @@ -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) => {