xmrwallet: silence messages for compat_call

This commit is contained in:
The MMGen Project 2025-11-27 11:34:09 +00:00
commit e3e215f0c6
Signed by: mmgen
GPG key ID: 3F8B1861E32B7DA2
5 changed files with 27 additions and 20 deletions

View file

@ -130,4 +130,6 @@ def op(op, cfg, infile, wallets, *, spec=None, compat_call=False):
'daemon': cfg.daemon or cfg.monero_daemon,
'watch_only': cfg.watch_only or cfg.autosign or bool(cfg.autosign_mountpoint),
'wallet_dir': twctl_cls.get_tw_dir(cfg, cfg._proto)})
return op_cls(op)(cfg, uargs(infile, wallets, spec))
ret = op_cls(op)(cfg, uargs(infile, wallets, spec))
ret.compat_call = compat_call
return ret

View file

@ -31,12 +31,13 @@ class OpLabel(OpMixinSpec, OpWallet):
async def main(self, add_timestr='ask', auto=False):
gmsg('\n{a} label for wallet {b}, account #{c}, address #{d}'.format(
a = 'Setting' if self.label else 'Removing',
b = self.source.idx,
c = self.account,
d = self.address_idx
))
if not self.compat_call:
gmsg('\n{a} label for wallet {b}, account #{c}, address #{d}'.format(
a = 'Setting' if self.label else 'Removing',
b = self.source.idx,
c = self.account,
d = self.address_idx))
h = MoneroWalletRPC(self, self.source)
h.open_wallet('source')

View file

@ -169,10 +169,10 @@ class OpSweep(OpMixinSpec, OpWallet):
die(2, f'{self.account}: requested account index out of bounds (>{max_acct})')
async def main(self):
gmsg(
f'\n{self.stem.capitalize()}ing account #{self.account}'
f' of wallet {self.source.idx}{self.add_desc}')
if not self.compat_call:
gmsg(
f'\n{self.stem.capitalize()}ing account #{self.account}'
f' of wallet {self.source.idx}{self.add_desc}')
h = MoneroWalletRPC(self, self.source)
@ -191,7 +191,9 @@ class OpSweep(OpMixinSpec, OpWallet):
if self.cfg.tx_relay_daemon:
self.display_tx_relay_info(indent=' ')
msg('Saving TX data to file')
if not self.compat_call:
msg('Saving TX data to file')
new_tx.write(delete_metadata=True)
if self.cfg.no_relay or self.cfg.autosign:

View file

@ -204,11 +204,12 @@ class OpWallet(OpBase):
return 'offline signing ' if self.cfg.offline else 'watch-only ' if self.cfg.watch_only else ''
async def main(self):
gmsg('\n{a}ing {b} {c}wallet{d}'.format(
a = self.stem.capitalize(),
b = len(self.addr_data),
c = self.add_wallet_desc,
d = suf(self.addr_data)))
if not self.compat_call:
gmsg('\n{a}ing {b} {c}wallet{d}'.format(
a = self.stem.capitalize(),
b = len(self.addr_data),
c = self.add_wallet_desc,
d = suf(self.addr_data)))
data = []
for n, d in enumerate(self.addr_data): # [d.sec,d.addr,d.wallet_passwd,d.viewkey]
fn = self.get_wallet_fn(d)
@ -218,7 +219,8 @@ class OpWallet(OpBase):
c = len(self.addr_data),
d = fn.name))
data.append(await self.process_wallet(d, fn, last=n == len(self.addr_data) - 1))
gmsg(f'\n{len(data)} wallet{suf(len(data))} {self.stem}ed\n')
if not self.compat_call:
gmsg(f'\n{len(data)} wallet{suf(len(data))} {self.stem}ed\n')
return data if self.return_data else sum(map(bool, data))
def head_msg(self, wallet_idx, fn):

View file

@ -89,7 +89,7 @@ class MoneroWalletRPC:
addrs_data = [
self.c.call('get_address', account_index=i)
for i in range(len(accts_data['subaddress_accounts']))]
if print:
if print and not self.parent.compat_call:
msg('\n' + '\n'.join(self.gen_accts_info(
accts_data,
addrs_data,
@ -113,7 +113,7 @@ class MoneroWalletRPC:
return (ret['account_index'], ret['base_address'])
def print_acct_addrs(self, wallet_data, account, silent=False):
if not silent:
if not (self.parent.compat_call or silent):
msg('\n Addresses of account #{} ({}):'.format(
account,
wallet_data.accts_data['subaddress_accounts'][account]['label']))