[WIP] feat(api): Add paginated REST endpoint for querying translated events by contract ID#269
Merged
Osuochasam merged 1 commit intoJun 29, 2026
Conversation
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.
Closes #231
Proposed Approach
Looking at the acceptance criteria, the real lift here is the pagination logic and ensuring the query performance scales when filtering across large event sets—I've dealt with similar Stellar data queries before. I'll implement the GET endpoint with cursor-based pagination (more efficient than offset for this use case) and add proper indexing on
contractIdandtimestampin the schema. The validation layer insrc/utils/parse.tsalready handles query sanitization, so I'll hook into that. Should be ready by end of tomorrow with tests covering the main edge cases—filtering by contract ID alone, time range, and the pagination boundary conditions.Acceptance Criteria
Body:
Summary
Currently, the only way to consume translated events is via the live WebSocket feed. There is no way to query historical events by contract ID, time range, or event type via a REST API. This makes it impossible for external tools, dashboards, or scripts to integrate with Open-Audit without maintaining a persistent WebSocket connection.
Required work
New API route: app/api/events/route.ts
Implement a GET /api/events endpoint with the following query parameters:
ParameterTypeDescriptioncontractIdstringFilter by Stellar contract ID (required)pagenumberPage number, 1-indexed (default
Implementation in progress — will remove
[WIP]once code is ready.