diff --git a/multi-wallet.py b/multi-wallet.py index c558889..c1e9583 100644 --- a/multi-wallet.py +++ b/multi-wallet.py @@ -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": { "name": "Expiring Domains", "type": "default", @@ -219,6 +237,22 @@ def domains(params, authentication): domains.append(f"Total: {total}") 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): with open("user_data/multiwallet.json", "r") as f: multiwallet = json.load(f)