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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
- This applies to `submit`, `signAndSubmit`, `restoreFootprint`, and therefore to `ContractClient.invoke` when it submits.
- fix: always encode text as UTF-8 in `Scv.toString(String)`, `Sep10Challenge` (`web_auth_domain` / `client_domain`), `Util.paddedByteArray(String, int)`, and the `SorobanServer` request body. They used the JVM default charset, so non-ASCII text produced different bytes on JVMs where that is not UTF-8.
- chore: upgrade generated XDR definitions to Protocol 30.
- refactor: deprecate `GetEventsResponse.EventInfo.inSuccessfulContractCall`. Stellar RPC no longer returns it from `getEvents` ([stellar-rpc#1050](https://github.com/stellar/stellar-rpc/pull/1050)), so it is `null` with newer servers. It will be removed in the next major release.

## 5.0.0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,14 @@ public static class EventInfo {
/** 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;
/**
* Whether the event was emitted during a successful contract call.
*
* @deprecated Stellar RPC no longer returns this field from {@code getEvents} (<a
* href="https://github.com/stellar/stellar-rpc/pull/1050">stellar-rpc#1050</a>), so it is
* {@code null} with newer servers. It will be removed in the next major release.
*/
@Deprecated Boolean inSuccessfulContractCall;

/**
* Parses the {@code topic} field from a list of strings to a list of {@link
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;

import com.google.gson.reflect.TypeToken;
import java.io.IOException;
Expand Down Expand Up @@ -56,4 +57,24 @@ public void testDeserialize() throws IOException {
GetEventsResponse.EventInfo eventInfo2 = getEventsResponse.getResult().getEvents().get(2);
assertEquals(eventInfo2.getType(), EventFilterType.DIAGNOSTIC);
}

@Test
public void testDeserializeWithoutInSuccessfulContractCall() {
// Stellar RPC no longer returns inSuccessfulContractCall (stellar-rpc#1050).
String json =
"{\"jsonrpc\":\"2.0\",\"id\":\"1\",\"result\":{\"latestLedger\":100,"
+ "\"cursor\":\"0000000463856472064-0000000000\",\"events\":[{\"type\":\"contract\","
+ "\"ledger\":108,\"ledgerClosedAt\":\"2023-07-23T14:47:01Z\","
+ "\"contractId\":\"CBQHNAXSI55GX2GN6D67GK7BHVPSLJUGZQEU7WJ5LKR5PNUCGLIMAO4K\","
+ "\"id\":\"0000000463856472064-0000000000\",\"topic\":[\"AAAADwAAAAdDT1VOVEVSAA==\"],"
+ "\"value\":\"AAAAAwAAAAE=\",\"txHash\":"
+ "\"db86e94aa98b7d38213c041ebbb727fbaabf0b7c435de594f36c2d51fc61926d\"}]}}";

SorobanRpcResponse<GetEventsResponse> getEventsResponse =
GsonSingleton.getInstance()
.fromJson(json, new TypeToken<SorobanRpcResponse<GetEventsResponse>>() {}.getType());
GetEventsResponse.EventInfo eventInfo = getEventsResponse.getResult().getEvents().get(0);
assertEquals(eventInfo.getValue(), "AAAAAwAAAAE=");
assertNull(eventInfo.getInSuccessfulContractCall());
}
}
Loading