2024-01-22 17:08:28 +00:00
|
|
|
import os
|
|
|
|
import json
|
|
|
|
import requests
|
|
|
|
import base64
|
2024-01-23 10:53:16 +00:00
|
|
|
from datetime import datetime
|
2024-01-22 17:08:28 +00:00
|
|
|
|
|
|
|
devfund_data_path = os.path.normpath(os.path.join("..", "devfund_pubkey.json"))
|
|
|
|
|
|
|
|
with open(devfund_data_path, "r") as f:
|
|
|
|
devfund_data = json.load(f)
|
|
|
|
|
|
|
|
macaroon = devfund_data["mainnet_invoices_readonly_macaroon_hex"]
|
|
|
|
url = f'https://{devfund_data["mainnet_rpcserver"]}:8080'
|
|
|
|
headers = {"Grpc-Metadata-macaroon": macaroon}
|
|
|
|
method = "/v1/invoices"
|
|
|
|
|
|
|
|
r = requests.get(url + method, headers=headers)
|
|
|
|
|
|
|
|
response_data = r.json()
|
|
|
|
|
|
|
|
for invoice in response_data["invoices"]:
|
|
|
|
if invoice["is_keysend"] and invoice["htlcs"][0]["custom_records"]["34349334"]:
|
2024-01-23 10:53:16 +00:00
|
|
|
dt = datetime.fromtimestamp(int(invoice["creation_date"]))
|
2024-01-22 17:08:28 +00:00
|
|
|
print(f"Index {invoice['add_index']}")
|
2024-01-23 10:53:16 +00:00
|
|
|
print(f'Timestamp {dt.strftime("%Y-%m-%d %H:%M:%S")}')
|
2024-01-22 17:08:28 +00:00
|
|
|
print(
|
|
|
|
f"{base64.b64decode(invoice['htlcs'][0]['custom_records']['34349334']).decode('utf-8')}"
|
|
|
|
)
|
|
|
|
print(f"Amount {invoice['amt_paid_sat']} Sats")
|
|
|
|
print("----------------------")
|