From 45acfb353d6cd5f2d91b053035527ff50cbbe4b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?dni=20=E2=9A=A1?= Date: Wed, 4 Jan 2023 14:01:18 +0100 Subject: [PATCH] fix lndhub mypy issues --- lnbits/extensions/lndhub/views.py | 3 +-- lnbits/extensions/lndhub/views_api.py | 10 ++++------ pyproject.toml | 1 - 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/lnbits/extensions/lndhub/views.py b/lnbits/extensions/lndhub/views.py index 38a33a34..b216f8b1 100644 --- a/lnbits/extensions/lndhub/views.py +++ b/lnbits/extensions/lndhub/views.py @@ -1,5 +1,4 @@ -from fastapi import Request -from fastapi.params import Depends +from fastapi import Depends, Request from lnbits.core.models import User from lnbits.decorators import check_user_exists diff --git a/lnbits/extensions/lndhub/views_api.py b/lnbits/extensions/lndhub/views_api.py index c21c0bfd..1dff5235 100644 --- a/lnbits/extensions/lndhub/views_api.py +++ b/lnbits/extensions/lndhub/views_api.py @@ -1,15 +1,13 @@ -import asyncio import time from base64 import urlsafe_b64encode from http import HTTPStatus -from fastapi.param_functions import Query -from fastapi.params import Depends +from fastapi import Depends, Query from pydantic import BaseModel from starlette.exceptions import HTTPException from lnbits import bolt11 -from lnbits.core.crud import delete_expired_invoices, get_payments +from lnbits.core.crud import get_payments from lnbits.core.services import create_invoice, pay_invoice from lnbits.decorators import WalletTypeInfo from lnbits.settings import get_wallet_class, settings @@ -73,13 +71,13 @@ async def lndhub_addinvoice( } -class Invoice(BaseModel): +class CreateInvoice(BaseModel): invoice: str = Query(...) @lndhub_ext.post("/ext/payinvoice") async def lndhub_payinvoice( - r_invoice: Invoice, wallet: WalletTypeInfo = Depends(require_admin_key) + r_invoice: CreateInvoice, wallet: WalletTypeInfo = Depends(require_admin_key) ): try: await pay_invoice( diff --git a/pyproject.toml b/pyproject.toml index 186e2123..405cf3ca 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -96,7 +96,6 @@ exclude = """(?x)( | ^lnbits/extensions/invoices. | ^lnbits/extensions/livestream. | ^lnbits/extensions/lnaddress. - | ^lnbits/extensions/lndhub. | ^lnbits/extensions/lnurldevice. | ^lnbits/extensions/lnurlp. | ^lnbits/extensions/offlineshop.