Hooked up the Block Explorer to the Debugger so we can instantly debug made transactions

This commit is contained in:
Maran
2014-05-28 15:48:17 +02:00
parent aaeb268522
commit 1eda1d25b0
3 changed files with 59 additions and 8 deletions

View File

@ -2,6 +2,7 @@ package ethui
import (
"bitbucket.org/kardianos/osext"
"encoding/hex"
"github.com/ethereum/eth-go"
"github.com/ethereum/eth-go/ethchain"
"github.com/ethereum/eth-go/ethutil"
@ -24,8 +25,9 @@ type UiLib struct {
connected bool
assetPath string
// The main application window
win *qml.Window
Db *Debugger
win *qml.Window
Db *Debugger
DbWindow *DebuggerWindow
}
func NewUiLib(engine *qml.Engine, eth *eth.Ethereum, assetPath string) *UiLib {
@ -88,9 +90,26 @@ func (ui *UiLib) ConnectToPeer(addr string) {
func (ui *UiLib) AssetPath(p string) string {
return path.Join(ui.assetPath, p)
}
func (self *UiLib) StartDbWithContractAndData(contractHash, data string) {
dbWindow := NewDebuggerWindow(self)
object := self.eth.StateManager().CurrentState().GetStateObject(ethutil.FromHex(contractHash))
if len(object.Script()) > 0 {
dbWindow.SetCode("0x" + hex.EncodeToString(object.Script()))
}
dbWindow.SetData(data)
dbWindow.Show()
}
func (self *UiLib) StartDbWithCode(code string) {
dbWindow := NewDebuggerWindow(self)
dbWindow.SetCode("0x" + code)
dbWindow.Show()
}
func (self *UiLib) StartDebugger() {
dbWindow := NewDebuggerWindow(self)
//self.DbWindow = dbWindow
dbWindow.Show()
}