The Problem
Different chains use different decimal precisions for the same token:
When bridging tokens, amounts must be converted between these precisions. Small amounts can round to zero during conversion — and a zero-amount transfer fails.
Example: The Dust Problem
Suppose you try to bridge 0.0000001 USDC from NEAR (24 decimals) to Ethereum (6 decimals):How the SDK Protects You
validateTransfer() catches this automatically:
Finding Minimum Amounts
Use these helpers to determine safe transfer amounts:Building UI Validation
Show users the minimum before they submit:Handling Errors
The ValidatedTransfer Contains Normalized Amounts
After validation succeeds, the result includes the normalized amount:Fees Matter Too
Remember:amount - fee must survive normalization, not just amount. If you’re paying fees from the transfer:
Key Takeaways
- Always use
validateTransfer()— Never skip validation - Check minimums in your UI — Show users the minimum before they submit
- Handle
AMOUNT_TOO_SMALLerrors — Give users a helpful message - Remember fees reduce the amount — The net amount must survive, not just the gross