module Hydra.Tx.BlueprintTx where

import Hydra.Tx.IsTx (IsTx, UTxOType, txSpendingUTxO)

-- | _Blueprint/Draft_ transaction paired with the 'UTxO' which resolves it's inputs.
-- The transaction inputs are committed to a `Head` and the 'lookupUTxO' is expected
-- to contain these inputs.
data CommitBlueprintTx tx = CommitBlueprintTx {forall tx. CommitBlueprintTx tx -> UTxOType tx
lookupUTxO :: UTxOType tx, forall tx. CommitBlueprintTx tx -> tx
blueprintTx :: tx}

mkSimpleBlueprintTx :: IsTx tx => UTxOType tx -> CommitBlueprintTx tx
mkSimpleBlueprintTx :: forall tx. IsTx tx => UTxOType tx -> CommitBlueprintTx tx
mkSimpleBlueprintTx UTxOType tx
utxo =
  CommitBlueprintTx
    { lookupUTxO :: UTxOType tx
lookupUTxO = UTxOType tx
utxo
    , $sel:blueprintTx:CommitBlueprintTx :: tx
blueprintTx = UTxOType tx -> tx
forall tx. IsTx tx => UTxOType tx -> tx
txSpendingUTxO UTxOType tx
utxo
    }