2026-01-30 19:21:23 +01:00
|
|
|
#pragma once
|
2026-02-20 00:47:06 +01:00
|
|
|
|
2026-02-16 16:15:04 +01:00
|
|
|
#include "i_logos_blockchain_module.h"
|
2026-02-20 00:47:06 +01:00
|
|
|
|
2026-02-10 13:06:58 +01:00
|
|
|
#include <iostream>
|
2026-02-16 23:14:26 +01:00
|
|
|
#ifdef __cplusplus
|
|
|
|
|
extern "C" {
|
|
|
|
|
#endif
|
|
|
|
|
#include <logos_blockchain.h>
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
#include "i_logos_blockchain_module.h"
|
2026-01-30 19:21:23 +01:00
|
|
|
|
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-16 23:14:26 +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
|
2026-02-20 00:47:06 +01:00
|
|
|
Q_INVOKABLE int generate_user_config(const QVariantMap& args) override;
|
2026-02-02 17:28:11 +01:00
|
|
|
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;
|
2026-02-16 23:14:26 +01:00
|
|
|
Q_INVOKABLE QString wallet_get_balance(const QString& addressHex) override;
|
|
|
|
|
Q_INVOKABLE QString wallet_transfer_funds(
|
|
|
|
|
const QString& changePublicKey,
|
|
|
|
|
const QStringList& senderAddresses,
|
|
|
|
|
const QString& recipientAddress,
|
|
|
|
|
const QString& amount,
|
|
|
|
|
const QString& optionalTipHex) override;
|
|
|
|
|
Q_INVOKABLE QString wallet_transfer_funds(
|
|
|
|
|
const QString& changePublicKey,
|
|
|
|
|
const QString& senderAddress,
|
|
|
|
|
const QString& recipientAddress,
|
|
|
|
|
const QString& amount,
|
|
|
|
|
const QString& optionalTipHex);
|
|
|
|
|
Q_INVOKABLE QStringList wallet_get_known_addresses() 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
|
|
|
};
|