Skip to content
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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
- feat: add muxed account, liquidity pool and claimable balance support to `Address` class.
- feat: add `destinationMuxedId` and `destinationMuxedIdType` to `InvokeHostFunctionOperationResponse.AssetContractBalanceChange`.
- feat: add `events` field to `GetTransactionsResponse.Transaction` and `GetTransactionResponse`, see [stellar-rpc#455](https://github.com/stellar/stellar-rpc/pull/455) for more details.
- feat: add `oldestLedger`, `latestLedgerCloseTime` and `oldestLedgerCloseTime` fields to `GetEventsResponse`, and add `transactionIndex` and `operationIndex` fields to `GetEventsResponse.EventInfo`, check [Stellar RPC release log](https://github.com/stellar/stellar-rpc/releases/tag/v23.0.0-rc.1) for more information.

### Breaking changes:
- refactor!: the following functions in `StrKey` are marked as deprecated, they will be removed in the next major release; please refer to the documentation for each function to see the corresponding replacement functions:
Expand All @@ -20,6 +21,8 @@
- `StrKey#encodeToXDRMuxedAccount(String)`
- refactor!: remove `numArchivedContracts` and `archivedContractsAmount` from `AssetResponse`.
- refactor!: `GetTransactionsResponse.Transaction#getDiagnosticEventsXdr()` and `GetTransactionsResponse.Transaction#parseDiagnosticEventsXdr()` has been marked as deprecated, they will be removed in Stellar RPC soon, use `GetTransactionsResponse.Transaction#getEvents()` instead.
- refactor!: remove deprecated `pagingToken` field from `GetEventsResponse.EventInfo`.
- refactor!: `inSuccessfulContractCall` in `GetEventsResponse.EventInfo` has been marked as deprecated, it will be removed in the next release.

## 1.5.0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,13 @@
public class GetEventsResponse {
List<EventInfo> events;

String cursor;

Long latestLedger;
Long oldestLedger;

String cursor;
Long latestLedgerCloseTime;
Long oldestLedgerCloseTime;

@Value
public static class EventInfo {
Expand All @@ -34,23 +38,22 @@ 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;
Long operationIndex;

Long transactionIndex;

@SerializedName("txHash")
String transactionHash;

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

/** The field can be parsed as {@link org.stellar.sdk.xdr.SCVal} object. */
String value;

/** The field will be removed in the next version. */
Boolean inSuccessfulContractCall;

@SerializedName("txHash")
String transactionHash;

/**
* Parses the {@code topic} field from a list of strings to a list of {@link
* org.stellar.sdk.xdr.SCVal} objects.
Expand Down
3 changes: 1 addition & 2 deletions src/test/java/org/stellar/sdk/SorobanServerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -757,7 +757,7 @@ public MockResponse dispatch(@NotNull RecordedRequest recordedRequest)
HttpUrl baseUrl = mockWebServer.url("");
SorobanServer server = new SorobanServer(baseUrl.toString());
GetEventsResponse resp = server.getEvents(getEventsRequest);
assertEquals(resp.getLatestLedger().longValue(), 187L);
assertEquals(resp.getLatestLedger().longValue(), 318987L);
assertEquals(resp.getCursor(), "0000000468151439360-0000000000");
assertEquals(resp.getEvents().size(), 2);
assertEquals(resp.getEvents().get(0).getType(), EventFilterType.CONTRACT);
Expand All @@ -767,7 +767,6 @@ 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 @@ -20,7 +20,10 @@ public void testDeserialize() throws IOException {
SorobanRpcResponse<GetEventsResponse> getEventsResponse =
GsonSingleton.getInstance()
.fromJson(json, new TypeToken<SorobanRpcResponse<GetEventsResponse>>() {}.getType());
assertEquals(getEventsResponse.getResult().getLatestLedger().longValue(), 169L);
assertEquals(getEventsResponse.getResult().getLatestLedger().longValue(), 318987L);
assertEquals(getEventsResponse.getResult().getOldestLedger().longValue(), 317964L);
assertEquals(getEventsResponse.getResult().getLatestLedgerCloseTime().longValue(), 1751863824L);
assertEquals(getEventsResponse.getResult().getOldestLedgerCloseTime().longValue(), 1751858705L);
assertEquals(getEventsResponse.getResult().getEvents().size(), 3);
assertEquals(getEventsResponse.getResult().getCursor(), "0000000463856472064-0000000000");

Expand All @@ -31,7 +34,6 @@ 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 All @@ -45,6 +47,8 @@ public void testDeserialize() throws IOException {
assertEquals(eventInfo0.parseTopic().size(), 2);
assertEquals(eventInfo0.parseTopic().get(0).toXdrBase64(), eventInfo0.getTopic().get(0));
assertEquals(eventInfo0.parseTopic().get(1).toXdrBase64(), eventInfo0.getTopic().get(1));
assertEquals(eventInfo0.getOperationIndex().longValue(), 1L);
assertEquals(eventInfo0.getTransactionIndex().longValue(), 2L);

GetEventsResponse.EventInfo eventInfo1 = getEventsResponse.getResult().getEvents().get(1);
assertEquals(eventInfo1.getType(), EventFilterType.SYSTEM);
Expand Down
12 changes: 10 additions & 2 deletions src/test/resources/responses/sorobanrpc/get_events.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@
"ledgerClosedAt": "2023-07-23T14:47:01Z",
"contractId": "CBQHNAXSI55GX2GN6D67GK7BHVPSLJUGZQEU7WJ5LKR5PNUCGLIMAO4K",
"id": "0000000463856472064-0000000000",
"pagingToken": "0000000463856472064-0000000000",
"topic": [
"AAAADwAAAAdDT1VOVEVSAA==",
"AAAADwAAAAlpbmNyZW1lbnQAAAA="
],
"value": "AAAAAwAAAAE=",
"inSuccessfulContractCall": true,
"operationIndex": 1,
"transactionIndex": 2,
"txHash": "db86e94aa98b7d38213c041ebbb727fbaabf0b7c435de594f36c2d51fc61926d"
},
{
Expand All @@ -30,6 +31,8 @@
"AAAADwAAAAlpbmNyZW1lbnQAAAA="
],
"value": "AAAAAwAAAAI=",
"operationIndex": 3,
"transactionIndex": 4,
"inSuccessfulContractCall": true,
"txHash": "db86e94aa98b7d38213c041ebbb727fbaabf0b7c435de594f36c2d51fc61926d"
},
Expand All @@ -45,11 +48,16 @@
"AAAADwAAAAlpbmNyZW1lbnQAAAA="
],
"value": "AAAAAwAAAAM=",
"operationIndex": 5,
"transactionIndex": 6,
"inSuccessfulContractCall": true,
"txHash": "db86e94aa98b7d38213c041ebbb727fbaabf0b7c435de594f36c2d51fc61926d"
}
],
"latestLedger": "169",
"latestLedger": 318987,
"oldestLedger": 317964,
"latestLedgerCloseTime": "1751863824",
"oldestLedgerCloseTime": "1751858705",
"cursor": "0000000463856472064-0000000000"
}
}
10 changes: 8 additions & 2 deletions src/test/resources/soroban_server/get_events.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@
"ledgerClosedAt": "2023-07-28T14:57:02Z",
"contractId": "CBQHNAXSI55GX2GN6D67GK7BHVPSLJUGZQEU7WJ5LKR5PNUCGLIMAO4K",
"id": "0000000459561504768-0000000000",
"pagingToken": "0000000459561504768-0000000000",
"topic": [
"AAAADwAAAAdDT1VOVEVSAA==",
"AAAADwAAAAlpbmNyZW1lbnQAAAA="
],
"operationIndex": 1,
"transactionIndex": 2,
"value": "AAAAAwAAAAQ=",
"inSuccessfulContractCall": true,
"txHash": "db86e94aa98b7d38213c041ebbb727fbaabf0b7c435de594f36c2d51fc61926d"
Expand All @@ -29,12 +30,17 @@
"AAAADwAAAAdDT1VOVEVSAA==",
"AAAADwAAAAlpbmNyZW1lbnQAAAA="
],
"operationIndex": 3,
"transactionIndex": 4,
"value": "AAAAAwAAAAU=",
"inSuccessfulContractCall": true,
"txHash": "db86e94aa98b7d38213c041ebbb727fbaabf0b7c435de594f36c2d51fc61926d"
}
],
"latestLedger": "187",
"latestLedger": 318987,
"oldestLedger": 317964,
"latestLedgerCloseTime": "1751863824",
"oldestLedgerCloseTime": "1751858705",
"cursor": "0000000468151439360-0000000000"
}
}