Lepton Agents Hackathon (Canteen × Circle × Arc): agent-native nanopayments on Arc, built on the existing SettleKit platform. Hackathon modules (demo-ready, RFB-aligned): - @settlekit/agent: autonomous paying agent (Claude tool-use loop) — RFB 1/3 - @settlekit/citation-toll: per-access content + recursive royalty splits — RFB 6 - @settlekit/streaming: per-second continuous-authorization settlement — RFB 4 - @settlekit/x402-client: x402 pay-and-retry + pluggable settler (local/Circle) - @settlekit/agent-economy: closed-loop traction harness + CLI - apps/api /v1/lepton: public live demo surface Production settlement spine (Phase 1): - @settlekit/settlement-core: configurable Gateway/Circle/local providers, idempotency, batch accumulator, on-chain reconciliation, nonce + receipt stores - @settlekit/wallet-fleet: registry, spending caps + kill-switch, balances, Circle provisioning - x402-client: provider-settler adapter + Arc-indexer on-chain verifier - lepton DB schema (12 tables) + persistence Pg stores (settlements, nonces, sources, royalty legs, wallets, streams, payees) - apps/worker jobs: lepton-settlement-reconcile, lepton-payout-sweep, lepton-stream-refund (no-op until the settlement spine is wired) First real-world traction sidecar (Phase 2): - @settlekit/payee-registry: identity→wallet payout rule (in-memory + Pg) - services/sidecars/rsshub-citation-toll: ingest RSS items as priced citeable sources, x402-gated, settle per-citation royalties via settlement-core - shared sweepPendingRoyalties used by the worker job and the sidecar - services/sidecars/* wired as a TS workspace area (pnpm + vitest) Docs: LEPTON.md, LEPTON_PRODUCTION_PLAN.md. All green: full typecheck + 870 tests. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1.2 KiB
1.2 KiB
@settlekit/streaming
Per-second, continuous-authorization payment streams (Lepton RFB 4) — the "streaming payments are a real code gap in x402" lane.
The viewer authorizes a rate (USDC/second) and a reserve (the maximum to commit) instead of a fixed price. Value accrues in real time while the stream is active, settles in batches, pauses the instant delivery drops (proof-of-flow), and refunds the reserved-but-unused remainder when the stream stops. The meter is computed in USDC base units over an injectable millisecond clock, so it is exact and fully deterministic under test.
import { openStream } from "@settlekit/streaming";
const stream = openStream({
payer: "0xviewer", payee: "0xstreamer", network: "arc",
ratePerSecondUsdc: "0.0001", reserveUsdc: "0.01",
});
stream.reportFlow(false); // delivery dropped -> meter pauses, not billed
stream.reportFlow(true); // recovered -> resumes
await stream.settle(sink); // batch-settle accrued-but-unsettled value
const { finalSettlement, refund } = await stream.close(); // stop + settle tail + refund unused reserve
stream.snapshot() returns the live meter: state, accruedUsdc, settledUsdc, dueUsdc, refundableUsdc.