From 026c9b5155308e6232a1536064083df69d182f32 Mon Sep 17 00:00:00 2001 From: Bitkarrot <73979971+bitkarrot@users.noreply.github.com> Date: Tue, 30 Jul 2024 09:04:07 -0700 Subject: [PATCH] Fix for LNURLp with ZBD wallet (#2609) --- lnbits/wallets/zbd.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/lnbits/wallets/zbd.py b/lnbits/wallets/zbd.py index d623b20a1..6f2f892fd 100644 --- a/lnbits/wallets/zbd.py +++ b/lnbits/wallets/zbd.py @@ -1,4 +1,5 @@ import asyncio +import hashlib from typing import AsyncGenerator, Dict, Optional import httpx @@ -13,7 +14,6 @@ from .base import ( PaymentResponse, PaymentStatus, StatusResponse, - UnsupportedError, Wallet, ) @@ -64,18 +64,23 @@ class ZBDWallet(Wallet): **kwargs, ) -> InvoiceResponse: # https://api.zebedee.io/v0/charges - if description_hash or unhashed_description: - raise UnsupportedError("description_hash") msats_amount = amount * 1000 data: Dict = { "amount": f"{msats_amount}", - "description": memo, "expiresIn": 3600, "callbackUrl": "", "internalId": "", } + ## handle description_hash and unhashed for ZBD + if description_hash: + data["description"] = description_hash.hex() + elif unhashed_description: + data["description"] = hashlib.sha256(unhashed_description).hexdigest() + else: + data["description"] = memo or "" + r = await self.client.post( "charges", json=data,