Relay
- class cometa.pool_params.relay.Relay(ptr)[source]
Bases:
objectRepresents a generic relay for Cardano stake pools.
A relay is a type of node that acts as an intermediary between core nodes (which produce blocks) and the wider internet. They help in passing along transactions and blocks, ensuring that data is propagated throughout the network.
This class wraps the three specific relay types: - SingleHostAddrRelay: Connects via IPv4/IPv6 address and port - SingleHostNameRelay: Connects via DNS name and port - MultiHostNameRelay: Connects via DNS SRV record
- classmethod from_single_host_addr(relay)[source]
Creates a Relay from a SingleHostAddrRelay.
- Parameters:
relay (SingleHostAddrRelay) – The single host address relay.
- Returns:
A new Relay wrapping the single host address relay.
- Raises:
CardanoError – If creation fails.
- Return type:
- classmethod from_single_host_name(relay)[source]
Creates a Relay from a SingleHostNameRelay.
- Parameters:
relay (SingleHostNameRelay) – The single host name relay.
- Returns:
A new Relay wrapping the single host name relay.
- Raises:
CardanoError – If creation fails.
- Return type:
- classmethod from_multi_host_name(relay)[source]
Creates a Relay from a MultiHostNameRelay.
- Parameters:
relay (MultiHostNameRelay) – The multi-host name relay.
- Returns:
A new Relay wrapping the multi-host name relay.
- Raises:
CardanoError – If creation fails.
- Return type:
- classmethod from_cbor(reader)[source]
Deserializes a Relay from CBOR data.
- Parameters:
reader (CborReader) – A CborReader positioned at the relay data.
- Returns:
A new Relay 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
- to_single_host_addr()[source]
Converts this relay to a SingleHostAddrRelay.
- Returns:
The underlying SingleHostAddrRelay.
- Raises:
CardanoError – If this relay is not a single host address relay.
- Return type:
- to_single_host_name()[source]
Converts this relay to a SingleHostNameRelay.
- Returns:
The underlying SingleHostNameRelay.
- Raises:
CardanoError – If this relay is not a single host name relay.
- Return type:
- to_multi_host_name()[source]
Converts this relay to a MultiHostNameRelay.
- Returns:
The underlying MultiHostNameRelay.
- Raises:
CardanoError – If this relay is not a multi-host name relay.
- Return type:
- 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