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


Python BIP32_HD_Wallet.sign_message方法代碼示例

本文整理匯總了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)
開發者ID:psb777,項目名稱:electrum,代碼行數:31,代碼來源:btchipwallet.py

示例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)
開發者ID:achow101,項目名稱:electrum,代碼行數:12,代碼來源:keepkey.py


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