- clis/lepton (@settlekit/lepton-cli): operator CLI (deploy/config/settlements/lineage/proof) on real domain logic - apps/agent-console: Next.js agentic-commerce surface, real domain logic (agent-services + citation-toll + attribution) - apps/stream-meter: Next.js live per-second streaming meter (RFB 4) on real @settlekit/streaming - packages/payouts-cpn (@settlekit/payouts-cpn): Circle CPN fiat off-ramp, credential-gated + local provider + tests - common: make ids.ts isomorphic (Web Crypto) so domain packages bundle into client components - wire clis/lepton into pnpm-workspace + vitest; 1031 tests, typecheck, all next builds green
2.0 KiB
@settlekit/stream-meter
A live per-second USDC streaming-payment meter (Lepton RFB 4) built on the
real @settlekit/streaming domain logic. A viewer authorizes a rate
(USDC/second) and a reserve (the maximum to commit); value accrues in real
time as an Owncast broadcast or Navidrome listen is delivered, pauses the
instant delivery drops (proof-of-flow), and settles in gas-free checkpoints.
Pages
- Meter (
/) — SSR totals plus a live, ticking per-second meter that drives a realPaymentStreamin the browser. Accrued / due / settled / refundable values come straight fromstream.snapshot()— never a hand-rolled formula. - Streams (
/streams) — every active stream (Owncast broadcasts and Navidrome listens) with its parties, authorized rate, state, and accrued / settled / refundable balances. - Settlements (
/settlements) — the settlement checkpoints captured as each stream batched its accrued-but-unsettled value.
Domain logic, not mocked JSON
lib/data.ts builds every stream with openStream() from @settlekit/streaming
over a fixed millisecond clock, advancing a cursor in steps and calling
reportFlow() / settle() exactly as a live integration would. The fixed clock
makes server rendering and next build deterministic. The browser meter
(components/LiveMeter.tsx, "use client") builds the same real
PaymentStream via buildLiveStream(() => Date.now()) so the on-screen ticker
is the genuine accrual function, not a re-implementation.
Swap lib/data.ts for a StreamStore-backed loader (e.g. a Postgres
StreamStore) to go live.
Develop
pnpm --filter @settlekit/stream-meter dev # http://localhost:3009
Build
@settlekit/streaming and @settlekit/common are consumed as compiled ESM
(dist/), so they must be built first. The ... selector handles that:
pnpm --filter @settlekit/stream-meter... build
# or build the whole workspace: pnpm -r build
Port: 3009.