Skip to content

0xProject/token-swap-dapp-course-code

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Token Swapping in DeFi Applications

An example ERC-20 swap application built on Next.js App Router with 0x Swap API and RainbowKit.

Swap API enables your users to easily and conveniently trade tokens at the best prices directly in your app. With one simple integration, 0x unlocks thousands of tokens on the most popular blockchains and aggregated liquidity from 100+ AMMs and professional market makers.

This demo app covers best practices for how to use the 0x Swap API's /price endpoint for indicative pricing and the /quote endpoint for firm quotes.

Warning

This is a demo, and is not ready for production use. The code has not been audited and does not account for all error handling. Use at your own risk.

Screenshot 2024-04-19 at 1 59 24 PM

Getting Started

  1. Setup the required API keys
API Keys Description Code
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
  1. Install project dependencies
npm install
  1. Start the Next.js development server
npm run dev
  1. Navigate to http://localhost:3000
open http://localhost:3000

Supported Networks

Swap API is supported on the following chains. Access liquidity from the chain you want by using the corresponding chain URI when making a request:

Read more accessing the API endpoints.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published