Token Units
token_unitsExact (string-math, no floating point) conversion between human token amounts and on-chain base units: wei / gwei / ether, lamports / SOL, sats / BTC, USDC/USDT (6 decimals) or any token with a decimals value. Returns the converted amount, the integer base units (decimal and hex) and every unit of the family. Accepts decimals, scientific notation and 0x-hex raw amounts. Price: $0.001 USDC per successful call (x402, Solana). Same tool over HTTPS: GET https://scorptech.it.com/api/x402/v1/token-units
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"amount": "<amount>",
"from": "<from>",
"to": "<to>"
},
"name": "token_units"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| to | Yes | Target unit | |
| from | Yes | Unit of amount (raw = integer base units) | |
| amount | Yes | Amount: 1.5, 2e-6, 1500000, or 0x-hex (base units) | |
| decimals | No | Token decimals, needed for unit "token" (and for raw <-> token) |