-
Notifications
You must be signed in to change notification settings - Fork 142
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add public view of devfund donations script
- Loading branch information
1 parent
e49c861
commit 35b8f56
Showing
1 changed file
with
27 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import os | ||
import json | ||
import requests | ||
import base64 | ||
|
||
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"]: | ||
print(f"Index {invoice['add_index']}") | ||
print( | ||
f"{base64.b64decode(invoice['htlcs'][0]['custom_records']['34349334']).decode('utf-8')}" | ||
) | ||
print(f"Amount {invoice['amt_paid_sat']} Sats") | ||
print("----------------------") |