SwapDex is a decentralized mobile application built using React Native and web3 libraries. The app enables users to swap cryptocurrencies across different networks with a seamless and efficient onboarding process. It also allows users to:
- View transaction history
- Check balances
- See the top 100 tokens
- Read the latest crypto news
The swap functionality is powered by 1inch API and Chainlink price feeds, while Alchemy is used as the RPC provider.
- Wallet connection via Reown.
- Users can select tokens to swap.
- Price feeds fetched via Chainlink.
- Allowance checking before initiating swaps.
- Users can edit slippage settings.
- Handles slippage errors and transaction failures.
- Uses ethers.js for transaction formatting.
- Converts token amounts based on decimals (e.g., 18 for ETH, varies for ERC20 tokens).
- Handles errors like exceeding API rate limits and incorrect amount conversions.
- Top UI: Displays ETH/Polygon balance and USD equivalent.
- Network switcher: Toggle between ETH and Polygon.
- Tokens Screen: View top 100 tokens.
- Latest Transactions Screen: View transaction history.
- News Screen: Displays latest crypto news.
- Transaction Hash Screen:
- Displays transaction confirmation.
- Allows users to click and view transactions on Etherscan/Polygonscan.
- Expo React Native
- WAGMI, Viem & ethers.js for onchain interactions
- Alchemy RPC Provider & Alchemy SDK
- 1inch API for swapping
- React Query (for caching and data fetching)
- Chainlink API for price feeds
- Cryptocompare API for news
- Coinranking API for the top token list
- Reown for wallet integration
- Custom Hooks for modular and reusable code
- Implemented refetch and increased request interval to prevent exceeding 1inch API limits.
- Added custom slippage settings for better user control.
- Displaying error messages in the UI instead of console logs.
- Handling high slippage errors, invalid swaps, and failed API requests.
- Improved UI/UX feedback for failed swaps.
🚀 SwapDex is designed to offer a seamless, decentralized swapping experience with reliable price feeds, secure wallet connections, and a smooth UI.
Happy swapping! 🦄💰