Repository navigation
Add a client for Stellar Asset Contracts - #204
Merged
Merged
Conversation
SorobanClient::forClientOptions threw "Could not load contract info" for every Stellar Asset Contract, because a SAC has no wasm to read a spec from. The SDK also had no way to derive a SAC id from an asset. This change: - embeds the upstream SAC spec as SACSpec, generated from a pinned commit by a standard-library Python tool that checks its sha256 - adds Asset::getContractId() to derive an asset's SAC id on a given network - opens a SAC in forClientOptions with the embedded spec, and sends the same requests as before for wasm and external-reference contracts - adds SorobanClient::forSpecEntries() and a read-only mode that simulates without loading the source account and refuses to sign - adds SACClient with typed balance, transfer, transferAndSend, decimals, name and symbol, plus toBaseUnits() for decimal amounts The new SACClientTest integration class passed against testnet on 2026-11-11 (UTC).
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #204 +/- ##
============================================
+ Coverage 93.47% 93.51% +0.03%
- Complexity 21622 21684 +62
============================================
Files 1006 1007 +1
Lines 52424 52601 +177
============================================
+ Hits 49003 49189 +186
+ Misses 3421 3412 -9
🚀 New features to boost your workflow:
|
Before this change, SorobanClient::forClientOptions() read the contract instance itself, so a SorobanServer subclass that overrides loadContractInfoForContractId() was no longer called. send() submitted a read-only transaction whose signed field was set by hand. An amount error echoed its input even when the input was a secret seed. This change: - Calls the server's loader first in forClientOptions() and reads the instance only when the loader returns nothing, to open a Stellar Asset Contract with the embedded spec. - Refuses send() on a read-only transaction before any request. - Names a secret seed passed as an amount by its kind only. - Removes an error branch of transferAndSend() that polling never reaches and tests the polling error through the real path. - Fails the integration test when the network reports no protocol version, and pins the full invocation of decimals(), name() and symbol() in the unit tests. Unit suite and static analysis pass. The SACClientTest integration class passed against testnet on 2026-11-11 (UTC).
Member
|
Tank you @ngybnc! |
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.
SorobanClient::forClientOptions threw "Could not load contract info" for every Stellar Asset Contract, because a SAC has no wasm to read a spec from. The SDK also had no way to derive a SAC id from an asset.
This change:
The new SACClientTest integration class passed against testnet on 2026-11-11 (UTC).