A comprehensive multi-chain DeFi dashboard with full 1inch API integration, portfolio analytics, and advanced trading features.
- Connect with MetaMask, WalletConnect, Coinbase Wallet, and more via RainbowKit
- Support for Ethereum, BSC, Polygon, Arbitrum, Optimism, Base, and Linea
- Automatic network switching and detection
- Real-time balance updates across all chains
- Real-time Balance Tracking: View ETH and ERC-20 token balances with live USD values
- Portfolio Analytics: Comprehensive portfolio overview with protocol breakdown
- Interactive Charts: Portfolio value charts with multiple timeframes using Recharts
- CSV Export: Download detailed portfolio reports
- Multi-chain Aggregation: Unified view across all supported networks
- Classic Swaps: Best-rate token swaps via 1inch aggregation
- Fusion Trading: Advanced order types with better pricing
- Liquidity Sources: Access to 100+ DEXs and liquidity providers
- Gas Optimization: Intelligent gas estimation and optimization
- MEV Protection: Built-in protection against MEV attacks
- Market Analysis: Real-time spot prices and market data
- Transaction History: Detailed swap history with Etherscan links
- Price Charts: Token price charts and trends
- Protocol Breakdown: See your holdings across different DeFi protocols
- Performance Tracking: Track portfolio performance over time
- shadcn/ui Components: Modern, accessible UI components
- Responsive Design: Works perfectly on desktop and mobile
- Dark/Light Mode: Adaptive theming
- Real-time Updates: Live data without manual refresh
- Interactive Charts: Rich data visualization with Recharts
- Frontend: React 18 + TypeScript + Vite
- Wallet Integration: wagmi v2 + RainbowKit + viem
- Styling: Tailwind CSS + shadcn/ui
- Charts: Recharts for interactive data visualization
- State Management: React hooks + Zustand (for complex state)
- 1inch Classic Swap API: Token swaps and quotes
- 1inch Portfolio API v4/v5: Portfolio analytics and reporting
- 1inch Fusion API: Advanced trading features
- 1inch Spot Price API: Real-time price data
- 1inch History API: Transaction tracking
- 1inch Charts API: Price charts and market data
- 1inch NFT API: NFT portfolio tracking
- 1inch Domains API: ENS and domain services
- Build Tool: Vite with HMR and hot reload
- Type Safety: Full TypeScript coverage
- API Proxy: Vite proxy for CORS handling
- Environment: Secure environment variable management
npm installCreate a .env file with your API keys:
VITE_1INCH_API_URL=https://api.1inch.dev
VITE_1INCH_API_KEY=your_1inch_api_key_here
VITE_WALLETCONNECT_PROJECT_ID=your_walletconnect_project_idGet API Keys:
- 1inch API key: https://portal.1inch.dev/
- WalletConnect Project ID: https://cloud.walletconnect.com
npm run devThe application will be available at http://localhost:5173
npm run build
npm run preview # Preview production buildsrc/
βββ components/
β βββ AdvancedDashboard.tsx # Main portfolio dashboard with charts
β βββ WalletConnector.tsx # RainbowKit wallet connection
β βββ BalanceList.tsx # Token balance display
β βββ SwapForm.tsx # Token swap interface
β βββ SwapHistory.tsx # Transaction history
β βββ NetworkStatus.tsx # Network information
β βββ FusionTrading.tsx # Advanced Fusion trading
β βββ MarketAnalytics.tsx # Market data and analytics
β βββ ui/ # shadcn/ui components
β βββ button.tsx
β βββ card.tsx
β βββ badge.tsx
β βββ loading-spinner.tsx
βββ hooks/
β βββ usePortfolio.ts # Portfolio data and analytics
β βββ useBalances.ts # Wallet balance fetching
β βββ useSwap.ts # Swap execution
β βββ useQuote.ts # Price quotes
β βββ useFusion.ts # Fusion trading
β βββ useSpotPrice.ts # Real-time prices
β βββ useHistory.ts # Transaction history
β βββ useCharts.ts # Chart data
βββ utils/
β βββ portfolio.ts # Portfolio API utilities
β βββ swap.ts # Swap API utilities
β βββ fusion.ts # Fusion API utilities
β βββ spotPrice.ts # Price API utilities
β βββ history.ts # History API utilities
β βββ charts.ts # Charts API utilities
β βββ nft.ts # NFT API utilities
β βββ domains.ts # Domains API utilities
β βββ balance.ts # Balance API utilities
β βββ tokens.ts # Token metadata
βββ config/
β βββ wagmi.ts # Wallet and chain configuration
βββ types/
β βββ index.ts # TypeScript type definitions
βββ App.tsx # Main application component
- Classic Swap API v6.1: Token swaps with best rates
- Fusion API: Advanced order types and MEV protection
- Liquidity Sources API: Access to 100+ DEX protocols
- Portfolio API v4: Current portfolio value and breakdown
- Portfolio API v5: Advanced analytics and CSV reports
- Chart API v5.0: Portfolio value charts with multiple timeframes
- Spot Price API: Real-time token prices
- History API v2.0: Transaction history and tracking
- NFT API: NFT portfolio tracking (ready for integration)
- Domains API: ENS and domain services
- Orderbook API: Order book data for advanced trading
- Web3 RPC API: Direct blockchain interaction with real-time network stats
- Traces API: Transaction trace analysis
- Live Price Tracking: Real-time token prices with 30-second updates
- Network Statistics: Live blockchain data (blocks, gas prices, network stats)
- Gas Price Monitoring: Real-time gas price tracking across networks
- Block Information: Latest block data with transaction counts
- Ethereum (Chain ID: 1)
- BSC (Chain ID: 56)
- Polygon (Chain ID: 137)
- Arbitrum (Chain ID: 42161)
- Optimism (Chain ID: 10)
- Base (Chain ID: 8453)
- Linea (Chain ID: 59144)
- Automatic network detection and switching
- Real-time balance updates
- Gas optimization and estimation
- Slippage protection
- MEV protection via Fusion
- Multi-chain portfolio aggregation
- Connect Your Wallet: Click "Connect Wallet" and choose your preferred wallet
- Switch Networks: Use your wallet to switch between supported chains
- View Portfolio: Navigate to the Portfolio tab to see your holdings
- Overview: See total portfolio value and 24h change
- Protocol Breakdown: View holdings across different DeFi protocols
- Interactive Charts: Analyze portfolio performance with Area/Line charts
- Time Ranges: Switch between 1D, 1W, 1M, 3M, 1Y, and 3Y views
- CSV Export: Download detailed portfolio reports
- Token Swaps:
- Select tokens from the dropdown
- Enter amount to swap
- Review quote and gas estimation
- Execute swap with one click
- Fusion Trading: Access advanced order types for better pricing
- Market Analysis: View real-time prices and market data
- Swap History: Track all your transactions
- Etherscan Links: Click to view transactions on block explorer
- Status Tracking: See pending, successful, and failed transactions
- Automatic Detection: App detects your wallet's current network
- Seamless Switching: Switch networks directly from your wallet
- Unified Portfolio: View holdings across all supported chains
The application is ready for deployment on:
- Vercel (Recommended)
- Netlify
- GitHub Pages
- Any static hosting service
Set these environment variables in your hosting platform:
VITE_1INCH_API_URL=https://api.1inch.dev
VITE_1INCH_API_KEY=your_1inch_api_key_here
VITE_WALLETCONNECT_PROJECT_ID=your_walletconnect_project_id- Connect your GitHub repository to Vercel
- Add environment variables in Vercel dashboard
- Deploy with automatic builds on push
- TypeScript: Full type safety
- ESLint: Code linting and formatting
- Prettier: Code formatting (if configured)
- Vite: Fast development and build
- New API Endpoints: Add to
src/utils/directory - New Hooks: Create in
src/hooks/directory - New Components: Add to
src/components/directory - Types: Define in
src/types/index.ts
- Test wallet connection on different networks
- Verify API responses with different addresses
- Test responsive design on mobile devices
# Check if API key is properly set
echo $VITE_1INCH_API_KEY- Ensure API key is active on 1inch portal
- Check API key permissions and rate limits
- Ensure wallet is connected to supported network
- Check if network is properly configured in
wagmi.ts - Verify RPC endpoints are working
# Clear cache and reinstall
rm -rf node_modules package-lock.json
npm installecho fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf
sudo sysctl -p- API responses are cached for better performance
- Vite proxy handles CORS and injects API keys securely
- Recharts provides smooth chart interactions
- Components are optimized with React.memo where needed
- Portfolio: Complete portfolio analytics with charts
- Balances: Token balance overview across chains
- Swap: Token trading with best rates
- History: Transaction history tracking
- Fusion: Advanced trading features
- Analytics: Market data and insights
- Multi-timeframe Charts: 1D, 1W, 1M, 3M, 1Y, 3Y
- Chart Types: Area and Line charts with smooth animations
- Protocol Analytics: See holdings breakdown by DeFi protocol
- CSV Export: Download portfolio data for analysis
- Real-time Updates: Live balance and price updates
- Gas Optimization: Intelligent gas estimation
- MEV Protection: Built-in MEV protection via Fusion
- Fork the repository
- Clone your fork:
git clone https://github.com/yourusername/1SwapDash.git - Install dependencies:
npm install - Create environment file: Copy
.env.exampleto.env - Start development server:
npm run dev
- Create feature branch:
git checkout -b feature/your-feature - Make changes and test thoroughly
- Commit with descriptive messages
- Push to your fork and create pull request
This project is open source and available under the MIT License.
- 1inch: For providing comprehensive DeFi APIs
- wagmi: For excellent wallet integration
- RainbowKit: For beautiful wallet connection UI
- shadcn/ui: For modern UI components
- Recharts: For interactive chart components