mirror of
https://github.com/monero-project/monero-gui.git
synced 2024-12-14 04:16:33 +02:00
Priority aka fee multiplier integrated
This commit is contained in:
parent
17f38a930e
commit
409c5701e2
@ -30,7 +30,7 @@ import QtQuick 2.2
|
||||
|
||||
Rectangle {
|
||||
color: "#F0EEEE"
|
||||
signal paymentClicked(string address, string paymentId, double amount, int mixinCount)
|
||||
signal paymentClicked(string address, string paymentId, double amount, int mixinCount, int priority)
|
||||
signal generatePaymentIdInvoked()
|
||||
|
||||
states: [
|
||||
@ -89,7 +89,7 @@ Rectangle {
|
||||
target: loader.item
|
||||
onPaymentClicked : {
|
||||
console.log("MiddlePanel: paymentClicked")
|
||||
paymentClicked(address, paymentId, amount, mixinCount)
|
||||
paymentClicked(address, paymentId, amount, mixinCount, priority)
|
||||
}
|
||||
}
|
||||
|
||||
|
15
main.qml
15
main.qml
@ -169,15 +169,18 @@ ApplicationWindow {
|
||||
return wallets.length > 0;
|
||||
}
|
||||
|
||||
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
|
||||
function handlePayment(address, paymentId, amount, mixinCount, priority) {
|
||||
console.log("Creating transaction: ")
|
||||
console.log("\taddress: ", address,
|
||||
", payment_id: ", paymentId,
|
||||
", amount: ", amount,
|
||||
", mixins: ", mixinCount,
|
||||
", priority: ", priority);
|
||||
|
||||
var amountxmr = walletManager.amountFromString(amount);
|
||||
|
||||
console.log("integer amount: ", amountxmr);
|
||||
var pendingTransaction = wallet.createTransaction(address, amountxmr, mixinCount);
|
||||
var pendingTransaction = wallet.createTransaction(address, paymentId, amountxmr, mixinCount, priority);
|
||||
if (pendingTransaction.status !== PendingTransaction.Status_Ok) {
|
||||
console.error("Can't create transaction: ", pendingTransaction.errorString);
|
||||
} else {
|
||||
|
@ -27,10 +27,13 @@
|
||||
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import QtQuick 2.0
|
||||
import Bitmonero.PendingTransaction 1.0
|
||||
import "../components"
|
||||
|
||||
|
||||
Rectangle {
|
||||
signal paymentClicked(string address, string paymentId, double amount, int mixinCount)
|
||||
signal paymentClicked(string address, string paymentId, double amount, int mixinCount,
|
||||
int priority)
|
||||
|
||||
color: "#F0EEEE"
|
||||
|
||||
@ -54,7 +57,7 @@ Rectangle {
|
||||
text: qsTr("Amount")
|
||||
fontSize: 14
|
||||
}
|
||||
/*
|
||||
|
||||
Label {
|
||||
id: transactionPriority
|
||||
anchors.top: parent.top
|
||||
@ -63,8 +66,6 @@ Rectangle {
|
||||
x: (parent.width - 17) / 2 + 17
|
||||
text: qsTr("Transaction prority")
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
Row {
|
||||
id: amountRow
|
||||
@ -92,11 +93,11 @@ Rectangle {
|
||||
|
||||
ListModel {
|
||||
id: priorityModel
|
||||
ListElement { column1: "LOW"; column2: "( fee: 0.0002 )" }
|
||||
ListElement { column1: "MEDIUM"; column2: "( fee: 0.0004 )" }
|
||||
ListElement { column1: "HIGH"; column2: "( fee: 0.0008 )" }
|
||||
ListElement { column1: "LOW"; column2: ""; priority: PendingTransaction.Priority_Low }
|
||||
ListElement { column1: "MEDIUM"; column2: ""; priority: PendingTransaction.Priority_Medium }
|
||||
ListElement { column1: "HIGH"; column2: ""; priority: PendingTransaction.Priority_High }
|
||||
}
|
||||
/*
|
||||
|
||||
StandardDropdown {
|
||||
id: priorityDropdown
|
||||
anchors.top: transactionPriority.bottom
|
||||
@ -111,7 +112,7 @@ Rectangle {
|
||||
dataModel: priorityModel
|
||||
z: 1
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
Label {
|
||||
@ -243,7 +244,10 @@ Rectangle {
|
||||
|
||||
if (addressLine.text.length > 0 && amountLine.text.length > 0) {
|
||||
console.log("paymentClicked")
|
||||
paymentClicked(addressLine.text, paymentIdLine.text, amountLine.text, scaleValueToMixinCount(privacyLevelItem.fillLevel))
|
||||
var priority = priorityModel.get(priorityDropdown.currentIndex).priority
|
||||
console.log("priority: " + priority)
|
||||
paymentClicked(addressLine.text, paymentIdLine.text, amountLine.text, scaleValueToMixinCount(privacyLevelItem.fillLevel),
|
||||
priority)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -23,9 +23,16 @@ public:
|
||||
Status_Ok = Bitmonero::PendingTransaction::Status_Ok,
|
||||
Status_Error = Bitmonero::PendingTransaction::Status_Error
|
||||
};
|
||||
|
||||
Q_ENUM(Status)
|
||||
|
||||
enum Priority {
|
||||
Priority_Low = Bitmonero::PendingTransaction::Priority_Low,
|
||||
Priority_Medium = Bitmonero::PendingTransaction::Priority_Medium,
|
||||
Priority_High = Bitmonero::PendingTransaction::Priority_High
|
||||
};
|
||||
Q_ENUM(Priority)
|
||||
|
||||
|
||||
Status status() const;
|
||||
QString errorString() const;
|
||||
Q_INVOKABLE bool commit();
|
||||
|
@ -89,10 +89,12 @@ bool Wallet::refresh()
|
||||
}
|
||||
|
||||
PendingTransaction *Wallet::createTransaction(const QString &dst_addr, const QString &payment_id,
|
||||
quint64 amount, quint32 mixin_count)
|
||||
quint64 amount, quint32 mixin_count,
|
||||
PendingTransaction::Priority priority)
|
||||
{
|
||||
Bitmonero::PendingTransaction * ptImpl = m_walletImpl->createTransaction(
|
||||
dst_addr.toStdString(), payment_id.toStdString(), amount, mixin_count);
|
||||
dst_addr.toStdString(), payment_id.toStdString(), amount, mixin_count,
|
||||
static_cast<Bitmonero::PendingTransaction::Priority>(priority));
|
||||
PendingTransaction * result = new PendingTransaction(ptImpl, this);
|
||||
return result;
|
||||
}
|
||||
|
@ -3,13 +3,15 @@
|
||||
|
||||
#include <QObject>
|
||||
|
||||
#include "wallet/wallet2_api.h" // we need to access Status enum here;
|
||||
#include "wallet/wallet2_api.h" // we need to have an access to the Bitmonero::Wallet::Status enum here;
|
||||
#include "PendingTransaction.h" // we need to have an access to the PendingTransaction::Priority enum here;
|
||||
|
||||
|
||||
namespace Bitmonero {
|
||||
class Wallet; // forward declaration
|
||||
}
|
||||
|
||||
class PendingTransaction;
|
||||
|
||||
class TransactionHistory;
|
||||
|
||||
class Wallet : public QObject
|
||||
@ -77,8 +79,8 @@ public:
|
||||
|
||||
//! creates transaction
|
||||
Q_INVOKABLE PendingTransaction * createTransaction(const QString &dst_addr, const QString &payment_id,
|
||||
quint64 amount, quint32 mixin_count);
|
||||
|
||||
quint64 amount, quint32 mixin_count,
|
||||
PendingTransaction::Priority priority = PendingTransaction::Priority_Low);
|
||||
//! deletes transaction and frees memory
|
||||
Q_INVOKABLE void disposeTransaction(PendingTransaction * t);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user