TxInfo: improve timestamp display
This commit is contained in:
parent
cb8b697fe2
commit
c6ef791a6b
3 changed files with 14 additions and 6 deletions
|
|
@ -19,8 +19,8 @@ from ....addr import MMGenID
|
|||
|
||||
class TxInfo(TxInfo):
|
||||
sort_orders = ('addr','raw')
|
||||
txinfo_hdr_fs = 'TRANSACTION DATA\n\nID={i} ({a} {c}) UTC={t} RBF={r} Sig={s} Locktime={l}\n'
|
||||
txinfo_hdr_fs_short = 'TX {i} ({a} {c}) UTC={t} RBF={r} Sig={s} Locktime={l}\n'
|
||||
txinfo_hdr_fs = 'TRANSACTION DATA\n\nID={i} ({a} {c}) RBF={r} Sig={s} Locktime={l}\n'
|
||||
txinfo_hdr_fs_short = 'TX {i} ({a} {c}) RBF={r} Sig={s} Locktime={l}\n'
|
||||
txinfo_ftr_fs = fmt("""
|
||||
Input amount: {i} {d}
|
||||
Spend amount: {s} {d}
|
||||
|
|
|
|||
|
|
@ -19,8 +19,8 @@ from ....addr import MMGenID
|
|||
from ....obj import Str
|
||||
|
||||
class TxInfo(TxInfo):
|
||||
txinfo_hdr_fs = 'TRANSACTION DATA\n\nID={i} ({a} {c}) UTC={t} Sig={s} Locktime={l}\n'
|
||||
txinfo_hdr_fs_short = 'TX {i} ({a} {c}) UTC={t} Sig={s} Locktime={l}\n'
|
||||
txinfo_hdr_fs = 'TRANSACTION DATA\n\nID={i} ({a} {c}) Sig={s} Locktime={l}\n'
|
||||
txinfo_hdr_fs_short = 'TX {i} ({a} {c}) Sig={s} Locktime={l}\n'
|
||||
txinfo_ftr_fs = fmt("""
|
||||
Total in account: {i} {d}
|
||||
Total to spend: {o} {d}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,8 @@ import importlib
|
|||
|
||||
from ..cfg import gc
|
||||
from ..color import red,green,orange
|
||||
from ..util import msg,msg_r
|
||||
from ..util import msg,msg_r,decode_timestamp,make_timestr
|
||||
from ..util2 import format_elapsed_hr
|
||||
|
||||
class TxInfo:
|
||||
|
||||
|
|
@ -49,13 +50,20 @@ class TxInfo:
|
|||
i = tx.txid.hl(),
|
||||
a = tx.send_amt.hl(),
|
||||
c = tx.dcoin,
|
||||
t = tx.timestamp,
|
||||
r = green('True') if tx.is_replaceable() else red('False'),
|
||||
s = green('True') if tx.signed else red('False'),
|
||||
l = (
|
||||
orange(self.strfmt_locktime(terse=True)) if tx.locktime else
|
||||
green('None') ))
|
||||
|
||||
for attr,label in [('timestamp','Created:')]:
|
||||
if (val := getattr(tx,attr)) is not None:
|
||||
_ = decode_timestamp(val)
|
||||
yield f'{label:8} {make_timestr(_)} ({format_elapsed_hr(_)})\n'
|
||||
|
||||
if not terse:
|
||||
yield '\n'
|
||||
|
||||
if tx.chain != 'mainnet': # if mainnet has a coin-specific name, display it
|
||||
yield green(f'Chain: {tx.chain.upper()}') + '\n'
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue