diff --git a/lnbits/extensions/withdraw/crud.py b/lnbits/extensions/withdraw/crud.py
index cc7fe387..11f7d949 100644
--- a/lnbits/extensions/withdraw/crud.py
+++ b/lnbits/extensions/withdraw/crud.py
@@ -99,6 +99,7 @@ def chunks(lst, n):
for i in range(0, len(lst), n):
yield lst[i : i + n]
+
async def create_hash_check(
the_hash: str,
lnurl_id: str,
@@ -120,6 +121,7 @@ async def create_hash_check(
row = await db.fetchone("SELECT * FROM hash_check WHERE id = ?", (the_hash,))
return HashCheck.from_row(row) if row else None
+
async def get_hash_check(the_hash: str, lnurl_id: str) -> Optional[HashCheck]:
row = await db.fetchone("SELECT * FROM hash_check WHERE id = ?", (the_hash,))
return HashCheck.from_row(row) if row else None
\ No newline at end of file
diff --git a/lnbits/extensions/withdraw/migrations.py b/lnbits/extensions/withdraw/migrations.py
index b0cf0b8f..2cb802d4 100644
--- a/lnbits/extensions/withdraw/migrations.py
+++ b/lnbits/extensions/withdraw/migrations.py
@@ -95,6 +95,7 @@ async def m002_change_withdraw_table(db):
)
await db.execute("DROP TABLE withdraw_links")
+
async def m003_make_hash_check(db):
"""
Creates a hash check table.
diff --git a/lnbits/extensions/withdraw/models.py b/lnbits/extensions/withdraw/models.py
index 4d147f25..4c485ea3 100644
--- a/lnbits/extensions/withdraw/models.py
+++ b/lnbits/extensions/withdraw/models.py
@@ -60,9 +60,11 @@ class WithdrawLink(NamedTuple):
default_description=self.title,
)
+
class HashCheck(NamedTuple):
id: str
lnurl_id: str
+
@classmethod
def from_row(cls, row: Row) -> "Hash":
return cls(**dict(row))
\ No newline at end of file
diff --git a/lnbits/extensions/withdraw/templates/withdraw/_api_docs.html b/lnbits/extensions/withdraw/templates/withdraw/_api_docs.html
index b8fa8231..c303b091 100644
--- a/lnbits/extensions/withdraw/templates/withdraw/_api_docs.html
+++ b/lnbits/extensions/withdraw/templates/withdraw/_api_docs.html
@@ -129,7 +129,6 @@
dense
expand-separator
label="Delete a withdraw link"
-
>
@@ -149,53 +148,47 @@
+
+
+
+ GET
+ /withdraw/api/v1/links/<the_hash>/<lnurl_id>
+ Headers
+ {"X-Api-Key": <invoice_key>}
+ Body (application/json)
+
+ Returns 201 CREATED (application/json)
+
+ {"status": <bool>}
+ Curl example
+ curl -X GET {{ request.url_root
+ }}api/v1/links/<the_hash>/<lnurl_id> -H "X-Api-Key: {{
+ g.user.wallets[0].inkey }}"
+
+
+
+
-
-
- GET
- /withdraw/api/v1/links/<the_hash>/<lnurl_id>
- Headers
- {"X-Api-Key": <invoice_key>}
- Body (application/json)
-
- Returns 201 CREATED (application/json)
-
- {"status": <bool>}
- Curl example
- curl -X GET {{ request.url_root }}api/v1/links/<the_hash>/<lnurl_id> -H
- "X-Api-Key: {{ g.user.wallets[0].inkey }}"
-
-
-
+ group="api"
+ dense
+ expand-separator
+ label="Get image to embed"
+ class="q-pb-md"
+ >
+
+
+ GET
+ /withdraw/img/<lnurl_id>
+ Curl example
+ curl -X GET {{ request.url_root }}/withdraw/img/<lnurl_id>"
+
+
+
+
-
-
-
- GET
- /withdraw/img/<lnurl_id>
- Curl example
- curl -X GET {{ request.url_root }}/withdraw/img/<lnurl_id>"
-
-
-
-
-
-
-
diff --git a/lnbits/extensions/withdraw/views_api.py b/lnbits/extensions/withdraw/views_api.py
index 757603c6..2f80aab5 100644
--- a/lnbits/extensions/withdraw/views_api.py
+++ b/lnbits/extensions/withdraw/views_api.py
@@ -114,6 +114,7 @@ async def api_link_delete(link_id):
return "", HTTPStatus.NO_CONTENT
+
@withdraw_ext.route("/api/v1/links//", methods=["GET"])
@api_check_wallet_key("invoice")
async def api_hash_retrieve(the_hash, lnurl_id):