diff --git a/lnbits/extensions/lnurlpayout/crud.py b/lnbits/extensions/lnurlpayout/crud.py
index 0540cf770..873099ab0 100644
--- a/lnbits/extensions/lnurlpayout/crud.py
+++ b/lnbits/extensions/lnurlpayout/crud.py
@@ -6,14 +6,14 @@ from . import db
from .models import lnurlpayout, CreateLnurlPayoutData
-async def create_lnurlpayout(wallet_id: str, data: CreateLnurlPayoutData) -> lnurlpayout:
+async def create_lnurlpayout(wallet_id: str, admin_key: str, data: CreateLnurlPayoutData) -> lnurlpayout:
lnurlpayout_id = urlsafe_short_hash()
await db.execute(
"""
- INSERT INTO lnurlpayout.lnurlpayouts (id, title, wallet, lnurlpay, threshold)
+ INSERT INTO lnurlpayout.lnurlpayouts (id, title, wallet, admin_key, lnurlpay, threshold)
VALUES (?, ?, ?, ?, ?)
""",
- (lnurlpayout_id, data.title, wallet_id, data.lnurlpay, data.threshold),
+ (lnurlpayout_id, data.title, wallet_id, admin_key, data.lnurlpay, data.threshold),
)
lnurlpayout = await get_lnurlpayout(lnurlpayout_id)
diff --git a/lnbits/extensions/lnurlpayout/migrations.py b/lnbits/extensions/lnurlpayout/migrations.py
index 4023f095d..6af047910 100644
--- a/lnbits/extensions/lnurlpayout/migrations.py
+++ b/lnbits/extensions/lnurlpayout/migrations.py
@@ -8,6 +8,7 @@ async def m001_initial(db):
id TEXT PRIMARY KEY,
title TEXT NOT NULL,
wallet TEXT NOT NULL,
+ admin_key TEXT NOT NULL,
lnurlpay TEXT NOT NULL,
threshold INT NOT NULL
);
diff --git a/lnbits/extensions/lnurlpayout/models.py b/lnbits/extensions/lnurlpayout/models.py
index b1e163a3c..e4bc7bcef 100644
--- a/lnbits/extensions/lnurlpayout/models.py
+++ b/lnbits/extensions/lnurlpayout/models.py
@@ -11,5 +11,6 @@ class lnurlpayout(BaseModel):
id: str
title: str
wallet: str
+ admin_key: str
lnurlpay: str
threshold: str
diff --git a/lnbits/extensions/lnurlpayout/tasks.py b/lnbits/extensions/lnurlpayout/tasks.py
index 0e1cdffb3..cf4e3b246 100644
--- a/lnbits/extensions/lnurlpayout/tasks.py
+++ b/lnbits/extensions/lnurlpayout/tasks.py
@@ -25,10 +25,13 @@ async def on_invoice_paid(payment: Payment) -> None:
lnurlpayout_link = await get_lnurlpayout_from_wallet(payment.wallet_id)
print(lnurlpayout_link)
if lnurlpayout_link:
+ print("poo11")
# Check the wallet balance is more than the threshold
- wallet = await api_wallet(payment.wallet_id)
+ wallet = await api_wallet(lnurlpayout_link.admin_key)
+ print("poo1")
if wallet.balance + (wallet.balance/100*2) < lnurlpayout_link.threshold:
return
+ print("poo2")
# Get the invoice from the LNURL to pay
async with httpx.AsyncClient() as client:
try:
diff --git a/lnbits/extensions/lnurlpayout/templates/lnurlpayout/_api_docs.html b/lnbits/extensions/lnurlpayout/templates/lnurlpayout/_api_docs.html
index 1ccc5d0da..7febea44c 100644
--- a/lnbits/extensions/lnurlpayout/templates/lnurlpayout/_api_docs.html
+++ b/lnbits/extensions/lnurlpayout/templates/lnurlpayout/_api_docs.html
@@ -20,8 +20,8 @@
[<lnurlpayout_object>, ...]
curl -X GET {{ request.base_url }}api/v1/lnurlpayouts -H "X-Api-Key:
- <invoice_key>"
+ >curl -X GET {{ request.base_url }}lnurlpayout/api/v1/lnurlpayouts -H
+ "X-Api-Key: <invoice_key>"
@@ -53,9 +53,9 @@
>
curl -X POST {{ request.base_url }}api/v1/lnurlpayouts -d '{"name":
- <string>, "currency": <string>}' -H "Content-type:
- application/json" -H "X-Api-Key: <admin_key>"
+ >curl -X POST {{ request.base_url }}lnurlpayout/api/v1/lnurlpayouts -d
+ '{"name": <string>, "currency": <string>}' -H
+ "Content-type: application/json" -H "X-Api-Key: <admin_key>"
@@ -66,7 +66,6 @@
dense
expand-separator
label="Delete a lnurlpayout"
- class="q-pb-md"
>
curl -X DELETE {{ request.base_url
- }}api/v1/lnurlpayouts/<lnurlpayout_id> -H "X-Api-Key:
- <admin_key>"
+ }}lnurlpayout/api/v1/lnurlpayouts/<lnurlpayout_id> -H
+ "X-Api-Key: <admin_key>"
+
+ GET
+ /lnurlpayout/api/v1/lnurlpayouts/<lnurlpayout_id>
+ {"X-Api-Key": <invoice_key>}
[<lnurlpayout_object>, ...]
+ curl -X GET {{ request.base_url
+ }}lnurlpayout/api/v1/lnurlpayouts/<lnurlpayout_id> -H
+ "X-Api-Key: <invoice_key>"