convert_amount
Convert token amounts between human-readable and smallest-unit values such as wei, lamports, or satoshis. Use before bridge and swap tools that require precise smallest-unit amounts.
Instructions
Convert between human-readable token amounts and smallest-unit values (wei, lamports, satoshis).
Use this before calling quote/bridge/swap tools which require amounts in smallest units.
Examples:
1.5 ETH (18 decimals) → "1500000000000000000"
100 USDC (6 decimals) → "100000000"
0.001 BTC (8 decimals) → "100000"
"1000000000000000000" → 1.0 (18 decimals)
Common decimals: ETH/WETH = 18, USDC/USDT = 6, BTC = 8, SOL = 9. Use get_supported_tokens or get_token_details to look up decimals for other tokens.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| amount | Yes | The amount to convert. Can be human-readable ("1.5") or smallest-unit ("1500000000000000000"). | |
| decimals | Yes | Token decimals. Common values: ETH=18, USDC=6, BTC=8, SOL=9. | |
| direction | Yes | "toSmallestUnit": human → wei/lamports/satoshis. "toHuman": wei/lamports/satoshis → human-readable. |