RewardAddress

class cometa.address.reward_address.RewardAddress(ptr)[source]

Bases: object

Represents a Cardano reward address.

Reward addresses are used to distribute rewards for participating in the proof-of-stake protocol, either directly or via delegation. They contain only a stake credential and are used exclusively for receiving staking rewards.

__init__(ptr)[source]
Return type:

None

__enter__()[source]
Return type:

RewardAddress

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

None

__repr__()[source]

Return repr(self).

Return type:

str

classmethod from_credentials(network_id, credential)[source]

Creates a reward address from a stake credential.

Parameters:
  • network_id (NetworkId) – The network (mainnet or testnet).

  • credential (Credential) – The stake credential controlling reward distribution.

Returns:

A new RewardAddress instance.

Raises:

CardanoError – If address creation fails.

Return type:

RewardAddress

Example

>>> stake = Credential.from_key_hash("00" * 28)
>>> addr = RewardAddress.from_credentials(NetworkId.MAINNET, stake)
classmethod from_address(address)[source]

Creates a RewardAddress from a generic Address.

Parameters:

address (Address) – A generic Address that must be a reward address.

Returns:

A new RewardAddress instance.

Raises:

CardanoError – If the address is not a reward address.

Return type:

RewardAddress

classmethod from_bech32(bech32_string)[source]

Creates a RewardAddress from a Bech32-encoded string.

Parameters:

bech32_string (str) – The Bech32-encoded address string (e.g., “stake1…”).

Returns:

A new RewardAddress instance.

Raises:

CardanoError – If parsing fails.

Return type:

RewardAddress

classmethod from_bytes(data)[source]

Creates a RewardAddress from raw bytes.

Parameters:

data (bytes | bytearray) – The serialized address bytes.

Returns:

A new RewardAddress instance.

Raises:

CardanoError – If parsing fails.

Return type:

RewardAddress

property credential: Credential

Returns the stake credential.

property network_id: NetworkId

Returns the network ID.

to_address()[source]

Converts this RewardAddress to a generic Address.

Returns:

A generic Address instance.

Return type:

Address

to_bytes()[source]

Returns the serialized byte representation.

Return type:

bytes

to_bech32()[source]

Returns the Bech32-encoded string representation.

Return type:

str

__str__()[source]

Returns the Bech32 string representation.

Return type:

str

__bytes__()[source]

Returns the serialized bytes.

Return type:

bytes

__hash__()[source]

Returns a Python hash for use in sets and dicts.

Return type:

int

__eq__(other)[source]

Checks equality with another RewardAddress.

Parameters:

other (object)

Return type:

bool