mirror of
https://github.com/lnbits/lnbits.git
synced 2025-06-25 16:20:54 +02:00
format
This commit is contained in:
parent
694a4e5054
commit
8ca390e0b0
@ -166,7 +166,7 @@ def lnencode(addr, privkey):
|
|||||||
if addr.amount:
|
if addr.amount:
|
||||||
amount = Decimal(str(addr.amount))
|
amount = Decimal(str(addr.amount))
|
||||||
# We can only send down to millisatoshi.
|
# We can only send down to millisatoshi.
|
||||||
if amount * 10 ** 12 % 10:
|
if amount * 10**12 % 10:
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
"Cannot encode {}: too many decimal places".format(addr.amount)
|
"Cannot encode {}: too many decimal places".format(addr.amount)
|
||||||
)
|
)
|
||||||
@ -271,7 +271,7 @@ class LnAddr(object):
|
|||||||
def shorten_amount(amount):
|
def shorten_amount(amount):
|
||||||
"""Given an amount in bitcoin, shorten it"""
|
"""Given an amount in bitcoin, shorten it"""
|
||||||
# Convert to pico initially
|
# Convert to pico initially
|
||||||
amount = int(amount * 10 ** 12)
|
amount = int(amount * 10**12)
|
||||||
units = ["p", "n", "u", "m", ""]
|
units = ["p", "n", "u", "m", ""]
|
||||||
for unit in units:
|
for unit in units:
|
||||||
if amount % 1000 == 0:
|
if amount % 1000 == 0:
|
||||||
@ -290,7 +290,7 @@ def _unshorten_amount(amount: str) -> int:
|
|||||||
# * `u` (micro): multiply by 0.000001
|
# * `u` (micro): multiply by 0.000001
|
||||||
# * `n` (nano): multiply by 0.000000001
|
# * `n` (nano): multiply by 0.000000001
|
||||||
# * `p` (pico): multiply by 0.000000000001
|
# * `p` (pico): multiply by 0.000000000001
|
||||||
units = {"p": 10 ** 12, "n": 10 ** 9, "u": 10 ** 6, "m": 10 ** 3}
|
units = {"p": 10**12, "n": 10**9, "u": 10**6, "m": 10**3}
|
||||||
unit = str(amount)[-1]
|
unit = str(amount)[-1]
|
||||||
|
|
||||||
# BOLT #11:
|
# BOLT #11:
|
||||||
|
@ -329,12 +329,12 @@ async def perform_lnurlauth(
|
|||||||
sign_len = 6 + r_len + s_len
|
sign_len = 6 + r_len + s_len
|
||||||
|
|
||||||
signature = BytesIO()
|
signature = BytesIO()
|
||||||
signature.write(0x30 .to_bytes(1, "big", signed=False))
|
signature.write(0x30.to_bytes(1, "big", signed=False))
|
||||||
signature.write((sign_len - 2).to_bytes(1, "big", signed=False))
|
signature.write((sign_len - 2).to_bytes(1, "big", signed=False))
|
||||||
signature.write(0x02 .to_bytes(1, "big", signed=False))
|
signature.write(0x02.to_bytes(1, "big", signed=False))
|
||||||
signature.write(r_len.to_bytes(1, "big", signed=False))
|
signature.write(r_len.to_bytes(1, "big", signed=False))
|
||||||
signature.write(r)
|
signature.write(r)
|
||||||
signature.write(0x02 .to_bytes(1, "big", signed=False))
|
signature.write(0x02.to_bytes(1, "big", signed=False))
|
||||||
signature.write(s_len.to_bytes(1, "big", signed=False))
|
signature.write(s_len.to_bytes(1, "big", signed=False))
|
||||||
signature.write(s)
|
signature.write(s)
|
||||||
|
|
||||||
|
@ -65,7 +65,9 @@ async def on_invoice_paid(payment: Payment) -> None:
|
|||||||
except (httpx.ConnectError, httpx.RequestError):
|
except (httpx.ConnectError, httpx.RequestError):
|
||||||
await mark_webhook_sent(payment, -1)
|
await mark_webhook_sent(payment, -1)
|
||||||
if payment.extra.get("comment"):
|
if payment.extra.get("comment"):
|
||||||
await websocketUpdater(copilot.id, str(data) + "-" + str(payment.extra.get("comment")))
|
await websocketUpdater(
|
||||||
|
copilot.id, str(data) + "-" + str(payment.extra.get("comment"))
|
||||||
|
)
|
||||||
|
|
||||||
await websocketUpdater(copilot.id, str(data) + "-none")
|
await websocketUpdater(copilot.id, str(data) + "-none")
|
||||||
|
|
||||||
|
@ -158,8 +158,8 @@
|
|||||||
color="primary"
|
color="primary"
|
||||||
size="md"
|
size="md"
|
||||||
@click="copyText(wslocation + '/api/v1/ws/' + settingsDialog.data.id, 'Link copied to clipboard!')"
|
@click="copyText(wslocation + '/api/v1/ws/' + settingsDialog.data.id, 'Link copied to clipboard!')"
|
||||||
>{% raw %}{{wslocation}}/api/v1/ws/{{settingsDialog.data.id}}{%
|
>{% raw %}{{wslocation}}/api/v1/ws/{{settingsDialog.data.id}}{% endraw
|
||||||
endraw %}<q-tooltip> Click to copy URL </q-tooltip>
|
%}<q-tooltip> Click to copy URL </q-tooltip>
|
||||||
</q-btn>
|
</q-btn>
|
||||||
<q-btn
|
<q-btn
|
||||||
v-else
|
v-else
|
||||||
|
Loading…
x
Reference in New Issue
Block a user