A comprehensive cross-chain bridging application with AI intent extraction, real-time quotes from Relay API, and Starknet integration for seamless token swaps.
- Natural language intent extraction
- Automatic form filling
- Clarification requests for unclear inputs
- Smart chain mapping and validation
- Real quotes from Relay API
- 9 supported chains (including Starknet)
- Multiple supported tokens
- Live fee calculations
- Transaction monitoring
- Direct token swaps on Starknet
- AutoSwappr SDK integration
- Ekubo DEX support
- Account balance validation
- Transaction status tracking
- Mock exchange rates
- Token switching
- Real-time calculations
- EVM Testnets (5): Sepolia, Base Sepolia, Arbitrum Sepolia, OP Sepolia, Polygon Amoy
- Solana (2): Solana Devnet, Eclipse Testnet
- Bitcoin (1): Bitcoin Testnet 4
- Starknet (1): Starknet Mainnet
- ETH - Ethereum (EVM chains + Starknet)
- SOL - Solana (Solana chains)
- BTC - Bitcoin (Bitcoin chain)
- USDC - USD Coin (Starknet)
POST /api/intent
{
"message": "I want to swap 0.1 ETH from sepolia to base-sepolia"
}POST /api/routes
{
"sourceChain": "sepolia",
"targetChain": "base-sepolia",
"token": "ETH",
"amount": "0.1"
}POST /api/execute
{
"quoteId": "0x...",
"userAddress": "0x...",
"sourceChain": "sepolia",
"targetChain": "base-sepolia",
"token": "ETH",
"amount": "0.1"
}POST /api/starknet-swap
{
"fromToken": "ETH",
"toToken": "USDC",
"amount": "0.001",
"accountAddress": "0x..."
}# Install dependencies (if not already done)
npm install
# Start development server
npm run dev
# Open browser to http://localhost:3000-
Connect Wallet to Navigate to the main page
-
Try natural language inputs:
- "I want to swap 0.1 ETH from sepolia to base-sepolia"
- "Bridge 50 USDC from arbitrum-sepolia to polygon-amoy"
- "Swap 0.5 SOL on solana-devnet"
- "I need to transfer 0.01 BTC from bitcoin-testnet4"
-
Click on Get Quote to find the optimal route
-
Execute Swap
- Cross-chain bridges: Try different chain combinations
- Starknet swaps: Test ETH β USDC swaps on Starknet
- React with TypeScript
- Tailwind CSS for styling
- Real-time form updates
- Error handling and loading states
- RainbowKit for wallet connection
- Starknet provider integration
- Next.js API routes
- OpenAI integration for intent extraction
- Relay API integration for quotes
- AutoSwappr SDK for Starknet swaps
- Balance validation and error handling
- Minimal & Manageable: Focused on core functionality
- Real API Integration: Gets actual quotes from Relay and Starknet
- Security First: Private keys handled server-side
- Clear Error Messages: Comprehensive error handling
- Multi-Chain Support: Seamless cross-chain and same-chain swaps
- β Cross-chain transfers working perfectly across EVM testnets
- β Starknet swaps with AutoSwappr SDK
- β Real bridge fees and timing from Relay API
- β AI intent extraction with clarification support
- β Balance validation and error handling
- β Clean, maintainable code structure
-
Install dependencies
npm install
-
Set up environment variables
# Create .env.local OPEN_API_KEY=your_openai_api_key_here -
Start development server
npm run dev
-
Open browser
http://localhost:3000
- Update
SUPPORTED_CHAINSin/api/routes/route.ts - Add chain to
CHAINSarray in/app/page.tsx - Update token address mapping in
getNativeTokenAddress()
- Update
SUPPORTED_TOKENSin/api/routes/route.ts - Add token to
TOKENSarray in/app/page.tsx - Update decimals mapping in
getTokenDecimals()
- Update
TOKEN_ADDRESSESinAutoSwap.tsx - Configure RPC endpoints in API routes
- Set up private keys in environment variables
- Private Keys: Handled server-side only
- Environment Variables: Sensitive data stored securely
- Error Handling: No sensitive information exposed in errors
- Validation: Input validation on all API endpoints
# Required environment variables
OPEN_API_KEY=your_openai_api_keyMIT License - feel free to use this as a foundation for your own projects!