mirror of
https://github.com/lnbits/lnbits-legend.git
synced 2025-02-24 06:48:02 +01:00
21 lines
609 B
Python
21 lines
609 B
Python
from binascii import unhexlify
|
|
|
|
from lnbits.bolt11 import Invoice
|
|
|
|
|
|
def to_buffer(payment_hash: str):
|
|
return {"type": "Buffer", "data": [b for b in unhexlify(payment_hash)]}
|
|
|
|
|
|
def decoded_as_lndhub(invoice: Invoice):
|
|
return {
|
|
"destination": invoice.payee,
|
|
"payment_hash": invoice.payment_hash,
|
|
"num_satoshis": invoice.amount_msat / 1000,
|
|
"timestamp": str(invoice.date),
|
|
"expiry": str(invoice.expiry),
|
|
"description": invoice.description,
|
|
"fallback_addr": "",
|
|
"cltv_expiry": invoice.min_final_cltv_expiry,
|
|
"route_hints": "",
|
|
}
|