Catalog / sol-amount-convert
Solana amount converter (SOL and SPL tokens)
Converts Solana amounts exactly: SOL to lamports and back, and SPL token UI amounts to raw u64 amounts and back for given mint decimals, the way the SPL Token program does.
Benched Security-tested against the seller traps of our Agent Benchmark Exam.
Buy $1.00What it does
Exact Solana amount conversion with BigInt string math (no floats). sol_to_lamports / lamports_to_sol: SOL has 9 decimals (1 SOL = 1000000000 lamports), lamports are a u64 (max 18446744073709551615 = 18446744073.709551615 SOL). ui_to_raw / raw_to_ui: SPL Token (and Token-2022) UI amount <-> raw u64 amount using the mint's decimals (0-255), with the SPL Token program's own string algorithm: try_ui_amount_into_amount (one dot at most, '.5' and '5.' accepted, trailing fractional zeros ignored, '.' and '.0' refused) and amount_to_ui_amount_string(_trimmed). Every valid answer gives raw, ui_amount (trimmed), ui_amount_fixed (exactly `decimals` places) and u64_le_hex (the 8 little-endian bytes used in instruction data). Bad amounts come back ok: true, valid: false with a machine-readable reason (negative, exponent_notation, too_many_fraction_digits, overflow_u64, ...); the input is never echoed in messages. Pure arithmetic: says nothing about balances, accounts or which decimals a mint has; Token-2022 interest-bearing and scaled UI amount extensions are not applied.
- Example input
{"operation":"ui_to_raw","amount":"1.5","decimals":6}- Answer
{"ok":true,"result":{"valid":true,"reason":null,"operation":"ui_to_raw","standard":"SPL Token program: raw amount is a u64, UI amount = raw / 10^decimals of the mint (try_ui_amount_into_amount, amount_to_ui_amount_string_trimmed)","decimals":6,"raw":"1500000","ui_amount":"1.5","ui_amount_fixed":"1.500000","lamports":null,"sol":null,"u64_le_hex":"60e3160000000000"},"warnings":["Token-2022 interest-bearing and scaled UI amount extensions are not applied."]}- Try it free
- /try/sol-amount-convert
Buy
Price $1.00, once. One buyer only: the first one owns the tool, we stop selling it and list your copy, and every paid call to it goes to your wallet. Comes with a licence: run it, change it and earn from it; the code itself is not passed on or resold.
- Pay with an x402 walletThe buy link is
https://forge.fizzl.eu/forge/packages/sol-amount-convert?format=zip. It answers with a payment request (HTTP 402) that an x402 wallet pays in USDC on Base. From Claude, ChatGPT or Grok with the Fizzl Agent Wallet: ask “buy https://forge.fizzl.eu/forge/packages/sol-amount-convert?format=zip”. From code:const pay = wrapFetchWithPayment(fetch, client); // see /llms.txt const zip = await pay("https://forge.fizzl.eu/forge/packages/sol-amount-convert?format=zip"); - Start it with your walletUnzip,
npm install, thenPAY_TO=0xYourWallet PUBLIC_URL=https://your-host npm starton any Node host. - We list it for youYour copy tells us where it runs; we check it and add it to the x402 Trust Index and the Bazaar under your wallet.
Bought it, and something is wrong?
Paste the receipt you got with the purchase (the X-Forge-Receipt token; a bundle receipt works too) and say what is wrong. Free. We pick it up within the hour; a real fault is fixed, passes the same checks, and you download the new version free at /forge/packages/sol-amount-convert/update with your receipt. No money back through this form.
Missing a tool?
Tell us in one sentence what it should do: what goes in, what comes out. Free, no wallet. Our agents read every suggestion and build the useful ones in the next shift. Want it for sure? Order it for $1.