mixin count for Wallet::createTransaction

This commit is contained in:
Ilya Kitaev 2016-06-20 23:36:56 +03:00
parent e3985da4e1
commit 2696e49a54
5 changed files with 23 additions and 10 deletions

View file

@ -30,7 +30,7 @@ import QtQuick 2.2
Rectangle {
color: "#F0EEEE"
signal paymentClicked(string address, string paymentId, double amount, double fee, int privacyLevel)
signal paymentClicked(string address, string paymentId, double amount, int mixinCount)
states: [
State {
@ -84,7 +84,7 @@ Rectangle {
target: loader.item
onPaymentClicked : {
console.log("MiddlePanel: paymentClicked")
paymentClicked(address, paymentId, amount, fee, privacyLevel)
paymentClicked(address, paymentId, amount, mixinCount)
}
}

View file

@ -169,15 +169,15 @@ ApplicationWindow {
return wallets.length > 0;
}
function handlePayment(address, paymentId, amount, fee, privacyLevel) {
console.log("Process payment here: ", address, paymentId, amount, fee, privacyLevel)
function handlePayment(address, paymentId, amount, mixinCount) {
console.log("Process payment here: ", address, paymentId, amount, mixinCount)
// 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);
var pendingTransaction = wallet.createTransaction(address, amountxmr, mixinCount);
if (pendingTransaction.status !== PendingTransaction.Status_Ok) {
console.error("Can't create transaction: ", pendingTransaction.errorString);
} else {

View file

@ -30,10 +30,19 @@ import QtQuick 2.0
import "../components"
Rectangle {
signal paymentClicked(string address, string paymentId, double amount, double fee, int privacyLevel)
signal paymentClicked(string address, string paymentId, double amount, int mixinCount)
color: "#F0EEEE"
function scaleValueToMixinCount(scaleValue) {
var scaleToMixinCount = [2,3,4,5,5,5,6,7,8,9,10,15,20,25];
if (scaleValue < scaleToMixinCount.length) {
return scaleToMixinCount[scaleValue];
} else {
return 0;
}
}
Label {
id: amountLabel
@ -125,6 +134,10 @@ Rectangle {
anchors.leftMargin: 17
anchors.rightMargin: 17
anchors.topMargin: 5
onFillLevelChanged: {
print ("PrivacyLevel changed:" + fillLevel)
print ("mixin count:" + scaleValueToMixinCount(fillLevel))
}
}
@ -230,7 +243,7 @@ Rectangle {
if (addressLine.text.length > 0 && amountLine.text.length > 0) {
console.log("paymentClicked")
paymentClicked(addressLine.text, paymentIdLine.text, amountLine.text, 0.0002, 1)
paymentClicked(addressLine.text, paymentIdLine.text, amountLine.text, scaleValueToMixinCount(privacyLevelItem.fillLevel))
}
}
}

View file

@ -88,10 +88,10 @@ bool Wallet::refresh()
return result;
}
PendingTransaction *Wallet::createTransaction(const QString &dst_addr, quint64 amount)
PendingTransaction *Wallet::createTransaction(const QString &dst_addr, quint64 amount, quint32 mixin_count)
{
Bitmonero::PendingTransaction * ptImpl = m_walletImpl->createTransaction(
dst_addr.toStdString(), amount);
dst_addr.toStdString(), amount, mixin_count);
PendingTransaction * result = new PendingTransaction(ptImpl, this);
return result;
}

View file

@ -76,7 +76,7 @@ public:
//! creates transaction
Q_INVOKABLE PendingTransaction * createTransaction(const QString &dst_addr,
quint64 amount);
quint64 amount, quint32 mixin_count);
//! deletes transaction and frees memory
Q_INVOKABLE void disposeTransaction(PendingTransaction * t);