VkeyWitnessSet

class cometa.witness_set.vkey_witness_set.VkeyWitnessSet(ptr=None)[source]

Bases: Set[VkeyWitness]

Represents a set of verification key witnesses.

This collection type is used in transaction witness sets to hold all VKey witnesses (public key + signature pairs) that authorize the transaction.

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

None

__enter__()[source]
Return type:

VkeyWitnessSet

__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 VkeyWitnessSet from CBOR data.

Parameters:

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

Returns:

A new VkeyWitnessSet deserialized from the CBOR data.

Raises:

CardanoError – If deserialization fails.

Return type:

VkeyWitnessSet

classmethod from_list(witnesses)[source]

Creates a VkeyWitnessSet from an iterable of VkeyWitness objects.

Parameters:

witnesses (Iterable[VkeyWitness]) – An iterable of VkeyWitness objects.

Returns:

A new VkeyWitnessSet containing all the witnesses.

Raises:

CardanoError – If creation fails.

Return type:

VkeyWitnessSet

to_cbor(writer)[source]

Serializes the witness set to CBOR format.

Parameters:

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

Raises:

CardanoError – If serialization fails.

Return type:

None

add(witness)[source]

Adds a VKey witness to the set.

Parameters:

witness (VkeyWitness) – The VkeyWitness to add.

Raises:

CardanoError – If addition fails.

Return type:

None

get(index)[source]

Retrieves a VKey witness at the specified index.

Parameters:

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

Returns:

The VkeyWitness at the specified index.

Raises:
  • CardanoError – If retrieval fails.

  • IndexError – If index is out of bounds.

Return type:

VkeyWitness

property use_tag: bool

Whether the set uses Conway era tagged encoding.

Returns:

True if using tagged encoding, False for legacy array encoding.

__len__()[source]

Returns the number of witnesses in the set.

Return type:

int

__iter__()[source]

Iterates over all witnesses in the set.

Return type:

Iterator[VkeyWitness]

__getitem__(index)[source]

Gets a witness by index using bracket notation.

Parameters:

index (int)

Return type:

VkeyWitness

__bool__()[source]

Returns True if the set is not empty.

Return type:

bool

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

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

Returns:

True if the sets are disjoint.

Return type:

bool