feat: add disable option for LNURLw (#70)

This commit is contained in:
Tiago Vasconcelos 2026-03-17 21:41:17 +00:00 committed by GitHub
commit 74852e3494
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 76 additions and 7 deletions

View file

@ -43,6 +43,9 @@ async def api_lnurl_response(
if not link:
return LnurlErrorResponse(reason="Withdraw link does not exist.")
if not link.enabled:
return LnurlErrorResponse(reason="Withdraw link is disabled.")
if link.is_spent:
return LnurlErrorResponse(reason="Withdraw is spent.")
@ -86,11 +89,13 @@ async def api_lnurl_callback(
pr: str,
id_unique_hash: str | None = None,
) -> LnurlErrorResponse | LnurlSuccessResponse:
link = await get_withdraw_link_by_hash(unique_hash)
if not link:
return LnurlErrorResponse(reason="withdraw link not found.")
if not link.enabled:
return LnurlErrorResponse(reason="Withdraw link is disabled.")
if link.is_spent:
return LnurlErrorResponse(reason="withdraw is spent.")
@ -194,6 +199,9 @@ async def api_lnurl_multi_response(
if not link:
return LnurlErrorResponse(reason="Withdraw link does not exist.")
if not link.enabled:
return LnurlErrorResponse(reason="Withdraw link is disabled.")
if link.is_spent:
return LnurlErrorResponse(reason="Withdraw is spent.")