本文整理匯總了Python中ckcc.protocol.CCProtocolPacker.get_xpub方法的典型用法代碼示例。如果您正苦於以下問題:Python CCProtocolPacker.get_xpub方法的具體用法?Python CCProtocolPacker.get_xpub怎麽用?Python CCProtocolPacker.get_xpub使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ckcc.protocol.CCProtocolPacker
的用法示例。
在下文中一共展示了CCProtocolPacker.get_xpub方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: get_xpub
# 需要導入模塊: from ckcc.protocol import CCProtocolPacker [as 別名]
# 或者: from ckcc.protocol.CCProtocolPacker import get_xpub [as 別名]
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
示例2: get_xpub
# 需要導入模塊: from ckcc.protocol import CCProtocolPacker [as 別名]
# 或者: from ckcc.protocol.CCProtocolPacker import get_xpub [as 別名]
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