Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getEvents should still return a cursor if there are no events #340

Closed
kalepail opened this issue Dec 14, 2024 · 5 comments
Closed

getEvents should still return a cursor if there are no events #340

kalepail opened this issue Dec 14, 2024 · 5 comments
Labels
bug Something isn't working

Comments

@kalepail
Copy link
Contributor

kalepail commented Dec 14, 2024

Describe the bug
When getEvents doesn't return any events, there is no cursor to paginate on.

But what if there are no events for a given filter? You may want to continue on but can't because there's no cursor. Especially given the way I think events are retrieved it's quite possible events are "missing" from your query and you need to paginate further for them.

@kalepail kalepail added the bug Something isn't working label Dec 14, 2024
@kalepail
Copy link
Contributor Author

This is specifically in reference to the returned types

export interface GetEventsResponse {
        latestLedger: number;
        events: EventResponse[];
    }

@Shaptic
Copy link
Contributor

Shaptic commented Dec 14, 2024

It's in the EventResponse, either as pagingToken (deprecated), id, or cursor. I think we decided it makes more sense to have a per-event rather than per-page cursor.

@Shaptic Shaptic closed this as completed Dec 14, 2024
@kalepail
Copy link
Contributor Author

But what if there are no events for a given filter? You may want to continue on but can't because there's no cursor. Especially given the way I think events are retrieved it's quite possible events are "missing" from your query and you need to paginate further for them.

@kalepail kalepail reopened this Dec 16, 2024
@Shaptic Shaptic transferred this issue from stellar/js-stellar-sdk Dec 16, 2024
@Shaptic Shaptic changed the title rpc.getEvents doesn't return a cursor. Should it? getEvents should still return a cursor if there are no events Dec 16, 2024
@Shaptic
Copy link
Contributor

Shaptic commented Dec 17, 2024

Oh, I'm a fool. We actually have cursor at the top level now rather than per-event. It's the API schema in the SDK that's wrong 🤦 fixed in stellar/js-stellar-sdk#1124, so closing this. Sorry for the confusion!

@Shaptic Shaptic closed this as completed Dec 17, 2024
@kalepail
Copy link
Contributor Author

fwiw there's a cursor at the top level AND per event from the RPC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Done
Development

No branches or pull requests

2 participants