diff --git a/lib/contracts/deploy.js b/lib/contracts/deploy.js index fc4eee80..8228e30a 100644 --- a/lib/contracts/deploy.js +++ b/lib/contracts/deploy.js @@ -26,6 +26,22 @@ class Deploy { cb(self.contractsManager.getContract(contractName)); }); + self.events.setCommandHandler("contracts:all", (contractName, cb) => { + let contracts = self.contractsManager.listContracts(); + let results = {}; + for (let className in contracts) { + let contract = contracts[className]; + + results[className] = { + name: contract.className, + deploy: contract.deploy, + error: contract.error, + address: contract.deployedAddress + }; + } + cb(results); + }); + let plugin = this.plugins.createPlugin('deployment', {}); plugin.registerAPICall( 'get', @@ -34,6 +50,14 @@ class Deploy { self.events.request('contracts:contract', req.params.contractName, res.send.bind(res)); } ); + + plugin.registerAPICall( + 'get', + '/embark/contracts', + (req, res) => { + self.events.request('contracts:all', null, res.send.bind(res)); + } + ); } initTracker(cb) { diff --git a/lib/modules/webserver/backend/contracts/view.html b/lib/modules/webserver/backend/contracts/view.html index 34371d55..3b899f2a 100644 --- a/lib/modules/webserver/backend/contracts/view.html +++ b/lib/modules/webserver/backend/contracts/view.html @@ -75,7 +75,7 @@
- + Embark
@@ -150,7 +150,7 @@