MirToStakeCredsCert

class cometa.certificates.mir_to_stake_creds_cert.MirToStakeCredsCert(ptr)[source]

Bases: object

Represents a Move Instantaneous Reward (MIR) certificate for transferring funds to stake credentials.

This certificate is used to transfer rewards to a specified set of stake credentials from either the reserve or treasury pot.

__init__(ptr)[source]
Return type:

None

__enter__()[source]
Return type:

MirToStakeCredsCert

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

None

__repr__()[source]

Return repr(self).

Return type:

str

__len__()[source]

Returns the number of credential-to-amount mappings.

Return type:

int

__iter__()[source]

Iterates over credential-to-amount mappings.

Return type:

Iterator[Tuple[Credential, int]]

classmethod new(pot_type)[source]

Creates a new MIR to stake credentials certificate.

Parameters:

pot_type (MirCertPotType) – The accounting pot from which funds will be drawn.

Returns:

A new MirToStakeCredsCert instance.

Raises:

CardanoError – If creation fails.

Return type:

MirToStakeCredsCert

classmethod from_cbor(reader)[source]

Deserializes a MirToStakeCredsCert from CBOR data.

Parameters:

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

Returns:

A new MirToStakeCredsCert deserialized from the CBOR data.

Raises:

CardanoError – If deserialization fails.

Return type:

MirToStakeCredsCert

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 pot: MirCertPotType

The accounting pot from which funds are drawn.

Returns:

The MirCertPotType indicating the source pot.

insert(credential, amount)[source]

Inserts a credential-to-amount mapping.

Parameters:
  • credential (Credential) – The stake credential to receive the reward.

  • amount (int) – The amount of ADA (in lovelace) to transfer.

Raises:

CardanoError – If the insertion fails.

Return type:

None

get_key_at(index)[source]

Retrieves the credential at the specified index.

Parameters:

index (int) – The index of the credential to retrieve.

Returns:

The Credential at the specified index.

Raises:

CardanoError – If retrieval fails.

Return type:

Credential

get_value_at(index)[source]

Retrieves the amount at the specified index.

Parameters:

index (int) – The index of the amount to retrieve.

Returns:

The amount in lovelace.

Raises:

CardanoError – If retrieval fails.

Return type:

int

get_key_value_at(index)[source]

Retrieves both the credential and amount at the specified index.

Parameters:

index (int) – The index of the mapping to retrieve.

Returns:

A tuple of (Credential, amount).

Raises:

CardanoError – If retrieval fails.

Return type:

Tuple[Credential, int]

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