{-# LANGUAGE DerivingStrategies #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE UndecidableInstances #-}
{-# OPTIONS_GHC -Wno-missing-import-lists #-}
module Ledger.Typed.Scripts
( module Export
, MintingPolicy
, Validator
, PV1.ConnectionError (..)
, mkForwardingMintingPolicy
, unsafeMkTypedValidator
, PV1.ValidatorType
, PV1.mkTypedValidator
, PV1.mkTypedValidatorParam
) where
import Ledger.Typed.Scripts.Orphans as Export ()
import Plutus.Script.Utils.Scripts qualified as Untyped
import Plutus.Script.Utils.Typed as Export
import Plutus.Script.Utils.V1.Typed.Scripts qualified as PV1
import Plutus.Script.Utils.V2.Typed.Scripts qualified as PV2
import Plutus.V1.Ledger.Api (MintingPolicy, Validator)
mkForwardingMintingPolicy :: Versioned Validator -> Versioned MintingPolicy
mkForwardingMintingPolicy :: Versioned Validator -> Versioned MintingPolicy
mkForwardingMintingPolicy vl :: Versioned Validator
vl@(Versioned Validator
_ Language
PlutusV1) = MintingPolicy -> Language -> Versioned MintingPolicy
forall script. script -> Language -> Versioned script
Versioned (ValidatorHash -> MintingPolicy
PV1.mkForwardingMintingPolicy (Versioned Validator -> ValidatorHash
Untyped.validatorHash Versioned Validator
vl)) Language
PlutusV1
mkForwardingMintingPolicy vl :: Versioned Validator
vl@(Versioned Validator
_ Language
PlutusV2) = MintingPolicy -> Language -> Versioned MintingPolicy
forall script. script -> Language -> Versioned script
Versioned (ValidatorHash -> MintingPolicy
PV2.mkForwardingMintingPolicy (Versioned Validator -> ValidatorHash
Untyped.validatorHash Versioned Validator
vl)) Language
PlutusV2
unsafeMkTypedValidator :: Versioned Validator -> TypedValidator Any
unsafeMkTypedValidator :: Versioned Validator -> TypedValidator Any
unsafeMkTypedValidator Versioned Validator
vl =
TypedValidator :: forall a.
Versioned Validator
-> ValidatorHash
-> Versioned MintingPolicy
-> MintingPolicyHash
-> TypedValidator a
TypedValidator
{ tvValidator :: Versioned Validator
tvValidator = Versioned Validator
vl
, tvValidatorHash :: ValidatorHash
tvValidatorHash = ValidatorHash
vh
, tvForwardingMPS :: Versioned MintingPolicy
tvForwardingMPS = Versioned MintingPolicy
mps
, tvForwardingMPSHash :: MintingPolicyHash
tvForwardingMPSHash = Versioned MintingPolicy -> MintingPolicyHash
Untyped.mintingPolicyHash Versioned MintingPolicy
mps
}
where
vh :: ValidatorHash
vh = Versioned Validator -> ValidatorHash
Untyped.validatorHash Versioned Validator
vl
mps :: Versioned MintingPolicy
mps = Versioned Validator -> Versioned MintingPolicy
mkForwardingMintingPolicy Versioned Validator
vl