2026-04-02 00:19:02 +03:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include "models/Block.h"
|
|
|
|
|
#include "models/Transaction.h"
|
|
|
|
|
#include "models/Account.h"
|
|
|
|
|
|
2026-04-02 22:36:51 +03:00
|
|
|
#include <QObject>
|
2026-04-02 00:19:02 +03:00
|
|
|
#include <QVector>
|
|
|
|
|
#include <optional>
|
|
|
|
|
|
|
|
|
|
struct SearchResults {
|
|
|
|
|
QVector<Block> blocks;
|
|
|
|
|
QVector<Transaction> transactions;
|
|
|
|
|
QVector<Account> accounts;
|
|
|
|
|
};
|
|
|
|
|
|
2026-04-02 22:36:51 +03:00
|
|
|
class IndexerService : public QObject {
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
2026-04-02 00:19:02 +03:00
|
|
|
public:
|
2026-04-02 22:36:51 +03:00
|
|
|
explicit IndexerService(QObject* parent = nullptr) : QObject(parent) {}
|
|
|
|
|
~IndexerService() override = default;
|
2026-04-02 00:19:02 +03:00
|
|
|
|
|
|
|
|
virtual std::optional<Account> getAccount(const QString& accountId) = 0;
|
|
|
|
|
virtual std::optional<Block> getBlockById(quint64 blockId) = 0;
|
|
|
|
|
virtual std::optional<Block> getBlockByHash(const QString& hash) = 0;
|
|
|
|
|
virtual std::optional<Transaction> getTransaction(const QString& hash) = 0;
|
|
|
|
|
virtual QVector<Block> getBlocks(std::optional<quint64> before, int limit) = 0;
|
|
|
|
|
virtual quint64 getLatestBlockId() = 0;
|
|
|
|
|
virtual QVector<Transaction> getTransactionsByAccount(const QString& accountId, int offset, int limit) = 0;
|
|
|
|
|
virtual SearchResults search(const QString& query) = 0;
|
2026-04-02 22:36:51 +03:00
|
|
|
|
|
|
|
|
signals:
|
|
|
|
|
void newBlockAdded(Block block);
|
2026-04-02 00:19:02 +03:00
|
|
|
};
|