diff options
Diffstat (limited to 'ethereal/assets/qml/test_app.qml')
-rw-r--r-- | ethereal/assets/qml/test_app.qml | 81 |
1 files changed, 58 insertions, 23 deletions
diff --git a/ethereal/assets/qml/test_app.qml b/ethereal/assets/qml/test_app.qml index aace4e881..c69587839 100644 --- a/ethereal/assets/qml/test_app.qml +++ b/ethereal/assets/qml/test_app.qml @@ -3,33 +3,68 @@ import QtQuick.Controls 1.0; import QtQuick.Layouts 1.0; import Ethereum 1.0 -ApplicationWindow { - minimumWidth: 500 - maximumWidth: 500 - maximumHeight: 100 - minimumHeight: 100 +QmlApp { + minimumWidth: 350 + maximumWidth: 350 + maximumHeight: 80 + minimumHeight: 80 - title: "Ethereum Dice" + title: "Generic Coin" - TextField { - id: textField - anchors.verticalCenter: parent.verticalCenter - anchors.horizontalCenter: parent.horizontalCenter - placeholderText: "Amount" + property string contractAddr: "f299f6c74515620e4c4cd8fe3d205b5c4f2e25c8" + property string addr: "2ef47100e0787b915105fd5e3f4ff6752079d5cb" + + Component.onCompleted: { + eth.watch(contractAddr, addr) + eth.watch(addr, contractAddr) + setAmount() + } + + function onStorageChangeCb(storageObject) { + setAmount() } - Label { - id: txHash - anchors.bottom: textField.top - anchors.bottomMargin: 5 - anchors.horizontalCenter: parent.horizontalCenter + + function setAmount(){ + var state = eth.getStateObject(contractAddr) + var storage = state.getStorage(addr) + amountLabel.text = storage } - Button { - anchors.top: textField.bottom - anchors.horizontalCenter: parent.horizontalCenter - anchors.topMargin: 5 - text: "Place bet" - onClicked: { - txHash.text = eth.createTx("e6716f9544a56c530d868e4bfbacb172315bdead", textField.text) + Column { + spacing: 5 + Row { + spacing: 20 + Label { + id: genLabel + text: "Generic coin balance:" + } + Label { + id: amountLabel + } + } + Row { + spacing: 20 + TextField { + id: address + placeholderText: "Address" + } + TextField { + id: amount + placeholderText: "Amount" + } + } + Button { + text: "Send coins" + onClicked: { + var privKey = eth.getKey().privateKey + if(privKey){ + var result = eth.transact(privKey, contractAddr, 0,"100000","250", "0x" + address.text + "\n" + amount.text) + resultTx.text = result.hash + } + } + } + Label { + id: resultTx } } + } |