rpc.py 907 B

12345678910111213141516171819202122232425262728293031323334
  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.eth.tw.rpc: Ethereum base protocol tracking wallet RPC class
  12. """
  13. from ....addr import CoinAddr
  14. from ....tw.shared import TwLabel
  15. from ....tw.rpc import TwRPC
  16. class EthereumTwRPC(TwRPC):
  17. async def get_addr_label_pairs(self,twmmid=None):
  18. ret = [(
  19. TwLabel( self.proto, mmid + ' ' + d['comment'] ),
  20. CoinAddr( self.proto, d['addr'] )
  21. ) for mmid,d in self.twctl.mmid_ordered_dict.items() ]
  22. if twmmid:
  23. ret = [e for e in ret if e[0].mmid == twmmid]
  24. return ret or None
  25. class EthereumTokenTwRPC(EthereumTwRPC):
  26. pass