aiken_design_patterns/multi_utxo_indexer
Functions
withdraw_no_redeemer(
validation_logic: fn(Int, Input, Int, Output) -> Bool,
indices: Pairs<Int, Int>,
stake_cred: Credential,
tx: Transaction,
) -> Bool
Helper function to compelement your staking script. Note that this function
expects to see an equal number of inputs coming from addresses which their
payment parts are equal to its own (stake_cred
). This is an important
detail, as the validator needs to guarantee an exact number of inputs are
spent.
The validation function you should provide has access to:
- Index of the
Input
being validatin - The
Input
itself - Index of the
Output
being validation - The
Output
itself
withdraw_with_redeemer(
spend_redeemer_coercer_and_stake_credential_extractor: fn(Data) ->
(a, Credential),
validation_logic: fn(Int, Input, a, Int, Output) -> Bool,
indices: Pairs<Int, Int>,
stake_cred: Credential,
tx: Transaction,
) -> Bool
Another variant that is independent of the spending validator, and also
provides the validation logic with each UTxO’s redeemer. Subsequently, an
additional argument must be provided, capable of coercing a redeemer Data
to spending script’s redeemer, and also extracting the staking credential of
the script that performs the validation.
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.