feat: real-time Soroban log event parser and decoded alert pipeline#87
Merged
JamesEjembi merged 1 commit intoJun 28, 2026
Merged
Conversation
Decode raw contract log events (hex XDR topics + base64 SCVal body) from the Soroban RPC into typed, human-readable alerts instead of showing operators raw cryptographic hex. - types/ledgerEvents.ts: LedgerEvent discriminated union over the seven known event types plus UnknownEvent, with severity/title metadata - utils/hexDecoder.ts: total decodeLedgerEvent() — parses the topic[0] signature via @stellar/stellar-sdk ScVal, matches a lookup table, decodes the subject topic + body map per the matched schema, and degrades any unrecognized/malformed input to UnknownEvent (never throws) - hooks/useLedgerEvents: bounded newest-first raw event stream - hooks/useDecodedLedgerEvents: wraps it and decodes each event at most once (memoized by raw-event identity via a WeakMap) - components/alerts/AlertBanner: human-readable title, severity color coding, details deep-link, relative timestamp; UnknownEvent fallback with Copy Raw + Report (logs the shape to Sentry); optional Web Audio tone for high-severity (slash / reject) events, off by default - utils/alertSound: in-memory synthesized alert tone (no network asset) - services/sentry: captureUnknownLedgerEvent reporter - move @stellar/stellar-sdk to runtime dependencies (decoder uses it) Tested with vitest: encodes events with @stellar/stellar-sdk, asserts each known type's decoded output, that unknown/garbage input yields an UnknownEvent without throwing, and that 1,000 events decode in <100ms.
JamesEjembi
approved these changes
Jun 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Real-Time Soroban Log Event Parser & Decoded Alert Pipeline
Closes: #8
Summary
Contract logs arrive from the Soroban RPC
getTransactionresponse as raw hex XDRtopics + a base64 SCVal body, and were shown to operators verbatim — forcing 30–60s
of manual cross-referencing per alert. This decodes them client-side into typed,
human-readable alerts with severity color coding, well inside the <10ms/event budget.
What changed
Types —
src/types/ledgerEvents.tsLedgerEventdiscriminated union over all seven known event types(
approve_attestation,reject_attestation,slash_node,reward_distributed,node_registered,node_deregistered,parameter_changed) plusUnknownEvent.title,severity, andhighSeveritymetadata, plus theoriginal
rawTopics/rawBody.