-
Token Swap
-
- {/* From Token */}
-
-
-
- setAmount(e.target.value)}
- className="flex-1 p-3 border rounded-lg focus:ring-2 focus:ring-blue-500"
- />
-
-
-
Ethereum
-
-
- {/* Swap Arrow */}
-
-
-
-
- {/* To Token */}
-
-
-
-
-
-
-
Polygon
-
-
- {/* Quote Info */}
- {quote && (
-
-
- Rate: 1 {fromToken} = {(Number(quote.destinationAmount) / Number(quote.originAmount)).toFixed(6)} {toToken}
-
-
- Fee: {((Number(quote.originAmount) - Number(amount) * 1e18) / 1e18).toFixed(6)} {fromToken}
-
-
- Estimated time: {Math.round(quote.estimatedExecutionTimeMs / 1000)}s
-
-
- )}
-
- {/* Swap Button */}
-
-
- {!account && (
-
- Connect your wallet to start swapping
-
- )}
-
- );
-}
+
+#### Set an ERC20 token to Buy by default
+
+```tsx
+
-
Advanced Token Swap
-
- {/* Amount Input */}
-
- getQuotes(e.target.value)}
- className="w-full p-3 border rounded-lg focus:ring-2 focus:ring-blue-500"
- />
-
-
- {/* Route Options */}
-
-
Available Routes
- {quotes.map(({ route, quote }, index) => (
-
setSelectedRoute({ route, quote })}
- >
-
-
-
- {route.originToken.symbol} → {route.destinationToken.symbol}
-
-
- {route.originToken.name} to {route.destinationToken.name}
-
-
-
-
- {(Number(quote.destinationAmount) / Math.pow(10, route.destinationToken.decimals)).toFixed(6)}
-
-
- ~{Math.round(quote.estimatedExecutionTimeMs / 1000)}s
-
-
-
-
- ))}
-
-
- {selectedRoute && (
-
-
Selected Route
-
{selectedRoute.route.originToken.symbol} → {selectedRoute.route.destinationToken.symbol}
-
-
- )}
-
- );
-}
+#### Set both buy and sell tokens by default
+
+```tsx
+