aboutsummaryrefslogtreecommitdiff
path: root/src/libwalletqt/Wallet.cpp
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2016-11-13 11:33:32 +0200
committerRiccardo Spagni <ric@spagni.net>2016-11-13 11:33:32 +0200
commit2fed96d0486f97f5765117cb8b08e0a2b138e82c (patch)
treea9a14b239a5e5b04a7478dd791853eb69df0bafd /src/libwalletqt/Wallet.cpp
parentb8ea2ffc745edaa250f2da5b65b121469d5045df (diff)
parent111248f410da5133bb6c8051b674536fb4ca121f (diff)
downloadmonzero-gui-2fed96d0486f97f5765117cb8b08e0a2b138e82c.tar.gz
monzero-gui-2fed96d0486f97f5765117cb8b08e0a2b138e82c.tar.xz
monzero-gui-2fed96d0486f97f5765117cb8b08e0a2b138e82c.zip
Merge pull request #135
111248f Make the new sweep functions use async transactions (moneromooo.monero) c779b37 Support for sweeping all outputs (moneromooo.monero) 2143392 Add a button to sweep unmixable outputs (moneromooo.monero)
Diffstat (limited to 'src/libwalletqt/Wallet.cpp')
-rw-r--r--src/libwalletqt/Wallet.cpp45
1 files changed, 44 insertions, 1 deletions
diff --git a/src/libwalletqt/Wallet.cpp b/src/libwalletqt/Wallet.cpp
index 78cb6949..5f3cd5f3 100644
--- a/src/libwalletqt/Wallet.cpp
+++ b/src/libwalletqt/Wallet.cpp
@@ -216,7 +216,6 @@ PendingTransaction *Wallet::createTransaction(const QString &dst_addr, const QSt
return result;
}
-
void Wallet::createTransactionAsync(const QString &dst_addr, const QString &payment_id,
quint64 amount, quint32 mixin_count,
PendingTransaction::Priority priority)
@@ -233,7 +232,51 @@ void Wallet::createTransactionAsync(const QString &dst_addr, const QString &paym
});
}
+PendingTransaction *Wallet::createTransactionAll(const QString &dst_addr, const QString &payment_id,
+ quint32 mixin_count, PendingTransaction::Priority priority)
+{
+ Bitmonero::PendingTransaction * ptImpl = m_walletImpl->createTransaction(
+ dst_addr.toStdString(), payment_id.toStdString(), Bitmonero::optional<uint64_t>(), mixin_count,
+ static_cast<Bitmonero::PendingTransaction::Priority>(priority));
+ PendingTransaction * result = new PendingTransaction(ptImpl, this);
+ return result;
+}
+
+void Wallet::createTransactionAllAsync(const QString &dst_addr, const QString &payment_id,
+ quint32 mixin_count,
+ PendingTransaction::Priority priority)
+{
+ QFuture<PendingTransaction*> future = QtConcurrent::run(this, &Wallet::createTransactionAll,
+ dst_addr, payment_id, mixin_count, priority);
+ QFutureWatcher<PendingTransaction*> * watcher = new QFutureWatcher<PendingTransaction*>();
+ watcher->setFuture(future);
+ connect(watcher, &QFutureWatcher<PendingTransaction*>::finished,
+ this, [this, watcher,dst_addr,payment_id,mixin_count]() {
+ QFuture<PendingTransaction*> future = watcher->future();
+ watcher->deleteLater();
+ emit transactionCreated(future.result(),dst_addr,payment_id,mixin_count);
+ });
+}
+
+PendingTransaction *Wallet::createSweepUnmixableTransaction()
+{
+ Bitmonero::PendingTransaction * ptImpl = m_walletImpl->createSweepUnmixableTransaction();
+ PendingTransaction * result = new PendingTransaction(ptImpl, this);
+ return result;
+}
+void Wallet::createSweepUnmixableTransactionAsync()
+{
+ QFuture<PendingTransaction*> future = QtConcurrent::run(this, &Wallet::createSweepUnmixableTransaction);
+ QFutureWatcher<PendingTransaction*> * watcher = new QFutureWatcher<PendingTransaction*>();
+ watcher->setFuture(future);
+ connect(watcher, &QFutureWatcher<PendingTransaction*>::finished,
+ this, [this, watcher]() {
+ QFuture<PendingTransaction*> future = watcher->future();
+ watcher->deleteLater();
+ emit transactionCreated(future.result(),"","",0);
+ });
+}
void Wallet::disposeTransaction(PendingTransaction *t)
{