Add Turnkey swap APIs and example for executing swaps - #1447
Merged
Conversation
|
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:
|
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
force-pushed
the
codex/execute-swap-example
branch
3 times, most recently
from
August 6, 2026 19:48
9a299a9 to
eb8f15a
Compare
Bijan-Massoumi
force-pushed
the
codex/execute-swap-example
branch
from
August 11, 2026 17:50
d9d0ae7 to
de1d086
Compare
DeRauk
approved these changes
Aug 11, 2026
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.
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 pollsgetSwapStatusuntil completion.Swagger/types were updated from mono for the swap endpoints (including required
walletAccountongetSwapQuote). High-level clients in@turnkey/http,@turnkey/sdk-server,@turnkey/sdk-browser,@turnkey/sdk-types, and@turnkey/corewere regenerated so callers can use the new methods without hand-rolling requests.The example (
examples/defi/execute-swap) is configured via env for CAIP-19FROM_TOKEN/TO_TOKEN, base-unitAMOUNT, 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
pnpm --filter @turnkey/{sdk-server,sdk-browser,sdk-types,core} codegen@turnkey/http,@turnkey/sdk-types,@turnkey/sdk-server,@turnkey/sdk-browser,@turnkey/core, and@turnkey/example-execute-swapexamples/defi/execute-swapagainst preprod:getSwapQuote→executeSwap→getSwapStatusPENDING→COMPLETEDwith an origin tx on SolscanFEATURE_FLAG_SWAP,FEATURE_FLAG_SOL_SEND_TRANSACTIONDid 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