This is a XFlows API demonstration application built with Vite + React + TypeScript, showcasing the complete functionality of the Wanchain XFlows cross-chain swap protocol.
- Support for multi-chain asset cross-chain swapping
- 6 work modes: direct cross-chain, cross-chain then swap, swap only, etc.
- Real-time quote retrieval and slippage settings
- Smart path selection and fee calculation
- Real-time transaction execution status queries
- Support for multi-chain transaction hash queries
- Detailed transaction information display
- Status code explanations and error handling
- Complete XFlows API interface demonstration
- Query supported chains, tokens, bridges, and DEXes
- Real-time API calls and response display
- cURL command generation
- Support for MetaMask and other browser extension wallets
- Automatic wallet connection status detection
- Chain switching and token balance queries
- Transaction authorization and execution
- Frontend Framework: React 18 + TypeScript
- Build Tool: Vite
- Styling: Tailwind CSS
- Icons: Lucide React
- Web3: Viem + Native Ethereum API
- HTTP Client: Axios
npm install
npm run dev
npm run build
npm run preview
src/
├── components/ # React Components
│ ├── WalletConnect.tsx # Wallet connection component
│ ├── ChainSelector.tsx # Chain selector
│ ├── TokenSelector.tsx # Token selector
│ ├── SwapInterface.tsx # Swap interface
│ ├── StatusTracker.tsx # Status tracker
│ ├── ApiExplorer.tsx # API explorer
│ └── Tabs.tsx # Tab component
├── hooks/ # React Hooks
│ └── useWallet.ts # Wallet hook
├── services/ # Service Layer
│ └── xflowsApi.ts # XFlows API service
├── types/ # TypeScript Type Definitions
│ └── xflows.ts # XFlows types
└── App.tsx # Main application component
- Connect Wallet: Click the "Connect Wallet" button in the top right corner
- Select Chains and Tokens: Choose source chain, target chain, and corresponding tokens in the swap interface
- Enter Amount: Input the amount of tokens to swap
- Get Quote: Click "Get Quote" to view swap details
- Execute Swap: Authorize tokens if needed, then execute the swap
- Track Status: Enter transaction hash in the status query page to view progress
MIT License