Beispiel #1
0
    def prepare(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.prepare_transfer_tx(hw_session, utxos_to_spend,
                                              dest_addresses, tx_fee)

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

            return keepkey.prepare_transfer_tx(hw_session, utxos_to_spend,
                                               dest_addresses, tx_fee)

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

            return ledger.prepare_transfer_tx(hw_session, utxos_to_spend,
                                              dest_addresses, tx_fee,
                                              rawtransactions)

        else:
            logging.error('Invalid HW type: ' +
                          str(hw_session.app_config.hw_type))
Beispiel #2
0
    def prepare(ctrl):
        ctrl.dlg_config_fun(dlg_title="Confirm message signing.",
                            show_progress_bar=False)
        ctrl.display_msg_fun(
            '<b>Click the confirmation button on your hardware wallet...</b>')

        if main_ui.config.hw_type == HWType.trezor:
            import hw_intf_trezor as trezor

            return trezor.prepare_transfer_tx(main_ui, utxos_to_spend,
                                              dest_address, tx_fee)

        elif main_ui.config.hw_type == HWType.keepkey:
            import hw_intf_keepkey as keepkey

            return keepkey.prepare_transfer_tx(main_ui, utxos_to_spend,
                                               dest_address, tx_fee)

        elif main_ui.config.hw_type == HWType.ledger_nano_s:
            import hw_intf_ledgernano as ledger

            return ledger.prepare_transfer_tx(main_ui, utxos_to_spend,
                                              dest_address, tx_fee,
                                              rawtransactions)

        else:
            logging.error('Unsupported HW type: ' +
                          str(main_ui.config.hw_type))
def prepare_transfer_tx(main_ui, utxos_to_spend, dest_address, tx_fee):
    """
    Creates a signed transaction.
    :param main_ui: Main window for configuration data
    :param utxos_to_spend: list of utxos to send
    :param dest_address: destination (Dash) address
    :param tx_fee: transaction fee
    :return: tuple (serialized tx, total transaction amount in satoshis)
    """
    main_ui.connectHardwareWallet()
    client = main_ui.hw_client
    if client:
        if main_ui.config.hw_type == 'TREZOR':
            import hw_intf_trezor as trezor

            return trezor.prepare_transfer_tx(main_ui, utxos_to_spend,
                                              dest_address, tx_fee)

        elif main_ui.config.hw_type == 'KEEPKEY':
            import hw_intf_keepkey as keepkey

            return keepkey.prepare_transfer_tx(main_ui, utxos_to_spend,
                                               dest_address, tx_fee)

        else:
            logging.error('Unsupported HW type: ' +
                          str(main_ui.config.hw_type))