BaseAddress
- class cometa.address.base_address.BaseAddress(ptr)[source]
Bases:
objectRepresents a Cardano base address.
Base addresses contain both a payment credential and a stake credential, making them the most common address type for receiving funds and staking.
The payment credential controls spending, while the stake credential determines where staking rewards are directed.
- classmethod from_credentials(network_id, payment, stake)[source]
Creates a base address from payment and stake credentials.
- Parameters:
network_id (NetworkId) – The network (mainnet or testnet).
payment (Credential) – The payment credential controlling spending.
stake (Credential) – The stake credential controlling staking rewards.
- Returns:
A new BaseAddress instance.
- Raises:
CardanoError – If address creation fails.
- Return type:
Example
>>> payment = Credential.from_key_hash("00" * 28) >>> stake = Credential.from_key_hash("11" * 28) >>> addr = BaseAddress.from_credentials(NetworkId.MAINNET, payment, stake)
- classmethod from_address(address)[source]
Creates a BaseAddress from a generic Address.
- Parameters:
address (Address) – A generic Address that must be a base address.
- Returns:
A new BaseAddress instance.
- Raises:
CardanoError – If the address is not a base address.
- Return type:
- classmethod from_bech32(bech32_string)[source]
Creates a BaseAddress from a Bech32-encoded string.
- Parameters:
bech32_string (str) – The Bech32-encoded address string.
- Returns:
A new BaseAddress instance.
- Raises:
CardanoError – If parsing fails.
- Return type:
Example
>>> addr = BaseAddress.from_bech32("addr1...")
- classmethod from_bytes(data)[source]
Creates a BaseAddress from raw bytes.
- Parameters:
data (bytes | bytearray) – The serialized address bytes.
- Returns:
A new BaseAddress instance.
- Raises:
CardanoError – If parsing fails.
- Return type:
- property payment_credential: Credential
Returns the payment credential.
- property stake_credential: Credential
Returns the stake credential.