ScriptAny

class cometa.scripts.native_scripts.script_any.ScriptAny(ptr)[source]

Bases: object

Represents a script that requires any sub-script to evaluate to true.

This script evaluates to true if any of the sub-scripts evaluate to true. If the list of sub-scripts is empty, this script evaluates to false.

__init__(ptr)[source]
Return type:

None

__enter__()[source]
Return type:

ScriptAny

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

None

__repr__()[source]

Return repr(self).

Return type:

str

classmethod new(scripts)[source]

Creates a new ScriptAny with the given sub-scripts.

Parameters:

scripts (NativeScriptList | List[Any]) – The list of native scripts where at least one must evaluate to true. Can be a NativeScriptList or a Python list of native scripts.

Returns:

A new ScriptAny instance.

Raises:

CardanoError – If creation fails.

Return type:

ScriptAny

classmethod from_cbor(reader)[source]

Deserializes a ScriptAny from CBOR data.

Parameters:

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

Returns:

A new ScriptAny deserialized from the CBOR data.

Raises:

CardanoError – If deserialization fails.

Return type:

ScriptAny

to_cbor(writer)[source]

Serializes the script to CBOR format.

Parameters:

writer (CborWriter) – A CborWriter to write the serialized data to.

Raises:

CardanoError – If serialization fails.

Return type:

None

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

property scripts: NativeScriptList

The list of sub-scripts.

Returns:

The NativeScriptList containing all sub-scripts.

property hash: bytes

The hash of this native script.

Returns:

The 28-byte Blake2b hash.

__len__()[source]

Returns the number of sub-scripts.

Return type:

int

__eq__(other)[source]

Checks equality with another ScriptAny.

Parameters:

other (object)

Return type:

bool

__hash__ = None