示例#1
0
    def sign(ctrl):
        ctrl.dlg_config_fun(dlg_title="Confirm transaction signing.",
                            show_progress_bar=False)
        ctrl.display_msg_fun(
            '<b>Click the confirmation button on your hardware wallet<br>'
            'and wait for the transaction to be signed...</b>')

        if hw_session.app_config.hw_type == HWType.trezor:
            import hw_intf_trezor as trezor

            return trezor.sign_tx(hw_session, utxos_to_spend, tx_outputs,
                                  tx_fee)

        elif hw_session.app_config.hw_type == HWType.keepkey:
            import hw_intf_keepkey as keepkey

            return keepkey.sign_tx(hw_session, utxos_to_spend, tx_outputs,
                                   tx_fee)

        elif hw_session.app_config.hw_type == HWType.ledger_nano_s:
            import hw_intf_ledgernano as ledger

            return ledger.sign_tx(hw_session, utxos_to_spend, tx_outputs,
                                  tx_fee)

        else:
            logging.error('Invalid HW type: ' +
                          str(hw_session.app_config.hw_type))
 def sign(ctrl):
     if hw_session.app_config.hw_type == HWType.ledger_nano_s:
         import hw_intf_ledgernano as ledger
         ctrl.dlg_config_fun(dlg_title="Sign transaction",
                             show_progress_bar=False,
                             min_width=250)
         ctrl.display_msg_fun('<b>Initialising...</b>')
         return ledger.sign_tx(hw_session, utxos_to_spend, tx_outputs,
                               tx_fee, ctrl)
     else:
         ctrl.dlg_config_fun(dlg_title="Confirm transaction signing.",
                             show_progress_bar=False)
         ctrl.display_msg_fun(
             '<b>Please verify then confirm the transaction<br>on your hardware wallet.</b>'
         )
         if hw_session.app_config.hw_type == HWType.trezor:
             import hw_intf_trezor as trezor
             return trezor.sign_tx(hw_session, utxos_to_spend, tx_outputs,
                                   tx_fee)
         elif hw_session.app_config.hw_type == HWType.keepkey:
             import hw_intf_keepkey as keepkey
             return keepkey.sign_tx(hw_session, utxos_to_spend, tx_outputs,
                                    tx_fee)
         else:
             logging.error('Invalid HW type: ' +
                           str(hw_session.app_config.hw_type))