Fix 0 sat lnaddr invoices (#2149)

* Fix comment position

* Fix possible 0 sat lnaddr invoices
This commit is contained in:
ekzyis 2025-05-05 09:56:04 -05:00 committed by GitHub
parent b864290cac
commit f754b530ff
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -17,11 +17,15 @@ export const createInvoice = async (
const { min, callback, commentAllowed } = await lnAddrOptions(address, { signal })
const callbackUrl = new URL(callback)
// most lnurl providers suck nards so we have to floor to nearest sat
if (!msats) {
// use min sendable amount by default
msats = 1_000 * min
}
// create invoices with a minimum amount of 1 sat
msats = Math.max(msats, 1_000)
// most lnurl providers suck nards so we have to floor to nearest sat
msats = msatsSatsFloor(msats)
callbackUrl.searchParams.append('amount', msats)