Best-Practices
-
Wallet Connection: Ensure the user has connected their wallet (such as MetaMask) and has enough tokens and gas fees.
-
Amount Handling: Use
parseUnits
andformatUnits
to handle token decimals and avoid precision issues. -
Transaction Status: Cross-chain transactions may be slow due to network latency. It is recommended to show a progress bar or status updates.
-
Security Checks: Validate input addresses and amounts to prevent user errors.
-
User Experience: Provide clear loading states and error messages to optimize user interaction.
-
Token Icons: Use the
getTokenIcon
helper function to display token icons, supporting multiple icon sources. -
History Records: Save the user's selected token history to improve user experience.