fix pyright lnbits/core

Co-authored-by: dni  <office@dnilabs.com>
This commit is contained in:
Pavol Rusnak
2023-04-04 07:34:37 +02:00
committed by dni ⚡
co-authored by dni ⚡
parent 02306148df
commit 0607cb1d6e
4 changed files with 38 additions and 31 deletions
+10 -6
View File
@@ -411,8 +411,7 @@ async def subscribe_wallet_invoices(request: Request, wallet: Wallet):
typ, data = await send_queue.get()
if data:
jdata = json.dumps(dict(data.dict(), pending=False))
yield dict(data=jdata, event=typ)
yield dict(data=jdata, event=typ)
except asyncio.CancelledError:
logger.debug(f"removing listener for wallet {uid}")
api_invoice_listeners.pop(uid)
@@ -431,11 +430,12 @@ async def api_payments_sse(
)
# TODO: refactor this route into a public and admin one
@core_app.get("/api/v1/payments/{payment_hash}")
async def api_payment(payment_hash, X_Api_Key: Optional[str] = Header(None)):
# We use X_Api_Key here because we want this call to work with and without keys
# If a valid key is given, we also return the field "details", otherwise not
wallet = await get_wallet_for_key(X_Api_Key) if type(X_Api_Key) == str else None
wallet = await get_wallet_for_key(X_Api_Key) if type(X_Api_Key) == str else None # type: ignore
# we have to specify the wallet id here, because postgres and sqlite return internal payments in different order
# and get_standalone_payment otherwise just fetches the first one, causing unpredictable results
@@ -505,6 +505,7 @@ async def api_lnurlscan(code: str, wallet: WalletTypeInfo = Depends(get_key_type
params.update(callback=url) # with k1 already in it
lnurlauth_key = wallet.wallet.lnurlauth_key(domain)
assert lnurlauth_key.verifying_key
params.update(pubkey=lnurlauth_key.verifying_key.to_string("compressed").hex())
else:
async with httpx.AsyncClient() as client:
@@ -693,7 +694,7 @@ async def api_auditor():
if not error_message:
delta = node_balance - total_balance
else:
node_balance, delta = None, None
node_balance, delta = 0, 0
return {
"node_balance_msats": int(node_balance),
@@ -745,6 +746,7 @@ async def api_install_extension(
raise HTTPException(
status_code=HTTPStatus.NOT_FOUND, detail="Release not found"
)
ext_info = InstallableExtension(
id=data.ext_id, name=data.ext_id, installed_release=release, icon=release.icon
)
@@ -824,8 +826,10 @@ async def api_uninstall_extension(ext_id: str, user: User = Depends(check_admin)
)
@core_app.get("/api/v1/extension/{ext_id}/releases")
async def get_extension_releases(ext_id: str, user: User = Depends(check_admin)):
@core_app.get(
"/api/v1/extension/{ext_id}/releases", dependencies=[Depends(check_admin)]
)
async def get_extension_releases(ext_id: str):
try:
extension_releases: List[
ExtensionRelease