fix: send payments via Wallet UI

This commit is contained in:
Stefan Stammberger 2021-09-11 11:47:05 +02:00
parent 63d0242685
commit 9e76668269
No known key found for this signature in database
GPG key ID: 645FA807E935D9D5

View file

@ -31,7 +31,7 @@ from ..tasks import api_invoice_listeners
@core_app.get("/api/v1/wallet") @core_app.get("/api/v1/wallet")
async def api_wallet(wallet: WalletTypeInfo = Depends(get_key_type)): async def api_wallet(wallet: WalletTypeInfo = Depends(get_key_type)):
return {"id": wallet.wallet.id, "name": wallet.wallet.name, "balance": wallet.wallet.balance_msat}, return {"id": wallet.wallet.id, "name": wallet.wallet.name, "balance": wallet.wallet.balance_msat}
@core_app.put("/api/v1/wallet/{new_name}") @core_app.put("/api/v1/wallet/{new_name}")
@ -171,7 +171,7 @@ async def api_payments_pay_invoice(bolt11: str, wallet: Wallet):
status_code=HTTPStatus.CREATED) status_code=HTTPStatus.CREATED)
async def api_payments_create(wallet: WalletTypeInfo = Depends(get_key_type), out: bool = True, async def api_payments_create(wallet: WalletTypeInfo = Depends(get_key_type), out: bool = True,
invoiceData: Optional[CreateInvoiceData] = Body(None), invoiceData: Optional[CreateInvoiceData] = Body(None),
bolt11: Optional[str] = Query(None)): bolt11: Optional[str] = Body(None)):
if wallet.wallet_type < 0 or wallet.wallet_type > 2: if wallet.wallet_type < 0 or wallet.wallet_type > 2:
raise HTTPException(status_code=HTTPStatus.BAD_REQUEST, detail="Key is invalid") raise HTTPException(status_code=HTTPStatus.BAD_REQUEST, detail="Key is invalid")