{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE GADTs #-}

module Cardano.CLI.EraBased.Script.Mint.Read
  ( readMintScriptWitness
  )
where

import           Cardano.Api
import           Cardano.Api.Shelley

import           Cardano.CLI.EraBased.Script.Mint.Types
import           Cardano.CLI.Read

readMintScriptWitness
  :: MonadIOTransError (FileError CliScriptWitnessError) t m
  => ShelleyBasedEra era -> CliMintScriptRequirements -> t m (MintScriptWitnessWithPolicyId era)
readMintScriptWitness :: forall (t :: (* -> *) -> * -> *) (m :: * -> *) era.
MonadIOTransError (FileError CliScriptWitnessError) t m =>
ShelleyBasedEra era
-> CliMintScriptRequirements
-> t m (MintScriptWitnessWithPolicyId era)
readMintScriptWitness ShelleyBasedEra era
sbe (OnDiskSimpleOrPlutusScript SimpleOrPlutusScriptCliArgs
simpleOrPlutus) =
  case SimpleOrPlutusScriptCliArgs
simpleOrPlutus of
    OnDiskSimpleScriptCliArgs File ScriptInAnyLang 'In
simpleFp -> do
      let sFp :: FilePath
sFp = File ScriptInAnyLang 'In -> FilePath
forall content (direction :: FileDirection).
File content direction -> FilePath
unFile File ScriptInAnyLang 'In
simpleFp
      Script SimpleScript'
s <-
        (FileError ScriptDecodeError -> FileError CliScriptWitnessError)
-> ExceptT (FileError ScriptDecodeError) m (Script SimpleScript')
-> t m (Script SimpleScript')
forall e' (t :: (* -> *) -> * -> *) (m :: * -> *) e a.
MonadTransError e' t m =>
(e -> e') -> ExceptT e m a -> t m a
modifyError ((ScriptDecodeError -> CliScriptWitnessError)
-> FileError ScriptDecodeError -> FileError CliScriptWitnessError
forall a b. (a -> b) -> FileError a -> FileError b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ScriptDecodeError -> CliScriptWitnessError
SimpleScriptWitnessDecodeError) (ExceptT (FileError ScriptDecodeError) m (Script SimpleScript')
 -> t m (Script SimpleScript'))
-> ExceptT (FileError ScriptDecodeError) m (Script SimpleScript')
-> t m (Script SimpleScript')
forall a b. (a -> b) -> a -> b
$ FilePath
-> ExceptT (FileError ScriptDecodeError) m (Script SimpleScript')
forall (t :: (* -> *) -> * -> *) (m :: * -> *).
MonadIOTransError (FileError ScriptDecodeError) t m =>
FilePath -> t m (Script SimpleScript')
readFileSimpleScript FilePath
sFp
      case Script SimpleScript'
s of
        SimpleScript SimpleScript
ss -> do
          let polId :: PolicyId
polId = ScriptHash -> PolicyId
PolicyId (ScriptHash -> PolicyId) -> ScriptHash -> PolicyId
forall a b. (a -> b) -> a -> b
$ Script SimpleScript' -> ScriptHash
forall lang. Script lang -> ScriptHash
hashScript Script SimpleScript'
s
          MintScriptWitnessWithPolicyId era
-> t m (MintScriptWitnessWithPolicyId era)
forall a. a -> t m a
forall (m :: * -> *) a. Monad m => a -> m a
return (MintScriptWitnessWithPolicyId era
 -> t m (MintScriptWitnessWithPolicyId era))
-> MintScriptWitnessWithPolicyId era
-> t m (MintScriptWitnessWithPolicyId era)
forall a b. (a -> b) -> a -> b
$
            PolicyId
-> ScriptWitness WitCtxMint era
-> MintScriptWitnessWithPolicyId era
forall era.
PolicyId
-> ScriptWitness WitCtxMint era
-> MintScriptWitnessWithPolicyId era
MintScriptWitnessWithPolicyId PolicyId
polId (ScriptWitness WitCtxMint era -> MintScriptWitnessWithPolicyId era)
-> ScriptWitness WitCtxMint era
-> MintScriptWitnessWithPolicyId era
forall a b. (a -> b) -> a -> b
$
              ScriptLanguageInEra SimpleScript' era
-> SimpleScriptOrReferenceInput SimpleScript'
-> ScriptWitness WitCtxMint era
forall era witctx.
ScriptLanguageInEra SimpleScript' era
-> SimpleScriptOrReferenceInput SimpleScript'
-> ScriptWitness witctx era
SimpleScriptWitness (ShelleyBasedEra era -> ScriptLanguageInEra SimpleScript' era
forall era.
ShelleyBasedEra era -> ScriptLanguageInEra SimpleScript' era
sbeToSimpleScriptLangInEra ShelleyBasedEra era
sbe) (SimpleScriptOrReferenceInput SimpleScript'
 -> ScriptWitness WitCtxMint era)
-> SimpleScriptOrReferenceInput SimpleScript'
-> ScriptWitness WitCtxMint era
forall a b. (a -> b) -> a -> b
$
                SimpleScript -> SimpleScriptOrReferenceInput SimpleScript'
forall lang. SimpleScript -> SimpleScriptOrReferenceInput lang
SScript SimpleScript
ss
    OnDiskPlutusScriptCliArgs File ScriptInAnyLang 'In
plutusScriptFp ScriptDataOrFile
redeemerFile ExecutionUnits
execUnits -> do
      let sFp :: FilePath
sFp = File ScriptInAnyLang 'In -> FilePath
forall content (direction :: FileDirection).
File content direction -> FilePath
unFile File ScriptInAnyLang 'In
plutusScriptFp
      AnyPlutusScript
plutusScript <-
        (FileError PlutusScriptDecodeError
 -> FileError CliScriptWitnessError)
-> ExceptT (FileError PlutusScriptDecodeError) m AnyPlutusScript
-> t m AnyPlutusScript
forall e' (t :: (* -> *) -> * -> *) (m :: * -> *) e a.
MonadTransError e' t m =>
(e -> e') -> ExceptT e m a -> t m a
modifyError ((PlutusScriptDecodeError -> CliScriptWitnessError)
-> FileError PlutusScriptDecodeError
-> FileError CliScriptWitnessError
forall a b. (a -> b) -> FileError a -> FileError b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap PlutusScriptDecodeError -> CliScriptWitnessError
PlutusScriptWitnessDecodeError) (ExceptT (FileError PlutusScriptDecodeError) m AnyPlutusScript
 -> t m AnyPlutusScript)
-> ExceptT (FileError PlutusScriptDecodeError) m AnyPlutusScript
-> t m AnyPlutusScript
forall a b. (a -> b) -> a -> b
$
          FilePath
-> ExceptT (FileError PlutusScriptDecodeError) m AnyPlutusScript
forall (t :: (* -> *) -> * -> *) (m :: * -> *).
MonadIOTransError (FileError PlutusScriptDecodeError) t m =>
FilePath -> t m AnyPlutusScript
readFilePlutusScript (FilePath
 -> ExceptT (FileError PlutusScriptDecodeError) m AnyPlutusScript)
-> FilePath
-> ExceptT (FileError PlutusScriptDecodeError) m AnyPlutusScript
forall a b. (a -> b) -> a -> b
$
            File ScriptInAnyLang 'In -> FilePath
forall content (direction :: FileDirection).
File content direction -> FilePath
unFile File ScriptInAnyLang 'In
plutusScriptFp

      HashableScriptData
redeemer <-
        (ScriptDataError -> FileError CliScriptWitnessError)
-> ExceptT ScriptDataError m HashableScriptData
-> t m HashableScriptData
forall e' (t :: (* -> *) -> * -> *) (m :: * -> *) e a.
MonadTransError e' t m =>
(e -> e') -> ExceptT e m a -> t m a
modifyError (FilePath
-> CliScriptWitnessError -> FileError CliScriptWitnessError
forall e. FilePath -> e -> FileError e
FileError FilePath
sFp (CliScriptWitnessError -> FileError CliScriptWitnessError)
-> (ScriptDataError -> CliScriptWitnessError)
-> ScriptDataError
-> FileError CliScriptWitnessError
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ScriptDataError -> CliScriptWitnessError
PlutusScriptWitnessRedeemerError) (ExceptT ScriptDataError m HashableScriptData
 -> t m HashableScriptData)
-> ExceptT ScriptDataError m HashableScriptData
-> t m HashableScriptData
forall a b. (a -> b) -> a -> b
$
          ScriptDataOrFile -> ExceptT ScriptDataError m HashableScriptData
forall (m :: * -> *).
MonadIO m =>
ScriptDataOrFile -> ExceptT ScriptDataError m HashableScriptData
readScriptDataOrFile ScriptDataOrFile
redeemerFile
      case AnyPlutusScript
plutusScript of
        AnyPlutusScript PlutusScriptVersion lang
lang PlutusScript lang
script -> do
          let pScript :: PlutusScriptOrReferenceInput lang
pScript = PlutusScript lang -> PlutusScriptOrReferenceInput lang
forall lang. PlutusScript lang -> PlutusScriptOrReferenceInput lang
PScript PlutusScript lang
script
              polId :: PolicyId
polId = ScriptHash -> PolicyId
PolicyId (ScriptHash -> PolicyId) -> ScriptHash -> PolicyId
forall a b. (a -> b) -> a -> b
$ Script lang -> ScriptHash
forall lang. Script lang -> ScriptHash
hashScript (Script lang -> ScriptHash) -> Script lang -> ScriptHash
forall a b. (a -> b) -> a -> b
$ PlutusScriptVersion lang -> PlutusScript lang -> Script lang
forall lang.
IsPlutusScriptLanguage lang =>
PlutusScriptVersion lang -> PlutusScript lang -> Script lang
PlutusScript PlutusScriptVersion lang
lang PlutusScript lang
script
          ScriptLanguageInEra lang era
sLangSupported <-
            (CliScriptWitnessError -> FileError CliScriptWitnessError)
-> ExceptT CliScriptWitnessError m (ScriptLanguageInEra lang era)
-> t m (ScriptLanguageInEra lang era)
forall e' (t :: (* -> *) -> * -> *) (m :: * -> *) e a.
MonadTransError e' t m =>
(e -> e') -> ExceptT e m a -> t m a
modifyError (FilePath
-> CliScriptWitnessError -> FileError CliScriptWitnessError
forall e. FilePath -> e -> FileError e
FileError FilePath
sFp)
              (ExceptT CliScriptWitnessError m (ScriptLanguageInEra lang era)
 -> t m (ScriptLanguageInEra lang era))
-> ExceptT CliScriptWitnessError m (ScriptLanguageInEra lang era)
-> t m (ScriptLanguageInEra lang era)
forall a b. (a -> b) -> a -> b
$ CliScriptWitnessError
-> Maybe (ScriptLanguageInEra lang era)
-> ExceptT CliScriptWitnessError m (ScriptLanguageInEra lang era)
forall (m :: * -> *) x a. Monad m => x -> Maybe a -> ExceptT x m a
hoistMaybe
                ( AnyPlutusScriptVersion
-> AnyShelleyBasedEra -> CliScriptWitnessError
PlutusScriptWitnessLanguageNotSupportedInEra
                    (PlutusScriptVersion lang -> AnyPlutusScriptVersion
forall lang.
IsPlutusScriptLanguage lang =>
PlutusScriptVersion lang -> AnyPlutusScriptVersion
AnyPlutusScriptVersion PlutusScriptVersion lang
lang)
                    (ShelleyBasedEra era
-> (ShelleyBasedEraConstraints era => AnyShelleyBasedEra)
-> AnyShelleyBasedEra
forall era a.
ShelleyBasedEra era -> (ShelleyBasedEraConstraints era => a) -> a
shelleyBasedEraConstraints ShelleyBasedEra era
sbe ((ShelleyBasedEraConstraints era => AnyShelleyBasedEra)
 -> AnyShelleyBasedEra)
-> (ShelleyBasedEraConstraints era => AnyShelleyBasedEra)
-> AnyShelleyBasedEra
forall a b. (a -> b) -> a -> b
$ ShelleyBasedEra era -> AnyShelleyBasedEra
forall era.
Typeable era =>
ShelleyBasedEra era -> AnyShelleyBasedEra
AnyShelleyBasedEra ShelleyBasedEra era
sbe)
                )
              (Maybe (ScriptLanguageInEra lang era)
 -> ExceptT CliScriptWitnessError m (ScriptLanguageInEra lang era))
-> Maybe (ScriptLanguageInEra lang era)
-> ExceptT CliScriptWitnessError m (ScriptLanguageInEra lang era)
forall a b. (a -> b) -> a -> b
$ ShelleyBasedEra era
-> ScriptLanguage lang -> Maybe (ScriptLanguageInEra lang era)
forall era lang.
ShelleyBasedEra era
-> ScriptLanguage lang -> Maybe (ScriptLanguageInEra lang era)
scriptLanguageSupportedInEra ShelleyBasedEra era
sbe
              (ScriptLanguage lang -> Maybe (ScriptLanguageInEra lang era))
-> ScriptLanguage lang -> Maybe (ScriptLanguageInEra lang era)
forall a b. (a -> b) -> a -> b
$ PlutusScriptVersion lang -> ScriptLanguage lang
forall lang.
IsPlutusScriptLanguage lang =>
PlutusScriptVersion lang -> ScriptLanguage lang
PlutusScriptLanguage PlutusScriptVersion lang
lang
          MintScriptWitnessWithPolicyId era
-> t m (MintScriptWitnessWithPolicyId era)
forall a. a -> t m a
forall (m :: * -> *) a. Monad m => a -> m a
return (MintScriptWitnessWithPolicyId era
 -> t m (MintScriptWitnessWithPolicyId era))
-> MintScriptWitnessWithPolicyId era
-> t m (MintScriptWitnessWithPolicyId era)
forall a b. (a -> b) -> a -> b
$
            PolicyId
-> ScriptWitness WitCtxMint era
-> MintScriptWitnessWithPolicyId era
forall era.
PolicyId
-> ScriptWitness WitCtxMint era
-> MintScriptWitnessWithPolicyId era
MintScriptWitnessWithPolicyId PolicyId
polId (ScriptWitness WitCtxMint era -> MintScriptWitnessWithPolicyId era)
-> ScriptWitness WitCtxMint era
-> MintScriptWitnessWithPolicyId era
forall a b. (a -> b) -> a -> b
$
              ScriptLanguageInEra lang era
-> PlutusScriptVersion lang
-> PlutusScriptOrReferenceInput lang
-> ScriptDatum WitCtxMint
-> HashableScriptData
-> ExecutionUnits
-> ScriptWitness WitCtxMint era
forall lang era witctx.
IsPlutusScriptLanguage lang =>
ScriptLanguageInEra lang era
-> PlutusScriptVersion lang
-> PlutusScriptOrReferenceInput lang
-> ScriptDatum witctx
-> HashableScriptData
-> ExecutionUnits
-> ScriptWitness witctx era
PlutusScriptWitness
                ScriptLanguageInEra lang era
sLangSupported
                PlutusScriptVersion lang
lang
                PlutusScriptOrReferenceInput lang
pScript
                ScriptDatum WitCtxMint
NoScriptDatumForMint
                HashableScriptData
redeemer
                ExecutionUnits
execUnits
readMintScriptWitness ShelleyBasedEra era
sbe (OnDiskSimpleRefScript (SimpleRefScriptCliArgs TxIn
refTxIn PolicyId
polId)) =
  MintScriptWitnessWithPolicyId era
-> t m (MintScriptWitnessWithPolicyId era)
forall a. a -> t m a
forall (m :: * -> *) a. Monad m => a -> m a
return (MintScriptWitnessWithPolicyId era
 -> t m (MintScriptWitnessWithPolicyId era))
-> MintScriptWitnessWithPolicyId era
-> t m (MintScriptWitnessWithPolicyId era)
forall a b. (a -> b) -> a -> b
$
    PolicyId
-> ScriptWitness WitCtxMint era
-> MintScriptWitnessWithPolicyId era
forall era.
PolicyId
-> ScriptWitness WitCtxMint era
-> MintScriptWitnessWithPolicyId era
MintScriptWitnessWithPolicyId PolicyId
polId (ScriptWitness WitCtxMint era -> MintScriptWitnessWithPolicyId era)
-> ScriptWitness WitCtxMint era
-> MintScriptWitnessWithPolicyId era
forall a b. (a -> b) -> a -> b
$
      ScriptLanguageInEra SimpleScript' era
-> SimpleScriptOrReferenceInput SimpleScript'
-> ScriptWitness WitCtxMint era
forall era witctx.
ScriptLanguageInEra SimpleScript' era
-> SimpleScriptOrReferenceInput SimpleScript'
-> ScriptWitness witctx era
SimpleScriptWitness
        (ShelleyBasedEra era -> ScriptLanguageInEra SimpleScript' era
forall era.
ShelleyBasedEra era -> ScriptLanguageInEra SimpleScript' era
sbeToSimpleScriptLangInEra ShelleyBasedEra era
sbe)
        (TxIn -> SimpleScriptOrReferenceInput SimpleScript'
forall lang. TxIn -> SimpleScriptOrReferenceInput lang
SReferenceScript TxIn
refTxIn)
readMintScriptWitness
  ShelleyBasedEra era
sbe
  ( OnDiskPlutusRefScript
      (PlutusRefScriptCliArgs TxIn
refTxIn AnyPlutusScriptVersion
anyPlutusScriptVersion ScriptDataOrFile
redeemerFile ExecutionUnits
execUnits PolicyId
polId)
    ) = do
    case AnyPlutusScriptVersion
anyPlutusScriptVersion of
      AnyPlutusScriptVersion PlutusScriptVersion lang
lang -> do
        let pScript :: PlutusScriptOrReferenceInput lang
pScript = TxIn -> PlutusScriptOrReferenceInput lang
forall lang. TxIn -> PlutusScriptOrReferenceInput lang
PReferenceScript TxIn
refTxIn
        HashableScriptData
redeemer <-
          -- TODO: Implement a new error type to capture this. FileError is not representative of cases
          -- where we do not have access to the script.
          (ScriptDataError -> FileError CliScriptWitnessError)
-> ExceptT ScriptDataError m HashableScriptData
-> t m HashableScriptData
forall e' (t :: (* -> *) -> * -> *) (m :: * -> *) e a.
MonadTransError e' t m =>
(e -> e') -> ExceptT e m a -> t m a
modifyError (FilePath
-> CliScriptWitnessError -> FileError CliScriptWitnessError
forall e. FilePath -> e -> FileError e
FileError FilePath
"Reference script filepath not available" (CliScriptWitnessError -> FileError CliScriptWitnessError)
-> (ScriptDataError -> CliScriptWitnessError)
-> ScriptDataError
-> FileError CliScriptWitnessError
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ScriptDataError -> CliScriptWitnessError
PlutusScriptWitnessRedeemerError) (ExceptT ScriptDataError m HashableScriptData
 -> t m HashableScriptData)
-> ExceptT ScriptDataError m HashableScriptData
-> t m HashableScriptData
forall a b. (a -> b) -> a -> b
$
            ScriptDataOrFile -> ExceptT ScriptDataError m HashableScriptData
forall (m :: * -> *).
MonadIO m =>
ScriptDataOrFile -> ExceptT ScriptDataError m HashableScriptData
readScriptDataOrFile ScriptDataOrFile
redeemerFile
        ScriptLanguageInEra lang era
sLangSupported <-
          -- TODO: Implement a new error type to capture this. FileError is not representative of cases
          -- where we do not have access to the script.
          (CliScriptWitnessError -> FileError CliScriptWitnessError)
-> ExceptT CliScriptWitnessError m (ScriptLanguageInEra lang era)
-> t m (ScriptLanguageInEra lang era)
forall e' (t :: (* -> *) -> * -> *) (m :: * -> *) e a.
MonadTransError e' t m =>
(e -> e') -> ExceptT e m a -> t m a
modifyError (FilePath
-> CliScriptWitnessError -> FileError CliScriptWitnessError
forall e. FilePath -> e -> FileError e
FileError FilePath
"Reference script filepath not available")
            (ExceptT CliScriptWitnessError m (ScriptLanguageInEra lang era)
 -> t m (ScriptLanguageInEra lang era))
-> ExceptT CliScriptWitnessError m (ScriptLanguageInEra lang era)
-> t m (ScriptLanguageInEra lang era)
forall a b. (a -> b) -> a -> b
$ CliScriptWitnessError
-> Maybe (ScriptLanguageInEra lang era)
-> ExceptT CliScriptWitnessError m (ScriptLanguageInEra lang era)
forall (m :: * -> *) x a. Monad m => x -> Maybe a -> ExceptT x m a
hoistMaybe
              ( AnyPlutusScriptVersion
-> AnyShelleyBasedEra -> CliScriptWitnessError
PlutusScriptWitnessLanguageNotSupportedInEra
                  (PlutusScriptVersion lang -> AnyPlutusScriptVersion
forall lang.
IsPlutusScriptLanguage lang =>
PlutusScriptVersion lang -> AnyPlutusScriptVersion
AnyPlutusScriptVersion PlutusScriptVersion lang
lang)
                  (ShelleyBasedEra era
-> (ShelleyBasedEraConstraints era => AnyShelleyBasedEra)
-> AnyShelleyBasedEra
forall era a.
ShelleyBasedEra era -> (ShelleyBasedEraConstraints era => a) -> a
shelleyBasedEraConstraints ShelleyBasedEra era
sbe ((ShelleyBasedEraConstraints era => AnyShelleyBasedEra)
 -> AnyShelleyBasedEra)
-> (ShelleyBasedEraConstraints era => AnyShelleyBasedEra)
-> AnyShelleyBasedEra
forall a b. (a -> b) -> a -> b
$ ShelleyBasedEra era -> AnyShelleyBasedEra
forall era.
Typeable era =>
ShelleyBasedEra era -> AnyShelleyBasedEra
AnyShelleyBasedEra ShelleyBasedEra era
sbe)
              )
            (Maybe (ScriptLanguageInEra lang era)
 -> ExceptT CliScriptWitnessError m (ScriptLanguageInEra lang era))
-> Maybe (ScriptLanguageInEra lang era)
-> ExceptT CliScriptWitnessError m (ScriptLanguageInEra lang era)
forall a b. (a -> b) -> a -> b
$ ShelleyBasedEra era
-> ScriptLanguage lang -> Maybe (ScriptLanguageInEra lang era)
forall era lang.
ShelleyBasedEra era
-> ScriptLanguage lang -> Maybe (ScriptLanguageInEra lang era)
scriptLanguageSupportedInEra ShelleyBasedEra era
sbe
            (ScriptLanguage lang -> Maybe (ScriptLanguageInEra lang era))
-> ScriptLanguage lang -> Maybe (ScriptLanguageInEra lang era)
forall a b. (a -> b) -> a -> b
$ PlutusScriptVersion lang -> ScriptLanguage lang
forall lang.
IsPlutusScriptLanguage lang =>
PlutusScriptVersion lang -> ScriptLanguage lang
PlutusScriptLanguage PlutusScriptVersion lang
lang
        MintScriptWitnessWithPolicyId era
-> t m (MintScriptWitnessWithPolicyId era)
forall a. a -> t m a
forall (m :: * -> *) a. Monad m => a -> m a
return (MintScriptWitnessWithPolicyId era
 -> t m (MintScriptWitnessWithPolicyId era))
-> MintScriptWitnessWithPolicyId era
-> t m (MintScriptWitnessWithPolicyId era)
forall a b. (a -> b) -> a -> b
$
          PolicyId
-> ScriptWitness WitCtxMint era
-> MintScriptWitnessWithPolicyId era
forall era.
PolicyId
-> ScriptWitness WitCtxMint era
-> MintScriptWitnessWithPolicyId era
MintScriptWitnessWithPolicyId PolicyId
polId (ScriptWitness WitCtxMint era -> MintScriptWitnessWithPolicyId era)
-> ScriptWitness WitCtxMint era
-> MintScriptWitnessWithPolicyId era
forall a b. (a -> b) -> a -> b
$
            ScriptLanguageInEra lang era
-> PlutusScriptVersion lang
-> PlutusScriptOrReferenceInput lang
-> ScriptDatum WitCtxMint
-> HashableScriptData
-> ExecutionUnits
-> ScriptWitness WitCtxMint era
forall lang era witctx.
IsPlutusScriptLanguage lang =>
ScriptLanguageInEra lang era
-> PlutusScriptVersion lang
-> PlutusScriptOrReferenceInput lang
-> ScriptDatum witctx
-> HashableScriptData
-> ExecutionUnits
-> ScriptWitness witctx era
PlutusScriptWitness
              ScriptLanguageInEra lang era
sLangSupported
              PlutusScriptVersion lang
lang
              PlutusScriptOrReferenceInput lang
pScript
              ScriptDatum WitCtxMint
NoScriptDatumForMint
              HashableScriptData
redeemer
              ExecutionUnits
execUnits

-- TODO: Remove me when exposed from cardano-api
sbeToSimpleScriptLangInEra
  :: ShelleyBasedEra era -> ScriptLanguageInEra SimpleScript' era
sbeToSimpleScriptLangInEra :: forall era.
ShelleyBasedEra era -> ScriptLanguageInEra SimpleScript' era
sbeToSimpleScriptLangInEra ShelleyBasedEra era
ShelleyBasedEraShelley = ScriptLanguageInEra SimpleScript' era
ScriptLanguageInEra SimpleScript' ShelleyEra
SimpleScriptInShelley
sbeToSimpleScriptLangInEra ShelleyBasedEra era
ShelleyBasedEraAllegra = ScriptLanguageInEra SimpleScript' era
ScriptLanguageInEra SimpleScript' AllegraEra
SimpleScriptInAllegra
sbeToSimpleScriptLangInEra ShelleyBasedEra era
ShelleyBasedEraMary = ScriptLanguageInEra SimpleScript' era
ScriptLanguageInEra SimpleScript' MaryEra
SimpleScriptInMary
sbeToSimpleScriptLangInEra ShelleyBasedEra era
ShelleyBasedEraAlonzo = ScriptLanguageInEra SimpleScript' era
ScriptLanguageInEra SimpleScript' AlonzoEra
SimpleScriptInAlonzo
sbeToSimpleScriptLangInEra ShelleyBasedEra era
ShelleyBasedEraBabbage = ScriptLanguageInEra SimpleScript' era
ScriptLanguageInEra SimpleScript' BabbageEra
SimpleScriptInBabbage
sbeToSimpleScriptLangInEra ShelleyBasedEra era
ShelleyBasedEraConway = ScriptLanguageInEra SimpleScript' era
ScriptLanguageInEra SimpleScript' ConwayEra
SimpleScriptInConway