|
|
@ -2,7 +2,6 @@ var TxBrowser = require('./debuggerUI/TxBrowser') |
|
|
|
var StepManagerUI = require('./debuggerUI/StepManager') |
|
|
|
var StepManagerUI = require('./debuggerUI/StepManager') |
|
|
|
var VmDebugger = require('./debuggerUI/VmDebugger') |
|
|
|
var VmDebugger = require('./debuggerUI/VmDebugger') |
|
|
|
|
|
|
|
|
|
|
|
//var Debugger = require('./debugger/debugger')
|
|
|
|
|
|
|
|
var Debugger = require('remix-debug').TransactionDebugger |
|
|
|
var Debugger = require('remix-debug').TransactionDebugger |
|
|
|
|
|
|
|
|
|
|
|
var SourceHighlighter = require('../editor/sourceHighlighter') |
|
|
|
var SourceHighlighter = require('../editor/sourceHighlighter') |
|
|
@ -33,28 +32,13 @@ var css = csjs` |
|
|
|
|
|
|
|
|
|
|
|
class ContextManager { |
|
|
|
class ContextManager { |
|
|
|
constructor () { |
|
|
|
constructor () { |
|
|
|
this.web3 = executionContext.web3() |
|
|
|
this.executionContext = executionContext |
|
|
|
|
|
|
|
this.web3 = this.executionContext.web3() |
|
|
|
this.event = new EventManager() |
|
|
|
this.event = new EventManager() |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class DebuggerUI { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
constructor (container) { |
|
|
|
|
|
|
|
this.registry = globalRegistry |
|
|
|
|
|
|
|
this.event = new EventManager() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.executionContext = executionContext |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.debugger = new Debugger({ |
|
|
|
|
|
|
|
web3: executionContext.web3(), |
|
|
|
|
|
|
|
offsetToLineColumnConverter: this.registry.get('offsettolinecolumnconverter').api, |
|
|
|
|
|
|
|
compiler: this.registry.get('compiler').api, |
|
|
|
|
|
|
|
compilersArtefacts: this.registry.get('compilersartefacts').api |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
initProviders () { |
|
|
|
this.web3Providers = new Web3Providers() |
|
|
|
this.web3Providers = new Web3Providers() |
|
|
|
this.executionContext = this.executionContext |
|
|
|
|
|
|
|
this.addProvider('DUMMYWEB3', new DummyProvider()) |
|
|
|
this.addProvider('DUMMYWEB3', new DummyProvider()) |
|
|
|
this.switchProvider('DUMMYWEB3') |
|
|
|
this.switchProvider('DUMMYWEB3') |
|
|
|
|
|
|
|
|
|
|
@ -62,25 +46,11 @@ class DebuggerUI { |
|
|
|
this.addProvider('injected', this.executionContext.internalWeb3()) |
|
|
|
this.addProvider('injected', this.executionContext.internalWeb3()) |
|
|
|
this.addProvider('web3', this.executionContext.internalWeb3()) |
|
|
|
this.addProvider('web3', this.executionContext.internalWeb3()) |
|
|
|
this.switchProvider(this.executionContext.getProvider()) |
|
|
|
this.switchProvider(this.executionContext.getProvider()) |
|
|
|
|
|
|
|
|
|
|
|
this.isActive = false |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.sourceHighlighter = new SourceHighlighter() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.startTxBrowser() |
|
|
|
|
|
|
|
this.stepManager = null |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.statusMessage = '' |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.view |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
container.appendChild(this.render()) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.setEditor() |
|
|
|
|
|
|
|
this.listenToEvents() |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
getWeb3 () { |
|
|
|
|
|
|
|
return this.web3 |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
addProvider (type, obj) { |
|
|
|
addProvider (type, obj) { |
|
|
|
this.web3Providers.addProvider(type, obj) |
|
|
|
this.web3Providers.addProvider(type, obj) |
|
|
@ -93,22 +63,61 @@ class DebuggerUI { |
|
|
|
if (error) { |
|
|
|
if (error) { |
|
|
|
console.log('provider ' + type + ' not defined') |
|
|
|
console.log('provider ' + type + ' not defined') |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
self.debugger.updateWeb3(obj) |
|
|
|
self.web3 = obj |
|
|
|
self.executionContext.detectNetwork((error, network) => { |
|
|
|
self.executionContext.detectNetwork((error, network) => { |
|
|
|
if (error || !network) { |
|
|
|
if (error || !network) { |
|
|
|
self.debugger.debugger.updateWeb3(obj) |
|
|
|
self.web3 = obj |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
var webDebugNode = init.web3DebugNode(network.name) |
|
|
|
var webDebugNode = init.web3DebugNode(network.name) |
|
|
|
self.debugger.updateWeb3(!webDebugNode ? obj : webDebugNode) |
|
|
|
self.web3 = (!webDebugNode ? obj : webDebugNode) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
self.event.trigger('providerChanged', [type, self.web3]) |
|
|
|
}) |
|
|
|
}) |
|
|
|
self.event.trigger('providerChanged', [type]) |
|
|
|
self.event.trigger('providerChanged', [type, self.web3]) |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class DebuggerUI { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
constructor (container) { |
|
|
|
|
|
|
|
this.registry = globalRegistry |
|
|
|
|
|
|
|
this.event = new EventManager() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.executionContext = executionContext |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.contextManager = new ContextManager() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.debugger = new Debugger({ |
|
|
|
|
|
|
|
web3: this.contextManager.getWeb3(), |
|
|
|
|
|
|
|
offsetToLineColumnConverter: this.registry.get('offsettolinecolumnconverter').api, |
|
|
|
|
|
|
|
compiler: this.registry.get('compiler').api |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.contextManager.initProviders() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.contextManager.event.register('providerChanged', () => { |
|
|
|
|
|
|
|
this.debugger.updateWeb3(this.contextManager.getWeb3()) |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.isActive = false |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.sourceHighlighter = new SourceHighlighter() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.startTxBrowser() |
|
|
|
|
|
|
|
this.stepManager = null |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.statusMessage = '' |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.view |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
container.appendChild(this.render()) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.setEditor() |
|
|
|
|
|
|
|
this.listenToEvents() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
setEditor () { |
|
|
|
setEditor () { |
|
|
|
const self = this |
|
|
|
const self = this |
|
|
|