Skip to content

[WIP] feat(api): Add paginated REST endpoint for querying translated events by contract ID#269

Merged
Osuochasam merged 1 commit into
Open-audit-foundation:mainfrom
gaiabio12-design:grantfox-issue-231
Jun 29, 2026
Merged

[WIP] feat(api): Add paginated REST endpoint for querying translated events by contract ID#269
Osuochasam merged 1 commit into
Open-audit-foundation:mainfrom
gaiabio12-design:grantfox-issue-231

Conversation

@gaiabio12-design

Copy link
Copy Markdown
Contributor

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 contractId and timestamp in the schema. The validation layer in src/utils/parse.ts already 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(api): Add paginated REST endpoint for querying translated events by contract ID

2 participants