x402 Forge BundlesCatalog

Catalog / xlm-amount-convert

Stellar amount and asset converter (stroops, asset codes, SAC contract ID)

Converts Stellar amounts between XLM (or any classic asset) and stroops exactly, checks an asset code and issuer, and works out the asset's Soroban contract address.

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

Buy $1.00

What it does

Exact Stellar amount math with BigInt strings (no floats). to_stroops: units with at most 7 decimals -> stroops (1 unit = 10000000 stroops); from_stroops: stroops -> units (minimal and fixed 7-decimal form, as js-stellar-base prints them). Both refuse negatives, exponent notation, more than 7 decimals and anything above the XDR Int64 maximum 9223372036854775807 stroops (922337203685.4775807 units); zero only with allow_zero=true. asset: validates a classic asset (native, or a 1-4 char credit_alphanum4 / 5-12 char credit_alphanum12 code [A-Za-z0-9] plus a checksum-verified G-address issuer) and returns its canonical CODE:ISSUER form, its Asset XDR hex and, given network public or testnet, its Soroban Stellar Asset Contract C-address (SHA-256 of the HashIdPreimage, computed offline; deployment is not checked). Bad input is ok: true, valid: false with a machine-readable reason.

Example input
{"operation":"asset","asset_code":"USDC","asset_issuer":"GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN","network":"public"}
Answer
{"ok":true,"result":{"valid":true,"reason":null,"operation":"asset","standard":"Stellar classic asset (CAP-0001 Asset XDR: native, credit_alphanum4 1-4 chars, credit_alphanum12 5-12 chars, [A-Za-z0-9]); issuer is a StrKey ed25519 G-address (SEP-23); SAC contract ID = StrKey C(SHA-256(HashIdPreimage ENVELOPE_TYPE_CONTRACT_ID, SHA-256(network passphrase), CONTRACT_ID_PREIMAGE_FROM_ASSET)) (CAP-46-06, js-stellar-base Asset.contractId)","asset_type":"credit_alphanum4","asset_code":"USDC","asset_issuer":"GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN","canonical":"USDC:GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN","asset_xdr_hex":"0000000155534443000000003b9911380efe988ba0a8900eb1cfe44f366f7dbe946bed077240f7f624df15c5","network":"public","network_passphrase":"Public Global Stellar Network ; September 2015","contract_id":"CCW67TSZV3SSS2HXMBQ5JFGCKJNXKZM7UQUWUZPUTHXSTZLEO7SJMI75"},"warnings":["The contract ID is derived offline; whether the Stellar Asset Contract is deployed on this network was not checked."]}
Try it free
/try/xlm-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/xlm-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/xlm-amount-convert?format=zip”. From code:
    const pay = wrapFetchWithPayment(fetch, client); // see /llms.txt
    const zip = await pay("https://forge.fizzl.eu/forge/packages/xlm-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/xlm-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.