feat: add cursor pagination to sc events
[wip] to add prev_cursor
Fixes https://github.com/hirosystems/stacks-blockchain-api/issues/2349 by adding cursor-based pagination for events. This provides stable iteration through results, unlike offset-based pagination where responses can shift as new events are added.
Vercel deployment URL: https://stacks-blockchain-57uq2bbf2-hirosystems.vercel.app :rocket:
Codecov Report
:x: Patch coverage is 63.26531% with 18 lines in your changes missing coverage. Please review.
| Files with missing lines | Patch % | Lines |
|---|---|---|
| src/datastore/pg-store.ts | 51.42% | 14 Missing and 3 partials :warning: |
| src/api/routes/contract.ts | 90.00% | 1 Missing :warning: |
:loudspeaker: Thoughts on this report? Let us know!
@ASuciuX thanks for giving a shot at this pr. With this cursor based approach, will it be possible to got from event 1 (the first one that happened) to the last one? My use case would be to index all the events from the start to a specific block.
Yes, with the cursor you can iterate forward from the very first event to the latest, page by page. It’s designed so you can start at genesis and stop at any specific block height.
Amazing, looking forward to be able to use this approach 🙏
@ASuciuX lmk if I can help to get the pr merged faster
@ASuciuX lmk if I can help to get the pr merged faster
The task got pushed to the backlog due to some internal priorities, but I’ll take care of it as soon as those wrap up.