Merge pull request #1338 from joelklabo/dont-mulitply-sats-nip5

Don't Multiply Sat Price by 100 for NIP-5 Verification
This commit is contained in:
Arc
2023-01-10 12:05:43 +00:00
committed by GitHub
2 changed files with 11 additions and 4 deletions

View File

@@ -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: async def create_domain_internal(wallet_id: str, data: CreateDomainData) -> Domain:
domain_id = urlsafe_short_hash() domain_id = urlsafe_short_hash()
if data.currency != "Satoshis":
amount = data.amount * 100
else:
amount = data.amount
await db.execute( await db.execute(
""" """
INSERT INTO nostrnip5.domains (id, wallet, currency, amount, domain) INSERT INTO nostrnip5.domains (id, wallet, currency, amount, domain)
VALUES (?, ?, ?, ?, ?) 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) domain = await get_domain(domain_id)

View File

@@ -36,12 +36,14 @@ context %} {% block page %}
the {{ domain.domain }} domain. the {{ domain.domain }} domain.
</p> </p>
<p> <p>
The current price is The current price is {% if domain.currency != "Satoshis" %}
<b <b
>{{ "{:0,.2f}".format(domain.amount / 100) }} {{ domain.currency }}</b >{{ "{:0,.2f}".format(domain.amount / 100) }} {{ domain.currency }}</b
> >
for an account (if you do not own the domain, the service provider can {% else %}
disable at any time). <b>{{ "{}".format(domain.amount) }} {{ domain.currency }}</b>
{% endif %} for an account (if you do not own the domain, the service
provider can disable at any time).
</p> </p>
<p>After submitting payment, your address will be</p> <p>After submitting payment, your address will be</p>