Commit 2bcb5107 authored by yann300's avatar yann300

start external debugging

parent a050304f
var Debugger = require('./src/Ethdebugger')
module.exports = Debugger
...@@ -11,15 +11,20 @@ var yo = require('yo-yo') ...@@ -11,15 +11,20 @@ var yo = require('yo-yo')
var init = require('./helpers/init') var init = require('./helpers/init')
var ui = require('./helpers/ui') var ui = require('./helpers/ui')
function Ethdebugger () { function Ethdebugger (_web3) {
util.extend(this, new EventManager()) util.extend(this, new EventManager())
this.currentStepIndex = -1 this.currentStepIndex = -1
this.tx this.tx
this.statusMessage = '' this.statusMessage = ''
this.view this.view
if (_web3) {
this.web3 = _web3
init.extendWeb3(this.web3)
} else {
this.web3 = init.loadWeb3() this.web3 = init.loadWeb3()
}
this.traceManager = new TraceManager(this.web3) this.traceManager = new TraceManager(this.web3)
var self = this var self = this
...@@ -41,6 +46,10 @@ function Ethdebugger () { ...@@ -41,6 +46,10 @@ function Ethdebugger () {
this.sticker = new Sticker(this, this.traceManager, this.web3) this.sticker = new Sticker(this, this.traceManager, this.web3)
} }
Ethdebugger.prototype.debug = function (tx) {
this.txBrowser.load(tx.hash)
}
Ethdebugger.prototype.render = function () { Ethdebugger.prototype.render = function () {
var view = yo`<div style=${ui.formatCss(style.font)}> var view = yo`<div style=${ui.formatCss(style.font)}>
<h1 style=${ui.formatCss(style.container)}>VM Debugger</h1> <h1 style=${ui.formatCss(style.container)}>VM Debugger</h1>
......
...@@ -102,6 +102,12 @@ TxBrowser.prototype.updateTxN = function (ev) { ...@@ -102,6 +102,12 @@ TxBrowser.prototype.updateTxN = function (ev) {
this.txNumber = ev.target.value this.txNumber = ev.target.value
} }
TxBrowser.prototype.load = function (txHash) {
this.txNumber = txHash
yo.update(this.view, this.render())
this.submit()
}
TxBrowser.prototype.init = function (ev) { TxBrowser.prototype.init = function (ev) {
this.setDefaultValues() this.setDefaultValues()
yo.update(this.view, this.render()) yo.update(this.view, this.render())
......
...@@ -10,6 +10,10 @@ module.exports = { ...@@ -10,6 +10,10 @@ module.exports = {
return web3 return web3
}, },
extendWeb3: function (web3) {
Web3Admin.extend(web3)
},
setProvider: function (web3, url) { setProvider: function (web3, url) {
web3.setProvider(new web3.providers.HttpProvider(url)) web3.setProvider(new web3.providers.HttpProvider(url))
} }
......
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