From 0045ff28d14280ba6d0d76717334182e7d2cd35d Mon Sep 17 00:00:00 2001 From: Nathan Woodburn Date: Fri, 26 Jan 2024 17:17:01 +1100 Subject: [PATCH] fix: Revoke without using python wrapper --- account.py | 18 ++++++++++++++++-- main.py | 25 +++++++++++++++++++------ templates/auction.html | 2 +- 3 files changed, 36 insertions(+), 9 deletions(-) diff --git a/account.py b/account.py index 232ca60..89f5ba8 100644 --- a/account.py +++ b/account.py @@ -471,8 +471,22 @@ def revoke(account,domain): } try: - response = hsw.sendREVOKE(account_name,password,domain) - return response + response = hsw.rpc_selectWallet(account_name) + if response['error'] is not None: + return { + "error": { + "message": response['error']['message'] + } + } + response = hsw.rpc_walletPassphrase(password,10) + if response['error'] is not None: + return { + "error": { + "message": response['error']['message'] + } + } + response = hsw.rpc_sendREVOKE(domain) + return response except Exception as e: return { "error": { diff --git a/main.py b/main.py index 391ad72..5b1ccd8 100644 --- a/main.py +++ b/main.py @@ -281,13 +281,16 @@ def search(): state = domain['info']['state'] if state == 'CLOSED': - if not domain['info']['registered']: - state = 'AVAILABLE' - next = "Available Now" - else: + if domain['info']['registered']: state = 'REGISTERED' expires = domain['info']['stats']['daysUntilExpire'] next = f"Expires in ~{expires} days" + else: + state = 'AVAILABLE' + next = "Available Now" + elif state == "REVOKED": + state = 'AVAILABLE' + next = "Available Now" elif state == 'OPENING': next = "Bidding opens in ~" + str(domain['info']['stats']['blocksUntilBidding']) + " blocks" elif state == 'BIDDING': @@ -461,8 +464,9 @@ def revokeConfirm(domain: str): response = account_module.revoke(request.cookies.get("account"),domain) if 'error' in response: - print(response) - return redirect("/manage/" + domain + "?error=" + response['error']['message']) + if response['error'] != None: + print(response) + return redirect("/manage/" + domain + "?error=" + response['error']['message']) return redirect("/success?tx=" + response['hash']) @@ -680,6 +684,10 @@ def auction(domain): own_domains = [x.lower() for x in own_domains] if search_term in own_domains: next_action = f'Manage' + elif state == "REVOKED": + state = 'AVAILABLE' + next = "Available Now" + next_action = f'Open Auction' elif state == 'OPENING': next = "Bidding opens in ~" + str(domainInfo['info']['stats']['blocksUntilBidding']) + " blocks" elif state == 'BIDDING': @@ -790,6 +798,11 @@ def open_auction(domain): domain = domain.lower() response = account_module.openAuction(request.cookies.get("account"),domain) + + if 'error' in response: + if response['error'] != None: + return redirect("/auction/" + domain + "?message=" + response['error']['message']) + print(response) return redirect("/success?tx=" + response['hash']) @app.route('/auction//reveal') diff --git a/templates/auction.html b/templates/auction.html index 5ce6bf2..68b07d5 100644 --- a/templates/auction.html +++ b/templates/auction.html @@ -73,7 +73,7 @@

Bid

-
+