FAQ-and-Debugging
FAQ
-
Why does
fetchData
return empty data?- Ensure the API key and bridge parameters are correctly configured.
- Check network connection or API server status.
-
Transfer failed with "Insufficient Balance"?
- Verify the user wallet has enough tokens and gas fees.
- Use
useCrossChainFee
to check fee requirements.
-
How long does a cross-chain transaction take?
- Usually 1-5 minutes, depending on the confirmation speed of the source and destination chains.
-
How to debug a failed transaction?
- Check the
error
object's detailed information. - Use a blockchain explorer (such as Etherscan) to trace the
source_tx_hash
.
- Check the
-
What to do if a smart contract call fails?
- Check if the contract address is correct.
- Verify if the ABI matches the contract.
- Ensure function parameter types and counts are correct.
-
Reasons for token swap failure?
- Check if the token is approved.
- Verify if the slippage setting is reasonable.
- Ensure there is enough token balance.
Debugging Recommendations
- Logging: Add
console.log
to print input and output infetchData
andtransfer
. - Testnet Testing: Verify functionality on testnets (such as Sepolia) to reduce costs.
- State Tracking: Use the
loading
state to show loading animations and avoid duplicate operations. - Error Boundaries: Use React Error Boundary to catch component errors.