Utility Operations
resource: utility — local unit conversion. No network call, no credential.
convertUnits
Converts between lamports (the base unit) and SOL. Pure computation — no RPC call is made, so it works even if no cluster is configured.
| Field | Type | Required | Description |
|---|---|---|---|
lamports | text (integer) | Exactly one of lamports / sol | Amount in lamports to convert to SOL. |
sol | text (decimal) | Exactly one of the two | Amount in SOL to convert to lamports. |
Example response (given sol: "1.5"):
{
"lamports": 1500000000,
"sol": 1.5
}
1 SOL = 1,000,000,000 lamports (109). Supply exactly one of
lamports or sol — the response always includes both, so a single call gives
you either direction.
Why this exists as its own operation: Every field that carries a lamport amount
elsewhere on this node (
transaction/sendNative's lamports, the balance
responses) is a raw integer, deliberately kept as text rather than a numeric control to avoid
JavaScript/JSON Number.MAX_SAFE_INTEGER precision loss on large values. Use
convertUnits to translate a user-friendly SOL amount collected upstream (e.g. a form
field) into the lamport integer a write operation expects.