PoolMetadata
- class cometa.pool_params.pool_metadata.PoolMetadata(ptr)[source]
Bases:
objectRepresents pool metadata for a Cardano stake pool.
Pool metadata includes a URL pointing to a JSON file containing pool information and a Blake2b-256 hash of that file for integrity verification.
- classmethod new(url, metadata_hash)[source]
Creates a new pool metadata object.
- Parameters:
url (str) – The URL pointing to the pool metadata JSON file.
metadata_hash (Blake2bHash) – The Blake2b-256 hash of the metadata file.
- Returns:
A new PoolMetadata instance.
- Raises:
CardanoError – If creation fails.
- Return type:
Example
>>> hash = Blake2bHash.from_hex("00" * 32) >>> metadata = PoolMetadata.new("https://example.com/pool.json", hash)
- classmethod from_hash_hex(url, hash_hex)[source]
Creates a new pool metadata object from a URL and hex-encoded hash.
- Parameters:
url (str) – The URL pointing to the pool metadata JSON file.
hash_hex (str) – The Blake2b-256 hash as a hexadecimal string.
- Returns:
A new PoolMetadata instance.
- Raises:
CardanoError – If creation fails.
- Return type:
Example
>>> metadata = PoolMetadata.from_hash_hex( ... "https://example.com/pool.json", ... "00" * 32 ... )
- classmethod from_cbor(reader)[source]
Deserializes a PoolMetadata from CBOR data.
- Parameters:
reader (CborReader) – A CborReader positioned at the pool metadata data.
- Returns:
A new PoolMetadata deserialized from the CBOR data.
- Raises:
CardanoError – If deserialization fails.
- Return type:
- to_cbor(writer)[source]
Serializes the pool metadata to CBOR format.
- Parameters:
writer (CborWriter) – A CborWriter to write the serialized data to.
- Raises:
CardanoError – If serialization fails.
- Return type:
None
- property url: str
Returns the metadata URL.
- property hash: Blake2bHash
Returns the metadata hash.
- to_cip116_json(writer)[source]
Serializes this pool metadata to CIP-116 compliant JSON.
- Parameters:
writer (JsonWriter) – The JsonWriter to write the JSON to.
- Raises:
CardanoError – If serialization fails.
- Return type:
None