PointerAddress

class cometa.address.pointer_address.PointerAddress(ptr)[source]

Bases: object

Represents a Cardano pointer address.

Pointer addresses indirectly specify the stake key that should control staking for the address. Instead of embedding a stake key directly, they reference a stake key by pointing to a stake key registration certificate location on the blockchain.

__init__(ptr)[source]
Return type:

None

__enter__()[source]
Return type:

PointerAddress

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

None

__repr__()[source]

Return repr(self).

Return type:

str

classmethod from_credentials(network_id, payment, pointer)[source]

Creates a pointer address from a payment credential and stake pointer.

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

  • payment (Credential) – The payment credential controlling spending.

  • pointer (StakePointer) – The stake pointer referencing a stake key registration.

Returns:

A new PointerAddress instance.

Raises:

CardanoError – If address creation fails.

Return type:

PointerAddress

Example

>>> payment = Credential.from_key_hash("00" * 28)
>>> pointer = StakePointer(slot=5756214, tx_index=1, cert_index=0)
>>> addr = PointerAddress.from_credentials(NetworkId.MAINNET, payment, pointer)
classmethod from_address(address)[source]

Creates a PointerAddress from a generic Address.

Parameters:

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

Returns:

A new PointerAddress instance.

Raises:

CardanoError – If the address is not a pointer address.

Return type:

PointerAddress

classmethod from_bech32(bech32_string)[source]

Creates a PointerAddress from a Bech32-encoded string.

Parameters:

bech32_string (str) – The Bech32-encoded address string.

Returns:

A new PointerAddress instance.

Raises:

CardanoError – If parsing fails.

Return type:

PointerAddress

classmethod from_bytes(data)[source]

Creates a PointerAddress from raw bytes.

Parameters:

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

Returns:

A new PointerAddress instance.

Raises:

CardanoError – If parsing fails.

Return type:

PointerAddress

property payment_credential: Credential

Returns the payment credential.

property stake_pointer: StakePointer

Returns the stake pointer.

property network_id: NetworkId

Returns the network ID.

to_address()[source]

Converts this PointerAddress 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 PointerAddress.

Parameters:

other (object)

Return type:

bool