From 6e0b5e2be5b8bc3df2c85fbc39b7f36ee588c110 Mon Sep 17 00:00:00 2001 From: selsta Date: Sat, 28 May 2022 02:02:17 +0200 Subject: [PATCH 1/2] libwallet: add scanTransactions function --- src/libwalletqt/Wallet.cpp | 12 ++++++++++++ src/libwalletqt/Wallet.h | 3 +++ 2 files changed, 15 insertions(+) diff --git a/src/libwalletqt/Wallet.cpp b/src/libwalletqt/Wallet.cpp index eef80b9782..cec8378e6c 100644 --- a/src/libwalletqt/Wallet.cpp +++ b/src/libwalletqt/Wallet.cpp @@ -30,7 +30,9 @@ #include #include +#include #include +#include #include "PendingTransaction.h" #include "UnsignedTransaction.h" @@ -507,6 +509,16 @@ bool Wallet::importOutputs(const QString& path) { return m_walletImpl->importOutputs(path.toStdString()); } +bool Wallet::scanTransactions(const QVector &txids) +{ + std::vector c; + for (const auto &v : txids) + { + c.push_back(v.toStdString()); + } + return m_walletImpl->scanTransactions(c); +} + bool Wallet::refresh(bool historyAndSubaddresses /* = true */) { refreshingSet(true); diff --git a/src/libwalletqt/Wallet.h b/src/libwalletqt/Wallet.h index a81b455569..039417d8ce 100644 --- a/src/libwalletqt/Wallet.h +++ b/src/libwalletqt/Wallet.h @@ -212,6 +212,9 @@ class Wallet : public QObject, public PassprasePrompter Q_INVOKABLE bool exportOutputs(const QString& path, bool all = false); Q_INVOKABLE bool importOutputs(const QString& path); + //! scan transactions + Q_INVOKABLE bool scanTransactions(const QVector &txids); + //! refreshes the wallet Q_INVOKABLE bool refresh(bool historyAndSubaddresses = true); From 559106174ee2106953b5d12a65b1966e0a7776c8 Mon Sep 17 00:00:00 2001 From: selsta Date: Sat, 28 May 2022 02:49:42 +0200 Subject: [PATCH 2/2] SettingsWallet: add scan transaction option --- fonts/FontAwesome/FontAwesome.qml | 1 + pages/settings/SettingsWallet.qml | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/fonts/FontAwesome/FontAwesome.qml b/fonts/FontAwesome/FontAwesome.qml index 9c077a9ae6..f2cfbab15e 100644 --- a/fonts/FontAwesome/FontAwesome.qml +++ b/fonts/FontAwesome/FontAwesome.qml @@ -54,6 +54,7 @@ Object { property string key : "\uf084" property string language : "\uf1ab" property string lock : "\uf023" + property string magnifyingGlass : "\uf002" property string minus : "\uf068" property string minusCircle : "\uf056" property string moonO : "\uf186" diff --git a/pages/settings/SettingsWallet.qml b/pages/settings/SettingsWallet.qml index 2e5468ab3c..0c1e80eaa2 100644 --- a/pages/settings/SettingsWallet.qml +++ b/pages/settings/SettingsWallet.qml @@ -127,6 +127,27 @@ Rectangle { } } + MoneroComponents.SettingsListItem { + enabled: leftPanel.progressBar.fillLevel == 100 + iconText: FontAwesome.magnifyingGlass + description: qsTr("Use this feature if a transaction is missing in your wallet history. This will expose the transaction ID to the remote node, which can harm your privacy.") + translationManager.emptyString + title: qsTr("Scan transaction") + translationManager.emptyString + + onClicked: { + inputDialog.labelText = qsTr("Enter a transaction ID:") + translationManager.emptyString; + inputDialog.onAcceptedCallback = function() { + var txid = inputDialog.inputText.trim(); + if (currentWallet.scanTransactions([txid])) { + appWindow.showStatusMessage(qsTr("Transaction successfully scanned"), 3); + } else { + appWindow.showStatusMessage(qsTr("Failed to scan transaction") + ": " + currentWallet.errorString, 5); + } + } + inputDialog.onRejectedCallback = null; + inputDialog.open() + } + } + MoneroComponents.SettingsListItem { iconText: FontAwesome.ellipsisH description: qsTr("Change the password of your wallet.") + translationManager.emptyString