assist/values

This module contains code that aids in various value manipulations and comparisons.

Functions

compute_hash(target: Value) -> ByteArray

Compute the sha3_256 hash of a value by merklizing the policy id, asset name, and quantity. Empty values return the empty by string.

values.compute_hash(validating_value)

contains(target: Value, total: Value) -> Bool

Prove that the target value is contained inside another value. Each token inside the target must exist inside the total value. The quantity of each token must be at least the target amount or greater.

values.contains(payment_value, output_value)

from_token(token: Token) -> Value

Creates a Value type from a token.

values.from_token(this_token)

from_tokens(tokens: Tokens) -> Value

Creates a Value type from a list of tokens.

values.from_tokens(redeemer.tokens)

multiply(val: Value, n: Int) -> Value

Multiply some value by n. This is just a linear scaling to the quantity of each token.

values.multiply(bundle_value, bundle_size)

prove_exact_nft(
  nft_pid: PolicyId,
  nft_tkn: AssetName,
  total_value: Value,
) -> Bool

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.

values.prove_exact_nft(pid, tkn, that_value)

prove_nft(pid: PolicyId, total: Value) -> Bool

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.

values.prove_nft(pid, this_value)

unique_token_name(txid: TxHash, idx: Int, prefix: 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.

values.unique_token_name(tx_id, tx_idx, prefixes.prefix_333)
Search Document