diff --git a/CHANGELOG.md b/CHANGELOG.md index 33f518aae..dc71187cf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,10 +2,13 @@ ## Pending +## 3.1.0 + ### Update -- fix: make Horizon request builder URL generation idempotent so repeated `buildUri()` or `execute()` calls on the same builder do not duplicate path segments. -- docs: add an [Agent Skill](https://agentskills.io/) for the Java Stellar SDK under `skills/`, plus Claude Code plugin manifests in `.claude-plugin/`. The skill gives AI coding agents concise, Stellar-specific guidance (transactions, operations, Horizon, Soroban, XDR/SCVal, and SEP protocols) when generating application code with `stellar-sdk`. -- feat: add SEP-0046, SEP-0047, and SEP-0048 contract introspection support. New `ContractMeta`, `ContractSpec`, and `ContractInfo` wrappers under `org.stellar.sdk.contract` parse contract Wasm metadata and interface specs locally. `SorobanServer` adds `getContractWasm`, `getContractWasmByHash`, `getContractMeta`, `getContractSpec`, and `getContractInfo` for RPC-backed retrieval. +- fix: make `RootRequestBuilder` request the Horizon root endpoint as `/` instead of the percent-encoded `/%2F` path. ([#801](https://github.com/lightsail-network/java-stellar-sdk/pull/801)) +- fix: make Horizon request builder URL generation idempotent so repeated `buildUri()` or `execute()` calls on the same builder do not duplicate path segments. ([#798](https://github.com/lightsail-network/java-stellar-sdk/pull/798)) +- docs: add an [Agent Skill](https://agentskills.io/) for the Java Stellar SDK under `skills/`, plus Claude Code plugin manifests in `.claude-plugin/`. The skill gives AI coding agents concise, Stellar-specific guidance (transactions, operations, Horizon, Soroban, XDR/SCVal, and SEP protocols) when generating application code with `stellar-sdk`. ([#797](https://github.com/lightsail-network/java-stellar-sdk/pull/797)) +- feat: add SEP-0046, SEP-0047, and SEP-0048 contract introspection support. New `ContractMeta`, `ContractSpec`, and `ContractInfo` wrappers under `org.stellar.sdk.contract` parse contract Wasm metadata and interface specs locally. `SorobanServer` adds `getContractWasm`, `getContractWasmByHash`, `getContractMeta`, `getContractSpec`, and `getContractInfo` for RPC-backed retrieval. ([#796](https://github.com/lightsail-network/java-stellar-sdk/pull/796)) ## 3.0.0 diff --git a/android_test/app/build.gradle.kts b/android_test/app/build.gradle.kts index 4fc8db9c0..dd1c13e79 100644 --- a/android_test/app/build.gradle.kts +++ b/android_test/app/build.gradle.kts @@ -68,7 +68,7 @@ dependencies { implementation("androidx.compose.material3:material3") // Since we are adding local jar(libs/stellar-sdk.jar) as dependency, // gradle cannot automatically download the required third-party dependencies. - implementation(files("libs/stellar-sdk-3.0.0.jar")) + implementation(files("libs/stellar-sdk-3.1.0.jar")) implementation("com.squareup.okhttp3:okhttp:4.11.0") implementation("com.squareup.okhttp3:okhttp-sse:4.11.0") implementation("com.moandjiezana.toml:toml4j:0.7.2") diff --git a/build.gradle.kts b/build.gradle.kts index 99a69b143..7821f8abc 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -12,7 +12,7 @@ plugins { } group = "network.lightsail" -version = "3.0.0" +version = "3.1.0" java { toolchain { diff --git a/examples/build.gradle.kts b/examples/build.gradle.kts index bfda6ca32..ff8202744 100644 --- a/examples/build.gradle.kts +++ b/examples/build.gradle.kts @@ -22,7 +22,7 @@ spotless { dependencies { // Use https://central.sonatype.com/artifact/network.lightsail/stellar-sdk in prod. - implementation("network.lightsail:stellar-sdk:3.0.0") + implementation("network.lightsail:stellar-sdk:3.1.0") testImplementation(platform("org.junit:junit-bom:5.10.0")) testImplementation("org.junit.jupiter:junit-jupiter") } diff --git a/pom.xml b/pom.xml index d57563582..a13a57c41 100644 --- a/pom.xml +++ b/pom.xml @@ -11,7 +11,7 @@ network.lightsail stellar-sdk - 3.0.0 + 3.1.0 jar stellar-sdk diff --git a/readme.md b/readme.md index 6030a0093..e980a8759 100644 --- a/readme.md +++ b/readme.md @@ -14,13 +14,13 @@ The Java Stellar SDK library provides APIs to build transactions and connect to network.lightsail stellar-sdk - 3.0.0 + 3.1.0 ``` ### Gradle ```groovy -implementation 'network.lightsail:stellar-sdk:3.0.0' +implementation 'network.lightsail:stellar-sdk:3.1.0' ``` You can find instructions on how to install this dependency using alternative package managers [here](https://central.sonatype.com/artifact/network.lightsail/stellar-sdk). diff --git a/skills/java-stellar-sdk/SKILL.md b/skills/java-stellar-sdk/SKILL.md index 56ac5d6b3..35d496e74 100644 --- a/skills/java-stellar-sdk/SKILL.md +++ b/skills/java-stellar-sdk/SKILL.md @@ -22,14 +22,14 @@ Maven: network.lightsail stellar-sdk - 3.0.0 + 3.1.0 ``` Gradle: ```groovy -implementation 'network.lightsail:stellar-sdk:3.0.0' +implementation 'network.lightsail:stellar-sdk:3.1.0' ``` ## Import style diff --git a/skills/java-stellar-sdk/references/quickstart.md b/skills/java-stellar-sdk/references/quickstart.md index bc93e287b..a1b665bb8 100644 --- a/skills/java-stellar-sdk/references/quickstart.md +++ b/skills/java-stellar-sdk/references/quickstart.md @@ -6,7 +6,7 @@ from the environment. See `transactions.md` for the full lifecycle. ## Install (Gradle) ```groovy -implementation 'network.lightsail:stellar-sdk:3.0.0' +implementation 'network.lightsail:stellar-sdk:3.1.0' ``` ## Generate or load a keypair diff --git a/src/main/java/org/stellar/sdk/requests/RootRequestBuilder.java b/src/main/java/org/stellar/sdk/requests/RootRequestBuilder.java index ac7946d55..0c0a1fb23 100644 --- a/src/main/java/org/stellar/sdk/requests/RootRequestBuilder.java +++ b/src/main/java/org/stellar/sdk/requests/RootRequestBuilder.java @@ -9,7 +9,7 @@ /** Builds requests connected to root. */ public class RootRequestBuilder extends RequestBuilder { public RootRequestBuilder(OkHttpClient httpClient, HttpUrl serverURI) { - super(httpClient, serverURI, "/"); + super(httpClient, serverURI, null); } /** diff --git a/src/test/java/org/stellar/sdk/requests/RootRequestBuilderTest.java b/src/test/java/org/stellar/sdk/requests/RootRequestBuilderTest.java new file mode 100644 index 000000000..798039d01 --- /dev/null +++ b/src/test/java/org/stellar/sdk/requests/RootRequestBuilderTest.java @@ -0,0 +1,45 @@ +package org.stellar.sdk.requests; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; + +import java.io.IOException; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import okhttp3.mockwebserver.RecordedRequest; +import org.junit.Test; +import org.stellar.sdk.Server; +import org.stellar.sdk.exception.BadRequestException; + +public class RootRequestBuilderTest { + @Test + public void testRoot() { + Server server = new Server("https://horizon-testnet.stellar.org"); + + assertEquals("https://horizon-testnet.stellar.org/", server.root().buildUri().toString()); + + server.close(); + } + + @Test + public void testRootRequestPath() throws IOException, InterruptedException { + MockWebServer mockWebServer = new MockWebServer(); + mockWebServer.enqueue(new MockResponse().setResponseCode(404)); + mockWebServer.start(); + Server server = new Server(mockWebServer.url("").toString()); + + try { + server.root().execute(); + fail("expected root request to return 404"); + } catch (BadRequestException e) { + assertEquals(404, e.getCode().intValue()); + + RecordedRequest request = mockWebServer.takeRequest(); + assertEquals("GET", request.getMethod()); + assertEquals("/", request.getPath()); + } finally { + server.close(); + mockWebServer.shutdown(); + } + } +}