-Subproject commit 34aacb1b49553f17b9bb7ca1ee6dfb6524aada55
+Subproject commit fedd2d2238c88a221b547b9fe2738dc0c18c5195
// 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)
#ifndef ADDRESSBOOK_H
#define ADDRESSBOOK_H
-#include <wallet/api/wallet2_api.h>
#include <QMap>
#include <QObject>
#include <QReadWriteLock>
#ifndef MONERO_GUI_PASSPHRASEHELPER_H
#define MONERO_GUI_PASSPHRASEHELPER_H
-#include <QtGlobal>
#include <wallet/api/wallet2_api.h>
#include <QMutex>
#include <QPointer>
#ifndef FEATHER_PENDINGTRANSACTIONINFO_H
#define FEATHER_PENDINGTRANSACTIONINFO_H
-#include <wallet/api/wallet2_api.h>
#include "ConstructionInfo.h"
#include <QObject>
#include <QSet>
#include <functional>
-#include <wallet/api/wallet2_api.h>
#include <QReadWriteLock>
#include <QObject>
#include <QList>
#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);
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);
}
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);
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
private:
explicit TransactionHistory(Wallet *wallet, tools::wallet2 *wallet2, QObject *parent = nullptr);
- QString description(const tools::wallet2::payment_details &pd);
private:
friend class Wallet;
#include <QObject>
-#include <wallet/api/wallet2_api.h>
#include "libwalletqt/PendingTransactionInfo.h"
class UnsignedTransaction : public QObject
#include "utils/ScopeGuard.h"
+#include "wallet/wallet2.h"
+
namespace {
constexpr char ATTRIBUTE_SUBADDRESS_ACCOUNT[] = "feather.subaddress_account";
}
#include <QList>
#include <QtConcurrent/QtConcurrent>
-#include "wallet/api/wallet2_api.h"
#include "utils/scheduler.h"
#include "PendingTransaction.h"
#include "UnsignedTransaction.h"
#include "Wallet.h"
#include "utils/ScopeGuard.h"
-#include "serialization/binary_utils.h"
class WalletPassphraseListenerImpl : public Monero::WalletListener, public PassphraseReceiver
{
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
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);
#ifndef FEATHER_COINSINFO_H
#define FEATHER_COINSINFO_H
-#include <wallet/api/wallet2_api.h>
#include <QObject>
#include <QDateTime>
#include <QSet>