cardano/tx

This module incorporates additional code that expands the functionality of the standard library.

Functions

output_reference(tx_id_hash: ByteArray, idx: Int) -> OutputReference

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_signature(
  vks: List<VerificationKeyHash>,
  vk: VerificationKeyHash,
) -> Bool

Check if the list of signatures inside a transaction contains the verification key.

tx.verify_signature(context.transaction, wallet_pkh)

verify_multisig(
  sigs: List<VerificationKeyHash>,
  vks: List<VerificationKeyHash>,
  minimum: Int,
) -> Bool

This counts the number of signatures inside a transaction that are from the list of signers then checks if its at least the minimum amount.

tx.verify_multisig(context.transaction, lst_of_sigs, sig_threshold)

is_spending_input(inputs: List<Input>, out_ref: OutputReference) -> Bool

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.

tx.is_spending_input(tx.inputs, output_reference)

not_being_spent_from(
  validator_hashes: List<ScriptHash>,
  inputs: List<Input>,
) -> Bool

Given a set of validator hashes prove that none of them are being spent. Assume every address is not staked and that the is list is complete.

tx.not_being_spent_from(not_these_vkhs, tx.inputs)

total_token_amount(
  inputs: List<Input>,
  pid: PolicyId,
  tkn: AssetName,
  threshold: Int,
) -> Bool

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)
Search Document