Example #1
0
        def create_output_by_address():
            txoutputtype = TxOutputType()
            txoutputtype.amount = amount
            if _type == TYPE_SCRIPT:
                script = address.to_script()
                # We only support OP_RETURN with one constant push
                if (script[0] == 0x6a and amount == 0 and
                    script[1] == len(script) - 2 and
                    script[1] <= 75):
                    txoutputtype.script_type = OutputScriptType.PAYTOOPRETURN
                    txoutputtype.op_return_data = script[2:]
                else:
                    raise Exception(_("Unsupported output script."))
            elif _type == TYPE_ADDRESS:
                txoutputtype.script_type = OutputScriptType.PAYTOADDRESS

                # ecash: addresses are not supported yet by trezor
                ui_addr_fmt = address.FMT_UI
                if ui_addr_fmt == address.FMT_CASHADDR:
                    ui_addr_fmt = address.FMT_CASHADDR_BCH

                addr_format = address.FMT_LEGACY
                if client.get_trezor_model() == 'T':
                    if client.atleast_version(2, 0, 8):
                        addr_format = ui_addr_fmt
                    elif client.atleast_version(2, 0, 7):
                        addr_format = address.FMT_CASHADDR_BCH
                else:
                    if client.atleast_version(1, 6, 2):
                        addr_format = ui_addr_fmt
                txoutputtype.address = address.to_full_string(addr_format)
            return txoutputtype
Example #2
0
 def create_output_by_address():
     txoutputtype = TxOutputType()
     txoutputtype.amount = txout.value
     if address:
         txoutputtype.script_type = OutputScriptType.PAYTOADDRESS
         txoutputtype.address = address
     else:
         txoutputtype.script_type = OutputScriptType.PAYTOOPRETURN
         txoutputtype.op_return_data = trezor_validate_op_return_output_and_get_data(txout)
     return txoutputtype
 def create_output_by_address():
     txoutputtype = TxOutputType()
     txoutputtype.amount = amount
     if _type == TYPE_SCRIPT:
         txoutputtype.script_type = OutputScriptType.PAYTOOPRETURN
         txoutputtype.op_return_data = trezor_validate_op_return_output_and_get_data(o)
     elif _type == TYPE_ADDRESS:
         txoutputtype.script_type = OutputScriptType.PAYTOADDRESS
         txoutputtype.address = address
     return txoutputtype
Example #4
0
 def create_output_by_address():
     txoutputtype = TxOutputType()
     txoutputtype.amount = amount
     if _type == TYPE_SCRIPT:
         txoutputtype.script_type = OutputScriptType.PAYTOOPRETURN
         txoutputtype.op_return_data = trezor_validate_op_return_output_and_get_data(o)
     elif _type == TYPE_ADDRESS:
         txoutputtype.script_type = OutputScriptType.PAYTOADDRESS
         txoutputtype.address = address
     return txoutputtype
Example #5
0
 def create_output_by_address():
     txoutputtype = TxOutputType()
     txoutputtype.amount = tx_output.value
     address = classify_tx_output(tx_output)
     if isinstance(address, Address):
         txoutputtype.script_type = OutputScriptType.PAYTOADDRESS
         txoutputtype.address = address.to_string(coin=Net.COIN)
     elif isinstance(address, OP_RETURN_Output):
         txoutputtype.script_type = OutputScriptType.PAYTOOPRETURN
         txoutputtype.op_return_data = validate_op_return(tx_output)
     return txoutputtype