Troubleshooting
Diagnostic Checklist
Section titled “Diagnostic Checklist”When something isn’t working, check these in order:
- Is
registerWidgetElement()called? Required before using HTML tags. Not needed for the imperative API. - Is the container in the DOM? The imperative API throws
TF5001if the CSS selector doesn’t match. - Is the API reachable? Test with:
curl <your-api-endpoint>/v1/chains - Is a wallet adapter provided? Without one, “Connect Wallet” only fires the
onConnectWalletcallback. - Is the correct chain connected? Some routes require the wallet to be on a specific chain.
- Are there console errors? Check the browser DevTools console for
[TokenFlight]warnings.
Console Warnings
Section titled “Console Warnings”| Warning | Meaning | Fix |
|---|---|---|
No wallet adapter configured | No adapter — wallet features limited | Provide walletAdapter or handle onConnectWallet |
Wallet not connected | Wallet action attempted without connection | Connect the wallet first |
API request failed | Network request failed | Check API reachability and network |
Common Issues
Section titled “Common Issues”Widget renders but is completely empty
Section titled “Widget renders but is completely empty”- CSP violation: If your page has a strict Content Security Policy, inline styles may be blocked. Use the
csp-nonceattribute. See CSP Guide. - Shadow DOM not supported: Very old browsers may not support Shadow DOM v1. See Browser Compatibility.
Widget shows but no tokens appear
Section titled “Widget shows but no tokens appear”- The API needs to respond with token data. Check network requests in DevTools for failed
/v1/tokensor/v1/chainscalls. - If using
supportedChainIdson the wallet adapter, ensure the listed chains are supported by the API.
Quotes never load
Section titled “Quotes never load”- Check the network tab for
POST /v1/quotesrequests. - A 15-second timeout applies. Slow networks may trigger
TF3002. - Verify the token pair is valid — not all combinations have routes.
Wallet connection fails
Section titled “Wallet connection fails”- No
window.ethereum: The ethers adapter requires an injected provider. If using a mobile browser without a wallet extension, consider AppKit with WalletConnect. - Wrong chain: Some adapters auto-switch chains. If switching fails,
TF2003is emitted.
Transaction signed but order stuck
Section titled “Transaction signed but order stuck”- Cross-chain orders can take 10+ minutes depending on the bridge and chains involved.
- Check the source chain transaction on a block explorer using the
txHash. - Query
GET /v1/orders/:addressfrom your backend for the latest status.
Wallet shows zero balance on a supported chain
Section titled “Wallet shows zero balance on a supported chain”The widget queries token balances only for chains listed in supportedChainIds. When using wallet adapters like AppKitWalletAdapter or WagmiWalletAdapter, this list is automatically derived from your wallet library’s configured networks.
If a chain is supported by the API but missing from your wallet config, the widget won’t query balances for it.
Fix: Add the missing chain to your wallet library configuration:
// AppKit example — add Unichain (chainId 130)import { defineChain } from '@reown/appkit/networks'
const unichain = defineChain({ id: 130, name: 'Unichain', nativeCurrency: { name: 'ETH', symbol: 'ETH', decimals: 18 }, rpcUrls: { default: { http: ['https://mainnet.unichain.org'] } }, blockExplorers: { default: { name: 'Uniscan', url: 'https://uniscan.xyz' } },})
createAppKit({ networks: [mainnet, arbitrum, base, polygon, unichain], // ...})Or override supportedChainIds explicitly on the adapter:
const adapter = new AppKitWalletAdapter(appkit, { supportedChainIds: [1, 42161, 8453, 137, 10, 130],})Network Debugging
Section titled “Network Debugging”The widget only makes HTTP requests to:
- API endpoint — the configured
apiEndpointfor quotes, builds, submissions, and order tracking. - Chain icons —
<apiEndpoint>/v1/chain/{chainId}/iconfor chain logo images. - Token icons — URLs from the
logoURIfield in token metadata (various CDNs).
No other domains are contacted. No analytics, no tracking, no third-party scripts.
Distinguishing Error Sources
Section titled “Distinguishing Error Sources”| Symptom | Likely Source | How to Verify |
|---|---|---|
| Widget won’t render | SDK integration issue | Check console for TF5001/TF5002 errors |
| ”Connect Wallet” does nothing | Missing adapter or callback | Check if onConnectWallet is configured |
| Wallet popup appears then fails | Wallet issue (wrong chain, insufficient gas) | Check wallet error message |
| Quote loads but swap fails | API or route issue | Check POST /v1/quotes response in Network tab |
| Tx signed but nothing happens | Network/bridge delay | Check txHash on block explorer |
Getting Help
Section titled “Getting Help”If you can’t resolve an issue:
- Check the FAQ for common questions
- Contact support with:
- Browser and version
- SDK version (
@tokenflight/swapversion frompackage.json) - Adapter being used
- Console errors (screenshots help)
- Network request/response for failed API calls