lez-explorer-ui/src/services/IndexerService.h

47 lines
1.5 KiB
C
Raw Normal View History

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
// Over the Logos protocol the "endpoint" is repurposed to the indexer
// config path (absolute path to indexer_config.json); blank means the
// indexer is already running. No network URL is involved anymore.
static QString defaultEndpoint()
{
return QString();
}
virtual QString endpoint() const = 0;
virtual void setEndpoint(const QString& endpoint) = 0;
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 getLastFinalizedBlockId() = 0;
2026-04-02 00:19:02 +03:00
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
};