ctl.py 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #!/usr/bin/env python3
  2. #
  3. # MMGen Wallet, a terminal-based cryptocurrency wallet
  4. # Copyright (C)2013-2026 The MMGen Project <mmgen@tuta.io>
  5. # Licensed under the GNU General Public License, Version 3:
  6. # https://www.gnu.org/licenses
  7. # Public project repositories:
  8. # https://github.com/mmgen/mmgen-wallet
  9. # https://gitlab.com/mmgen/mmgen-wallet
  10. """
  11. proto.xmr.tw.ctl: Monero tracking wallet control class
  12. """
  13. from ....tw.ctl import write_mode
  14. from ....tw.store import TwCtlWithStore
  15. class MoneroTwCtl(TwCtlWithStore):
  16. tw_subdir = 'tracking-wallets'
  17. use_cached_balances = True
  18. @write_mode
  19. async def set_comment(
  20. self,
  21. addrspec,
  22. comment = '',
  23. *,
  24. trusted_pair = None,
  25. silent = False):
  26. from ....ui import keypress_confirm
  27. add_timestr = keypress_confirm(self.cfg, 'Add timestamp to label?')
  28. m = trusted_pair[0].obj
  29. from ....xmrwallet import op as xmrwallet_op
  30. op = xmrwallet_op(
  31. 'label',
  32. self.cfg,
  33. None,
  34. None,
  35. spec = f'{m.idx}:{m.acct_idx}:{m.addr_idx},{comment}',
  36. compat_call = True)
  37. op.c.call('close_wallet')
  38. return await op.main(add_timestr=add_timestr)