An example ERC-20 swap application built on Next.js with 0x Swap API and ConnectKit.
- Setup the required API keys
API Keys | Description | Code |
---|---|---|
alchemyId | Alchemy API key (create one here) | Add here |
walletConnectProjectId | WalletConnect's SDK to help with connecting wallets (create one here) | Add here |
0x | 0x API key (create one here) | Add for /price here and for /quote here |
- Install project dependencies
npm install connectkit wagmi viem fs net tls
- Start the Next.js development server
yarn
yarn run dev
- Navigate to http://localhost:3000
open http://localhost:3000
๐ฅ Watch this video for an walk-through of this app.
- ๐ Swap API Docs: https://0x.org/docs/0x-swap-api/introduction
- Quote API Endpoint: https://0x.org/docs/0x-swap-api/api-references/get-swap-v1-quote
- Price API Endpoint: https://0x.org/docs/0x-swap-api/api-references/get-swap-v1-price
- โ๏ธ Swap API Endpoints on All Networks: https://0x.org/docs/introduction/0x-cheat-sheet