feat: add lud17 support (#60)

This commit is contained in:
dni ⚡ 2025-08-25 12:25:20 +02:00 committed by GitHub
commit 10a4caff7e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 92 additions and 155 deletions

View file

@ -4,7 +4,7 @@ import shortuuid
from lnbits.db import Database
from lnbits.helpers import urlsafe_short_hash
from .models import CreateWithdrawData, HashCheck, WithdrawLink
from .models import CreateWithdrawData, HashCheck, PaginatedWithdraws, WithdrawLink
db = Database("ext_withdraw")
@ -66,7 +66,7 @@ async def get_withdraw_link_by_hash(unique_hash: str, num=0) -> WithdrawLink | N
async def get_withdraw_links(
wallet_ids: list[str], limit: int, offset: int
) -> tuple[list[WithdrawLink], int]:
) -> PaginatedWithdraws:
q = ",".join([f"'{w}'" for w in wallet_ids])
query_str = f"""
@ -85,16 +85,15 @@ async def get_withdraw_links(
query_params,
WithdrawLink,
)
result = await db.execute(
f"""
SELECT COUNT(*) as total FROM withdraw.withdraw_link
WHERE wallet IN ({q})
"""
)
total = result.mappings().first()
result2 = result.mappings().first()
return links, total.total
return PaginatedWithdraws(data=links, total=int(result2.total))
async def remove_unique_withdraw_link(link: WithdrawLink, unique_hash: str) -> None: