Certificate
- class cometa.certificates.certificate.Certificate(cert_or_ptr)[source]
Bases:
objectRepresents a Cardano certificate.
Certificates are a means to encode various essential operations related to stake delegation and stake pool management. Certificates are embedded in transactions and included in blocks. They’re a vital aspect of Cardano’s proof-of-stake mechanism, ensuring that stakeholders can participate in the protocol and its governance.
The Certificate class can be constructed from any specific certificate type:
Example
>>> stake_reg = StakeRegistrationCert.new(credential) >>> cert = Certificate(stake_reg) # Automatic conversion >>> # Or explicitly: >>> cert = Certificate.from_cert(stake_reg)
- __init__(cert_or_ptr)[source]
Creates a Certificate from a raw pointer or a specific certificate type.
- Parameters:
cert_or_ptr – Either a raw FFI pointer or a specific certificate instance (e.g., StakeRegistrationCert, PoolRegistrationCert, etc.)
- Raises:
CardanoError – If creation fails.
TypeError – If the argument is not a valid certificate type.
- Return type:
None
- classmethod from_cert(cert)[source]
Creates a Certificate from any specific certificate type.
This is an explicit conversion method. You can also use the constructor directly: Certificate(specific_cert).
- Parameters:
cert (CertificateUnion) – A specific certificate instance (e.g., StakeRegistrationCert, PoolRegistrationCert, etc.)
- Returns:
A new Certificate wrapping the specific certificate.
- Raises:
TypeError – If the argument is not a valid certificate type.
- Return type:
Example
>>> stake_reg = StakeRegistrationCert.new(credential) >>> cert = Certificate.from_cert(stake_reg)
- classmethod new_auth_committee_hot(cert)[source]
Creates a Certificate from an AuthCommitteeHotCert.
- Parameters:
cert (AuthCommitteeHotCert)
- Return type:
- classmethod new_genesis_key_delegation(cert)[source]
Creates a Certificate from a GenesisKeyDelegationCert.
- Parameters:
cert (GenesisKeyDelegationCert)
- Return type:
- classmethod new_mir(cert)[source]
Creates a Certificate from a MirCert.
- Parameters:
cert (MirCert)
- Return type:
- classmethod new_pool_registration(cert)[source]
Creates a Certificate from a PoolRegistrationCert.
- Parameters:
cert (PoolRegistrationCert)
- Return type:
- classmethod new_pool_retirement(cert)[source]
Creates a Certificate from a PoolRetirementCert.
- Parameters:
cert (PoolRetirementCert)
- Return type:
- classmethod new_register_drep(cert)[source]
Creates a Certificate from a RegisterDRepCert.
- Parameters:
cert (RegisterDRepCert)
- Return type:
- classmethod new_registration(cert)[source]
Creates a Certificate from a RegistrationCert.
- Parameters:
cert (RegistrationCert)
- Return type:
- classmethod new_resign_committee_cold(cert)[source]
Creates a Certificate from a ResignCommitteeColdCert.
- Parameters:
cert (ResignCommitteeColdCert)
- Return type:
- classmethod new_stake_delegation(cert)[source]
Creates a Certificate from a StakeDelegationCert.
- Parameters:
cert (StakeDelegationCert)
- Return type:
- classmethod new_stake_deregistration(cert)[source]
Creates a Certificate from a StakeDeregistrationCert.
- Parameters:
cert (StakeDeregistrationCert)
- Return type:
- classmethod new_stake_registration(cert)[source]
Creates a Certificate from a StakeRegistrationCert.
- Parameters:
cert (StakeRegistrationCert)
- Return type:
- classmethod new_stake_registration_delegation(cert)[source]
Creates a Certificate from a StakeRegistrationDelegationCert.
- Parameters:
- Return type:
- classmethod new_stake_vote_delegation(cert)[source]
Creates a Certificate from a StakeVoteDelegationCert.
- Parameters:
cert (StakeVoteDelegationCert)
- Return type:
- classmethod new_stake_vote_registration_delegation(cert)[source]
Creates a Certificate from a StakeVoteRegistrationDelegationCert.
- Parameters:
- Return type:
- classmethod new_unregister_drep(cert)[source]
Creates a Certificate from an UnregisterDRepCert.
- Parameters:
cert (UnregisterDRepCert)
- Return type:
- classmethod new_unregistration(cert)[source]
Creates a Certificate from an UnregistrationCert.
- Parameters:
cert (UnregistrationCert)
- Return type:
- classmethod new_update_drep(cert)[source]
Creates a Certificate from an UpdateDRepCert.
- Parameters:
cert (UpdateDRepCert)
- Return type:
- classmethod new_vote_delegation(cert)[source]
Creates a Certificate from a VoteDelegationCert.
- Parameters:
cert (VoteDelegationCert)
- Return type:
- classmethod new_vote_registration_delegation(cert)[source]
Creates a Certificate from a VoteRegistrationDelegationCert.
- Parameters:
- Return type:
- classmethod from_cbor(reader)[source]
Deserializes a Certificate from CBOR data.
- Parameters:
reader (CborReader) – A CborReader positioned at the certificate data.
- Returns:
A new Certificate deserialized from the CBOR data.
- Raises:
CardanoError – If deserialization fails.
- Return type:
- to_cbor(writer)[source]
Serializes the certificate to CBOR format.
- Parameters:
writer (CborWriter) – A CborWriter to write the serialized data to.
- Raises:
CardanoError – If serialization fails.
- Return type:
None
- property cert_type: CertificateType
The type of this certificate.
- Returns:
The CertificateType indicating the specific certificate type.
- to_stake_registration_delegation()[source]
Extracts the underlying StakeRegistrationDelegationCert.
- Return type:
- to_stake_vote_registration_delegation()[source]
Extracts the underlying StakeVoteRegistrationDelegationCert.
- Return type:
- to_vote_registration_delegation()[source]
Extracts the underlying VoteRegistrationDelegationCert.
- Return type:
- to_cip116_json(writer)[source]
Serializes this certificate to CIP-116 compliant JSON.
- Parameters:
writer (JsonWriter) – The JsonWriter to write the JSON to.
- Raises:
CardanoError – If serialization fails.
- Return type:
None