From 3d8bb8610f43bae5f37ae3382899014bcfefb615 Mon Sep 17 00:00:00 2001 From: Jan Dvorak Date: Fri, 14 Jul 2023 11:13:15 +0200 Subject: [PATCH 1/4] fix broken link for tag, boltcard -> boltcards (name of the extension) --- lnurl.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lnurl.py b/lnurl.py index 82cbccb..e3ac7f1 100644 --- a/lnurl.py +++ b/lnurl.py @@ -125,7 +125,7 @@ async def lnurl_callback( wallet_id=card.wallet, payment_request=pr, max_sat=card.tx_limit, - extra={"tag": "boltcard", "hit": hit.id}, + extra={"tag": "boltcards", "hit": hit.id}, ) return {"status": "OK"} except Exception as exc: From 3ccebf81405d16ba5b7f5b1a56ae6dcc220004e3 Mon Sep 17 00:00:00 2001 From: Jan Dvorak Date: Wed, 13 Sep 2023 22:44:18 +0200 Subject: [PATCH 2/4] add support for LUD-19 in bolt cards extension --- lnurl.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lnurl.py b/lnurl.py index e3ac7f1..35aadc2 100644 --- a/lnurl.py +++ b/lnurl.py @@ -75,14 +75,23 @@ async def api_scan(p, c, request: Request, external_id: str): if hits_amount > card.daily_limit: return {"status": "ERROR", "reason": "Max daily limit spent."} hit = await create_hit(card.id, ip, agent, card.counter, ctr_int) - lnurlpay = lnurl_encode(str(request.url_for("boltcards.lnurlp_response", hit_id=hit.id))) + + #the raw lnurl + lnurlpay_raw = str(request.url_for("boltcards.lnurlp_response", hit_id=hit.id)) + #bech32 encoded lnurl + lnurlpay_bech32 = lnurl_encode(lnurlpay_raw) + #create a lud17 lnurlp to support lud19, add to payLink field of the withdrawRequest + lnurlpay_nonbech32_lud17 = lnurlpay_raw.replace("https://", "lnurlp://").replace("http://","lnurlp://") + + return { "tag": "withdrawRequest", "callback": str(request.url_for("boltcards.lnurl_callback", hit_id=hit.id)), "k1": hit.id, "minWithdrawable": 1 * 1000, "maxWithdrawable": card.tx_limit * 1000, - "defaultDescription": f"Boltcard (refund address lnurl://{lnurlpay})", + "defaultDescription": f"Boltcard (refund address lnurl://{lnurlpay_bech32})", + "payLink": lnurlpay_nonbech32_lud17, #LUD-19 compatibility } From d5905cd8bb41c03d346540ae26b043af2079bf68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Dvo=C5=99=C3=A1k?= <80678558+gorrdy@users.noreply.github.com> Date: Thu, 14 Sep 2023 05:12:03 +0200 Subject: [PATCH 3/4] Apply suggestions from code review Co-authored-by: Pavol Rusnak --- lnurl.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lnurl.py b/lnurl.py index 35aadc2..0ddb429 100644 --- a/lnurl.py +++ b/lnurl.py @@ -76,14 +76,13 @@ async def api_scan(p, c, request: Request, external_id: str): return {"status": "ERROR", "reason": "Max daily limit spent."} hit = await create_hit(card.id, ip, agent, card.counter, ctr_int) - #the raw lnurl + # the raw lnurl lnurlpay_raw = str(request.url_for("boltcards.lnurlp_response", hit_id=hit.id)) - #bech32 encoded lnurl + # bech32 encoded lnurl lnurlpay_bech32 = lnurl_encode(lnurlpay_raw) - #create a lud17 lnurlp to support lud19, add to payLink field of the withdrawRequest + # create a lud17 lnurlp to support lud19, add to payLink field of the withdrawRequest lnurlpay_nonbech32_lud17 = lnurlpay_raw.replace("https://", "lnurlp://").replace("http://","lnurlp://") - return { "tag": "withdrawRequest", "callback": str(request.url_for("boltcards.lnurl_callback", hit_id=hit.id)), From b4efd61af6589502e68ed02af9dd9acbd1d1f496 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Dvo=C5=99=C3=A1k?= <80678558+gorrdy@users.noreply.github.com> Date: Thu, 14 Sep 2023 05:12:35 +0200 Subject: [PATCH 4/4] Apply suggestions from code review Co-authored-by: Pavol Rusnak --- lnurl.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lnurl.py b/lnurl.py index 0ddb429..4b39374 100644 --- a/lnurl.py +++ b/lnurl.py @@ -90,7 +90,7 @@ async def api_scan(p, c, request: Request, external_id: str): "minWithdrawable": 1 * 1000, "maxWithdrawable": card.tx_limit * 1000, "defaultDescription": f"Boltcard (refund address lnurl://{lnurlpay_bech32})", - "payLink": lnurlpay_nonbech32_lud17, #LUD-19 compatibility + "payLink": lnurlpay_nonbech32_lud17, # LUD-19 compatibility }