amt: pass coin unit to hl3()

This commit is contained in:
The MMGen Project 2026-11-15 10:56:44 +00:00
commit 052ff38780
Signed by: mmgen
GPG key ID: 3F8B1861E32B7DA2
3 changed files with 4 additions and 4 deletions

View file

@ -109,12 +109,12 @@ class CoinAmt(Decimal, Hilite, InitErrors): # abstract class
return self.colorize2(str(self), color=color, color_override=color_override)
# fancy highlighting with coin unit, enclosure, formatting
def hl3(self, *, color=True, unit=False, fs='{}', encl='', color_override=''):
def hl3(self, *, color=True, unit=None, fs='{}', encl='', color_override=''):
res = fs.format(self)
return self.colorize2(
encl[:-1]
+ (res.rstrip('0').rstrip('.') if '.' in res else res)
+ (' ' + self.coin if unit else '')
+ (' ' + unit if unit else '')
+ encl[1:],
color = color,
color_override = color_override)

View file

@ -130,7 +130,7 @@ class Signable:
if nm is non_mmgen[0] else ''.ljust(t_wid),
a = nm.addr.fmt(nm.addr.view_pref, a_wid, color=True)
if nm.addr else '-'.ljust(a_wid),
A = nm.amt.hl() + ' ' + yellow(tx.coin))
A = nm.amt.hl3(unit=tx.proto.dcoin))
msg('\n' + '\n'.join(gen()))
else:

View file

@ -88,7 +88,7 @@ class TwAddressesPrune(TwAddresses):
red('Address #{a} ({b}) has a balance of {c}!'.format(
a = addrnum,
b = e.twmmid.addr,
c = e.amt.hl3(color=False, unit=True))),
c = e.amt.hl3(color=False, unit=self.proto.dcoin))),
'[p]rune anyway, [P]rune all with balance, [s]kip, [S]kip all with balance: '),
'used': md(
yellow('Address #{a} ({b}) is used!'.format(