From 720c2756b6088e3b77bdbfefc93fd6c53b9b57d0 Mon Sep 17 00:00:00 2001 From: heyolaniran Date: Mon, 18 May 2026 18:17:06 +0100 Subject: [PATCH] fix: route lightning address payments to the user's default wallet listByAccountId returns wallets in undefined order, causing wallet[0] to resolve to a random wallet's lnurlp. Use the account's defaultWalletId to honour whichever wallet the user has designated as default, whether that is the BTC, USD, or external wallet. --- src/services/ibex/webhook-server/routes/on-pay.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/services/ibex/webhook-server/routes/on-pay.ts b/src/services/ibex/webhook-server/routes/on-pay.ts index f47d24d61..73576d544 100644 --- a/src/services/ibex/webhook-server/routes/on-pay.ts +++ b/src/services/ibex/webhook-server/routes/on-pay.ts @@ -47,11 +47,11 @@ router.get( if (account instanceof Error) { return resp.status(404).json({ error: "User not found" }) } - const wallet = await WalletsRepository().listByAccountId(account.id) - if (!wallet || wallet instanceof Error || wallet.length === 0) { + const wallet = await WalletsRepository().findById(account.defaultWalletId) + if (!wallet || wallet instanceof Error) { return resp.status(404).json({ error: "No wallet found for this user" }) } - const lnurlp = wallet[0].lnurlp + const lnurlp = wallet.lnurlp if (!lnurlp) return resp.status(404).json({ error: "No lnurlp found for this wallet" })