From 8a2698ad5e3d47db9175e838b0a16c3f59b6e071 Mon Sep 17 00:00:00 2001 From: Maran Date: Mon, 14 Apr 2014 13:46:59 -0400 Subject: [PATCH 1/3] Add send to contract --- .../qml/newTransaction/_new_contract.qml | 39 +++++++++++++++++-- ethereal/assets/qml/wallet.qml | 2 +- 2 files changed, 37 insertions(+), 4 deletions(-) diff --git a/ethereal/assets/qml/newTransaction/_new_contract.qml b/ethereal/assets/qml/newTransaction/_new_contract.qml index 8ce81a799e..abaac16959 100644 --- a/ethereal/assets/qml/newTransaction/_new_contract.qml +++ b/ethereal/assets/qml/newTransaction/_new_contract.qml @@ -85,9 +85,34 @@ Component { } } + Row { + id: rowContract + ExclusiveGroup { id: contractTypeGroup } + RadioButton { + id: createContractRadio + text: "Create contract" + checked: true + exclusiveGroup: contractTypeGroup + onClicked: { + txFuelRecipient.visible = false + txDataLabel.text = "Contract code" + } + } + RadioButton { + id: runContractRadio + text: "Run contract" + exclusiveGroup: contractTypeGroup + onClicked: { + txFuelRecipient.visible = true + txDataLabel.text = "Contract arguments" + } + } + } + + Label { id: txDataLabel - text: "Transaction data" + text: "Contract code" } TextArea { @@ -100,6 +125,14 @@ Component { } } + TextField { + id: txFuelRecipient + placeholderText: "Contract address" + validator: RegExpValidator { regExp: /[a-f0-9]{40}/ } + visible: false + width: 530 + } + Button { id: txButton states: [ @@ -116,14 +149,14 @@ Component { enabled: false onClicked: { //this.enabled = false - var res = eth.createTx("", txValue.text, txGas.text, txGasPrice.text, codeView.text) + var res = eth.createTx(txFuelRecipient.text, txValue.text, txGas.text, txGasPrice.text, codeView.text) if(res[1]) { txResult.text = "Your contract could not be send over the network:\n" txResult.text += res[1].error() txResult.text += "" mainContractColumn.state = "ERROR" } else { - txResult.text = "Your contract has been submitted:\n" + txResult.text = "Your transaction has been submitted:\n" txOutput.text = res[0] mainContractColumn.state = "DONE" } diff --git a/ethereal/assets/qml/wallet.qml b/ethereal/assets/qml/wallet.qml index 0c8c91e132..a4d5cb6424 100644 --- a/ethereal/assets/qml/wallet.qml +++ b/ethereal/assets/qml/wallet.qml @@ -167,7 +167,7 @@ ApplicationWindow { var newContract = component.createObject("newContract") addTab("Simple send", newTransaction) - addTab("Create contract", newContract) + addTab("Contracts", newContract) } } } From 91c75c9305e7554c21e84ed1a07ec0e750bb775a Mon Sep 17 00:00:00 2001 From: Maran Date: Mon, 14 Apr 2014 17:08:15 -0400 Subject: [PATCH 2/3] Adding log messages to debug panel --- ethereal/assets/qml/wallet.qml | 15 +++++++++++++++ ethereal/ui/ui_lib.go | 3 +++ 2 files changed, 18 insertions(+) diff --git a/ethereal/assets/qml/wallet.qml b/ethereal/assets/qml/wallet.qml index c3ddfe4b8c..2d2a9db9f6 100644 --- a/ethereal/assets/qml/wallet.qml +++ b/ethereal/assets/qml/wallet.qml @@ -412,6 +412,17 @@ ApplicationWindow { model: memModel } + SplitView { + orientation: Qt.Vertical + anchors.fill: parent + TableView { + property var debuggerLog: ListModel { + id: debuggerLog + } + TableViewColumn{ role: "value"; title: "Debug messages" } + model: debuggerLog + } + } TableView { property var stackModel: ListModel { id: stackModel @@ -449,6 +460,10 @@ ApplicationWindow { function setStack(stack) { stackModel.append({value: stack}) } + function addDebugMessage(message){ + console.log("WOOP:") + debuggerLog.append({value: message}) + } function clearStack() { stackModel.clear() diff --git a/ethereal/ui/ui_lib.go b/ethereal/ui/ui_lib.go index 86855290fb..b2552cdce9 100644 --- a/ethereal/ui/ui_lib.go +++ b/ethereal/ui/ui_lib.go @@ -102,6 +102,9 @@ func (ui *UiLib) DebugTx(recipient, valueStr, gasStr, gasPriceStr, data string) asm, err := mutan.Compile(strings.NewReader(mainInput), false) if err != nil { fmt.Println(err) + for _, e := range err { + ui.win.Root().Call("addDebugMessage", e.Error()) + } } callerScript := ethutil.Assemble(asm...) From c23a971a1f98cb6f45079846d8ff5efc4f488244 Mon Sep 17 00:00:00 2001 From: Maran Date: Mon, 14 Apr 2014 17:14:07 -0400 Subject: [PATCH 3/3] Fix up paneling --- ethereal/assets/qml/wallet.qml | 61 +++++++++++++++++----------------- 1 file changed, 30 insertions(+), 31 deletions(-) diff --git a/ethereal/assets/qml/wallet.qml b/ethereal/assets/qml/wallet.qml index 2d2a9db9f6..37224c7b44 100644 --- a/ethereal/assets/qml/wallet.qml +++ b/ethereal/assets/qml/wallet.qml @@ -401,37 +401,36 @@ ApplicationWindow { orientation: Qt.Vertical anchors.fill: parent - TableView { - property var memModel: ListModel { - id: memModel - } - height: parent.height/2 - width: parent.width - TableViewColumn{ id:mnumColmn ; role: "num" ; title: "#" ; width: 50} - TableViewColumn{ role: "value" ; title: "Memory" ; width: 750} - model: memModel - } - - SplitView { - orientation: Qt.Vertical - anchors.fill: parent - TableView { - property var debuggerLog: ListModel { - id: debuggerLog - } - TableViewColumn{ role: "value"; title: "Debug messages" } - model: debuggerLog - } - } - TableView { - property var stackModel: ListModel { - id: stackModel - } - height: parent.height/2 - width: parent.width - TableViewColumn{ role: "value" ; title: "Stack" ; width: parent.width } - model: stackModel - } + TableView { + property var memModel: ListModel { + id: memModel + } + height: parent.height/2 + width: parent.width + TableViewColumn{ id:mnumColmn ; role: "num" ; title: "#" ; width: 50} + TableViewColumn{ role: "value" ; title: "Memory" ; width: 750} + model: memModel + } + + SplitView { + orientation: Qt.Horizontal + TableView { + property var debuggerLog: ListModel { + id: debuggerLog + } + TableViewColumn{ role: "value"; title: "Debug messages" } + model: debuggerLog + } + TableView { + property var stackModel: ListModel { + id: stackModel + } + height: parent.height/2 + width: parent.width + TableViewColumn{ role: "value" ; title: "Stack" ; width: parent.width } + model: stackModel + } + } } } }