From 8e0f8b44d11bb3fc6c7c4d8fb772885c6e05b27e Mon Sep 17 00:00:00 2001 From: emizzle Date: Wed, 4 Dec 2019 16:26:32 +1100 Subject: [PATCH] fix(@embark/debugger): Re-enable debugger Re-enable debugger for cockpit and console. Add missing request `blockchain:getTransaction` required to start a debugging session. Fix error in console when stopping a debug session. --- packages/embark/src/cmd/cmd_controller.js | 2 ++ packages/plugins/debugger/src/index.ts | 4 ++-- packages/plugins/ethereum-blockchain-client/src/api.js | 1 + packages/stack/blockchain/src/api.ts | 5 +++++ 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/embark/src/cmd/cmd_controller.js b/packages/embark/src/cmd/cmd_controller.js index 93aa39ac7..f2ac0e687 100644 --- a/packages/embark/src/cmd/cmd_controller.js +++ b/packages/embark/src/cmd/cmd_controller.js @@ -162,6 +162,7 @@ class EmbarkController { engine.registerModuleGroup("storage"); engine.registerModuleGroup("cockpit"); engine.registerModulePackage('embark-deploy-tracker', { plugins: engine.plugins }); + engine.registerModulePackage("embark-debugger"); // load custom plugins engine.loadDappPlugins(); @@ -391,6 +392,7 @@ class EmbarkController { engine.registerModuleGroup("cockpit"); } engine.registerModulePackage('embark-deploy-tracker', { plugins: engine.plugins }); + engine.registerModulePackage("embark-debugger"); callback(); }, diff --git a/packages/plugins/debugger/src/index.ts b/packages/plugins/debugger/src/index.ts index d6254b278..8e8ee54a9 100644 --- a/packages/plugins/debugger/src/index.ts +++ b/packages/plugins/debugger/src/index.ts @@ -275,9 +275,9 @@ class TransactionDebugger { this.embark.logger.warn(NO_DEBUG_SESSION); return callback(); } - this.cmdDebugger = null; - this.embark.logger.info(__('The debug session has been stopped')); this.cmdDebugger.unload(); + this.cmdDebugger = null; + callback(undefined, __('The debug session has been stopped')); }, usage: ' stop debugger/sd', }); diff --git a/packages/plugins/ethereum-blockchain-client/src/api.js b/packages/plugins/ethereum-blockchain-client/src/api.js index 23103788b..86e419434 100644 --- a/packages/plugins/ethereum-blockchain-client/src/api.js +++ b/packages/plugins/ethereum-blockchain-client/src/api.js @@ -44,6 +44,7 @@ export default class EthereumAPI { this.embark.events.request("blockchain:request:register", this.blockchainName, "getBlock", this.getBlock.bind(this)); this.embark.events.request("blockchain:request:register", this.blockchainName, "getGasPrice", this.getGasPrice.bind(this)); this.embark.events.request("blockchain:request:register", this.blockchainName, "getNetworkId", this.getNetworkId.bind(this)); + this.embark.events.request("blockchain:request:register", this.blockchainName, "getTransaction", this.getTransactionByHash.bind(this)); this.embark.events.request("blockchain:request:register", this.blockchainName, "contractObject", this.contractObject.bind(this)); } diff --git a/packages/stack/blockchain/src/api.ts b/packages/stack/blockchain/src/api.ts index 4784b6bcd..1408c97f7 100644 --- a/packages/stack/blockchain/src/api.ts +++ b/packages/stack/blockchain/src/api.ts @@ -114,6 +114,11 @@ export default class BlockchainAPI { cb(getNetworkId); }); + this.events.setCommandHandler("blockchain:getTransaction", async (txId, cb) => { + const getTransaction = this.getRequestForBlockchain(blockchainName, "getTransaction"); + getTransaction(txId, cb); + }); + this.events.setCommandHandler("blockchain:contract:create", (params, cb) => { const contractObject = this.getRequestForBlockchain(blockchainName, "contractObject")(params); cb(contractObject);