PlutusV1ScriptSet
- class cometa.witness_set.plutus_v1_script_set.PlutusV1ScriptSet(ptr=None)[source]
Bases:
Set[PlutusV1Script]Represents a set of Plutus V1 scripts.
Plutus V1 scripts are smart contracts that implement pure functions with True or False outputs. V1 was the initial version of Plutus, introduced in the Alonzo hard fork.
- classmethod from_cbor(reader)[source]
Deserializes a PlutusV1ScriptSet from CBOR data.
- Parameters:
reader (CborReader) – A CborReader positioned at the script set data.
- Returns:
A new PlutusV1ScriptSet deserialized from the CBOR data.
- Raises:
CardanoError – If deserialization fails.
- Return type:
- classmethod from_list(scripts)[source]
Creates a PlutusV1ScriptSet from an iterable of PlutusV1Script objects.
- Parameters:
scripts (Iterable[PlutusV1Script]) – An iterable of PlutusV1Script objects.
- Returns:
A new PlutusV1ScriptSet containing all the scripts.
- Raises:
CardanoError – If creation fails.
- Return type:
- to_cbor(writer)[source]
Serializes the script set to CBOR format.
- Parameters:
writer (CborWriter) – A CborWriter to write the serialized data to.
- Raises:
CardanoError – If serialization fails.
- Return type:
None
- property use_tag: bool
Whether the set uses Conway era tagged encoding.
- Returns:
True if using tagged encoding, False for legacy array encoding.
- add(script)[source]
Adds a Plutus V1 script to the set.
- Parameters:
script (PlutusV1Script) – The PlutusV1Script to add.
- Raises:
CardanoError – If addition fails.
- Return type:
None
- get(index)[source]
Retrieves a Plutus V1 script at the specified index.
- Parameters:
index (int) – The index of the script to retrieve.
- Returns:
The PlutusV1Script at the specified index.
- Raises:
CardanoError – If retrieval fails.
IndexError – If index is out of bounds.
- Return type:
- __iter__()[source]
Iterates over all scripts in the set.
- Return type:
Iterator[PlutusV1Script]
- __getitem__(index)[source]
Gets a script by index using bracket notation.
- Parameters:
index (int)
- Return type:
- __contains__(item)[source]
Checks if an item is in the set.
- Parameters:
item (object)
- Return type:
bool
- isdisjoint(other)[source]
Returns True if the set has no elements in common with other.
- Parameters:
other (Iterable[PlutusV1Script]) – Another iterable to compare with.
- Returns:
True if the sets are disjoint.
- Return type:
bool