Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SettingsWallet: add scan transaction option #3932

Merged
merged 2 commits into from
Jul 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions fonts/FontAwesome/FontAwesome.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
21 changes: 21 additions & 0 deletions pages/settings/SettingsWallet.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 12 additions & 0 deletions src/libwalletqt/Wallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@

#include <chrono>
#include <stdexcept>
#include <string>
#include <thread>
#include <vector>

#include "PendingTransaction.h"
#include "UnsignedTransaction.h"
Expand Down Expand Up @@ -507,6 +509,16 @@ bool Wallet::importOutputs(const QString& path) {
return m_walletImpl->importOutputs(path.toStdString());
}

bool Wallet::scanTransactions(const QVector<QString> &txids)
{
std::vector<std::string> c;
for (const auto &v : txids)
{
c.push_back(v.toStdString());
}
return m_walletImpl->scanTransactions(c);
}

bool Wallet::refresh(bool historyAndSubaddresses /* = true */)
{
refreshingSet(true);
Expand Down
3 changes: 3 additions & 0 deletions src/libwalletqt/Wallet.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<QString> &txids);

//! refreshes the wallet
Q_INVOKABLE bool refresh(bool historyAndSubaddresses = true);

Expand Down