fix pyright lnbits/wallets

Co-authored-by: dni  <office@dnilabs.com>
This commit is contained in:
Pavol Rusnak
2023-04-04 07:34:50 +02:00
committed by dni ⚡
co-authored by dni ⚡
parent 0607cb1d6e
commit 9c8a79eb9b
10 changed files with 163 additions and 130 deletions
+3 -4
View File
@@ -21,12 +21,13 @@ class LNbitsWallet(Wallet):
def __init__(self):
self.endpoint = settings.lnbits_endpoint
key = (
settings.lnbits_key
or settings.lnbits_admin_key
or settings.lnbits_invoice_key
)
if not self.endpoint or not key:
raise Exception("cannot initialize lnbits wallet")
self.key = {"X-Api-Key": key}
async def status(self) -> StatusResponse:
@@ -60,7 +61,7 @@ class LNbitsWallet(Wallet):
unhashed_description: Optional[bytes] = None,
**kwargs,
) -> InvoiceResponse:
data: Dict = {"out": False, "amount": amount}
data: Dict = {"out": False, "amount": amount, "memo": memo or ""}
if kwargs.get("expiry"):
data["expiry"] = kwargs["expiry"]
if description_hash:
@@ -68,8 +69,6 @@ class LNbitsWallet(Wallet):
if unhashed_description:
data["unhashed_description"] = unhashed_description.hex()
data["memo"] = memo or ""
async with httpx.AsyncClient() as client:
r = await client.post(
url=f"{self.endpoint}/api/v1/payments", headers=self.key, json=data