ScriptInvalidBefore
- class cometa.scripts.native_scripts.script_invalid_before.ScriptInvalidBefore(ptr)[source]
Bases:
objectRepresents a time-lock script that requires a minimum slot.
This script evaluates to true if the lower bound of the transaction validity interval is a slot number Y, and Y >= X (the slot number in this script). This guarantees that the transaction is included in a slot >= X.
- __init__(ptr)[source]
Initializes a ScriptInvalidBefore from an FFI pointer.
- Parameters:
ptr – FFI pointer to the native cardano_script_invalid_before_t object.
- Raises:
CardanoError – If the pointer is NULL.
- Return type:
None
- __enter__()[source]
Enters a context manager for the ScriptInvalidBefore object.
- Returns:
Self for use in a with statement.
- Return type:
- __exit__(exc_type, exc_val, exc_tb)[source]
Exits the context manager for the ScriptInvalidBefore object.
- Parameters:
exc_type – The exception type if an exception occurred.
exc_val – The exception value if an exception occurred.
exc_tb – The exception traceback if an exception occurred.
- Return type:
None
- __repr__()[source]
Returns a string representation of the ScriptInvalidBefore object.
- Returns:
A string representation showing the slot number.
- Return type:
str
- classmethod new(slot)[source]
Creates a new ScriptInvalidBefore with the given slot number.
- Parameters:
slot (int) – The slot number representing the lower bound of validity.
- Returns:
A new ScriptInvalidBefore instance.
- Raises:
CardanoError – If creation fails.
- Return type:
- classmethod from_cbor(reader)[source]
Deserializes a ScriptInvalidBefore from CBOR data.
- Parameters:
reader (CborReader) – A CborReader positioned at the script data.
- Returns:
A new ScriptInvalidBefore deserialized from the CBOR data.
- Raises:
CardanoError – If deserialization fails.
- Return type:
- 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 slot: int
The slot number representing the lower bound of validity.
- Returns:
The slot number.
- property hash: bytes
The hash of this native script.
- Returns:
The 28-byte Blake2b hash.
- __eq__(other)[source]
Checks equality with another ScriptInvalidBefore.
- Parameters:
other (object)
- Return type:
bool
- __hash__ = None