{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE UndecidableInstances #-}
{-# OPTIONS_GHC -Wno-orphans #-}

module Plutarch.Api.V1.Tx (
  PTxOutRef (PTxOutRef),
  PTxOut (PTxOut),
  PTxId (PTxId),
  PTxInInfo (PTxInInfo),
) where

import PlutusLedgerApi.V1 qualified as Plutus

import Data.Bifunctor (first)
import Plutarch.Api.V1.Address (PAddress)
import Plutarch.Api.V1.Maybe (PMaybeData)
import Plutarch.Api.V1.Scripts (PDatumHash)
import Plutarch.Api.V1.Value (
  AmountGuarantees (Positive),
  KeyGuarantees (Sorted),
  PValue,
 )
import Plutarch.Builtin (pasConstr)
import Plutarch.DataRepr (
  DerivePConstantViaData (DerivePConstantViaData),
  PDataFields,
 )
import Plutarch.Lift (
  PConstantDecl,
  PLifted,
  PUnsafeLiftDecl,
 )
import Plutarch.Prelude
import Plutarch.TryFrom (PTryFrom (PTryFromExcess, ptryFrom'))
import Plutarch.Unsafe (punsafeCoerce)

newtype Flip f a b = Flip (f b a) deriving stock (forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall k k (f :: k -> k -> Type) (a :: k) (b :: k) x.
Rep (Flip @k @k f a b) x -> Flip @k @k f a b
forall k k (f :: k -> k -> Type) (a :: k) (b :: k) x.
Flip @k @k f a b -> Rep (Flip @k @k f a b) x
$cto :: forall k k (f :: k -> k -> Type) (a :: k) (b :: k) x.
Rep (Flip @k @k f a b) x -> Flip @k @k f a b
$cfrom :: forall k k (f :: k -> k -> Type) (a :: k) (b :: k) x.
Flip @k @k f a b -> Rep (Flip @k @k f a b) x
Generic)

newtype PTxId (s :: S)
  = PTxId (Term s (PDataRecord '["_0" ':= PByteString]))
  deriving stock (forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall (s :: S) x. Rep (PTxId s) x -> PTxId s
forall (s :: S) x. PTxId s -> Rep (PTxId s) x
$cto :: forall (s :: S) x. Rep (PTxId s) x -> PTxId s
$cfrom :: forall (s :: S) x. PTxId s -> Rep (PTxId s) x
Generic)
  deriving anyclass (forall (s :: S). PTxId s -> Term s (PInner PTxId)
forall (s :: S) (b :: PType).
Term s (PInner PTxId) -> (PTxId s -> Term s b) -> Term s b
forall (a :: PType).
(forall (s :: S). a s -> Term s (PInner a))
-> (forall (s :: S) (b :: PType).
    Term s (PInner a) -> (a s -> Term s b) -> Term s b)
-> PlutusType a
pmatch' :: forall (s :: S) (b :: PType).
Term s (PInner PTxId) -> (PTxId s -> Term s b) -> Term s b
$cpmatch' :: forall (s :: S) (b :: PType).
Term s (PInner PTxId) -> (PTxId s -> Term s b) -> Term s b
pcon' :: forall (s :: S). PTxId s -> Term s (PInner PTxId)
$cpcon' :: forall (s :: S). PTxId s -> Term s (PInner PTxId)
PlutusType, forall (s :: S). Term s (PAsData PTxId) -> Term s PTxId
forall (s :: S). Term s PTxId -> Term s PData
forall (a :: PType).
(forall (s :: S). Term s (PAsData a) -> Term s a)
-> (forall (s :: S). Term s a -> Term s PData) -> PIsData a
pdataImpl :: forall (s :: S). Term s PTxId -> Term s PData
$cpdataImpl :: forall (s :: S). Term s PTxId -> Term s PData
pfromDataImpl :: forall (s :: S). Term s (PAsData PTxId) -> Term s PTxId
$cpfromDataImpl :: forall (s :: S). Term s (PAsData PTxId) -> Term s PTxId
PIsData, forall (s :: S).
Term s PTxId -> Term s (PDataRecord (PFields PTxId))
forall (a :: PType).
(forall (s :: S). Term s a -> Term s (PDataRecord (PFields a)))
-> PDataFields a
ptoFields :: forall (s :: S).
Term s PTxId -> Term s (PDataRecord (PFields PTxId))
$cptoFields :: forall (s :: S).
Term s PTxId -> Term s (PDataRecord (PFields PTxId))
PDataFields, forall (s :: S). Term s PTxId -> Term s PTxId -> Term s PBool
forall (t :: PType).
(forall (s :: S). Term s t -> Term s t -> Term s PBool) -> PEq t
#== :: forall (s :: S). Term s PTxId -> Term s PTxId -> Term s PBool
$c#== :: forall (s :: S). Term s PTxId -> Term s PTxId -> Term s PBool
PEq, PEq PTxId
forall (s :: S). Term s PTxId -> Term s PTxId -> Term s PBool
forall (t :: PType).
PEq t
-> (forall (s :: S). Term s t -> Term s t -> Term s PBool)
-> (forall (s :: S). Term s t -> Term s t -> Term s PBool)
-> PPartialOrd t
#< :: forall (s :: S). Term s PTxId -> Term s PTxId -> Term s PBool
$c#< :: forall (s :: S). Term s PTxId -> Term s PTxId -> Term s PBool
#<= :: forall (s :: S). Term s PTxId -> Term s PTxId -> Term s PBool
$c#<= :: forall (s :: S). Term s PTxId -> Term s PTxId -> Term s PBool
PPartialOrd, PPartialOrd PTxId
forall (t :: PType). PPartialOrd t -> POrd t
POrd, forall (s :: S). Bool -> Term s PTxId -> Term s PString
forall (t :: PType).
(forall (s :: S). Bool -> Term s t -> Term s PString) -> PShow t
pshow' :: forall (s :: S). Bool -> Term s PTxId -> Term s PString
$cpshow' :: forall (s :: S). Bool -> Term s PTxId -> Term s PString
PShow)
instance DerivePlutusType PTxId where type DPTStrat _ = PlutusTypeData

instance PUnsafeLiftDecl PTxId where type PLifted PTxId = Plutus.TxId
deriving via (DerivePConstantViaData Plutus.TxId PTxId) instance PConstantDecl Plutus.TxId

instance PTryFrom PData PTxId where
  type PTryFromExcess PData PTxId = Flip Term PByteString
  ptryFrom' :: forall (s :: S) (r :: PType).
Term s PData
-> ((Term s PTxId, Reduce (PTryFromExcess PData PTxId s))
    -> Term s r)
-> Term s r
ptryFrom' Term s PData
opq (Term s PTxId, Reduce (PTryFromExcess PData PTxId s)) -> Term s r
cont = forall (b :: PType) (a :: PType) (s :: S) (r :: PType).
PTryFrom a b =>
Term s a
-> ((Term s b, Reduce (PTryFromExcess a b s)) -> Term s r)
-> Term s r
ptryFrom @(PAsData PTxId) Term s PData
opq ((Term s PTxId, Reduce (PTryFromExcess PData PTxId s)) -> Term s r
cont forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (p :: Type -> Type -> Type) a b c.
Bifunctor p =>
(a -> b) -> p a c -> p b c
first forall (s :: S) (a :: PType) (b :: PType). Term s a -> Term s b
punsafeCoerce)

instance PTryFrom PData (PAsData PTxId) where
  type PTryFromExcess PData (PAsData PTxId) = Flip Term PByteString
  ptryFrom' :: forall (s :: S) (r :: PType).
Term s PData
-> ((Term s (PAsData PTxId),
     Reduce (PTryFromExcess PData (PAsData PTxId) s))
    -> Term s r)
-> Term s r
ptryFrom' Term s PData
opq = forall (r :: PType) (s :: S) a.
TermCont @r s a -> (a -> Term s r) -> Term s r
runTermCont forall a b. (a -> b) -> a -> b
$ do
    Term s (PBuiltinPair PInteger (PBuiltinList PData))
opq' <- forall a (s :: S) (r :: PType).
((a -> Term s r) -> Term s r) -> TermCont @r s a
tcont forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (s :: S) (a :: PType) (b :: PType).
Term s a -> (Term s a -> Term s b) -> Term s b
plet forall a b. (a -> b) -> a -> b
$ forall (s :: S).
Term s (PData :--> PBuiltinPair PInteger (PBuiltinList PData))
pasConstr forall (s :: S) (a :: PType) (b :: PType).
HasCallStack =>
Term s (a :--> b) -> Term s a -> Term s b
# Term s PData
opq
    forall a (s :: S) (r :: PType).
((a -> Term s r) -> Term s r) -> TermCont @r s a
tcont forall a b. (a -> b) -> a -> b
$ \() -> Term s r
f ->
      forall (s :: S) (a :: PType).
Term s PBool -> Term s a -> Term s a -> Term s a
pif (forall (s :: S) (a :: PType) (b :: PType).
Term s (PBuiltinPair a b :--> a)
pfstBuiltin forall (s :: S) (a :: PType) (b :: PType).
HasCallStack =>
Term s (a :--> b) -> Term s a -> Term s b
# Term s (PBuiltinPair PInteger (PBuiltinList PData))
opq' forall (t :: PType) (s :: S).
PEq t =>
Term s t -> Term s t -> Term s PBool
#== Term s PInteger
0) (() -> Term s r
f ()) forall a b. (a -> b) -> a -> b
$ forall (s :: S) (a :: PType). Term s PString -> Term s a
ptraceError Term s PString
"ptryFrom(TxId): invalid constructor id"
    Term s (PBuiltinList PData)
flds <- forall a (s :: S) (r :: PType).
((a -> Term s r) -> Term s r) -> TermCont @r s a
tcont forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (s :: S) (a :: PType) (b :: PType).
Term s a -> (Term s a -> Term s b) -> Term s b
plet forall a b. (a -> b) -> a -> b
$ forall (s :: S) (a :: PType) (b :: PType).
Term s (PBuiltinPair a b :--> b)
psndBuiltin forall (s :: S) (a :: PType) (b :: PType).
HasCallStack =>
Term s (a :--> b) -> Term s a -> Term s b
# Term s (PBuiltinPair PInteger (PBuiltinList PData))
opq'
    let dataBs :: Term s PData
dataBs = forall (list :: PType -> PType) (a :: PType) (s :: S).
(PListLike list, PElemConstraint list a) =>
Term s (list a :--> a)
phead forall (s :: S) (a :: PType) (b :: PType).
HasCallStack =>
Term s (a :--> b) -> Term s a -> Term s b
# Term s (PBuiltinList PData)
flds
    forall a (s :: S) (r :: PType).
((a -> Term s r) -> Term s r) -> TermCont @r s a
tcont forall a b. (a -> b) -> a -> b
$ \() -> Term s r
f ->
      forall (s :: S) (a :: PType).
Term s PBool -> Term s a -> Term s a -> Term s a
pif (forall (list :: PType -> PType) (a :: PType) (s :: S).
(PListLike list, PElemConstraint list a) =>
Term s (list a)
pnil forall (t :: PType) (s :: S).
PEq t =>
Term s t -> Term s t -> Term s PBool
#== forall (list :: PType -> PType) (a :: PType) (s :: S).
(PListLike list, PElemConstraint list a) =>
Term s (list a :--> list a)
ptail forall (s :: S) (a :: PType) (b :: PType).
HasCallStack =>
Term s (a :--> b) -> Term s a -> Term s b
# Term s (PBuiltinList PData)
flds) (() -> Term s r
f ()) forall a b. (a -> b) -> a -> b
$ forall (s :: S) (a :: PType). Term s PString -> Term s a
ptraceError Term s PString
"ptryFrom(TxId): constructor fields len > 1"
    Term s PByteString
unwrapped <- forall a (s :: S) (r :: PType).
((a -> Term s r) -> Term s r) -> TermCont @r s a
tcont forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (s :: S) (a :: PType) (b :: PType).
Term s a -> (Term s a -> Term s b) -> Term s b
plet forall a b. (a -> b) -> a -> b
$ forall (b :: PType) (a :: PType) (s :: S) (r :: PType).
PTryFrom a b =>
Term s a
-> ((Term s b, Reduce (PTryFromExcess a b s)) -> Term s r)
-> Term s r
ptryFrom @(PAsData PByteString) Term s PData
dataBs forall a b. (a, b) -> b
snd
    forall a (s :: S) (r :: PType).
((a -> Term s r) -> Term s r) -> TermCont @r s a
tcont forall a b. (a -> b) -> a -> b
$ \() -> Term s r
f ->
      forall (s :: S) (a :: PType).
Term s PBool -> Term s a -> Term s a -> Term s a
pif (forall (s :: S). Term s (PByteString :--> PInteger)
plengthBS forall (s :: S) (a :: PType) (b :: PType).
HasCallStack =>
Term s (a :--> b) -> Term s a -> Term s b
# Term s PByteString
unwrapped forall (t :: PType) (s :: S).
PEq t =>
Term s t -> Term s t -> Term s PBool
#== Term s PInteger
32) (() -> Term s r
f ()) forall a b. (a -> b) -> a -> b
$ forall (s :: S) (a :: PType). Term s PString -> Term s a
ptraceError Term s PString
"ptryFrom(TxId): must be 32 bytes long"
    forall (f :: Type -> Type) a. Applicative f => a -> f a
pure (forall (s :: S) (a :: PType) (b :: PType). Term s a -> Term s b
punsafeCoerce Term s PData
opq, Term s PByteString
unwrapped)

-- | Reference to a transaction output with a index referencing which of the outputs is being referred to.
newtype PTxOutRef (s :: S)
  = PTxOutRef
      ( Term
          s
          ( PDataRecord
              '[ "id" ':= PTxId
               , "idx" ':= PInteger
               ]
          )
      )
  deriving stock (forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall (s :: S) x. Rep (PTxOutRef s) x -> PTxOutRef s
forall (s :: S) x. PTxOutRef s -> Rep (PTxOutRef s) x
$cto :: forall (s :: S) x. Rep (PTxOutRef s) x -> PTxOutRef s
$cfrom :: forall (s :: S) x. PTxOutRef s -> Rep (PTxOutRef s) x
Generic)
  deriving anyclass (forall (s :: S). PTxOutRef s -> Term s (PInner PTxOutRef)
forall (s :: S) (b :: PType).
Term s (PInner PTxOutRef) -> (PTxOutRef s -> Term s b) -> Term s b
forall (a :: PType).
(forall (s :: S). a s -> Term s (PInner a))
-> (forall (s :: S) (b :: PType).
    Term s (PInner a) -> (a s -> Term s b) -> Term s b)
-> PlutusType a
pmatch' :: forall (s :: S) (b :: PType).
Term s (PInner PTxOutRef) -> (PTxOutRef s -> Term s b) -> Term s b
$cpmatch' :: forall (s :: S) (b :: PType).
Term s (PInner PTxOutRef) -> (PTxOutRef s -> Term s b) -> Term s b
pcon' :: forall (s :: S). PTxOutRef s -> Term s (PInner PTxOutRef)
$cpcon' :: forall (s :: S). PTxOutRef s -> Term s (PInner PTxOutRef)
PlutusType, forall (s :: S). Term s (PAsData PTxOutRef) -> Term s PTxOutRef
forall (s :: S). Term s PTxOutRef -> Term s PData
forall (a :: PType).
(forall (s :: S). Term s (PAsData a) -> Term s a)
-> (forall (s :: S). Term s a -> Term s PData) -> PIsData a
pdataImpl :: forall (s :: S). Term s PTxOutRef -> Term s PData
$cpdataImpl :: forall (s :: S). Term s PTxOutRef -> Term s PData
pfromDataImpl :: forall (s :: S). Term s (PAsData PTxOutRef) -> Term s PTxOutRef
$cpfromDataImpl :: forall (s :: S). Term s (PAsData PTxOutRef) -> Term s PTxOutRef
PIsData, forall (s :: S).
Term s PTxOutRef -> Term s (PDataRecord (PFields PTxOutRef))
forall (a :: PType).
(forall (s :: S). Term s a -> Term s (PDataRecord (PFields a)))
-> PDataFields a
ptoFields :: forall (s :: S).
Term s PTxOutRef -> Term s (PDataRecord (PFields PTxOutRef))
$cptoFields :: forall (s :: S).
Term s PTxOutRef -> Term s (PDataRecord (PFields PTxOutRef))
PDataFields, forall (s :: S).
Term s PTxOutRef -> Term s PTxOutRef -> Term s PBool
forall (t :: PType).
(forall (s :: S). Term s t -> Term s t -> Term s PBool) -> PEq t
#== :: forall (s :: S).
Term s PTxOutRef -> Term s PTxOutRef -> Term s PBool
$c#== :: forall (s :: S).
Term s PTxOutRef -> Term s PTxOutRef -> Term s PBool
PEq, PEq PTxOutRef
forall (s :: S).
Term s PTxOutRef -> Term s PTxOutRef -> Term s PBool
forall (t :: PType).
PEq t
-> (forall (s :: S). Term s t -> Term s t -> Term s PBool)
-> (forall (s :: S). Term s t -> Term s t -> Term s PBool)
-> PPartialOrd t
#< :: forall (s :: S).
Term s PTxOutRef -> Term s PTxOutRef -> Term s PBool
$c#< :: forall (s :: S).
Term s PTxOutRef -> Term s PTxOutRef -> Term s PBool
#<= :: forall (s :: S).
Term s PTxOutRef -> Term s PTxOutRef -> Term s PBool
$c#<= :: forall (s :: S).
Term s PTxOutRef -> Term s PTxOutRef -> Term s PBool
PPartialOrd, PPartialOrd PTxOutRef
forall (t :: PType). PPartialOrd t -> POrd t
POrd, PTryFrom PData, forall (s :: S). Bool -> Term s PTxOutRef -> Term s PString
forall (t :: PType).
(forall (s :: S). Bool -> Term s t -> Term s PString) -> PShow t
pshow' :: forall (s :: S). Bool -> Term s PTxOutRef -> Term s PString
$cpshow' :: forall (s :: S). Bool -> Term s PTxOutRef -> Term s PString
PShow)

instance DerivePlutusType PTxOutRef where type DPTStrat _ = PlutusTypeData

instance PUnsafeLiftDecl PTxOutRef where type PLifted PTxOutRef = Plutus.TxOutRef
deriving via (DerivePConstantViaData Plutus.TxOutRef PTxOutRef) instance PConstantDecl Plutus.TxOutRef
instance PTryFrom PData (PAsData PTxOutRef)

-- | A input of the pending transaction.
newtype PTxInInfo (s :: S)
  = PTxInInfo
      ( Term
          s
          ( PDataRecord
              '[ "outRef" ':= PTxOutRef
               , "resolved" ':= PTxOut
               ]
          )
      )
  deriving stock (forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall (s :: S) x. Rep (PTxInInfo s) x -> PTxInInfo s
forall (s :: S) x. PTxInInfo s -> Rep (PTxInInfo s) x
$cto :: forall (s :: S) x. Rep (PTxInInfo s) x -> PTxInInfo s
$cfrom :: forall (s :: S) x. PTxInInfo s -> Rep (PTxInInfo s) x
Generic)
  deriving anyclass (forall (s :: S). PTxInInfo s -> Term s (PInner PTxInInfo)
forall (s :: S) (b :: PType).
Term s (PInner PTxInInfo) -> (PTxInInfo s -> Term s b) -> Term s b
forall (a :: PType).
(forall (s :: S). a s -> Term s (PInner a))
-> (forall (s :: S) (b :: PType).
    Term s (PInner a) -> (a s -> Term s b) -> Term s b)
-> PlutusType a
pmatch' :: forall (s :: S) (b :: PType).
Term s (PInner PTxInInfo) -> (PTxInInfo s -> Term s b) -> Term s b
$cpmatch' :: forall (s :: S) (b :: PType).
Term s (PInner PTxInInfo) -> (PTxInInfo s -> Term s b) -> Term s b
pcon' :: forall (s :: S). PTxInInfo s -> Term s (PInner PTxInInfo)
$cpcon' :: forall (s :: S). PTxInInfo s -> Term s (PInner PTxInInfo)
PlutusType, forall (s :: S). Term s (PAsData PTxInInfo) -> Term s PTxInInfo
forall (s :: S). Term s PTxInInfo -> Term s PData
forall (a :: PType).
(forall (s :: S). Term s (PAsData a) -> Term s a)
-> (forall (s :: S). Term s a -> Term s PData) -> PIsData a
pdataImpl :: forall (s :: S). Term s PTxInInfo -> Term s PData
$cpdataImpl :: forall (s :: S). Term s PTxInInfo -> Term s PData
pfromDataImpl :: forall (s :: S). Term s (PAsData PTxInInfo) -> Term s PTxInInfo
$cpfromDataImpl :: forall (s :: S). Term s (PAsData PTxInInfo) -> Term s PTxInInfo
PIsData, forall (s :: S).
Term s PTxInInfo -> Term s (PDataRecord (PFields PTxInInfo))
forall (a :: PType).
(forall (s :: S). Term s a -> Term s (PDataRecord (PFields a)))
-> PDataFields a
ptoFields :: forall (s :: S).
Term s PTxInInfo -> Term s (PDataRecord (PFields PTxInInfo))
$cptoFields :: forall (s :: S).
Term s PTxInInfo -> Term s (PDataRecord (PFields PTxInInfo))
PDataFields, forall (s :: S).
Term s PTxInInfo -> Term s PTxInInfo -> Term s PBool
forall (t :: PType).
(forall (s :: S). Term s t -> Term s t -> Term s PBool) -> PEq t
#== :: forall (s :: S).
Term s PTxInInfo -> Term s PTxInInfo -> Term s PBool
$c#== :: forall (s :: S).
Term s PTxInInfo -> Term s PTxInInfo -> Term s PBool
PEq, forall (s :: S). Bool -> Term s PTxInInfo -> Term s PString
forall (t :: PType).
(forall (s :: S). Bool -> Term s t -> Term s PString) -> PShow t
pshow' :: forall (s :: S). Bool -> Term s PTxInInfo -> Term s PString
$cpshow' :: forall (s :: S). Bool -> Term s PTxInInfo -> Term s PString
PShow)

instance DerivePlutusType PTxInInfo where type DPTStrat _ = PlutusTypeData

instance PUnsafeLiftDecl PTxInInfo where type PLifted PTxInInfo = Plutus.TxInInfo
deriving via (DerivePConstantViaData Plutus.TxInInfo PTxInInfo) instance PConstantDecl Plutus.TxInInfo

-- | A transaction output. This consists of a target address, value and maybe a datum hash
newtype PTxOut (s :: S)
  = PTxOut
      ( Term
          s
          ( PDataRecord
              '[ "address" ':= PAddress
               , "value" ':= PValue 'Sorted 'Positive -- negative values may appear in a future Cardano version
               , "datumHash" ':= PMaybeData PDatumHash
               ]
          )
      )
  deriving stock (forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall (s :: S) x. Rep (PTxOut s) x -> PTxOut s
forall (s :: S) x. PTxOut s -> Rep (PTxOut s) x
$cto :: forall (s :: S) x. Rep (PTxOut s) x -> PTxOut s
$cfrom :: forall (s :: S) x. PTxOut s -> Rep (PTxOut s) x
Generic)
  deriving anyclass (forall (s :: S). PTxOut s -> Term s (PInner PTxOut)
forall (s :: S) (b :: PType).
Term s (PInner PTxOut) -> (PTxOut s -> Term s b) -> Term s b
forall (a :: PType).
(forall (s :: S). a s -> Term s (PInner a))
-> (forall (s :: S) (b :: PType).
    Term s (PInner a) -> (a s -> Term s b) -> Term s b)
-> PlutusType a
pmatch' :: forall (s :: S) (b :: PType).
Term s (PInner PTxOut) -> (PTxOut s -> Term s b) -> Term s b
$cpmatch' :: forall (s :: S) (b :: PType).
Term s (PInner PTxOut) -> (PTxOut s -> Term s b) -> Term s b
pcon' :: forall (s :: S). PTxOut s -> Term s (PInner PTxOut)
$cpcon' :: forall (s :: S). PTxOut s -> Term s (PInner PTxOut)
PlutusType, forall (s :: S). Term s (PAsData PTxOut) -> Term s PTxOut
forall (s :: S). Term s PTxOut -> Term s PData
forall (a :: PType).
(forall (s :: S). Term s (PAsData a) -> Term s a)
-> (forall (s :: S). Term s a -> Term s PData) -> PIsData a
pdataImpl :: forall (s :: S). Term s PTxOut -> Term s PData
$cpdataImpl :: forall (s :: S). Term s PTxOut -> Term s PData
pfromDataImpl :: forall (s :: S). Term s (PAsData PTxOut) -> Term s PTxOut
$cpfromDataImpl :: forall (s :: S). Term s (PAsData PTxOut) -> Term s PTxOut
PIsData, forall (s :: S).
Term s PTxOut -> Term s (PDataRecord (PFields PTxOut))
forall (a :: PType).
(forall (s :: S). Term s a -> Term s (PDataRecord (PFields a)))
-> PDataFields a
ptoFields :: forall (s :: S).
Term s PTxOut -> Term s (PDataRecord (PFields PTxOut))
$cptoFields :: forall (s :: S).
Term s PTxOut -> Term s (PDataRecord (PFields PTxOut))
PDataFields, forall (s :: S). Term s PTxOut -> Term s PTxOut -> Term s PBool
forall (t :: PType).
(forall (s :: S). Term s t -> Term s t -> Term s PBool) -> PEq t
#== :: forall (s :: S). Term s PTxOut -> Term s PTxOut -> Term s PBool
$c#== :: forall (s :: S). Term s PTxOut -> Term s PTxOut -> Term s PBool
PEq, forall (s :: S). Bool -> Term s PTxOut -> Term s PString
forall (t :: PType).
(forall (s :: S). Bool -> Term s t -> Term s PString) -> PShow t
pshow' :: forall (s :: S). Bool -> Term s PTxOut -> Term s PString
$cpshow' :: forall (s :: S). Bool -> Term s PTxOut -> Term s PString
PShow)

instance DerivePlutusType PTxOut where type DPTStrat _ = PlutusTypeData

instance PUnsafeLiftDecl PTxOut where type PLifted PTxOut = Plutus.TxOut
deriving via (DerivePConstantViaData Plutus.TxOut PTxOut) instance PConstantDecl Plutus.TxOut