SingleHostAddrRelay
- class cometa.pool_params.single_host_addr_relay.SingleHostAddrRelay(ptr)[source]
Bases:
objectRepresents a single host address relay for Cardano stake pools.
This relay type points to a single host via its IPv4/IPv6 address and a given port. At least one of IPv4 or IPv6 address should be provided. The port is optional.
- classmethod new(port=None, ipv4=None, ipv6=None)[source]
Creates a new single host address relay.
- Parameters:
- Returns:
A new SingleHostAddrRelay instance.
- Raises:
CardanoError – If creation fails.
- Return type:
Example
>>> ipv4 = IPv4.from_string("192.168.1.1") >>> relay = SingleHostAddrRelay.new(port=3001, ipv4=ipv4)
- classmethod from_cbor(reader)[source]
Deserializes a SingleHostAddrRelay from CBOR data.
- Parameters:
reader (CborReader) – A CborReader positioned at the relay data.
- Returns:
A new SingleHostAddrRelay deserialized from the CBOR data.
- Raises:
CardanoError – If deserialization fails.
- Return type:
- 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.
- 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