Skip to content
Snippets Groups Projects
Commit cf22c4eb authored by matograine's avatar matograine
Browse files

[mod] #344 use pendulum in tx_history

parent 627262ef
No related branches found
No related tags found
No related merge requests found
...@@ -15,6 +15,7 @@ You should have received a copy of the GNU Affero General Public License ...@@ -15,6 +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/>. along with Silkaj. If not, see <https://www.gnu.org/licenses/>.
""" """
from pendulum import from_timestamp
from click import command, argument, option, echo_via_pager, get_terminal_size from click import command, argument, option, echo_via_pager, get_terminal_size
from texttable import Texttable from texttable import Texttable
from operator import itemgetter, neg, eq, ne from operator import itemgetter, neg, eq, ne
...@@ -25,11 +26,12 @@ from duniterpy.documents.transaction import Transaction ...@@ -25,11 +26,12 @@ from duniterpy.documents.transaction import Transaction
from silkaj.network_tools import ClientInstance from silkaj.network_tools import ClientInstance
from silkaj.tools import coroutine from silkaj.tools import coroutine
from silkaj.tui import convert_time, display_pubkey_and_checksum from silkaj.tui import display_pubkey_and_checksum
from silkaj.crypto_tools import validate_checksum, check_pubkey_format from silkaj.crypto_tools import validate_checksum, check_pubkey_format
from silkaj import wot from silkaj import wot
from silkaj.money import get_amount_from_pubkey, amount_in_current_base, UDValue from silkaj.money import get_amount_from_pubkey, amount_in_current_base, UDValue
from silkaj.tools import CurrencySymbol from silkaj.tools import CurrencySymbol
from silkaj.constants import ALL_DIGITAL
@command("history", help="Display transaction history") @command("history", help="Display transaction history")
...@@ -72,7 +74,7 @@ Current balance: {balance} {currency}, {balance_ud} UD {currency} on the {date}\ ...@@ -72,7 +74,7 @@ Current balance: {balance} {currency}, {balance_ud} UD {currency} on the {date}\
currency=currency_symbol, currency=currency_symbol,
balance=balance[1] / 100, balance=balance[1] / 100,
balance_ud=round(balance[1] / ud_value, 2), balance_ud=round(balance[1] / ud_value, 2),
date=convert_time(time(), "all"), date=from_timestamp(time()).format(ALL_DIGITAL),
) )
...@@ -150,7 +152,7 @@ async def parse_received_tx( ...@@ -150,7 +152,7 @@ async def parse_received_tx(
identities = await wot.identities_from_pubkeys(issuers, uids) identities = await wot.identities_from_pubkeys(issuers, uids)
for received_tx in received_txs: for received_tx in received_txs:
tx_list = list() tx_list = list()
tx_list.append(convert_time(received_tx.time, "all")) tx_list.append(from_timestamp(received_tx.time).format(ALL_DIGITAL))
tx_list.append(str()) tx_list.append(str())
for i, issuer in enumerate(received_tx.issuers): for i, issuer in enumerate(received_tx.issuers):
tx_list[1] += prefix(None, None, i) + assign_idty_from_pubkey( tx_list[1] += prefix(None, None, i) + assign_idty_from_pubkey(
...@@ -182,7 +184,7 @@ async def parse_sent_tx(sent_txs_table, sent_txs, pubkey, ud_value, uids, full_p ...@@ -182,7 +184,7 @@ async def parse_sent_tx(sent_txs_table, sent_txs, pubkey, ud_value, uids, full_p
identities = await wot.identities_from_pubkeys(pubkeys, uids) identities = await wot.identities_from_pubkeys(pubkeys, uids)
for sent_tx in sent_txs: for sent_tx in sent_txs:
tx_list = list() tx_list = list()
tx_list.append(convert_time(sent_tx.time, "all")) tx_list.append(from_timestamp(sent_tx.time).format(ALL_DIGITAL))
total_amount, outputs = tx_amount(sent_tx, pubkey, sent_func) total_amount, outputs = tx_amount(sent_tx, pubkey, sent_func)
if len(outputs) > 1: if len(outputs) > 1:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment