Integration
To integrate the on-ramp and swap to a custom token, follow these steps:1
Connect with Web SDK
Make sure you completed the Getting Started guide.
2
On ramp to a supported token
Complete the On-ramp guide
3
Update state after on-ramp is successful
After the on-ramp is successful, we can use the
onOrderSuccessful
callback to update the state of the app.4
Swap to a custom token with Smart Swaps
Once the on-ramp is successful, we can use the
useSwapModal
hook to swap the purchased token to your own custom token.It will take a few minutes (1-3 minutes) for the on-ramped token to be available in the smart wallet so make sure to check the balance before opening the swap modal.
If you have enough balance of a supported payment token, the modal will display it as a payment option, you don’t need to specify a payment token.Make sure your custom token has enough liquidity on the chain you are executing the swap on.