cardano/value
This module contains code that aids in various value manipulations and comparisons.
Functions
Creates a Value type from a list of tokens.
value.from_tokens(redeemer.tokens)
Multiply some value by n
. This is just a linear scaling to the quantity
of each token.
value.multiply(bundle_value, bundle_size)
Prove that the target value is contained inside another assets. Each token inside the target must exist inside the total assets. The quantity of each token must be at least the target amount or greater.
value.contains(total_value, target_value)
Compute the sha3_256 hash of a value by merklizing the policy id, asset name, and quantity. Empty values return the empty by string.
value.compute_hash(validating_value)
unique_token_name(
txid: TransactionId,
idx: Int,
prefix: ByteArray,
personal: ByteArray,
) -> AssetName
Calculate a unique token name from a TxId#Idx
and prefix. Can be combined
with the find
module to create unique token names from the first input
utxo inside the transaction.
value.unique_token_name(tx_id, tx_idx, cip68.prefix_333, personal_tag)
Proves that inside some value there is a policy id with a single token name that has a quantity of 1. This will show that a value contains an NFT or something that is nft-like. Should be useful to prove that something is holding a token inside a transaction when the token name is assumed to be unique.
value.prove_nft(this_value, pid)
Proves that inside some value there is a policy id with token name that has a quantity of 1. This will show that a value contains an NFT or something that is nft-like. Should be useful to prove that something is holding a token inside a transaction when the policy id and token name is known.
value.prove_exact_nft(that_value, pid, tkn)