diff --git a/remix-debugger/src/ui/Ethdebugger.js b/remix-debugger/src/ui/Ethdebugger.js index ba6aa7c71f..b799c0cc59 100644 --- a/remix-debugger/src/ui/Ethdebugger.js +++ b/remix-debugger/src/ui/Ethdebugger.js @@ -6,6 +6,8 @@ var TraceManager = remixCore.trace.TraceManager var VmDebugger = require('./VmDebugger') var remixLib = require('remix-lib') var global = remixLib.global +var init = remixLib.init +var executionContext = remixLib.execution.executionContext var EventManager = remixLib.EventManager var yo = require('yo-yo') var csjs = require('csjs-inject') @@ -97,6 +99,14 @@ Ethdebugger.prototype.switchProvider = function (type) { console.log('provider ' + type + ' not defined') } else { global.web3 = obj + executionContext.detectNetwork((error, network) => { + if (error || !network) { + global.web3Debug = obj + } else { + var webDebugNode = init.web3DebugNode(network.name) + global.web3Debug = !webDebugNode ? obj : webDebugNode + } + }) self.event.trigger('providerChanged', [type]) } })