PlutusV3ScriptSet

class cometa.witness_set.plutus_v3_script_set.PlutusV3ScriptSet(ptr=None)[source]

Bases: Set[PlutusV3Script]

Represents a set of Plutus V3 scripts.

Plutus V3 scripts are smart contracts introduced in the Conway hard fork. V3 scripts support governance features and have additional built-in functions for working with the new governance mechanisms.

__init__(ptr=None)[source]
Return type:

None

__enter__()[source]
Return type:

PlutusV3ScriptSet

__exit__(exc_type, exc_val, exc_tb)[source]
Return type:

None

__repr__()[source]

Return repr(self).

Return type:

str

classmethod from_cbor(reader)[source]

Deserializes a PlutusV3ScriptSet from CBOR data.

Parameters:

reader (CborReader) – A CborReader positioned at the script set data.

Returns:

A new PlutusV3ScriptSet deserialized from the CBOR data.

Raises:

CardanoError – If deserialization fails.

Return type:

PlutusV3ScriptSet

classmethod from_list(scripts)[source]

Creates a PlutusV3ScriptSet from an iterable of PlutusV3Script objects.

Parameters:

scripts (Iterable[PlutusV3Script]) – An iterable of PlutusV3Script objects.

Returns:

A new PlutusV3ScriptSet containing all the scripts.

Raises:

CardanoError – If creation fails.

Return type:

PlutusV3ScriptSet

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 V3 script to the set.

Parameters:

script (PlutusV3Script) – The PlutusV3Script to add.

Raises:

CardanoError – If addition fails.

Return type:

None

get(index)[source]

Retrieves a Plutus V3 script at the specified index.

Parameters:

index (int) – The index of the script to retrieve.

Returns:

The PlutusV3Script at the specified index.

Raises:
  • CardanoError – If retrieval fails.

  • IndexError – If index is out of bounds.

Return type:

PlutusV3Script

__len__()[source]

Returns the number of scripts in the set.

Return type:

int

__iter__()[source]

Iterates over all scripts in the set.

Return type:

Iterator[PlutusV3Script]

__getitem__(index)[source]

Gets a script by index using bracket notation.

Parameters:

index (int)

Return type:

PlutusV3Script

__bool__()[source]

Returns True if the set is not empty.

Return type:

bool

__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[PlutusV3Script]) – Another iterable to compare with.

Returns:

True if the sets are disjoint.

Return type:

bool