assist/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 validated on their own as these functions are used to just generate Address types assuming valid key lengths.

Functions

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

Creates a enterprise or base address from the public key hash and stake credential. An empty sc means enterpise address by default. This function assumes proper key lengths for pkh and sc. Again, this function does not check if the stake credential has a proper length. Address types should be generated from the Wallet type so proper length checks are done with the wallet.is_valid function.

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

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

Creates a script address for a smart contract. The type does not mix address types. Staked smart contracts are contracts as well. An empty sc is assumed to be not staked. This function assumes proper key lengths for vkh and sc. Again, this function does not check if the stake credential has a proper length. Address types should be generated from the Wallet type so proper length checks are done with the wallet.is_valid function.

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

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 = types.from_wallet(this_wallet)
Search Document