Recipe 17 — Idempotent retry pattern for swaps
Status: ✅ runnable SDK surface:
client.swap.execute(idempotency_key=...)(caller-supplied) Server endpoint:POST /v1/swap/execute+X-Idempotency-Keyheader
The SDK auto-generates a fresh UUIDv4 idempotency key per call, but for cross-process retries (e.g. a worker restart between issuing the call and receiving the response) you need a stable, caller-owned key so the server can deduplicate. This recipe shows the pattern.
PYTHONPATH=packages/sdk-py/src python cookbook/recipes/17-idempotent-swap-retry/python_example.py
npx tsx cookbook/recipes/17-idempotent-swap-retry/typescript_example.ts