Skip to content

stoka-typescript

Official TypeScript / JavaScript client for the stoka x402 storage API.

Stoka is a paid key/value blob store you hit with an HTTP request and pay for per byte in USDC on Stellar. No accounts. No monthly bill. A failed 402 tells you exactly what to pay, and this client signs it for you in-process.

What it does

  • Native x402 "exact" scheme signer for Stellar USDC payments — no subprocess, no bun, no secondary runtime.
  • Drives the store / retrieve / update 402 retry loop automatically: first request triggers the 402, the client signs a Soroban authorization entry, retries, returns the body.
  • Same shape on Node and the browser:
    • Node — pass a Stellar S… seed; the client signs with a keypair in process.
    • Browser — pass a SEP-43 wallet (Freighter / xBull / Lobstr / Rabet); the wallet owns the key and approves each payment.

Next steps

Requirements

  • Node 20 or later (for the server flow)
  • A modern browser with a SEP-43 wallet installed (for the browser flow)
  • @stellar/stellar-sdk is a direct dependency (already installed transitively)

MIT Licensed.