Constitution

class cometa.proposal_procedures.constitution.Constitution(ptr)[source]

Bases: object

Represents a Cardano constitution.

The constitution is a document that defines the rules and principles governing the Cardano blockchain. It includes an anchor (URL and hash) pointing to the constitution document and optionally a script hash for the constitution script.

__init__(ptr)[source]
Return type:

None

__enter__()[source]
Return type:

Constitution

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

None

__repr__()[source]

Return repr(self).

Return type:

str

classmethod new(anchor, script_hash=None)[source]

Creates a new constitution.

Parameters:
  • anchor (Anchor) – The anchor pointing to the constitution document.

  • script_hash (Blake2bHash | None) – Optional script hash for the constitution script.

Returns:

A new Constitution instance.

Raises:

CardanoError – If creation fails.

Return type:

Constitution

classmethod from_cbor(reader)[source]

Deserializes a Constitution from CBOR data.

Parameters:

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

Returns:

A new Constitution deserialized from the CBOR data.

Raises:

CardanoError – If deserialization fails.

Return type:

Constitution

to_cbor(writer)[source]

Serializes the constitution to CBOR format.

Parameters:

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

Raises:

CardanoError – If serialization fails.

Return type:

None

property anchor: Anchor

The anchor pointing to the constitution document.

Returns:

The Anchor.

property script_hash: Blake2bHash | None

The optional script hash for the constitution script.

Returns:

The Blake2bHash if present, None otherwise.

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