From 61c9a22fe1475034d81239cb447d8b9f2a53a9fc Mon Sep 17 00:00:00 2001
From: Joel Klabo
Date: Mon, 9 Jan 2023 07:20:22 -0800
Subject: [PATCH 1/4] Don't Multiply Sat Price by 100 for NIP-5 Verification
---
lnbits/extensions/nostrnip5/crud.py | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/lnbits/extensions/nostrnip5/crud.py b/lnbits/extensions/nostrnip5/crud.py
index 12adc05a6..2060d08a8 100644
--- a/lnbits/extensions/nostrnip5/crud.py
+++ b/lnbits/extensions/nostrnip5/crud.py
@@ -173,12 +173,17 @@ async def create_address_internal(domain_id: str, data: CreateAddressData) -> Ad
async def create_domain_internal(wallet_id: str, data: CreateDomainData) -> Domain:
domain_id = urlsafe_short_hash()
+ if data.currency != "Satoshis":
+ amount = data.amount * 100
+ else:
+ amount = data.amount
+
await db.execute(
"""
INSERT INTO nostrnip5.domains (id, wallet, currency, amount, domain)
VALUES (?, ?, ?, ?, ?)
""",
- (domain_id, wallet_id, data.currency, int(data.amount * 100), data.domain),
+ (domain_id, wallet_id, data.currency, int(amount), data.domain),
)
domain = await get_domain(domain_id)
From 18737402941f50cf96096a8568134786ba1fbc53 Mon Sep 17 00:00:00 2001
From: ben
Date: Mon, 9 Jan 2023 16:14:46 +0000
Subject: [PATCH 2/4] format
---
lnbits/extensions/nostrnip5/crud.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lnbits/extensions/nostrnip5/crud.py b/lnbits/extensions/nostrnip5/crud.py
index 2060d08a8..fe71b981f 100644
--- a/lnbits/extensions/nostrnip5/crud.py
+++ b/lnbits/extensions/nostrnip5/crud.py
@@ -177,7 +177,7 @@ async def create_domain_internal(wallet_id: str, data: CreateDomainData) -> Doma
amount = data.amount * 100
else:
amount = data.amount
-
+
await db.execute(
"""
INSERT INTO nostrnip5.domains (id, wallet, currency, amount, domain)
From 679b371eb8da56f797eb2a4b2c4e7b1cd2c617a0 Mon Sep 17 00:00:00 2001
From: Joel Klabo
Date: Mon, 9 Jan 2023 08:44:18 -0800
Subject: [PATCH 3/4] Update Formatting of Satoshi Amount (No decimal places)
---
lnbits/extensions/nostrnip5/templates/nostrnip5/signup.html | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/lnbits/extensions/nostrnip5/templates/nostrnip5/signup.html b/lnbits/extensions/nostrnip5/templates/nostrnip5/signup.html
index c78639e0b..5124dcd4d 100644
--- a/lnbits/extensions/nostrnip5/templates/nostrnip5/signup.html
+++ b/lnbits/extensions/nostrnip5/templates/nostrnip5/signup.html
@@ -37,9 +37,15 @@ context %} {% block page %}
The current price is
+ {% if domain.currency != "Satoshis" %}
{{ "{:0,.2f}".format(domain.amount / 100) }} {{ domain.currency }}
+ {% else %}
+ {{ "{}".format(domain.amount) }} {{ domain.currency }}
+ {% endif %}
for an account (if you do not own the domain, the service provider can
disable at any time).
From 68d1271d5fe7f3b6b488c7fe21fc3b56b835978b Mon Sep 17 00:00:00 2001
From: ben
Date: Mon, 9 Jan 2023 19:23:03 +0000
Subject: [PATCH 4/4] format
---
.../nostrnip5/templates/nostrnip5/signup.html | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/lnbits/extensions/nostrnip5/templates/nostrnip5/signup.html b/lnbits/extensions/nostrnip5/templates/nostrnip5/signup.html
index 5124dcd4d..152948171 100644
--- a/lnbits/extensions/nostrnip5/templates/nostrnip5/signup.html
+++ b/lnbits/extensions/nostrnip5/templates/nostrnip5/signup.html
@@ -36,18 +36,14 @@ context %} {% block page %}
the {{ domain.domain }} domain.
- The current price is
- {% if domain.currency != "Satoshis" %}
+ The current price is {% if domain.currency != "Satoshis" %}
{{ "{:0,.2f}".format(domain.amount / 100) }} {{ domain.currency }}
{% else %}
- {{ "{}".format(domain.amount) }} {{ domain.currency }}
- {% endif %}
- for an account (if you do not own the domain, the service provider can
- disable at any time).
+ {{ "{}".format(domain.amount) }} {{ domain.currency }}
+ {% endif %} for an account (if you do not own the domain, the service
+ provider can disable at any time).
After submitting payment, your address will be