cardano/addresses

This module incorporates code for generating valid wallet and script addresses, ensuring their correctness. Empty keys are treated as intentional, and address subtypes are not combined nor mixed. The key lengths must be valid as these functions will ignore invalid key keys when generating Address types.

Functions

from_wallet(wallet: Wallet) -> Address

Creates an address from the Wallet type. This should be used primairly for creating an address as the Wallet type has a is_valid function that should be used in the same validaiton.

let addr: Address = addresses.from_wallet(this_wallet)

create_address(pkh: VerificationKeyHash, sc: VerificationKeyHash) -> Address

Creates a enterprise or base address from the public key hash and stake address. An empty sc means enterpise address by default. This function assumes proper key lengths for pkh.Address types should be generated from the Wallet type so proper length checks are done with the wallet.is_valid function located in types/wallet.ak.

addresses.create_address(datum.wallet.pkh, datum.wallet.sc)

create_script_address(vkh: ScriptHash, sc: ScriptHash) -> Address

Creates a script address for a smart contract. The type does not mix address types. Staking credentials are assumed to be smart contracts. An empty stake credential or bad length stake credential is invalid and will be assumed to be not staked. This function assumes proper key lengths for vkh.

addresses.create_script_address(datum.script.vkh, datum.script.sc)
Search Document