mirror of
https://github.com/logos-blockchain/logos-execution-zone-module.git
synced 2026-04-03 12:43:10 +00:00
Merge pull request #6 from logos-blockchain/fix/returnType
fix: fix return type to be c++ compatible
This commit is contained in:
commit
3b7c853d81
@ -3,14 +3,6 @@
|
|||||||
|
|
||||||
#include <core/interface.h>
|
#include <core/interface.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
#include <wallet_ffi.h>
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
class ILogosExecutionZoneWalletModule {
|
class ILogosExecutionZoneWalletModule {
|
||||||
public:
|
public:
|
||||||
virtual ~ILogosExecutionZoneWalletModule() = default;
|
virtual ~ILogosExecutionZoneWalletModule() = default;
|
||||||
@ -38,7 +30,7 @@ public:
|
|||||||
virtual QString account_id_from_base58(const QString& base58_str) = 0;
|
virtual QString account_id_from_base58(const QString& base58_str) = 0;
|
||||||
|
|
||||||
// Blockchain Synchronisation
|
// Blockchain Synchronisation
|
||||||
virtual WalletFfiError sync_to_block(uint64_t block_id) = 0;
|
virtual int sync_to_block(uint64_t block_id) = 0;
|
||||||
virtual uint64_t get_last_synced_block() = 0;
|
virtual uint64_t get_last_synced_block() = 0;
|
||||||
virtual uint64_t get_current_block_height() = 0;
|
virtual uint64_t get_current_block_height() = 0;
|
||||||
|
|
||||||
@ -77,13 +69,13 @@ public:
|
|||||||
virtual QString register_private_account(const QString& account_id_hex) = 0;
|
virtual QString register_private_account(const QString& account_id_hex) = 0;
|
||||||
|
|
||||||
// Wallet Lifecycle
|
// Wallet Lifecycle
|
||||||
virtual WalletFfiError create_new(
|
virtual int create_new(
|
||||||
const QString& config_path,
|
const QString& config_path,
|
||||||
const QString& storage_path,
|
const QString& storage_path,
|
||||||
const QString& password
|
const QString& password
|
||||||
) = 0;
|
) = 0;
|
||||||
virtual WalletFfiError open(const QString& config_path, const QString& storage_path) = 0;
|
virtual int open(const QString& config_path, const QString& storage_path) = 0;
|
||||||
virtual WalletFfiError save() = 0;
|
virtual int save() = 0;
|
||||||
|
|
||||||
// Configuration & Metadata
|
// Configuration & Metadata
|
||||||
virtual QString get_sequencer_addr() = 0;
|
virtual QString get_sequencer_addr() = 0;
|
||||||
|
|||||||
@ -302,7 +302,7 @@ QString LogosExecutionZoneWalletModule::account_id_from_base58(const QString& ba
|
|||||||
|
|
||||||
// === Blockchain Synchronisation ===
|
// === Blockchain Synchronisation ===
|
||||||
|
|
||||||
WalletFfiError LogosExecutionZoneWalletModule::sync_to_block(const uint64_t block_id) {
|
int LogosExecutionZoneWalletModule::sync_to_block(const uint64_t block_id) {
|
||||||
return wallet_ffi_sync_to_block(walletHandle, block_id);
|
return wallet_ffi_sync_to_block(walletHandle, block_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -548,7 +548,7 @@ QString LogosExecutionZoneWalletModule::register_private_account(const QString&
|
|||||||
|
|
||||||
// === Wallet Lifecycle ===
|
// === Wallet Lifecycle ===
|
||||||
|
|
||||||
WalletFfiError LogosExecutionZoneWalletModule::create_new(
|
int LogosExecutionZoneWalletModule::create_new(
|
||||||
const QString& config_path,
|
const QString& config_path,
|
||||||
const QString& storage_path,
|
const QString& storage_path,
|
||||||
const QString& password
|
const QString& password
|
||||||
@ -571,7 +571,7 @@ WalletFfiError LogosExecutionZoneWalletModule::create_new(
|
|||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
WalletFfiError LogosExecutionZoneWalletModule::open(const QString& config_path, const QString& storage_path) {
|
int LogosExecutionZoneWalletModule::open(const QString& config_path, const QString& storage_path) {
|
||||||
if (walletHandle) {
|
if (walletHandle) {
|
||||||
qWarning() << "open: wallet is already open";
|
qWarning() << "open: wallet is already open";
|
||||||
return INTERNAL_ERROR;
|
return INTERNAL_ERROR;
|
||||||
@ -589,7 +589,7 @@ WalletFfiError LogosExecutionZoneWalletModule::open(const QString& config_path,
|
|||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
WalletFfiError LogosExecutionZoneWalletModule::save() {
|
int LogosExecutionZoneWalletModule::save() {
|
||||||
return wallet_ffi_save(walletHandle);
|
return wallet_ffi_save(walletHandle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -3,6 +3,14 @@
|
|||||||
|
|
||||||
#include "i_logos_execution_zone_wallet_module.h"
|
#include "i_logos_execution_zone_wallet_module.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
#include <wallet_ffi.h>
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <QJsonArray>
|
#include <QJsonArray>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
@ -48,7 +56,7 @@ public:
|
|||||||
Q_INVOKABLE QString account_id_from_base58(const QString& base58_str) override;
|
Q_INVOKABLE QString account_id_from_base58(const QString& base58_str) override;
|
||||||
|
|
||||||
// Blockchain Synchronisation
|
// Blockchain Synchronisation
|
||||||
Q_INVOKABLE WalletFfiError sync_to_block(uint64_t block_id) override;
|
Q_INVOKABLE int sync_to_block(uint64_t block_id) override;
|
||||||
Q_INVOKABLE uint64_t get_last_synced_block() override;
|
Q_INVOKABLE uint64_t get_last_synced_block() override;
|
||||||
Q_INVOKABLE uint64_t get_current_block_height() override;
|
Q_INVOKABLE uint64_t get_current_block_height() override;
|
||||||
|
|
||||||
@ -87,10 +95,9 @@ public:
|
|||||||
Q_INVOKABLE QString register_private_account(const QString& account_id_hex) override;
|
Q_INVOKABLE QString register_private_account(const QString& account_id_hex) override;
|
||||||
|
|
||||||
// Wallet Lifecycle
|
// Wallet Lifecycle
|
||||||
Q_INVOKABLE WalletFfiError
|
Q_INVOKABLE int create_new(const QString& config_path, const QString& storage_path, const QString& password) override;
|
||||||
create_new(const QString& config_path, const QString& storage_path, const QString& password) override;
|
Q_INVOKABLE int open(const QString& config_path, const QString& storage_path) override;
|
||||||
Q_INVOKABLE WalletFfiError open(const QString& config_path, const QString& storage_path) override;
|
Q_INVOKABLE int save() override;
|
||||||
Q_INVOKABLE WalletFfiError save() override;
|
|
||||||
|
|
||||||
// Configuration
|
// Configuration
|
||||||
Q_INVOKABLE QString get_sequencer_addr() override;
|
Q_INVOKABLE QString get_sequencer_addr() override;
|
||||||
@ -99,4 +106,4 @@ signals:
|
|||||||
void eventResponse(const QString& eventName, const QVariantList& data);
|
void eventResponse(const QString& eventName, const QVariantList& data);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
Loading…
x
Reference in New Issue
Block a user