feat: Add dashboard cards
All checks were successful
Build Docker / Build Image (push) Successful in 52s

This commit is contained in:
2025-02-03 13:32:35 +11:00
parent a56ffef656
commit 82b9241c00
6 changed files with 117 additions and 5 deletions

View File

@@ -639,6 +639,30 @@ def getPendingRegisters(account):
pending.append(bid)
return pending
def getPendingFinalizes(account,password):
tx = createBatch(f'{account}:{password}',[["FINALIZE"]])
if 'error' in tx:
return []
pending = []
try:
for output in tx['outputs']:
if output['covenant']['type'] != 10:
continue
if output['covenant']['action'] != "FINALIZE":
continue
nameHash = output['covenant']['items'][0]
# Try to get the name from hash
name = hsd.rpc_getNameByHash(nameHash)
if name['error']:
pending.append(nameHash)
else:
pending.append(name['result'])
except:
print("Failed to parse finalizes")
return pending
def getRevealTX(reveal):
prevout = reveal['prevout']
hash = prevout['hash']
@@ -753,6 +777,19 @@ def registerAll(account):
batch.append(["UPDATE",domain['name'],{"records":[]}])
return sendBatch(account,batch)
def finalizeAll(account):
account_name = check_account(account)
password = ":".join(account.split(":")[1:])
if account_name == False:
return {
"error": {
"message": "Invalid account"
}
}
return sendBatch(account,[["FINALIZE"]])
def rescan_auction(account,domain):
# Get height of the start of the auction
response = hsw.rpc_selectWallet(account)
@@ -991,6 +1028,53 @@ def sendBatch(account, batch):
}
}
def createBatch(account, batch):
account_name = check_account(account)
password = ":".join(account.split(":")[1:])
if account_name == False:
return {
"error": {
"message": "Invalid account"
}
}
try:
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 = requests.post(f"http://x:{HSD_API}@{HSD_IP}:{HSD_WALLET_PORT}",json={
"method": "createbatch",
"params": [batch]
}).json()
if response['error'] is not None:
return response
if 'result' not in response:
return {
"error": {
"message": "No result"
}
}
return response['result']
except Exception as e:
return {
"error": {
"message": str(e)
}
}
#region settingsAPIs
def rescan():