BootstrapWitnessSet
- class cometa.witness_set.bootstrap_witness_set.BootstrapWitnessSet(ptr=None)[source]
Bases:
Set[BootstrapWitness]Represents a set of bootstrap witnesses.
This collection type is used in transaction witness sets to hold all bootstrap witnesses required for Byron-era address spending.
- classmethod from_cbor(reader)[source]
Deserializes a BootstrapWitnessSet from CBOR data.
- Parameters:
reader (CborReader) – A CborReader positioned at the witness set data.
- Returns:
A new BootstrapWitnessSet deserialized from the CBOR data.
- Raises:
CardanoError – If deserialization fails.
- Return type:
- classmethod from_list(witnesses)[source]
Creates a BootstrapWitnessSet from an iterable of BootstrapWitness objects.
- Parameters:
witnesses (Iterable[BootstrapWitness]) – An iterable of BootstrapWitness objects.
- Returns:
A new BootstrapWitnessSet containing all the witnesses.
- Raises:
CardanoError – If creation fails.
- Return type:
- 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 bootstrap witness to the set.
- Parameters:
witness (BootstrapWitness) – The BootstrapWitness to add.
- Raises:
CardanoError – If addition fails.
- Return type:
None
- get(index)[source]
Retrieves a bootstrap witness at the specified index.
- Parameters:
index (int) – The index of the witness to retrieve.
- Returns:
The BootstrapWitness at the specified index.
- Raises:
CardanoError – If retrieval fails.
IndexError – If index is out of bounds.
- Return type:
- property use_tag: bool
Whether the set uses Conway era tagged encoding.
- Returns:
True if using tagged encoding, False for legacy array encoding.
- __iter__()[source]
Iterates over all witnesses in the set.
- Return type:
Iterator[BootstrapWitness]
- __getitem__(index)[source]
Gets a witness by index using bracket notation.
- Parameters:
index (int)
- Return type:
- 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[BootstrapWitness]) – Another iterable to compare with.
- Returns:
True if the sets are disjoint.
- Return type:
bool