feat: add status update checks for UI

This commit is contained in:
erhant 2026-06-22 18:37:07 +03:00
parent 84d9ef5d19
commit 014a6dcfe1
3 changed files with 27 additions and 4 deletions

8
flake.lock generated
View File

@ -1348,11 +1348,11 @@
"rust-rapidsnark": "rust-rapidsnark"
},
"locked": {
"lastModified": 1782123395,
"narHash": "sha256-vbfaImZIjSdou9KUyOT30vkhphTZiB3tIFlGGAuGjgY=",
"lastModified": 1782142589,
"narHash": "sha256-K5NtBontpPx1XqnX6jbEzPXSchaLbPlG9689W+C/ExA=",
"ref": "erhant/fix-indexer-ffi",
"rev": "2c76fa959f6a3f3262f768d49411e5e177ad1b27",
"revCount": 2772,
"rev": "2a78b1b3d1b4080930c00ecf23b5c0e73cd646b8",
"revCount": 2773,
"type": "git",
"url": "https://github.com/logos-blockchain/logos-execution-zone"
},

View File

@ -226,6 +226,25 @@ std::string LezIndexerModuleImpl::getLastFinalizedBlockId() {
return u64ToString(res.block_id);
}
std::string LezIndexerModuleImpl::getStatus() {
if (!indexer_service_ffi) {
warn("getStatus", "indexer not started");
return {};
}
// The FFI builds the status JSON itself (schema owned by indexer_core), so
// there is nothing to marshal — copy the C string out and free it.
char* json = ::query_status(handle(indexer_service_ffi));
if (!json) {
warn("getStatus", "indexer FFI error");
return {};
}
const std::string out(json);
::free_cstring(json);
return out;
}
std::string LezIndexerModuleImpl::getTransactionsByAccount(
const std::string& account_id,
const std::string& offset,

View File

@ -49,6 +49,10 @@ public:
std::string getBlocks(const std::string& before, const std::string& limit);
/// Tip block id as a bare decimal string.
std::string getLastFinalizedBlockId();
/// Current ingestion status as a compact JSON object so a UI can tell
/// "catching up" from "failed": { state (starting/syncing/caught_up/error),
/// indexedBlockId, lastError }. Empty string if the indexer isn't running.
std::string getStatus();
/// Transactions touching `account_id` (32-byte hex), paginated by decimal
/// `offset`/`limit`.
//