Summary
Two copy-paste errors in the SDK docs cause every new integrator to write broken code. The executeSwapQuote README example checks for progress.step === "deposit", but the SwapTransactionProgress union type (executeSwapQuote.ts) defines steps "approve", "swap", and "fill" — there is no "deposit" step in the swap flow. Separately, the getSwapQuote JSDoc example (which propagates to docs/classes/AcrossClient.md) passes route fields (originChainId, destinationChainId, inputToken, outputToken) at the top level, but GetSwapQuoteParams requires them nested inside a route sub-object.
What I observed
Bug 1 — packages/sdk/README.md L104
// README example for executeSwapQuote onProgress callback
if (progress.step === "deposit" && progress.status === "txSuccess") {
// once deposit is successful you have access to depositId and the receipt
const { depositId, txReceipt } = progress;
}
SwapTransactionProgress (src/actions/executeSwapQuote.ts) defines steps "approve", "swap", and "fill" only. The branch above can never match; the correct step is "swap". The destructured txReceipt is also wrong for this step — the "swap" | txSuccess variant exposes txReceipt and depositId, but txReceipt alone is not listed at the top level.
Bug 2 — src/client.ts JSDoc for executeSwapQuote (L398–405), reflected in docs/classes/AcrossClient.md L100–107
// JSDoc example
const quote = await client.getSwapQuote({
originChainId: 1,
destinationChainId: 10,
inputToken: "0x...",
outputToken: "0x...",
amount: "10",
depositor: "0x...",
});
GetSwapQuoteParams (src/actions/getSwapQuote.ts L13–33) omits the flat chain/token fields from the top level and requires them inside a route sub-object:
export type GetSwapQuoteParams = Omit<BaseSwapQueryParams,
"amount" | "inputToken" | "outputToken" | "originChainId" | "destinationChainId" | ...
> & {
amount: Amount;
route: {
originChainId: number;
inputToken: AnyChainAddress;
destinationChainId: number;
outputToken: AnyChainAddress;
};
...
};
The example call passes originChainId etc. at the top level, which TypeScript rejects at compile time.
Impact
- Bug 1: Any integrator following the README writes an
onProgress handler that silently never fires on the swap step. If they depend on depositId being set before proceeding, their code hangs or throws a runtime error.
- Bug 2: Any integrator copy-pasting the documented
getSwapQuote example gets an immediate TypeScript type error (or silent undefined at runtime if transpiling loose), blocking them from getting a quote at all.
Both errors appear in the primary onboarding surface (README + generated API docs), so impact is highest for new users.
Suggested fix
Fix 1 — packages/sdk/README.md L104: change "deposit" to "swap".
Fix 2 — packages/sdk/src/client.ts JSDoc example (~L398–405): wrap the route fields in a route object. The generated docs will update on the next doc build.
// corrected JSDoc example
const quote = await client.getSwapQuote({
route: {
originChainId: 1,
destinationChainId: 10,
inputToken: "0x...",
outputToken: "0x...",
},
amount: "10",
depositor: "0x...",
});
Notes
The executeQuote flow (non-swap) correctly uses step: "deposit" (src/actions/executeQuote.ts), so the README example appears to have been copied from the non-swap path without updating the step name. The fix is independent of any runtime changes.
Summary
Two copy-paste errors in the SDK docs cause every new integrator to write broken code. The
executeSwapQuoteREADME example checks forprogress.step === "deposit", but theSwapTransactionProgressunion type (executeSwapQuote.ts) defines steps"approve","swap", and"fill"— there is no"deposit"step in the swap flow. Separately, thegetSwapQuoteJSDoc example (which propagates todocs/classes/AcrossClient.md) passes route fields (originChainId,destinationChainId,inputToken,outputToken) at the top level, butGetSwapQuoteParamsrequires them nested inside aroutesub-object.What I observed
Bug 1 —
packages/sdk/README.mdL104SwapTransactionProgress(src/actions/executeSwapQuote.ts) defines steps"approve","swap", and"fill"only. The branch above can never match; the correct step is"swap". The destructuredtxReceiptis also wrong for this step — the"swap" | txSuccessvariant exposestxReceiptanddepositId, buttxReceiptalone is not listed at the top level.Bug 2 —
src/client.tsJSDoc forexecuteSwapQuote(L398–405), reflected indocs/classes/AcrossClient.mdL100–107GetSwapQuoteParams(src/actions/getSwapQuote.tsL13–33) omits the flat chain/token fields from the top level and requires them inside aroutesub-object:The example call passes
originChainIdetc. at the top level, which TypeScript rejects at compile time.Impact
onProgresshandler that silently never fires on the swap step. If they depend ondepositIdbeing set before proceeding, their code hangs or throws a runtime error.getSwapQuoteexample gets an immediate TypeScript type error (or silent undefined at runtime if transpiling loose), blocking them from getting a quote at all.Both errors appear in the primary onboarding surface (README + generated API docs), so impact is highest for new users.
Suggested fix
Fix 1 —
packages/sdk/README.mdL104: change"deposit"to"swap".Fix 2 —
packages/sdk/src/client.tsJSDoc example (~L398–405): wrap the route fields in arouteobject. The generated docs will update on the next doc build.Notes
The
executeQuoteflow (non-swap) correctly usesstep: "deposit"(src/actions/executeQuote.ts), so the README example appears to have been copied from the non-swap path without updating the step name. The fix is independent of any runtime changes.