From 8880893446c78be7cce3f467aa42e682d33ed2b6 Mon Sep 17 00:00:00 2001 From: Vladimir Rogojin Date: Sat, 23 May 2026 16:42:20 +0200 Subject: [PATCH] fix(cli)(#24): use 'full' sync mode for invoice-status and invoice-list MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Both commands need the IPFS / Profile pointer pull, not just the Nostr inbox. 'nostr' mode skipped that pull, so on a fresh device or after a wipe `invoice-status` reported "No invoice found matching prefix" and `invoice-list` returned an empty set — even when the invoice had been minted by another peer and was reachable on-chain. The other invoice commands (deliver, close, cancel, pay, return, receipts, notices, auto-return, transfers, export) already used 'full'. This aligns the two read-side commands with the rest. Companion sphere-sdk fix is #230 — once that lands, the receiver-side AccountingModule.invoiceTermsCache will also refresh on sync:completed and the full cross-device §C.4 flow will work end-to-end. Refs sphere-cli#24, sphere-sdk#230, sphere-sdk#223 --- src/legacy/legacy-cli.ts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/legacy/legacy-cli.ts b/src/legacy/legacy-cli.ts index 3262e43..22a852d 100644 --- a/src/legacy/legacy-cli.ts +++ b/src/legacy/legacy-cli.ts @@ -4277,7 +4277,12 @@ async function main(): Promise { console.error('Accounting module not enabled.'); process.exit(1); } - await ensureSync(sphere, 'nostr'); + // Invoice listing surfaces invoice tokens, including those received + // cross-device via Profile/IPFS sync. 'nostr' only pulls inbox DMs + // and skips the IPFS pull, so on a fresh device or after a wipe the + // list misses invoices that landed on another peer. Use 'full' to + // include the IPFS / Profile pointer pull (issue sphere-cli#24). + await ensureSync(sphere, 'full'); const stateIdx = args.indexOf('--state'); const limitIdx2 = args.indexOf('--limit'); @@ -4340,7 +4345,12 @@ async function main(): Promise { console.error('Accounting module not enabled.'); process.exit(1); } - await ensureSync(sphere, 'nostr'); + // Per-target balance is computed from on-chain payment attribution, + // which requires the IPFS / Profile pointer pull — not just the + // Nostr inbox. 'nostr' mode skips that pull, so on a fresh device + // or after a wipe the status is stale / "No invoice found" even + // when the invoice exists on another peer (issue sphere-cli#24). + await ensureSync(sphere, 'full'); // Resolve ID from prefix const allInvoices = await sphere.accounting.getInvoices();