From afed041f9a1dae38c2765212ddff3cb60a0ee8b5 Mon Sep 17 00:00:00 2001 From: thePR0M3TH3AN <53631862+PR0M3TH3AN@users.noreply.github.com> Date: Sat, 4 Jul 2026 23:41:25 -0400 Subject: [PATCH] zaps: retried shares also publish tallies + bump the badge (#47) executeRetry now fires the same onZapSuccess hook as the main send path with the retried shares' proof, so a zap completed via the retry flow gets its optimistic bump and preimage-verified tally publish too (was previously only on the first-attempt path). Closes the retry-path item in the plan checklist. Co-Authored-By: Claude Fable 5 --- js/ui/zapController.js | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/js/ui/zapController.js b/js/ui/zapController.js index f460ef09..f525e393 100644 --- a/js/ui/zapController.js +++ b/js/ui/zapController.js @@ -1112,6 +1112,38 @@ export default class ZapController { : "Retried zap shares successfully."; this.videoModal?.setZapStatus(successMessage, "success"); this.notifySuccess("Zap shares retried successfully!"); + + // Retried shares also bump the badge + publish verified tallies (same hook + // as the main path; docs/zap-tally-plan.md ยง5.4). Best-effort. + if (this.callbacks.onZapSuccess) { + try { + const shareProof = aggregatedReceipts + .filter( + (r) => + r && + (r.status === "success" || !r.status) && + typeof r.preimage === "string" && + r.preimage, + ) + .map((r) => ({ + recipientType: r.recipientType || "creator", + amountSats: Math.max(0, Math.round(Number(r.amount) || 0)), + bolt11: + typeof r.invoice?.invoice === "string" ? r.invoice.invoice : "", + preimage: r.preimage, + zapRequest: typeof r.zapRequest === "string" ? r.zapRequest : "", + })) + .filter((s) => s.bolt11 && s.zapRequest && s.amountSats > 0); + this.callbacks.onZapSuccess({ + video: this.getCurrentVideo(), + sats: total, + shares: shareProof, + }); + } catch (error) { + userLogger.warn("[zap] onZapSuccess hook failed (retry):", error); + } + } + this.resetRetryState(); return true; }