Smart Swaps
Sequence Smart Swaps auto detects eligible currencies in the user’s wallet and swaps them to the target currency. Developers can define the target currency and Sequence will handle everything, including the UI and flow through Web SDK.
The power of smart swaps is intelligently detecting the currencies available to the user as well as batching multiple transactions together to if the user is utilizing a Sequence wallet to simplify the UX. You can say goodbye to separate approve
and transfer
transactions!
If you intend to use smart swaps with your custom token, please ensure you provide sufficient liquidity for your token (preferably USDC, USDT, or ETH) on a supported DEX such as Uniswap.
We support the following chains for swaps:
- Ethereum (Mainnet)
- Ethereum (Sepolia)
- Arbitrum
- Avalanche
- Base
- Blast
- BSC
- Optimism
- Polygon
Here are some of our supported liquidity pool providers:
UniSwap
SushiSwap
Pancake Swap
Curve
Balancer
Bancor
Synapse
Solidly
Installation and Setup
To integrate the Swap feature with Web SDK, follow these steps:
Install the @0xsequence/checkout library
Place the `SequenceCheckoutProvider` below the `SequenceConnect` Provider in your App:
Import Swap Dependencies and Logic
toTokenAddress
: The target currency address, this is the token the user will receive after the swap.toTokenAmount
: The target currency amount, this is the amount the user will receive after the swap.postSwapTransactions
: An optional array of transactions to be executed after the swap, using the swapped tokens.title
: The modal’s title.description
: A description of the swap and payment process.chainId
: The chain id of the target currency.onSuccess
: A callback function that is called when the swap is successful.
Congratulations! You’ve just learned how to use smart swaps with Web SDK.