fix: Add rounding to bid display and strip batch inputs
All checks were successful
Build Docker / Build Image (push) Successful in 45s

This commit is contained in:
Nathan Woodburn 2025-01-28 10:56:24 +11:00
parent 4b7b9f991b
commit 2b6447fd12
Signed by: nathanwoodburn
GPG Key ID: 203B000478AD0EF1
3 changed files with 23 additions and 7 deletions

13
main.py
View File

@ -278,6 +278,8 @@ def auctions():
balance = account_module.getBalance(account) balance = account_module.getBalance(account)
locked = balance['locked'] locked = balance['locked']
# Round to 2 decimals
locked = round(locked, 2)
# Add commas to the numbers # Add commas to the numbers
locked = "{:,}".format(locked) locked = "{:,}".format(locked)
@ -289,7 +291,7 @@ def auctions():
# Sort # Sort
sort = request.args.get("sort") sort = request.args.get("sort")
if sort == None: if sort == None:
sort = "domain" sort = "state"
sort = sort.lower() sort = sort.lower()
sort_price = "" sort_price = ""
sort_price_next = "" sort_price_next = ""
@ -301,6 +303,9 @@ def auctions():
direction = request.args.get("direction") direction = request.args.get("direction")
if direction == None: if direction == None:
if sort == "state":
direction = ""
else:
direction = "" direction = ""
if direction == "": if direction == "":
@ -342,10 +347,6 @@ def auctions():
pending_reveals += 1 pending_reveals += 1
plugins = "" plugins = ""
# dashFunctions = plugins_module.getDashboardFunctions()
# for function in dashFunctions:
# functionOutput = plugins_module.runPluginFunction(function["plugin"],function["function"],{},request.cookies.get("account"))
# plugins += render.plugin_output_dash(functionOutput,plugins_module.getPluginFunctionReturns(function["plugin"],function["function"]))
message = '' message = ''
if 'message' in request.args: if 'message' in request.args:
@ -377,7 +378,7 @@ def revealAllBids():
return redirect("/auctions?message=No reveals pending") return redirect("/auctions?message=No reveals pending")
return redirect("/auctions?message=" + response['error']['message']) return redirect("/auctions?message=" + response['error']['message'])
return redirect("/success?tx=" + response['hash']) return redirect("/success?tx=" + response['result']['hash'])
@app.route('/search') @app.route('/search')

View File

@ -290,6 +290,8 @@ def transfer(params, authentication):
domains = params["domains"] domains = params["domains"]
address = params["address"] address = params["address"]
domains = domains.splitlines() domains = domains.splitlines()
domains = [x.strip() for x in domains]
domains = [x for x in domains if x != ""]
wallet = authentication.split(":")[0] wallet = authentication.split(":")[0]
owned = account.getDomains(wallet) owned = account.getDomains(wallet)
@ -322,6 +324,8 @@ def transfer(params, authentication):
def simple(batchType,params, authentication): def simple(batchType,params, authentication):
domains = params["domains"] domains = params["domains"]
domains = domains.splitlines() domains = domains.splitlines()
domains = [x.strip() for x in domains]
domains = [x for x in domains if x != ""]
batch = [] batch = []
for domain in domains: for domain in domains:
@ -351,6 +355,9 @@ def open(params, authentication):
def bid(params, authentication): def bid(params, authentication):
domains = params["domains"] domains = params["domains"]
domains = domains.splitlines() domains = domains.splitlines()
domains = [x.strip() for x in domains]
domains = [x for x in domains if x != ""]
try: try:
bid = float(params["bid"]) bid = float(params["bid"])
blind = float(params["blind"]) blind = float(params["blind"])
@ -387,6 +394,9 @@ def redeem(params, authentication):
def register(params, authentication): def register(params, authentication):
domains = params["domains"] domains = params["domains"]
domains = domains.splitlines() domains = domains.splitlines()
domains = [x.strip() for x in domains]
domains = [x for x in domains if x != ""]
batch = [] batch = []
for domain in domains: for domain in domains:
batch.append(['UPDATE', domain,{"records": []}]) batch.append(['UPDATE', domain,{"records": []}])
@ -410,6 +420,8 @@ def renew(params, authentication):
def advancedBid(params, authentication): def advancedBid(params, authentication):
bids = params["bids"] bids = params["bids"]
bids = bids.splitlines() bids = bids.splitlines()
bids = [x.strip() for x in bids]
bids = [x for x in bids if x != ""]
batch = [] batch = []
for bid in bids: for bid in bids:
@ -437,6 +449,8 @@ def advancedBid(params, authentication):
def advancedBatch(params, authentication): def advancedBatch(params, authentication):
transactions = params["transactions"] transactions = params["transactions"]
transactions = transactions.splitlines() transactions = transactions.splitlines()
transactions = [x.strip() for x in transactions]
transactions = [x for x in transactions if x != ""]
batch = [] batch = []
for transaction in transactions: for transaction in transactions:

View File

@ -189,6 +189,7 @@ def bidDomains(bids,domains, sortState=False):
bidValue = round(bidValue, 2) bidValue = round(bidValue, 2)
blind = lockup - bidValue blind = lockup - bidValue
bidValue = "{:,}".format(bidValue) bidValue = "{:,}".format(bidValue)
blind = round(blind, 2)
blind = "{:,}".format(blind) blind = "{:,}".format(blind)
bidDisplay = f'<b>{bidValue} HNS</b> + {blind} HNS blind' bidDisplay = f'<b>{bidValue} HNS</b> + {blind} HNS blind'