cardano/tx
This module incorporates additional code that expands the functionality of the standard library.
To check for a single signature, use stdlib’s
list.has(tx.extra_signatories, vkh).
Functions
Create an OutputReference from the TxId#Idx information. This is useful
for building correct output references of specific UTxOs. It can be combined
with the find module for some very convenient requests.
tx.output_reference(that_tx_id, that_tx_idx)
verify_multisig(
sigs: List<VerificationKeyHash>,
vks: List<VerificationKeyHash>,
minimum: Int,
) -> Bool
This counts how many of the verification keys in vks have signed the
transaction, then checks that the count is at least minimum.
Each element of
vksis counted separately, so a key listed twice counts twice. Ifvkscan be influenced by a user, deduplicate it first (e.g.list.unique). Aminimumof zero or less is always satisfied.
tx.verify_multisig(tx.extra_signatories, datum.signers, datum.threshold)
Check if a specific input by output reference is being spent. This is useful when a minting script requires a utxo to be spent but doesn’t need any specific information about that input. Returns True or fails.
tx.is_spending_input(tx.inputs, output_reference)
Given a set of validator hashes prove that none of them are being spent. An input counts as being spent from a validator when its payment credential is that script, regardless of its stake credential.
tx.not_being_spent_from(not_these_vkhs, tx.inputs)
Calculate the total amount of a token within the set of inputs for the transaction and check if it is at least equal to the provided threshold.
tx.total_token_amount(tx.inputs, datum.pid, datum.tkn, datum.threshold)