本文整理汇总了Python中electrum.wallet.BIP32_HD_Wallet.sign_message方法的典型用法代码示例。如果您正苦于以下问题:Python BIP32_HD_Wallet.sign_message方法的具体用法?Python BIP32_HD_Wallet.sign_message怎么用?Python BIP32_HD_Wallet.sign_message使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类electrum.wallet.BIP32_HD_Wallet
的用法示例。
在下文中一共展示了BIP32_HD_Wallet.sign_message方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: sign_message
# 需要导入模块: from electrum.wallet import BIP32_HD_Wallet [as 别名]
# 或者: from electrum.wallet.BIP32_HD_Wallet import sign_message [as 别名]
def sign_message(self, address, message, password):
if self.has_seed():
return BIP32_HD_Wallet.sign_message(self, address, message, password)
use2FA = False
self.signing = True
self.get_client() # prompt for the PIN before displaying the dialog if necessary
if not self.check_proper_device():
self.give_error('Wrong device or password')
address_path = self.address_id(address)
self.plugin.handler.show_message("Signing message ...")
try:
info = self.get_client().signMessagePrepare(address_path, message)
pin = ""
if info['confirmationNeeded']:
# TODO : handle different confirmation types. For the time being only supports keyboard 2FA
use2FA = True
confirmed, p, pin = self.password_dialog()
if not confirmed:
raise Exception('Aborted by user')
pin = pin.encode()
self.client.bad = True
self.device_checked = False
self.get_client(True)
signature = self.get_client().signMessageSign(pin)
except BTChipException, e:
if e.sw == 0x6a80:
self.give_error("Unfortunately, this message cannot be signed by the Ledger wallet. Only alphanumerical messages shorter than 140 characters are supported. Please remove any extra characters (tab, carriage return) and retry.")
else:
self.give_error(e, True)
示例2: sign_message
# 需要导入模块: from electrum.wallet import BIP32_HD_Wallet [as 别名]
# 或者: from electrum.wallet.BIP32_HD_Wallet import sign_message [as 别名]
def sign_message(self, address, message, password):
if self.has_seed():
return BIP32_HD_Wallet.sign_message(self, address, message, password)
if not self.check_proper_device():
give_error("Wrong device or password")
try:
address_path = self.address_id(address)
address_n = self.plugin.get_client().expand_path(address_path)
except Exception, e:
give_error(e)