UIswap is a modern, user-friendly decentralized exchange (DEX) interface for swapping tokens on Ethereum and other EVM-compatible blockchains. Built with Next.js and RainbowKit, UIswap provides a clean, intuitive user interface for token swapping.
- Token Swapping: Easily swap between different tokens with a simple interface
- Wallet Integration: Connect with popular wallets via RainbowKit (MetaMask, Coinbase Wallet, etc.)
- Responsive Design: Fully responsive interface that works on desktop and mobile devices
- Frontend: Next.js 15 (App Router), React 18
- Styling: Tailwind CSS, shadcn/ui components
- Wallet Connection: wagmi
- State Management: React Context API
- Type Safety: TypeScript
- Node.js 18.x or later
- npm or yarn
- A WalletConnect Project ID (for wallet connections)
-
Clone the repository: ```bash git clone https://github.com/..../uiswap.git cd uiswap ```
-
Install dependencies: ```bash npm install
yarn install ```
-
Create a
.env.localfile in the root directory with your WalletConnect Project ID: ``` NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID=your_project_id_here ``` -
Start the development server: ```bash npm run dev
yarn dev ```
-
Open http://localhost:3000 in your browser to see the application.
uiswap/
├── app/ # Next.js App Router and client-side layouts
│ ├── layout.tsx
│ ├── page.tsx
│ ├── client-layout.tsx
│ ├── globals.css
│ ├── pair/ # Token pair pages
│ ├── pools/ # Liquidity pools page
│ └── token/ # Token detail pages
├── components/ # React components
│ ├── ui/ # UI components (shadcn/ui)
│ ├── navbar.tsx
│ ├── footer.tsx
│ ├── swap-interface.tsx
│ ├── token-selector.tsx
│ ├── token-provider.tsx
│ ├── connect-wallet-button.tsx
│ ├── settings-dialog.tsx
│ └── ... # Other components
├── config/ # Configuration files
│ └── wagmi-config.ts
├── contexts/ # React context providers
│ └── wallet-context.tsx
├── hooks/ # Custom React hooks
│ ├── use-wallet-info.ts
│ ├── use-wallet-connection.ts
│ └── use-mobile_del.tsx # Renamed from use-mobile.tsx
├── lib/ # Utility functions
│ └── utils.ts
├── public/ # Static assets (images and other assets)
│ └── ...
├── next.config.mjs
├── package.json
├── tailwind.config.ts
└── tsconfig.json
The main swap interface allows users to exchange tokens. It includes:
- Token selection
- Amount input
- Price information
- Slippage settings
- Transaction confirmation
UIswap uses wagmi for wallet connections, with a custom WalletConnectionModal supporting:
- MetaMask
- WalletConnect
- And many other popular wallets
- Create new components in the
components/directory - Add new pages in the
app/directory - Update context providers as needed
UIswap uses Tailwind CSS for styling. The main theme colors and styles are defined in:
app/globals.csstailwind.config.ts
To add new tokens, update the token list in components/token-provider.tsx.
The easiest way to deploy UIswap is using Vercel:
- Push your code to a GitHub repository
- Import the project in Vercel
- Set the environment variables (NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID)
- Deploy
You can also deploy UIswap using Docker:
-
Build the Docker image: ```bash docker build -t uiswap . ```
-
Run the container: ```bash docker run -p 3000:3000 -e NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID=your_project_id_here uiswap ```
To run the tests:
```bash npm test
yarn test ```
For testing wallet connections, you can use the following test wallets:
- MetaMask: Install the MetaMask browser extension and create a test account
- Coinbase Wallet: Install the Coinbase Wallet browser extension
- For other wallets, you can use their respective test environments
UIswap implements several security measures:
- All transactions require explicit user confirmation
- No private keys are stored in the application
- All connections are secured with HTTPS
- Smart contract interactions are validated before execution
The application is optimized for performance:
- Code splitting for faster initial load
- Dynamic imports for components
- Memoization of expensive calculations
- Optimized images and assets
- Server-side rendering where appropriate
-
Wallet Connection Issues
- Make sure your wallet is unlocked
- Check that you're on the correct network
- Try refreshing the page
-
Transaction Failures
- Ensure you have enough funds for gas
- Check slippage tolerance settings
- Verify token approvals
-
UI Display Issues
- Clear browser cache
- Try a different browser
- Check for browser extensions that might interfere
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/new-feature) - Commit your changes (
git commit -m 'Add some new feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Made with ❤️ by the GMonchain Team