RewardAddressList
- class cometa.common.reward_address_list.RewardAddressList(ptr=None)[source]
Bases:
Sequence[RewardAddress]Represents a list of reward addresses.
Reward addresses are used to distribute staking rewards in the Cardano proof-of-stake protocol.
Example
>>> from cometa import RewardAddressList, RewardAddress >>> addr_list = RewardAddressList() >>> addr_list.add(RewardAddress.from_bech32("stake_test1...")) >>> len(addr_list) 1
- __iter__()[source]
Iterates over all reward addresses in the list.
- Return type:
Iterator[‘RewardAddress’]
- __getitem__(index)[source]
Gets a reward address by index using bracket notation.
- Parameters:
index (int)
- Return type:
- classmethod from_list(addresses)[source]
Creates a RewardAddressList from a Python list of RewardAddress objects.
- Parameters:
addresses (list[RewardAddress]) – A list of RewardAddress objects.
- Returns:
A new RewardAddressList containing all the addresses.
- Raises:
CardanoError – If creation fails.
- Return type:
- add(address)[source]
Adds a reward address to the end of the list.
- Parameters:
address (RewardAddress) – The RewardAddress to add.
- Raises:
CardanoError – If addition fails.
- Return type:
None
- get(index)[source]
Retrieves a reward address at the specified index.
- Parameters:
index (int) – The index of the address to retrieve.
- Returns:
The RewardAddress at the specified index.
- Raises:
CardanoError – If retrieval fails.
IndexError – If index is out of bounds.
- Return type:
- append(address)[source]
Appends a reward address to the list.
This is an alias for add() to match Python list semantics.
- Parameters:
address (RewardAddress) – The RewardAddress to append.
- Return type:
None
- index(value, start=0, stop=None)[source]
Returns the index of the first occurrence of value.
- Parameters:
value (RewardAddress) – The value to search for.
start (int) – Start searching from this index.
stop (Optional[int]) – Stop searching at this index.
- Returns:
The index of the first occurrence.
- Raises:
ValueError – If the value is not found.
- Return type:
int
- count(value)[source]
Returns the number of occurrences of value.
- Parameters:
value (RewardAddress) – The value to count.
- Returns:
The number of occurrences.
- Return type:
int