tx.new: add label to autoselect prompt if present

This commit is contained in:
The MMGen Project 2026-10-05 14:30:05 +00:00
commit 82f1756413
Signed by: mmgen
GPG key ID: 3F8B1861E32B7DA2
2 changed files with 6 additions and 4 deletions

View file

@ -285,6 +285,7 @@ class New(Base):
if self.chg_autoselected and not self.is_swap: # swap TX, so user has already confirmed
self.confirm_autoselected_addr(
self.chg_output.mmid,
self.chg_output.comment,
'change address')
elif len(self.nondata_outputs) > 1:
await self.warn_addr_used(self.proto, self.chg_output, 'change address')
@ -313,13 +314,14 @@ class New(Base):
msg(f'{type(e).__name__}: {e}')
return ad_f
def confirm_autoselected_addr(self, mmid, desc):
def confirm_autoselected_addr(self, mmid, lbl, desc):
from ..ui import keypress_confirm
keypress_confirm(
self.cfg,
'Using {a} as {b}. OK?'.format(
'Using {a}{b}as {c}. OK?'.format(
a = mmid.hl(),
b = 'single output address' if len(self.nondata_outputs) == 1 else desc),
b = ' {}\n '.format(lbl.hl2(encl='()')) if lbl else ' ',
c = 'single output address' if len(self.nondata_outputs) == 1 else desc),
default_yes = True,
do_exit = True)

View file

@ -59,7 +59,7 @@ class NewSwap(New):
exclude = [],
desc = full_desc,
match_all_addrtypes = not arg)
self.confirm_autoselected_addr(res.twmmid, full_desc)
self.confirm_autoselected_addr(res.twmmid, res.comment, full_desc)
return ret(proto.coin, proto.network, res.addr, res.twmmid)
async def get_chg_output(self, arg, addrfiles):