cometa-0.1.0.0: Idiomatic Haskell bindings to cardano-c
Safe HaskellSafe-Inferred
LanguageHaskell2010

Cometa.SubTransaction.Indices

Description

Locate objects in a subtransaction for deferred redeemers and script arguments. Indices start at zero and can change when the body changes. Missing objects return Nothing. Nested levels remain independent.

import qualified Cometa.SubTransaction.Indices as Indices

spendingPosition reference transaction = Indices.findInput reference transaction
Synopsis

Documentation

findInput :: Input -> SubTransaction -> Maybe Word64 Source #

First spending reference in hash-byte then numeric-index order. Duplicates occupy separate positions.

findReferenceInput :: Input -> SubTransaction -> Maybe Word64 Source #

First reference input in the same order as findInput.

findOutput :: Address -> Word64 -> SubTransaction -> Maybe Word64 Source #

First output at the exact address containing at least the minimum lovelace. Output creation order is retained; the minimum spans unsigned 64-bit values.

findMintPolicy :: PolicyId -> SubTransaction -> Maybe Word64 Source #

Policy position in ascending hash-byte order. Imported policies with only zero quantities or an empty asset map still occupy positions.

findWithdrawal :: RewardAddress -> SubTransaction -> Maybe Word64 Source #

Withdrawal position in ledger reward-account order: test networks before mainnet, then script credentials before key credentials, then hash bytes. All network tags other than 1 belong to the same test-network class.

findCertificate :: EncodedCertificate -> SubTransaction -> IO (Either Error (Maybe Word64)) Source #

First certificate with the same native canonical encoding. Certificate list order and duplicates count. Imported representation differences are normalized by the native certificate codecs; no transaction bytes change.

findVote :: Voter -> SubTransaction -> Maybe Word64 Source #

Voter position in ledger role order: committee, DRep, stake pool. Within each role script credentials precede key credentials, then hash bytes order each kind. Multiple action votes by one voter occupy a single position.

findProposal :: Proposal -> SubTransaction -> Maybe Word64 Source #

First proposal with the same canonical encoding, including its deposit, return account and anchor. Positions follow proposal insertion order, counting actions without scripts. A proposing redeemer uses this same position.

findRedeemer :: RedeemerId -> SubTransaction -> Maybe Word64 Source #

Redeemer rank ordered by purpose then purpose index, independently of its imported witness collection order. This is its position among all redeemers, rather than its position in the body collection authorized by the script.