{-# OPTIONS_GHC -Wno-deprecations #-}
{-# OPTIONS_GHC -Wno-orphans #-}

-- Mirrors the equivalent V4 module in plutus-ledger-api
module Plutarch.LedgerApi.V4.Contexts (
  PGovernanceActionId (..),
  PProtocolVersion (..),
  PConstitution (..),
  PCommittee (..),
  PGovernanceAction (..),
  PProposalProcedure (..),
  PAccountBalanceInterval (..),
  PAccountBalanceIntervals (..),
  PTxCert (..),
  PScriptPurpose (..),
  PTxInInfo (..),
  PTxInfo (..),
  PTopTxInfoSimplified (..),
  PTopTxInfo (..),
  PScriptInfo (..),
  PScriptContext (..),
) where

import Data.Bifunctor (bimap)
import GHC.Generics (Generic)
import Generics.SOP qualified as SOP
import Plutarch.Internal.Lift (
  LiftError (CouldNotDecodeData),
  punsafeCoercePLifted,
 )
import Plutarch.LedgerApi.AssocMap (PUnsortedMap)
import Plutarch.LedgerApi.Utils (PMaybeData)
import Plutarch.LedgerApi.V1.Credential (PCredential)
import Plutarch.LedgerApi.V1.Crypto (PPubKeyHash)
import Plutarch.LedgerApi.V1.Scripts (
  PDatum,
  PDatumHash,
  PRedeemer,
  PScriptHash,
 )
import Plutarch.LedgerApi.V3.Contexts (
  PChangedParameters,
  PColdCommitteeCredential,
  PDRepCredential,
  PDelegatee,
  PHotCommitteeCredential,
  PVote,
  PVoter,
 )
import Plutarch.LedgerApi.V3.MintValue (PMintValue)
import Plutarch.LedgerApi.V3.Tx (PTxId)
import Plutarch.LedgerApi.V4.Address (PAccountId)
import Plutarch.LedgerApi.V4.Ratio (PRationalData)
import Plutarch.LedgerApi.V4.Time (PPosixTimeRange)
import Plutarch.LedgerApi.V4.Tx (PTxOut, PTxOutRef)
import Plutarch.LedgerApi.Value (PCurrencySymbol, PLovelace)
import Plutarch.Prelude
import Plutarch.Unsafe (punsafeBuiltin, punsafeCoerce)
import PlutusCore qualified as PLC
import PlutusLedgerApi.V4 qualified as Plutus
import PlutusTx.AssocMap qualified as PlutusMap

-- | @since 3.8.0
data PGovernanceActionId (s :: S)
  = PGovernanceActionId (Term s (PAsData PTxId)) (Term s (PAsData PInteger))
  deriving stock
    ( -- | @since 3.8.0
      (forall x. PGovernanceActionId s -> Rep (PGovernanceActionId s) x)
-> (forall x.
    Rep (PGovernanceActionId s) x -> PGovernanceActionId s)
-> Generic (PGovernanceActionId s)
forall x. Rep (PGovernanceActionId s) x -> PGovernanceActionId s
forall x. PGovernanceActionId s -> Rep (PGovernanceActionId s) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall (s :: S) x.
Rep (PGovernanceActionId s) x -> PGovernanceActionId s
forall (s :: S) x.
PGovernanceActionId s -> Rep (PGovernanceActionId s) x
$cfrom :: forall (s :: S) x.
PGovernanceActionId s -> Rep (PGovernanceActionId s) x
from :: forall x. PGovernanceActionId s -> Rep (PGovernanceActionId s) x
$cto :: forall (s :: S) x.
Rep (PGovernanceActionId s) x -> PGovernanceActionId s
to :: forall x. Rep (PGovernanceActionId s) x -> PGovernanceActionId s
Generic
    )
  deriving anyclass
    ( -- | @since 3.8.0
      All SListI (Code (PGovernanceActionId s))
All SListI (Code (PGovernanceActionId s)) =>
(PGovernanceActionId s -> Rep (PGovernanceActionId s))
-> (Rep (PGovernanceActionId s) -> PGovernanceActionId s)
-> Generic (PGovernanceActionId s)
Rep (PGovernanceActionId s) -> PGovernanceActionId s
PGovernanceActionId s -> Rep (PGovernanceActionId s)
forall a.
All SListI (Code a) =>
(a -> Rep a) -> (Rep a -> a) -> Generic a
forall (s :: S). All SListI (Code (PGovernanceActionId s))
forall (s :: S).
Rep (PGovernanceActionId s) -> PGovernanceActionId s
forall (s :: S).
PGovernanceActionId s -> Rep (PGovernanceActionId s)
$cfrom :: forall (s :: S).
PGovernanceActionId s -> Rep (PGovernanceActionId s)
from :: PGovernanceActionId s -> Rep (PGovernanceActionId s)
$cto :: forall (s :: S).
Rep (PGovernanceActionId s) -> PGovernanceActionId s
to :: Rep (PGovernanceActionId s) -> PGovernanceActionId s
SOP.Generic
    , -- | @since 3.8.0
      (forall (s :: S).
 Term s (PAsData PGovernanceActionId) -> Term s PGovernanceActionId)
-> (forall (s :: S). Term s PGovernanceActionId -> Term s PData)
-> PIsData PGovernanceActionId
forall (s :: S).
Term s (PAsData PGovernanceActionId) -> Term s PGovernanceActionId
forall (s :: S). Term s PGovernanceActionId -> Term s PData
forall (a :: S -> Type).
(forall (s :: S). Term s (PAsData a) -> Term s a)
-> (forall (s :: S). Term s a -> Term s PData) -> PIsData a
$cpfromDataImpl :: forall (s :: S).
Term s (PAsData PGovernanceActionId) -> Term s PGovernanceActionId
pfromDataImpl :: forall (s :: S).
Term s (PAsData PGovernanceActionId) -> Term s PGovernanceActionId
$cpdataImpl :: forall (s :: S). Term s PGovernanceActionId -> Term s PData
pdataImpl :: forall (s :: S). Term s PGovernanceActionId -> Term s PData
PIsData
    , -- | @since 3.8.0
      (forall (s :: S).
 Term s PGovernanceActionId
 -> Term s PGovernanceActionId -> Term s PBool)
-> PEq PGovernanceActionId
forall (s :: S).
Term s PGovernanceActionId
-> Term s PGovernanceActionId -> Term s PBool
forall (t :: S -> Type).
(forall (s :: S). Term s t -> Term s t -> Term s PBool) -> PEq t
$c#== :: forall (s :: S).
Term s PGovernanceActionId
-> Term s PGovernanceActionId -> Term s PBool
#== :: forall (s :: S).
Term s PGovernanceActionId
-> Term s PGovernanceActionId -> Term s PBool
PEq
    , -- | @since 3.8.0
      (forall (s :: S).
 Bool -> Term s PGovernanceActionId -> Term s PString)
-> PShow PGovernanceActionId
forall (s :: S).
Bool -> Term s PGovernanceActionId -> Term s PString
forall (t :: S -> Type).
(forall (s :: S). Bool -> Term s t -> Term s PString) -> PShow t
$cpshow' :: forall (s :: S).
Bool -> Term s PGovernanceActionId -> Term s PString
pshow' :: forall (s :: S).
Bool -> Term s PGovernanceActionId -> Term s PString
PShow
    )
  deriving
    ( -- | @since 3.8.0
      (forall (s :: S).
 PGovernanceActionId s -> Term s (PInner PGovernanceActionId))
-> (forall (s :: S) (b :: S -> Type).
    Term s (PInner PGovernanceActionId)
    -> (PGovernanceActionId s -> Term s b) -> Term s b)
-> PlutusType PGovernanceActionId
forall (s :: S).
PGovernanceActionId s -> Term s (PInner PGovernanceActionId)
forall (s :: S) (b :: S -> Type).
Term s (PInner PGovernanceActionId)
-> (PGovernanceActionId s -> Term s b) -> Term s b
forall (a :: S -> Type).
(forall (s :: S). a s -> Term s (PInner a))
-> (forall (s :: S) (b :: S -> Type).
    Term s (PInner a) -> (a s -> Term s b) -> Term s b)
-> PlutusType a
$cpcon' :: forall (s :: S).
PGovernanceActionId s -> Term s (PInner PGovernanceActionId)
pcon' :: forall (s :: S).
PGovernanceActionId s -> Term s (PInner PGovernanceActionId)
$cpmatch' :: forall (s :: S) (b :: S -> Type).
Term s (PInner PGovernanceActionId)
-> (PGovernanceActionId s -> Term s b) -> Term s b
pmatch' :: forall (s :: S) (b :: S -> Type).
Term s (PInner PGovernanceActionId)
-> (PGovernanceActionId s -> Term s b) -> Term s b
PlutusType
    , -- | @since 3.8.0
      (forall (s :: S).
 Term s PData -> forall (r :: S -> Type). Term s r -> Term s r)
-> PValidateData PGovernanceActionId
forall (s :: S).
Term s PData -> forall (r :: S -> Type). Term s r -> Term s r
forall (a :: S -> Type).
(forall (s :: S).
 Term s PData -> forall (r :: S -> Type). Term s r -> Term s r)
-> PValidateData a
$cpwithValidated :: forall (s :: S).
Term s PData -> forall (r :: S -> Type). Term s r -> Term s r
pwithValidated :: forall (s :: S).
Term s PData -> forall (r :: S -> Type). Term s r -> Term s r
PValidateData
    )
    via (DeriveAsDataRec PGovernanceActionId)

-- | @since 3.8.0
instance PLiftable PGovernanceActionId where
  type AsHaskell PGovernanceActionId = Plutus.GovernanceActionId
  type PlutusRepr PGovernanceActionId = Plutus.Data
  haskToRepr :: AsHaskell PGovernanceActionId -> PlutusRepr PGovernanceActionId
haskToRepr = AsHaskell PGovernanceActionId -> PlutusRepr PGovernanceActionId
GovernanceActionId -> Data
forall a. ToData a => a -> Data
Plutus.toData
  reprToHask :: PlutusRepr PGovernanceActionId
-> Either LiftError (AsHaskell PGovernanceActionId)
reprToHask = Either LiftError GovernanceActionId
-> (GovernanceActionId -> Either LiftError GovernanceActionId)
-> Maybe GovernanceActionId
-> Either LiftError GovernanceActionId
forall b a. b -> (a -> b) -> Maybe a -> b
maybe (LiftError -> Either LiftError GovernanceActionId
forall a b. a -> Either a b
Left LiftError
CouldNotDecodeData) GovernanceActionId -> Either LiftError GovernanceActionId
forall a b. b -> Either a b
Right (Maybe GovernanceActionId -> Either LiftError GovernanceActionId)
-> (Data -> Maybe GovernanceActionId)
-> Data
-> Either LiftError GovernanceActionId
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Data -> Maybe GovernanceActionId
forall a. FromData a => Data -> Maybe a
Plutus.fromData
  plutToRepr :: (forall (s :: S). PLifted s PGovernanceActionId)
-> Either LiftError (PlutusRepr PGovernanceActionId)
plutToRepr forall (s :: S). PLifted s PGovernanceActionId
t = ([Data] -> PlutusRepr PGovernanceActionId)
-> Either LiftError [Data]
-> Either LiftError (PlutusRepr PGovernanceActionId)
forall a b. (a -> b) -> Either LiftError a -> Either LiftError b
forall (f :: Type -> Type) a b. Functor f => (a -> b) -> f a -> f b
fmap [Data] -> PlutusRepr PGovernanceActionId
[Data] -> Data
Plutus.List (Either LiftError [Data]
 -> Either LiftError (PlutusRepr PGovernanceActionId))
-> Either LiftError [Data]
-> Either LiftError (PlutusRepr PGovernanceActionId)
forall a b. (a -> b) -> a -> b
$ forall (a :: S -> Type).
KnownBuiltinType
  (Term DeBruijn DefaultUni DefaultFun ()) (PlutusRepr a) =>
(forall (s :: S). PLifted s a) -> Either LiftError (PlutusRepr a)
plutToReprUni @(PBuiltinList PData) ((forall (s :: S). PLifted s (PBuiltinList PData))
 -> Either LiftError (PlutusRepr (PBuiltinList PData)))
-> (forall (s :: S). PLifted s (PBuiltinList PData))
-> Either LiftError (PlutusRepr (PBuiltinList PData))
forall a b. (a -> b) -> a -> b
$ PLifted s PGovernanceActionId -> PLifted s (PBuiltinList PData)
forall (s :: S) (a :: S -> Type) (b :: S -> Type).
PLifted s a -> PLifted s b
punsafeCoercePLifted PLifted s PGovernanceActionId
forall (s :: S). PLifted s PGovernanceActionId
t
  reprToPlut :: forall (s :: S).
PlutusRepr PGovernanceActionId -> PLifted s PGovernanceActionId
reprToPlut = \case
    Plutus.List [Data]
ell -> PLifted s (PBuiltinList PData) -> PLifted s PGovernanceActionId
forall (s :: S) (a :: S -> Type) (b :: S -> Type).
PLifted s a -> PLifted s b
punsafeCoercePLifted (forall (a :: S -> Type) (s :: S).
Includes DefaultUni (PlutusRepr a) =>
PlutusRepr a -> PLifted s a
reprToPlutUni @(PBuiltinList PData) [Data]
PlutusRepr (PBuiltinList PData)
ell)
    PlutusRepr PGovernanceActionId
_ -> [Char] -> PLifted s PGovernanceActionId
forall a. HasCallStack => [Char] -> a
error [Char]
"Impossible: PGovernanceActionId is list-represented."

-- | @since 3.8.0
instance PTryFrom PData (PAsData PGovernanceActionId)

-- | @since 3.8.0
data PProtocolVersion (s :: S) = PProtocolVersion
  { forall (s :: S). PProtocolVersion s -> Term s (PAsData PInteger)
pprotocolVersion'major :: Term s (PAsData PInteger)
  , forall (s :: S). PProtocolVersion s -> Term s (PAsData PInteger)
pprotocolVersion'minor :: Term s (PAsData PInteger)
  }
  deriving stock
    ( -- | @since 3.8.0
      (forall x. PProtocolVersion s -> Rep (PProtocolVersion s) x)
-> (forall x. Rep (PProtocolVersion s) x -> PProtocolVersion s)
-> Generic (PProtocolVersion s)
forall x. Rep (PProtocolVersion s) x -> PProtocolVersion s
forall x. PProtocolVersion s -> Rep (PProtocolVersion s) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall (s :: S) x. Rep (PProtocolVersion s) x -> PProtocolVersion s
forall (s :: S) x. PProtocolVersion s -> Rep (PProtocolVersion s) x
$cfrom :: forall (s :: S) x. PProtocolVersion s -> Rep (PProtocolVersion s) x
from :: forall x. PProtocolVersion s -> Rep (PProtocolVersion s) x
$cto :: forall (s :: S) x. Rep (PProtocolVersion s) x -> PProtocolVersion s
to :: forall x. Rep (PProtocolVersion s) x -> PProtocolVersion s
Generic
    )
  deriving anyclass
    ( -- | @since 3.8.0
      All SListI (Code (PProtocolVersion s))
All SListI (Code (PProtocolVersion s)) =>
(PProtocolVersion s -> Rep (PProtocolVersion s))
-> (Rep (PProtocolVersion s) -> PProtocolVersion s)
-> Generic (PProtocolVersion s)
Rep (PProtocolVersion s) -> PProtocolVersion s
PProtocolVersion s -> Rep (PProtocolVersion s)
forall a.
All SListI (Code a) =>
(a -> Rep a) -> (Rep a -> a) -> Generic a
forall (s :: S). All SListI (Code (PProtocolVersion s))
forall (s :: S). Rep (PProtocolVersion s) -> PProtocolVersion s
forall (s :: S). PProtocolVersion s -> Rep (PProtocolVersion s)
$cfrom :: forall (s :: S). PProtocolVersion s -> Rep (PProtocolVersion s)
from :: PProtocolVersion s -> Rep (PProtocolVersion s)
$cto :: forall (s :: S). Rep (PProtocolVersion s) -> PProtocolVersion s
to :: Rep (PProtocolVersion s) -> PProtocolVersion s
SOP.Generic
    , -- | @since 3.8.0
      (forall (s :: S).
 Term s (PAsData PProtocolVersion) -> Term s PProtocolVersion)
-> (forall (s :: S). Term s PProtocolVersion -> Term s PData)
-> PIsData PProtocolVersion
forall (s :: S).
Term s (PAsData PProtocolVersion) -> Term s PProtocolVersion
forall (s :: S). Term s PProtocolVersion -> Term s PData
forall (a :: S -> Type).
(forall (s :: S). Term s (PAsData a) -> Term s a)
-> (forall (s :: S). Term s a -> Term s PData) -> PIsData a
$cpfromDataImpl :: forall (s :: S).
Term s (PAsData PProtocolVersion) -> Term s PProtocolVersion
pfromDataImpl :: forall (s :: S).
Term s (PAsData PProtocolVersion) -> Term s PProtocolVersion
$cpdataImpl :: forall (s :: S). Term s PProtocolVersion -> Term s PData
pdataImpl :: forall (s :: S). Term s PProtocolVersion -> Term s PData
PIsData
    , -- | @since 3.8.0
      (forall (s :: S).
 Term s PProtocolVersion -> Term s PProtocolVersion -> Term s PBool)
-> PEq PProtocolVersion
forall (s :: S).
Term s PProtocolVersion -> Term s PProtocolVersion -> Term s PBool
forall (t :: S -> Type).
(forall (s :: S). Term s t -> Term s t -> Term s PBool) -> PEq t
$c#== :: forall (s :: S).
Term s PProtocolVersion -> Term s PProtocolVersion -> Term s PBool
#== :: forall (s :: S).
Term s PProtocolVersion -> Term s PProtocolVersion -> Term s PBool
PEq
    , -- | @since 3.8.0
      (forall (s :: S).
 Bool -> Term s PProtocolVersion -> Term s PString)
-> PShow PProtocolVersion
forall (s :: S). Bool -> Term s PProtocolVersion -> Term s PString
forall (t :: S -> Type).
(forall (s :: S). Bool -> Term s t -> Term s PString) -> PShow t
$cpshow' :: forall (s :: S). Bool -> Term s PProtocolVersion -> Term s PString
pshow' :: forall (s :: S). Bool -> Term s PProtocolVersion -> Term s PString
PShow
    )
  deriving
    ( -- | @since 3.8.0
      (forall (s :: S).
 PProtocolVersion s -> Term s (PInner PProtocolVersion))
-> (forall (s :: S) (b :: S -> Type).
    Term s (PInner PProtocolVersion)
    -> (PProtocolVersion s -> Term s b) -> Term s b)
-> PlutusType PProtocolVersion
forall (s :: S).
PProtocolVersion s -> Term s (PInner PProtocolVersion)
forall (s :: S) (b :: S -> Type).
Term s (PInner PProtocolVersion)
-> (PProtocolVersion s -> Term s b) -> Term s b
forall (a :: S -> Type).
(forall (s :: S). a s -> Term s (PInner a))
-> (forall (s :: S) (b :: S -> Type).
    Term s (PInner a) -> (a s -> Term s b) -> Term s b)
-> PlutusType a
$cpcon' :: forall (s :: S).
PProtocolVersion s -> Term s (PInner PProtocolVersion)
pcon' :: forall (s :: S).
PProtocolVersion s -> Term s (PInner PProtocolVersion)
$cpmatch' :: forall (s :: S) (b :: S -> Type).
Term s (PInner PProtocolVersion)
-> (PProtocolVersion s -> Term s b) -> Term s b
pmatch' :: forall (s :: S) (b :: S -> Type).
Term s (PInner PProtocolVersion)
-> (PProtocolVersion s -> Term s b) -> Term s b
PlutusType
    , -- | @since 3.8.0
      (forall (s :: S).
 Term s PData -> forall (r :: S -> Type). Term s r -> Term s r)
-> PValidateData PProtocolVersion
forall (s :: S).
Term s PData -> forall (r :: S -> Type). Term s r -> Term s r
forall (a :: S -> Type).
(forall (s :: S).
 Term s PData -> forall (r :: S -> Type). Term s r -> Term s r)
-> PValidateData a
$cpwithValidated :: forall (s :: S).
Term s PData -> forall (r :: S -> Type). Term s r -> Term s r
pwithValidated :: forall (s :: S).
Term s PData -> forall (r :: S -> Type). Term s r -> Term s r
PValidateData
    )
    via (DeriveAsDataRec PProtocolVersion)

-- | @since 3.8.0
instance PLiftable PProtocolVersion where
  type AsHaskell PProtocolVersion = Plutus.ProtocolVersion
  type PlutusRepr PProtocolVersion = Plutus.Data
  haskToRepr :: AsHaskell PProtocolVersion -> PlutusRepr PProtocolVersion
haskToRepr = AsHaskell PProtocolVersion -> PlutusRepr PProtocolVersion
ProtocolVersion -> Data
forall a. ToData a => a -> Data
Plutus.toData
  reprToHask :: PlutusRepr PProtocolVersion
-> Either LiftError (AsHaskell PProtocolVersion)
reprToHask = Either LiftError ProtocolVersion
-> (ProtocolVersion -> Either LiftError ProtocolVersion)
-> Maybe ProtocolVersion
-> Either LiftError ProtocolVersion
forall b a. b -> (a -> b) -> Maybe a -> b
maybe (LiftError -> Either LiftError ProtocolVersion
forall a b. a -> Either a b
Left LiftError
CouldNotDecodeData) ProtocolVersion -> Either LiftError ProtocolVersion
forall a b. b -> Either a b
Right (Maybe ProtocolVersion -> Either LiftError ProtocolVersion)
-> (Data -> Maybe ProtocolVersion)
-> Data
-> Either LiftError ProtocolVersion
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Data -> Maybe ProtocolVersion
forall a. FromData a => Data -> Maybe a
Plutus.fromData
  plutToRepr :: (forall (s :: S). PLifted s PProtocolVersion)
-> Either LiftError (PlutusRepr PProtocolVersion)
plutToRepr forall (s :: S). PLifted s PProtocolVersion
t = ([Data] -> PlutusRepr PProtocolVersion)
-> Either LiftError [Data]
-> Either LiftError (PlutusRepr PProtocolVersion)
forall a b. (a -> b) -> Either LiftError a -> Either LiftError b
forall (f :: Type -> Type) a b. Functor f => (a -> b) -> f a -> f b
fmap [Data] -> PlutusRepr PProtocolVersion
[Data] -> Data
Plutus.List (Either LiftError [Data]
 -> Either LiftError (PlutusRepr PProtocolVersion))
-> Either LiftError [Data]
-> Either LiftError (PlutusRepr PProtocolVersion)
forall a b. (a -> b) -> a -> b
$ forall (a :: S -> Type).
KnownBuiltinType
  (Term DeBruijn DefaultUni DefaultFun ()) (PlutusRepr a) =>
(forall (s :: S). PLifted s a) -> Either LiftError (PlutusRepr a)
plutToReprUni @(PBuiltinList PData) ((forall (s :: S). PLifted s (PBuiltinList PData))
 -> Either LiftError (PlutusRepr (PBuiltinList PData)))
-> (forall (s :: S). PLifted s (PBuiltinList PData))
-> Either LiftError (PlutusRepr (PBuiltinList PData))
forall a b. (a -> b) -> a -> b
$ PLifted s PProtocolVersion -> PLifted s (PBuiltinList PData)
forall (s :: S) (a :: S -> Type) (b :: S -> Type).
PLifted s a -> PLifted s b
punsafeCoercePLifted PLifted s PProtocolVersion
forall (s :: S). PLifted s PProtocolVersion
t
  reprToPlut :: forall (s :: S).
PlutusRepr PProtocolVersion -> PLifted s PProtocolVersion
reprToPlut = \case
    Plutus.List [Data]
ell -> PLifted s (PBuiltinList PData) -> PLifted s PProtocolVersion
forall (s :: S) (a :: S -> Type) (b :: S -> Type).
PLifted s a -> PLifted s b
punsafeCoercePLifted (forall (a :: S -> Type) (s :: S).
Includes DefaultUni (PlutusRepr a) =>
PlutusRepr a -> PLifted s a
reprToPlutUni @(PBuiltinList PData) [Data]
PlutusRepr (PBuiltinList PData)
ell)
    PlutusRepr PProtocolVersion
_ -> [Char] -> PLifted s PProtocolVersion
forall a. HasCallStack => [Char] -> a
error [Char]
"Impossible: PProtocolVersion is list-represented."

-- | @since 3.8.0
instance PTryFrom PData (PAsData PProtocolVersion)

{- | A constitution, omitting the optional anchor.

@since 3.8.0
-}
newtype PConstitution (s :: S) = PConstitution (Term s (PMaybeData PScriptHash))
  deriving stock
    ( -- | @since 3.8.0
      (forall x. PConstitution s -> Rep (PConstitution s) x)
-> (forall x. Rep (PConstitution s) x -> PConstitution s)
-> Generic (PConstitution s)
forall x. Rep (PConstitution s) x -> PConstitution s
forall x. PConstitution s -> Rep (PConstitution s) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall (s :: S) x. Rep (PConstitution s) x -> PConstitution s
forall (s :: S) x. PConstitution s -> Rep (PConstitution s) x
$cfrom :: forall (s :: S) x. PConstitution s -> Rep (PConstitution s) x
from :: forall x. PConstitution s -> Rep (PConstitution s) x
$cto :: forall (s :: S) x. Rep (PConstitution s) x -> PConstitution s
to :: forall x. Rep (PConstitution s) x -> PConstitution s
Generic
    )
  deriving anyclass
    ( -- | @since 3.8.0
      All SListI (Code (PConstitution s))
All SListI (Code (PConstitution s)) =>
(PConstitution s -> Rep (PConstitution s))
-> (Rep (PConstitution s) -> PConstitution s)
-> Generic (PConstitution s)
Rep (PConstitution s) -> PConstitution s
PConstitution s -> Rep (PConstitution s)
forall a.
All SListI (Code a) =>
(a -> Rep a) -> (Rep a -> a) -> Generic a
forall (s :: S). All SListI (Code (PConstitution s))
forall (s :: S). Rep (PConstitution s) -> PConstitution s
forall (s :: S). PConstitution s -> Rep (PConstitution s)
$cfrom :: forall (s :: S). PConstitution s -> Rep (PConstitution s)
from :: PConstitution s -> Rep (PConstitution s)
$cto :: forall (s :: S). Rep (PConstitution s) -> PConstitution s
to :: Rep (PConstitution s) -> PConstitution s
SOP.Generic
    , -- | @since 3.8.0
      (forall (s :: S).
 Term s (PAsData PConstitution) -> Term s PConstitution)
-> (forall (s :: S). Term s PConstitution -> Term s PData)
-> PIsData PConstitution
forall (s :: S).
Term s (PAsData PConstitution) -> Term s PConstitution
forall (s :: S). Term s PConstitution -> Term s PData
forall (a :: S -> Type).
(forall (s :: S). Term s (PAsData a) -> Term s a)
-> (forall (s :: S). Term s a -> Term s PData) -> PIsData a
$cpfromDataImpl :: forall (s :: S).
Term s (PAsData PConstitution) -> Term s PConstitution
pfromDataImpl :: forall (s :: S).
Term s (PAsData PConstitution) -> Term s PConstitution
$cpdataImpl :: forall (s :: S). Term s PConstitution -> Term s PData
pdataImpl :: forall (s :: S). Term s PConstitution -> Term s PData
PIsData
    , -- | @since 3.8.0
      (forall (s :: S).
 Term s PConstitution -> Term s PConstitution -> Term s PBool)
-> PEq PConstitution
forall (s :: S).
Term s PConstitution -> Term s PConstitution -> Term s PBool
forall (t :: S -> Type).
(forall (s :: S). Term s t -> Term s t -> Term s PBool) -> PEq t
$c#== :: forall (s :: S).
Term s PConstitution -> Term s PConstitution -> Term s PBool
#== :: forall (s :: S).
Term s PConstitution -> Term s PConstitution -> Term s PBool
PEq
    , -- | @since 3.8.0
      (forall (s :: S). Bool -> Term s PConstitution -> Term s PString)
-> PShow PConstitution
forall (s :: S). Bool -> Term s PConstitution -> Term s PString
forall (t :: S -> Type).
(forall (s :: S). Bool -> Term s t -> Term s PString) -> PShow t
$cpshow' :: forall (s :: S). Bool -> Term s PConstitution -> Term s PString
pshow' :: forall (s :: S). Bool -> Term s PConstitution -> Term s PString
PShow
    )
  deriving
    ( -- | @since 3.8.0
      (forall (s :: S). PConstitution s -> Term s (PInner PConstitution))
-> (forall (s :: S) (b :: S -> Type).
    Term s (PInner PConstitution)
    -> (PConstitution s -> Term s b) -> Term s b)
-> PlutusType PConstitution
forall (s :: S). PConstitution s -> Term s (PInner PConstitution)
forall (s :: S) (b :: S -> Type).
Term s (PInner PConstitution)
-> (PConstitution s -> Term s b) -> Term s b
forall (a :: S -> Type).
(forall (s :: S). a s -> Term s (PInner a))
-> (forall (s :: S) (b :: S -> Type).
    Term s (PInner a) -> (a s -> Term s b) -> Term s b)
-> PlutusType a
$cpcon' :: forall (s :: S). PConstitution s -> Term s (PInner PConstitution)
pcon' :: forall (s :: S). PConstitution s -> Term s (PInner PConstitution)
$cpmatch' :: forall (s :: S) (b :: S -> Type).
Term s (PInner PConstitution)
-> (PConstitution s -> Term s b) -> Term s b
pmatch' :: forall (s :: S) (b :: S -> Type).
Term s (PInner PConstitution)
-> (PConstitution s -> Term s b) -> Term s b
PlutusType
    , -- | @since 3.8.0
      (forall (s :: S).
 Term s PData -> forall (r :: S -> Type). Term s r -> Term s r)
-> PValidateData PConstitution
forall (s :: S).
Term s PData -> forall (r :: S -> Type). Term s r -> Term s r
forall (a :: S -> Type).
(forall (s :: S).
 Term s PData -> forall (r :: S -> Type). Term s r -> Term s r)
-> PValidateData a
$cpwithValidated :: forall (s :: S).
Term s PData -> forall (r :: S -> Type). Term s r -> Term s r
pwithValidated :: forall (s :: S).
Term s PData -> forall (r :: S -> Type). Term s r -> Term s r
PValidateData
    )
    via (DeriveAsDataRec PConstitution)

-- | @since 3.8.0
instance PLiftable PConstitution where
  type AsHaskell PConstitution = Plutus.Constitution
  type PlutusRepr PConstitution = Plutus.Data
  haskToRepr :: AsHaskell PConstitution -> PlutusRepr PConstitution
haskToRepr = AsHaskell PConstitution -> PlutusRepr PConstitution
Constitution -> Data
forall a. ToData a => a -> Data
Plutus.toData
  reprToHask :: PlutusRepr PConstitution
-> Either LiftError (AsHaskell PConstitution)
reprToHask = Either LiftError Constitution
-> (Constitution -> Either LiftError Constitution)
-> Maybe Constitution
-> Either LiftError Constitution
forall b a. b -> (a -> b) -> Maybe a -> b
maybe (LiftError -> Either LiftError Constitution
forall a b. a -> Either a b
Left LiftError
CouldNotDecodeData) Constitution -> Either LiftError Constitution
forall a b. b -> Either a b
Right (Maybe Constitution -> Either LiftError Constitution)
-> (Data -> Maybe Constitution)
-> Data
-> Either LiftError Constitution
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Data -> Maybe Constitution
forall a. FromData a => Data -> Maybe a
Plutus.fromData
  plutToRepr :: (forall (s :: S). PLifted s PConstitution)
-> Either LiftError (PlutusRepr PConstitution)
plutToRepr forall (s :: S). PLifted s PConstitution
t = ([Data] -> PlutusRepr PConstitution)
-> Either LiftError [Data]
-> Either LiftError (PlutusRepr PConstitution)
forall a b. (a -> b) -> Either LiftError a -> Either LiftError b
forall (f :: Type -> Type) a b. Functor f => (a -> b) -> f a -> f b
fmap [Data] -> PlutusRepr PConstitution
[Data] -> Data
Plutus.List (Either LiftError [Data]
 -> Either LiftError (PlutusRepr PConstitution))
-> Either LiftError [Data]
-> Either LiftError (PlutusRepr PConstitution)
forall a b. (a -> b) -> a -> b
$ forall (a :: S -> Type).
KnownBuiltinType
  (Term DeBruijn DefaultUni DefaultFun ()) (PlutusRepr a) =>
(forall (s :: S). PLifted s a) -> Either LiftError (PlutusRepr a)
plutToReprUni @(PBuiltinList PData) ((forall (s :: S). PLifted s (PBuiltinList PData))
 -> Either LiftError (PlutusRepr (PBuiltinList PData)))
-> (forall (s :: S). PLifted s (PBuiltinList PData))
-> Either LiftError (PlutusRepr (PBuiltinList PData))
forall a b. (a -> b) -> a -> b
$ PLifted s PConstitution -> PLifted s (PBuiltinList PData)
forall (s :: S) (a :: S -> Type) (b :: S -> Type).
PLifted s a -> PLifted s b
punsafeCoercePLifted PLifted s PConstitution
forall (s :: S). PLifted s PConstitution
t
  reprToPlut :: forall (s :: S).
PlutusRepr PConstitution -> PLifted s PConstitution
reprToPlut = \case
    Plutus.List [Data]
ell -> PLifted s (PBuiltinList PData) -> PLifted s PConstitution
forall (s :: S) (a :: S -> Type) (b :: S -> Type).
PLifted s a -> PLifted s b
punsafeCoercePLifted (forall (a :: S -> Type) (s :: S).
Includes DefaultUni (PlutusRepr a) =>
PlutusRepr a -> PLifted s a
reprToPlutUni @(PBuiltinList PData) [Data]
PlutusRepr (PBuiltinList PData)
ell)
    PlutusRepr PConstitution
_ -> [Char] -> PLifted s PConstitution
forall a. HasCallStack => [Char] -> a
error [Char]
"Impossible: PConstitution is list-represented."

-- | @since 3.8.0
instance PTryFrom PData (PAsData PConstitution)

-- | @since 3.8.0
data PCommittee (s :: S) = PCommittee
  { forall (s :: S).
PCommittee s
-> Term
     s (PAsData (PUnsortedMap PColdCommitteeCredential PInteger))
pcommittee'members :: Term s (PAsData (PUnsortedMap PColdCommitteeCredential PInteger))
  , forall (s :: S). PCommittee s -> Term s (PAsData PRationalData)
pcommittee'quorum :: Term s (PAsData PRationalData)
  }
  deriving stock
    ( -- | @since 3.8.0
      (forall x. PCommittee s -> Rep (PCommittee s) x)
-> (forall x. Rep (PCommittee s) x -> PCommittee s)
-> Generic (PCommittee s)
forall x. Rep (PCommittee s) x -> PCommittee s
forall x. PCommittee s -> Rep (PCommittee s) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall (s :: S) x. Rep (PCommittee s) x -> PCommittee s
forall (s :: S) x. PCommittee s -> Rep (PCommittee s) x
$cfrom :: forall (s :: S) x. PCommittee s -> Rep (PCommittee s) x
from :: forall x. PCommittee s -> Rep (PCommittee s) x
$cto :: forall (s :: S) x. Rep (PCommittee s) x -> PCommittee s
to :: forall x. Rep (PCommittee s) x -> PCommittee s
Generic
    )
  deriving anyclass
    ( -- | @since 3.8.0
      All SListI (Code (PCommittee s))
All SListI (Code (PCommittee s)) =>
(PCommittee s -> Rep (PCommittee s))
-> (Rep (PCommittee s) -> PCommittee s) -> Generic (PCommittee s)
Rep (PCommittee s) -> PCommittee s
PCommittee s -> Rep (PCommittee s)
forall a.
All SListI (Code a) =>
(a -> Rep a) -> (Rep a -> a) -> Generic a
forall (s :: S). All SListI (Code (PCommittee s))
forall (s :: S). Rep (PCommittee s) -> PCommittee s
forall (s :: S). PCommittee s -> Rep (PCommittee s)
$cfrom :: forall (s :: S). PCommittee s -> Rep (PCommittee s)
from :: PCommittee s -> Rep (PCommittee s)
$cto :: forall (s :: S). Rep (PCommittee s) -> PCommittee s
to :: Rep (PCommittee s) -> PCommittee s
SOP.Generic
    , -- | @since 3.8.0
      (forall (s :: S). Term s (PAsData PCommittee) -> Term s PCommittee)
-> (forall (s :: S). Term s PCommittee -> Term s PData)
-> PIsData PCommittee
forall (s :: S). Term s (PAsData PCommittee) -> Term s PCommittee
forall (s :: S). Term s PCommittee -> Term s PData
forall (a :: S -> Type).
(forall (s :: S). Term s (PAsData a) -> Term s a)
-> (forall (s :: S). Term s a -> Term s PData) -> PIsData a
$cpfromDataImpl :: forall (s :: S). Term s (PAsData PCommittee) -> Term s PCommittee
pfromDataImpl :: forall (s :: S). Term s (PAsData PCommittee) -> Term s PCommittee
$cpdataImpl :: forall (s :: S). Term s PCommittee -> Term s PData
pdataImpl :: forall (s :: S). Term s PCommittee -> Term s PData
PIsData
    , -- | @since 3.8.0
      (forall (s :: S).
 Term s PCommittee -> Term s PCommittee -> Term s PBool)
-> PEq PCommittee
forall (s :: S).
Term s PCommittee -> Term s PCommittee -> Term s PBool
forall (t :: S -> Type).
(forall (s :: S). Term s t -> Term s t -> Term s PBool) -> PEq t
$c#== :: forall (s :: S).
Term s PCommittee -> Term s PCommittee -> Term s PBool
#== :: forall (s :: S).
Term s PCommittee -> Term s PCommittee -> Term s PBool
PEq
    , -- | @since 3.8.0
      (forall (s :: S). Bool -> Term s PCommittee -> Term s PString)
-> PShow PCommittee
forall (s :: S). Bool -> Term s PCommittee -> Term s PString
forall (t :: S -> Type).
(forall (s :: S). Bool -> Term s t -> Term s PString) -> PShow t
$cpshow' :: forall (s :: S). Bool -> Term s PCommittee -> Term s PString
pshow' :: forall (s :: S). Bool -> Term s PCommittee -> Term s PString
PShow
    )
  deriving
    ( -- | @since 3.8.0
      (forall (s :: S). PCommittee s -> Term s (PInner PCommittee))
-> (forall (s :: S) (b :: S -> Type).
    Term s (PInner PCommittee)
    -> (PCommittee s -> Term s b) -> Term s b)
-> PlutusType PCommittee
forall (s :: S). PCommittee s -> Term s (PInner PCommittee)
forall (s :: S) (b :: S -> Type).
Term s (PInner PCommittee)
-> (PCommittee s -> Term s b) -> Term s b
forall (a :: S -> Type).
(forall (s :: S). a s -> Term s (PInner a))
-> (forall (s :: S) (b :: S -> Type).
    Term s (PInner a) -> (a s -> Term s b) -> Term s b)
-> PlutusType a
$cpcon' :: forall (s :: S). PCommittee s -> Term s (PInner PCommittee)
pcon' :: forall (s :: S). PCommittee s -> Term s (PInner PCommittee)
$cpmatch' :: forall (s :: S) (b :: S -> Type).
Term s (PInner PCommittee)
-> (PCommittee s -> Term s b) -> Term s b
pmatch' :: forall (s :: S) (b :: S -> Type).
Term s (PInner PCommittee)
-> (PCommittee s -> Term s b) -> Term s b
PlutusType
    , -- | @since 3.8.0
      (forall (s :: S).
 Term s PData -> forall (r :: S -> Type). Term s r -> Term s r)
-> PValidateData PCommittee
forall (s :: S).
Term s PData -> forall (r :: S -> Type). Term s r -> Term s r
forall (a :: S -> Type).
(forall (s :: S).
 Term s PData -> forall (r :: S -> Type). Term s r -> Term s r)
-> PValidateData a
$cpwithValidated :: forall (s :: S).
Term s PData -> forall (r :: S -> Type). Term s r -> Term s r
pwithValidated :: forall (s :: S).
Term s PData -> forall (r :: S -> Type). Term s r -> Term s r
PValidateData
    )
    via (DeriveAsDataRec PCommittee)

-- | @since 3.8.0
instance PLiftable PCommittee where
  type AsHaskell PCommittee = Plutus.Committee
  type PlutusRepr PCommittee = Plutus.Data
  haskToRepr :: AsHaskell PCommittee -> PlutusRepr PCommittee
haskToRepr = AsHaskell PCommittee -> PlutusRepr PCommittee
Committee -> Data
forall a. ToData a => a -> Data
Plutus.toData
  reprToHask :: PlutusRepr PCommittee -> Either LiftError (AsHaskell PCommittee)
reprToHask = Either LiftError Committee
-> (Committee -> Either LiftError Committee)
-> Maybe Committee
-> Either LiftError Committee
forall b a. b -> (a -> b) -> Maybe a -> b
maybe (LiftError -> Either LiftError Committee
forall a b. a -> Either a b
Left LiftError
CouldNotDecodeData) Committee -> Either LiftError Committee
forall a b. b -> Either a b
Right (Maybe Committee -> Either LiftError Committee)
-> (Data -> Maybe Committee) -> Data -> Either LiftError Committee
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Data -> Maybe Committee
forall a. FromData a => Data -> Maybe a
Plutus.fromData
  plutToRepr :: (forall (s :: S). PLifted s PCommittee)
-> Either LiftError (PlutusRepr PCommittee)
plutToRepr forall (s :: S). PLifted s PCommittee
t = ([Data] -> PlutusRepr PCommittee)
-> Either LiftError [Data]
-> Either LiftError (PlutusRepr PCommittee)
forall a b. (a -> b) -> Either LiftError a -> Either LiftError b
forall (f :: Type -> Type) a b. Functor f => (a -> b) -> f a -> f b
fmap [Data] -> PlutusRepr PCommittee
[Data] -> Data
Plutus.List (Either LiftError [Data]
 -> Either LiftError (PlutusRepr PCommittee))
-> Either LiftError [Data]
-> Either LiftError (PlutusRepr PCommittee)
forall a b. (a -> b) -> a -> b
$ forall (a :: S -> Type).
KnownBuiltinType
  (Term DeBruijn DefaultUni DefaultFun ()) (PlutusRepr a) =>
(forall (s :: S). PLifted s a) -> Either LiftError (PlutusRepr a)
plutToReprUni @(PBuiltinList PData) ((forall (s :: S). PLifted s (PBuiltinList PData))
 -> Either LiftError (PlutusRepr (PBuiltinList PData)))
-> (forall (s :: S). PLifted s (PBuiltinList PData))
-> Either LiftError (PlutusRepr (PBuiltinList PData))
forall a b. (a -> b) -> a -> b
$ PLifted s PCommittee -> PLifted s (PBuiltinList PData)
forall (s :: S) (a :: S -> Type) (b :: S -> Type).
PLifted s a -> PLifted s b
punsafeCoercePLifted PLifted s PCommittee
forall (s :: S). PLifted s PCommittee
t
  reprToPlut :: forall (s :: S). PlutusRepr PCommittee -> PLifted s PCommittee
reprToPlut = \case
    Plutus.List [Data]
ell -> PLifted s (PBuiltinList PData) -> PLifted s PCommittee
forall (s :: S) (a :: S -> Type) (b :: S -> Type).
PLifted s a -> PLifted s b
punsafeCoercePLifted (forall (a :: S -> Type) (s :: S).
Includes DefaultUni (PlutusRepr a) =>
PlutusRepr a -> PLifted s a
reprToPlutUni @(PBuiltinList PData) [Data]
PlutusRepr (PBuiltinList PData)
ell)
    PlutusRepr PCommittee
_ -> [Char] -> PLifted s PCommittee
forall a. HasCallStack => [Char] -> a
error [Char]
"Impossible: PCommittee is list-represented."

-- | @since 3.8.0
instance PTryFrom PData (PAsData PCommittee)

-- | @since 3.8.0
data PGovernanceAction (s :: S)
  = PParameterChange (Term s (PMaybeData PGovernanceActionId)) (Term s PChangedParameters) (Term s (PMaybeData PScriptHash))
  | PHardForkInitiation (Term s (PMaybeData PGovernanceActionId)) (Term s (PAsData PProtocolVersion))
  | PTreasuryWithdrawals
      (Term s (PAsData (PUnsortedMap PCredential PLovelace)))
      (Term s (PMaybeData PScriptHash))
  | PNoConfidence (Term s (PMaybeData PGovernanceActionId))
  | PUpdateCommittee
      (Term s (PMaybeData PGovernanceActionId))
      (Term s (PAsData (PBuiltinList (PAsData PColdCommitteeCredential))))
      (Term s (PAsData (PUnsortedMap PColdCommitteeCredential PInteger)))
      (Term s (PAsData PRationalData))
  | PNewConstitution (Term s (PMaybeData PGovernanceActionId)) (Term s (PAsData PConstitution))
  | PInfoAction
  deriving stock
    ( -- | @since 3.8.0
      (forall x. PGovernanceAction s -> Rep (PGovernanceAction s) x)
-> (forall x. Rep (PGovernanceAction s) x -> PGovernanceAction s)
-> Generic (PGovernanceAction s)
forall x. Rep (PGovernanceAction s) x -> PGovernanceAction s
forall x. PGovernanceAction s -> Rep (PGovernanceAction s) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall (s :: S) x.
Rep (PGovernanceAction s) x -> PGovernanceAction s
forall (s :: S) x.
PGovernanceAction s -> Rep (PGovernanceAction s) x
$cfrom :: forall (s :: S) x.
PGovernanceAction s -> Rep (PGovernanceAction s) x
from :: forall x. PGovernanceAction s -> Rep (PGovernanceAction s) x
$cto :: forall (s :: S) x.
Rep (PGovernanceAction s) x -> PGovernanceAction s
to :: forall x. Rep (PGovernanceAction s) x -> PGovernanceAction s
Generic
    )
  deriving anyclass
    ( -- | @since 3.3.0
      All SListI (Code (PGovernanceAction s))
All SListI (Code (PGovernanceAction s)) =>
(PGovernanceAction s -> Rep (PGovernanceAction s))
-> (Rep (PGovernanceAction s) -> PGovernanceAction s)
-> Generic (PGovernanceAction s)
Rep (PGovernanceAction s) -> PGovernanceAction s
PGovernanceAction s -> Rep (PGovernanceAction s)
forall a.
All SListI (Code a) =>
(a -> Rep a) -> (Rep a -> a) -> Generic a
forall (s :: S). All SListI (Code (PGovernanceAction s))
forall (s :: S). Rep (PGovernanceAction s) -> PGovernanceAction s
forall (s :: S). PGovernanceAction s -> Rep (PGovernanceAction s)
$cfrom :: forall (s :: S). PGovernanceAction s -> Rep (PGovernanceAction s)
from :: PGovernanceAction s -> Rep (PGovernanceAction s)
$cto :: forall (s :: S). Rep (PGovernanceAction s) -> PGovernanceAction s
to :: Rep (PGovernanceAction s) -> PGovernanceAction s
SOP.Generic
    , -- | @since 3.8.0
      (forall (s :: S).
 Term s (PAsData PGovernanceAction) -> Term s PGovernanceAction)
-> (forall (s :: S). Term s PGovernanceAction -> Term s PData)
-> PIsData PGovernanceAction
forall (s :: S).
Term s (PAsData PGovernanceAction) -> Term s PGovernanceAction
forall (s :: S). Term s PGovernanceAction -> Term s PData
forall (a :: S -> Type).
(forall (s :: S). Term s (PAsData a) -> Term s a)
-> (forall (s :: S). Term s a -> Term s PData) -> PIsData a
$cpfromDataImpl :: forall (s :: S).
Term s (PAsData PGovernanceAction) -> Term s PGovernanceAction
pfromDataImpl :: forall (s :: S).
Term s (PAsData PGovernanceAction) -> Term s PGovernanceAction
$cpdataImpl :: forall (s :: S). Term s PGovernanceAction -> Term s PData
pdataImpl :: forall (s :: S). Term s PGovernanceAction -> Term s PData
PIsData
    , -- | @since 3.8.0
      (forall (s :: S).
 Term s PGovernanceAction
 -> Term s PGovernanceAction -> Term s PBool)
-> PEq PGovernanceAction
forall (s :: S).
Term s PGovernanceAction
-> Term s PGovernanceAction -> Term s PBool
forall (t :: S -> Type).
(forall (s :: S). Term s t -> Term s t -> Term s PBool) -> PEq t
$c#== :: forall (s :: S).
Term s PGovernanceAction
-> Term s PGovernanceAction -> Term s PBool
#== :: forall (s :: S).
Term s PGovernanceAction
-> Term s PGovernanceAction -> Term s PBool
PEq
    , -- | @since 3.8.0
      (forall (s :: S).
 Bool -> Term s PGovernanceAction -> Term s PString)
-> PShow PGovernanceAction
forall (s :: S). Bool -> Term s PGovernanceAction -> Term s PString
forall (t :: S -> Type).
(forall (s :: S). Bool -> Term s t -> Term s PString) -> PShow t
$cpshow' :: forall (s :: S). Bool -> Term s PGovernanceAction -> Term s PString
pshow' :: forall (s :: S). Bool -> Term s PGovernanceAction -> Term s PString
PShow
    )
  deriving
    ( -- | @since 3.8.0
      (forall (s :: S).
 PGovernanceAction s -> Term s (PInner PGovernanceAction))
-> (forall (s :: S) (b :: S -> Type).
    Term s (PInner PGovernanceAction)
    -> (PGovernanceAction s -> Term s b) -> Term s b)
-> PlutusType PGovernanceAction
forall (s :: S).
PGovernanceAction s -> Term s (PInner PGovernanceAction)
forall (s :: S) (b :: S -> Type).
Term s (PInner PGovernanceAction)
-> (PGovernanceAction s -> Term s b) -> Term s b
forall (a :: S -> Type).
(forall (s :: S). a s -> Term s (PInner a))
-> (forall (s :: S) (b :: S -> Type).
    Term s (PInner a) -> (a s -> Term s b) -> Term s b)
-> PlutusType a
$cpcon' :: forall (s :: S).
PGovernanceAction s -> Term s (PInner PGovernanceAction)
pcon' :: forall (s :: S).
PGovernanceAction s -> Term s (PInner PGovernanceAction)
$cpmatch' :: forall (s :: S) (b :: S -> Type).
Term s (PInner PGovernanceAction)
-> (PGovernanceAction s -> Term s b) -> Term s b
pmatch' :: forall (s :: S) (b :: S -> Type).
Term s (PInner PGovernanceAction)
-> (PGovernanceAction s -> Term s b) -> Term s b
PlutusType
    , -- | @since 3.8.0
      (forall (s :: S).
 Term s PData -> forall (r :: S -> Type). Term s r -> Term s r)
-> PValidateData PGovernanceAction
forall (s :: S).
Term s PData -> forall (r :: S -> Type). Term s r -> Term s r
forall (a :: S -> Type).
(forall (s :: S).
 Term s PData -> forall (r :: S -> Type). Term s r -> Term s r)
-> PValidateData a
$cpwithValidated :: forall (s :: S).
Term s PData -> forall (r :: S -> Type). Term s r -> Term s r
pwithValidated :: forall (s :: S).
Term s PData -> forall (r :: S -> Type). Term s r -> Term s r
PValidateData
    )
    via (DeriveAsDataStruct PGovernanceAction)

-- | @since 3.8.0
deriving via
  DeriveDataPLiftable PGovernanceAction Plutus.GovernanceAction
  instance
    PLiftable PGovernanceAction

-- | @since 3.8.0
instance PTryFrom PData (PAsData PGovernanceAction)

-- | @since 3.8.0
data PProposalProcedure (s :: S) = PProposalProcedure
  { forall (s :: S). PProposalProcedure s -> Term s (PAsData PLovelace)
pproposalProcedure'deposit :: Term s (PAsData PLovelace)
  , forall (s :: S). PProposalProcedure s -> Term s PCredential
pproposalProcedure'returnAddr :: Term s PCredential
  , forall (s :: S). PProposalProcedure s -> Term s PGovernanceAction
pproposalProcedure'governanceAction :: Term s PGovernanceAction
  }
  deriving stock
    ( -- | @since 3.8.0
      (forall x. PProposalProcedure s -> Rep (PProposalProcedure s) x)
-> (forall x. Rep (PProposalProcedure s) x -> PProposalProcedure s)
-> Generic (PProposalProcedure s)
forall x. Rep (PProposalProcedure s) x -> PProposalProcedure s
forall x. PProposalProcedure s -> Rep (PProposalProcedure s) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall (s :: S) x.
Rep (PProposalProcedure s) x -> PProposalProcedure s
forall (s :: S) x.
PProposalProcedure s -> Rep (PProposalProcedure s) x
$cfrom :: forall (s :: S) x.
PProposalProcedure s -> Rep (PProposalProcedure s) x
from :: forall x. PProposalProcedure s -> Rep (PProposalProcedure s) x
$cto :: forall (s :: S) x.
Rep (PProposalProcedure s) x -> PProposalProcedure s
to :: forall x. Rep (PProposalProcedure s) x -> PProposalProcedure s
Generic
    )
  deriving anyclass
    ( -- | @since 3.8.0
      All SListI (Code (PProposalProcedure s))
All SListI (Code (PProposalProcedure s)) =>
(PProposalProcedure s -> Rep (PProposalProcedure s))
-> (Rep (PProposalProcedure s) -> PProposalProcedure s)
-> Generic (PProposalProcedure s)
Rep (PProposalProcedure s) -> PProposalProcedure s
PProposalProcedure s -> Rep (PProposalProcedure s)
forall a.
All SListI (Code a) =>
(a -> Rep a) -> (Rep a -> a) -> Generic a
forall (s :: S). All SListI (Code (PProposalProcedure s))
forall (s :: S). Rep (PProposalProcedure s) -> PProposalProcedure s
forall (s :: S). PProposalProcedure s -> Rep (PProposalProcedure s)
$cfrom :: forall (s :: S). PProposalProcedure s -> Rep (PProposalProcedure s)
from :: PProposalProcedure s -> Rep (PProposalProcedure s)
$cto :: forall (s :: S). Rep (PProposalProcedure s) -> PProposalProcedure s
to :: Rep (PProposalProcedure s) -> PProposalProcedure s
SOP.Generic
    , -- | @since 3.8.0
      (forall (s :: S).
 Term s (PAsData PProposalProcedure) -> Term s PProposalProcedure)
-> (forall (s :: S). Term s PProposalProcedure -> Term s PData)
-> PIsData PProposalProcedure
forall (s :: S).
Term s (PAsData PProposalProcedure) -> Term s PProposalProcedure
forall (s :: S). Term s PProposalProcedure -> Term s PData
forall (a :: S -> Type).
(forall (s :: S). Term s (PAsData a) -> Term s a)
-> (forall (s :: S). Term s a -> Term s PData) -> PIsData a
$cpfromDataImpl :: forall (s :: S).
Term s (PAsData PProposalProcedure) -> Term s PProposalProcedure
pfromDataImpl :: forall (s :: S).
Term s (PAsData PProposalProcedure) -> Term s PProposalProcedure
$cpdataImpl :: forall (s :: S). Term s PProposalProcedure -> Term s PData
pdataImpl :: forall (s :: S). Term s PProposalProcedure -> Term s PData
PIsData
    , -- | @since 3.8.0
      (forall (s :: S).
 Term s PProposalProcedure
 -> Term s PProposalProcedure -> Term s PBool)
-> PEq PProposalProcedure
forall (s :: S).
Term s PProposalProcedure
-> Term s PProposalProcedure -> Term s PBool
forall (t :: S -> Type).
(forall (s :: S). Term s t -> Term s t -> Term s PBool) -> PEq t
$c#== :: forall (s :: S).
Term s PProposalProcedure
-> Term s PProposalProcedure -> Term s PBool
#== :: forall (s :: S).
Term s PProposalProcedure
-> Term s PProposalProcedure -> Term s PBool
PEq
    , -- | @since 3.8.0
      (forall (s :: S).
 Bool -> Term s PProposalProcedure -> Term s PString)
-> PShow PProposalProcedure
forall (s :: S).
Bool -> Term s PProposalProcedure -> Term s PString
forall (t :: S -> Type).
(forall (s :: S). Bool -> Term s t -> Term s PString) -> PShow t
$cpshow' :: forall (s :: S).
Bool -> Term s PProposalProcedure -> Term s PString
pshow' :: forall (s :: S).
Bool -> Term s PProposalProcedure -> Term s PString
PShow
    )
  deriving
    ( -- | @since 3.8.0
      (forall (s :: S).
 PProposalProcedure s -> Term s (PInner PProposalProcedure))
-> (forall (s :: S) (b :: S -> Type).
    Term s (PInner PProposalProcedure)
    -> (PProposalProcedure s -> Term s b) -> Term s b)
-> PlutusType PProposalProcedure
forall (s :: S).
PProposalProcedure s -> Term s (PInner PProposalProcedure)
forall (s :: S) (b :: S -> Type).
Term s (PInner PProposalProcedure)
-> (PProposalProcedure s -> Term s b) -> Term s b
forall (a :: S -> Type).
(forall (s :: S). a s -> Term s (PInner a))
-> (forall (s :: S) (b :: S -> Type).
    Term s (PInner a) -> (a s -> Term s b) -> Term s b)
-> PlutusType a
$cpcon' :: forall (s :: S).
PProposalProcedure s -> Term s (PInner PProposalProcedure)
pcon' :: forall (s :: S).
PProposalProcedure s -> Term s (PInner PProposalProcedure)
$cpmatch' :: forall (s :: S) (b :: S -> Type).
Term s (PInner PProposalProcedure)
-> (PProposalProcedure s -> Term s b) -> Term s b
pmatch' :: forall (s :: S) (b :: S -> Type).
Term s (PInner PProposalProcedure)
-> (PProposalProcedure s -> Term s b) -> Term s b
PlutusType
    , -- | @since 3.8.0
      (forall (s :: S).
 Term s PData -> forall (r :: S -> Type). Term s r -> Term s r)
-> PValidateData PProposalProcedure
forall (s :: S).
Term s PData -> forall (r :: S -> Type). Term s r -> Term s r
forall (a :: S -> Type).
(forall (s :: S).
 Term s PData -> forall (r :: S -> Type). Term s r -> Term s r)
-> PValidateData a
$cpwithValidated :: forall (s :: S).
Term s PData -> forall (r :: S -> Type). Term s r -> Term s r
pwithValidated :: forall (s :: S).
Term s PData -> forall (r :: S -> Type). Term s r -> Term s r
PValidateData
    )
    via (DeriveAsDataRec PProposalProcedure)

-- | @since 3.8.0
instance PLiftable PProposalProcedure where
  type AsHaskell PProposalProcedure = Plutus.ProposalProcedure
  type PlutusRepr PProposalProcedure = Plutus.Data
  haskToRepr :: AsHaskell PProposalProcedure -> PlutusRepr PProposalProcedure
haskToRepr = AsHaskell PProposalProcedure -> PlutusRepr PProposalProcedure
ProposalProcedure -> Data
forall a. ToData a => a -> Data
Plutus.toData
  reprToHask :: PlutusRepr PProposalProcedure
-> Either LiftError (AsHaskell PProposalProcedure)
reprToHask = Either LiftError ProposalProcedure
-> (ProposalProcedure -> Either LiftError ProposalProcedure)
-> Maybe ProposalProcedure
-> Either LiftError ProposalProcedure
forall b a. b -> (a -> b) -> Maybe a -> b
maybe (LiftError -> Either LiftError ProposalProcedure
forall a b. a -> Either a b
Left LiftError
CouldNotDecodeData) ProposalProcedure -> Either LiftError ProposalProcedure
forall a b. b -> Either a b
Right (Maybe ProposalProcedure -> Either LiftError ProposalProcedure)
-> (Data -> Maybe ProposalProcedure)
-> Data
-> Either LiftError ProposalProcedure
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Data -> Maybe ProposalProcedure
forall a. FromData a => Data -> Maybe a
Plutus.fromData
  plutToRepr :: (forall (s :: S). PLifted s PProposalProcedure)
-> Either LiftError (PlutusRepr PProposalProcedure)
plutToRepr forall (s :: S). PLifted s PProposalProcedure
t = ([Data] -> PlutusRepr PProposalProcedure)
-> Either LiftError [Data]
-> Either LiftError (PlutusRepr PProposalProcedure)
forall a b. (a -> b) -> Either LiftError a -> Either LiftError b
forall (f :: Type -> Type) a b. Functor f => (a -> b) -> f a -> f b
fmap [Data] -> PlutusRepr PProposalProcedure
[Data] -> Data
Plutus.List (Either LiftError [Data]
 -> Either LiftError (PlutusRepr PProposalProcedure))
-> Either LiftError [Data]
-> Either LiftError (PlutusRepr PProposalProcedure)
forall a b. (a -> b) -> a -> b
$ forall (a :: S -> Type).
KnownBuiltinType
  (Term DeBruijn DefaultUni DefaultFun ()) (PlutusRepr a) =>
(forall (s :: S). PLifted s a) -> Either LiftError (PlutusRepr a)
plutToReprUni @(PBuiltinList PData) ((forall (s :: S). PLifted s (PBuiltinList PData))
 -> Either LiftError (PlutusRepr (PBuiltinList PData)))
-> (forall (s :: S). PLifted s (PBuiltinList PData))
-> Either LiftError (PlutusRepr (PBuiltinList PData))
forall a b. (a -> b) -> a -> b
$ PLifted s PProposalProcedure -> PLifted s (PBuiltinList PData)
forall (s :: S) (a :: S -> Type) (b :: S -> Type).
PLifted s a -> PLifted s b
punsafeCoercePLifted PLifted s PProposalProcedure
forall (s :: S). PLifted s PProposalProcedure
t
  reprToPlut :: forall (s :: S).
PlutusRepr PProposalProcedure -> PLifted s PProposalProcedure
reprToPlut = \case
    Plutus.List [Data]
ell -> PLifted s (PBuiltinList PData) -> PLifted s PProposalProcedure
forall (s :: S) (a :: S -> Type) (b :: S -> Type).
PLifted s a -> PLifted s b
punsafeCoercePLifted (forall (a :: S -> Type) (s :: S).
Includes DefaultUni (PlutusRepr a) =>
PlutusRepr a -> PLifted s a
reprToPlutUni @(PBuiltinList PData) [Data]
PlutusRepr (PBuiltinList PData)
ell)
    PlutusRepr PProposalProcedure
_ -> [Char] -> PLifted s PProposalProcedure
forall a. HasCallStack => [Char] -> a
error [Char]
"Impossible: PProposalProcedure is list-represented."

-- | @since 3.8.0
instance PTryFrom PData (PAsData PProposalProcedure)

-- | @since 3.8.0
data PAccountBalanceInterval (s :: S)
  = PAccountBalanceLowerBound (Term s (PAsData PLovelace))
  | PAccountBalanceUpperBound (Term s (PAsData PLovelace))
  | PAccountBalanceBothBounds (Term s (PAsData PLovelace)) (Term s (PAsData PLovelace))
  | PAccountBalanceExact (Term s (PAsData PLovelace))
  deriving stock
    ( -- | @since 3.8.0
      (forall x.
 PAccountBalanceInterval s -> Rep (PAccountBalanceInterval s) x)
-> (forall x.
    Rep (PAccountBalanceInterval s) x -> PAccountBalanceInterval s)
-> Generic (PAccountBalanceInterval s)
forall x.
Rep (PAccountBalanceInterval s) x -> PAccountBalanceInterval s
forall x.
PAccountBalanceInterval s -> Rep (PAccountBalanceInterval s) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall (s :: S) x.
Rep (PAccountBalanceInterval s) x -> PAccountBalanceInterval s
forall (s :: S) x.
PAccountBalanceInterval s -> Rep (PAccountBalanceInterval s) x
$cfrom :: forall (s :: S) x.
PAccountBalanceInterval s -> Rep (PAccountBalanceInterval s) x
from :: forall x.
PAccountBalanceInterval s -> Rep (PAccountBalanceInterval s) x
$cto :: forall (s :: S) x.
Rep (PAccountBalanceInterval s) x -> PAccountBalanceInterval s
to :: forall x.
Rep (PAccountBalanceInterval s) x -> PAccountBalanceInterval s
Generic
    )
  deriving anyclass
    ( -- | @since 3.8.0
      All SListI (Code (PAccountBalanceInterval s))
All SListI (Code (PAccountBalanceInterval s)) =>
(PAccountBalanceInterval s -> Rep (PAccountBalanceInterval s))
-> (Rep (PAccountBalanceInterval s) -> PAccountBalanceInterval s)
-> Generic (PAccountBalanceInterval s)
Rep (PAccountBalanceInterval s) -> PAccountBalanceInterval s
PAccountBalanceInterval s -> Rep (PAccountBalanceInterval s)
forall a.
All SListI (Code a) =>
(a -> Rep a) -> (Rep a -> a) -> Generic a
forall (s :: S). All SListI (Code (PAccountBalanceInterval s))
forall (s :: S).
Rep (PAccountBalanceInterval s) -> PAccountBalanceInterval s
forall (s :: S).
PAccountBalanceInterval s -> Rep (PAccountBalanceInterval s)
$cfrom :: forall (s :: S).
PAccountBalanceInterval s -> Rep (PAccountBalanceInterval s)
from :: PAccountBalanceInterval s -> Rep (PAccountBalanceInterval s)
$cto :: forall (s :: S).
Rep (PAccountBalanceInterval s) -> PAccountBalanceInterval s
to :: Rep (PAccountBalanceInterval s) -> PAccountBalanceInterval s
SOP.Generic
    , -- | @since 3.8.0
      (forall (s :: S).
 Term s (PAsData PAccountBalanceInterval)
 -> Term s PAccountBalanceInterval)
-> (forall (s :: S).
    Term s PAccountBalanceInterval -> Term s PData)
-> PIsData PAccountBalanceInterval
forall (s :: S).
Term s (PAsData PAccountBalanceInterval)
-> Term s PAccountBalanceInterval
forall (s :: S). Term s PAccountBalanceInterval -> Term s PData
forall (a :: S -> Type).
(forall (s :: S). Term s (PAsData a) -> Term s a)
-> (forall (s :: S). Term s a -> Term s PData) -> PIsData a
$cpfromDataImpl :: forall (s :: S).
Term s (PAsData PAccountBalanceInterval)
-> Term s PAccountBalanceInterval
pfromDataImpl :: forall (s :: S).
Term s (PAsData PAccountBalanceInterval)
-> Term s PAccountBalanceInterval
$cpdataImpl :: forall (s :: S). Term s PAccountBalanceInterval -> Term s PData
pdataImpl :: forall (s :: S). Term s PAccountBalanceInterval -> Term s PData
PIsData
    , -- | @since 3.8.0
      (forall (s :: S).
 Term s PAccountBalanceInterval
 -> Term s PAccountBalanceInterval -> Term s PBool)
-> PEq PAccountBalanceInterval
forall (s :: S).
Term s PAccountBalanceInterval
-> Term s PAccountBalanceInterval -> Term s PBool
forall (t :: S -> Type).
(forall (s :: S). Term s t -> Term s t -> Term s PBool) -> PEq t
$c#== :: forall (s :: S).
Term s PAccountBalanceInterval
-> Term s PAccountBalanceInterval -> Term s PBool
#== :: forall (s :: S).
Term s PAccountBalanceInterval
-> Term s PAccountBalanceInterval -> Term s PBool
PEq
    , -- | @since 3.8.0
      (forall (s :: S).
 Bool -> Term s PAccountBalanceInterval -> Term s PString)
-> PShow PAccountBalanceInterval
forall (s :: S).
Bool -> Term s PAccountBalanceInterval -> Term s PString
forall (t :: S -> Type).
(forall (s :: S). Bool -> Term s t -> Term s PString) -> PShow t
$cpshow' :: forall (s :: S).
Bool -> Term s PAccountBalanceInterval -> Term s PString
pshow' :: forall (s :: S).
Bool -> Term s PAccountBalanceInterval -> Term s PString
PShow
    )
  deriving
    ( -- | @since 3.8.0
      (forall (s :: S).
 PAccountBalanceInterval s
 -> Term s (PInner PAccountBalanceInterval))
-> (forall (s :: S) (b :: S -> Type).
    Term s (PInner PAccountBalanceInterval)
    -> (PAccountBalanceInterval s -> Term s b) -> Term s b)
-> PlutusType PAccountBalanceInterval
forall (s :: S).
PAccountBalanceInterval s
-> Term s (PInner PAccountBalanceInterval)
forall (s :: S) (b :: S -> Type).
Term s (PInner PAccountBalanceInterval)
-> (PAccountBalanceInterval s -> Term s b) -> Term s b
forall (a :: S -> Type).
(forall (s :: S). a s -> Term s (PInner a))
-> (forall (s :: S) (b :: S -> Type).
    Term s (PInner a) -> (a s -> Term s b) -> Term s b)
-> PlutusType a
$cpcon' :: forall (s :: S).
PAccountBalanceInterval s
-> Term s (PInner PAccountBalanceInterval)
pcon' :: forall (s :: S).
PAccountBalanceInterval s
-> Term s (PInner PAccountBalanceInterval)
$cpmatch' :: forall (s :: S) (b :: S -> Type).
Term s (PInner PAccountBalanceInterval)
-> (PAccountBalanceInterval s -> Term s b) -> Term s b
pmatch' :: forall (s :: S) (b :: S -> Type).
Term s (PInner PAccountBalanceInterval)
-> (PAccountBalanceInterval s -> Term s b) -> Term s b
PlutusType
    , -- | @since 3.8.0
      (forall (s :: S).
 Term s PData -> forall (r :: S -> Type). Term s r -> Term s r)
-> PValidateData PAccountBalanceInterval
forall (s :: S).
Term s PData -> forall (r :: S -> Type). Term s r -> Term s r
forall (a :: S -> Type).
(forall (s :: S).
 Term s PData -> forall (r :: S -> Type). Term s r -> Term s r)
-> PValidateData a
$cpwithValidated :: forall (s :: S).
Term s PData -> forall (r :: S -> Type). Term s r -> Term s r
pwithValidated :: forall (s :: S).
Term s PData -> forall (r :: S -> Type). Term s r -> Term s r
PValidateData
    )
    via (DeriveAsDataStruct PAccountBalanceInterval)

-- | @since 3.8.0
deriving via
  DeriveDataPLiftable PAccountBalanceInterval Plutus.AccountBalanceInterval
  instance
    PLiftable PAccountBalanceInterval

-- | @since 3.8.0
instance PTryFrom PData (PAsData PAccountBalanceInterval)

-- | @since 3.8.0
newtype PAccountBalanceIntervals (s :: S)
  = PAccountBalanceIntervals (Term s (PUnsortedMap PAccountId PAccountBalanceInterval))
  deriving stock
    ( -- | @since 3.8.0
      (forall x.
 PAccountBalanceIntervals s -> Rep (PAccountBalanceIntervals s) x)
-> (forall x.
    Rep (PAccountBalanceIntervals s) x -> PAccountBalanceIntervals s)
-> Generic (PAccountBalanceIntervals s)
forall x.
Rep (PAccountBalanceIntervals s) x -> PAccountBalanceIntervals s
forall x.
PAccountBalanceIntervals s -> Rep (PAccountBalanceIntervals s) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall (s :: S) x.
Rep (PAccountBalanceIntervals s) x -> PAccountBalanceIntervals s
forall (s :: S) x.
PAccountBalanceIntervals s -> Rep (PAccountBalanceIntervals s) x
$cfrom :: forall (s :: S) x.
PAccountBalanceIntervals s -> Rep (PAccountBalanceIntervals s) x
from :: forall x.
PAccountBalanceIntervals s -> Rep (PAccountBalanceIntervals s) x
$cto :: forall (s :: S) x.
Rep (PAccountBalanceIntervals s) x -> PAccountBalanceIntervals s
to :: forall x.
Rep (PAccountBalanceIntervals s) x -> PAccountBalanceIntervals s
Generic
    )
  deriving anyclass
    ( -- | @since 3.8.0
      All SListI (Code (PAccountBalanceIntervals s))
All SListI (Code (PAccountBalanceIntervals s)) =>
(PAccountBalanceIntervals s -> Rep (PAccountBalanceIntervals s))
-> (Rep (PAccountBalanceIntervals s) -> PAccountBalanceIntervals s)
-> Generic (PAccountBalanceIntervals s)
Rep (PAccountBalanceIntervals s) -> PAccountBalanceIntervals s
PAccountBalanceIntervals s -> Rep (PAccountBalanceIntervals s)
forall a.
All SListI (Code a) =>
(a -> Rep a) -> (Rep a -> a) -> Generic a
forall (s :: S). All SListI (Code (PAccountBalanceIntervals s))
forall (s :: S).
Rep (PAccountBalanceIntervals s) -> PAccountBalanceIntervals s
forall (s :: S).
PAccountBalanceIntervals s -> Rep (PAccountBalanceIntervals s)
$cfrom :: forall (s :: S).
PAccountBalanceIntervals s -> Rep (PAccountBalanceIntervals s)
from :: PAccountBalanceIntervals s -> Rep (PAccountBalanceIntervals s)
$cto :: forall (s :: S).
Rep (PAccountBalanceIntervals s) -> PAccountBalanceIntervals s
to :: Rep (PAccountBalanceIntervals s) -> PAccountBalanceIntervals s
SOP.Generic
    , -- | @since 3.8.0
      (forall (s :: S).
 Bool -> Term s PAccountBalanceIntervals -> Term s PString)
-> PShow PAccountBalanceIntervals
forall (s :: S).
Bool -> Term s PAccountBalanceIntervals -> Term s PString
forall (t :: S -> Type).
(forall (s :: S). Bool -> Term s t -> Term s PString) -> PShow t
$cpshow' :: forall (s :: S).
Bool -> Term s PAccountBalanceIntervals -> Term s PString
pshow' :: forall (s :: S).
Bool -> Term s PAccountBalanceIntervals -> Term s PString
PShow
    )
  deriving
    ( -- | @since 3.8.0
      (forall (s :: S).
 PAccountBalanceIntervals s
 -> Term s (PInner PAccountBalanceIntervals))
-> (forall (s :: S) (b :: S -> Type).
    Term s (PInner PAccountBalanceIntervals)
    -> (PAccountBalanceIntervals s -> Term s b) -> Term s b)
-> PlutusType PAccountBalanceIntervals
forall (s :: S).
PAccountBalanceIntervals s
-> Term s (PInner PAccountBalanceIntervals)
forall (s :: S) (b :: S -> Type).
Term s (PInner PAccountBalanceIntervals)
-> (PAccountBalanceIntervals s -> Term s b) -> Term s b
forall (a :: S -> Type).
(forall (s :: S). a s -> Term s (PInner a))
-> (forall (s :: S) (b :: S -> Type).
    Term s (PInner a) -> (a s -> Term s b) -> Term s b)
-> PlutusType a
$cpcon' :: forall (s :: S).
PAccountBalanceIntervals s
-> Term s (PInner PAccountBalanceIntervals)
pcon' :: forall (s :: S).
PAccountBalanceIntervals s
-> Term s (PInner PAccountBalanceIntervals)
$cpmatch' :: forall (s :: S) (b :: S -> Type).
Term s (PInner PAccountBalanceIntervals)
-> (PAccountBalanceIntervals s -> Term s b) -> Term s b
pmatch' :: forall (s :: S) (b :: S -> Type).
Term s (PInner PAccountBalanceIntervals)
-> (PAccountBalanceIntervals s -> Term s b) -> Term s b
PlutusType
    )
    via (DeriveNewtypePlutusType PAccountBalanceIntervals)
  deriving
    ( -- | @since 3.8.0
      (forall (s :: S).
 Term s PData -> forall (r :: S -> Type). Term s r -> Term s r)
-> PValidateData PAccountBalanceIntervals
forall (s :: S).
Term s PData -> forall (r :: S -> Type). Term s r -> Term s r
forall (a :: S -> Type).
(forall (s :: S).
 Term s PData -> forall (r :: S -> Type). Term s r -> Term s r)
-> PValidateData a
$cpwithValidated :: forall (s :: S).
Term s PData -> forall (r :: S -> Type). Term s r -> Term s r
pwithValidated :: forall (s :: S).
Term s PData -> forall (r :: S -> Type). Term s r -> Term s r
PValidateData
    )
    via (DeriveNewtypePValidateData PAccountBalanceIntervals (PUnsortedMap PAccountId PAccountBalanceInterval))

-- | @since 3.8.0
instance PIsData PAccountBalanceIntervals where
  pfromDataImpl :: forall (s :: S).
Term s (PAsData PAccountBalanceIntervals)
-> Term s PAccountBalanceIntervals
pfromDataImpl Term s (PAsData PAccountBalanceIntervals)
x = Term s (PBuiltinList (PBuiltinPair PData PData))
-> Term s PAccountBalanceIntervals
forall (b :: S -> Type) (a :: S -> Type) (s :: S).
Term s a -> Term s b
punsafeCoerce (Term s (PBuiltinList (PBuiltinPair PData PData))
 -> Term s PAccountBalanceIntervals)
-> Term s (PBuiltinList (PBuiltinPair PData PData))
-> Term s PAccountBalanceIntervals
forall a b. (a -> b) -> a -> b
$ Term s (PData :--> PBuiltinList (PBuiltinPair PData PData))
forall (s :: S).
Term s (PData :--> PBuiltinList (PBuiltinPair PData PData))
pasMap Term s (PData :--> PBuiltinList (PBuiltinPair PData PData))
-> Term s PData -> Term s (PBuiltinList (PBuiltinPair PData PData))
forall (s :: S) (a :: S -> Type) (b :: S -> Type).
Term s (a :--> b) -> Term s a -> Term s b
# Term s (PAsData PAccountBalanceIntervals) -> Term s PData
forall (s :: S) (a :: S -> Type).
Term s (PAsData a) -> Term s PData
pforgetData Term s (PAsData PAccountBalanceIntervals)
x
  pdataImpl :: forall (s :: S). Term s PAccountBalanceIntervals -> Term s PData
pdataImpl Term s PAccountBalanceIntervals
x = DefaultFun -> Term s (PAccountBalanceIntervals :--> PData)
forall (s :: S) (a :: S -> Type). DefaultFun -> Term s a
punsafeBuiltin DefaultFun
PLC.MapData Term s (PAccountBalanceIntervals :--> PData)
-> Term s PAccountBalanceIntervals -> Term s PData
forall (s :: S) (a :: S -> Type) (b :: S -> Type).
Term s (a :--> b) -> Term s a -> Term s b
# Term s PAccountBalanceIntervals
x

-- | @since 3.8.0
instance PLiftable PAccountBalanceIntervals where
  type AsHaskell PAccountBalanceIntervals = Plutus.AccountBalanceIntervals
  type PlutusRepr PAccountBalanceIntervals = [(Plutus.Data, Plutus.Data)]
  haskToRepr :: AsHaskell PAccountBalanceIntervals
-> PlutusRepr PAccountBalanceIntervals
haskToRepr (Plutus.AccountBalanceIntervals Map AccountId AccountBalanceInterval
m) =
    ((AccountId, AccountBalanceInterval) -> (Data, Data))
-> [(AccountId, AccountBalanceInterval)] -> [(Data, Data)]
forall a b. (a -> b) -> [a] -> [b]
forall (f :: Type -> Type) a b. Functor f => (a -> b) -> f a -> f b
fmap ((AccountId -> Data)
-> (AccountBalanceInterval -> Data)
-> (AccountId, AccountBalanceInterval)
-> (Data, Data)
forall a b c d. (a -> b) -> (c -> d) -> (a, c) -> (b, d)
forall (p :: Type -> Type -> Type) a b c d.
Bifunctor p =>
(a -> b) -> (c -> d) -> p a c -> p b d
bimap AccountId -> Data
forall a. ToData a => a -> Data
Plutus.toData AccountBalanceInterval -> Data
forall a. ToData a => a -> Data
Plutus.toData) ([(AccountId, AccountBalanceInterval)]
 -> PlutusRepr PAccountBalanceIntervals)
-> (Map AccountId AccountBalanceInterval
    -> [(AccountId, AccountBalanceInterval)])
-> Map AccountId AccountBalanceInterval
-> PlutusRepr PAccountBalanceIntervals
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Map AccountId AccountBalanceInterval
-> [(AccountId, AccountBalanceInterval)]
forall k v. Map k v -> [(k, v)]
PlutusMap.toList (Map AccountId AccountBalanceInterval
 -> PlutusRepr PAccountBalanceIntervals)
-> Map AccountId AccountBalanceInterval
-> PlutusRepr PAccountBalanceIntervals
forall a b. (a -> b) -> a -> b
$ Map AccountId AccountBalanceInterval
m
  reprToHask :: PlutusRepr PAccountBalanceIntervals
-> Either LiftError (AsHaskell PAccountBalanceIntervals)
reprToHask PlutusRepr PAccountBalanceIntervals
x =
    Map AccountId AccountBalanceInterval -> AccountBalanceIntervals
Plutus.AccountBalanceIntervals (Map AccountId AccountBalanceInterval -> AccountBalanceIntervals)
-> ([(AccountId, AccountBalanceInterval)]
    -> Map AccountId AccountBalanceInterval)
-> [(AccountId, AccountBalanceInterval)]
-> AccountBalanceIntervals
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [(AccountId, AccountBalanceInterval)]
-> Map AccountId AccountBalanceInterval
forall k v. [(k, v)] -> Map k v
PlutusMap.unsafeFromList
      ([(AccountId, AccountBalanceInterval)] -> AccountBalanceIntervals)
-> Either LiftError [(AccountId, AccountBalanceInterval)]
-> Either LiftError AccountBalanceIntervals
forall (f :: Type -> Type) a b. Functor f => (a -> b) -> f a -> f b
<$> ((Data, Data)
 -> Either LiftError (AccountId, AccountBalanceInterval))
-> [(Data, Data)]
-> Either LiftError [(AccountId, AccountBalanceInterval)]
forall (t :: Type -> Type) (f :: Type -> Type) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
forall (f :: Type -> Type) a b.
Applicative f =>
(a -> f b) -> [a] -> f [b]
traverse
        ( \(Data
k, Data
v) ->
            (,)
              (AccountId
 -> AccountBalanceInterval -> (AccountId, AccountBalanceInterval))
-> Either LiftError AccountId
-> Either
     LiftError
     (AccountBalanceInterval -> (AccountId, AccountBalanceInterval))
forall (f :: Type -> Type) a b. Functor f => (a -> b) -> f a -> f b
<$> (Either LiftError AccountId
-> (AccountId -> Either LiftError AccountId)
-> Maybe AccountId
-> Either LiftError AccountId
forall b a. b -> (a -> b) -> Maybe a -> b
maybe (LiftError -> Either LiftError AccountId
forall a b. a -> Either a b
Left LiftError
CouldNotDecodeData) AccountId -> Either LiftError AccountId
forall a b. b -> Either a b
Right (Maybe AccountId -> Either LiftError AccountId)
-> (Data -> Maybe AccountId) -> Data -> Either LiftError AccountId
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Data -> Maybe AccountId
forall a. FromData a => Data -> Maybe a
Plutus.fromData) Data
k
              Either
  LiftError
  (AccountBalanceInterval -> (AccountId, AccountBalanceInterval))
-> Either LiftError AccountBalanceInterval
-> Either LiftError (AccountId, AccountBalanceInterval)
forall a b.
Either LiftError (a -> b)
-> Either LiftError a -> Either LiftError b
forall (f :: Type -> Type) a b.
Applicative f =>
f (a -> b) -> f a -> f b
<*> (Either LiftError AccountBalanceInterval
-> (AccountBalanceInterval
    -> Either LiftError AccountBalanceInterval)
-> Maybe AccountBalanceInterval
-> Either LiftError AccountBalanceInterval
forall b a. b -> (a -> b) -> Maybe a -> b
maybe (LiftError -> Either LiftError AccountBalanceInterval
forall a b. a -> Either a b
Left LiftError
CouldNotDecodeData) AccountBalanceInterval -> Either LiftError AccountBalanceInterval
forall a b. b -> Either a b
Right (Maybe AccountBalanceInterval
 -> Either LiftError AccountBalanceInterval)
-> (Data -> Maybe AccountBalanceInterval)
-> Data
-> Either LiftError AccountBalanceInterval
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Data -> Maybe AccountBalanceInterval
forall a. FromData a => Data -> Maybe a
Plutus.fromData) Data
v
        )
        [(Data, Data)]
PlutusRepr PAccountBalanceIntervals
x
  reprToPlut :: forall (s :: S).
PlutusRepr PAccountBalanceIntervals
-> PLifted s PAccountBalanceIntervals
reprToPlut = PlutusRepr PAccountBalanceIntervals
-> PLifted s PAccountBalanceIntervals
forall (a :: S -> Type) (s :: S).
Includes DefaultUni (PlutusRepr a) =>
PlutusRepr a -> PLifted s a
reprToPlutUni
  plutToRepr :: (forall (s :: S). PLifted s PAccountBalanceIntervals)
-> Either LiftError (PlutusRepr PAccountBalanceIntervals)
plutToRepr = (forall (s :: S). PLifted s PAccountBalanceIntervals)
-> Either LiftError (PlutusRepr PAccountBalanceIntervals)
forall (a :: S -> Type).
KnownBuiltinType
  (Term DeBruijn DefaultUni DefaultFun ()) (PlutusRepr a) =>
(forall (s :: S). PLifted s a) -> Either LiftError (PlutusRepr a)
plutToReprUni

-- | @since 3.8.0
instance PTryFrom PData (PAsData PAccountBalanceIntervals)

-- | @since 3.8.0
data PTxCert (s :: S)
  = PTxCertRegAccount (Term s (PAsData PAccountId)) (Term s (PAsData PLovelace))
  | PTxCertUnRegAccount (Term s (PAsData PAccountId)) (Term s (PAsData PLovelace))
  | PTxCertDelegAccount (Term s (PAsData PAccountId)) (Term s (PAsData PDelegatee))
  | PTxCertRegAccountDeleg (Term s (PAsData PAccountId)) (Term s (PAsData PDelegatee)) (Term s (PAsData PLovelace))
  | PTxCertRegDRep (Term s (PAsData PDRepCredential)) (Term s (PAsData PLovelace))
  | PTxCertUpdateDRep (Term s (PAsData PDRepCredential))
  | PTxCertUnRegDRep (Term s (PAsData PDRepCredential)) (Term s (PAsData PLovelace))
  | PTxCertPoolRegister (Term s (PAsData PPubKeyHash)) (Term s (PAsData PPubKeyHash))
  | PTxCertPoolRetire (Term s (PAsData PPubKeyHash)) (Term s (PAsData PInteger))
  | PTxCertAuthHotCommittee (Term s (PAsData PColdCommitteeCredential)) (Term s (PAsData PHotCommitteeCredential))
  | PTxCertResignColdCommittee (Term s (PAsData PColdCommitteeCredential))
  deriving stock
    ( -- | @since 3.8.0
      (forall x. PTxCert s -> Rep (PTxCert s) x)
-> (forall x. Rep (PTxCert s) x -> PTxCert s)
-> Generic (PTxCert s)
forall x. Rep (PTxCert s) x -> PTxCert s
forall x. PTxCert s -> Rep (PTxCert s) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall (s :: S) x. Rep (PTxCert s) x -> PTxCert s
forall (s :: S) x. PTxCert s -> Rep (PTxCert s) x
$cfrom :: forall (s :: S) x. PTxCert s -> Rep (PTxCert s) x
from :: forall x. PTxCert s -> Rep (PTxCert s) x
$cto :: forall (s :: S) x. Rep (PTxCert s) x -> PTxCert s
to :: forall x. Rep (PTxCert s) x -> PTxCert s
Generic
    )
  deriving anyclass
    ( -- | @since 3.8.0
      All SListI (Code (PTxCert s))
All SListI (Code (PTxCert s)) =>
(PTxCert s -> Rep (PTxCert s))
-> (Rep (PTxCert s) -> PTxCert s) -> Generic (PTxCert s)
Rep (PTxCert s) -> PTxCert s
PTxCert s -> Rep (PTxCert s)
forall a.
All SListI (Code a) =>
(a -> Rep a) -> (Rep a -> a) -> Generic a
forall (s :: S). All SListI (Code (PTxCert s))
forall (s :: S). Rep (PTxCert s) -> PTxCert s
forall (s :: S). PTxCert s -> Rep (PTxCert s)
$cfrom :: forall (s :: S). PTxCert s -> Rep (PTxCert s)
from :: PTxCert s -> Rep (PTxCert s)
$cto :: forall (s :: S). Rep (PTxCert s) -> PTxCert s
to :: Rep (PTxCert s) -> PTxCert s
SOP.Generic
    , -- | @since 3.8.0
      (forall (s :: S). Term s (PAsData PTxCert) -> Term s PTxCert)
-> (forall (s :: S). Term s PTxCert -> Term s PData)
-> PIsData PTxCert
forall (s :: S). Term s (PAsData PTxCert) -> Term s PTxCert
forall (s :: S). Term s PTxCert -> Term s PData
forall (a :: S -> Type).
(forall (s :: S). Term s (PAsData a) -> Term s a)
-> (forall (s :: S). Term s a -> Term s PData) -> PIsData a
$cpfromDataImpl :: forall (s :: S). Term s (PAsData PTxCert) -> Term s PTxCert
pfromDataImpl :: forall (s :: S). Term s (PAsData PTxCert) -> Term s PTxCert
$cpdataImpl :: forall (s :: S). Term s PTxCert -> Term s PData
pdataImpl :: forall (s :: S). Term s PTxCert -> Term s PData
PIsData
    , -- | @since 3.8.0
      (forall (s :: S). Term s PTxCert -> Term s PTxCert -> Term s PBool)
-> PEq PTxCert
forall (s :: S). Term s PTxCert -> Term s PTxCert -> Term s PBool
forall (t :: S -> Type).
(forall (s :: S). Term s t -> Term s t -> Term s PBool) -> PEq t
$c#== :: forall (s :: S). Term s PTxCert -> Term s PTxCert -> Term s PBool
#== :: forall (s :: S). Term s PTxCert -> Term s PTxCert -> Term s PBool
PEq
    , -- | @since 3.8.0
      (forall (s :: S). Bool -> Term s PTxCert -> Term s PString)
-> PShow PTxCert
forall (s :: S). Bool -> Term s PTxCert -> Term s PString
forall (t :: S -> Type).
(forall (s :: S). Bool -> Term s t -> Term s PString) -> PShow t
$cpshow' :: forall (s :: S). Bool -> Term s PTxCert -> Term s PString
pshow' :: forall (s :: S). Bool -> Term s PTxCert -> Term s PString
PShow
    )
  deriving
    ( -- | @since 3.8.0
      (forall (s :: S). PTxCert s -> Term s (PInner PTxCert))
-> (forall (s :: S) (b :: S -> Type).
    Term s (PInner PTxCert) -> (PTxCert s -> Term s b) -> Term s b)
-> PlutusType PTxCert
forall (s :: S). PTxCert s -> Term s (PInner PTxCert)
forall (s :: S) (b :: S -> Type).
Term s (PInner PTxCert) -> (PTxCert s -> Term s b) -> Term s b
forall (a :: S -> Type).
(forall (s :: S). a s -> Term s (PInner a))
-> (forall (s :: S) (b :: S -> Type).
    Term s (PInner a) -> (a s -> Term s b) -> Term s b)
-> PlutusType a
$cpcon' :: forall (s :: S). PTxCert s -> Term s (PInner PTxCert)
pcon' :: forall (s :: S). PTxCert s -> Term s (PInner PTxCert)
$cpmatch' :: forall (s :: S) (b :: S -> Type).
Term s (PInner PTxCert) -> (PTxCert s -> Term s b) -> Term s b
pmatch' :: forall (s :: S) (b :: S -> Type).
Term s (PInner PTxCert) -> (PTxCert s -> Term s b) -> Term s b
PlutusType
    , -- | @since 3.8.0
      (forall (s :: S).
 Term s PData -> forall (r :: S -> Type). Term s r -> Term s r)
-> PValidateData PTxCert
forall (s :: S).
Term s PData -> forall (r :: S -> Type). Term s r -> Term s r
forall (a :: S -> Type).
(forall (s :: S).
 Term s PData -> forall (r :: S -> Type). Term s r -> Term s r)
-> PValidateData a
$cpwithValidated :: forall (s :: S).
Term s PData -> forall (r :: S -> Type). Term s r -> Term s r
pwithValidated :: forall (s :: S).
Term s PData -> forall (r :: S -> Type). Term s r -> Term s r
PValidateData
    )
    via (DeriveAsDataStruct PTxCert)

-- | @since 3.8.0
deriving via
  DeriveDataPLiftable PTxCert Plutus.TxCert
  instance
    PLiftable PTxCert

-- | @since 3.8.0
instance PTryFrom PData (PAsData PTxCert)

-- | @since 3.8.0
data PScriptPurpose (s :: S)
  = PMinting (Term s (PAsData PScriptHash)) (Term s (PAsData PCurrencySymbol))
  | PSpending (Term s (PAsData PScriptHash)) (Term s (PAsData PTxOutRef))
  | PWithdrawing (Term s (PAsData PScriptHash)) (Term s (PAsData PCredential))
  | PCertifying (Term s (PAsData PScriptHash)) (Term s (PAsData PInteger)) (Term s (PAsData PTxCert))
  | PVoting (Term s (PAsData PScriptHash)) (Term s (PAsData PVoter))
  | PProposing (Term s (PAsData PScriptHash)) (Term s (PAsData PInteger)) (Term s (PAsData PProposalProcedure))
  | PGuarding (Term s (PAsData PScriptHash)) (Term s (PAsData PInteger))
  deriving stock
    ( -- | @since 3.8.0
      (forall x. PScriptPurpose s -> Rep (PScriptPurpose s) x)
-> (forall x. Rep (PScriptPurpose s) x -> PScriptPurpose s)
-> Generic (PScriptPurpose s)
forall x. Rep (PScriptPurpose s) x -> PScriptPurpose s
forall x. PScriptPurpose s -> Rep (PScriptPurpose s) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall (s :: S) x. Rep (PScriptPurpose s) x -> PScriptPurpose s
forall (s :: S) x. PScriptPurpose s -> Rep (PScriptPurpose s) x
$cfrom :: forall (s :: S) x. PScriptPurpose s -> Rep (PScriptPurpose s) x
from :: forall x. PScriptPurpose s -> Rep (PScriptPurpose s) x
$cto :: forall (s :: S) x. Rep (PScriptPurpose s) x -> PScriptPurpose s
to :: forall x. Rep (PScriptPurpose s) x -> PScriptPurpose s
Generic
    )
  deriving anyclass
    ( -- | @since 3.8.0
      All SListI (Code (PScriptPurpose s))
All SListI (Code (PScriptPurpose s)) =>
(PScriptPurpose s -> Rep (PScriptPurpose s))
-> (Rep (PScriptPurpose s) -> PScriptPurpose s)
-> Generic (PScriptPurpose s)
Rep (PScriptPurpose s) -> PScriptPurpose s
PScriptPurpose s -> Rep (PScriptPurpose s)
forall a.
All SListI (Code a) =>
(a -> Rep a) -> (Rep a -> a) -> Generic a
forall (s :: S). All SListI (Code (PScriptPurpose s))
forall (s :: S). Rep (PScriptPurpose s) -> PScriptPurpose s
forall (s :: S). PScriptPurpose s -> Rep (PScriptPurpose s)
$cfrom :: forall (s :: S). PScriptPurpose s -> Rep (PScriptPurpose s)
from :: PScriptPurpose s -> Rep (PScriptPurpose s)
$cto :: forall (s :: S). Rep (PScriptPurpose s) -> PScriptPurpose s
to :: Rep (PScriptPurpose s) -> PScriptPurpose s
SOP.Generic
    , -- | @since 3.8.0
      (forall (s :: S).
 Term s (PAsData PScriptPurpose) -> Term s PScriptPurpose)
-> (forall (s :: S). Term s PScriptPurpose -> Term s PData)
-> PIsData PScriptPurpose
forall (s :: S).
Term s (PAsData PScriptPurpose) -> Term s PScriptPurpose
forall (s :: S). Term s PScriptPurpose -> Term s PData
forall (a :: S -> Type).
(forall (s :: S). Term s (PAsData a) -> Term s a)
-> (forall (s :: S). Term s a -> Term s PData) -> PIsData a
$cpfromDataImpl :: forall (s :: S).
Term s (PAsData PScriptPurpose) -> Term s PScriptPurpose
pfromDataImpl :: forall (s :: S).
Term s (PAsData PScriptPurpose) -> Term s PScriptPurpose
$cpdataImpl :: forall (s :: S). Term s PScriptPurpose -> Term s PData
pdataImpl :: forall (s :: S). Term s PScriptPurpose -> Term s PData
PIsData
    , -- | @since 3.8.0
      (forall (s :: S).
 Term s PScriptPurpose -> Term s PScriptPurpose -> Term s PBool)
-> PEq PScriptPurpose
forall (s :: S).
Term s PScriptPurpose -> Term s PScriptPurpose -> Term s PBool
forall (t :: S -> Type).
(forall (s :: S). Term s t -> Term s t -> Term s PBool) -> PEq t
$c#== :: forall (s :: S).
Term s PScriptPurpose -> Term s PScriptPurpose -> Term s PBool
#== :: forall (s :: S).
Term s PScriptPurpose -> Term s PScriptPurpose -> Term s PBool
PEq
    , -- | @since 3.8.0
      (forall (s :: S). Bool -> Term s PScriptPurpose -> Term s PString)
-> PShow PScriptPurpose
forall (s :: S). Bool -> Term s PScriptPurpose -> Term s PString
forall (t :: S -> Type).
(forall (s :: S). Bool -> Term s t -> Term s PString) -> PShow t
$cpshow' :: forall (s :: S). Bool -> Term s PScriptPurpose -> Term s PString
pshow' :: forall (s :: S). Bool -> Term s PScriptPurpose -> Term s PString
PShow
    )
  deriving
    ( -- | @since 3.8.0
      (forall (s :: S).
 PScriptPurpose s -> Term s (PInner PScriptPurpose))
-> (forall (s :: S) (b :: S -> Type).
    Term s (PInner PScriptPurpose)
    -> (PScriptPurpose s -> Term s b) -> Term s b)
-> PlutusType PScriptPurpose
forall (s :: S). PScriptPurpose s -> Term s (PInner PScriptPurpose)
forall (s :: S) (b :: S -> Type).
Term s (PInner PScriptPurpose)
-> (PScriptPurpose s -> Term s b) -> Term s b
forall (a :: S -> Type).
(forall (s :: S). a s -> Term s (PInner a))
-> (forall (s :: S) (b :: S -> Type).
    Term s (PInner a) -> (a s -> Term s b) -> Term s b)
-> PlutusType a
$cpcon' :: forall (s :: S). PScriptPurpose s -> Term s (PInner PScriptPurpose)
pcon' :: forall (s :: S). PScriptPurpose s -> Term s (PInner PScriptPurpose)
$cpmatch' :: forall (s :: S) (b :: S -> Type).
Term s (PInner PScriptPurpose)
-> (PScriptPurpose s -> Term s b) -> Term s b
pmatch' :: forall (s :: S) (b :: S -> Type).
Term s (PInner PScriptPurpose)
-> (PScriptPurpose s -> Term s b) -> Term s b
PlutusType
    , -- | @since 3.8.0
      (forall (s :: S).
 Term s PData -> forall (r :: S -> Type). Term s r -> Term s r)
-> PValidateData PScriptPurpose
forall (s :: S).
Term s PData -> forall (r :: S -> Type). Term s r -> Term s r
forall (a :: S -> Type).
(forall (s :: S).
 Term s PData -> forall (r :: S -> Type). Term s r -> Term s r)
-> PValidateData a
$cpwithValidated :: forall (s :: S).
Term s PData -> forall (r :: S -> Type). Term s r -> Term s r
pwithValidated :: forall (s :: S).
Term s PData -> forall (r :: S -> Type). Term s r -> Term s r
PValidateData
    )
    via (DeriveAsDataStruct PScriptPurpose)

-- | @since 3.8.0
deriving via
  DeriveDataPLiftable PScriptPurpose Plutus.ScriptPurpose
  instance
    PLiftable PScriptPurpose

-- | @since 3.8.0
instance PTryFrom PData (PAsData PScriptPurpose)

-- | @since 3.8.0
data PTxInInfo (s :: S) = PTxInInfo
  { forall (s :: S). PTxInInfo s -> Term s (PAsData PTxOutRef)
ptxInInfo'outRef :: Term s (PAsData PTxOutRef)
  , forall (s :: S). PTxInInfo s -> Term s (PAsData PTxOut)
ptxInInfo'resolved :: Term s (PAsData PTxOut)
  }
  deriving stock
    ( -- | @since 3.8.0
      (forall x. PTxInInfo s -> Rep (PTxInInfo s) x)
-> (forall x. Rep (PTxInInfo s) x -> PTxInInfo s)
-> Generic (PTxInInfo s)
forall x. Rep (PTxInInfo s) x -> PTxInInfo s
forall x. PTxInInfo s -> Rep (PTxInInfo s) x
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
$cfrom :: forall (s :: S) x. PTxInInfo s -> Rep (PTxInInfo s) x
from :: forall x. PTxInInfo s -> Rep (PTxInInfo s) x
$cto :: forall (s :: S) x. Rep (PTxInInfo s) x -> PTxInInfo s
to :: forall x. Rep (PTxInInfo s) x -> PTxInInfo s
Generic
    )
  deriving anyclass
    ( -- | @since 3.8.0
      All SListI (Code (PTxInInfo s))
All SListI (Code (PTxInInfo s)) =>
(PTxInInfo s -> Rep (PTxInInfo s))
-> (Rep (PTxInInfo s) -> PTxInInfo s) -> Generic (PTxInInfo s)
Rep (PTxInInfo s) -> PTxInInfo s
PTxInInfo s -> Rep (PTxInInfo s)
forall a.
All SListI (Code a) =>
(a -> Rep a) -> (Rep a -> a) -> Generic a
forall (s :: S). All SListI (Code (PTxInInfo s))
forall (s :: S). Rep (PTxInInfo s) -> PTxInInfo s
forall (s :: S). PTxInInfo s -> Rep (PTxInInfo s)
$cfrom :: forall (s :: S). PTxInInfo s -> Rep (PTxInInfo s)
from :: PTxInInfo s -> Rep (PTxInInfo s)
$cto :: forall (s :: S). Rep (PTxInInfo s) -> PTxInInfo s
to :: Rep (PTxInInfo s) -> PTxInInfo s
SOP.Generic
    , -- | @since 3.8.0
      (forall (s :: S). Term s (PAsData PTxInInfo) -> Term s PTxInInfo)
-> (forall (s :: S). Term s PTxInInfo -> Term s PData)
-> PIsData PTxInInfo
forall (s :: S). Term s (PAsData PTxInInfo) -> Term s PTxInInfo
forall (s :: S). Term s PTxInInfo -> Term s PData
forall (a :: S -> Type).
(forall (s :: S). Term s (PAsData a) -> Term s a)
-> (forall (s :: S). Term s a -> Term s PData) -> PIsData a
$cpfromDataImpl :: forall (s :: S). Term s (PAsData PTxInInfo) -> Term s PTxInInfo
pfromDataImpl :: forall (s :: S). Term s (PAsData PTxInInfo) -> Term s PTxInInfo
$cpdataImpl :: forall (s :: S). Term s PTxInInfo -> Term s PData
pdataImpl :: forall (s :: S). Term s PTxInInfo -> Term s PData
PIsData
    , -- | @since 3.8.0
      (forall (s :: S).
 Term s PTxInInfo -> Term s PTxInInfo -> Term s PBool)
-> PEq PTxInInfo
forall (s :: S).
Term s PTxInInfo -> Term s PTxInInfo -> Term s PBool
forall (t :: S -> Type).
(forall (s :: S). Term s t -> Term s t -> Term s PBool) -> PEq t
$c#== :: forall (s :: S).
Term s PTxInInfo -> Term s PTxInInfo -> Term s PBool
#== :: forall (s :: S).
Term s PTxInInfo -> Term s PTxInInfo -> Term s PBool
PEq
    , -- | @since 3.8.0
      (forall (s :: S). Bool -> Term s PTxInInfo -> Term s PString)
-> PShow PTxInInfo
forall (s :: S). Bool -> Term s PTxInInfo -> Term s PString
forall (t :: S -> Type).
(forall (s :: S). Bool -> Term s t -> Term s PString) -> PShow t
$cpshow' :: forall (s :: S). Bool -> Term s PTxInInfo -> Term s PString
pshow' :: forall (s :: S). Bool -> Term s PTxInInfo -> Term s PString
PShow
    )
  deriving
    ( -- | @since 3.8.0
      (forall (s :: S). PTxInInfo s -> Term s (PInner PTxInInfo))
-> (forall (s :: S) (b :: S -> Type).
    Term s (PInner PTxInInfo) -> (PTxInInfo s -> Term s b) -> Term s b)
-> PlutusType PTxInInfo
forall (s :: S). PTxInInfo s -> Term s (PInner PTxInInfo)
forall (s :: S) (b :: S -> Type).
Term s (PInner PTxInInfo) -> (PTxInInfo s -> Term s b) -> Term s b
forall (a :: S -> Type).
(forall (s :: S). a s -> Term s (PInner a))
-> (forall (s :: S) (b :: S -> Type).
    Term s (PInner a) -> (a s -> Term s b) -> Term s b)
-> PlutusType a
$cpcon' :: forall (s :: S). PTxInInfo s -> Term s (PInner PTxInInfo)
pcon' :: forall (s :: S). PTxInInfo s -> Term s (PInner PTxInInfo)
$cpmatch' :: forall (s :: S) (b :: S -> Type).
Term s (PInner PTxInInfo) -> (PTxInInfo s -> Term s b) -> Term s b
pmatch' :: forall (s :: S) (b :: S -> Type).
Term s (PInner PTxInInfo) -> (PTxInInfo s -> Term s b) -> Term s b
PlutusType
    , -- | @since 3.8.0
      (forall (s :: S).
 Term s PData -> forall (r :: S -> Type). Term s r -> Term s r)
-> PValidateData PTxInInfo
forall (s :: S).
Term s PData -> forall (r :: S -> Type). Term s r -> Term s r
forall (a :: S -> Type).
(forall (s :: S).
 Term s PData -> forall (r :: S -> Type). Term s r -> Term s r)
-> PValidateData a
$cpwithValidated :: forall (s :: S).
Term s PData -> forall (r :: S -> Type). Term s r -> Term s r
pwithValidated :: forall (s :: S).
Term s PData -> forall (r :: S -> Type). Term s r -> Term s r
PValidateData
    )
    via (DeriveAsDataRec PTxInInfo)

-- | @since 3.8.0
instance PLiftable PTxInInfo where
  type AsHaskell PTxInInfo = Plutus.TxInInfo
  type PlutusRepr PTxInInfo = Plutus.Data
  haskToRepr :: AsHaskell PTxInInfo -> PlutusRepr PTxInInfo
haskToRepr = AsHaskell PTxInInfo -> PlutusRepr PTxInInfo
TxInInfo -> Data
forall a. ToData a => a -> Data
Plutus.toData
  reprToHask :: PlutusRepr PTxInInfo -> Either LiftError (AsHaskell PTxInInfo)
reprToHask = Either LiftError TxInInfo
-> (TxInInfo -> Either LiftError TxInInfo)
-> Maybe TxInInfo
-> Either LiftError TxInInfo
forall b a. b -> (a -> b) -> Maybe a -> b
maybe (LiftError -> Either LiftError TxInInfo
forall a b. a -> Either a b
Left LiftError
CouldNotDecodeData) TxInInfo -> Either LiftError TxInInfo
forall a b. b -> Either a b
Right (Maybe TxInInfo -> Either LiftError TxInInfo)
-> (Data -> Maybe TxInInfo) -> Data -> Either LiftError TxInInfo
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Data -> Maybe TxInInfo
forall a. FromData a => Data -> Maybe a
Plutus.fromData
  plutToRepr :: (forall (s :: S). PLifted s PTxInInfo)
-> Either LiftError (PlutusRepr PTxInInfo)
plutToRepr forall (s :: S). PLifted s PTxInInfo
t = ([Data] -> PlutusRepr PTxInInfo)
-> Either LiftError [Data]
-> Either LiftError (PlutusRepr PTxInInfo)
forall a b. (a -> b) -> Either LiftError a -> Either LiftError b
forall (f :: Type -> Type) a b. Functor f => (a -> b) -> f a -> f b
fmap [Data] -> PlutusRepr PTxInInfo
[Data] -> Data
Plutus.List (Either LiftError [Data]
 -> Either LiftError (PlutusRepr PTxInInfo))
-> Either LiftError [Data]
-> Either LiftError (PlutusRepr PTxInInfo)
forall a b. (a -> b) -> a -> b
$ forall (a :: S -> Type).
KnownBuiltinType
  (Term DeBruijn DefaultUni DefaultFun ()) (PlutusRepr a) =>
(forall (s :: S). PLifted s a) -> Either LiftError (PlutusRepr a)
plutToReprUni @(PBuiltinList PData) ((forall (s :: S). PLifted s (PBuiltinList PData))
 -> Either LiftError (PlutusRepr (PBuiltinList PData)))
-> (forall (s :: S). PLifted s (PBuiltinList PData))
-> Either LiftError (PlutusRepr (PBuiltinList PData))
forall a b. (a -> b) -> a -> b
$ PLifted s PTxInInfo -> PLifted s (PBuiltinList PData)
forall (s :: S) (a :: S -> Type) (b :: S -> Type).
PLifted s a -> PLifted s b
punsafeCoercePLifted PLifted s PTxInInfo
forall (s :: S). PLifted s PTxInInfo
t
  reprToPlut :: forall (s :: S). PlutusRepr PTxInInfo -> PLifted s PTxInInfo
reprToPlut = \case
    Plutus.List [Data]
ell -> PLifted s (PBuiltinList PData) -> PLifted s PTxInInfo
forall (s :: S) (a :: S -> Type) (b :: S -> Type).
PLifted s a -> PLifted s b
punsafeCoercePLifted (forall (a :: S -> Type) (s :: S).
Includes DefaultUni (PlutusRepr a) =>
PlutusRepr a -> PLifted s a
reprToPlutUni @(PBuiltinList PData) [Data]
PlutusRepr (PBuiltinList PData)
ell)
    PlutusRepr PTxInInfo
_ -> [Char] -> PLifted s PTxInInfo
forall a. HasCallStack => [Char] -> a
error [Char]
"Impossible: PTxInInfo is list-represented."

-- | @since 3.8.0
instance PTryFrom PData (PAsData PTxInInfo)

-- | @since 3.8.0
data PTxInfo (s :: S) = PTxInfo
  { forall (s :: S). PTxInfo s -> Term s (PAsData PTxId)
ptxInfo'id :: Term s (PAsData PTxId)
  , forall (s :: S). PTxInfo s -> Term s (PMaybeData PInteger)
ptxInfo'subTxIx :: Term s (PMaybeData PInteger)
  , forall (s :: S).
PTxInfo s -> Term s (PAsData (PBuiltinList (PAsData PTxInInfo)))
ptxInfo'inputs :: Term s (PAsData (PBuiltinList (PAsData PTxInInfo)))
  , forall (s :: S).
PTxInfo s -> Term s (PAsData (PBuiltinList (PAsData PTxInInfo)))
ptxInfo'referenceInputs :: Term s (PAsData (PBuiltinList (PAsData PTxInInfo)))
  , forall (s :: S).
PTxInfo s -> Term s (PAsData (PBuiltinList (PAsData PTxOut)))
ptxInfo'outputs :: Term s (PAsData (PBuiltinList (PAsData PTxOut)))
  , forall (s :: S). PTxInfo s -> Term s (PAsData PMintValue)
ptxInfo'mint :: Term s (PAsData PMintValue)
  , forall (s :: S).
PTxInfo s -> Term s (PAsData (PBuiltinList (PAsData PTxCert)))
ptxInfo'txCerts :: Term s (PAsData (PBuiltinList (PAsData PTxCert)))
  , forall (s :: S).
PTxInfo s -> Term s (PAsData (PUnsortedMap PCredential PLovelace))
ptxInfo'withdrawals :: Term s (PAsData (PUnsortedMap PCredential PLovelace))
  , forall (s :: S).
PTxInfo s -> Term s (PAsData (PUnsortedMap PCredential PLovelace))
ptxInfo'directDeposits :: Term s (PAsData (PUnsortedMap PCredential PLovelace))
  , forall (s :: S).
PTxInfo s -> Term s (PAsData PAccountBalanceIntervals)
ptxInfo'accountBalanceIntervals :: Term s (PAsData PAccountBalanceIntervals)
  , forall (s :: S). PTxInfo s -> Term s (PAsData PPosixTimeRange)
ptxInfo'validRange :: Term s (PAsData PPosixTimeRange)
  , forall (s :: S).
PTxInfo s -> Term s (PAsData (PBuiltinList (PAsData PCredential)))
ptxInfo'guards :: Term s (PAsData (PBuiltinList (PAsData PCredential)))
  , forall (s :: S).
PTxInfo s
-> Term s (PAsData (PUnsortedMap PCredential (PMaybeData PDatum)))
ptxInfo'requiredTopLevelGuards :: Term s (PAsData (PUnsortedMap PCredential (PMaybeData PDatum)))
  , forall (s :: S).
PTxInfo s
-> Term s (PAsData (PUnsortedMap PScriptPurpose PRedeemer))
ptxInfo'redeemers :: Term s (PAsData (PUnsortedMap PScriptPurpose PRedeemer))
  , forall (s :: S).
PTxInfo s -> Term s (PAsData (PUnsortedMap PDatumHash PDatum))
ptxInfo'data :: Term s (PAsData (PUnsortedMap PDatumHash PDatum))
  , forall (s :: S).
PTxInfo s
-> Term
     s
     (PAsData
        (PUnsortedMap PVoter (PUnsortedMap PGovernanceActionId PVote)))
ptxInfo'votes :: Term s (PAsData (PUnsortedMap PVoter (PUnsortedMap PGovernanceActionId PVote)))
  , forall (s :: S).
PTxInfo s
-> Term s (PAsData (PBuiltinList (PAsData PProposalProcedure)))
ptxInfo'proposalProcedures :: Term s (PAsData (PBuiltinList (PAsData PProposalProcedure)))
  , forall (s :: S). PTxInfo s -> Term s (PMaybeData PLovelace)
ptxInfo'currentTreasuryAmount :: Term s (PMaybeData PLovelace)
  , forall (s :: S). PTxInfo s -> Term s (PAsData PLovelace)
ptxInfo'treasuryDonation :: Term s (PAsData PLovelace)
  }
  deriving stock
    ( -- | @since 3.8.0
      (forall x. PTxInfo s -> Rep (PTxInfo s) x)
-> (forall x. Rep (PTxInfo s) x -> PTxInfo s)
-> Generic (PTxInfo s)
forall x. Rep (PTxInfo s) x -> PTxInfo s
forall x. PTxInfo s -> Rep (PTxInfo s) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall (s :: S) x. Rep (PTxInfo s) x -> PTxInfo s
forall (s :: S) x. PTxInfo s -> Rep (PTxInfo s) x
$cfrom :: forall (s :: S) x. PTxInfo s -> Rep (PTxInfo s) x
from :: forall x. PTxInfo s -> Rep (PTxInfo s) x
$cto :: forall (s :: S) x. Rep (PTxInfo s) x -> PTxInfo s
to :: forall x. Rep (PTxInfo s) x -> PTxInfo s
Generic
    )
  deriving anyclass
    ( -- | @since 3.8.0
      All SListI (Code (PTxInfo s))
All SListI (Code (PTxInfo s)) =>
(PTxInfo s -> Rep (PTxInfo s))
-> (Rep (PTxInfo s) -> PTxInfo s) -> Generic (PTxInfo s)
Rep (PTxInfo s) -> PTxInfo s
PTxInfo s -> Rep (PTxInfo s)
forall a.
All SListI (Code a) =>
(a -> Rep a) -> (Rep a -> a) -> Generic a
forall (s :: S). All SListI (Code (PTxInfo s))
forall (s :: S). Rep (PTxInfo s) -> PTxInfo s
forall (s :: S). PTxInfo s -> Rep (PTxInfo s)
$cfrom :: forall (s :: S). PTxInfo s -> Rep (PTxInfo s)
from :: PTxInfo s -> Rep (PTxInfo s)
$cto :: forall (s :: S). Rep (PTxInfo s) -> PTxInfo s
to :: Rep (PTxInfo s) -> PTxInfo s
SOP.Generic
    , -- | @since 3.8.0
      (forall (s :: S). Term s (PAsData PTxInfo) -> Term s PTxInfo)
-> (forall (s :: S). Term s PTxInfo -> Term s PData)
-> PIsData PTxInfo
forall (s :: S). Term s (PAsData PTxInfo) -> Term s PTxInfo
forall (s :: S). Term s PTxInfo -> Term s PData
forall (a :: S -> Type).
(forall (s :: S). Term s (PAsData a) -> Term s a)
-> (forall (s :: S). Term s a -> Term s PData) -> PIsData a
$cpfromDataImpl :: forall (s :: S). Term s (PAsData PTxInfo) -> Term s PTxInfo
pfromDataImpl :: forall (s :: S). Term s (PAsData PTxInfo) -> Term s PTxInfo
$cpdataImpl :: forall (s :: S). Term s PTxInfo -> Term s PData
pdataImpl :: forall (s :: S). Term s PTxInfo -> Term s PData
PIsData
    , -- | @since 3.8.0
      (forall (s :: S). Term s PTxInfo -> Term s PTxInfo -> Term s PBool)
-> PEq PTxInfo
forall (s :: S). Term s PTxInfo -> Term s PTxInfo -> Term s PBool
forall (t :: S -> Type).
(forall (s :: S). Term s t -> Term s t -> Term s PBool) -> PEq t
$c#== :: forall (s :: S). Term s PTxInfo -> Term s PTxInfo -> Term s PBool
#== :: forall (s :: S). Term s PTxInfo -> Term s PTxInfo -> Term s PBool
PEq
    , -- | @since 3.8.0
      (forall (s :: S). Bool -> Term s PTxInfo -> Term s PString)
-> PShow PTxInfo
forall (s :: S). Bool -> Term s PTxInfo -> Term s PString
forall (t :: S -> Type).
(forall (s :: S). Bool -> Term s t -> Term s PString) -> PShow t
$cpshow' :: forall (s :: S). Bool -> Term s PTxInfo -> Term s PString
pshow' :: forall (s :: S). Bool -> Term s PTxInfo -> Term s PString
PShow
    )
  deriving
    ( -- | @since 3.8.0
      (forall (s :: S). PTxInfo s -> Term s (PInner PTxInfo))
-> (forall (s :: S) (b :: S -> Type).
    Term s (PInner PTxInfo) -> (PTxInfo s -> Term s b) -> Term s b)
-> PlutusType PTxInfo
forall (s :: S). PTxInfo s -> Term s (PInner PTxInfo)
forall (s :: S) (b :: S -> Type).
Term s (PInner PTxInfo) -> (PTxInfo s -> Term s b) -> Term s b
forall (a :: S -> Type).
(forall (s :: S). a s -> Term s (PInner a))
-> (forall (s :: S) (b :: S -> Type).
    Term s (PInner a) -> (a s -> Term s b) -> Term s b)
-> PlutusType a
$cpcon' :: forall (s :: S). PTxInfo s -> Term s (PInner PTxInfo)
pcon' :: forall (s :: S). PTxInfo s -> Term s (PInner PTxInfo)
$cpmatch' :: forall (s :: S) (b :: S -> Type).
Term s (PInner PTxInfo) -> (PTxInfo s -> Term s b) -> Term s b
pmatch' :: forall (s :: S) (b :: S -> Type).
Term s (PInner PTxInfo) -> (PTxInfo s -> Term s b) -> Term s b
PlutusType
    , -- | @since 3.8.0
      (forall (s :: S).
 Term s PData -> forall (r :: S -> Type). Term s r -> Term s r)
-> PValidateData PTxInfo
forall (s :: S).
Term s PData -> forall (r :: S -> Type). Term s r -> Term s r
forall (a :: S -> Type).
(forall (s :: S).
 Term s PData -> forall (r :: S -> Type). Term s r -> Term s r)
-> PValidateData a
$cpwithValidated :: forall (s :: S).
Term s PData -> forall (r :: S -> Type). Term s r -> Term s r
pwithValidated :: forall (s :: S).
Term s PData -> forall (r :: S -> Type). Term s r -> Term s r
PValidateData
    )
    via (DeriveAsDataRec PTxInfo)

-- | @since 3.8.0
instance PLiftable PTxInfo where
  type AsHaskell PTxInfo = Plutus.TxInfo
  type PlutusRepr PTxInfo = Plutus.Data
  haskToRepr :: AsHaskell PTxInfo -> PlutusRepr PTxInfo
haskToRepr = AsHaskell PTxInfo -> PlutusRepr PTxInfo
TxInfo -> Data
forall a. ToData a => a -> Data
Plutus.toData
  reprToHask :: PlutusRepr PTxInfo -> Either LiftError (AsHaskell PTxInfo)
reprToHask = Either LiftError TxInfo
-> (TxInfo -> Either LiftError TxInfo)
-> Maybe TxInfo
-> Either LiftError TxInfo
forall b a. b -> (a -> b) -> Maybe a -> b
maybe (LiftError -> Either LiftError TxInfo
forall a b. a -> Either a b
Left LiftError
CouldNotDecodeData) TxInfo -> Either LiftError TxInfo
forall a b. b -> Either a b
Right (Maybe TxInfo -> Either LiftError TxInfo)
-> (Data -> Maybe TxInfo) -> Data -> Either LiftError TxInfo
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Data -> Maybe TxInfo
forall a. FromData a => Data -> Maybe a
Plutus.fromData
  plutToRepr :: (forall (s :: S). PLifted s PTxInfo)
-> Either LiftError (PlutusRepr PTxInfo)
plutToRepr forall (s :: S). PLifted s PTxInfo
t = ([Data] -> PlutusRepr PTxInfo)
-> Either LiftError [Data] -> Either LiftError (PlutusRepr PTxInfo)
forall a b. (a -> b) -> Either LiftError a -> Either LiftError b
forall (f :: Type -> Type) a b. Functor f => (a -> b) -> f a -> f b
fmap [Data] -> PlutusRepr PTxInfo
[Data] -> Data
Plutus.List (Either LiftError [Data] -> Either LiftError (PlutusRepr PTxInfo))
-> Either LiftError [Data] -> Either LiftError (PlutusRepr PTxInfo)
forall a b. (a -> b) -> a -> b
$ forall (a :: S -> Type).
KnownBuiltinType
  (Term DeBruijn DefaultUni DefaultFun ()) (PlutusRepr a) =>
(forall (s :: S). PLifted s a) -> Either LiftError (PlutusRepr a)
plutToReprUni @(PBuiltinList PData) ((forall (s :: S). PLifted s (PBuiltinList PData))
 -> Either LiftError (PlutusRepr (PBuiltinList PData)))
-> (forall (s :: S). PLifted s (PBuiltinList PData))
-> Either LiftError (PlutusRepr (PBuiltinList PData))
forall a b. (a -> b) -> a -> b
$ PLifted s PTxInfo -> PLifted s (PBuiltinList PData)
forall (s :: S) (a :: S -> Type) (b :: S -> Type).
PLifted s a -> PLifted s b
punsafeCoercePLifted PLifted s PTxInfo
forall (s :: S). PLifted s PTxInfo
t
  reprToPlut :: forall (s :: S). PlutusRepr PTxInfo -> PLifted s PTxInfo
reprToPlut = \case
    Plutus.List [Data]
ell -> PLifted s (PBuiltinList PData) -> PLifted s PTxInfo
forall (s :: S) (a :: S -> Type) (b :: S -> Type).
PLifted s a -> PLifted s b
punsafeCoercePLifted (forall (a :: S -> Type) (s :: S).
Includes DefaultUni (PlutusRepr a) =>
PlutusRepr a -> PLifted s a
reprToPlutUni @(PBuiltinList PData) [Data]
PlutusRepr (PBuiltinList PData)
ell)
    PlutusRepr PTxInfo
_ -> [Char] -> PLifted s PTxInfo
forall a. HasCallStack => [Char] -> a
error [Char]
"Impossible: PTxInfo is list-represented."

-- | @since 3.8.0
instance PTryFrom PData (PAsData PTxInfo)

-- | @since 3.8.0
data PTopTxInfoSimplified (s :: S) = PTopTxInfoSimplified
  { forall (s :: S).
PTopTxInfoSimplified s
-> Term s (PAsData (PBuiltinList (PAsData PTxId)))
pttis'ids :: Term s (PAsData (PBuiltinList (PAsData PTxId)))
  , forall (s :: S).
PTopTxInfoSimplified s
-> Term s (PAsData (PBuiltinList (PAsData PTxInInfo)))
pttis'inputs :: Term s (PAsData (PBuiltinList (PAsData PTxInInfo)))
  , forall (s :: S).
PTopTxInfoSimplified s
-> Term s (PAsData (PBuiltinList (PAsData PTxInInfo)))
pttis'referenceInputs :: Term s (PAsData (PBuiltinList (PAsData PTxInInfo)))
  , forall (s :: S).
PTopTxInfoSimplified s
-> Term s (PAsData (PBuiltinList (PAsData PTxOut)))
pttis'outputs :: Term s (PAsData (PBuiltinList (PAsData PTxOut)))
  , forall (s :: S).
PTopTxInfoSimplified s -> Term s (PAsData PMintValue)
pttis'mints :: Term s (PAsData PMintValue)
  , forall (s :: S).
PTopTxInfoSimplified s -> Term s (PAsData PMintValue)
pttis'burns :: Term s (PAsData PMintValue)
  , forall (s :: S).
PTopTxInfoSimplified s
-> Term s (PAsData (PBuiltinList (PAsData PTxCert)))
pttis'txCerts :: Term s (PAsData (PBuiltinList (PAsData PTxCert)))
  , forall (s :: S).
PTopTxInfoSimplified s
-> Term s (PAsData (PUnsortedMap PCredential PLovelace))
pttis'withdrawals :: Term s (PAsData (PUnsortedMap PCredential PLovelace))
  , forall (s :: S).
PTopTxInfoSimplified s
-> Term s (PAsData (PUnsortedMap PCredential PLovelace))
pttis'directDeposits :: Term s (PAsData (PUnsortedMap PCredential PLovelace))
  , forall (s :: S).
PTopTxInfoSimplified s -> Term s (PAsData PPosixTimeRange)
pttis'validRange :: Term s (PAsData PPosixTimeRange)
  , forall (s :: S).
PTopTxInfoSimplified s
-> Term s (PAsData (PBuiltinList (PAsData PCredential)))
pttis'guards :: Term s (PAsData (PBuiltinList (PAsData PCredential)))
  , forall (s :: S).
PTopTxInfoSimplified s
-> Term s (PAsData (PBuiltinList (PAsData PCredential)))
pttis'requiredTopLevelGuards :: Term s (PAsData (PBuiltinList (PAsData PCredential)))
  , forall (s :: S).
PTopTxInfoSimplified s
-> Term s (PAsData (PBuiltinList (PAsData PScriptHash)))
pttis'redeemerHashes :: Term s (PAsData (PBuiltinList (PAsData PScriptHash)))
  , forall (s :: S).
PTopTxInfoSimplified s
-> Term s (PAsData (PUnsortedMap PDatumHash PDatum))
pttis'data :: Term s (PAsData (PUnsortedMap PDatumHash PDatum))
  , forall (s :: S).
PTopTxInfoSimplified s
-> Term
     s
     (PAsData
        (PUnsortedMap PVoter (PUnsortedMap PGovernanceActionId PVote)))
pttis'votes :: Term s (PAsData (PUnsortedMap PVoter (PUnsortedMap PGovernanceActionId PVote)))
  , forall (s :: S).
PTopTxInfoSimplified s
-> Term s (PAsData (PBuiltinList (PAsData PProposalProcedure)))
pttis'proposalProcedures :: Term s (PAsData (PBuiltinList (PAsData PProposalProcedure)))
  , forall (s :: S).
PTopTxInfoSimplified s -> Term s (PMaybeData PLovelace)
pttis'currentTreasuryAmount :: Term s (PMaybeData PLovelace)
  , forall (s :: S).
PTopTxInfoSimplified s -> Term s (PAsData PLovelace)
pttis'treasuryDonations :: Term s (PAsData PLovelace)
  }
  deriving stock
    ( -- | @since 3.8.0
      (forall x.
 PTopTxInfoSimplified s -> Rep (PTopTxInfoSimplified s) x)
-> (forall x.
    Rep (PTopTxInfoSimplified s) x -> PTopTxInfoSimplified s)
-> Generic (PTopTxInfoSimplified s)
forall x. Rep (PTopTxInfoSimplified s) x -> PTopTxInfoSimplified s
forall x. PTopTxInfoSimplified s -> Rep (PTopTxInfoSimplified s) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall (s :: S) x.
Rep (PTopTxInfoSimplified s) x -> PTopTxInfoSimplified s
forall (s :: S) x.
PTopTxInfoSimplified s -> Rep (PTopTxInfoSimplified s) x
$cfrom :: forall (s :: S) x.
PTopTxInfoSimplified s -> Rep (PTopTxInfoSimplified s) x
from :: forall x. PTopTxInfoSimplified s -> Rep (PTopTxInfoSimplified s) x
$cto :: forall (s :: S) x.
Rep (PTopTxInfoSimplified s) x -> PTopTxInfoSimplified s
to :: forall x. Rep (PTopTxInfoSimplified s) x -> PTopTxInfoSimplified s
Generic
    )
  deriving anyclass
    ( -- | @since 3.8.0
      All SListI (Code (PTopTxInfoSimplified s))
All SListI (Code (PTopTxInfoSimplified s)) =>
(PTopTxInfoSimplified s -> Rep (PTopTxInfoSimplified s))
-> (Rep (PTopTxInfoSimplified s) -> PTopTxInfoSimplified s)
-> Generic (PTopTxInfoSimplified s)
Rep (PTopTxInfoSimplified s) -> PTopTxInfoSimplified s
PTopTxInfoSimplified s -> Rep (PTopTxInfoSimplified s)
forall a.
All SListI (Code a) =>
(a -> Rep a) -> (Rep a -> a) -> Generic a
forall (s :: S). All SListI (Code (PTopTxInfoSimplified s))
forall (s :: S).
Rep (PTopTxInfoSimplified s) -> PTopTxInfoSimplified s
forall (s :: S).
PTopTxInfoSimplified s -> Rep (PTopTxInfoSimplified s)
$cfrom :: forall (s :: S).
PTopTxInfoSimplified s -> Rep (PTopTxInfoSimplified s)
from :: PTopTxInfoSimplified s -> Rep (PTopTxInfoSimplified s)
$cto :: forall (s :: S).
Rep (PTopTxInfoSimplified s) -> PTopTxInfoSimplified s
to :: Rep (PTopTxInfoSimplified s) -> PTopTxInfoSimplified s
SOP.Generic
    , -- | @since 3.8.0
      (forall (s :: S).
 Term s (PAsData PTopTxInfoSimplified)
 -> Term s PTopTxInfoSimplified)
-> (forall (s :: S). Term s PTopTxInfoSimplified -> Term s PData)
-> PIsData PTopTxInfoSimplified
forall (s :: S).
Term s (PAsData PTopTxInfoSimplified)
-> Term s PTopTxInfoSimplified
forall (s :: S). Term s PTopTxInfoSimplified -> Term s PData
forall (a :: S -> Type).
(forall (s :: S). Term s (PAsData a) -> Term s a)
-> (forall (s :: S). Term s a -> Term s PData) -> PIsData a
$cpfromDataImpl :: forall (s :: S).
Term s (PAsData PTopTxInfoSimplified)
-> Term s PTopTxInfoSimplified
pfromDataImpl :: forall (s :: S).
Term s (PAsData PTopTxInfoSimplified)
-> Term s PTopTxInfoSimplified
$cpdataImpl :: forall (s :: S). Term s PTopTxInfoSimplified -> Term s PData
pdataImpl :: forall (s :: S). Term s PTopTxInfoSimplified -> Term s PData
PIsData
    , -- | @since 3.8.0
      (forall (s :: S).
 Term s PTopTxInfoSimplified
 -> Term s PTopTxInfoSimplified -> Term s PBool)
-> PEq PTopTxInfoSimplified
forall (s :: S).
Term s PTopTxInfoSimplified
-> Term s PTopTxInfoSimplified -> Term s PBool
forall (t :: S -> Type).
(forall (s :: S). Term s t -> Term s t -> Term s PBool) -> PEq t
$c#== :: forall (s :: S).
Term s PTopTxInfoSimplified
-> Term s PTopTxInfoSimplified -> Term s PBool
#== :: forall (s :: S).
Term s PTopTxInfoSimplified
-> Term s PTopTxInfoSimplified -> Term s PBool
PEq
    , -- | @since 3.8.0
      (forall (s :: S).
 Bool -> Term s PTopTxInfoSimplified -> Term s PString)
-> PShow PTopTxInfoSimplified
forall (s :: S).
Bool -> Term s PTopTxInfoSimplified -> Term s PString
forall (t :: S -> Type).
(forall (s :: S). Bool -> Term s t -> Term s PString) -> PShow t
$cpshow' :: forall (s :: S).
Bool -> Term s PTopTxInfoSimplified -> Term s PString
pshow' :: forall (s :: S).
Bool -> Term s PTopTxInfoSimplified -> Term s PString
PShow
    )
  deriving
    ( -- | @since 3.8.0
      (forall (s :: S).
 PTopTxInfoSimplified s -> Term s (PInner PTopTxInfoSimplified))
-> (forall (s :: S) (b :: S -> Type).
    Term s (PInner PTopTxInfoSimplified)
    -> (PTopTxInfoSimplified s -> Term s b) -> Term s b)
-> PlutusType PTopTxInfoSimplified
forall (s :: S).
PTopTxInfoSimplified s -> Term s (PInner PTopTxInfoSimplified)
forall (s :: S) (b :: S -> Type).
Term s (PInner PTopTxInfoSimplified)
-> (PTopTxInfoSimplified s -> Term s b) -> Term s b
forall (a :: S -> Type).
(forall (s :: S). a s -> Term s (PInner a))
-> (forall (s :: S) (b :: S -> Type).
    Term s (PInner a) -> (a s -> Term s b) -> Term s b)
-> PlutusType a
$cpcon' :: forall (s :: S).
PTopTxInfoSimplified s -> Term s (PInner PTopTxInfoSimplified)
pcon' :: forall (s :: S).
PTopTxInfoSimplified s -> Term s (PInner PTopTxInfoSimplified)
$cpmatch' :: forall (s :: S) (b :: S -> Type).
Term s (PInner PTopTxInfoSimplified)
-> (PTopTxInfoSimplified s -> Term s b) -> Term s b
pmatch' :: forall (s :: S) (b :: S -> Type).
Term s (PInner PTopTxInfoSimplified)
-> (PTopTxInfoSimplified s -> Term s b) -> Term s b
PlutusType
    , -- | @since 3.8.0
      (forall (s :: S).
 Term s PData -> forall (r :: S -> Type). Term s r -> Term s r)
-> PValidateData PTopTxInfoSimplified
forall (s :: S).
Term s PData -> forall (r :: S -> Type). Term s r -> Term s r
forall (a :: S -> Type).
(forall (s :: S).
 Term s PData -> forall (r :: S -> Type). Term s r -> Term s r)
-> PValidateData a
$cpwithValidated :: forall (s :: S).
Term s PData -> forall (r :: S -> Type). Term s r -> Term s r
pwithValidated :: forall (s :: S).
Term s PData -> forall (r :: S -> Type). Term s r -> Term s r
PValidateData
    )
    via (DeriveAsDataRec PTopTxInfoSimplified)

-- | @since 3.8.0
instance PLiftable PTopTxInfoSimplified where
  type AsHaskell PTopTxInfoSimplified = Plutus.TopTxInfoSimplified
  type PlutusRepr PTopTxInfoSimplified = Plutus.Data
  haskToRepr :: AsHaskell PTopTxInfoSimplified -> PlutusRepr PTopTxInfoSimplified
haskToRepr = AsHaskell PTopTxInfoSimplified -> PlutusRepr PTopTxInfoSimplified
TopTxInfoSimplified -> Data
forall a. ToData a => a -> Data
Plutus.toData
  reprToHask :: PlutusRepr PTopTxInfoSimplified
-> Either LiftError (AsHaskell PTopTxInfoSimplified)
reprToHask = Either LiftError TopTxInfoSimplified
-> (TopTxInfoSimplified -> Either LiftError TopTxInfoSimplified)
-> Maybe TopTxInfoSimplified
-> Either LiftError TopTxInfoSimplified
forall b a. b -> (a -> b) -> Maybe a -> b
maybe (LiftError -> Either LiftError TopTxInfoSimplified
forall a b. a -> Either a b
Left LiftError
CouldNotDecodeData) TopTxInfoSimplified -> Either LiftError TopTxInfoSimplified
forall a b. b -> Either a b
Right (Maybe TopTxInfoSimplified -> Either LiftError TopTxInfoSimplified)
-> (Data -> Maybe TopTxInfoSimplified)
-> Data
-> Either LiftError TopTxInfoSimplified
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Data -> Maybe TopTxInfoSimplified
forall a. FromData a => Data -> Maybe a
Plutus.fromData
  plutToRepr :: (forall (s :: S). PLifted s PTopTxInfoSimplified)
-> Either LiftError (PlutusRepr PTopTxInfoSimplified)
plutToRepr forall (s :: S). PLifted s PTopTxInfoSimplified
t = ([Data] -> PlutusRepr PTopTxInfoSimplified)
-> Either LiftError [Data]
-> Either LiftError (PlutusRepr PTopTxInfoSimplified)
forall a b. (a -> b) -> Either LiftError a -> Either LiftError b
forall (f :: Type -> Type) a b. Functor f => (a -> b) -> f a -> f b
fmap [Data] -> PlutusRepr PTopTxInfoSimplified
[Data] -> Data
Plutus.List (Either LiftError [Data]
 -> Either LiftError (PlutusRepr PTopTxInfoSimplified))
-> Either LiftError [Data]
-> Either LiftError (PlutusRepr PTopTxInfoSimplified)
forall a b. (a -> b) -> a -> b
$ forall (a :: S -> Type).
KnownBuiltinType
  (Term DeBruijn DefaultUni DefaultFun ()) (PlutusRepr a) =>
(forall (s :: S). PLifted s a) -> Either LiftError (PlutusRepr a)
plutToReprUni @(PBuiltinList PData) ((forall (s :: S). PLifted s (PBuiltinList PData))
 -> Either LiftError (PlutusRepr (PBuiltinList PData)))
-> (forall (s :: S). PLifted s (PBuiltinList PData))
-> Either LiftError (PlutusRepr (PBuiltinList PData))
forall a b. (a -> b) -> a -> b
$ PLifted s PTopTxInfoSimplified -> PLifted s (PBuiltinList PData)
forall (s :: S) (a :: S -> Type) (b :: S -> Type).
PLifted s a -> PLifted s b
punsafeCoercePLifted PLifted s PTopTxInfoSimplified
forall (s :: S). PLifted s PTopTxInfoSimplified
t
  reprToPlut :: forall (s :: S).
PlutusRepr PTopTxInfoSimplified -> PLifted s PTopTxInfoSimplified
reprToPlut = \case
    Plutus.List [Data]
ell -> PLifted s (PBuiltinList PData) -> PLifted s PTopTxInfoSimplified
forall (s :: S) (a :: S -> Type) (b :: S -> Type).
PLifted s a -> PLifted s b
punsafeCoercePLifted (forall (a :: S -> Type) (s :: S).
Includes DefaultUni (PlutusRepr a) =>
PlutusRepr a -> PLifted s a
reprToPlutUni @(PBuiltinList PData) [Data]
PlutusRepr (PBuiltinList PData)
ell)
    PlutusRepr PTopTxInfoSimplified
_ -> [Char] -> PLifted s PTopTxInfoSimplified
forall a. HasCallStack => [Char] -> a
error [Char]
"Impossible: PTopTxInfoSimplified is list-represented."

-- | @since 3.8.0
instance PTryFrom PData (PAsData PTopTxInfoSimplified)

-- | @since 3.8.0
data PTopTxInfo (s :: S) = PTopTxInfo
  { forall (s :: S).
PTopTxInfo s -> Term s (PAsData (PBuiltinList (PAsData PTxInfo)))
topTxInfo'subTransactions :: Term s (PAsData (PBuiltinList (PAsData PTxInfo)))
  , forall (s :: S).
PTopTxInfo s -> Term s (PAsData (PUnsortedMap PTxId PDatum))
topTxInfo'datums :: Term s (PAsData (PUnsortedMap PTxId PDatum))
  , forall (s :: S).
PTopTxInfo s -> Term s (PAsData PAccountBalanceIntervals)
topTxInfo'startingBalanceIntervals :: Term s (PAsData PAccountBalanceIntervals)
  , forall (s :: S).
PTopTxInfo s -> Term s (PAsData PTopTxInfoSimplified)
topTxInfo'simplified :: Term s (PAsData PTopTxInfoSimplified)
  }
  deriving stock
    ( -- | @since 3.8.0
      (forall x. PTopTxInfo s -> Rep (PTopTxInfo s) x)
-> (forall x. Rep (PTopTxInfo s) x -> PTopTxInfo s)
-> Generic (PTopTxInfo s)
forall x. Rep (PTopTxInfo s) x -> PTopTxInfo s
forall x. PTopTxInfo s -> Rep (PTopTxInfo s) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall (s :: S) x. Rep (PTopTxInfo s) x -> PTopTxInfo s
forall (s :: S) x. PTopTxInfo s -> Rep (PTopTxInfo s) x
$cfrom :: forall (s :: S) x. PTopTxInfo s -> Rep (PTopTxInfo s) x
from :: forall x. PTopTxInfo s -> Rep (PTopTxInfo s) x
$cto :: forall (s :: S) x. Rep (PTopTxInfo s) x -> PTopTxInfo s
to :: forall x. Rep (PTopTxInfo s) x -> PTopTxInfo s
Generic
    )
  deriving anyclass
    ( -- | @since 3.8.0
      All SListI (Code (PTopTxInfo s))
All SListI (Code (PTopTxInfo s)) =>
(PTopTxInfo s -> Rep (PTopTxInfo s))
-> (Rep (PTopTxInfo s) -> PTopTxInfo s) -> Generic (PTopTxInfo s)
Rep (PTopTxInfo s) -> PTopTxInfo s
PTopTxInfo s -> Rep (PTopTxInfo s)
forall a.
All SListI (Code a) =>
(a -> Rep a) -> (Rep a -> a) -> Generic a
forall (s :: S). All SListI (Code (PTopTxInfo s))
forall (s :: S). Rep (PTopTxInfo s) -> PTopTxInfo s
forall (s :: S). PTopTxInfo s -> Rep (PTopTxInfo s)
$cfrom :: forall (s :: S). PTopTxInfo s -> Rep (PTopTxInfo s)
from :: PTopTxInfo s -> Rep (PTopTxInfo s)
$cto :: forall (s :: S). Rep (PTopTxInfo s) -> PTopTxInfo s
to :: Rep (PTopTxInfo s) -> PTopTxInfo s
SOP.Generic
    , -- | @since 3.8.0
      (forall (s :: S). Term s (PAsData PTopTxInfo) -> Term s PTopTxInfo)
-> (forall (s :: S). Term s PTopTxInfo -> Term s PData)
-> PIsData PTopTxInfo
forall (s :: S). Term s (PAsData PTopTxInfo) -> Term s PTopTxInfo
forall (s :: S). Term s PTopTxInfo -> Term s PData
forall (a :: S -> Type).
(forall (s :: S). Term s (PAsData a) -> Term s a)
-> (forall (s :: S). Term s a -> Term s PData) -> PIsData a
$cpfromDataImpl :: forall (s :: S). Term s (PAsData PTopTxInfo) -> Term s PTopTxInfo
pfromDataImpl :: forall (s :: S). Term s (PAsData PTopTxInfo) -> Term s PTopTxInfo
$cpdataImpl :: forall (s :: S). Term s PTopTxInfo -> Term s PData
pdataImpl :: forall (s :: S). Term s PTopTxInfo -> Term s PData
PIsData
    , -- | @since 3.8.0
      (forall (s :: S).
 Term s PTopTxInfo -> Term s PTopTxInfo -> Term s PBool)
-> PEq PTopTxInfo
forall (s :: S).
Term s PTopTxInfo -> Term s PTopTxInfo -> Term s PBool
forall (t :: S -> Type).
(forall (s :: S). Term s t -> Term s t -> Term s PBool) -> PEq t
$c#== :: forall (s :: S).
Term s PTopTxInfo -> Term s PTopTxInfo -> Term s PBool
#== :: forall (s :: S).
Term s PTopTxInfo -> Term s PTopTxInfo -> Term s PBool
PEq
    , -- | @since 3.8.0
      (forall (s :: S). Bool -> Term s PTopTxInfo -> Term s PString)
-> PShow PTopTxInfo
forall (s :: S). Bool -> Term s PTopTxInfo -> Term s PString
forall (t :: S -> Type).
(forall (s :: S). Bool -> Term s t -> Term s PString) -> PShow t
$cpshow' :: forall (s :: S). Bool -> Term s PTopTxInfo -> Term s PString
pshow' :: forall (s :: S). Bool -> Term s PTopTxInfo -> Term s PString
PShow
    )
  deriving
    ( -- | @since 3.8.0
      (forall (s :: S). PTopTxInfo s -> Term s (PInner PTopTxInfo))
-> (forall (s :: S) (b :: S -> Type).
    Term s (PInner PTopTxInfo)
    -> (PTopTxInfo s -> Term s b) -> Term s b)
-> PlutusType PTopTxInfo
forall (s :: S). PTopTxInfo s -> Term s (PInner PTopTxInfo)
forall (s :: S) (b :: S -> Type).
Term s (PInner PTopTxInfo)
-> (PTopTxInfo s -> Term s b) -> Term s b
forall (a :: S -> Type).
(forall (s :: S). a s -> Term s (PInner a))
-> (forall (s :: S) (b :: S -> Type).
    Term s (PInner a) -> (a s -> Term s b) -> Term s b)
-> PlutusType a
$cpcon' :: forall (s :: S). PTopTxInfo s -> Term s (PInner PTopTxInfo)
pcon' :: forall (s :: S). PTopTxInfo s -> Term s (PInner PTopTxInfo)
$cpmatch' :: forall (s :: S) (b :: S -> Type).
Term s (PInner PTopTxInfo)
-> (PTopTxInfo s -> Term s b) -> Term s b
pmatch' :: forall (s :: S) (b :: S -> Type).
Term s (PInner PTopTxInfo)
-> (PTopTxInfo s -> Term s b) -> Term s b
PlutusType
    , -- | @since 3.8.0
      (forall (s :: S).
 Term s PData -> forall (r :: S -> Type). Term s r -> Term s r)
-> PValidateData PTopTxInfo
forall (s :: S).
Term s PData -> forall (r :: S -> Type). Term s r -> Term s r
forall (a :: S -> Type).
(forall (s :: S).
 Term s PData -> forall (r :: S -> Type). Term s r -> Term s r)
-> PValidateData a
$cpwithValidated :: forall (s :: S).
Term s PData -> forall (r :: S -> Type). Term s r -> Term s r
pwithValidated :: forall (s :: S).
Term s PData -> forall (r :: S -> Type). Term s r -> Term s r
PValidateData
    )
    via (DeriveAsDataRec PTopTxInfo)

-- | @since 3.8.0
instance PLiftable PTopTxInfo where
  type AsHaskell PTopTxInfo = Plutus.TopTxInfo
  type PlutusRepr PTopTxInfo = Plutus.Data
  haskToRepr :: AsHaskell PTopTxInfo -> PlutusRepr PTopTxInfo
haskToRepr = AsHaskell PTopTxInfo -> PlutusRepr PTopTxInfo
TopTxInfo -> Data
forall a. ToData a => a -> Data
Plutus.toData
  reprToHask :: PlutusRepr PTopTxInfo -> Either LiftError (AsHaskell PTopTxInfo)
reprToHask = Either LiftError TopTxInfo
-> (TopTxInfo -> Either LiftError TopTxInfo)
-> Maybe TopTxInfo
-> Either LiftError TopTxInfo
forall b a. b -> (a -> b) -> Maybe a -> b
maybe (LiftError -> Either LiftError TopTxInfo
forall a b. a -> Either a b
Left LiftError
CouldNotDecodeData) TopTxInfo -> Either LiftError TopTxInfo
forall a b. b -> Either a b
Right (Maybe TopTxInfo -> Either LiftError TopTxInfo)
-> (Data -> Maybe TopTxInfo) -> Data -> Either LiftError TopTxInfo
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Data -> Maybe TopTxInfo
forall a. FromData a => Data -> Maybe a
Plutus.fromData
  plutToRepr :: (forall (s :: S). PLifted s PTopTxInfo)
-> Either LiftError (PlutusRepr PTopTxInfo)
plutToRepr forall (s :: S). PLifted s PTopTxInfo
t = ([Data] -> PlutusRepr PTopTxInfo)
-> Either LiftError [Data]
-> Either LiftError (PlutusRepr PTopTxInfo)
forall a b. (a -> b) -> Either LiftError a -> Either LiftError b
forall (f :: Type -> Type) a b. Functor f => (a -> b) -> f a -> f b
fmap [Data] -> PlutusRepr PTopTxInfo
[Data] -> Data
Plutus.List (Either LiftError [Data]
 -> Either LiftError (PlutusRepr PTopTxInfo))
-> Either LiftError [Data]
-> Either LiftError (PlutusRepr PTopTxInfo)
forall a b. (a -> b) -> a -> b
$ forall (a :: S -> Type).
KnownBuiltinType
  (Term DeBruijn DefaultUni DefaultFun ()) (PlutusRepr a) =>
(forall (s :: S). PLifted s a) -> Either LiftError (PlutusRepr a)
plutToReprUni @(PBuiltinList PData) ((forall (s :: S). PLifted s (PBuiltinList PData))
 -> Either LiftError (PlutusRepr (PBuiltinList PData)))
-> (forall (s :: S). PLifted s (PBuiltinList PData))
-> Either LiftError (PlutusRepr (PBuiltinList PData))
forall a b. (a -> b) -> a -> b
$ PLifted s PTopTxInfo -> PLifted s (PBuiltinList PData)
forall (s :: S) (a :: S -> Type) (b :: S -> Type).
PLifted s a -> PLifted s b
punsafeCoercePLifted PLifted s PTopTxInfo
forall (s :: S). PLifted s PTopTxInfo
t
  reprToPlut :: forall (s :: S). PlutusRepr PTopTxInfo -> PLifted s PTopTxInfo
reprToPlut = \case
    Plutus.List [Data]
ell -> PLifted s (PBuiltinList PData) -> PLifted s PTopTxInfo
forall (s :: S) (a :: S -> Type) (b :: S -> Type).
PLifted s a -> PLifted s b
punsafeCoercePLifted (forall (a :: S -> Type) (s :: S).
Includes DefaultUni (PlutusRepr a) =>
PlutusRepr a -> PLifted s a
reprToPlutUni @(PBuiltinList PData) [Data]
PlutusRepr (PBuiltinList PData)
ell)
    PlutusRepr PTopTxInfo
_ -> [Char] -> PLifted s PTopTxInfo
forall a. HasCallStack => [Char] -> a
error [Char]
"Impossible: PTopTxInfo is list-represented."

-- | @since 3.8.0
instance PTryFrom PData (PAsData PTopTxInfo)

-- | @since 3.8.0
data PScriptInfo (s :: S)
  = PMintingScript (Term s (PAsData PCurrencySymbol))
  | PSpendingScript (Term s (PAsData PTxOutRef)) (Term s (PMaybeData PDatum))
  | PWithdrawingScript (Term s (PAsData PAccountId))
  | PCertifyingScript (Term s (PAsData PInteger)) (Term s (PAsData PTxCert))
  | PVotingScript (Term s (PAsData PVoter))
  | PProposingScript (Term s (PAsData PNatural)) (Term s (PAsData PProposalProcedure))
  | PGuardingScript (Term s (PAsData PInteger)) (Term s (PMaybeData PTopTxInfo))
  deriving stock
    ( -- | @since 3.8.0
      (forall x. PScriptInfo s -> Rep (PScriptInfo s) x)
-> (forall x. Rep (PScriptInfo s) x -> PScriptInfo s)
-> Generic (PScriptInfo s)
forall x. Rep (PScriptInfo s) x -> PScriptInfo s
forall x. PScriptInfo s -> Rep (PScriptInfo s) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall (s :: S) x. Rep (PScriptInfo s) x -> PScriptInfo s
forall (s :: S) x. PScriptInfo s -> Rep (PScriptInfo s) x
$cfrom :: forall (s :: S) x. PScriptInfo s -> Rep (PScriptInfo s) x
from :: forall x. PScriptInfo s -> Rep (PScriptInfo s) x
$cto :: forall (s :: S) x. Rep (PScriptInfo s) x -> PScriptInfo s
to :: forall x. Rep (PScriptInfo s) x -> PScriptInfo s
Generic
    )
  deriving anyclass
    ( -- | @since 3.8.0
      All SListI (Code (PScriptInfo s))
All SListI (Code (PScriptInfo s)) =>
(PScriptInfo s -> Rep (PScriptInfo s))
-> (Rep (PScriptInfo s) -> PScriptInfo s)
-> Generic (PScriptInfo s)
Rep (PScriptInfo s) -> PScriptInfo s
PScriptInfo s -> Rep (PScriptInfo s)
forall a.
All SListI (Code a) =>
(a -> Rep a) -> (Rep a -> a) -> Generic a
forall (s :: S). All SListI (Code (PScriptInfo s))
forall (s :: S). Rep (PScriptInfo s) -> PScriptInfo s
forall (s :: S). PScriptInfo s -> Rep (PScriptInfo s)
$cfrom :: forall (s :: S). PScriptInfo s -> Rep (PScriptInfo s)
from :: PScriptInfo s -> Rep (PScriptInfo s)
$cto :: forall (s :: S). Rep (PScriptInfo s) -> PScriptInfo s
to :: Rep (PScriptInfo s) -> PScriptInfo s
SOP.Generic
    , -- | @since 3.8.0
      (forall (s :: S).
 Term s (PAsData PScriptInfo) -> Term s PScriptInfo)
-> (forall (s :: S). Term s PScriptInfo -> Term s PData)
-> PIsData PScriptInfo
forall (s :: S). Term s (PAsData PScriptInfo) -> Term s PScriptInfo
forall (s :: S). Term s PScriptInfo -> Term s PData
forall (a :: S -> Type).
(forall (s :: S). Term s (PAsData a) -> Term s a)
-> (forall (s :: S). Term s a -> Term s PData) -> PIsData a
$cpfromDataImpl :: forall (s :: S). Term s (PAsData PScriptInfo) -> Term s PScriptInfo
pfromDataImpl :: forall (s :: S). Term s (PAsData PScriptInfo) -> Term s PScriptInfo
$cpdataImpl :: forall (s :: S). Term s PScriptInfo -> Term s PData
pdataImpl :: forall (s :: S). Term s PScriptInfo -> Term s PData
PIsData
    , -- | @since 3.8.0
      (forall (s :: S).
 Term s PScriptInfo -> Term s PScriptInfo -> Term s PBool)
-> PEq PScriptInfo
forall (s :: S).
Term s PScriptInfo -> Term s PScriptInfo -> Term s PBool
forall (t :: S -> Type).
(forall (s :: S). Term s t -> Term s t -> Term s PBool) -> PEq t
$c#== :: forall (s :: S).
Term s PScriptInfo -> Term s PScriptInfo -> Term s PBool
#== :: forall (s :: S).
Term s PScriptInfo -> Term s PScriptInfo -> Term s PBool
PEq
    , -- | @since 3.8.0
      (forall (s :: S). Bool -> Term s PScriptInfo -> Term s PString)
-> PShow PScriptInfo
forall (s :: S). Bool -> Term s PScriptInfo -> Term s PString
forall (t :: S -> Type).
(forall (s :: S). Bool -> Term s t -> Term s PString) -> PShow t
$cpshow' :: forall (s :: S). Bool -> Term s PScriptInfo -> Term s PString
pshow' :: forall (s :: S). Bool -> Term s PScriptInfo -> Term s PString
PShow
    )
  deriving
    ( -- | @since 3.8.0
      (forall (s :: S). PScriptInfo s -> Term s (PInner PScriptInfo))
-> (forall (s :: S) (b :: S -> Type).
    Term s (PInner PScriptInfo)
    -> (PScriptInfo s -> Term s b) -> Term s b)
-> PlutusType PScriptInfo
forall (s :: S). PScriptInfo s -> Term s (PInner PScriptInfo)
forall (s :: S) (b :: S -> Type).
Term s (PInner PScriptInfo)
-> (PScriptInfo s -> Term s b) -> Term s b
forall (a :: S -> Type).
(forall (s :: S). a s -> Term s (PInner a))
-> (forall (s :: S) (b :: S -> Type).
    Term s (PInner a) -> (a s -> Term s b) -> Term s b)
-> PlutusType a
$cpcon' :: forall (s :: S). PScriptInfo s -> Term s (PInner PScriptInfo)
pcon' :: forall (s :: S). PScriptInfo s -> Term s (PInner PScriptInfo)
$cpmatch' :: forall (s :: S) (b :: S -> Type).
Term s (PInner PScriptInfo)
-> (PScriptInfo s -> Term s b) -> Term s b
pmatch' :: forall (s :: S) (b :: S -> Type).
Term s (PInner PScriptInfo)
-> (PScriptInfo s -> Term s b) -> Term s b
PlutusType
    , -- | @since 3.8.0
      (forall (s :: S).
 Term s PData -> forall (r :: S -> Type). Term s r -> Term s r)
-> PValidateData PScriptInfo
forall (s :: S).
Term s PData -> forall (r :: S -> Type). Term s r -> Term s r
forall (a :: S -> Type).
(forall (s :: S).
 Term s PData -> forall (r :: S -> Type). Term s r -> Term s r)
-> PValidateData a
$cpwithValidated :: forall (s :: S).
Term s PData -> forall (r :: S -> Type). Term s r -> Term s r
pwithValidated :: forall (s :: S).
Term s PData -> forall (r :: S -> Type). Term s r -> Term s r
PValidateData
    )
    via (DeriveAsDataStruct PScriptInfo)

-- | @since 3.8.0
deriving via
  DeriveDataPLiftable PScriptInfo Plutus.ScriptInfo
  instance
    PLiftable PScriptInfo

-- | @since 3.8.0
instance PTryFrom PData (PAsData PScriptInfo)

-- | @since 3.8.0
data PScriptContext (s :: S) = PScriptContext
  { forall (s :: S). PScriptContext s -> Term s (PAsData PTxInfo)
pscriptContext'txInfo :: Term s (PAsData PTxInfo)
  , forall (s :: S). PScriptContext s -> Term s (PAsData PRedeemer)
pscriptContext'redeemer :: Term s (PAsData PRedeemer)
  , forall (s :: S). PScriptContext s -> Term s (PAsData PScriptInfo)
pscriptContext'scriptInfo :: Term s (PAsData PScriptInfo)
  , forall (s :: S). PScriptContext s -> Term s (PAsData PScriptHash)
pscriptContext'scriptHash :: Term s (PAsData PScriptHash)
  }
  deriving stock
    ( -- | @since 3.8.0
      (forall x. PScriptContext s -> Rep (PScriptContext s) x)
-> (forall x. Rep (PScriptContext s) x -> PScriptContext s)
-> Generic (PScriptContext s)
forall x. Rep (PScriptContext s) x -> PScriptContext s
forall x. PScriptContext s -> Rep (PScriptContext s) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall (s :: S) x. Rep (PScriptContext s) x -> PScriptContext s
forall (s :: S) x. PScriptContext s -> Rep (PScriptContext s) x
$cfrom :: forall (s :: S) x. PScriptContext s -> Rep (PScriptContext s) x
from :: forall x. PScriptContext s -> Rep (PScriptContext s) x
$cto :: forall (s :: S) x. Rep (PScriptContext s) x -> PScriptContext s
to :: forall x. Rep (PScriptContext s) x -> PScriptContext s
Generic
    )
  deriving anyclass
    ( -- | @since 3.8.0
      All SListI (Code (PScriptContext s))
All SListI (Code (PScriptContext s)) =>
(PScriptContext s -> Rep (PScriptContext s))
-> (Rep (PScriptContext s) -> PScriptContext s)
-> Generic (PScriptContext s)
Rep (PScriptContext s) -> PScriptContext s
PScriptContext s -> Rep (PScriptContext s)
forall a.
All SListI (Code a) =>
(a -> Rep a) -> (Rep a -> a) -> Generic a
forall (s :: S). All SListI (Code (PScriptContext s))
forall (s :: S). Rep (PScriptContext s) -> PScriptContext s
forall (s :: S). PScriptContext s -> Rep (PScriptContext s)
$cfrom :: forall (s :: S). PScriptContext s -> Rep (PScriptContext s)
from :: PScriptContext s -> Rep (PScriptContext s)
$cto :: forall (s :: S). Rep (PScriptContext s) -> PScriptContext s
to :: Rep (PScriptContext s) -> PScriptContext s
SOP.Generic
    , -- | @since 3.8.0
      (forall (s :: S).
 Term s (PAsData PScriptContext) -> Term s PScriptContext)
-> (forall (s :: S). Term s PScriptContext -> Term s PData)
-> PIsData PScriptContext
forall (s :: S).
Term s (PAsData PScriptContext) -> Term s PScriptContext
forall (s :: S). Term s PScriptContext -> Term s PData
forall (a :: S -> Type).
(forall (s :: S). Term s (PAsData a) -> Term s a)
-> (forall (s :: S). Term s a -> Term s PData) -> PIsData a
$cpfromDataImpl :: forall (s :: S).
Term s (PAsData PScriptContext) -> Term s PScriptContext
pfromDataImpl :: forall (s :: S).
Term s (PAsData PScriptContext) -> Term s PScriptContext
$cpdataImpl :: forall (s :: S). Term s PScriptContext -> Term s PData
pdataImpl :: forall (s :: S). Term s PScriptContext -> Term s PData
PIsData
    , -- | @since 3.8.0
      (forall (s :: S).
 Term s PScriptContext -> Term s PScriptContext -> Term s PBool)
-> PEq PScriptContext
forall (s :: S).
Term s PScriptContext -> Term s PScriptContext -> Term s PBool
forall (t :: S -> Type).
(forall (s :: S). Term s t -> Term s t -> Term s PBool) -> PEq t
$c#== :: forall (s :: S).
Term s PScriptContext -> Term s PScriptContext -> Term s PBool
#== :: forall (s :: S).
Term s PScriptContext -> Term s PScriptContext -> Term s PBool
PEq
    , -- | @since 3.8.0
      (forall (s :: S). Bool -> Term s PScriptContext -> Term s PString)
-> PShow PScriptContext
forall (s :: S). Bool -> Term s PScriptContext -> Term s PString
forall (t :: S -> Type).
(forall (s :: S). Bool -> Term s t -> Term s PString) -> PShow t
$cpshow' :: forall (s :: S). Bool -> Term s PScriptContext -> Term s PString
pshow' :: forall (s :: S). Bool -> Term s PScriptContext -> Term s PString
PShow
    )
  deriving
    ( -- | @since 3.8.0
      (forall (s :: S).
 PScriptContext s -> Term s (PInner PScriptContext))
-> (forall (s :: S) (b :: S -> Type).
    Term s (PInner PScriptContext)
    -> (PScriptContext s -> Term s b) -> Term s b)
-> PlutusType PScriptContext
forall (s :: S). PScriptContext s -> Term s (PInner PScriptContext)
forall (s :: S) (b :: S -> Type).
Term s (PInner PScriptContext)
-> (PScriptContext s -> Term s b) -> Term s b
forall (a :: S -> Type).
(forall (s :: S). a s -> Term s (PInner a))
-> (forall (s :: S) (b :: S -> Type).
    Term s (PInner a) -> (a s -> Term s b) -> Term s b)
-> PlutusType a
$cpcon' :: forall (s :: S). PScriptContext s -> Term s (PInner PScriptContext)
pcon' :: forall (s :: S). PScriptContext s -> Term s (PInner PScriptContext)
$cpmatch' :: forall (s :: S) (b :: S -> Type).
Term s (PInner PScriptContext)
-> (PScriptContext s -> Term s b) -> Term s b
pmatch' :: forall (s :: S) (b :: S -> Type).
Term s (PInner PScriptContext)
-> (PScriptContext s -> Term s b) -> Term s b
PlutusType
    , -- | @since 3.8.0
      (forall (s :: S).
 Term s PData -> forall (r :: S -> Type). Term s r -> Term s r)
-> PValidateData PScriptContext
forall (s :: S).
Term s PData -> forall (r :: S -> Type). Term s r -> Term s r
forall (a :: S -> Type).
(forall (s :: S).
 Term s PData -> forall (r :: S -> Type). Term s r -> Term s r)
-> PValidateData a
$cpwithValidated :: forall (s :: S).
Term s PData -> forall (r :: S -> Type). Term s r -> Term s r
pwithValidated :: forall (s :: S).
Term s PData -> forall (r :: S -> Type). Term s r -> Term s r
PValidateData
    )
    via (DeriveAsDataRec PScriptContext)

-- | @since 3.8.0
instance PLiftable PScriptContext where
  type AsHaskell PScriptContext = Plutus.ScriptContext
  type PlutusRepr PScriptContext = Plutus.Data
  haskToRepr :: AsHaskell PScriptContext -> PlutusRepr PScriptContext
haskToRepr = AsHaskell PScriptContext -> PlutusRepr PScriptContext
ScriptContext -> Data
forall a. ToData a => a -> Data
Plutus.toData
  reprToHask :: PlutusRepr PScriptContext
-> Either LiftError (AsHaskell PScriptContext)
reprToHask = Either LiftError ScriptContext
-> (ScriptContext -> Either LiftError ScriptContext)
-> Maybe ScriptContext
-> Either LiftError ScriptContext
forall b a. b -> (a -> b) -> Maybe a -> b
maybe (LiftError -> Either LiftError ScriptContext
forall a b. a -> Either a b
Left LiftError
CouldNotDecodeData) ScriptContext -> Either LiftError ScriptContext
forall a b. b -> Either a b
Right (Maybe ScriptContext -> Either LiftError ScriptContext)
-> (Data -> Maybe ScriptContext)
-> Data
-> Either LiftError ScriptContext
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Data -> Maybe ScriptContext
forall a. FromData a => Data -> Maybe a
Plutus.fromData
  plutToRepr :: (forall (s :: S). PLifted s PScriptContext)
-> Either LiftError (PlutusRepr PScriptContext)
plutToRepr forall (s :: S). PLifted s PScriptContext
t = ([Data] -> PlutusRepr PScriptContext)
-> Either LiftError [Data]
-> Either LiftError (PlutusRepr PScriptContext)
forall a b. (a -> b) -> Either LiftError a -> Either LiftError b
forall (f :: Type -> Type) a b. Functor f => (a -> b) -> f a -> f b
fmap [Data] -> PlutusRepr PScriptContext
[Data] -> Data
Plutus.List (Either LiftError [Data]
 -> Either LiftError (PlutusRepr PScriptContext))
-> Either LiftError [Data]
-> Either LiftError (PlutusRepr PScriptContext)
forall a b. (a -> b) -> a -> b
$ forall (a :: S -> Type).
KnownBuiltinType
  (Term DeBruijn DefaultUni DefaultFun ()) (PlutusRepr a) =>
(forall (s :: S). PLifted s a) -> Either LiftError (PlutusRepr a)
plutToReprUni @(PBuiltinList PData) ((forall (s :: S). PLifted s (PBuiltinList PData))
 -> Either LiftError (PlutusRepr (PBuiltinList PData)))
-> (forall (s :: S). PLifted s (PBuiltinList PData))
-> Either LiftError (PlutusRepr (PBuiltinList PData))
forall a b. (a -> b) -> a -> b
$ PLifted s PScriptContext -> PLifted s (PBuiltinList PData)
forall (s :: S) (a :: S -> Type) (b :: S -> Type).
PLifted s a -> PLifted s b
punsafeCoercePLifted PLifted s PScriptContext
forall (s :: S). PLifted s PScriptContext
t
  reprToPlut :: forall (s :: S).
PlutusRepr PScriptContext -> PLifted s PScriptContext
reprToPlut = \case
    Plutus.List [Data]
ell -> PLifted s (PBuiltinList PData) -> PLifted s PScriptContext
forall (s :: S) (a :: S -> Type) (b :: S -> Type).
PLifted s a -> PLifted s b
punsafeCoercePLifted (forall (a :: S -> Type) (s :: S).
Includes DefaultUni (PlutusRepr a) =>
PlutusRepr a -> PLifted s a
reprToPlutUni @(PBuiltinList PData) [Data]
PlutusRepr (PBuiltinList PData)
ell)
    PlutusRepr PScriptContext
_ -> [Char] -> PLifted s PScriptContext
forall a. HasCallStack => [Char] -> a
error [Char]
"Impossible: PScriptContext is list-represented."

-- | @since 3.8.0
instance PTryFrom PData (PAsData PScriptContext)