RedeemerList
- class cometa.witness_set.redeemer_list.RedeemerList(ptr=None)[source]
Bases:
Sequence[Redeemer]Represents a list of redeemers.
This collection type is used in transaction witness sets to hold all redeemers required for script validation.
- classmethod from_cbor(reader)[source]
Deserializes a RedeemerList from CBOR data.
- Parameters:
reader (CborReader) – A CborReader positioned at the redeemer list data.
- Returns:
A new RedeemerList deserialized from the CBOR data.
- Raises:
CardanoError – If deserialization fails.
- Return type:
- classmethod from_list(redeemers)[source]
Creates a RedeemerList from an iterable of Redeemer objects.
- Parameters:
redeemers (Iterable[Redeemer]) – An iterable of Redeemer objects.
- Returns:
A new RedeemerList containing all the redeemers.
- Raises:
CardanoError – If creation fails.
- Return type:
- to_cbor(writer)[source]
Serializes the redeemer list to CBOR format.
- Parameters:
writer (CborWriter) – A CborWriter to write the serialized data to.
- Raises:
CardanoError – If serialization fails.
- Return type:
None
- add(redeemer)[source]
Adds a redeemer to the list.
- Parameters:
redeemer (Redeemer) – The Redeemer to add.
- Raises:
CardanoError – If addition fails.
- Return type:
None
- get(index)[source]
Retrieves a redeemer at the specified index.
- Parameters:
index (int) – The index of the redeemer to retrieve.
- Returns:
The Redeemer at the specified index.
- Raises:
CardanoError – If retrieval fails.
IndexError – If index is out of bounds.
- Return type:
- set_ex_units(tag, index, mem, steps)[source]
Sets the execution units for a specific redeemer.
- Parameters:
tag (RedeemerTag) – The redeemer tag type.
index (int) – The index of the redeemer.
mem (int) – The memory units.
steps (int) – The step units.
- Raises:
CardanoError – If setting fails.
- Return type:
None
- clone()[source]
Creates a deep copy of this redeemer list.
- Returns:
A new RedeemerList that is a deep copy.
- Raises:
CardanoError – If cloning fails.
- Return type:
- clear_cbor_cache()[source]
Clears the cached CBOR representation.
This is useful when you have modified the list after it was created from CBOR and you want to ensure that the next serialization reflects the current state rather than using the original cached CBOR.
Warning
Clearing the CBOR cache may change the binary representation when serialized, which can invalidate existing signatures.
- Return type:
None
- __getitem__(index)[source]
Gets a redeemer by index using bracket notation.
- Parameters:
index (int)
- Return type:
- to_cip116_json(writer)[source]
Serializes this object to CIP-116 compliant JSON.
- Parameters:
writer (JsonWriter) – The JsonWriter to write the JSON to.
- Raises:
CardanoError – If serialization fails.
- Return type:
None
- index(value, start=0, stop=None)[source]
Returns the index of the first occurrence of value.
- Parameters:
value (Redeemer) – The value to search for.
start (int) – Start searching from this index.
stop (int | None) – Stop searching at this index.
- Returns:
The index of the first occurrence.
- Raises:
ValueError – If the value is not found.
- Return type:
int