diff --git a/packages/cockpit/ui/src/components/Console.css b/packages/cockpit/ui/src/components/Console.css index 2087d0866..57de9d0dc 100644 --- a/packages/cockpit/ui/src/components/Console.css +++ b/packages/cockpit/ui/src/components/Console.css @@ -7,6 +7,11 @@ text-transform: capitalize; } +.console-text { + font-family: monospace; + white-space: pre; +} + .text__new-line, .card.warnings-card .list-group-item, .card.errors-card .list-group-item { white-space: pre-wrap; font-family: monospace; diff --git a/packages/cockpit/ui/src/components/Console.js b/packages/cockpit/ui/src/components/Console.js index 40a93adcc..fed473dec 100644 --- a/packages/cockpit/ui/src/components/Console.js +++ b/packages/cockpit/ui/src/components/Console.js @@ -77,6 +77,7 @@ class Console extends Component { logClassName(item) { return classnames('m-0', { + 'console-text': true, 'text-success': item.logLevel === 'info', 'text-info': item.logLevel === 'debug', 'text-danger': item.logLevel === 'error', diff --git a/packages/core/core/src/engine.ts b/packages/core/core/src/engine.ts index bf1062c79..dc4a7ff93 100644 --- a/packages/core/core/src/engine.ts +++ b/packages/core/core/src/engine.ts @@ -286,6 +286,7 @@ export class Engine { this.registerModulePackage('embark-specialconfigs', {plugins: this.plugins}); this.registerModulePackage('embark-transaction-logger'); this.registerModulePackage('embark-transaction-tracker'); + this.registerModulePackage('embark-profiler'); } storageComponent() { diff --git a/packages/plugins/profiler/package.json b/packages/plugins/profiler/package.json index 0b89dba5c..0199d376e 100644 --- a/packages/plugins/profiler/package.json +++ b/packages/plugins/profiler/package.json @@ -45,6 +45,7 @@ "ascii-table": "0.0.9", "async": "2.6.1", "core-js": "3.3.5", + "web3": "1.2.1", "web3-utils": "1.2.1" }, "devDependencies": { diff --git a/packages/plugins/profiler/src/gasEstimator.js b/packages/plugins/profiler/src/gasEstimator.js index 58ff0b8c0..32af6ab3a 100644 --- a/packages/plugins/profiler/src/gasEstimator.js +++ b/packages/plugins/profiler/src/gasEstimator.js @@ -1,5 +1,6 @@ const async = require('async'); const ContractFuzzer = require('./fuzzer.js'); +const Web3 = require('web3'); class GasEstimator { constructor(embark) { @@ -12,8 +13,10 @@ class GasEstimator { estimateGas(contractName, cb) { const self = this; let gasMap = {}; - self.events.request('blockchain:object', ({ web3 }) => { - self.events.request('contracts:contract', contractName, (contract) => { + self.events.request("blockchain:client:provider", "ethereum", (err, provider) => { + const web3 = new Web3(provider); + self.events.request('contracts:contract', contractName, (err, contract) => { + if (err) return cb(err); let fuzzMap = self.fuzzer.generateFuzz(3, contract); let contractObj = new web3.eth.Contract(contract.abiDefinition, contract.deployedAddress); async.each(contract.abiDefinition.filter((x) => x.type !== "event"), @@ -21,10 +24,10 @@ class GasEstimator { let name = abiMethod.name; if (abiMethod.type === "constructor") { // already provided for us - gasMap['constructor'] = contract.gasEstimates.creation.totalCost.toString(); + gasMap['constructor'] = parseFloat(contract.gasEstimates.creation.totalCost.toString()); return gasCb(null, name, abiMethod.type); } else if (abiMethod.type === "fallback") { - gasMap['fallback'] = contract.gasEstimates.external[""].toString(); + gasMap['fallback'] = parseFloat(contract.gasEstimates.external[""].toString()); return gasCb(null, name, abiMethod.type); } else if ( (abiMethod.inputs === null || abiMethod.inputs === undefined || abiMethod.inputs.length === 0) diff --git a/packages/plugins/profiler/src/index.js b/packages/plugins/profiler/src/index.js index 89a3dc6ea..f8d5f6007 100644 --- a/packages/plugins/profiler/src/index.js +++ b/packages/plugins/profiler/src/index.js @@ -19,7 +19,8 @@ class Profiler { profileObj.name = contractName; profileObj.methods = []; - self.events.request('contracts:contract', contractName, (contract) => { + self.events.request('contracts:contract', contractName, (err, contract) => { + if (err) return returnCb(err); if (!contract || !contract.deployedAddress) { return returnCb("-- couldn't profile " + contractName + " - it's not deployed or could be an interface"); }