A comprehensive Next.js 14 trading platform powered by Bankr AI, Uniswap V3, and GMX Protocol.
- Natural language trading through
/api/bankr(server-side only) - Execute trades with plain English commands
- x402 micropayment integration ($0.10 per request)
- Secure server-side processing with Base chain payments
- Token swaps with multiple pairs (ETH, USDC, USDT, DAI, WBTC)
- Real-time price quotes using Smart Order Router
- Low slippage, instant execution
- Multi-chain support (Ethereum, Arbitrum, Base)
- Long/Short positions with 1-50x leverage
- Configurable take profit and stop loss orders
- Position management dashboard
- Liquidation price calculations
- Supported on Arbitrum chain
- MetaMask wallet connection
- Multi-chain support
- Balance tracking
- Transaction status monitoring
- Purple/Orange retro pixel art theme
- Responsive design (mobile & desktop)
- Real-time updates
- Interactive components
/bankrdex
βββ pages/
β βββ index.tsx # Main trading interface
β βββ _app.tsx # Next.js app wrapper
β βββ api/
β βββ bankr.ts # Bankr AI API route (server-side)
βββ components/
β βββ Layout.tsx # Header/Footer with branding
β βββ WalletConnect.tsx # Wallet connection UI
β βββ SpotTrading.tsx # Uniswap spot trading
β βββ PerpTrading.tsx # GMX perpetuals
β βββ BankrChat.tsx # AI trading assistant
βββ lib/
β βββ bankr.ts # Bankr SDK utilities (server-side)
β βββ uniswap.ts # Uniswap integration
β βββ gmx.ts # GMX Protocol integration
βββ styles/
β βββ globals.css # BANKRDEX theme & styling
βββ public/
β βββ logo.svg # BANKRDEX logo
βββ .env.local # Environment variables
βββ next.config.js
βββ tailwind.config.js
βββ postcss.config.js
βββ tsconfig.json
βββ package.json
- Node.js 18+
- MetaMask or compatible Web3 wallet
- Ethereum/Arbitrum mainnet or testnet
- Install dependencies:
npm install- Configure environment variables:
# Copy the example file
cp .env.local.example .env.local
# Edit .env.local with your values:
BANKR_PRIVATE_KEY=0x... # For Bankr payments (keep secret!)
NEXT_PUBLIC_INFURA_KEY=... # Infura API key
NEXT_PUBLIC_WALLET_CONNECT_ID=... # WalletConnect ID
NEXT_PUBLIC_ETHEREUM_RPC=... # Ethereum RPC endpoint
NEXT_PUBLIC_ARBITRUM_RPC=... # Arbitrum RPC endpoint
NEXT_PUBLIC_BASE_RPC=... # Base chain RPC endpoint- Start development server:
npm run dev- Open in browser:
http://localhost:3000
- Server-side only: The Bankr SDK is initialized only in
/api/bankr, never exposed to the client - x402 Payments: Uses HTTP 402 micropayments protocol
- Base Chain: Bankr payments are processed on Base chain ($0.10 per request)
- Private Key Protection:
BANKR_PRIVATE_KEYshould only be in.env.local(never committed)
- Never expose private keys in frontend code
- Use ethers.js v5 for safe contract interactions
- Validate all user input before sending transactions
- Implement transaction confirmation modals
- Check gas prices before execution
- Uniswap V3 swaps are safe (well-audited protocol)
- GMX perpetuals are subject to funding rates
- Always use stop loss orders for leverage trading
- Monitor liquidation prices closely
Execute natural language trading prompts through Bankr AI.
Request:
{
"prompt": "swap 100 USDC for ETH",
"walletAddress": "0x..."
}Response:
{
"success": true,
"response": "β
Swap executed!",
"transactionExecuted": true,
"transactionHash": "0x...",
"newBalance": "900.00"
}Errors:
- 402: Insufficient balance (need $0.10 USDC)
- 400: Invalid request
- 500: Server error
| Chain | Use Case | RPC |
|---|---|---|
| Ethereum | Uniswap V3, general tokens | Mainnet |
| Arbitrum | GMX perpetuals | Arbitrum One |
| Base | Bankr x402 payments | Base mainnet |
- Bankr Requests: $0.10 per trade (x402 payment)
- Uniswap Swaps: Standard gas fees (varies by network)
- GMX Perpetuals: Entry/exit fees + funding rates
- No platform fees: BANKRDEX is fee-free decentralized app
1. Connect wallet (MetaMask)
2. Select from/to tokens
3. Enter amount
4. View quote via Smart Order Router
5. Execute swap via Uniswap V3
6. Transaction confirmed on chain
1. Connect wallet
2. Select asset & position type (long/short)
3. Set collateral & leverage (1-50x)
4. (Optional) Set take profit & stop loss
5. Open position via GMX
6. Monitor unrealized P&L
7. Close position to realize gains/losses
1. Connect wallet
2. Type natural language command
3. Bankr AI parses intent
4. Route to appropriate protocol (Uniswap/GMX)
5. Execute trade server-side
6. Return transaction hash & status
7. Cost: $0.10 USDC per request
Edit tailwind.config.js to customize:
--bankrdex-purple: #7B3FF2--bankrdex-orange: #FF6B35--bankrdex-yellow: #FFD700
- Uniswap tokens: Edit
lib/uniswap.tsTOKENS constant - GMX assets: Edit
lib/gmx.tsGMX_ASSETS constant
- CTA buttons:
.bankrdex-button - Cards:
.bankrdex-card - Input fields:
.bankrdex-input - See
styles/globals.cssfor all styles
This is a demo/educational platform.
- Not audited for security
- Real keys should use separate environment
- Test on testnet before mainnet use
- Trading and leverage carry significant risks
- Perpetual positions can result in liquidation
- Always use stop losses for leverage trading
- BANKRDEX is not responsible for losses
- Real Bankr SDK integration
- Actual smart contract interactions
- Order book integration
- Advanced charting
- Portfolio analytics
- Historical trade data
- Alerts & notifications
- Mobile app (React Native)
Contributions welcome! Please:
- Fork the repository
- Create a feature branch
- Submit a pull request with clear description
MIT License - See LICENSE file for details
- Issues: GitHub Issues
- Email: support@bankrdex.dev
- Twitter: @BANKRDEX
- Discord: BANKRDEX Community
Built with β€οΈ by BANKRDEX Team
Bringing AI-powered decentralized trading to everyone.