From 734dc858254bde7f4cf8212d87d8d6f9e9b606ab Mon Sep 17 00:00:00 2001 From: VoR0220 Date: Mon, 18 Jun 2018 10:45:20 -0500 Subject: [PATCH] add in new api for ens Signed-off-by: VoR0220 --- lib/modules/ens/index.js | 39 +++++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 16 deletions(-) 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) => {