diff --git a/FireWalletBrowser.bsdesign b/FireWalletBrowser.bsdesign index c795c8d..0851dfc 100644 Binary files a/FireWalletBrowser.bsdesign and b/FireWalletBrowser.bsdesign differ diff --git a/render.py b/render.py index 9e388ce..5d25bd0 100644 --- a/render.py +++ b/render.py @@ -30,6 +30,7 @@ elif HSD_NETWORK == "regtest": HSD_WALLET_PORT = 14039 HSD_NODE_PORT = 14037 +CONVERT_NAME = False hsd = api.hsd(HSD_API, HSD_IP, HSD_NODE_PORT) @@ -96,11 +97,20 @@ def transactions(txs): if len(txs) == 0: return 'No transactions found' html = '' - for tx in txs: + print(f"Processing {len(txs)} transactions") + for tx in txs: action = "HNS Transfer" address = tx["outputs"][0]["address"] hash = tx["hash"] confirmations=tx["confirmations"] + mined_date = "Pending" + if confirmations >= 1: + mined_date = tx["mdate"] + if mined_date is None: + mined_date = "Pending" + else: + # Format 2025-06-27T01:49:14Z + mined_date = datetime.datetime.strptime(mined_date, "%Y-%m-%dT%H:%M:%SZ").strftime("%d %b %Y") incomming = True amount = 0 isMulti = False @@ -140,36 +150,42 @@ def transactions(txs): humanAction = action if action == "HNS Transfer": - if amount > 0: - humanAction = "Received HNS" + if amount >= 0: + humanAction = f"Received {amount:,.2f} HNS" else: - humanAction = "Sent HNS" + humanAction = f"Sent {(amount*-1):,.2f} HNS" elif action == "FINALIZE": if incomming and not isMulti: - name = hsd.rpc_getNameByHash(nameHashes[0]) - if name["error"] is None: - name = name["result"] - humanAction = f"Received {renderDomain(name)}" + humanAction = "Received Domain" + if CONVERT_NAME: + name = hsd.rpc_getNameByHash(nameHashes[0]) + if name["error"] is None: + name = name["result"] + humanAction = f"Received {renderDomain(name)}" elif incomming and isMulti: humanAction = "Received Multiple Domains" elif not isMulti: - name = hsd.rpc_getNameByHash(nameHashes[0]) - if name["error"] is None: - name = name["result"] - humanAction = f"Finalized {renderDomain(name)}" + humanAction = "Finalized Domain Transfer" + if CONVERT_NAME: + name = hsd.rpc_getNameByHash(nameHashes[0]) + if name["error"] is None: + name = name["result"] + humanAction = f"Finalized {renderDomain(name)}" else: humanAction = "Finalized Multiple Domain Transfers" elif isMulti: humanAction = actionMapPlural.get(action, "Unknown Action") else: humanAction = actionMap.get(action, "Unknown Action") - name = hsd.rpc_getNameByHash(nameHashes[0]) - if name["error"] is None: - name = name["result"] + if CONVERT_NAME: + name = hsd.rpc_getNameByHash(nameHashes[0]) + if name["error"] is None: + name = name["result"] + else: + name = None + humanAction += renderDomain(name) if name else "domain" else: - name = None - humanAction += renderDomain(name) if name else "domain" - + humanAction += "domain" if amount < 0: amount = f"{amount:,.2f}" elif amount > 0: @@ -179,12 +195,18 @@ def transactions(txs): # hash = f"{hash[:8]}..." + txdate = "" if confirmations < 5: - confirmations = f"{confirmations}" + txdate = f"{mined_date}" else: - confirmations = f"{confirmations:,}" - - html += f'{humanAction}{address}{confirmations}{amount} HNS' + txdate = f"{mined_date}" + # confirmations = f"{confirmations:,}" + html += f''' + + {txdate} + {humanAction} + + ''' return html diff --git a/templates/tx.html b/templates/tx.html index d60a5d8..d740a23 100644 --- a/templates/tx.html +++ b/templates/tx.html @@ -82,10 +82,10 @@ + - - - + + @@ -102,10 +102,10 @@ + - - - + +
Date TransactionAddressConfirmationsAmount
Date TransactionAddressConfirmationsAmount