Update dapp skill to JS SDK v16 (contract.Client, Node 22, pollTransaction)#43
Open
oceans404 wants to merge 3 commits into
Open
Update dapp skill to JS SDK v16 (contract.Client, Node 22, pollTransaction)#43oceans404 wants to merge 3 commits into
oceans404 wants to merge 3 commits into
Conversation
…ntent across six skills
….Client Re-grounds the SDK-mechanics sections against the official JS SDK docs (stellar.github.io/js-stellar-sdk): - Node 20+ -> Node 22+; note stellar-base folded into stellar-sdk, ESM-first, native fetch (v16 migration). - Lead smart contract invocation with the typed contract.Client (Client.from<T> -> method() -> signAndSend); demote the low-level Contract.call path to an advanced note using prepareTransaction. - Replace the unbounded getTransaction poll loop with rpc.pollTransaction. - Add rpc.queryContract / getContractMethods one-liners for reading contract state; keep manual getLedgerEntries as advanced. - Use the typed NotFoundError in the balance example and point to result codes for submission failures. - Add a sourcing note: SDK mechanics track the JS SDK docs; wallet, passkey, and relayer sections are separate packages verified against their own docs.
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the skill documentation set (primarily the dapp skill) to align Soroban/JS client patterns with @stellar/stellar-sdk v16 guidance, while also incorporating stacked documentation hygiene fixes (e.g., deduping standards references and correcting copy/paste snippet issues).
Changes:
- Refreshes
dappSDK mechanics to v16 patterns: Node 22 requirement notes,contract.Client-first invocation,prepareTransactionfor low-level paths, andrpc.pollTransactionfor bounded polling. - Fixes/modernizes copy-paste examples across skills (e.g., lazy per-network config factories, missing imports in Rust examples).
- Deduplicates/condenses large reference sections in
standardsto point to canonical guides.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| skills/standards/SKILL.md | Replaces long inlined security/tools/ecosystem catalogs with pointers and compact link lists to reduce drift. |
| skills/smart-contracts/testing.md | Adds missing IntoVal import so the auth-mocking example compiles when copied. |
| skills/smart-contracts/development.md | Adds missing symbol_short / vec imports so the data-types example compiles when copied. |
| skills/data/SKILL.md | Makes network config resolution lazy and adds an explicit unknown-network guard. |
| skills/dapp/SKILL.md | Updates SDK v16 guidance and examples (Node 22+, contract.Client, bounded polling, typed error note, read helpers). |
| skills/assets/SKILL.md | Replaces placeholder SEP snippets with accurate prose summaries + spec links. |
| skills/agentic-payments/SKILL.md | Minor wording update in troubleshooting guidance. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+95
to
+99
| horizonUrl: "https://horizon-testnet.stellar.org", | ||
| rpcUrl: "https://soroban-testnet.stellar.org", | ||
| networkPassphrase: StellarSdk.Networks.TESTNET, | ||
| friendbotUrl: "https://friendbot.stellar.org" as string | null, | ||
| }; |
| The canonical way to call a Soroban contract from JS is the `contract.Client`, not hand-built `Contract.call` + `assembleTransaction`. The client reads the contract's interface from the network, so each method is callable by name and returns an `AssembledTransaction`. You get a native JS result and don't build ScVals by hand. | ||
|
|
||
| ```typescript | ||
| import { contract, rpc, Networks } from "@stellar/stellar-sdk"; |
Comment on lines
+297
to
+309
| export async function getCounterClient( | ||
| contractId: string, | ||
| publicKey: string, | ||
| signTransaction: contract.ClientOptions["signTransaction"], | ||
| ) { | ||
| return contract.Client.from<CounterContract>({ | ||
| contractId, | ||
| rpcUrl: "https://soroban-testnet.stellar.org", | ||
| networkPassphrase: Networks.TESTNET, | ||
| publicKey, | ||
| signTransaction, | ||
| }); | ||
| } |
Comment on lines
+340
to
343
| const transaction = new StellarSdk.TransactionBuilder(account, { | ||
| fee: StellarSdk.BASE_FEE, | ||
| networkPassphrase: config.networkPassphrase, | ||
| }) |
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.
What
Re-grounds the SDK-mechanics sections of the
dappskill against the official JS SDK docs (v16), which now publishllms.txt/llms-full.txtbundles for AI tools. Several patterns in the skill had drifted from what the docs treat as canonical.Changes
engines: >=22.0.0). Added notes that@stellar/stellar-baseis folded into@stellar/stellar-sdk, the SDK is ESM-first, and it uses nativefetch.contract.Client. The docs' canonical "Invoke a Contract" guide usesClient.from<T>()→method()→signAndSend(), and callsAssembledTransactionthe "main workhorse." The skill only showed the low-levelContract.call+assembleTransactionpath. Now the typed client is primary; the low-level path is kept as an advanced note (usingprepareTransaction).while (status === "NOT_FOUND")loop withrpc.pollTransaction.rpc.queryContract/rpc.getContractMethods; kept manualgetLedgerEntriesas an advanced fallback.NotFoundErrorinstead oferror.response?.status === 404, and points to Horizon result codes for submission failures.Why
Skills are consumed by AI agents that copy examples verbatim. The old contract-invocation and polling patterns still compile but are lower-level than the docs recommend, and the Node version was factually wrong.
Notes for reviewers
fix/skill-audit-example-code-and-dedup(PR Fix example code bugs, stale link labels, and duplicated reference content #41), which also editsdapp/SKILL.mdand hasn't merged yet. Until Fix example code bugs, stale link labels, and duplicated reference content #41 merges, this PR's diff includes Fix example code bugs, stale link labels, and duplicated reference content #41's commits. Merge Fix example code bugs, stale link labels, and duplicated reference content #41 first, then this narrows to just the dapp SDK update.