Releases: lnbotdev/typescript-l402
Releases · lnbotdev/typescript-l402
v1.0.0
v1.0.0
Migrate to wallet-scoped L402 API (@lnbot/sdk v1.0.0).
Breaking Changes
paywall()options now requirewalletIdfieldclient()options now requirewalletIdfield- Minimum
@lnbot/sdkpeer dependency is now>=1.0.0
Migration
// Before (v0.x)
l402.paywall(ln, { price: 10 });
l402.client(ln);
// After (v1.0.0)
l402.paywall(ln, { walletId: "wal_xxx", price: 10 });
l402.client(ln, { walletId: "wal_xxx" });v0.2.0
What's Changed
- Fix:
maxPricecheck now throwsL402BudgetExceededErrorinstead of genericL402Error, so all spending-limit violations can be caught with a singleinstanceof - Fix: Budget tracker now records the actual amount paid via SDK (
payment.amount) instead of the server's self-reported price - Safety: Client throws
L402PaymentFailedErrorif server still returns 402 after a successful payment (prevents infinite retry loops) - Feature: Added
put(),patch(), anddelete()convenience methods toL402Client
v0.1.0
Initial release of @lnbot/l402 — L402 Lightning payment middleware for Express.js.
Features
- Server middleware —
l402.paywall()protects Express routes behind an L402 paywall with fixed or dynamic pricing - Client wrapper —
l402.client()auto-pays L402-protected APIs with token caching and budget controls - Header utilities — parse and format L402
AuthorizationandWWW-Authenticateheaders - Zero crypto dependencies — all L402 logic (macaroons, verification, payment) delegated to
@lnbot/sdk
Quick start
import express from "express";
import { l402, LnBot } from "@lnbot/l402";
const app = express();
const ln = new LnBot({ apiKey: "key_..." });
app.use("/api/premium", l402.paywall(ln, { price: 10 }));See the README for full documentation.