Swap
The Swap component provides a complete interface for token swapping using the Jupiter API.
Installation
1. Install Dependencies
Swap requires Solana Wallet Adapter and must be wrapped in Connection and Wallet provider components.
2. Install @solana/web3.js and @solana/spl-token
Swap requires @solana/web3.js and @solana/spl-token
3. Install SolanaUI TokenInput
Swap requires the TokenInput
component. Copy the code below to src/components/sol/token-input.tsx
.
4. Install SolanaUI TxnSettings
Swap requires the TxnSettings
component. Copy the code below to src/components/sol/txn-settings.tsx
.
5. Install SolanaUI TxnToast
Swap requires the TxnToast
component. Copy the code below to src/components/sol/txn-toast.tsx
.
6. Install SolanaUI Swap
Copy the code below to src/components/sol/swap.tsx
.
7. Use Swap
Import the Swap
component and use it in your app.