mirror of
https://github.com/monero-project/monero-gui.git
synced 2025-01-09 19:32:03 +02:00
Merge pull request #3327
b20b956
Wallet: estimateTransactionFeeAsync - multi dest support (xiphon)
This commit is contained in:
commit
8b8948954d
@ -361,8 +361,8 @@ Rectangle {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
currentWallet.estimateTransactionFeeAsync(
|
currentWallet.estimateTransactionFeeAsync(
|
||||||
addressLine.text,
|
[addressLine.text],
|
||||||
walletManager.amountFromString(amountLine.text),
|
[walletManager.amountFromString(amountLine.text)],
|
||||||
priorityModelV5.get(priorityDropdown.currentIndex).priority,
|
priorityModelV5.get(priorityDropdown.currentIndex).priority,
|
||||||
function (amount) {
|
function (amount) {
|
||||||
estimatedFee = Utils.removeTrailingZeros(amount);
|
estimatedFee = Utils.removeTrailingZeros(amount);
|
||||||
|
@ -641,17 +641,32 @@ void Wallet::disposeTransaction(UnsignedTransaction *t)
|
|||||||
delete t;
|
delete t;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Wallet::estimateTransactionFeeAsync(const QString &destination,
|
void Wallet::estimateTransactionFeeAsync(
|
||||||
quint64 amount,
|
const QVector<QString> &destinationAddresses,
|
||||||
PendingTransaction::Priority priority,
|
const QVector<quint64> &amounts,
|
||||||
const QJSValue &callback)
|
PendingTransaction::Priority priority,
|
||||||
|
const QJSValue &callback)
|
||||||
{
|
{
|
||||||
m_scheduler.run([this, destination, amount, priority] {
|
m_scheduler.run(
|
||||||
const uint64_t fee = m_walletImpl->estimateTransactionFee(
|
[this, destinationAddresses, amounts, priority] {
|
||||||
{std::make_pair(destination.toStdString(), amount)},
|
if (destinationAddresses.size() != amounts.size())
|
||||||
static_cast<Monero::PendingTransaction::Priority>(priority));
|
{
|
||||||
return QJSValueList({QString::fromStdString(Monero::Wallet::displayAmount(fee))});
|
return QJSValueList({""});
|
||||||
}, callback);
|
}
|
||||||
|
|
||||||
|
std::vector<std::pair<std::string, uint64_t>> destinations;
|
||||||
|
destinations.reserve(destinationAddresses.size());
|
||||||
|
for (size_t index = 0; index < destinationAddresses.size(); ++index)
|
||||||
|
{
|
||||||
|
destinations.emplace_back(std::make_pair(destinationAddresses[index].toStdString(), amounts[index]));
|
||||||
|
}
|
||||||
|
|
||||||
|
const uint64_t fee = m_walletImpl->estimateTransactionFee(
|
||||||
|
destinations,
|
||||||
|
static_cast<Monero::PendingTransaction::Priority>(priority));
|
||||||
|
return QJSValueList({QString::fromStdString(Monero::Wallet::displayAmount(fee))});
|
||||||
|
},
|
||||||
|
callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
TransactionHistory *Wallet::history() const
|
TransactionHistory *Wallet::history() const
|
||||||
|
@ -253,10 +253,11 @@ public:
|
|||||||
//! deletes unsigned transaction and frees memory
|
//! deletes unsigned transaction and frees memory
|
||||||
Q_INVOKABLE void disposeTransaction(UnsignedTransaction * t);
|
Q_INVOKABLE void disposeTransaction(UnsignedTransaction * t);
|
||||||
|
|
||||||
Q_INVOKABLE void estimateTransactionFeeAsync(const QString &destination,
|
Q_INVOKABLE void estimateTransactionFeeAsync(
|
||||||
quint64 amount,
|
const QVector<QString> &destinationAddresses,
|
||||||
PendingTransaction::Priority priority,
|
const QVector<quint64> &amounts,
|
||||||
const QJSValue &callback);
|
PendingTransaction::Priority priority,
|
||||||
|
const QJSValue &callback);
|
||||||
|
|
||||||
//! returns transaction history
|
//! returns transaction history
|
||||||
TransactionHistory * history() const;
|
TransactionHistory * history() const;
|
||||||
|
Loading…
Reference in New Issue
Block a user