diff options
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | ethereal/assets/qml/wallet.qml | 41 | ||||
-rw-r--r-- | ethereal/ui/debugger.go | 6 | ||||
-rw-r--r-- | ethereal/ui/gui.go | 2 | ||||
-rw-r--r-- | ethereal/ui/ui_lib.go | 22 |
5 files changed, 61 insertions, 12 deletions
@@ -5,7 +5,7 @@ Ethereum Ethereum Go Client © 2014 Jeffrey Wilcke. -Current state: Proof of Concept 5.0 RC10. +Current state: Proof of Concept 5.0 RC11. For the development package please see the [eth-go package](https://github.com/ethereum/eth-go). diff --git a/ethereal/assets/qml/wallet.qml b/ethereal/assets/qml/wallet.qml index bba9c1d3b..0e0e3d78d 100644 --- a/ethereal/assets/qml/wallet.qml +++ b/ethereal/assets/qml/wallet.qml @@ -340,10 +340,8 @@ ApplicationWindow { id: popup visible: false property var block - width: 800 - height: 280 - x: root.x - y: root.y + root.height + width: root.width + height: 240 Component{ id: blockDetailsDelegate Rectangle { @@ -389,17 +387,27 @@ ApplicationWindow { onClicked: { var tx = transactionModel.get(row) if(tx.data) { - popup.showContractData(tx.data) + popup.showContractData(tx) }else{ popup.height = 230 } } } - function showContractData(data) { - contractData.text = data + + function showContractData(tx) { + txDetailsDebugButton.tx = tx + if(tx.createsContract) { + contractData.text = tx.data + contractLabel.text = "<h4> Transaction created contract " + tx.address + "</h4>" + }else{ + contractLabel.text = "<h4> Transaction ran contract " + tx.address + "</h4>" + contractData.text = tx.rawData + } popup.height = 400 } + Rectangle { + id: txDetails width: popup.width height: 300 anchors.left: listViewThing.left @@ -411,11 +419,28 @@ ApplicationWindow { id: contractLabel anchors.leftMargin: 10 } + Button { + property var tx + id: txDetailsDebugButton + anchors.right: parent.right + anchors.rightMargin: 10 + anchors.top: parent.top + anchors.topMargin: 10 + text: "Debug contract" + onClicked: { + if(tx.createsContract){ + ui.startDbWithCode(tx.rawData) + }else { + ui.startDbWithContractAndData(tx.address, tx.rawData) + } + } + } TextArea { id: contractData text: "Contract" anchors.top: contractLabel.bottom anchors.left: parent.left + anchors.bottom: popup.bottom wrapMode: Text.Wrap width: parent.width - 30 height: 80 @@ -437,7 +462,7 @@ ApplicationWindow { transactionModel.insert(0, block.txs.get(i)) } if(block.txs.get(0).data){ - popup.showContractData(block.txs.get(0).data) + popup.showContractData(block.txs.get(0)) } } txView.forceActiveFocus() diff --git a/ethereal/ui/debugger.go b/ethereal/ui/debugger.go index 5b1fb50a2..342e3a7d0 100644 --- a/ethereal/ui/debugger.go +++ b/ethereal/ui/debugger.go @@ -65,6 +65,12 @@ func (self *DebuggerWindow) SetCode(code string) { func (self *DebuggerWindow) SetData(data string) { self.win.Set("dataText", data) } +func (self *DebuggerWindow) SetAsm(data string) { + dis := ethchain.Disassemble(ethutil.FromHex(data)) + for _, str := range dis { + self.win.Root().Call("setAsm", str) + } +} func (self *DebuggerWindow) Debug(valueStr, gasStr, gasPriceStr, scriptStr, dataStr string) { if !self.Db.done { diff --git a/ethereal/ui/gui.go b/ethereal/ui/gui.go index 63ab028ab..32ff76b1a 100644 --- a/ethereal/ui/gui.go +++ b/ethereal/ui/gui.go @@ -54,7 +54,7 @@ func New(ethereum *eth.Ethereum) *Gui { } func (gui *Gui) Start(assetPath string) { - const version = "0.5.0 RC10" + const version = "0.5.0 RC11" defer gui.txDb.Close() diff --git a/ethereal/ui/ui_lib.go b/ethereal/ui/ui_lib.go index 998392525..9c4301ffe 100644 --- a/ethereal/ui/ui_lib.go +++ b/ethereal/ui/ui_lib.go @@ -24,8 +24,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 +89,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" + ethutil.Hex(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() } |