Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
needs: [lint]
strategy:
matrix:
python-version: ['3.9', '3.10']
python-version: ['3.10', '3.11', '3.12']
steps:
- uses: actions/checkout@v4
- uses: lnbits/lnbits/.github/actions/prepare@dev
Expand Down
4 changes: 2 additions & 2 deletions crud.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import secrets
import time
from typing import List, Optional, Union
from typing import Optional, Union
from uuid import uuid4

from .db import db
Expand Down Expand Up @@ -41,7 +41,7 @@ async def get_bleskomat_by_api_key_id(api_key_id: str) -> Optional[Bleskomat]:
)


async def get_bleskomats(wallet_ids: Union[str, List[str]]) -> List[Bleskomat]:
async def get_bleskomats(wallet_ids: Union[str, list[str]]) -> list[Bleskomat]:
if isinstance(wallet_ids, str):
wallet_ids = [wallet_ids]
q = ",".join([f"'{wallet_id}'" for wallet_id in wallet_ids])
Expand Down
10 changes: 5 additions & 5 deletions models.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import bolt11
from fastapi import Query, Request
from lnbits.core.services import pay_invoice
from lnbits.db import Connection
from lnbits.exceptions import PaymentError
from loguru import logger
from pydantic import BaseModel, validator
Expand Down Expand Up @@ -131,15 +132,14 @@ async def execute_action(self, query):
logger.error(str(exc))
raise LnurlValidationError("Unexpected error") from exc

async def use(self, conn) -> bool:
async def use(self, conn: Connection) -> bool:
now = int(time.time())
result = await conn.execute(
"""
UPDATE bleskomat.bleskomat_lnurls
SET remaining_uses = remaining_uses - 1, updated_time = ?
WHERE id = ?
AND remaining_uses > 0
SET remaining_uses = remaining_uses - 1, updated_time = :now
WHERE id = :id AND remaining_uses > 0
""",
(now, self.id),
{"now": now, "id": self.id},
)
return result.rowcount > 0
Loading