aiken_design_patterns/multi_utxo_indexer_one_to_many
Functions
withdraw_no_redeemer(
input_output_validator: fn(Int, Input, Int, Output) -> Bool,
input_collective_outputs_validator: fn(Int, Input, List<Output>) -> Bool,
collective_inputs_outputs_validator: fn(List<Input>, List<Output>) -> Bool,
outer_indices: Pairs<Int, List<Int>>,
total_input_count: Int,
stake_cred: Credential,
tx: Transaction,
) -> Bool
Use this function inside your withdrawal script to validate all the inputs coming from the script’s spend endpoint. This is an important detail, as the validator needs to guarantee an exact number of inputs are spent.
If you want to work with an external staking script, consider
using withdraw_with_redeemer
.
The arguments are:
- Validation function on each input, and each of its corresponding outputs
- Validation function on each input, against all its outputs
- Validation function on all the inputs and all the outputs
Pairs
of indices, mapping each input to multiple outputs- Total number of inputs
- Staking credential of the wrapping validator (provided by
withdraw
). Note that in this variant, it can only validate spending the UTxOs from its own spending endpoint Transaction
provided by the validator
For validation functions, corresponding indices of inputs/outputs are also provided in these functions.
withdraw_with_redeemer(
spend_redeemer_coercer_and_stake_credential_extractor: fn(Redeemer) ->
(a, Credential),
input_output_validator: fn(Int, Input, a, Int, Output) -> Bool,
input_collective_outputs_validator: fn(Int, Input, a, List<Output>) -> Bool,
collective_inputs_outputs_validator: fn(List<Input>, List<Output>) -> Bool,
indices: Pairs<Int, List<Int>>,
total_script_inputs: Int,
stake_cred: Credential,
tx: Transaction,
) -> Bool
A variant of withdraw_no_redeemer
. The difference
here is that it gives access to the spend redeemers to your validation
functions.
Note that your spend redeemers are expected to carry the Credential
to the
resulting staking script (which is the purpose of the first argument).
The arguments are:
- Validation function on each input, and each of its corresponding outputs
- Validation function on each input, against all its outputs
- Validation function on all the inputs and all the outputs
Pairs
of indices, mapping each input to multiple outputs- Total number of script inputs
- Staking credential of the wrapping validator (provided by
withdraw
) Transaction
provided by the validator
For validation functions, corresponding indices of inputs/outputs are also provided in these functions.
Under the hood, one other difference is that here, instead of traversing all
the inputs, there are two traversals: one over the redeemers
, and another
over the indices.