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

refactor: add pagingToken back to GetEventsResponse.EventInfo. #655

Merged
merged 3 commits into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

### Update
- refactor: refactor `SSEStream`, make it more reliable.
- refactor: add `pagingToken` back to `GetEventsResponse.EventInfo`. This is to ensure compatibility with older versions of Soroban-RPC. We still recommend using the `GetEventsResponse.cursor` field after upgrading Soroban-RPC.

## 1.0.0-beta0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ public static class EventInfo {

String id;

/**
* The field may will be removed in the next version of the protocol. It remains for backward.
* It is recommended to use {@link #cursor} instead.
*/
String pagingToken;

/** The elements inside can be parsed as {@link org.stellar.sdk.xdr.SCVal} objects. */
List<String> topic;

Expand Down
1 change: 1 addition & 0 deletions src/test/java/org/stellar/sdk/SorobanServerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -661,6 +661,7 @@ public MockResponse dispatch(@NotNull RecordedRequest recordedRequest)
resp.getEvents().get(0).getContractId(),
"CBQHNAXSI55GX2GN6D67GK7BHVPSLJUGZQEU7WJ5LKR5PNUCGLIMAO4K");
assertEquals(resp.getEvents().get(0).getId(), "0000000459561504768-0000000000");
assertEquals(resp.getEvents().get(0).getPagingToken(), "0000000459561504768-0000000000");
assertEquals(resp.getEvents().get(0).getTopic().size(), 2);
assertEquals(resp.getEvents().get(0).getTopic().get(0), "AAAADwAAAAdDT1VOVEVSAA==");
assertEquals(resp.getEvents().get(0).getTopic().get(1), "AAAADwAAAAlpbmNyZW1lbnQAAAA=");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public void testDeserialize() throws IOException {
assertEquals(
eventInfo0.getContractId(), "CBQHNAXSI55GX2GN6D67GK7BHVPSLJUGZQEU7WJ5LKR5PNUCGLIMAO4K");
assertEquals(eventInfo0.getId(), "0000000463856472064-0000000000");
assertEquals(eventInfo0.getPagingToken(), "0000000463856472064-0000000000");
assertEquals(eventInfo0.getTopic().size(), 2);
assertEquals(eventInfo0.getTopic().get(0), "AAAADwAAAAdDT1VOVEVSAA==");
assertEquals(eventInfo0.getTopic().get(1), "AAAADwAAAAlpbmNyZW1lbnQAAAA=");
Expand Down
3 changes: 3 additions & 0 deletions src/test/resources/responses/sorobanrpc/get_events.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"ledgerClosedAt": "2023-07-23T14:47:01Z",
"contractId": "CBQHNAXSI55GX2GN6D67GK7BHVPSLJUGZQEU7WJ5LKR5PNUCGLIMAO4K",
"id": "0000000463856472064-0000000000",
"pagingToken": "0000000463856472064-0000000000",
"topic": [
"AAAADwAAAAdDT1VOVEVSAA==",
"AAAADwAAAAlpbmNyZW1lbnQAAAA="
Expand All @@ -23,6 +24,7 @@
"ledgerClosedAt": "2023-07-23T14:47:04Z",
"contractId": "CBQHNAXSI55GX2GN6D67GK7BHVPSLJUGZQEU7WJ5LKR5PNUCGLIMAO4K",
"id": "0000000476741373952-0000000000",
"pagingToken": "0000000476741373952-0000000000",
"topic": [
"AAAADwAAAAdDT1VOVEVSAA==",
"AAAADwAAAAlpbmNyZW1lbnQAAAA="
Expand All @@ -37,6 +39,7 @@
"ledgerClosedAt": "2023-07-23T14:47:07Z",
"contractId": "CBQHNAXSI55GX2GN6D67GK7BHVPSLJUGZQEU7WJ5LKR5PNUCGLIMAO4K",
"id": "0000000489626275840-0000000000",
"pagingToken": "0000000489626275840-0000000000",
"topic": [
"AAAADwAAAAdDT1VOVEVSAA==",
"AAAADwAAAAlpbmNyZW1lbnQAAAA="
Expand Down
2 changes: 2 additions & 0 deletions src/test/resources/soroban_server/get_events.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"ledgerClosedAt": "2023-07-28T14:57:02Z",
"contractId": "CBQHNAXSI55GX2GN6D67GK7BHVPSLJUGZQEU7WJ5LKR5PNUCGLIMAO4K",
"id": "0000000459561504768-0000000000",
"pagingToken": "0000000459561504768-0000000000",
"topic": [
"AAAADwAAAAdDT1VOVEVSAA==",
"AAAADwAAAAlpbmNyZW1lbnQAAAA="
Expand All @@ -23,6 +24,7 @@
"ledgerClosedAt": "2023-07-28T14:57:04Z",
"contractId": "CBQHNAXSI55GX2GN6D67GK7BHVPSLJUGZQEU7WJ5LKR5PNUCGLIMAO4K",
"id": "0000000468151439360-0000000000",
"pagingToken": "0000000468151439360-0000000000",
"topic": [
"AAAADwAAAAdDT1VOVEVSAA==",
"AAAADwAAAAlpbmNyZW1lbnQAAAA="
Expand Down
Loading