mirror of
https://github.com/monero-project/monero-gui.git
synced 2024-11-17 00:07:51 +00:00
Wallet: estimateTransactionFeeAsync - multi dest support
This commit is contained in:
parent
c1573c2c2a
commit
b20b956e15
3 changed files with 32 additions and 16 deletions
|
@ -361,8 +361,8 @@ Rectangle {
|
|||
return;
|
||||
}
|
||||
currentWallet.estimateTransactionFeeAsync(
|
||||
addressLine.text,
|
||||
walletManager.amountFromString(amountLine.text),
|
||||
[addressLine.text],
|
||||
[walletManager.amountFromString(amountLine.text)],
|
||||
priorityModelV5.get(priorityDropdown.currentIndex).priority,
|
||||
function (amount) {
|
||||
estimatedFee = Utils.removeTrailingZeros(amount);
|
||||
|
|
|
@ -626,17 +626,32 @@ void Wallet::disposeTransaction(UnsignedTransaction *t)
|
|||
delete t;
|
||||
}
|
||||
|
||||
void Wallet::estimateTransactionFeeAsync(const QString &destination,
|
||||
quint64 amount,
|
||||
void Wallet::estimateTransactionFeeAsync(
|
||||
const QVector<QString> &destinationAddresses,
|
||||
const QVector<quint64> &amounts,
|
||||
PendingTransaction::Priority priority,
|
||||
const QJSValue &callback)
|
||||
{
|
||||
m_scheduler.run([this, destination, amount, priority] {
|
||||
m_scheduler.run(
|
||||
[this, destinationAddresses, amounts, priority] {
|
||||
if (destinationAddresses.size() != amounts.size())
|
||||
{
|
||||
return QJSValueList({""});
|
||||
}
|
||||
|
||||
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(
|
||||
{std::make_pair(destination.toStdString(), amount)},
|
||||
destinations,
|
||||
static_cast<Monero::PendingTransaction::Priority>(priority));
|
||||
return QJSValueList({QString::fromStdString(Monero::Wallet::displayAmount(fee))});
|
||||
}, callback);
|
||||
},
|
||||
callback);
|
||||
}
|
||||
|
||||
TransactionHistory *Wallet::history() const
|
||||
|
|
|
@ -255,8 +255,9 @@ public:
|
|||
//! deletes unsigned transaction and frees memory
|
||||
Q_INVOKABLE void disposeTransaction(UnsignedTransaction * t);
|
||||
|
||||
Q_INVOKABLE void estimateTransactionFeeAsync(const QString &destination,
|
||||
quint64 amount,
|
||||
Q_INVOKABLE void estimateTransactionFeeAsync(
|
||||
const QVector<QString> &destinationAddresses,
|
||||
const QVector<quint64> &amounts,
|
||||
PendingTransaction::Priority priority,
|
||||
const QJSValue &callback);
|
||||
|
||||
|
|
Loading…
Reference in a new issue