Pass token amounts as integer strings in the token’s smallest unit.
Definition
A human-readable amount includes the decimal point users see in wallets. A smallest unit amount is the integer value sent to APIs and contracts.
Decision Table
Worked Example
Convert 1 WEGLD with 18 decimals:
Convert 100 USDC with 6 decimals:
Edge Cases
Do not send human-readable amounts to quote endpoints. A decimal mistake can build a transaction for the wrong value.
Verify
Before signing or broadcasting, compare:
- The input token decimals from metadata.
- The integer string sent in the request.
- The displayed human-readable amount in your UI.
- The returned
amountOut or amountIn converted back with output decimals.