basic "send money" functionality implemented in GUI

This commit is contained in:
Ilya Kitaev
2016-06-16 17:13:46 +03:00
parent 3ddd9bed72
commit eaf59243b2
9 changed files with 82 additions and 6 deletions

View File

@@ -32,6 +32,7 @@ import QtQuick.Controls 1.1
import QtQuick.Controls.Styles 1.1
import Qt.labs.settings 1.0
import Bitmonero.Wallet 1.0
import Bitmonero.PendingTransaction 1.0
import "components"
import "wizard"
@@ -120,6 +121,8 @@ ApplicationWindow {
function initialize() {
middlePanel.paymentClicked.connect(handlePayment);
if (typeof wizard.settings['wallet'] !== 'undefined') {
wallet = wizard.settings['wallet'];
} else {
@@ -157,6 +160,27 @@ ApplicationWindow {
return wallets.length > 0;
}
function handlePayment(address, paymentId, amount, fee, privacyLevel) {
console.log("Process payment here: ", address, paymentId, amount, fee, privacyLevel)
// TODO: handle payment id
// TODO: handle fee;
// TODO: handle mixins
var amountxmr = walletManager.amountFromString(amount);
console.log("integer amount: ", amountxmr);
var pendingTransaction = wallet.createTransaction(address, amountxmr);
if (pendingTransaction.status !== PendingTransaction.Status_Ok) {
console.error("Can't create transaction: ", pendingTransaction.errorString);
} else {
console.log("Transaction created, amount: " + walletManager.displayAmount(pendingTransaction.amount)
+ ", fee: " + walletManager.displayAmount(pendingTransaction.fee));
if (!pendingTransaction.commit()) {
console.log("Error committing transaction: " + pendingTransaction.errorString);
}
}
wallet.disposeTransaction(pendingTransaction);
}
visible: true
width: rightPanelExpanded ? 1269 : 1269 - 300
height: 800
@@ -423,6 +447,7 @@ ApplicationWindow {
}
property var previousPosition
onPressed: {
previousPosition = globalCursor.getPosition()
}