Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- pgetContinuingOutputs :: Term s (PBuiltinList PTxInInfo :--> (PBuiltinList PTxOut :--> (PTxOutRef :--> PBuiltinList PTxOut)))
- pfindOwnInput :: Term s (PBuiltinList PTxInInfo :--> (PTxOutRef :--> PMaybe PTxInInfo))
- pparseDatum :: forall a s. PTryFrom PData (PAsData a) => Term s (PDatumHash :--> (PBuiltinList (PAsData (PTuple PDatumHash PDatum)) :--> PMaybe (PAsData a)))
Documentation
pgetContinuingOutputs :: Term s (PBuiltinList PTxInInfo :--> (PBuiltinList PTxOut :--> (PTxOutRef :--> PBuiltinList PTxOut))) Source #
Find the output txns corresponding to the input being validated.
Takes as arguments the inputs, outputs and the spending transaction referenced
from PScriptPurpose
.
Example:
ctx <- tcont $ pletFields["txInfo", "purpose"] sc pmatchC (getField
"purpose" ctx) >>= case PSpending outRef' -> do let outRef = pfield"_0" # outRef' inputs = pfield
"inputs" # (getField"txInfo" ctx) outputs = pfield
"outputs" # (getField @"txInfo" ctx) pure $ pgetContinuingOutputs # inputs # outputs # outRef _ -> pure $ ptraceError "not a spending tx"
pfindOwnInput :: Term s (PBuiltinList PTxInInfo :--> (PTxOutRef :--> PMaybe PTxInInfo)) Source #
Find the input being spent in the current transaction.
Takes as arguments the inputs, as well as the spending transaction referenced from PScriptPurpose
.
Example:
ctx <- tcont $ pletFields["txInfo", "purpose"] sc pmatchC (getField
"purpose" ctx) >>= case PSpending outRef' -> do let outRef = pfield"_0" # outRef' inputs = pfield
"inputs" # (getField @"txInfo" ctx) pure $ pfindOwnInput # inputs # outRef _ -> pure $ ptraceError "not a spending tx"
pparseDatum :: forall a s. PTryFrom PData (PAsData a) => Term s (PDatumHash :--> (PBuiltinList (PAsData (PTuple PDatumHash PDatum)) :--> PMaybe (PAsData a))) Source #
Lookup up the datum given the datum hash.
Takes as argument the datum assoc list from a PTxInfo
. Validates the datum
using PTryFrom
.
Example:
pparseDatum MyType # datumHash #$ pfield
"datums" # txinfo