add event and API end poitn to get the JSON info of a contract

This commit is contained in:
Iuri Matias 2018-04-17 15:38:12 -04:00 committed by Pascal Precht
parent 21440505e1
commit 23bd2c91a7
No known key found for this signature in database
GPG Key ID: 0EE28D8D6FD85D7D
1 changed files with 13 additions and 0 deletions

View File

@ -21,6 +21,19 @@ class Deploy {
this.events.setCommandHandler('setDashboardState', () => {
self.events.emit('contractsState', self.contractsManager.contractsState());
});
self.events.setCommandHandler("contracts:contract", (contractName, cb) => {
cb(self.contractsManager.getContract(contractName));
});
let plugin = this.plugins.createPlugin('deployment', {});
plugin.registerAPICall(
'get',
'/embark/contract/:contractName',
(req, res) => {
self.events.request('contracts:contract', req.params.contractName, res.send.bind(res));
}
);
}
initTracker(cb) {