Overview
Jupiter is Solana’s leading liquidity aggregator, enabling users to execute optimal token swaps across multiple DEXs through its Ultra API. This cookbook shows how to integrate Turnkey wallets with Jupiter Ultra Swap using thewith-jupiter
example.You’ll learn how to authenticate with Turnkey, load a wallet, and use it to create, sign, and send Solana swap transactions directly through the Jupiter API.
Getting started
Before you begin, make sure you’ve followed the Turnkey Quickstart guide.You should have:
- A Turnkey organization and Auth Proxy Config ID
- An account funded with SOL and optionally USDC
- Access to the Jupiter API (Ultra API)
- Access to a Solana RPC Provider (e.g.,
https://solana-rpc.publicnode.com
)
Install dependencies
Setting up the Turnkey wallet
We’ll use the @turnkey/react-wallet-kit package to authenticate and manage a wallet session.Fetching a swap quote from Jupiter Ultra
You can query Jupiter’s Ultra API for a swap quote between two tokens.Creating and executing a swap transaction
Once you’ve selected a quote, you can request a transaction from Jupiter and sign it using your Turnkey signer.Putting it all together
Here’s an example component that performs a USDC → SOL swap.Checking balances
You can fetch a user’s token balances directly from the Jupiter Ultra API.Summary
✅ You’ve now learned how to:- Authenticate a user with Turnkey
- Use a TurnkeySigner to sign Solana transactions
- Interact with Jupiter Ultra API for token swaps
- Retrieve balances and verify swap transactions on Solscan