tx.info: display amounts with columnar alignment
This commit is contained in:
parent
addd94c702
commit
4da94df0da
3 changed files with 14 additions and 10 deletions
|
|
@ -36,8 +36,8 @@ class TxInfo(TxInfo):
|
|||
pink('{:0.6f}%'.format( tx.fee / tx.send_amt * 100 ))
|
||||
)
|
||||
|
||||
def format_abs_fee(self):
|
||||
return self.tx.proto.coin_amt(self.tx.fee).hl()
|
||||
def format_abs_fee(self,color,iwidth):
|
||||
return self.tx.proto.coin_amt(self.tx.fee).fmt(color=color,iwidth=iwidth)
|
||||
|
||||
def format_verbose_footer(self):
|
||||
tx = self.tx
|
||||
|
|
@ -67,6 +67,8 @@ class TxInfo(TxInfo):
|
|||
key = lambda o: (o.mmid.sort_key if o.mmid else f'+{o.addr}') + f'{o.amt:040.20f}' ),
|
||||
'raw': lambda: io
|
||||
}[sort]
|
||||
if terse:
|
||||
iwidth = max(len(str(int(e.amt))) for e in io)
|
||||
for n,e in enumerate(io_sorted()):
|
||||
if is_input and blockcount:
|
||||
confs = e.confs + blockcount - tx.blockcount
|
||||
|
|
@ -85,7 +87,7 @@ class TxInfo(TxInfo):
|
|||
n+1,
|
||||
e.addr.fmt(color=True,width=addr_w),
|
||||
mmid_fmt,
|
||||
e.amt.hl(),
|
||||
e.amt.fmt(iwidth=iwidth,color=True),
|
||||
tx.dcoin )
|
||||
else:
|
||||
def gen():
|
||||
|
|
|
|||
|
|
@ -55,8 +55,8 @@ class TxInfo(TxInfo):
|
|||
t_mmid = m['outputs'] if len(tx.outputs) else '',
|
||||
f_mmid = m['inputs'] )
|
||||
|
||||
def format_abs_fee(self):
|
||||
return self.tx.fee.hl() + (' (max)' if self.tx.txobj['data'] else '')
|
||||
def format_abs_fee(self,color,iwidth):
|
||||
return self.tx.fee.fmt(color=color,iwidth=iwidth) + (' (max)' if self.tx.txobj['data'] else '')
|
||||
|
||||
def format_rel_fee(self,terse):
|
||||
return ' ({} of spend amount)'.format(
|
||||
|
|
|
|||
|
|
@ -72,12 +72,14 @@ class TxInfo:
|
|||
|
||||
yield self.format_body(blockcount,nonmm_str,max_mmwid,enl,terse=terse,sort=sort)
|
||||
|
||||
iwidth = len(str(int(tx.sum_inputs())))
|
||||
|
||||
yield self.txinfo_ftr_fs.format(
|
||||
i = tx.sum_inputs().hl(),
|
||||
o = tx.sum_outputs().hl(),
|
||||
C = tx.change.hl(),
|
||||
s = tx.send_amt.hl(),
|
||||
a = self.format_abs_fee(),
|
||||
i = tx.sum_inputs().fmt(color=True,iwidth=iwidth),
|
||||
o = tx.sum_outputs().fmt(color=True,iwidth=iwidth),
|
||||
C = tx.change.fmt(color=True,iwidth=iwidth),
|
||||
s = tx.send_amt.fmt(color=True,iwidth=iwidth),
|
||||
a = self.format_abs_fee(color=True,iwidth=iwidth),
|
||||
r = self.format_rel_fee(terse),
|
||||
d = tx.dcoin,
|
||||
c = tx.coin )
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue