Fix/sdk issues 1359 1362 - #1398
Open
Mosas2000 wants to merge 4 commits into
Open
Conversation
|
@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! 🚀 |
|
@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. |
Contributor
|
@Mosas2000 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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)
ReadResult<T>discriminated union type ({ ok: true, value: T } | { ok: true, value: null, absent: true } | { ok: false, error: LinkoraError }) inerrors.ts.executeReadResult<T>()helper toLinkoraClient.getDmKey,getTreasury,getPool,getProfile,getPost) so thatNotFoundErrorcleanly maps tonull(absent), while network/RPC transport errors (NetworkError,SimulationError) throw typed errors rather than swallowing failures into barenull.2. Single rpc.Server reuse & batch simulation (#1360)
_rpcServer: rpc.Serverinstance insideLinkoraClientandConnectionHealthMonitorto eliminate per-call server allocation overhead.batchSimulate(ops)onLinkoraClientto coalesce multiple contract read/simulate operations into a single multi-op simulation RPC roundtrip.3. Classic account & Horizon SDK surface (#1361)
ClassicAccountClientinclassic.tswith network URL resolution (resolveHorizonUrl) honoringnetworkPassphrase,horizonUrl, andallowHttp.classicclient instance as well asgetClassicAccountBalancesandgetClassicAccountTrustlinesonLinkoraClient.apps/web/src/hooks/useTokenBalances.tsthrough the SDK classic account helper instead of using hardcoded testnet endpoints.4. Contract version & capability verification (#1362)
VersionMismatchErrortoerrors.ts.getContractVersion()andverifyContractVersion(expectedVersion)methods toLinkoraClientand the code generation script (packages/codegen/generate.ts).Verification & Testing
src/__tests__/read.test.ts: Verified distinguishable handling for value present, absent (NotFoundError), and network failure.src/__tests__/batch.test.ts: Verifiedrpc.Serverinstantiation reuse andbatchSimulateexecution.src/__tests__/classic.test.ts: Verified Horizon URL resolution and balance/trustline parsing.src/__tests__/version.test.ts: Verified version retrieval andVersionMismatchErroron version drift.