stdlib icon indicating copy to clipboard operation
stdlib copied to clipboard

More transaction related helper functions

Open KristianBalaj opened this issue 2 years ago • 3 comments

Currently there are just 3 helper functions in the aiken/transaction module (i.e. find_script_outputs, find_datum, find_input).

I'm proposing to add further helper function inspired by PlutusTx:

  • [ ] findOwnInput - https://input-output-hk.github.io/plutus/master/plutus-ledger-api/html/PlutusLedgerApi-V2-Contexts.html#v:findOwnInput - Resolves https://github.com/aiken-lang/stdlib/pull/44
  • [ ] getContinuingOutputs - https://input-output-hk.github.io/plutus/master/plutus-ledger-api/html/PlutusLedgerApi-V2-Contexts.html#v:getContinuingOutputs
  • [ ] txSignedBy - https://input-output-hk.github.io/plutus/master/plutus-ledger-api/html/PlutusLedgerApi-V2-Contexts.html#v:txSignedBy
  • [ ] checkOwnOutput - check whether there's an output with expected datum and value going to the same script as currently being validated

I will be adding further items to this list but at least these for now. I will be also adding PRs for those functions over time.

KristianBalaj avatar Jun 02 '23 10:06 KristianBalaj

Something to consider perhaps

https://github.com/aiken-lang/stdlib/issues/45

rvcas avatar Jun 02 '23 14:06 rvcas

I suggest that

txSignedBy :: [TxInfo] -> [PubKeyHash] -> [Bool]

is instead

signedByAll :: [PubKeyHash] -> [PubKeyHash] -> [Bool]

or some other variant. Once there are type classes etc. it can be an alias for list subset.

micahkendall avatar Jun 08 '23 06:06 micahkendall

I don't like getContinuingOutputs/checkOwnOutput as they seem to be unnecessarily limiting in many cases, or encourage bad habits. Maybe we should have a compatibility library for all these ideas, and encourage datum/nft tagging etc. as alternatives.

micahkendall avatar Jun 08 '23 06:06 micahkendall

Closing this as we've been adding helper functions every now and then, feel free to provide suggestions via PR or bring them forth on Discord.

KtorZ avatar Sep 20 '24 13:09 KtorZ