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 @@ -3,6 +3,7 @@
## Pending

### Update
- fix: make `RootRequestBuilder` request the Horizon root endpoint as `/` instead of the percent-encoded `/%2F` path.
- 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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand Down
45 changes: 45 additions & 0 deletions src/test/java/org/stellar/sdk/requests/RootRequestBuilderTest.java
Original file line number Diff line number Diff line change
@@ -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();
}
}
}
Loading