chore: move skill file to skills/soroswap-sdk/SKILL.md for agent skills CLI discovery#10
chore: move skill file to skills/soroswap-sdk/SKILL.md for agent skills CLI discovery#10miguelnietoa wants to merge 1 commit into
Conversation
… discovery The skills CLI (npx skills) only auto-detects files named SKILL.md, so the skill was not installable from this repo. Content is unchanged; a stub is left at the old path so existing links keep working. Closes soroswap#9
📝 WalkthroughWalkthroughThis PR reorganizes Soroswap SDK documentation to meet the ChangesSDK Documentation and Skill Registration
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@skills/soroswap-sdk/SKILL.md`:
- Around line 96-139: The sdk.send call is using three arguments but the method
signature only accepts (xdr, network); update calls to sdk.send so they pass
only the signed XDR and the SupportedNetworks enum (remove the extraneous
boolean). Locate the send invocation(s) (symbol: sdk.send) in the sample and
replace sdk.send(signedXdr, false, SupportedNetworks.MAINNET) with a
two-argument call sdk.send(signedXdr, SupportedNetworks.MAINNET) (and do the
same for the earlier duplicate instance mentioned).
- Line 70: Update the three incorrect calls to sdk.send in the Backend Signing
example, Full Swap Flow example, and Express backend example to match the actual
signature send(xdr: string, network?: SupportedNetworks): remove the extraneous
middle boolean argument (the `false`) so each call becomes
sdk.send(transaction.toXDR(), SupportedNetworks.MAINNET) or sdk.send(xdr) as
appropriate; verify the examples around the Backend Signing, Full Swap Flow and
Express backend sections use the two-parameter form consistent with the Quick
Reference entry send(xdr, network?).
- Around line 398-429: The sdk.send(...) invocation incorrectly passes a third
boolean argument; update the call to match the sdk.send signature by removing
the extraneous false argument from the sdk.send(signedXdr, false) call
(referencing the sdk.send function) or, if you need to specify network, pass it
using the supported parameter shape for SoroswapSDK.send rather than adding a
third positional boolean; edit the example in SKILL.md where sdk.send is used to
either call sdk.send(signedXdr) or the proper form that accepts an explicit
network option.
- Around line 56-71: The SKILL.md example passes an extra boolean to sdk.send
which doesn't match the method signature; update the example calls to sdk.send
to only pass the XDR string and optional network enum (e.g.,
sdk.send(transaction.toXDR(), SupportedNetworks.MAINNET)), and apply the same
change to the Express example so both use the correct signature; locate
references to sdk.send, TransactionBuilder.fromXDR, Keypair.fromSecret, and
transaction.sign in the markdown to make the edits.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 03173076-f00b-414c-b72e-4621fea89f52
📒 Files selected for processing (2)
skills/soroswap-sdk/SKILL.mdsoroswap-sdk-skill.md
|
|
||
| For scripts, bots, or server-side execution where you control the signing key: | ||
|
|
||
| ```typescript | ||
| import { Keypair, Networks, Transaction, TransactionBuilder } from "@stellar/stellar-sdk"; | ||
|
|
||
| // After receiving XDR from any SDK method: | ||
| const transaction = TransactionBuilder.fromXDR( | ||
| response.xdr, | ||
| Networks.PUBLIC // or Networks.TESTNET | ||
| ) as Transaction; | ||
|
|
||
| transaction.sign(Keypair.fromSecret(process.env.STELLAR_SECRET_KEY as string)); | ||
|
|
||
| const result = await sdk.send(transaction.toXDR(), false, SupportedNetworks.MAINNET); | ||
| ``` |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Search for the send method signature in the SDK source
rg -nP --type=ts -C3 'async\s+send\s*\(' src/Repository: soroswap/sdk
Length of output: 548
Fix incorrect sdk.send() arguments in SKILL.md example
The SDK method signature is async send(xdr: string, network?: SupportedNetworks), but the example calls sdk.send(transaction.toXDR(), false, SupportedNetworks.MAINNET), passing an extra false argument that doesn’t belong to the method and will break/cause type errors for anyone copy-pasting.
🐛 Proposed fix
-const result = await sdk.send(transaction.toXDR(), false, SupportedNetworks.MAINNET);
+const result = await sdk.send(transaction.toXDR(), SupportedNetworks.MAINNET);Also ensure the Express example uses the same sdk.send(xdr, network?) calling convention.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@skills/soroswap-sdk/SKILL.md` around lines 56 - 71, The SKILL.md example
passes an extra boolean to sdk.send which doesn't match the method signature;
update the example calls to sdk.send to only pass the XDR string and optional
network enum (e.g., sdk.send(transaction.toXDR(), SupportedNetworks.MAINNET)),
and apply the same change to the Express example so both use the correct
signature; locate references to sdk.send, TransactionBuilder.fromXDR,
Keypair.fromSecret, and transaction.sign in the markdown to make the edits.
|
|
||
| transaction.sign(Keypair.fromSecret(process.env.STELLAR_SECRET_KEY as string)); | ||
|
|
||
| const result = await sdk.send(transaction.toXDR(), false, SupportedNetworks.MAINNET); |
There was a problem hiding this comment.
Three instances of incorrect sdk.send() signature across the file.
Lines 70, 134, and 426 all call sdk.send() with an invalid middle parameter. The actual signature is send(xdr: string, network?: SupportedNetworks) (two parameters), but these examples pass three arguments. The false parameter in the middle position does not exist and will cause type errors.
This affects the Backend Signing example (line 70), the Full Swap Flow example (line 134), and the Express backend example (line 426).
The Quick Reference table at line 340 correctly documents the signature as send(xdr, network?).
🐛 Proposed fixes for all three instances
Line 70:
-const result = await sdk.send(transaction.toXDR(), false, SupportedNetworks.MAINNET);
+const result = await sdk.send(transaction.toXDR(), SupportedNetworks.MAINNET);Line 134:
-const result = await sdk.send(signedXdr, false, SupportedNetworks.MAINNET);
+const result = await sdk.send(signedXdr, SupportedNetworks.MAINNET);Line 426:
- const result = await sdk.send(signedXdr, false);
+ const result = await sdk.send(signedXdr);📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| const result = await sdk.send(transaction.toXDR(), false, SupportedNetworks.MAINNET); | |
| const result = await sdk.send(transaction.toXDR(), SupportedNetworks.MAINNET); |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@skills/soroswap-sdk/SKILL.md` at line 70, Update the three incorrect calls to
sdk.send in the Backend Signing example, Full Swap Flow example, and Express
backend example to match the actual signature send(xdr: string, network?:
SupportedNetworks): remove the extraneous middle boolean argument (the `false`)
so each call becomes sdk.send(transaction.toXDR(), SupportedNetworks.MAINNET) or
sdk.send(xdr) as appropriate; verify the examples around the Backend Signing,
Full Swap Flow and Express backend sections use the two-parameter form
consistent with the Quick Reference entry send(xdr, network?).
| ```typescript | ||
| import { | ||
| SoroswapSDK, | ||
| QuoteRequest, | ||
| BuildQuoteRequest, | ||
| TradeType, | ||
| SupportedNetworks, | ||
| SupportedProtocols, | ||
| } from "@soroswap/sdk"; | ||
|
|
||
| // 1. Get a quote | ||
| const quoteRequest: QuoteRequest = { | ||
| assetIn: "CCW67TSZV3SSS2HXMBQ5JFGCKJNXKZM7UQUWUZPUTHXSTZLEO7SJMI75", // USDC contract | ||
| assetOut: "CAS3J7GYLGXMF6TDJBBYYSE3HQ6BBSMLNUQ34T6TZMYMW2EVH34XOWMA", // XLM contract | ||
| amount: 1000000000n, // 100 USDC (7 decimals) - MUST be BigInt | ||
| tradeType: TradeType.EXACT_IN, // or TradeType.EXACT_OUT | ||
| protocols: [SupportedProtocols.SOROSWAP, SupportedProtocols.AQUA], | ||
| slippageBps: 50, // 0.5% slippage in basis points | ||
| maxHops: 2, // Optional: max routing hops | ||
| }; | ||
|
|
||
| const quote = await sdk.quote(quoteRequest, SupportedNetworks.MAINNET); | ||
| // quote.amountIn, quote.amountOut, quote.priceImpactPct, quote.routePlan | ||
|
|
||
| // 2. Build transaction XDR from quote | ||
| const buildRequest: BuildQuoteRequest = { | ||
| quote, | ||
| from: "GXXXXXXX...", // Sender wallet address | ||
| to: "GXXXXXXX...", // Optional: recipient (defaults to 'from') | ||
| }; | ||
|
|
||
| const buildResponse = await sdk.build(buildRequest, SupportedNetworks.MAINNET); | ||
| // buildResponse.xdr - unsigned transaction XDR | ||
|
|
||
| // 3. Sign the XDR (see Transaction Signing section above) | ||
| const signedXdr = signTransaction(buildResponse.xdr); | ||
|
|
||
| // 4. Send signed transaction | ||
| const result = await sdk.send(signedXdr, false, SupportedNetworks.MAINNET); | ||
|
|
||
| if (result.success && result.result?.type === "swap") { | ||
| console.log(`Swapped ${result.result.amountIn} for ${result.result.amountOut}`); | ||
| } | ||
| ``` |
There was a problem hiding this comment.
Fix incorrect parameter count in sdk.send() call.
Line 134 has the same issue as line 70: sdk.send() only accepts two parameters (xdr and optional network), not three. The false parameter should be removed.
🐛 Proposed fix
-const result = await sdk.send(signedXdr, false, SupportedNetworks.MAINNET);
+const result = await sdk.send(signedXdr, SupportedNetworks.MAINNET);📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| ```typescript | |
| import { | |
| SoroswapSDK, | |
| QuoteRequest, | |
| BuildQuoteRequest, | |
| TradeType, | |
| SupportedNetworks, | |
| SupportedProtocols, | |
| } from "@soroswap/sdk"; | |
| // 1. Get a quote | |
| const quoteRequest: QuoteRequest = { | |
| assetIn: "CCW67TSZV3SSS2HXMBQ5JFGCKJNXKZM7UQUWUZPUTHXSTZLEO7SJMI75", // USDC contract | |
| assetOut: "CAS3J7GYLGXMF6TDJBBYYSE3HQ6BBSMLNUQ34T6TZMYMW2EVH34XOWMA", // XLM contract | |
| amount: 1000000000n, // 100 USDC (7 decimals) - MUST be BigInt | |
| tradeType: TradeType.EXACT_IN, // or TradeType.EXACT_OUT | |
| protocols: [SupportedProtocols.SOROSWAP, SupportedProtocols.AQUA], | |
| slippageBps: 50, // 0.5% slippage in basis points | |
| maxHops: 2, // Optional: max routing hops | |
| }; | |
| const quote = await sdk.quote(quoteRequest, SupportedNetworks.MAINNET); | |
| // quote.amountIn, quote.amountOut, quote.priceImpactPct, quote.routePlan | |
| // 2. Build transaction XDR from quote | |
| const buildRequest: BuildQuoteRequest = { | |
| quote, | |
| from: "GXXXXXXX...", // Sender wallet address | |
| to: "GXXXXXXX...", // Optional: recipient (defaults to 'from') | |
| }; | |
| const buildResponse = await sdk.build(buildRequest, SupportedNetworks.MAINNET); | |
| // buildResponse.xdr - unsigned transaction XDR | |
| // 3. Sign the XDR (see Transaction Signing section above) | |
| const signedXdr = signTransaction(buildResponse.xdr); | |
| // 4. Send signed transaction | |
| const result = await sdk.send(signedXdr, false, SupportedNetworks.MAINNET); | |
| if (result.success && result.result?.type === "swap") { | |
| console.log(`Swapped ${result.result.amountIn} for ${result.result.amountOut}`); | |
| } | |
| ``` |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@skills/soroswap-sdk/SKILL.md` around lines 96 - 139, The sdk.send call is
using three arguments but the method signature only accepts (xdr, network);
update calls to sdk.send so they pass only the signed XDR and the
SupportedNetworks enum (remove the extraneous boolean). Locate the send
invocation(s) (symbol: sdk.send) in the sample and replace sdk.send(signedXdr,
false, SupportedNetworks.MAINNET) with a two-argument call sdk.send(signedXdr,
SupportedNetworks.MAINNET) (and do the same for the earlier duplicate instance
mentioned).
| ### Express.js Backend Example | ||
|
|
||
| ```typescript | ||
| import { SoroswapSDK, SupportedNetworks, TradeType, SupportedProtocols } from "@soroswap/sdk"; | ||
|
|
||
| const sdk = new SoroswapSDK({ | ||
| apiKey: process.env.SOROSWAP_API_KEY as string, | ||
| defaultNetwork: SupportedNetworks.MAINNET, | ||
| }); | ||
|
|
||
| app.post("/api/quote-and-build", async (req, res) => { | ||
| const { assetIn, assetOut, amount, walletAddress } = req.body; | ||
|
|
||
| const quote = await sdk.quote({ | ||
| assetIn, | ||
| assetOut, | ||
| amount: BigInt(amount), | ||
| tradeType: TradeType.EXACT_IN, | ||
| protocols: [SupportedProtocols.SOROSWAP, SupportedProtocols.AQUA], | ||
| }); | ||
|
|
||
| const buildResponse = await sdk.build({ quote, from: walletAddress }); | ||
|
|
||
| res.json({ quote, xdr: buildResponse.xdr }); | ||
| }); | ||
|
|
||
| app.post("/api/send-transaction", async (req, res) => { | ||
| const { signedXdr } = req.body; | ||
| const result = await sdk.send(signedXdr, false); | ||
| res.json(result); | ||
| }); | ||
| ``` |
There was a problem hiding this comment.
Fix incorrect parameter count in sdk.send() call.
Line 426 has the same issue: sdk.send() only accepts two parameters, not three. The false parameter should be removed.
🐛 Proposed fix
- const result = await sdk.send(signedXdr, false);
+ const result = await sdk.send(signedXdr);Or, if you want to specify the network explicitly:
- const result = await sdk.send(signedXdr, false);
+ const result = await sdk.send(signedXdr, SupportedNetworks.MAINNET);📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| ### Express.js Backend Example | |
| ```typescript | |
| import { SoroswapSDK, SupportedNetworks, TradeType, SupportedProtocols } from "@soroswap/sdk"; | |
| const sdk = new SoroswapSDK({ | |
| apiKey: process.env.SOROSWAP_API_KEY as string, | |
| defaultNetwork: SupportedNetworks.MAINNET, | |
| }); | |
| app.post("/api/quote-and-build", async (req, res) => { | |
| const { assetIn, assetOut, amount, walletAddress } = req.body; | |
| const quote = await sdk.quote({ | |
| assetIn, | |
| assetOut, | |
| amount: BigInt(amount), | |
| tradeType: TradeType.EXACT_IN, | |
| protocols: [SupportedProtocols.SOROSWAP, SupportedProtocols.AQUA], | |
| }); | |
| const buildResponse = await sdk.build({ quote, from: walletAddress }); | |
| res.json({ quote, xdr: buildResponse.xdr }); | |
| }); | |
| app.post("/api/send-transaction", async (req, res) => { | |
| const { signedXdr } = req.body; | |
| const result = await sdk.send(signedXdr, false); | |
| res.json(result); | |
| }); | |
| ``` | |
| ### Express.js Backend Example | |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@skills/soroswap-sdk/SKILL.md` around lines 398 - 429, The sdk.send(...)
invocation incorrectly passes a third boolean argument; update the call to match
the sdk.send signature by removing the extraneous false argument from the
sdk.send(signedXdr, false) call (referencing the sdk.send function) or, if you
need to specify network, pass it using the supported parameter shape for
SoroswapSDK.send rather than adding a third positional boolean; edit the example
in SKILL.md where sdk.send is used to either call sdk.send(signedXdr) or the
proper form that accepts an explicit network option.
Adds agent guidance (CLAUDE.md) plus six skills managed with the skills CLI: dapp, data, assets (stellar/stellar-dev-skill), soroswap-sdk (soroswap/sdk, vendored until soroswap/sdk#10 lands), vercel-react-best-practices and webapp-testing. Canonical copies live in .agents/skills/ with symlinks in .claude/skills/ so any agent can read them; versions are pinned in skills-lock.json.
Closes #9.
Moves
soroswap-sdk-skill.mdtoskills/soroswap-sdk/SKILL.mdso the skills.sh website and skills CLI can auto-detect it. Content is unchanged; the frontmatter was already valid.After this change, installation works directly:
and the skill becomes eligible for listing on skills.sh, with consumers getting version pinning in
skills-lock.jsonand update detection vianpx skills update.I left a one-line
soroswap-sdk-skill.mdstub pointing to the new path so existing links (for example the community skill card on skills.stellar.org) don't break.