add event and API endpoint to get the contract sourcecode
This commit is contained in:
parent
b324061e2b
commit
1b32122557
|
@ -19,6 +19,24 @@ class Pipeline {
|
|||
this.logger = options.logger;
|
||||
this.plugins = options.plugins;
|
||||
this.pipelinePlugins = this.plugins.getPluginsFor('pipeline');
|
||||
|
||||
const self = this;
|
||||
self.events.setCommandHandler("files:contract", (filename, cb) => {
|
||||
let file = self.contractsFiles.find((file) => file.filename === filename);
|
||||
if (!file) {
|
||||
return cb({error: filename + " not found"});
|
||||
}
|
||||
file.content(cb);
|
||||
});
|
||||
|
||||
let plugin = this.plugins.createPlugin('deployment', {});
|
||||
plugin.registerAPICall(
|
||||
'get',
|
||||
'/embark/files/contracts/',
|
||||
(req, res) => {
|
||||
self.events.request('files:contract', req.query.filename, res.send.bind(res));
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
build(abi, contractsJSON, path, callback) {
|
||||
|
|
Loading…
Reference in New Issue