Commit f59d81b5 authored by Iuri Matias's avatar Iuri Matias Committed by yann300

move provider set into debugger class

parent faab2ff2
...@@ -82,6 +82,8 @@ function Debugger (container, sourceHighlighter, localRegistry) { ...@@ -82,6 +82,8 @@ function Debugger (container, sourceHighlighter, localRegistry) {
} }
}) })
// ====================
// listen to events
this.debugger.event.register('newTraceLoaded', this, function () { this.debugger.event.register('newTraceLoaded', this, function () {
self.event.trigger('debuggerStatus', [true]) self.event.trigger('debuggerStatus', [true])
}) })
...@@ -90,6 +92,13 @@ function Debugger (container, sourceHighlighter, localRegistry) { ...@@ -90,6 +92,13 @@ function Debugger (container, sourceHighlighter, localRegistry) {
self._components.sourceHighlighter.currentSourceLocation(null) self._components.sourceHighlighter.currentSourceLocation(null)
self.event.trigger('debuggerStatus', [false]) self.event.trigger('debuggerStatus', [false])
}) })
// ====================
// add providers
this.debugger.addProvider('vm', executionContext.vm())
this.debugger.addProvider('injected', executionContext.internalWeb3())
this.debugger.addProvider('web3', executionContext.internalWeb3())
this.debugger.switchProvider(executionContext.getProvider())
} }
/** /**
...@@ -107,24 +116,24 @@ Debugger.prototype.debug = function (txHash) { ...@@ -107,24 +116,24 @@ Debugger.prototype.debug = function (txHash) {
}) })
} }
/** // /**
* add a new web3 provider to remix // * add a new web3 provider to remix
* // *
* @param {String} type - type/name of the provider to add // * @param {String} type - type/name of the provider to add
* @param {Object} obj - provider // * @param {Object} obj - provider
*/ // */
Debugger.prototype.addProvider = function (type, obj) { // Debugger.prototype.addProvider = function (type, obj) {
this.debugger.addProvider(type, obj) // this.debugger.addProvider(type, obj)
} // }
/** // /**
* switch the provider // * switch the provider
* // *
* @param {String} type - type/name of the provider to use // * @param {String} type - type/name of the provider to use
*/ // */
Debugger.prototype.switchProvider = function (type) { // Debugger.prototype.switchProvider = function (type) {
this.debugger.switchProvider(type) // this.debugger.switchProvider(type)
} // }
/** /**
* get the current provider * get the current provider
......
var Debugger = require('../debugger/debugger') var Debugger = require('../debugger/debugger')
var executionContext = require('../../execution-context')
var SourceHighlighter = require('../editor/sourceHighlighter') var SourceHighlighter = require('../editor/sourceHighlighter')
class DebuggerUI { class DebuggerUI {
constructor (container) { constructor (container) {
this.transactionDebugger = new Debugger(container, new SourceHighlighter()) this.transactionDebugger = new Debugger(container, new SourceHighlighter())
this.transactionDebugger.addProvider('vm', executionContext.vm())
this.transactionDebugger.addProvider('injected', executionContext.internalWeb3())
this.transactionDebugger.addProvider('web3', executionContext.internalWeb3())
this.transactionDebugger.switchProvider(executionContext.getProvider())
this.isActive = false this.isActive = false
this.listenToEvents() this.listenToEvents()
} }
...@@ -31,7 +24,7 @@ class DebuggerUI { ...@@ -31,7 +24,7 @@ class DebuggerUI {
return this.isActive return this.isActive
} }
debug(txHash) { debug (txHash) {
this.transactionDebugger.debug(txHash) this.transactionDebugger.debug(txHash)
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment