{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeFamilyDependencies #-}
module Cardano.Api.Experimental.Plutus.Internal.Shim.LegacyScripts
( convertToNewScriptWitness
, legacyWitnessToScriptRequirements
, legacyWitnessConversion
, obtainMonoidConstraint
, toPlutusSLanguage
, fromPlutusSLanguage
, mkLegacyPolicyId
)
where
import Cardano.Api.Era.Internal.Eon.AlonzoEraOnwards
import Cardano.Api.Era.Internal.Eon.ShelleyBasedEra
import Cardano.Api.Experimental.AnyScriptWitness
import Cardano.Api.Experimental.Era (obtainCommonConstraints)
import Cardano.Api.Experimental.Era qualified as Exp
import Cardano.Api.Experimental.Plutus.Internal.IndexedPlutusScriptWitness
import Cardano.Api.Experimental.Plutus.Internal.Script
import Cardano.Api.Experimental.Plutus.Internal.ScriptWitness
import Cardano.Api.Experimental.Simple.Script
import Cardano.Api.Experimental.Tx.Internal.AnyWitness
import Cardano.Api.Experimental.Tx.Internal.TxScriptWitnessRequirements hiding
( obtainMonoidConstraint
)
import Cardano.Api.Plutus.Internal.Script
( ExecutionUnits
, Witness
)
import Cardano.Api.Plutus.Internal.Script qualified as Old
import Cardano.Api.Pretty
import Cardano.Api.Tx.Internal.BuildTxWith
import Cardano.Api.Tx.Internal.TxIn
import Cardano.Api.Value.Internal qualified as Old
import Cardano.Binary qualified as CBOR
import Cardano.Ledger.Alonzo.Scripts qualified as L
import Cardano.Ledger.BaseTypes (Version)
import Cardano.Ledger.Core qualified as L
import Cardano.Ledger.Mary.Value qualified as L
import Cardano.Ledger.Plutus.Language qualified as L
import Data.Text qualified as Text
import Data.Typeable
toAnyWitness
:: AlonzoEraOnwards era
-> (Witnessable thing (ShelleyLedgerEra era), BuildTxWith BuildTx (Witness witctx era))
-> Either
CBOR.DecoderError
(Witnessable thing (ShelleyLedgerEra era), AnyWitness (ShelleyLedgerEra era))
toAnyWitness :: forall era (thing :: WitnessableItem) witctx.
AlonzoEraOnwards era
-> (Witnessable thing (ShelleyLedgerEra era),
BuildTxWith BuildTx (Witness witctx era))
-> Either
DecoderError
(Witnessable thing (ShelleyLedgerEra era),
AnyWitness (ShelleyLedgerEra era))
toAnyWitness AlonzoEraOnwards era
_ (Witnessable thing (ShelleyLedgerEra era)
witnessable, BuildTxWith (Old.KeyWitness KeyWitnessInCtx witctx
_)) =
(Witnessable thing (ShelleyLedgerEra era),
AnyWitness (ShelleyLedgerEra era))
-> Either
DecoderError
(Witnessable thing (ShelleyLedgerEra era),
AnyWitness (ShelleyLedgerEra era))
forall a. a -> Either DecoderError a
forall (m :: * -> *) a. Monad m => a -> m a
return (Witnessable thing (ShelleyLedgerEra era)
witnessable, AnyWitness (ShelleyLedgerEra era)
forall era. AnyWitness era
AnyKeyWitnessPlaceholder)
toAnyWitness AlonzoEraOnwards era
eon (Witnessable thing (ShelleyLedgerEra era)
witnessable, BuildTxWith (Old.ScriptWitness ScriptWitnessInCtx witctx
_ oldSw :: ScriptWitness witctx era
oldSw@Old.SimpleScriptWitness{})) =
AlonzoEraOnwards era
-> ScriptWitness witctx era
-> Witnessable thing (ShelleyLedgerEra era)
-> Either
DecoderError
(Witnessable thing (ShelleyLedgerEra era),
AnyWitness (ShelleyLedgerEra era))
forall era witctx (thing :: WitnessableItem).
AlonzoEraOnwards era
-> ScriptWitness witctx era
-> Witnessable thing (ShelleyLedgerEra era)
-> Either
DecoderError
(Witnessable thing (ShelleyLedgerEra era),
AnyWitness (ShelleyLedgerEra era))
convertToNewScriptWitness AlonzoEraOnwards era
eon ScriptWitness witctx era
oldSw Witnessable thing (ShelleyLedgerEra era)
witnessable
toAnyWitness AlonzoEraOnwards era
eon (Witnessable thing (ShelleyLedgerEra era)
witnessable, BuildTxWith (Old.ScriptWitness ScriptWitnessInCtx witctx
_ ScriptWitness witctx era
oldApiPlutusScriptWitness)) =
AlonzoEraOnwards era
-> ScriptWitness witctx era
-> Witnessable thing (ShelleyLedgerEra era)
-> Either
DecoderError
(Witnessable thing (ShelleyLedgerEra era),
AnyWitness (ShelleyLedgerEra era))
forall era witctx (thing :: WitnessableItem).
AlonzoEraOnwards era
-> ScriptWitness witctx era
-> Witnessable thing (ShelleyLedgerEra era)
-> Either
DecoderError
(Witnessable thing (ShelleyLedgerEra era),
AnyWitness (ShelleyLedgerEra era))
convertToNewScriptWitness AlonzoEraOnwards era
eon ScriptWitness witctx era
oldApiPlutusScriptWitness Witnessable thing (ShelleyLedgerEra era)
witnessable
type family ToPlutusScriptPurpose witnessable = (purpose :: PlutusScriptPurpose) | purpose -> witnessable where
ToPlutusScriptPurpose TxInItem = SpendingScript
ToPlutusScriptPurpose CertItem = MintingScript
ToPlutusScriptPurpose MintItem = CertifyingScript
ToPlutusScriptPurpose WithdrawalItem = WithdrawingScript
ToPlutusScriptPurpose VoterItem = ProposingScript
ToPlutusScriptPurpose ProposalItem = VotingScript
convertToNewScriptWitness
:: AlonzoEraOnwards era
-> Old.ScriptWitness witctx era
-> Witnessable thing (ShelleyLedgerEra era)
-> Either
CBOR.DecoderError
(Witnessable thing (ShelleyLedgerEra era), AnyWitness (ShelleyLedgerEra era))
convertToNewScriptWitness :: forall era witctx (thing :: WitnessableItem).
AlonzoEraOnwards era
-> ScriptWitness witctx era
-> Witnessable thing (ShelleyLedgerEra era)
-> Either
DecoderError
(Witnessable thing (ShelleyLedgerEra era),
AnyWitness (ShelleyLedgerEra era))
convertToNewScriptWitness AlonzoEraOnwards era
eon (Old.PlutusScriptWitness ScriptLanguageInEra lang era
_ PlutusScriptVersion lang
v PlutusScriptOrReferenceInput lang
scriptOrRefInput ScriptDatum witctx
datum ScriptRedeemer
scriptRedeemer ExecutionUnits
execUnits) Witnessable thing (ShelleyLedgerEra era)
witnessable = do
let d :: PlutusScriptDatum
(ToLedgerPlutusLanguage lang) (PlutusScriptFor thing)
d = Witnessable thing (ShelleyLedgerEra era)
-> PlutusScriptVersion lang
-> ScriptDatum witctx
-> PlutusScriptDatum
(ToLedgerPlutusLanguage lang) (PlutusScriptFor thing)
forall (thing :: WitnessableItem) era lang witctx.
Witnessable thing era
-> PlutusScriptVersion lang
-> ScriptDatum witctx
-> PlutusScriptDatum
(ToLedgerPlutusLanguage lang) (PlutusScriptFor thing)
createPlutusScriptDatum Witnessable thing (ShelleyLedgerEra era)
witnessable PlutusScriptVersion lang
v ScriptDatum witctx
datum
newScriptWitness <-
PlutusScriptVersion lang
-> (PlutusLanguage (ToLedgerPlutusLanguage lang) =>
Either DecoderError (AnyWitness (ShelleyLedgerEra era)))
-> Either DecoderError (AnyWitness (ShelleyLedgerEra era))
forall lang a.
PlutusScriptVersion lang
-> (PlutusLanguage (ToLedgerPlutusLanguage lang) => a) -> a
obtainConstraints PlutusScriptVersion lang
v ((PlutusLanguage (ToLedgerPlutusLanguage lang) =>
Either DecoderError (AnyWitness (ShelleyLedgerEra era)))
-> Either DecoderError (AnyWitness (ShelleyLedgerEra era)))
-> (PlutusLanguage (ToLedgerPlutusLanguage lang) =>
Either DecoderError (AnyWitness (ShelleyLedgerEra era)))
-> Either DecoderError (AnyWitness (ShelleyLedgerEra era))
forall a b. (a -> b) -> a -> b
$
AlonzoEraOnwards era
-> Witnessable thing (ShelleyLedgerEra era)
-> PlutusScriptVersion lang
-> PlutusScriptOrReferenceInput lang
-> ScriptRedeemer
-> ExecutionUnits
-> PlutusScriptDatum
(ToLedgerPlutusLanguage lang) (PlutusScriptFor thing)
-> Either DecoderError (AnyWitness (ShelleyLedgerEra era))
forall era lang (thing :: WitnessableItem).
PlutusLanguage (ToLedgerPlutusLanguage lang) =>
AlonzoEraOnwards era
-> Witnessable thing (ShelleyLedgerEra era)
-> PlutusScriptVersion lang
-> PlutusScriptOrReferenceInput lang
-> ScriptRedeemer
-> ExecutionUnits
-> PlutusScriptDatum
(ToLedgerPlutusLanguage lang) (PlutusScriptFor thing)
-> Either DecoderError (AnyWitness (ShelleyLedgerEra era))
toNewPlutusScriptWitness
AlonzoEraOnwards era
eon
Witnessable thing (ShelleyLedgerEra era)
witnessable
PlutusScriptVersion lang
v
PlutusScriptOrReferenceInput lang
scriptOrRefInput
ScriptRedeemer
scriptRedeemer
ExecutionUnits
execUnits
PlutusScriptDatum
(ToLedgerPlutusLanguage lang) (PlutusScriptFor thing)
d
return (witnessable, newScriptWitness)
convertToNewScriptWitness AlonzoEraOnwards era
eon (Old.SimpleScriptWitness ScriptLanguageInEra SimpleScript' era
_ SimpleScriptOrReferenceInput SimpleScript'
scriptOrRefInput) Witnessable thing (ShelleyLedgerEra era)
witnessable =
case SimpleScriptOrReferenceInput SimpleScript'
scriptOrRefInput of
Old.SScript SimpleScript
simpleScript -> AlonzoEraOnwards era
-> (AlonzoEraOnwardsConstraints era =>
Either
DecoderError
(Witnessable thing (ShelleyLedgerEra era),
AnyWitness (ShelleyLedgerEra era)))
-> Either
DecoderError
(Witnessable thing (ShelleyLedgerEra era),
AnyWitness (ShelleyLedgerEra era))
forall era a.
AlonzoEraOnwards era -> (AlonzoEraOnwardsConstraints era => a) -> a
alonzoEraOnwardsConstraints AlonzoEraOnwards era
eon ((AlonzoEraOnwardsConstraints era =>
Either
DecoderError
(Witnessable thing (ShelleyLedgerEra era),
AnyWitness (ShelleyLedgerEra era)))
-> Either
DecoderError
(Witnessable thing (ShelleyLedgerEra era),
AnyWitness (ShelleyLedgerEra era)))
-> (AlonzoEraOnwardsConstraints era =>
Either
DecoderError
(Witnessable thing (ShelleyLedgerEra era),
AnyWitness (ShelleyLedgerEra era)))
-> Either
DecoderError
(Witnessable thing (ShelleyLedgerEra era),
AnyWitness (ShelleyLedgerEra era))
forall a b. (a -> b) -> a -> b
$ do
let timelock :: NativeScript (ShelleyLedgerEra era)
timelock = AlonzoEraOnwards era
-> SimpleScript -> NativeScript (ShelleyLedgerEra era)
forall era.
AlonzoEraOnwards era
-> SimpleScript -> NativeScript (ShelleyLedgerEra era)
convertTotimelock AlonzoEraOnwards era
eon SimpleScript
simpleScript
(Witnessable thing (ShelleyLedgerEra era),
AnyWitness (ShelleyLedgerEra era))
-> Either
DecoderError
(Witnessable thing (ShelleyLedgerEra era),
AnyWitness (ShelleyLedgerEra era))
forall a. a -> Either DecoderError a
forall (m :: * -> *) a. Monad m => a -> m a
return (Witnessable thing (ShelleyLedgerEra era)
witnessable, SimpleScriptOrReferenceInput (ShelleyLedgerEra era)
-> AnyWitness (ShelleyLedgerEra era)
forall era. SimpleScriptOrReferenceInput era -> AnyWitness era
AnySimpleScriptWitness (SimpleScriptOrReferenceInput (ShelleyLedgerEra era)
-> AnyWitness (ShelleyLedgerEra era))
-> SimpleScriptOrReferenceInput (ShelleyLedgerEra era)
-> AnyWitness (ShelleyLedgerEra era)
forall a b. (a -> b) -> a -> b
$ SimpleScript (ShelleyLedgerEra era)
-> SimpleScriptOrReferenceInput (ShelleyLedgerEra era)
forall era. SimpleScript era -> SimpleScriptOrReferenceInput era
SScript (SimpleScript (ShelleyLedgerEra era)
-> SimpleScriptOrReferenceInput (ShelleyLedgerEra era))
-> SimpleScript (ShelleyLedgerEra era)
-> SimpleScriptOrReferenceInput (ShelleyLedgerEra era)
forall a b. (a -> b) -> a -> b
$ NativeScript (ShelleyLedgerEra era)
-> SimpleScript (ShelleyLedgerEra era)
forall era. EraScript era => NativeScript era -> SimpleScript era
SimpleScript NativeScript (ShelleyLedgerEra era)
timelock)
Old.SReferenceScript TxIn
txIn ->
(Witnessable thing (ShelleyLedgerEra era),
AnyWitness (ShelleyLedgerEra era))
-> Either
DecoderError
(Witnessable thing (ShelleyLedgerEra era),
AnyWitness (ShelleyLedgerEra era))
forall a. a -> Either DecoderError a
forall (m :: * -> *) a. Monad m => a -> m a
return (Witnessable thing (ShelleyLedgerEra era)
witnessable, SimpleScriptOrReferenceInput (ShelleyLedgerEra era)
-> AnyWitness (ShelleyLedgerEra era)
forall era. SimpleScriptOrReferenceInput era -> AnyWitness era
AnySimpleScriptWitness (SimpleScriptOrReferenceInput (ShelleyLedgerEra era)
-> AnyWitness (ShelleyLedgerEra era))
-> SimpleScriptOrReferenceInput (ShelleyLedgerEra era)
-> AnyWitness (ShelleyLedgerEra era)
forall a b. (a -> b) -> a -> b
$ TxIn -> SimpleScriptOrReferenceInput (ShelleyLedgerEra era)
forall era. TxIn -> SimpleScriptOrReferenceInput era
SReferenceScript TxIn
txIn)
convertTotimelock
:: AlonzoEraOnwards era -> Old.SimpleScript -> L.NativeScript (ShelleyLedgerEra era)
convertTotimelock :: forall era.
AlonzoEraOnwards era
-> SimpleScript -> NativeScript (ShelleyLedgerEra era)
convertTotimelock AlonzoEraOnwards era
eon SimpleScript
s = AlonzoEraOnwards era
-> (AlonzoEraOnwardsConstraints era =>
NativeScript (ShelleyLedgerEra era))
-> NativeScript (ShelleyLedgerEra era)
forall era a.
AlonzoEraOnwards era -> (AlonzoEraOnwardsConstraints era => a) -> a
alonzoEraOnwardsConstraints AlonzoEraOnwards era
eon ((AlonzoEraOnwardsConstraints era =>
NativeScript (ShelleyLedgerEra era))
-> NativeScript (ShelleyLedgerEra era))
-> (AlonzoEraOnwardsConstraints era =>
NativeScript (ShelleyLedgerEra era))
-> NativeScript (ShelleyLedgerEra era)
forall a b. (a -> b) -> a -> b
$ SimpleScript -> NativeScript (ShelleyLedgerEra era)
forall era.
(AllegraEraScript era, NativeScript era ~ Timelock era) =>
SimpleScript -> NativeScript era
Old.toAllegraTimelock SimpleScript
s
createPlutusScriptDatum
:: Witnessable thing era
-> Old.PlutusScriptVersion lang
-> Old.ScriptDatum witctx
-> PlutusScriptDatum (Old.ToLedgerPlutusLanguage lang) (PlutusScriptFor thing)
createPlutusScriptDatum :: forall (thing :: WitnessableItem) era lang witctx.
Witnessable thing era
-> PlutusScriptVersion lang
-> ScriptDatum witctx
-> PlutusScriptDatum
(ToLedgerPlutusLanguage lang) (PlutusScriptFor thing)
createPlutusScriptDatum Witnessable thing era
missingContext PlutusScriptVersion lang
plutusVersion ScriptDatum witctx
oldDatum =
case (Witnessable thing era
missingContext, ScriptDatum witctx
oldDatum) of
(w :: Witnessable thing era
w@WitTxIn{}, d :: ScriptDatum witctx
d@Old.ScriptDatumForTxIn{}) -> Witnessable 'TxInItem era
-> PlutusScriptVersion lang
-> ScriptDatum WitCtxTxIn
-> PlutusScriptDatum
(ToLedgerPlutusLanguage lang) (ToPlutusScriptPurpose 'TxInItem)
forall era lang.
Witnessable 'TxInItem era
-> PlutusScriptVersion lang
-> ScriptDatum WitCtxTxIn
-> PlutusScriptDatum
(ToLedgerPlutusLanguage lang) (ToPlutusScriptPurpose 'TxInItem)
toPlutusScriptDatum Witnessable thing era
Witnessable 'TxInItem era
w PlutusScriptVersion lang
plutusVersion ScriptDatum witctx
ScriptDatum WitCtxTxIn
d
(WitTxIn{}, ScriptDatum witctx
_) -> PlutusScriptDatum (ToLedgerPlutusLanguage lang) 'SpendingScript
PlutusScriptDatum
(ToLedgerPlutusLanguage lang) (PlutusScriptFor thing)
forall (lang :: Language) (purpose :: PlutusScriptPurpose).
PlutusScriptDatum lang purpose
NoScriptDatum
(WitMint{}, ScriptDatum witctx
_) -> PlutusScriptDatum (ToLedgerPlutusLanguage lang) 'MintingScript
PlutusScriptDatum
(ToLedgerPlutusLanguage lang) (PlutusScriptFor thing)
forall (lang :: Language) (purpose :: PlutusScriptPurpose).
PlutusScriptDatum lang purpose
NoScriptDatum
(WitWithdrawal{}, ScriptDatum witctx
_) -> PlutusScriptDatum (ToLedgerPlutusLanguage lang) 'WithdrawingScript
PlutusScriptDatum
(ToLedgerPlutusLanguage lang) (PlutusScriptFor thing)
forall (lang :: Language) (purpose :: PlutusScriptPurpose).
PlutusScriptDatum lang purpose
NoScriptDatum
(WitProposal{}, ScriptDatum witctx
_) -> PlutusScriptDatum (ToLedgerPlutusLanguage lang) 'ProposingScript
PlutusScriptDatum
(ToLedgerPlutusLanguage lang) (PlutusScriptFor thing)
forall (lang :: Language) (purpose :: PlutusScriptPurpose).
PlutusScriptDatum lang purpose
NoScriptDatum
(WitVote{}, ScriptDatum witctx
_) -> PlutusScriptDatum (ToLedgerPlutusLanguage lang) 'VotingScript
PlutusScriptDatum
(ToLedgerPlutusLanguage lang) (PlutusScriptFor thing)
forall (lang :: Language) (purpose :: PlutusScriptPurpose).
PlutusScriptDatum lang purpose
NoScriptDatum
(WitTxCert{}, ScriptDatum witctx
_) -> PlutusScriptDatum (ToLedgerPlutusLanguage lang) 'CertifyingScript
PlutusScriptDatum
(ToLedgerPlutusLanguage lang) (PlutusScriptFor thing)
forall (lang :: Language) (purpose :: PlutusScriptPurpose).
PlutusScriptDatum lang purpose
NoScriptDatum
toPlutusScriptDatum
:: Witnessable TxInItem era
-> Old.PlutusScriptVersion lang
-> Old.ScriptDatum Old.WitCtxTxIn
-> PlutusScriptDatum (Old.ToLedgerPlutusLanguage lang) (ToPlutusScriptPurpose TxInItem)
toPlutusScriptDatum :: forall era lang.
Witnessable 'TxInItem era
-> PlutusScriptVersion lang
-> ScriptDatum WitCtxTxIn
-> PlutusScriptDatum
(ToLedgerPlutusLanguage lang) (ToPlutusScriptPurpose 'TxInItem)
toPlutusScriptDatum WitTxIn{} PlutusScriptVersion lang
Old.PlutusScriptV4 (Old.ScriptDatumForTxIn Maybe ScriptRedeemer
r) = PlutusScriptDatumF 'PlutusV4 'SpendingScript
-> PlutusScriptDatum 'PlutusV4 'SpendingScript
forall (lang :: Language).
PlutusScriptDatumF lang 'SpendingScript
-> PlutusScriptDatum lang 'SpendingScript
SpendingScriptDatum Maybe ScriptRedeemer
PlutusScriptDatumF 'PlutusV4 'SpendingScript
r
toPlutusScriptDatum WitTxIn{} PlutusScriptVersion lang
Old.PlutusScriptV3 (Old.ScriptDatumForTxIn Maybe ScriptRedeemer
r) = PlutusScriptDatumF 'PlutusV3 'SpendingScript
-> PlutusScriptDatum 'PlutusV3 'SpendingScript
forall (lang :: Language).
PlutusScriptDatumF lang 'SpendingScript
-> PlutusScriptDatum lang 'SpendingScript
SpendingScriptDatum Maybe ScriptRedeemer
PlutusScriptDatumF 'PlutusV3 'SpendingScript
r
toPlutusScriptDatum WitTxIn{} PlutusScriptVersion lang
Old.PlutusScriptV2 (Old.ScriptDatumForTxIn (Just ScriptRedeemer
r)) = PlutusScriptDatumF 'PlutusV2 'SpendingScript
-> PlutusScriptDatum 'PlutusV2 'SpendingScript
forall (lang :: Language).
PlutusScriptDatumF lang 'SpendingScript
-> PlutusScriptDatum lang 'SpendingScript
SpendingScriptDatum ScriptRedeemer
PlutusScriptDatumF 'PlutusV2 'SpendingScript
r
toPlutusScriptDatum WitTxIn{} PlutusScriptVersion lang
Old.PlutusScriptV1 (Old.ScriptDatumForTxIn (Just ScriptRedeemer
r)) = PlutusScriptDatumF 'PlutusV1 'SpendingScript
-> PlutusScriptDatum 'PlutusV1 'SpendingScript
forall (lang :: Language).
PlutusScriptDatumF lang 'SpendingScript
-> PlutusScriptDatum lang 'SpendingScript
SpendingScriptDatum ScriptRedeemer
PlutusScriptDatumF 'PlutusV1 'SpendingScript
r
toPlutusScriptDatum WitTxIn{} PlutusScriptVersion lang
Old.PlutusScriptV4 ScriptDatum WitCtxTxIn
Old.InlineScriptDatum = PlutusScriptDatum 'PlutusV4 'SpendingScript
PlutusScriptDatum
(ToLedgerPlutusLanguage lang) (ToPlutusScriptPurpose 'TxInItem)
forall (lang :: Language) (purpose :: PlutusScriptPurpose).
PlutusScriptDatum lang purpose
InlineDatum
toPlutusScriptDatum WitTxIn{} PlutusScriptVersion lang
Old.PlutusScriptV3 ScriptDatum WitCtxTxIn
Old.InlineScriptDatum = PlutusScriptDatum 'PlutusV3 'SpendingScript
PlutusScriptDatum
(ToLedgerPlutusLanguage lang) (ToPlutusScriptPurpose 'TxInItem)
forall (lang :: Language) (purpose :: PlutusScriptPurpose).
PlutusScriptDatum lang purpose
InlineDatum
toPlutusScriptDatum WitTxIn{} PlutusScriptVersion lang
Old.PlutusScriptV2 ScriptDatum WitCtxTxIn
Old.InlineScriptDatum = PlutusScriptDatum 'PlutusV2 'SpendingScript
PlutusScriptDatum
(ToLedgerPlutusLanguage lang) (ToPlutusScriptPurpose 'TxInItem)
forall (lang :: Language) (purpose :: PlutusScriptPurpose).
PlutusScriptDatum lang purpose
InlineDatum
toPlutusScriptDatum WitTxIn{} PlutusScriptVersion lang
Old.PlutusScriptV1 ScriptDatum WitCtxTxIn
Old.InlineScriptDatum = PlutusScriptDatum 'PlutusV1 'SpendingScript
PlutusScriptDatum
(ToLedgerPlutusLanguage lang) (ToPlutusScriptPurpose 'TxInItem)
forall (lang :: Language) (purpose :: PlutusScriptPurpose).
PlutusScriptDatum lang purpose
NoScriptDatum
toPlutusScriptDatum WitTxIn{} PlutusScriptVersion lang
Old.PlutusScriptV1 (Old.ScriptDatumForTxIn Maybe ScriptRedeemer
Nothing) = PlutusScriptDatum 'PlutusV1 'SpendingScript
PlutusScriptDatum
(ToLedgerPlutusLanguage lang) (ToPlutusScriptPurpose 'TxInItem)
forall (lang :: Language) (purpose :: PlutusScriptPurpose).
PlutusScriptDatum lang purpose
NoScriptDatum
toPlutusScriptDatum WitTxIn{} PlutusScriptVersion lang
Old.PlutusScriptV2 (Old.ScriptDatumForTxIn Maybe ScriptRedeemer
Nothing) = PlutusScriptDatum 'PlutusV2 'SpendingScript
PlutusScriptDatum
(ToLedgerPlutusLanguage lang) (ToPlutusScriptPurpose 'TxInItem)
forall (lang :: Language) (purpose :: PlutusScriptPurpose).
PlutusScriptDatum lang purpose
NoScriptDatum
toNewPlutusScriptWitness
:: forall era lang thing
. L.PlutusLanguage (Old.ToLedgerPlutusLanguage lang)
=> AlonzoEraOnwards era
-> Witnessable thing (ShelleyLedgerEra era)
-> Old.PlutusScriptVersion lang
-> Old.PlutusScriptOrReferenceInput lang
-> ScriptRedeemer
-> ExecutionUnits
-> PlutusScriptDatum (Old.ToLedgerPlutusLanguage lang) (PlutusScriptFor thing)
-> Either
CBOR.DecoderError
( AnyWitness
(ShelleyLedgerEra era)
)
toNewPlutusScriptWitness :: forall era lang (thing :: WitnessableItem).
PlutusLanguage (ToLedgerPlutusLanguage lang) =>
AlonzoEraOnwards era
-> Witnessable thing (ShelleyLedgerEra era)
-> PlutusScriptVersion lang
-> PlutusScriptOrReferenceInput lang
-> ScriptRedeemer
-> ExecutionUnits
-> PlutusScriptDatum
(ToLedgerPlutusLanguage lang) (PlutusScriptFor thing)
-> Either DecoderError (AnyWitness (ShelleyLedgerEra era))
toNewPlutusScriptWitness AlonzoEraOnwards era
eon Witnessable thing (ShelleyLedgerEra era)
w PlutusScriptVersion lang
l (Old.PScript (Old.PlutusScriptSerialised ShortByteString
scriptShortBs)) ScriptRedeemer
scriptRedeemer ExecutionUnits
execUnits PlutusScriptDatum
(ToLedgerPlutusLanguage lang) (PlutusScriptFor thing)
datum = do
let protocolVersion :: Version
protocolVersion = AlonzoEraOnwards era -> Version
forall era. AlonzoEraOnwards era -> Version
getVersion AlonzoEraOnwards era
eon
plutusScript :: Plutus (ToLedgerPlutusLanguage lang)
plutusScript = PlutusBinary -> Plutus (ToLedgerPlutusLanguage lang)
forall (l :: Language). PlutusBinary -> Plutus l
L.Plutus (PlutusBinary -> Plutus (ToLedgerPlutusLanguage lang))
-> PlutusBinary -> Plutus (ToLedgerPlutusLanguage lang)
forall a b. (a -> b) -> a -> b
$ ShortByteString -> PlutusBinary
L.PlutusBinary ShortByteString
scriptShortBs
case forall (l :: Language).
PlutusLanguage l =>
Version -> Plutus l -> Either ScriptDecodeError (PlutusRunnable l)
L.decodePlutusRunnable @(Old.ToLedgerPlutusLanguage lang) Version
protocolVersion Plutus (ToLedgerPlutusLanguage lang)
plutusScript of
Left ScriptDecodeError
e ->
DecoderError
-> Either DecoderError (AnyWitness (ShelleyLedgerEra era))
forall a b. a -> Either a b
Left (DecoderError
-> Either DecoderError (AnyWitness (ShelleyLedgerEra era)))
-> DecoderError
-> Either DecoderError (AnyWitness (ShelleyLedgerEra era))
forall a b. (a -> b) -> a -> b
$
Text -> Text -> DecoderError
CBOR.DecoderErrorCustom Text
"PlutusLedgerApi.Common.ScriptDecodeError" (String -> Text
Text.pack (String -> Text)
-> (Doc (ZonkAny 2) -> String) -> Doc (ZonkAny 2) -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Doc (ZonkAny 2) -> String
forall a. Show a => a -> String
show (Doc (ZonkAny 2) -> Text) -> Doc (ZonkAny 2) -> Text
forall a b. (a -> b) -> a -> b
$ ScriptDecodeError -> Doc (ZonkAny 2)
forall a ann. Pretty a => a -> Doc ann
forall ann. ScriptDecodeError -> Doc ann
pretty ScriptDecodeError
e)
Right PlutusRunnable (ToLedgerPlutusLanguage lang)
plutusScriptRunnable ->
AnyWitness (ShelleyLedgerEra era)
-> Either DecoderError (AnyWitness (ShelleyLedgerEra era))
forall a. a -> Either DecoderError a
forall (m :: * -> *) a. Monad m => a -> m a
return (AnyWitness (ShelleyLedgerEra era)
-> Either DecoderError (AnyWitness (ShelleyLedgerEra era)))
-> AnyWitness (ShelleyLedgerEra era)
-> Either DecoderError (AnyWitness (ShelleyLedgerEra era))
forall a b. (a -> b) -> a -> b
$
AlonzoEraOnwards era
-> Witnessable thing (ShelleyLedgerEra era)
-> SLanguage (ToLedgerPlutusLanguage lang)
-> PlutusRunnable (ToLedgerPlutusLanguage lang)
-> PlutusScriptDatum
(ToLedgerPlutusLanguage lang) (PlutusScriptFor thing)
-> ScriptRedeemer
-> ExecutionUnits
-> AnyWitness (ShelleyLedgerEra era)
forall era (thing :: WitnessableItem) (plutuslang :: Language).
PlutusLanguage plutuslang =>
AlonzoEraOnwards era
-> Witnessable thing (ShelleyLedgerEra era)
-> SLanguage plutuslang
-> PlutusRunnable plutuslang
-> PlutusScriptDatum plutuslang (PlutusScriptFor thing)
-> ScriptRedeemer
-> ExecutionUnits
-> AnyWitness (ShelleyLedgerEra era)
mkPlutusScriptWitness
AlonzoEraOnwards era
eon
Witnessable thing (ShelleyLedgerEra era)
w
(PlutusScriptVersion lang -> SLanguage (ToLedgerPlutusLanguage lang)
forall lang.
PlutusScriptVersion lang -> SLanguage (ToLedgerPlutusLanguage lang)
toPlutusSLanguage PlutusScriptVersion lang
l)
PlutusRunnable (ToLedgerPlutusLanguage lang)
plutusScriptRunnable
PlutusScriptDatum
(ToLedgerPlutusLanguage lang) (PlutusScriptFor thing)
datum
ScriptRedeemer
scriptRedeemer
ExecutionUnits
execUnits
toNewPlutusScriptWitness AlonzoEraOnwards era
_ Witnessable thing (ShelleyLedgerEra era)
w PlutusScriptVersion lang
l (Old.PReferenceScript TxIn
refInput) ScriptRedeemer
scriptRedeemer ExecutionUnits
execUnits PlutusScriptDatum
(ToLedgerPlutusLanguage lang) (PlutusScriptFor thing)
datum =
AnyWitness (ShelleyLedgerEra era)
-> Either DecoderError (AnyWitness (ShelleyLedgerEra era))
forall a. a -> Either DecoderError a
forall (m :: * -> *) a. Monad m => a -> m a
return (AnyWitness (ShelleyLedgerEra era)
-> Either DecoderError (AnyWitness (ShelleyLedgerEra era)))
-> AnyWitness (ShelleyLedgerEra era)
-> Either DecoderError (AnyWitness (ShelleyLedgerEra era))
forall a b. (a -> b) -> a -> b
$
Witnessable thing (ShelleyLedgerEra era)
-> SLanguage (ToLedgerPlutusLanguage lang)
-> TxIn
-> PlutusScriptDatum
(ToLedgerPlutusLanguage lang) (PlutusScriptFor thing)
-> ScriptRedeemer
-> ExecutionUnits
-> AnyWitness (ShelleyLedgerEra era)
forall (thing :: WitnessableItem) era (plutuslang :: Language).
Typeable plutuslang =>
Witnessable thing (ShelleyLedgerEra era)
-> SLanguage plutuslang
-> TxIn
-> PlutusScriptDatum plutuslang (PlutusScriptFor thing)
-> ScriptRedeemer
-> ExecutionUnits
-> AnyWitness (ShelleyLedgerEra era)
mkReferencePlutusScriptWitness Witnessable thing (ShelleyLedgerEra era)
w (PlutusScriptVersion lang -> SLanguage (ToLedgerPlutusLanguage lang)
forall lang.
PlutusScriptVersion lang -> SLanguage (ToLedgerPlutusLanguage lang)
toPlutusSLanguage PlutusScriptVersion lang
l) TxIn
refInput PlutusScriptDatum
(ToLedgerPlutusLanguage lang) (PlutusScriptFor thing)
datum ScriptRedeemer
scriptRedeemer ExecutionUnits
execUnits
type family PlutusScriptFor thing where
PlutusScriptFor TxInItem = SpendingScript
PlutusScriptFor CertItem = CertifyingScript
PlutusScriptFor MintItem = MintingScript
PlutusScriptFor WithdrawalItem = WithdrawingScript
PlutusScriptFor VoterItem = VotingScript
PlutusScriptFor ProposalItem = ProposingScript
mkPlutusScriptWitness
:: forall era thing plutuslang
. L.PlutusLanguage plutuslang
=> AlonzoEraOnwards era
-> Witnessable thing (ShelleyLedgerEra era)
-> L.SLanguage plutuslang
-> L.PlutusRunnable plutuslang
-> PlutusScriptDatum plutuslang (PlutusScriptFor thing)
-> ScriptRedeemer
-> ExecutionUnits
-> AnyWitness (ShelleyLedgerEra era)
mkPlutusScriptWitness :: forall era (thing :: WitnessableItem) (plutuslang :: Language).
PlutusLanguage plutuslang =>
AlonzoEraOnwards era
-> Witnessable thing (ShelleyLedgerEra era)
-> SLanguage plutuslang
-> PlutusRunnable plutuslang
-> PlutusScriptDatum plutuslang (PlutusScriptFor thing)
-> ScriptRedeemer
-> ExecutionUnits
-> AnyWitness (ShelleyLedgerEra era)
mkPlutusScriptWitness AlonzoEraOnwards era
eon Witnessable thing (ShelleyLedgerEra era)
w SLanguage plutuslang
l PlutusRunnable plutuslang
plutusScriptRunnable PlutusScriptDatum plutuslang (PlutusScriptFor thing)
d ScriptRedeemer
r ExecutionUnits
e =
let script' :: PlutusScriptOrReferenceInput plutuslang (ShelleyLedgerEra era)
script' :: PlutusScriptOrReferenceInput plutuslang (ShelleyLedgerEra era)
script' = (PlutusScriptInEra plutuslang (ShelleyLedgerEra era)
-> PlutusScriptOrReferenceInput plutuslang (ShelleyLedgerEra era)
forall (lang :: Language) era.
PlutusScriptInEra lang era -> PlutusScriptOrReferenceInput lang era
PScript (PlutusScriptInEra plutuslang (ShelleyLedgerEra era)
-> PlutusScriptOrReferenceInput plutuslang (ShelleyLedgerEra era))
-> PlutusScriptInEra plutuslang (ShelleyLedgerEra era)
-> PlutusScriptOrReferenceInput plutuslang (ShelleyLedgerEra era)
forall a b. (a -> b) -> a -> b
$ PlutusRunnable plutuslang
-> PlutusScriptInEra plutuslang (ShelleyLedgerEra era)
forall (lang :: Language) era.
PlutusLanguage lang =>
PlutusRunnable lang -> PlutusScriptInEra lang era
PlutusScriptInEra PlutusRunnable plutuslang
plutusScriptRunnable)
in case Witnessable thing (ShelleyLedgerEra era)
w of
WitTxIn{} ->
let
s
:: AlonzoEraOnwards era
-> L.SLanguage plutuslang
-> PlutusScriptWitness plutuslang SpendingScript (ShelleyLedgerEra era)
s :: AlonzoEraOnwards era
-> SLanguage plutuslang
-> PlutusScriptWitness
plutuslang 'SpendingScript (ShelleyLedgerEra era)
s AlonzoEraOnwards era
_eon SLanguage plutuslang
lang = SLanguage plutuslang
-> PlutusScriptOrReferenceInput plutuslang (ShelleyLedgerEra era)
-> PlutusScriptDatum plutuslang 'SpendingScript
-> ScriptRedeemer
-> ExecutionUnits
-> PlutusScriptWitness
plutuslang 'SpendingScript (ShelleyLedgerEra era)
forall (lang :: Language) era (purpose :: PlutusScriptPurpose).
SLanguage lang
-> PlutusScriptOrReferenceInput lang era
-> PlutusScriptDatum lang purpose
-> ScriptRedeemer
-> ExecutionUnits
-> PlutusScriptWitness lang purpose era
PlutusScriptWitness SLanguage plutuslang
lang PlutusScriptOrReferenceInput plutuslang (ShelleyLedgerEra era)
script' PlutusScriptDatum plutuslang 'SpendingScript
PlutusScriptDatum plutuslang (PlutusScriptFor thing)
d ScriptRedeemer
r ExecutionUnits
e
in
AnyPlutusScriptWitness
(ZonkAny 1) 'SpendingScript (ShelleyLedgerEra era)
-> AnyWitness (ShelleyLedgerEra era)
forall (lang :: Language) (purpose :: PlutusScriptPurpose) era.
AnyPlutusScriptWitness lang purpose era -> AnyWitness era
AnyPlutusScriptWitness (AnyPlutusScriptWitness
(ZonkAny 1) 'SpendingScript (ShelleyLedgerEra era)
-> AnyWitness (ShelleyLedgerEra era))
-> AnyPlutusScriptWitness
(ZonkAny 1) 'SpendingScript (ShelleyLedgerEra era)
-> AnyWitness (ShelleyLedgerEra era)
forall a b. (a -> b) -> a -> b
$
PlutusSpendingScriptWitness (ShelleyLedgerEra era)
-> AnyPlutusScriptWitness
(ZonkAny 1) 'SpendingScript (ShelleyLedgerEra era)
forall era (lang :: Language).
PlutusSpendingScriptWitness era
-> AnyPlutusScriptWitness lang 'SpendingScript era
AnyPlutusSpendingScriptWitness (PlutusSpendingScriptWitness (ShelleyLedgerEra era)
-> AnyPlutusScriptWitness
(ZonkAny 1) 'SpendingScript (ShelleyLedgerEra era))
-> PlutusSpendingScriptWitness (ShelleyLedgerEra era)
-> AnyPlutusScriptWitness
(ZonkAny 1) 'SpendingScript (ShelleyLedgerEra era)
forall a b. (a -> b) -> a -> b
$
case SLanguage plutuslang
l of
SLanguage plutuslang
L.SPlutusV1 ->
PlutusScriptWitness
'PlutusV1 'SpendingScript (ShelleyLedgerEra era)
-> PlutusSpendingScriptWitness (ShelleyLedgerEra era)
forall era.
PlutusScriptWitness 'PlutusV1 'SpendingScript era
-> PlutusSpendingScriptWitness era
PlutusSpendingScriptWitnessV1 (AlonzoEraOnwards era
-> SLanguage plutuslang
-> PlutusScriptWitness
plutuslang 'SpendingScript (ShelleyLedgerEra era)
s AlonzoEraOnwards era
eon SLanguage plutuslang
l)
SLanguage plutuslang
L.SPlutusV2 ->
PlutusScriptWitness
'PlutusV2 'SpendingScript (ShelleyLedgerEra era)
-> PlutusSpendingScriptWitness (ShelleyLedgerEra era)
forall era.
PlutusScriptWitness 'PlutusV2 'SpendingScript era
-> PlutusSpendingScriptWitness era
PlutusSpendingScriptWitnessV2 (AlonzoEraOnwards era
-> SLanguage plutuslang
-> PlutusScriptWitness
plutuslang 'SpendingScript (ShelleyLedgerEra era)
s AlonzoEraOnwards era
eon SLanguage plutuslang
l)
SLanguage plutuslang
L.SPlutusV3 ->
PlutusScriptWitness
'PlutusV3 'SpendingScript (ShelleyLedgerEra era)
-> PlutusSpendingScriptWitness (ShelleyLedgerEra era)
forall era.
PlutusScriptWitness 'PlutusV3 'SpendingScript era
-> PlutusSpendingScriptWitness era
PlutusSpendingScriptWitnessV3 (AlonzoEraOnwards era
-> SLanguage plutuslang
-> PlutusScriptWitness
plutuslang 'SpendingScript (ShelleyLedgerEra era)
s AlonzoEraOnwards era
eon SLanguage plutuslang
l)
SLanguage plutuslang
L.SPlutusV4 ->
PlutusScriptWitness
'PlutusV4 'SpendingScript (ShelleyLedgerEra era)
-> PlutusSpendingScriptWitness (ShelleyLedgerEra era)
forall era.
PlutusScriptWitness 'PlutusV4 'SpendingScript era
-> PlutusSpendingScriptWitness era
PlutusSpendingScriptWitnessV4 (AlonzoEraOnwards era
-> SLanguage plutuslang
-> PlutusScriptWitness
plutuslang 'SpendingScript (ShelleyLedgerEra era)
s AlonzoEraOnwards era
eon SLanguage plutuslang
l)
WitTxCert{} ->
AnyPlutusScriptWitness
plutuslang 'CertifyingScript (ShelleyLedgerEra era)
-> AnyWitness (ShelleyLedgerEra era)
forall (lang :: Language) (purpose :: PlutusScriptPurpose) era.
AnyPlutusScriptWitness lang purpose era -> AnyWitness era
AnyPlutusScriptWitness (AnyPlutusScriptWitness
plutuslang 'CertifyingScript (ShelleyLedgerEra era)
-> AnyWitness (ShelleyLedgerEra era))
-> AnyPlutusScriptWitness
plutuslang 'CertifyingScript (ShelleyLedgerEra era)
-> AnyWitness (ShelleyLedgerEra era)
forall a b. (a -> b) -> a -> b
$
PlutusScriptWitness
plutuslang 'CertifyingScript (ShelleyLedgerEra era)
-> AnyPlutusScriptWitness
plutuslang 'CertifyingScript (ShelleyLedgerEra era)
forall (lang :: Language) era.
Typeable lang =>
PlutusScriptWitness lang 'CertifyingScript era
-> AnyPlutusScriptWitness lang 'CertifyingScript era
AnyPlutusCertifyingScriptWitness
( SLanguage plutuslang
-> PlutusScriptOrReferenceInput plutuslang (ShelleyLedgerEra era)
-> PlutusScriptDatum plutuslang 'CertifyingScript
-> ScriptRedeemer
-> ExecutionUnits
-> PlutusScriptWitness
plutuslang 'CertifyingScript (ShelleyLedgerEra era)
forall (lang :: Language) era (purpose :: PlutusScriptPurpose).
SLanguage lang
-> PlutusScriptOrReferenceInput lang era
-> PlutusScriptDatum lang purpose
-> ScriptRedeemer
-> ExecutionUnits
-> PlutusScriptWitness lang purpose era
PlutusScriptWitness
SLanguage plutuslang
l
PlutusScriptOrReferenceInput plutuslang (ShelleyLedgerEra era)
script'
PlutusScriptDatum plutuslang 'CertifyingScript
PlutusScriptDatum plutuslang (PlutusScriptFor thing)
d
ScriptRedeemer
r
ExecutionUnits
e
)
WitMint{} ->
AnyPlutusScriptWitness
plutuslang 'MintingScript (ShelleyLedgerEra era)
-> AnyWitness (ShelleyLedgerEra era)
forall (lang :: Language) (purpose :: PlutusScriptPurpose) era.
AnyPlutusScriptWitness lang purpose era -> AnyWitness era
AnyPlutusScriptWitness (AnyPlutusScriptWitness
plutuslang 'MintingScript (ShelleyLedgerEra era)
-> AnyWitness (ShelleyLedgerEra era))
-> AnyPlutusScriptWitness
plutuslang 'MintingScript (ShelleyLedgerEra era)
-> AnyWitness (ShelleyLedgerEra era)
forall a b. (a -> b) -> a -> b
$
PlutusScriptWitness
plutuslang 'MintingScript (ShelleyLedgerEra era)
-> AnyPlutusScriptWitness
plutuslang 'MintingScript (ShelleyLedgerEra era)
forall (lang :: Language) era.
Typeable lang =>
PlutusScriptWitness lang 'MintingScript era
-> AnyPlutusScriptWitness lang 'MintingScript era
AnyPlutusMintingScriptWitness
( SLanguage plutuslang
-> PlutusScriptOrReferenceInput plutuslang (ShelleyLedgerEra era)
-> PlutusScriptDatum plutuslang 'MintingScript
-> ScriptRedeemer
-> ExecutionUnits
-> PlutusScriptWitness
plutuslang 'MintingScript (ShelleyLedgerEra era)
forall (lang :: Language) era (purpose :: PlutusScriptPurpose).
SLanguage lang
-> PlutusScriptOrReferenceInput lang era
-> PlutusScriptDatum lang purpose
-> ScriptRedeemer
-> ExecutionUnits
-> PlutusScriptWitness lang purpose era
PlutusScriptWitness
SLanguage plutuslang
l
PlutusScriptOrReferenceInput plutuslang (ShelleyLedgerEra era)
script'
PlutusScriptDatum plutuslang 'MintingScript
PlutusScriptDatum plutuslang (PlutusScriptFor thing)
d
ScriptRedeemer
r
ExecutionUnits
e
)
WitWithdrawal{} ->
AnyPlutusScriptWitness
plutuslang 'WithdrawingScript (ShelleyLedgerEra era)
-> AnyWitness (ShelleyLedgerEra era)
forall (lang :: Language) (purpose :: PlutusScriptPurpose) era.
AnyPlutusScriptWitness lang purpose era -> AnyWitness era
AnyPlutusScriptWitness (AnyPlutusScriptWitness
plutuslang 'WithdrawingScript (ShelleyLedgerEra era)
-> AnyWitness (ShelleyLedgerEra era))
-> AnyPlutusScriptWitness
plutuslang 'WithdrawingScript (ShelleyLedgerEra era)
-> AnyWitness (ShelleyLedgerEra era)
forall a b. (a -> b) -> a -> b
$
PlutusScriptWitness
plutuslang 'WithdrawingScript (ShelleyLedgerEra era)
-> AnyPlutusScriptWitness
plutuslang 'WithdrawingScript (ShelleyLedgerEra era)
forall (lang :: Language) era.
Typeable lang =>
PlutusScriptWitness lang 'WithdrawingScript era
-> AnyPlutusScriptWitness lang 'WithdrawingScript era
AnyPlutusWithdrawingScriptWitness
( SLanguage plutuslang
-> PlutusScriptOrReferenceInput plutuslang (ShelleyLedgerEra era)
-> PlutusScriptDatum plutuslang 'WithdrawingScript
-> ScriptRedeemer
-> ExecutionUnits
-> PlutusScriptWitness
plutuslang 'WithdrawingScript (ShelleyLedgerEra era)
forall (lang :: Language) era (purpose :: PlutusScriptPurpose).
SLanguage lang
-> PlutusScriptOrReferenceInput lang era
-> PlutusScriptDatum lang purpose
-> ScriptRedeemer
-> ExecutionUnits
-> PlutusScriptWitness lang purpose era
PlutusScriptWitness
SLanguage plutuslang
l
(PlutusScriptInEra plutuslang (ShelleyLedgerEra era)
-> PlutusScriptOrReferenceInput plutuslang (ShelleyLedgerEra era)
forall (lang :: Language) era.
PlutusScriptInEra lang era -> PlutusScriptOrReferenceInput lang era
PScript (PlutusScriptInEra plutuslang (ShelleyLedgerEra era)
-> PlutusScriptOrReferenceInput plutuslang (ShelleyLedgerEra era))
-> PlutusScriptInEra plutuslang (ShelleyLedgerEra era)
-> PlutusScriptOrReferenceInput plutuslang (ShelleyLedgerEra era)
forall a b. (a -> b) -> a -> b
$ PlutusRunnable plutuslang
-> PlutusScriptInEra plutuslang (ShelleyLedgerEra era)
forall (lang :: Language) era.
PlutusLanguage lang =>
PlutusRunnable lang -> PlutusScriptInEra lang era
PlutusScriptInEra PlutusRunnable plutuslang
plutusScriptRunnable)
PlutusScriptDatum plutuslang 'WithdrawingScript
PlutusScriptDatum plutuslang (PlutusScriptFor thing)
d
ScriptRedeemer
r
ExecutionUnits
e
)
WitVote{} ->
AnyPlutusScriptWitness
plutuslang 'VotingScript (ShelleyLedgerEra era)
-> AnyWitness (ShelleyLedgerEra era)
forall (lang :: Language) (purpose :: PlutusScriptPurpose) era.
AnyPlutusScriptWitness lang purpose era -> AnyWitness era
AnyPlutusScriptWitness (AnyPlutusScriptWitness
plutuslang 'VotingScript (ShelleyLedgerEra era)
-> AnyWitness (ShelleyLedgerEra era))
-> AnyPlutusScriptWitness
plutuslang 'VotingScript (ShelleyLedgerEra era)
-> AnyWitness (ShelleyLedgerEra era)
forall a b. (a -> b) -> a -> b
$
PlutusScriptWitness plutuslang 'VotingScript (ShelleyLedgerEra era)
-> AnyPlutusScriptWitness
plutuslang 'VotingScript (ShelleyLedgerEra era)
forall (lang :: Language) era.
Typeable lang =>
PlutusScriptWitness lang 'VotingScript era
-> AnyPlutusScriptWitness lang 'VotingScript era
AnyPlutusVotingScriptWitness
( SLanguage plutuslang
-> PlutusScriptOrReferenceInput plutuslang (ShelleyLedgerEra era)
-> PlutusScriptDatum plutuslang 'VotingScript
-> ScriptRedeemer
-> ExecutionUnits
-> PlutusScriptWitness
plutuslang 'VotingScript (ShelleyLedgerEra era)
forall (lang :: Language) era (purpose :: PlutusScriptPurpose).
SLanguage lang
-> PlutusScriptOrReferenceInput lang era
-> PlutusScriptDatum lang purpose
-> ScriptRedeemer
-> ExecutionUnits
-> PlutusScriptWitness lang purpose era
PlutusScriptWitness
SLanguage plutuslang
l
(PlutusScriptInEra plutuslang (ShelleyLedgerEra era)
-> PlutusScriptOrReferenceInput plutuslang (ShelleyLedgerEra era)
forall (lang :: Language) era.
PlutusScriptInEra lang era -> PlutusScriptOrReferenceInput lang era
PScript (PlutusScriptInEra plutuslang (ShelleyLedgerEra era)
-> PlutusScriptOrReferenceInput plutuslang (ShelleyLedgerEra era))
-> PlutusScriptInEra plutuslang (ShelleyLedgerEra era)
-> PlutusScriptOrReferenceInput plutuslang (ShelleyLedgerEra era)
forall a b. (a -> b) -> a -> b
$ PlutusRunnable plutuslang
-> PlutusScriptInEra plutuslang (ShelleyLedgerEra era)
forall (lang :: Language) era.
PlutusLanguage lang =>
PlutusRunnable lang -> PlutusScriptInEra lang era
PlutusScriptInEra PlutusRunnable plutuslang
plutusScriptRunnable)
PlutusScriptDatum plutuslang 'VotingScript
PlutusScriptDatum plutuslang (PlutusScriptFor thing)
d
ScriptRedeemer
r
ExecutionUnits
e
)
WitProposal{} ->
AnyPlutusScriptWitness
plutuslang 'ProposingScript (ShelleyLedgerEra era)
-> AnyWitness (ShelleyLedgerEra era)
forall (lang :: Language) (purpose :: PlutusScriptPurpose) era.
AnyPlutusScriptWitness lang purpose era -> AnyWitness era
AnyPlutusScriptWitness (AnyPlutusScriptWitness
plutuslang 'ProposingScript (ShelleyLedgerEra era)
-> AnyWitness (ShelleyLedgerEra era))
-> AnyPlutusScriptWitness
plutuslang 'ProposingScript (ShelleyLedgerEra era)
-> AnyWitness (ShelleyLedgerEra era)
forall a b. (a -> b) -> a -> b
$
PlutusScriptWitness
plutuslang 'ProposingScript (ShelleyLedgerEra era)
-> AnyPlutusScriptWitness
plutuslang 'ProposingScript (ShelleyLedgerEra era)
forall (lang :: Language) era.
Typeable lang =>
PlutusScriptWitness lang 'ProposingScript era
-> AnyPlutusScriptWitness lang 'ProposingScript era
AnyPlutusProposingScriptWitness
( SLanguage plutuslang
-> PlutusScriptOrReferenceInput plutuslang (ShelleyLedgerEra era)
-> PlutusScriptDatum plutuslang 'ProposingScript
-> ScriptRedeemer
-> ExecutionUnits
-> PlutusScriptWitness
plutuslang 'ProposingScript (ShelleyLedgerEra era)
forall (lang :: Language) era (purpose :: PlutusScriptPurpose).
SLanguage lang
-> PlutusScriptOrReferenceInput lang era
-> PlutusScriptDatum lang purpose
-> ScriptRedeemer
-> ExecutionUnits
-> PlutusScriptWitness lang purpose era
PlutusScriptWitness
SLanguage plutuslang
l
(PlutusScriptInEra plutuslang (ShelleyLedgerEra era)
-> PlutusScriptOrReferenceInput plutuslang (ShelleyLedgerEra era)
forall (lang :: Language) era.
PlutusScriptInEra lang era -> PlutusScriptOrReferenceInput lang era
PScript (PlutusScriptInEra plutuslang (ShelleyLedgerEra era)
-> PlutusScriptOrReferenceInput plutuslang (ShelleyLedgerEra era))
-> PlutusScriptInEra plutuslang (ShelleyLedgerEra era)
-> PlutusScriptOrReferenceInput plutuslang (ShelleyLedgerEra era)
forall a b. (a -> b) -> a -> b
$ PlutusRunnable plutuslang
-> PlutusScriptInEra plutuslang (ShelleyLedgerEra era)
forall (lang :: Language) era.
PlutusLanguage lang =>
PlutusRunnable lang -> PlutusScriptInEra lang era
PlutusScriptInEra PlutusRunnable plutuslang
plutusScriptRunnable)
PlutusScriptDatum plutuslang 'ProposingScript
PlutusScriptDatum plutuslang (PlutusScriptFor thing)
d
ScriptRedeemer
r
ExecutionUnits
e
)
mkReferencePlutusScriptWitness
:: forall thing era plutuslang
. Typeable plutuslang
=> Witnessable thing (ShelleyLedgerEra era)
-> L.SLanguage plutuslang
-> TxIn
-> PlutusScriptDatum plutuslang (PlutusScriptFor thing)
-> ScriptRedeemer
-> ExecutionUnits
-> AnyWitness (ShelleyLedgerEra era)
mkReferencePlutusScriptWitness :: forall (thing :: WitnessableItem) era (plutuslang :: Language).
Typeable plutuslang =>
Witnessable thing (ShelleyLedgerEra era)
-> SLanguage plutuslang
-> TxIn
-> PlutusScriptDatum plutuslang (PlutusScriptFor thing)
-> ScriptRedeemer
-> ExecutionUnits
-> AnyWitness (ShelleyLedgerEra era)
mkReferencePlutusScriptWitness Witnessable thing (ShelleyLedgerEra era)
w SLanguage plutuslang
l TxIn
txIn PlutusScriptDatum plutuslang (PlutusScriptFor thing)
d ScriptRedeemer
r ExecutionUnits
e =
case Witnessable thing (ShelleyLedgerEra era)
w of
WitTxIn{} ->
let s
:: L.SLanguage plutuslang
-> PlutusScriptWitness plutuslang SpendingScript (ShelleyLedgerEra era)
s :: SLanguage plutuslang
-> PlutusScriptWitness
plutuslang 'SpendingScript (ShelleyLedgerEra era)
s SLanguage plutuslang
lang = SLanguage plutuslang
-> PlutusScriptOrReferenceInput plutuslang (ShelleyLedgerEra era)
-> PlutusScriptDatum plutuslang 'SpendingScript
-> ScriptRedeemer
-> ExecutionUnits
-> PlutusScriptWitness
plutuslang 'SpendingScript (ShelleyLedgerEra era)
forall (lang :: Language) era (purpose :: PlutusScriptPurpose).
SLanguage lang
-> PlutusScriptOrReferenceInput lang era
-> PlutusScriptDatum lang purpose
-> ScriptRedeemer
-> ExecutionUnits
-> PlutusScriptWitness lang purpose era
PlutusScriptWitness SLanguage plutuslang
lang (TxIn
-> PlutusScriptOrReferenceInput plutuslang (ShelleyLedgerEra era)
forall (lang :: Language) era.
TxIn -> PlutusScriptOrReferenceInput lang era
PReferenceScript TxIn
txIn) PlutusScriptDatum plutuslang 'SpendingScript
PlutusScriptDatum plutuslang (PlutusScriptFor thing)
d ScriptRedeemer
r ExecutionUnits
e
in AnyPlutusScriptWitness
(ZonkAny 0) 'SpendingScript (ShelleyLedgerEra era)
-> AnyWitness (ShelleyLedgerEra era)
forall (lang :: Language) (purpose :: PlutusScriptPurpose) era.
AnyPlutusScriptWitness lang purpose era -> AnyWitness era
AnyPlutusScriptWitness (AnyPlutusScriptWitness
(ZonkAny 0) 'SpendingScript (ShelleyLedgerEra era)
-> AnyWitness (ShelleyLedgerEra era))
-> AnyPlutusScriptWitness
(ZonkAny 0) 'SpendingScript (ShelleyLedgerEra era)
-> AnyWitness (ShelleyLedgerEra era)
forall a b. (a -> b) -> a -> b
$
PlutusSpendingScriptWitness (ShelleyLedgerEra era)
-> AnyPlutusScriptWitness
(ZonkAny 0) 'SpendingScript (ShelleyLedgerEra era)
forall era (lang :: Language).
PlutusSpendingScriptWitness era
-> AnyPlutusScriptWitness lang 'SpendingScript era
AnyPlutusSpendingScriptWitness (PlutusSpendingScriptWitness (ShelleyLedgerEra era)
-> AnyPlutusScriptWitness
(ZonkAny 0) 'SpendingScript (ShelleyLedgerEra era))
-> PlutusSpendingScriptWitness (ShelleyLedgerEra era)
-> AnyPlutusScriptWitness
(ZonkAny 0) 'SpendingScript (ShelleyLedgerEra era)
forall a b. (a -> b) -> a -> b
$
case SLanguage plutuslang
l of
SLanguage plutuslang
L.SPlutusV1 ->
PlutusScriptWitness
'PlutusV1 'SpendingScript (ShelleyLedgerEra era)
-> PlutusSpendingScriptWitness (ShelleyLedgerEra era)
forall era.
PlutusScriptWitness 'PlutusV1 'SpendingScript era
-> PlutusSpendingScriptWitness era
PlutusSpendingScriptWitnessV1 (SLanguage plutuslang
-> PlutusScriptWitness
plutuslang 'SpendingScript (ShelleyLedgerEra era)
s SLanguage plutuslang
l)
SLanguage plutuslang
L.SPlutusV2 ->
PlutusScriptWitness
'PlutusV2 'SpendingScript (ShelleyLedgerEra era)
-> PlutusSpendingScriptWitness (ShelleyLedgerEra era)
forall era.
PlutusScriptWitness 'PlutusV2 'SpendingScript era
-> PlutusSpendingScriptWitness era
PlutusSpendingScriptWitnessV2 (SLanguage plutuslang
-> PlutusScriptWitness
plutuslang 'SpendingScript (ShelleyLedgerEra era)
s SLanguage plutuslang
l)
SLanguage plutuslang
L.SPlutusV3 ->
PlutusScriptWitness
'PlutusV3 'SpendingScript (ShelleyLedgerEra era)
-> PlutusSpendingScriptWitness (ShelleyLedgerEra era)
forall era.
PlutusScriptWitness 'PlutusV3 'SpendingScript era
-> PlutusSpendingScriptWitness era
PlutusSpendingScriptWitnessV3 (SLanguage plutuslang
-> PlutusScriptWitness
plutuslang 'SpendingScript (ShelleyLedgerEra era)
s SLanguage plutuslang
l)
SLanguage plutuslang
L.SPlutusV4 ->
PlutusScriptWitness
'PlutusV4 'SpendingScript (ShelleyLedgerEra era)
-> PlutusSpendingScriptWitness (ShelleyLedgerEra era)
forall era.
PlutusScriptWitness 'PlutusV4 'SpendingScript era
-> PlutusSpendingScriptWitness era
PlutusSpendingScriptWitnessV4 (SLanguage plutuslang
-> PlutusScriptWitness
plutuslang 'SpendingScript (ShelleyLedgerEra era)
s SLanguage plutuslang
l)
WitTxCert{} ->
AnyPlutusScriptWitness
plutuslang 'CertifyingScript (ShelleyLedgerEra era)
-> AnyWitness (ShelleyLedgerEra era)
forall (lang :: Language) (purpose :: PlutusScriptPurpose) era.
AnyPlutusScriptWitness lang purpose era -> AnyWitness era
AnyPlutusScriptWitness (AnyPlutusScriptWitness
plutuslang 'CertifyingScript (ShelleyLedgerEra era)
-> AnyWitness (ShelleyLedgerEra era))
-> AnyPlutusScriptWitness
plutuslang 'CertifyingScript (ShelleyLedgerEra era)
-> AnyWitness (ShelleyLedgerEra era)
forall a b. (a -> b) -> a -> b
$
PlutusScriptWitness
plutuslang 'CertifyingScript (ShelleyLedgerEra era)
-> AnyPlutusScriptWitness
plutuslang 'CertifyingScript (ShelleyLedgerEra era)
forall (lang :: Language) era.
Typeable lang =>
PlutusScriptWitness lang 'CertifyingScript era
-> AnyPlutusScriptWitness lang 'CertifyingScript era
AnyPlutusCertifyingScriptWitness
( SLanguage plutuslang
-> PlutusScriptOrReferenceInput plutuslang (ShelleyLedgerEra era)
-> PlutusScriptDatum plutuslang 'CertifyingScript
-> ScriptRedeemer
-> ExecutionUnits
-> PlutusScriptWitness
plutuslang 'CertifyingScript (ShelleyLedgerEra era)
forall (lang :: Language) era (purpose :: PlutusScriptPurpose).
SLanguage lang
-> PlutusScriptOrReferenceInput lang era
-> PlutusScriptDatum lang purpose
-> ScriptRedeemer
-> ExecutionUnits
-> PlutusScriptWitness lang purpose era
PlutusScriptWitness
SLanguage plutuslang
l
(TxIn
-> PlutusScriptOrReferenceInput plutuslang (ShelleyLedgerEra era)
forall (lang :: Language) era.
TxIn -> PlutusScriptOrReferenceInput lang era
PReferenceScript TxIn
txIn)
PlutusScriptDatum plutuslang 'CertifyingScript
PlutusScriptDatum plutuslang (PlutusScriptFor thing)
d
ScriptRedeemer
r
ExecutionUnits
e
)
WitMint{} ->
AnyPlutusScriptWitness
plutuslang 'MintingScript (ShelleyLedgerEra era)
-> AnyWitness (ShelleyLedgerEra era)
forall (lang :: Language) (purpose :: PlutusScriptPurpose) era.
AnyPlutusScriptWitness lang purpose era -> AnyWitness era
AnyPlutusScriptWitness (AnyPlutusScriptWitness
plutuslang 'MintingScript (ShelleyLedgerEra era)
-> AnyWitness (ShelleyLedgerEra era))
-> AnyPlutusScriptWitness
plutuslang 'MintingScript (ShelleyLedgerEra era)
-> AnyWitness (ShelleyLedgerEra era)
forall a b. (a -> b) -> a -> b
$
PlutusScriptWitness
plutuslang 'MintingScript (ShelleyLedgerEra era)
-> AnyPlutusScriptWitness
plutuslang 'MintingScript (ShelleyLedgerEra era)
forall (lang :: Language) era.
Typeable lang =>
PlutusScriptWitness lang 'MintingScript era
-> AnyPlutusScriptWitness lang 'MintingScript era
AnyPlutusMintingScriptWitness
( SLanguage plutuslang
-> PlutusScriptOrReferenceInput plutuslang (ShelleyLedgerEra era)
-> PlutusScriptDatum plutuslang 'MintingScript
-> ScriptRedeemer
-> ExecutionUnits
-> PlutusScriptWitness
plutuslang 'MintingScript (ShelleyLedgerEra era)
forall (lang :: Language) era (purpose :: PlutusScriptPurpose).
SLanguage lang
-> PlutusScriptOrReferenceInput lang era
-> PlutusScriptDatum lang purpose
-> ScriptRedeemer
-> ExecutionUnits
-> PlutusScriptWitness lang purpose era
PlutusScriptWitness
SLanguage plutuslang
l
(TxIn
-> PlutusScriptOrReferenceInput plutuslang (ShelleyLedgerEra era)
forall (lang :: Language) era.
TxIn -> PlutusScriptOrReferenceInput lang era
PReferenceScript TxIn
txIn)
PlutusScriptDatum plutuslang 'MintingScript
PlutusScriptDatum plutuslang (PlutusScriptFor thing)
d
ScriptRedeemer
r
ExecutionUnits
e
)
WitWithdrawal{} ->
AnyPlutusScriptWitness
plutuslang 'WithdrawingScript (ShelleyLedgerEra era)
-> AnyWitness (ShelleyLedgerEra era)
forall (lang :: Language) (purpose :: PlutusScriptPurpose) era.
AnyPlutusScriptWitness lang purpose era -> AnyWitness era
AnyPlutusScriptWitness (AnyPlutusScriptWitness
plutuslang 'WithdrawingScript (ShelleyLedgerEra era)
-> AnyWitness (ShelleyLedgerEra era))
-> AnyPlutusScriptWitness
plutuslang 'WithdrawingScript (ShelleyLedgerEra era)
-> AnyWitness (ShelleyLedgerEra era)
forall a b. (a -> b) -> a -> b
$
PlutusScriptWitness
plutuslang 'WithdrawingScript (ShelleyLedgerEra era)
-> AnyPlutusScriptWitness
plutuslang 'WithdrawingScript (ShelleyLedgerEra era)
forall (lang :: Language) era.
Typeable lang =>
PlutusScriptWitness lang 'WithdrawingScript era
-> AnyPlutusScriptWitness lang 'WithdrawingScript era
AnyPlutusWithdrawingScriptWitness
( SLanguage plutuslang
-> PlutusScriptOrReferenceInput plutuslang (ShelleyLedgerEra era)
-> PlutusScriptDatum plutuslang 'WithdrawingScript
-> ScriptRedeemer
-> ExecutionUnits
-> PlutusScriptWitness
plutuslang 'WithdrawingScript (ShelleyLedgerEra era)
forall (lang :: Language) era (purpose :: PlutusScriptPurpose).
SLanguage lang
-> PlutusScriptOrReferenceInput lang era
-> PlutusScriptDatum lang purpose
-> ScriptRedeemer
-> ExecutionUnits
-> PlutusScriptWitness lang purpose era
PlutusScriptWitness
SLanguage plutuslang
l
(TxIn
-> PlutusScriptOrReferenceInput plutuslang (ShelleyLedgerEra era)
forall (lang :: Language) era.
TxIn -> PlutusScriptOrReferenceInput lang era
PReferenceScript TxIn
txIn)
PlutusScriptDatum plutuslang 'WithdrawingScript
PlutusScriptDatum plutuslang (PlutusScriptFor thing)
d
ScriptRedeemer
r
ExecutionUnits
e
)
WitVote{} ->
AnyPlutusScriptWitness
plutuslang 'VotingScript (ShelleyLedgerEra era)
-> AnyWitness (ShelleyLedgerEra era)
forall (lang :: Language) (purpose :: PlutusScriptPurpose) era.
AnyPlutusScriptWitness lang purpose era -> AnyWitness era
AnyPlutusScriptWitness (AnyPlutusScriptWitness
plutuslang 'VotingScript (ShelleyLedgerEra era)
-> AnyWitness (ShelleyLedgerEra era))
-> AnyPlutusScriptWitness
plutuslang 'VotingScript (ShelleyLedgerEra era)
-> AnyWitness (ShelleyLedgerEra era)
forall a b. (a -> b) -> a -> b
$
PlutusScriptWitness plutuslang 'VotingScript (ShelleyLedgerEra era)
-> AnyPlutusScriptWitness
plutuslang 'VotingScript (ShelleyLedgerEra era)
forall (lang :: Language) era.
Typeable lang =>
PlutusScriptWitness lang 'VotingScript era
-> AnyPlutusScriptWitness lang 'VotingScript era
AnyPlutusVotingScriptWitness
( SLanguage plutuslang
-> PlutusScriptOrReferenceInput plutuslang (ShelleyLedgerEra era)
-> PlutusScriptDatum plutuslang 'VotingScript
-> ScriptRedeemer
-> ExecutionUnits
-> PlutusScriptWitness
plutuslang 'VotingScript (ShelleyLedgerEra era)
forall (lang :: Language) era (purpose :: PlutusScriptPurpose).
SLanguage lang
-> PlutusScriptOrReferenceInput lang era
-> PlutusScriptDatum lang purpose
-> ScriptRedeemer
-> ExecutionUnits
-> PlutusScriptWitness lang purpose era
PlutusScriptWitness
SLanguage plutuslang
l
(TxIn
-> PlutusScriptOrReferenceInput plutuslang (ShelleyLedgerEra era)
forall (lang :: Language) era.
TxIn -> PlutusScriptOrReferenceInput lang era
PReferenceScript TxIn
txIn)
PlutusScriptDatum plutuslang 'VotingScript
PlutusScriptDatum plutuslang (PlutusScriptFor thing)
d
ScriptRedeemer
r
ExecutionUnits
e
)
WitProposal{} ->
AnyPlutusScriptWitness
plutuslang 'ProposingScript (ShelleyLedgerEra era)
-> AnyWitness (ShelleyLedgerEra era)
forall (lang :: Language) (purpose :: PlutusScriptPurpose) era.
AnyPlutusScriptWitness lang purpose era -> AnyWitness era
AnyPlutusScriptWitness (AnyPlutusScriptWitness
plutuslang 'ProposingScript (ShelleyLedgerEra era)
-> AnyWitness (ShelleyLedgerEra era))
-> AnyPlutusScriptWitness
plutuslang 'ProposingScript (ShelleyLedgerEra era)
-> AnyWitness (ShelleyLedgerEra era)
forall a b. (a -> b) -> a -> b
$
PlutusScriptWitness
plutuslang 'ProposingScript (ShelleyLedgerEra era)
-> AnyPlutusScriptWitness
plutuslang 'ProposingScript (ShelleyLedgerEra era)
forall (lang :: Language) era.
Typeable lang =>
PlutusScriptWitness lang 'ProposingScript era
-> AnyPlutusScriptWitness lang 'ProposingScript era
AnyPlutusProposingScriptWitness
( SLanguage plutuslang
-> PlutusScriptOrReferenceInput plutuslang (ShelleyLedgerEra era)
-> PlutusScriptDatum plutuslang 'ProposingScript
-> ScriptRedeemer
-> ExecutionUnits
-> PlutusScriptWitness
plutuslang 'ProposingScript (ShelleyLedgerEra era)
forall (lang :: Language) era (purpose :: PlutusScriptPurpose).
SLanguage lang
-> PlutusScriptOrReferenceInput lang era
-> PlutusScriptDatum lang purpose
-> ScriptRedeemer
-> ExecutionUnits
-> PlutusScriptWitness lang purpose era
PlutusScriptWitness
SLanguage plutuslang
l
(TxIn
-> PlutusScriptOrReferenceInput plutuslang (ShelleyLedgerEra era)
forall (lang :: Language) era.
TxIn -> PlutusScriptOrReferenceInput lang era
PReferenceScript TxIn
txIn)
PlutusScriptDatum plutuslang 'ProposingScript
PlutusScriptDatum plutuslang (PlutusScriptFor thing)
d
ScriptRedeemer
r
ExecutionUnits
e
)
legacyWitnessConversion
:: AlonzoEraOnwards era
-> [(Witnessable witnessable (ShelleyLedgerEra era), BuildTxWith BuildTx (Witness ctx era))]
-> Either
CBOR.DecoderError
[(Witnessable witnessable (ShelleyLedgerEra era), AnyWitness (ShelleyLedgerEra era))]
legacyWitnessConversion :: forall era (witnessable :: WitnessableItem) ctx.
AlonzoEraOnwards era
-> [(Witnessable witnessable (ShelleyLedgerEra era),
BuildTxWith BuildTx (Witness ctx era))]
-> Either
DecoderError
[(Witnessable witnessable (ShelleyLedgerEra era),
AnyWitness (ShelleyLedgerEra era))]
legacyWitnessConversion AlonzoEraOnwards era
eon = ((Witnessable witnessable (ShelleyLedgerEra era),
BuildTxWith BuildTx (Witness ctx era))
-> Either
DecoderError
(Witnessable witnessable (ShelleyLedgerEra era),
AnyWitness (ShelleyLedgerEra era)))
-> [(Witnessable witnessable (ShelleyLedgerEra era),
BuildTxWith BuildTx (Witness ctx era))]
-> Either
DecoderError
[(Witnessable witnessable (ShelleyLedgerEra era),
AnyWitness (ShelleyLedgerEra era))]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
forall (m :: * -> *) a b. Monad m => (a -> m b) -> [a] -> m [b]
mapM (AlonzoEraOnwards era
-> (Witnessable witnessable (ShelleyLedgerEra era),
BuildTxWith BuildTx (Witness ctx era))
-> Either
DecoderError
(Witnessable witnessable (ShelleyLedgerEra era),
AnyWitness (ShelleyLedgerEra era))
forall era (thing :: WitnessableItem) witctx.
AlonzoEraOnwards era
-> (Witnessable thing (ShelleyLedgerEra era),
BuildTxWith BuildTx (Witness witctx era))
-> Either
DecoderError
(Witnessable thing (ShelleyLedgerEra era),
AnyWitness (ShelleyLedgerEra era))
toAnyWitness AlonzoEraOnwards era
eon)
legacyWitnessToScriptRequirements
:: AlonzoEraOnwards era
-> [(Witnessable witnessable (ShelleyLedgerEra era), BuildTxWith BuildTx (Witness ctx era))]
-> Either CBOR.DecoderError (TxScriptWitnessRequirements (ShelleyLedgerEra era))
legacyWitnessToScriptRequirements :: forall era (witnessable :: WitnessableItem) ctx.
AlonzoEraOnwards era
-> [(Witnessable witnessable (ShelleyLedgerEra era),
BuildTxWith BuildTx (Witness ctx era))]
-> Either
DecoderError (TxScriptWitnessRequirements (ShelleyLedgerEra era))
legacyWitnessToScriptRequirements AlonzoEraOnwards era
eon [(Witnessable witnessable (ShelleyLedgerEra era),
BuildTxWith BuildTx (Witness ctx era))]
wits = do
r <- AlonzoEraOnwards era
-> [(Witnessable witnessable (ShelleyLedgerEra era),
BuildTxWith BuildTx (Witness ctx era))]
-> Either
DecoderError
[(Witnessable witnessable (ShelleyLedgerEra era),
AnyWitness (ShelleyLedgerEra era))]
forall era (witnessable :: WitnessableItem) ctx.
AlonzoEraOnwards era
-> [(Witnessable witnessable (ShelleyLedgerEra era),
BuildTxWith BuildTx (Witness ctx era))]
-> Either
DecoderError
[(Witnessable witnessable (ShelleyLedgerEra era),
AnyWitness (ShelleyLedgerEra era))]
legacyWitnessConversion AlonzoEraOnwards era
eon [(Witnessable witnessable (ShelleyLedgerEra era),
BuildTxWith BuildTx (Witness ctx era))]
wits
return $
alonzoEraOnwardsConstraints eon $
obtainMonoidConstraint eon $
getTxScriptWitnessesRequirements r
getVersion :: forall era. AlonzoEraOnwards era -> Version
getVersion :: forall era. AlonzoEraOnwards era -> Version
getVersion AlonzoEraOnwards era
eon = AlonzoEraOnwards era
-> (AlonzoEraOnwardsConstraints era => Version) -> Version
forall era a.
AlonzoEraOnwards era -> (AlonzoEraOnwardsConstraints era => a) -> a
alonzoEraOnwardsConstraints AlonzoEraOnwards era
eon ((AlonzoEraOnwardsConstraints era => Version) -> Version)
-> (AlonzoEraOnwardsConstraints era => Version) -> Version
forall a b. (a -> b) -> a -> b
$ forall era. Era era => Version
L.eraProtVerHigh @(ShelleyLedgerEra era)
obtainConstraints
:: Old.PlutusScriptVersion lang
-> (L.PlutusLanguage (Old.ToLedgerPlutusLanguage lang) => a)
-> a
obtainConstraints :: forall lang a.
PlutusScriptVersion lang
-> (PlutusLanguage (ToLedgerPlutusLanguage lang) => a) -> a
obtainConstraints PlutusScriptVersion lang
v =
case PlutusScriptVersion lang
v of
PlutusScriptVersion lang
Old.PlutusScriptV1 -> a -> a
(PlutusLanguage (ToLedgerPlutusLanguage lang) => a) -> a
forall a. a -> a
id
PlutusScriptVersion lang
Old.PlutusScriptV2 -> a -> a
(PlutusLanguage (ToLedgerPlutusLanguage lang) => a) -> a
forall a. a -> a
id
PlutusScriptVersion lang
Old.PlutusScriptV3 -> a -> a
(PlutusLanguage (ToLedgerPlutusLanguage lang) => a) -> a
forall a. a -> a
id
PlutusScriptVersion lang
Old.PlutusScriptV4 -> a -> a
(PlutusLanguage (ToLedgerPlutusLanguage lang) => a) -> a
forall a. a -> a
id
obtainMonoidConstraint
:: AlonzoEraOnwards era
-> (Monoid (TxScriptWitnessRequirements (ShelleyLedgerEra era)) => a)
-> a
obtainMonoidConstraint :: forall era a.
AlonzoEraOnwards era
-> (Monoid (TxScriptWitnessRequirements (ShelleyLedgerEra era)) =>
a)
-> a
obtainMonoidConstraint AlonzoEraOnwards era
eon = case AlonzoEraOnwards era
eon of
AlonzoEraOnwards era
AlonzoEraOnwardsAlonzo -> a -> a
(Monoid (TxScriptWitnessRequirements (ShelleyLedgerEra era)) => a)
-> a
forall a. a -> a
id
AlonzoEraOnwards era
AlonzoEraOnwardsBabbage -> a -> a
(Monoid (TxScriptWitnessRequirements (ShelleyLedgerEra era)) => a)
-> a
forall a. a -> a
id
AlonzoEraOnwards era
AlonzoEraOnwardsConway -> a -> a
(Monoid (TxScriptWitnessRequirements (ShelleyLedgerEra era)) => a)
-> a
forall a. a -> a
id
AlonzoEraOnwards era
AlonzoEraOnwardsDijkstra -> a -> a
(Monoid (TxScriptWitnessRequirements (ShelleyLedgerEra era)) => a)
-> a
forall a. a -> a
id
toPlutusSLanguage
:: Old.PlutusScriptVersion lang -> L.SLanguage (Old.ToLedgerPlutusLanguage lang)
toPlutusSLanguage :: forall lang.
PlutusScriptVersion lang -> SLanguage (ToLedgerPlutusLanguage lang)
toPlutusSLanguage = \case
PlutusScriptVersion lang
Old.PlutusScriptV1 -> SLanguage 'PlutusV1
SLanguage (ToLedgerPlutusLanguage lang)
L.SPlutusV1
PlutusScriptVersion lang
Old.PlutusScriptV2 -> SLanguage 'PlutusV2
SLanguage (ToLedgerPlutusLanguage lang)
L.SPlutusV2
PlutusScriptVersion lang
Old.PlutusScriptV3 -> SLanguage 'PlutusV3
SLanguage (ToLedgerPlutusLanguage lang)
L.SPlutusV3
PlutusScriptVersion lang
Old.PlutusScriptV4 -> SLanguage 'PlutusV4
SLanguage (ToLedgerPlutusLanguage lang)
L.SPlutusV4
fromPlutusSLanguage
:: L.SLanguage lang -> Old.PlutusScriptVersion (Old.FromLedgerPlutusLanguage lang)
fromPlutusSLanguage :: forall (lang :: Language).
SLanguage lang
-> PlutusScriptVersion (FromLedgerPlutusLanguage lang)
fromPlutusSLanguage = \case
SLanguage lang
L.SPlutusV1 -> PlutusScriptVersion (FromLedgerPlutusLanguage lang)
PlutusScriptVersion PlutusScriptV1
Old.PlutusScriptV1
SLanguage lang
L.SPlutusV2 -> PlutusScriptVersion (FromLedgerPlutusLanguage lang)
PlutusScriptVersion PlutusScriptV2
Old.PlutusScriptV2
SLanguage lang
L.SPlutusV3 -> PlutusScriptVersion (FromLedgerPlutusLanguage lang)
PlutusScriptVersion PlutusScriptV3
Old.PlutusScriptV3
SLanguage lang
L.SPlutusV4 -> PlutusScriptVersion (FromLedgerPlutusLanguage lang)
PlutusScriptVersion PlutusScriptV4
Old.PlutusScriptV4
mkLegacyPolicyId :: forall era. Exp.IsEra era => L.Script (Exp.LedgerEra era) -> Old.PolicyId
mkLegacyPolicyId :: forall era. IsEra era => Script (LedgerEra era) -> PolicyId
mkLegacyPolicyId Script (LedgerEra era)
s =
let ScriptHash
h :: L.ScriptHash = Era era -> (EraCommonConstraints era => ScriptHash) -> ScriptHash
forall era a. Era era -> (EraCommonConstraints era => a) -> a
obtainCommonConstraints (forall era. IsEra era => Era era
Exp.useEra @era) ((EraCommonConstraints era => ScriptHash) -> ScriptHash)
-> (EraCommonConstraints era => ScriptHash) -> ScriptHash
forall a b. (a -> b) -> a -> b
$ Script (LedgerEra era) -> ScriptHash
forall era. EraScript era => Script era -> ScriptHash
L.hashScript Script (LedgerEra era)
s
pid :: PolicyID
pid = ScriptHash -> PolicyID
L.PolicyID ScriptHash
h
in PolicyID -> PolicyId
Old.fromMaryPolicyID PolicyID
pid