x402 Forge BundlesCatalog

Catalog / ccd-amount-convert

Concordium amount converter (CCD and CIS-2)

Converts Concordium amounts exactly: CCD to microCCD and back, and CIS-2 token amounts to the raw integer and the LEB128 bytes a contract expects.

Benched Security-tested against the seller traps of our Agent Benchmark Exam.

Buy $1.00

What it does

Exact Concordium amount conversion with BigInt string math (no floats). ccd_to_micro / micro_to_ccd: CCD has 6 decimals, on-chain amounts are a u64 of microCCD (max 18446744073709551615). token_to_raw / raw_to_token: CIS-2 token amount in display units <-> raw integer (max 2^256-1) using the decimals from the token metadata, plus the unsigned LEB128 hex CIS-2 serialises it as. leb128_decode: LEB128 hex -> raw integer (and display amount if decimals is given), refusing truncated, non-minimal, trailing-byte, over-37-byte and overflowing encodings. Amounts are taken as decimal strings. Bad amounts come back ok: true, valid: false with a machine-readable reason (negative, exponent_notation, too_many_fraction_digits, overflow_u64, ...).

Example input
{"operation":"token_to_raw","amount":"1.5","decimals":6}
Answer
{"ok":true,"result":{"valid":true,"reason":null,"operation":"token_to_raw","standard":"Concordium CIS-2 TokenAmount: unsigned integer up to 2^256-1, serialised as unsigned LEB128, at most 37 bytes","micro_ccd":null,"ccd":null,"ccd_fixed":null,"raw":"1500000","token_amount":"1.5","token_amount_fixed":"1.500000","decimals":6,"leb128_hex":"e0c65b","leb128_bytes":3},"warnings":[]}
Try it free
/try/ccd-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.

  1. Pay with an x402 walletThe buy link is https://forge.fizzl.eu/forge/packages/ccd-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/ccd-amount-convert?format=zip”. From code:
    const pay = wrapFetchWithPayment(fetch, client); // see /llms.txt
    const zip = await pay("https://forge.fizzl.eu/forge/packages/ccd-amount-convert?format=zip");
  2. Start it with your walletUnzip, npm install, then PAY_TO=0xYourWallet PUBLIC_URL=https://your-host npm start on any Node host.
  3. 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/ccd-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.