From f53af12e026263e212c7c1e3fb21bd25f5234046 Mon Sep 17 00:00:00 2001 From: selsta Date: Tue, 13 Apr 2021 07:27:05 +0200 Subject: [PATCH] Wallet: fix transfer with Qt 5.12 --- main.qml | 2 +- src/libwalletqt/Wallet.cpp | 14 +++++++++----- src/libwalletqt/Wallet.h | 4 ++-- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/main.qml b/main.qml index c5829db8..6701d7e2 100644 --- a/main.qml +++ b/main.qml @@ -885,7 +885,7 @@ ApplicationWindow { return recipient.address; }); const amountsxmr = recipients.map(function (recipient) { - return walletManager.amountFromString(recipient.amount); + return recipient.amount; }); currentWallet.createTransactionAsync(addresses, paymentId, amountsxmr, mixinCount, priority); } diff --git a/src/libwalletqt/Wallet.cpp b/src/libwalletqt/Wallet.cpp index e9700143..2c9e26d7 100644 --- a/src/libwalletqt/Wallet.cpp +++ b/src/libwalletqt/Wallet.cpp @@ -535,7 +535,7 @@ void Wallet::pauseRefresh() PendingTransaction *Wallet::createTransaction( const QVector &destinationAddresses, const QString &payment_id, - const QVector &amounts, + const QVector &destinationAmounts, quint32 mixin_count, PendingTransaction::Priority priority) { @@ -543,11 +543,15 @@ PendingTransaction *Wallet::createTransaction( for (const auto &address : destinationAddresses) { destinations.push_back(address.toStdString()); } + std::vector amounts; + for (const auto &amount : destinationAmounts) { + amounts.push_back(Monero::Wallet::amountFromString(amount.toStdString())); + } std::set subaddr_indices; Monero::PendingTransaction *ptImpl = m_walletImpl->createTransactionMultDest( destinations, payment_id.toStdString(), - std::vector(amounts.begin(), amounts.end()), + amounts, mixin_count, static_cast(priority), currentSubaddressAccount(), @@ -559,12 +563,12 @@ PendingTransaction *Wallet::createTransaction( void Wallet::createTransactionAsync( const QVector &destinationAddresses, const QString &payment_id, - const QVector &amounts, + const QVector &destinationAmounts, quint32 mixin_count, PendingTransaction::Priority priority) { - m_scheduler.run([this, destinationAddresses, payment_id, amounts, mixin_count, priority] { - PendingTransaction *tx = createTransaction(destinationAddresses, payment_id, amounts, mixin_count, priority); + m_scheduler.run([this, destinationAddresses, payment_id, destinationAmounts, mixin_count, priority] { + PendingTransaction *tx = createTransaction(destinationAddresses, payment_id, destinationAmounts, mixin_count, priority); emit transactionCreated(tx, destinationAddresses, payment_id, mixin_count); }); } diff --git a/src/libwalletqt/Wallet.h b/src/libwalletqt/Wallet.h index 237ef853..319b2a14 100644 --- a/src/libwalletqt/Wallet.h +++ b/src/libwalletqt/Wallet.h @@ -220,7 +220,7 @@ public: Q_INVOKABLE void createTransactionAsync( const QVector &destinationAddresses, const QString &payment_id, - const QVector &amounts, + const QVector &destinationAmounts, quint32 mixin_count, PendingTransaction::Priority priority); @@ -421,7 +421,7 @@ private: PendingTransaction *createTransaction( const QVector &destinationAddresses, const QString &payment_id, - const QVector &amounts, + const QVector &destinationAmounts, quint32 mixin_count, PendingTransaction::Priority priority);