Troubleshooting
Things break. Here are the usual suspects, roughly in the order people run into them.
API says "Token not found"
The Swap API only routes listed tokens. Check the address against
/partner/tokens, and make sure you used the 0xEeee… placeholder for
native zkLTC (not the zero address, not wzkLTC).
API says "No route found"
No pool path has enough liquidity for that pair and size. Try a smaller amount. If the pair has no pool at all, nothing can route it until someone adds liquidity.
Quote looks a bit low
partnerFeeBps defaults to 10. If you don't charge an integrator fee, pass partnerFeeBps=0 and the numbers will
match what the app shows.
The swap transaction reverts
Most reverts come down to one of these:
| What you see | What it means | Fix |
|---|---|---|
InsufficientAmountAfterFees (0x6145e8b9) | Output came in under minAmountOut. The price moved | Fetch a fresh /partner/swap and resend. Raise slippage a little for volatile tokens |
transferFrom failed / SafeERC20FailedOperation (0x5274afe7) | The swap contract couldn't pull your token | Approve spender for at least amount, and check the balance |
InsufficientNativeValue (0x35898e6e) | Sent less zkLTC than the swap needs | Send exactly transaction.value |
UnexpectedNativeValue (0xe0aeda7d) / NativeNotAccepted (0x1a9fe9f6) | Sent zkLTC with a token sell | value must be 0 when you sell an ERC-20 |
ReferrerFeeAboveMaximum (0x25a0d875) | Integrator fee over 500 bps | Keep partnerFeeBps (or widget fee) at 500 or lower |
BuyAndSellTokensAreSame (0xdef6e22c) | fromToken equals toToken | Pick two different tokens |
| Out of gas | Gas limit set by hand too low | Let the wallet estimate, or add headroom for multi-hop routes |
Got a raw revert like 0x6145e8b9? The first 4 bytes are the error selector. Match it against the table, or paste
the transaction hash into the explorer.
Wallet is on the wrong network
Everything here is on chain id 4441. Prompt the user to switch, or add the chain with wallet_addEthereumChain
(see Network setup).
Amounts are off by a factor of 10^something
Two classics:
- API vs chain units. The API wants
"1.5". Contracts want1500000000000000000(for 18 decimals). - Wrong decimals. Read
decimals()from the token. ZKUSDC on LitVM has 18, not 6.
eth_getLogs errors or times out
Your block range is too big. Use chunks of about 5,000 blocks. See scanning logs in chunks.
Block numbers don't line up
Inside a contract, block.number is the parent chain's block number. Use
ArbSys(0x64).arbBlockNumber() for LitVM's own number. Details on
Network setup.
V3 calldata doesn't match
The SwapRouter here is the original one, with deadline inside the params struct. SwapRouter02 style calldata
(no deadline) won't decode. See V3 pools.
Still stuck?
Come say hi in the builders Telegram. Bring the request you sent (minus any private keys, obviously) or the transaction hash. We'll take a look.
Nobody from LitVMSwap will ever ask for one. Not in Telegram, not in DMs, not "to debug your integration".