Skip to content

Add Turnkey swap APIs and example for executing swaps - #1447

Merged
Bijan-Massoumi merged 1 commit into
mainfrom
codex/execute-swap-example
Aug 11, 2026
Merged

Add Turnkey swap APIs and example for executing swaps#1447
Bijan-Massoumi merged 1 commit into
mainfrom
codex/execute-swap-example

Conversation

@Bijan-Massoumi

Copy link
Copy Markdown
Contributor

Summary & Motivation

Turnkey now exposes first-party swap APIs (quote, execute, status, config). This PR syncs that surface into the SDK packages and adds a runnable example that quotes a swap, submits executeSwap, then polls getSwapStatus until completion.

Swagger/types were updated from mono for the swap endpoints (including required walletAccount on getSwapQuote). High-level clients in @turnkey/http, @turnkey/sdk-server, @turnkey/sdk-browser, @turnkey/sdk-types, and @turnkey/core were regenerated so callers can use the new methods without hand-rolling requests.

The example (examples/defi/execute-swap) is configured via env for CAIP-19 FROM_TOKEN / TO_TOKEN, base-unit AMOUNT, and wallet/SIGN_WITH, so the same flow can cover Solana SOL↔USDC (and other supported pairs) without code changes.

How I Tested These Changes

  • Regenerated package clients via pnpm --filter @turnkey/{sdk-server,sdk-browser,sdk-types,core} codegen
  • Typechecked: @turnkey/http, @turnkey/sdk-types, @turnkey/sdk-server, @turnkey/sdk-browser, @turnkey/core, and @turnkey/example-execute-swap
  • Ran examples/defi/execute-swap against preprod:
    • Solana mainnet SOL → USDC via getSwapQuoteexecuteSwapgetSwapStatus
    • Confirmed status progressed PENDINGCOMPLETED with an origin tx on Solscan
    • Required feature flags on the test org: FEATURE_FLAG_SWAP, FEATURE_FLAG_SOL_SEND_TRANSACTION

Did you add a changeset?

Yes. .changeset/execute-swap-apis.md (minor) for:

  • @turnkey/http
  • @turnkey/sdk-server
  • @turnkey/sdk-browser
  • @turnkey/sdk-types
  • @turnkey/core

@codesandbox-ci

codesandbox-ci Bot commented Jul 22, 2026

Copy link
Copy Markdown

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit de1d086:

Sandbox Source
@turnkey/example-react-components Configuration

@DeRauk

DeRauk commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

@Bijan-Massoumi Could you add a readme, like we have with the other examples? And could you make sure we put in the readme that this is in closed beta right now?

@moe-dev
moe-dev force-pushed the codex/execute-swap-example branch 3 times, most recently from 9a299a9 to eb8f15a Compare August 6, 2026 19:48
@Bijan-Massoumi
Bijan-Massoumi force-pushed the codex/execute-swap-example branch from d9d0ae7 to de1d086 Compare August 11, 2026 17:50
@Bijan-Massoumi
Bijan-Massoumi merged commit c97920c into main Aug 11, 2026
7 checks passed
@Bijan-Massoumi
Bijan-Massoumi deleted the codex/execute-swap-example branch August 11, 2026 20:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants