Fix for LNURLp with ZBD wallet (#2609)

This commit is contained in:
Bitkarrot 2024-07-30 09:04:07 -07:00 committed by GitHub
parent c834929f8b
commit 026c9b5155
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,4 +1,5 @@
import asyncio import asyncio
import hashlib
from typing import AsyncGenerator, Dict, Optional from typing import AsyncGenerator, Dict, Optional
import httpx import httpx
@ -13,7 +14,6 @@ from .base import (
PaymentResponse, PaymentResponse,
PaymentStatus, PaymentStatus,
StatusResponse, StatusResponse,
UnsupportedError,
Wallet, Wallet,
) )
@ -64,18 +64,23 @@ class ZBDWallet(Wallet):
**kwargs, **kwargs,
) -> InvoiceResponse: ) -> InvoiceResponse:
# https://api.zebedee.io/v0/charges # https://api.zebedee.io/v0/charges
if description_hash or unhashed_description:
raise UnsupportedError("description_hash")
msats_amount = amount * 1000 msats_amount = amount * 1000
data: Dict = { data: Dict = {
"amount": f"{msats_amount}", "amount": f"{msats_amount}",
"description": memo,
"expiresIn": 3600, "expiresIn": 3600,
"callbackUrl": "", "callbackUrl": "",
"internalId": "", "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( r = await self.client.post(
"charges", "charges",
json=data, json=data,