mirror of
https://github.com/lnbits/lnbits.git
synced 2025-09-27 12:26:19 +02:00
fix: enpoints
This commit is contained in:
@@ -82,11 +82,11 @@ async def api_cashu_delete(
|
|||||||
|
|
||||||
if not cashu:
|
if not cashu:
|
||||||
raise HTTPException(
|
raise HTTPException(
|
||||||
status_code=HTTPStatus.NOT_FOUND, detail="TPoS does not exist."
|
status_code=HTTPStatus.NOT_FOUND, detail="Cashu does not exist."
|
||||||
)
|
)
|
||||||
|
|
||||||
if cashu.wallet != wallet.wallet.id:
|
if cashu.wallet != wallet.wallet.id:
|
||||||
raise HTTPException(status_code=HTTPStatus.FORBIDDEN, detail="Not your TPoS.")
|
raise HTTPException(status_code=HTTPStatus.FORBIDDEN, detail="Not your Cashu.")
|
||||||
|
|
||||||
await delete_cashu(cashu_id)
|
await delete_cashu(cashu_id)
|
||||||
raise HTTPException(status_code=HTTPStatus.NO_CONTENT)
|
raise HTTPException(status_code=HTTPStatus.NO_CONTENT)
|
||||||
@@ -206,7 +206,7 @@ async def api_cashu_check_invoice(cashu_id: str, payment_hash: str):
|
|||||||
########################################
|
########################################
|
||||||
|
|
||||||
|
|
||||||
@cashu_ext.get("/api/v1/mint/{cashu_id}/keys", status_code=HTTPStatus.OK)
|
@cashu_ext.get("/api/v1/cashu/{cashu_id}/keys", status_code=HTTPStatus.OK)
|
||||||
async def keys(
|
async def keys(
|
||||||
cashu_id: str = Query(False), wallet: WalletTypeInfo = Depends(get_key_type)
|
cashu_id: str = Query(False), wallet: WalletTypeInfo = Depends(get_key_type)
|
||||||
):
|
):
|
||||||
@@ -219,7 +219,7 @@ async def keys(
|
|||||||
return get_pubkeys(mint.prvkey)
|
return get_pubkeys(mint.prvkey)
|
||||||
|
|
||||||
|
|
||||||
@cashu_ext.get("/api/v1/{cashu_id}/mint")
|
@cashu_ext.get("/api/v1/cashu/{cashu_id}/mint")
|
||||||
async def mint_pay_request(
|
async def mint_pay_request(
|
||||||
amount: int = 0,
|
amount: int = 0,
|
||||||
cashu_id: str = Query(None),
|
cashu_id: str = Query(None),
|
||||||
@@ -253,7 +253,7 @@ async def mint_pay_request(
|
|||||||
return {"pr": payment_request, "hash": payment_hash}
|
return {"pr": payment_request, "hash": payment_hash}
|
||||||
|
|
||||||
|
|
||||||
@cashu_ext.post("/api/v1/{cashu_id}/mint")
|
@cashu_ext.post("/api/v1/cashu/{cashu_id}/mint")
|
||||||
async def mint_coins(
|
async def mint_coins(
|
||||||
data: MintPayloads,
|
data: MintPayloads,
|
||||||
cashu_id: str = Query(None),
|
cashu_id: str = Query(None),
|
||||||
@@ -286,7 +286,7 @@ async def mint_coins(
|
|||||||
|
|
||||||
status: PaymentStatus = await check_transaction_status(cashu.wallet, payment_hash)
|
status: PaymentStatus = await check_transaction_status(cashu.wallet, payment_hash)
|
||||||
# todo: revert to: status.paid != True:
|
# todo: revert to: status.paid != True:
|
||||||
if status.paid == False:
|
if status.paid != True:
|
||||||
raise HTTPException(
|
raise HTTPException(
|
||||||
status_code=HTTPStatus.PAYMENT_REQUIRED, detail="Invoice not paid."
|
status_code=HTTPStatus.PAYMENT_REQUIRED, detail="Invoice not paid."
|
||||||
)
|
)
|
||||||
@@ -311,7 +311,7 @@ async def mint_coins(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@cashu_ext.post("/api/v1/{cashu_id}/melt")
|
@cashu_ext.post("/api/v1/cashu/{cashu_id}/melt")
|
||||||
async def melt_coins(payload: MeltPayload, cashu_id: str = Query(None)):
|
async def melt_coins(payload: MeltPayload, cashu_id: str = Query(None)):
|
||||||
cashu: Cashu = await get_cashu(cashu_id)
|
cashu: Cashu = await get_cashu(cashu_id)
|
||||||
if cashu is None:
|
if cashu is None:
|
||||||
|
Reference in New Issue
Block a user