run402 4.76.1 → 4.76.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  {
2
- "surface_version": "4.76.1",
2
+ "surface_version": "4.76.2",
3
3
  "verbs": [
4
4
  "repos create",
5
5
  "repos list",
package/lib/billing.mjs CHANGED
@@ -12,7 +12,7 @@ Subcommands:
12
12
  create-email <email> Create an email organization
13
13
  link-wallet [<org_id>] <wallet_address> Link a wallet to an email organization
14
14
  checkout <identifier> --product <p> Create an org checkout
15
- topup <identifier> --sats <n> [--wait] Top up the cash balance over Lightning (a bolt11 invoice; no node, no Stripe)
15
+ topup <identifier> --sats <n> [--wait] [--qr <file.png>] Top up the cash balance over Lightning (a bolt11 invoice; --qr also writes a scannable PNG)
16
16
  auto-recharge [<org_id>] <on|off> [--threshold <n>]
17
17
  balance <identifier> Balance by organization id (UUID), wallet (0x...), or email
18
18
  history <identifier> [--limit <n>] Ledger history by organization id (UUID), wallet, or email
@@ -23,6 +23,7 @@ Examples:
23
23
  run402 billing checkout 0x1234... --product email-pack
24
24
  run402 billing checkout 0x1234... --product balance-topup --amount 5000000
25
25
  run402 billing topup 0x1234... --sats 2000 --wait
26
+ run402 billing topup 0x1234... --sats 2000 --qr /tmp/invoice.png # also write the invoice as a scannable PNG
26
27
  run402 billing auto-recharge org_abc on --threshold 2000
27
28
  run402 billing balance user@example.com
28
29
  `;
@@ -215,7 +216,7 @@ async function checkout(args) {
215
216
  // invoice line and the receipt go to stderr.
216
217
  async function topup(args) {
217
218
  const parsedArgs = normalizeArgv(args);
218
- const valueFlags = ["--sats", "--timeout", "--idempotency-key"];
219
+ const valueFlags = ["--sats", "--timeout", "--idempotency-key", "--qr"];
219
220
  assertKnownFlags(parsedArgs, [...valueFlags, "--wait", "--help", "-h"], valueFlags);
220
221
  const positionals = positionalArgs(parsedArgs, valueFlags);
221
222
  const identifier = positionals[0];
@@ -242,6 +243,14 @@ async function topup(args) {
242
243
  console.log(JSON.stringify(created, null, 2));
243
244
  console.error(`Invoice for ${created.amount_sats} sats (≈ $${(created.amount_usd_micros / 1_000_000).toFixed(2)} at the quoted rate), expires ${created.invoice_expires_at}.`);
244
245
  console.error(`Pay it from any Lightning wallet:\n lightning:${created.bolt11}`);
246
+ const qrPath = flagValue(parsedArgs, "--qr");
247
+ if (qrPath) {
248
+ // Uppercase bolt11 in a `LIGHTNING:` URI is what wallets and the BOLT11
249
+ // spec recommend for QR: alphanumeric mode, a third fewer modules.
250
+ const { toFile } = await import("qrcode");
251
+ await toFile(qrPath, `LIGHTNING:${created.bolt11.toUpperCase()}`, { type: "png", width: 512, margin: 2, errorCorrectionLevel: "M" });
252
+ console.error(`QR written to ${qrPath} — post the image where the payer can scan it.`);
253
+ }
245
254
  if (!parsedArgs.includes("--wait")) {
246
255
  console.error(`Then read it: run402 billing topup is one-shot; poll GET /orgs/v1/${org.org_id}/checkouts/${created.topup_id} (or rerun with --wait).`);
247
256
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "run402",
3
- "version": "4.76.1",
3
+ "version": "4.76.2",
4
4
  "description": "CLI for Run402 — full-stack backend infrastructure for AI agents: Postgres, auth, storage, serverless functions and atomic deploys. Paid with x402/MPP. Includes $0.03 image generation.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -37,6 +37,7 @@
37
37
  "ipaddr.js": "1.9.1",
38
38
  "json-canonicalize": "2.0.0",
39
39
  "mppx": "^0.4.7",
40
+ "qrcode": "1.5.4",
40
41
  "tsx": "^4.21.0",
41
42
  "undici": "^7.29.0",
42
43
  "viem": "^2.47.1"