本文整理汇总了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