feat: Add estimated expiry
This commit is contained in:
parent
5445a31a76
commit
27613bc1aa
@ -2,6 +2,7 @@ import json
|
|||||||
import account
|
import account
|
||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
|
import datetime
|
||||||
|
|
||||||
# Plugin Data
|
# Plugin Data
|
||||||
info = {
|
info = {
|
||||||
@ -157,16 +158,23 @@ def expiring(params, authentication):
|
|||||||
expiring += "</tbody></table></div></div>"
|
expiring += "</tbody></table></div></div>"
|
||||||
return {"result": 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):
|
def export(params, authentication):
|
||||||
wallets = account.listWallets()
|
wallets = account.listWallets()
|
||||||
result = "name,expiry,value,wallet"
|
result = "name,expiry,expiryBlock,value,wallet"
|
||||||
|
currentBlock = account.getBlockHeight()
|
||||||
|
|
||||||
for wallet in wallets:
|
for wallet in wallets:
|
||||||
domains = account.getDomains(wallet)
|
domains = account.getDomains(wallet)
|
||||||
for domain in domains:
|
for domain in domains:
|
||||||
if 'stats' in domain and 'renewalPeriodEnd' in domain['stats']:
|
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:
|
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}
|
return {"result": result}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user