當前位置: 首頁>>代碼示例>>Python>>正文


Python protocol.CCProtocolPacker類代碼示例

本文整理匯總了Python中ckcc.protocol.CCProtocolPacker的典型用法代碼示例。如果您正苦於以下問題:Python CCProtocolPacker類的具體用法?Python CCProtocolPacker怎麽用?Python CCProtocolPacker使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了CCProtocolPacker類的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: doit

        def doit():
            dlen, _ = dev.upload_file(firmware, verify=True)
            assert dlen == len(firmware)

            # append the firmware header a second time
            result = dev.send_recv(CCProtocolPacker.upload(size, size+FW_HEADER_SIZE, hdr))

            # make it reboot into bootlaoder which might install it
            dev.send_recv(CCProtocolPacker.reboot())
開發者ID:faircoin,項目名稱:electrumfair,代碼行數:9,代碼來源:qt.py

示例2: ping_check

 def ping_check(self):
     # check connection is working
     assert self.dev.session_key, 'not encrypted?'
     req = b'1234 Electrum Plugin 4321'      # free up to 59 bytes
     try:
         echo = self.dev.send_recv(CCProtocolPacker.ping(req))
         assert echo == req
     except:
         raise RuntimeError("Communication trouble with Coldcard")
開發者ID:neocogent,項目名稱:electrum,代碼行數:9,代碼來源:coldcard.py

示例3: sign_transaction_start

    def sign_transaction_start(self, raw_psbt, finalize=True):
        # Multiple steps to sign:
        # - upload binary
        # - start signing UX
        # - wait for coldcard to complete process, or have it refused.
        # - download resulting txn
        assert 20 <= len(raw_psbt) < MAX_TXN_LEN, 'PSBT is too big'
        dlen, chk = self.dev.upload_file(raw_psbt)

        resp = self.dev.send_recv(CCProtocolPacker.sign_transaction(dlen, chk, finalize=finalize),
                                    timeout=None)

        if resp != None:
            raise ValueError(resp)
開發者ID:neocogent,項目名稱:electrum,代碼行數:14,代碼來源:coldcard.py

示例4: get_xpub

 def get_xpub(self, bip32_path, xtype):
     assert xtype in ColdcardPlugin.SUPPORTED_XTYPES
     print_error('[coldcard]', 'Derive xtype = %r' % xtype)
     xpub = self.dev.send_recv(CCProtocolPacker.get_xpub(bip32_path), timeout=5000)
     # TODO handle timeout?
     # change type of xpub to the requested type
     try:
         __, depth, fingerprint, child_number, c, cK = deserialize_xpub(xpub)
     except InvalidMasterKeyVersionBytes:
         raise UserFacingException(_('Invalid xpub magic. Make sure your {} device is set to the correct chain.')
                                   .format(self.device)) from None
     if xtype != 'standard':
         xpub = serialize_xpub(xtype, c, cK, depth, fingerprint, child_number)
     return xpub
開發者ID:neocogent,項目名稱:electrum,代碼行數:14,代碼來源:coldcard.py

示例5: get_xpub

 def get_xpub(self, bip32_path, xtype):
     assert xtype in ColdcardPlugin.SUPPORTED_XTYPES
     print_error('[coldcard]', 'Derive xtype = %r' % xtype)
     xpub = self.dev.send_recv(CCProtocolPacker.get_xpub(bip32_path), timeout=5000)
     # TODO handle timeout?
     # change type of xpub to the requested type
     try:
         node = BIP32Node.from_xkey(xpub)
     except InvalidMasterKeyVersionBytes:
         raise UserFacingException(_('Invalid xpub magic. Make sure your {} device is set to the correct chain.')
                                   .format(self.device)) from None
     if xtype != 'standard':
         xpub = node._replace(xtype=xtype).to_xpub()
     return xpub
開發者ID:faircoin,項目名稱:electrumfair,代碼行數:14,代碼來源:coldcard.py

示例6: sign_transaction_poll

 def sign_transaction_poll(self):
     # poll device... if user has approved, will get tuple: (legnth, checksum) else None
     return self.dev.send_recv(CCProtocolPacker.get_signed_txn(), timeout=None)
開發者ID:neocogent,項目名稱:electrum,代碼行數:3,代碼來源:coldcard.py

示例7: sign_message_poll

 def sign_message_poll(self):
     # poll device... if user has approved, will get tuple: (addr, sig) else None
     return self.dev.send_recv(CCProtocolPacker.get_signed_msg(), timeout=None)
開發者ID:neocogent,項目名稱:electrum,代碼行數:3,代碼來源:coldcard.py

示例8: sign_message_start

 def sign_message_start(self, path, msg):
     # this starts the UX experience.
     self.dev.send_recv(CCProtocolPacker.sign_message(msg, path), timeout=None)
開發者ID:neocogent,項目名稱:electrum,代碼行數:3,代碼來源:coldcard.py

示例9: get_version

 def get_version(self):
     # gives list of strings
     return self.dev.send_recv(CCProtocolPacker.version(), timeout=1000).split('\n')
開發者ID:neocogent,項目名稱:electrum,代碼行數:3,代碼來源:coldcard.py

示例10: show_address

 def show_address(self, path, addr_fmt):
     # prompt user w/ addres, also returns it immediately.
     return self.dev.send_recv(CCProtocolPacker.show_address(path, addr_fmt), timeout=None)
開發者ID:neocogent,項目名稱:electrum,代碼行數:3,代碼來源:coldcard.py


注:本文中的ckcc.protocol.CCProtocolPacker類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。