{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE UndecidableInstances #-}
{-# OPTIONS_GHC -Wno-orphans #-}
module Cardano.Ledger.Dijkstra.TxInfo (
DijkstraContextError (..),
guardDijkstraFeaturesForPlutusV1toV3,
transFailUnsupportedScriptInSubTx,
) where
import Cardano.Crypto.Hash.Class (hashToBytes)
import Cardano.Ledger.Alonzo.Plutus.Context (
EraPlutusContext (..),
EraPlutusTxInfo (..),
LedgerTxInfo (..),
PlutusTxInfo,
PlutusTxInfoResult (..),
SupportedLanguage (..),
)
import qualified Cardano.Ledger.Alonzo.Plutus.TxInfo as Alonzo
import Cardano.Ledger.Alonzo.Scripts (AsPurpose (..))
import qualified Cardano.Ledger.Babbage.TxInfo as Babbage
import Cardano.Ledger.BaseTypes (Inject (..), ProtVer (..), kindObject, strictMaybe)
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 (..),
transTxInInfoV1,
transTxInInfoV3,
)
import qualified Cardano.Ledger.Conway.TxInfo as Conway
import Cardano.Ledger.Credential (StakeReference (..))
import Cardano.Ledger.Dijkstra.Core
import Cardano.Ledger.Dijkstra.Era (DijkstraEra)
import Cardano.Ledger.Dijkstra.Scripts (
AccountBalanceIntervals (..),
PlutusScript (..),
pattern GuardingPurpose,
)
import Cardano.Ledger.Dijkstra.TxCert (DijkstraTxCert)
import Cardano.Ledger.Dijkstra.UTxO ()
import Cardano.Ledger.Plutus (
Language (..),
PlutusArgs (..),
PlutusLanguage,
SLanguage (..),
TxOutSource (..),
plutusLanguage,
plutusSLanguage,
transCoinToLovelace,
transCoinToValue,
transCred,
transDatum,
transEpochNo,
transKeyHash,
)
import Cardano.Ledger.Plutus.Data (Data)
import Cardano.Ledger.Plutus.ToPlutusData (ToPlutusData (..))
import Cardano.Ledger.State (StakePoolParams (..))
import Cardano.Ledger.TxIn (TxId)
import Control.Arrow (left)
import Control.DeepSeq (NFData)
import Control.Monad (forM, forM_, unless, zipWithM)
import Data.Aeson (KeyValue (..), ToJSON (..))
import Data.Foldable (Foldable (..))
import qualified Data.Foldable as F
import Data.List.NonEmpty (NonEmpty (..))
import qualified Data.List.NonEmpty as NE
import qualified Data.Map.Strict as Map
import qualified Data.OMap.Strict as OMap
import Data.Proxy (Proxy (..))
import qualified Data.Set as Set
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
data DijkstraContextError era
= ConwayContextError (ConwayContextError era)
|
SubTxContextError TxId (ContextError era)
| PointerPresentInOutput (NonEmpty (TxOut era))
|
UnsupportedScriptInSubTx Language TxId
|
DirectDepositsNotSupported DirectDeposits
|
AccountBalanceIntervalsNotSupported (AccountBalanceIntervals era)
|
SubTxsAreNotSupported (NonEmpty TxId)
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
, 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
kindObject
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 NonEmpty (TxOut era)
x -> Text -> [Pair] -> Value
kindObject 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
.= NonEmpty (TxOut era) -> Value
forall a. ToJSON a => a -> Value
toJSON NonEmpty (TxOut era)
x]
UnsupportedScriptInSubTx Language
lang TxId
txId ->
Text -> [Pair] -> Value
kindObject
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
kindObject 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
kindObject 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]
SubTxsAreNotSupported NonEmpty TxId
txIds ->
Text -> [Pair] -> Value
kindObject Text
"SubTxsAreNotSupported" [Key
"txIds" Key -> Value -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= NonEmpty TxId -> Value
forall a. ToJSON a => a -> Value
toJSON NonEmpty TxId
txIds]
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 1)) (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 1)) (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 3)) 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 3)) TxId
forall t (w :: Wrapped). DecCBOR t => Decode w t
From Decode Open (ContextError era -> DijkstraContextError era)
-> Decode (Closed (ZonkAny 2)) (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 2)) (ContextError era)
forall t (w :: Wrapped). DecCBOR t => Decode w t
From
Word
18 -> (NonEmpty (TxOut era) -> DijkstraContextError era)
-> Decode Open (NonEmpty (TxOut era) -> DijkstraContextError era)
forall t. t -> Decode Open t
SumD NonEmpty (TxOut era) -> DijkstraContextError era
forall era. NonEmpty (TxOut era) -> DijkstraContextError era
PointerPresentInOutput Decode Open (NonEmpty (TxOut era) -> DijkstraContextError era)
-> Decode (Closed (ZonkAny 4)) (NonEmpty (TxOut 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 4)) (NonEmpty (TxOut era))
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 6)) 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 6)) Language
forall t (w :: Wrapped). DecCBOR t => Decode w t
From Decode Open (TxId -> DijkstraContextError era)
-> Decode (Closed (ZonkAny 5)) 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 5)) 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 7)) 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 7)) 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 8)) (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 8)) (AccountBalanceIntervals era)
forall t (w :: Wrapped). DecCBOR t => Decode w t
From
Word
22 -> (NonEmpty TxId -> DijkstraContextError era)
-> Decode Open (NonEmpty TxId -> DijkstraContextError era)
forall t. t -> Decode Open t
SumD NonEmpty TxId -> DijkstraContextError era
forall era. NonEmpty TxId -> DijkstraContextError era
SubTxsAreNotSupported Decode Open (NonEmpty TxId -> DijkstraContextError era)
-> Decode (Closed (ZonkAny 9)) (NonEmpty 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 9)) (NonEmpty TxId)
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 (TxOut 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 NonEmpty (TxOut era)
x -> (NonEmpty (TxOut era) -> DijkstraContextError era)
-> Word
-> Encode Open (NonEmpty (TxOut era) -> DijkstraContextError era)
forall t. t -> Word -> Encode Open t
Sum NonEmpty (TxOut era) -> DijkstraContextError era
forall era. NonEmpty (TxOut era) -> DijkstraContextError era
PointerPresentInOutput Word
18 Encode Open (NonEmpty (TxOut era) -> DijkstraContextError era)
-> Encode (Closed Dense) (NonEmpty (TxOut era))
-> Encode Open (DijkstraContextError era)
forall (w :: Wrapped) a t (r :: Density).
Encode w (a -> t) -> Encode (Closed r) a -> Encode w t
!> NonEmpty (TxOut era)
-> Encode (Closed Dense) (NonEmpty (TxOut era))
forall t. EncCBOR t => t -> Encode (Closed Dense) t
To NonEmpty (TxOut era)
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
SubTxsAreNotSupported NonEmpty TxId
txIds -> (NonEmpty TxId -> DijkstraContextError era)
-> Word -> Encode Open (NonEmpty TxId -> DijkstraContextError era)
forall t. t -> Word -> Encode Open t
Sum NonEmpty TxId -> DijkstraContextError era
forall era. NonEmpty TxId -> DijkstraContextError era
SubTxsAreNotSupported Word
22 Encode Open (NonEmpty TxId -> DijkstraContextError era)
-> Encode (Closed Dense) (NonEmpty TxId)
-> Encode Open (DijkstraContextError era)
forall (w :: Wrapped) a t (r :: Density).
Encode w (a -> t) -> Encode (Closed r) a -> Encode w t
!> NonEmpty TxId -> Encode (Closed Dense) (NonEmpty TxId)
forall t. EncCBOR t => t -> Encode (Closed Dense) t
To NonEmpty TxId
txIds
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
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
mkPlutusWithContext :: PlutusScript DijkstraEra
-> ScriptHash
-> PlutusPurpose AsIxItem DijkstraEra
-> LedgerTxInfo DijkstraEra
-> TxInfoResult DijkstraEra
-> (Data DijkstraEra, ExUnits)
-> CostModel
-> Either (ContextError DijkstraEra) PlutusWithContext
mkPlutusWithContext = \case
DijkstraPlutusV1 Plutus 'PlutusV1
p -> Either (Plutus 'PlutusV1) (PlutusRunnable 'PlutusV1)
-> ScriptHash
-> PlutusPurpose AsIxItem DijkstraEra
-> LedgerTxInfo DijkstraEra
-> TxInfoResult DijkstraEra
-> (Data DijkstraEra, ExUnits)
-> CostModel
-> Either (ContextError DijkstraEra) PlutusWithContext
forall (l :: Language) era.
(EraPlutusTxInfo l era, AlonzoEraUTxO era) =>
Either (Plutus l) (PlutusRunnable l)
-> ScriptHash
-> PlutusPurpose AsIxItem era
-> LedgerTxInfo era
-> TxInfoResult era
-> (Data era, ExUnits)
-> CostModel
-> Either (ContextError era) PlutusWithContext
Alonzo.toPlutusWithContext (Either (Plutus 'PlutusV1) (PlutusRunnable 'PlutusV1)
-> ScriptHash
-> PlutusPurpose AsIxItem DijkstraEra
-> LedgerTxInfo DijkstraEra
-> TxInfoResult DijkstraEra
-> (Data DijkstraEra, ExUnits)
-> CostModel
-> Either (ContextError DijkstraEra) PlutusWithContext)
-> Either (Plutus 'PlutusV1) (PlutusRunnable 'PlutusV1)
-> ScriptHash
-> PlutusPurpose AsIxItem DijkstraEra
-> LedgerTxInfo DijkstraEra
-> TxInfoResult DijkstraEra
-> (Data DijkstraEra, ExUnits)
-> CostModel
-> Either (ContextError DijkstraEra) PlutusWithContext
forall a b. (a -> b) -> a -> b
$ Plutus 'PlutusV1
-> Either (Plutus 'PlutusV1) (PlutusRunnable 'PlutusV1)
forall a b. a -> Either a b
Left Plutus 'PlutusV1
p
DijkstraPlutusV2 Plutus 'PlutusV2
p -> Either (Plutus 'PlutusV2) (PlutusRunnable 'PlutusV2)
-> ScriptHash
-> PlutusPurpose AsIxItem DijkstraEra
-> LedgerTxInfo DijkstraEra
-> TxInfoResult DijkstraEra
-> (Data DijkstraEra, ExUnits)
-> CostModel
-> Either (ContextError DijkstraEra) PlutusWithContext
forall (l :: Language) era.
(EraPlutusTxInfo l era, AlonzoEraUTxO era) =>
Either (Plutus l) (PlutusRunnable l)
-> ScriptHash
-> PlutusPurpose AsIxItem era
-> LedgerTxInfo era
-> TxInfoResult era
-> (Data era, ExUnits)
-> CostModel
-> Either (ContextError era) PlutusWithContext
Alonzo.toPlutusWithContext (Either (Plutus 'PlutusV2) (PlutusRunnable 'PlutusV2)
-> ScriptHash
-> PlutusPurpose AsIxItem DijkstraEra
-> LedgerTxInfo DijkstraEra
-> TxInfoResult DijkstraEra
-> (Data DijkstraEra, ExUnits)
-> CostModel
-> Either (ContextError DijkstraEra) PlutusWithContext)
-> Either (Plutus 'PlutusV2) (PlutusRunnable 'PlutusV2)
-> ScriptHash
-> PlutusPurpose AsIxItem DijkstraEra
-> LedgerTxInfo DijkstraEra
-> TxInfoResult DijkstraEra
-> (Data DijkstraEra, ExUnits)
-> CostModel
-> Either (ContextError DijkstraEra) PlutusWithContext
forall a b. (a -> b) -> a -> b
$ Plutus 'PlutusV2
-> Either (Plutus 'PlutusV2) (PlutusRunnable 'PlutusV2)
forall a b. a -> Either a b
Left Plutus 'PlutusV2
p
DijkstraPlutusV3 Plutus 'PlutusV3
p -> Either (Plutus 'PlutusV3) (PlutusRunnable 'PlutusV3)
-> ScriptHash
-> PlutusPurpose AsIxItem DijkstraEra
-> LedgerTxInfo DijkstraEra
-> TxInfoResult DijkstraEra
-> (Data DijkstraEra, ExUnits)
-> CostModel
-> Either (ContextError DijkstraEra) PlutusWithContext
forall (l :: Language) era.
(EraPlutusTxInfo l era, AlonzoEraUTxO era) =>
Either (Plutus l) (PlutusRunnable l)
-> ScriptHash
-> PlutusPurpose AsIxItem era
-> LedgerTxInfo era
-> TxInfoResult era
-> (Data era, ExUnits)
-> CostModel
-> Either (ContextError era) PlutusWithContext
Alonzo.toPlutusWithContext (Either (Plutus 'PlutusV3) (PlutusRunnable 'PlutusV3)
-> ScriptHash
-> PlutusPurpose AsIxItem DijkstraEra
-> LedgerTxInfo DijkstraEra
-> TxInfoResult DijkstraEra
-> (Data DijkstraEra, ExUnits)
-> CostModel
-> Either (ContextError DijkstraEra) PlutusWithContext)
-> Either (Plutus 'PlutusV3) (PlutusRunnable 'PlutusV3)
-> ScriptHash
-> PlutusPurpose AsIxItem DijkstraEra
-> LedgerTxInfo DijkstraEra
-> TxInfoResult DijkstraEra
-> (Data DijkstraEra, ExUnits)
-> CostModel
-> Either (ContextError DijkstraEra) PlutusWithContext
forall a b. (a -> b) -> a -> b
$ Plutus 'PlutusV3
-> Either (Plutus 'PlutusV3) (PlutusRunnable 'PlutusV3)
forall a b. a -> Either a b
Left Plutus 'PlutusV3
p
DijkstraPlutusV4 Plutus 'PlutusV4
p -> Either (Plutus 'PlutusV4) (PlutusRunnable 'PlutusV4)
-> ScriptHash
-> PlutusPurpose AsIxItem DijkstraEra
-> LedgerTxInfo DijkstraEra
-> TxInfoResult DijkstraEra
-> (Data DijkstraEra, ExUnits)
-> CostModel
-> Either (ContextError DijkstraEra) PlutusWithContext
forall (l :: Language) era.
(EraPlutusTxInfo l era, AlonzoEraUTxO era) =>
Either (Plutus l) (PlutusRunnable l)
-> ScriptHash
-> PlutusPurpose AsIxItem era
-> LedgerTxInfo era
-> TxInfoResult era
-> (Data era, ExUnits)
-> CostModel
-> Either (ContextError era) PlutusWithContext
Alonzo.toPlutusWithContext (Either (Plutus 'PlutusV4) (PlutusRunnable 'PlutusV4)
-> ScriptHash
-> PlutusPurpose AsIxItem DijkstraEra
-> LedgerTxInfo DijkstraEra
-> TxInfoResult DijkstraEra
-> (Data DijkstraEra, ExUnits)
-> CostModel
-> Either (ContextError DijkstraEra) PlutusWithContext)
-> Either (Plutus 'PlutusV4) (PlutusRunnable 'PlutusV4)
-> ScriptHash
-> PlutusPurpose AsIxItem DijkstraEra
-> LedgerTxInfo DijkstraEra
-> TxInfoResult DijkstraEra
-> (Data DijkstraEra, ExUnits)
-> CostModel
-> Either (ContextError DijkstraEra) PlutusWithContext
forall a b. (a -> b) -> a -> b
$ Plutus 'PlutusV4
-> Either (Plutus 'PlutusV4) (PlutusRunnable 'PlutusV4)
forall a b. a -> Either a b
Left Plutus 'PlutusV4
p
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
-> ProtVer
-> PlutusPurpose AsIxItem DijkstraEra
-> Either
(ContextError DijkstraEra) (PlutusScriptPurpose 'PlutusV1)
toPlutusScriptPurpose = proxy 'PlutusV1
-> ProtVer
-> PlutusPurpose AsIxItem DijkstraEra
-> Either
(ContextError DijkstraEra) (PlutusScriptPurpose 'PlutusV1)
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
toPlutusTxInfo :: forall (proxy :: Language -> *).
proxy 'PlutusV1
-> LedgerTxInfo DijkstraEra
-> PlutusTxInfoResult 'PlutusV1 DijkstraEra
toPlutusTxInfo proxy 'PlutusV1
proxy LedgerTxInfo {ProtVer
ltiProtVer :: ProtVer
ltiProtVer :: forall era. LedgerTxInfo era -> 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 (DijkstraContextError DijkstraEra) POSIXTimeRange
forall (proxy :: * -> *) era a.
Inject (AlonzoContextError era) a =>
proxy era
-> EpochInfo (Either Text)
-> SystemStart
-> ValidityInterval
-> Either a 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
-> ProtVer
-> PlutusTxInfo 'PlutusV1
-> PlutusPurpose AsIxItem DijkstraEra
-> Maybe (Data DijkstraEra)
-> Data DijkstraEra
-> Either (ContextError DijkstraEra) (PlutusArgs 'PlutusV1)
toPlutusArgs = proxy 'PlutusV1
-> ProtVer
-> PlutusTxInfo 'PlutusV1
-> PlutusPurpose AsIxItem DijkstraEra
-> Maybe (Data DijkstraEra)
-> Data DijkstraEra
-> Either (ContextError DijkstraEra) (PlutusArgs 'PlutusV1)
proxy 'PlutusV1
-> ProtVer
-> TxInfo
-> PlutusPurpose AsIxItem DijkstraEra
-> Maybe (Data DijkstraEra)
-> Data DijkstraEra
-> Either (ContextError DijkstraEra) (PlutusArgs 'PlutusV1)
forall era (proxy :: Language -> *).
EraPlutusTxInfo 'PlutusV1 era =>
proxy 'PlutusV1
-> ProtVer
-> TxInfo
-> PlutusPurpose AsIxItem era
-> Maybe (Data 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 :: StakePoolParams -> KeyHash StakePool
sppId, VRFVerKeyHash StakePoolVRF
sppVrf :: VRFVerKeyHash StakePoolVRF
sppVrf :: StakePoolParams -> 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
-> ProtVer
-> PlutusPurpose AsIxItem DijkstraEra
-> Either
(ContextError DijkstraEra) (PlutusScriptPurpose 'PlutusV2)
toPlutusScriptPurpose = proxy 'PlutusV2
-> ProtVer
-> PlutusPurpose AsIxItem DijkstraEra
-> Either
(ContextError DijkstraEra) (PlutusScriptPurpose 'PlutusV2)
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
toPlutusTxInfo :: forall (proxy :: Language -> *).
proxy 'PlutusV2
-> LedgerTxInfo DijkstraEra
-> PlutusTxInfoResult 'PlutusV2 DijkstraEra
toPlutusTxInfo proxy 'PlutusV2
proxy 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 (DijkstraContextError DijkstraEra) POSIXTimeRange
forall (proxy :: * -> *) era a.
Inject (AlonzoContextError era) a =>
proxy era
-> EpochInfo (Either Text)
-> SystemStart
-> ValidityInterval
-> Either a 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 ltiProtVer tx
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
-> ProtVer
-> PlutusTxInfo 'PlutusV2
-> PlutusPurpose AsIxItem DijkstraEra
-> Maybe (Data DijkstraEra)
-> Data DijkstraEra
-> Either (ContextError DijkstraEra) (PlutusArgs 'PlutusV2)
toPlutusArgs = proxy 'PlutusV2
-> ProtVer
-> PlutusTxInfo 'PlutusV2
-> PlutusPurpose AsIxItem DijkstraEra
-> Maybe (Data DijkstraEra)
-> Data DijkstraEra
-> Either (ContextError DijkstraEra) (PlutusArgs 'PlutusV2)
proxy 'PlutusV2
-> ProtVer
-> TxInfo
-> PlutusPurpose AsIxItem DijkstraEra
-> Maybe (Data DijkstraEra)
-> Data DijkstraEra
-> Either (ContextError DijkstraEra) (PlutusArgs 'PlutusV2)
forall era (proxy :: Language -> *).
EraPlutusTxInfo 'PlutusV2 era =>
proxy 'PlutusV2
-> ProtVer
-> TxInfo
-> PlutusPurpose AsIxItem era
-> Maybe (Data 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
transTxCert
toPlutusScriptPurpose :: forall (proxy :: Language -> *).
proxy 'PlutusV3
-> ProtVer
-> PlutusPurpose AsIxItem DijkstraEra
-> Either
(ContextError DijkstraEra) (PlutusScriptPurpose 'PlutusV3)
toPlutusScriptPurpose = proxy 'PlutusV3
-> ProtVer
-> PlutusPurpose AsIxItem DijkstraEra
-> Either
(ContextError DijkstraEra) (PlutusScriptPurpose 'PlutusV3)
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
toPlutusTxInfo :: forall (proxy :: Language -> *).
proxy 'PlutusV3
-> LedgerTxInfo DijkstraEra
-> PlutusTxInfoResult 'PlutusV3 DijkstraEra
toPlutusTxInfo proxy 'PlutusV3
proxy 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 (DijkstraContextError DijkstraEra) POSIXTimeRange
forall (proxy :: * -> *) era a.
Inject (AlonzoContextError era) a =>
proxy era
-> EpochInfo (Either Text)
-> SystemStart
-> ValidityInterval
-> Either a 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 ltiProtVer tx
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
-> ProtVer
-> PlutusTxInfo 'PlutusV3
-> PlutusPurpose AsIxItem DijkstraEra
-> Maybe (Data DijkstraEra)
-> Data DijkstraEra
-> Either (ContextError DijkstraEra) (PlutusArgs 'PlutusV3)
toPlutusArgs = proxy 'PlutusV3
-> ProtVer
-> PlutusTxInfo 'PlutusV3
-> PlutusPurpose AsIxItem DijkstraEra
-> Maybe (Data DijkstraEra)
-> Data DijkstraEra
-> Either (ContextError DijkstraEra) (PlutusArgs 'PlutusV3)
proxy 'PlutusV3
-> ProtVer
-> TxInfo
-> PlutusPurpose AsIxItem DijkstraEra
-> Maybe (Data DijkstraEra)
-> Data DijkstraEra
-> Either (ContextError DijkstraEra) (PlutusArgs 'PlutusV3)
forall era (proxy :: Language -> *).
EraPlutusTxInfo 'PlutusV3 era =>
proxy 'PlutusV3
-> ProtVer
-> TxInfo
-> PlutusPurpose AsIxItem era
-> Maybe (Data 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
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 (DirectDeposits -> DijkstraContextError era
forall era. DirectDeposits -> DijkstraContextError era
DirectDepositsNotSupported DirectDeposits
directDeposits :: DijkstraContextError era)
let 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
Bool
-> Either (ContextError era) () -> Either (ContextError era) ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (Map AccountId (AccountBalanceInterval era) -> Bool
forall a. Map AccountId a -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null (Map AccountId (AccountBalanceInterval era) -> Bool)
-> Map AccountId (AccountBalanceInterval era) -> Bool
forall a b. (a -> b) -> a -> b
$ AccountBalanceIntervals era
-> Map AccountId (AccountBalanceInterval era)
forall era.
AccountBalanceIntervals era
-> Map AccountId (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 (AccountBalanceIntervals era -> DijkstraContextError era
forall era. AccountBalanceIntervals era -> DijkstraContextError era
AccountBalanceIntervalsNotSupported AccountBalanceIntervals era
accountBalanceIntervals :: DijkstraContextError era)
Maybe (NonEmpty TxId)
-> (NonEmpty TxId -> Either (ContextError era) (ZonkAny 0))
-> Either (ContextError era) ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
t a -> (a -> m b) -> m ()
forM_ ([TxId] -> Maybe (NonEmpty TxId)
forall a. [a] -> Maybe (NonEmpty a)
NE.nonEmpty ([TxId] -> Maybe (NonEmpty TxId))
-> (OMap TxId (Tx SubTx era) -> [TxId])
-> OMap TxId (Tx SubTx era)
-> Maybe (NonEmpty TxId)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. StrictSeq TxId -> [TxId]
forall a. StrictSeq a -> [a]
forall (t :: * -> *) a. Foldable t => t a -> [a]
toList (StrictSeq TxId -> [TxId])
-> (OMap TxId (Tx SubTx era) -> StrictSeq TxId)
-> OMap TxId (Tx SubTx era)
-> [TxId]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. OMap TxId (Tx SubTx era) -> StrictSeq TxId
forall k v. OMap k v -> StrictSeq k
OMap.toStrictSeqOKeys (OMap TxId (Tx SubTx era) -> Maybe (NonEmpty TxId))
-> OMap TxId (Tx SubTx era) -> Maybe (NonEmpty TxId)
forall a b. (a -> b) -> a -> b
$ TxBody TopTx era
txBody TxBody TopTx era
-> Getting
(OMap TxId (Tx SubTx era))
(TxBody TopTx era)
(OMap TxId (Tx SubTx era))
-> OMap TxId (Tx SubTx era)
forall s a. s -> Getting a s a -> a
^. Getting
(OMap TxId (Tx SubTx era))
(TxBody TopTx era)
(OMap TxId (Tx SubTx era))
forall era.
DijkstraEraTxBody era =>
Lens' (TxBody TopTx era) (OMap TxId (Tx SubTx era))
Lens' (TxBody TopTx era) (OMap TxId (Tx SubTx era))
subTransactionsTxBodyL) ((NonEmpty TxId -> Either (ContextError era) (ZonkAny 0))
-> Either (ContextError era) ())
-> (NonEmpty TxId -> Either (ContextError era) (ZonkAny 0))
-> Either (ContextError era) ()
forall a b. (a -> b) -> a -> b
$ \NonEmpty TxId
subTxIds ->
ContextError era -> Either (ContextError era) (ZonkAny 0)
forall a b. a -> Either a b
Left (ContextError era -> Either (ContextError era) (ZonkAny 0))
-> ContextError era -> Either (ContextError era) (ZonkAny 0)
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 TxId -> DijkstraContextError era
SubTxsAreNotSupported @era NonEmpty TxId
subTxIds
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)
transTxCert ::
(ConwayEraTxCert era, TxCert era ~ DijkstraTxCert era) => TxCert era -> PV3.TxCert
transTxCert :: forall era.
(ConwayEraTxCert era, TxCert era ~ DijkstraTxCert era) =>
TxCert era -> TxCert
transTxCert = \case
RegPoolTxCert StakePoolParams {KeyHash StakePool
sppId :: StakePoolParams -> KeyHash StakePool
sppId :: KeyHash StakePool
sppId, VRFVerKeyHash StakePoolVRF
sppVrf :: StakePoolParams -> 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
_ 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
transTxCert
toPlutusScriptPurpose :: forall (proxy :: Language -> *).
proxy 'PlutusV4
-> ProtVer
-> PlutusPurpose AsIxItem DijkstraEra
-> Either
(ContextError DijkstraEra) (PlutusScriptPurpose 'PlutusV4)
toPlutusScriptPurpose proxy 'PlutusV4
_ = String
-> ProtVer
-> DijkstraPlutusPurpose AsIxItem DijkstraEra
-> Either (DijkstraContextError DijkstraEra) ScriptPurpose
forall a. HasCallStack => String -> a
error String
"stub: PlutusV4 not yet implemented"
toPlutusTxInfo :: forall (proxy :: Language -> *).
proxy 'PlutusV4
-> LedgerTxInfo DijkstraEra
-> PlutusTxInfoResult 'PlutusV4 DijkstraEra
toPlutusTxInfo proxy 'PlutusV4
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} = do
Tx level DijkstraEra
-> (Tx TopTx DijkstraEra
-> PlutusTxInfoResult 'PlutusV4 DijkstraEra)
-> (Tx SubTx DijkstraEra
-> PlutusTxInfoResult 'PlutusV4 DijkstraEra)
-> PlutusTxInfoResult 'PlutusV4 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 TopTx DijkstraEra -> PlutusTxInfoResult 'PlutusV4 DijkstraEra
mkTopTxInfo Tx SubTx DijkstraEra -> PlutusTxInfoResult 'PlutusV4 DijkstraEra
forall {l :: Language} {l :: TxLevel}.
(PlutusTxInfo l ~ TxInfo) =>
Tx l DijkstraEra -> PlutusTxInfoResult l DijkstraEra
mkSubTxInfo
where
mkTopTxInfo :: Tx TopTx DijkstraEra -> PlutusTxInfoResult 'PlutusV4 DijkstraEra
mkTopTxInfo Tx TopTx DijkstraEra
tx = 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
txInfo <- Tx TopTx DijkstraEra
-> Either (ContextError DijkstraEra) (PlutusTxInfo 'PlutusV4)
forall (l :: TxLevel).
Tx l DijkstraEra
-> Either (ContextError DijkstraEra) (PlutusTxInfo 'PlutusV4)
mkAnyLevelTxInfo Tx TopTx DijkstraEra
tx
let
topTxInfo = TxInfo
txInfo {PV3.txInfoFee = transCoinToLovelace (tx ^. bodyTxL . feeTxBodyL)}
Right $ \case
purpose :: DijkstraPlutusPurpose AsPurpose DijkstraEra
purpose@(GuardingPurpose AsPurpose Word32 ScriptHash
AsPurpose) -> do
_subTxInfosForGuards <-
[Tx SubTx DijkstraEra]
-> (Tx SubTx DijkstraEra
-> Either (DijkstraContextError DijkstraEra) TxInfo)
-> Either (DijkstraContextError DijkstraEra) [TxInfo]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
t a -> (a -> m b) -> m (t b)
forM (OMap TxId (Tx SubTx DijkstraEra) -> [Tx SubTx DijkstraEra]
forall k v. Ord k => OMap k v -> [v]
OMap.elems (Tx TopTx DijkstraEra
tx Tx TopTx DijkstraEra
-> Getting
(OMap TxId (Tx SubTx DijkstraEra))
(Tx TopTx DijkstraEra)
(OMap TxId (Tx SubTx DijkstraEra))
-> OMap TxId (Tx SubTx DijkstraEra)
forall s a. s -> Getting a s a -> a
^. (TxBody TopTx DijkstraEra
-> Const
(OMap TxId (Tx SubTx DijkstraEra)) (TxBody TopTx DijkstraEra))
-> Tx TopTx DijkstraEra
-> Const (OMap TxId (Tx SubTx DijkstraEra)) (Tx 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 ((TxBody TopTx DijkstraEra
-> Const
(OMap TxId (Tx SubTx DijkstraEra)) (TxBody TopTx DijkstraEra))
-> Tx TopTx DijkstraEra
-> Const (OMap TxId (Tx SubTx DijkstraEra)) (Tx TopTx DijkstraEra))
-> ((OMap TxId (Tx SubTx DijkstraEra)
-> Const
(OMap TxId (Tx SubTx DijkstraEra))
(OMap TxId (Tx SubTx DijkstraEra)))
-> TxBody TopTx DijkstraEra
-> Const
(OMap TxId (Tx SubTx DijkstraEra)) (TxBody TopTx DijkstraEra))
-> Getting
(OMap TxId (Tx SubTx DijkstraEra))
(Tx TopTx DijkstraEra)
(OMap TxId (Tx SubTx DijkstraEra))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (OMap TxId (Tx SubTx DijkstraEra)
-> Const
(OMap TxId (Tx SubTx DijkstraEra))
(OMap TxId (Tx SubTx DijkstraEra)))
-> TxBody TopTx DijkstraEra
-> Const
(OMap TxId (Tx SubTx DijkstraEra)) (TxBody TopTx DijkstraEra)
forall era.
DijkstraEraTxBody era =>
Lens' (TxBody TopTx era) (OMap TxId (Tx SubTx era))
Lens' (TxBody TopTx DijkstraEra) (OMap TxId (Tx SubTx DijkstraEra))
subTransactionsTxBodyL)) ((Tx SubTx DijkstraEra
-> Either (DijkstraContextError DijkstraEra) TxInfo)
-> Either (DijkstraContextError DijkstraEra) [TxInfo])
-> (Tx SubTx DijkstraEra
-> Either (DijkstraContextError DijkstraEra) TxInfo)
-> Either (DijkstraContextError DijkstraEra) [TxInfo]
forall a b. (a -> b) -> a -> b
$ \Tx SubTx DijkstraEra
subTx -> do
let txId :: TxId
txId = Tx SubTx DijkstraEra -> TxId
forall era (l :: TxLevel). EraTx era => Tx l era -> TxId
txIdTx Tx SubTx DijkstraEra
subTx
mkTxInfo <-
PlutusTxInfoResult 'PlutusV4 DijkstraEra
-> Either
(ContextError DijkstraEra)
(PlutusPurpose AsPurpose DijkstraEra
-> Either (ContextError DijkstraEra) (PlutusTxInfo 'PlutusV4))
forall (l :: Language) era.
PlutusTxInfoResult l era
-> Either
(ContextError era)
(PlutusPurpose AsPurpose era
-> Either (ContextError era) (PlutusTxInfo l))
unPlutusTxInfoResult (PlutusTxInfoResult 'PlutusV4 DijkstraEra
-> 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))
forall a b. (a -> b) -> a -> b
$
case TxId
-> Map TxId (TxInfoResult DijkstraEra)
-> Maybe (TxInfoResult DijkstraEra)
forall k a. Ord k => k -> Map k a -> Maybe a
Map.lookup TxId
txId (LedgerTxInfo DijkstraEra -> Map TxId (TxInfoResult DijkstraEra)
forall era. LedgerTxInfo era -> Map TxId (TxInfoResult era)
ltiMemoizedSubTransactions LedgerTxInfo DijkstraEra
lti) of
Maybe (TxInfoResult DijkstraEra)
Nothing ->
proxy '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 proxy 'PlutusV4
proxy (LedgerTxInfo DijkstraEra
-> PlutusTxInfoResult 'PlutusV4 DijkstraEra)
-> LedgerTxInfo DijkstraEra
-> PlutusTxInfoResult 'PlutusV4 DijkstraEra
forall a b. (a -> b) -> a -> b
$
LedgerTxInfo DijkstraEra
lti
{ ltiTx = subTx
, ltiMemoizedSubTransactions = mempty
}
Just TxInfoResult DijkstraEra
txInfoResults ->
SLanguage 'PlutusV4
-> TxInfoResult DijkstraEra
-> PlutusTxInfoResult 'PlutusV4 DijkstraEra
forall era (l :: Language).
(EraPlutusContext era, EraPlutusTxInfo l era) =>
SLanguage l -> TxInfoResult era -> PlutusTxInfoResult l era
forall (l :: Language).
EraPlutusTxInfo l DijkstraEra =>
SLanguage l
-> TxInfoResult DijkstraEra -> PlutusTxInfoResult l DijkstraEra
lookupTxInfoResult (proxy 'PlutusV4 -> SLanguage 'PlutusV4
forall (l :: Language) (proxy :: Language -> *).
PlutusLanguage l =>
proxy l -> SLanguage l
plutusSLanguage proxy 'PlutusV4
proxy) TxInfoResult DijkstraEra
txInfoResults
left (SubTxContextError txId) $ mkTxInfo purpose
Right topTxInfo
DijkstraPlutusPurpose AsPurpose DijkstraEra
_ -> TxInfo -> Either (DijkstraContextError DijkstraEra) TxInfo
forall a b. b -> Either a b
Right TxInfo
topTxInfo
mkSubTxInfo :: Tx l DijkstraEra -> PlutusTxInfoResult l DijkstraEra
mkSubTxInfo Tx l DijkstraEra
tx = Either
(ContextError DijkstraEra)
(PlutusPurpose AsPurpose DijkstraEra
-> Either (ContextError DijkstraEra) (PlutusTxInfo l))
-> PlutusTxInfoResult l 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 l))
-> PlutusTxInfoResult l DijkstraEra)
-> Either
(ContextError DijkstraEra)
(PlutusPurpose AsPurpose DijkstraEra
-> Either (ContextError DijkstraEra) (PlutusTxInfo l))
-> PlutusTxInfoResult l DijkstraEra
forall a b. (a -> b) -> a -> b
$ do
txInfo <- Tx l DijkstraEra
-> Either (ContextError DijkstraEra) (PlutusTxInfo 'PlutusV4)
forall (l :: TxLevel).
Tx l DijkstraEra
-> Either (ContextError DijkstraEra) (PlutusTxInfo 'PlutusV4)
mkAnyLevelTxInfo Tx l DijkstraEra
tx
Right $ \PlutusPurpose AsPurpose DijkstraEra
_ -> PlutusTxInfo l
-> Either (ContextError DijkstraEra) (PlutusTxInfo l)
forall a b. b -> Either a b
Right PlutusTxInfo l
txInfo
mkAnyLevelTxInfo ::
Tx l DijkstraEra ->
Either (ContextError DijkstraEra) (PlutusTxInfo 'PlutusV4)
mkAnyLevelTxInfo :: forall (l :: TxLevel).
Tx l DijkstraEra
-> Either (ContextError DijkstraEra) (PlutusTxInfo 'PlutusV4)
mkAnyLevelTxInfo Tx l DijkstraEra
tx = do
let
txBody :: TxBody l DijkstraEra
txBody = Tx l DijkstraEra
tx Tx l DijkstraEra
-> Getting
(TxBody l DijkstraEra) (Tx l DijkstraEra) (TxBody l DijkstraEra)
-> TxBody l DijkstraEra
forall s a. s -> Getting a s a -> a
^. Getting
(TxBody l DijkstraEra) (Tx l DijkstraEra) (TxBody l 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 l DijkstraEra
txBody TxBody l DijkstraEra
-> Getting (Set TxIn) (TxBody l DijkstraEra) (Set TxIn) -> Set TxIn
forall s a. s -> Getting a s a -> a
^. Getting (Set TxIn) (TxBody l 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 l DijkstraEra
txBody TxBody l DijkstraEra
-> Getting (Set TxIn) (TxBody l DijkstraEra) (Set TxIn) -> Set TxIn
forall s a. s -> Getting a s a -> a
^. Getting (Set TxIn) (TxBody l 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 <-
Tx l DijkstraEra
-> EpochInfo (Either Text)
-> SystemStart
-> ValidityInterval
-> Either (DijkstraContextError DijkstraEra) POSIXTimeRange
forall (proxy :: * -> *) era a.
Inject (AlonzoContextError era) a =>
proxy era
-> EpochInfo (Either Text)
-> SystemStart
-> ValidityInterval
-> Either a POSIXTimeRange
Conway.transValidityInterval Tx l DijkstraEra
tx EpochInfo (Either Text)
ltiEpochInfo SystemStart
ltiSystemStart (TxBody l DijkstraEra
txBody TxBody l DijkstraEra
-> Getting ValidityInterval (TxBody l DijkstraEra) ValidityInterval
-> ValidityInterval
forall s a. s -> Getting a s a -> a
^. Getting ValidityInterval (TxBody l 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
checkPointerPresentInOutput $ txBody ^. outputsTxBodyL
outputs <-
zipWithM
(Babbage.transTxOutV2 . TxOutFromOutput)
[minBound ..]
(F.toList (txBody ^. outputsTxBodyL))
txCerts <- Alonzo.transTxBodyCerts proxy ltiProtVer txBody
plutusRedeemers <- Babbage.transTxRedeemers proxy ltiProtVer tx
Right $
PV3.TxInfo
{ PV3.txInfoInputs = inputsInfo
, PV3.txInfoOutputs = outputs
, PV3.txInfoReferenceInputs = refInputsInfo
, PV3.txInfoFee = 0
, PV3.txInfoMint = Conway.transMintValue (txBody ^. mintTxBodyL)
, PV3.txInfoTxCerts = txCerts
, PV3.txInfoWdrl = Conway.transTxBodyWithdrawals txBody
, PV3.txInfoValidRange = timeRange
, PV3.txInfoSignatories = Alonzo.transTxBodyReqSignerHashes txBody
, PV3.txInfoRedeemers = plutusRedeemers
, PV3.txInfoData = PV3.unsafeFromList $ Alonzo.transTxWitsDatums (tx ^. witsTxL)
, PV3.txInfoId = Conway.transTxBodyId txBody
, PV3.txInfoVotes = Conway.transVotingProcedures (txBody ^. votingProceduresTxBodyL)
, PV3.txInfoProposalProcedures =
map (Conway.transProposal proxy) $ toList (txBody ^. proposalProceduresTxBodyL)
, PV3.txInfoCurrentTreasuryAmount =
strictMaybe Nothing (Just . transCoinToLovelace) $ txBody ^. currentTreasuryValueTxBodyL
, PV3.txInfoTreasuryDonation =
case txBody ^. 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
}
toPlutusArgs :: forall (proxy :: Language -> *).
proxy 'PlutusV4
-> ProtVer
-> PlutusTxInfo 'PlutusV4
-> PlutusPurpose AsIxItem DijkstraEra
-> Maybe (Data DijkstraEra)
-> Data DijkstraEra
-> Either (ContextError DijkstraEra) (PlutusArgs 'PlutusV4)
toPlutusArgs = proxy 'PlutusV4
-> ProtVer
-> PlutusTxInfo 'PlutusV4
-> PlutusPurpose AsIxItem DijkstraEra
-> Maybe (Data DijkstraEra)
-> Data DijkstraEra
-> Either (ContextError DijkstraEra) (PlutusArgs 'PlutusV4)
proxy 'PlutusV4
-> ProtVer
-> TxInfo
-> PlutusPurpose AsIxItem DijkstraEra
-> Maybe (Data DijkstraEra)
-> Data DijkstraEra
-> Either (ContextError DijkstraEra) (PlutusArgs 'PlutusV4)
forall era (proxy :: Language -> *).
EraPlutusTxInfo 'PlutusV4 era =>
proxy 'PlutusV4
-> ProtVer
-> TxInfo
-> PlutusPurpose AsIxItem era
-> Maybe (Data 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.
(Inject (BabbageContextError era) (ContextError era),
Value era ~ MaryValue, BabbageEraTxOut era) =>
UTxO era -> TxIn -> Either (ContextError era) TxInInfo
transTxInInfoV3
toPlutusV4Args ::
EraPlutusTxInfo 'PlutusV4 era =>
proxy 'PlutusV4 ->
ProtVer ->
PV3.TxInfo ->
PlutusPurpose AsIxItem era ->
Maybe (Data era) ->
Data era ->
Either (ContextError era) (PlutusArgs 'PlutusV4)
toPlutusV4Args :: forall era (proxy :: Language -> *).
EraPlutusTxInfo 'PlutusV4 era =>
proxy 'PlutusV4
-> ProtVer
-> TxInfo
-> PlutusPurpose AsIxItem era
-> Maybe (Data era)
-> Data era
-> Either (ContextError era) (PlutusArgs 'PlutusV4)
toPlutusV4Args proxy 'PlutusV4
proxy ProtVer
pv TxInfo
txInfo PlutusPurpose AsIxItem era
plutusPurpose Maybe (Data era)
maybeSpendingData Data era
redeemerData = do
scriptPurpose <- proxy 'PlutusV4
-> ProtVer
-> PlutusPurpose AsIxItem era
-> Either (ContextError era) (PlutusScriptPurpose 'PlutusV4)
forall (l :: Language) era (proxy :: Language -> *).
EraPlutusTxInfo l era =>
proxy l
-> ProtVer
-> PlutusPurpose AsIxItem era
-> Either (ContextError era) (PlutusScriptPurpose l)
forall (proxy :: Language -> *).
proxy 'PlutusV4
-> ProtVer
-> PlutusPurpose AsIxItem era
-> Either (ContextError era) (PlutusScriptPurpose 'PlutusV4)
toPlutusScriptPurpose proxy 'PlutusV4
proxy ProtVer
pv PlutusPurpose AsIxItem era
plutusPurpose
let scriptInfo =
ScriptPurpose -> Maybe Datum -> ScriptInfo
Conway.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)
pure $
PlutusV4Args $
PV3.ScriptContext
{ PV3.scriptContextTxInfo = txInfo
, PV3.scriptContextRedeemer = Babbage.transRedeemer redeemerData
, PV3.scriptContextScriptInfo = scriptInfo
}
checkPointerPresentInOutput ::
Foldable f =>
f (TxOut DijkstraEra) ->
Either (ContextError DijkstraEra) ()
checkPointerPresentInOutput :: forall (f :: * -> *).
Foldable f =>
f (TxOut DijkstraEra) -> Either (ContextError DijkstraEra) ()
checkPointerPresentInOutput f (TxOut DijkstraEra)
outputs =
case [TxOut DijkstraEra] -> Maybe (NonEmpty (TxOut DijkstraEra))
forall a. [a] -> Maybe (NonEmpty a)
NE.nonEmpty ((TxOut DijkstraEra -> Bool)
-> [TxOut DijkstraEra] -> [TxOut DijkstraEra]
forall a. (a -> Bool) -> [a] -> [a]
filter TxOut DijkstraEra -> Bool
forall {era}.
(Assert
(OrdCond
(CmpNat (ProtVerLow era) (ProtVerHigh era)) 'True 'True 'False)
(TypeError ...),
Assert
(OrdCond (CmpNat 0 (ProtVerLow era)) 'True 'True 'False)
(TypeError ...),
Assert
(OrdCond (CmpNat 0 (ProtVerHigh era)) 'True 'True 'False)
(TypeError ...),
EraTxOut era) =>
TxOut era -> Bool
outputHasPtr ([TxOut DijkstraEra] -> [TxOut DijkstraEra])
-> [TxOut DijkstraEra] -> [TxOut DijkstraEra]
forall a b. (a -> b) -> a -> b
$ f (TxOut DijkstraEra) -> [TxOut DijkstraEra]
forall a. f a -> [a]
forall (t :: * -> *) a. Foldable t => t a -> [a]
toList f (TxOut DijkstraEra)
outputs) of
Maybe (NonEmpty (TxOut DijkstraEra))
Nothing -> () -> Either (DijkstraContextError DijkstraEra) ()
forall a. a -> Either (DijkstraContextError DijkstraEra) a
forall (f :: * -> *) a. Applicative f => a -> f a
pure ()
Just NonEmpty (TxOut DijkstraEra)
ptrOutputs -> ContextError DijkstraEra -> Either (ContextError DijkstraEra) ()
forall a b. a -> Either a b
Left (ContextError DijkstraEra -> Either (ContextError DijkstraEra) ())
-> ContextError DijkstraEra -> Either (ContextError DijkstraEra) ()
forall a b. (a -> b) -> a -> b
$ NonEmpty (TxOut DijkstraEra) -> DijkstraContextError DijkstraEra
forall era. NonEmpty (TxOut era) -> DijkstraContextError era
PointerPresentInOutput NonEmpty (TxOut DijkstraEra)
ptrOutputs
where
outputHasPtr :: TxOut era -> Bool
outputHasPtr TxOut era
txOut = 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
_ (StakeRefPtr Ptr
_) -> Bool
True
Addr
_ -> Bool
False