Skip to content

feat: Soroban RPC read client (/api/v1/chain) - #17

Merged
james2177 merged 3 commits into
mainfrom
feat/soroban-rpc-client
Jul 13, 2026
Merged

feat: Soroban RPC read client (/api/v1/chain)#17
james2177 merged 3 commits into
mainfrom
feat/soroban-rpc-client

Conversation

@james2177

Copy link
Copy Markdown
Contributor

Summary

First slice of the on-chain integration roadmap item — read-only Soroban RPC access, no writes/transaction submission yet:

  • SorobanService — injectable wrapper around @stellar/stellar-sdk's SorobanRpc.Server, reading the RPC URL from ConfigService (stellar.sorobanRpcUrl, already validated/defaulted since the config module PR). Methods: getHealth, getLatestLedger, getNetwork, getAccount.
  • SorobanControllerGET /api/v1/chain/health, /ledger, /network, /account/:publicKey.
  • README updates: documents the new endpoints, marks "Soroban RPC reads" done on the roadmap, on-chain writes still pending.

Test plan

  • npm run typecheck / lint / build / test / test:e2e all pass (23 e2e + 18 unit, confirms SorobanService's constructor makes no network calls, so e2e tests stay fast/offline-safe)
  • Verified against the real Stellar testnet, not mocked — hit all four live endpoints through the running app:
    • /health, /network, /ledger → real current testnet data
    • /account/:publicKey with a well-formed key → real account sequence number
    • Malformed key → SDK's raw "invalid encoded string" error, correctly caught by the existing global exception filter, logged via winston, returned as a 500. No key-format validation yet — acceptable for a read-only first slice, noted for follow-up.
  • Note: the sandbox's network to soroban-testnet.stellar.org is occasionally slow/flaky (same as Docker Hub was in the Dockerfile PR) but consistently reachable on retry; real users won't see this.

First slice of the on-chain integration roadmap item: an injectable
service wrapping @stellar/stellar-sdk's SorobanRpc.Server, reading
the RPC URL from ConfigService (stellar.sorobanRpcUrl, already
validated/defaulted since the config module PR). Exposes read-only
methods: getHealth, getLatestLedger, getNetwork, getAccount. No
write/submit methods yet - this is explicitly read-only per the
roadmap item's scope.

Wired into AppModule; no HTTP surface yet (next commit).

Verified against the real Stellar testnet Soroban RPC (not mocked):
getHealth, getLatestLedger, and getNetwork all returned real,
correctly-shaped responses from https://soroban-testnet.stellar.org
via a throwaway script, not committed. The RPC endpoint is
occasionally slow/flaky from this sandbox (same as Docker Hub pulls
in the Dockerfile PR) but consistently reachable on retry.
Adds SorobanController: GET /api/v1/chain/health, /ledger, /network,
/account/:publicKey - all backed by the real SorobanService added in
the previous commit.

Verified against the real Stellar testnet through the live app (not
mocked): all three no-arg routes returned real testnet data, and
GET /account/:publicKey with a real (if arbitrary) well-formed
public key returned that account's real sequence number. Also
checked the honest failure path: a malformed public key throws the
SDK's raw "invalid encoded string" error, which the existing global
exception filter correctly catches, logs, and returns as a 500 -
no special key-format validation yet, which is fine for this
read-only first slice but worth knowing about.
@james2177
james2177 merged commit 4243090 into main Jul 13, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant