mirror of
https://github.com/monero-project/monero-gui.git
synced 2024-12-23 12:09:57 +00:00
mixin count for Wallet::createTransaction
This commit is contained in:
parent
e3985da4e1
commit
2696e49a54
5 changed files with 23 additions and 10 deletions
|
@ -30,7 +30,7 @@ import QtQuick 2.2
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
color: "#F0EEEE"
|
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: [
|
states: [
|
||||||
State {
|
State {
|
||||||
|
@ -84,7 +84,7 @@ Rectangle {
|
||||||
target: loader.item
|
target: loader.item
|
||||||
onPaymentClicked : {
|
onPaymentClicked : {
|
||||||
console.log("MiddlePanel: paymentClicked")
|
console.log("MiddlePanel: paymentClicked")
|
||||||
paymentClicked(address, paymentId, amount, fee, privacyLevel)
|
paymentClicked(address, paymentId, amount, mixinCount)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
6
main.qml
6
main.qml
|
@ -169,15 +169,15 @@ ApplicationWindow {
|
||||||
return wallets.length > 0;
|
return wallets.length > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
function handlePayment(address, paymentId, amount, fee, privacyLevel) {
|
function handlePayment(address, paymentId, amount, mixinCount) {
|
||||||
console.log("Process payment here: ", address, paymentId, amount, fee, privacyLevel)
|
console.log("Process payment here: ", address, paymentId, amount, mixinCount)
|
||||||
// TODO: handle payment id
|
// TODO: handle payment id
|
||||||
// TODO: handle fee;
|
// TODO: handle fee;
|
||||||
// TODO: handle mixins
|
// TODO: handle mixins
|
||||||
var amountxmr = walletManager.amountFromString(amount);
|
var amountxmr = walletManager.amountFromString(amount);
|
||||||
|
|
||||||
console.log("integer amount: ", amountxmr);
|
console.log("integer amount: ", amountxmr);
|
||||||
var pendingTransaction = wallet.createTransaction(address, amountxmr);
|
var pendingTransaction = wallet.createTransaction(address, amountxmr, mixinCount);
|
||||||
if (pendingTransaction.status !== PendingTransaction.Status_Ok) {
|
if (pendingTransaction.status !== PendingTransaction.Status_Ok) {
|
||||||
console.error("Can't create transaction: ", pendingTransaction.errorString);
|
console.error("Can't create transaction: ", pendingTransaction.errorString);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -30,10 +30,19 @@ import QtQuick 2.0
|
||||||
import "../components"
|
import "../components"
|
||||||
|
|
||||||
Rectangle {
|
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"
|
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 {
|
Label {
|
||||||
id: amountLabel
|
id: amountLabel
|
||||||
|
@ -125,6 +134,10 @@ Rectangle {
|
||||||
anchors.leftMargin: 17
|
anchors.leftMargin: 17
|
||||||
anchors.rightMargin: 17
|
anchors.rightMargin: 17
|
||||||
anchors.topMargin: 5
|
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) {
|
if (addressLine.text.length > 0 && amountLine.text.length > 0) {
|
||||||
console.log("paymentClicked")
|
console.log("paymentClicked")
|
||||||
paymentClicked(addressLine.text, paymentIdLine.text, amountLine.text, 0.0002, 1)
|
paymentClicked(addressLine.text, paymentIdLine.text, amountLine.text, scaleValueToMixinCount(privacyLevelItem.fillLevel))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,10 +88,10 @@ bool Wallet::refresh()
|
||||||
return result;
|
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(
|
Bitmonero::PendingTransaction * ptImpl = m_walletImpl->createTransaction(
|
||||||
dst_addr.toStdString(), amount);
|
dst_addr.toStdString(), amount, mixin_count);
|
||||||
PendingTransaction * result = new PendingTransaction(ptImpl, this);
|
PendingTransaction * result = new PendingTransaction(ptImpl, this);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,7 +76,7 @@ public:
|
||||||
|
|
||||||
//! creates transaction
|
//! creates transaction
|
||||||
Q_INVOKABLE PendingTransaction * createTransaction(const QString &dst_addr,
|
Q_INVOKABLE PendingTransaction * createTransaction(const QString &dst_addr,
|
||||||
quint64 amount);
|
quint64 amount, quint32 mixin_count);
|
||||||
|
|
||||||
//! deletes transaction and frees memory
|
//! deletes transaction and frees memory
|
||||||
Q_INVOKABLE void disposeTransaction(PendingTransaction * t);
|
Q_INVOKABLE void disposeTransaction(PendingTransaction * t);
|
||||||
|
|
Loading…
Reference in a new issue