SingleHostNameRelay

class cometa.pool_params.single_host_name_relay.SingleHostNameRelay(ptr)[source]

Bases: object

Represents a single host name relay for Cardano stake pools.

This relay type points to a single host via a DNS name (A or AAAA record) and an optional port number.

__init__(ptr)[source]
Return type:

None

__enter__()[source]
Return type:

SingleHostNameRelay

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

None

__repr__()[source]

Return repr(self).

Return type:

str

__str__()[source]

Return str(self).

Return type:

str

classmethod new(dns, port=None)[source]

Creates a new single host name relay.

Parameters:
  • dns (str) – The DNS hostname (e.g., “relay.example.com”).

  • port (int | None) – Optional port number (0-65535).

Returns:

A new SingleHostNameRelay instance.

Raises:

CardanoError – If creation fails.

Return type:

SingleHostNameRelay

Example

>>> relay = SingleHostNameRelay.new("relay.example.com", port=3001)
classmethod from_cbor(reader)[source]

Deserializes a SingleHostNameRelay from CBOR data.

Parameters:

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

Returns:

A new SingleHostNameRelay deserialized from the CBOR data.

Raises:

CardanoError – If deserialization fails.

Return type:

SingleHostNameRelay

to_cbor(writer)[source]

Serializes the relay to CBOR format.

Parameters:

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

Raises:

CardanoError – If serialization fails.

Return type:

None

property port: int | None

Returns the port number, or None if not set.

property dns: str

Returns the DNS hostname.

to_cip116_json(writer)[source]

Serializes this relay to CIP-116 compliant JSON.

Parameters:

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

Raises:

CardanoError – If serialization fails.

Return type:

None