diff --git a/FireWalletBrowser.bsdesign b/FireWalletBrowser.bsdesign index 9ae55b8..e4d7098 100644 Binary files a/FireWalletBrowser.bsdesign and b/FireWalletBrowser.bsdesign differ diff --git a/account.py b/account.py index 09d19e3..4427a61 100644 --- a/account.py +++ b/account.py @@ -476,9 +476,11 @@ def getAddressFromCoin(coinhash: str, coinindex = 0): # Get the address from the hash response = requests.get(get_node_api_url(f"coin/{coinhash}/{coinindex}")) if response.status_code != 200: + print(f"Error getting address from coin: {response.text}") return "No Owner" data = response.json() if 'address' not in data: + print(json.dumps(data, indent=4)) return "No Owner" return data['address'] diff --git a/render.py b/render.py index e0dba7f..ff79dd9 100644 --- a/render.py +++ b/render.py @@ -278,30 +278,61 @@ def timestamp_to_readable_time(timestamp): return readable_time def bids(bids,reveals): - html = '' + # Create a list to hold bid data for sorting + bid_data = [] + + # Prepare data for sorting for bid in bids: - lockup = bid['lockup'] - lockup = lockup / 1000000 - html += "" - html += f"{lockup:,.2f} HNS" + lockup = bid['lockup'] / 1000000 revealed = False + value = 0 + + # Check if this bid has been revealed for reveal in reveals: if reveal['bid'] == bid['prevout']['hash']: revealed = True - value = reveal['value'] - value = value / 1000000 - html += f"{value:,.2f} HNS" - bidValue = lockup - value - html += f"{bidValue:,.2f} HNS" + value = reveal['value'] / 1000000 break - if not revealed: + + # Store all relevant information for sorting and display + bid_data.append({ + 'bid': bid, + 'lockup': lockup, + 'revealed': revealed, + 'value': value, + 'sort_value': value if revealed else lockup # Use value for sorting if revealed, otherwise lockup + }) + + # Sort by the sort_value in descending order (highest first) + bid_data.sort(key=lambda x: x['sort_value'], reverse=True) + + # Generate HTML from sorted data + html = '' + for data in bid_data: + bid = data['bid'] + lockup = data['lockup'] + revealed = data['revealed'] + value = data['value'] + + html += "" + html += f"{lockup:,.2f} HNS" + + if revealed: + bidValue = lockup - value + html += f"{value:,.2f} HNS" + html += f"{bidValue:,.2f} HNS" + else: html += f"Hidden until reveal" html += f"Hidden until reveal" + if bid['own']: html += "You" else: - html += "Unknown" + html += f"Unknown" + + html += f"Bid TX 🔗" html += "" + return html diff --git a/templates/auction.html b/templates/auction.html index dc20d85..cd5b559 100644 --- a/templates/auction.html +++ b/templates/auction.html @@ -93,6 +93,7 @@ Bid Blind Owner +