From f7d5bd0e708b80afbad9f1e140446b0aabb54a9c Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Wed, 1 Aug 2018 15:09:16 -0400 Subject: [PATCH] refactor profile caller --- lib/modules/profiler/index.js | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/lib/modules/profiler/index.js b/lib/modules/profiler/index.js index 65d837b42..6f2ab05df 100644 --- a/lib/modules/profiler/index.js +++ b/lib/modules/profiler/index.js @@ -16,7 +16,7 @@ class Profiler { profile(contractName, contract, callback) { const self = this; - this.profileJSON(contractName, contract, (err, profileObj) => { + this.profileJSON(contractName, (err, profileObj) => { if (err) { return callback(null, "error found in method: " + name + " error: " + JSON.stringify(err)); } @@ -70,16 +70,12 @@ class Profiler { '/embark-api/profiler/:contractName', (req, res) => { let contractName = req.params.contractName; - self.events.request('contracts:contract', contractName, (contract) => { - if (!contract || !contract.deployedAddress) { - return res.send({error: "-- couldn't profile " + contractName + " - it's not deployed or could be an interface"}); + + self.profileJSON(contractName, (err, table) => { + if (err) { + return res.send({error: err}); } - self.profile(contractName, contract, (err, table) => { - if (err) { - return res.send({error: err}); - } - res.send(table); - }); + res.send(table); }); } );