electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

cmdline.py (1090B)


      1 from electrum.plugin import hook
      2 from electrum.util import print_msg, raw_input, print_stderr
      3 from electrum.logging import get_logger
      4 
      5 from ..hw_wallet.cmdline import CmdLineHandler
      6 
      7 from .coldcard import ColdcardPlugin
      8 
      9 
     10 _logger = get_logger(__name__)
     11 
     12 
     13 class ColdcardCmdLineHandler(CmdLineHandler):
     14 
     15     def get_passphrase(self, msg, confirm):
     16         raise NotImplementedError
     17 
     18     def get_pin(self, msg, *, show_strength=True):
     19         raise NotImplementedError
     20 
     21     def prompt_auth(self, msg):
     22         raise NotImplementedError
     23 
     24     def yes_no_question(self, msg):
     25         print_msg(msg)
     26         return raw_input() in 'yY'
     27 
     28     def stop(self):
     29         pass
     30 
     31     def update_status(self, b):
     32         _logger.info(f'hw device status {b}')
     33 
     34     def finished(self):
     35         pass
     36 
     37 class Plugin(ColdcardPlugin):
     38     handler = ColdcardCmdLineHandler()
     39 
     40     @hook
     41     def init_keystore(self, keystore):
     42         if not isinstance(keystore, self.keystore_class):
     43             return
     44         keystore.handler = self.handler
     45 
     46     def create_handler(self, window):
     47         return self.handler
     48 
     49 # EOF