Relays

class cometa.pool_params.relays.Relays(ptr)[source]

Bases: object

Represents a collection of relays for a Cardano stake pool.

This class provides a list-like interface for managing pool relays, supporting iteration, indexing, and standard list operations.

__init__(ptr)[source]
Return type:

None

__enter__()[source]
Return type:

Relays

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

None

__repr__()[source]

Return repr(self).

Return type:

str

__len__()[source]
Return type:

int

__getitem__(index: int) Relay[source]
__getitem__(index: slice) List[Relay]
__iter__()[source]
Return type:

Iterator[Relay]

__contains__(item)[source]
Parameters:

item (object)

Return type:

bool

classmethod new()[source]

Creates a new empty Relays collection.

Returns:

A new empty Relays instance.

Raises:

CardanoError – If creation fails.

Return type:

Relays

classmethod from_cbor(reader)[source]

Deserializes a Relays collection from CBOR data.

Parameters:

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

Returns:

A new Relays deserialized from the CBOR data.

Raises:

CardanoError – If deserialization fails.

Return type:

Relays

to_cbor(writer)[source]

Serializes the relays collection to CBOR format.

Parameters:

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

Raises:

CardanoError – If serialization fails.

Return type:

None

add(relay)[source]

Adds a relay to the collection.

Parameters:

relay (Relay | SingleHostAddrRelay | SingleHostNameRelay | MultiHostNameRelay) – The relay to add. Can be a Relay or any specific relay type.

Raises:

CardanoError – If adding fails.

Return type:

None

append(relay)[source]

Appends a relay to the collection (alias for add).

Parameters:

relay (Relay | SingleHostAddrRelay | SingleHostNameRelay | MultiHostNameRelay) – The relay to append. Can be a Relay or any specific relay type.

Raises:

CardanoError – If appending fails.

Return type:

None

extend(relays)[source]

Extends the collection with relays from another collection or list.

Parameters:

relays (Relays | List[Relay | SingleHostAddrRelay | SingleHostNameRelay | MultiHostNameRelay]) – Another Relays collection or a list of relay-like objects.

Raises:

CardanoError – If extending fails.

Return type:

None

to_cip116_json(writer)[source]

Serializes this relays collection to CIP-116 compliant JSON.

Parameters:

writer (JsonWriter) – The JsonWriter to write the JSON to.

Raises:

CardanoError – If serialization fails.

Return type:

None