completed.py 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. #!/usr/bin/env python3
  2. #
  3. # MMGen Wallet, a terminal-based cryptocurrency wallet
  4. # Copyright (C)2013-2025 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.tx.completed: Monero completed transaction class
  12. """
  13. from ....cfg import Config
  14. from ....util import cached_property, make_timestamp
  15. from .base import Base
  16. class Completed(Base):
  17. def __init__(self, cfg, *args, proto, filename, **kwargs):
  18. self.cfg = Config({
  19. '_clone': cfg,
  20. 'coin': 'XMR',
  21. 'network': proto.network})
  22. self.proto = proto
  23. self.filename = filename
  24. @cached_property
  25. def compat_tx(self):
  26. from pathlib import Path
  27. from ....xmrwallet.file.tx import MoneroMMGenTX
  28. return MoneroMMGenTX.View(self.cfg, Path(self.filename)) # View = Completed with silent open
  29. @cached_property
  30. def timestamp(self):
  31. return make_timestamp(self.compat_tx.data.create_time)