Skip to content

Document how to add reference_inputs when using TransactionBuilder #118

Closed
@peterVG

Description

@peterVG

It's not obvious how to set values for the reference_inputs property and add it to a TransactionBody, as per the API here:
https://pycardano.readthedocs.io/en/latest/api/pycardano.transaction.html#pycardano.transaction.TransactionBody

I can add another TransactionBuilder property like ttl as part of the object instantiation, e.g.
builder = TransactionBuilder(context=context, ttl=2024)

But trying to do the same for the reference_inputs property results in:

builder = TransactionBuilder(context=context, reference_inputs=["testing1", "testing2"])
>>>TypeError: TransactionBuilder.__init__() got an unexpected keyword argument 'reference_inputs'

Trying to add it to the object after it's instantiated also fails to build a proper transaction:

builder = TransactionBuilder(context)`
builder.__set__(self, reference_inputs, {"test1", "test2"})
>>>AttributeError: 'TransactionBuilder' object has no attribute '__set__'. Did you mean: '__eq__'?

This code here appears to be adding reference_inputs to the utxo.output.script but, again, not sure where to initially set that reference input value.

if utxo.output.script:
self._inputs_to_scripts[utxo] = utxo.output.script
self.reference_inputs.add(utxo.input)
self._reference_scripts.append(utxo.output.script)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions