2026-01-30 19:21:23 +01:00
|
|
|
#pragma once
|
2026-02-10 13:06:58 +01:00
|
|
|
#include <QtCore/QDebug>
|
|
|
|
|
#include <iostream>
|
2026-01-30 19:21:23 +01:00
|
|
|
#include "i_logos_blockchain_module.h"
|
|
|
|
|
|
2026-02-02 17:28:11 +01:00
|
|
|
class LogosBlockchainModule final : public QObject, public PluginInterface, public ILogosBlockchainModule {
|
2026-01-30 19:21:23 +01:00
|
|
|
Q_OBJECT
|
2026-02-03 18:27:08 +01:00
|
|
|
Q_PLUGIN_METADATA(IID ILogosBlockchainModule_iid FILE LOGOS_BLOCKCHAIN_MODULE_METADATA_FILE)
|
2026-02-02 17:28:11 +01:00
|
|
|
Q_INTERFACES(PluginInterface)
|
2026-01-30 19:21:23 +01:00
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
LogosBlockchainModule();
|
|
|
|
|
~LogosBlockchainModule() override;
|
|
|
|
|
|
2026-02-02 17:28:11 +01:00
|
|
|
// Logos Core
|
2026-01-30 19:21:23 +01:00
|
|
|
[[nodiscard]] QString name() const override;
|
|
|
|
|
[[nodiscard]] QString version() const override;
|
|
|
|
|
Q_INVOKABLE void initLogos(LogosAPI*) override;
|
2026-02-02 17:28:11 +01:00
|
|
|
|
|
|
|
|
// Logos Blockchain
|
|
|
|
|
Q_INVOKABLE int start(const QString& config_path, const QString& deployment) override;
|
2026-01-30 19:21:23 +01:00
|
|
|
Q_INVOKABLE int stop() override;
|
|
|
|
|
Q_INVOKABLE int wallet_get_balance(const uint8_t*, const HeaderId*, BalanceResult*) override;
|
|
|
|
|
Q_INVOKABLE int wallet_transfer_funds(const TransferFundsArguments*, Hash*) override;
|
2026-02-16 10:49:02 +01:00
|
|
|
Q_INVOKABLE int wallet_get_known_addresses(lb::KnownAddresses*) override;
|
2026-01-30 19:21:23 +01:00
|
|
|
|
2026-02-04 15:56:51 +01:00
|
|
|
signals:
|
|
|
|
|
void eventResponse(const QString& eventName, const QVariantList& data);
|
2026-02-02 17:28:11 +01:00
|
|
|
|
2026-01-30 19:21:23 +01:00
|
|
|
private:
|
|
|
|
|
LogosBlockchainNode* node = nullptr;
|
2026-02-12 15:25:56 +05:30
|
|
|
LogosAPIClient* client = nullptr;
|
|
|
|
|
|
|
|
|
|
// Static instance for C callback (C API doesn't support user data)
|
|
|
|
|
static LogosBlockchainModule* s_instance;
|
|
|
|
|
|
|
|
|
|
// C-compatible callback function
|
|
|
|
|
static void onNewBlockCallback(const char* block);
|
|
|
|
|
|
|
|
|
|
// Helper method for emitting events
|
|
|
|
|
void emitEvent(const QString& eventName, const QVariantList& data);
|
2026-01-30 19:21:23 +01:00
|
|
|
};
|