fix: fix syncToBlock apis

This commit is contained in:
Khushboo Mehta 2026-03-06 00:09:45 +00:00
parent f20ef94e35
commit 038d91a2b5
3 changed files with 20 additions and 8 deletions

View File

@ -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(

View File

@ -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<int>(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<int>(block_height);
}
// === Pinata claiming ===

View File

@ -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(