Guides
Buy tokens in your DApp
Here is a step-by-step guide to integrate the widget into your dApp seamlessly. You can find the complete implementation in this repo.
- If you are creating a new repository, start by initializing a new Next.js app. If a Next.js project is already set up, you can skip this step.
- Navigate to your app directory.
- After setting up your preferences, install the required packages. You can use any package manager of your choice, such as yarn or pnpm.
- Next, define your environment variables in the
.env
file.
- Setup config for the widget.
AarcConfig.ts
- Setup your wagmi & RainbowKit.
- Create a custom provider to manage the widget’s state consistently throughout the application.
contexts/AarcProvider.tsx
- Wrap the application with the necessary provider(s).
In root component:
- Opening widget.
That’s it !
You’ve successfully integrated the widget into your dApp, enabling seamless user onboarding to purchase tokens via CEX, wallets, or fiat. Additionally, the widget supports checkout functionality, allowing you to call custom contracts on the destination chain with the specified payload.