2026-04-17 00:37:17 +02:00
|
|
|
#ifndef LEZ_WALLET_BACKEND_H
|
|
|
|
|
#define LEZ_WALLET_BACKEND_H
|
2026-02-20 14:20:39 +01:00
|
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
|
#include <QString>
|
2026-04-17 00:37:17 +02:00
|
|
|
|
|
|
|
|
#include "rep_LEZWalletBackend_source.h"
|
|
|
|
|
|
2026-02-22 02:03:13 +05:30
|
|
|
#include "LEZAccountFilterModel.h"
|
|
|
|
|
#include "LEZWalletAccountModel.h"
|
2026-02-20 14:20:39 +01:00
|
|
|
|
2026-04-17 00:37:17 +02:00
|
|
|
class LogosAPI;
|
2026-04-20 16:41:20 +02:00
|
|
|
struct LogosModules;
|
2026-02-22 02:03:13 +05:30
|
|
|
|
2026-04-17 00:37:17 +02:00
|
|
|
// Source-side implementation of the LEZWalletBackend .rep interface.
|
|
|
|
|
// Inheriting from LEZWalletBackendSimpleSource gives us the generated PROPs
|
|
|
|
|
// and SLOTs from LEZWalletBackend.rep — all the simple ones flow over QtRO.
|
|
|
|
|
class LEZWalletBackend : public LEZWalletBackendSimpleSource {
|
2026-02-20 14:20:39 +01:00
|
|
|
Q_OBJECT
|
2026-04-17 00:37:17 +02:00
|
|
|
Q_PROPERTY(LEZWalletAccountModel* accountModel READ accountModel CONSTANT)
|
|
|
|
|
Q_PROPERTY(LEZAccountFilterModel* filteredAccountModel READ filteredAccountModel CONSTANT)
|
2026-02-20 14:20:39 +01:00
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
explicit LEZWalletBackend(LogosAPI* logosAPI = nullptr, QObject* parent = nullptr);
|
2026-04-17 00:37:17 +02:00
|
|
|
~LEZWalletBackend() override;
|
2026-02-20 14:20:39 +01:00
|
|
|
|
2026-02-22 02:03:13 +05:30
|
|
|
LEZWalletAccountModel* accountModel() const { return m_accountModel; }
|
|
|
|
|
LEZAccountFilterModel* filteredAccountModel() const { return m_filteredAccountModel; }
|
2026-02-20 14:20:39 +01:00
|
|
|
|
2026-04-17 00:37:17 +02:00
|
|
|
public slots:
|
|
|
|
|
// Overrides of the pure-virtual slots generated from the .rep.
|
|
|
|
|
QString createAccountPublic() override;
|
|
|
|
|
QString createAccountPrivate() override;
|
|
|
|
|
void refreshAccounts() override;
|
|
|
|
|
QString getBalance(QString accountIdHex, bool isPublic) override;
|
|
|
|
|
void refreshBalances() override;
|
|
|
|
|
QString getPublicAccountKey(QString accountIdHex) override;
|
|
|
|
|
QString getPrivateAccountKeys(QString accountIdHex) override;
|
|
|
|
|
bool syncToBlock(quint64 blockId) override;
|
|
|
|
|
QString transferPublic(QString fromHex, QString toHex, QString amountStr) override;
|
|
|
|
|
QString transferPrivate(QString fromHex, QString toHex, QString amountStr) override;
|
|
|
|
|
QString transferPrivateOwned(QString fromHex, QString toHex, QString amountStr) override;
|
|
|
|
|
bool createNew(QString configPath, QString storagePath, QString password) override;
|
|
|
|
|
void copyToClipboard(QString text) override;
|
2026-02-20 14:20:39 +01:00
|
|
|
|
|
|
|
|
private:
|
2026-04-17 00:37:17 +02:00
|
|
|
void persistConfigPath(const QString& path);
|
|
|
|
|
void persistStoragePath(const QString& path);
|
2026-02-20 14:20:39 +01:00
|
|
|
void refreshBlockHeights();
|
|
|
|
|
void refreshSequencerAddr();
|
|
|
|
|
void saveWallet();
|
2026-02-23 18:09:06 +01:00
|
|
|
void fetchAndUpdateBlockHeights();
|
2026-04-17 00:37:17 +02:00
|
|
|
void openIfPathsConfigured();
|
2026-02-20 14:20:39 +01:00
|
|
|
|
2026-02-22 02:03:13 +05:30
|
|
|
LEZWalletAccountModel* m_accountModel;
|
|
|
|
|
LEZAccountFilterModel* m_filteredAccountModel;
|
2026-02-20 14:20:39 +01:00
|
|
|
|
|
|
|
|
LogosAPI* m_logosAPI;
|
2026-04-20 16:41:20 +02:00
|
|
|
LogosModules* m_logos;
|
2026-02-20 14:20:39 +01:00
|
|
|
};
|
2026-04-17 00:37:17 +02:00
|
|
|
|
|
|
|
|
#endif // LEZ_WALLET_BACKEND_H
|