diff --git a/multi-wallet.py b/multi-wallet.py index 5897ed9..89347d0 100644 --- a/multi-wallet.py +++ b/multi-wallet.py @@ -39,6 +39,38 @@ functions = { } } }, + "expiring": { + "name": "Expiring Domains", + "type": "default", + "description": "List domains that are expiring and their wallet", + "params": { + "days": { + "name": "Days until expiry (default 30)", + "type": "number" + } + }, + "returns": { + "result": + { + "name": "Result", + "type": "text" + } + } + }, + "export": { + "name": "Export Domains", + "type": "default", + "description": "Export domains to a file", + "params": { + }, + "returns": { + "result": + { + "name": "result.csv", + "type": "file" + } + } + }, "dash": { "name": "Dashboard widget", "type": "dashboard", @@ -102,6 +134,42 @@ def balance(params, authentication): return {"result": balances} +def expiring(params, authentication): + days = params['days'] + if days == None or days == '': + days = 30 + else: + days = int(days) + wallets = account.listWallets() + expiring = '' + + for wallet in wallets: + walletExpiring = [] + domains = account.getDomains(wallet) + for domain in domains: + if 'stats' in domain and 'daysUntilExpire' in domain['stats']: + if domain['stats']['daysUntilExpire'] <= days: + walletExpiring.append({"domain": domain['name'], "wallet": wallet, "days": domain['stats']['daysUntilExpire']}) + if len(walletExpiring) > 0: + expiring += f"
Domain | Days Until Expiration |
---|---|
{domain['domain']} | {domain['days']} |