module Cooked.Output
( IsAbstractOutput,
OwnerType,
DatumType,
ValueType,
ReferenceScriptType,
outputOwnerL,
outputStakingCredentialL,
outputDatumL,
outputValueL,
outputReferenceScriptL,
IsTxInfoOutput,
outputAddress,
outputOutputDatum,
outputValue,
outputReferenceScriptHash,
outputTxOut,
ConcreteOutput (..),
toOutputWithReferenceScriptHash,
isOutputWithoutDatum,
isOutputWithInlineDatum,
isOutputWithDatumHash,
isOutputWithInlineDatumOfType,
isScriptOutputFrom,
isPKOutputFrom,
isOnlyAdaOutput,
fromAbstractOutput,
isReferenceScriptOutputFrom,
isStakingCredentialOutputFrom,
isEmptyStakingCredentialOutput,
isPKOutput,
isScriptOutput,
setDatum,
setOwner,
setReferenceScript,
setValue,
setStakingCredential,
)
where
import Cooked.Conversion.ToCredential
import Cooked.Conversion.ToOutputDatum
import Cooked.Conversion.ToScriptHash
import Cooked.Conversion.ToValue
import Optics.Core
import Plutus.Script.Utils.Ada qualified as Script
import Plutus.Script.Utils.Value qualified as Script
import PlutusLedgerApi.V2.Tx qualified as Api
import PlutusLedgerApi.V3 qualified as Api
class IsAbstractOutput o where
type OwnerType o
type DatumType o
type ValueType o
type ReferenceScriptType o
outputOwnerL :: Lens' o (OwnerType o)
outputStakingCredentialL :: Lens' o (Maybe Api.StakingCredential)
outputDatumL :: Lens' o (DatumType o)
outputValueL :: Lens' o (ValueType o)
outputReferenceScriptL :: Lens' o (Maybe (ReferenceScriptType o))
type IsTxInfoOutput o =
( IsAbstractOutput o,
ToCredential (OwnerType o),
ToOutputDatum (DatumType o),
ToValue (ValueType o),
ToScriptHash (ReferenceScriptType o)
)
outputAddress :: (IsAbstractOutput o, ToCredential (OwnerType o)) => o -> Api.Address
outputAddress :: forall o.
(IsAbstractOutput o, ToCredential (OwnerType o)) =>
o -> Address
outputAddress o
out = Credential -> Maybe StakingCredential -> Address
Api.Address (OwnerType o -> Credential
forall a. ToCredential a => a -> Credential
toCredential (o
out o -> Optic' A_Lens NoIx o (OwnerType o) -> OwnerType o
forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. Optic' A_Lens NoIx o (OwnerType o)
forall o. IsAbstractOutput o => Lens' o (OwnerType o)
outputOwnerL)) (o
out o
-> Optic' A_Lens NoIx o (Maybe StakingCredential)
-> Maybe StakingCredential
forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. Optic' A_Lens NoIx o (Maybe StakingCredential)
forall o. IsAbstractOutput o => Lens' o (Maybe StakingCredential)
outputStakingCredentialL)
outputOutputDatum :: (IsAbstractOutput o, ToOutputDatum (DatumType o)) => o -> Api.OutputDatum
outputOutputDatum :: forall o.
(IsAbstractOutput o, ToOutputDatum (DatumType o)) =>
o -> OutputDatum
outputOutputDatum = DatumType o -> OutputDatum
forall a. ToOutputDatum a => a -> OutputDatum
toOutputDatum (DatumType o -> OutputDatum)
-> (o -> DatumType o) -> o -> OutputDatum
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (o -> Optic' A_Lens NoIx o (DatumType o) -> DatumType o
forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. Optic' A_Lens NoIx o (DatumType o)
forall o. IsAbstractOutput o => Lens' o (DatumType o)
outputDatumL)
outputValue :: (IsAbstractOutput o, ToValue (ValueType o)) => o -> Api.Value
outputValue :: forall o. (IsAbstractOutput o, ToValue (ValueType o)) => o -> Value
outputValue = ValueType o -> Value
forall a. ToValue a => a -> Value
toValue (ValueType o -> Value) -> (o -> ValueType o) -> o -> Value
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (o -> Optic' A_Lens NoIx o (ValueType o) -> ValueType o
forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. Optic' A_Lens NoIx o (ValueType o)
forall o. IsAbstractOutput o => Lens' o (ValueType o)
outputValueL)
outputReferenceScriptHash :: (IsAbstractOutput o, ToScriptHash (ReferenceScriptType o)) => o -> Maybe Api.ScriptHash
outputReferenceScriptHash :: forall o.
(IsAbstractOutput o, ToScriptHash (ReferenceScriptType o)) =>
o -> Maybe ScriptHash
outputReferenceScriptHash = (ReferenceScriptType o -> ScriptHash
forall a. ToScriptHash a => a -> ScriptHash
toScriptHash (ReferenceScriptType o -> ScriptHash)
-> Maybe (ReferenceScriptType o) -> Maybe ScriptHash
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$>) (Maybe (ReferenceScriptType o) -> Maybe ScriptHash)
-> (o -> Maybe (ReferenceScriptType o)) -> o -> Maybe ScriptHash
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (o
-> Optic' A_Lens NoIx o (Maybe (ReferenceScriptType o))
-> Maybe (ReferenceScriptType o)
forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. Optic' A_Lens NoIx o (Maybe (ReferenceScriptType o))
forall o.
IsAbstractOutput o =>
Lens' o (Maybe (ReferenceScriptType o))
outputReferenceScriptL)
outputTxOut :: (IsTxInfoOutput o) => o -> Api.TxOut
outputTxOut :: forall o. IsTxInfoOutput o => o -> TxOut
outputTxOut o
o = Address -> Value -> OutputDatum -> Maybe ScriptHash -> TxOut
Api.TxOut (o -> Address
forall o.
(IsAbstractOutput o, ToCredential (OwnerType o)) =>
o -> Address
outputAddress o
o) (o -> Value
forall o. (IsAbstractOutput o, ToValue (ValueType o)) => o -> Value
outputValue o
o) (o -> OutputDatum
forall o.
(IsAbstractOutput o, ToOutputDatum (DatumType o)) =>
o -> OutputDatum
outputOutputDatum o
o) (o -> Maybe ScriptHash
forall o.
(IsAbstractOutput o, ToScriptHash (ReferenceScriptType o)) =>
o -> Maybe ScriptHash
outputReferenceScriptHash o
o)
instance IsAbstractOutput Api.TxOut where
type OwnerType Api.TxOut = Api.Credential
type DatumType Api.TxOut = Api.OutputDatum
type ValueType Api.TxOut = Api.Value
type ReferenceScriptType Api.TxOut = Api.ScriptHash
outputOwnerL :: Lens' TxOut (OwnerType TxOut)
outputOwnerL =
LensVL TxOut TxOut Address Address
-> Lens TxOut TxOut Address Address
forall s t a b. LensVL s t a b -> Lens s t a b
lensVL (Address -> f Address) -> TxOut -> f TxOut
LensVL TxOut TxOut Address Address
Api.outAddress
Lens TxOut TxOut Address Address
-> Optic A_Lens NoIx Address Address Credential Credential
-> Optic A_Lens NoIx TxOut TxOut Credential Credential
forall k l m (is :: IxList) (js :: IxList) (ks :: IxList) s t u v a
b.
(JoinKinds k l m, AppendIndices is js ks) =>
Optic k is s t u v -> Optic l js u v a b -> Optic m ks s t a b
% (Address -> Credential)
-> (Address -> Credential -> Address)
-> Optic A_Lens NoIx Address Address Credential Credential
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens
Address -> Credential
Api.addressCredential
(\Address
addr Credential
cred -> Address
addr {Api.addressCredential = cred})
outputDatumL :: Lens' TxOut (DatumType TxOut)
outputDatumL = LensVL TxOut TxOut OutputDatum OutputDatum
-> Lens TxOut TxOut OutputDatum OutputDatum
forall s t a b. LensVL s t a b -> Lens s t a b
lensVL (OutputDatum -> f OutputDatum) -> TxOut -> f TxOut
LensVL TxOut TxOut OutputDatum OutputDatum
Api.outDatum
outputStakingCredentialL :: Lens' TxOut (Maybe StakingCredential)
outputStakingCredentialL =
(TxOut -> Maybe StakingCredential)
-> (TxOut -> Maybe StakingCredential -> TxOut)
-> Lens' TxOut (Maybe StakingCredential)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens
(Address -> Maybe StakingCredential
Api.addressStakingCredential (Address -> Maybe StakingCredential)
-> (TxOut -> Address) -> TxOut -> Maybe StakingCredential
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TxOut -> Address
Api.txOutAddress)
( \TxOut
out Maybe StakingCredential
mStCred ->
TxOut
out {Api.txOutAddress = (Api.txOutAddress out) {Api.addressStakingCredential = mStCred}}
)
outputValueL :: Lens' TxOut (ValueType TxOut)
outputValueL = LensVL TxOut TxOut Value Value -> Lens TxOut TxOut Value Value
forall s t a b. LensVL s t a b -> Lens s t a b
lensVL (Value -> f Value) -> TxOut -> f TxOut
LensVL TxOut TxOut Value Value
Api.outValue
outputReferenceScriptL :: Lens' TxOut (Maybe (ReferenceScriptType TxOut))
outputReferenceScriptL = LensVL TxOut TxOut (Maybe ScriptHash) (Maybe ScriptHash)
-> Lens TxOut TxOut (Maybe ScriptHash) (Maybe ScriptHash)
forall s t a b. LensVL s t a b -> Lens s t a b
lensVL (Maybe ScriptHash -> f (Maybe ScriptHash)) -> TxOut -> f TxOut
LensVL TxOut TxOut (Maybe ScriptHash) (Maybe ScriptHash)
Api.outReferenceScript
data ConcreteOutput ownerType datumType valueType referenceScriptType where
ConcreteOutput ::
{ forall ownerType datumType valueType referenceScriptType.
ConcreteOutput ownerType datumType valueType referenceScriptType
-> ownerType
concreteOutputOwner :: ownerType,
forall ownerType datumType valueType referenceScriptType.
ConcreteOutput ownerType datumType valueType referenceScriptType
-> Maybe StakingCredential
concreteOutputStakingCredential :: Maybe Api.StakingCredential,
forall ownerType datumType valueType referenceScriptType.
ConcreteOutput ownerType datumType valueType referenceScriptType
-> datumType
concreteOutputDatum :: datumType,
forall ownerType datumType valueType referenceScriptType.
ConcreteOutput ownerType datumType valueType referenceScriptType
-> valueType
concreteOutputValue :: valueType,
forall ownerType datumType valueType referenceScriptType.
ConcreteOutput ownerType datumType valueType referenceScriptType
-> Maybe referenceScriptType
concreteOutputReferenceScript :: Maybe referenceScriptType
} ->
ConcreteOutput ownerType datumType valueType referenceScriptType
deriving instance (Show ownerType, Show datumType, Show valueType, Show referenceScriptType) => Show (ConcreteOutput ownerType datumType valueType referenceScriptType)
deriving instance (Eq ownerType, Eq datumType, Eq valueType, Eq referenceScriptType) => Eq (ConcreteOutput ownerType datumType valueType referenceScriptType)
instance IsAbstractOutput (ConcreteOutput ownerType datumType valueType referenceScriptType) where
type OwnerType (ConcreteOutput ownerType _ _ _) = ownerType
type DatumType (ConcreteOutput _ datumType _ _) = datumType
type ValueType (ConcreteOutput _ _ valueType _) = valueType
type ReferenceScriptType (ConcreteOutput _ _ _ referenceScriptType) = referenceScriptType
outputOwnerL :: Lens'
(ConcreteOutput ownerType datumType valueType referenceScriptType)
(OwnerType
(ConcreteOutput ownerType datumType valueType referenceScriptType))
outputOwnerL = (ConcreteOutput ownerType datumType valueType referenceScriptType
-> ownerType)
-> (ConcreteOutput
ownerType datumType valueType referenceScriptType
-> ownerType
-> ConcreteOutput
ownerType datumType valueType referenceScriptType)
-> Lens
(ConcreteOutput ownerType datumType valueType referenceScriptType)
(ConcreteOutput ownerType datumType valueType referenceScriptType)
ownerType
ownerType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens ConcreteOutput ownerType datumType valueType referenceScriptType
-> ownerType
forall ownerType datumType valueType referenceScriptType.
ConcreteOutput ownerType datumType valueType referenceScriptType
-> ownerType
concreteOutputOwner (\ConcreteOutput ownerType datumType valueType referenceScriptType
out ownerType
owner -> ConcreteOutput ownerType datumType valueType referenceScriptType
out {concreteOutputOwner = owner})
outputStakingCredentialL :: Lens'
(ConcreteOutput ownerType datumType valueType referenceScriptType)
(Maybe StakingCredential)
outputStakingCredentialL = (ConcreteOutput ownerType datumType valueType referenceScriptType
-> Maybe StakingCredential)
-> (ConcreteOutput
ownerType datumType valueType referenceScriptType
-> Maybe StakingCredential
-> ConcreteOutput
ownerType datumType valueType referenceScriptType)
-> Lens'
(ConcreteOutput ownerType datumType valueType referenceScriptType)
(Maybe StakingCredential)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens ConcreteOutput ownerType datumType valueType referenceScriptType
-> Maybe StakingCredential
forall ownerType datumType valueType referenceScriptType.
ConcreteOutput ownerType datumType valueType referenceScriptType
-> Maybe StakingCredential
concreteOutputStakingCredential (\ConcreteOutput ownerType datumType valueType referenceScriptType
out Maybe StakingCredential
mStCred -> ConcreteOutput ownerType datumType valueType referenceScriptType
out {concreteOutputStakingCredential = mStCred})
outputDatumL :: Lens'
(ConcreteOutput ownerType datumType valueType referenceScriptType)
(DatumType
(ConcreteOutput ownerType datumType valueType referenceScriptType))
outputDatumL = (ConcreteOutput ownerType datumType valueType referenceScriptType
-> datumType)
-> (ConcreteOutput
ownerType datumType valueType referenceScriptType
-> datumType
-> ConcreteOutput
ownerType datumType valueType referenceScriptType)
-> Lens
(ConcreteOutput ownerType datumType valueType referenceScriptType)
(ConcreteOutput ownerType datumType valueType referenceScriptType)
datumType
datumType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens ConcreteOutput ownerType datumType valueType referenceScriptType
-> datumType
forall ownerType datumType valueType referenceScriptType.
ConcreteOutput ownerType datumType valueType referenceScriptType
-> datumType
concreteOutputDatum (\ConcreteOutput ownerType datumType valueType referenceScriptType
out datumType
datum -> ConcreteOutput ownerType datumType valueType referenceScriptType
out {concreteOutputDatum = datum})
outputValueL :: Lens'
(ConcreteOutput ownerType datumType valueType referenceScriptType)
(ValueType
(ConcreteOutput ownerType datumType valueType referenceScriptType))
outputValueL = (ConcreteOutput ownerType datumType valueType referenceScriptType
-> valueType)
-> (ConcreteOutput
ownerType datumType valueType referenceScriptType
-> valueType
-> ConcreteOutput
ownerType datumType valueType referenceScriptType)
-> Lens
(ConcreteOutput ownerType datumType valueType referenceScriptType)
(ConcreteOutput ownerType datumType valueType referenceScriptType)
valueType
valueType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens ConcreteOutput ownerType datumType valueType referenceScriptType
-> valueType
forall ownerType datumType valueType referenceScriptType.
ConcreteOutput ownerType datumType valueType referenceScriptType
-> valueType
concreteOutputValue (\ConcreteOutput ownerType datumType valueType referenceScriptType
out valueType
value -> ConcreteOutput ownerType datumType valueType referenceScriptType
out {concreteOutputValue = value})
outputReferenceScriptL :: Lens'
(ConcreteOutput ownerType datumType valueType referenceScriptType)
(Maybe
(ReferenceScriptType
(ConcreteOutput
ownerType datumType valueType referenceScriptType)))
outputReferenceScriptL = (ConcreteOutput ownerType datumType valueType referenceScriptType
-> Maybe referenceScriptType)
-> (ConcreteOutput
ownerType datumType valueType referenceScriptType
-> Maybe referenceScriptType
-> ConcreteOutput
ownerType datumType valueType referenceScriptType)
-> Lens
(ConcreteOutput ownerType datumType valueType referenceScriptType)
(ConcreteOutput ownerType datumType valueType referenceScriptType)
(Maybe referenceScriptType)
(Maybe referenceScriptType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens ConcreteOutput ownerType datumType valueType referenceScriptType
-> Maybe referenceScriptType
forall ownerType datumType valueType referenceScriptType.
ConcreteOutput ownerType datumType valueType referenceScriptType
-> Maybe referenceScriptType
concreteOutputReferenceScript (\ConcreteOutput ownerType datumType valueType referenceScriptType
out Maybe referenceScriptType
mRefScript -> ConcreteOutput ownerType datumType valueType referenceScriptType
out {concreteOutputReferenceScript = mRefScript})
fromAbstractOutput :: (IsAbstractOutput out) => out -> ConcreteOutput (OwnerType out) (DatumType out) (ValueType out) (ReferenceScriptType out)
fromAbstractOutput :: forall out.
IsAbstractOutput out =>
out
-> ConcreteOutput
(OwnerType out)
(DatumType out)
(ValueType out)
(ReferenceScriptType out)
fromAbstractOutput out
o = OwnerType out
-> Maybe StakingCredential
-> DatumType out
-> ValueType out
-> Maybe (ReferenceScriptType out)
-> ConcreteOutput
(OwnerType out)
(DatumType out)
(ValueType out)
(ReferenceScriptType out)
forall ownerType datumType valueType referenceScriptType.
ownerType
-> Maybe StakingCredential
-> datumType
-> valueType
-> Maybe referenceScriptType
-> ConcreteOutput ownerType datumType valueType referenceScriptType
ConcreteOutput (out
o out -> Optic' A_Lens NoIx out (OwnerType out) -> OwnerType out
forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. Optic' A_Lens NoIx out (OwnerType out)
forall o. IsAbstractOutput o => Lens' o (OwnerType o)
outputOwnerL) (out
o out
-> Optic' A_Lens NoIx out (Maybe StakingCredential)
-> Maybe StakingCredential
forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. Optic' A_Lens NoIx out (Maybe StakingCredential)
forall o. IsAbstractOutput o => Lens' o (Maybe StakingCredential)
outputStakingCredentialL) (out
o out -> Optic' A_Lens NoIx out (DatumType out) -> DatumType out
forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. Optic' A_Lens NoIx out (DatumType out)
forall o. IsAbstractOutput o => Lens' o (DatumType o)
outputDatumL) (out
o out -> Optic' A_Lens NoIx out (ValueType out) -> ValueType out
forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. Optic' A_Lens NoIx out (ValueType out)
forall o. IsAbstractOutput o => Lens' o (ValueType o)
outputValueL) (out
o out
-> Optic' A_Lens NoIx out (Maybe (ReferenceScriptType out))
-> Maybe (ReferenceScriptType out)
forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. Optic' A_Lens NoIx out (Maybe (ReferenceScriptType out))
forall o.
IsAbstractOutput o =>
Lens' o (Maybe (ReferenceScriptType o))
outputReferenceScriptL)
setDatum :: (IsAbstractOutput out) => out -> dat -> ConcreteOutput (OwnerType out) dat (ValueType out) (ReferenceScriptType out)
setDatum :: forall out dat.
IsAbstractOutput out =>
out
-> dat
-> ConcreteOutput
(OwnerType out) dat (ValueType out) (ReferenceScriptType out)
setDatum out
o dat
dat = (out
-> ConcreteOutput
(OwnerType out)
(DatumType out)
(ValueType out)
(ReferenceScriptType out)
forall out.
IsAbstractOutput out =>
out
-> ConcreteOutput
(OwnerType out)
(DatumType out)
(ValueType out)
(ReferenceScriptType out)
fromAbstractOutput out
o) {concreteOutputDatum = dat}
setOwner :: (IsAbstractOutput out) => out -> owner -> ConcreteOutput owner (DatumType out) (ValueType out) (ReferenceScriptType out)
setOwner :: forall out owner.
IsAbstractOutput out =>
out
-> owner
-> ConcreteOutput
owner (DatumType out) (ValueType out) (ReferenceScriptType out)
setOwner out
o owner
own = (out
-> ConcreteOutput
(OwnerType out)
(DatumType out)
(ValueType out)
(ReferenceScriptType out)
forall out.
IsAbstractOutput out =>
out
-> ConcreteOutput
(OwnerType out)
(DatumType out)
(ValueType out)
(ReferenceScriptType out)
fromAbstractOutput out
o) {concreteOutputOwner = own}
setStakingCredential :: (IsAbstractOutput out) => out -> Api.StakingCredential -> ConcreteOutput (OwnerType out) (DatumType out) (ValueType out) (ReferenceScriptType out)
setStakingCredential :: forall out.
IsAbstractOutput out =>
out
-> StakingCredential
-> ConcreteOutput
(OwnerType out)
(DatumType out)
(ValueType out)
(ReferenceScriptType out)
setStakingCredential out
o StakingCredential
cred = (out
-> ConcreteOutput
(OwnerType out)
(DatumType out)
(ValueType out)
(ReferenceScriptType out)
forall out.
IsAbstractOutput out =>
out
-> ConcreteOutput
(OwnerType out)
(DatumType out)
(ValueType out)
(ReferenceScriptType out)
fromAbstractOutput out
o) {concreteOutputStakingCredential = Just cred}
setValue :: (IsAbstractOutput out) => out -> val -> ConcreteOutput (OwnerType out) (DatumType out) val (ReferenceScriptType out)
setValue :: forall out val.
IsAbstractOutput out =>
out
-> val
-> ConcreteOutput
(OwnerType out) (DatumType out) val (ReferenceScriptType out)
setValue out
o val
val = (out
-> ConcreteOutput
(OwnerType out)
(DatumType out)
(ValueType out)
(ReferenceScriptType out)
forall out.
IsAbstractOutput out =>
out
-> ConcreteOutput
(OwnerType out)
(DatumType out)
(ValueType out)
(ReferenceScriptType out)
fromAbstractOutput out
o) {concreteOutputValue = val}
setReferenceScript :: (IsAbstractOutput out) => out -> ref -> ConcreteOutput (OwnerType out) (DatumType out) (ValueType out) ref
setReferenceScript :: forall out ref.
IsAbstractOutput out =>
out
-> ref
-> ConcreteOutput
(OwnerType out) (DatumType out) (ValueType out) ref
setReferenceScript out
o ref
refScript = (out
-> ConcreteOutput
(OwnerType out)
(DatumType out)
(ValueType out)
(ReferenceScriptType out)
forall out.
IsAbstractOutput out =>
out
-> ConcreteOutput
(OwnerType out)
(DatumType out)
(ValueType out)
(ReferenceScriptType out)
fromAbstractOutput out
o) {concreteOutputReferenceScript = Just refScript}
isOutputWithoutDatum :: (IsTxInfoOutput out) => out -> Maybe (ConcreteOutput (OwnerType out) () (ValueType out) (ReferenceScriptType out))
isOutputWithoutDatum :: forall out.
IsTxInfoOutput out =>
out
-> Maybe
(ConcreteOutput
(OwnerType out) () (ValueType out) (ReferenceScriptType out))
isOutputWithoutDatum out
out | OutputDatum
Api.NoOutputDatum <- out -> OutputDatum
forall o.
(IsAbstractOutput o, ToOutputDatum (DatumType o)) =>
o -> OutputDatum
outputOutputDatum out
out = ConcreteOutput
(OwnerType out) () (ValueType out) (ReferenceScriptType out)
-> Maybe
(ConcreteOutput
(OwnerType out) () (ValueType out) (ReferenceScriptType out))
forall a. a -> Maybe a
Just (ConcreteOutput
(OwnerType out) () (ValueType out) (ReferenceScriptType out)
-> Maybe
(ConcreteOutput
(OwnerType out) () (ValueType out) (ReferenceScriptType out)))
-> ConcreteOutput
(OwnerType out) () (ValueType out) (ReferenceScriptType out)
-> Maybe
(ConcreteOutput
(OwnerType out) () (ValueType out) (ReferenceScriptType out))
forall a b. (a -> b) -> a -> b
$ out
-> ()
-> ConcreteOutput
(OwnerType out) () (ValueType out) (ReferenceScriptType out)
forall out dat.
IsAbstractOutput out =>
out
-> dat
-> ConcreteOutput
(OwnerType out) dat (ValueType out) (ReferenceScriptType out)
setDatum out
out ()
isOutputWithoutDatum out
_ = Maybe
(ConcreteOutput
(OwnerType out) () (ValueType out) (ReferenceScriptType out))
forall a. Maybe a
Nothing
isOutputWithInlineDatum :: (IsTxInfoOutput out) => out -> Maybe (ConcreteOutput (OwnerType out) Api.Datum (ValueType out) (ReferenceScriptType out))
isOutputWithInlineDatum :: forall out.
IsTxInfoOutput out =>
out
-> Maybe
(ConcreteOutput
(OwnerType out) Datum (ValueType out) (ReferenceScriptType out))
isOutputWithInlineDatum out
out | Api.OutputDatum datum :: Datum
datum@(Api.Datum BuiltinData
_) <- out -> OutputDatum
forall o.
(IsAbstractOutput o, ToOutputDatum (DatumType o)) =>
o -> OutputDatum
outputOutputDatum out
out = ConcreteOutput
(OwnerType out) Datum (ValueType out) (ReferenceScriptType out)
-> Maybe
(ConcreteOutput
(OwnerType out) Datum (ValueType out) (ReferenceScriptType out))
forall a. a -> Maybe a
Just (ConcreteOutput
(OwnerType out) Datum (ValueType out) (ReferenceScriptType out)
-> Maybe
(ConcreteOutput
(OwnerType out) Datum (ValueType out) (ReferenceScriptType out)))
-> ConcreteOutput
(OwnerType out) Datum (ValueType out) (ReferenceScriptType out)
-> Maybe
(ConcreteOutput
(OwnerType out) Datum (ValueType out) (ReferenceScriptType out))
forall a b. (a -> b) -> a -> b
$ out
-> Datum
-> ConcreteOutput
(OwnerType out) Datum (ValueType out) (ReferenceScriptType out)
forall out dat.
IsAbstractOutput out =>
out
-> dat
-> ConcreteOutput
(OwnerType out) dat (ValueType out) (ReferenceScriptType out)
setDatum out
out Datum
datum
isOutputWithInlineDatum out
_ = Maybe
(ConcreteOutput
(OwnerType out) Datum (ValueType out) (ReferenceScriptType out))
forall a. Maybe a
Nothing
isOutputWithInlineDatumOfType :: (Api.FromData a, IsTxInfoOutput out) => out -> Maybe (ConcreteOutput (OwnerType out) a (ValueType out) (ReferenceScriptType out))
isOutputWithInlineDatumOfType :: forall a out.
(FromData a, IsTxInfoOutput out) =>
out
-> Maybe
(ConcreteOutput
(OwnerType out) a (ValueType out) (ReferenceScriptType out))
isOutputWithInlineDatumOfType out
out | Api.OutputDatum (Api.Datum BuiltinData
datum) <- out -> OutputDatum
forall o.
(IsAbstractOutput o, ToOutputDatum (DatumType o)) =>
o -> OutputDatum
outputOutputDatum out
out = out
-> a
-> ConcreteOutput
(OwnerType out) a (ValueType out) (ReferenceScriptType out)
forall out dat.
IsAbstractOutput out =>
out
-> dat
-> ConcreteOutput
(OwnerType out) dat (ValueType out) (ReferenceScriptType out)
setDatum out
out (a
-> ConcreteOutput
(OwnerType out) a (ValueType out) (ReferenceScriptType out))
-> Maybe a
-> Maybe
(ConcreteOutput
(OwnerType out) a (ValueType out) (ReferenceScriptType out))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> BuiltinData -> Maybe a
forall a. FromData a => BuiltinData -> Maybe a
Api.fromBuiltinData BuiltinData
datum
isOutputWithInlineDatumOfType out
_ = Maybe
(ConcreteOutput
(OwnerType out) a (ValueType out) (ReferenceScriptType out))
forall a. Maybe a
Nothing
isOutputWithDatumHash :: (IsTxInfoOutput out) => out -> Maybe (ConcreteOutput (OwnerType out) Api.DatumHash (ValueType out) (ReferenceScriptType out))
isOutputWithDatumHash :: forall out.
IsTxInfoOutput out =>
out
-> Maybe
(ConcreteOutput
(OwnerType out)
DatumHash
(ValueType out)
(ReferenceScriptType out))
isOutputWithDatumHash out
out | Api.OutputDatumHash DatumHash
hash <- out -> OutputDatum
forall o.
(IsAbstractOutput o, ToOutputDatum (DatumType o)) =>
o -> OutputDatum
outputOutputDatum out
out = ConcreteOutput
(OwnerType out) DatumHash (ValueType out) (ReferenceScriptType out)
-> Maybe
(ConcreteOutput
(OwnerType out)
DatumHash
(ValueType out)
(ReferenceScriptType out))
forall a. a -> Maybe a
Just (ConcreteOutput
(OwnerType out) DatumHash (ValueType out) (ReferenceScriptType out)
-> Maybe
(ConcreteOutput
(OwnerType out)
DatumHash
(ValueType out)
(ReferenceScriptType out)))
-> ConcreteOutput
(OwnerType out) DatumHash (ValueType out) (ReferenceScriptType out)
-> Maybe
(ConcreteOutput
(OwnerType out)
DatumHash
(ValueType out)
(ReferenceScriptType out))
forall a b. (a -> b) -> a -> b
$ out
-> DatumHash
-> ConcreteOutput
(OwnerType out) DatumHash (ValueType out) (ReferenceScriptType out)
forall out dat.
IsAbstractOutput out =>
out
-> dat
-> ConcreteOutput
(OwnerType out) dat (ValueType out) (ReferenceScriptType out)
setDatum out
out DatumHash
hash
isOutputWithDatumHash out
_ = Maybe
(ConcreteOutput
(OwnerType out)
DatumHash
(ValueType out)
(ReferenceScriptType out))
forall a. Maybe a
Nothing
isScriptOutput :: (IsTxInfoOutput out) => out -> Maybe (ConcreteOutput Api.ScriptHash (DatumType out) (ValueType out) (ReferenceScriptType out))
isScriptOutput :: forall out.
IsTxInfoOutput out =>
out
-> Maybe
(ConcreteOutput
ScriptHash
(DatumType out)
(ValueType out)
(ReferenceScriptType out))
isScriptOutput out
out | Api.Address (Api.ScriptCredential ScriptHash
scriptHash) Maybe StakingCredential
_ <- out -> Address
forall o.
(IsAbstractOutput o, ToCredential (OwnerType o)) =>
o -> Address
outputAddress out
out = ConcreteOutput
ScriptHash
(DatumType out)
(ValueType out)
(ReferenceScriptType out)
-> Maybe
(ConcreteOutput
ScriptHash
(DatumType out)
(ValueType out)
(ReferenceScriptType out))
forall a. a -> Maybe a
Just (ConcreteOutput
ScriptHash
(DatumType out)
(ValueType out)
(ReferenceScriptType out)
-> Maybe
(ConcreteOutput
ScriptHash
(DatumType out)
(ValueType out)
(ReferenceScriptType out)))
-> ConcreteOutput
ScriptHash
(DatumType out)
(ValueType out)
(ReferenceScriptType out)
-> Maybe
(ConcreteOutput
ScriptHash
(DatumType out)
(ValueType out)
(ReferenceScriptType out))
forall a b. (a -> b) -> a -> b
$ out
-> ScriptHash
-> ConcreteOutput
ScriptHash
(DatumType out)
(ValueType out)
(ReferenceScriptType out)
forall out owner.
IsAbstractOutput out =>
out
-> owner
-> ConcreteOutput
owner (DatumType out) (ValueType out) (ReferenceScriptType out)
setOwner out
out ScriptHash
scriptHash
isScriptOutput out
_ = Maybe
(ConcreteOutput
ScriptHash
(DatumType out)
(ValueType out)
(ReferenceScriptType out))
forall a. Maybe a
Nothing
isScriptOutputFrom :: (IsTxInfoOutput out, ToScriptHash s) => s -> out -> Maybe (ConcreteOutput s (DatumType out) (ValueType out) (ReferenceScriptType out))
isScriptOutputFrom :: forall out s.
(IsTxInfoOutput out, ToScriptHash s) =>
s
-> out
-> Maybe
(ConcreteOutput
s (DatumType out) (ValueType out) (ReferenceScriptType out))
isScriptOutputFrom s
validator out
out = do
ConcreteOutput
ScriptHash
(DatumType out)
(ValueType out)
(ReferenceScriptType out)
x <- out
-> Maybe
(ConcreteOutput
ScriptHash
(DatumType out)
(ValueType out)
(ReferenceScriptType out))
forall out.
IsTxInfoOutput out =>
out
-> Maybe
(ConcreteOutput
ScriptHash
(DatumType out)
(ValueType out)
(ReferenceScriptType out))
isScriptOutput out
out
if s -> ScriptHash
forall a. ToScriptHash a => a -> ScriptHash
toScriptHash s
validator ScriptHash -> ScriptHash -> Bool
forall a. Eq a => a -> a -> Bool
== ConcreteOutput
ScriptHash
(DatumType out)
(ValueType out)
(ReferenceScriptType out)
x ConcreteOutput
ScriptHash
(DatumType out)
(ValueType out)
(ReferenceScriptType out)
-> Optic'
A_Lens
NoIx
(ConcreteOutput
ScriptHash
(DatumType out)
(ValueType out)
(ReferenceScriptType out))
ScriptHash
-> ScriptHash
forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. Optic'
A_Lens
NoIx
(ConcreteOutput
ScriptHash
(DatumType out)
(ValueType out)
(ReferenceScriptType out))
ScriptHash
Lens'
(ConcreteOutput
ScriptHash
(DatumType out)
(ValueType out)
(ReferenceScriptType out))
(OwnerType
(ConcreteOutput
ScriptHash
(DatumType out)
(ValueType out)
(ReferenceScriptType out)))
forall o. IsAbstractOutput o => Lens' o (OwnerType o)
outputOwnerL
then ConcreteOutput
s (DatumType out) (ValueType out) (ReferenceScriptType out)
-> Maybe
(ConcreteOutput
s (DatumType out) (ValueType out) (ReferenceScriptType out))
forall a. a -> Maybe a
Just (ConcreteOutput
s (DatumType out) (ValueType out) (ReferenceScriptType out)
-> Maybe
(ConcreteOutput
s (DatumType out) (ValueType out) (ReferenceScriptType out)))
-> ConcreteOutput
s (DatumType out) (ValueType out) (ReferenceScriptType out)
-> Maybe
(ConcreteOutput
s (DatumType out) (ValueType out) (ReferenceScriptType out))
forall a b. (a -> b) -> a -> b
$ ConcreteOutput
ScriptHash
(DatumType out)
(ValueType out)
(ReferenceScriptType out)
-> s
-> ConcreteOutput
s
(DatumType
(ConcreteOutput
ScriptHash
(DatumType out)
(ValueType out)
(ReferenceScriptType out)))
(ValueType
(ConcreteOutput
ScriptHash
(DatumType out)
(ValueType out)
(ReferenceScriptType out)))
(ReferenceScriptType
(ConcreteOutput
ScriptHash
(DatumType out)
(ValueType out)
(ReferenceScriptType out)))
forall out owner.
IsAbstractOutput out =>
out
-> owner
-> ConcreteOutput
owner (DatumType out) (ValueType out) (ReferenceScriptType out)
setOwner ConcreteOutput
ScriptHash
(DatumType out)
(ValueType out)
(ReferenceScriptType out)
x s
validator
else Maybe
(ConcreteOutput
s (DatumType out) (ValueType out) (ReferenceScriptType out))
forall a. Maybe a
Nothing
isPKOutput :: (IsTxInfoOutput out) => out -> Maybe (ConcreteOutput Api.PubKeyHash (DatumType out) (ValueType out) (ReferenceScriptType out))
isPKOutput :: forall out.
IsTxInfoOutput out =>
out
-> Maybe
(ConcreteOutput
PubKeyHash
(DatumType out)
(ValueType out)
(ReferenceScriptType out))
isPKOutput out
out | Api.Address (Api.PubKeyCredential PubKeyHash
pkh) Maybe StakingCredential
_ <- out -> Address
forall o.
(IsAbstractOutput o, ToCredential (OwnerType o)) =>
o -> Address
outputAddress out
out = ConcreteOutput
PubKeyHash
(DatumType out)
(ValueType out)
(ReferenceScriptType out)
-> Maybe
(ConcreteOutput
PubKeyHash
(DatumType out)
(ValueType out)
(ReferenceScriptType out))
forall a. a -> Maybe a
Just (ConcreteOutput
PubKeyHash
(DatumType out)
(ValueType out)
(ReferenceScriptType out)
-> Maybe
(ConcreteOutput
PubKeyHash
(DatumType out)
(ValueType out)
(ReferenceScriptType out)))
-> ConcreteOutput
PubKeyHash
(DatumType out)
(ValueType out)
(ReferenceScriptType out)
-> Maybe
(ConcreteOutput
PubKeyHash
(DatumType out)
(ValueType out)
(ReferenceScriptType out))
forall a b. (a -> b) -> a -> b
$ out
-> PubKeyHash
-> ConcreteOutput
PubKeyHash
(DatumType out)
(ValueType out)
(ReferenceScriptType out)
forall out owner.
IsAbstractOutput out =>
out
-> owner
-> ConcreteOutput
owner (DatumType out) (ValueType out) (ReferenceScriptType out)
setOwner out
out PubKeyHash
pkh
isPKOutput out
_ = Maybe
(ConcreteOutput
PubKeyHash
(DatumType out)
(ValueType out)
(ReferenceScriptType out))
forall a. Maybe a
Nothing
isPKOutputFrom :: (IsTxInfoOutput out) => Api.PubKeyHash -> out -> Maybe (ConcreteOutput Api.PubKeyHash (DatumType out) (ValueType out) (ReferenceScriptType out))
isPKOutputFrom :: forall out.
IsTxInfoOutput out =>
PubKeyHash
-> out
-> Maybe
(ConcreteOutput
PubKeyHash
(DatumType out)
(ValueType out)
(ReferenceScriptType out))
isPKOutputFrom PubKeyHash
pkh out
out = do
ConcreteOutput
PubKeyHash
(DatumType out)
(ValueType out)
(ReferenceScriptType out)
x <- out
-> Maybe
(ConcreteOutput
PubKeyHash
(DatumType out)
(ValueType out)
(ReferenceScriptType out))
forall out.
IsTxInfoOutput out =>
out
-> Maybe
(ConcreteOutput
PubKeyHash
(DatumType out)
(ValueType out)
(ReferenceScriptType out))
isPKOutput out
out
if PubKeyHash
pkh PubKeyHash -> PubKeyHash -> Bool
forall a. Eq a => a -> a -> Bool
== ConcreteOutput
PubKeyHash
(DatumType out)
(ValueType out)
(ReferenceScriptType out)
x ConcreteOutput
PubKeyHash
(DatumType out)
(ValueType out)
(ReferenceScriptType out)
-> Optic'
A_Lens
NoIx
(ConcreteOutput
PubKeyHash
(DatumType out)
(ValueType out)
(ReferenceScriptType out))
PubKeyHash
-> PubKeyHash
forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. Optic'
A_Lens
NoIx
(ConcreteOutput
PubKeyHash
(DatumType out)
(ValueType out)
(ReferenceScriptType out))
PubKeyHash
Lens'
(ConcreteOutput
PubKeyHash
(DatumType out)
(ValueType out)
(ReferenceScriptType out))
(OwnerType
(ConcreteOutput
PubKeyHash
(DatumType out)
(ValueType out)
(ReferenceScriptType out)))
forall o. IsAbstractOutput o => Lens' o (OwnerType o)
outputOwnerL
then ConcreteOutput
PubKeyHash
(DatumType out)
(ValueType out)
(ReferenceScriptType out)
-> Maybe
(ConcreteOutput
PubKeyHash
(DatumType out)
(ValueType out)
(ReferenceScriptType out))
forall a. a -> Maybe a
Just ConcreteOutput
PubKeyHash
(DatumType out)
(ValueType out)
(ReferenceScriptType out)
x
else Maybe
(ConcreteOutput
PubKeyHash
(DatumType out)
(ValueType out)
(ReferenceScriptType out))
forall a. Maybe a
Nothing
isStakingCredentialOutputFrom :: (IsTxInfoOutput out, ToCredential cred) => cred -> out -> Maybe (ConcreteOutput (OwnerType out) (DatumType out) (ValueType out) (ReferenceScriptType out))
isStakingCredentialOutputFrom :: forall out cred.
(IsTxInfoOutput out, ToCredential cred) =>
cred
-> out
-> Maybe
(ConcreteOutput
(OwnerType out)
(DatumType out)
(ValueType out)
(ReferenceScriptType out))
isStakingCredentialOutputFrom cred
cred out
out | Just (Api.StakingHash Credential
cred') <- out
out out
-> Optic' A_Lens NoIx out (Maybe StakingCredential)
-> Maybe StakingCredential
forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. Optic' A_Lens NoIx out (Maybe StakingCredential)
forall o. IsAbstractOutput o => Lens' o (Maybe StakingCredential)
outputStakingCredentialL, cred -> Credential
forall a. ToCredential a => a -> Credential
toCredential cred
cred Credential -> Credential -> Bool
forall a. Eq a => a -> a -> Bool
== Credential
cred' = ConcreteOutput
(OwnerType out)
(DatumType out)
(ValueType out)
(ReferenceScriptType out)
-> Maybe
(ConcreteOutput
(OwnerType out)
(DatumType out)
(ValueType out)
(ReferenceScriptType out))
forall a. a -> Maybe a
Just (ConcreteOutput
(OwnerType out)
(DatumType out)
(ValueType out)
(ReferenceScriptType out)
-> Maybe
(ConcreteOutput
(OwnerType out)
(DatumType out)
(ValueType out)
(ReferenceScriptType out)))
-> ConcreteOutput
(OwnerType out)
(DatumType out)
(ValueType out)
(ReferenceScriptType out)
-> Maybe
(ConcreteOutput
(OwnerType out)
(DatumType out)
(ValueType out)
(ReferenceScriptType out))
forall a b. (a -> b) -> a -> b
$ out
-> ConcreteOutput
(OwnerType out)
(DatumType out)
(ValueType out)
(ReferenceScriptType out)
forall out.
IsAbstractOutput out =>
out
-> ConcreteOutput
(OwnerType out)
(DatumType out)
(ValueType out)
(ReferenceScriptType out)
fromAbstractOutput out
out
isStakingCredentialOutputFrom cred
_ out
_ = Maybe
(ConcreteOutput
(OwnerType out)
(DatumType out)
(ValueType out)
(ReferenceScriptType out))
forall a. Maybe a
Nothing
isEmptyStakingCredentialOutput :: (IsTxInfoOutput out) => out -> Maybe (ConcreteOutput (OwnerType out) (DatumType out) (ValueType out) (ReferenceScriptType out))
isEmptyStakingCredentialOutput :: forall out.
IsTxInfoOutput out =>
out
-> Maybe
(ConcreteOutput
(OwnerType out)
(DatumType out)
(ValueType out)
(ReferenceScriptType out))
isEmptyStakingCredentialOutput out
out | Maybe StakingCredential
Nothing <- out
out out
-> Optic' A_Lens NoIx out (Maybe StakingCredential)
-> Maybe StakingCredential
forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. Optic' A_Lens NoIx out (Maybe StakingCredential)
forall o. IsAbstractOutput o => Lens' o (Maybe StakingCredential)
outputStakingCredentialL = ConcreteOutput
(OwnerType out)
(DatumType out)
(ValueType out)
(ReferenceScriptType out)
-> Maybe
(ConcreteOutput
(OwnerType out)
(DatumType out)
(ValueType out)
(ReferenceScriptType out))
forall a. a -> Maybe a
Just (ConcreteOutput
(OwnerType out)
(DatumType out)
(ValueType out)
(ReferenceScriptType out)
-> Maybe
(ConcreteOutput
(OwnerType out)
(DatumType out)
(ValueType out)
(ReferenceScriptType out)))
-> ConcreteOutput
(OwnerType out)
(DatumType out)
(ValueType out)
(ReferenceScriptType out)
-> Maybe
(ConcreteOutput
(OwnerType out)
(DatumType out)
(ValueType out)
(ReferenceScriptType out))
forall a b. (a -> b) -> a -> b
$ out
-> ConcreteOutput
(OwnerType out)
(DatumType out)
(ValueType out)
(ReferenceScriptType out)
forall out.
IsAbstractOutput out =>
out
-> ConcreteOutput
(OwnerType out)
(DatumType out)
(ValueType out)
(ReferenceScriptType out)
fromAbstractOutput out
out
isEmptyStakingCredentialOutput out
_ = Maybe
(ConcreteOutput
(OwnerType out)
(DatumType out)
(ValueType out)
(ReferenceScriptType out))
forall a. Maybe a
Nothing
isOnlyAdaOutput :: (IsTxInfoOutput out) => out -> Maybe (ConcreteOutput (OwnerType out) (DatumType out) Script.Ada (ReferenceScriptType out))
isOnlyAdaOutput :: forall out.
IsTxInfoOutput out =>
out
-> Maybe
(ConcreteOutput
(OwnerType out) (DatumType out) Ada (ReferenceScriptType out))
isOnlyAdaOutput out
out | Value -> Bool
Script.isAdaOnlyValue (out -> Value
forall o. (IsAbstractOutput o, ToValue (ValueType o)) => o -> Value
outputValue out
out) = ConcreteOutput
(OwnerType out) (DatumType out) Ada (ReferenceScriptType out)
-> Maybe
(ConcreteOutput
(OwnerType out) (DatumType out) Ada (ReferenceScriptType out))
forall a. a -> Maybe a
Just (ConcreteOutput
(OwnerType out) (DatumType out) Ada (ReferenceScriptType out)
-> Maybe
(ConcreteOutput
(OwnerType out) (DatumType out) Ada (ReferenceScriptType out)))
-> ConcreteOutput
(OwnerType out) (DatumType out) Ada (ReferenceScriptType out)
-> Maybe
(ConcreteOutput
(OwnerType out) (DatumType out) Ada (ReferenceScriptType out))
forall a b. (a -> b) -> a -> b
$ out
-> Ada
-> ConcreteOutput
(OwnerType out) (DatumType out) Ada (ReferenceScriptType out)
forall out val.
IsAbstractOutput out =>
out
-> val
-> ConcreteOutput
(OwnerType out) (DatumType out) val (ReferenceScriptType out)
setValue out
out (Ada
-> ConcreteOutput
(OwnerType out) (DatumType out) Ada (ReferenceScriptType out))
-> Ada
-> ConcreteOutput
(OwnerType out) (DatumType out) Ada (ReferenceScriptType out)
forall a b. (a -> b) -> a -> b
$ Value -> Ada
Script.fromValue (Value -> Ada) -> Value -> Ada
forall a b. (a -> b) -> a -> b
$ out -> Value
forall o. (IsAbstractOutput o, ToValue (ValueType o)) => o -> Value
outputValue out
out
isOnlyAdaOutput out
_ = Maybe
(ConcreteOutput
(OwnerType out) (DatumType out) Ada (ReferenceScriptType out))
forall a. Maybe a
Nothing
toOutputWithReferenceScriptHash :: (IsTxInfoOutput out) => out -> ConcreteOutput (OwnerType out) (DatumType out) (ValueType out) Api.ScriptHash
toOutputWithReferenceScriptHash :: forall out.
IsTxInfoOutput out =>
out
-> ConcreteOutput
(OwnerType out) (DatumType out) (ValueType out) ScriptHash
toOutputWithReferenceScriptHash out
out = (out
-> ConcreteOutput
(OwnerType out)
(DatumType out)
(ValueType out)
(ReferenceScriptType out)
forall out.
IsAbstractOutput out =>
out
-> ConcreteOutput
(OwnerType out)
(DatumType out)
(ValueType out)
(ReferenceScriptType out)
fromAbstractOutput out
out) {concreteOutputReferenceScript = toScriptHash <$> out ^. outputReferenceScriptL}
isReferenceScriptOutputFrom :: (IsTxInfoOutput out, ToScriptHash s) => s -> out -> Maybe (ConcreteOutput (OwnerType out) (DatumType out) (ValueType out) Api.ScriptHash)
isReferenceScriptOutputFrom :: forall out s.
(IsTxInfoOutput out, ToScriptHash s) =>
s
-> out
-> Maybe
(ConcreteOutput
(OwnerType out) (DatumType out) (ValueType out) ScriptHash)
isReferenceScriptOutputFrom s
script out
out | Just ReferenceScriptType out
x <- out
out out
-> Optic' A_Lens NoIx out (Maybe (ReferenceScriptType out))
-> Maybe (ReferenceScriptType out)
forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. Optic' A_Lens NoIx out (Maybe (ReferenceScriptType out))
forall o.
IsAbstractOutput o =>
Lens' o (Maybe (ReferenceScriptType o))
outputReferenceScriptL, ReferenceScriptType out -> ScriptHash
forall a. ToScriptHash a => a -> ScriptHash
toScriptHash ReferenceScriptType out
x ScriptHash -> ScriptHash -> Bool
forall a. Eq a => a -> a -> Bool
== s -> ScriptHash
forall a. ToScriptHash a => a -> ScriptHash
toScriptHash s
script = ConcreteOutput
(OwnerType out) (DatumType out) (ValueType out) ScriptHash
-> Maybe
(ConcreteOutput
(OwnerType out) (DatumType out) (ValueType out) ScriptHash)
forall a. a -> Maybe a
Just (ConcreteOutput
(OwnerType out) (DatumType out) (ValueType out) ScriptHash
-> Maybe
(ConcreteOutput
(OwnerType out) (DatumType out) (ValueType out) ScriptHash))
-> ConcreteOutput
(OwnerType out) (DatumType out) (ValueType out) ScriptHash
-> Maybe
(ConcreteOutput
(OwnerType out) (DatumType out) (ValueType out) ScriptHash)
forall a b. (a -> b) -> a -> b
$ out
-> ConcreteOutput
(OwnerType out) (DatumType out) (ValueType out) ScriptHash
forall out.
IsTxInfoOutput out =>
out
-> ConcreteOutput
(OwnerType out) (DatumType out) (ValueType out) ScriptHash
toOutputWithReferenceScriptHash out
out
isReferenceScriptOutputFrom s
_ out
_ = Maybe
(ConcreteOutput
(OwnerType out) (DatumType out) (ValueType out) ScriptHash)
forall a. Maybe a
Nothing