prettier/black
This commit is contained in:
parent
66cde0154b
commit
ad545e7fe1
|
@ -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
|
|
@ -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.
|
||||
|
|
|
@ -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))
|
|
@ -129,7 +129,6 @@
|
|||
dense
|
||||
expand-separator
|
||||
label="Delete a withdraw link"
|
||||
|
||||
>
|
||||
<q-card>
|
||||
<q-card-section>
|
||||
|
@ -149,53 +148,47 @@
|
|||
</q-card-section>
|
||||
</q-card>
|
||||
</q-expansion-item>
|
||||
<q-expansion-item group="api" dense expand-separator label="Get Hash Check">
|
||||
<q-card>
|
||||
<q-card-section>
|
||||
<code
|
||||
><span class="text-blue">GET</span>
|
||||
/withdraw/api/v1/links/<the_hash>/<lnurl_id></code
|
||||
>
|
||||
<h5 class="text-caption q-mt-sm q-mb-none">Headers</h5>
|
||||
<code>{"X-Api-Key": <invoice_key>}</code><br />
|
||||
<h5 class="text-caption q-mt-sm q-mb-none">Body (application/json)</h5>
|
||||
<h5 class="text-caption q-mt-sm q-mb-none">
|
||||
Returns 201 CREATED (application/json)
|
||||
</h5>
|
||||
<code>{"status": <bool>}</code>
|
||||
<h5 class="text-caption q-mt-sm q-mb-none">Curl example</h5>
|
||||
<code
|
||||
>curl -X GET {{ request.url_root
|
||||
}}api/v1/links/<the_hash>/<lnurl_id> -H "X-Api-Key: {{
|
||||
g.user.wallets[0].inkey }}"
|
||||
</code>
|
||||
</q-card-section>
|
||||
</q-card>
|
||||
</q-expansion-item>
|
||||
<q-expansion-item
|
||||
group="api"
|
||||
dense
|
||||
expand-separator
|
||||
label="Get Hash Check"
|
||||
>
|
||||
<q-card>
|
||||
<q-card-section>
|
||||
<code
|
||||
><span class="text-blue">GET</span>
|
||||
/withdraw/api/v1/links/<the_hash>/<lnurl_id></code
|
||||
>
|
||||
<h5 class="text-caption q-mt-sm q-mb-none">Headers</h5>
|
||||
<code>{"X-Api-Key": <invoice_key>}</code><br />
|
||||
<h5 class="text-caption q-mt-sm q-mb-none">Body (application/json)</h5>
|
||||
<h5 class="text-caption q-mt-sm q-mb-none">
|
||||
Returns 201 CREATED (application/json)
|
||||
</h5>
|
||||
<code>{"status": <bool>}</code>
|
||||
<h5 class="text-caption q-mt-sm q-mb-none">Curl example</h5>
|
||||
<code
|
||||
>curl -X GET {{ request.url_root }}api/v1/links/<the_hash>/<lnurl_id> -H
|
||||
"X-Api-Key: {{ g.user.wallets[0].inkey }}"
|
||||
</code>
|
||||
</q-card-section>
|
||||
</q-card>
|
||||
group="api"
|
||||
dense
|
||||
expand-separator
|
||||
label="Get image to embed"
|
||||
class="q-pb-md"
|
||||
>
|
||||
<q-card>
|
||||
<q-card-section>
|
||||
<code
|
||||
><span class="text-blue">GET</span>
|
||||
/withdraw/img/<lnurl_id></code
|
||||
>
|
||||
<h5 class="text-caption q-mt-sm q-mb-none">Curl example</h5>
|
||||
<code
|
||||
>curl -X GET {{ request.url_root }}/withdraw/img/<lnurl_id>"
|
||||
</code>
|
||||
</q-card-section>
|
||||
</q-card>
|
||||
</q-expansion-item>
|
||||
</q-expansion-item>
|
||||
<q-expansion-item
|
||||
group="api"
|
||||
dense
|
||||
expand-separator
|
||||
label="Get image to embed"
|
||||
class="q-pb-md"
|
||||
>
|
||||
<q-card>
|
||||
<q-card-section>
|
||||
<code
|
||||
><span class="text-blue">GET</span>
|
||||
/withdraw/img/<lnurl_id></code
|
||||
>
|
||||
<h5 class="text-caption q-mt-sm q-mb-none">Curl example</h5>
|
||||
<code
|
||||
>curl -X GET {{ request.url_root }}/withdraw/img/<lnurl_id>"
|
||||
</code>
|
||||
</q-card-section>
|
||||
</q-card>
|
||||
</q-expansion-item>
|
||||
</q-expansion-item>
|
||||
|
||||
|
||||
|
|
|
@ -114,6 +114,7 @@ async def api_link_delete(link_id):
|
|||
|
||||
return "", HTTPStatus.NO_CONTENT
|
||||
|
||||
|
||||
@withdraw_ext.route("/api/v1/links/<the_hash>/<lnurl_id>", methods=["GET"])
|
||||
@api_check_wallet_key("invoice")
|
||||
async def api_hash_retrieve(the_hash, lnurl_id):
|
||||
|
|
Loading…
Reference in New Issue
Block a user