diff --git a/src/i_logos_execution_zone_wallet_module.h b/src/i_logos_execution_zone_wallet_module.h index e22dea4..def8a41 100644 --- a/src/i_logos_execution_zone_wallet_module.h +++ b/src/i_logos_execution_zone_wallet_module.h @@ -31,8 +31,9 @@ public: // Blockchain Synchronisation virtual int sync_to_block(uint64_t block_id) = 0; - virtual uint64_t get_last_synced_block() = 0; - virtual uint64_t get_current_block_height() = 0; + virtual int sync_to_block(const QString& block_id_str) = 0; + virtual int get_last_synced_block() = 0; + virtual int get_current_block_height() = 0; // Pinata virtual QString claim_pinata( diff --git a/src/logos_execution_zone_wallet_module.cpp b/src/logos_execution_zone_wallet_module.cpp index f281215..1ff02dc 100644 --- a/src/logos_execution_zone_wallet_module.cpp +++ b/src/logos_execution_zone_wallet_module.cpp @@ -366,24 +366,34 @@ int LogosExecutionZoneWalletModule::sync_to_block(const uint64_t block_id) { return wallet_ffi_sync_to_block(walletHandle, block_id); } -uint64_t LogosExecutionZoneWalletModule::get_last_synced_block() { +int LogosExecutionZoneWalletModule::sync_to_block(const QString& block_id_str) { + bool ok = false; + const uint64_t block_id = block_id_str.trimmed().toULongLong(&ok); + if (!ok) { + qWarning() << "sync_to_block: invalid block id string:" << block_id_str; + return -1; + } + return sync_to_block(block_id); +} + +int LogosExecutionZoneWalletModule::get_last_synced_block() { uint64_t block_id = 0; const WalletFfiError error = wallet_ffi_get_last_synced_block(walletHandle, &block_id); if (error != SUCCESS) { qWarning() << "get_last_synced_block: wallet FFI error" << error; return 0; } - return block_id; + return static_cast(block_id); } -uint64_t LogosExecutionZoneWalletModule::get_current_block_height() { +int LogosExecutionZoneWalletModule::get_current_block_height() { uint64_t block_height = 0; const WalletFfiError error = wallet_ffi_get_current_block_height(walletHandle, &block_height); if (error != SUCCESS) { qWarning() << "get_current_block_height: wallet FFI error" << error; return 0; } - return block_height; + return static_cast(block_height); } // === Pinata claiming === diff --git a/src/logos_execution_zone_wallet_module.h b/src/logos_execution_zone_wallet_module.h index 5b25b67..1ac0005 100644 --- a/src/logos_execution_zone_wallet_module.h +++ b/src/logos_execution_zone_wallet_module.h @@ -77,8 +77,9 @@ public: // Blockchain Synchronisation 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_current_block_height() override; + Q_INVOKABLE int sync_to_block(const QString& block_id_str) override; + Q_INVOKABLE int get_last_synced_block() override; + Q_INVOKABLE int get_current_block_height() override; // Operations Q_INVOKABLE QString transfer_public(