Skip to content

Fix/sdk issues 1359 1362 - #1398

Open
Mosas2000 wants to merge 4 commits into
Epta-Node:mainfrom
Mosas2000:fix/sdk-issues-1359-1362
Open

Fix/sdk issues 1359 1362#1398
Mosas2000 wants to merge 4 commits into
Epta-Node:mainfrom
Mosas2000:fix/sdk-issues-1359-1362

Conversation

@Mosas2000

Copy link
Copy Markdown
Contributor

Summary

This PR addresses and resolves four SDK open-source issues (#1359, #1360, #1361, #1362) to improve error handling clarity, request performance, Stellar classic-account support, and contract version compatibility checking.

Closes #1359
Closes #1360
Closes #1361
Closes #1362


Detailed Changes

1. Fix SDK read path error ambiguity (#1359)

  • Introduced ReadResult<T> discriminated union type ({ ok: true, value: T } | { ok: true, value: null, absent: true } | { ok: false, error: LinkoraError }) in errors.ts.
  • Added executeReadResult<T>() helper to LinkoraClient.
  • Fixed read methods (getDmKey, getTreasury, getPool, getProfile, getPost) so that NotFoundError cleanly maps to null (absent), while network/RPC transport errors (NetworkError, SimulationError) throw typed errors rather than swallowing failures into bare null.

2. Single rpc.Server reuse & batch simulation (#1360)

  • Reused a single client-wide _rpcServer: rpc.Server instance inside LinkoraClient and ConnectionHealthMonitor to eliminate per-call server allocation overhead.
  • Exposed batchSimulate(ops) on LinkoraClient to coalesce multiple contract read/simulate operations into a single multi-op simulation RPC roundtrip.

3. Classic account & Horizon SDK surface (#1361)

  • Added ClassicAccountClient in classic.ts with network URL resolution (resolveHorizonUrl) honoring networkPassphrase, horizonUrl, and allowHttp.
  • Exposed classic client instance as well as getClassicAccountBalances and getClassicAccountTrustlines on LinkoraClient.
  • Routed apps/web/src/hooks/useTokenBalances.ts through the SDK classic account helper instead of using hardcoded testnet endpoints.

4. Contract version & capability verification (#1362)

  • Added VersionMismatchError to errors.ts.
  • Added getContractVersion() and verifyContractVersion(expectedVersion) methods to LinkoraClient and the code generation script (packages/codegen/generate.ts).
  • Ensures contract version drift produces a clear, descriptive error prior to method execution.

Verification & Testing

  • Executed full SDK test suite: 17 test suites passed, 189 total unit tests passing.
  • Added dedicated test coverage:
    • src/__tests__/read.test.ts: Verified distinguishable handling for value present, absent (NotFoundError), and network failure.
    • src/__tests__/batch.test.ts: Verified rpc.Server instantiation reuse and batchSimulate execution.
    • src/__tests__/classic.test.ts: Verified Horizon URL resolution and balance/trustline parsing.
    • src/__tests__/version.test.ts: Verified version retrieval and VersionMismatchError on version drift.

@drips-wave

drips-wave Bot commented Aug 28, 2026

Copy link
Copy Markdown

@Mosas2000 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@vercel

vercel Bot commented Aug 28, 2026

Copy link
Copy Markdown

@Mosas2000 is attempting to deploy a commit to the Jaja's projects Team on Vercel.

A member of the Team first needs to authorize it.

@devJaja

devJaja commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

@Mosas2000
Resolve the conflicts please

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment