diff --git a/silkaj/wot.py b/silkaj/wot.py index 366c696a40e82ae5730fc77d13a70d96c2645ef1..b26d1fbea030ae15adbcfb8cc98cf9a938bbb7dd 100644 --- a/silkaj/wot.py +++ b/silkaj/wot.py @@ -15,7 +15,7 @@ You should have received a copy of the GNU Affero General Public License along with Silkaj. If not, see <https://www.gnu.org/licenses/>. """ -import click +import click, pendulum from time import time from tabulate import tabulate from collections import OrderedDict @@ -26,9 +26,9 @@ from duniterpy.api.errors import DuniterError from silkaj.network_tools import ClientInstance from silkaj.crypto_tools import is_pubkey_and_check from silkaj.tools import message_exit, coroutine -from silkaj.tui import convert_time, display_pubkey_and_checksum +from silkaj.tui import display_pubkey_and_checksum from silkaj.blockchain_tools import BlockchainParams -from silkaj.constants import ASYNC_SLEEP +from silkaj.constants import ASYNC_SLEEP, DATE def get_sent_certifications(signed, time_first_block, params): @@ -132,25 +132,24 @@ async def membership_status(certifications, pubkey, req): "revoked:", req["revoked"], "\nrevoked on:", - convert_time(req["revoked_on"], "date") + "\n", + pendulum.from_timestamp(req["revoked_on"]).format(DATE) + "\n", ) if not member and req["wasMember"]: print("expired:", req["expired"], "\nwasMember:", req["wasMember"]) elif member: print( "Membership document expiration: " - + convert_time(time() + req["membershipExpiresIn"], "date") + + pendulum.from_timestamp(time() + req["membershipExpiresIn"]).format(DATE) ) print("Sentry:", req["isSentry"]) print("outdistanced:", req["outdistanced"]) def expiration_date_from_block_id(block_id, time_first_block, params): - return convert_time( + return pendulum.from_timestamp( date_approximation(block_id, time_first_block, params["avgGenTime"]) - + params["sigValidity"], - "date", - ) + + params["sigValidity"] + ).format(DATE) def date_approximation(block_id, time_first_block, avgentime):