addrgen.py 928 B

123456789101112131415161718192021222324252627282930313233
  1. #!/usr/bin/env python3
  2. #
  3. # mmgen = Multi-Mode GENerator, a command-line cryptocurrency wallet
  4. # Copyright (C)2013-2024 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.zec.addrgen: Zcash-Z address generation class for the MMGen suite
  12. """
  13. from ...addrgen import addr_generator,check_data
  14. from ...addr import CoinAddr
  15. from ..btc.common import b58chk_encode
  16. class zcash_z(addr_generator.base):
  17. @check_data
  18. def to_addr(self,data):
  19. ret = b58chk_encode(
  20. self.proto.addr_fmt_to_ver_bytes['zcash_z']
  21. + data.pubkey )
  22. return CoinAddr( self.proto, ret )
  23. @check_data
  24. def to_viewkey(self,data):
  25. return self.proto.viewkey(
  26. b58chk_encode(
  27. self.proto.addr_fmt_to_ver_bytes['viewkey']
  28. + data.viewkey_bytes ) )