feat: Add domains info

This commit is contained in:
Nathan Woodburn 2025-01-29 14:46:21 +11:00
parent 0a074a4bbf
commit a35e41b656
Signed by: nathanwoodburn
GPG Key ID: 203B000478AD0EF1

View File

@ -26,6 +26,19 @@ functions = {
} }
} }
}, },
"domains": {
"name": "Domains",
"type": "default",
"description": "List number of domains in each wallet",
"params": {},
"returns": {
"result":
{
"name": "Result",
"type": "list"
}
}
},
"dash": { "dash": {
"name": "Dashboard widget", "name": "Dashboard widget",
"type": "dashboard", "type": "dashboard",
@ -118,6 +131,18 @@ def dash(params, authentication):
return {"result": f"Available: {available:,.2f} HNS<br>Total: {total:,.2f} HNS"} return {"result": f"Available: {available:,.2f} HNS<br>Total: {total:,.2f} HNS"}
def domains(params, authentication):
wallets = account.listWallets()
domains = []
total = 0
for wallet in wallets:
numDomains = len(account.getDomains(wallet))
domains.append(f"{wallet}: {numDomains}")
total += numDomains
domains.append(f"Total: {total}")
return {"result": domains}
def enable(params, authentication): def enable(params, authentication):
with open("user_data/multiwallet.json", "r") as f: with open("user_data/multiwallet.json", "r") as f:
multiwallet = json.load(f) multiwallet = json.load(f)