{-# LANGUAGE CPP #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE TupleSections #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE ViewPatterns #-}
{-# OPTIONS_GHC -Wno-orphans #-}
#if __GLASGOW_HASKELL__ >= 910
{-# OPTIONS_GHC -fno-spec-eval #-}
#endif
module Cardano.Ledger.Dijkstra.TxInfo (
DijkstraContextError (..),
guardDijkstraFeaturesForPlutusV1toV3,
transFailUnsupportedScriptInSubTx,
transValidityInterval,
) where
import Cardano.Crypto.Hash.Class (hashToBytes)
import Cardano.Ledger.Alonzo.Plutus.Context (
EraPlutusContext (..),
EraPlutusTxInfo (..),
LedgerTxInfo (..),
PlutusScriptPurpose,
PlutusTxInfoResult (..),
SupportedLanguage (..),
SupportedPlutusRunnable (..),
)
import Cardano.Ledger.Alonzo.Plutus.TxInfo (transPolicyID, transValue)
import qualified Cardano.Ledger.Alonzo.Plutus.TxInfo as Alonzo
import Cardano.Ledger.Alonzo.Scripts (toAsItem, toAsIx)
import Cardano.Ledger.Alonzo.UTxO (AlonzoEraUTxO (..))
import qualified Cardano.Ledger.Babbage.TxInfo as Babbage
import Cardano.Ledger.BaseTypes (
Exclusive (..),
Inclusive (..),
Inject (..),
StrictMaybe (..),
TxIx (TxIx),
kindObjectValue,
strictMaybe,
strictMaybeToMaybe,
txIxToInt,
)
import Cardano.Ledger.Binary (DecCBOR (..), EncCBOR (..))
import Cardano.Ledger.Binary.Coders (Decode (..), Encode (..), decode, encode, (!>), (<!))
import Cardano.Ledger.Coin (Coin (..))
import Cardano.Ledger.Conway.TxCert (Delegatee (..))
import Cardano.Ledger.Conway.TxInfo (
ConwayContextError (..),
ConwayEraPlutusTxInfo (..),
transColdCommitteeCred,
transDRepCred,
transDelegatee,
transHotCommitteeCred,
transMap,
transProposal,
transSlotToPOSIXTime,
transTxInInfoV1,
transTxInInfoV3,
transVoter,
)
import qualified Cardano.Ledger.Conway.TxInfo as Conway
import Cardano.Ledger.Credential (Credential (..), StakeReference (..))
import Cardano.Ledger.Dijkstra.Core
import Cardano.Ledger.Dijkstra.Era (DijkstraEra)
import Cardano.Ledger.Dijkstra.Scripts (
AccountBalanceInterval (..),
AccountBalanceIntervals (..),
DijkstraEraScript,
PlutusScript (..),
)
import Cardano.Ledger.Dijkstra.TxCert (DijkstraTxCert)
import Cardano.Ledger.Dijkstra.UTxO ()
import Cardano.Ledger.Mary.Value (MaryValue)
import Cardano.Ledger.Plutus (
Datum (..),
Language (..),
PlutusArgs (..),
PlutusLanguage,
SLanguage (..),
TxOutSource (..),
binaryDataToData,
decodePlutusRunnable,
getPlutusData,
plutusLanguage,
transCoinToLovelace,
transCoinToValue,
transCred,
transDataHash,
transDatum,
transEpochNo,
transKeyHash,
transSafeHash,
transScriptHash,
)
import Cardano.Ledger.Plutus.Data (Data)
import Cardano.Ledger.Plutus.ToPlutusData (ToPlutusData (..))
import Cardano.Ledger.State (StakePoolParams (..), UTxO)
import Cardano.Ledger.TxIn (TxId (TxId), TxIn (..))
import Cardano.Slotting.EpochInfo (EpochInfo)
import Cardano.Slotting.Time (SystemStart)
import Control.DeepSeq (NFData)
import Control.Monad (unless, zipWithM)
import Data.Aeson (KeyValue (..), ToJSON (..))
import Data.Bifunctor (Bifunctor (..))
import Data.Foldable (Foldable (..))
import qualified Data.Foldable as F
import Data.List.NonEmpty (NonEmpty (..))
import qualified Data.List.NonEmpty as NE
import Data.Map.NonEmpty (NonEmptyMap)
import qualified Data.Map.NonEmpty as NEMap
import qualified Data.Map.Strict as Map
import Data.Proxy (Proxy (..))
import qualified Data.Set as Set
import Data.Set.NonEmpty (NonEmptySet)
import qualified Data.Set.NonEmpty as NES
import Data.Text (Text)
import GHC.Generics (Generic)
import Lens.Micro ((^.))
import qualified PlutusLedgerApi.V1 as PV1
import qualified PlutusLedgerApi.V2 as PV2
import qualified PlutusLedgerApi.V3 as PV3
import qualified PlutusLedgerApi.V4 as PV4
data DijkstraContextError era
= ConwayContextError (ConwayContextError era)
|
SubTxContextError TxId (ContextError era)
|
PointerPresentInOutput (NonEmptySet TxOutSource)
|
UnsupportedScriptInSubTx Language TxId
|
DirectDepositsNotSupported DirectDeposits
|
AccountBalanceIntervalsNotSupported (AccountBalanceIntervals era)
|
GuardScriptHashesNotSupported (NonEmpty ScriptHash)
|
RequiredTopLevelGuardsNotSupported (NonEmptyMap (Credential Guard) (StrictMaybe (Data era)))
|
ScriptHashNotFoundForPurpose (PlutusPurpose AsIx era)
deriving ((forall x.
DijkstraContextError era -> Rep (DijkstraContextError era) x)
-> (forall x.
Rep (DijkstraContextError era) x -> DijkstraContextError era)
-> Generic (DijkstraContextError era)
forall x.
Rep (DijkstraContextError era) x -> DijkstraContextError era
forall x.
DijkstraContextError era -> Rep (DijkstraContextError era) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall era x.
Rep (DijkstraContextError era) x -> DijkstraContextError era
forall era x.
DijkstraContextError era -> Rep (DijkstraContextError era) x
$cfrom :: forall era x.
DijkstraContextError era -> Rep (DijkstraContextError era) x
from :: forall x.
DijkstraContextError era -> Rep (DijkstraContextError era) x
$cto :: forall era x.
Rep (DijkstraContextError era) x -> DijkstraContextError era
to :: forall x.
Rep (DijkstraContextError era) x -> DijkstraContextError era
Generic)
deriving instance
( AlonzoEraScript era
, EraTxCert era
, EraTxOut era
, Eq (ContextError era)
) =>
Eq (DijkstraContextError era)
deriving instance
( AlonzoEraScript era
, EraTxCert era
, EraTxOut era
, Ord (ContextError era)
) =>
Ord (DijkstraContextError era)
deriving instance
( AlonzoEraScript era
, EraTxCert era
, EraTxOut era
, Show (ContextError era)
) =>
Show (DijkstraContextError era)
instance
( AlonzoEraScript era
, EraTxCert era
, EraTxOut era
, NFData (ContextError era)
) =>
NFData (DijkstraContextError era)
instance
( ToJSON (TxOut era)
, ToJSON (TxCert era)
, ToJSON (ContextError era)
, ToJSON (PlutusPurpose AsIx era)
, ToJSON (PlutusPurpose AsItem era)
, EraPParams era
) =>
ToJSON (DijkstraContextError era)
where
toJSON :: DijkstraContextError era -> Value
toJSON = \case
ConwayContextError ConwayContextError era
x -> ConwayContextError era -> Value
forall a. ToJSON a => a -> Value
toJSON ConwayContextError era
x
SubTxContextError TxId
txId ContextError era
subTxError ->
Text -> [Pair] -> Value
kindObjectValue
Text
"SubTxContextError"
[ Key
"txId" Key -> Value -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= TxId -> Value
forall a. ToJSON a => a -> Value
toJSON TxId
txId
, Key
"subTxError" Key -> Value -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= ContextError era -> Value
forall a. ToJSON a => a -> Value
toJSON ContextError era
subTxError
]
PointerPresentInOutput NonEmptySet TxOutSource
x -> Text -> [Pair] -> Value
kindObjectValue Text
"PointerPresentInOutput" [Key
"txOut" Key -> Value -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= NonEmptySet TxOutSource -> Value
forall a. ToJSON a => a -> Value
toJSON NonEmptySet TxOutSource
x]
UnsupportedScriptInSubTx Language
lang TxId
txId ->
Text -> [Pair] -> Value
kindObjectValue
Text
"UnsupportedScriptInSubTx"
[ Key
"language" Key -> Value -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Language -> Value
forall a. ToJSON a => a -> Value
toJSON Language
lang
, Key
"txId" Key -> Value -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= TxId -> Value
forall a. ToJSON a => a -> Value
toJSON TxId
txId
]
DirectDepositsNotSupported DirectDeposits
dd ->
Text -> [Pair] -> Value
kindObjectValue Text
"DirectDepositsNotSupported" [Key
"direct_deposits" Key -> String -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= DirectDeposits -> String
forall a. Show a => a -> String
show DirectDeposits
dd]
AccountBalanceIntervalsNotSupported AccountBalanceIntervals era
abi ->
Text -> [Pair] -> Value
kindObjectValue Text
"AccountBalanceIntervalsNotSupported" [Key
"account_balance_intervals" Key -> String -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= AccountBalanceIntervals era -> String
forall a. Show a => a -> String
show AccountBalanceIntervals era
abi]
GuardScriptHashesNotSupported NonEmpty ScriptHash
scriptHashes ->
Text -> [Pair] -> Value
kindObjectValue Text
"GuardScriptHashesNotSupported" [Key
"script_hashes" Key -> Value -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= NonEmpty ScriptHash -> Value
forall a. ToJSON a => a -> Value
toJSON NonEmpty ScriptHash
scriptHashes]
RequiredTopLevelGuardsNotSupported NonEmptyMap (Credential Guard) (StrictMaybe (Data era))
rtlg ->
Text -> [Pair] -> Value
kindObjectValue Text
"RequiredTopLevelGuardsNotSupported" [Key
"required_top_level_guards" Key -> String -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= NonEmptyMap (Credential Guard) (StrictMaybe (Data era)) -> String
forall a. Show a => a -> String
show NonEmptyMap (Credential Guard) (StrictMaybe (Data era))
rtlg]
ScriptHashNotFoundForPurpose PlutusPurpose AsIx era
purpose ->
Text -> [Pair] -> Value
kindObjectValue Text
"ScriptHashNotFoundForPurpose" [Key
"purpose" Key -> Value -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= PlutusPurpose AsIx era -> Value
forall a. ToJSON a => a -> Value
toJSON PlutusPurpose AsIx era
purpose]
instance
( EraPParams era
, DecCBOR (TxOut era)
, DecCBOR (TxCert era)
, DecCBOR (ContextError era)
, DecCBOR (PlutusPurpose AsIx era)
, DecCBOR (PlutusPurpose AsItem era)
) =>
DecCBOR (DijkstraContextError era)
where
decCBOR :: forall s. Decoder s (DijkstraContextError era)
decCBOR = Decode (Closed Dense) (DijkstraContextError era)
-> Decoder s (DijkstraContextError era)
forall t (w :: Wrapped) s. Typeable t => Decode w t -> Decoder s t
decode (Decode (Closed Dense) (DijkstraContextError era)
-> Decoder s (DijkstraContextError era))
-> Decode (Closed Dense) (DijkstraContextError era)
-> Decoder s (DijkstraContextError era)
forall a b. (a -> b) -> a -> b
$ Text
-> (Word -> Decode Open (DijkstraContextError era))
-> Decode (Closed Dense) (DijkstraContextError era)
forall t.
Text -> (Word -> Decode Open t) -> Decode (Closed Dense) t
Summands Text
"ContextError" ((Word -> Decode Open (DijkstraContextError era))
-> Decode (Closed Dense) (DijkstraContextError era))
-> (Word -> Decode Open (DijkstraContextError era))
-> Decode (Closed Dense) (DijkstraContextError era)
forall a b. (a -> b) -> a -> b
$ \case
Word
16 -> (ConwayContextError era -> DijkstraContextError era)
-> Decode Open (ConwayContextError era -> DijkstraContextError era)
forall t. t -> Decode Open t
SumD ConwayContextError era -> DijkstraContextError era
forall era. ConwayContextError era -> DijkstraContextError era
ConwayContextError Decode Open (ConwayContextError era -> DijkstraContextError era)
-> Decode (Closed (ZonkAny 0)) (ConwayContextError era)
-> Decode Open (DijkstraContextError era)
forall a (w1 :: Wrapped) t (w :: Density).
Typeable a =>
Decode w1 (a -> t) -> Decode (Closed w) a -> Decode w1 t
<! Decode (Closed (ZonkAny 0)) (ConwayContextError era)
forall t (w :: Wrapped). DecCBOR t => Decode w t
From
Word
17 -> (TxId -> ContextError era -> DijkstraContextError era)
-> Decode
Open (TxId -> ContextError era -> DijkstraContextError era)
forall t. t -> Decode Open t
SumD TxId -> ContextError era -> DijkstraContextError era
forall era. TxId -> ContextError era -> DijkstraContextError era
SubTxContextError Decode Open (TxId -> ContextError era -> DijkstraContextError era)
-> Decode (Closed (ZonkAny 2)) TxId
-> Decode Open (ContextError era -> DijkstraContextError era)
forall a (w1 :: Wrapped) t (w :: Density).
Typeable a =>
Decode w1 (a -> t) -> Decode (Closed w) a -> Decode w1 t
<! Decode (Closed (ZonkAny 2)) TxId
forall t (w :: Wrapped). DecCBOR t => Decode w t
From Decode Open (ContextError era -> DijkstraContextError era)
-> Decode (Closed (ZonkAny 1)) (ContextError era)
-> Decode Open (DijkstraContextError era)
forall a (w1 :: Wrapped) t (w :: Density).
Typeable a =>
Decode w1 (a -> t) -> Decode (Closed w) a -> Decode w1 t
<! Decode (Closed (ZonkAny 1)) (ContextError era)
forall t (w :: Wrapped). DecCBOR t => Decode w t
From
Word
18 -> (NonEmptySet TxOutSource -> DijkstraContextError era)
-> Decode
Open (NonEmptySet TxOutSource -> DijkstraContextError era)
forall t. t -> Decode Open t
SumD NonEmptySet TxOutSource -> DijkstraContextError era
forall era. NonEmptySet TxOutSource -> DijkstraContextError era
PointerPresentInOutput Decode Open (NonEmptySet TxOutSource -> DijkstraContextError era)
-> Decode (Closed (ZonkAny 3)) (NonEmptySet TxOutSource)
-> Decode Open (DijkstraContextError era)
forall a (w1 :: Wrapped) t (w :: Density).
Typeable a =>
Decode w1 (a -> t) -> Decode (Closed w) a -> Decode w1 t
<! Decode (Closed (ZonkAny 3)) (NonEmptySet TxOutSource)
forall t (w :: Wrapped). DecCBOR t => Decode w t
From
Word
19 -> (Language -> TxId -> DijkstraContextError era)
-> Decode Open (Language -> TxId -> DijkstraContextError era)
forall t. t -> Decode Open t
SumD Language -> TxId -> DijkstraContextError era
forall era. Language -> TxId -> DijkstraContextError era
UnsupportedScriptInSubTx Decode Open (Language -> TxId -> DijkstraContextError era)
-> Decode (Closed (ZonkAny 5)) Language
-> Decode Open (TxId -> DijkstraContextError era)
forall a (w1 :: Wrapped) t (w :: Density).
Typeable a =>
Decode w1 (a -> t) -> Decode (Closed w) a -> Decode w1 t
<! Decode (Closed (ZonkAny 5)) Language
forall t (w :: Wrapped). DecCBOR t => Decode w t
From Decode Open (TxId -> DijkstraContextError era)
-> Decode (Closed (ZonkAny 4)) TxId
-> Decode Open (DijkstraContextError era)
forall a (w1 :: Wrapped) t (w :: Density).
Typeable a =>
Decode w1 (a -> t) -> Decode (Closed w) a -> Decode w1 t
<! Decode (Closed (ZonkAny 4)) TxId
forall t (w :: Wrapped). DecCBOR t => Decode w t
From
Word
20 -> (DirectDeposits -> DijkstraContextError era)
-> Decode Open (DirectDeposits -> DijkstraContextError era)
forall t. t -> Decode Open t
SumD DirectDeposits -> DijkstraContextError era
forall era. DirectDeposits -> DijkstraContextError era
DirectDepositsNotSupported Decode Open (DirectDeposits -> DijkstraContextError era)
-> Decode (Closed (ZonkAny 6)) DirectDeposits
-> Decode Open (DijkstraContextError era)
forall a (w1 :: Wrapped) t (w :: Density).
Typeable a =>
Decode w1 (a -> t) -> Decode (Closed w) a -> Decode w1 t
<! Decode (Closed (ZonkAny 6)) DirectDeposits
forall t (w :: Wrapped). DecCBOR t => Decode w t
From
Word
21 -> (AccountBalanceIntervals era -> DijkstraContextError era)
-> Decode
Open (AccountBalanceIntervals era -> DijkstraContextError era)
forall t. t -> Decode Open t
SumD AccountBalanceIntervals era -> DijkstraContextError era
forall era. AccountBalanceIntervals era -> DijkstraContextError era
AccountBalanceIntervalsNotSupported Decode
Open (AccountBalanceIntervals era -> DijkstraContextError era)
-> Decode (Closed (ZonkAny 7)) (AccountBalanceIntervals era)
-> Decode Open (DijkstraContextError era)
forall a (w1 :: Wrapped) t (w :: Density).
Typeable a =>
Decode w1 (a -> t) -> Decode (Closed w) a -> Decode w1 t
<! Decode (Closed (ZonkAny 7)) (AccountBalanceIntervals era)
forall t (w :: Wrapped). DecCBOR t => Decode w t
From
Word
22 -> (NonEmpty ScriptHash -> DijkstraContextError era)
-> Decode Open (NonEmpty ScriptHash -> DijkstraContextError era)
forall t. t -> Decode Open t
SumD NonEmpty ScriptHash -> DijkstraContextError era
forall era. NonEmpty ScriptHash -> DijkstraContextError era
GuardScriptHashesNotSupported Decode Open (NonEmpty ScriptHash -> DijkstraContextError era)
-> Decode (Closed (ZonkAny 8)) (NonEmpty ScriptHash)
-> Decode Open (DijkstraContextError era)
forall a (w1 :: Wrapped) t (w :: Density).
Typeable a =>
Decode w1 (a -> t) -> Decode (Closed w) a -> Decode w1 t
<! Decode (Closed (ZonkAny 8)) (NonEmpty ScriptHash)
forall t (w :: Wrapped). DecCBOR t => Decode w t
From
Word
23 -> (NonEmptyMap (Credential Guard) (StrictMaybe (Data era))
-> DijkstraContextError era)
-> Decode
Open
(NonEmptyMap (Credential Guard) (StrictMaybe (Data era))
-> DijkstraContextError era)
forall t. t -> Decode Open t
SumD NonEmptyMap (Credential Guard) (StrictMaybe (Data era))
-> DijkstraContextError era
forall era.
NonEmptyMap (Credential Guard) (StrictMaybe (Data era))
-> DijkstraContextError era
RequiredTopLevelGuardsNotSupported Decode
Open
(NonEmptyMap (Credential Guard) (StrictMaybe (Data era))
-> DijkstraContextError era)
-> Decode
(Closed (ZonkAny 9))
(NonEmptyMap (Credential Guard) (StrictMaybe (Data era)))
-> Decode Open (DijkstraContextError era)
forall a (w1 :: Wrapped) t (w :: Density).
Typeable a =>
Decode w1 (a -> t) -> Decode (Closed w) a -> Decode w1 t
<! Decode
(Closed (ZonkAny 9))
(NonEmptyMap (Credential Guard) (StrictMaybe (Data era)))
forall t (w :: Wrapped). DecCBOR t => Decode w t
From
Word
24 -> (PlutusPurpose AsIx era -> DijkstraContextError era)
-> Decode Open (PlutusPurpose AsIx era -> DijkstraContextError era)
forall t. t -> Decode Open t
SumD PlutusPurpose AsIx era -> DijkstraContextError era
forall era. PlutusPurpose AsIx era -> DijkstraContextError era
ScriptHashNotFoundForPurpose Decode Open (PlutusPurpose AsIx era -> DijkstraContextError era)
-> Decode (Closed (ZonkAny 10)) (PlutusPurpose AsIx era)
-> Decode Open (DijkstraContextError era)
forall a (w1 :: Wrapped) t (w :: Density).
Typeable a =>
Decode w1 (a -> t) -> Decode (Closed w) a -> Decode w1 t
<! Decode (Closed (ZonkAny 10)) (PlutusPurpose AsIx era)
forall t (w :: Wrapped). DecCBOR t => Decode w t
From
Word
k -> Word -> Decode Open (DijkstraContextError era)
forall (w :: Wrapped) t. Word -> Decode w t
Invalid Word
k
instance
( EraPParams era
, EncCBOR (TxCert era)
, EncCBOR (ContextError era)
, EncCBOR (PlutusPurpose AsIx era)
, EncCBOR (PlutusPurpose AsItem era)
) =>
EncCBOR (DijkstraContextError era)
where
encCBOR :: DijkstraContextError era -> Encoding
encCBOR =
Encode Open (DijkstraContextError era) -> Encoding
forall (w :: Wrapped) t. Encode w t -> Encoding
encode (Encode Open (DijkstraContextError era) -> Encoding)
-> (DijkstraContextError era
-> Encode Open (DijkstraContextError era))
-> DijkstraContextError era
-> Encoding
forall b c a. (b -> c) -> (a -> b) -> a -> c
. \case
ConwayContextError ConwayContextError era
x -> (ConwayContextError era -> DijkstraContextError era)
-> Word
-> Encode Open (ConwayContextError era -> DijkstraContextError era)
forall t. t -> Word -> Encode Open t
Sum ConwayContextError era -> DijkstraContextError era
forall era. ConwayContextError era -> DijkstraContextError era
ConwayContextError Word
16 Encode Open (ConwayContextError era -> DijkstraContextError era)
-> Encode (Closed Dense) (ConwayContextError era)
-> Encode Open (DijkstraContextError era)
forall (w :: Wrapped) a t (r :: Density).
Encode w (a -> t) -> Encode (Closed r) a -> Encode w t
!> ConwayContextError era
-> Encode (Closed Dense) (ConwayContextError era)
forall t. EncCBOR t => t -> Encode (Closed Dense) t
To ConwayContextError era
x
SubTxContextError TxId
txId ContextError era
subTxError -> (TxId -> ContextError era -> DijkstraContextError era)
-> Word
-> Encode
Open (TxId -> ContextError era -> DijkstraContextError era)
forall t. t -> Word -> Encode Open t
Sum TxId -> ContextError era -> DijkstraContextError era
forall era. TxId -> ContextError era -> DijkstraContextError era
SubTxContextError Word
17 Encode Open (TxId -> ContextError era -> DijkstraContextError era)
-> Encode (Closed Dense) TxId
-> Encode Open (ContextError era -> DijkstraContextError era)
forall (w :: Wrapped) a t (r :: Density).
Encode w (a -> t) -> Encode (Closed r) a -> Encode w t
!> TxId -> Encode (Closed Dense) TxId
forall t. EncCBOR t => t -> Encode (Closed Dense) t
To TxId
txId Encode Open (ContextError era -> DijkstraContextError era)
-> Encode (Closed Dense) (ContextError era)
-> Encode Open (DijkstraContextError era)
forall (w :: Wrapped) a t (r :: Density).
Encode w (a -> t) -> Encode (Closed r) a -> Encode w t
!> ContextError era -> Encode (Closed Dense) (ContextError era)
forall t. EncCBOR t => t -> Encode (Closed Dense) t
To ContextError era
subTxError
PointerPresentInOutput NonEmptySet TxOutSource
x -> (NonEmptySet TxOutSource -> DijkstraContextError era)
-> Word
-> Encode
Open (NonEmptySet TxOutSource -> DijkstraContextError era)
forall t. t -> Word -> Encode Open t
Sum NonEmptySet TxOutSource -> DijkstraContextError era
forall era. NonEmptySet TxOutSource -> DijkstraContextError era
PointerPresentInOutput Word
18 Encode Open (NonEmptySet TxOutSource -> DijkstraContextError era)
-> Encode (Closed Dense) (NonEmptySet TxOutSource)
-> Encode Open (DijkstraContextError era)
forall (w :: Wrapped) a t (r :: Density).
Encode w (a -> t) -> Encode (Closed r) a -> Encode w t
!> NonEmptySet TxOutSource
-> Encode (Closed Dense) (NonEmptySet TxOutSource)
forall t. EncCBOR t => t -> Encode (Closed Dense) t
To NonEmptySet TxOutSource
x
UnsupportedScriptInSubTx Language
lang TxId
txId ->
(Language -> TxId -> DijkstraContextError era)
-> Word
-> Encode Open (Language -> TxId -> DijkstraContextError era)
forall t. t -> Word -> Encode Open t
Sum Language -> TxId -> DijkstraContextError era
forall era. Language -> TxId -> DijkstraContextError era
UnsupportedScriptInSubTx Word
19 Encode Open (Language -> TxId -> DijkstraContextError era)
-> Encode (Closed Dense) Language
-> Encode Open (TxId -> DijkstraContextError era)
forall (w :: Wrapped) a t (r :: Density).
Encode w (a -> t) -> Encode (Closed r) a -> Encode w t
!> Language -> Encode (Closed Dense) Language
forall t. EncCBOR t => t -> Encode (Closed Dense) t
To Language
lang Encode Open (TxId -> DijkstraContextError era)
-> Encode (Closed Dense) TxId
-> Encode Open (DijkstraContextError era)
forall (w :: Wrapped) a t (r :: Density).
Encode w (a -> t) -> Encode (Closed r) a -> Encode w t
!> TxId -> Encode (Closed Dense) TxId
forall t. EncCBOR t => t -> Encode (Closed Dense) t
To TxId
txId
DirectDepositsNotSupported DirectDeposits
dd -> (DirectDeposits -> DijkstraContextError era)
-> Word -> Encode Open (DirectDeposits -> DijkstraContextError era)
forall t. t -> Word -> Encode Open t
Sum DirectDeposits -> DijkstraContextError era
forall era. DirectDeposits -> DijkstraContextError era
DirectDepositsNotSupported Word
20 Encode Open (DirectDeposits -> DijkstraContextError era)
-> Encode (Closed Dense) DirectDeposits
-> Encode Open (DijkstraContextError era)
forall (w :: Wrapped) a t (r :: Density).
Encode w (a -> t) -> Encode (Closed r) a -> Encode w t
!> DirectDeposits -> Encode (Closed Dense) DirectDeposits
forall t. EncCBOR t => t -> Encode (Closed Dense) t
To DirectDeposits
dd
AccountBalanceIntervalsNotSupported AccountBalanceIntervals era
abi -> (AccountBalanceIntervals era -> DijkstraContextError era)
-> Word
-> Encode
Open (AccountBalanceIntervals era -> DijkstraContextError era)
forall t. t -> Word -> Encode Open t
Sum AccountBalanceIntervals era -> DijkstraContextError era
forall era. AccountBalanceIntervals era -> DijkstraContextError era
AccountBalanceIntervalsNotSupported Word
21 Encode
Open (AccountBalanceIntervals era -> DijkstraContextError era)
-> Encode (Closed Dense) (AccountBalanceIntervals era)
-> Encode Open (DijkstraContextError era)
forall (w :: Wrapped) a t (r :: Density).
Encode w (a -> t) -> Encode (Closed r) a -> Encode w t
!> AccountBalanceIntervals era
-> Encode (Closed Dense) (AccountBalanceIntervals era)
forall t. EncCBOR t => t -> Encode (Closed Dense) t
To AccountBalanceIntervals era
abi
GuardScriptHashesNotSupported NonEmpty ScriptHash
scriptHashes ->
(NonEmpty ScriptHash -> DijkstraContextError era)
-> Word
-> Encode Open (NonEmpty ScriptHash -> DijkstraContextError era)
forall t. t -> Word -> Encode Open t
Sum NonEmpty ScriptHash -> DijkstraContextError era
forall era. NonEmpty ScriptHash -> DijkstraContextError era
GuardScriptHashesNotSupported Word
22 Encode Open (NonEmpty ScriptHash -> DijkstraContextError era)
-> Encode (Closed Dense) (NonEmpty ScriptHash)
-> Encode Open (DijkstraContextError era)
forall (w :: Wrapped) a t (r :: Density).
Encode w (a -> t) -> Encode (Closed r) a -> Encode w t
!> NonEmpty ScriptHash -> Encode (Closed Dense) (NonEmpty ScriptHash)
forall t. EncCBOR t => t -> Encode (Closed Dense) t
To NonEmpty ScriptHash
scriptHashes
RequiredTopLevelGuardsNotSupported NonEmptyMap (Credential Guard) (StrictMaybe (Data era))
rtlg ->
(NonEmptyMap (Credential Guard) (StrictMaybe (Data era))
-> DijkstraContextError era)
-> Word
-> Encode
Open
(NonEmptyMap (Credential Guard) (StrictMaybe (Data era))
-> DijkstraContextError era)
forall t. t -> Word -> Encode Open t
Sum NonEmptyMap (Credential Guard) (StrictMaybe (Data era))
-> DijkstraContextError era
forall era.
NonEmptyMap (Credential Guard) (StrictMaybe (Data era))
-> DijkstraContextError era
RequiredTopLevelGuardsNotSupported Word
23 Encode
Open
(NonEmptyMap (Credential Guard) (StrictMaybe (Data era))
-> DijkstraContextError era)
-> Encode
(Closed Dense)
(NonEmptyMap (Credential Guard) (StrictMaybe (Data era)))
-> Encode Open (DijkstraContextError era)
forall (w :: Wrapped) a t (r :: Density).
Encode w (a -> t) -> Encode (Closed r) a -> Encode w t
!> NonEmptyMap (Credential Guard) (StrictMaybe (Data era))
-> Encode
(Closed Dense)
(NonEmptyMap (Credential Guard) (StrictMaybe (Data era)))
forall t. EncCBOR t => t -> Encode (Closed Dense) t
To NonEmptyMap (Credential Guard) (StrictMaybe (Data era))
rtlg
ScriptHashNotFoundForPurpose PlutusPurpose AsIx era
purpose ->
(PlutusPurpose AsIx era -> DijkstraContextError era)
-> Word
-> Encode Open (PlutusPurpose AsIx era -> DijkstraContextError era)
forall t. t -> Word -> Encode Open t
Sum PlutusPurpose AsIx era -> DijkstraContextError era
forall era. PlutusPurpose AsIx era -> DijkstraContextError era
ScriptHashNotFoundForPurpose Word
24 Encode Open (PlutusPurpose AsIx era -> DijkstraContextError era)
-> Encode (Closed Dense) (PlutusPurpose AsIx era)
-> Encode Open (DijkstraContextError era)
forall (w :: Wrapped) a t (r :: Density).
Encode w (a -> t) -> Encode (Closed r) a -> Encode w t
!> PlutusPurpose AsIx era
-> Encode (Closed Dense) (PlutusPurpose AsIx era)
forall t. EncCBOR t => t -> Encode (Closed Dense) t
To PlutusPurpose AsIx era
purpose
instance Inject (ConwayContextError era) (DijkstraContextError era) where
inject :: ConwayContextError era -> DijkstraContextError era
inject = ConwayContextError era -> DijkstraContextError era
forall era. ConwayContextError era -> DijkstraContextError era
ConwayContextError
instance Inject (Babbage.BabbageContextError era) (DijkstraContextError era) where
inject :: BabbageContextError era -> DijkstraContextError era
inject = ConwayContextError era -> DijkstraContextError era
forall era. ConwayContextError era -> DijkstraContextError era
ConwayContextError (ConwayContextError era -> DijkstraContextError era)
-> (BabbageContextError era -> ConwayContextError era)
-> BabbageContextError era
-> DijkstraContextError era
forall b c a. (b -> c) -> (a -> b) -> a -> c
. BabbageContextError era -> ConwayContextError era
forall t s. Inject t s => t -> s
inject
instance Inject (Alonzo.AlonzoContextError era) (DijkstraContextError era) where
inject :: AlonzoContextError era -> DijkstraContextError era
inject = ConwayContextError era -> DijkstraContextError era
forall era. ConwayContextError era -> DijkstraContextError era
ConwayContextError (ConwayContextError era -> DijkstraContextError era)
-> (AlonzoContextError era -> ConwayContextError era)
-> AlonzoContextError era
-> DijkstraContextError era
forall b c a. (b -> c) -> (a -> b) -> a -> c
. AlonzoContextError era -> ConwayContextError era
forall t s. Inject t s => t -> s
inject
instance EraPlutusContext DijkstraEra where
type ContextError DijkstraEra = DijkstraContextError DijkstraEra
data TxInfoResult DijkstraEra
= DijkstraTxInfoResult
(PlutusTxInfoResult 'PlutusV1 DijkstraEra)
(PlutusTxInfoResult 'PlutusV2 DijkstraEra)
(PlutusTxInfoResult 'PlutusV3 DijkstraEra)
(PlutusTxInfoResult 'PlutusV4 DijkstraEra)
mkSupportedLanguage :: Language -> Maybe (SupportedLanguage DijkstraEra)
mkSupportedLanguage = \case
Language
PlutusV1 -> SupportedLanguage DijkstraEra
-> Maybe (SupportedLanguage DijkstraEra)
forall a. a -> Maybe a
Just (SupportedLanguage DijkstraEra
-> Maybe (SupportedLanguage DijkstraEra))
-> SupportedLanguage DijkstraEra
-> Maybe (SupportedLanguage DijkstraEra)
forall a b. (a -> b) -> a -> b
$ SLanguage 'PlutusV1 -> SupportedLanguage DijkstraEra
forall (l :: Language) era.
EraPlutusTxInfo l era =>
SLanguage l -> SupportedLanguage era
SupportedLanguage SLanguage 'PlutusV1
SPlutusV1
Language
PlutusV2 -> SupportedLanguage DijkstraEra
-> Maybe (SupportedLanguage DijkstraEra)
forall a. a -> Maybe a
Just (SupportedLanguage DijkstraEra
-> Maybe (SupportedLanguage DijkstraEra))
-> SupportedLanguage DijkstraEra
-> Maybe (SupportedLanguage DijkstraEra)
forall a b. (a -> b) -> a -> b
$ SLanguage 'PlutusV2 -> SupportedLanguage DijkstraEra
forall (l :: Language) era.
EraPlutusTxInfo l era =>
SLanguage l -> SupportedLanguage era
SupportedLanguage SLanguage 'PlutusV2
SPlutusV2
Language
PlutusV3 -> SupportedLanguage DijkstraEra
-> Maybe (SupportedLanguage DijkstraEra)
forall a. a -> Maybe a
Just (SupportedLanguage DijkstraEra
-> Maybe (SupportedLanguage DijkstraEra))
-> SupportedLanguage DijkstraEra
-> Maybe (SupportedLanguage DijkstraEra)
forall a b. (a -> b) -> a -> b
$ SLanguage 'PlutusV3 -> SupportedLanguage DijkstraEra
forall (l :: Language) era.
EraPlutusTxInfo l era =>
SLanguage l -> SupportedLanguage era
SupportedLanguage SLanguage 'PlutusV3
SPlutusV3
Language
PlutusV4 -> SupportedLanguage DijkstraEra
-> Maybe (SupportedLanguage DijkstraEra)
forall a. a -> Maybe a
Just (SupportedLanguage DijkstraEra
-> Maybe (SupportedLanguage DijkstraEra))
-> SupportedLanguage DijkstraEra
-> Maybe (SupportedLanguage DijkstraEra)
forall a b. (a -> b) -> a -> b
$ SLanguage 'PlutusV4 -> SupportedLanguage DijkstraEra
forall (l :: Language) era.
EraPlutusTxInfo l era =>
SLanguage l -> SupportedLanguage era
SupportedLanguage SLanguage 'PlutusV4
SPlutusV4
mkSupportedPlutusRunnable :: Version
-> PlutusScript DijkstraEra -> SupportedPlutusRunnable DijkstraEra
mkSupportedPlutusRunnable Version
v = \case
DijkstraPlutusV1 Plutus 'PlutusV1
p -> PlutusRunnable 'PlutusV1 -> SupportedPlutusRunnable DijkstraEra
forall (l :: Language) era.
EraPlutusTxInfo l era =>
PlutusRunnable l -> SupportedPlutusRunnable era
SupportedPlutusRunnable (PlutusRunnable 'PlutusV1 -> SupportedPlutusRunnable DijkstraEra)
-> PlutusRunnable 'PlutusV1 -> SupportedPlutusRunnable DijkstraEra
forall a b. (a -> b) -> a -> b
$ Version -> Plutus 'PlutusV1 -> PlutusRunnable 'PlutusV1
forall (l :: Language).
PlutusLanguage l =>
Version -> Plutus l -> PlutusRunnable l
decodePlutusRunnable Version
v Plutus 'PlutusV1
p
DijkstraPlutusV2 Plutus 'PlutusV2
p -> PlutusRunnable 'PlutusV2 -> SupportedPlutusRunnable DijkstraEra
forall (l :: Language) era.
EraPlutusTxInfo l era =>
PlutusRunnable l -> SupportedPlutusRunnable era
SupportedPlutusRunnable (PlutusRunnable 'PlutusV2 -> SupportedPlutusRunnable DijkstraEra)
-> PlutusRunnable 'PlutusV2 -> SupportedPlutusRunnable DijkstraEra
forall a b. (a -> b) -> a -> b
$ Version -> Plutus 'PlutusV2 -> PlutusRunnable 'PlutusV2
forall (l :: Language).
PlutusLanguage l =>
Version -> Plutus l -> PlutusRunnable l
decodePlutusRunnable Version
v Plutus 'PlutusV2
p
DijkstraPlutusV3 Plutus 'PlutusV3
p -> PlutusRunnable 'PlutusV3 -> SupportedPlutusRunnable DijkstraEra
forall (l :: Language) era.
EraPlutusTxInfo l era =>
PlutusRunnable l -> SupportedPlutusRunnable era
SupportedPlutusRunnable (PlutusRunnable 'PlutusV3 -> SupportedPlutusRunnable DijkstraEra)
-> PlutusRunnable 'PlutusV3 -> SupportedPlutusRunnable DijkstraEra
forall a b. (a -> b) -> a -> b
$ Version -> Plutus 'PlutusV3 -> PlutusRunnable 'PlutusV3
forall (l :: Language).
PlutusLanguage l =>
Version -> Plutus l -> PlutusRunnable l
decodePlutusRunnable Version
v Plutus 'PlutusV3
p
DijkstraPlutusV4 Plutus 'PlutusV4
p -> PlutusRunnable 'PlutusV4 -> SupportedPlutusRunnable DijkstraEra
forall (l :: Language) era.
EraPlutusTxInfo l era =>
PlutusRunnable l -> SupportedPlutusRunnable era
SupportedPlutusRunnable (PlutusRunnable 'PlutusV4 -> SupportedPlutusRunnable DijkstraEra)
-> PlutusRunnable 'PlutusV4 -> SupportedPlutusRunnable DijkstraEra
forall a b. (a -> b) -> a -> b
$ Version -> Plutus 'PlutusV4 -> PlutusRunnable 'PlutusV4
forall (l :: Language).
PlutusLanguage l =>
Version -> Plutus l -> PlutusRunnable l
decodePlutusRunnable Version
v Plutus 'PlutusV4
p
mkTxInfoResult :: LedgerTxInfo DijkstraEra -> TxInfoResult DijkstraEra
mkTxInfoResult LedgerTxInfo DijkstraEra
lti =
PlutusTxInfoResult 'PlutusV1 DijkstraEra
-> PlutusTxInfoResult 'PlutusV2 DijkstraEra
-> PlutusTxInfoResult 'PlutusV3 DijkstraEra
-> PlutusTxInfoResult 'PlutusV4 DijkstraEra
-> TxInfoResult DijkstraEra
DijkstraTxInfoResult
(SLanguage 'PlutusV1
-> LedgerTxInfo DijkstraEra
-> PlutusTxInfoResult 'PlutusV1 DijkstraEra
forall (l :: Language) era (proxy :: Language -> *).
EraPlutusTxInfo l era =>
proxy l -> LedgerTxInfo era -> PlutusTxInfoResult l era
forall (proxy :: Language -> *).
proxy 'PlutusV1
-> LedgerTxInfo DijkstraEra
-> PlutusTxInfoResult 'PlutusV1 DijkstraEra
toPlutusTxInfo SLanguage 'PlutusV1
SPlutusV1 LedgerTxInfo DijkstraEra
lti)
(SLanguage 'PlutusV2
-> LedgerTxInfo DijkstraEra
-> PlutusTxInfoResult 'PlutusV2 DijkstraEra
forall (l :: Language) era (proxy :: Language -> *).
EraPlutusTxInfo l era =>
proxy l -> LedgerTxInfo era -> PlutusTxInfoResult l era
forall (proxy :: Language -> *).
proxy 'PlutusV2
-> LedgerTxInfo DijkstraEra
-> PlutusTxInfoResult 'PlutusV2 DijkstraEra
toPlutusTxInfo SLanguage 'PlutusV2
SPlutusV2 LedgerTxInfo DijkstraEra
lti)
(SLanguage 'PlutusV3
-> LedgerTxInfo DijkstraEra
-> PlutusTxInfoResult 'PlutusV3 DijkstraEra
forall (l :: Language) era (proxy :: Language -> *).
EraPlutusTxInfo l era =>
proxy l -> LedgerTxInfo era -> PlutusTxInfoResult l era
forall (proxy :: Language -> *).
proxy 'PlutusV3
-> LedgerTxInfo DijkstraEra
-> PlutusTxInfoResult 'PlutusV3 DijkstraEra
toPlutusTxInfo SLanguage 'PlutusV3
SPlutusV3 LedgerTxInfo DijkstraEra
lti)
(SLanguage 'PlutusV4
-> LedgerTxInfo DijkstraEra
-> PlutusTxInfoResult 'PlutusV4 DijkstraEra
forall (l :: Language) era (proxy :: Language -> *).
EraPlutusTxInfo l era =>
proxy l -> LedgerTxInfo era -> PlutusTxInfoResult l era
forall (proxy :: Language -> *).
proxy 'PlutusV4
-> LedgerTxInfo DijkstraEra
-> PlutusTxInfoResult 'PlutusV4 DijkstraEra
toPlutusTxInfo SLanguage 'PlutusV4
SPlutusV4 LedgerTxInfo DijkstraEra
lti)
lookupTxInfoResult :: forall (l :: Language).
EraPlutusTxInfo l DijkstraEra =>
SLanguage l
-> TxInfoResult DijkstraEra -> PlutusTxInfoResult l DijkstraEra
lookupTxInfoResult SLanguage l
SPlutusV1 (DijkstraTxInfoResult PlutusTxInfoResult 'PlutusV1 DijkstraEra
tirPlutusV1 PlutusTxInfoResult 'PlutusV2 DijkstraEra
_ PlutusTxInfoResult 'PlutusV3 DijkstraEra
_ PlutusTxInfoResult 'PlutusV4 DijkstraEra
_) = PlutusTxInfoResult l DijkstraEra
PlutusTxInfoResult 'PlutusV1 DijkstraEra
tirPlutusV1
lookupTxInfoResult SLanguage l
SPlutusV2 (DijkstraTxInfoResult PlutusTxInfoResult 'PlutusV1 DijkstraEra
_ PlutusTxInfoResult 'PlutusV2 DijkstraEra
tirPlutusV2 PlutusTxInfoResult 'PlutusV3 DijkstraEra
_ PlutusTxInfoResult 'PlutusV4 DijkstraEra
_) = PlutusTxInfoResult l DijkstraEra
PlutusTxInfoResult 'PlutusV2 DijkstraEra
tirPlutusV2
lookupTxInfoResult SLanguage l
SPlutusV3 (DijkstraTxInfoResult PlutusTxInfoResult 'PlutusV1 DijkstraEra
_ PlutusTxInfoResult 'PlutusV2 DijkstraEra
_ PlutusTxInfoResult 'PlutusV3 DijkstraEra
tirPlutusV3 PlutusTxInfoResult 'PlutusV4 DijkstraEra
_) = PlutusTxInfoResult l DijkstraEra
PlutusTxInfoResult 'PlutusV3 DijkstraEra
tirPlutusV3
lookupTxInfoResult SLanguage l
SPlutusV4 (DijkstraTxInfoResult PlutusTxInfoResult 'PlutusV1 DijkstraEra
_ PlutusTxInfoResult 'PlutusV2 DijkstraEra
_ PlutusTxInfoResult 'PlutusV3 DijkstraEra
_ PlutusTxInfoResult 'PlutusV4 DijkstraEra
tirPlutusV4) = PlutusTxInfoResult l DijkstraEra
PlutusTxInfoResult 'PlutusV4 DijkstraEra
tirPlutusV4
instance EraPlutusTxInfo 'PlutusV1 DijkstraEra where
toPlutusTxCert :: forall (proxy :: Language -> *).
proxy 'PlutusV1
-> ProtVer
-> TxCert DijkstraEra
-> Either (ContextError DijkstraEra) (PlutusTxCert 'PlutusV1)
toPlutusTxCert proxy 'PlutusV1
_ ProtVer
_ = TxCert DijkstraEra
-> Either (ContextError DijkstraEra) (PlutusTxCert 'PlutusV1)
TxCert DijkstraEra -> Either (ContextError DijkstraEra) DCert
forall era.
(ConwayEraTxCert era,
Inject (ConwayContextError era) (ContextError era)) =>
TxCert era -> Either (ContextError era) DCert
transTxCertV1V2
toPlutusScriptPurpose :: forall (proxy :: Language -> *).
proxy 'PlutusV1
-> LedgerTxInfo DijkstraEra
-> PlutusPurpose AsIxItem DijkstraEra
-> Either
(ContextError DijkstraEra) (PlutusScriptPurpose 'PlutusV1)
toPlutusScriptPurpose proxy 'PlutusV1
proxy LedgerTxInfo DijkstraEra
lti = proxy 'PlutusV1
-> ProtVer
-> PlutusPurpose AsIxItem DijkstraEra
-> Either (ContextError DijkstraEra) ScriptPurpose
forall (l :: Language) era (proxy :: Language -> *).
(PlutusTxCert l ~ DCert, EraPlutusTxInfo l era,
Inject (ConwayContextError era) (ContextError era)) =>
proxy l
-> ProtVer
-> PlutusPurpose AsIxItem era
-> Either (ContextError era) ScriptPurpose
Conway.transPlutusPurposeV1V2 proxy 'PlutusV1
proxy (LedgerTxInfo DijkstraEra -> ProtVer
forall era. LedgerTxInfo era -> ProtVer
ltiProtVer LedgerTxInfo DijkstraEra
lti)
toPlutusTxInfo :: forall (proxy :: Language -> *).
proxy 'PlutusV1
-> LedgerTxInfo DijkstraEra
-> PlutusTxInfoResult 'PlutusV1 DijkstraEra
toPlutusTxInfo proxy 'PlutusV1
proxy LedgerTxInfo {ProtVer
ltiProtVer :: forall era. LedgerTxInfo era -> ProtVer
ltiProtVer :: ProtVer
ltiProtVer, EpochInfo (Either Text)
ltiEpochInfo :: EpochInfo (Either Text)
ltiEpochInfo :: forall era. LedgerTxInfo era -> EpochInfo (Either Text)
ltiEpochInfo, SystemStart
ltiSystemStart :: SystemStart
ltiSystemStart :: forall era. LedgerTxInfo era -> SystemStart
ltiSystemStart, UTxO DijkstraEra
ltiUTxO :: UTxO DijkstraEra
ltiUTxO :: forall era. LedgerTxInfo era -> UTxO era
ltiUTxO, Tx level DijkstraEra
ltiTx :: Tx level DijkstraEra
ltiTx :: ()
ltiTx} =
((Tx TopTx DijkstraEra -> PlutusTxInfoResult 'PlutusV1 DijkstraEra)
-> (Tx SubTx DijkstraEra
-> PlutusTxInfoResult 'PlutusV1 DijkstraEra)
-> PlutusTxInfoResult 'PlutusV1 DijkstraEra)
-> (Tx SubTx DijkstraEra
-> PlutusTxInfoResult 'PlutusV1 DijkstraEra)
-> (Tx TopTx DijkstraEra
-> PlutusTxInfoResult 'PlutusV1 DijkstraEra)
-> PlutusTxInfoResult 'PlutusV1 DijkstraEra
forall a b c. (a -> b -> c) -> b -> a -> c
flip (Tx level DijkstraEra
-> (Tx TopTx DijkstraEra
-> PlutusTxInfoResult 'PlutusV1 DijkstraEra)
-> (Tx SubTx DijkstraEra
-> PlutusTxInfoResult 'PlutusV1 DijkstraEra)
-> PlutusTxInfoResult 'PlutusV1 DijkstraEra
forall (l :: TxLevel) era (t :: TxLevel -> * -> *) a.
(HasEraTxLevel t era, STxLevel l era ~ STxBothLevels l era) =>
t l era -> (t TopTx era -> a) -> (t SubTx era -> a) -> a
withBothTxLevels Tx level DijkstraEra
ltiTx) Tx SubTx DijkstraEra -> PlutusTxInfoResult 'PlutusV1 DijkstraEra
forall (l :: Language) era.
(EraTx era, Inject (DijkstraContextError era) (ContextError era),
PlutusLanguage l) =>
Tx SubTx era -> PlutusTxInfoResult l era
transFailUnsupportedScriptInSubTx ((Tx TopTx DijkstraEra -> PlutusTxInfoResult 'PlutusV1 DijkstraEra)
-> PlutusTxInfoResult 'PlutusV1 DijkstraEra)
-> (Tx TopTx DijkstraEra
-> PlutusTxInfoResult 'PlutusV1 DijkstraEra)
-> PlutusTxInfoResult 'PlutusV1 DijkstraEra
forall a b. (a -> b) -> a -> b
$ \Tx TopTx DijkstraEra
tx -> Either
(ContextError DijkstraEra)
(PlutusPurpose AsPurpose DijkstraEra
-> Either (ContextError DijkstraEra) (PlutusTxInfo 'PlutusV1))
-> PlutusTxInfoResult 'PlutusV1 DijkstraEra
forall (l :: Language) era.
Either
(ContextError era)
(PlutusPurpose AsPurpose era
-> Either (ContextError era) (PlutusTxInfo l))
-> PlutusTxInfoResult l era
PlutusTxInfoResult (Either
(ContextError DijkstraEra)
(PlutusPurpose AsPurpose DijkstraEra
-> Either (ContextError DijkstraEra) (PlutusTxInfo 'PlutusV1))
-> PlutusTxInfoResult 'PlutusV1 DijkstraEra)
-> Either
(ContextError DijkstraEra)
(PlutusPurpose AsPurpose DijkstraEra
-> Either (ContextError DijkstraEra) (PlutusTxInfo 'PlutusV1))
-> PlutusTxInfoResult 'PlutusV1 DijkstraEra
forall a b. (a -> b) -> a -> b
$ do
let txBody :: TxBody TopTx DijkstraEra
txBody = Tx TopTx DijkstraEra
tx Tx TopTx DijkstraEra
-> Getting
(TxBody TopTx DijkstraEra)
(Tx TopTx DijkstraEra)
(TxBody TopTx DijkstraEra)
-> TxBody TopTx DijkstraEra
forall s a. s -> Getting a s a -> a
^. Getting
(TxBody TopTx DijkstraEra)
(Tx TopTx DijkstraEra)
(TxBody TopTx DijkstraEra)
forall era (l :: TxLevel).
EraTx era =>
Lens' (Tx l era) (TxBody l era)
forall (l :: TxLevel).
Lens' (Tx l DijkstraEra) (TxBody l DijkstraEra)
bodyTxL
Tx TopTx DijkstraEra -> Either (ContextError DijkstraEra) ()
forall era (l :: TxLevel).
(EraTx era, ConwayEraTxBody era,
Inject (ConwayContextError era) (ContextError era)) =>
Tx l era -> Either (ContextError era) ()
Conway.guardConwayFeaturesForPlutusV1V2 Tx TopTx DijkstraEra
tx
Tx TopTx DijkstraEra -> Either (ContextError DijkstraEra) ()
forall era.
(EraTx era, DijkstraEraTxBody era,
Inject (DijkstraContextError era) (ContextError era)) =>
Tx TopTx era -> Either (ContextError era) ()
guardDijkstraFeaturesForPlutusV1toV3 Tx TopTx DijkstraEra
tx
timeRange <- Tx TopTx DijkstraEra
-> EpochInfo (Either Text)
-> SystemStart
-> ValidityInterval
-> Either (ContextError DijkstraEra) POSIXTimeRange
forall (proxy :: * -> *) era.
Inject (AlonzoContextError era) (ContextError era) =>
proxy era
-> EpochInfo (Either Text)
-> SystemStart
-> ValidityInterval
-> Either (ContextError era) POSIXTimeRange
Conway.transValidityInterval Tx TopTx DijkstraEra
tx EpochInfo (Either Text)
ltiEpochInfo SystemStart
ltiSystemStart (TxBody TopTx DijkstraEra
txBody TxBody TopTx DijkstraEra
-> Getting
ValidityInterval (TxBody TopTx DijkstraEra) ValidityInterval
-> ValidityInterval
forall s a. s -> Getting a s a -> a
^. Getting
ValidityInterval (TxBody TopTx DijkstraEra) ValidityInterval
forall era (l :: TxLevel).
AllegraEraTxBody era =>
Lens' (TxBody l era) ValidityInterval
forall (l :: TxLevel).
Lens' (TxBody l DijkstraEra) ValidityInterval
vldtTxBodyL)
inputs <- mapM (Conway.transTxInInfoV1 ltiUTxO) (Set.toList (txBody ^. inputsTxBodyL))
mapM_ (Conway.transTxInInfoV1 ltiUTxO) (Set.toList (txBody ^. referenceInputsTxBodyL))
outputs <-
zipWithM
(Conway.transTxOutV1 . TxOutFromOutput)
[minBound ..]
(F.toList (txBody ^. outputsTxBodyL))
txCerts <- Alonzo.transTxBodyCerts proxy ltiProtVer txBody
let
txInfo =
PV1.TxInfo
{ txInfoInputs :: [TxInInfo]
PV1.txInfoInputs = [TxInInfo]
inputs
, txInfoOutputs :: [TxOut]
PV1.txInfoOutputs = [TxOut]
outputs
, txInfoFee :: Value
PV1.txInfoFee = Coin -> Value
transCoinToValue (TxBody TopTx DijkstraEra
txBody TxBody TopTx DijkstraEra
-> Getting Coin (TxBody TopTx DijkstraEra) Coin -> Coin
forall s a. s -> Getting a s a -> a
^. Getting Coin (TxBody TopTx DijkstraEra) Coin
forall era. EraTxBody era => Lens' (TxBody TopTx era) Coin
Lens' (TxBody TopTx DijkstraEra) Coin
feeTxBodyL)
, txInfoMint :: Value
PV1.txInfoMint = MultiAsset -> Value
Alonzo.transMintValue (TxBody TopTx DijkstraEra
txBody TxBody TopTx DijkstraEra
-> Getting MultiAsset (TxBody TopTx DijkstraEra) MultiAsset
-> MultiAsset
forall s a. s -> Getting a s a -> a
^. Getting MultiAsset (TxBody TopTx DijkstraEra) MultiAsset
forall era (l :: TxLevel).
MaryEraTxBody era =>
Lens' (TxBody l era) MultiAsset
forall (l :: TxLevel). Lens' (TxBody l DijkstraEra) MultiAsset
mintTxBodyL)
, txInfoDCert :: [DCert]
PV1.txInfoDCert = [DCert]
txCerts
, txInfoWdrl :: [(StakingCredential, Integer)]
PV1.txInfoWdrl = TxBody TopTx DijkstraEra -> [(StakingCredential, Integer)]
forall era (t :: TxLevel).
EraTxBody era =>
TxBody t era -> [(StakingCredential, Integer)]
Alonzo.transTxBodyWithdrawals TxBody TopTx DijkstraEra
txBody
, txInfoValidRange :: POSIXTimeRange
PV1.txInfoValidRange = POSIXTimeRange
timeRange
, txInfoSignatories :: [PubKeyHash]
PV1.txInfoSignatories = TxBody TopTx DijkstraEra -> [PubKeyHash]
forall era (t :: TxLevel).
AlonzoEraTxBody era =>
TxBody t era -> [PubKeyHash]
Alonzo.transTxBodyReqSignerHashes TxBody TopTx DijkstraEra
txBody
, txInfoData :: [(DatumHash, Datum)]
PV1.txInfoData = TxWits DijkstraEra -> [(DatumHash, Datum)]
forall era.
AlonzoEraTxWits era =>
TxWits era -> [(DatumHash, Datum)]
Alonzo.transTxWitsDatums (Tx TopTx DijkstraEra
tx Tx TopTx DijkstraEra
-> Getting
(TxWits DijkstraEra) (Tx TopTx DijkstraEra) (TxWits DijkstraEra)
-> TxWits DijkstraEra
forall s a. s -> Getting a s a -> a
^. Getting
(TxWits DijkstraEra) (Tx TopTx DijkstraEra) (TxWits DijkstraEra)
forall era (l :: TxLevel).
EraTx era =>
Lens' (Tx l era) (TxWits era)
forall (l :: TxLevel).
Lens' (Tx l DijkstraEra) (TxWits DijkstraEra)
witsTxL)
, txInfoId :: TxId
PV1.txInfoId = TxBody TopTx DijkstraEra -> TxId
forall era (l :: TxLevel). EraTxBody era => TxBody l era -> TxId
Alonzo.transTxBodyId TxBody TopTx DijkstraEra
txBody
}
Right $ \DijkstraPlutusPurpose AsPurpose DijkstraEra
_ -> TxInfo -> Either (DijkstraContextError DijkstraEra) TxInfo
forall a b. b -> Either a b
Right TxInfo
txInfo
toPlutusArgs :: forall (proxy :: Language -> *).
proxy 'PlutusV1
-> LedgerTxInfo DijkstraEra
-> PlutusTxInfo 'PlutusV1
-> PlutusPurpose AsIxItem DijkstraEra
-> Data DijkstraEra
-> Either (ContextError DijkstraEra) (PlutusArgs 'PlutusV1)
toPlutusArgs = proxy 'PlutusV1
-> LedgerTxInfo DijkstraEra
-> PlutusTxInfo 'PlutusV1
-> PlutusPurpose AsIxItem DijkstraEra
-> Data DijkstraEra
-> Either (ContextError DijkstraEra) (PlutusArgs 'PlutusV1)
proxy 'PlutusV1
-> LedgerTxInfo DijkstraEra
-> TxInfo
-> PlutusPurpose AsIxItem DijkstraEra
-> Data DijkstraEra
-> Either (ContextError DijkstraEra) (PlutusArgs 'PlutusV1)
forall era (proxy :: Language -> *).
(AlonzoEraUTxO era, EraPlutusTxInfo 'PlutusV1 era) =>
proxy 'PlutusV1
-> LedgerTxInfo era
-> TxInfo
-> PlutusPurpose AsIxItem era
-> Data era
-> Either (ContextError era) (PlutusArgs 'PlutusV1)
Alonzo.toPlutusV1Args
toPlutusTxInInfo :: forall (proxy :: Language -> *).
proxy 'PlutusV1
-> UTxO DijkstraEra
-> TxIn
-> Either
(ContextError DijkstraEra) (PlutusTxInInfo DijkstraEra 'PlutusV1)
toPlutusTxInInfo proxy 'PlutusV1
_ = UTxO DijkstraEra
-> TxIn
-> Either
(ContextError DijkstraEra) (PlutusTxInInfo DijkstraEra 'PlutusV1)
UTxO DijkstraEra
-> TxIn -> Either (ContextError DijkstraEra) TxInInfo
forall era.
(Inject (BabbageContextError era) (ContextError era),
Value era ~ MaryValue, BabbageEraTxOut era) =>
UTxO era -> TxIn -> Either (ContextError era) TxInInfo
transTxInInfoV1
transTxCertV1V2 ::
( ConwayEraTxCert era
, Inject (ConwayContextError era) (ContextError era)
) =>
TxCert era ->
Either (ContextError era) PV1.DCert
transTxCertV1V2 :: forall era.
(ConwayEraTxCert era,
Inject (ConwayContextError era) (ContextError era)) =>
TxCert era -> Either (ContextError era) DCert
transTxCertV1V2 = \case
RegDepositTxCert Credential Staking
stakeCred Coin
_deposit ->
DCert -> Either (ContextError era) DCert
forall a b. b -> Either a b
Right (DCert -> Either (ContextError era) DCert)
-> DCert -> Either (ContextError era) DCert
forall a b. (a -> b) -> a -> b
$ StakingCredential -> DCert
PV1.DCertDelegRegKey (Credential -> StakingCredential
PV1.StakingHash (Credential Staking -> Credential
forall (kr :: KeyRole). Credential kr -> Credential
transCred Credential Staking
stakeCred))
UnRegDepositTxCert Credential Staking
stakeCred Coin
_refund ->
DCert -> Either (ContextError era) DCert
forall a b. b -> Either a b
Right (DCert -> Either (ContextError era) DCert)
-> DCert -> Either (ContextError era) DCert
forall a b. (a -> b) -> a -> b
$ StakingCredential -> DCert
PV1.DCertDelegDeRegKey (Credential -> StakingCredential
PV1.StakingHash (Credential Staking -> Credential
forall (kr :: KeyRole). Credential kr -> Credential
transCred Credential Staking
stakeCred))
DelegTxCert Credential Staking
stakeCred (DelegStake KeyHash StakePool
keyHash) ->
DCert -> Either (ContextError era) DCert
forall a b. b -> Either a b
Right (DCert -> Either (ContextError era) DCert)
-> DCert -> Either (ContextError era) DCert
forall a b. (a -> b) -> a -> b
$ StakingCredential -> PubKeyHash -> DCert
PV1.DCertDelegDelegate (Credential -> StakingCredential
PV1.StakingHash (Credential Staking -> Credential
forall (kr :: KeyRole). Credential kr -> Credential
transCred Credential Staking
stakeCred)) (KeyHash StakePool -> PubKeyHash
forall (d :: KeyRole). KeyHash d -> PubKeyHash
transKeyHash KeyHash StakePool
keyHash)
RegPoolTxCert (StakePoolParams {KeyHash StakePool
sppId :: KeyHash StakePool
sppId :: forall era. StakePoolParams era -> KeyHash StakePool
sppId, VRFVerKeyHash StakePoolVRF
sppVrf :: VRFVerKeyHash StakePoolVRF
sppVrf :: forall era. StakePoolParams era -> VRFVerKeyHash StakePoolVRF
sppVrf}) ->
DCert -> Either (ContextError era) DCert
forall a b. b -> Either a b
Right (DCert -> Either (ContextError era) DCert)
-> DCert -> Either (ContextError era) DCert
forall a b. (a -> b) -> a -> b
$
PubKeyHash -> PubKeyHash -> DCert
PV1.DCertPoolRegister
(KeyHash StakePool -> PubKeyHash
forall (d :: KeyRole). KeyHash d -> PubKeyHash
transKeyHash KeyHash StakePool
sppId)
(BuiltinByteString -> PubKeyHash
PV1.PubKeyHash (ByteString -> ToBuiltin ByteString
forall a. HasToBuiltin a => a -> ToBuiltin a
PV1.toBuiltin (Hash HASH KeyRoleVRF -> ByteString
forall h a. Hash h a -> ByteString
hashToBytes (VRFVerKeyHash StakePoolVRF -> Hash HASH KeyRoleVRF
forall (r :: KeyRoleVRF). VRFVerKeyHash r -> Hash HASH KeyRoleVRF
unVRFVerKeyHash VRFVerKeyHash StakePoolVRF
sppVrf))))
RetirePoolTxCert KeyHash StakePool
poolId EpochNo
retireEpochNo ->
DCert -> Either (ContextError era) DCert
forall a b. b -> Either a b
Right (DCert -> Either (ContextError era) DCert)
-> DCert -> Either (ContextError era) DCert
forall a b. (a -> b) -> a -> b
$ PubKeyHash -> Integer -> DCert
PV1.DCertPoolRetire (KeyHash StakePool -> PubKeyHash
forall (d :: KeyRole). KeyHash d -> PubKeyHash
transKeyHash KeyHash StakePool
poolId) (EpochNo -> Integer
transEpochNo EpochNo
retireEpochNo)
TxCert era
txCert -> ContextError era -> Either (ContextError era) DCert
forall a b. a -> Either a b
Left (ContextError era -> Either (ContextError era) DCert)
-> ContextError era -> Either (ContextError era) DCert
forall a b. (a -> b) -> a -> b
$ ConwayContextError era -> ContextError era
forall t s. Inject t s => t -> s
inject (ConwayContextError era -> ContextError era)
-> ConwayContextError era -> ContextError era
forall a b. (a -> b) -> a -> b
$ TxCert era -> ConwayContextError era
forall era. TxCert era -> ConwayContextError era
CertificateNotSupported TxCert era
txCert
instance EraPlutusTxInfo 'PlutusV2 DijkstraEra where
toPlutusTxCert :: forall (proxy :: Language -> *).
proxy 'PlutusV2
-> ProtVer
-> TxCert DijkstraEra
-> Either (ContextError DijkstraEra) (PlutusTxCert 'PlutusV2)
toPlutusTxCert proxy 'PlutusV2
_ ProtVer
_ = TxCert DijkstraEra
-> Either (ContextError DijkstraEra) (PlutusTxCert 'PlutusV2)
TxCert DijkstraEra -> Either (ContextError DijkstraEra) DCert
forall era.
(ConwayEraTxCert era,
Inject (ConwayContextError era) (ContextError era)) =>
TxCert era -> Either (ContextError era) DCert
transTxCertV1V2
toPlutusScriptPurpose :: forall (proxy :: Language -> *).
proxy 'PlutusV2
-> LedgerTxInfo DijkstraEra
-> PlutusPurpose AsIxItem DijkstraEra
-> Either
(ContextError DijkstraEra) (PlutusScriptPurpose 'PlutusV2)
toPlutusScriptPurpose proxy 'PlutusV2
proxy LedgerTxInfo DijkstraEra
lti = proxy 'PlutusV2
-> ProtVer
-> PlutusPurpose AsIxItem DijkstraEra
-> Either (ContextError DijkstraEra) ScriptPurpose
forall (l :: Language) era (proxy :: Language -> *).
(PlutusTxCert l ~ DCert, EraPlutusTxInfo l era,
Inject (ConwayContextError era) (ContextError era)) =>
proxy l
-> ProtVer
-> PlutusPurpose AsIxItem era
-> Either (ContextError era) ScriptPurpose
Conway.transPlutusPurposeV1V2 proxy 'PlutusV2
proxy (LedgerTxInfo DijkstraEra -> ProtVer
forall era. LedgerTxInfo era -> ProtVer
ltiProtVer LedgerTxInfo DijkstraEra
lti)
toPlutusTxInfo :: forall (proxy :: Language -> *).
proxy 'PlutusV2
-> LedgerTxInfo DijkstraEra
-> PlutusTxInfoResult 'PlutusV2 DijkstraEra
toPlutusTxInfo proxy 'PlutusV2
proxy lti :: LedgerTxInfo DijkstraEra
lti@LedgerTxInfo {ProtVer
ltiProtVer :: forall era. LedgerTxInfo era -> ProtVer
ltiProtVer :: ProtVer
ltiProtVer, EpochInfo (Either Text)
ltiEpochInfo :: forall era. LedgerTxInfo era -> EpochInfo (Either Text)
ltiEpochInfo :: EpochInfo (Either Text)
ltiEpochInfo, SystemStart
ltiSystemStart :: forall era. LedgerTxInfo era -> SystemStart
ltiSystemStart :: SystemStart
ltiSystemStart, UTxO DijkstraEra
ltiUTxO :: forall era. LedgerTxInfo era -> UTxO era
ltiUTxO :: UTxO DijkstraEra
ltiUTxO, Tx level DijkstraEra
ltiTx :: ()
ltiTx :: Tx level DijkstraEra
ltiTx} =
((Tx TopTx DijkstraEra -> PlutusTxInfoResult 'PlutusV2 DijkstraEra)
-> (Tx SubTx DijkstraEra
-> PlutusTxInfoResult 'PlutusV2 DijkstraEra)
-> PlutusTxInfoResult 'PlutusV2 DijkstraEra)
-> (Tx SubTx DijkstraEra
-> PlutusTxInfoResult 'PlutusV2 DijkstraEra)
-> (Tx TopTx DijkstraEra
-> PlutusTxInfoResult 'PlutusV2 DijkstraEra)
-> PlutusTxInfoResult 'PlutusV2 DijkstraEra
forall a b c. (a -> b -> c) -> b -> a -> c
flip (Tx level DijkstraEra
-> (Tx TopTx DijkstraEra
-> PlutusTxInfoResult 'PlutusV2 DijkstraEra)
-> (Tx SubTx DijkstraEra
-> PlutusTxInfoResult 'PlutusV2 DijkstraEra)
-> PlutusTxInfoResult 'PlutusV2 DijkstraEra
forall (l :: TxLevel) era (t :: TxLevel -> * -> *) a.
(HasEraTxLevel t era, STxLevel l era ~ STxBothLevels l era) =>
t l era -> (t TopTx era -> a) -> (t SubTx era -> a) -> a
withBothTxLevels Tx level DijkstraEra
ltiTx) Tx SubTx DijkstraEra -> PlutusTxInfoResult 'PlutusV2 DijkstraEra
forall (l :: Language) era.
(EraTx era, Inject (DijkstraContextError era) (ContextError era),
PlutusLanguage l) =>
Tx SubTx era -> PlutusTxInfoResult l era
transFailUnsupportedScriptInSubTx ((Tx TopTx DijkstraEra -> PlutusTxInfoResult 'PlutusV2 DijkstraEra)
-> PlutusTxInfoResult 'PlutusV2 DijkstraEra)
-> (Tx TopTx DijkstraEra
-> PlutusTxInfoResult 'PlutusV2 DijkstraEra)
-> PlutusTxInfoResult 'PlutusV2 DijkstraEra
forall a b. (a -> b) -> a -> b
$ \Tx TopTx DijkstraEra
tx -> Either
(ContextError DijkstraEra)
(PlutusPurpose AsPurpose DijkstraEra
-> Either (ContextError DijkstraEra) (PlutusTxInfo 'PlutusV2))
-> PlutusTxInfoResult 'PlutusV2 DijkstraEra
forall (l :: Language) era.
Either
(ContextError era)
(PlutusPurpose AsPurpose era
-> Either (ContextError era) (PlutusTxInfo l))
-> PlutusTxInfoResult l era
PlutusTxInfoResult (Either
(ContextError DijkstraEra)
(PlutusPurpose AsPurpose DijkstraEra
-> Either (ContextError DijkstraEra) (PlutusTxInfo 'PlutusV2))
-> PlutusTxInfoResult 'PlutusV2 DijkstraEra)
-> Either
(ContextError DijkstraEra)
(PlutusPurpose AsPurpose DijkstraEra
-> Either (ContextError DijkstraEra) (PlutusTxInfo 'PlutusV2))
-> PlutusTxInfoResult 'PlutusV2 DijkstraEra
forall a b. (a -> b) -> a -> b
$ do
let txBody :: TxBody TopTx DijkstraEra
txBody = Tx TopTx DijkstraEra
tx Tx TopTx DijkstraEra
-> Getting
(TxBody TopTx DijkstraEra)
(Tx TopTx DijkstraEra)
(TxBody TopTx DijkstraEra)
-> TxBody TopTx DijkstraEra
forall s a. s -> Getting a s a -> a
^. Getting
(TxBody TopTx DijkstraEra)
(Tx TopTx DijkstraEra)
(TxBody TopTx DijkstraEra)
forall era (l :: TxLevel).
EraTx era =>
Lens' (Tx l era) (TxBody l era)
forall (l :: TxLevel).
Lens' (Tx l DijkstraEra) (TxBody l DijkstraEra)
bodyTxL
Tx TopTx DijkstraEra -> Either (ContextError DijkstraEra) ()
forall era (l :: TxLevel).
(EraTx era, ConwayEraTxBody era,
Inject (ConwayContextError era) (ContextError era)) =>
Tx l era -> Either (ContextError era) ()
Conway.guardConwayFeaturesForPlutusV1V2 Tx TopTx DijkstraEra
tx
Tx TopTx DijkstraEra -> Either (ContextError DijkstraEra) ()
forall era.
(EraTx era, DijkstraEraTxBody era,
Inject (DijkstraContextError era) (ContextError era)) =>
Tx TopTx era -> Either (ContextError era) ()
guardDijkstraFeaturesForPlutusV1toV3 Tx TopTx DijkstraEra
tx
timeRange <-
Tx TopTx DijkstraEra
-> EpochInfo (Either Text)
-> SystemStart
-> ValidityInterval
-> Either (ContextError DijkstraEra) POSIXTimeRange
forall (proxy :: * -> *) era.
Inject (AlonzoContextError era) (ContextError era) =>
proxy era
-> EpochInfo (Either Text)
-> SystemStart
-> ValidityInterval
-> Either (ContextError era) POSIXTimeRange
Conway.transValidityInterval Tx TopTx DijkstraEra
tx EpochInfo (Either Text)
ltiEpochInfo SystemStart
ltiSystemStart (TxBody TopTx DijkstraEra
txBody TxBody TopTx DijkstraEra
-> Getting
ValidityInterval (TxBody TopTx DijkstraEra) ValidityInterval
-> ValidityInterval
forall s a. s -> Getting a s a -> a
^. Getting
ValidityInterval (TxBody TopTx DijkstraEra) ValidityInterval
forall era (l :: TxLevel).
AllegraEraTxBody era =>
Lens' (TxBody l era) ValidityInterval
forall (l :: TxLevel).
Lens' (TxBody l DijkstraEra) ValidityInterval
vldtTxBodyL)
inputs <- mapM (Babbage.transTxInInfoV2 ltiUTxO) (Set.toList (txBody ^. inputsTxBodyL))
refInputs <- mapM (Babbage.transTxInInfoV2 ltiUTxO) (Set.toList (txBody ^. referenceInputsTxBodyL))
outputs <-
zipWithM
(Babbage.transTxOutV2 . TxOutFromOutput)
[minBound ..]
(F.toList (txBody ^. outputsTxBodyL))
txCerts <- Alonzo.transTxBodyCerts proxy ltiProtVer txBody
plutusRedeemers <- Babbage.transTxRedeemers proxy lti
let
txInfo =
PV2.TxInfo
{ txInfoInputs :: [TxInInfo]
PV2.txInfoInputs = [TxInInfo]
inputs
, txInfoOutputs :: [TxOut]
PV2.txInfoOutputs = [TxOut]
outputs
, txInfoReferenceInputs :: [TxInInfo]
PV2.txInfoReferenceInputs = [TxInInfo]
refInputs
, txInfoFee :: Value
PV2.txInfoFee = Coin -> Value
transCoinToValue (TxBody TopTx DijkstraEra
txBody TxBody TopTx DijkstraEra
-> Getting Coin (TxBody TopTx DijkstraEra) Coin -> Coin
forall s a. s -> Getting a s a -> a
^. Getting Coin (TxBody TopTx DijkstraEra) Coin
forall era. EraTxBody era => Lens' (TxBody TopTx era) Coin
Lens' (TxBody TopTx DijkstraEra) Coin
feeTxBodyL)
, txInfoMint :: Value
PV2.txInfoMint = MultiAsset -> Value
Alonzo.transMintValue (TxBody TopTx DijkstraEra
txBody TxBody TopTx DijkstraEra
-> Getting MultiAsset (TxBody TopTx DijkstraEra) MultiAsset
-> MultiAsset
forall s a. s -> Getting a s a -> a
^. Getting MultiAsset (TxBody TopTx DijkstraEra) MultiAsset
forall era (l :: TxLevel).
MaryEraTxBody era =>
Lens' (TxBody l era) MultiAsset
forall (l :: TxLevel). Lens' (TxBody l DijkstraEra) MultiAsset
mintTxBodyL)
, txInfoDCert :: [DCert]
PV2.txInfoDCert = [DCert]
txCerts
, txInfoWdrl :: Map StakingCredential Integer
PV2.txInfoWdrl = [(StakingCredential, Integer)] -> Map StakingCredential Integer
forall k v. [(k, v)] -> Map k v
PV2.unsafeFromList ([(StakingCredential, Integer)] -> Map StakingCredential Integer)
-> [(StakingCredential, Integer)] -> Map StakingCredential Integer
forall a b. (a -> b) -> a -> b
$ TxBody TopTx DijkstraEra -> [(StakingCredential, Integer)]
forall era (t :: TxLevel).
EraTxBody era =>
TxBody t era -> [(StakingCredential, Integer)]
Alonzo.transTxBodyWithdrawals TxBody TopTx DijkstraEra
txBody
, txInfoValidRange :: POSIXTimeRange
PV2.txInfoValidRange = POSIXTimeRange
timeRange
, txInfoSignatories :: [PubKeyHash]
PV2.txInfoSignatories = TxBody TopTx DijkstraEra -> [PubKeyHash]
forall era (t :: TxLevel).
AlonzoEraTxBody era =>
TxBody t era -> [PubKeyHash]
Alonzo.transTxBodyReqSignerHashes TxBody TopTx DijkstraEra
txBody
, txInfoRedeemers :: Map ScriptPurpose Redeemer
PV2.txInfoRedeemers = Map ScriptPurpose Redeemer
plutusRedeemers
, txInfoData :: Map DatumHash Datum
PV2.txInfoData = [(DatumHash, Datum)] -> Map DatumHash Datum
forall k v. [(k, v)] -> Map k v
PV2.unsafeFromList ([(DatumHash, Datum)] -> Map DatumHash Datum)
-> [(DatumHash, Datum)] -> Map DatumHash Datum
forall a b. (a -> b) -> a -> b
$ TxWits DijkstraEra -> [(DatumHash, Datum)]
forall era.
AlonzoEraTxWits era =>
TxWits era -> [(DatumHash, Datum)]
Alonzo.transTxWitsDatums (Tx TopTx DijkstraEra
tx Tx TopTx DijkstraEra
-> Getting
(TxWits DijkstraEra) (Tx TopTx DijkstraEra) (TxWits DijkstraEra)
-> TxWits DijkstraEra
forall s a. s -> Getting a s a -> a
^. Getting
(TxWits DijkstraEra) (Tx TopTx DijkstraEra) (TxWits DijkstraEra)
forall era (l :: TxLevel).
EraTx era =>
Lens' (Tx l era) (TxWits era)
forall (l :: TxLevel).
Lens' (Tx l DijkstraEra) (TxWits DijkstraEra)
witsTxL)
, txInfoId :: TxId
PV2.txInfoId = TxBody TopTx DijkstraEra -> TxId
forall era (l :: TxLevel). EraTxBody era => TxBody l era -> TxId
Alonzo.transTxBodyId TxBody TopTx DijkstraEra
txBody
}
Right $ \DijkstraPlutusPurpose AsPurpose DijkstraEra
_ -> TxInfo -> Either (DijkstraContextError DijkstraEra) TxInfo
forall a b. b -> Either a b
Right TxInfo
txInfo
toPlutusArgs :: forall (proxy :: Language -> *).
proxy 'PlutusV2
-> LedgerTxInfo DijkstraEra
-> PlutusTxInfo 'PlutusV2
-> PlutusPurpose AsIxItem DijkstraEra
-> Data DijkstraEra
-> Either (ContextError DijkstraEra) (PlutusArgs 'PlutusV2)
toPlutusArgs = proxy 'PlutusV2
-> LedgerTxInfo DijkstraEra
-> PlutusTxInfo 'PlutusV2
-> PlutusPurpose AsIxItem DijkstraEra
-> Data DijkstraEra
-> Either (ContextError DijkstraEra) (PlutusArgs 'PlutusV2)
proxy 'PlutusV2
-> LedgerTxInfo DijkstraEra
-> TxInfo
-> PlutusPurpose AsIxItem DijkstraEra
-> Data DijkstraEra
-> Either (ContextError DijkstraEra) (PlutusArgs 'PlutusV2)
forall era (proxy :: Language -> *).
(AlonzoEraUTxO era, EraPlutusTxInfo 'PlutusV2 era) =>
proxy 'PlutusV2
-> LedgerTxInfo era
-> TxInfo
-> PlutusPurpose AsIxItem era
-> Data era
-> Either (ContextError era) (PlutusArgs 'PlutusV2)
Babbage.toPlutusV2Args
toPlutusTxInInfo :: forall (proxy :: Language -> *).
proxy 'PlutusV2
-> UTxO DijkstraEra
-> TxIn
-> Either
(ContextError DijkstraEra) (PlutusTxInInfo DijkstraEra 'PlutusV2)
toPlutusTxInInfo proxy 'PlutusV2
_ = UTxO DijkstraEra
-> TxIn
-> Either
(ContextError DijkstraEra) (PlutusTxInInfo DijkstraEra 'PlutusV2)
UTxO DijkstraEra
-> TxIn -> Either (ContextError DijkstraEra) TxInInfo
forall era.
(Inject (BabbageContextError era) (ContextError era),
Value era ~ MaryValue, BabbageEraTxOut era) =>
UTxO era -> TxIn -> Either (ContextError era) TxInInfo
Babbage.transTxInInfoV2
instance EraPlutusTxInfo 'PlutusV3 DijkstraEra where
toPlutusTxCert :: forall (proxy :: Language -> *).
proxy 'PlutusV3
-> ProtVer
-> TxCert DijkstraEra
-> Either (ContextError DijkstraEra) (PlutusTxCert 'PlutusV3)
toPlutusTxCert proxy 'PlutusV3
_ ProtVer
_ = TxCert -> Either (DijkstraContextError DijkstraEra) TxCert
forall a. a -> Either (DijkstraContextError DijkstraEra) a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (TxCert -> Either (DijkstraContextError DijkstraEra) TxCert)
-> (DijkstraTxCert DijkstraEra -> TxCert)
-> DijkstraTxCert DijkstraEra
-> Either (DijkstraContextError DijkstraEra) TxCert
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TxCert DijkstraEra -> TxCert
DijkstraTxCert DijkstraEra -> TxCert
forall era.
(ConwayEraTxCert era, TxCert era ~ DijkstraTxCert era) =>
TxCert era -> TxCert
transTxCertV3
toPlutusScriptPurpose :: forall (proxy :: Language -> *).
proxy 'PlutusV3
-> LedgerTxInfo DijkstraEra
-> PlutusPurpose AsIxItem DijkstraEra
-> Either
(ContextError DijkstraEra) (PlutusScriptPurpose 'PlutusV3)
toPlutusScriptPurpose proxy 'PlutusV3
proxy LedgerTxInfo DijkstraEra
lti = proxy 'PlutusV3
-> ProtVer
-> PlutusPurpose AsIxItem DijkstraEra
-> Either (ContextError DijkstraEra) ScriptPurpose
forall era (proxy :: Language -> *).
(ConwayEraPlutusTxInfo 'PlutusV3 era,
Inject (ConwayContextError era) (ContextError era)) =>
proxy 'PlutusV3
-> ProtVer
-> PlutusPurpose AsIxItem era
-> Either (ContextError era) ScriptPurpose
Conway.transPlutusPurposeV3 proxy 'PlutusV3
proxy (LedgerTxInfo DijkstraEra -> ProtVer
forall era. LedgerTxInfo era -> ProtVer
ltiProtVer LedgerTxInfo DijkstraEra
lti)
toPlutusTxInfo :: forall (proxy :: Language -> *).
proxy 'PlutusV3
-> LedgerTxInfo DijkstraEra
-> PlutusTxInfoResult 'PlutusV3 DijkstraEra
toPlutusTxInfo proxy 'PlutusV3
proxy lti :: LedgerTxInfo DijkstraEra
lti@LedgerTxInfo {ProtVer
ltiProtVer :: forall era. LedgerTxInfo era -> ProtVer
ltiProtVer :: ProtVer
ltiProtVer, EpochInfo (Either Text)
ltiEpochInfo :: forall era. LedgerTxInfo era -> EpochInfo (Either Text)
ltiEpochInfo :: EpochInfo (Either Text)
ltiEpochInfo, SystemStart
ltiSystemStart :: forall era. LedgerTxInfo era -> SystemStart
ltiSystemStart :: SystemStart
ltiSystemStart, UTxO DijkstraEra
ltiUTxO :: forall era. LedgerTxInfo era -> UTxO era
ltiUTxO :: UTxO DijkstraEra
ltiUTxO, Tx level DijkstraEra
ltiTx :: ()
ltiTx :: Tx level DijkstraEra
ltiTx} =
((Tx TopTx DijkstraEra -> PlutusTxInfoResult 'PlutusV3 DijkstraEra)
-> (Tx SubTx DijkstraEra
-> PlutusTxInfoResult 'PlutusV3 DijkstraEra)
-> PlutusTxInfoResult 'PlutusV3 DijkstraEra)
-> (Tx SubTx DijkstraEra
-> PlutusTxInfoResult 'PlutusV3 DijkstraEra)
-> (Tx TopTx DijkstraEra
-> PlutusTxInfoResult 'PlutusV3 DijkstraEra)
-> PlutusTxInfoResult 'PlutusV3 DijkstraEra
forall a b c. (a -> b -> c) -> b -> a -> c
flip (Tx level DijkstraEra
-> (Tx TopTx DijkstraEra
-> PlutusTxInfoResult 'PlutusV3 DijkstraEra)
-> (Tx SubTx DijkstraEra
-> PlutusTxInfoResult 'PlutusV3 DijkstraEra)
-> PlutusTxInfoResult 'PlutusV3 DijkstraEra
forall (l :: TxLevel) era (t :: TxLevel -> * -> *) a.
(HasEraTxLevel t era, STxLevel l era ~ STxBothLevels l era) =>
t l era -> (t TopTx era -> a) -> (t SubTx era -> a) -> a
withBothTxLevels Tx level DijkstraEra
ltiTx) Tx SubTx DijkstraEra -> PlutusTxInfoResult 'PlutusV3 DijkstraEra
forall (l :: Language) era.
(EraTx era, Inject (DijkstraContextError era) (ContextError era),
PlutusLanguage l) =>
Tx SubTx era -> PlutusTxInfoResult l era
transFailUnsupportedScriptInSubTx ((Tx TopTx DijkstraEra -> PlutusTxInfoResult 'PlutusV3 DijkstraEra)
-> PlutusTxInfoResult 'PlutusV3 DijkstraEra)
-> (Tx TopTx DijkstraEra
-> PlutusTxInfoResult 'PlutusV3 DijkstraEra)
-> PlutusTxInfoResult 'PlutusV3 DijkstraEra
forall a b. (a -> b) -> a -> b
$ \Tx TopTx DijkstraEra
tx -> Either
(ContextError DijkstraEra)
(PlutusPurpose AsPurpose DijkstraEra
-> Either (ContextError DijkstraEra) (PlutusTxInfo 'PlutusV3))
-> PlutusTxInfoResult 'PlutusV3 DijkstraEra
forall (l :: Language) era.
Either
(ContextError era)
(PlutusPurpose AsPurpose era
-> Either (ContextError era) (PlutusTxInfo l))
-> PlutusTxInfoResult l era
PlutusTxInfoResult (Either
(ContextError DijkstraEra)
(PlutusPurpose AsPurpose DijkstraEra
-> Either (ContextError DijkstraEra) (PlutusTxInfo 'PlutusV3))
-> PlutusTxInfoResult 'PlutusV3 DijkstraEra)
-> Either
(ContextError DijkstraEra)
(PlutusPurpose AsPurpose DijkstraEra
-> Either (ContextError DijkstraEra) (PlutusTxInfo 'PlutusV3))
-> PlutusTxInfoResult 'PlutusV3 DijkstraEra
forall a b. (a -> b) -> a -> b
$ do
let
txBody :: TxBody TopTx DijkstraEra
txBody = Tx TopTx DijkstraEra
tx Tx TopTx DijkstraEra
-> Getting
(TxBody TopTx DijkstraEra)
(Tx TopTx DijkstraEra)
(TxBody TopTx DijkstraEra)
-> TxBody TopTx DijkstraEra
forall s a. s -> Getting a s a -> a
^. Getting
(TxBody TopTx DijkstraEra)
(Tx TopTx DijkstraEra)
(TxBody TopTx DijkstraEra)
forall era (l :: TxLevel).
EraTx era =>
Lens' (Tx l era) (TxBody l era)
forall (l :: TxLevel).
Lens' (Tx l DijkstraEra) (TxBody l DijkstraEra)
bodyTxL
txInputs :: Set TxIn
txInputs = TxBody TopTx DijkstraEra
txBody TxBody TopTx DijkstraEra
-> Getting (Set TxIn) (TxBody TopTx DijkstraEra) (Set TxIn)
-> Set TxIn
forall s a. s -> Getting a s a -> a
^. Getting (Set TxIn) (TxBody TopTx DijkstraEra) (Set TxIn)
forall era (l :: TxLevel).
EraTxBody era =>
Lens' (TxBody l era) (Set TxIn)
forall (l :: TxLevel). Lens' (TxBody l DijkstraEra) (Set TxIn)
inputsTxBodyL
refInputs :: Set TxIn
refInputs = TxBody TopTx DijkstraEra
txBody TxBody TopTx DijkstraEra
-> Getting (Set TxIn) (TxBody TopTx DijkstraEra) (Set TxIn)
-> Set TxIn
forall s a. s -> Getting a s a -> a
^. Getting (Set TxIn) (TxBody TopTx DijkstraEra) (Set TxIn)
forall era (l :: TxLevel).
BabbageEraTxBody era =>
Lens' (TxBody l era) (Set TxIn)
forall (l :: TxLevel). Lens' (TxBody l DijkstraEra) (Set TxIn)
referenceInputsTxBodyL
Tx TopTx DijkstraEra -> Either (ContextError DijkstraEra) ()
forall era.
(EraTx era, DijkstraEraTxBody era,
Inject (DijkstraContextError era) (ContextError era)) =>
Tx TopTx era -> Either (ContextError era) ()
guardDijkstraFeaturesForPlutusV1toV3 Tx TopTx DijkstraEra
tx
timeRange <-
Tx TopTx DijkstraEra
-> EpochInfo (Either Text)
-> SystemStart
-> ValidityInterval
-> Either (ContextError DijkstraEra) POSIXTimeRange
forall (proxy :: * -> *) era.
Inject (AlonzoContextError era) (ContextError era) =>
proxy era
-> EpochInfo (Either Text)
-> SystemStart
-> ValidityInterval
-> Either (ContextError era) POSIXTimeRange
Conway.transValidityInterval Tx TopTx DijkstraEra
tx EpochInfo (Either Text)
ltiEpochInfo SystemStart
ltiSystemStart (TxBody TopTx DijkstraEra
txBody TxBody TopTx DijkstraEra
-> Getting
ValidityInterval (TxBody TopTx DijkstraEra) ValidityInterval
-> ValidityInterval
forall s a. s -> Getting a s a -> a
^. Getting
ValidityInterval (TxBody TopTx DijkstraEra) ValidityInterval
forall era (l :: TxLevel).
AllegraEraTxBody era =>
Lens' (TxBody l era) ValidityInterval
forall (l :: TxLevel).
Lens' (TxBody l DijkstraEra) ValidityInterval
vldtTxBodyL)
inputsInfo <- mapM (Conway.transTxInInfoV3 ltiUTxO) (Set.toList txInputs)
refInputsInfo <- mapM (Conway.transTxInInfoV3 ltiUTxO) (Set.toList refInputs)
Conway.checkReferenceInputsNotDisjointFromInputs txBody
outputs <-
zipWithM
(Babbage.transTxOutV2 . TxOutFromOutput)
[minBound ..]
(F.toList (txBody ^. outputsTxBodyL))
txCerts <- Alonzo.transTxBodyCerts proxy ltiProtVer txBody
plutusRedeemers <- Babbage.transTxRedeemers proxy lti
let
txInfo =
PV3.TxInfo
{ txInfoInputs :: [TxInInfo]
PV3.txInfoInputs = [TxInInfo]
inputsInfo
, txInfoOutputs :: [TxOut]
PV3.txInfoOutputs = [TxOut]
outputs
, txInfoReferenceInputs :: [TxInInfo]
PV3.txInfoReferenceInputs = [TxInInfo]
refInputsInfo
, txInfoFee :: Lovelace
PV3.txInfoFee = Coin -> Lovelace
transCoinToLovelace (TxBody TopTx DijkstraEra
txBody TxBody TopTx DijkstraEra
-> Getting Coin (TxBody TopTx DijkstraEra) Coin -> Coin
forall s a. s -> Getting a s a -> a
^. Getting Coin (TxBody TopTx DijkstraEra) Coin
forall era. EraTxBody era => Lens' (TxBody TopTx era) Coin
Lens' (TxBody TopTx DijkstraEra) Coin
feeTxBodyL)
, txInfoMint :: MintValue
PV3.txInfoMint = MultiAsset -> MintValue
Conway.transMintValue (TxBody TopTx DijkstraEra
txBody TxBody TopTx DijkstraEra
-> Getting MultiAsset (TxBody TopTx DijkstraEra) MultiAsset
-> MultiAsset
forall s a. s -> Getting a s a -> a
^. Getting MultiAsset (TxBody TopTx DijkstraEra) MultiAsset
forall era (l :: TxLevel).
MaryEraTxBody era =>
Lens' (TxBody l era) MultiAsset
forall (l :: TxLevel). Lens' (TxBody l DijkstraEra) MultiAsset
mintTxBodyL)
, txInfoTxCerts :: [TxCert]
PV3.txInfoTxCerts = [TxCert]
txCerts
, txInfoWdrl :: Map Credential Lovelace
PV3.txInfoWdrl = TxBody TopTx DijkstraEra -> Map Credential Lovelace
forall era (l :: TxLevel).
EraTxBody era =>
TxBody l era -> Map Credential Lovelace
Conway.transTxBodyWithdrawals TxBody TopTx DijkstraEra
txBody
, txInfoValidRange :: POSIXTimeRange
PV3.txInfoValidRange = POSIXTimeRange
timeRange
, txInfoSignatories :: [PubKeyHash]
PV3.txInfoSignatories = TxBody TopTx DijkstraEra -> [PubKeyHash]
forall era (t :: TxLevel).
AlonzoEraTxBody era =>
TxBody t era -> [PubKeyHash]
Alonzo.transTxBodyReqSignerHashes TxBody TopTx DijkstraEra
txBody
, txInfoRedeemers :: Map ScriptPurpose Redeemer
PV3.txInfoRedeemers = Map ScriptPurpose Redeemer
plutusRedeemers
, txInfoData :: Map DatumHash Datum
PV3.txInfoData = [(DatumHash, Datum)] -> Map DatumHash Datum
forall k v. [(k, v)] -> Map k v
PV3.unsafeFromList ([(DatumHash, Datum)] -> Map DatumHash Datum)
-> [(DatumHash, Datum)] -> Map DatumHash Datum
forall a b. (a -> b) -> a -> b
$ TxWits DijkstraEra -> [(DatumHash, Datum)]
forall era.
AlonzoEraTxWits era =>
TxWits era -> [(DatumHash, Datum)]
Alonzo.transTxWitsDatums (Tx TopTx DijkstraEra
tx Tx TopTx DijkstraEra
-> Getting
(TxWits DijkstraEra) (Tx TopTx DijkstraEra) (TxWits DijkstraEra)
-> TxWits DijkstraEra
forall s a. s -> Getting a s a -> a
^. Getting
(TxWits DijkstraEra) (Tx TopTx DijkstraEra) (TxWits DijkstraEra)
forall era (l :: TxLevel).
EraTx era =>
Lens' (Tx l era) (TxWits era)
forall (l :: TxLevel).
Lens' (Tx l DijkstraEra) (TxWits DijkstraEra)
witsTxL)
, txInfoId :: TxId
PV3.txInfoId = TxBody TopTx DijkstraEra -> TxId
forall era (l :: TxLevel). EraTxBody era => TxBody l era -> TxId
Conway.transTxBodyId TxBody TopTx DijkstraEra
txBody
, txInfoVotes :: Map Voter (Map GovernanceActionId Vote)
PV3.txInfoVotes = VotingProcedures DijkstraEra
-> Map Voter (Map GovernanceActionId Vote)
forall era.
VotingProcedures era -> Map Voter (Map GovernanceActionId Vote)
Conway.transVotingProcedures (TxBody TopTx DijkstraEra
txBody TxBody TopTx DijkstraEra
-> Getting
(VotingProcedures DijkstraEra)
(TxBody TopTx DijkstraEra)
(VotingProcedures DijkstraEra)
-> VotingProcedures DijkstraEra
forall s a. s -> Getting a s a -> a
^. Getting
(VotingProcedures DijkstraEra)
(TxBody TopTx DijkstraEra)
(VotingProcedures DijkstraEra)
forall era (l :: TxLevel).
ConwayEraTxBody era =>
Lens' (TxBody l era) (VotingProcedures era)
forall (l :: TxLevel).
Lens' (TxBody l DijkstraEra) (VotingProcedures DijkstraEra)
votingProceduresTxBodyL)
, txInfoProposalProcedures :: [ProposalProcedure]
PV3.txInfoProposalProcedures =
(ProposalProcedure DijkstraEra -> ProposalProcedure)
-> [ProposalProcedure DijkstraEra] -> [ProposalProcedure]
forall a b. (a -> b) -> [a] -> [b]
map (proxy 'PlutusV3
-> ProposalProcedure DijkstraEra -> ProposalProcedure
forall (l :: Language) era (proxy :: Language -> *).
ConwayEraPlutusTxInfo l era =>
proxy l -> ProposalProcedure era -> ProposalProcedure
Conway.transProposal proxy 'PlutusV3
proxy) ([ProposalProcedure DijkstraEra] -> [ProposalProcedure])
-> [ProposalProcedure DijkstraEra] -> [ProposalProcedure]
forall a b. (a -> b) -> a -> b
$ OSet (ProposalProcedure DijkstraEra)
-> [ProposalProcedure DijkstraEra]
forall a. OSet a -> [a]
forall (t :: * -> *) a. Foldable t => t a -> [a]
toList (TxBody TopTx DijkstraEra
txBody TxBody TopTx DijkstraEra
-> Getting
(OSet (ProposalProcedure DijkstraEra))
(TxBody TopTx DijkstraEra)
(OSet (ProposalProcedure DijkstraEra))
-> OSet (ProposalProcedure DijkstraEra)
forall s a. s -> Getting a s a -> a
^. Getting
(OSet (ProposalProcedure DijkstraEra))
(TxBody TopTx DijkstraEra)
(OSet (ProposalProcedure DijkstraEra))
forall era (l :: TxLevel).
ConwayEraTxBody era =>
Lens' (TxBody l era) (OSet (ProposalProcedure era))
forall (l :: TxLevel).
Lens' (TxBody l DijkstraEra) (OSet (ProposalProcedure DijkstraEra))
proposalProceduresTxBodyL)
, txInfoCurrentTreasuryAmount :: Maybe Lovelace
PV3.txInfoCurrentTreasuryAmount =
Maybe Lovelace
-> (Coin -> Maybe Lovelace) -> StrictMaybe Coin -> Maybe Lovelace
forall a b. a -> (b -> a) -> StrictMaybe b -> a
strictMaybe Maybe Lovelace
forall a. Maybe a
Nothing (Lovelace -> Maybe Lovelace
forall a. a -> Maybe a
Just (Lovelace -> Maybe Lovelace)
-> (Coin -> Lovelace) -> Coin -> Maybe Lovelace
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Coin -> Lovelace
transCoinToLovelace) (StrictMaybe Coin -> Maybe Lovelace)
-> StrictMaybe Coin -> Maybe Lovelace
forall a b. (a -> b) -> a -> b
$ TxBody TopTx DijkstraEra
txBody TxBody TopTx DijkstraEra
-> Getting
(StrictMaybe Coin) (TxBody TopTx DijkstraEra) (StrictMaybe Coin)
-> StrictMaybe Coin
forall s a. s -> Getting a s a -> a
^. Getting
(StrictMaybe Coin) (TxBody TopTx DijkstraEra) (StrictMaybe Coin)
forall era (l :: TxLevel).
ConwayEraTxBody era =>
Lens' (TxBody l era) (StrictMaybe Coin)
forall (l :: TxLevel).
Lens' (TxBody l DijkstraEra) (StrictMaybe Coin)
currentTreasuryValueTxBodyL
, txInfoTreasuryDonation :: Maybe Lovelace
PV3.txInfoTreasuryDonation =
case TxBody TopTx DijkstraEra
txBody TxBody TopTx DijkstraEra
-> Getting Coin (TxBody TopTx DijkstraEra) Coin -> Coin
forall s a. s -> Getting a s a -> a
^. Getting Coin (TxBody TopTx DijkstraEra) Coin
forall era (l :: TxLevel).
ConwayEraTxBody era =>
Lens' (TxBody l era) Coin
forall (l :: TxLevel). Lens' (TxBody l DijkstraEra) Coin
treasuryDonationTxBodyL of
Coin Integer
0 -> Maybe Lovelace
forall a. Maybe a
Nothing
Coin
coin -> Lovelace -> Maybe Lovelace
forall a. a -> Maybe a
Just (Lovelace -> Maybe Lovelace) -> Lovelace -> Maybe Lovelace
forall a b. (a -> b) -> a -> b
$ Coin -> Lovelace
transCoinToLovelace Coin
coin
}
Right $ \DijkstraPlutusPurpose AsPurpose DijkstraEra
_ -> TxInfo -> Either (DijkstraContextError DijkstraEra) TxInfo
forall a b. b -> Either a b
Right TxInfo
txInfo
toPlutusArgs :: forall (proxy :: Language -> *).
proxy 'PlutusV3
-> LedgerTxInfo DijkstraEra
-> PlutusTxInfo 'PlutusV3
-> PlutusPurpose AsIxItem DijkstraEra
-> Data DijkstraEra
-> Either (ContextError DijkstraEra) (PlutusArgs 'PlutusV3)
toPlutusArgs = proxy 'PlutusV3
-> LedgerTxInfo DijkstraEra
-> PlutusTxInfo 'PlutusV3
-> PlutusPurpose AsIxItem DijkstraEra
-> Data DijkstraEra
-> Either (ContextError DijkstraEra) (PlutusArgs 'PlutusV3)
proxy 'PlutusV3
-> LedgerTxInfo DijkstraEra
-> TxInfo
-> PlutusPurpose AsIxItem DijkstraEra
-> Data DijkstraEra
-> Either (ContextError DijkstraEra) (PlutusArgs 'PlutusV3)
forall era (proxy :: Language -> *).
(AlonzoEraUTxO era, EraPlutusTxInfo 'PlutusV3 era) =>
proxy 'PlutusV3
-> LedgerTxInfo era
-> TxInfo
-> PlutusPurpose AsIxItem era
-> Data era
-> Either (ContextError era) (PlutusArgs 'PlutusV3)
Conway.toPlutusV3Args
toPlutusTxInInfo :: forall (proxy :: Language -> *).
proxy 'PlutusV3
-> UTxO DijkstraEra
-> TxIn
-> Either
(ContextError DijkstraEra) (PlutusTxInInfo DijkstraEra 'PlutusV3)
toPlutusTxInInfo proxy 'PlutusV3
_ = UTxO DijkstraEra
-> TxIn
-> Either
(ContextError DijkstraEra) (PlutusTxInInfo DijkstraEra 'PlutusV3)
UTxO DijkstraEra
-> TxIn -> Either (ContextError DijkstraEra) TxInInfo
forall era.
(Inject (BabbageContextError era) (ContextError era),
Value era ~ MaryValue, BabbageEraTxOut era) =>
UTxO era -> TxIn -> Either (ContextError era) TxInInfo
transTxInInfoV3
guardDijkstraFeaturesForPlutusV1toV3 ::
forall era.
( EraTx era
, DijkstraEraTxBody era
, Inject (DijkstraContextError era) (ContextError era)
) =>
Tx TopTx era ->
Either (ContextError era) ()
guardDijkstraFeaturesForPlutusV1toV3 :: forall era.
(EraTx era, DijkstraEraTxBody era,
Inject (DijkstraContextError era) (ContextError era)) =>
Tx TopTx era -> Either (ContextError era) ()
guardDijkstraFeaturesForPlutusV1toV3 Tx TopTx era
tx = do
let txBody :: TxBody TopTx era
txBody = Tx TopTx era
tx Tx TopTx era
-> Getting (TxBody TopTx era) (Tx TopTx era) (TxBody TopTx era)
-> TxBody TopTx era
forall s a. s -> Getting a s a -> a
^. Getting (TxBody TopTx era) (Tx TopTx era) (TxBody TopTx era)
forall era (l :: TxLevel).
EraTx era =>
Lens' (Tx l era) (TxBody l era)
forall (l :: TxLevel). Lens' (Tx l era) (TxBody l era)
bodyTxL
directDeposits :: DirectDeposits
directDeposits = TxBody TopTx era
txBody TxBody TopTx era
-> Getting DirectDeposits (TxBody TopTx era) DirectDeposits
-> DirectDeposits
forall s a. s -> Getting a s a -> a
^. Getting DirectDeposits (TxBody TopTx era) DirectDeposits
forall era (l :: TxLevel).
DijkstraEraTxBody era =>
Lens' (TxBody l era) DirectDeposits
forall (l :: TxLevel). Lens' (TxBody l era) DirectDeposits
directDepositsTxBodyL
accountBalanceIntervals :: AccountBalanceIntervals era
accountBalanceIntervals = TxBody TopTx era
txBody TxBody TopTx era
-> Getting
(AccountBalanceIntervals era)
(TxBody TopTx era)
(AccountBalanceIntervals era)
-> AccountBalanceIntervals era
forall s a. s -> Getting a s a -> a
^. Getting
(AccountBalanceIntervals era)
(TxBody TopTx era)
(AccountBalanceIntervals era)
forall era (l :: TxLevel).
DijkstraEraTxBody era =>
Lens' (TxBody l era) (AccountBalanceIntervals era)
forall (l :: TxLevel).
Lens' (TxBody l era) (AccountBalanceIntervals era)
accountBalanceIntervalsTxBodyL
requiredTopLevelGuards :: Map (Credential Guard) (StrictMaybe (Data era))
requiredTopLevelGuards = TxBody TopTx era
txBody TxBody TopTx era
-> Getting
(Map (Credential Guard) (StrictMaybe (Data era)))
(TxBody TopTx era)
(Map (Credential Guard) (StrictMaybe (Data era)))
-> Map (Credential Guard) (StrictMaybe (Data era))
forall s a. s -> Getting a s a -> a
^. Getting
(Map (Credential Guard) (StrictMaybe (Data era)))
(TxBody TopTx era)
(Map (Credential Guard) (StrictMaybe (Data era)))
forall era (l :: TxLevel).
DijkstraEraTxBody era =>
Lens'
(TxBody l era) (Map (Credential Guard) (StrictMaybe (Data era)))
forall (l :: TxLevel).
Lens'
(TxBody l era) (Map (Credential Guard) (StrictMaybe (Data era)))
requiredTopLevelGuardsL
scriptHashes :: [ScriptHash]
scriptHashes = [ScriptHash
sh | ScriptHashObj ScriptHash
sh <- OSet (Credential Guard) -> [Credential Guard]
forall a. OSet a -> [a]
forall (t :: * -> *) a. Foldable t => t a -> [a]
toList (TxBody TopTx era
txBody TxBody TopTx era
-> Getting
(OSet (Credential Guard))
(TxBody TopTx era)
(OSet (Credential Guard))
-> OSet (Credential Guard)
forall s a. s -> Getting a s a -> a
^. Getting
(OSet (Credential Guard))
(TxBody TopTx era)
(OSet (Credential Guard))
forall era (l :: TxLevel).
DijkstraEraTxBody era =>
Lens' (TxBody l era) (OSet (Credential Guard))
forall (l :: TxLevel).
Lens' (TxBody l era) (OSet (Credential Guard))
guardsTxBodyL)]
Bool
-> Either (ContextError era) () -> Either (ContextError era) ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (Map AccountAddress Coin -> Bool
forall a. Map AccountAddress a -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null (Map AccountAddress Coin -> Bool)
-> Map AccountAddress Coin -> Bool
forall a b. (a -> b) -> a -> b
$ DirectDeposits -> Map AccountAddress Coin
unDirectDeposits DirectDeposits
directDeposits) (Either (ContextError era) () -> Either (ContextError era) ())
-> Either (ContextError era) () -> Either (ContextError era) ()
forall a b. (a -> b) -> a -> b
$
ContextError era -> Either (ContextError era) ()
forall a b. a -> Either a b
Left (ContextError era -> Either (ContextError era) ())
-> ContextError era -> Either (ContextError era) ()
forall a b. (a -> b) -> a -> b
$
DijkstraContextError era -> ContextError era
forall t s. Inject t s => t -> s
inject (DijkstraContextError era -> ContextError era)
-> DijkstraContextError era -> ContextError era
forall a b. (a -> b) -> a -> b
$
forall era. DirectDeposits -> DijkstraContextError era
DirectDepositsNotSupported @era DirectDeposits
directDeposits
Bool
-> Either (ContextError era) () -> Either (ContextError era) ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (Map AccountAddress (AccountBalanceInterval era) -> Bool
forall a. Map AccountAddress a -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null (Map AccountAddress (AccountBalanceInterval era) -> Bool)
-> Map AccountAddress (AccountBalanceInterval era) -> Bool
forall a b. (a -> b) -> a -> b
$ AccountBalanceIntervals era
-> Map AccountAddress (AccountBalanceInterval era)
forall era.
AccountBalanceIntervals era
-> Map AccountAddress (AccountBalanceInterval era)
unAccountBalanceIntervals AccountBalanceIntervals era
accountBalanceIntervals) (Either (ContextError era) () -> Either (ContextError era) ())
-> Either (ContextError era) () -> Either (ContextError era) ()
forall a b. (a -> b) -> a -> b
$
ContextError era -> Either (ContextError era) ()
forall a b. a -> Either a b
Left (ContextError era -> Either (ContextError era) ())
-> ContextError era -> Either (ContextError era) ()
forall a b. (a -> b) -> a -> b
$
DijkstraContextError era -> ContextError era
forall t s. Inject t s => t -> s
inject (DijkstraContextError era -> ContextError era)
-> DijkstraContextError era -> ContextError era
forall a b. (a -> b) -> a -> b
$
forall era. AccountBalanceIntervals era -> DijkstraContextError era
AccountBalanceIntervalsNotSupported @era AccountBalanceIntervals era
accountBalanceIntervals
case Map (Credential Guard) (StrictMaybe (Data era))
-> Maybe (NonEmptyMap (Credential Guard) (StrictMaybe (Data era)))
forall k v. Map k v -> Maybe (NonEmptyMap k v)
NEMap.fromMap Map (Credential Guard) (StrictMaybe (Data era))
requiredTopLevelGuards of
Maybe (NonEmptyMap (Credential Guard) (StrictMaybe (Data era)))
Nothing -> () -> Either (ContextError era) ()
forall a b. b -> Either a b
Right ()
Just NonEmptyMap (Credential Guard) (StrictMaybe (Data era))
neRequiredTopLevelGuards ->
ContextError era -> Either (ContextError era) ()
forall a b. a -> Either a b
Left (ContextError era -> Either (ContextError era) ())
-> ContextError era -> Either (ContextError era) ()
forall a b. (a -> b) -> a -> b
$
DijkstraContextError era -> ContextError era
forall t s. Inject t s => t -> s
inject (DijkstraContextError era -> ContextError era)
-> DijkstraContextError era -> ContextError era
forall a b. (a -> b) -> a -> b
$
forall era.
NonEmptyMap (Credential Guard) (StrictMaybe (Data era))
-> DijkstraContextError era
RequiredTopLevelGuardsNotSupported @era NonEmptyMap (Credential Guard) (StrictMaybe (Data era))
neRequiredTopLevelGuards
case [ScriptHash] -> Maybe (NonEmpty ScriptHash)
forall a. [a] -> Maybe (NonEmpty a)
NE.nonEmpty [ScriptHash]
scriptHashes of
Maybe (NonEmpty ScriptHash)
Nothing -> () -> Either (ContextError era) ()
forall a b. b -> Either a b
Right ()
Just NonEmpty ScriptHash
neScriptHashes ->
ContextError era -> Either (ContextError era) ()
forall a b. a -> Either a b
Left (ContextError era -> Either (ContextError era) ())
-> ContextError era -> Either (ContextError era) ()
forall a b. (a -> b) -> a -> b
$
DijkstraContextError era -> ContextError era
forall t s. Inject t s => t -> s
inject (DijkstraContextError era -> ContextError era)
-> DijkstraContextError era -> ContextError era
forall a b. (a -> b) -> a -> b
$
forall era. NonEmpty ScriptHash -> DijkstraContextError era
GuardScriptHashesNotSupported @era NonEmpty ScriptHash
neScriptHashes
transFailUnsupportedScriptInSubTx ::
forall l era.
( EraTx era
, Inject (DijkstraContextError era) (ContextError era)
, PlutusLanguage l
) =>
Tx SubTx era -> PlutusTxInfoResult l era
transFailUnsupportedScriptInSubTx :: forall (l :: Language) era.
(EraTx era, Inject (DijkstraContextError era) (ContextError era),
PlutusLanguage l) =>
Tx SubTx era -> PlutusTxInfoResult l era
transFailUnsupportedScriptInSubTx Tx SubTx era
tx =
Either
(ContextError era)
(PlutusPurpose AsPurpose era
-> Either (ContextError era) (PlutusTxInfo l))
-> PlutusTxInfoResult l era
forall (l :: Language) era.
Either
(ContextError era)
(PlutusPurpose AsPurpose era
-> Either (ContextError era) (PlutusTxInfo l))
-> PlutusTxInfoResult l era
PlutusTxInfoResult (Either
(ContextError era)
(PlutusPurpose AsPurpose era
-> Either (ContextError era) (PlutusTxInfo l))
-> PlutusTxInfoResult l era)
-> Either
(ContextError era)
(PlutusPurpose AsPurpose era
-> Either (ContextError era) (PlutusTxInfo l))
-> PlutusTxInfoResult l era
forall a b. (a -> b) -> a -> b
$
ContextError era
-> Either
(ContextError era)
(PlutusPurpose AsPurpose era
-> Either (ContextError era) (PlutusTxInfo l))
forall a b. a -> Either a b
Left (ContextError era
-> Either
(ContextError era)
(PlutusPurpose AsPurpose era
-> Either (ContextError era) (PlutusTxInfo l)))
-> ContextError era
-> Either
(ContextError era)
(PlutusPurpose AsPurpose era
-> Either (ContextError era) (PlutusTxInfo l))
forall a b. (a -> b) -> a -> b
$
DijkstraContextError era -> ContextError era
forall t s. Inject t s => t -> s
inject (DijkstraContextError era -> ContextError era)
-> DijkstraContextError era -> ContextError era
forall a b. (a -> b) -> a -> b
$
forall era. Language -> TxId -> DijkstraContextError era
UnsupportedScriptInSubTx @era (Proxy l -> Language
forall (l :: Language) (proxy :: Language -> *).
PlutusLanguage l =>
proxy l -> Language
plutusLanguage (forall {k} (t :: k). Proxy t
forall (t :: Language). Proxy t
Proxy @l)) (Tx SubTx era -> TxId
forall era (l :: TxLevel). EraTx era => Tx l era -> TxId
txIdTx Tx SubTx era
tx)
transTxCertV3 ::
(ConwayEraTxCert era, TxCert era ~ DijkstraTxCert era) => TxCert era -> PV3.TxCert
transTxCertV3 :: forall era.
(ConwayEraTxCert era, TxCert era ~ DijkstraTxCert era) =>
TxCert era -> TxCert
transTxCertV3 = \case
RegPoolTxCert StakePoolParams {KeyHash StakePool
sppId :: forall era. StakePoolParams era -> KeyHash StakePool
sppId :: KeyHash StakePool
sppId, VRFVerKeyHash StakePoolVRF
sppVrf :: forall era. StakePoolParams era -> VRFVerKeyHash StakePoolVRF
sppVrf :: VRFVerKeyHash StakePoolVRF
sppVrf} ->
PubKeyHash -> PubKeyHash -> TxCert
PV3.TxCertPoolRegister
(KeyHash StakePool -> PubKeyHash
forall (d :: KeyRole). KeyHash d -> PubKeyHash
transKeyHash KeyHash StakePool
sppId)
(BuiltinByteString -> PubKeyHash
PV3.PubKeyHash (ByteString -> ToBuiltin ByteString
forall a. HasToBuiltin a => a -> ToBuiltin a
PV3.toBuiltin (Hash HASH KeyRoleVRF -> ByteString
forall h a. Hash h a -> ByteString
hashToBytes (VRFVerKeyHash StakePoolVRF -> Hash HASH KeyRoleVRF
forall (r :: KeyRoleVRF). VRFVerKeyHash r -> Hash HASH KeyRoleVRF
unVRFVerKeyHash VRFVerKeyHash StakePoolVRF
sppVrf))))
RetirePoolTxCert KeyHash StakePool
poolId EpochNo
retireEpochNo ->
PubKeyHash -> Integer -> TxCert
PV3.TxCertPoolRetire (KeyHash StakePool -> PubKeyHash
forall (d :: KeyRole). KeyHash d -> PubKeyHash
transKeyHash KeyHash StakePool
poolId) (EpochNo -> Integer
transEpochNo EpochNo
retireEpochNo)
RegDepositTxCert Credential Staking
stakeCred Coin
deposit ->
Credential -> Maybe Lovelace -> TxCert
PV3.TxCertRegStaking (Credential Staking -> Credential
forall (kr :: KeyRole). Credential kr -> Credential
transCred Credential Staking
stakeCred) (Lovelace -> Maybe Lovelace
forall a. a -> Maybe a
Just (Lovelace -> Maybe Lovelace) -> Lovelace -> Maybe Lovelace
forall a b. (a -> b) -> a -> b
$ Coin -> Lovelace
transCoinToLovelace Coin
deposit)
UnRegDepositTxCert Credential Staking
stakeCred Coin
refund ->
Credential -> Maybe Lovelace -> TxCert
PV3.TxCertUnRegStaking (Credential Staking -> Credential
forall (kr :: KeyRole). Credential kr -> Credential
transCred Credential Staking
stakeCred) (Lovelace -> Maybe Lovelace
forall a. a -> Maybe a
Just (Lovelace -> Maybe Lovelace) -> Lovelace -> Maybe Lovelace
forall a b. (a -> b) -> a -> b
$ Coin -> Lovelace
transCoinToLovelace Coin
refund)
DelegTxCert Credential Staking
stakeCred Delegatee
delegatee ->
Credential -> Delegatee -> TxCert
PV3.TxCertDelegStaking (Credential Staking -> Credential
forall (kr :: KeyRole). Credential kr -> Credential
transCred Credential Staking
stakeCred) (Delegatee -> Delegatee
Conway.transDelegatee Delegatee
delegatee)
RegDepositDelegTxCert Credential Staking
stakeCred Delegatee
delegatee Coin
deposit ->
Credential -> Delegatee -> Lovelace -> TxCert
PV3.TxCertRegDeleg
(Credential Staking -> Credential
forall (kr :: KeyRole). Credential kr -> Credential
transCred Credential Staking
stakeCred)
(Delegatee -> Delegatee
Conway.transDelegatee Delegatee
delegatee)
(Coin -> Lovelace
transCoinToLovelace Coin
deposit)
AuthCommitteeHotKeyTxCert Credential ColdCommitteeRole
coldCred Credential HotCommitteeRole
hotCred ->
ColdCommitteeCredential -> HotCommitteeCredential -> TxCert
PV3.TxCertAuthHotCommittee
(Credential ColdCommitteeRole -> ColdCommitteeCredential
Conway.transColdCommitteeCred Credential ColdCommitteeRole
coldCred)
(Credential HotCommitteeRole -> HotCommitteeCredential
Conway.transHotCommitteeCred Credential HotCommitteeRole
hotCred)
ResignCommitteeColdTxCert Credential ColdCommitteeRole
coldCred StrictMaybe Anchor
_anchor ->
ColdCommitteeCredential -> TxCert
PV3.TxCertResignColdCommittee (Credential ColdCommitteeRole -> ColdCommitteeCredential
Conway.transColdCommitteeCred Credential ColdCommitteeRole
coldCred)
RegDRepTxCert Credential DRepRole
drepCred Coin
deposit StrictMaybe Anchor
_anchor ->
DRepCredential -> Lovelace -> TxCert
PV3.TxCertRegDRep (Credential DRepRole -> DRepCredential
Conway.transDRepCred Credential DRepRole
drepCred) (Coin -> Lovelace
transCoinToLovelace Coin
deposit)
UnRegDRepTxCert Credential DRepRole
drepCred Coin
refund ->
DRepCredential -> Lovelace -> TxCert
PV3.TxCertUnRegDRep (Credential DRepRole -> DRepCredential
Conway.transDRepCred Credential DRepRole
drepCred) (Coin -> Lovelace
transCoinToLovelace Coin
refund)
UpdateDRepTxCert Credential DRepRole
drepCred StrictMaybe Anchor
_anchor ->
DRepCredential -> TxCert
PV3.TxCertUpdateDRep (Credential DRepRole -> DRepCredential
Conway.transDRepCred Credential DRepRole
drepCred)
TxCert era
_ -> String -> TxCert
forall a. HasCallStack => String -> a
error String
"Impossible: All TxCerts should have been accounted for"
instance ConwayEraPlutusTxInfo 'PlutusV3 DijkstraEra where
toPlutusChangedParameters :: forall (proxy :: Language -> *).
proxy 'PlutusV3 -> PParamsUpdate DijkstraEra -> ChangedParameters
toPlutusChangedParameters proxy 'PlutusV3
_ PParamsUpdate DijkstraEra
x = BuiltinData -> ChangedParameters
PV3.ChangedParameters (Data -> BuiltinData
PV3.dataToBuiltinData (PParamsUpdate DijkstraEra -> Data
forall x. ToPlutusData x => x -> Data
toPlutusData PParamsUpdate DijkstraEra
x))
instance ConwayEraPlutusTxInfo 'PlutusV4 DijkstraEra where
toPlutusChangedParameters :: forall (proxy :: Language -> *).
proxy 'PlutusV4 -> PParamsUpdate DijkstraEra -> ChangedParameters
toPlutusChangedParameters proxy 'PlutusV4
_ PParamsUpdate DijkstraEra
x = BuiltinData -> ChangedParameters
PV3.ChangedParameters (Data -> BuiltinData
PV3.dataToBuiltinData (PParamsUpdate DijkstraEra -> Data
forall x. ToPlutusData x => x -> Data
toPlutusData PParamsUpdate DijkstraEra
x))
instance EraPlutusTxInfo 'PlutusV4 DijkstraEra where
toPlutusTxCert :: forall (proxy :: Language -> *).
proxy 'PlutusV4
-> ProtVer
-> TxCert DijkstraEra
-> Either (ContextError DijkstraEra) (PlutusTxCert 'PlutusV4)
toPlutusTxCert proxy 'PlutusV4
_proxy ProtVer
_pv = TxCert -> Either (DijkstraContextError DijkstraEra) TxCert
forall a. a -> Either (DijkstraContextError DijkstraEra) a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (TxCert -> Either (DijkstraContextError DijkstraEra) TxCert)
-> (DijkstraTxCert DijkstraEra -> TxCert)
-> DijkstraTxCert DijkstraEra
-> Either (DijkstraContextError DijkstraEra) TxCert
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TxCert DijkstraEra -> TxCert
DijkstraTxCert DijkstraEra -> TxCert
forall era. ConwayEraTxCert era => TxCert era -> TxCert
transTxCertV4
toPlutusScriptPurpose :: forall (proxy :: Language -> *).
proxy 'PlutusV4
-> LedgerTxInfo DijkstraEra
-> PlutusPurpose AsIxItem DijkstraEra
-> Either
(ContextError DijkstraEra) (PlutusScriptPurpose 'PlutusV4)
toPlutusScriptPurpose = proxy 'PlutusV4
-> LedgerTxInfo DijkstraEra
-> PlutusPurpose AsIxItem DijkstraEra
-> Either
(ContextError DijkstraEra) (PlutusScriptPurpose 'PlutusV4)
forall era (proxy :: Language -> *).
(DijkstraEraScript era, ConwayEraPlutusTxInfo 'PlutusV4 era,
Inject (ConwayContextError era) (ContextError era),
Inject (DijkstraContextError era) (ContextError era)) =>
proxy 'PlutusV4
-> LedgerTxInfo era
-> PlutusPurpose AsIxItem era
-> Either (ContextError era) (PlutusScriptPurpose 'PlutusV4)
transPlutusPurposeV4
toPlutusTxInfo :: forall (proxy :: Language -> *).
proxy 'PlutusV4
-> LedgerTxInfo DijkstraEra
-> PlutusTxInfoResult 'PlutusV4 DijkstraEra
toPlutusTxInfo proxy 'PlutusV4
proxy lti :: LedgerTxInfo DijkstraEra
lti@LedgerTxInfo {[(PlutusPurpose AsIxItem DijkstraEra,
SupportedPlutusRunnable DijkstraEra)]
Map (PlutusPurpose AsIx DijkstraEra) ScriptHash
Map TxId (TxInfoResult DijkstraEra)
Tx level DijkstraEra
UTxO DijkstraEra
EpochInfo (Either Text)
ProtVer
SystemStart
ltiProtVer :: forall era. LedgerTxInfo era -> ProtVer
ltiEpochInfo :: forall era. LedgerTxInfo era -> EpochInfo (Either Text)
ltiSystemStart :: forall era. LedgerTxInfo era -> SystemStart
ltiUTxO :: forall era. LedgerTxInfo era -> UTxO era
ltiTx :: ()
ltiProtVer :: ProtVer
ltiEpochInfo :: EpochInfo (Either Text)
ltiSystemStart :: SystemStart
ltiUTxO :: UTxO DijkstraEra
ltiTx :: Tx level DijkstraEra
ltiScriptsUsed :: [(PlutusPurpose AsIxItem DijkstraEra,
SupportedPlutusRunnable DijkstraEra)]
ltiScriptHashesUsed :: Map (PlutusPurpose AsIx DijkstraEra) ScriptHash
ltiMemoizedSubTransactions :: Map TxId (TxInfoResult DijkstraEra)
ltiMemoizedSubTransactions :: forall era. LedgerTxInfo era -> Map TxId (TxInfoResult era)
ltiScriptHashesUsed :: forall era.
LedgerTxInfo era -> Map (PlutusPurpose AsIx era) ScriptHash
ltiScriptsUsed :: forall era.
LedgerTxInfo era
-> [(PlutusPurpose AsIxItem era, SupportedPlutusRunnable era)]
..} =
Either
(ContextError DijkstraEra)
(PlutusPurpose AsPurpose DijkstraEra
-> Either (ContextError DijkstraEra) (PlutusTxInfo 'PlutusV4))
-> PlutusTxInfoResult 'PlutusV4 DijkstraEra
forall (l :: Language) era.
Either
(ContextError era)
(PlutusPurpose AsPurpose era
-> Either (ContextError era) (PlutusTxInfo l))
-> PlutusTxInfoResult l era
PlutusTxInfoResult (Either
(ContextError DijkstraEra)
(PlutusPurpose AsPurpose DijkstraEra
-> Either (ContextError DijkstraEra) (PlutusTxInfo 'PlutusV4))
-> PlutusTxInfoResult 'PlutusV4 DijkstraEra)
-> Either
(ContextError DijkstraEra)
(PlutusPurpose AsPurpose DijkstraEra
-> Either (ContextError DijkstraEra) (PlutusTxInfo 'PlutusV4))
-> PlutusTxInfoResult 'PlutusV4 DijkstraEra
forall a b. (a -> b) -> a -> b
$ do
let
era :: Proxy DijkstraEra
era = forall t. Proxy t
forall {k} (t :: k). Proxy t
Proxy @DijkstraEra
txBody :: TxBody level DijkstraEra
txBody = Tx level DijkstraEra
ltiTx Tx level DijkstraEra
-> Getting
(TxBody level DijkstraEra)
(Tx level DijkstraEra)
(TxBody level DijkstraEra)
-> TxBody level DijkstraEra
forall s a. s -> Getting a s a -> a
^. Getting
(TxBody level DijkstraEra)
(Tx level DijkstraEra)
(TxBody level DijkstraEra)
forall era (l :: TxLevel).
EraTx era =>
Lens' (Tx l era) (TxBody l era)
forall (l :: TxLevel).
Lens' (Tx l DijkstraEra) (TxBody l DijkstraEra)
bodyTxL
txInputs :: Set TxIn
txInputs = TxBody level DijkstraEra
txBody TxBody level DijkstraEra
-> Getting (Set TxIn) (TxBody level DijkstraEra) (Set TxIn)
-> Set TxIn
forall s a. s -> Getting a s a -> a
^. Getting (Set TxIn) (TxBody level DijkstraEra) (Set TxIn)
forall era (l :: TxLevel).
EraTxBody era =>
Lens' (TxBody l era) (Set TxIn)
forall (l :: TxLevel). Lens' (TxBody l DijkstraEra) (Set TxIn)
inputsTxBodyL
refInputs :: Set TxIn
refInputs = TxBody level DijkstraEra
txBody TxBody level DijkstraEra
-> Getting (Set TxIn) (TxBody level DijkstraEra) (Set TxIn)
-> Set TxIn
forall s a. s -> Getting a s a -> a
^. Getting (Set TxIn) (TxBody level DijkstraEra) (Set TxIn)
forall era (l :: TxLevel).
BabbageEraTxBody era =>
Lens' (TxBody l era) (Set TxIn)
forall (l :: TxLevel). Lens' (TxBody l DijkstraEra) (Set TxIn)
referenceInputsTxBodyL
timeRange <-
Proxy DijkstraEra
-> EpochInfo (Either Text)
-> SystemStart
-> ValidityInterval
-> Either (ContextError DijkstraEra) POSIXTimeRange
forall era.
Inject (AlonzoContextError era) (ContextError era) =>
Proxy era
-> EpochInfo (Either Text)
-> SystemStart
-> ValidityInterval
-> Either (ContextError era) POSIXTimeRange
transValidityInterval Proxy DijkstraEra
era EpochInfo (Either Text)
ltiEpochInfo SystemStart
ltiSystemStart (TxBody level DijkstraEra
txBody TxBody level DijkstraEra
-> Getting
ValidityInterval (TxBody level DijkstraEra) ValidityInterval
-> ValidityInterval
forall s a. s -> Getting a s a -> a
^. Getting
ValidityInterval (TxBody level DijkstraEra) ValidityInterval
forall era (l :: TxLevel).
AllegraEraTxBody era =>
Lens' (TxBody l era) ValidityInterval
forall (l :: TxLevel).
Lens' (TxBody l DijkstraEra) ValidityInterval
vldtTxBodyL)
inputsInfo <- mapM (transTxInInfoV4 ltiUTxO) (Set.toList txInputs)
refInputsInfo <- mapM (transTxInInfoV4 ltiUTxO) (Set.toList refInputs)
Conway.checkReferenceInputsNotDisjointFromInputs txBody
let
accErrors Either (DijkstraContextError era) [TxOut]
acc (TxIx
ix, TxOut era
txOut) =
let res :: Either (ContextError era) TxOut
res = TxOutSource -> TxOut era -> Either (ContextError era) TxOut
forall era.
(BabbageEraTxOut era, Value era ~ MaryValue,
Inject (BabbageContextError era) (ContextError era),
Inject (DijkstraContextError era) (ContextError era)) =>
TxOutSource -> TxOut era -> Either (ContextError era) TxOut
transTxOutV4 (TxIx -> TxOutSource
TxOutFromOutput TxIx
ix) TxOut era
txOut
in case Either (DijkstraContextError era) [TxOut]
acc of
Right [TxOut]
l -> case Either (ContextError era) TxOut
res of
Right TxOut
x -> [TxOut] -> Either (DijkstraContextError era) [TxOut]
forall a b. b -> Either a b
Right ([TxOut] -> Either (DijkstraContextError era) [TxOut])
-> [TxOut] -> Either (DijkstraContextError era) [TxOut]
forall a b. (a -> b) -> a -> b
$ TxOut
x TxOut -> [TxOut] -> [TxOut]
forall a. a -> [a] -> [a]
: [TxOut]
l
Left ContextError era
e -> DijkstraContextError era
-> Either (DijkstraContextError era) [TxOut]
forall a b. a -> Either a b
Left ContextError era
DijkstraContextError era
e
Left (PointerPresentInOutput NonEmptySet TxOutSource
errs)
| Left (PointerPresentInOutput NonEmptySet TxOutSource
err) <- Either (ContextError era) TxOut
res ->
DijkstraContextError era
-> Either (DijkstraContextError era) [TxOut]
forall a b. a -> Either a b
Left (DijkstraContextError era
-> Either (DijkstraContextError era) [TxOut])
-> (NonEmptySet TxOutSource -> DijkstraContextError era)
-> NonEmptySet TxOutSource
-> Either (DijkstraContextError era) [TxOut]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. NonEmptySet TxOutSource -> DijkstraContextError era
forall era. NonEmptySet TxOutSource -> DijkstraContextError era
PointerPresentInOutput (NonEmptySet TxOutSource
-> Either (DijkstraContextError era) [TxOut])
-> NonEmptySet TxOutSource
-> Either (DijkstraContextError era) [TxOut]
forall a b. (a -> b) -> a -> b
$ NonEmptySet TxOutSource
err NonEmptySet TxOutSource
-> NonEmptySet TxOutSource -> NonEmptySet TxOutSource
forall a. Semigroup a => a -> a -> a
<> NonEmptySet TxOutSource
errs
Left DijkstraContextError era
e -> DijkstraContextError era
-> Either (DijkstraContextError era) [TxOut]
forall a b. a -> Either a b
Left DijkstraContextError era
e
outputs <-
reverse
<$>
foldl'
accErrors
(Right mempty)
([minBound ..] `zip` F.toList (txBody ^. outputsTxBodyL))
txCerts <- Alonzo.transTxBodyCerts proxy ltiProtVer txBody
plutusRedeemers <- Babbage.transTxRedeemers proxy lti
let
txInfo =
PV4.TxInfo
{ txInfoInputs :: [TxInInfo]
PV4.txInfoInputs = [TxInInfo]
inputsInfo
, txInfoOutputs :: [TxOut]
PV4.txInfoOutputs = [TxOut]
outputs
, txInfoReferenceInputs :: [TxInInfo]
PV4.txInfoReferenceInputs = [TxInInfo]
refInputsInfo
, txInfoMint :: MintValue
PV4.txInfoMint = MultiAsset -> MintValue
Conway.transMintValue (TxBody level DijkstraEra
txBody TxBody level DijkstraEra
-> Getting MultiAsset (TxBody level DijkstraEra) MultiAsset
-> MultiAsset
forall s a. s -> Getting a s a -> a
^. Getting MultiAsset (TxBody level DijkstraEra) MultiAsset
forall era (l :: TxLevel).
MaryEraTxBody era =>
Lens' (TxBody l era) MultiAsset
forall (l :: TxLevel). Lens' (TxBody l DijkstraEra) MultiAsset
mintTxBodyL)
, txInfoTxCerts :: [TxCert]
PV4.txInfoTxCerts = [TxCert]
txCerts
, txInfoValidRange :: POSIXTimeRange
PV4.txInfoValidRange = POSIXTimeRange
timeRange
, txInfoRedeemers :: Map ScriptPurpose Redeemer
PV4.txInfoRedeemers = Map ScriptPurpose Redeemer
plutusRedeemers
, txInfoData :: Map DatumHash Datum
PV4.txInfoData = [(DatumHash, Datum)] -> Map DatumHash Datum
forall k v. [(k, v)] -> Map k v
PV3.unsafeFromList ([(DatumHash, Datum)] -> Map DatumHash Datum)
-> [(DatumHash, Datum)] -> Map DatumHash Datum
forall a b. (a -> b) -> a -> b
$ TxWits DijkstraEra -> [(DatumHash, Datum)]
forall era.
AlonzoEraTxWits era =>
TxWits era -> [(DatumHash, Datum)]
Alonzo.transTxWitsDatums (Tx level DijkstraEra
ltiTx Tx level DijkstraEra
-> Getting
(TxWits DijkstraEra) (Tx level DijkstraEra) (TxWits DijkstraEra)
-> TxWits DijkstraEra
forall s a. s -> Getting a s a -> a
^. Getting
(TxWits DijkstraEra) (Tx level DijkstraEra) (TxWits DijkstraEra)
forall era (l :: TxLevel).
EraTx era =>
Lens' (Tx l era) (TxWits era)
forall (l :: TxLevel).
Lens' (Tx l DijkstraEra) (TxWits DijkstraEra)
witsTxL)
, txInfoId :: TxId
PV4.txInfoId = TxBody level DijkstraEra -> TxId
forall era (l :: TxLevel). EraTxBody era => TxBody l era -> TxId
Conway.transTxBodyId TxBody level DijkstraEra
txBody
, txInfoVotes :: Map Voter (Map GovernanceActionId Vote)
PV4.txInfoVotes = VotingProcedures DijkstraEra
-> Map Voter (Map GovernanceActionId Vote)
forall era.
VotingProcedures era -> Map Voter (Map GovernanceActionId Vote)
Conway.transVotingProcedures (TxBody level DijkstraEra
txBody TxBody level DijkstraEra
-> Getting
(VotingProcedures DijkstraEra)
(TxBody level DijkstraEra)
(VotingProcedures DijkstraEra)
-> VotingProcedures DijkstraEra
forall s a. s -> Getting a s a -> a
^. Getting
(VotingProcedures DijkstraEra)
(TxBody level DijkstraEra)
(VotingProcedures DijkstraEra)
forall era (l :: TxLevel).
ConwayEraTxBody era =>
Lens' (TxBody l era) (VotingProcedures era)
forall (l :: TxLevel).
Lens' (TxBody l DijkstraEra) (VotingProcedures DijkstraEra)
votingProceduresTxBodyL)
, txInfoProposalProcedures :: [ProposalProcedure]
PV4.txInfoProposalProcedures =
(ProposalProcedure DijkstraEra -> ProposalProcedure)
-> [ProposalProcedure DijkstraEra] -> [ProposalProcedure]
forall a b. (a -> b) -> [a] -> [b]
map (proxy 'PlutusV4
-> ProposalProcedure DijkstraEra -> ProposalProcedure
forall (l :: Language) era (proxy :: Language -> *).
ConwayEraPlutusTxInfo l era =>
proxy l -> ProposalProcedure era -> ProposalProcedure
Conway.transProposal proxy 'PlutusV4
proxy) ([ProposalProcedure DijkstraEra] -> [ProposalProcedure])
-> [ProposalProcedure DijkstraEra] -> [ProposalProcedure]
forall a b. (a -> b) -> a -> b
$ OSet (ProposalProcedure DijkstraEra)
-> [ProposalProcedure DijkstraEra]
forall a. OSet a -> [a]
forall (t :: * -> *) a. Foldable t => t a -> [a]
toList (TxBody level DijkstraEra
txBody TxBody level DijkstraEra
-> Getting
(OSet (ProposalProcedure DijkstraEra))
(TxBody level DijkstraEra)
(OSet (ProposalProcedure DijkstraEra))
-> OSet (ProposalProcedure DijkstraEra)
forall s a. s -> Getting a s a -> a
^. Getting
(OSet (ProposalProcedure DijkstraEra))
(TxBody level DijkstraEra)
(OSet (ProposalProcedure DijkstraEra))
forall era (l :: TxLevel).
ConwayEraTxBody era =>
Lens' (TxBody l era) (OSet (ProposalProcedure era))
forall (l :: TxLevel).
Lens' (TxBody l DijkstraEra) (OSet (ProposalProcedure DijkstraEra))
proposalProceduresTxBodyL)
, txInfoCurrentTreasuryAmount :: Maybe Lovelace
PV4.txInfoCurrentTreasuryAmount =
Maybe Lovelace
-> (Coin -> Maybe Lovelace) -> StrictMaybe Coin -> Maybe Lovelace
forall a b. a -> (b -> a) -> StrictMaybe b -> a
strictMaybe Maybe Lovelace
forall a. Maybe a
Nothing (Lovelace -> Maybe Lovelace
forall a. a -> Maybe a
Just (Lovelace -> Maybe Lovelace)
-> (Coin -> Lovelace) -> Coin -> Maybe Lovelace
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Coin -> Lovelace
transCoinToLovelace) (StrictMaybe Coin -> Maybe Lovelace)
-> StrictMaybe Coin -> Maybe Lovelace
forall a b. (a -> b) -> a -> b
$ TxBody level DijkstraEra
txBody TxBody level DijkstraEra
-> Getting
(StrictMaybe Coin) (TxBody level DijkstraEra) (StrictMaybe Coin)
-> StrictMaybe Coin
forall s a. s -> Getting a s a -> a
^. Getting
(StrictMaybe Coin) (TxBody level DijkstraEra) (StrictMaybe Coin)
forall era (l :: TxLevel).
ConwayEraTxBody era =>
Lens' (TxBody l era) (StrictMaybe Coin)
forall (l :: TxLevel).
Lens' (TxBody l DijkstraEra) (StrictMaybe Coin)
currentTreasuryValueTxBodyL
, txInfoTreasuryDonation :: Lovelace
PV4.txInfoTreasuryDonation = Coin -> Lovelace
transCoinToLovelace (Coin -> Lovelace) -> Coin -> Lovelace
forall a b. (a -> b) -> a -> b
$ TxBody level DijkstraEra
txBody TxBody level DijkstraEra
-> Getting Coin (TxBody level DijkstraEra) Coin -> Coin
forall s a. s -> Getting a s a -> a
^. Getting Coin (TxBody level DijkstraEra) Coin
forall era (l :: TxLevel).
ConwayEraTxBody era =>
Lens' (TxBody l era) Coin
forall (l :: TxLevel). Lens' (TxBody l DijkstraEra) Coin
treasuryDonationTxBodyL
, txInfoSubTxIx :: Maybe Integer
PV4.txInfoSubTxIx = Maybe Integer
forall a. Maybe a
Nothing
, txInfoWithdrawals :: Map Credential Lovelace
PV4.txInfoWithdrawals = TxBody level DijkstraEra -> Map Credential Lovelace
forall era (l :: TxLevel).
DijkstraEraTxBody era =>
TxBody l era -> Map Credential Lovelace
transTxBodyWithdrawals TxBody level DijkstraEra
txBody
, txInfoDirectDeposits :: Map Credential Lovelace
PV4.txInfoDirectDeposits = TxBody level DijkstraEra -> Map Credential Lovelace
forall era (l :: TxLevel).
DijkstraEraTxBody era =>
TxBody l era -> Map Credential Lovelace
transTxBodyDirectDeposits TxBody level DijkstraEra
txBody
, txInfoAccountBalanceIntervals :: AccountBalanceIntervals
PV4.txInfoAccountBalanceIntervals =
AccountBalanceIntervals DijkstraEra -> AccountBalanceIntervals
forall era. AccountBalanceIntervals era -> AccountBalanceIntervals
transAccountBalanceIntervals (AccountBalanceIntervals DijkstraEra -> AccountBalanceIntervals)
-> AccountBalanceIntervals DijkstraEra -> AccountBalanceIntervals
forall a b. (a -> b) -> a -> b
$ TxBody level DijkstraEra
txBody TxBody level DijkstraEra
-> Getting
(AccountBalanceIntervals DijkstraEra)
(TxBody level DijkstraEra)
(AccountBalanceIntervals DijkstraEra)
-> AccountBalanceIntervals DijkstraEra
forall s a. s -> Getting a s a -> a
^. Getting
(AccountBalanceIntervals DijkstraEra)
(TxBody level DijkstraEra)
(AccountBalanceIntervals DijkstraEra)
forall era (l :: TxLevel).
DijkstraEraTxBody era =>
Lens' (TxBody l era) (AccountBalanceIntervals era)
forall (l :: TxLevel).
Lens' (TxBody l DijkstraEra) (AccountBalanceIntervals DijkstraEra)
accountBalanceIntervalsTxBodyL
, txInfoGuards :: [Credential]
PV4.txInfoGuards = TxBody level DijkstraEra -> [Credential]
forall era (l :: TxLevel).
DijkstraEraTxBody era =>
TxBody l era -> [Credential]
transTxBodyGuards TxBody level DijkstraEra
txBody
, txInfoRequiredTopLevelGuards :: Map Credential (Maybe Datum)
PV4.txInfoRequiredTopLevelGuards = TxBody level DijkstraEra -> Map Credential (Maybe Datum)
forall era (l :: TxLevel).
DijkstraEraTxBody era =>
TxBody l era -> Map Credential (Maybe Datum)
transTxBodyRequiredTopLevelGuards TxBody level DijkstraEra
txBody
}
Right $ \DijkstraPlutusPurpose AsPurpose DijkstraEra
_ -> TxInfo -> Either (DijkstraContextError DijkstraEra) TxInfo
forall a b. b -> Either a b
Right TxInfo
txInfo
toPlutusArgs :: forall (proxy :: Language -> *).
proxy 'PlutusV4
-> LedgerTxInfo DijkstraEra
-> PlutusTxInfo 'PlutusV4
-> PlutusPurpose AsIxItem DijkstraEra
-> Data DijkstraEra
-> Either (ContextError DijkstraEra) (PlutusArgs 'PlutusV4)
toPlutusArgs = proxy 'PlutusV4
-> LedgerTxInfo DijkstraEra
-> PlutusTxInfo 'PlutusV4
-> PlutusPurpose AsIxItem DijkstraEra
-> Data DijkstraEra
-> Either (ContextError DijkstraEra) (PlutusArgs 'PlutusV4)
proxy 'PlutusV4
-> LedgerTxInfo DijkstraEra
-> TxInfo
-> PlutusPurpose AsIxItem DijkstraEra
-> Data DijkstraEra
-> Either (ContextError DijkstraEra) (PlutusArgs 'PlutusV4)
forall era (proxy :: Language -> *).
(AlonzoEraUTxO era, EraPlutusTxInfo 'PlutusV4 era,
Inject (DijkstraContextError era) (ContextError era)) =>
proxy 'PlutusV4
-> LedgerTxInfo era
-> TxInfo
-> PlutusPurpose AsIxItem era
-> Data era
-> Either (ContextError era) (PlutusArgs 'PlutusV4)
toPlutusV4Args
toPlutusTxInInfo :: forall (proxy :: Language -> *).
proxy 'PlutusV4
-> UTxO DijkstraEra
-> TxIn
-> Either
(ContextError DijkstraEra) (PlutusTxInInfo DijkstraEra 'PlutusV4)
toPlutusTxInInfo proxy 'PlutusV4
_ = UTxO DijkstraEra
-> TxIn
-> Either
(ContextError DijkstraEra) (PlutusTxInInfo DijkstraEra 'PlutusV4)
UTxO DijkstraEra
-> TxIn -> Either (ContextError DijkstraEra) TxInInfo
forall era.
(BabbageEraTxOut era, Value era ~ MaryValue,
Inject (BabbageContextError era) (ContextError era),
Inject (DijkstraContextError era) (ContextError era)) =>
UTxO era -> TxIn -> Either (ContextError era) TxInInfo
transTxInInfoV4
transTxInV4 :: TxIn -> PV4.TxOutRef
transTxInV4 :: TxIn -> TxOutRef
transTxInV4 (TxIn TxId
txid TxIx
txIx) = TxId -> Integer -> TxOutRef
PV4.TxOutRef (TxId -> TxId
transTxId TxId
txid) (Int -> Integer
forall a. Integral a => a -> Integer
toInteger (TxIx -> Int
txIxToInt TxIx
txIx))
transTxInInfoV4 ::
forall era.
( BabbageEraTxOut era
, Value era ~ MaryValue
, Inject (Babbage.BabbageContextError era) (ContextError era)
, Inject (DijkstraContextError era) (ContextError era)
) =>
UTxO era ->
TxIn ->
Either (ContextError era) PV4.TxInInfo
transTxInInfoV4 :: forall era.
(BabbageEraTxOut era, Value era ~ MaryValue,
Inject (BabbageContextError era) (ContextError era),
Inject (DijkstraContextError era) (ContextError era)) =>
UTxO era -> TxIn -> Either (ContextError era) TxInInfo
transTxInInfoV4 UTxO era
utxo TxIn
txIn = do
txOut <- (AlonzoContextError era -> ContextError era)
-> Either (AlonzoContextError era) (TxOut era)
-> Either (ContextError era) (TxOut era)
forall a b c. (a -> b) -> Either a c -> Either b c
forall (p :: * -> * -> *) a b c.
Bifunctor p =>
(a -> b) -> p a c -> p b c
first (BabbageContextError era -> ContextError era
forall t s. Inject t s => t -> s
inject (BabbageContextError era -> ContextError era)
-> (AlonzoContextError era -> BabbageContextError era)
-> AlonzoContextError era
-> ContextError era
forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall era. AlonzoContextError era -> BabbageContextError era
Babbage.AlonzoContextError @era) (Either (AlonzoContextError era) (TxOut era)
-> Either (ContextError era) (TxOut era))
-> Either (AlonzoContextError era) (TxOut era)
-> Either (ContextError era) (TxOut era)
forall a b. (a -> b) -> a -> b
$ UTxO era -> TxIn -> Either (AlonzoContextError era) (TxOut era)
forall era a.
Inject (AlonzoContextError era) a =>
UTxO era -> TxIn -> Either a (TxOut era)
Alonzo.transLookupTxOut UTxO era
utxo TxIn
txIn
plutusTxOut <- transTxOutV4 (TxOutFromInput txIn) txOut
Right (PV4.TxInInfo (transTxInV4 txIn) plutusTxOut)
transTxOutV4 ::
forall era.
( BabbageEraTxOut era
, Value era ~ MaryValue
, Inject (Babbage.BabbageContextError era) (ContextError era)
, Inject (DijkstraContextError era) (ContextError era)
) =>
TxOutSource ->
TxOut era ->
Either (ContextError era) PV4.TxOut
transTxOutV4 :: forall era.
(BabbageEraTxOut era, Value era ~ MaryValue,
Inject (BabbageContextError era) (ContextError era),
Inject (DijkstraContextError era) (ContextError era)) =>
TxOutSource -> TxOut era -> Either (ContextError era) TxOut
transTxOutV4 TxOutSource
txOutSource TxOut era
txOut = do
let
val :: Value
val = MaryValue -> Value
transValue (MaryValue -> Value) -> MaryValue -> Value
forall a b. (a -> b) -> a -> b
$ TxOut era
txOut TxOut era -> Getting MaryValue (TxOut era) MaryValue -> MaryValue
forall s a. s -> Getting a s a -> a
^. (Value era -> Const MaryValue (Value era))
-> TxOut era -> Const MaryValue (TxOut era)
Getting MaryValue (TxOut era) MaryValue
forall era. EraTxOut era => Lens' (TxOut era) (Value era)
Lens' (TxOut era) (Value era)
valueTxOutL
referenceScript :: Maybe ScriptHash
referenceScript = StrictMaybe (Script era) -> Maybe ScriptHash
forall era.
EraScript era =>
StrictMaybe (Script era) -> Maybe ScriptHash
Babbage.transReferenceScript (StrictMaybe (Script era) -> Maybe ScriptHash)
-> StrictMaybe (Script era) -> Maybe ScriptHash
forall a b. (a -> b) -> a -> b
$ TxOut era
txOut TxOut era
-> Getting
(StrictMaybe (Script era)) (TxOut era) (StrictMaybe (Script era))
-> StrictMaybe (Script era)
forall s a. s -> Getting a s a -> a
^. Getting
(StrictMaybe (Script era)) (TxOut era) (StrictMaybe (Script era))
forall era.
BabbageEraTxOut era =>
Lens' (TxOut era) (StrictMaybe (Script era))
Lens' (TxOut era) (StrictMaybe (Script era))
referenceScriptTxOutL
datum :: OutputDatum
datum =
case TxOut era
txOut TxOut era
-> Getting (Datum era) (TxOut era) (Datum era) -> Datum era
forall s a. s -> Getting a s a -> a
^. Getting (Datum era) (TxOut era) (Datum era)
forall era.
AlonzoEraTxOut era =>
SimpleGetter (TxOut era) (Datum era)
SimpleGetter (TxOut era) (Datum era)
datumTxOutF of
Datum era
NoDatum -> OutputDatum
PV2.NoOutputDatum
DatumHash DataHash
dh -> DatumHash -> OutputDatum
PV2.OutputDatumHash (DatumHash -> OutputDatum) -> DatumHash -> OutputDatum
forall a b. (a -> b) -> a -> b
$ DataHash -> DatumHash
transDataHash DataHash
dh
Datum BinaryData era
binaryData ->
Datum -> OutputDatum
PV2.OutputDatum
(Datum -> OutputDatum)
-> (BinaryData era -> Datum) -> BinaryData era -> OutputDatum
forall b c a. (b -> c) -> (a -> b) -> a -> c
. BuiltinData -> Datum
PV2.Datum
(BuiltinData -> Datum)
-> (BinaryData era -> BuiltinData) -> BinaryData era -> Datum
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Data -> BuiltinData
PV2.dataToBuiltinData
(Data -> BuiltinData)
-> (BinaryData era -> Data) -> BinaryData era -> BuiltinData
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Data era -> Data
forall era. Data era -> Data
getPlutusData
(Data era -> Data)
-> (BinaryData era -> Data era) -> BinaryData era -> Data
forall b c a. (b -> c) -> (a -> b) -> a -> c
. BinaryData era -> Data era
forall era. Era era => BinaryData era -> Data era
binaryDataToData
(BinaryData era -> OutputDatum) -> BinaryData era -> OutputDatum
forall a b. (a -> b) -> a -> b
$ BinaryData era
binaryData
addr <-
case TxOut era
txOut TxOut era -> Getting Addr (TxOut era) Addr -> Addr
forall s a. s -> Getting a s a -> a
^. Getting Addr (TxOut era) Addr
forall era. EraTxOut era => Lens' (TxOut era) Addr
Lens' (TxOut era) Addr
addrTxOutL of
Addr Network
_ Credential Payment
pCred StakeReference
stakeRef ->
Credential -> Maybe AccountId -> Address
PV4.Address (Credential Payment -> Credential
forall (kr :: KeyRole). Credential kr -> Credential
transCred Credential Payment
pCred) (Maybe AccountId -> Address)
-> Either (ContextError era) (Maybe AccountId)
-> Either (ContextError era) Address
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> case StakeReference
stakeRef of
StakeRefBase Credential Staking
sCred -> Maybe AccountId -> Either (ContextError era) (Maybe AccountId)
forall a b. b -> Either a b
Right (Maybe AccountId -> Either (ContextError era) (Maybe AccountId))
-> (AccountId -> Maybe AccountId)
-> AccountId
-> Either (ContextError era) (Maybe AccountId)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. AccountId -> Maybe AccountId
forall a. a -> Maybe a
Just (AccountId -> Either (ContextError era) (Maybe AccountId))
-> AccountId -> Either (ContextError era) (Maybe AccountId)
forall a b. (a -> b) -> a -> b
$ Credential Staking -> AccountId
forall (r :: KeyRole). Credential r -> AccountId
transCredToAccountId Credential Staking
sCred
StakeReference
StakeRefNull -> Maybe AccountId -> Either (ContextError era) (Maybe AccountId)
forall a b. b -> Either a b
Right Maybe AccountId
forall a. Maybe a
Nothing
StakeRefPtr Ptr
_ -> ContextError era -> Either (ContextError era) (Maybe AccountId)
forall a b. a -> Either a b
Left (ContextError era -> Either (ContextError era) (Maybe AccountId))
-> (NonEmptySet TxOutSource -> ContextError era)
-> NonEmptySet TxOutSource
-> Either (ContextError era) (Maybe AccountId)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. DijkstraContextError era -> ContextError era
forall t s. Inject t s => t -> s
inject (DijkstraContextError era -> ContextError era)
-> (NonEmptySet TxOutSource -> DijkstraContextError era)
-> NonEmptySet TxOutSource
-> ContextError era
forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall era. NonEmptySet TxOutSource -> DijkstraContextError era
PointerPresentInOutput @era (NonEmptySet TxOutSource
-> Either (ContextError era) (Maybe AccountId))
-> NonEmptySet TxOutSource
-> Either (ContextError era) (Maybe AccountId)
forall a b. (a -> b) -> a -> b
$ TxOutSource -> NonEmptySet TxOutSource
forall a. a -> NonEmptySet a
NES.singleton TxOutSource
txOutSource
AddrBootstrap BootstrapAddress
_ -> ContextError era -> Either (ContextError era) Address
forall a b. a -> Either a b
Left (ContextError era -> Either (ContextError era) Address)
-> (BabbageContextError era -> ContextError era)
-> BabbageContextError era
-> Either (ContextError era) Address
forall b c a. (b -> c) -> (a -> b) -> a -> c
. BabbageContextError era -> ContextError era
forall t s. Inject t s => t -> s
inject (BabbageContextError era -> Either (ContextError era) Address)
-> BabbageContextError era -> Either (ContextError era) Address
forall a b. (a -> b) -> a -> b
$ forall era. TxOutSource -> BabbageContextError era
Babbage.ByronTxOutInContext @era TxOutSource
txOutSource
pure $
PV4.TxOut
{ txOutReferenceScript = referenceScript
, txOutDatum = datum
, txOutValue = val
, txOutAddress = addr
}
transTxBodyWithdrawals ::
DijkstraEraTxBody era => TxBody l era -> PV4.Map PV4.Credential PV4.Lovelace
transTxBodyWithdrawals :: forall era (l :: TxLevel).
DijkstraEraTxBody era =>
TxBody l era -> Map Credential Lovelace
transTxBodyWithdrawals TxBody l era
txb = (AccountAddress -> Credential)
-> (Coin -> Lovelace)
-> Map AccountAddress Coin
-> Map Credential Lovelace
forall t1 k t2 v. (t1 -> k) -> (t2 -> v) -> Map t1 t2 -> Map k v
transMap AccountAddress -> Credential
transAccountAddressToCredential Coin -> Lovelace
transCoinToLovelace Map AccountAddress Coin
withdrawals
where
Withdrawals Map AccountAddress Coin
withdrawals = TxBody l era
txb TxBody l era
-> Getting Withdrawals (TxBody l era) Withdrawals -> Withdrawals
forall s a. s -> Getting a s a -> a
^. Getting Withdrawals (TxBody l era) Withdrawals
forall era (l :: TxLevel).
EraTxBody era =>
Lens' (TxBody l era) Withdrawals
forall (l :: TxLevel). Lens' (TxBody l era) Withdrawals
withdrawalsTxBodyL
transCredToAccountId :: Credential r -> PV4.AccountId
transCredToAccountId :: forall (r :: KeyRole). Credential r -> AccountId
transCredToAccountId = Credential -> AccountId
PV4.AccountId (Credential -> AccountId)
-> (Credential r -> Credential) -> Credential r -> AccountId
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Credential r -> Credential
forall (kr :: KeyRole). Credential kr -> Credential
transCred
transTxCertV4 :: ConwayEraTxCert era => TxCert era -> PV4.TxCert
transTxCertV4 :: forall era. ConwayEraTxCert era => TxCert era -> TxCert
transTxCertV4 = \case
RegPoolTxCert StakePoolParams {KeyHash StakePool
sppId :: forall era. StakePoolParams era -> KeyHash StakePool
sppId :: KeyHash StakePool
sppId, VRFVerKeyHash StakePoolVRF
sppVrf :: forall era. StakePoolParams era -> VRFVerKeyHash StakePoolVRF
sppVrf :: VRFVerKeyHash StakePoolVRF
sppVrf} ->
PubKeyHash -> PubKeyHash -> TxCert
PV4.TxCertPoolRegister
(KeyHash StakePool -> PubKeyHash
forall (d :: KeyRole). KeyHash d -> PubKeyHash
transKeyHash KeyHash StakePool
sppId)
(BuiltinByteString -> PubKeyHash
PV4.PubKeyHash (ByteString -> ToBuiltin ByteString
forall a. HasToBuiltin a => a -> ToBuiltin a
PV4.toBuiltin (Hash HASH KeyRoleVRF -> ByteString
forall h a. Hash h a -> ByteString
hashToBytes (VRFVerKeyHash StakePoolVRF -> Hash HASH KeyRoleVRF
forall (r :: KeyRoleVRF). VRFVerKeyHash r -> Hash HASH KeyRoleVRF
unVRFVerKeyHash VRFVerKeyHash StakePoolVRF
sppVrf))))
RetirePoolTxCert KeyHash StakePool
poolId EpochNo
retireEpochNo ->
PubKeyHash -> Integer -> TxCert
PV4.TxCertPoolRetire (KeyHash StakePool -> PubKeyHash
forall (d :: KeyRole). KeyHash d -> PubKeyHash
transKeyHash KeyHash StakePool
poolId) (EpochNo -> Integer
transEpochNo EpochNo
retireEpochNo)
RegDepositTxCert Credential Staking
stakeCred Coin
deposit ->
AccountId -> Lovelace -> TxCert
PV4.TxCertRegAccount (Credential Staking -> AccountId
forall (r :: KeyRole). Credential r -> AccountId
transCredToAccountId Credential Staking
stakeCred) (Coin -> Lovelace
transCoinToLovelace Coin
deposit)
UnRegDepositTxCert Credential Staking
stakeCred Coin
refund ->
AccountId -> Lovelace -> TxCert
PV4.TxCertUnRegAccount (Credential Staking -> AccountId
forall (r :: KeyRole). Credential r -> AccountId
transCredToAccountId Credential Staking
stakeCred) (Coin -> Lovelace
transCoinToLovelace Coin
refund)
DelegTxCert Credential Staking
stakeCred Delegatee
delegatee ->
AccountId -> Delegatee -> TxCert
PV4.TxCertDelegAccount (Credential Staking -> AccountId
forall (r :: KeyRole). Credential r -> AccountId
transCredToAccountId Credential Staking
stakeCred) (Delegatee -> Delegatee
transDelegatee Delegatee
delegatee)
RegDepositDelegTxCert Credential Staking
stakeCred Delegatee
delegatee Coin
deposit ->
AccountId -> Delegatee -> Lovelace -> TxCert
PV4.TxCertRegAccountDeleg
(Credential Staking -> AccountId
forall (r :: KeyRole). Credential r -> AccountId
transCredToAccountId Credential Staking
stakeCred)
(Delegatee -> Delegatee
transDelegatee Delegatee
delegatee)
(Coin -> Lovelace
transCoinToLovelace Coin
deposit)
AuthCommitteeHotKeyTxCert Credential ColdCommitteeRole
coldCred Credential HotCommitteeRole
hotCred ->
ColdCommitteeCredential -> HotCommitteeCredential -> TxCert
PV4.TxCertAuthHotCommittee (Credential ColdCommitteeRole -> ColdCommitteeCredential
transColdCommitteeCred Credential ColdCommitteeRole
coldCred) (Credential HotCommitteeRole -> HotCommitteeCredential
transHotCommitteeCred Credential HotCommitteeRole
hotCred)
ResignCommitteeColdTxCert Credential ColdCommitteeRole
coldCred StrictMaybe Anchor
_anchor ->
ColdCommitteeCredential -> TxCert
PV4.TxCertResignColdCommittee (Credential ColdCommitteeRole -> ColdCommitteeCredential
transColdCommitteeCred Credential ColdCommitteeRole
coldCred)
RegDRepTxCert Credential DRepRole
drepCred Coin
deposit StrictMaybe Anchor
_anchor ->
DRepCredential -> Lovelace -> TxCert
PV4.TxCertRegDRep (Credential DRepRole -> DRepCredential
transDRepCred Credential DRepRole
drepCred) (Coin -> Lovelace
transCoinToLovelace Coin
deposit)
UnRegDRepTxCert Credential DRepRole
drepCred Coin
refund ->
DRepCredential -> Lovelace -> TxCert
PV4.TxCertUnRegDRep (Credential DRepRole -> DRepCredential
transDRepCred Credential DRepRole
drepCred) (Coin -> Lovelace
transCoinToLovelace Coin
refund)
UpdateDRepTxCert Credential DRepRole
drepCred StrictMaybe Anchor
_anchor ->
DRepCredential -> TxCert
PV4.TxCertUpdateDRep (Credential DRepRole -> DRepCredential
transDRepCred Credential DRepRole
drepCred)
TxCert era
_ -> String -> TxCert
forall a. HasCallStack => String -> a
error String
"Impossible: All TxCerts should have been accounted for"
transTxBodyRequiredTopLevelGuards ::
DijkstraEraTxBody era => TxBody l era -> PV4.Map PV4.Credential (Maybe PV4.Datum)
transTxBodyRequiredTopLevelGuards :: forall era (l :: TxLevel).
DijkstraEraTxBody era =>
TxBody l era -> Map Credential (Maybe Datum)
transTxBodyRequiredTopLevelGuards TxBody l era
txb = (Credential Guard -> Credential)
-> (StrictMaybe (Data era) -> Maybe Datum)
-> Map (Credential Guard) (StrictMaybe (Data era))
-> Map Credential (Maybe Datum)
forall t1 k t2 v. (t1 -> k) -> (t2 -> v) -> Map t1 t2 -> Map k v
transMap Credential Guard -> Credential
forall (kr :: KeyRole). Credential kr -> Credential
transCred ((Data era -> Datum) -> Maybe (Data era) -> Maybe Datum
forall a b. (a -> b) -> Maybe a -> Maybe b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Data era -> Datum
forall era. Data era -> Datum
transDatum (Maybe (Data era) -> Maybe Datum)
-> (StrictMaybe (Data era) -> Maybe (Data era))
-> StrictMaybe (Data era)
-> Maybe Datum
forall b c a. (b -> c) -> (a -> b) -> a -> c
. StrictMaybe (Data era) -> Maybe (Data era)
forall a. StrictMaybe a -> Maybe a
strictMaybeToMaybe) Map (Credential Guard) (StrictMaybe (Data era))
requiredGuards
where
requiredGuards :: Map (Credential Guard) (StrictMaybe (Data era))
requiredGuards = TxBody l era
txb TxBody l era
-> Getting
(Map (Credential Guard) (StrictMaybe (Data era)))
(TxBody l era)
(Map (Credential Guard) (StrictMaybe (Data era)))
-> Map (Credential Guard) (StrictMaybe (Data era))
forall s a. s -> Getting a s a -> a
^. Getting
(Map (Credential Guard) (StrictMaybe (Data era)))
(TxBody l era)
(Map (Credential Guard) (StrictMaybe (Data era)))
forall era (l :: TxLevel).
DijkstraEraTxBody era =>
Lens'
(TxBody l era) (Map (Credential Guard) (StrictMaybe (Data era)))
forall (l :: TxLevel).
Lens'
(TxBody l era) (Map (Credential Guard) (StrictMaybe (Data era)))
requiredTopLevelGuardsL
transAccountAddressToAccountId :: AccountAddress -> PV4.AccountId
transAccountAddressToAccountId :: AccountAddress -> AccountId
transAccountAddressToAccountId (AccountAddress Network
_ (AccountId Credential Staking
c)) = Credential -> AccountId
PV4.AccountId (Credential -> AccountId) -> Credential -> AccountId
forall a b. (a -> b) -> a -> b
$ Credential Staking -> Credential
forall (kr :: KeyRole). Credential kr -> Credential
transCred Credential Staking
c
transAccountAddressToCredential :: AccountAddress -> PV4.Credential
transAccountAddressToCredential :: AccountAddress -> Credential
transAccountAddressToCredential (AccountAddress Network
_ (AccountId Credential Staking
c)) = Credential Staking -> Credential
forall (kr :: KeyRole). Credential kr -> Credential
transCred Credential Staking
c
transTxBodyDirectDeposits ::
DijkstraEraTxBody era => TxBody l era -> PV4.Map PV4.Credential PV4.Lovelace
transTxBodyDirectDeposits :: forall era (l :: TxLevel).
DijkstraEraTxBody era =>
TxBody l era -> Map Credential Lovelace
transTxBodyDirectDeposits TxBody l era
txb = (AccountAddress -> Credential)
-> (Coin -> Lovelace)
-> Map AccountAddress Coin
-> Map Credential Lovelace
forall t1 k t2 v. (t1 -> k) -> (t2 -> v) -> Map t1 t2 -> Map k v
transMap AccountAddress -> Credential
transAccountAddressToCredential Coin -> Lovelace
transCoinToLovelace Map AccountAddress Coin
deposits
where
DirectDeposits Map AccountAddress Coin
deposits = TxBody l era
txb TxBody l era
-> Getting DirectDeposits (TxBody l era) DirectDeposits
-> DirectDeposits
forall s a. s -> Getting a s a -> a
^. Getting DirectDeposits (TxBody l era) DirectDeposits
forall era (l :: TxLevel).
DijkstraEraTxBody era =>
Lens' (TxBody l era) DirectDeposits
forall (l :: TxLevel). Lens' (TxBody l era) DirectDeposits
directDepositsTxBodyL
transValidityInterval ::
Inject (Alonzo.AlonzoContextError era) (ContextError era) =>
Proxy era ->
EpochInfo (Either Text) ->
SystemStart ->
ValidityInterval ->
Either (ContextError era) PV4.POSIXTimeRange
transValidityInterval :: forall era.
Inject (AlonzoContextError era) (ContextError era) =>
Proxy era
-> EpochInfo (Either Text)
-> SystemStart
-> ValidityInterval
-> Either (ContextError era) POSIXTimeRange
transValidityInterval Proxy era
era EpochInfo (Either Text)
epochInfo SystemStart
systemStart (ValidityInterval StrictMaybe SlotNo
from StrictMaybe SlotNo
to) = do
let transSlot :: SlotNo -> Either (ContextError era) POSIXTime
transSlot = Proxy era
-> EpochInfo (Either Text)
-> SystemStart
-> SlotNo
-> Either (ContextError era) POSIXTime
forall era (proxy :: * -> *).
Inject (AlonzoContextError era) (ContextError era) =>
proxy era
-> EpochInfo (Either Text)
-> SystemStart
-> SlotNo
-> Either (ContextError era) POSIXTime
transSlotToPOSIXTime Proxy era
era EpochInfo (Either Text)
epochInfo SystemStart
systemStart
pFrom <- (SlotNo -> Either (ContextError era) POSIXTime)
-> StrictMaybe SlotNo
-> Either (ContextError era) (StrictMaybe POSIXTime)
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> StrictMaybe a -> f (StrictMaybe b)
traverse SlotNo -> Either (ContextError era) POSIXTime
transSlot StrictMaybe SlotNo
from
pTo <- traverse transSlot to
pure $ PV4.POSIXTimeRange (strictMaybeToMaybe pFrom) (strictMaybeToMaybe pTo)
transAccountBalanceInterval :: AccountBalanceInterval era -> PV4.AccountBalanceInterval
transAccountBalanceInterval :: forall era. AccountBalanceInterval era -> AccountBalanceInterval
transAccountBalanceInterval = \case
AccountBalanceExact Coin
c -> Lovelace -> AccountBalanceInterval
PV4.AccountBalanceExact (Lovelace -> AccountBalanceInterval)
-> Lovelace -> AccountBalanceInterval
forall a b. (a -> b) -> a -> b
$ Coin -> Lovelace
transCoinToLovelace Coin
c
AccountBalanceLowerBound (Inclusive Coin
l) -> Lovelace -> AccountBalanceInterval
PV4.AccountBalanceLowerBound (Lovelace -> AccountBalanceInterval)
-> Lovelace -> AccountBalanceInterval
forall a b. (a -> b) -> a -> b
$ Coin -> Lovelace
transCoinToLovelace Coin
l
AccountBalanceUpperBound (Exclusive Coin
u) -> Lovelace -> AccountBalanceInterval
PV4.AccountBalanceUpperBound (Lovelace -> AccountBalanceInterval)
-> Lovelace -> AccountBalanceInterval
forall a b. (a -> b) -> a -> b
$ Coin -> Lovelace
transCoinToLovelace Coin
u
AccountBalanceBothBounds (Inclusive Coin
l) (Exclusive Coin
u) -> Lovelace -> Lovelace -> AccountBalanceInterval
PV4.AccountBalanceBothBounds (Coin -> Lovelace
transCoinToLovelace Coin
l) (Coin -> Lovelace
transCoinToLovelace Coin
u)
transAccountBalanceIntervals :: AccountBalanceIntervals era -> PV4.AccountBalanceIntervals
transAccountBalanceIntervals :: forall era. AccountBalanceIntervals era -> AccountBalanceIntervals
transAccountBalanceIntervals (AccountBalanceIntervals Map AccountAddress (AccountBalanceInterval era)
balanceIntervals) =
Map AccountId AccountBalanceInterval -> AccountBalanceIntervals
PV4.AccountBalanceIntervals (Map AccountId AccountBalanceInterval -> AccountBalanceIntervals)
-> Map AccountId AccountBalanceInterval -> AccountBalanceIntervals
forall a b. (a -> b) -> a -> b
$
(AccountAddress -> AccountId)
-> (AccountBalanceInterval era -> AccountBalanceInterval)
-> Map AccountAddress (AccountBalanceInterval era)
-> Map AccountId AccountBalanceInterval
forall t1 k t2 v. (t1 -> k) -> (t2 -> v) -> Map t1 t2 -> Map k v
transMap AccountAddress -> AccountId
transAccountAddressToAccountId AccountBalanceInterval era -> AccountBalanceInterval
forall era. AccountBalanceInterval era -> AccountBalanceInterval
transAccountBalanceInterval Map AccountAddress (AccountBalanceInterval era)
balanceIntervals
transTxBodyGuards :: DijkstraEraTxBody era => TxBody l era -> [PV4.Credential]
transTxBodyGuards :: forall era (l :: TxLevel).
DijkstraEraTxBody era =>
TxBody l era -> [Credential]
transTxBodyGuards TxBody l era
txb = (Credential Guard -> Credential)
-> [Credential Guard] -> [Credential]
forall a b. (a -> b) -> [a] -> [b]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Credential Guard -> Credential
forall (kr :: KeyRole). Credential kr -> Credential
transCred ([Credential Guard] -> [Credential])
-> (OSet (Credential Guard) -> [Credential Guard])
-> OSet (Credential Guard)
-> [Credential]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. OSet (Credential Guard) -> [Credential Guard]
forall a. OSet a -> [a]
forall (t :: * -> *) a. Foldable t => t a -> [a]
F.toList (OSet (Credential Guard) -> [Credential])
-> OSet (Credential Guard) -> [Credential]
forall a b. (a -> b) -> a -> b
$ TxBody l era
txb TxBody l era
-> Getting
(OSet (Credential Guard)) (TxBody l era) (OSet (Credential Guard))
-> OSet (Credential Guard)
forall s a. s -> Getting a s a -> a
^. Getting
(OSet (Credential Guard)) (TxBody l era) (OSet (Credential Guard))
forall era (l :: TxLevel).
DijkstraEraTxBody era =>
Lens' (TxBody l era) (OSet (Credential Guard))
forall (l :: TxLevel).
Lens' (TxBody l era) (OSet (Credential Guard))
guardsTxBodyL
scriptPurposeToScriptInfo ::
PV4.ScriptPurpose ->
Maybe PV4.Datum ->
Maybe PV4.TopTxInfo ->
PV4.ScriptInfo
scriptPurposeToScriptInfo :: ScriptPurpose -> Maybe Datum -> Maybe TopTxInfo -> ScriptInfo
scriptPurposeToScriptInfo ScriptPurpose
sp Maybe Datum
datum Maybe TopTxInfo
topInfo = case ScriptPurpose
sp of
PV4.Spending ScriptHash
_ TxOutRef
ref -> TxOutRef -> Maybe Datum -> ScriptInfo
PV4.SpendingScript TxOutRef
ref Maybe Datum
datum
PV4.Minting ScriptHash
_ CurrencySymbol
sym -> CurrencySymbol -> ScriptInfo
PV4.MintingScript CurrencySymbol
sym
PV4.Withdrawing ScriptHash
_ Credential
c -> AccountId -> ScriptInfo
PV4.WithdrawingScript (AccountId -> ScriptInfo) -> AccountId -> ScriptInfo
forall a b. (a -> b) -> a -> b
$ Credential -> AccountId
PV4.AccountId Credential
c
PV4.Certifying ScriptHash
_ Integer
ix TxCert
cert -> Integer -> TxCert -> ScriptInfo
PV4.CertifyingScript Integer
ix TxCert
cert
PV4.Voting ScriptHash
_ Voter
v -> Voter -> ScriptInfo
PV4.VotingScript Voter
v
PV4.Proposing ScriptHash
_ Integer
ix ProposalProcedure
proc -> Integer -> ProposalProcedure -> ScriptInfo
PV4.ProposingScript Integer
ix ProposalProcedure
proc
PV4.Guarding ScriptHash
_ Integer
ix -> Integer -> Maybe TopTxInfo -> ScriptInfo
PV4.GuardingScript Integer
ix Maybe TopTxInfo
topInfo
toPlutusV4Args ::
( AlonzoEraUTxO era
, EraPlutusTxInfo PlutusV4 era
, Inject (DijkstraContextError era) (ContextError era)
) =>
proxy 'PlutusV4 ->
LedgerTxInfo era ->
PV4.TxInfo ->
PlutusPurpose AsIxItem era ->
Data era ->
Either (ContextError era) (PlutusArgs 'PlutusV4)
toPlutusV4Args :: forall era (proxy :: Language -> *).
(AlonzoEraUTxO era, EraPlutusTxInfo 'PlutusV4 era,
Inject (DijkstraContextError era) (ContextError era)) =>
proxy 'PlutusV4
-> LedgerTxInfo era
-> TxInfo
-> PlutusPurpose AsIxItem era
-> Data era
-> Either (ContextError era) (PlutusArgs 'PlutusV4)
toPlutusV4Args proxy 'PlutusV4
proxy lti :: LedgerTxInfo era
lti@LedgerTxInfo {[(PlutusPurpose AsIxItem era, SupportedPlutusRunnable era)]
Map (PlutusPurpose AsIx era) ScriptHash
Map TxId (TxInfoResult era)
Tx level era
UTxO era
EpochInfo (Either Text)
ProtVer
SystemStart
ltiProtVer :: forall era. LedgerTxInfo era -> ProtVer
ltiEpochInfo :: forall era. LedgerTxInfo era -> EpochInfo (Either Text)
ltiSystemStart :: forall era. LedgerTxInfo era -> SystemStart
ltiUTxO :: forall era. LedgerTxInfo era -> UTxO era
ltiTx :: ()
ltiMemoizedSubTransactions :: forall era. LedgerTxInfo era -> Map TxId (TxInfoResult era)
ltiScriptHashesUsed :: forall era.
LedgerTxInfo era -> Map (PlutusPurpose AsIx era) ScriptHash
ltiScriptsUsed :: forall era.
LedgerTxInfo era
-> [(PlutusPurpose AsIxItem era, SupportedPlutusRunnable era)]
ltiProtVer :: ProtVer
ltiEpochInfo :: EpochInfo (Either Text)
ltiSystemStart :: SystemStart
ltiUTxO :: UTxO era
ltiTx :: Tx level era
ltiScriptsUsed :: [(PlutusPurpose AsIxItem era, SupportedPlutusRunnable era)]
ltiScriptHashesUsed :: Map (PlutusPurpose AsIx era) ScriptHash
ltiMemoizedSubTransactions :: Map TxId (TxInfoResult era)
..} TxInfo
txInfo PlutusPurpose AsIxItem era
plutusPurpose Data era
redeemerData = do
scriptPurpose <- proxy 'PlutusV4
-> LedgerTxInfo era
-> PlutusPurpose AsIxItem era
-> Either (ContextError era) (PlutusScriptPurpose 'PlutusV4)
forall (l :: Language) era (proxy :: Language -> *).
EraPlutusTxInfo l era =>
proxy l
-> LedgerTxInfo era
-> PlutusPurpose AsIxItem era
-> Either (ContextError era) (PlutusScriptPurpose l)
forall (proxy :: Language -> *).
proxy 'PlutusV4
-> LedgerTxInfo era
-> PlutusPurpose AsIxItem era
-> Either (ContextError era) (PlutusScriptPurpose 'PlutusV4)
toPlutusScriptPurpose proxy 'PlutusV4
proxy LedgerTxInfo era
lti PlutusPurpose AsIxItem era
plutusPurpose
let
maybeSpendingData = UTxO era
-> Tx level era -> PlutusPurpose AsItem era -> Maybe (Data era)
forall era (l :: TxLevel).
AlonzoEraUTxO era =>
UTxO era
-> Tx l era -> PlutusPurpose AsItem era -> Maybe (Data era)
forall (l :: TxLevel).
UTxO era
-> Tx l era -> PlutusPurpose AsItem era -> Maybe (Data era)
getSpendingDatum UTxO era
ltiUTxO Tx level era
ltiTx (PlutusPurpose AsItem era -> Maybe (Data era))
-> PlutusPurpose AsItem era -> Maybe (Data era)
forall a b. (a -> b) -> a -> b
$ (forall ix it. AsIxItem ix it -> AsItem ix it)
-> PlutusPurpose AsIxItem era -> PlutusPurpose AsItem era
forall era (g :: * -> * -> *) (f :: * -> * -> *).
AlonzoEraScript era =>
(forall ix it. g ix it -> f ix it)
-> PlutusPurpose g era -> PlutusPurpose f era
forall (g :: * -> * -> *) (f :: * -> * -> *).
(forall ix it. g ix it -> f ix it)
-> PlutusPurpose g era -> PlutusPurpose f era
hoistPlutusPurpose AsIxItem ix it -> AsItem ix it
forall ix it. AsIxItem ix it -> AsItem ix it
toAsItem PlutusPurpose AsIxItem era
plutusPurpose
scriptInfo = ScriptPurpose -> Maybe Datum -> Maybe TopTxInfo -> ScriptInfo
scriptPurposeToScriptInfo ScriptPurpose
scriptPurpose (Data era -> Datum
forall era. Data era -> Datum
transDatum (Data era -> Datum) -> Maybe (Data era) -> Maybe Datum
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Maybe (Data era)
maybeSpendingData) Maybe TopTxInfo
forall a. Maybe a
Nothing
ixPurpose = (forall ix it. AsIxItem ix it -> AsIx ix it)
-> PlutusPurpose AsIxItem era -> PlutusPurpose AsIx era
forall era (g :: * -> * -> *) (f :: * -> * -> *).
AlonzoEraScript era =>
(forall ix it. g ix it -> f ix it)
-> PlutusPurpose g era -> PlutusPurpose f era
forall (g :: * -> * -> *) (f :: * -> * -> *).
(forall ix it. g ix it -> f ix it)
-> PlutusPurpose g era -> PlutusPurpose f era
hoistPlutusPurpose AsIxItem ix it -> AsIx ix it
forall ix it. AsIxItem ix it -> AsIx ix it
toAsIx PlutusPurpose AsIxItem era
plutusPurpose
sh <-
case Map.lookup ixPurpose ltiScriptHashesUsed of
Maybe ScriptHash
Nothing -> ContextError era -> Either (ContextError era) ScriptHash
forall a b. a -> Either a b
Left (ContextError era -> Either (ContextError era) ScriptHash)
-> ContextError era -> Either (ContextError era) ScriptHash
forall a b. (a -> b) -> a -> b
$ DijkstraContextError era -> ContextError era
forall t s. Inject t s => t -> s
inject (DijkstraContextError era -> ContextError era)
-> DijkstraContextError era -> ContextError era
forall a b. (a -> b) -> a -> b
$ PlutusPurpose AsIx era -> DijkstraContextError era
forall era. PlutusPurpose AsIx era -> DijkstraContextError era
ScriptHashNotFoundForPurpose PlutusPurpose AsIx era
ixPurpose
Just ScriptHash
scriptHash -> ScriptHash -> Either (ContextError era) ScriptHash
forall a b. b -> Either a b
Right (ScriptHash -> Either (ContextError era) ScriptHash)
-> ScriptHash -> Either (ContextError era) ScriptHash
forall a b. (a -> b) -> a -> b
$ ScriptHash -> ScriptHash
transScriptHash ScriptHash
scriptHash
pure $
PlutusV4Args $
PV4.ScriptContext
{ PV4.scriptContextTxInfo = txInfo
, PV4.scriptContextRedeemer = Babbage.transRedeemer redeemerData
, PV4.scriptContextScriptInfo = scriptInfo
, PV4.scriptContextScriptHash = sh
}
transTxId :: TxId -> PV4.TxId
transTxId :: TxId -> TxId
transTxId (TxId SafeHash EraIndependentTxBody
h) = BuiltinByteString -> TxId
PV4.TxId (BuiltinByteString -> TxId) -> BuiltinByteString -> TxId
forall a b. (a -> b) -> a -> b
$ SafeHash EraIndependentTxBody -> BuiltinByteString
forall i. SafeHash i -> BuiltinByteString
transSafeHash SafeHash EraIndependentTxBody
h
transPlutusPurposeV4 ::
forall era proxy.
( DijkstraEraScript era
, ConwayEraPlutusTxInfo PlutusV4 era
, Inject (ConwayContextError era) (ContextError era)
, Inject (DijkstraContextError era) (ContextError era)
) =>
proxy 'PlutusV4 ->
LedgerTxInfo era ->
PlutusPurpose AsIxItem era ->
Either (ContextError era) (PlutusScriptPurpose PlutusV4)
transPlutusPurposeV4 :: forall era (proxy :: Language -> *).
(DijkstraEraScript era, ConwayEraPlutusTxInfo 'PlutusV4 era,
Inject (ConwayContextError era) (ContextError era),
Inject (DijkstraContextError era) (ContextError era)) =>
proxy 'PlutusV4
-> LedgerTxInfo era
-> PlutusPurpose AsIxItem era
-> Either (ContextError era) (PlutusScriptPurpose 'PlutusV4)
transPlutusPurposeV4 proxy 'PlutusV4
proxy LedgerTxInfo era
lti PlutusPurpose AsIxItem era
plutusPurpose = do
let
pv :: ProtVer
pv = LedgerTxInfo era -> ProtVer
forall era. LedgerTxInfo era -> ProtVer
ltiProtVer LedgerTxInfo era
lti
ixPurpose :: PlutusPurpose AsIx era
ixPurpose = (forall ix it. AsIxItem ix it -> AsIx ix it)
-> PlutusPurpose AsIxItem era -> PlutusPurpose AsIx era
forall era (g :: * -> * -> *) (f :: * -> * -> *).
AlonzoEraScript era =>
(forall ix it. g ix it -> f ix it)
-> PlutusPurpose g era -> PlutusPurpose f era
forall (g :: * -> * -> *) (f :: * -> * -> *).
(forall ix it. g ix it -> f ix it)
-> PlutusPurpose g era -> PlutusPurpose f era
hoistPlutusPurpose AsIxItem ix it -> AsIx ix it
forall ix it. AsIxItem ix it -> AsIx ix it
toAsIx PlutusPurpose AsIxItem era
plutusPurpose
sh <-
case PlutusPurpose AsIx era
-> Map (PlutusPurpose AsIx era) ScriptHash -> Maybe ScriptHash
forall k a. Ord k => k -> Map k a -> Maybe a
Map.lookup PlutusPurpose AsIx era
ixPurpose (LedgerTxInfo era -> Map (PlutusPurpose AsIx era) ScriptHash
forall era.
LedgerTxInfo era -> Map (PlutusPurpose AsIx era) ScriptHash
ltiScriptHashesUsed LedgerTxInfo era
lti) of
Maybe ScriptHash
Nothing -> ContextError era -> Either (ContextError era) ScriptHash
forall a b. a -> Either a b
Left (ContextError era -> Either (ContextError era) ScriptHash)
-> ContextError era -> Either (ContextError era) ScriptHash
forall a b. (a -> b) -> a -> b
$ DijkstraContextError era -> ContextError era
forall t s. Inject t s => t -> s
inject (DijkstraContextError era -> ContextError era)
-> DijkstraContextError era -> ContextError era
forall a b. (a -> b) -> a -> b
$ forall era. PlutusPurpose AsIx era -> DijkstraContextError era
ScriptHashNotFoundForPurpose @era PlutusPurpose AsIx era
ixPurpose
Just ScriptHash
scriptHash -> ScriptHash -> Either (ContextError era) ScriptHash
forall a b. b -> Either a b
Right (ScriptHash -> Either (ContextError era) ScriptHash)
-> ScriptHash -> Either (ContextError era) ScriptHash
forall a b. (a -> b) -> a -> b
$ ScriptHash -> ScriptHash
transScriptHash ScriptHash
scriptHash
case plutusPurpose of
SpendingPurpose (AsIxItem Word32
_ (TxIn TxId
txId (TxIx Word16
ix))) ->
ScriptPurpose -> Either (ContextError era) ScriptPurpose
forall a. a -> Either (ContextError era) a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (ScriptPurpose -> Either (ContextError era) ScriptPurpose)
-> (TxOutRef -> ScriptPurpose)
-> TxOutRef
-> Either (ContextError era) ScriptPurpose
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ScriptHash -> TxOutRef -> ScriptPurpose
PV4.Spending ScriptHash
sh (TxOutRef -> Either (ContextError era) ScriptPurpose)
-> TxOutRef -> Either (ContextError era) ScriptPurpose
forall a b. (a -> b) -> a -> b
$ TxId -> Integer -> TxOutRef
PV4.TxOutRef (TxId -> TxId
transTxId TxId
txId) (Word16 -> Integer
forall a. Integral a => a -> Integer
toInteger Word16
ix)
MintingPurpose (AsIxItem Word32
_ PolicyID
pId) -> ScriptPurpose -> Either (ContextError era) ScriptPurpose
forall a. a -> Either (ContextError era) a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (ScriptPurpose -> Either (ContextError era) ScriptPurpose)
-> (CurrencySymbol -> ScriptPurpose)
-> CurrencySymbol
-> Either (ContextError era) ScriptPurpose
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ScriptHash -> CurrencySymbol -> ScriptPurpose
PV4.Minting ScriptHash
sh (CurrencySymbol -> Either (ContextError era) ScriptPurpose)
-> CurrencySymbol -> Either (ContextError era) ScriptPurpose
forall a b. (a -> b) -> a -> b
$ PolicyID -> CurrencySymbol
transPolicyID PolicyID
pId
CertifyingPurpose (AsIxItem Word32
ix TxCert era
cert) ->
ScriptHash -> Integer -> TxCert -> ScriptPurpose
PV4.Certifying ScriptHash
sh (Word32 -> Integer
forall a. Integral a => a -> Integer
toInteger Word32
ix) (TxCert -> ScriptPurpose)
-> Either (ContextError era) TxCert
-> Either (ContextError era) ScriptPurpose
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> proxy 'PlutusV4
-> ProtVer
-> TxCert era
-> Either (ContextError era) (PlutusTxCert 'PlutusV4)
forall (l :: Language) era (proxy :: Language -> *).
EraPlutusTxInfo l era =>
proxy l
-> ProtVer
-> TxCert era
-> Either (ContextError era) (PlutusTxCert l)
forall (proxy :: Language -> *).
proxy 'PlutusV4
-> ProtVer
-> TxCert era
-> Either (ContextError era) (PlutusTxCert 'PlutusV4)
toPlutusTxCert proxy 'PlutusV4
proxy ProtVer
pv TxCert era
cert
WithdrawingPurpose (AsIxItem Word32
_ (AccountAddress Network
_ (AccountId Credential Staking
c))) ->
ScriptPurpose -> Either (ContextError era) ScriptPurpose
forall a. a -> Either (ContextError era) a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (ScriptPurpose -> Either (ContextError era) ScriptPurpose)
-> ScriptPurpose -> Either (ContextError era) ScriptPurpose
forall a b. (a -> b) -> a -> b
$ ScriptHash -> Credential -> ScriptPurpose
PV4.Withdrawing ScriptHash
sh (Credential Staking -> Credential
forall (kr :: KeyRole). Credential kr -> Credential
transCred Credential Staking
c)
VotingPurpose (AsIxItem Word32
_ Voter
voter) -> ScriptPurpose -> Either (ContextError era) ScriptPurpose
forall a. a -> Either (ContextError era) a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (ScriptPurpose -> Either (ContextError era) ScriptPurpose)
-> ScriptPurpose -> Either (ContextError era) ScriptPurpose
forall a b. (a -> b) -> a -> b
$ ScriptHash -> Voter -> ScriptPurpose
PV4.Voting ScriptHash
sh (Voter -> Voter
transVoter Voter
voter)
ProposingPurpose (AsIxItem Word32
ix ProposalProcedure era
proc) ->
ScriptPurpose -> Either (ContextError era) ScriptPurpose
forall a. a -> Either (ContextError era) a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (ScriptPurpose -> Either (ContextError era) ScriptPurpose)
-> ScriptPurpose -> Either (ContextError era) ScriptPurpose
forall a b. (a -> b) -> a -> b
$ ScriptHash -> Integer -> ProposalProcedure -> ScriptPurpose
PV4.Proposing ScriptHash
sh (Word32 -> Integer
forall a. Integral a => a -> Integer
toInteger Word32
ix) (proxy 'PlutusV4 -> ProposalProcedure era -> ProposalProcedure
forall (l :: Language) era (proxy :: Language -> *).
ConwayEraPlutusTxInfo l era =>
proxy l -> ProposalProcedure era -> ProposalProcedure
transProposal proxy 'PlutusV4
proxy ProposalProcedure era
proc)
GuardingPurpose (AsIxItem Word32
ix ScriptHash
_) -> ScriptPurpose -> Either (ContextError era) ScriptPurpose
forall a. a -> Either (ContextError era) a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (ScriptPurpose -> Either (ContextError era) ScriptPurpose)
-> ScriptPurpose -> Either (ContextError era) ScriptPurpose
forall a b. (a -> b) -> a -> b
$ ScriptHash -> Integer -> ScriptPurpose
PV4.Guarding ScriptHash
sh (Word32 -> Integer
forall a. Integral a => a -> Integer
toInteger Word32
ix)
PlutusPurpose AsIxItem era
_ -> ContextError era -> Either (ContextError era) ScriptPurpose
forall a b. a -> Either a b
Left (ContextError era -> Either (ContextError era) ScriptPurpose)
-> ContextError era -> Either (ContextError era) ScriptPurpose
forall a b. (a -> b) -> a -> b
$ ConwayContextError era -> ContextError era
forall t s. Inject t s => t -> s
inject (ConwayContextError era -> ContextError era)
-> ConwayContextError era -> ContextError era
forall a b. (a -> b) -> a -> b
$ forall era. PlutusPurpose AsItem era -> ConwayContextError era
PlutusPurposeNotSupported @era (PlutusPurpose AsItem era -> ConwayContextError era)
-> PlutusPurpose AsItem era -> ConwayContextError era
forall a b. (a -> b) -> a -> b
$ (forall ix it. AsIxItem ix it -> AsItem ix it)
-> PlutusPurpose AsIxItem era -> PlutusPurpose AsItem era
forall era (g :: * -> * -> *) (f :: * -> * -> *).
AlonzoEraScript era =>
(forall ix it. g ix it -> f ix it)
-> PlutusPurpose g era -> PlutusPurpose f era
forall (g :: * -> * -> *) (f :: * -> * -> *).
(forall ix it. g ix it -> f ix it)
-> PlutusPurpose g era -> PlutusPurpose f era
hoistPlutusPurpose AsIxItem ix it -> AsItem ix it
forall ix it. AsIxItem ix it -> AsItem ix it
toAsItem PlutusPurpose AsIxItem era
plutusPurpose