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,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": {

25
main.py
View File

@ -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'<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':
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/<domain>/reveal')

View File

@ -73,7 +73,7 @@
<div class="card">
<div class="card-body">
<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>
</form>
</div>