From c7e8f628aa215caaa999f06d7fccb910fd5cc099 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Sun, 15 Feb 2026 16:58:17 -0800 Subject: fix custodial bitcoin sends --- src/routes/(app)/send/invoice/[id]/+page.server.ts | 10 ++++--- src/routes/(app)/send/invoice/[id]/+page.svelte | 31 +++++++++++++--------- 2 files changed, 26 insertions(+), 15 deletions(-) (limited to 'src/routes/(app)/send/invoice') diff --git a/src/routes/(app)/send/invoice/[id]/+page.server.ts b/src/routes/(app)/send/invoice/[id]/+page.server.ts index 59add224..dfbe9d26 100644 --- a/src/routes/(app)/send/invoice/[id]/+page.server.ts +++ b/src/routes/(app)/send/invoice/[id]/+page.server.ts @@ -12,7 +12,7 @@ export async function load({ cookies, depends, params: { id }, parent }) { const trust = await get("/trust", auth(cookies)); const trusted = trust.includes(invoice.uid); - if (trusted && (pin || !user.haspin)) { + if (trusted && (pin || !user.haspin) && invoice.amount) { let p; try { if (!invoice.tip && invoice.user.prompt) { @@ -37,8 +37,12 @@ export async function load({ cookies, depends, params: { id }, parent }) { if (invoice.memoPrompt && invoice.memo === null) redirect(307, `/invoice/${id}/memo`); if (user && invoice.aid === aid) error(500, { message: "Cannot send to self" }); - else if (user && ![types.lightning, types.bolt12].includes(invoice.type)) - redirect(307, `/send/${invoice.type === types.ecash ? "ecash" : "bitcoin"}/${invoice.hash}`); + else if (user && ![types.lightning, types.bolt12].includes(invoice.type)) { + // Don't redirect custodial bitcoin invoices — they should be paid internally + const isVault = invoice.account?.pubkey || invoice.account?.seed; + if (invoice.type !== types.bitcoin || isVault) + redirect(307, `/send/${invoice.type === types.ecash ? "ecash" : "bitcoin"}/${invoice.hash}`); + } if (!user) redirect(307, `/invoice/${id}`); diff --git a/src/routes/(app)/send/invoice/[id]/+page.svelte b/src/routes/(app)/send/invoice/[id]/+page.svelte index 99040ed6..01b4facd 100644 --- a/src/routes/(app)/send/invoice/[id]/+page.svelte +++ b/src/routes/(app)/send/invoice/[id]/+page.svelte @@ -1,6 +1,6 @@