From ec4adcf1daf39f061f95a6c377ab037e68ba39a5 Mon Sep 17 00:00:00 2001 From: Rassl Date: Mon, 13 Apr 2026 23:12:17 +0400 Subject: [PATCH] feat: fix payment --- src/lib/sphinx/bridge.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/lib/sphinx/bridge.ts b/src/lib/sphinx/bridge.ts index 979a54a3..941de0a9 100644 --- a/src/lib/sphinx/bridge.ts +++ b/src/lib/sphinx/bridge.ts @@ -94,7 +94,13 @@ export async function payInvoice(invoice: string): Promise<{ preimage: string } if (isSphinx()) { try { - console.log("[payInvoice] calling sphinx.sendPayment...") + // Ensure Sphinx has budget allocated before paying + let budget = await sphinx.setBudget() + if (!budget?.budget) { + budget = await sphinx.authorize() + } + console.log("[payInvoice] Sphinx budget:", budget?.budget) + const result = await sphinx.sendPayment(invoice) console.log("[payInvoice] sphinx.sendPayment result:", JSON.stringify(result)) return result?.preimage ? { preimage: result.preimage } : null