fix: Revoke without using python wrapper

This commit is contained in:
Nathan Woodburn 2024-01-26 17:17:01 +11:00
parent 8540265173
commit 0045ff28d1
Signed by: nathanwoodburn
GPG Key ID: 203B000478AD0EF1
3 changed files with 36 additions and 9 deletions

View File

@ -471,7 +471,21 @@ def revoke(account,domain):
} }
try: try:
response = hsw.sendREVOKE(account_name,password,domain) 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 return response
except Exception as e: except Exception as e:
return { return {

21
main.py
View File

@ -281,13 +281,16 @@ def search():
state = domain['info']['state'] state = domain['info']['state']
if state == 'CLOSED': if state == 'CLOSED':
if not domain['info']['registered']: if domain['info']['registered']:
state = 'AVAILABLE'
next = "Available Now"
else:
state = 'REGISTERED' state = 'REGISTERED'
expires = domain['info']['stats']['daysUntilExpire'] expires = domain['info']['stats']['daysUntilExpire']
next = f"Expires in ~{expires} days" next = f"Expires in ~{expires} days"
else:
state = 'AVAILABLE'
next = "Available Now"
elif state == "REVOKED":
state = 'AVAILABLE'
next = "Available Now"
elif state == 'OPENING': elif state == 'OPENING':
next = "Bidding opens in ~" + str(domain['info']['stats']['blocksUntilBidding']) + " blocks" next = "Bidding opens in ~" + str(domain['info']['stats']['blocksUntilBidding']) + " blocks"
elif state == 'BIDDING': elif state == 'BIDDING':
@ -461,6 +464,7 @@ def revokeConfirm(domain: str):
response = account_module.revoke(request.cookies.get("account"),domain) response = account_module.revoke(request.cookies.get("account"),domain)
if 'error' in response: if 'error' in response:
if response['error'] != None:
print(response) print(response)
return redirect("/manage/" + domain + "?error=" + response['error']['message']) return redirect("/manage/" + domain + "?error=" + response['error']['message'])
@ -680,6 +684,10 @@ def auction(domain):
own_domains = [x.lower() for x in own_domains] own_domains = [x.lower() for x in own_domains]
if search_term in own_domains: if search_term in own_domains:
next_action = f'<a href="/manage/{domain}">Manage</a>' next_action = f'<a href="/manage/{domain}">Manage</a>'
elif state == "REVOKED":
state = 'AVAILABLE'
next = "Available Now"
next_action = f'<a href="/auction/{domain}/open">Open Auction</a>'
elif state == 'OPENING': elif state == 'OPENING':
next = "Bidding opens in ~" + str(domainInfo['info']['stats']['blocksUntilBidding']) + " blocks" next = "Bidding opens in ~" + str(domainInfo['info']['stats']['blocksUntilBidding']) + " blocks"
elif state == 'BIDDING': elif state == 'BIDDING':
@ -790,6 +798,11 @@ def open_auction(domain):
domain = domain.lower() domain = domain.lower()
response = account_module.openAuction(request.cookies.get("account"),domain) 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']) return redirect("/success?tx=" + response['hash'])
@app.route('/auction/<domain>/reveal') @app.route('/auction/<domain>/reveal')

View File

@ -73,7 +73,7 @@
<div class="card"> <div class="card">
<div class="card-body"> <div class="card-body">
<h4 class="card-title">Bid</h4> <h4 class="card-title">Bid</h4>
<form action="/auction/{{search_term}}/bid"><label class="form-label">Bid</label><input class="form-control" type="number" placeholder="0.00" min="0" name="bid"><label class="form-label" style="margin-top: 10px;">Optional blind</label><input class="form-control" type="number" name="blind" placeholder="0.00" min="0"> <form action="/auction/{{search_term}}/bid"><label class="form-label">Bid</label><input class="form-control" type="number" placeholder="0.00" min="0" name="bid" step="any"><label class="form-label" style="margin-top: 10px;">Optional blind</label><input class="form-control" type="number" name="blind" placeholder="0.00" min="0" step="any">
<div class="text-end" style="margin-top: 10px;"><input class="btn btn-primary" type="submit" value="Bid"></div> <div class="text-end" style="margin-top: 10px;"><input class="btn btn-primary" type="submit" value="Bid"></div>
</form> </form>
</div> </div>