feat: Add info on when bidding closes
All checks were successful
Build Docker / Build Image (push) Successful in 1m14s
All checks were successful
Build Docker / Build Image (push) Successful in 1m14s
This commit is contained in:
Binary file not shown.
@@ -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:
|
||||
|
||||
37
main.py
37
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"
|
||||
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"
|
||||
|
||||
|
||||
|
||||
return f"{hours}h {minutes}m"
|
||||
|
||||
|
||||
@app.route('/')
|
||||
@@ -521,10 +527,7 @@ def manage(domain: str):
|
||||
|
||||
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 += "<br>Bidding no longer possible"
|
||||
elif stats['blocksUntilReveal'] == 2:
|
||||
next += "<br>LAST CHANCE TO BID"
|
||||
elif stats['blocksUntilReveal'] == 3:
|
||||
next += f"<br>Next block is last chance to bid"
|
||||
elif stats['blocksUntilReveal'] < 6:
|
||||
next += f"<br>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'<a href="/auction/{domain}/reveal">Reveal All</a>'
|
||||
|
||||
@@ -68,7 +68,7 @@
|
||||
<div class="card-body">
|
||||
<div class="stick-right">{{next_action|safe}}</div>
|
||||
<h4 class="card-title">{{rendered}}</h4>
|
||||
<h6 class="text-muted mb-2 card-subtitle">{{next}}</h6>
|
||||
<h6 class="text-muted mb-2 card-subtitle">{{next | safe}}</h6>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user