Add service fee to specific wallet (#2050)
* add service fee to specific wallet * add to .env.example * Added service fee wallet to manage server * cleaned * prettier * Added badge for service fee * Added tooltip * Added service fee max * allow ignoring service fee for internal transactions * add fee_reserve_total helper funciton that includes service_fee * html for admin ui * typo * Update .env.example Co-authored-by: Pavol Rusnak <pavol@rusnak.io> * fix .env.template comment * bundle * WIP: expose fee reserve endpoint --------- Co-authored-by: Arc <ben@arc.wales> Co-authored-by: dni ⚡ <office@dnilabs.com> Co-authored-by: Pavol Rusnak <pavol@rusnak.io>
This commit is contained in:
co-authored by
Pavol Rusnak
Arc
dni ⚡
parent
4dcf26bcb3
commit
6a27b91fcb
@@ -104,6 +104,7 @@ from ..services import (
|
||||
PaymentFailure,
|
||||
check_transaction_status,
|
||||
create_invoice,
|
||||
fee_reserve_total,
|
||||
pay_invoice,
|
||||
perform_lnurlauth,
|
||||
websocketManager,
|
||||
@@ -386,6 +387,21 @@ async def api_payments_create(
|
||||
)
|
||||
|
||||
|
||||
@api_router.get("/api/v1/payments/fee-reserve")
|
||||
async def api_payments_fee_reserve(invoice: str = Query("invoice")) -> JSONResponse:
|
||||
invoice_obj = bolt11.decode(invoice)
|
||||
if invoice_obj.amount_msat:
|
||||
response = {
|
||||
"fee_reserve": fee_reserve_total(invoice_obj.amount_msat),
|
||||
}
|
||||
return JSONResponse(response)
|
||||
else:
|
||||
raise HTTPException(
|
||||
status_code=HTTPStatus.BAD_REQUEST,
|
||||
detail="Invoice has no amount.",
|
||||
)
|
||||
|
||||
|
||||
@api_router.post("/api/v1/payments/lnurl")
|
||||
async def api_payments_pay_lnurl(
|
||||
data: CreateLnurl, wallet: WalletTypeInfo = Depends(require_admin_key)
|
||||
|
||||
Reference in New Issue
Block a user