diff --git a/multi-wallet.py b/multi-wallet.py index 3b094fe..7c6fceb 100644 --- a/multi-wallet.py +++ b/multi-wallet.py @@ -2,6 +2,7 @@ import json import account import os import time +import datetime # Plugin Data info = { @@ -157,16 +158,23 @@ def expiring(params, authentication): expiring += "" return {"result": expiring} +def BlocksToDate(blocks): + date = datetime.datetime.now() + datetime.timedelta(minutes=blocks*10) + return date.strftime("%Y-%m-%d %H:%M:%S") + def export(params, authentication): wallets = account.listWallets() - result = "name,expiry,value,wallet" + result = "name,expiry,expiryBlock,value,wallet" + currentBlock = account.getBlockHeight() + for wallet in wallets: domains = account.getDomains(wallet) for domain in domains: if 'stats' in domain and 'renewalPeriodEnd' in domain['stats']: - result += f"\n{domain['name']},{domain['stats']['renewalPeriodEnd']},{domain['value']/1000000},{wallet}" + expiryBlock = domain['stats']['renewalPeriodEnd'] + result += f"\n{domain['name']}{BlocksToDate(expiryBlock - currentBlock)},{expiryBlock},{domain['value']/1000000},{wallet}" else: - result += f"\n{domain['name']},N/A,{domain['value']/1000000},{wallet}" + result += f"\n{domain['name']},N/A,N/A,{domain['value']/1000000},{wallet}" return {"result": result}