feat: Add find domain function
This commit is contained in:
parent
33311d7799
commit
1705e47476
@ -40,6 +40,24 @@ functions = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"find": {
|
||||||
|
"name": "Find domain wallet",
|
||||||
|
"type": "default",
|
||||||
|
"description": "Find which wallet owns a domain",
|
||||||
|
"params": {
|
||||||
|
"domain": {
|
||||||
|
"name": "List of Domain to find",
|
||||||
|
"type": "text"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"returns": {
|
||||||
|
"result":
|
||||||
|
{
|
||||||
|
"name": "Result",
|
||||||
|
"type": "text"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"expiring": {
|
"expiring": {
|
||||||
"name": "Expiring Domains",
|
"name": "Expiring Domains",
|
||||||
"type": "default",
|
"type": "default",
|
||||||
@ -219,6 +237,22 @@ def domains(params, authentication):
|
|||||||
domains.append(f"Total: {total}")
|
domains.append(f"Total: {total}")
|
||||||
return {"result": domains}
|
return {"result": domains}
|
||||||
|
|
||||||
|
def find(params, authentication):
|
||||||
|
wallets = account.listWallets()
|
||||||
|
domain_owners = {}
|
||||||
|
for wallet in wallets:
|
||||||
|
domains = account.getDomains(wallet)
|
||||||
|
for domain in domains:
|
||||||
|
if domain['name'] in params['domain'].split(","):
|
||||||
|
domain_owners[domain['name']] = wallet
|
||||||
|
if len(domain_owners) > 0:
|
||||||
|
result = ''
|
||||||
|
for domain, wallet in domain_owners.items():
|
||||||
|
result += f"{domain}: {wallet}<br>"
|
||||||
|
return {"result": result}
|
||||||
|
else:
|
||||||
|
return {"result": "Not found"}
|
||||||
|
|
||||||
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)
|
||||||
|
Loading…
Reference in New Issue
Block a user