diff --git a/FireWalletBrowser.bsdesign b/FireWalletBrowser.bsdesign index 2c9d800..9ae55b8 100644 Binary files a/FireWalletBrowser.bsdesign and b/FireWalletBrowser.bsdesign differ diff --git a/account.py b/account.py index 7d41165..075c7ad 100644 --- a/account.py +++ b/account.py @@ -184,7 +184,6 @@ def selectWallet(account: str): } } - def getBalance(account: str): # Get the total balance info = hsw.getBalance('default', account) @@ -446,6 +445,13 @@ def send(account, address, amount): def isOwnDomain(account, name: str): + # Get domain + domain_info = getDomain(name) + owner = getAddressFromCoin(domain_info['info']['owner']['hash'],domain_info['info']['owner']['index']) + # Select the account + print(hsw.rpc_selectWallet(account)) + print(hsw.rpc_getAccount(owner)) + domains = getDomains(account) for domain in domains: if domain['name'] == name: diff --git a/main.py b/main.py index 3dceb08..e263000 100644 --- a/main.py +++ b/main.py @@ -36,18 +36,24 @@ THEME = os.getenv("THEME") def blocks_to_time(blocks: int) -> str: """ Convert blocks to time in a human-readable format. + Blocks are mined approximately every 10 minutes. """ if blocks < 0: return "Invalid time" - hours = blocks // 10 - minutes = (blocks % 10) * 6 - if hours >= 24: - days = hours // 24 - hours = hours % 24 - return f"{days}d {hours}h" - - return f"{hours}h {minutes}m" + if blocks < 6: + return f"{blocks * 10} mins" + elif blocks < 144: + hours = blocks // 6 + minutes = (blocks % 6) * 10 + return f"{hours} hrs {minutes} mins" + else: + days = blocks // 144 + hours = (blocks % 144) // 6 + return f"{days} days {hours} hrs" + + + @app.route('/') @@ -520,11 +526,8 @@ def manage(domain: str): return redirect("/logout") domain = domain.lower() - - own_domains = account_module.getDomains(account) - own_domains = [x['name'] for x in own_domains] - own_domains = [x.lower() for x in own_domains] - if domain not in own_domains: + + if not account_module.isOwnDomain(account, domain): return redirect("/search?q=" + domain) domain_info = account_module.getDomain(domain) @@ -952,7 +955,17 @@ def auction(domain): elif state == 'OPENING': next = f"Bidding opens in {str(stats['blocksUntilBidding'])} blocks (~{blocks_to_time(stats['blocksUntilBidding'])})" elif state == 'BIDDING': - next = f"Reveal in {str(stats['blocksUntilReveal'])} blocks (~{blocks_to_time(stats['blocksUntilReveal'])})" + next = f"Reveal in {stats['blocksUntilReveal']} blocks (~{blocks_to_time(stats['blocksUntilReveal'])})" + if stats['blocksUntilReveal'] == 1: + next += "
Bidding no longer possible" + elif stats['blocksUntilReveal'] == 2: + next += "
LAST CHANCE TO BID" + elif stats['blocksUntilReveal'] == 3: + next += f"
Next block is last chance to bid" + elif stats['blocksUntilReveal'] < 6: + next += f"
Last chance to bid in {stats['blocksUntilReveal']-2} blocks" + + elif state == 'REVEAL': next = f"Reveal ends in {str(stats['blocksUntilClose'])} blocks (~{blocks_to_time(stats['blocksUntilClose'])})" next_action = f'Reveal All' diff --git a/templates/auction.html b/templates/auction.html index bb41036..dc20d85 100644 --- a/templates/auction.html +++ b/templates/auction.html @@ -68,7 +68,7 @@
{{next_action|safe}}

{{rendered}}

-
{{next}}
+
{{next | safe}}