Skip to main content

Best-Practices

  1. Wallet Connection: Ensure the user has connected their wallet (such as MetaMask) and has enough tokens and gas fees.

  2. Amount Handling: Use parseUnits and formatUnits to handle token decimals and avoid precision issues.

  3. Transaction Status: Cross-chain transactions may be slow due to network latency. It is recommended to show a progress bar or status updates.

  4. Security Checks: Validate input addresses and amounts to prevent user errors.

  5. User Experience: Provide clear loading states and error messages to optimize user interaction.

  6. Token Icons: Use the getTokenIcon helper function to display token icons, supporting multiple icon sources.

  7. History Records: Save the user's selected token history to improve user experience.