]> Nutra Git (v2) - gamesguru/feather.git/commitdiff
build: remove needless wallet2.h includes
authortobtoht <tob@featherwallet.org>
Fri, 5 Jan 2024 01:21:51 +0000 (02:21 +0100)
committertobtoht <tob@featherwallet.org>
Fri, 5 Jan 2024 01:24:14 +0000 (02:24 +0100)
14 files changed:
monero
src/libwalletqt/AddressBook.cpp
src/libwalletqt/AddressBook.h
src/libwalletqt/PassphraseHelper.h
src/libwalletqt/PendingTransactionInfo.h
src/libwalletqt/Subaddress.h
src/libwalletqt/TransactionHistory.cpp
src/libwalletqt/TransactionHistory.h
src/libwalletqt/UnsignedTransaction.h
src/libwalletqt/Wallet.cpp
src/libwalletqt/Wallet.h
src/libwalletqt/WalletManager.cpp
src/libwalletqt/WalletManager.h
src/libwalletqt/rows/CoinsInfo.h

diff --git a/monero b/monero
index 34aacb1b49553f17b9bb7ca1ee6dfb6524aada55..fedd2d2238c88a221b547b9fe2738dc0c18c5195 160000 (submodule)
--- a/monero
+++ b/monero
@@ -1 +1 @@
-Subproject commit 34aacb1b49553f17b9bb7ca1ee6dfb6524aada55
+Subproject commit fedd2d2238c88a221b547b9fe2738dc0c18c5195
index 3ab84ef00262b6a90733f5e2e4892ce055ea4f02..15fd6e287f3b3b5ba770a7a5bc637418315bdb16 100644 (file)
@@ -2,7 +2,7 @@
 // SPDX-FileCopyrightText: 2020-2024 The Monero Project
 
 #include "AddressBook.h"
-#include <QDebug>
+
 #include <wallet/wallet2.h>
 
 AddressBook::AddressBook(Wallet *wallet, tools::wallet2 *wallet2, QObject *parent)
index 22c947d3b028c78996060adeb82804f8b69a9bd3..a4ee0e4313364bf2fd1d2fc1ee42e0bc5357dbdf 100644 (file)
@@ -4,7 +4,6 @@
 #ifndef ADDRESSBOOK_H
 #define ADDRESSBOOK_H
 
-#include <wallet/api/wallet2_api.h>
 #include <QMap>
 #include <QObject>
 #include <QReadWriteLock>
index c6781354299cad68a528454e4a5ff4d9484af236..745ce50738a144dc4dd1f46b8d1ec1fe0b6ffd49 100644 (file)
@@ -4,7 +4,6 @@
 #ifndef MONERO_GUI_PASSPHRASEHELPER_H
 #define MONERO_GUI_PASSPHRASEHELPER_H
 
-#include <QtGlobal>
 #include <wallet/api/wallet2_api.h>
 #include <QMutex>
 #include <QPointer>
index 7d00d1f5deb86124188a8eadbb5de5d2c053511e..48135e39264e442dbf445b2b20273491fe22a43c 100644 (file)
@@ -4,7 +4,6 @@
 #ifndef FEATHER_PENDINGTRANSACTIONINFO_H
 #define FEATHER_PENDINGTRANSACTIONINFO_H
 
-#include <wallet/api/wallet2_api.h>
 #include "ConstructionInfo.h"
 #include <QObject>
 #include <QSet>
index be799d97d0531848041dc1e44d95b959832a46fc..7007baa9ab5f5e76929de63a10bc3688f3697752 100644 (file)
@@ -6,7 +6,6 @@
 
 #include <functional>
 
-#include <wallet/api/wallet2_api.h>
 #include <QReadWriteLock>
 #include <QObject>
 #include <QList>
index aaa543acf46aa7c996f89d8ddb45b0beacd84798..1714c7251a2b1885c01cb66c8749638f69b9fa6b 100644 (file)
 #include "Ring.h"
 #include "wallet/wallet2.h"
 
+QString description(tools::wallet2 *wallet2, const tools::wallet2::payment_details &pd)
+{
+    QString description = QString::fromStdString(wallet2->get_tx_note(pd.m_tx_hash));
+    if (description.isEmpty()) {
+        if (pd.m_coinbase) {
+            description = "Coinbase";
+        }
+        else if (pd.m_subaddr_index.major == 0 && pd.m_subaddr_index.minor == 0) {
+            description = "Primary address";
+        }
+        else {
+            description = QString::fromStdString(wallet2->get_subaddress_label(pd.m_subaddr_index));
+        }
+    }
+    return description;
+}
+
 bool TransactionHistory::transaction(int index, std::function<void (TransactionRow &)> callback)
 {
     QReadLocker locker(&m_lock);
@@ -103,7 +120,7 @@ void TransactionHistory::refresh()
             t->m_timestamp = QDateTime::fromSecsSinceEpoch(pd.m_timestamp);
             t->m_confirmations = (wallet_height > pd.m_block_height) ? wallet_height - pd.m_block_height : 0;
             t->m_unlockTime = pd.m_unlock_time;
-            t->m_description = description(pd);
+            t->m_description = description(m_wallet2, pd);
 
             m_rows.append(t);
         }
@@ -250,7 +267,7 @@ void TransactionHistory::refresh()
             t->m_label = QString::fromStdString(m_wallet2->get_subaddress_label(pd.m_subaddr_index));
             t->m_timestamp = QDateTime::fromSecsSinceEpoch(pd.m_timestamp);
             t->m_confirmations = 0;
-            t->m_description = description(pd);
+            t->m_description = description(m_wallet2, pd);
 
             m_rows.append(t);
 
@@ -384,21 +401,4 @@ bool TransactionHistory::writeCSV(const QString &path) {
 
     data = QString("blockHeight,timestamp,date,accountIndex,direction,balanceDelta,amount,fee,txid,description,paymentId,fiatAmount,fiatCurrency%1").arg(data);
     return Utils::fileWrite(path, data);
-}
-
-QString TransactionHistory::description(const tools::wallet2::payment_details &pd)
-{
-    QString description = QString::fromStdString(m_wallet2->get_tx_note(pd.m_tx_hash));
-    if (description.isEmpty()) {
-        if (pd.m_coinbase) {
-            description = "Coinbase";
-        }
-        else if (pd.m_subaddr_index.major == 0 && pd.m_subaddr_index.minor == 0) {
-            description = "Primary address";
-        }
-        else {
-            description = QString::fromStdString(m_wallet2->get_subaddress_label(pd.m_subaddr_index));
-        }
-    }
-    return description;
 }
\ No newline at end of file
index 24e60c6f013e317e6e33087d044143eca6c79242..ce10b8e7dd7452d21edbcc9889e5b4c1b1e651ce 100644 (file)
@@ -51,7 +51,6 @@ signals:
 
 private:
     explicit TransactionHistory(Wallet *wallet, tools::wallet2 *wallet2, QObject *parent = nullptr);
-    QString description(const tools::wallet2::payment_details &pd);
 
 private:
     friend class Wallet;
index 63df75768d8bf7e547884a02607acd6258ffe65b..33e872376978854b186e171f06c20313e5a3baba 100644 (file)
@@ -6,7 +6,6 @@
 
 #include <QObject>
 
-#include <wallet/api/wallet2_api.h>
 #include "libwalletqt/PendingTransactionInfo.h"
 
 class UnsignedTransaction : public QObject
index c04701e5a6bbba6a1ca728fd997194a3cb886651..1b485e15209af87f0ed63fe6c0a6154a6997c1bb 100644 (file)
@@ -25,6 +25,8 @@
 
 #include "utils/ScopeGuard.h"
 
+#include "wallet/wallet2.h"
+
 namespace {
     constexpr char ATTRIBUTE_SUBADDRESS_ACCOUNT[] = "feather.subaddress_account";
 }
index d53dc721044ff881dcdadae4c1ec8d60a3951a1e..df74afb2adc2e2b3ef2e7235f7864eff6e22a812 100644 (file)
@@ -10,7 +10,6 @@
 #include <QList>
 #include <QtConcurrent/QtConcurrent>
 
-#include "wallet/api/wallet2_api.h"
 #include "utils/scheduler.h"
 #include "PendingTransaction.h"
 #include "UnsignedTransaction.h"
index 5f234432d215134bab2ff3feff01e970681148a4..c34fea451307816b0296f7e94bdf049ee8b413b7 100644 (file)
@@ -5,7 +5,6 @@
 #include "Wallet.h"
 
 #include "utils/ScopeGuard.h"
-#include "serialization/binary_utils.h"
 
 class WalletPassphraseListenerImpl : public Monero::WalletListener, public PassphraseReceiver
 {
@@ -329,45 +328,3 @@ void WalletManager::onPassphraseEntered(const QString &passphrase, bool enter_on
         m_passphraseReceiver->onPassphraseEntered(passphrase, enter_on_device, entry_abort);
     }
 }
-
-std::string WalletManager::encryptWithPassword(const QString &q_plain, const QString &q_password) {
-    std::string plain = q_plain.toStdString();
-    std::string password = q_password.toStdString();
-
-    crypto::chacha_key key;
-    crypto::generate_chacha_key(password.data(), password.size(), key, 1);
-
-    std::string cipher;
-    cipher.resize(plain.size());
-
-    // Repurposing this struct
-    tools::wallet2::keys_file_data s_data = {};
-    s_data.iv = crypto::rand<crypto::chacha_iv>();
-
-    crypto::chacha20(plain.data(), plain.size(), key, s_data.iv, &cipher[0]);
-    s_data.account_data = cipher;
-
-    std::string buf;
-    ::serialization::dump_binary(s_data, buf);
-
-    return buf;
-}
-
-QString WalletManager::decryptWithPassword(const std::string &cipher, const QString &q_password) {
-    std::string password = q_password.toStdString();
-
-    tools::wallet2::keys_file_data s_data;
-    bool r = ::serialization::parse_binary(cipher, s_data);
-    if (!r) {
-        return {};
-    }
-
-    crypto::chacha_key key;
-    crypto::generate_chacha_key(password.data(), password.size(), key, 1);
-
-    std::string plaintext;
-    plaintext.resize(s_data.account_data.size());
-    crypto::chacha20(s_data.account_data.data(), s_data.account_data.size(), key, s_data.iv, &plaintext[0]);
-
-    return QString::fromStdString(plaintext);
-}
\ No newline at end of file
index 74b3bb80883cc6a7123140ed0dc7cbcabcb32e14..596a03f09f4a97d6e142c5d8a1f94ed6ee713a48 100644 (file)
@@ -117,9 +117,6 @@ public:
     void onPassphraseEntered(const QString &passphrase, bool enter_on_device, bool entry_abort=false);
     virtual void onWalletPassphraseNeeded(bool on_device) override;
 
-    static std::string encryptWithPassword(const QString &plain, const QString &password);
-    static QString decryptWithPassword(const std::string &cipher, const QString &password);
-
 signals:
     void walletOpened(Wallet *wallet);
     void walletCreated(Wallet *wallet);
index 68b06ce9402d8152223086a5d87763beaa395d16..9cee507060a628429528e1d5e4b8a2d7413c4b9b 100644 (file)
@@ -4,7 +4,6 @@
 #ifndef FEATHER_COINSINFO_H
 #define FEATHER_COINSINFO_H
 
-#include <wallet/api/wallet2_api.h>
 #include <QObject>
 #include <QDateTime>
 #include <QSet>