Merge pull request #308 from arcbtc/FastAPI

Started on extensions and projects
This commit is contained in:
Arc 2021-08-21 00:42:18 +01:00 committed by GitHub
commit 5671348fea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -34,9 +34,7 @@ from ..tasks import api_invoice_listeners
@api_check_wallet_key("invoice") @api_check_wallet_key("invoice")
async def api_wallet(): async def api_wallet():
return ( return (
jsonable_encoder( {"id": g.wallet.id, "name": g.wallet.name, "balance": g.wallet.balance_msat},
{"id": g.wallet.id, "name": g.wallet.name, "balance": g.wallet.balance_msat}
),
HTTPStatus.OK, HTTPStatus.OK,
) )
@ -46,13 +44,11 @@ async def api_wallet():
async def api_update_wallet(new_name: str): async def api_update_wallet(new_name: str):
await update_wallet(g.wallet.id, new_name) await update_wallet(g.wallet.id, new_name)
return ( return (
jsonable_encoder(
{ {
"id": g.wallet.id, "id": g.wallet.id,
"name": g.wallet.name, "name": g.wallet.name,
"balance": g.wallet.balance_msat, "balance": g.wallet.balance_msat,
} },
),
HTTPStatus.OK, HTTPStatus.OK,
) )
@ -61,9 +57,7 @@ async def api_update_wallet(new_name: str):
@api_check_wallet_key("invoice") @api_check_wallet_key("invoice")
async def api_payments(): async def api_payments():
return ( return (
jsonable_encoder( await get_payments(wallet_id=g.wallet.id, pending=True, complete=True),
await get_payments(wallet_id=g.wallet.id, pending=True, complete=True)
),
HTTPStatus.OK, HTTPStatus.OK,
) )