From 4486d216a3f70ee5719b9501c171634ae3b4f508 Mon Sep 17 00:00:00 2001 From: mmontin Date: Wed, 13 Mar 2024 13:31:26 +0000 Subject: [PATCH] deploy: 5fe13dd3b51b8142a669d20adc476607342ca6d6 --- Cooked-Attack-AddToken.html | 6 +- Cooked-Attack-DatumHijacking.html | 10 +- Cooked-Attack-DoubleSat.html | 8 +- Cooked-Attack-DupToken.html | 6 +- Cooked-Currencies.html | 4 +- Cooked-Ltl.html | 12 +- Cooked-MockChain-Balancing.html | 4 +- Cooked-MockChain-BlockChain.html | 32 +- Cooked-MockChain-Direct.html | 10 +- Cooked-MockChain-GenerateTx.html | 4 +- Cooked-MockChain-Staged.html | 8 +- Cooked-MockChain-Testing.html | 10 +- Cooked-MockChain-UtxoSearch.html | 14 +- Cooked-MockChain-UtxoState.html | 6 +- Cooked-MockChain.html | 70 +- Cooked-Output.html | 14 +- Cooked-Pretty-Class.html | 6 +- Cooked-Pretty-Common.html | 2 +- Cooked-Pretty-Cooked.html | 8 +- Cooked-Pretty-Options.html | 4 +- Cooked-Pretty.html | 6 +- Cooked-RawUPLC.html | 10 +- Cooked-ShowBS.html | 6 +- Cooked-Skeleton.html | 60 +- Cooked-Tweak-AddInputsAndOutputs.html | 10 +- Cooked-Tweak-Common.html | 16 +- Cooked-Tweak-TamperDatum.html | 6 +- Cooked-Tweak-ValidityRange.html | 4 +- Cooked-Tweak.html | 28 +- Cooked-ValueUtils.html | 6 +- Cooked-Wallet.html | 8 +- Cooked.html | 2 +- cooked-validators.haddock | Bin 89731 -> 89731 bytes doc-index.json | 2 +- src/Cooked.Attack.AddToken.html | 112 +- src/Cooked.Attack.DatumHijacking.html | 170 +- src/Cooked.Attack.DoubleSat.html | 244 +-- src/Cooked.Attack.DupToken.html | 172 +- src/Cooked.Currencies.html | 88 +- src/Cooked.Ltl.html | 752 ++++---- src/Cooked.MockChain.Balancing.html | 2094 ++++++++++----------- src/Cooked.MockChain.BlockChain.html | 1082 +++++------ src/Cooked.MockChain.Direct.html | 1406 +++++++------- src/Cooked.MockChain.GenerateTx.html | 1282 ++++++------- src/Cooked.MockChain.Staged.html | 574 +++--- src/Cooked.MockChain.Testing.html | 724 +++---- src/Cooked.MockChain.UtxoSearch.html | 262 +-- src/Cooked.MockChain.UtxoState.html | 174 +- src/Cooked.Output.html | 836 ++++---- src/Cooked.Pretty.Class.html | 564 +++--- src/Cooked.Pretty.Common.html | 150 +- src/Cooked.Pretty.Cooked.html | 1696 ++++++++--------- src/Cooked.Pretty.Options.html | 34 +- src/Cooked.RawUPLC.html | 114 +- src/Cooked.ShowBS.html | 1358 ++++++------- src/Cooked.Skeleton.html | 1938 +++++++++---------- src/Cooked.Tweak.AddInputsAndOutputs.html | 234 +-- src/Cooked.Tweak.Common.html | 514 ++--- src/Cooked.Tweak.Labels.html | 30 +- src/Cooked.Tweak.OutPermutations.html | 336 ++-- src/Cooked.Tweak.Signers.html | 92 +- src/Cooked.Tweak.TamperDatum.html | 278 +-- src/Cooked.Tweak.ValidityRange.html | 294 +-- src/Cooked.ValueUtils.html | 136 +- src/Cooked.Wallet.html | 286 +-- src/Paths_cooked_validators.html | 211 ++- 66 files changed, 9321 insertions(+), 9318 deletions(-) diff --git a/Cooked-Attack-AddToken.html b/Cooked-Attack-AddToken.html index 0f957960a..e6cbaaa0c 100644 --- a/Cooked-Attack-AddToken.html +++ b/Cooked-Attack-AddToken.html @@ -1,11 +1,11 @@ -Cooked.Attack.AddToken
cooked-validators-2.0.0
Safe HaskellNone
LanguageHaskell2010

Cooked.Attack.AddToken

Synopsis

Documentation

addTokenAttack Source #

Arguments

:: MonadTweak m 
=> (Versioned MintingPolicy -> [(TokenName, Integer)])

For each policy that occurs in some Mints constraint, return a list of +Cooked.Attack.AddToken

cooked-validators-2.0.0
Safe HaskellNone
LanguageHaskell2010

Cooked.Attack.AddToken

Documentation

addTokenAttack Source #

Arguments

:: MonadTweak m 
=> (Versioned MintingPolicy -> [(TokenName, Integer)])

For each policy that occurs in some Mints constraint, return a list of token names together with how many tokens with that name should be minted.

For each of the elements of the returned list, one modified transaction with the additional tokens will be generated. (This means for example that, if there were three minting policies on the original transaction, and the lists returned for each of them have n,m, and o elements, respectively, - there'll be n*m*o modified transactions.)

The redeemer will be the one that's already being used on the transaction.

-> Wallet

The wallet of the attacker. Any extra tokens will be paid to this wallet.

-> m Value 

This attack adds extra tokens, depending on the minting policy. It is + there'll be n*m*o modified transactions.)

The redeemer will be the one that's already being used on the transaction.

-> Wallet

The wallet of the attacker. Any extra tokens will be paid to this wallet.

-> m Value 

This attack adds extra tokens, depending on the minting policy. It is different from the dupTokenAttack in that it does not merely try to increase the amount of tokens minted: It tries to mint tokens of asset classes that were not necessarily present on the unmodified transaction.

This attack adds an AddTokenLbl with the token name of the additional - minted token(s). It returns additional value minted.

newtype AddTokenLbl Source #

Constructors

AddTokenLbl TokenName 

Instances

Instances details
Eq AddTokenLbl Source # 
Instance details

Defined in Cooked.Attack.AddToken

Show AddTokenLbl Source # 
Instance details

Defined in Cooked.Attack.AddToken

\ No newline at end of file + minted token(s). It returns additional value minted.

newtype AddTokenLbl Source #

Constructors

AddTokenLbl TokenName 

Instances

Instances details
Eq AddTokenLbl Source # 
Instance details

Defined in Cooked.Attack.AddToken

Show AddTokenLbl Source # 
Instance details

Defined in Cooked.Attack.AddToken

\ No newline at end of file diff --git a/Cooked-Attack-DatumHijacking.html b/Cooked-Attack-DatumHijacking.html index 08edc517b..17454ff42 100644 --- a/Cooked-Attack-DatumHijacking.html +++ b/Cooked-Attack-DatumHijacking.html @@ -1,16 +1,16 @@ -Cooked.Attack.DatumHijacking
cooked-validators-2.0.0
Safe HaskellNone
LanguageHaskell2010

Cooked.Attack.DatumHijacking

Synopsis

Documentation

redirectScriptOutputTweak Source #

Arguments

:: (MonadTweak m, Is k A_Traversal, Show (DatumType a), ToData (DatumType a)) 
=> Optic' k is TxSkel (ConcreteOutput (TypedValidator a) TxSkelOutDatum Value (Versioned Script)) 
-> (ConcreteOutput (TypedValidator a) TxSkelOutDatum Value (Versioned Script) -> Maybe (TypedValidator a))

Return Just the new validator, or Nothing if you want to leave this +Cooked.Attack.DatumHijacking

cooked-validators-2.0.0
Safe HaskellNone
LanguageHaskell2010

Cooked.Attack.DatumHijacking

Documentation

redirectScriptOutputTweak Source #

Arguments

:: (MonadTweak m, Is k A_Traversal, Show (DatumType a), ToData (DatumType a)) 
=> Optic' k is TxSkel (ConcreteOutput (TypedValidator a) TxSkelOutDatum Value (Versioned Script)) 
-> (ConcreteOutput (TypedValidator a) TxSkelOutDatum Value (Versioned Script) -> Maybe (TypedValidator a))

Return Just the new validator, or Nothing if you want to leave this output unchanged.

-> (Integer -> Bool)

The redirection described by the previous argument might apply to more than one of the script outputs of the transaction. Use this predicate to select which of the redirectable script outputs to actually redirect. We count the redirectable script outputs from the left to the right, starting - with zero.

-> m [ConcreteOutput (TypedValidator a) TxSkelOutDatum Value (Versioned Script)] 

Redirect script outputs from one validator to another validator of the same + with zero.

-> m [ConcreteOutput (TypedValidator a) TxSkelOutDatum Value (Versioned Script)] 

Redirect script outputs from one validator to another validator of the same type. Returns the list of outputs it redirected (as they were before the modification), in the order in which they occurred on the original transaction.

Something like txSkelOutsL % traversed % txSkelOutOwnerTypeP (Pl.TypedValidator a)@ - might be useful to construct the optics used by this tweak.

datumHijackingAttack Source #

Arguments

:: forall a m. (MonadTweak m, Show (DatumType a), PrettyCooked (DatumType a), ToData (DatumType a), Typeable (DatumType a), Typeable a) 
=> (ConcreteOutput (TypedValidator a) TxSkelOutDatum Value (Versioned Script) -> Bool)

Predicate to select outputs to steal, depending on the intended + might be useful to construct the optics used by this tweak.

datumHijackingAttack Source #

Arguments

:: forall a m. (MonadTweak m, Show (DatumType a), PrettyCooked (DatumType a), ToData (DatumType a), Typeable (DatumType a), Typeable a) 
=> (ConcreteOutput (TypedValidator a) TxSkelOutDatum Value (Versioned Script) -> Bool)

Predicate to select outputs to steal, depending on the intended recipient, the datum, and the value.

-> (Integer -> Bool)

The selection predicate may match more than one output. Use this predicate to restrict to the i-th of the outputs (counting from the left, - starting at zero) chosen by the selection predicate with this predicate.

-> m [ConcreteOutput (TypedValidator a) TxSkelOutDatum Value (Versioned Script)] 

A datum hijacking attack, simplified: This attack tries to substitute a + starting at zero) chosen by the selection predicate with this predicate.

-> m [ConcreteOutput (TypedValidator a) TxSkelOutDatum Value (Versioned Script)] 

A datum hijacking attack, simplified: This attack tries to substitute a different recipient on PaysScript constraints, but leaves the datum as it is. That is, it tests for careless uses of something like txInfoOutputs in places where something like getContinuingOutputs should be used. If this @@ -19,6 +19,6 @@ toBuiltinData-translation stays the same will also work.

A DatumHijackingLbl with the hash of the "thief" validator is added to the labels of the TxSkel using addLabel.

This attack returns the list of outputs it redirected, in the order in which they occurred on the original transaction. If no output is redirected, this - attack fails.

datumHijackingTarget :: TypedValidator a Source #

The trivial validator that always succeds; this is a sufficient target for + attack fails.

datumHijackingTarget :: TypedValidator a Source #

The trivial validator that always succeds; this is a sufficient target for the datum hijacking attack since we only want to show feasibility of the attack.

\ No newline at end of file diff --git a/Cooked-Attack-DoubleSat.html b/Cooked-Attack-DoubleSat.html index 30ebe421b..79a10f485 100644 --- a/Cooked-Attack-DoubleSat.html +++ b/Cooked-Attack-DoubleSat.html @@ -1,7 +1,7 @@ -Cooked.Attack.DoubleSat
cooked-validators-2.0.0
Safe HaskellNone
LanguageHaskell2010

Cooked.Attack.DoubleSat

Synopsis

Documentation

type DoubleSatDelta = (Map TxOutRef TxSkelRedeemer, [TxSkelOut], TxSkelMints) Source #

A triple of transaction inputs, transaction outputs, and minted value. This +Cooked.Attack.DoubleSat

cooked-validators-2.0.0
Safe HaskellNone
LanguageHaskell2010

Cooked.Attack.DoubleSat

Synopsis

Documentation

type DoubleSatDelta = (Map TxOutRef TxSkelRedeemer, [TxSkelOut], TxSkelMints) Source #

A triple of transaction inputs, transaction outputs, and minted value. This is what we can add to the transaction in order to try a double satisfaction - attack.

doubleSatAttack Source #

Arguments

:: (MonadTweak m, Eq is, Is k A_Traversal) 
=> ([is] -> [[is]])

how to combine modifications from caused by different foci. See the - comment at combineModsTweak, which uses the same logic.

-> Optic' k (WithIx is) TxSkel a

Each focus of this optic is a potential reason to add some extra + attack.

doubleSatAttack Source #

Arguments

:: (MonadTweak m, Eq is, Is k A_Traversal) 
=> ([is] -> [[is]])

how to combine modifications from caused by different foci. See the + comment at combineModsTweak, which uses the same logic.

-> Optic' k (WithIx is) TxSkel a

Each focus of this optic is a potential reason to add some extra constraints.

As an example, one could go through the paysScript outputs for validators of type t with the following traversal:

txSkelOutsL % itaversed % txSkelOutputToTypedValidatorP @t
-> (is -> a -> m [(a, DoubleSatDelta)])

How to change each focus, and which inputs, outputs, and mints to add, for each of the foci. There might be different options for each focus, @@ -22,4 +22,4 @@ hoping that the additional minting policies or validator scripts thereby involved are fooled by what's already present on the transaction. Any extra value contained in new inputs to the transaction is then paid to the - attacker.

Orphan instances

\ No newline at end of file + attacker.

Orphan instances

\ No newline at end of file diff --git a/Cooked-Attack-DupToken.html b/Cooked-Attack-DupToken.html index 288922ca4..50f25d9e8 100644 --- a/Cooked-Attack-DupToken.html +++ b/Cooked-Attack-DupToken.html @@ -1,12 +1,12 @@ -Cooked.Attack.DupToken
cooked-validators-2.0.0
Safe HaskellNone
LanguageHaskell2010

Cooked.Attack.DupToken

Synopsis

Documentation

dupTokenAttack Source #

Arguments

:: MonadTweak m 
=> (AssetClass -> Integer -> Integer)

A function describing how the amount of tokens specified by a Mints +Cooked.Attack.DupToken

cooked-validators-2.0.0
Safe HaskellNone
LanguageHaskell2010

Cooked.Attack.DupToken

Documentation

dupTokenAttack Source #

Arguments

:: MonadTweak m 
=> (AssetClass -> Integer -> Integer)

A function describing how the amount of tokens specified by a Mints constraint should be changed, depending on the asset class and the amount specified by the constraint. The given function f should probably satisfy f ac i > i for all ac and i, i.e. it should increase the minted amount. If it does *not* increase the minted amount, the amount will be left unchanged.

-> Wallet

The wallet of the attacker. Any additional tokens that are minted by the modified transaction but were not minted by the original transaction are - paid to this wallet.

-> m Value 

A token duplication attack increases values in Mints-constraints of a + paid to this wallet.

-> m Value 

A token duplication attack increases values in Mints-constraints of a TxSkel according to some conditions, and pays the extra minted value to a given recipient wallet. This adds a DupTokenLbl to the labels of the transaction using addLabel. Returns the Value by which the minted value - was increased.

\ No newline at end of file + was increased.

\ No newline at end of file diff --git a/Cooked-Currencies.html b/Cooked-Currencies.html index fd86ebd85..15b64bb87 100644 --- a/Cooked-Currencies.html +++ b/Cooked-Currencies.html @@ -9,5 +9,5 @@ will, at any point in time.

The permanent prefixed functions provide access to tokens from the const (const False) minting policy. That is, these cannot ever be minted or burnt and must be present in an initial distribution (see - initialDistribution) to be useful.

Synopsis

Documentation

quickTokenName :: String -> TokenName Source #

Token name of a quick asset class; prefixes the name with a q to - make it easy to distinguish between quick and permanent tokens.

quickAssetClass :: String -> AssetClass Source #

Quick asset class from a token name

quickValue :: String -> Integer -> Value Source #

Constructor for quick values from token name and amount

permanentTokenName :: String -> TokenName Source #

Token name of a permanent asset class

permanentAssetClass :: String -> AssetClass Source #

Permanent asset class from a token name

permanentValue :: String -> Integer -> Value Source #

Constructor for Permanent values from token name and amount

quickCurrencyPolicy :: MintingPolicy Source #

quickCurrencySymbol :: CurrencySymbol Source #

permanentCurrencySymbol :: CurrencySymbol Source #

\ No newline at end of file + initialDistribution) to be useful.

Documentation

quickTokenName :: String -> TokenName Source #

Token name of a quick asset class; prefixes the name with a q to + make it easy to distinguish between quick and permanent tokens.

quickAssetClass :: String -> AssetClass Source #

Quick asset class from a token name

quickValue :: String -> Integer -> Value Source #

Constructor for quick values from token name and amount

permanentTokenName :: String -> TokenName Source #

Token name of a permanent asset class

permanentAssetClass :: String -> AssetClass Source #

Permanent asset class from a token name

permanentValue :: String -> Integer -> Value Source #

Constructor for Permanent values from token name and amount

\ No newline at end of file diff --git a/Cooked-Ltl.html b/Cooked-Ltl.html index d9664bef7..e2e7e5e30 100644 --- a/Cooked-Ltl.html +++ b/Cooked-Ltl.html @@ -1,4 +1,4 @@ -Cooked.Ltl
cooked-validators-2.0.0
Safe HaskellSafe-Inferred
LanguageHaskell2010

Cooked.Ltl

Synopsis

Documentation

data Ltl a Source #

Type of LTL formulas with atomic formulas of type a. Think of a as a +Cooked.Ltl

cooked-validators-2.0.0
Safe HaskellSafe-Inferred
LanguageHaskell2010

Cooked.Ltl

Synopsis

Documentation

data Ltl a Source #

Type of LTL formulas with atomic formulas of type a. Think of a as a type of "modifications", then a value of type Ltl a describes where to apply modifications. Since it does not make (obvious) sense to talk of a negated modification or of one modification (possibly in the future) to @@ -21,7 +21,7 @@ > a LtlRelease b and > b LtlAnd (a LtlOr LtlNext (a LtlRelease b)) - are equivalent.

Instances

Instances details
Show a => Show (Ltl a) Source # 
Instance details

Defined in Cooked.Ltl

Methods

showsPrec :: Int -> Ltl a -> ShowS #

show :: Ltl a -> String #

showList :: [Ltl a] -> ShowS #

nowLater :: Monoid a => Ltl a -> [(a, Ltl a)] Source #

Split an LTL formula that describes a modification of a computation into a + are equivalent.

Instances

Instances details
Show a => Show (Ltl a) Source # 
Instance details

Defined in Cooked.Ltl

Methods

showsPrec :: Int -> Ltl a -> ShowS Source #

show :: Ltl a -> String Source #

showList :: [Ltl a] -> ShowS Source #

nowLater :: Monoid a => Ltl a -> [(a, Ltl a)] Source #

Split an LTL formula that describes a modification of a computation into a list of (doNow, doLater) pairs, where

  • doNow is the modification to be applied to the current time step,
  • doLater is an LTL formula describing the modification that should be applied from the next time step onwards, and

The return value is a list because a formula might be satisfied in different ways. For example, the modification described by a LtlUntil b might be @@ -42,9 +42,9 @@ modify the following computations. Think of this operation as coming between time steps and adding a new formula to be applied before all of the formulas that should already be applied to the next time step.

StopLtl :: LtlOp modification builtin ()

The operation that removes the last LTL formula that was introduced. If - the formula is not yet finished, the current time line will fail.

Builtin :: builtin a -> LtlOp modification builtin a 

Instances

Instances details
MonadFail StagedMockChain Source # 
Instance details

Defined in Cooked.MockChain.Staged

Methods

fail :: String -> StagedMockChain a #

Alternative StagedMockChain Source # 
Instance details

Defined in Cooked.MockChain.Staged

MonadBlockChain StagedMockChain Source # 
Instance details

Defined in Cooked.MockChain.Staged

MonadBlockChainWithoutValidation StagedMockChain Source # 
Instance details

Defined in Cooked.MockChain.Staged

MonadBlockChainBalancing StagedMockChain Source # 
Instance details

Defined in Cooked.MockChain.Staged

Methods

getParams :: StagedMockChain Params Source #

utxosAtLedger :: Address -> StagedMockChain [(TxOutRef, TxOut)] Source #

datumFromHash :: DatumHash -> StagedMockChain (Maybe Datum) Source #

validatorFromHash :: ValidatorHash -> StagedMockChain (Maybe (Versioned Validator)) Source #

txOutByRefLedger :: TxOutRef -> StagedMockChain (Maybe TxOut) Source #

MonadError MockChainError StagedMockChain Source # 
Instance details

Defined in Cooked.MockChain.Staged

MonadModal (Staged (LtlOp modification builtin)) Source # 
Instance details

Defined in Cooked.Ltl

Associated Types

type Modification (Staged (LtlOp modification builtin)) Source #

Methods

modifyLtl :: Ltl (Modification (Staged (LtlOp modification builtin))) -> Staged (LtlOp modification builtin) a -> Staged (LtlOp modification builtin) a Source #

type Modification (Staged (LtlOp modification builtin)) Source # 
Instance details

Defined in Cooked.Ltl

type Modification (Staged (LtlOp modification builtin)) = modification

data Staged (op :: * -> *) :: * -> * where Source #

The freer monad on op. We think of this as the AST of a computation with - operations of types op a.

Constructors

Return :: a -> Staged op a 
Instr :: op a -> (a -> Staged op b) -> Staged op b 

Instances

Instances details
MonadFail StagedMockChain Source # 
Instance details

Defined in Cooked.MockChain.Staged

Methods

fail :: String -> StagedMockChain a #

Alternative StagedMockChain Source # 
Instance details

Defined in Cooked.MockChain.Staged

MonadBlockChain StagedMockChain Source # 
Instance details

Defined in Cooked.MockChain.Staged

MonadBlockChainWithoutValidation StagedMockChain Source # 
Instance details

Defined in Cooked.MockChain.Staged

MonadBlockChainBalancing StagedMockChain Source # 
Instance details

Defined in Cooked.MockChain.Staged

Methods

getParams :: StagedMockChain Params Source #

utxosAtLedger :: Address -> StagedMockChain [(TxOutRef, TxOut)] Source #

datumFromHash :: DatumHash -> StagedMockChain (Maybe Datum) Source #

validatorFromHash :: ValidatorHash -> StagedMockChain (Maybe (Versioned Validator)) Source #

txOutByRefLedger :: TxOutRef -> StagedMockChain (Maybe TxOut) Source #

MonadError MockChainError StagedMockChain Source # 
Instance details

Defined in Cooked.MockChain.Staged

Monad (Staged op) Source # 
Instance details

Defined in Cooked.Ltl

Methods

(>>=) :: Staged op a -> (a -> Staged op b) -> Staged op b #

(>>) :: Staged op a -> Staged op b -> Staged op b #

return :: a -> Staged op a #

Functor (Staged op) Source # 
Instance details

Defined in Cooked.Ltl

Methods

fmap :: (a -> b) -> Staged op a -> Staged op b #

(<$) :: a -> Staged op b -> Staged op a #

Applicative (Staged op) Source # 
Instance details

Defined in Cooked.Ltl

Methods

pure :: a -> Staged op a #

(<*>) :: Staged op (a -> b) -> Staged op a -> Staged op b #

liftA2 :: (a -> b -> c) -> Staged op a -> Staged op b -> Staged op c #

(*>) :: Staged op a -> Staged op b -> Staged op b #

(<*) :: Staged op a -> Staged op b -> Staged op a #

MonadModal (Staged (LtlOp modification builtin)) Source # 
Instance details

Defined in Cooked.Ltl

Associated Types

type Modification (Staged (LtlOp modification builtin)) Source #

Methods

modifyLtl :: Ltl (Modification (Staged (LtlOp modification builtin))) -> Staged (LtlOp modification builtin) a -> Staged (LtlOp modification builtin) a Source #

type Modification (Staged (LtlOp modification builtin)) Source # 
Instance details

Defined in Cooked.Ltl

type Modification (Staged (LtlOp modification builtin)) = modification

interpLtl :: InterpLtl modification builtin m => Staged (LtlOp modification builtin) a -> StateT [Ltl modification] m a Source #

Interpret a Staged computation into a suitable domain, using the function - interpBuiltin to interpret the builtins.

interpLtlAndPruneUnfinished :: InterpLtl modification builtin m => Staged (LtlOp modification builtin) a -> StateT [Ltl modification] m a Source #

Interpret a Staged computation into a suitable domain, using the function + the formula is not yet finished, the current time line will fail.

Builtin :: builtin a -> LtlOp modification builtin a 

Instances

Instances details
MonadFail StagedMockChain Source # 
Instance details

Defined in Cooked.MockChain.Staged

Alternative StagedMockChain Source # 
Instance details

Defined in Cooked.MockChain.Staged

MonadBlockChain StagedMockChain Source # 
Instance details

Defined in Cooked.MockChain.Staged

MonadBlockChainWithoutValidation StagedMockChain Source # 
Instance details

Defined in Cooked.MockChain.Staged

MonadBlockChainBalancing StagedMockChain Source # 
Instance details

Defined in Cooked.MockChain.Staged

MonadError MockChainError StagedMockChain Source # 
Instance details

Defined in Cooked.MockChain.Staged

MonadModal (Staged (LtlOp modification builtin)) Source # 
Instance details

Defined in Cooked.Ltl

Associated Types

type Modification (Staged (LtlOp modification builtin)) Source #

Methods

modifyLtl :: Ltl (Modification (Staged (LtlOp modification builtin))) -> Staged (LtlOp modification builtin) a -> Staged (LtlOp modification builtin) a Source #

type Modification (Staged (LtlOp modification builtin)) Source # 
Instance details

Defined in Cooked.Ltl

type Modification (Staged (LtlOp modification builtin)) = modification

data Staged (op :: * -> *) :: * -> * where Source #

The freer monad on op. We think of this as the AST of a computation with + operations of types op a.

Constructors

Return :: a -> Staged op a 
Instr :: op a -> (a -> Staged op b) -> Staged op b 

Instances

Instances details
MonadFail StagedMockChain Source # 
Instance details

Defined in Cooked.MockChain.Staged

Alternative StagedMockChain Source # 
Instance details

Defined in Cooked.MockChain.Staged

MonadBlockChain StagedMockChain Source # 
Instance details

Defined in Cooked.MockChain.Staged

MonadBlockChainWithoutValidation StagedMockChain Source # 
Instance details

Defined in Cooked.MockChain.Staged

MonadBlockChainBalancing StagedMockChain Source # 
Instance details

Defined in Cooked.MockChain.Staged

MonadError MockChainError StagedMockChain Source # 
Instance details

Defined in Cooked.MockChain.Staged

Monad (Staged op) Source # 
Instance details

Defined in Cooked.Ltl

Methods

(>>=) :: Staged op a -> (a -> Staged op b) -> Staged op b Source #

(>>) :: Staged op a -> Staged op b -> Staged op b Source #

return :: a -> Staged op a Source #

Functor (Staged op) Source # 
Instance details

Defined in Cooked.Ltl

Methods

fmap :: (a -> b) -> Staged op a -> Staged op b Source #

(<$) :: a -> Staged op b -> Staged op a Source #

Applicative (Staged op) Source # 
Instance details

Defined in Cooked.Ltl

Methods

pure :: a -> Staged op a Source #

(<*>) :: Staged op (a -> b) -> Staged op a -> Staged op b Source #

liftA2 :: (a -> b -> c) -> Staged op a -> Staged op b -> Staged op c Source #

(*>) :: Staged op a -> Staged op b -> Staged op b Source #

(<*) :: Staged op a -> Staged op b -> Staged op a Source #

MonadModal (Staged (LtlOp modification builtin)) Source # 
Instance details

Defined in Cooked.Ltl

Associated Types

type Modification (Staged (LtlOp modification builtin)) Source #

Methods

modifyLtl :: Ltl (Modification (Staged (LtlOp modification builtin))) -> Staged (LtlOp modification builtin) a -> Staged (LtlOp modification builtin) a Source #

type Modification (Staged (LtlOp modification builtin)) Source # 
Instance details

Defined in Cooked.Ltl

type Modification (Staged (LtlOp modification builtin)) = modification

interpLtl :: InterpLtl modification builtin m => Staged (LtlOp modification builtin) a -> StateT [Ltl modification] m a Source #

Interpret a Staged computation into a suitable domain, using the function + interpBuiltin to interpret the builtins.

interpLtlAndPruneUnfinished :: InterpLtl modification builtin m => Staged (LtlOp modification builtin) a -> StateT [Ltl modification] m a Source #

Interpret a Staged computation into a suitable domain, using the function interpBuiltin to interpret the builtins. At the end of the computation, prune branches that still have unfinished modifications applied to them. See the discussion on the regression test case for PRs 110 and 131 in @@ -60,4 +60,4 @@ . map (\(now, later) -> applyModification now op <* put later) . nowLaterList

(But to write this, modification has to be a Monoid to make nowLaterList work!) Look at the tests for this module and at - Cooked.MockChain.Monad.Staged for examples of how to use this type class.

Methods

interpBuiltin :: builtin a -> StateT [Ltl modification] m a Source #

class Monad m => MonadModal m where Source #

Monads that allow modificaitons with LTL formulas.

Associated Types

type Modification m :: Type Source #

Methods

modifyLtl :: Ltl (Modification m) -> m a -> m a Source #

Instances

Instances details
MonadModal (Staged (LtlOp modification builtin)) Source # 
Instance details

Defined in Cooked.Ltl

Associated Types

type Modification (Staged (LtlOp modification builtin)) Source #

Methods

modifyLtl :: Ltl (Modification (Staged (LtlOp modification builtin))) -> Staged (LtlOp modification builtin) a -> Staged (LtlOp modification builtin) a Source #

\ No newline at end of file + Cooked.MockChain.Monad.Staged for examples of how to use this type class.

Methods

interpBuiltin :: builtin a -> StateT [Ltl modification] m a Source #

class Monad m => MonadModal m where Source #

Monads that allow modificaitons with LTL formulas.

Associated Types

type Modification m :: Type Source #

Methods

modifyLtl :: Ltl (Modification m) -> m a -> m a Source #

Instances

Instances details
MonadModal (Staged (LtlOp modification builtin)) Source # 
Instance details

Defined in Cooked.Ltl

Associated Types

type Modification (Staged (LtlOp modification builtin)) Source #

Methods

modifyLtl :: Ltl (Modification (Staged (LtlOp modification builtin))) -> Staged (LtlOp modification builtin) a -> Staged (LtlOp modification builtin) a Source #

\ No newline at end of file diff --git a/Cooked-MockChain-Balancing.html b/Cooked-MockChain-Balancing.html index 7e7ef192e..454cb8604 100644 --- a/Cooked-MockChain-Balancing.html +++ b/Cooked-MockChain-Balancing.html @@ -1,2 +1,2 @@ -Cooked.MockChain.Balancing
cooked-validators-2.0.0
Safe HaskellNone
LanguageHaskell2010

Cooked.MockChain.Balancing

Synopsis

Documentation

balancedTx :: MonadBlockChainBalancing m => (TxSkel, Fee, Set TxOutRef) -> m (Tx BabbageEra) Source #

Take the output of balancedTxSkel and turn it into an actual Cardano - transaction.

txSkelInputData :: MonadBlockChainBalancing m => TxSkel -> m (Map DatumHash Datum) Source #

Look up the data on UTxOs the transaction consumes.

\ No newline at end of file +Cooked.MockChain.Balancing
cooked-validators-2.0.0
Safe HaskellNone
LanguageHaskell2010

Cooked.MockChain.Balancing

Documentation

balancedTx :: MonadBlockChainBalancing m => (TxSkel, Fee, Set TxOutRef) -> m (Tx BabbageEra) Source #

Take the output of balancedTxSkel and turn it into an actual Cardano + transaction.

txSkelInputData :: MonadBlockChainBalancing m => TxSkel -> m (Map DatumHash Datum) Source #

Look up the data on UTxOs the transaction consumes.

\ No newline at end of file diff --git a/Cooked-MockChain-BlockChain.html b/Cooked-MockChain-BlockChain.html index 5f125d925..267a7a310 100644 --- a/Cooked-MockChain-BlockChain.html +++ b/Cooked-MockChain-BlockChain.html @@ -1,30 +1,30 @@ -Cooked.MockChain.BlockChain
cooked-validators-2.0.0
Safe HaskellNone
LanguageHaskell2010

Cooked.MockChain.BlockChain

Synopsis

Documentation

data MockChainError where Source #

The errors that can be produced by the MockChainT monad

Constructors

MCEValidationError :: ValidationErrorInPhase -> MockChainError 
MCEUnbalanceable :: MCEUnbalanceableError -> TxSkel -> MockChainError 
MCENoSuitableCollateral :: MockChainError

Thrown when the balancing wallet owns no output that is pure Ada and - with no datum.

MCEGenerationError :: GenerateTxError -> MockChainError 
MCECalcFee :: MockChainError -> MockChainError

Errors happening at fee calculation time.

MCEUnknownOutRefError :: String -> TxOutRef -> MockChainError

Thrown when an output reference should be in the state of the mockchain, - but isn't.

MCEUnknownValidator :: String -> ValidatorHash -> MockChainError

Same as MCEUnknownOutRefError for validators.

MCEUnknownDatum :: String -> DatumHash -> MockChainError

Same as MCEUnknownOutRefError for datums.

FailWith :: String -> MockChainError

Used to provide MonadFail instances.

OtherMockChainError :: (Show err, Eq err) => err -> MockChainError 

Instances

Instances details
Eq MockChainError Source # 
Instance details

Defined in Cooked.MockChain.BlockChain

Show MockChainError Source # 
Instance details

Defined in Cooked.MockChain.BlockChain

PrettyCooked MockChainError Source # 
Instance details

Defined in Cooked.Pretty.Cooked

MonadError MockChainError StagedMockChain Source # 
Instance details

Defined in Cooked.MockChain.Staged

Monad m => MonadError MockChainError (MockChainT m) Source # 
Instance details

Defined in Cooked.MockChain.Direct

(MonadTransControl t, MonadError MockChainError m, Monad (t m)) => MonadError MockChainError (AsTrans t m) Source # 
Instance details

Defined in Cooked.MockChain.BlockChain

Methods

throwError :: MockChainError -> AsTrans t m a #

catchError :: AsTrans t m a -> (MockChainError -> AsTrans t m a) -> AsTrans t m a #

Show a => PrettyCooked (Either MockChainError (a, UtxoState)) Source # 
Instance details

Defined in Cooked.Pretty.Cooked

data MCEUnbalanceableError Source #

Constructors

MCEUnbalNotEnoughFunds Wallet Value

The balancing wallet misses some value to pay what is needed to balance - the transaction.

MCEUnbalNotEnoughReturning (Value, [TxOutRef]) (Value, [TxOutRef]) Value

There is value to return to the balancing wallet but not enough to +Cooked.MockChain.BlockChain

cooked-validators-2.0.0
Safe HaskellNone
LanguageHaskell2010

Cooked.MockChain.BlockChain

Synopsis

Documentation

data MockChainError where Source #

The errors that can be produced by the MockChainT monad

Constructors

MCEValidationError :: ValidationErrorInPhase -> MockChainError 
MCEUnbalanceable :: MCEUnbalanceableError -> TxSkel -> MockChainError 
MCENoSuitableCollateral :: MockChainError

Thrown when the balancing wallet owns no output that is pure Ada and + with no datum.

MCEGenerationError :: GenerateTxError -> MockChainError 
MCECalcFee :: MockChainError -> MockChainError

Errors happening at fee calculation time.

MCEUnknownOutRefError :: String -> TxOutRef -> MockChainError

Thrown when an output reference should be in the state of the mockchain, + but isn't.

MCEUnknownValidator :: String -> ValidatorHash -> MockChainError

Same as MCEUnknownOutRefError for validators.

MCEUnknownDatum :: String -> DatumHash -> MockChainError

Same as MCEUnknownOutRefError for datums.

FailWith :: String -> MockChainError

Used to provide MonadFail instances.

OtherMockChainError :: (Show err, Eq err) => err -> MockChainError 

Instances

Instances details
Eq MockChainError Source # 
Instance details

Defined in Cooked.MockChain.BlockChain

Show MockChainError Source # 
Instance details

Defined in Cooked.MockChain.BlockChain

PrettyCooked MockChainError Source # 
Instance details

Defined in Cooked.Pretty.Cooked

MonadError MockChainError StagedMockChain Source # 
Instance details

Defined in Cooked.MockChain.Staged

Monad m => MonadError MockChainError (MockChainT m) Source # 
Instance details

Defined in Cooked.MockChain.Direct

(MonadTransControl t, MonadError MockChainError m, Monad (t m)) => MonadError MockChainError (AsTrans t m) Source # 
Instance details

Defined in Cooked.MockChain.BlockChain

Methods

throwError :: MockChainError -> AsTrans t m a Source #

catchError :: AsTrans t m a -> (MockChainError -> AsTrans t m a) -> AsTrans t m a Source #

Show a => PrettyCooked (Either MockChainError (a, UtxoState)) Source # 
Instance details

Defined in Cooked.Pretty.Cooked

data MCEUnbalanceableError Source #

Constructors

MCEUnbalNotEnoughFunds Wallet Value

The balancing wallet misses some value to pay what is needed to balance + the transaction.

MCEUnbalNotEnoughReturning (Value, [TxOutRef]) (Value, [TxOutRef]) Value

There is value to return to the balancing wallet but not enough to fullfill the min ada requirement and there is not enough in additional - inputs to make it possible.

class (MonadFail m, MonadError MockChainError m) => MonadBlockChainBalancing m where Source #

Contains methods needed for balancing.

Methods

getParams :: m Params Source #

Returns the parameters of the chain.

utxosAtLedger :: Address -> m [(TxOutRef, TxOut)] Source #

Returns a list of all UTxOs at a certain address.

datumFromHash :: DatumHash -> m (Maybe Datum) Source #

Returns the datum with the given hash or Nothing if there is none

validatorFromHash :: ValidatorHash -> m (Maybe (Versioned Validator)) Source #

Returns the full validator corresponding to hash, if that validator owns - something or if it is stored in the reference script field of some UTxO.

txOutByRefLedger :: TxOutRef -> m (Maybe TxOut) Source #

Returns an output given a reference to it

Instances

Instances details
MonadBlockChainBalancing StagedMockChain Source # 
Instance details

Defined in Cooked.MockChain.Staged

Methods

getParams :: StagedMockChain Params Source #

utxosAtLedger :: Address -> StagedMockChain [(TxOutRef, TxOut)] Source #

datumFromHash :: DatumHash -> StagedMockChain (Maybe Datum) Source #

validatorFromHash :: ValidatorHash -> StagedMockChain (Maybe (Versioned Validator)) Source #

txOutByRefLedger :: TxOutRef -> StagedMockChain (Maybe TxOut) Source #

MonadBlockChainBalancing m => MonadBlockChainBalancing (ListT m) Source # 
Instance details

Defined in Cooked.MockChain.BlockChain

Methods

getParams :: ListT m Params Source #

utxosAtLedger :: Address -> ListT m [(TxOutRef, TxOut)] Source #

datumFromHash :: DatumHash -> ListT m (Maybe Datum) Source #

validatorFromHash :: ValidatorHash -> ListT m (Maybe (Versioned Validator)) Source #

txOutByRefLedger :: TxOutRef -> ListT m (Maybe TxOut) Source #

Monad m => MonadBlockChainBalancing (MockChainT m) Source # 
Instance details

Defined in Cooked.MockChain.Direct

Methods

getParams :: MockChainT m Params Source #

utxosAtLedger :: Address -> MockChainT m [(TxOutRef, TxOut)] Source #

datumFromHash :: DatumHash -> MockChainT m (Maybe Datum) Source #

validatorFromHash :: ValidatorHash -> MockChainT m (Maybe (Versioned Validator)) Source #

txOutByRefLedger :: TxOutRef -> MockChainT m (Maybe TxOut) Source #

MonadBlockChainBalancing m => MonadBlockChainBalancing (ReaderT r m) Source # 
Instance details

Defined in Cooked.MockChain.BlockChain

Methods

getParams :: ReaderT r m Params Source #

utxosAtLedger :: Address -> ReaderT r m [(TxOutRef, TxOut)] Source #

datumFromHash :: DatumHash -> ReaderT r m (Maybe Datum) Source #

validatorFromHash :: ValidatorHash -> ReaderT r m (Maybe (Versioned Validator)) Source #

txOutByRefLedger :: TxOutRef -> ReaderT r m (Maybe TxOut) Source #

MonadBlockChainBalancing m => MonadBlockChainBalancing (StateT s m) Source # 
Instance details

Defined in Cooked.MockChain.BlockChain

Methods

getParams :: StateT s m Params Source #

utxosAtLedger :: Address -> StateT s m [(TxOutRef, TxOut)] Source #

datumFromHash :: DatumHash -> StateT s m (Maybe Datum) Source #

validatorFromHash :: ValidatorHash -> StateT s m (Maybe (Versioned Validator)) Source #

txOutByRefLedger :: TxOutRef -> StateT s m (Maybe TxOut) Source #

(Monoid w, MonadBlockChainBalancing m) => MonadBlockChainBalancing (WriterT w m) Source # 
Instance details

Defined in Cooked.MockChain.BlockChain

Methods

getParams :: WriterT w m Params Source #

utxosAtLedger :: Address -> WriterT w m [(TxOutRef, TxOut)] Source #

datumFromHash :: DatumHash -> WriterT w m (Maybe Datum) Source #

validatorFromHash :: ValidatorHash -> WriterT w m (Maybe (Versioned Validator)) Source #

txOutByRefLedger :: TxOutRef -> WriterT w m (Maybe TxOut) Source #

(MonadTrans t, MonadBlockChainBalancing m, Monad (t m), MonadError MockChainError (AsTrans t m)) => MonadBlockChainBalancing (AsTrans t m) Source # 
Instance details

Defined in Cooked.MockChain.BlockChain

Methods

getParams :: AsTrans t m Params Source #

utxosAtLedger :: Address -> AsTrans t m [(TxOutRef, TxOut)] Source #

datumFromHash :: DatumHash -> AsTrans t m (Maybe Datum) Source #

validatorFromHash :: ValidatorHash -> AsTrans t m (Maybe (Versioned Validator)) Source #

txOutByRefLedger :: TxOutRef -> AsTrans t m (Maybe TxOut) Source #

class MonadBlockChainBalancing m => MonadBlockChainWithoutValidation m where Source #

Methods

allUtxosLedger :: m [(TxOutRef, TxOut)] Source #

Returns a list of all currently known outputs.

currentSlot :: m Slot Source #

Returns the current slot number

awaitSlot :: Slot -> m Slot Source #

Waits until the current slot becomes greater or equal to the given slot, + inputs to make it possible.

class (MonadFail m, MonadError MockChainError m) => MonadBlockChainBalancing m where Source #

Contains methods needed for balancing.

Methods

getParams :: m Params Source #

Returns the parameters of the chain.

utxosAtLedger :: Address -> m [(TxOutRef, TxOut)] Source #

Returns a list of all UTxOs at a certain address.

datumFromHash :: DatumHash -> m (Maybe Datum) Source #

Returns the datum with the given hash or Nothing if there is none

validatorFromHash :: ValidatorHash -> m (Maybe (Versioned Validator)) Source #

Returns the full validator corresponding to hash, if that validator owns + something or if it is stored in the reference script field of some UTxO.

txOutByRefLedger :: TxOutRef -> m (Maybe TxOut) Source #

Returns an output given a reference to it

Instances

Instances details
MonadBlockChainBalancing StagedMockChain Source # 
Instance details

Defined in Cooked.MockChain.Staged

MonadBlockChainBalancing m => MonadBlockChainBalancing (ListT m) Source # 
Instance details

Defined in Cooked.MockChain.BlockChain

Monad m => MonadBlockChainBalancing (MockChainT m) Source # 
Instance details

Defined in Cooked.MockChain.Direct

MonadBlockChainBalancing m => MonadBlockChainBalancing (ReaderT r m) Source # 
Instance details

Defined in Cooked.MockChain.BlockChain

MonadBlockChainBalancing m => MonadBlockChainBalancing (StateT s m) Source # 
Instance details

Defined in Cooked.MockChain.BlockChain

(Monoid w, MonadBlockChainBalancing m) => MonadBlockChainBalancing (WriterT w m) Source # 
Instance details

Defined in Cooked.MockChain.BlockChain

(MonadTrans t, MonadBlockChainBalancing m, Monad (t m), MonadError MockChainError (AsTrans t m)) => MonadBlockChainBalancing (AsTrans t m) Source # 
Instance details

Defined in Cooked.MockChain.BlockChain

class MonadBlockChainBalancing m => MonadBlockChainWithoutValidation m where Source #

Methods

allUtxosLedger :: m [(TxOutRef, TxOut)] Source #

Returns a list of all currently known outputs.

currentSlot :: m Slot Source #

Returns the current slot number

awaitSlot :: Slot -> m Slot Source #

Waits until the current slot becomes greater or equal to the given slot, and returns the current slot after waiting.

Note that it might not wait for anything if the current slot is large - enough.

Instances

Instances details
MonadBlockChainWithoutValidation StagedMockChain Source # 
Instance details

Defined in Cooked.MockChain.Staged

MonadBlockChainWithoutValidation m => MonadBlockChainWithoutValidation (ListT m) Source # 
Instance details

Defined in Cooked.MockChain.BlockChain

Methods

allUtxosLedger :: ListT m [(TxOutRef, TxOut)] Source #

currentSlot :: ListT m Slot Source #

awaitSlot :: Slot -> ListT m Slot Source #

Monad m => MonadBlockChainWithoutValidation (MockChainT m) Source # 
Instance details

Defined in Cooked.MockChain.Direct

Methods

allUtxosLedger :: MockChainT m [(TxOutRef, TxOut)] Source #

currentSlot :: MockChainT m Slot Source #

awaitSlot :: Slot -> MockChainT m Slot Source #

MonadBlockChainWithoutValidation m => MonadBlockChainWithoutValidation (ReaderT r m) Source # 
Instance details

Defined in Cooked.MockChain.BlockChain

Methods

allUtxosLedger :: ReaderT r m [(TxOutRef, TxOut)] Source #

currentSlot :: ReaderT r m Slot Source #

awaitSlot :: Slot -> ReaderT r m Slot Source #

MonadBlockChainWithoutValidation m => MonadBlockChainWithoutValidation (StateT s m) Source # 
Instance details

Defined in Cooked.MockChain.BlockChain

Methods

allUtxosLedger :: StateT s m [(TxOutRef, TxOut)] Source #

currentSlot :: StateT s m Slot Source #

awaitSlot :: Slot -> StateT s m Slot Source #

(Monoid w, MonadBlockChainWithoutValidation m) => MonadBlockChainWithoutValidation (WriterT w m) Source # 
Instance details

Defined in Cooked.MockChain.BlockChain

Methods

allUtxosLedger :: WriterT w m [(TxOutRef, TxOut)] Source #

currentSlot :: WriterT w m Slot Source #

awaitSlot :: Slot -> WriterT w m Slot Source #

(MonadTrans t, MonadBlockChainWithoutValidation m, Monad (t m), MonadError MockChainError (AsTrans t m)) => MonadBlockChainWithoutValidation (AsTrans t m) Source # 
Instance details

Defined in Cooked.MockChain.BlockChain

Methods

allUtxosLedger :: AsTrans t m [(TxOutRef, TxOut)] Source #

currentSlot :: AsTrans t m Slot Source #

awaitSlot :: Slot -> AsTrans t m Slot Source #

class MonadBlockChainWithoutValidation m => MonadBlockChain m where Source #

The main abstraction of the blockchain.

Methods

validateTxSkel :: TxSkel -> m CardanoTx Source #

Generates, balances and validates a transaction from a skeleton. + enough.

Instances

Instances details
MonadBlockChainWithoutValidation StagedMockChain Source # 
Instance details

Defined in Cooked.MockChain.Staged

MonadBlockChainWithoutValidation m => MonadBlockChainWithoutValidation (ListT m) Source # 
Instance details

Defined in Cooked.MockChain.BlockChain

Monad m => MonadBlockChainWithoutValidation (MockChainT m) Source # 
Instance details

Defined in Cooked.MockChain.Direct

MonadBlockChainWithoutValidation m => MonadBlockChainWithoutValidation (ReaderT r m) Source # 
Instance details

Defined in Cooked.MockChain.BlockChain

MonadBlockChainWithoutValidation m => MonadBlockChainWithoutValidation (StateT s m) Source # 
Instance details

Defined in Cooked.MockChain.BlockChain

(Monoid w, MonadBlockChainWithoutValidation m) => MonadBlockChainWithoutValidation (WriterT w m) Source # 
Instance details

Defined in Cooked.MockChain.BlockChain

(MonadTrans t, MonadBlockChainWithoutValidation m, Monad (t m), MonadError MockChainError (AsTrans t m)) => MonadBlockChainWithoutValidation (AsTrans t m) Source # 
Instance details

Defined in Cooked.MockChain.BlockChain

class MonadBlockChainWithoutValidation m => MonadBlockChain m where Source #

The main abstraction of the blockchain.

Methods

validateTxSkel :: TxSkel -> m CardanoTx Source #

Generates, balances and validates a transaction from a skeleton. It returns the validated transaction and updates the state of the blockchain. In MockChainT, this means: - deletes the consumed outputs from mcstIndex - adds the produced outputs to msctIndex - deletes the consumed datums from mcstDatums - adds the produced datums to mcstDatums - - adds the validators on outputs to the mcstValidators.

Instances

Instances details
MonadBlockChain StagedMockChain Source # 
Instance details

Defined in Cooked.MockChain.Staged

MonadBlockChain m => MonadBlockChain (ListT m) Source # 
Instance details

Defined in Cooked.MockChain.BlockChain

Methods

validateTxSkel :: TxSkel -> ListT m CardanoTx Source #

Monad m => MonadBlockChain (MockChainT m) Source # 
Instance details

Defined in Cooked.MockChain.Direct

Methods

validateTxSkel :: TxSkel -> MockChainT m CardanoTx Source #

MonadBlockChain m => MonadBlockChain (ReaderT r m) Source # 
Instance details

Defined in Cooked.MockChain.BlockChain

Methods

validateTxSkel :: TxSkel -> ReaderT r m CardanoTx Source #

MonadBlockChain m => MonadBlockChain (StateT s m) Source # 
Instance details

Defined in Cooked.MockChain.BlockChain

Methods

validateTxSkel :: TxSkel -> StateT s m CardanoTx Source #

(Monoid w, MonadBlockChain m) => MonadBlockChain (WriterT w m) Source # 
Instance details

Defined in Cooked.MockChain.BlockChain

Methods

validateTxSkel :: TxSkel -> WriterT w m CardanoTx Source #

(MonadTrans t, MonadBlockChain m, MonadBlockChainWithoutValidation (AsTrans t m)) => MonadBlockChain (AsTrans t m) Source # 
Instance details

Defined in Cooked.MockChain.BlockChain

Methods

validateTxSkel :: TxSkel -> AsTrans t m CardanoTx Source #

newtype AsTrans t (m :: Type -> Type) a Source #

A newtype wrapper to be used with '-XDerivingVia' to derive instances of MonadBlockChain - for any MonadTransControl.

For example, to derive 'MonadBlockChain m => MonadBlockChain (ReaderT r m)', you'd write

deriving via (AsTrans (ReaderT r) m) instance MonadBlockChain m => MonadBlockChain (ReaderT r m)

and avoid the boilerplate of defining all the methods of the class yourself.

Constructors

AsTrans 

Fields

Instances

Instances details
(MonadTransControl t, MonadError MockChainError m, Monad (t m)) => MonadError MockChainError (AsTrans t m) Source # 
Instance details

Defined in Cooked.MockChain.BlockChain

Methods

throwError :: MockChainError -> AsTrans t m a #

catchError :: AsTrans t m a -> (MockChainError -> AsTrans t m a) -> AsTrans t m a #

MonadTrans t => MonadTrans (AsTrans t) Source # 
Instance details

Defined in Cooked.MockChain.BlockChain

Methods

lift :: Monad m => m a -> AsTrans t m a #

MonadTransControl t => MonadTransControl (AsTrans t) Source # 
Instance details

Defined in Cooked.MockChain.BlockChain

Associated Types

type StT (AsTrans t) a

Methods

liftWith :: Monad m => (Run (AsTrans t) -> m a) -> AsTrans t m a

restoreT :: Monad m => m (StT (AsTrans t) a) -> AsTrans t m a

Monad (t m) => Monad (AsTrans t m) Source # 
Instance details

Defined in Cooked.MockChain.BlockChain

Methods

(>>=) :: AsTrans t m a -> (a -> AsTrans t m b) -> AsTrans t m b #

(>>) :: AsTrans t m a -> AsTrans t m b -> AsTrans t m b #

return :: a -> AsTrans t m a #

Functor (t m) => Functor (AsTrans t m) Source # 
Instance details

Defined in Cooked.MockChain.BlockChain

Methods

fmap :: (a -> b) -> AsTrans t m a -> AsTrans t m b #

(<$) :: a -> AsTrans t m b -> AsTrans t m a #

(MonadTrans t, MonadFail m, Monad (t m)) => MonadFail (AsTrans t m) Source # 
Instance details

Defined in Cooked.MockChain.BlockChain

Methods

fail :: String -> AsTrans t m a #

Applicative (t m) => Applicative (AsTrans t m) Source # 
Instance details

Defined in Cooked.MockChain.BlockChain

Methods

pure :: a -> AsTrans t m a #

(<*>) :: AsTrans t m (a -> b) -> AsTrans t m a -> AsTrans t m b #

liftA2 :: (a -> b -> c) -> AsTrans t m a -> AsTrans t m b -> AsTrans t m c #

(*>) :: AsTrans t m a -> AsTrans t m b -> AsTrans t m b #

(<*) :: AsTrans t m a -> AsTrans t m b -> AsTrans t m a #

(MonadTrans t, MonadBlockChain m, MonadBlockChainWithoutValidation (AsTrans t m)) => MonadBlockChain (AsTrans t m) Source # 
Instance details

Defined in Cooked.MockChain.BlockChain

Methods

validateTxSkel :: TxSkel -> AsTrans t m CardanoTx Source #

(MonadTrans t, MonadBlockChainWithoutValidation m, Monad (t m), MonadError MockChainError (AsTrans t m)) => MonadBlockChainWithoutValidation (AsTrans t m) Source # 
Instance details

Defined in Cooked.MockChain.BlockChain

Methods

allUtxosLedger :: AsTrans t m [(TxOutRef, TxOut)] Source #

currentSlot :: AsTrans t m Slot Source #

awaitSlot :: Slot -> AsTrans t m Slot Source #

(MonadTrans t, MonadBlockChainBalancing m, Monad (t m), MonadError MockChainError (AsTrans t m)) => MonadBlockChainBalancing (AsTrans t m) Source # 
Instance details

Defined in Cooked.MockChain.BlockChain

Methods

getParams :: AsTrans t m Params Source #

utxosAtLedger :: Address -> AsTrans t m [(TxOutRef, TxOut)] Source #

datumFromHash :: DatumHash -> AsTrans t m (Maybe Datum) Source #

validatorFromHash :: ValidatorHash -> AsTrans t m (Maybe (Versioned Validator)) Source #

txOutByRefLedger :: TxOutRef -> AsTrans t m (Maybe TxOut) Source #

type StT (AsTrans t) a Source # 
Instance details

Defined in Cooked.MockChain.BlockChain

type StT (AsTrans t) a = StT t a

allUtxos :: MonadBlockChainWithoutValidation m => m [(TxOutRef, TxOut)] Source #

currentTime :: MonadBlockChainWithoutValidation m => m (POSIXTime, POSIXTime) Source #

Returns the closed ms interval corresponding to the current slot

waitNSlots :: MonadBlockChainWithoutValidation m => Integer -> m Slot Source #

Moves n slots fowards

utxosAt :: MonadBlockChainBalancing m => Address -> m [(TxOutRef, TxOut)] Source #

txOutByRef :: MonadBlockChainBalancing m => TxOutRef -> m (Maybe TxOut) Source #

utxosFromCardanoTx :: CardanoTx -> [(TxOutRef, TxOut)] Source #

Retrieve the ordered list of outputs of the given CardanoTx.

This is useful when writing endpoints and/or traces to fetch utxos of + - adds the validators on outputs to the mcstValidators.

newtype AsTrans t (m :: Type -> Type) a Source #

A newtype wrapper to be used with '-XDerivingVia' to derive instances of MonadBlockChain + for any MonadTransControl.

For example, to derive 'MonadBlockChain m => MonadBlockChain (ReaderT r m)', you'd write

deriving via (AsTrans (ReaderT r) m) instance MonadBlockChain m => MonadBlockChain (ReaderT r m)

and avoid the boilerplate of defining all the methods of the class yourself.

Constructors

AsTrans 

Fields

Instances

Instances details
(MonadTransControl t, MonadError MockChainError m, Monad (t m)) => MonadError MockChainError (AsTrans t m) Source # 
Instance details

Defined in Cooked.MockChain.BlockChain

Methods

throwError :: MockChainError -> AsTrans t m a Source #

catchError :: AsTrans t m a -> (MockChainError -> AsTrans t m a) -> AsTrans t m a Source #

MonadTrans t => MonadTrans (AsTrans t) Source # 
Instance details

Defined in Cooked.MockChain.BlockChain

Methods

lift :: Monad m => m a -> AsTrans t m a Source #

MonadTransControl t => MonadTransControl (AsTrans t) Source # 
Instance details

Defined in Cooked.MockChain.BlockChain

Associated Types

type StT (AsTrans t) a Source #

Methods

liftWith :: Monad m => (Run (AsTrans t) -> m a) -> AsTrans t m a Source #

restoreT :: Monad m => m (StT (AsTrans t) a) -> AsTrans t m a Source #

Monad (t m) => Monad (AsTrans t m) Source # 
Instance details

Defined in Cooked.MockChain.BlockChain

Methods

(>>=) :: AsTrans t m a -> (a -> AsTrans t m b) -> AsTrans t m b Source #

(>>) :: AsTrans t m a -> AsTrans t m b -> AsTrans t m b Source #

return :: a -> AsTrans t m a Source #

Functor (t m) => Functor (AsTrans t m) Source # 
Instance details

Defined in Cooked.MockChain.BlockChain

Methods

fmap :: (a -> b) -> AsTrans t m a -> AsTrans t m b Source #

(<$) :: a -> AsTrans t m b -> AsTrans t m a Source #

(MonadTrans t, MonadFail m, Monad (t m)) => MonadFail (AsTrans t m) Source # 
Instance details

Defined in Cooked.MockChain.BlockChain

Methods

fail :: String -> AsTrans t m a Source #

Applicative (t m) => Applicative (AsTrans t m) Source # 
Instance details

Defined in Cooked.MockChain.BlockChain

Methods

pure :: a -> AsTrans t m a Source #

(<*>) :: AsTrans t m (a -> b) -> AsTrans t m a -> AsTrans t m b Source #

liftA2 :: (a -> b -> c) -> AsTrans t m a -> AsTrans t m b -> AsTrans t m c Source #

(*>) :: AsTrans t m a -> AsTrans t m b -> AsTrans t m b Source #

(<*) :: AsTrans t m a -> AsTrans t m b -> AsTrans t m a Source #

(MonadTrans t, MonadBlockChain m, MonadBlockChainWithoutValidation (AsTrans t m)) => MonadBlockChain (AsTrans t m) Source # 
Instance details

Defined in Cooked.MockChain.BlockChain

(MonadTrans t, MonadBlockChainWithoutValidation m, Monad (t m), MonadError MockChainError (AsTrans t m)) => MonadBlockChainWithoutValidation (AsTrans t m) Source # 
Instance details

Defined in Cooked.MockChain.BlockChain

(MonadTrans t, MonadBlockChainBalancing m, Monad (t m), MonadError MockChainError (AsTrans t m)) => MonadBlockChainBalancing (AsTrans t m) Source # 
Instance details

Defined in Cooked.MockChain.BlockChain

type StT (AsTrans t) a Source # 
Instance details

Defined in Cooked.MockChain.BlockChain

type StT (AsTrans t) a = StT t a

currentTime :: MonadBlockChainWithoutValidation m => m (POSIXTime, POSIXTime) Source #

Returns the closed ms interval corresponding to the current slot

utxosFromCardanoTx :: CardanoTx -> [(TxOutRef, TxOut)] Source #

Retrieve the ordered list of outputs of the given CardanoTx.

This is useful when writing endpoints and/or traces to fetch utxos of interest right from the start and avoid querying the chain for them - afterwards using allUtxos or similar functions.

txOutV2FromLedger :: TxOut -> TxOut Source #

typedDatumFromTxOutRef :: (FromData a, MonadBlockChainWithoutValidation m) => TxOutRef -> m (Maybe a) Source #

resolveDatum :: (IsAbstractOutput out, ToOutputDatum (DatumType out), MonadBlockChainBalancing m) => out -> m (Maybe (ConcreteOutput (OwnerType out) Datum (ValueType out) (ReferenceScriptType out))) Source #

Try to resolve the datum on the output: If there's an inline datum, take + afterwards using allUtxos or similar functions.

resolveDatum :: (IsAbstractOutput out, ToOutputDatum (DatumType out), MonadBlockChainBalancing m) => out -> m (Maybe (ConcreteOutput (OwnerType out) Datum (ValueType out) (ReferenceScriptType out))) Source #

Try to resolve the datum on the output: If there's an inline datum, take that; if there's a datum hash, look the corresponding datum up (with datumFromHash), returning Nothing if it can't be found; if there's no - datum or hash at all, return Nothing.

resolveTypedDatum :: (IsAbstractOutput out, ToOutputDatum (DatumType out), MonadBlockChainBalancing m, FromData a) => out -> m (Maybe (ConcreteOutput (OwnerType out) a (ValueType out) (ReferenceScriptType out))) Source #

Like resolveDatum, but also tries to use fromBuiltinData to extract a - datum of the suitable type.

resolveValidator :: (IsAbstractOutput out, ToCredential (OwnerType out), MonadBlockChainBalancing m) => out -> m (Maybe (ConcreteOutput (Versioned Validator) (DatumType out) (ValueType out) (ReferenceScriptType out))) Source #

Try to resolve the validator that owns an output: If the output is owned by + datum or hash at all, return Nothing.

resolveTypedDatum :: (IsAbstractOutput out, ToOutputDatum (DatumType out), MonadBlockChainBalancing m, FromData a) => out -> m (Maybe (ConcreteOutput (OwnerType out) a (ValueType out) (ReferenceScriptType out))) Source #

Like resolveDatum, but also tries to use fromBuiltinData to extract a + datum of the suitable type.

resolveValidator :: (IsAbstractOutput out, ToCredential (OwnerType out), MonadBlockChainBalancing m) => out -> m (Maybe (ConcreteOutput (Versioned Validator) (DatumType out) (ValueType out) (ReferenceScriptType out))) Source #

Try to resolve the validator that owns an output: If the output is owned by a public key, or if the validator's hash is not known (i.e. if - validatorFromHash returns Nothing) return Nothing.

resolveReferenceScript :: (IsAbstractOutput out, ToScriptHash (ReferenceScriptType out), MonadBlockChainBalancing m) => out -> m (Maybe (ConcreteOutput (OwnerType out) (DatumType out) (ValueType out) (Versioned Validator))) Source #

Try to resolve the reference script on an output: If the output has no + validatorFromHash returns Nothing) return Nothing.

resolveReferenceScript :: (IsAbstractOutput out, ToScriptHash (ReferenceScriptType out), MonadBlockChainBalancing m) => out -> m (Maybe (ConcreteOutput (OwnerType out) (DatumType out) (ValueType out) (Versioned Validator))) Source #

Try to resolve the reference script on an output: If the output has no reference script, or if the reference script's hash is not known (i.e. if - validatorFromHash returns Nothing), this function will return Nothing.

getEnclosingSlot :: MonadBlockChainWithoutValidation m => POSIXTime -> m Slot Source #

Return the slot that contains the given time. See slotToTimeInterval for - some equational properties this function satisfies.

awaitEnclosingSlot :: MonadBlockChainWithoutValidation m => POSIXTime -> m Slot Source #

Waits until the current slot becomes greater or equal to the slot containing the given POSIX time. - Note that that it might not wait for anything if the current slot is large enough.

slotRangeBefore :: MonadBlockChainWithoutValidation m => POSIXTime -> m SlotRange Source #

The infinite range of slots ending before or at the given POSIX time

slotRangeAfter :: MonadBlockChainWithoutValidation m => POSIXTime -> m SlotRange Source #

The infinite range of slots starting after or at the given POSIX time

slotToTimeInterval :: MonadBlockChainWithoutValidation m => Slot -> m (POSIXTime, POSIXTime) Source #

Returns the closed ms interval corresponding to the slot with the given + validatorFromHash returns Nothing), this function will return Nothing.

getEnclosingSlot :: MonadBlockChainWithoutValidation m => POSIXTime -> m Slot Source #

Return the slot that contains the given time. See slotToTimeInterval for + some equational properties this function satisfies.

awaitEnclosingSlot :: MonadBlockChainWithoutValidation m => POSIXTime -> m Slot Source #

Waits until the current slot becomes greater or equal to the slot containing the given POSIX time. + Note that that it might not wait for anything if the current slot is large enough.

slotRangeBefore :: MonadBlockChainWithoutValidation m => POSIXTime -> m SlotRange Source #

The infinite range of slots ending before or at the given POSIX time

slotRangeAfter :: MonadBlockChainWithoutValidation m => POSIXTime -> m SlotRange Source #

The infinite range of slots starting after or at the given POSIX time

slotToTimeInterval :: MonadBlockChainWithoutValidation m => Slot -> m (POSIXTime, POSIXTime) Source #

Returns the closed ms interval corresponding to the slot with the given number. It holds that

slotToTimeInterval (getEnclosingSlot t) == (a, b)    ==>   a <= t <= b

and

slotToTimeInterval n == (a, b)   ==>   getEnclosingSlot a == n && getEnclosingSlot b == n

and

slotToTimeInterval n == (a, b)   ==>   getEnclosingSlot (a-1) == n-1 && getEnclosingSlot (b+1) == n+1
\ No newline at end of file diff --git a/Cooked-MockChain-Direct.html b/Cooked-MockChain-Direct.html index 633d2436c..a666f58fe 100644 --- a/Cooked-MockChain-Direct.html +++ b/Cooked-MockChain-Direct.html @@ -1,14 +1,14 @@ -Cooked.MockChain.Direct
cooked-validators-2.0.0
Safe HaskellNone
LanguageHaskell2010

Cooked.MockChain.Direct

Synopsis

Direct Emulation

The MockChainT monad provides a direct emulator; that is, it gives us a +Cooked.MockChain.Direct

cooked-validators-2.0.0
Safe HaskellNone
LanguageHaskell2010

Cooked.MockChain.Direct

Synopsis

Direct Emulation

The MockChainT monad provides a direct emulator; that is, it gives us a simple way to call validator scripts directly, without the need for all the complexity the Contract monad introduces.

Running a MockChain produces a UtxoState, a simplified view on UtxoIndex, which we also keep in our state.

data MockChainSt Source #

Slightly more concrete version of UtxoState, used to actually run the - simulation.

Constructors

MockChainSt 

Fields

Instances

Instances details
Eq MockChainSt Source # 
Instance details

Defined in Cooked.MockChain.Direct

Show MockChainSt Source # 
Instance details

Defined in Cooked.MockChain.Direct

Default MockChainSt Source # 
Instance details

Defined in Cooked.MockChain.Direct

Methods

def :: MockChainSt

Monad m => MonadState MockChainSt (MockChainT m) Source # 
Instance details

Defined in Cooked.MockChain.Direct

newtype MockChainEnv Source #

Constructors

MockChainEnv 

Fields

Instances

Instances details
Show MockChainEnv Source # 
Instance details

Defined in Cooked.MockChain.Direct

Default MockChainEnv Source # 
Instance details

Defined in Cooked.MockChain.Direct

Methods

def :: MockChainEnv

Monad m => MonadReader MockChainEnv (MockChainT m) Source # 
Instance details

Defined in Cooked.MockChain.Direct

newtype MockChainT m a Source #

Instances

Instances details
MonadFail StagedMockChain Source # 
Instance details

Defined in Cooked.MockChain.Staged

Methods

fail :: String -> StagedMockChain a #

Alternative StagedMockChain Source # 
Instance details

Defined in Cooked.MockChain.Staged

MonadTrans MockChainT Source # 
Instance details

Defined in Cooked.MockChain.Direct

Methods

lift :: Monad m => m a -> MockChainT m a #

MonadBlockChain StagedMockChain Source # 
Instance details

Defined in Cooked.MockChain.Staged

MonadBlockChainWithoutValidation StagedMockChain Source # 
Instance details

Defined in Cooked.MockChain.Staged

MonadBlockChainBalancing StagedMockChain Source # 
Instance details

Defined in Cooked.MockChain.Staged

Methods

getParams :: StagedMockChain Params Source #

utxosAtLedger :: Address -> StagedMockChain [(TxOutRef, TxOut)] Source #

datumFromHash :: DatumHash -> StagedMockChain (Maybe Datum) Source #

validatorFromHash :: ValidatorHash -> StagedMockChain (Maybe (Versioned Validator)) Source #

txOutByRefLedger :: TxOutRef -> StagedMockChain (Maybe TxOut) Source #

MonadError MockChainError StagedMockChain Source # 
Instance details

Defined in Cooked.MockChain.Staged

Monad m => MonadState MockChainSt (MockChainT m) Source # 
Instance details

Defined in Cooked.MockChain.Direct

Monad m => MonadReader MockChainEnv (MockChainT m) Source # 
Instance details

Defined in Cooked.MockChain.Direct

Monad m => MonadError MockChainError (MockChainT m) Source # 
Instance details

Defined in Cooked.MockChain.Direct

Monad m => Monad (MockChainT m) Source #

Custom monad instance made to increase the slot count automatically

Instance details

Defined in Cooked.MockChain.Direct

Methods

(>>=) :: MockChainT m a -> (a -> MockChainT m b) -> MockChainT m b #

(>>) :: MockChainT m a -> MockChainT m b -> MockChainT m b #

return :: a -> MockChainT m a #

Functor m => Functor (MockChainT m) Source # 
Instance details

Defined in Cooked.MockChain.Direct

Methods

fmap :: (a -> b) -> MockChainT m a -> MockChainT m b #

(<$) :: a -> MockChainT m b -> MockChainT m a #

Monad m => MonadFail (MockChainT m) Source # 
Instance details

Defined in Cooked.MockChain.Direct

Methods

fail :: String -> MockChainT m a #

Monad m => Applicative (MockChainT m) Source # 
Instance details

Defined in Cooked.MockChain.Direct

Methods

pure :: a -> MockChainT m a #

(<*>) :: MockChainT m (a -> b) -> MockChainT m a -> MockChainT m b #

liftA2 :: (a -> b -> c) -> MockChainT m a -> MockChainT m b -> MockChainT m c #

(*>) :: MockChainT m a -> MockChainT m b -> MockChainT m b #

(<*) :: MockChainT m a -> MockChainT m b -> MockChainT m a #

MonadPlus m => MonadPlus (MockChainT m) Source # 
Instance details

Defined in Cooked.MockChain.Staged

Methods

mzero :: MockChainT m a #

mplus :: MockChainT m a -> MockChainT m a -> MockChainT m a #

(Monad m, Alternative m) => Alternative (MockChainT m) Source # 
Instance details

Defined in Cooked.MockChain.Direct

Methods

empty :: MockChainT m a #

(<|>) :: MockChainT m a -> MockChainT m a -> MockChainT m a #

some :: MockChainT m a -> MockChainT m [a] #

many :: MockChainT m a -> MockChainT m [a] #

Monad m => MonadBlockChain (MockChainT m) Source # 
Instance details

Defined in Cooked.MockChain.Direct

Methods

validateTxSkel :: TxSkel -> MockChainT m CardanoTx Source #

Monad m => MonadBlockChainWithoutValidation (MockChainT m) Source # 
Instance details

Defined in Cooked.MockChain.Direct

Methods

allUtxosLedger :: MockChainT m [(TxOutRef, TxOut)] Source #

currentSlot :: MockChainT m Slot Source #

awaitSlot :: Slot -> MockChainT m Slot Source #

Monad m => MonadBlockChainBalancing (MockChainT m) Source # 
Instance details

Defined in Cooked.MockChain.Direct

Methods

getParams :: MockChainT m Params Source #

utxosAtLedger :: Address -> MockChainT m [(TxOutRef, TxOut)] Source #

datumFromHash :: DatumHash -> MockChainT m (Maybe Datum) Source #

validatorFromHash :: ValidatorHash -> MockChainT m (Maybe (Versioned Validator)) Source #

txOutByRefLedger :: TxOutRef -> MockChainT m (Maybe TxOut) Source #

combineMockChainT :: Monad m => (forall a. m a -> m a -> m a) -> MockChainT m x -> MockChainT m x -> MockChainT m x Source #

newtype MockChainT m a Source #

Instances

Instances details
MonadFail StagedMockChain Source # 
Instance details

Defined in Cooked.MockChain.Staged

Alternative StagedMockChain Source # 
Instance details

Defined in Cooked.MockChain.Staged

MonadTrans MockChainT Source # 
Instance details

Defined in Cooked.MockChain.Direct

Methods

lift :: Monad m => m a -> MockChainT m a Source #

MonadBlockChain StagedMockChain Source # 
Instance details

Defined in Cooked.MockChain.Staged

MonadBlockChainWithoutValidation StagedMockChain Source # 
Instance details

Defined in Cooked.MockChain.Staged

MonadBlockChainBalancing StagedMockChain Source # 
Instance details

Defined in Cooked.MockChain.Staged

MonadError MockChainError StagedMockChain Source # 
Instance details

Defined in Cooked.MockChain.Staged

Monad m => MonadReader MockChainEnv (MockChainT m) Source # 
Instance details

Defined in Cooked.MockChain.Direct

Monad m => MonadState MockChainSt (MockChainT m) Source # 
Instance details

Defined in Cooked.MockChain.Direct

Monad m => MonadError MockChainError (MockChainT m) Source # 
Instance details

Defined in Cooked.MockChain.Direct

Monad m => Monad (MockChainT m) Source #

Custom monad instance made to increase the slot count automatically

Instance details

Defined in Cooked.MockChain.Direct

Methods

(>>=) :: MockChainT m a -> (a -> MockChainT m b) -> MockChainT m b Source #

(>>) :: MockChainT m a -> MockChainT m b -> MockChainT m b Source #

return :: a -> MockChainT m a Source #

Functor m => Functor (MockChainT m) Source # 
Instance details

Defined in Cooked.MockChain.Direct

Methods

fmap :: (a -> b) -> MockChainT m a -> MockChainT m b Source #

(<$) :: a -> MockChainT m b -> MockChainT m a Source #

Monad m => MonadFail (MockChainT m) Source # 
Instance details

Defined in Cooked.MockChain.Direct

Methods

fail :: String -> MockChainT m a Source #

Monad m => Applicative (MockChainT m) Source # 
Instance details

Defined in Cooked.MockChain.Direct

Methods

pure :: a -> MockChainT m a Source #

(<*>) :: MockChainT m (a -> b) -> MockChainT m a -> MockChainT m b Source #

liftA2 :: (a -> b -> c) -> MockChainT m a -> MockChainT m b -> MockChainT m c Source #

(*>) :: MockChainT m a -> MockChainT m b -> MockChainT m b Source #

(<*) :: MockChainT m a -> MockChainT m b -> MockChainT m a Source #

MonadPlus m => MonadPlus (MockChainT m) Source # 
Instance details

Defined in Cooked.MockChain.Staged

Methods

mzero :: MockChainT m a Source #

mplus :: MockChainT m a -> MockChainT m a -> MockChainT m a Source #

(Monad m, Alternative m) => Alternative (MockChainT m) Source # 
Instance details

Defined in Cooked.MockChain.Direct

Monad m => MonadBlockChain (MockChainT m) Source # 
Instance details

Defined in Cooked.MockChain.Direct

Monad m => MonadBlockChainWithoutValidation (MockChainT m) Source # 
Instance details

Defined in Cooked.MockChain.Direct

Monad m => MonadBlockChainBalancing (MockChainT m) Source # 
Instance details

Defined in Cooked.MockChain.Direct

combineMockChainT :: Monad m => (forall a. m a -> m a -> m a) -> MockChainT m x -> MockChainT m x -> MockChainT m x Source #

runMockChainTRaw :: Monad m => MockChainEnv -> MockChainSt -> MockChainT m a -> m (Either MockChainError (a, MockChainSt)) Source #

Executes a MockChainT from some initial state and environment; does not convert the MockChainSt into a UtxoState.

runMockChainTFrom :: Monad m => InitialDistribution -> MockChainT m a -> m (Either MockChainError (a, UtxoState)) Source #

Executes a MockChainT from an initial state set up with the given initial value distribution. Similar to runMockChainT, uses the default environment. Returns a UtxoState instead of a MockChainSt. If you need the later, use runMockChainTRaw

runMockChainT :: Monad m => MockChainT m a -> m (Either MockChainError (a, UtxoState)) Source #

Executes a MockChainT from the canonical initial state and environment. The canonical environment uses the default SlotConfig and - Cooked.Wallet.wallet 1 as the sole wallet signing transactions.

Canonical initial values

utxoIndex0 :: UtxoIndex Source #

Direct Interpretation of Operations

getIndex :: UtxoIndex -> Map TxOutRef TxOut Source #

runTransactionValidation Source #

Arguments

:: Monad m 
=> Params

The emulator parameters to use. They might have been changed by the txOptEmulatorParamsModification.

-> Tx BabbageEra

The transaction to validate. It should already be balanced, and include - appropriate fees and collateral.

-> [RawModTx]

Modifications to apply to the transaction right before it is submitted.

-> Map DatumHash Datum

The data consumed by the transaction

-> Map DatumHash TxSkelOutDatum

The data produced by the transaction

-> Map ValidatorHash (Versioned Validator)

The validators protecting transaction outputs, and the validators in the + Cooked.Wallet.wallet 1 as the sole wallet signing transactions.

Canonical initial values

Direct Interpretation of Operations

runTransactionValidation Source #

Arguments

:: Monad m 
=> Params

The emulator parameters to use. They might have been changed by the txOptEmulatorParamsModification.

-> Tx BabbageEra

The transaction to validate. It should already be balanced, and include + appropriate fees and collateral.

-> [RawModTx]

Modifications to apply to the transaction right before it is submitted.

-> Map DatumHash Datum

The data consumed by the transaction

-> Map DatumHash TxSkelOutDatum

The data produced by the transaction

-> Map ValidatorHash (Versioned Validator)

The validators protecting transaction outputs, and the validators in the reference script field of transaction outputs. The MockChain will - remember them.

-> MockChainT m CardanoTx 

Orphan instances

Default Slot Source # 
Instance details

Methods

def :: Slot

\ No newline at end of file + remember them.

-> MockChainT m CardanoTx 

Orphan instances

Default Slot Source # 
Instance details

Methods

def :: Slot Source #

\ No newline at end of file diff --git a/Cooked-MockChain-GenerateTx.html b/Cooked-MockChain-GenerateTx.html index 7441342b0..54076b174 100644 --- a/Cooked-MockChain-GenerateTx.html +++ b/Cooked-MockChain-GenerateTx.html @@ -1,2 +1,2 @@ -Cooked.MockChain.GenerateTx
cooked-validators-2.0.0
Safe HaskellNone
LanguageHaskell2010

Cooked.MockChain.GenerateTx

Synopsis

Documentation

data GenTxParams Source #

The internal (do-not-modify unless you know what you're doing) parameters - for generateTxBodyContent.

Instances

Instances details
Default GenTxParams Source # 
Instance details

Defined in Cooked.MockChain.GenerateTx

Methods

def :: GenTxParams

generateTxBodyContent Source #

Arguments

:: GenTxParams

Parameters controlling transaction generation.

-> Params

Some parameters, coming from the MockChain.

-> Map DatumHash Datum

All of the currently known data on transaction inputs, also coming from the MockChain.

-> Map TxOutRef TxOut

All of the currently known UTxOs which will be used as transaction inputs or referenced, also coming from the MockChain.

-> Map ValidatorHash (Versioned Validator)

All of the currently known validators which protect transaction inputs, also coming from the MockChain.

-> TxSkel

The transaction skeleton to translate.

-> Either GenerateTxError (TxBodyContent BuildTx BabbageEra) 

txSkelOutToCardanoTxOut :: Params -> TxSkelOut -> Either GenerateTxError (TxOut CtxTx BabbageEra) Source #

generateTx Source #

Arguments

:: GenTxParams

Parameters controlling transaction generation.

-> Params

Some parameters, coming from the MockChain.

-> Map DatumHash Datum

All of the currently known data on transaction inputs, also coming from the MockChain.

-> Map TxOutRef TxOut

All of the currently known UTxOs which will be used as transaction inputs or referenced, also coming from the MockChain.

-> Map ValidatorHash (Versioned Validator)

All of the currently known validators which protect transaction inputs, also coming from the MockChain.

-> TxSkel

The transaction skeleton to translate.

-> Either GenerateTxError (Tx BabbageEra) 
\ No newline at end of file +Cooked.MockChain.GenerateTx
cooked-validators-2.0.0
Safe HaskellNone
LanguageHaskell2010

Cooked.MockChain.GenerateTx

Documentation

data GenTxParams Source #

The internal (do-not-modify unless you know what you're doing) parameters + for generateTxBodyContent.

Instances

Instances details
Default GenTxParams Source # 
Instance details

Defined in Cooked.MockChain.GenerateTx

generateTxBodyContent Source #

Arguments

:: GenTxParams

Parameters controlling transaction generation.

-> Params

Some parameters, coming from the MockChain.

-> Map DatumHash Datum

All of the currently known data on transaction inputs, also coming from the MockChain.

-> Map TxOutRef TxOut

All of the currently known UTxOs which will be used as transaction inputs or referenced, also coming from the MockChain.

-> Map ValidatorHash (Versioned Validator)

All of the currently known validators which protect transaction inputs, also coming from the MockChain.

-> TxSkel

The transaction skeleton to translate.

-> Either GenerateTxError (TxBodyContent BuildTx BabbageEra) 

generateTx Source #

Arguments

:: GenTxParams

Parameters controlling transaction generation.

-> Params

Some parameters, coming from the MockChain.

-> Map DatumHash Datum

All of the currently known data on transaction inputs, also coming from the MockChain.

-> Map TxOutRef TxOut

All of the currently known UTxOs which will be used as transaction inputs or referenced, also coming from the MockChain.

-> Map ValidatorHash (Versioned Validator)

All of the currently known validators which protect transaction inputs, also coming from the MockChain.

-> TxSkel

The transaction skeleton to translate.

-> Either GenerateTxError (Tx BabbageEra) 
\ No newline at end of file diff --git a/Cooked-MockChain-Staged.html b/Cooked-MockChain-Staged.html index 3f361e3db..94a1dd82b 100644 --- a/Cooked-MockChain-Staged.html +++ b/Cooked-MockChain-Staged.html @@ -1,8 +1,8 @@ -Cooked.MockChain.Staged
cooked-validators-2.0.0
Safe HaskellNone
LanguageHaskell2010

Cooked.MockChain.Staged

Synopsis

Documentation

interpretAndRunWith :: (forall m. Monad m => MockChainT m a -> m res) -> StagedMockChain a -> [(res, MockChainLog)] Source #

Interprets the staged mockchain then runs the resulting computation with a +Cooked.MockChain.Staged

cooked-validators-2.0.0
Safe HaskellNone
LanguageHaskell2010

Cooked.MockChain.Staged

Synopsis

Documentation

interpretAndRunWith :: (forall m. Monad m => MockChainT m a -> m res) -> StagedMockChain a -> [(res, MockChainLog)] Source #

Interprets the staged mockchain then runs the resulting computation with a custom function. This can be used, for example, to supply a custom - InitialDistribution by providing runMockChainTFrom.

newtype MockChainLog Source #

Instances

Instances details
MonadFail StagedMockChain Source # 
Instance details

Defined in Cooked.MockChain.Staged

Methods

fail :: String -> StagedMockChain a #

Semigroup MockChainLog Source # 
Instance details

Defined in Cooked.MockChain.Staged

Monoid MockChainLog Source # 
Instance details

Defined in Cooked.MockChain.Staged

Alternative StagedMockChain Source # 
Instance details

Defined in Cooked.MockChain.Staged

PrettyCooked MockChainLog Source #

This pretty prints a MockChainLog that usually consists of the list of + InitialDistribution by providing runMockChainTFrom.

newtype MockChainLog Source #

Instances

Instances details
MonadFail StagedMockChain Source # 
Instance details

Defined in Cooked.MockChain.Staged

Semigroup MockChainLog Source # 
Instance details

Defined in Cooked.MockChain.Staged

Monoid MockChainLog Source # 
Instance details

Defined in Cooked.MockChain.Staged

Alternative StagedMockChain Source # 
Instance details

Defined in Cooked.MockChain.Staged

PrettyCooked MockChainLog Source #

This pretty prints a MockChainLog that usually consists of the list of validated or submitted transactions. In the log, we know a transaction has - been validated if the MCLogSubmittedTxSkel is followed by a MCLogNewTx.

Instance details

Defined in Cooked.Pretty.Cooked

MonadBlockChain StagedMockChain Source # 
Instance details

Defined in Cooked.MockChain.Staged

MonadBlockChainWithoutValidation StagedMockChain Source # 
Instance details

Defined in Cooked.MockChain.Staged

MonadBlockChainBalancing StagedMockChain Source # 
Instance details

Defined in Cooked.MockChain.Staged

Methods

getParams :: StagedMockChain Params Source #

utxosAtLedger :: Address -> StagedMockChain [(TxOutRef, TxOut)] Source #

datumFromHash :: DatumHash -> StagedMockChain (Maybe Datum) Source #

validatorFromHash :: ValidatorHash -> StagedMockChain (Maybe (Versioned Validator)) Source #

txOutByRefLedger :: TxOutRef -> StagedMockChain (Maybe TxOut) Source #

MonadError MockChainError StagedMockChain Source # 
Instance details

Defined in Cooked.MockChain.Staged

type StagedMockChain = Staged MockChainOp Source #

type MonadModalBlockChain m = (MonadBlockChain m, MonadModal m, Modification m ~ UntypedTweak InterpMockChain) Source #

A modal mock chain is a mock chain that allows us to use LTL modifications + been validated if the MCLogSubmittedTxSkel is followed by a MCLogNewTx.

Instance details

Defined in Cooked.Pretty.Cooked

MonadBlockChain StagedMockChain Source # 
Instance details

Defined in Cooked.MockChain.Staged

MonadBlockChainWithoutValidation StagedMockChain Source # 
Instance details

Defined in Cooked.MockChain.Staged

MonadBlockChainBalancing StagedMockChain Source # 
Instance details

Defined in Cooked.MockChain.Staged

MonadError MockChainError StagedMockChain Source # 
Instance details

Defined in Cooked.MockChain.Staged

type StagedMockChain = Staged MockChainOp Source #

type MonadModalBlockChain m = (MonadBlockChain m, MonadModal m, Modification m ~ UntypedTweak InterpMockChain) Source #

A modal mock chain is a mock chain that allows us to use LTL modifications with Tweaks

somewhere :: MonadModalBlockChain m => Tweak InterpMockChain b -> m a -> m a Source #

Apply a Tweak to some transaction in the given Trace. The tweak must apply at least once.

runTweak :: Tweak InterpMockChain a -> TxSkel -> [Either MockChainError (a, TxSkel)] Source #

everywhere :: MonadModalBlockChain m => Tweak InterpMockChain b -> m a -> m a Source #

Apply a Tweak to every transaction in a given trace. This is also successful if there are no transactions at all.

withTweak :: MonadModalBlockChain m => m x -> Tweak InterpMockChain a -> m x Source #

Apply a Tweak to the next transaction in the given trace. The order of @@ -12,4 +12,4 @@ ...

where endpoint builds and validates a single transaction depending on the given arguments. Then withTweak says "I want to modify the transaction returned by this endpoint in the following way".

there :: MonadModalBlockChain m => Integer -> Tweak InterpMockChain b -> m a -> m a Source #

Apply a Tweak to the nth transaction in a given trace, 0 indexed. - Only successful when this transaction exists and can be modified.

Orphan instances

MonadPlus m => MonadPlus (MockChainT m) Source # 
Instance details

Methods

mzero :: MockChainT m a #

mplus :: MockChainT m a -> MockChainT m a -> MockChainT m a #

\ No newline at end of file + Only successful when this transaction exists and can be modified.

Orphan instances

MonadPlus m => MonadPlus (MockChainT m) Source # 
Instance details

Methods

mzero :: MockChainT m a Source #

mplus :: MockChainT m a -> MockChainT m a -> MockChainT m a Source #

\ No newline at end of file diff --git a/Cooked-MockChain-Testing.html b/Cooked-MockChain-Testing.html index 64ef04839..3d66cfe3b 100644 --- a/Cooked-MockChain-Testing.html +++ b/Cooked-MockChain-Testing.html @@ -1,6 +1,6 @@ -Cooked.MockChain.Testing
cooked-validators-2.0.0
Safe HaskellNone
LanguageHaskell2010

Cooked.MockChain.Testing

Synopsis

Documentation

class IsProp prop where Source #

This module provides a common interface for HUnit and QuickCheck tests. - We do so by abstracting uses of Assertion and Property for (IsProp prop) => prop, - then provide instances for both HU.Asserton and QC.Property.

Minimal complete definition

testCounterexample, testConjoin, testDisjoin

Methods

testCounterexample :: String -> prop -> prop Source #

Displays the string to the user in case of failure

testConjoin :: [prop] -> prop Source #

Conjunction of a number of results

testDisjoin :: [prop] -> prop Source #

Disjunction of a number of results

testFailure :: prop Source #

Flags a failure

testSuccess :: prop Source #

Flags a success

testFailureMsg :: String -> prop Source #

Flags a failure with a message

Instances

Instances details
IsProp Bool Source # 
Instance details

Defined in Cooked.MockChain.Testing

IsProp Property Source # 
Instance details

Defined in Cooked.MockChain.Testing

Methods

testCounterexample :: String -> Property -> Property Source #

testConjoin :: [Property] -> Property Source #

testDisjoin :: [Property] -> Property Source #

testFailure :: Property Source #

testSuccess :: Property Source #

testFailureMsg :: String -> Property Source #

IsProp Assertion Source # 
Instance details

Defined in Cooked.MockChain.Testing

Methods

testCounterexample :: String -> Assertion -> Assertion Source #

testConjoin :: [Assertion] -> Assertion Source #

testDisjoin :: [Assertion] -> Assertion Source #

testFailure :: Assertion Source #

testSuccess :: Assertion Source #

testFailureMsg :: String -> Assertion Source #

testBool :: IsProp prop => Bool -> prop Source #

testAll :: IsProp prop => (a -> prop) -> [a] -> prop Source #

(.==.) :: (IsProp prop, Eq a) => a -> a -> prop infix 4 Source #

(.&&.) :: IsProp prop => prop -> prop -> prop infixr 3 Source #

(.||.) :: IsProp prop => prop -> prop -> prop infixr 2 Source #

testSucceeds :: IsProp prop => PrettyCookedOpts -> StagedMockChain a -> prop Source #

Ensure that all results produced by the staged mockchain succeed, starting +Cooked.MockChain.Testing

cooked-validators-2.0.0
Safe HaskellNone
LanguageHaskell2010

Cooked.MockChain.Testing

Synopsis

Documentation

class IsProp prop where Source #

This module provides a common interface for HUnit and QuickCheck tests. + We do so by abstracting uses of Assertion and Property for (IsProp prop) => prop, + then provide instances for both HU.Asserton and QC.Property.

Minimal complete definition

testCounterexample, testConjoin, testDisjoin

Methods

testCounterexample :: String -> prop -> prop Source #

Displays the string to the user in case of failure

testConjoin :: [prop] -> prop Source #

Conjunction of a number of results

testDisjoin :: [prop] -> prop Source #

Disjunction of a number of results

testFailure :: prop Source #

Flags a failure

testSuccess :: prop Source #

Flags a success

testFailureMsg :: String -> prop Source #

Flags a failure with a message

testBool :: IsProp prop => Bool -> prop Source #

testAll :: IsProp prop => (a -> prop) -> [a] -> prop Source #

(.==.) :: (IsProp prop, Eq a) => a -> a -> prop infix 4 Source #

(.&&.) :: IsProp prop => prop -> prop -> prop infixr 3 Source #

(.||.) :: IsProp prop => prop -> prop -> prop infixr 2 Source #

testSucceeds :: IsProp prop => PrettyCookedOpts -> StagedMockChain a -> prop Source #

Ensure that all results produced by the staged mockchain succeed, starting from the default initial distribution

testFails :: (IsProp prop, Show a) => PrettyCookedOpts -> (MockChainError -> prop) -> StagedMockChain a -> prop Source #

Ensure that all results produced by the staged mockchain fail and that a predicate holds over the error.

To test that validation fails, use > testFails def (isCekEvaluationFailure def) e

testSucceedsFrom :: IsProp prop => PrettyCookedOpts -> InitialDistribution -> StagedMockChain a -> prop Source #

Ensure that all results produced by the staged mockchain succeed starting @@ -27,5 +27,5 @@ the predicate gets the trace descriptions that led to each potential outcome and is responsible for calling testCounterexample communicate these to the user.

Although this function is mainly used internally, as a building block for the simpler predicates, it can be useful in building some custom predicates. Check testAllSatisfiesFrom - or testBinaryRelatedBy for examples on using this.

TestResult instances

assertionToMaybe :: Assertion -> IO (Maybe HUnitFailure) Source #

forAll :: Show a => Gen a -> (a -> Property) -> Property Source #

Here we provide our own universsal quantifier instead of forAll, so we can monomorphize - it to returning a Property

\ No newline at end of file + or testBinaryRelatedBy for examples on using this.

TestResult instances

forAll :: Show a => Gen a -> (a -> Property) -> Property Source #

Here we provide our own universsal quantifier instead of forAll, so we can monomorphize + it to returning a Property

\ No newline at end of file diff --git a/Cooked-MockChain-UtxoSearch.html b/Cooked-MockChain-UtxoSearch.html index e69c959b0..82883ce51 100644 --- a/Cooked-MockChain-UtxoSearch.html +++ b/Cooked-MockChain-UtxoSearch.html @@ -1,9 +1,9 @@ -Cooked.MockChain.UtxoSearch
cooked-validators-2.0.0
Safe HaskellNone
LanguageHaskell2010

Cooked.MockChain.UtxoSearch

Synopsis

Documentation

runUtxoSearch :: Monad m => UtxoSearch m a -> m [(TxOutRef, a)] Source #

Given a UTxO search, we can run it to obtain a list of UTxOs.

allUtxosSearch :: MonadBlockChain m => UtxoSearch m TxOut Source #

Search all currently known TxOutRefs together with their corresponding - TxInfo-TxOut.

allUtxosLedgerSearch :: MonadBlockChain m => UtxoSearch m TxOut Source #

Like allUtxosSearch, but returns a Ledger-level representation of the - transaction outputs, which might contain more information.

utxosAtSearch :: MonadBlockChainBalancing m => Address -> UtxoSearch m TxOut Source #

Search all TxOutRefs at a certain address, together with their - TxInfo-TxOut.

utxosAtLedgerSearch :: MonadBlockChainBalancing m => Address -> UtxoSearch m TxOut Source #

Like utxosAtSearch, but returns a Ledger-level representation of the - transaction outputs, which might contain more information.

utxosFromCardanoTxSearch :: Monad m => CardanoTx -> UtxoSearch m TxOut Source #

Search all TxOutRefs of a transaction, together with their - TxInfo-TxOut.

txOutByRefSearch :: MonadBlockChainBalancing m => [TxOutRef] -> UtxoSearch m TxOut Source #

Search all TxInfo-TxOuts corresponding to given the list of +Cooked.MockChain.UtxoSearch

cooked-validators-2.0.0
Safe HaskellNone
LanguageHaskell2010

Cooked.MockChain.UtxoSearch

Synopsis

Documentation

runUtxoSearch :: Monad m => UtxoSearch m a -> m [(TxOutRef, a)] Source #

Given a UTxO search, we can run it to obtain a list of UTxOs.

allUtxosSearch :: MonadBlockChain m => UtxoSearch m TxOut Source #

Search all currently known TxOutRefs together with their corresponding + TxInfo-TxOut.

allUtxosLedgerSearch :: MonadBlockChain m => UtxoSearch m TxOut Source #

Like allUtxosSearch, but returns a Ledger-level representation of the + transaction outputs, which might contain more information.

utxosAtSearch :: MonadBlockChainBalancing m => Address -> UtxoSearch m TxOut Source #

Search all TxOutRefs at a certain address, together with their + TxInfo-TxOut.

utxosAtLedgerSearch :: MonadBlockChainBalancing m => Address -> UtxoSearch m TxOut Source #

Like utxosAtSearch, but returns a Ledger-level representation of the + transaction outputs, which might contain more information.

utxosFromCardanoTxSearch :: Monad m => CardanoTx -> UtxoSearch m TxOut Source #

Search all TxOutRefs of a transaction, together with their + TxInfo-TxOut.

txOutByRefSearch :: MonadBlockChainBalancing m => [TxOutRef] -> UtxoSearch m TxOut Source #

Search all TxInfo-TxOuts corresponding to given the list of TxOutRefs. Any TxOutRef that doesn't correspond to a known output will be filtered out.

filterWith :: Monad m => UtxoSearch m a -> (a -> m (Maybe b)) -> UtxoSearch m b Source #

Transform a UtxoSearch by applying a possibly failing monadic "lookup" - on every output.

filterWithPure :: Monad m => UtxoSearch m a -> (a -> Maybe b) -> UtxoSearch m b Source #

filterWithOptic :: (Is k An_AffineFold, Monad m) => UtxoSearch m a -> Optic' k is a b -> UtxoSearch m b Source #

filterWithPred :: Monad m => UtxoSearch m a -> (a -> Bool) -> UtxoSearch m a Source #

filterWithValuePred :: Monad m => UtxoSearch m TxOut -> (Value -> Bool) -> UtxoSearch m Value Source #

filterWithOnlyAda :: Monad m => UtxoSearch m TxOut -> UtxoSearch m Value Source #

filterWithNotOnlyAda :: Monad m => UtxoSearch m TxOut -> UtxoSearch m Value Source #

\ No newline at end of file + on every output.

filterWithPure :: Monad m => UtxoSearch m a -> (a -> Maybe b) -> UtxoSearch m b Source #

filterWithOptic :: (Is k An_AffineFold, Monad m) => UtxoSearch m a -> Optic' k is a b -> UtxoSearch m b Source #

filterWithPred :: Monad m => UtxoSearch m a -> (a -> Bool) -> UtxoSearch m a Source #

filterWithValuePred :: Monad m => UtxoSearch m TxOut -> (Value -> Bool) -> UtxoSearch m Value Source #

filterWithOnlyAda :: Monad m => UtxoSearch m TxOut -> UtxoSearch m Value Source #

filterWithNotOnlyAda :: Monad m => UtxoSearch m TxOut -> UtxoSearch m Value Source #

\ No newline at end of file diff --git a/Cooked-MockChain-UtxoState.html b/Cooked-MockChain-UtxoState.html index b0e437839..8881087b6 100644 --- a/Cooked-MockChain-UtxoState.html +++ b/Cooked-MockChain-UtxoState.html @@ -1,3 +1,3 @@ -Cooked.MockChain.UtxoState
cooked-validators-2.0.0
Safe HaskellNone
LanguageHaskell2010

Cooked.MockChain.UtxoState

Documentation

newtype UtxoState Source #

A description of who owns what in a blockchain. Owners are addresses - and they each own a UtxoPayloadSet.

Constructors

UtxoState 

Fields

Instances

Instances details
Eq UtxoState Source # 
Instance details

Defined in Cooked.MockChain.UtxoState

Semigroup UtxoState Source # 
Instance details

Defined in Cooked.MockChain.UtxoState

PrettyCooked UtxoState Source #

Pretty print a UtxoState. Print the known wallets first, then unknown - pubkeys, then scripts.

Instance details

Defined in Cooked.Pretty.Cooked

Show a => PrettyCooked (Either MockChainError (a, UtxoState)) Source # 
Instance details

Defined in Cooked.Pretty.Cooked

Show a => PrettyCooked (a, UtxoState) Source # 
Instance details

Defined in Cooked.Pretty.Cooked

data UtxoPayload Source #

A convenient wrapping of the interesting information of a UTxO.

Instances

Instances details
Eq UtxoPayload Source # 
Instance details

Defined in Cooked.MockChain.UtxoState

Show UtxoPayload Source # 
Instance details

Defined in Cooked.MockChain.UtxoState

holdsInState :: Address -> UtxoState -> Value Source #

Total value accessible to what's pointed by the address.

\ No newline at end of file +Cooked.MockChain.UtxoState
cooked-validators-2.0.0
Safe HaskellNone
LanguageHaskell2010

Cooked.MockChain.UtxoState

Documentation

newtype UtxoState Source #

A description of who owns what in a blockchain. Owners are addresses + and they each own a UtxoPayloadSet.

Constructors

UtxoState 

data UtxoPayload Source #

A convenient wrapping of the interesting information of a UTxO.

holdsInState :: Address -> UtxoState -> Value Source #

Total value accessible to what's pointed by the address.

\ No newline at end of file diff --git a/Cooked-MockChain.html b/Cooked-MockChain.html index 4198e1cae..06d0dde8f 100644 --- a/Cooked-MockChain.html +++ b/Cooked-MockChain.html @@ -1,55 +1,55 @@ -Cooked.MockChain
cooked-validators-2.0.0
Safe HaskellNone
LanguageHaskell2010

Cooked.MockChain

Synopsis

Documentation

data UtxoState Source #

A description of who owns what in a blockchain. Owners are addresses - and they each own a UtxoPayloadSet.

Instances

Instances details
Eq UtxoState Source # 
Instance details

Defined in Cooked.MockChain.UtxoState

Semigroup UtxoState Source # 
Instance details

Defined in Cooked.MockChain.UtxoState

PrettyCooked UtxoState Source #

Pretty print a UtxoState. Print the known wallets first, then unknown - pubkeys, then scripts.

Instance details

Defined in Cooked.Pretty.Cooked

Show a => PrettyCooked (Either MockChainError (a, UtxoState)) Source # 
Instance details

Defined in Cooked.Pretty.Cooked

Show a => PrettyCooked (a, UtxoState) Source # 
Instance details

Defined in Cooked.Pretty.Cooked

holdsInState :: Address -> UtxoState -> Value Source #

Total value accessible to what's pointed by the address.

newtype AsTrans t (m :: Type -> Type) a Source #

A newtype wrapper to be used with '-XDerivingVia' to derive instances of MonadBlockChain - for any MonadTransControl.

For example, to derive 'MonadBlockChain m => MonadBlockChain (ReaderT r m)', you'd write

deriving via (AsTrans (ReaderT r) m) instance MonadBlockChain m => MonadBlockChain (ReaderT r m)

and avoid the boilerplate of defining all the methods of the class yourself.

Constructors

AsTrans 

Fields

Instances

Instances details
(MonadTransControl t, MonadError MockChainError m, Monad (t m)) => MonadError MockChainError (AsTrans t m) Source # 
Instance details

Defined in Cooked.MockChain.BlockChain

Methods

throwError :: MockChainError -> AsTrans t m a #

catchError :: AsTrans t m a -> (MockChainError -> AsTrans t m a) -> AsTrans t m a #

MonadTrans t => MonadTrans (AsTrans t) Source # 
Instance details

Defined in Cooked.MockChain.BlockChain

Methods

lift :: Monad m => m a -> AsTrans t m a #

MonadTransControl t => MonadTransControl (AsTrans t) Source # 
Instance details

Defined in Cooked.MockChain.BlockChain

Associated Types

type StT (AsTrans t) a

Methods

liftWith :: Monad m => (Run (AsTrans t) -> m a) -> AsTrans t m a

restoreT :: Monad m => m (StT (AsTrans t) a) -> AsTrans t m a

Monad (t m) => Monad (AsTrans t m) Source # 
Instance details

Defined in Cooked.MockChain.BlockChain

Methods

(>>=) :: AsTrans t m a -> (a -> AsTrans t m b) -> AsTrans t m b #

(>>) :: AsTrans t m a -> AsTrans t m b -> AsTrans t m b #

return :: a -> AsTrans t m a #

Functor (t m) => Functor (AsTrans t m) Source # 
Instance details

Defined in Cooked.MockChain.BlockChain

Methods

fmap :: (a -> b) -> AsTrans t m a -> AsTrans t m b #

(<$) :: a -> AsTrans t m b -> AsTrans t m a #

(MonadTrans t, MonadFail m, Monad (t m)) => MonadFail (AsTrans t m) Source # 
Instance details

Defined in Cooked.MockChain.BlockChain

Methods

fail :: String -> AsTrans t m a #

Applicative (t m) => Applicative (AsTrans t m) Source # 
Instance details

Defined in Cooked.MockChain.BlockChain

Methods

pure :: a -> AsTrans t m a #

(<*>) :: AsTrans t m (a -> b) -> AsTrans t m a -> AsTrans t m b #

liftA2 :: (a -> b -> c) -> AsTrans t m a -> AsTrans t m b -> AsTrans t m c #

(*>) :: AsTrans t m a -> AsTrans t m b -> AsTrans t m b #

(<*) :: AsTrans t m a -> AsTrans t m b -> AsTrans t m a #

(MonadTrans t, MonadBlockChain m, MonadBlockChainWithoutValidation (AsTrans t m)) => MonadBlockChain (AsTrans t m) Source # 
Instance details

Defined in Cooked.MockChain.BlockChain

Methods

validateTxSkel :: TxSkel -> AsTrans t m CardanoTx Source #

(MonadTrans t, MonadBlockChainWithoutValidation m, Monad (t m), MonadError MockChainError (AsTrans t m)) => MonadBlockChainWithoutValidation (AsTrans t m) Source # 
Instance details

Defined in Cooked.MockChain.BlockChain

Methods

allUtxosLedger :: AsTrans t m [(TxOutRef, TxOut)] Source #

currentSlot :: AsTrans t m Slot Source #

awaitSlot :: Slot -> AsTrans t m Slot Source #

(MonadTrans t, MonadBlockChainBalancing m, Monad (t m), MonadError MockChainError (AsTrans t m)) => MonadBlockChainBalancing (AsTrans t m) Source # 
Instance details

Defined in Cooked.MockChain.BlockChain

Methods

getParams :: AsTrans t m Params Source #

utxosAtLedger :: Address -> AsTrans t m [(TxOutRef, TxOut)] Source #

datumFromHash :: DatumHash -> AsTrans t m (Maybe Datum) Source #

validatorFromHash :: ValidatorHash -> AsTrans t m (Maybe (Versioned Validator)) Source #

txOutByRefLedger :: TxOutRef -> AsTrans t m (Maybe TxOut) Source #

type StT (AsTrans t) a Source # 
Instance details

Defined in Cooked.MockChain.BlockChain

type StT (AsTrans t) a = StT t a

class MonadBlockChainWithoutValidation m => MonadBlockChain m where Source #

The main abstraction of the blockchain.

Methods

validateTxSkel :: TxSkel -> m CardanoTx Source #

Generates, balances and validates a transaction from a skeleton. +Cooked.MockChain

cooked-validators-2.0.0
Safe HaskellNone
LanguageHaskell2010

Cooked.MockChain

Synopsis

Documentation

data UtxoState Source #

A description of who owns what in a blockchain. Owners are addresses + and they each own a UtxoPayloadSet.

holdsInState :: Address -> UtxoState -> Value Source #

Total value accessible to what's pointed by the address.

newtype AsTrans t (m :: Type -> Type) a Source #

A newtype wrapper to be used with '-XDerivingVia' to derive instances of MonadBlockChain + for any MonadTransControl.

For example, to derive 'MonadBlockChain m => MonadBlockChain (ReaderT r m)', you'd write

deriving via (AsTrans (ReaderT r) m) instance MonadBlockChain m => MonadBlockChain (ReaderT r m)

and avoid the boilerplate of defining all the methods of the class yourself.

Constructors

AsTrans 

Fields

Instances

Instances details
(MonadTransControl t, MonadError MockChainError m, Monad (t m)) => MonadError MockChainError (AsTrans t m) Source # 
Instance details

Defined in Cooked.MockChain.BlockChain

Methods

throwError :: MockChainError -> AsTrans t m a Source #

catchError :: AsTrans t m a -> (MockChainError -> AsTrans t m a) -> AsTrans t m a Source #

MonadTrans t => MonadTrans (AsTrans t) Source # 
Instance details

Defined in Cooked.MockChain.BlockChain

Methods

lift :: Monad m => m a -> AsTrans t m a Source #

MonadTransControl t => MonadTransControl (AsTrans t) Source # 
Instance details

Defined in Cooked.MockChain.BlockChain

Associated Types

type StT (AsTrans t) a Source #

Methods

liftWith :: Monad m => (Run (AsTrans t) -> m a) -> AsTrans t m a Source #

restoreT :: Monad m => m (StT (AsTrans t) a) -> AsTrans t m a Source #

Monad (t m) => Monad (AsTrans t m) Source # 
Instance details

Defined in Cooked.MockChain.BlockChain

Methods

(>>=) :: AsTrans t m a -> (a -> AsTrans t m b) -> AsTrans t m b Source #

(>>) :: AsTrans t m a -> AsTrans t m b -> AsTrans t m b Source #

return :: a -> AsTrans t m a Source #

Functor (t m) => Functor (AsTrans t m) Source # 
Instance details

Defined in Cooked.MockChain.BlockChain

Methods

fmap :: (a -> b) -> AsTrans t m a -> AsTrans t m b Source #

(<$) :: a -> AsTrans t m b -> AsTrans t m a Source #

(MonadTrans t, MonadFail m, Monad (t m)) => MonadFail (AsTrans t m) Source # 
Instance details

Defined in Cooked.MockChain.BlockChain

Methods

fail :: String -> AsTrans t m a Source #

Applicative (t m) => Applicative (AsTrans t m) Source # 
Instance details

Defined in Cooked.MockChain.BlockChain

Methods

pure :: a -> AsTrans t m a Source #

(<*>) :: AsTrans t m (a -> b) -> AsTrans t m a -> AsTrans t m b Source #

liftA2 :: (a -> b -> c) -> AsTrans t m a -> AsTrans t m b -> AsTrans t m c Source #

(*>) :: AsTrans t m a -> AsTrans t m b -> AsTrans t m b Source #

(<*) :: AsTrans t m a -> AsTrans t m b -> AsTrans t m a Source #

(MonadTrans t, MonadBlockChain m, MonadBlockChainWithoutValidation (AsTrans t m)) => MonadBlockChain (AsTrans t m) Source # 
Instance details

Defined in Cooked.MockChain.BlockChain

(MonadTrans t, MonadBlockChainWithoutValidation m, Monad (t m), MonadError MockChainError (AsTrans t m)) => MonadBlockChainWithoutValidation (AsTrans t m) Source # 
Instance details

Defined in Cooked.MockChain.BlockChain

(MonadTrans t, MonadBlockChainBalancing m, Monad (t m), MonadError MockChainError (AsTrans t m)) => MonadBlockChainBalancing (AsTrans t m) Source # 
Instance details

Defined in Cooked.MockChain.BlockChain

type StT (AsTrans t) a Source # 
Instance details

Defined in Cooked.MockChain.BlockChain

type StT (AsTrans t) a = StT t a

class MonadBlockChainWithoutValidation m => MonadBlockChain m where Source #

The main abstraction of the blockchain.

Methods

validateTxSkel :: TxSkel -> m CardanoTx Source #

Generates, balances and validates a transaction from a skeleton. It returns the validated transaction and updates the state of the blockchain. In MockChainT, this means: - deletes the consumed outputs from mcstIndex - adds the produced outputs to msctIndex - deletes the consumed datums from mcstDatums - adds the produced datums to mcstDatums - - adds the validators on outputs to the mcstValidators.

Instances

Instances details
MonadBlockChain StagedMockChain Source # 
Instance details

Defined in Cooked.MockChain.Staged

MonadBlockChain m => MonadBlockChain (ListT m) Source # 
Instance details

Defined in Cooked.MockChain.BlockChain

Methods

validateTxSkel :: TxSkel -> ListT m CardanoTx Source #

Monad m => MonadBlockChain (MockChainT m) Source # 
Instance details

Defined in Cooked.MockChain.Direct

Methods

validateTxSkel :: TxSkel -> MockChainT m CardanoTx Source #

MonadBlockChain m => MonadBlockChain (ReaderT r m) Source # 
Instance details

Defined in Cooked.MockChain.BlockChain

Methods

validateTxSkel :: TxSkel -> ReaderT r m CardanoTx Source #

MonadBlockChain m => MonadBlockChain (StateT s m) Source # 
Instance details

Defined in Cooked.MockChain.BlockChain

Methods

validateTxSkel :: TxSkel -> StateT s m CardanoTx Source #

(Monoid w, MonadBlockChain m) => MonadBlockChain (WriterT w m) Source # 
Instance details

Defined in Cooked.MockChain.BlockChain

Methods

validateTxSkel :: TxSkel -> WriterT w m CardanoTx Source #

(MonadTrans t, MonadBlockChain m, MonadBlockChainWithoutValidation (AsTrans t m)) => MonadBlockChain (AsTrans t m) Source # 
Instance details

Defined in Cooked.MockChain.BlockChain

Methods

validateTxSkel :: TxSkel -> AsTrans t m CardanoTx Source #

class MonadBlockChainBalancing m => MonadBlockChainWithoutValidation m where Source #

Methods

allUtxosLedger :: m [(TxOutRef, TxOut)] Source #

Returns a list of all currently known outputs.

currentSlot :: m Slot Source #

Returns the current slot number

awaitSlot :: Slot -> m Slot Source #

Waits until the current slot becomes greater or equal to the given slot, + - adds the validators on outputs to the mcstValidators.

class MonadBlockChainBalancing m => MonadBlockChainWithoutValidation m where Source #

Methods

allUtxosLedger :: m [(TxOutRef, TxOut)] Source #

Returns a list of all currently known outputs.

currentSlot :: m Slot Source #

Returns the current slot number

awaitSlot :: Slot -> m Slot Source #

Waits until the current slot becomes greater or equal to the given slot, and returns the current slot after waiting.

Note that it might not wait for anything if the current slot is large - enough.

Instances

Instances details
MonadBlockChainWithoutValidation StagedMockChain Source # 
Instance details

Defined in Cooked.MockChain.Staged

MonadBlockChainWithoutValidation m => MonadBlockChainWithoutValidation (ListT m) Source # 
Instance details

Defined in Cooked.MockChain.BlockChain

Methods

allUtxosLedger :: ListT m [(TxOutRef, TxOut)] Source #

currentSlot :: ListT m Slot Source #

awaitSlot :: Slot -> ListT m Slot Source #

Monad m => MonadBlockChainWithoutValidation (MockChainT m) Source # 
Instance details

Defined in Cooked.MockChain.Direct

Methods

allUtxosLedger :: MockChainT m [(TxOutRef, TxOut)] Source #

currentSlot :: MockChainT m Slot Source #

awaitSlot :: Slot -> MockChainT m Slot Source #

MonadBlockChainWithoutValidation m => MonadBlockChainWithoutValidation (ReaderT r m) Source # 
Instance details

Defined in Cooked.MockChain.BlockChain

Methods

allUtxosLedger :: ReaderT r m [(TxOutRef, TxOut)] Source #

currentSlot :: ReaderT r m Slot Source #

awaitSlot :: Slot -> ReaderT r m Slot Source #

MonadBlockChainWithoutValidation m => MonadBlockChainWithoutValidation (StateT s m) Source # 
Instance details

Defined in Cooked.MockChain.BlockChain

Methods

allUtxosLedger :: StateT s m [(TxOutRef, TxOut)] Source #

currentSlot :: StateT s m Slot Source #

awaitSlot :: Slot -> StateT s m Slot Source #

(Monoid w, MonadBlockChainWithoutValidation m) => MonadBlockChainWithoutValidation (WriterT w m) Source # 
Instance details

Defined in Cooked.MockChain.BlockChain

Methods

allUtxosLedger :: WriterT w m [(TxOutRef, TxOut)] Source #

currentSlot :: WriterT w m Slot Source #

awaitSlot :: Slot -> WriterT w m Slot Source #

(MonadTrans t, MonadBlockChainWithoutValidation m, Monad (t m), MonadError MockChainError (AsTrans t m)) => MonadBlockChainWithoutValidation (AsTrans t m) Source # 
Instance details

Defined in Cooked.MockChain.BlockChain

Methods

allUtxosLedger :: AsTrans t m [(TxOutRef, TxOut)] Source #

currentSlot :: AsTrans t m Slot Source #

awaitSlot :: Slot -> AsTrans t m Slot Source #

class (MonadFail m, MonadError MockChainError m) => MonadBlockChainBalancing m where Source #

Contains methods needed for balancing.

Methods

getParams :: m Params Source #

Returns the parameters of the chain.

utxosAtLedger :: Address -> m [(TxOutRef, TxOut)] Source #

Returns a list of all UTxOs at a certain address.

datumFromHash :: DatumHash -> m (Maybe Datum) Source #

Returns the datum with the given hash or Nothing if there is none

validatorFromHash :: ValidatorHash -> m (Maybe (Versioned Validator)) Source #

Returns the full validator corresponding to hash, if that validator owns - something or if it is stored in the reference script field of some UTxO.

txOutByRefLedger :: TxOutRef -> m (Maybe TxOut) Source #

Returns an output given a reference to it

Instances

Instances details
MonadBlockChainBalancing StagedMockChain Source # 
Instance details

Defined in Cooked.MockChain.Staged

Methods

getParams :: StagedMockChain Params Source #

utxosAtLedger :: Address -> StagedMockChain [(TxOutRef, TxOut)] Source #

datumFromHash :: DatumHash -> StagedMockChain (Maybe Datum) Source #

validatorFromHash :: ValidatorHash -> StagedMockChain (Maybe (Versioned Validator)) Source #

txOutByRefLedger :: TxOutRef -> StagedMockChain (Maybe TxOut) Source #

MonadBlockChainBalancing m => MonadBlockChainBalancing (ListT m) Source # 
Instance details

Defined in Cooked.MockChain.BlockChain

Methods

getParams :: ListT m Params Source #

utxosAtLedger :: Address -> ListT m [(TxOutRef, TxOut)] Source #

datumFromHash :: DatumHash -> ListT m (Maybe Datum) Source #

validatorFromHash :: ValidatorHash -> ListT m (Maybe (Versioned Validator)) Source #

txOutByRefLedger :: TxOutRef -> ListT m (Maybe TxOut) Source #

Monad m => MonadBlockChainBalancing (MockChainT m) Source # 
Instance details

Defined in Cooked.MockChain.Direct

Methods

getParams :: MockChainT m Params Source #

utxosAtLedger :: Address -> MockChainT m [(TxOutRef, TxOut)] Source #

datumFromHash :: DatumHash -> MockChainT m (Maybe Datum) Source #

validatorFromHash :: ValidatorHash -> MockChainT m (Maybe (Versioned Validator)) Source #

txOutByRefLedger :: TxOutRef -> MockChainT m (Maybe TxOut) Source #

MonadBlockChainBalancing m => MonadBlockChainBalancing (ReaderT r m) Source # 
Instance details

Defined in Cooked.MockChain.BlockChain

Methods

getParams :: ReaderT r m Params Source #

utxosAtLedger :: Address -> ReaderT r m [(TxOutRef, TxOut)] Source #

datumFromHash :: DatumHash -> ReaderT r m (Maybe Datum) Source #

validatorFromHash :: ValidatorHash -> ReaderT r m (Maybe (Versioned Validator)) Source #

txOutByRefLedger :: TxOutRef -> ReaderT r m (Maybe TxOut) Source #

MonadBlockChainBalancing m => MonadBlockChainBalancing (StateT s m) Source # 
Instance details

Defined in Cooked.MockChain.BlockChain

Methods

getParams :: StateT s m Params Source #

utxosAtLedger :: Address -> StateT s m [(TxOutRef, TxOut)] Source #

datumFromHash :: DatumHash -> StateT s m (Maybe Datum) Source #

validatorFromHash :: ValidatorHash -> StateT s m (Maybe (Versioned Validator)) Source #

txOutByRefLedger :: TxOutRef -> StateT s m (Maybe TxOut) Source #

(Monoid w, MonadBlockChainBalancing m) => MonadBlockChainBalancing (WriterT w m) Source # 
Instance details

Defined in Cooked.MockChain.BlockChain

Methods

getParams :: WriterT w m Params Source #

utxosAtLedger :: Address -> WriterT w m [(TxOutRef, TxOut)] Source #

datumFromHash :: DatumHash -> WriterT w m (Maybe Datum) Source #

validatorFromHash :: ValidatorHash -> WriterT w m (Maybe (Versioned Validator)) Source #

txOutByRefLedger :: TxOutRef -> WriterT w m (Maybe TxOut) Source #

(MonadTrans t, MonadBlockChainBalancing m, Monad (t m), MonadError MockChainError (AsTrans t m)) => MonadBlockChainBalancing (AsTrans t m) Source # 
Instance details

Defined in Cooked.MockChain.BlockChain

Methods

getParams :: AsTrans t m Params Source #

utxosAtLedger :: Address -> AsTrans t m [(TxOutRef, TxOut)] Source #

datumFromHash :: DatumHash -> AsTrans t m (Maybe Datum) Source #

validatorFromHash :: ValidatorHash -> AsTrans t m (Maybe (Versioned Validator)) Source #

txOutByRefLedger :: TxOutRef -> AsTrans t m (Maybe TxOut) Source #

data MCEUnbalanceableError Source #

Constructors

MCEUnbalNotEnoughFunds Wallet Value

The balancing wallet misses some value to pay what is needed to balance - the transaction.

MCEUnbalNotEnoughReturning (Value, [TxOutRef]) (Value, [TxOutRef]) Value

There is value to return to the balancing wallet but not enough to + enough.

Instances

Instances details
MonadBlockChainWithoutValidation StagedMockChain Source # 
Instance details

Defined in Cooked.MockChain.Staged

MonadBlockChainWithoutValidation m => MonadBlockChainWithoutValidation (ListT m) Source # 
Instance details

Defined in Cooked.MockChain.BlockChain

Monad m => MonadBlockChainWithoutValidation (MockChainT m) Source # 
Instance details

Defined in Cooked.MockChain.Direct

MonadBlockChainWithoutValidation m => MonadBlockChainWithoutValidation (ReaderT r m) Source # 
Instance details

Defined in Cooked.MockChain.BlockChain

MonadBlockChainWithoutValidation m => MonadBlockChainWithoutValidation (StateT s m) Source # 
Instance details

Defined in Cooked.MockChain.BlockChain

(Monoid w, MonadBlockChainWithoutValidation m) => MonadBlockChainWithoutValidation (WriterT w m) Source # 
Instance details

Defined in Cooked.MockChain.BlockChain

(MonadTrans t, MonadBlockChainWithoutValidation m, Monad (t m), MonadError MockChainError (AsTrans t m)) => MonadBlockChainWithoutValidation (AsTrans t m) Source # 
Instance details

Defined in Cooked.MockChain.BlockChain

class (MonadFail m, MonadError MockChainError m) => MonadBlockChainBalancing m where Source #

Contains methods needed for balancing.

Methods

getParams :: m Params Source #

Returns the parameters of the chain.

utxosAtLedger :: Address -> m [(TxOutRef, TxOut)] Source #

Returns a list of all UTxOs at a certain address.

datumFromHash :: DatumHash -> m (Maybe Datum) Source #

Returns the datum with the given hash or Nothing if there is none

validatorFromHash :: ValidatorHash -> m (Maybe (Versioned Validator)) Source #

Returns the full validator corresponding to hash, if that validator owns + something or if it is stored in the reference script field of some UTxO.

txOutByRefLedger :: TxOutRef -> m (Maybe TxOut) Source #

Returns an output given a reference to it

Instances

Instances details
MonadBlockChainBalancing StagedMockChain Source # 
Instance details

Defined in Cooked.MockChain.Staged

MonadBlockChainBalancing m => MonadBlockChainBalancing (ListT m) Source # 
Instance details

Defined in Cooked.MockChain.BlockChain

Monad m => MonadBlockChainBalancing (MockChainT m) Source # 
Instance details

Defined in Cooked.MockChain.Direct

MonadBlockChainBalancing m => MonadBlockChainBalancing (ReaderT r m) Source # 
Instance details

Defined in Cooked.MockChain.BlockChain

MonadBlockChainBalancing m => MonadBlockChainBalancing (StateT s m) Source # 
Instance details

Defined in Cooked.MockChain.BlockChain

(Monoid w, MonadBlockChainBalancing m) => MonadBlockChainBalancing (WriterT w m) Source # 
Instance details

Defined in Cooked.MockChain.BlockChain

(MonadTrans t, MonadBlockChainBalancing m, Monad (t m), MonadError MockChainError (AsTrans t m)) => MonadBlockChainBalancing (AsTrans t m) Source # 
Instance details

Defined in Cooked.MockChain.BlockChain

data MCEUnbalanceableError Source #

Constructors

MCEUnbalNotEnoughFunds Wallet Value

The balancing wallet misses some value to pay what is needed to balance + the transaction.

MCEUnbalNotEnoughReturning (Value, [TxOutRef]) (Value, [TxOutRef]) Value

There is value to return to the balancing wallet but not enough to fullfill the min ada requirement and there is not enough in additional - inputs to make it possible.

data MockChainError where Source #

The errors that can be produced by the MockChainT monad

Constructors

MCEValidationError :: ValidationErrorInPhase -> MockChainError 
MCEUnbalanceable :: MCEUnbalanceableError -> TxSkel -> MockChainError 
MCENoSuitableCollateral :: MockChainError

Thrown when the balancing wallet owns no output that is pure Ada and - with no datum.

MCEGenerationError :: GenerateTxError -> MockChainError 
MCECalcFee :: MockChainError -> MockChainError

Errors happening at fee calculation time.

MCEUnknownOutRefError :: String -> TxOutRef -> MockChainError

Thrown when an output reference should be in the state of the mockchain, - but isn't.

MCEUnknownValidator :: String -> ValidatorHash -> MockChainError

Same as MCEUnknownOutRefError for validators.

MCEUnknownDatum :: String -> DatumHash -> MockChainError

Same as MCEUnknownOutRefError for datums.

FailWith :: String -> MockChainError

Used to provide MonadFail instances.

OtherMockChainError :: (Show err, Eq err) => err -> MockChainError 

Instances

Instances details
Eq MockChainError Source # 
Instance details

Defined in Cooked.MockChain.BlockChain

Show MockChainError Source # 
Instance details

Defined in Cooked.MockChain.BlockChain

PrettyCooked MockChainError Source # 
Instance details

Defined in Cooked.Pretty.Cooked

MonadError MockChainError StagedMockChain Source # 
Instance details

Defined in Cooked.MockChain.Staged

Monad m => MonadError MockChainError (MockChainT m) Source # 
Instance details

Defined in Cooked.MockChain.Direct

(MonadTransControl t, MonadError MockChainError m, Monad (t m)) => MonadError MockChainError (AsTrans t m) Source # 
Instance details

Defined in Cooked.MockChain.BlockChain

Methods

throwError :: MockChainError -> AsTrans t m a #

catchError :: AsTrans t m a -> (MockChainError -> AsTrans t m a) -> AsTrans t m a #

Show a => PrettyCooked (Either MockChainError (a, UtxoState)) Source # 
Instance details

Defined in Cooked.Pretty.Cooked

allUtxos :: MonadBlockChainWithoutValidation m => m [(TxOutRef, TxOut)] Source #

utxosAt :: MonadBlockChainBalancing m => Address -> m [(TxOutRef, TxOut)] Source #

txOutByRef :: MonadBlockChainBalancing m => TxOutRef -> m (Maybe TxOut) Source #

utxosFromCardanoTx :: CardanoTx -> [(TxOutRef, TxOut)] Source #

Retrieve the ordered list of outputs of the given CardanoTx.

This is useful when writing endpoints and/or traces to fetch utxos of + inputs to make it possible.

data MockChainError where Source #

The errors that can be produced by the MockChainT monad

Constructors

MCEValidationError :: ValidationErrorInPhase -> MockChainError 
MCEUnbalanceable :: MCEUnbalanceableError -> TxSkel -> MockChainError 
MCENoSuitableCollateral :: MockChainError

Thrown when the balancing wallet owns no output that is pure Ada and + with no datum.

MCEGenerationError :: GenerateTxError -> MockChainError 
MCECalcFee :: MockChainError -> MockChainError

Errors happening at fee calculation time.

MCEUnknownOutRefError :: String -> TxOutRef -> MockChainError

Thrown when an output reference should be in the state of the mockchain, + but isn't.

MCEUnknownValidator :: String -> ValidatorHash -> MockChainError

Same as MCEUnknownOutRefError for validators.

MCEUnknownDatum :: String -> DatumHash -> MockChainError

Same as MCEUnknownOutRefError for datums.

FailWith :: String -> MockChainError

Used to provide MonadFail instances.

OtherMockChainError :: (Show err, Eq err) => err -> MockChainError 

Instances

Instances details
Eq MockChainError Source # 
Instance details

Defined in Cooked.MockChain.BlockChain

Show MockChainError Source # 
Instance details

Defined in Cooked.MockChain.BlockChain

PrettyCooked MockChainError Source # 
Instance details

Defined in Cooked.Pretty.Cooked

MonadError MockChainError StagedMockChain Source # 
Instance details

Defined in Cooked.MockChain.Staged

Monad m => MonadError MockChainError (MockChainT m) Source # 
Instance details

Defined in Cooked.MockChain.Direct

(MonadTransControl t, MonadError MockChainError m, Monad (t m)) => MonadError MockChainError (AsTrans t m) Source # 
Instance details

Defined in Cooked.MockChain.BlockChain

Methods

throwError :: MockChainError -> AsTrans t m a Source #

catchError :: AsTrans t m a -> (MockChainError -> AsTrans t m a) -> AsTrans t m a Source #

Show a => PrettyCooked (Either MockChainError (a, UtxoState)) Source # 
Instance details

Defined in Cooked.Pretty.Cooked

utxosFromCardanoTx :: CardanoTx -> [(TxOutRef, TxOut)] Source #

Retrieve the ordered list of outputs of the given CardanoTx.

This is useful when writing endpoints and/or traces to fetch utxos of interest right from the start and avoid querying the chain for them - afterwards using allUtxos or similar functions.

txOutV2FromLedger :: TxOut -> TxOut Source #

resolveDatum :: (IsAbstractOutput out, ToOutputDatum (DatumType out), MonadBlockChainBalancing m) => out -> m (Maybe (ConcreteOutput (OwnerType out) Datum (ValueType out) (ReferenceScriptType out))) Source #

Try to resolve the datum on the output: If there's an inline datum, take + afterwards using allUtxos or similar functions.

resolveDatum :: (IsAbstractOutput out, ToOutputDatum (DatumType out), MonadBlockChainBalancing m) => out -> m (Maybe (ConcreteOutput (OwnerType out) Datum (ValueType out) (ReferenceScriptType out))) Source #

Try to resolve the datum on the output: If there's an inline datum, take that; if there's a datum hash, look the corresponding datum up (with datumFromHash), returning Nothing if it can't be found; if there's no - datum or hash at all, return Nothing.

resolveTypedDatum :: (IsAbstractOutput out, ToOutputDatum (DatumType out), MonadBlockChainBalancing m, FromData a) => out -> m (Maybe (ConcreteOutput (OwnerType out) a (ValueType out) (ReferenceScriptType out))) Source #

Like resolveDatum, but also tries to use fromBuiltinData to extract a - datum of the suitable type.

resolveValidator :: (IsAbstractOutput out, ToCredential (OwnerType out), MonadBlockChainBalancing m) => out -> m (Maybe (ConcreteOutput (Versioned Validator) (DatumType out) (ValueType out) (ReferenceScriptType out))) Source #

Try to resolve the validator that owns an output: If the output is owned by + datum or hash at all, return Nothing.

resolveTypedDatum :: (IsAbstractOutput out, ToOutputDatum (DatumType out), MonadBlockChainBalancing m, FromData a) => out -> m (Maybe (ConcreteOutput (OwnerType out) a (ValueType out) (ReferenceScriptType out))) Source #

Like resolveDatum, but also tries to use fromBuiltinData to extract a + datum of the suitable type.

resolveValidator :: (IsAbstractOutput out, ToCredential (OwnerType out), MonadBlockChainBalancing m) => out -> m (Maybe (ConcreteOutput (Versioned Validator) (DatumType out) (ValueType out) (ReferenceScriptType out))) Source #

Try to resolve the validator that owns an output: If the output is owned by a public key, or if the validator's hash is not known (i.e. if - validatorFromHash returns Nothing) return Nothing.

resolveReferenceScript :: (IsAbstractOutput out, ToScriptHash (ReferenceScriptType out), MonadBlockChainBalancing m) => out -> m (Maybe (ConcreteOutput (OwnerType out) (DatumType out) (ValueType out) (Versioned Validator))) Source #

Try to resolve the reference script on an output: If the output has no + validatorFromHash returns Nothing) return Nothing.

resolveReferenceScript :: (IsAbstractOutput out, ToScriptHash (ReferenceScriptType out), MonadBlockChainBalancing m) => out -> m (Maybe (ConcreteOutput (OwnerType out) (DatumType out) (ValueType out) (Versioned Validator))) Source #

Try to resolve the reference script on an output: If the output has no reference script, or if the reference script's hash is not known (i.e. if - validatorFromHash returns Nothing), this function will return Nothing.

typedDatumFromTxOutRef :: (FromData a, MonadBlockChainWithoutValidation m) => TxOutRef -> m (Maybe a) Source #

waitNSlots :: MonadBlockChainWithoutValidation m => Integer -> m Slot Source #

Moves n slots fowards

currentTime :: MonadBlockChainWithoutValidation m => m (POSIXTime, POSIXTime) Source #

Returns the closed ms interval corresponding to the current slot

slotToTimeInterval :: MonadBlockChainWithoutValidation m => Slot -> m (POSIXTime, POSIXTime) Source #

Returns the closed ms interval corresponding to the slot with the given - number. It holds that

slotToTimeInterval (getEnclosingSlot t) == (a, b)    ==>   a <= t <= b

and

slotToTimeInterval n == (a, b)   ==>   getEnclosingSlot a == n && getEnclosingSlot b == n

and

slotToTimeInterval n == (a, b)   ==>   getEnclosingSlot (a-1) == n-1 && getEnclosingSlot (b+1) == n+1

getEnclosingSlot :: MonadBlockChainWithoutValidation m => POSIXTime -> m Slot Source #

Return the slot that contains the given time. See slotToTimeInterval for - some equational properties this function satisfies.

awaitEnclosingSlot :: MonadBlockChainWithoutValidation m => POSIXTime -> m Slot Source #

Waits until the current slot becomes greater or equal to the slot containing the given POSIX time. - Note that that it might not wait for anything if the current slot is large enough.

slotRangeBefore :: MonadBlockChainWithoutValidation m => POSIXTime -> m SlotRange Source #

The infinite range of slots ending before or at the given POSIX time

slotRangeAfter :: MonadBlockChainWithoutValidation m => POSIXTime -> m SlotRange Source #

The infinite range of slots starting after or at the given POSIX time

runUtxoSearch :: Monad m => UtxoSearch m a -> m [(TxOutRef, a)] Source #

Given a UTxO search, we can run it to obtain a list of UTxOs.

allUtxosSearch :: MonadBlockChain m => UtxoSearch m TxOut Source #

Search all currently known TxOutRefs together with their corresponding - TxInfo-TxOut.

allUtxosLedgerSearch :: MonadBlockChain m => UtxoSearch m TxOut Source #

Like allUtxosSearch, but returns a Ledger-level representation of the - transaction outputs, which might contain more information.

utxosAtSearch :: MonadBlockChainBalancing m => Address -> UtxoSearch m TxOut Source #

Search all TxOutRefs at a certain address, together with their - TxInfo-TxOut.

utxosAtLedgerSearch :: MonadBlockChainBalancing m => Address -> UtxoSearch m TxOut Source #

Like utxosAtSearch, but returns a Ledger-level representation of the - transaction outputs, which might contain more information.

utxosFromCardanoTxSearch :: Monad m => CardanoTx -> UtxoSearch m TxOut Source #

Search all TxOutRefs of a transaction, together with their - TxInfo-TxOut.

txOutByRefSearch :: MonadBlockChainBalancing m => [TxOutRef] -> UtxoSearch m TxOut Source #

Search all TxInfo-TxOuts corresponding to given the list of + validatorFromHash returns Nothing), this function will return Nothing.

currentTime :: MonadBlockChainWithoutValidation m => m (POSIXTime, POSIXTime) Source #

Returns the closed ms interval corresponding to the current slot

slotToTimeInterval :: MonadBlockChainWithoutValidation m => Slot -> m (POSIXTime, POSIXTime) Source #

Returns the closed ms interval corresponding to the slot with the given + number. It holds that

slotToTimeInterval (getEnclosingSlot t) == (a, b)    ==>   a <= t <= b

and

slotToTimeInterval n == (a, b)   ==>   getEnclosingSlot a == n && getEnclosingSlot b == n

and

slotToTimeInterval n == (a, b)   ==>   getEnclosingSlot (a-1) == n-1 && getEnclosingSlot (b+1) == n+1

getEnclosingSlot :: MonadBlockChainWithoutValidation m => POSIXTime -> m Slot Source #

Return the slot that contains the given time. See slotToTimeInterval for + some equational properties this function satisfies.

awaitEnclosingSlot :: MonadBlockChainWithoutValidation m => POSIXTime -> m Slot Source #

Waits until the current slot becomes greater or equal to the slot containing the given POSIX time. + Note that that it might not wait for anything if the current slot is large enough.

slotRangeBefore :: MonadBlockChainWithoutValidation m => POSIXTime -> m SlotRange Source #

The infinite range of slots ending before or at the given POSIX time

slotRangeAfter :: MonadBlockChainWithoutValidation m => POSIXTime -> m SlotRange Source #

The infinite range of slots starting after or at the given POSIX time

runUtxoSearch :: Monad m => UtxoSearch m a -> m [(TxOutRef, a)] Source #

Given a UTxO search, we can run it to obtain a list of UTxOs.

allUtxosSearch :: MonadBlockChain m => UtxoSearch m TxOut Source #

Search all currently known TxOutRefs together with their corresponding + TxInfo-TxOut.

allUtxosLedgerSearch :: MonadBlockChain m => UtxoSearch m TxOut Source #

Like allUtxosSearch, but returns a Ledger-level representation of the + transaction outputs, which might contain more information.

utxosAtSearch :: MonadBlockChainBalancing m => Address -> UtxoSearch m TxOut Source #

Search all TxOutRefs at a certain address, together with their + TxInfo-TxOut.

utxosAtLedgerSearch :: MonadBlockChainBalancing m => Address -> UtxoSearch m TxOut Source #

Like utxosAtSearch, but returns a Ledger-level representation of the + transaction outputs, which might contain more information.

utxosFromCardanoTxSearch :: Monad m => CardanoTx -> UtxoSearch m TxOut Source #

Search all TxOutRefs of a transaction, together with their + TxInfo-TxOut.

txOutByRefSearch :: MonadBlockChainBalancing m => [TxOutRef] -> UtxoSearch m TxOut Source #

Search all TxInfo-TxOuts corresponding to given the list of TxOutRefs. Any TxOutRef that doesn't correspond to a known output will be filtered out.

filterWith :: Monad m => UtxoSearch m a -> (a -> m (Maybe b)) -> UtxoSearch m b Source #

Transform a UtxoSearch by applying a possibly failing monadic "lookup" - on every output.

filterWithPure :: Monad m => UtxoSearch m a -> (a -> Maybe b) -> UtxoSearch m b Source #

filterWithOptic :: (Is k An_AffineFold, Monad m) => UtxoSearch m a -> Optic' k is a b -> UtxoSearch m b Source #

filterWithPred :: Monad m => UtxoSearch m a -> (a -> Bool) -> UtxoSearch m a Source #

filterWithValuePred :: Monad m => UtxoSearch m TxOut -> (Value -> Bool) -> UtxoSearch m Value Source #

filterWithOnlyAda :: Monad m => UtxoSearch m TxOut -> UtxoSearch m Value Source #

filterWithNotOnlyAda :: Monad m => UtxoSearch m TxOut -> UtxoSearch m Value Source #

balancedTx :: MonadBlockChainBalancing m => (TxSkel, Fee, Set TxOutRef) -> m (Tx BabbageEra) Source #

Take the output of balancedTxSkel and turn it into an actual Cardano - transaction.

txSkelInputData :: MonadBlockChainBalancing m => TxSkel -> m (Map DatumHash Datum) Source #

Look up the data on UTxOs the transaction consumes.

newtype MockChainT m a Source #

Instances

Instances details
MonadFail StagedMockChain Source # 
Instance details

Defined in Cooked.MockChain.Staged

Methods

fail :: String -> StagedMockChain a #

Alternative StagedMockChain Source # 
Instance details

Defined in Cooked.MockChain.Staged

MonadTrans MockChainT Source # 
Instance details

Defined in Cooked.MockChain.Direct

Methods

lift :: Monad m => m a -> MockChainT m a #

MonadBlockChain StagedMockChain Source # 
Instance details

Defined in Cooked.MockChain.Staged

MonadBlockChainWithoutValidation StagedMockChain Source # 
Instance details

Defined in Cooked.MockChain.Staged

MonadBlockChainBalancing StagedMockChain Source # 
Instance details

Defined in Cooked.MockChain.Staged

Methods

getParams :: StagedMockChain Params Source #

utxosAtLedger :: Address -> StagedMockChain [(TxOutRef, TxOut)] Source #

datumFromHash :: DatumHash -> StagedMockChain (Maybe Datum) Source #

validatorFromHash :: ValidatorHash -> StagedMockChain (Maybe (Versioned Validator)) Source #

txOutByRefLedger :: TxOutRef -> StagedMockChain (Maybe TxOut) Source #

MonadError MockChainError StagedMockChain Source # 
Instance details

Defined in Cooked.MockChain.Staged

Monad m => MonadState MockChainSt (MockChainT m) Source # 
Instance details

Defined in Cooked.MockChain.Direct

Monad m => MonadReader MockChainEnv (MockChainT m) Source # 
Instance details

Defined in Cooked.MockChain.Direct

Monad m => MonadError MockChainError (MockChainT m) Source # 
Instance details

Defined in Cooked.MockChain.Direct

Monad m => Monad (MockChainT m) Source #

Custom monad instance made to increase the slot count automatically

Instance details

Defined in Cooked.MockChain.Direct

Methods

(>>=) :: MockChainT m a -> (a -> MockChainT m b) -> MockChainT m b #

(>>) :: MockChainT m a -> MockChainT m b -> MockChainT m b #

return :: a -> MockChainT m a #

Functor m => Functor (MockChainT m) Source # 
Instance details

Defined in Cooked.MockChain.Direct

Methods

fmap :: (a -> b) -> MockChainT m a -> MockChainT m b #

(<$) :: a -> MockChainT m b -> MockChainT m a #

Monad m => MonadFail (MockChainT m) Source # 
Instance details

Defined in Cooked.MockChain.Direct

Methods

fail :: String -> MockChainT m a #

Monad m => Applicative (MockChainT m) Source # 
Instance details

Defined in Cooked.MockChain.Direct

Methods

pure :: a -> MockChainT m a #

(<*>) :: MockChainT m (a -> b) -> MockChainT m a -> MockChainT m b #

liftA2 :: (a -> b -> c) -> MockChainT m a -> MockChainT m b -> MockChainT m c #

(*>) :: MockChainT m a -> MockChainT m b -> MockChainT m b #

(<*) :: MockChainT m a -> MockChainT m b -> MockChainT m a #

MonadPlus m => MonadPlus (MockChainT m) Source # 
Instance details

Defined in Cooked.MockChain.Staged

Methods

mzero :: MockChainT m a #

mplus :: MockChainT m a -> MockChainT m a -> MockChainT m a #

(Monad m, Alternative m) => Alternative (MockChainT m) Source # 
Instance details

Defined in Cooked.MockChain.Direct

Methods

empty :: MockChainT m a #

(<|>) :: MockChainT m a -> MockChainT m a -> MockChainT m a #

some :: MockChainT m a -> MockChainT m [a] #

many :: MockChainT m a -> MockChainT m [a] #

Monad m => MonadBlockChain (MockChainT m) Source # 
Instance details

Defined in Cooked.MockChain.Direct

Methods

validateTxSkel :: TxSkel -> MockChainT m CardanoTx Source #

Monad m => MonadBlockChainWithoutValidation (MockChainT m) Source # 
Instance details

Defined in Cooked.MockChain.Direct

Methods

allUtxosLedger :: MockChainT m [(TxOutRef, TxOut)] Source #

currentSlot :: MockChainT m Slot Source #

awaitSlot :: Slot -> MockChainT m Slot Source #

Monad m => MonadBlockChainBalancing (MockChainT m) Source # 
Instance details

Defined in Cooked.MockChain.Direct

Methods

getParams :: MockChainT m Params Source #

utxosAtLedger :: Address -> MockChainT m [(TxOutRef, TxOut)] Source #

datumFromHash :: DatumHash -> MockChainT m (Maybe Datum) Source #

validatorFromHash :: ValidatorHash -> MockChainT m (Maybe (Versioned Validator)) Source #

txOutByRefLedger :: TxOutRef -> MockChainT m (Maybe TxOut) Source #

newtype MockChainEnv Source #

Constructors

MockChainEnv 

Fields

Instances

Instances details
Show MockChainEnv Source # 
Instance details

Defined in Cooked.MockChain.Direct

Default MockChainEnv Source # 
Instance details

Defined in Cooked.MockChain.Direct

Methods

def :: MockChainEnv

Monad m => MonadReader MockChainEnv (MockChainT m) Source # 
Instance details

Defined in Cooked.MockChain.Direct

data MockChainSt Source #

Slightly more concrete version of UtxoState, used to actually run the - simulation.

Constructors

MockChainSt 

Fields

Instances

Instances details
Eq MockChainSt Source # 
Instance details

Defined in Cooked.MockChain.Direct

Show MockChainSt Source # 
Instance details

Defined in Cooked.MockChain.Direct

Default MockChainSt Source # 
Instance details

Defined in Cooked.MockChain.Direct

Methods

def :: MockChainSt

Monad m => MonadState MockChainSt (MockChainT m) Source # 
Instance details

Defined in Cooked.MockChain.Direct

combineMockChainT :: Monad m => (forall a. m a -> m a -> m a) -> MockChainT m x -> MockChainT m x -> MockChainT m x Source #

runMockChainTRaw :: Monad m => MockChainEnv -> MockChainSt -> MockChainT m a -> m (Either MockChainError (a, MockChainSt)) Source #

Executes a MockChainT from some initial state and environment; does not + on every output.

filterWithPure :: Monad m => UtxoSearch m a -> (a -> Maybe b) -> UtxoSearch m b Source #

filterWithOptic :: (Is k An_AffineFold, Monad m) => UtxoSearch m a -> Optic' k is a b -> UtxoSearch m b Source #

filterWithPred :: Monad m => UtxoSearch m a -> (a -> Bool) -> UtxoSearch m a Source #

filterWithValuePred :: Monad m => UtxoSearch m TxOut -> (Value -> Bool) -> UtxoSearch m Value Source #

filterWithOnlyAda :: Monad m => UtxoSearch m TxOut -> UtxoSearch m Value Source #

filterWithNotOnlyAda :: Monad m => UtxoSearch m TxOut -> UtxoSearch m Value Source #

balancedTx :: MonadBlockChainBalancing m => (TxSkel, Fee, Set TxOutRef) -> m (Tx BabbageEra) Source #

Take the output of balancedTxSkel and turn it into an actual Cardano + transaction.

txSkelInputData :: MonadBlockChainBalancing m => TxSkel -> m (Map DatumHash Datum) Source #

Look up the data on UTxOs the transaction consumes.

newtype MockChainT m a Source #

Instances

Instances details
MonadFail StagedMockChain Source # 
Instance details

Defined in Cooked.MockChain.Staged

Alternative StagedMockChain Source # 
Instance details

Defined in Cooked.MockChain.Staged

MonadTrans MockChainT Source # 
Instance details

Defined in Cooked.MockChain.Direct

Methods

lift :: Monad m => m a -> MockChainT m a Source #

MonadBlockChain StagedMockChain Source # 
Instance details

Defined in Cooked.MockChain.Staged

MonadBlockChainWithoutValidation StagedMockChain Source # 
Instance details

Defined in Cooked.MockChain.Staged

MonadBlockChainBalancing StagedMockChain Source # 
Instance details

Defined in Cooked.MockChain.Staged

MonadError MockChainError StagedMockChain Source # 
Instance details

Defined in Cooked.MockChain.Staged

Monad m => MonadReader MockChainEnv (MockChainT m) Source # 
Instance details

Defined in Cooked.MockChain.Direct

Monad m => MonadState MockChainSt (MockChainT m) Source # 
Instance details

Defined in Cooked.MockChain.Direct

Monad m => MonadError MockChainError (MockChainT m) Source # 
Instance details

Defined in Cooked.MockChain.Direct

Monad m => Monad (MockChainT m) Source #

Custom monad instance made to increase the slot count automatically

Instance details

Defined in Cooked.MockChain.Direct

Methods

(>>=) :: MockChainT m a -> (a -> MockChainT m b) -> MockChainT m b Source #

(>>) :: MockChainT m a -> MockChainT m b -> MockChainT m b Source #

return :: a -> MockChainT m a Source #

Functor m => Functor (MockChainT m) Source # 
Instance details

Defined in Cooked.MockChain.Direct

Methods

fmap :: (a -> b) -> MockChainT m a -> MockChainT m b Source #

(<$) :: a -> MockChainT m b -> MockChainT m a Source #

Monad m => MonadFail (MockChainT m) Source # 
Instance details

Defined in Cooked.MockChain.Direct

Methods

fail :: String -> MockChainT m a Source #

Monad m => Applicative (MockChainT m) Source # 
Instance details

Defined in Cooked.MockChain.Direct

Methods

pure :: a -> MockChainT m a Source #

(<*>) :: MockChainT m (a -> b) -> MockChainT m a -> MockChainT m b Source #

liftA2 :: (a -> b -> c) -> MockChainT m a -> MockChainT m b -> MockChainT m c Source #

(*>) :: MockChainT m a -> MockChainT m b -> MockChainT m b Source #

(<*) :: MockChainT m a -> MockChainT m b -> MockChainT m a Source #

MonadPlus m => MonadPlus (MockChainT m) Source # 
Instance details

Defined in Cooked.MockChain.Staged

Methods

mzero :: MockChainT m a Source #

mplus :: MockChainT m a -> MockChainT m a -> MockChainT m a Source #

(Monad m, Alternative m) => Alternative (MockChainT m) Source # 
Instance details

Defined in Cooked.MockChain.Direct

Monad m => MonadBlockChain (MockChainT m) Source # 
Instance details

Defined in Cooked.MockChain.Direct

Monad m => MonadBlockChainWithoutValidation (MockChainT m) Source # 
Instance details

Defined in Cooked.MockChain.Direct

Monad m => MonadBlockChainBalancing (MockChainT m) Source # 
Instance details

Defined in Cooked.MockChain.Direct

data MockChainSt Source #

Slightly more concrete version of UtxoState, used to actually run the + simulation.

combineMockChainT :: Monad m => (forall a. m a -> m a -> m a) -> MockChainT m x -> MockChainT m x -> MockChainT m x Source #

runMockChainTRaw :: Monad m => MockChainEnv -> MockChainSt -> MockChainT m a -> m (Either MockChainError (a, MockChainSt)) Source #

Executes a MockChainT from some initial state and environment; does not convert the MockChainSt into a UtxoState.

runMockChainTFrom :: Monad m => InitialDistribution -> MockChainT m a -> m (Either MockChainError (a, UtxoState)) Source #

Executes a MockChainT from an initial state set up with the given initial value distribution. Similar to runMockChainT, uses the default environment. Returns a UtxoState instead of a MockChainSt. If you need the later, use runMockChainTRaw

runMockChainT :: Monad m => MockChainT m a -> m (Either MockChainError (a, UtxoState)) Source #

Executes a MockChainT from the canonical initial state and environment. The canonical environment uses the default SlotConfig and - Cooked.Wallet.wallet 1 as the sole wallet signing transactions.

utxoIndex0 :: UtxoIndex Source #

getIndex :: UtxoIndex -> Map TxOutRef TxOut Source #

runTransactionValidation Source #

Arguments

:: Monad m 
=> Params

The emulator parameters to use. They might have been changed by the txOptEmulatorParamsModification.

-> Tx BabbageEra

The transaction to validate. It should already be balanced, and include - appropriate fees and collateral.

-> [RawModTx]

Modifications to apply to the transaction right before it is submitted.

-> Map DatumHash Datum

The data consumed by the transaction

-> Map DatumHash TxSkelOutDatum

The data produced by the transaction

-> Map ValidatorHash (Versioned Validator)

The validators protecting transaction outputs, and the validators in the + Cooked.Wallet.wallet 1 as the sole wallet signing transactions.

runTransactionValidation Source #

Arguments

:: Monad m 
=> Params

The emulator parameters to use. They might have been changed by the txOptEmulatorParamsModification.

-> Tx BabbageEra

The transaction to validate. It should already be balanced, and include + appropriate fees and collateral.

-> [RawModTx]

Modifications to apply to the transaction right before it is submitted.

-> Map DatumHash Datum

The data consumed by the transaction

-> Map DatumHash TxSkelOutDatum

The data produced by the transaction

-> Map ValidatorHash (Versioned Validator)

The validators protecting transaction outputs, and the validators in the reference script field of transaction outputs. The MockChain will - remember them.

-> MockChainT m CardanoTx 

type MonadModalBlockChain m = (MonadBlockChain m, MonadModal m, Modification m ~ UntypedTweak InterpMockChain) Source #

A modal mock chain is a mock chain that allows us to use LTL modifications - with Tweaks

interpretAndRunWith :: (forall m. Monad m => MockChainT m a -> m res) -> StagedMockChain a -> [(res, MockChainLog)] Source #

Interprets the staged mockchain then runs the resulting computation with a + remember them.

-> MockChainT m CardanoTx 

type MonadModalBlockChain m = (MonadBlockChain m, MonadModal m, Modification m ~ UntypedTweak InterpMockChain) Source #

A modal mock chain is a mock chain that allows us to use LTL modifications + with Tweaks

interpretAndRunWith :: (forall m. Monad m => MockChainT m a -> m res) -> StagedMockChain a -> [(res, MockChainLog)] Source #

Interprets the staged mockchain then runs the resulting computation with a custom function. This can be used, for example, to supply a custom InitialDistribution by providing runMockChainTFrom.

runTweak :: Tweak InterpMockChain a -> TxSkel -> [Either MockChainError (a, TxSkel)] Source #

somewhere :: MonadModalBlockChain m => Tweak InterpMockChain b -> m a -> m a Source #

Apply a Tweak to some transaction in the given Trace. The tweak must apply at least once.

everywhere :: MonadModalBlockChain m => Tweak InterpMockChain b -> m a -> m a Source #

Apply a Tweak to every transaction in a given trace. This is also @@ -61,8 +61,8 @@ ...

where endpoint builds and validates a single transaction depending on the given arguments. Then withTweak says "I want to modify the transaction returned by this endpoint in the following way".

class IsProp prop where Source #

This module provides a common interface for HUnit and QuickCheck tests. - We do so by abstracting uses of Assertion and Property for (IsProp prop) => prop, - then provide instances for both HU.Asserton and QC.Property.

Minimal complete definition

testCounterexample, testConjoin, testDisjoin

Methods

testCounterexample :: String -> prop -> prop Source #

Displays the string to the user in case of failure

testConjoin :: [prop] -> prop Source #

Conjunction of a number of results

testDisjoin :: [prop] -> prop Source #

Disjunction of a number of results

testFailure :: prop Source #

Flags a failure

testSuccess :: prop Source #

Flags a success

testFailureMsg :: String -> prop Source #

Flags a failure with a message

Instances

Instances details
IsProp Bool Source # 
Instance details

Defined in Cooked.MockChain.Testing

IsProp Property Source # 
Instance details

Defined in Cooked.MockChain.Testing

Methods

testCounterexample :: String -> Property -> Property Source #

testConjoin :: [Property] -> Property Source #

testDisjoin :: [Property] -> Property Source #

testFailure :: Property Source #

testSuccess :: Property Source #

testFailureMsg :: String -> Property Source #

IsProp Assertion Source # 
Instance details

Defined in Cooked.MockChain.Testing

Methods

testCounterexample :: String -> Assertion -> Assertion Source #

testConjoin :: [Assertion] -> Assertion Source #

testDisjoin :: [Assertion] -> Assertion Source #

testFailure :: Assertion Source #

testSuccess :: Assertion Source #

testFailureMsg :: String -> Assertion Source #

testBool :: IsProp prop => Bool -> prop Source #

testAll :: IsProp prop => (a -> prop) -> [a] -> prop Source #

(.==.) :: (IsProp prop, Eq a) => a -> a -> prop infix 4 Source #

(.&&.) :: IsProp prop => prop -> prop -> prop infixr 3 Source #

(.||.) :: IsProp prop => prop -> prop -> prop infixr 2 Source #

testSucceeds :: IsProp prop => PrettyCookedOpts -> StagedMockChain a -> prop Source #

Ensure that all results produced by the staged mockchain succeed, starting + We do so by abstracting uses of Assertion and Property for (IsProp prop) => prop, + then provide instances for both HU.Asserton and QC.Property.

Minimal complete definition

testCounterexample, testConjoin, testDisjoin

Methods

testCounterexample :: String -> prop -> prop Source #

Displays the string to the user in case of failure

testConjoin :: [prop] -> prop Source #

Conjunction of a number of results

testDisjoin :: [prop] -> prop Source #

Disjunction of a number of results

testFailure :: prop Source #

Flags a failure

testSuccess :: prop Source #

Flags a success

testFailureMsg :: String -> prop Source #

Flags a failure with a message

testBool :: IsProp prop => Bool -> prop Source #

testAll :: IsProp prop => (a -> prop) -> [a] -> prop Source #

(.==.) :: (IsProp prop, Eq a) => a -> a -> prop infix 4 Source #

(.&&.) :: IsProp prop => prop -> prop -> prop infixr 3 Source #

(.||.) :: IsProp prop => prop -> prop -> prop infixr 2 Source #

testSucceeds :: IsProp prop => PrettyCookedOpts -> StagedMockChain a -> prop Source #

Ensure that all results produced by the staged mockchain succeed, starting from the default initial distribution

testFails :: (IsProp prop, Show a) => PrettyCookedOpts -> (MockChainError -> prop) -> StagedMockChain a -> prop Source #

Ensure that all results produced by the staged mockchain fail and that a predicate holds over the error.

To test that validation fails, use > testFails def (isCekEvaluationFailure def) e

testSucceedsFrom :: IsProp prop => PrettyCookedOpts -> InitialDistribution -> StagedMockChain a -> prop Source #

Ensure that all results produced by the staged mockchain succeed starting @@ -89,5 +89,5 @@ the predicate gets the trace descriptions that led to each potential outcome and is responsible for calling testCounterexample communicate these to the user.

Although this function is mainly used internally, as a building block for the simpler predicates, it can be useful in building some custom predicates. Check testAllSatisfiesFrom - or testBinaryRelatedBy for examples on using this.

assertionToMaybe :: Assertion -> IO (Maybe HUnitFailure) Source #

forAll :: Show a => Gen a -> (a -> Property) -> Property Source #

Here we provide our own universsal quantifier instead of forAll, so we can monomorphize - it to returning a Property

\ No newline at end of file + or testBinaryRelatedBy for examples on using this.

forAll :: Show a => Gen a -> (a -> Property) -> Property Source #

Here we provide our own universsal quantifier instead of forAll, so we can monomorphize + it to returning a Property

\ No newline at end of file diff --git a/Cooked-Output.html b/Cooked-Output.html index 1ac2c9f7a..5f3448005 100644 --- a/Cooked-Output.html +++ b/Cooked-Output.html @@ -1,9 +1,9 @@ -Cooked.Output
cooked-validators-2.0.0
Safe HaskellNone
LanguageHaskell2010

Cooked.Output

Synopsis

Documentation

class IsAbstractOutput o Source #

A generalisation of TxOut: With the four type families, we can lift +Cooked.Output

cooked-validators-2.0.0
Safe HaskellNone
LanguageHaskell2010

Cooked.Output

Synopsis

Documentation

class IsAbstractOutput o Source #

A generalisation of TxOut: With the four type families, we can lift some information about

  • who owns the output (a public key, a script...?)
  • what kind of datum is there (do we have an inline datum, a datum hash, nothing...?)
  • what kind of value does the output hold (pure Ada ...?)
  • what information do we have on the reference script (only a hash, a - complete script, a typed validator...?)

to the type level.

Instances

Instances details
IsAbstractOutput TxOut Source # 
Instance details

Defined in Cooked.Output

Associated Types

type OwnerType TxOut Source #

type DatumType TxOut Source #

type ValueType TxOut Source #

type ReferenceScriptType TxOut Source #

Methods

outputOwnerL :: Lens' TxOut (OwnerType TxOut) Source #

outputStakingCredentialL :: Lens' TxOut (Maybe StakingCredential) Source #

outputDatumL :: Lens' TxOut (DatumType TxOut) Source #

outputValueL :: Lens' TxOut (ValueType TxOut) Source #

outputReferenceScriptL :: Lens' TxOut (Maybe (ReferenceScriptType TxOut)) Source #

IsAbstractOutput (ConcreteOutput ownerType datumType valueType referenceScriptType) Source # 
Instance details

Defined in Cooked.Output

Associated Types

type OwnerType (ConcreteOutput ownerType datumType valueType referenceScriptType) Source #

type DatumType (ConcreteOutput ownerType datumType valueType referenceScriptType) Source #

type ValueType (ConcreteOutput ownerType datumType valueType referenceScriptType) Source #

type ReferenceScriptType (ConcreteOutput ownerType datumType valueType referenceScriptType) Source #

Methods

outputOwnerL :: Lens' (ConcreteOutput ownerType datumType valueType referenceScriptType) (OwnerType (ConcreteOutput ownerType datumType valueType referenceScriptType)) Source #

outputStakingCredentialL :: Lens' (ConcreteOutput ownerType datumType valueType referenceScriptType) (Maybe StakingCredential) Source #

outputDatumL :: Lens' (ConcreteOutput ownerType datumType valueType referenceScriptType) (DatumType (ConcreteOutput ownerType datumType valueType referenceScriptType)) Source #

outputValueL :: Lens' (ConcreteOutput ownerType datumType valueType referenceScriptType) (ValueType (ConcreteOutput ownerType datumType valueType referenceScriptType)) Source #

outputReferenceScriptL :: Lens' (ConcreteOutput ownerType datumType valueType referenceScriptType) (Maybe (ReferenceScriptType (ConcreteOutput ownerType datumType valueType referenceScriptType))) Source #

type family OwnerType o Source #

Instances

Instances details
type OwnerType TxOut Source # 
Instance details

Defined in Cooked.Output

type OwnerType TxOut = Credential
type OwnerType (ConcreteOutput ownerType datumType valueType referenceScriptType) Source # 
Instance details

Defined in Cooked.Output

type OwnerType (ConcreteOutput ownerType datumType valueType referenceScriptType) = ownerType

type family DatumType o Source #

Instances

Instances details
type DatumType TxOut Source # 
Instance details

Defined in Cooked.Output

type DatumType TxOut = OutputDatum
type DatumType (ConcreteOutput ownerType datumType valueType referenceScriptType) Source # 
Instance details

Defined in Cooked.Output

type DatumType (ConcreteOutput ownerType datumType valueType referenceScriptType) = datumType

type family ValueType o Source #

Instances

Instances details
type ValueType TxOut Source # 
Instance details

Defined in Cooked.Output

type ValueType TxOut = Value
type ValueType (ConcreteOutput ownerType datumType valueType referenceScriptType) Source # 
Instance details

Defined in Cooked.Output

type ValueType (ConcreteOutput ownerType datumType valueType referenceScriptType) = valueType

type family ReferenceScriptType o Source #

Instances

Instances details
type ReferenceScriptType TxOut Source # 
Instance details

Defined in Cooked.Output

type ReferenceScriptType TxOut = ScriptHash
type ReferenceScriptType (ConcreteOutput ownerType datumType valueType referenceScriptType) Source # 
Instance details

Defined in Cooked.Output

type ReferenceScriptType (ConcreteOutput ownerType datumType valueType referenceScriptType) = referenceScriptType

outputStakingCredentialL :: IsAbstractOutput o => Lens' o (Maybe StakingCredential) Source #

class ToCredential a where Source #

Methods

toCredential :: a -> Credential Source #

Instances

Instances details
ToCredential Credential Source # 
Instance details

Defined in Cooked.Output

Methods

toCredential :: Credential -> Credential Source #

ToCredential PubKeyHash Source # 
Instance details

Defined in Cooked.Output

Methods

toCredential :: PubKeyHash -> Credential Source #

ToCredential (TypedValidator a) Source # 
Instance details

Defined in Cooked.Output

Methods

toCredential :: TypedValidator a -> Credential Source #

class ToOutputDatum a where Source #

Methods

toOutputDatum :: a -> OutputDatum Source #

Instances

Instances details
ToOutputDatum () Source # 
Instance details

Defined in Cooked.Output

Methods

toOutputDatum :: () -> OutputDatum Source #

ToOutputDatum Datum Source # 
Instance details

Defined in Cooked.Output

Methods

toOutputDatum :: Datum -> OutputDatum Source #

ToOutputDatum DatumHash Source # 
Instance details

Defined in Cooked.Output

Methods

toOutputDatum :: DatumHash -> OutputDatum Source #

ToOutputDatum OutputDatum Source # 
Instance details

Defined in Cooked.Output

Methods

toOutputDatum :: OutputDatum -> OutputDatum Source #

ToOutputDatum TxSkelOutDatum Source # 
Instance details

Defined in Cooked.Skeleton

Methods

toOutputDatum :: TxSkelOutDatum -> OutputDatum Source #

class ToValue a where Source #

Methods

toValue :: a -> Value Source #

Instances

Instances details
ToValue Value Source # 
Instance details

Defined in Cooked.Output

Methods

toValue :: Value -> Value Source #

ToValue Ada Source # 
Instance details

Defined in Cooked.Output

Methods

toValue :: Ada -> Value Source #

class ToScript a where Source #

Methods

toScript :: a -> Versioned Script Source #

Instances

Instances details
ToScript (Versioned Validator) Source # 
Instance details

Defined in Cooked.Output

Methods

toScript :: Versioned Validator -> Versioned Script Source #

ToScript (Versioned Script) Source # 
Instance details

Defined in Cooked.Output

Methods

toScript :: Versioned Script -> Versioned Script Source #

ToScript (TypedValidator a) Source # 
Instance details

Defined in Cooked.Output

Methods

toScript :: TypedValidator a -> Versioned Script Source #

class ToScriptHash a where Source #

Methods

toScriptHash :: a -> ScriptHash Source #

Instances

Instances details
ToScriptHash ValidatorHash Source # 
Instance details

Defined in Cooked.Output

Methods

toScriptHash :: ValidatorHash -> ScriptHash Source #

ToScriptHash ScriptHash Source # 
Instance details

Defined in Cooked.Output

Methods

toScriptHash :: ScriptHash -> ScriptHash Source #

ToScriptHash (Versioned Validator) Source # 
Instance details

Defined in Cooked.Output

Methods

toScriptHash :: Versioned Validator -> ScriptHash Source #

ToScriptHash (Versioned Script) Source # 
Instance details

Defined in Cooked.Output

Methods

toScriptHash :: Versioned Script -> ScriptHash Source #

ToScriptHash (TypedValidator a) Source # 
Instance details

Defined in Cooked.Output

Methods

toScriptHash :: TypedValidator a -> ScriptHash Source #

type IsTxInfoOutput o = (IsAbstractOutput o, ToCredential (OwnerType o), ToOutputDatum (DatumType o), ToValue (ValueType o), ToScriptHash (ReferenceScriptType o)) Source #

An output that can be translated into its script-perspective (as seen on - the TxInfo) representation

outputTxOut :: IsTxInfoOutput o => o -> TxOut Source #

Return the output as it is seen by a validator on the TxInfo.

data ConcreteOutput ownerType datumType valueType referenceScriptType where Source #

A type constructed to be the most general instance of IsAbstractOutput.

Constructors

ConcreteOutput :: ownerType -> Maybe StakingCredential -> valueType -> datumType -> Maybe referenceScriptType -> ConcreteOutput ownerType datumType valueType referenceScriptType 

Instances

Instances details
(Eq ownerType, Eq datumType, Eq valueType, Eq referenceScriptType) => Eq (ConcreteOutput ownerType datumType valueType referenceScriptType) Source # 
Instance details

Defined in Cooked.Output

Methods

(==) :: ConcreteOutput ownerType datumType valueType referenceScriptType -> ConcreteOutput ownerType datumType valueType referenceScriptType -> Bool #

(/=) :: ConcreteOutput ownerType datumType valueType referenceScriptType -> ConcreteOutput ownerType datumType valueType referenceScriptType -> Bool #

(Show ownerType, Show datumType, Show valueType, Show referenceScriptType) => Show (ConcreteOutput ownerType datumType valueType referenceScriptType) Source # 
Instance details

Defined in Cooked.Output

Methods

showsPrec :: Int -> ConcreteOutput ownerType datumType valueType referenceScriptType -> ShowS #

show :: ConcreteOutput ownerType datumType valueType referenceScriptType -> String #

showList :: [ConcreteOutput ownerType datumType valueType referenceScriptType] -> ShowS #

IsAbstractOutput (ConcreteOutput ownerType datumType valueType referenceScriptType) Source # 
Instance details

Defined in Cooked.Output

Associated Types

type OwnerType (ConcreteOutput ownerType datumType valueType referenceScriptType) Source #

type DatumType (ConcreteOutput ownerType datumType valueType referenceScriptType) Source #

type ValueType (ConcreteOutput ownerType datumType valueType referenceScriptType) Source #

type ReferenceScriptType (ConcreteOutput ownerType datumType valueType referenceScriptType) Source #

Methods

outputOwnerL :: Lens' (ConcreteOutput ownerType datumType valueType referenceScriptType) (OwnerType (ConcreteOutput ownerType datumType valueType referenceScriptType)) Source #

outputStakingCredentialL :: Lens' (ConcreteOutput ownerType datumType valueType referenceScriptType) (Maybe StakingCredential) Source #

outputDatumL :: Lens' (ConcreteOutput ownerType datumType valueType referenceScriptType) (DatumType (ConcreteOutput ownerType datumType valueType referenceScriptType)) Source #

outputValueL :: Lens' (ConcreteOutput ownerType datumType valueType referenceScriptType) (ValueType (ConcreteOutput ownerType datumType valueType referenceScriptType)) Source #

outputReferenceScriptL :: Lens' (ConcreteOutput ownerType datumType valueType referenceScriptType) (Maybe (ReferenceScriptType (ConcreteOutput ownerType datumType valueType referenceScriptType))) Source #

type OwnerType (ConcreteOutput ownerType datumType valueType referenceScriptType) Source # 
Instance details

Defined in Cooked.Output

type OwnerType (ConcreteOutput ownerType datumType valueType referenceScriptType) = ownerType
type DatumType (ConcreteOutput ownerType datumType valueType referenceScriptType) Source # 
Instance details

Defined in Cooked.Output

type DatumType (ConcreteOutput ownerType datumType valueType referenceScriptType) = datumType
type ValueType (ConcreteOutput ownerType datumType valueType referenceScriptType) Source # 
Instance details

Defined in Cooked.Output

type ValueType (ConcreteOutput ownerType datumType valueType referenceScriptType) = valueType
type ReferenceScriptType (ConcreteOutput ownerType datumType valueType referenceScriptType) Source # 
Instance details

Defined in Cooked.Output

type ReferenceScriptType (ConcreteOutput ownerType datumType valueType referenceScriptType) = referenceScriptType

toOutputWithReferenceScriptHash :: (IsAbstractOutput output, ToScriptHash (ReferenceScriptType output)) => output -> ConcreteOutput (OwnerType output) (DatumType output) (ValueType output) ScriptHash Source #

Convert the reference script type on the output to ScriptHash.

isOutputWithoutDatum :: IsTxInfoOutput output => output -> Maybe (ConcreteOutput (OwnerType output) () (ValueType output) (ReferenceScriptType output)) Source #

Test if there is no datum on an output.

isOutputWithInlineDatum :: IsTxInfoOutput output => output -> Maybe (ConcreteOutput (OwnerType output) Datum (ValueType output) (ReferenceScriptType output)) Source #

Test if the output carries some inlined datum.

isOutputWithDatumHash :: IsTxInfoOutput output => output -> Maybe (ConcreteOutput (OwnerType output) DatumHash (ValueType output) (ReferenceScriptType output)) Source #

Test if the output carries some datum hash.

isOutputWithInlineDatumOfType :: (FromData a, IsTxInfoOutput output) => output -> Maybe (ConcreteOutput (OwnerType output) a (ValueType output) (ReferenceScriptType output)) Source #

Test if the output carries some inlined datum that can be parsed from - builtin data on to something of a specific type.

isScriptOutputFrom :: IsTxInfoOutput output => TypedValidator a -> output -> Maybe (ConcreteOutput (TypedValidator a) (DatumType output) (ValueType output) (ReferenceScriptType output)) Source #

Test if the owner of an output is a specific typed validator. If it is, - return an output with the validator type as its OwnerType.

isPKOutputFrom :: IsTxInfoOutput output => PubKeyHash -> output -> Maybe (ConcreteOutput PubKeyHash (DatumType output) (ValueType output) (ReferenceScriptType output)) Source #

Test if the owner of an output is a specific public key. If it is, return - an output of the same DatumType, but with PubKeyHash as its - OwnerType.

isOnlyAdaOutput :: IsTxInfoOutput output => output -> Maybe (ConcreteOutput (OwnerType output) (DatumType output) Ada (ReferenceScriptType output)) Source #

Test if the value on an output contains only Ada.

\ No newline at end of file + complete script, a typed validator...?)

to the type level.

Instances

Instances details
IsAbstractOutput TxOut Source # 
Instance details

Defined in Cooked.Output

IsAbstractOutput (ConcreteOutput ownerType datumType valueType referenceScriptType) Source # 
Instance details

Defined in Cooked.Output

Associated Types

type OwnerType (ConcreteOutput ownerType datumType valueType referenceScriptType) Source #

type DatumType (ConcreteOutput ownerType datumType valueType referenceScriptType) Source #

type ValueType (ConcreteOutput ownerType datumType valueType referenceScriptType) Source #

type ReferenceScriptType (ConcreteOutput ownerType datumType valueType referenceScriptType) Source #

Methods

outputOwnerL :: Lens' (ConcreteOutput ownerType datumType valueType referenceScriptType) (OwnerType (ConcreteOutput ownerType datumType valueType referenceScriptType)) Source #

outputStakingCredentialL :: Lens' (ConcreteOutput ownerType datumType valueType referenceScriptType) (Maybe StakingCredential) Source #

outputDatumL :: Lens' (ConcreteOutput ownerType datumType valueType referenceScriptType) (DatumType (ConcreteOutput ownerType datumType valueType referenceScriptType)) Source #

outputValueL :: Lens' (ConcreteOutput ownerType datumType valueType referenceScriptType) (ValueType (ConcreteOutput ownerType datumType valueType referenceScriptType)) Source #

outputReferenceScriptL :: Lens' (ConcreteOutput ownerType datumType valueType referenceScriptType) (Maybe (ReferenceScriptType (ConcreteOutput ownerType datumType valueType referenceScriptType))) Source #

type family OwnerType o Source #

Instances

Instances details
type OwnerType TxOut Source # 
Instance details

Defined in Cooked.Output

type OwnerType (ConcreteOutput ownerType datumType valueType referenceScriptType) Source # 
Instance details

Defined in Cooked.Output

type OwnerType (ConcreteOutput ownerType datumType valueType referenceScriptType) = ownerType

type family DatumType o Source #

Instances

Instances details
type DatumType TxOut Source # 
Instance details

Defined in Cooked.Output

type DatumType (ConcreteOutput ownerType datumType valueType referenceScriptType) Source # 
Instance details

Defined in Cooked.Output

type DatumType (ConcreteOutput ownerType datumType valueType referenceScriptType) = datumType

type family ValueType o Source #

Instances

Instances details
type ValueType TxOut Source # 
Instance details

Defined in Cooked.Output

type ValueType (ConcreteOutput ownerType datumType valueType referenceScriptType) Source # 
Instance details

Defined in Cooked.Output

type ValueType (ConcreteOutput ownerType datumType valueType referenceScriptType) = valueType

type family ReferenceScriptType o Source #

Instances

Instances details
type ReferenceScriptType TxOut Source # 
Instance details

Defined in Cooked.Output

type ReferenceScriptType (ConcreteOutput ownerType datumType valueType referenceScriptType) Source # 
Instance details

Defined in Cooked.Output

type ReferenceScriptType (ConcreteOutput ownerType datumType valueType referenceScriptType) = referenceScriptType

class ToCredential a where Source #

Instances

Instances details
ToCredential PubKeyHash Source # 
Instance details

Defined in Cooked.Output

ToCredential Credential Source # 
Instance details

Defined in Cooked.Output

ToCredential (TypedValidator a) Source # 
Instance details

Defined in Cooked.Output

class ToOutputDatum a where Source #

Instances

Instances details
ToOutputDatum () Source # 
Instance details

Defined in Cooked.Output

ToOutputDatum OutputDatum Source # 
Instance details

Defined in Cooked.Output

ToOutputDatum Datum Source # 
Instance details

Defined in Cooked.Output

ToOutputDatum DatumHash Source # 
Instance details

Defined in Cooked.Output

ToOutputDatum TxSkelOutDatum Source # 
Instance details

Defined in Cooked.Skeleton

class ToValue a where Source #

Methods

toValue :: a -> Value Source #

Instances

Instances details
ToValue Value Source # 
Instance details

Defined in Cooked.Output

Methods

toValue :: Value -> Value Source #

ToValue Ada Source # 
Instance details

Defined in Cooked.Output

Methods

toValue :: Ada -> Value Source #

class ToScript a where Source #

Instances

Instances details
ToScript (Versioned Validator) Source # 
Instance details

Defined in Cooked.Output

ToScript (Versioned Script) Source # 
Instance details

Defined in Cooked.Output

ToScript (TypedValidator a) Source # 
Instance details

Defined in Cooked.Output

class ToScriptHash a where Source #

type IsTxInfoOutput o = (IsAbstractOutput o, ToCredential (OwnerType o), ToOutputDatum (DatumType o), ToValue (ValueType o), ToScriptHash (ReferenceScriptType o)) Source #

An output that can be translated into its script-perspective (as seen on + the TxInfo) representation

outputTxOut :: IsTxInfoOutput o => o -> TxOut Source #

Return the output as it is seen by a validator on the TxInfo.

data ConcreteOutput ownerType datumType valueType referenceScriptType where Source #

A type constructed to be the most general instance of IsAbstractOutput.

Constructors

ConcreteOutput :: ownerType -> Maybe StakingCredential -> valueType -> datumType -> Maybe referenceScriptType -> ConcreteOutput ownerType datumType valueType referenceScriptType 

Instances

Instances details
(Eq ownerType, Eq datumType, Eq valueType, Eq referenceScriptType) => Eq (ConcreteOutput ownerType datumType valueType referenceScriptType) Source # 
Instance details

Defined in Cooked.Output

Methods

(==) :: ConcreteOutput ownerType datumType valueType referenceScriptType -> ConcreteOutput ownerType datumType valueType referenceScriptType -> Bool Source #

(/=) :: ConcreteOutput ownerType datumType valueType referenceScriptType -> ConcreteOutput ownerType datumType valueType referenceScriptType -> Bool Source #

(Show ownerType, Show datumType, Show valueType, Show referenceScriptType) => Show (ConcreteOutput ownerType datumType valueType referenceScriptType) Source # 
Instance details

Defined in Cooked.Output

Methods

showsPrec :: Int -> ConcreteOutput ownerType datumType valueType referenceScriptType -> ShowS Source #

show :: ConcreteOutput ownerType datumType valueType referenceScriptType -> String Source #

showList :: [ConcreteOutput ownerType datumType valueType referenceScriptType] -> ShowS Source #

IsAbstractOutput (ConcreteOutput ownerType datumType valueType referenceScriptType) Source # 
Instance details

Defined in Cooked.Output

Associated Types

type OwnerType (ConcreteOutput ownerType datumType valueType referenceScriptType) Source #

type DatumType (ConcreteOutput ownerType datumType valueType referenceScriptType) Source #

type ValueType (ConcreteOutput ownerType datumType valueType referenceScriptType) Source #

type ReferenceScriptType (ConcreteOutput ownerType datumType valueType referenceScriptType) Source #

Methods

outputOwnerL :: Lens' (ConcreteOutput ownerType datumType valueType referenceScriptType) (OwnerType (ConcreteOutput ownerType datumType valueType referenceScriptType)) Source #

outputStakingCredentialL :: Lens' (ConcreteOutput ownerType datumType valueType referenceScriptType) (Maybe StakingCredential) Source #

outputDatumL :: Lens' (ConcreteOutput ownerType datumType valueType referenceScriptType) (DatumType (ConcreteOutput ownerType datumType valueType referenceScriptType)) Source #

outputValueL :: Lens' (ConcreteOutput ownerType datumType valueType referenceScriptType) (ValueType (ConcreteOutput ownerType datumType valueType referenceScriptType)) Source #

outputReferenceScriptL :: Lens' (ConcreteOutput ownerType datumType valueType referenceScriptType) (Maybe (ReferenceScriptType (ConcreteOutput ownerType datumType valueType referenceScriptType))) Source #

type OwnerType (ConcreteOutput ownerType datumType valueType referenceScriptType) Source # 
Instance details

Defined in Cooked.Output

type OwnerType (ConcreteOutput ownerType datumType valueType referenceScriptType) = ownerType
type DatumType (ConcreteOutput ownerType datumType valueType referenceScriptType) Source # 
Instance details

Defined in Cooked.Output

type DatumType (ConcreteOutput ownerType datumType valueType referenceScriptType) = datumType
type ValueType (ConcreteOutput ownerType datumType valueType referenceScriptType) Source # 
Instance details

Defined in Cooked.Output

type ValueType (ConcreteOutput ownerType datumType valueType referenceScriptType) = valueType
type ReferenceScriptType (ConcreteOutput ownerType datumType valueType referenceScriptType) Source # 
Instance details

Defined in Cooked.Output

type ReferenceScriptType (ConcreteOutput ownerType datumType valueType referenceScriptType) = referenceScriptType

toOutputWithReferenceScriptHash :: (IsAbstractOutput output, ToScriptHash (ReferenceScriptType output)) => output -> ConcreteOutput (OwnerType output) (DatumType output) (ValueType output) ScriptHash Source #

Convert the reference script type on the output to ScriptHash.

isOutputWithoutDatum :: IsTxInfoOutput output => output -> Maybe (ConcreteOutput (OwnerType output) () (ValueType output) (ReferenceScriptType output)) Source #

Test if there is no datum on an output.

isOutputWithInlineDatum :: IsTxInfoOutput output => output -> Maybe (ConcreteOutput (OwnerType output) Datum (ValueType output) (ReferenceScriptType output)) Source #

Test if the output carries some inlined datum.

isOutputWithDatumHash :: IsTxInfoOutput output => output -> Maybe (ConcreteOutput (OwnerType output) DatumHash (ValueType output) (ReferenceScriptType output)) Source #

Test if the output carries some datum hash.

isOutputWithInlineDatumOfType :: (FromData a, IsTxInfoOutput output) => output -> Maybe (ConcreteOutput (OwnerType output) a (ValueType output) (ReferenceScriptType output)) Source #

Test if the output carries some inlined datum that can be parsed from + builtin data on to something of a specific type.

isScriptOutputFrom :: IsTxInfoOutput output => TypedValidator a -> output -> Maybe (ConcreteOutput (TypedValidator a) (DatumType output) (ValueType output) (ReferenceScriptType output)) Source #

Test if the owner of an output is a specific typed validator. If it is, + return an output with the validator type as its OwnerType.

isPKOutputFrom :: IsTxInfoOutput output => PubKeyHash -> output -> Maybe (ConcreteOutput PubKeyHash (DatumType output) (ValueType output) (ReferenceScriptType output)) Source #

Test if the owner of an output is a specific public key. If it is, return + an output of the same DatumType, but with PubKeyHash as its + OwnerType.

isOnlyAdaOutput :: IsTxInfoOutput output => output -> Maybe (ConcreteOutput (OwnerType output) (DatumType output) Ada (ReferenceScriptType output)) Source #

Test if the value on an output contains only Ada.

\ No newline at end of file diff --git a/Cooked-Pretty-Class.html b/Cooked-Pretty-Class.html index 4fc3eb842..005cd8268 100644 --- a/Cooked-Pretty-Class.html +++ b/Cooked-Pretty-Class.html @@ -1,11 +1,11 @@ Cooked.Pretty.Class
cooked-validators-2.0.0
Safe HaskellNone
LanguageHaskell2010

Cooked.Pretty.Class

Description

We provide the PrettyCooked class and instances for common Plutus types. - We don't rely on Pretty from Prettyprinter in order to define better + We don't rely on Pretty from Prettyprinter in order to define better printers for Plutus types which already have instances of Pretty. Also, PrettyCooked makes it possible to optionally modify pretty printing settings PrettyCookedOpts (e.g. length of printed hashes).

When defining a new PrettyCooked instance, prefer implementing - prettyCookedOpt and relay the option parameter to other printers.

Documentation

class PrettyCooked a where Source #

Minimal complete definition

Nothing

Instances

Instances details
PrettyCooked Bool Source # 
Instance details

Defined in Cooked.Pretty.Class

PrettyCooked Int Source # 
Instance details

Defined in Cooked.Pretty.Class

PrettyCooked Integer Source # 
Instance details

Defined in Cooked.Pretty.Class

PrettyCooked () Source # 
Instance details

Defined in Cooked.Pretty.Class

PrettyCooked CurrencySymbol Source # 
Instance details

Defined in Cooked.Pretty.Class

Methods

prettyCooked :: CurrencySymbol -> DocCooked Source #

prettyCookedOpt :: PrettyCookedOpts -> CurrencySymbol -> DocCooked Source #

PrettyCooked ScriptHash Source # 
Instance details

Defined in Cooked.Pretty.Class

Methods

prettyCooked :: ScriptHash -> DocCooked Source #

prettyCookedOpt :: PrettyCookedOpts -> ScriptHash -> DocCooked Source #

PrettyCooked AssetClass Source # 
Instance details

Defined in Cooked.Pretty.Class

Methods

prettyCooked :: AssetClass -> DocCooked Source #

prettyCookedOpt :: PrettyCookedOpts -> AssetClass -> DocCooked Source #

PrettyCooked TokenName Source # 
Instance details

Defined in Cooked.Pretty.Class

PrettyCooked Value Source # 
Instance details

Defined in Cooked.Pretty.Class

PrettyCooked Address Source # 
Instance details

Defined in Cooked.Pretty.Class

PrettyCooked Credential Source # 
Instance details

Defined in Cooked.Pretty.Class

Methods

prettyCooked :: Credential -> DocCooked Source #

prettyCookedOpt :: PrettyCookedOpts -> Credential -> DocCooked Source #

PrettyCooked PubKeyHash Source # 
Instance details

Defined in Cooked.Pretty.Class

Methods

prettyCooked :: PubKeyHash -> DocCooked Source #

prettyCookedOpt :: PrettyCookedOpts -> PubKeyHash -> DocCooked Source #

PrettyCooked POSIXTime Source # 
Instance details

Defined in Cooked.Pretty.Class

PrettyCooked TxId Source # 
Instance details

Defined in Cooked.Pretty.Class

PrettyCooked TxOutRef Source # 
Instance details

Defined in Cooked.Pretty.Class

PrettyCooked BuiltinData Source # 
Instance details

Defined in Cooked.Pretty.Class

Methods

prettyCooked :: BuiltinData -> DocCooked Source #

prettyCookedOpt :: PrettyCookedOpts -> BuiltinData -> DocCooked Source #

PrettyCooked ValidationErrorInPhase Source # 
Instance details

Defined in Cooked.Pretty.Class

Methods

prettyCooked :: ValidationErrorInPhase -> DocCooked Source #

prettyCookedOpt :: PrettyCookedOpts -> ValidationErrorInPhase -> DocCooked Source #

PrettyCooked TxSkelOutDatum Source #

The PrettyCooked instance for TxSkelOutDatum prints the datum it + prettyCookedOpt and relay the option parameter to other printers.

Documentation

class PrettyCooked a where Source #

Minimal complete definition

Nothing

Instances

Instances details
PrettyCooked Bool Source # 
Instance details

Defined in Cooked.Pretty.Class

PrettyCooked Int Source # 
Instance details

Defined in Cooked.Pretty.Class

PrettyCooked Integer Source # 
Instance details

Defined in Cooked.Pretty.Class

PrettyCooked () Source # 
Instance details

Defined in Cooked.Pretty.Class

PrettyCooked POSIXTime Source # 
Instance details

Defined in Cooked.Pretty.Class

PrettyCooked TxOutRef Source # 
Instance details

Defined in Cooked.Pretty.Class

PrettyCooked AssetClass Source # 
Instance details

Defined in Cooked.Pretty.Class

PrettyCooked Address Source # 
Instance details

Defined in Cooked.Pretty.Class

PrettyCooked Value Source # 
Instance details

Defined in Cooked.Pretty.Class

PrettyCooked PubKeyHash Source # 
Instance details

Defined in Cooked.Pretty.Class

PrettyCooked ValidationErrorInPhase Source # 
Instance details

Defined in Cooked.Pretty.Class

PrettyCooked ScriptHash Source # 
Instance details

Defined in Cooked.Pretty.Class

PrettyCooked Credential Source # 
Instance details

Defined in Cooked.Pretty.Class

PrettyCooked TxId Source # 
Instance details

Defined in Cooked.Pretty.Class

PrettyCooked CurrencySymbol Source # 
Instance details

Defined in Cooked.Pretty.Class

PrettyCooked TokenName Source # 
Instance details

Defined in Cooked.Pretty.Class

PrettyCooked BuiltinData Source # 
Instance details

Defined in Cooked.Pretty.Class

PrettyCooked TxSkelOutDatum Source #

The PrettyCooked instance for TxSkelOutDatum prints the datum it contains according to its own PrettyCooked instance.

Instance details

Defined in Cooked.Pretty.Cooked

PrettyCooked UtxoState Source #

Pretty print a UtxoState. Print the known wallets first, then unknown pubkeys, then scripts.

Instance details

Defined in Cooked.Pretty.Cooked

PrettyCooked MockChainError Source # 
Instance details

Defined in Cooked.Pretty.Cooked

PrettyCooked MockChainLog Source #

This pretty prints a MockChainLog that usually consists of the list of validated or submitted transactions. In the log, we know a transaction has - been validated if the MCLogSubmittedTxSkel is followed by a MCLogNewTx.

Instance details

Defined in Cooked.Pretty.Cooked

PrettyCooked a => PrettyCooked [a] Source # 
Instance details

Defined in Cooked.Pretty.Class

PrettyCooked (Versioned MintingPolicy) Source # 
Instance details

Defined in Cooked.Pretty.Class

Methods

prettyCooked :: Versioned MintingPolicy -> DocCooked Source #

prettyCookedOpt :: PrettyCookedOpts -> Versioned MintingPolicy -> DocCooked Source #

Show a => PrettyCooked (Either MockChainError (a, UtxoState)) Source # 
Instance details

Defined in Cooked.Pretty.Cooked

Show a => PrettyCooked (a, UtxoState) Source # 
Instance details

Defined in Cooked.Pretty.Cooked

printCookedOpt :: PrettyCooked a => PrettyCookedOpts -> a -> IO () Source #

Use this in the REPL as an alternative to the default print function + been validated if the MCLogSubmittedTxSkel is followed by a MCLogNewTx.

Instance details

Defined in Cooked.Pretty.Cooked

PrettyCooked a => PrettyCooked [a] Source # 
Instance details

Defined in Cooked.Pretty.Class

PrettyCooked (Versioned MintingPolicy) Source # 
Instance details

Defined in Cooked.Pretty.Class

Show a => PrettyCooked (Either MockChainError (a, UtxoState)) Source # 
Instance details

Defined in Cooked.Pretty.Cooked

Show a => PrettyCooked (a, UtxoState) Source # 
Instance details

Defined in Cooked.Pretty.Cooked

printCookedOpt :: PrettyCooked a => PrettyCookedOpts -> a -> IO () Source #

Use this in the REPL as an alternative to the default print function when dealing with pretty-printable cooked values.

For example, printCookedOpt def runMockChain i0 foo

printCooked :: PrettyCooked a => a -> IO () Source #

Version of printCookedOpt that uses default pretty printing options.

\ No newline at end of file diff --git a/Cooked-Pretty-Common.html b/Cooked-Pretty-Common.html index 82123166e..ab27dd80e 100644 --- a/Cooked-Pretty-Common.html +++ b/Cooked-Pretty-Common.html @@ -1,4 +1,4 @@ -Cooked.Pretty.Common
cooked-validators-2.0.0
Safe HaskellSafe-Inferred
LanguageHaskell2010

Cooked.Pretty.Common

Description

Common tools to help implement pretty-printers in cooked-validators

Documentation

type DocCooked = Doc () Source #

renderString :: (a -> DocCooked) -> a -> String Source #

Use this to convert a pretty-printer to a regular show function using +Cooked.Pretty.Common

cooked-validators-2.0.0
Safe HaskellSafe-Inferred
LanguageHaskell2010

Cooked.Pretty.Common

Description

Common tools to help implement pretty-printers in cooked-validators

Documentation

type DocCooked = Doc () Source #

renderString :: (a -> DocCooked) -> a -> String Source #

Use this to convert a pretty-printer to a regular show function using default layout options. This is used in Testing because Tasty uses strings.

prettyItemize :: DocCooked -> DocCooked -> [DocCooked] -> DocCooked Source #

Print an item list with a title.

>>> prettyItemize "Foo" "-" ["bar1", "bar2", "bar3"]
 Foo
diff --git a/Cooked-Pretty-Cooked.html b/Cooked-Pretty-Cooked.html
index 4a265e99a..f70fcc4d5 100644
--- a/Cooked-Pretty-Cooked.html
+++ b/Cooked-Pretty-Cooked.html
@@ -5,14 +5,14 @@
  related code in submodules of Cooked.Pretty instead of having
  PrettyCooked instances scattered around.

Some structure require additional arguments to be pretty-printed and have therefore no instances PrettyCooked (for example TxSkel needs some - TxSkelContext).

Documentation

prettyBalancingWallet :: PrettyCookedOpts -> Wallet -> DocCooked Source #

Same as the PrettyCooked instance for Wallet with a suffix mentioning - this is the balancing wallet

prettySigners :: PrettyCookedOpts -> TxOpts -> [Wallet] -> [DocCooked] Source #

Prints a list of pubkeys with a flag next to the balancing wallet

prettyMints :: PrettyCookedOpts -> (Versioned MintingPolicy, MintsRedeemer, TokenName, Integer) -> DocCooked Source #

Prints a minting specification

Examples without and with redeemer + TxSkelContext).

Documentation

prettyBalancingWallet :: PrettyCookedOpts -> Wallet -> DocCooked Source #

Same as the PrettyCooked instance for Wallet with a suffix mentioning + this is the balancing wallet

prettySigners :: PrettyCookedOpts -> TxOpts -> [Wallet] -> [DocCooked] Source #

Prints a list of pubkeys with a flag next to the balancing wallet

prettyMints :: PrettyCookedOpts -> (Versioned MintingPolicy, MintsRedeemer, TokenName, Integer) -> DocCooked Source #

Prints a minting specification

Examples without and with redeemer > #abcdef Foo -> 500 > #123456 Bar | Redeemer -> 1000

mPrettyTxOpts :: PrettyCookedOpts -> TxOpts -> Maybe DocCooked Source #

Pretty-print a list of transaction skeleton options, only printing an option if its value is non-default. If no non-default options are in the - list, return nothing.

prettyAddressState :: PrettyCookedOpts -> Address -> UtxoPayloadSet -> DocCooked Source #

Pretty prints the state of an address, that is the list of UTxOs + list, return nothing.

prettyAddressState :: PrettyCookedOpts -> Address -> UtxoPayloadSet -> DocCooked Source #

Pretty prints the state of an address, that is the list of UTxOs (including value and datum), grouped

prettyPayloadGrouped :: PrettyCookedOpts -> [UtxoPayload] -> Maybe DocCooked Source #

Pretty prints payloads (datum and value corresponding to 1 UTxO) that have - been grouped together when they carry same value and datum

Orphan instances

PrettyCooked TxSkelOutDatum Source #

The PrettyCooked instance for TxSkelOutDatum prints the datum it + been grouped together when they carry same value and datum

Orphan instances

PrettyCooked TxSkelOutDatum Source #

The PrettyCooked instance for TxSkelOutDatum prints the datum it contains according to its own PrettyCooked instance.

Instance details

PrettyCooked UtxoState Source #

Pretty print a UtxoState. Print the known wallets first, then unknown pubkeys, then scripts.

Instance details

PrettyCooked MockChainError Source # 
Instance details

PrettyCooked MockChainLog Source #

This pretty prints a MockChainLog that usually consists of the list of validated or submitted transactions. In the log, we know a transaction has diff --git a/Cooked-Pretty-Options.html b/Cooked-Pretty-Options.html index 636cebe84..b67d7a259 100644 --- a/Cooked-Pretty-Options.html +++ b/Cooked-Pretty-Options.html @@ -5,8 +5,8 @@ By default: False

  • pcOptPrintedHashLength :: Int

    Length of printed hashes (e.g. addresses, transaction ids) By default: 7

  • pcOptNumericUnderscores :: Bool

    Whether to print big integers with numeric underscores. For example 53_000_000 instead of 53000000. - By default: True

  • data PCOptTxOutRefs Source #

    Whether to print transaction outputs references.

    Constructors

    PCOptTxOutRefsHidden

    Hide them

    PCOptTxOutRefsFull

    Always show them. + By default: True

    data PCOptTxOutRefs Source #

    Whether to print transaction outputs references.

    Constructors

    PCOptTxOutRefsHidden

    Hide them

    PCOptTxOutRefsFull

    Always show them. Warning: this will disable printing similar UTxOs as a group (for instance (×10) Lovelace: 100_000_000)

    PCOptTxOutRefsPartial

    Show them for UTxOs which are not grouped with similar others. This avoids the downside of PCOptTxOutRefsFull which disables printing - UTxOs as a group.

    Instances

    Instances details
    Eq PCOptTxOutRefs Source # 
    Instance details

    Defined in Cooked.Pretty.Options

    Show PCOptTxOutRefs Source # 
    Instance details

    Defined in Cooked.Pretty.Options

    \ No newline at end of file + UTxOs as a group.

    \ No newline at end of file diff --git a/Cooked-Pretty.html b/Cooked-Pretty.html index f73b0120f..9316bae50 100644 --- a/Cooked-Pretty.html +++ b/Cooked-Pretty.html @@ -1,10 +1,10 @@ Cooked.Pretty
    cooked-validators-2.0.0
    Safe HaskellNone
    LanguageHaskell2010

    Cooked.Pretty

    Description

    This module pretty-printing for transaction skeletons, utxo states, addresses, pubkey hashes, values, etc.

    We provide the PrettyCooked class and instances for common Plutus types. - We don't rely on Pretty from Prettyprinter in order to define better + We don't rely on Pretty from Prettyprinter in order to define better printers for Plutus types which already have instances of Pretty. Also, PrettyCooked makes it possible to optionally modify pretty printing settings PrettyCookedOpts (e.g. length of printed hashes).

    Requirements on datum and redeemers

    Datums and redeemers are required to have a PrettyCooked instance.

    For trivial datatypes, you can rely on Show by using viaShow from - Prettyprinter: 'prettyCooked = Prettyprinter.viaShow'.

    For more complex datatypes, you can rely on existing PrettyCooked + Prettyprinter: 'prettyCooked = Prettyprinter.viaShow'.

    For more complex datatypes, you can rely on existing PrettyCooked instances. Prefer implementing the prettyCookedOpt function and relay the PrettyCookedOpts settings to other printers.

        data Foo = Bar Pl.Value | Baz Pl.PubkeyHash Pl.Value
     
    @@ -19,6 +19,6 @@
                 "deposit:" + prettyCookedOpt pcOpts value ]
     

    The prettyItemize function is useful to nicely lay down nested lists of elements. Since we manipulate regular Doc values, any function from - Prettyprinter can be used to implement your printers.

    How to pretty print?

    Pretty printing of transaction skeletons and UTxO states is done + Prettyprinter can be used to implement your printers.

    How to pretty print?

    Pretty printing of transaction skeletons and UTxO states is done automatically by the end-user functions provided in Cooked.MockChain.Testing.

    To do it manually, use prettyTxSkel or prettyUtxoState.

    \ No newline at end of file diff --git a/Cooked-RawUPLC.html b/Cooked-RawUPLC.html index 3e38bab19..f1c5806a8 100644 --- a/Cooked-RawUPLC.html +++ b/Cooked-RawUPLC.html @@ -1,10 +1,10 @@ -Cooked.RawUPLC
    cooked-validators-2.0.0
    Safe HaskellNone
    LanguageHaskell2010

    Cooked.RawUPLC

    Synopsis

    Documentation

    unsafeTypedValidatorFromUPLC :: forall a. Program NamedDeBruijn DefaultUni DefaultFun () -> TypedValidator a Source #

    Returns a TypedValidator from a UPLC program. The "unsafe" refers to the use of unsafeCoerce +Cooked.RawUPLC

    cooked-validators-2.0.0
    Safe HaskellNone
    LanguageHaskell2010

    Cooked.RawUPLC

    Documentation

    unsafeTypedValidatorFromUPLC :: forall a. Program NamedDeBruijn DefaultUni DefaultFun () -> TypedValidator a Source #

    Returns a TypedValidator from a UPLC program. The "unsafe" refers to the use of unsafeCoerce to cast a TypedValidator Any, resulting from typedValidatorFromUPLC, to a TypedValidator a. This enables us to avoid using fromBuiltinData and toBuiltinData all the time.

    This function is meant to be used with -XTypeApplications and the programmer is responsible for ensuring that the type variable a, below, gets instantiated - to the correct type.

    typedValidatorFromUPLC :: Program NamedDeBruijn DefaultUni DefaultFun () -> TypedValidator Any Source #

    Returns a TypedValidator from a UPLC program. The resulting typed validator is instantiated to Any, - which means all of its arguments receive a value of type BuiltinData.

    TODO: At the moment this wraps everything as a PlutusV2 script. Make this more flexible.

    unsafeTypedValidatorFromBS :: forall a. ByteString -> Either String (TypedValidator a) Source #

    Loads a typed validator from a bytestring that was produced by flat the outputs + to the correct type.

    typedValidatorFromUPLC :: Program NamedDeBruijn DefaultUni DefaultFun () -> TypedValidator Any Source #

    Returns a TypedValidator from a UPLC program. The resulting typed validator is instantiated to Any, + which means all of its arguments receive a value of type BuiltinData.

    TODO: At the moment this wraps everything as a PlutusV2 script. Make this more flexible.

    unsafeTypedValidatorFromBS :: forall a. ByteString -> Either String (TypedValidator a) Source #

    Loads a typed validator from a bytestring that was produced by flat the outputs of getPlc - applied to a mkTypedValidator. If the compiled validator was not wrapped, - stick to typedValidatorFromBS.

    typedValidatorFromBS :: ByteString -> Either String (TypedValidator Any) Source #

    Loads a typed validator from a bytestring that was produced by flat the outputs + applied to a mkTypedValidator. If the compiled validator was not wrapped, + stick to typedValidatorFromBS.

    typedValidatorFromBS :: ByteString -> Either String (TypedValidator Any) Source #

    Loads a typed validator from a bytestring that was produced by flat the outputs of getPlc.

    \ No newline at end of file diff --git a/Cooked-ShowBS.html b/Cooked-ShowBS.html index 741683349..d91a375ce 100644 --- a/Cooked-ShowBS.html +++ b/Cooked-ShowBS.html @@ -1,7 +1,7 @@ -Cooked.ShowBS
    cooked-validators-2.0.0
    Safe HaskellNone
    LanguageHaskell2010

    Cooked.ShowBS

    Description

    Print all the types that occur on the TxInfo to BuiltinString. This is +Cooked.ShowBS

    cooked-validators-2.0.0
    Safe HaskellNone
    LanguageHaskell2010

    Cooked.ShowBS

    Description

    Print all the types that occur on the TxInfo to BuiltinString. This is useful for debugging of validators. You probably do not want to use this in production code, as many of the functions in this module are wildly - inefficient due to limitations of the BuiltinString type.

    If the functions from this module make script execution on your transactions + inefficient due to limitations of the BuiltinString type.

    If the functions from this module make script execution on your transactions go over budget, consider using txOptEmulatorParamsModification to temporarily loosen the limits (at the cost of breaking compatibility with - mainnet)

    Synopsis

    Documentation

    class ShowBS a where Source #

    analogue of Haskell's Show class for use in Plutus scripts.

    Minimal complete definition

    Nothing

    Methods

    showBS :: a -> BuiltinString Source #

    analogue of show

    showBSsPrec :: Integer -> a -> BuiltinString -> BuiltinString Source #

    analogue of showsPrec

    Instances

    Instances details
    ShowBS Bool Source # 
    Instance details

    Defined in Cooked.ShowBS

    Methods

    showBS :: Bool -> BuiltinString Source #

    showBSsPrec :: Integer -> Bool -> BuiltinString -> BuiltinString Source #

    ShowBS Integer Source # 
    Instance details

    Defined in Cooked.ShowBS

    Methods

    showBS :: Integer -> BuiltinString Source #

    showBSsPrec :: Integer -> Integer -> BuiltinString -> BuiltinString Source #

    ShowBS Datum Source # 
    Instance details

    Defined in Cooked.ShowBS

    Methods

    showBS :: Datum -> BuiltinString Source #

    showBSsPrec :: Integer -> Datum -> BuiltinString -> BuiltinString Source #

    ShowBS DatumHash Source # 
    Instance details

    Defined in Cooked.ShowBS

    Methods

    showBS :: DatumHash -> BuiltinString Source #

    showBSsPrec :: Integer -> DatumHash -> BuiltinString -> BuiltinString Source #

    ShowBS Redeemer Source # 
    Instance details

    Defined in Cooked.ShowBS

    Methods

    showBS :: Redeemer -> BuiltinString Source #

    showBSsPrec :: Integer -> Redeemer -> BuiltinString -> BuiltinString Source #

    ShowBS ValidatorHash Source # 
    Instance details

    Defined in Cooked.ShowBS

    Methods

    showBS :: ValidatorHash -> BuiltinString Source #

    showBSsPrec :: Integer -> ValidatorHash -> BuiltinString -> BuiltinString Source #

    ShowBS BuiltinByteString Source # 
    Instance details

    Defined in Cooked.ShowBS

    Methods

    showBS :: BuiltinByteString -> BuiltinString Source #

    showBSsPrec :: Integer -> BuiltinByteString -> BuiltinString -> BuiltinString Source #

    ShowBS CurrencySymbol Source # 
    Instance details

    Defined in Cooked.ShowBS

    Methods

    showBS :: CurrencySymbol -> BuiltinString Source #

    showBSsPrec :: Integer -> CurrencySymbol -> BuiltinString -> BuiltinString Source #

    ShowBS ScriptHash Source # 
    Instance details

    Defined in Cooked.ShowBS

    Methods

    showBS :: ScriptHash -> BuiltinString Source #

    showBSsPrec :: Integer -> ScriptHash -> BuiltinString -> BuiltinString Source #

    ShowBS TokenName Source # 
    Instance details

    Defined in Cooked.ShowBS

    Methods

    showBS :: TokenName -> BuiltinString Source #

    showBSsPrec :: Integer -> TokenName -> BuiltinString -> BuiltinString Source #

    ShowBS Value Source # 
    Instance details

    Defined in Cooked.ShowBS

    Methods

    showBS :: Value -> BuiltinString Source #

    showBSsPrec :: Integer -> Value -> BuiltinString -> BuiltinString Source #

    ShowBS Address Source # 
    Instance details

    Defined in Cooked.ShowBS

    Methods

    showBS :: Address -> BuiltinString Source #

    showBSsPrec :: Integer -> Address -> BuiltinString -> BuiltinString Source #

    ShowBS ScriptPurpose Source # 
    Instance details

    Defined in Cooked.ShowBS

    Methods

    showBS :: ScriptPurpose -> BuiltinString Source #

    showBSsPrec :: Integer -> ScriptPurpose -> BuiltinString -> BuiltinString Source #

    ShowBS Credential Source # 
    Instance details

    Defined in Cooked.ShowBS

    Methods

    showBS :: Credential -> BuiltinString Source #

    showBSsPrec :: Integer -> Credential -> BuiltinString -> BuiltinString Source #

    ShowBS StakingCredential Source # 
    Instance details

    Defined in Cooked.ShowBS

    Methods

    showBS :: StakingCredential -> BuiltinString Source #

    showBSsPrec :: Integer -> StakingCredential -> BuiltinString -> BuiltinString Source #

    ShowBS PubKeyHash Source # 
    Instance details

    Defined in Cooked.ShowBS

    Methods

    showBS :: PubKeyHash -> BuiltinString Source #

    showBSsPrec :: Integer -> PubKeyHash -> BuiltinString -> BuiltinString Source #

    ShowBS DCert Source # 
    Instance details

    Defined in Cooked.ShowBS

    Methods

    showBS :: DCert -> BuiltinString Source #

    showBSsPrec :: Integer -> DCert -> BuiltinString -> BuiltinString Source #

    ShowBS POSIXTime Source # 
    Instance details

    Defined in Cooked.ShowBS

    Methods

    showBS :: POSIXTime -> BuiltinString Source #

    showBSsPrec :: Integer -> POSIXTime -> BuiltinString -> BuiltinString Source #

    ShowBS TxId Source # 
    Instance details

    Defined in Cooked.ShowBS

    Methods

    showBS :: TxId -> BuiltinString Source #

    showBSsPrec :: Integer -> TxId -> BuiltinString -> BuiltinString Source #

    ShowBS TxOutRef Source # 
    Instance details

    Defined in Cooked.ShowBS

    Methods

    showBS :: TxOutRef -> BuiltinString Source #

    showBSsPrec :: Integer -> TxOutRef -> BuiltinString -> BuiltinString Source #

    ShowBS TxInInfo Source # 
    Instance details

    Defined in Cooked.ShowBS

    Methods

    showBS :: TxInInfo -> BuiltinString Source #

    showBSsPrec :: Integer -> TxInInfo -> BuiltinString -> BuiltinString Source #

    ShowBS TxInfo Source # 
    Instance details

    Defined in Cooked.ShowBS

    Methods

    showBS :: TxInfo -> BuiltinString Source #

    showBSsPrec :: Integer -> TxInfo -> BuiltinString -> BuiltinString Source #

    ShowBS OutputDatum Source # 
    Instance details

    Defined in Cooked.ShowBS

    Methods

    showBS :: OutputDatum -> BuiltinString Source #

    showBSsPrec :: Integer -> OutputDatum -> BuiltinString -> BuiltinString Source #

    ShowBS TxOut Source # 
    Instance details

    Defined in Cooked.ShowBS

    Methods

    showBS :: TxOut -> BuiltinString Source #

    showBSsPrec :: Integer -> TxOut -> BuiltinString -> BuiltinString Source #

    ShowBS BuiltinData Source # 
    Instance details

    Defined in Cooked.ShowBS

    Methods

    showBS :: BuiltinData -> BuiltinString Source #

    showBSsPrec :: Integer -> BuiltinData -> BuiltinString -> BuiltinString Source #

    ShowBS a => ShowBS [a] Source # 
    Instance details

    Defined in Cooked.ShowBS

    Methods

    showBS :: [a] -> BuiltinString Source #

    showBSsPrec :: Integer -> [a] -> BuiltinString -> BuiltinString Source #

    ShowBS a => ShowBS (Maybe a) Source # 
    Instance details

    Defined in Cooked.ShowBS

    Methods

    showBS :: Maybe a -> BuiltinString Source #

    showBSsPrec :: Integer -> Maybe a -> BuiltinString -> BuiltinString Source #

    ShowBS a => ShowBS (Extended a) Source # 
    Instance details

    Defined in Cooked.ShowBS

    Methods

    showBS :: Extended a -> BuiltinString Source #

    showBSsPrec :: Integer -> Extended a -> BuiltinString -> BuiltinString Source #

    ShowBS a => ShowBS (Interval a) Source # 
    Instance details

    Defined in Cooked.ShowBS

    Methods

    showBS :: Interval a -> BuiltinString Source #

    showBSsPrec :: Integer -> Interval a -> BuiltinString -> BuiltinString Source #

    ShowBS a => ShowBS (LowerBound a) Source # 
    Instance details

    Defined in Cooked.ShowBS

    Methods

    showBS :: LowerBound a -> BuiltinString Source #

    showBSsPrec :: Integer -> LowerBound a -> BuiltinString -> BuiltinString Source #

    ShowBS a => ShowBS (UpperBound a) Source # 
    Instance details

    Defined in Cooked.ShowBS

    Methods

    showBS :: UpperBound a -> BuiltinString Source #

    showBSsPrec :: Integer -> UpperBound a -> BuiltinString -> BuiltinString Source #

    (ShowBS a, ShowBS b) => ShowBS (a, b) Source # 
    Instance details

    Defined in Cooked.ShowBS

    Methods

    showBS :: (a, b) -> BuiltinString Source #

    showBSsPrec :: Integer -> (a, b) -> BuiltinString -> BuiltinString Source #

    (ShowBS k, ShowBS v) => ShowBS (Map k v) Source # 
    Instance details

    Defined in Cooked.ShowBS

    Methods

    showBS :: Map k v -> BuiltinString Source #

    showBSsPrec :: Integer -> Map k v -> BuiltinString -> BuiltinString Source #

    showBSs :: ShowBS a => a -> BuiltinString -> BuiltinString Source #

    analogue of shows

    app_prec :: Integer Source #

    Precedence of function applications

    \ No newline at end of file + mainnet)

    Documentation

    class ShowBS a where Source #

    analogue of Haskell's Show class for use in Plutus scripts.

    Minimal complete definition

    Nothing

    Methods

    showBS :: a -> BuiltinString Source #

    analogue of show

    showBSsPrec :: Integer -> a -> BuiltinString -> BuiltinString Source #

    analogue of showsPrec

    Instances

    Instances details
    ShowBS Bool Source # 
    Instance details

    Defined in Cooked.ShowBS

    ShowBS Integer Source # 
    Instance details

    Defined in Cooked.ShowBS

    ShowBS POSIXTime Source # 
    Instance details

    Defined in Cooked.ShowBS

    ShowBS TxOutRef Source # 
    Instance details

    Defined in Cooked.ShowBS

    ShowBS OutputDatum Source # 
    Instance details

    Defined in Cooked.ShowBS

    ShowBS Address Source # 
    Instance details

    Defined in Cooked.ShowBS

    ShowBS Value Source # 
    Instance details

    Defined in Cooked.ShowBS

    ShowBS Datum Source # 
    Instance details

    Defined in Cooked.ShowBS

    ShowBS PubKeyHash Source # 
    Instance details

    Defined in Cooked.ShowBS

    ShowBS DatumHash Source # 
    Instance details

    Defined in Cooked.ShowBS

    ShowBS ValidatorHash Source # 
    Instance details

    Defined in Cooked.ShowBS

    ShowBS ScriptHash Source # 
    Instance details

    Defined in Cooked.ShowBS

    ShowBS Redeemer Source # 
    Instance details

    Defined in Cooked.ShowBS

    ShowBS Credential Source # 
    Instance details

    Defined in Cooked.ShowBS

    ShowBS StakingCredential Source # 
    Instance details

    Defined in Cooked.ShowBS

    ShowBS DCert Source # 
    Instance details

    Defined in Cooked.ShowBS

    ShowBS ScriptPurpose Source # 
    Instance details

    Defined in Cooked.ShowBS

    ShowBS TxInInfo Source # 
    Instance details

    Defined in Cooked.ShowBS

    ShowBS TxInfo Source # 
    Instance details

    Defined in Cooked.ShowBS

    ShowBS TxOut Source # 
    Instance details

    Defined in Cooked.ShowBS

    ShowBS TxId Source # 
    Instance details

    Defined in Cooked.ShowBS

    ShowBS CurrencySymbol Source # 
    Instance details

    Defined in Cooked.ShowBS

    ShowBS TokenName Source # 
    Instance details

    Defined in Cooked.ShowBS

    ShowBS BuiltinData Source # 
    Instance details

    Defined in Cooked.ShowBS

    ShowBS BuiltinByteString Source # 
    Instance details

    Defined in Cooked.ShowBS

    ShowBS a => ShowBS [a] Source # 
    Instance details

    Defined in Cooked.ShowBS

    ShowBS a => ShowBS (Maybe a) Source # 
    Instance details

    Defined in Cooked.ShowBS

    ShowBS a => ShowBS (Interval a) Source # 
    Instance details

    Defined in Cooked.ShowBS

    ShowBS a => ShowBS (LowerBound a) Source # 
    Instance details

    Defined in Cooked.ShowBS

    ShowBS a => ShowBS (UpperBound a) Source # 
    Instance details

    Defined in Cooked.ShowBS

    ShowBS a => ShowBS (Extended a) Source # 
    Instance details

    Defined in Cooked.ShowBS

    (ShowBS a, ShowBS b) => ShowBS (a, b) Source # 
    Instance details

    Defined in Cooked.ShowBS

    (ShowBS k, ShowBS v) => ShowBS (Map k v) Source # 
    Instance details

    Defined in Cooked.ShowBS

    showBSs :: ShowBS a => a -> BuiltinString -> BuiltinString Source #

    analogue of shows

    app_prec :: Integer Source #

    Precedence of function applications

    \ No newline at end of file diff --git a/Cooked-Skeleton.html b/Cooked-Skeleton.html index 5e69b62bd..7bf1397b5 100644 --- a/Cooked-Skeleton.html +++ b/Cooked-Skeleton.html @@ -1,12 +1,12 @@ -Cooked.Skeleton
    cooked-validators-2.0.0
    Safe HaskellNone
    LanguageHaskell2010

    Cooked.Skeleton

    Synopsis

    Documentation

    type LabelConstrs x = (Show x, Typeable x, Eq x, Ord x) Source #

    data TxLabel where Source #

    Constructors

    TxLabel :: LabelConstrs x => x -> TxLabel 

    Instances

    Instances details
    Eq TxLabel Source # 
    Instance details

    Defined in Cooked.Skeleton

    Methods

    (==) :: TxLabel -> TxLabel -> Bool #

    (/=) :: TxLabel -> TxLabel -> Bool #

    Ord TxLabel Source # 
    Instance details

    Defined in Cooked.Skeleton

    Show TxLabel Source # 
    Instance details

    Defined in Cooked.Skeleton

    data BalanceOutputPolicy Source #

    Whether to adjust a potentially existing output to the balancing wallet +Cooked.Skeleton

    cooked-validators-2.0.0
    Safe HaskellNone
    LanguageHaskell2010

    Cooked.Skeleton

    Synopsis

    Documentation

    type LabelConstrs x = (Show x, Typeable x, Eq x, Ord x) Source #

    data TxLabel where Source #

    Constructors

    TxLabel :: LabelConstrs x => x -> TxLabel 

    Instances

    Instances details
    Eq TxLabel Source # 
    Instance details

    Defined in Cooked.Skeleton

    Ord TxLabel Source # 
    Instance details

    Defined in Cooked.Skeleton

    Show TxLabel Source # 
    Instance details

    Defined in Cooked.Skeleton

    data BalanceOutputPolicy Source #

    Whether to adjust a potentially existing output to the balancing wallet with the change during transaction balancing.

    Constructors

    AdjustExistingOutput

    Try to adjust an existing public key output with the change. If no suitable output can be found, create a new change output.

    DontAdjustExistingOutput

    Do not change the existing outputs, always create a new change - output.

    data BalancingWallet Source #

    Which wallet to use to provide outputs for balancing and collaterals. Either the first signer or an explicit wallet. In the second case, this - wallet must be a signer of the transaction.

    newtype RawModTx Source #

    Wraps a function that will be applied to a transaction right before - submitting it.

    Constructors

    RawModTxAfterBalancing (Tx BabbageEra -> Tx BabbageEra)

    Apply modification on transaction after balancing, fee calculation, and - final signing are performed

    Instances

    Instances details
    Eq RawModTx Source # 
    Instance details

    Defined in Cooked.Skeleton

    Show RawModTx Source # 
    Instance details

    Defined in Cooked.Skeleton

    newtype EmulatorParamsModification Source #

    Wraps a function that will temporarily change the emulator parameters for - the transaction's balancing and submission.

    Constructors

    EmulatorParamsModification (Params -> Params) 

    data BalancingUtxos Source #

    Describes which UTxOs of the balancing wallet can be spent for balancing.

    Constructors

    BalancingUtxosAll

    Use all UTxOs (default)

    BalancingUtxosDatumless

    Use all UTxOs without datum

    BalancingUtxosAllowlist [TxOutRef]

    Use only the provided UTxOs

    BalancingUtxosBlocklist [TxOutRef]

    Do not use the provided UTxOs

    newtype RawModTx Source #

    Wraps a function that will be applied to a transaction right before + submitting it.

    Constructors

    RawModTxAfterBalancing (Tx BabbageEra -> Tx BabbageEra)

    Apply modification on transaction after balancing, fee calculation, and + final signing are performed

    Instances

    Instances details
    Eq RawModTx Source # 
    Instance details

    Defined in Cooked.Skeleton

    Show RawModTx Source # 
    Instance details

    Defined in Cooked.Skeleton

    newtype EmulatorParamsModification Source #

    Wraps a function that will temporarily change the emulator parameters for + the transaction's balancing and submission.

    data BalancingUtxos Source #

    Describes which UTxOs of the balancing wallet can be spent for balancing.

    Constructors

    BalancingUtxosAll

    Use all UTxOs (default)

    BalancingUtxosDatumless

    Use all UTxOs without datum

    BalancingUtxosAllowlist [TxOutRef]

    Use only the provided UTxOs

    BalancingUtxosBlocklist [TxOutRef]

    Do not use the provided UTxOs

    applyRawModOnBalancedTx :: [RawModTx] -> Tx BabbageEra -> Tx BabbageEra Source #

    Applies a list of modifications right before the transaction is submitted. The leftmost function in the argument list is applied first.

    data TxOpts Source #

    Set of options to modify the behavior of generating and validating some transaction.

    Constructors

    TxOpts 

    Fields

    • txOptEnsureMinAda :: Bool

      Performs an adjustment to unbalanced transactions, making sure every UTxO that is produced has the necessary minimum amount of Ada.

      Default is False.

    • txOptAwaitTxConfirmed :: Bool

      Ignore this for now. Deprecated.

    • txOptAutoSlotIncrease :: Bool

      Whether to increase the slot counter automatically on transaction submission. This is useful for modelling transactions that could be @@ -34,13 +34,13 @@ compatibility with the actual chain. It is useful mainly for testing purposes, when you might want to use extremely big transactions or transactions that exhaust the maximum execution budget. Such a thing - could be accomplished with

      txOptEmulatorParamsModification = Just $ EmulatorParamsModification increaseTransactionLimits

      for example.

      Default is Nothing.

    Instances

    Instances details
    Eq TxOpts Source # 
    Instance details

    Defined in Cooked.Skeleton

    Methods

    (==) :: TxOpts -> TxOpts -> Bool #

    (/=) :: TxOpts -> TxOpts -> Bool #

    Show TxOpts Source # 
    Instance details

    Defined in Cooked.Skeleton

    Default TxOpts Source # 
    Instance details

    Defined in Cooked.Skeleton

    Methods

    def :: TxOpts

    type MintsConstrs redeemer = (ToData redeemer, Show redeemer, PrettyCooked redeemer, Typeable redeemer) Source #

    data MintsRedeemer where Source #

    Which redeemer to use for minting. Note that using NoMintsRedeemer - corresponds to the redeemer () on-chain.

    Constructors

    NoMintsRedeemer :: MintsRedeemer 
    SomeMintsRedeemer :: MintsConstrs redeemer => redeemer -> MintsRedeemer 

    Instances

    Instances details
    Eq MintsRedeemer Source # 
    Instance details

    Defined in Cooked.Skeleton

    Ord MintsRedeemer Source # 
    Instance details

    Defined in Cooked.Skeleton

    Show MintsRedeemer Source # 
    Instance details

    Defined in Cooked.Skeleton

    Semigroup TxSkelMints Source #

    Combining TxSkelMints in a sensible way. In particular, this means that

    Map.fromList [(pol, (red, NEMap.fromList [(tName, 1)]))]

    and

    Map.fromList [(pol, (red', NEMap.fromList [(tName, -1)]))]

    will combine to become the empty TxSkelMints (and similar examples, where + could be accomplished with

    txOptEmulatorParamsModification = Just $ EmulatorParamsModification increaseTransactionLimits

    for example.

    Default is Nothing.

    Instances

    Instances details
    Eq TxOpts Source # 
    Instance details

    Defined in Cooked.Skeleton

    Show TxOpts Source # 
    Instance details

    Defined in Cooked.Skeleton

    Default TxOpts Source # 
    Instance details

    Defined in Cooked.Skeleton

    Methods

    def :: TxOpts Source #

    type MintsConstrs redeemer = (ToData redeemer, Show redeemer, PrettyCooked redeemer, Typeable redeemer) Source #

    data MintsRedeemer where Source #

    Which redeemer to use for minting. Note that using NoMintsRedeemer + corresponds to the redeemer () on-chain.

    Constructors

    NoMintsRedeemer :: MintsRedeemer 
    SomeMintsRedeemer :: MintsConstrs redeemer => redeemer -> MintsRedeemer 

    Instances

    Instances details
    Eq MintsRedeemer Source # 
    Instance details

    Defined in Cooked.Skeleton

    Ord MintsRedeemer Source # 
    Instance details

    Defined in Cooked.Skeleton

    Show MintsRedeemer Source # 
    Instance details

    Defined in Cooked.Skeleton

    Semigroup TxSkelMints Source #

    Combining TxSkelMints in a sensible way. In particular, this means that

    Map.fromList [(pol, (red, NEMap.fromList [(tName, 1)]))]

    and

    Map.fromList [(pol, (red', NEMap.fromList [(tName, -1)]))]

    will combine to become the empty TxSkelMints (and similar examples, where the values add up to zero, see the comment at the definition of addToTxSkelMints).

    In every case, if you add mints with a different redeemer for the same - policy, the redeemer used in the right argument takes precedence.

    Instance details

    Defined in Cooked.Skeleton

    Semigroup DoubleSatDelta Source # 
    Instance details

    Defined in Cooked.Attack.DoubleSat

    Monoid TxSkelMints Source # 
    Instance details

    Defined in Cooked.Skeleton

    Monoid DoubleSatDelta Source # 
    Instance details

    Defined in Cooked.Attack.DoubleSat

    type TxSkelMints = Map (Versioned MintingPolicy) (MintsRedeemer, NEMap TokenName (NonZero Integer)) Source #

    A description of what a transaction mints. For every policy, there can only + policy, the redeemer used in the right argument takes precedence.

    Instance details

    Defined in Cooked.Skeleton

    Semigroup DoubleSatDelta Source # 
    Instance details

    Defined in Cooked.Attack.DoubleSat

    Monoid TxSkelMints Source # 
    Instance details

    Defined in Cooked.Skeleton

    Monoid DoubleSatDelta Source # 
    Instance details

    Defined in Cooked.Attack.DoubleSat

    type TxSkelMints = Map (Versioned MintingPolicy) (MintsRedeemer, NEMap TokenName (NonZero Integer)) Source #

    A description of what a transaction mints. For every policy, there can only be one MintsRedeemer, and if there is, there must be some token names, each - with a non-zero amount of tokens.

    You'll probably not construct this by hand, but use txSkelMintsFromList.

    addToTxSkelMints :: (Versioned MintingPolicy, MintsRedeemer, TokenName, Integer) -> TxSkelMints -> TxSkelMints Source #

    Add a new entry to a TxSkelMints. There are a few wrinkles:

    1. If for a given policy, redeemer, and token name, there are n tokens in + with a non-zero amount of tokens.

      You'll probably not construct this by hand, but use txSkelMintsFromList.

    addToTxSkelMints :: (Versioned MintingPolicy, MintsRedeemer, TokenName, Integer) -> TxSkelMints -> TxSkelMints Source #

    Add a new entry to a TxSkelMints. There are a few wrinkles:

    1. If for a given policy, redeemer, and token name, there are n tokens in the argument TxSkelMints, and you add -n tokens, the corresponding entry in the "inner map" of the policy will disappear (obviously, because all of its values have to be non-zero). If that also means that the inner map @@ -58,47 +58,47 @@ minted value together with a map from policy IDs to witnesses (which represent the used redeemers). That means that we can only store _one_ redeemer per minting policy, and no conflicting mints of the same asset - class, since they'll just cancel.

    txSkelMintsToList :: TxSkelMints -> [(Versioned MintingPolicy, MintsRedeemer, TokenName, Integer)] Source #

    Convert from TxSkelMints to a list of tuples describing eveything that's - being minted.

    txSkelMintsFromList :: [(Versioned MintingPolicy, MintsRedeemer, TokenName, Integer)] -> TxSkelMints Source #

    Smart constructor for TxSkelMints. This function relies on + class, since they'll just cancel.

    txSkelMintsToList :: TxSkelMints -> [(Versioned MintingPolicy, MintsRedeemer, TokenName, Integer)] Source #

    Convert from TxSkelMints to a list of tuples describing eveything that's + being minted.

    txSkelMintsFromList :: [(Versioned MintingPolicy, MintsRedeemer, TokenName, Integer)] -> TxSkelMints Source #

    Smart constructor for TxSkelMints. This function relies on addToTxSkelMints. So, some non-empty lists (where all amounts for a given asset class an redeemer add up to zero) might be translated into the empty - TxSkelMints.

    txSkelMintsValue :: TxSkelMints -> Value Source #

    The value described by a TxSkelMints

    txSkelOutValidator :: TxSkelOut -> Maybe (Versioned Validator) Source #

    type TxSkelOutDatumConstrs a = (Show a, PrettyCooked a, ToData a, Eq a, Typeable a) Source #

    data TxSkelOutDatum where Source #

    On transaction outputs, we have the options to use

    1. no datum
    2. only a datum hash
    3. a "normal" datum
    4. an inline datum

    These four options are also what the type TxSkelOutDatum records. The + TxSkelMints.

    txSkelMintsValue :: TxSkelMints -> Value Source #

    The value described by a TxSkelMints

    data TxSkelOutDatum where Source #

    On transaction outputs, we have the options to use

    1. no datum
    2. only a datum hash
    3. a "normal" datum
    4. an inline datum

    These four options are also what the type TxSkelOutDatum records. The following table explains their differences.

    datum stored in in the simulated chain state datum resolved -on the txInfoDataOutputDatum +on the txInfoDataOutputDatum constructor -seen by the validator
    TxSkelOutNoDatumnonoNoOutputDatum
    TxSkelOutDatumHashyesnoOutputDatumHash
    TxSkelOutDatumyesyesOutputDatumHash
    TxSkelOutInlineDatumyesnoOutputDatum

    That is:

    Constructors

    TxSkelOutNoDatum :: TxSkelOutDatum

    use no datum

    TxSkelOutDatumHash :: TxSkelOutDatumConstrs a => a -> TxSkelOutDatum

    only include the hash on the transaction

    TxSkelOutDatum :: TxSkelOutDatumConstrs a => a -> TxSkelOutDatum

    use a OutputDatumHash on the transaction output, but generate the + like findDatum.

    Constructors

    TxSkelOutNoDatum :: TxSkelOutDatum

    use no datum

    TxSkelOutDatumHash :: TxSkelOutDatumConstrs a => a -> TxSkelOutDatum

    only include the hash on the transaction

    TxSkelOutDatum :: TxSkelOutDatumConstrs a => a -> TxSkelOutDatum

    use a OutputDatumHash on the transaction output, but generate the transaction in such a way that the complete datum is included in the - txInfoData seen by validators

    TxSkelOutInlineDatum :: TxSkelOutDatumConstrs a => a -> TxSkelOutDatum

    use an inline datum

    data TxSkelOut where Source #

    Transaction outputs. The Pays constructor is really general, and you'll probably want to use one of the smart constructors like paysScript or - paysPK in most cases.

    Constructors

    Pays 

    paysPK :: PubKeyHash -> Value -> TxSkelOut Source #

    Pay a certain value to a public key.

    paysScript :: (ToData (DatumType a), Show (DatumType a), Typeable (DatumType a), Eq (DatumType a), PrettyCooked (DatumType a), Typeable a) => TypedValidator a -> DatumType a -> Value -> TxSkelOut Source #

    Pays a script a certain value with a certain datum, using the - TxSkelOutDatum constructor. (See the documentation of TxSkelOutDatum.)

    paysScriptInlineDatum :: (ToData (DatumType a), Show (DatumType a), Typeable (DatumType a), Eq (DatumType a), PrettyCooked (DatumType a), Typeable a) => TypedValidator a -> DatumType a -> Value -> TxSkelOut Source #

    Pays a script a certain value with a certain inlined datum.

    paysScriptDatumHash :: (ToData (DatumType a), Show (DatumType a), Typeable (DatumType a), Eq (DatumType a), PrettyCooked (DatumType a), Typeable a) => TypedValidator a -> DatumType a -> Value -> TxSkelOut Source #

    Pays a script a certain value with a certain hashed (not resolved in - transaction) datum.

    paysScriptNoDatum :: Typeable a => TypedValidator a -> Value -> TxSkelOut Source #

    Pays a script a certain value without any datum. Intended to be used with + paysPK in most cases.

    paysPK :: PubKeyHash -> Value -> TxSkelOut Source #

    Pay a certain value to a public key.

    paysScript :: (ToData (DatumType a), Show (DatumType a), Typeable (DatumType a), Eq (DatumType a), PrettyCooked (DatumType a), Typeable a) => TypedValidator a -> DatumType a -> Value -> TxSkelOut Source #

    Pays a script a certain value with a certain datum, using the + TxSkelOutDatum constructor. (See the documentation of TxSkelOutDatum.)

    paysScriptInlineDatum :: (ToData (DatumType a), Show (DatumType a), Typeable (DatumType a), Eq (DatumType a), PrettyCooked (DatumType a), Typeable a) => TypedValidator a -> DatumType a -> Value -> TxSkelOut Source #

    Pays a script a certain value with a certain inlined datum.

    paysScriptDatumHash :: (ToData (DatumType a), Show (DatumType a), Typeable (DatumType a), Eq (DatumType a), PrettyCooked (DatumType a), Typeable a) => TypedValidator a -> DatumType a -> Value -> TxSkelOut Source #

    Pays a script a certain value with a certain hashed (not resolved in + transaction) datum.

    paysScriptNoDatum :: Typeable a => TypedValidator a -> Value -> TxSkelOut Source #

    Pays a script a certain value without any datum. Intended to be used with withDatum, withDatumHash, or withInlineDatum to try a datum whose type - does not match the validator's.

    withDatum :: (ToData a, Show a, Typeable a, Eq a, PrettyCooked a) => TxSkelOut -> a -> TxSkelOut Source #

    Set the datum in a payment to the given datum (whose type may not fit the - typed validator in case of a script).

    withInlineDatum :: (ToData a, Show a, Typeable a, Eq a, PrettyCooked a) => TxSkelOut -> a -> TxSkelOut Source #

    Set the datum in a payment to the given inlined datum (whose type may not - fit the typed validator in case of a script).

    withDatumHash :: (ToData a, Show a, Typeable a, Eq a, PrettyCooked a) => TxSkelOut -> a -> TxSkelOut Source #

    Set the datum in a payment to the given hashed (not resolved in the + does not match the validator's.

    withDatum :: (ToData a, Show a, Typeable a, Eq a, PrettyCooked a) => TxSkelOut -> a -> TxSkelOut Source #

    Set the datum in a payment to the given datum (whose type may not fit the + typed validator in case of a script).

    withInlineDatum :: (ToData a, Show a, Typeable a, Eq a, PrettyCooked a) => TxSkelOut -> a -> TxSkelOut Source #

    Set the datum in a payment to the given inlined datum (whose type may not + fit the typed validator in case of a script).

    withDatumHash :: (ToData a, Show a, Typeable a, Eq a, PrettyCooked a) => TxSkelOut -> a -> TxSkelOut Source #

    Set the datum in a payment to the given hashed (not resolved in the transaction) datum (whose type may not fit the typed validator in case of a - script).

    withReferenceScript :: (Show script, ToScript script, Typeable script, ToScriptHash script) => TxSkelOut -> script -> TxSkelOut Source #

    Add a reference script to a transaction output (or replace it if there is already one)

    withStakingCredential :: TxSkelOut -> StakingCredential -> TxSkelOut Source #

    Add a staking credential to a transaction output (or replace it if there is already one)

    data TxSkelRedeemer where Source #

    Constructors

    TxSkelNoRedeemerForPK :: TxSkelRedeemer 
    TxSkelRedeemerForScript :: SpendsScriptConstrs redeemer => redeemer -> TxSkelRedeemer 
    TxSkelRedeemerForReferencedScript :: SpendsScriptConstrs redeemer => TxOutRef -> redeemer -> TxSkelRedeemer

    The first argument is a reference to the output where the referenced - script is stored.

    txSkelTypedRedeemer :: FromData (RedeemerType a) => TxSkelRedeemer -> Maybe (RedeemerType a) Source #

    data TxSkel where Source #

    Constructors

    TxSkel 

    Fields

    • :: { txSkelLabel :: Set TxLabel

      Labels do not influence the transaction generation at all; they are + script).

    withReferenceScript :: (Show script, ToScript script, Typeable script, ToScriptHash script) => TxSkelOut -> script -> TxSkelOut Source #

    Add a reference script to a transaction output (or replace it if there is already one)

    withStakingCredential :: TxSkelOut -> StakingCredential -> TxSkelOut Source #

    Add a staking credential to a transaction output (or replace it if there is already one)

    data TxSkelRedeemer where Source #

    Constructors

    TxSkelNoRedeemerForPK :: TxSkelRedeemer 
    TxSkelRedeemerForScript :: SpendsScriptConstrs redeemer => redeemer -> TxSkelRedeemer 
    TxSkelRedeemerForReferencedScript :: SpendsScriptConstrs redeemer => TxOutRef -> redeemer -> TxSkelRedeemer

    The first argument is a reference to the output where the referenced + script is stored.

    data TxSkel where Source #

    Constructors

    TxSkel 

    Fields

    • :: { txSkelLabel :: Set TxLabel

      Labels do not influence the transaction generation at all; they are pretty-printed whenever cooked-validators prints a transaction, and can therefore make the output more informative (and greppable).

    •    , txSkelOpts :: TxOpts

      Some options that control transaction generation.

    •    , txSkelMints :: TxSkelMints

      Any value minted or burned by the transaction. You'll probably want to use txSkelMintsFromList to construct this.

    •    , txSkelSigners :: [Wallet]

      The wallets signing the transaction. This list must contain at least one element. By default, the first signer will pay for fees and - balancing. You can change that with txOptBalanceWallet.

    •    , txSkelValidityRange :: SlotRange
       
    •    , txSkelIns :: Map TxOutRef TxSkelRedeemer

      To each TxOutRef the transaction should consume, add a redeemer + balancing. You can change that with txOptBalanceWallet.

    •    , txSkelValidityRange :: SlotRange
       
    •    , txSkelIns :: Map TxOutRef TxSkelRedeemer

      To each TxOutRef the transaction should consume, add a redeemer specifying how to spend it. You must make sure that

      • On TxOutRefs referencing UTxOs belonging to public keys, you use the TxSkelNoRedeemerForPK constructor.
      • On TxOutRefs referencing UTxOs belonging to scripts, you must make - sure that the type of the redeemer is appropriate for the script.
    •    , txSkelInsReference :: Set TxOutRef

      All outputs referenced by the transaction.

    •    , txSkelOuts :: [TxSkelOut]

      The outputs of the transaction. These will occur in exactly this - order on the transaction.

    •    } -> TxSkel
       

    Instances

    Instances details
    Eq TxSkel Source # 
    Instance details

    Defined in Cooked.Skeleton

    Methods

    (==) :: TxSkel -> TxSkel -> Bool #

    (/=) :: TxSkel -> TxSkel -> Bool #

    Show TxSkel Source # 
    Instance details

    Defined in Cooked.Skeleton

    MonadBlockChainWithoutValidation m => MonadTweak (Tweak m) Source # 
    Instance details

    Defined in Cooked.Tweak.Common

    txSkelValidityRangeL :: Lens' TxSkel SlotRange Source #

    txSkelInsReferenceL :: Lens' TxSkel (Set TxOutRef) Source #

    txSkelTemplate :: TxSkel Source #

    A convenience template of an empty transaction skeleton.

    txSkelOutputData :: TxSkel -> Map DatumHash TxSkelOutDatum Source #

    Return all data on transaction outputs.

    newtype Fee Source #

    Constructors

    Fee 

    Fields

    Instances

    Instances details
    Eq Fee Source # 
    Instance details

    Defined in Cooked.Skeleton

    Methods

    (==) :: Fee -> Fee -> Bool #

    (/=) :: Fee -> Fee -> Bool #

    Num Fee Source # 
    Instance details

    Defined in Cooked.Skeleton

    Methods

    (+) :: Fee -> Fee -> Fee #

    (-) :: Fee -> Fee -> Fee #

    (*) :: Fee -> Fee -> Fee #

    negate :: Fee -> Fee #

    abs :: Fee -> Fee #

    signum :: Fee -> Fee #

    fromInteger :: Integer -> Fee #

    Ord Fee Source # 
    Instance details

    Defined in Cooked.Skeleton

    Methods

    compare :: Fee -> Fee -> Ordering #

    (<) :: Fee -> Fee -> Bool #

    (<=) :: Fee -> Fee -> Bool #

    (>) :: Fee -> Fee -> Bool #

    (>=) :: Fee -> Fee -> Bool #

    max :: Fee -> Fee -> Fee #

    min :: Fee -> Fee -> Fee #

    Show Fee Source # 
    Instance details

    Defined in Cooked.Skeleton

    Methods

    showsPrec :: Int -> Fee -> ShowS #

    show :: Fee -> String #

    showList :: [Fee] -> ShowS #

    txSkelOutputValue :: TxSkel -> Fee -> Value Source #

    The value in all transaction inputs, plus the negative parts of the minted - value. This is the right hand side of the "balancing equation":

    mints + inputs = fees + burns + outputs

    txSkelOutValidators :: TxSkel -> Map ValidatorHash (Versioned Validator) Source #

    All validators which will receive transaction outputs

    txSkelOutOwnerTypeP :: forall ownerType. (ToCredential ownerType, Show ownerType, IsTxSkelOutAllowedOwner ownerType, Typeable ownerType) => Prism' TxSkelOut (ConcreteOutput ownerType TxSkelOutDatum Value (Versioned Script)) Source #

    Decide if a transaction output has a certain owner and datum type.

    txSkelOutputDatumTypeAT :: (FromData a, Typeable a) => AffineTraversal' TxSkelOut a Source #

    data SkelContext Source #

    The missing information on a TxSkel that can only be resolved by querying - the state of the blockchain.

    Constructors

    SkelContext 

    Fields

    txSkelOutReferenceScripts :: TxSkel -> Map ValidatorHash (Versioned Validator) Source #

    All validators in the reference script field of transaction outputs

    \ No newline at end of file + sure that the type of the redeemer is appropriate for the script.
  •    , txSkelInsReference :: Set TxOutRef

    All outputs referenced by the transaction.

  •    , txSkelOuts :: [TxSkelOut]

    The outputs of the transaction. These will occur in exactly this + order on the transaction.

  •    } -> TxSkel
     
  • Instances

    Instances details
    Eq TxSkel Source # 
    Instance details

    Defined in Cooked.Skeleton

    Show TxSkel Source # 
    Instance details

    Defined in Cooked.Skeleton

    MonadBlockChainWithoutValidation m => MonadTweak (Tweak m) Source # 
    Instance details

    Defined in Cooked.Tweak.Common

    txSkelTemplate :: TxSkel Source #

    A convenience template of an empty transaction skeleton.

    txSkelOutputData :: TxSkel -> Map DatumHash TxSkelOutDatum Source #

    Return all data on transaction outputs.

    newtype Fee Source #

    Constructors

    Fee 

    Fields

    Instances

    Instances details
    Eq Fee Source # 
    Instance details

    Defined in Cooked.Skeleton

    Methods

    (==) :: Fee -> Fee -> Bool Source #

    (/=) :: Fee -> Fee -> Bool Source #

    Num Fee Source # 
    Instance details

    Defined in Cooked.Skeleton

    Ord Fee Source # 
    Instance details

    Defined in Cooked.Skeleton

    Methods

    compare :: Fee -> Fee -> Ordering Source #

    (<) :: Fee -> Fee -> Bool Source #

    (<=) :: Fee -> Fee -> Bool Source #

    (>) :: Fee -> Fee -> Bool Source #

    (>=) :: Fee -> Fee -> Bool Source #

    max :: Fee -> Fee -> Fee Source #

    min :: Fee -> Fee -> Fee Source #

    Show Fee Source # 
    Instance details

    Defined in Cooked.Skeleton

    txSkelOutputValue :: TxSkel -> Fee -> Value Source #

    The value in all transaction inputs, plus the negative parts of the minted + value. This is the right hand side of the "balancing equation":

    mints + inputs = fees + burns + outputs

    txSkelOutValidators :: TxSkel -> Map ValidatorHash (Versioned Validator) Source #

    All validators which will receive transaction outputs

    txSkelOutOwnerTypeP :: forall ownerType. (ToCredential ownerType, Show ownerType, IsTxSkelOutAllowedOwner ownerType, Typeable ownerType) => Prism' TxSkelOut (ConcreteOutput ownerType TxSkelOutDatum Value (Versioned Script)) Source #

    Decide if a transaction output has a certain owner and datum type.

    data SkelContext Source #

    The missing information on a TxSkel that can only be resolved by querying + the state of the blockchain.

    txSkelOutReferenceScripts :: TxSkel -> Map ValidatorHash (Versioned Validator) Source #

    All validators in the reference script field of transaction outputs

    \ No newline at end of file diff --git a/Cooked-Tweak-AddInputsAndOutputs.html b/Cooked-Tweak-AddInputsAndOutputs.html index c9b967d5d..4058609cb 100644 --- a/Cooked-Tweak-AddInputsAndOutputs.html +++ b/Cooked-Tweak-AddInputsAndOutputs.html @@ -1,11 +1,11 @@ -Cooked.Tweak.AddInputsAndOutputs
    cooked-validators-2.0.0
    Safe HaskellNone
    LanguageHaskell2010

    Cooked.Tweak.AddInputsAndOutputs

    Description

    Some Tweaks that add or remove inputs and outputs from transactions.

    Synopsis

    Documentation

    ensureInputTweak :: MonadTweak m => TxOutRef -> TxSkelRedeemer -> m (Maybe (TxOutRef, TxSkelRedeemer)) Source #

    Ensure that a given TxOutRef is being spent with a given +Cooked.Tweak.AddInputsAndOutputs

    cooked-validators-2.0.0
    Safe HaskellNone
    LanguageHaskell2010

    Cooked.Tweak.AddInputsAndOutputs

    Description

    Some Tweaks that add or remove inputs and outputs from transactions.

    Documentation

    ensureInputTweak :: MonadTweak m => TxOutRef -> TxSkelRedeemer -> m (Maybe (TxOutRef, TxSkelRedeemer)) Source #

    Ensure that a given TxOutRef is being spent with a given TxSkelRedeemer. The return value will be Just the added data, if anything - changed.

    addInputTweak :: MonadTweak m => TxOutRef -> TxSkelRedeemer -> m () Source #

    Add an input to a transaction. If the given TxOutRef is already being - consumed by the transaction, fail.

    removeInputTweak :: MonadTweak m => (TxOutRef -> TxSkelRedeemer -> Bool) -> m [(TxOutRef, TxSkelRedeemer)] Source #

    Remove transaction inputs according to a given predicate. The returned list + changed.

    addInputTweak :: MonadTweak m => TxOutRef -> TxSkelRedeemer -> m () Source #

    Add an input to a transaction. If the given TxOutRef is already being + consumed by the transaction, fail.

    removeInputTweak :: MonadTweak m => (TxOutRef -> TxSkelRedeemer -> Bool) -> m [(TxOutRef, TxSkelRedeemer)] Source #

    Remove transaction inputs according to a given predicate. The returned list contains all removed inputs.

    ensureOutputTweak :: MonadTweak m => TxSkelOut -> m (Maybe TxSkelOut) Source #

    Ensure that a certain output is produced by a transaction. The return value will be Just the added output, if there was any change.

    addOutputTweak :: MonadTweak m => TxSkelOut -> m () Source #

    Add a transaction output, at the end of the current list of outputs, thus retaining the order in which they have been specified.

    removeOutputTweak :: MonadTweak m => (TxSkelOut -> Bool) -> m [TxSkelOut] Source #

    Remove transaction outputs according to some predicate. The returned list - contains all the removed outputs.

    addMintTweak :: MonadTweak m => (Versioned MintingPolicy, MintsRedeemer, TokenName, Integer) -> m () Source #

    Add a new entry to the TxSkelMints of the transaction skeleton under + contains all the removed outputs.

    addMintTweak :: MonadTweak m => (Versioned MintingPolicy, MintsRedeemer, TokenName, Integer) -> m () Source #

    Add a new entry to the TxSkelMints of the transaction skeleton under modification. As this is implemented in terms of addToTxSkelMints, the same - caveats apply as do to that function!

    removeMintTweak :: MonadTweak m => ((Versioned MintingPolicy, MintsRedeemer, TokenName, Integer) -> Bool) -> m [(Versioned MintingPolicy, MintsRedeemer, TokenName, Integer)] Source #

    Remove some entries from the TxSkelMints of a transaction, according to + caveats apply as do to that function!

    removeMintTweak :: MonadTweak m => ((Versioned MintingPolicy, MintsRedeemer, TokenName, Integer) -> Bool) -> m [(Versioned MintingPolicy, MintsRedeemer, TokenName, Integer)] Source #

    Remove some entries from the TxSkelMints of a transaction, according to some predicate. The returned list holds the removed entries.

    \ No newline at end of file diff --git a/Cooked-Tweak-Common.html b/Cooked-Tweak-Common.html index 3327f56c5..d1527930f 100644 --- a/Cooked-Tweak-Common.html +++ b/Cooked-Tweak-Common.html @@ -1,5 +1,5 @@ Cooked.Tweak.Common
    cooked-validators-2.0.0
    Safe HaskellNone
    LanguageHaskell2010

    Cooked.Tweak.Common

    Contents

    Description

    This module defines Tweaks which are the fundamental building blocks of - our "domain specific language" for attacks.

    Synopsis

    Documentation

    runTweakInChain :: (MonadBlockChainWithoutValidation m, MonadPlus m) => Tweak m a -> TxSkel -> m (a, TxSkel) Source #

    This is the function that gives a meaning to Tweaks: A Tweak is a + our "domain specific language" for attacks.

    Synopsis

    Documentation

    runTweakInChain :: (MonadBlockChainWithoutValidation m, MonadPlus m) => Tweak m a -> TxSkel -> m (a, TxSkel) Source #

    This is the function that gives a meaning to Tweaks: A Tweak is a computation that, depending on the state of the chain, looks at a transaction and returns zero or more modified transactions, together with some additional values.

    Our intuition (and also the language of the comments pertaining to Tweaks) @@ -12,22 +12,22 @@ to use this function.

    runTweakInChain' :: MonadBlockChainWithoutValidation m => Tweak m a -> TxSkel -> m [(a, TxSkel)] Source #

    Like runTweakInChain, but for when you want to explicitly apply a tweak to a transaction skeleton and get all results as a list.

    If you're trying to apply a tweak to a transaction directly before it's modified, consider using MonadModalBlockChain and idioms like withTweak, - somewhere, or everywhere.

    type Tweak m = StateT TxSkel (ListT m) Source #

    data UntypedTweak m where Source #

    This is a wrapper type used in the implementation of the Staged monad. You - will probably never use it while you're building Tweaks.

    Constructors

    UntypedTweak :: Tweak m a -> UntypedTweak m 

    Instances

    Instances details
    MonadFail StagedMockChain Source # 
    Instance details

    Defined in Cooked.MockChain.Staged

    Methods

    fail :: String -> StagedMockChain a #

    Alternative StagedMockChain Source # 
    Instance details

    Defined in Cooked.MockChain.Staged

    MonadBlockChain StagedMockChain Source # 
    Instance details

    Defined in Cooked.MockChain.Staged

    MonadBlockChainWithoutValidation StagedMockChain Source # 
    Instance details

    Defined in Cooked.MockChain.Staged

    MonadBlockChainBalancing StagedMockChain Source # 
    Instance details

    Defined in Cooked.MockChain.Staged

    Methods

    getParams :: StagedMockChain Params Source #

    utxosAtLedger :: Address -> StagedMockChain [(TxOutRef, TxOut)] Source #

    datumFromHash :: DatumHash -> StagedMockChain (Maybe Datum) Source #

    validatorFromHash :: ValidatorHash -> StagedMockChain (Maybe (Versioned Validator)) Source #

    txOutByRefLedger :: TxOutRef -> StagedMockChain (Maybe TxOut) Source #

    MonadError MockChainError StagedMockChain Source # 
    Instance details

    Defined in Cooked.MockChain.Staged

    Monad m => Semigroup (UntypedTweak m) Source # 
    Instance details

    Defined in Cooked.Tweak.Common

    Monad m => Monoid (UntypedTweak m) Source # 
    Instance details

    Defined in Cooked.Tweak.Common

    User API

    class (MonadPlus m, MonadBlockChainWithoutValidation m) => MonadTweak m where Source #

    Instances

    Instances details
    MonadBlockChainWithoutValidation m => MonadTweak (Tweak m) Source # 
    Instance details

    Defined in Cooked.Tweak.Common

    failingTweak :: MonadTweak m => m a Source #

    The never-applicable tweak.

    doNothingTweak :: MonadTweak m => m () Source #

    The tweak that always applies and leaves the transaction unchanged.

    viewTweak :: (MonadTweak m, Is k A_Getter) => Optic' k is TxSkel a -> m a Source #

    The "tweak" that obtains some value from the TxSkel. This does *not* - modify the transaction.

    viewAllTweak :: (MonadTweak m, Is k A_Fold) => Optic' k is TxSkel a -> m [a] Source #

    Like the viewTweak, but returns a list of all foci

    setTweak :: (MonadTweak m, Is k A_Setter) => Optic' k is TxSkel a -> a -> m () Source #

    The tweak that sets a certain value in the TxSkel.

    overTweak :: (MonadTweak m, Is k A_Setter) => Optic' k is TxSkel a -> (a -> a) -> m () Source #

    The tweak that modifies a certain value in the TxSkel.

    overMaybeTweak :: (MonadTweak m, Is k A_Traversal) => Optic' k is TxSkel a -> (a -> Maybe a) -> m [a] Source #

    Like overTweak, but only modifies foci on which the argument function + somewhere, or everywhere.

    data UntypedTweak m where Source #

    This is a wrapper type used in the implementation of the Staged monad. You + will probably never use it while you're building Tweaks.

    Constructors

    UntypedTweak :: Tweak m a -> UntypedTweak m 

    Instances

    Instances details
    MonadFail StagedMockChain Source # 
    Instance details

    Defined in Cooked.MockChain.Staged

    Alternative StagedMockChain Source # 
    Instance details

    Defined in Cooked.MockChain.Staged

    MonadBlockChain StagedMockChain Source # 
    Instance details

    Defined in Cooked.MockChain.Staged

    MonadBlockChainWithoutValidation StagedMockChain Source # 
    Instance details

    Defined in Cooked.MockChain.Staged

    MonadBlockChainBalancing StagedMockChain Source # 
    Instance details

    Defined in Cooked.MockChain.Staged

    MonadError MockChainError StagedMockChain Source # 
    Instance details

    Defined in Cooked.MockChain.Staged

    Monad m => Semigroup (UntypedTweak m) Source # 
    Instance details

    Defined in Cooked.Tweak.Common

    Monad m => Monoid (UntypedTweak m) Source # 
    Instance details

    Defined in Cooked.Tweak.Common

    User API

    class (MonadPlus m, MonadBlockChainWithoutValidation m) => MonadTweak m where Source #

    Instances

    Instances details
    MonadBlockChainWithoutValidation m => MonadTweak (Tweak m) Source # 
    Instance details

    Defined in Cooked.Tweak.Common

    failingTweak :: MonadTweak m => m a Source #

    The never-applicable tweak.

    doNothingTweak :: MonadTweak m => m () Source #

    The tweak that always applies and leaves the transaction unchanged.

    viewTweak :: (MonadTweak m, Is k A_Getter) => Optic' k is TxSkel a -> m a Source #

    The "tweak" that obtains some value from the TxSkel. This does *not* + modify the transaction.

    viewAllTweak :: (MonadTweak m, Is k A_Fold) => Optic' k is TxSkel a -> m [a] Source #

    Like the viewTweak, but returns a list of all foci

    setTweak :: (MonadTweak m, Is k A_Setter) => Optic' k is TxSkel a -> a -> m () Source #

    The tweak that sets a certain value in the TxSkel.

    overTweak :: (MonadTweak m, Is k A_Setter) => Optic' k is TxSkel a -> (a -> a) -> m () Source #

    The tweak that modifies a certain value in the TxSkel.

    overMaybeTweak :: (MonadTweak m, Is k A_Traversal) => Optic' k is TxSkel a -> (a -> Maybe a) -> m [a] Source #

    Like overTweak, but only modifies foci on which the argument function returns Just the new focus. Returns a list of the foci that were modified, as they were before the tweak, and in the order in which they occurred on - the original transaction.

    overMaybeSelectingTweak :: forall a m k is. (MonadTweak m, Is k A_Traversal) => Optic' k is TxSkel a -> (a -> Maybe a) -> (Integer -> Bool) -> m [a] Source #

    Sometimes overMaybeTweak modifies too many foci. This might be the case + the original transaction.

    overMaybeSelectingTweak :: forall a m k is. (MonadTweak m, Is k A_Traversal) => Optic' k is TxSkel a -> (a -> Maybe a) -> (Integer -> Bool) -> m [a] Source #

    Sometimes overMaybeTweak modifies too many foci. This might be the case if there are several identical foci, but you only want to modify some of them. This is where this Tweak becomes useful: The (Integer -> Bool) argument can be used to select which of the modifiable foci should be - actually modified.

    selectP :: (a -> Bool) -> Prism' a a Source #

    overMaybeTweak requires a modification that can fail (targeting Maybe). + actually modified.

    selectP :: (a -> Bool) -> Prism' a a Source #

    overMaybeTweak requires a modification that can fail (targeting Maybe). Sometimes, it can prove more convenient to explicitly state which property the foci shoud satisfy to be eligible for a modification that cannot fail instead. selectP provides a prism to make such a selection. The intended use case is 'overTweak (optic % selectP prop) mod' where optic gives the candidate foci, prop is the predicate to be satisfied - by the foci, and mod is the modification to be applied to the selected foci.

    combineModsTweak :: (Eq is, Is k A_Traversal, MonadTweak m) => ([is] -> [[is]]) -> Optic' k (WithIx is) TxSkel x -> (is -> x -> m [(x, l)]) -> m [l] Source #

    When constructing a tweak from an optic and a modification of foci, there + by the foci, and mod is the modification to be applied to the selected foci.

    combineModsTweak :: (Eq is, Is k A_Traversal, MonadTweak m) => ([is] -> [[is]]) -> Optic' k (WithIx is) TxSkel x -> (is -> x -> m [(x, l)]) -> m [l] Source #

    When constructing a tweak from an optic and a modification of foci, there are in principle two options for optics with many foci: (a) apply the modification to all foci and return one modified transaction (b) generate a number of transactions that contain different combinations of modified and @@ -78,4 +78,4 @@ [a1, b3, c4], [a1, b3, c5] ]

    So you see that tweaks constructed like this can branch quite wildly. Use - with caution!

    iviewTweak :: (MonadTweak m, Is k A_Getter) => Optic' k (WithIx is) TxSkel a -> m (is, a) Source #

    Like viewTweak, only for indexed optics.

    \ No newline at end of file + with caution!

    iviewTweak :: (MonadTweak m, Is k A_Getter) => Optic' k (WithIx is) TxSkel a -> m (is, a) Source #

    Like viewTweak, only for indexed optics.

    \ No newline at end of file diff --git a/Cooked-Tweak-TamperDatum.html b/Cooked-Tweak-TamperDatum.html index 812b81c64..1e6dbc643 100644 --- a/Cooked-Tweak-TamperDatum.html +++ b/Cooked-Tweak-TamperDatum.html @@ -1,8 +1,8 @@ -Cooked.Tweak.TamperDatum
    cooked-validators-2.0.0
    Safe HaskellNone
    LanguageHaskell2010

    Cooked.Tweak.TamperDatum

    Synopsis

    Documentation

    tamperDatumTweak Source #

    Arguments

    :: forall a m. (MonadTweak m, Show a, PrettyCooked a, ToData a, FromData a, Typeable a) 
    => (a -> Maybe a)

    Use this function to return Just the changed datum, if you want to +Cooked.Tweak.TamperDatum

    cooked-validators-2.0.0
    Safe HaskellNone
    LanguageHaskell2010

    Cooked.Tweak.TamperDatum

    Synopsis

    Documentation

    tamperDatumTweak Source #

    Arguments

    :: forall a m. (MonadTweak m, Show a, PrettyCooked a, ToData a, FromData a, Typeable a) 
    => (a -> Maybe a)

    Use this function to return Just the changed datum, if you want to perform a change, and Nothing, if you want to leave it as-is. All datums on outputs not paying to a validator of type a are never touched.

    -> m [a] 

    A tweak that tries to change the datum on outputs carrying datums of a certain type with a prescribed tampering function.

    The tweak returns a list of the modified datums, as they were *before* the - modification was applied to them.

    malformDatumTweak :: forall a m. (MonadTweak m, ToData a, FromData a, Typeable a) => (a -> [BuiltinData]) -> m () Source #

    A tweak that tries to change the datum on outputs carrying datums of a + modification was applied to them.

    malformDatumTweak :: forall a m. (MonadTweak m, ToData a, FromData a, Typeable a) => (a -> [BuiltinData]) -> m () Source #

    A tweak that tries to change the datum on outputs carrying datums of a certain type with a prescribed tampering function. There are two main differences with tamperDatumTweak. First, the tampering function returns BuiltinData, allowing it to do pretty much anything with the datums. Second, for every output datum there are zero or more options @@ -12,4 +12,4 @@ + k_1 * k_2 * k_3 + ... + k_{n-2} * k_{n-1} * k_n + ... + k_1 * k_2 * ... * k_{n-1} * k_n -== (k_1 + 1) * ... * (k_n + 1) - 1

    modified transactions.

    \ No newline at end of file +== (k_1 + 1) * ... * (k_n + 1) - 1

    modified transactions.

    \ No newline at end of file diff --git a/Cooked-Tweak-ValidityRange.html b/Cooked-Tweak-ValidityRange.html index 5b3949832..df6ec9405 100644 --- a/Cooked-Tweak-ValidityRange.html +++ b/Cooked-Tweak-ValidityRange.html @@ -1,4 +1,4 @@ -Cooked.Tweak.ValidityRange
    cooked-validators-2.0.0
    Safe HaskellNone
    LanguageHaskell2010

    Cooked.Tweak.ValidityRange

    Description

    This module defines Tweaks revolving around the validity range of a transaction

    Synopsis

    Documentation

    setValidityRangeTweak :: MonadTweak m => SlotRange -> m SlotRange Source #

    Changes the current validity range, returning the old one

    setAlwaysValidRangeTweak :: MonadTweak m => m SlotRange Source #

    Ensures the skeleton makes for an unconstrained validity range

    setValidityStartTweak :: MonadTweak m => Slot -> m SlotRange Source #

    Sets the left bound of the validity range. Leaves the right bound unchanged

    setValidityEndTweak :: MonadTweak m => Slot -> m SlotRange Source #

    Sets the right bound of the validity range. Leaves the left bound unchanged

    validityRangeSatisfiesTweak :: MonadTweak m => (SlotRange -> Bool) -> m Bool Source #

    Checks if the validity range satisfies a certain predicate

    isValidAtTweak :: MonadTweak m => Slot -> m Bool Source #

    Checks if a given time belongs to the validity range of a transaction

    isValidNowTweak :: MonadTweak m => m Bool Source #

    Checks if the current validity range includes the current time

    isValidDuringTweak :: MonadTweak m => SlotRange -> m Bool Source #

    Checks if a given range is included in the validity range of a transaction

    hasEmptyTimeRangeTweak :: MonadTweak m => m Bool Source #

    Checks if the validity range is empty

    hasFullTimeRangeTweak :: MonadTweak m => m Bool Source #

    Checks if the validity range is unconstrained

    intersectValidityRangeTweak :: MonadTweak m => SlotRange -> m SlotRange Source #

    Adds a constraint to the current validity range - Returns the old range, and fails is the resulting interval is empty

    centerAroundValidityRangeTweak :: MonadTweak m => Slot -> Integer -> m SlotRange Source #

    Centers the validity range around a value with a certain radius

    makeValidityRangeSingletonTweak :: MonadTweak m => Slot -> m SlotRange Source #

    Makes a transaction range equal to a singleton

    makeValidityRangeNowTweak :: MonadTweak m => m SlotRange Source #

    Makes the transaction validity range comply with the current time

    waitUntilValidTweak :: MonadTweak m => m Slot Source #

    Makes current time comply with the validity range of the transaction under +Cooked.Tweak.ValidityRange

    cooked-validators-2.0.0
    Safe HaskellNone
    LanguageHaskell2010

    Cooked.Tweak.ValidityRange

    Description

    This module defines Tweaks revolving around the validity range of a transaction

    Documentation

    setValidityRangeTweak :: MonadTweak m => SlotRange -> m SlotRange Source #

    Changes the current validity range, returning the old one

    setAlwaysValidRangeTweak :: MonadTweak m => m SlotRange Source #

    Ensures the skeleton makes for an unconstrained validity range

    setValidityStartTweak :: MonadTweak m => Slot -> m SlotRange Source #

    Sets the left bound of the validity range. Leaves the right bound unchanged

    setValidityEndTweak :: MonadTweak m => Slot -> m SlotRange Source #

    Sets the right bound of the validity range. Leaves the left bound unchanged

    validityRangeSatisfiesTweak :: MonadTweak m => (SlotRange -> Bool) -> m Bool Source #

    Checks if the validity range satisfies a certain predicate

    isValidAtTweak :: MonadTweak m => Slot -> m Bool Source #

    Checks if a given time belongs to the validity range of a transaction

    isValidNowTweak :: MonadTweak m => m Bool Source #

    Checks if the current validity range includes the current time

    isValidDuringTweak :: MonadTweak m => SlotRange -> m Bool Source #

    Checks if a given range is included in the validity range of a transaction

    hasEmptyTimeRangeTweak :: MonadTweak m => m Bool Source #

    Checks if the validity range is empty

    hasFullTimeRangeTweak :: MonadTweak m => m Bool Source #

    Checks if the validity range is unconstrained

    intersectValidityRangeTweak :: MonadTweak m => SlotRange -> m SlotRange Source #

    Adds a constraint to the current validity range + Returns the old range, and fails is the resulting interval is empty

    centerAroundValidityRangeTweak :: MonadTweak m => Slot -> Integer -> m SlotRange Source #

    Centers the validity range around a value with a certain radius

    makeValidityRangeSingletonTweak :: MonadTweak m => Slot -> m SlotRange Source #

    Makes a transaction range equal to a singleton

    makeValidityRangeNowTweak :: MonadTweak m => m SlotRange Source #

    Makes the transaction validity range comply with the current time

    waitUntilValidTweak :: MonadTweak m => m Slot Source #

    Makes current time comply with the validity range of the transaction under modification. Returns the new current time after the modification; fails if current time is already after the validity range.

    \ No newline at end of file diff --git a/Cooked-Tweak.html b/Cooked-Tweak.html index dbf506045..779e8b2af 100644 --- a/Cooked-Tweak.html +++ b/Cooked-Tweak.html @@ -1,12 +1,12 @@ -Cooked.Tweak
    cooked-validators-2.0.0
    Safe HaskellNone
    LanguageHaskell2010

    Cooked.Tweak

    Synopsis

    Documentation

    class (MonadPlus m, MonadBlockChainWithoutValidation m) => MonadTweak m where Source #

    Instances

    Instances details
    MonadBlockChainWithoutValidation m => MonadTweak (Tweak m) Source # 
    Instance details

    Defined in Cooked.Tweak.Common

    failingTweak :: MonadTweak m => m a Source #

    The never-applicable tweak.

    doNothingTweak :: MonadTweak m => m () Source #

    The tweak that always applies and leaves the transaction unchanged.

    viewTweak :: (MonadTweak m, Is k A_Getter) => Optic' k is TxSkel a -> m a Source #

    The "tweak" that obtains some value from the TxSkel. This does *not* - modify the transaction.

    iviewTweak :: (MonadTweak m, Is k A_Getter) => Optic' k (WithIx is) TxSkel a -> m (is, a) Source #

    Like viewTweak, only for indexed optics.

    viewAllTweak :: (MonadTweak m, Is k A_Fold) => Optic' k is TxSkel a -> m [a] Source #

    Like the viewTweak, but returns a list of all foci

    setTweak :: (MonadTweak m, Is k A_Setter) => Optic' k is TxSkel a -> a -> m () Source #

    The tweak that sets a certain value in the TxSkel.

    overTweak :: (MonadTweak m, Is k A_Setter) => Optic' k is TxSkel a -> (a -> a) -> m () Source #

    The tweak that modifies a certain value in the TxSkel.

    overMaybeTweak :: (MonadTweak m, Is k A_Traversal) => Optic' k is TxSkel a -> (a -> Maybe a) -> m [a] Source #

    Like overTweak, but only modifies foci on which the argument function +Cooked.Tweak

    cooked-validators-2.0.0
    Safe HaskellNone
    LanguageHaskell2010

    Cooked.Tweak

    Synopsis

    Documentation

    class (MonadPlus m, MonadBlockChainWithoutValidation m) => MonadTweak m where Source #

    Instances

    Instances details
    MonadBlockChainWithoutValidation m => MonadTweak (Tweak m) Source # 
    Instance details

    Defined in Cooked.Tweak.Common

    failingTweak :: MonadTweak m => m a Source #

    The never-applicable tweak.

    doNothingTweak :: MonadTweak m => m () Source #

    The tweak that always applies and leaves the transaction unchanged.

    viewTweak :: (MonadTweak m, Is k A_Getter) => Optic' k is TxSkel a -> m a Source #

    The "tweak" that obtains some value from the TxSkel. This does *not* + modify the transaction.

    iviewTweak :: (MonadTweak m, Is k A_Getter) => Optic' k (WithIx is) TxSkel a -> m (is, a) Source #

    Like viewTweak, only for indexed optics.

    viewAllTweak :: (MonadTweak m, Is k A_Fold) => Optic' k is TxSkel a -> m [a] Source #

    Like the viewTweak, but returns a list of all foci

    setTweak :: (MonadTweak m, Is k A_Setter) => Optic' k is TxSkel a -> a -> m () Source #

    The tweak that sets a certain value in the TxSkel.

    overTweak :: (MonadTweak m, Is k A_Setter) => Optic' k is TxSkel a -> (a -> a) -> m () Source #

    The tweak that modifies a certain value in the TxSkel.

    overMaybeTweak :: (MonadTweak m, Is k A_Traversal) => Optic' k is TxSkel a -> (a -> Maybe a) -> m [a] Source #

    Like overTweak, but only modifies foci on which the argument function returns Just the new focus. Returns a list of the foci that were modified, as they were before the tweak, and in the order in which they occurred on - the original transaction.

    overMaybeSelectingTweak :: forall a m k is. (MonadTweak m, Is k A_Traversal) => Optic' k is TxSkel a -> (a -> Maybe a) -> (Integer -> Bool) -> m [a] Source #

    Sometimes overMaybeTweak modifies too many foci. This might be the case + the original transaction.

    overMaybeSelectingTweak :: forall a m k is. (MonadTweak m, Is k A_Traversal) => Optic' k is TxSkel a -> (a -> Maybe a) -> (Integer -> Bool) -> m [a] Source #

    Sometimes overMaybeTweak modifies too many foci. This might be the case if there are several identical foci, but you only want to modify some of them. This is where this Tweak becomes useful: The (Integer -> Bool) argument can be used to select which of the modifiable foci should be - actually modified.

    combineModsTweak :: (Eq is, Is k A_Traversal, MonadTweak m) => ([is] -> [[is]]) -> Optic' k (WithIx is) TxSkel x -> (is -> x -> m [(x, l)]) -> m [l] Source #

    When constructing a tweak from an optic and a modification of foci, there + actually modified.

    combineModsTweak :: (Eq is, Is k A_Traversal, MonadTweak m) => ([is] -> [[is]]) -> Optic' k (WithIx is) TxSkel x -> (is -> x -> m [(x, l)]) -> m [l] Source #

    When constructing a tweak from an optic and a modification of foci, there are in principle two options for optics with many foci: (a) apply the modification to all foci and return one modified transaction (b) generate a number of transactions that contain different combinations of modified and @@ -57,7 +57,7 @@ [a1, b3, c4], [a1, b3, c5] ]

    So you see that tweaks constructed like this can branch quite wildly. Use - with caution!

    selectP :: (a -> Bool) -> Prism' a a Source #

    overMaybeTweak requires a modification that can fail (targeting Maybe). + with caution!

    selectP :: (a -> Bool) -> Prism' a a Source #

    overMaybeTweak requires a modification that can fail (targeting Maybe). Sometimes, it can prove more convenient to explicitly state which property the foci shoud satisfy to be eligible for a modification that cannot fail instead. selectP provides a prism to make such a selection. @@ -76,11 +76,11 @@ outputs are permuted. Use this with care; there might be a lot of permutations!

    (In particular, this is clever enough to generate only the distinct permutations, even if some outputs are identical.)

    singleOutPermutTweak :: MonadTweak m => Int -> m () Source #

    This randomly permutes the outputs of a transaction with a given seed - Can be used to assess if a certain validator is order-dependant

    addLabelTweak :: (MonadTweak m, LabelConstrs x) => x -> m () Source #

    Add a label to a TxSkel.

    removeLabelTweak :: (MonadTweak m, LabelConstrs x) => x -> m () Source #

    Removes a label from a TxSkel

    hasLabelTweak :: (MonadTweak m, LabelConstrs x) => x -> m Bool Source #

    Checks if a given label is present in the TxSkel

    tamperDatumTweak Source #

    Arguments

    :: forall a m. (MonadTweak m, Show a, PrettyCooked a, ToData a, FromData a, Typeable a) 
    => (a -> Maybe a)

    Use this function to return Just the changed datum, if you want to + Can be used to assess if a certain validator is order-dependant

    addLabelTweak :: (MonadTweak m, LabelConstrs x) => x -> m () Source #

    Add a label to a TxSkel.

    removeLabelTweak :: (MonadTweak m, LabelConstrs x) => x -> m () Source #

    Removes a label from a TxSkel

    hasLabelTweak :: (MonadTweak m, LabelConstrs x) => x -> m Bool Source #

    Checks if a given label is present in the TxSkel

    tamperDatumTweak Source #

    Arguments

    :: forall a m. (MonadTweak m, Show a, PrettyCooked a, ToData a, FromData a, Typeable a) 
    => (a -> Maybe a)

    Use this function to return Just the changed datum, if you want to perform a change, and Nothing, if you want to leave it as-is. All datums on outputs not paying to a validator of type a are never touched.

    -> m [a] 

    A tweak that tries to change the datum on outputs carrying datums of a certain type with a prescribed tampering function.

    The tweak returns a list of the modified datums, as they were *before* the - modification was applied to them.

    malformDatumTweak :: forall a m. (MonadTweak m, ToData a, FromData a, Typeable a) => (a -> [BuiltinData]) -> m () Source #

    A tweak that tries to change the datum on outputs carrying datums of a + modification was applied to them.

    malformDatumTweak :: forall a m. (MonadTweak m, ToData a, FromData a, Typeable a) => (a -> [BuiltinData]) -> m () Source #

    A tweak that tries to change the datum on outputs carrying datums of a certain type with a prescribed tampering function. There are two main differences with tamperDatumTweak. First, the tampering function returns BuiltinData, allowing it to do pretty much anything with the datums. Second, for every output datum there are zero or more options @@ -90,17 +90,17 @@ + k_1 * k_2 * k_3 + ... + k_{n-2} * k_{n-1} * k_n + ... + k_1 * k_2 * ... * k_{n-1} * k_n -== (k_1 + 1) * ... * (k_n + 1) - 1

    modified transactions.

    ensureInputTweak :: MonadTweak m => TxOutRef -> TxSkelRedeemer -> m (Maybe (TxOutRef, TxSkelRedeemer)) Source #

    Ensure that a given TxOutRef is being spent with a given +== (k_1 + 1) * ... * (k_n + 1) - 1

    modified transactions.

    ensureInputTweak :: MonadTweak m => TxOutRef -> TxSkelRedeemer -> m (Maybe (TxOutRef, TxSkelRedeemer)) Source #

    Ensure that a given TxOutRef is being spent with a given TxSkelRedeemer. The return value will be Just the added data, if anything - changed.

    addInputTweak :: MonadTweak m => TxOutRef -> TxSkelRedeemer -> m () Source #

    Add an input to a transaction. If the given TxOutRef is already being - consumed by the transaction, fail.

    removeInputTweak :: MonadTweak m => (TxOutRef -> TxSkelRedeemer -> Bool) -> m [(TxOutRef, TxSkelRedeemer)] Source #

    Remove transaction inputs according to a given predicate. The returned list + changed.

    addInputTweak :: MonadTweak m => TxOutRef -> TxSkelRedeemer -> m () Source #

    Add an input to a transaction. If the given TxOutRef is already being + consumed by the transaction, fail.

    removeInputTweak :: MonadTweak m => (TxOutRef -> TxSkelRedeemer -> Bool) -> m [(TxOutRef, TxSkelRedeemer)] Source #

    Remove transaction inputs according to a given predicate. The returned list contains all removed inputs.

    ensureOutputTweak :: MonadTweak m => TxSkelOut -> m (Maybe TxSkelOut) Source #

    Ensure that a certain output is produced by a transaction. The return value will be Just the added output, if there was any change.

    addOutputTweak :: MonadTweak m => TxSkelOut -> m () Source #

    Add a transaction output, at the end of the current list of outputs, thus retaining the order in which they have been specified.

    removeOutputTweak :: MonadTweak m => (TxSkelOut -> Bool) -> m [TxSkelOut] Source #

    Remove transaction outputs according to some predicate. The returned list - contains all the removed outputs.

    addMintTweak :: MonadTweak m => (Versioned MintingPolicy, MintsRedeemer, TokenName, Integer) -> m () Source #

    Add a new entry to the TxSkelMints of the transaction skeleton under + contains all the removed outputs.

    addMintTweak :: MonadTweak m => (Versioned MintingPolicy, MintsRedeemer, TokenName, Integer) -> m () Source #

    Add a new entry to the TxSkelMints of the transaction skeleton under modification. As this is implemented in terms of addToTxSkelMints, the same - caveats apply as do to that function!

    removeMintTweak :: MonadTweak m => ((Versioned MintingPolicy, MintsRedeemer, TokenName, Integer) -> Bool) -> m [(Versioned MintingPolicy, MintsRedeemer, TokenName, Integer)] Source #

    Remove some entries from the TxSkelMints of a transaction, according to - some predicate. The returned list holds the removed entries.

    setValidityRangeTweak :: MonadTweak m => SlotRange -> m SlotRange Source #

    Changes the current validity range, returning the old one

    setAlwaysValidRangeTweak :: MonadTweak m => m SlotRange Source #

    Ensures the skeleton makes for an unconstrained validity range

    setValidityStartTweak :: MonadTweak m => Slot -> m SlotRange Source #

    Sets the left bound of the validity range. Leaves the right bound unchanged

    setValidityEndTweak :: MonadTweak m => Slot -> m SlotRange Source #

    Sets the right bound of the validity range. Leaves the left bound unchanged

    validityRangeSatisfiesTweak :: MonadTweak m => (SlotRange -> Bool) -> m Bool Source #

    Checks if the validity range satisfies a certain predicate

    isValidAtTweak :: MonadTweak m => Slot -> m Bool Source #

    Checks if a given time belongs to the validity range of a transaction

    isValidNowTweak :: MonadTweak m => m Bool Source #

    Checks if the current validity range includes the current time

    isValidDuringTweak :: MonadTweak m => SlotRange -> m Bool Source #

    Checks if a given range is included in the validity range of a transaction

    hasEmptyTimeRangeTweak :: MonadTweak m => m Bool Source #

    Checks if the validity range is empty

    hasFullTimeRangeTweak :: MonadTweak m => m Bool Source #

    Checks if the validity range is unconstrained

    intersectValidityRangeTweak :: MonadTweak m => SlotRange -> m SlotRange Source #

    Adds a constraint to the current validity range - Returns the old range, and fails is the resulting interval is empty

    centerAroundValidityRangeTweak :: MonadTweak m => Slot -> Integer -> m SlotRange Source #

    Centers the validity range around a value with a certain radius

    makeValidityRangeSingletonTweak :: MonadTweak m => Slot -> m SlotRange Source #

    Makes a transaction range equal to a singleton

    makeValidityRangeNowTweak :: MonadTweak m => m SlotRange Source #

    Makes the transaction validity range comply with the current time

    waitUntilValidTweak :: MonadTweak m => m Slot Source #

    Makes current time comply with the validity range of the transaction under + caveats apply as do to that function!

    removeMintTweak :: MonadTweak m => ((Versioned MintingPolicy, MintsRedeemer, TokenName, Integer) -> Bool) -> m [(Versioned MintingPolicy, MintsRedeemer, TokenName, Integer)] Source #

    Remove some entries from the TxSkelMints of a transaction, according to + some predicate. The returned list holds the removed entries.

    setValidityRangeTweak :: MonadTweak m => SlotRange -> m SlotRange Source #

    Changes the current validity range, returning the old one

    setAlwaysValidRangeTweak :: MonadTweak m => m SlotRange Source #

    Ensures the skeleton makes for an unconstrained validity range

    setValidityStartTweak :: MonadTweak m => Slot -> m SlotRange Source #

    Sets the left bound of the validity range. Leaves the right bound unchanged

    setValidityEndTweak :: MonadTweak m => Slot -> m SlotRange Source #

    Sets the right bound of the validity range. Leaves the left bound unchanged

    validityRangeSatisfiesTweak :: MonadTweak m => (SlotRange -> Bool) -> m Bool Source #

    Checks if the validity range satisfies a certain predicate

    isValidAtTweak :: MonadTweak m => Slot -> m Bool Source #

    Checks if a given time belongs to the validity range of a transaction

    isValidNowTweak :: MonadTweak m => m Bool Source #

    Checks if the current validity range includes the current time

    isValidDuringTweak :: MonadTweak m => SlotRange -> m Bool Source #

    Checks if a given range is included in the validity range of a transaction

    hasEmptyTimeRangeTweak :: MonadTweak m => m Bool Source #

    Checks if the validity range is empty

    hasFullTimeRangeTweak :: MonadTweak m => m Bool Source #

    Checks if the validity range is unconstrained

    intersectValidityRangeTweak :: MonadTweak m => SlotRange -> m SlotRange Source #

    Adds a constraint to the current validity range + Returns the old range, and fails is the resulting interval is empty

    centerAroundValidityRangeTweak :: MonadTweak m => Slot -> Integer -> m SlotRange Source #

    Centers the validity range around a value with a certain radius

    makeValidityRangeSingletonTweak :: MonadTweak m => Slot -> m SlotRange Source #

    Makes a transaction range equal to a singleton

    makeValidityRangeNowTweak :: MonadTweak m => m SlotRange Source #

    Makes the transaction validity range comply with the current time

    waitUntilValidTweak :: MonadTweak m => m Slot Source #

    Makes current time comply with the validity range of the transaction under modification. Returns the new current time after the modification; fails if current time is already after the validity range.

    \ No newline at end of file diff --git a/Cooked-ValueUtils.html b/Cooked-ValueUtils.html index 25e700185..8e1717763 100644 --- a/Cooked-ValueUtils.html +++ b/Cooked-ValueUtils.html @@ -1,5 +1,5 @@ -Cooked.ValueUtils
    cooked-validators-2.0.0
    Safe HaskellNone
    LanguageHaskell2010

    Cooked.ValueUtils

    Description

    Utilities to work with Value

    Synopsis

    Documentation

    flattenValueI :: Iso' Value [(AssetClass, Integer)] Source #

    positivePart :: Value -> Value Source #

    The positive part of a value. For every asset class in the given value, +Cooked.ValueUtils

    cooked-validators-2.0.0
    Safe HaskellNone
    LanguageHaskell2010

    Cooked.ValueUtils

    Description

    Utilities to work with Value

    Documentation

    positivePart :: Value -> Value Source #

    The positive part of a value. For every asset class in the given value, this asset class and its amount are included in the output iff the amount is - strictly positive. It holds

    x == positivePart x <> Pl.negate negativePart x

    negativePart :: Value -> Value Source #

    The negative part of a value. For every asset class in the given value, + strictly positive. It holds

    x == positivePart x <> Pl.negate negativePart x

    negativePart :: Value -> Value Source #

    The negative part of a value. For every asset class in the given value, this asset class and its negated amount are included in the output iff the - amount is strictly negative. It holds

    x == positivePart x <> Pl.negate negativePart x

    adaL :: Lens' Value Ada Source #

    Focus the Ada part in a value.

    \ No newline at end of file + amount is strictly negative. It holds

    x == positivePart x <> Pl.negate negativePart x

    adaL :: Lens' Value Ada Source #

    Focus the Ada part in a value.

    \ No newline at end of file diff --git a/Cooked-Wallet.html b/Cooked-Wallet.html index 6eecd3b9d..65c09cb40 100644 --- a/Cooked-Wallet.html +++ b/Cooked-Wallet.html @@ -3,11 +3,11 @@ associating a list of UTxOs with some initial values to each known wallet). It also exposes a convenient API to construct wallets and distributions, manipulate them, and fetch information (such as public/private keys and - staking keys).

    Documentation

    knownWallets :: [Wallet] Source #

    All the wallets corresponding to known Plutus mock wallets. This is a list + staking keys).

    Documentation

    knownWallets :: [Wallet] Source #

    All the wallets corresponding to known Plutus mock wallets. This is a list of 10 wallets which will

    • receive funds in the standard initial distribution of cooked-validators, and
    • be pretty-printed as part the final state after running a few - transactions.

    wallet :: Int -> Wallet Source #

    Wallet corresponding to a given wallet number (or wallet ID)

    walletPKHashToId :: PubKeyHash -> Maybe Int Source #

    Retrieves the id of the known wallet that corresponds to a public key - hash, if any.

    walletPKHashToId (walletPKHash (wallet 3)) == Just 3

    walletPK :: Wallet -> PubKey Source #

    Retrieves a wallet public key (PK)

    walletStakingPK :: Wallet -> Maybe PubKey Source #

    Retrieves a wallet's public staking key (PK), if any

    walletPKHash :: Wallet -> PubKeyHash Source #

    Retrieves a wallet's public key hash

    walletStakingPKHash :: Wallet -> Maybe PubKeyHash Source #

    Retrieves a wallet's public staking key hash, if any

    walletAddress :: Wallet -> Address Source #

    Retrieves a wallet's address

    walletSK :: MockWallet -> PrivateKey Source #

    Retrieves a wallet private key (secret key SK)

    walletStakingSK :: Wallet -> Maybe PrivateKey Source #

    Retrieves a wallet's private staking key (secret key SK), if any

    newtype InitialDistribution Source #

    Describes the initial distribution of UTxOs per wallet. This is important + transactions.

    wallet :: Int -> Wallet Source #

    Wallet corresponding to a given wallet number (or wallet ID)

    walletPKHashToId :: PubKeyHash -> Maybe Int Source #

    Retrieves the id of the known wallet that corresponds to a public key + hash, if any.

    walletPKHashToId (walletPKHash (wallet 3)) == Just 3

    walletPK :: Wallet -> PubKey Source #

    Retrieves a wallet public key (PK)

    walletStakingPK :: Wallet -> Maybe PubKey Source #

    Retrieves a wallet's public staking key (PK), if any

    walletPKHash :: Wallet -> PubKeyHash Source #

    Retrieves a wallet's public key hash

    walletStakingPKHash :: Wallet -> Maybe PubKeyHash Source #

    Retrieves a wallet's public staking key hash, if any

    walletAddress :: Wallet -> Address Source #

    Retrieves a wallet's address

    walletSK :: MockWallet -> PrivateKey Source #

    Retrieves a wallet private key (secret key SK)

    walletStakingSK :: Wallet -> Maybe PrivateKey Source #

    Retrieves a wallet's private staking key (secret key SK), if any

    newtype InitialDistribution Source #

    Describes the initial distribution of UTxOs per wallet. This is important since transaction validation must specify a collateral. Hence, wallets must have more than one UTxO to begin with in order to execute a transaction and have some collateral option. The txCollateral is transferred to the @@ -21,4 +21,4 @@ ] , (wallet 2 , [Pl.lovelaveValueOf 10000000]) , (wallet 3 , [Pl.lovelaceValueOf 10000000 <> permanentValue "XYZ" 10]) - ]

    Constructors

    InitialDistribution 

    Fields

    type Wallet = MockWallet Source #

    type PrivateKey = XPrv Source #

    Orphan instances

    Eq Wallet Source # 
    Instance details

    Methods

    (==) :: Wallet -> Wallet -> Bool #

    (/=) :: Wallet -> Wallet -> Bool #

    Ord Wallet Source # 
    Instance details

    \ No newline at end of file + ]

    Orphan instances

    \ No newline at end of file diff --git a/Cooked.html b/Cooked.html index 4dd2a54bb..544f1d101 100644 --- a/Cooked.html +++ b/Cooked.html @@ -22,4 +22,4 @@ > a LtlRelease b and > b LtlAnd (a LtlOr LtlNext (a LtlRelease b)) - are equivalent.

    Instances

    Instances details
    Show a => Show (Ltl a) Source # 
    Instance details

    Defined in Cooked.Ltl

    Methods

    showsPrec :: Int -> Ltl a -> ShowS #

    show :: Ltl a -> String #

    showList :: [Ltl a] -> ShowS #

    \ No newline at end of file + are equivalent.

    Instances

    Instances details
    Show a => Show (Ltl a) Source # 
    Instance details

    Defined in Cooked.Ltl

    Methods

    showsPrec :: Int -> Ltl a -> ShowS Source #

    show :: Ltl a -> String Source #

    showList :: [Ltl a] -> ShowS Source #

    \ No newline at end of file diff --git a/cooked-validators.haddock b/cooked-validators.haddock index 969962930bd9bb634813601caa2b043662053a7c..d6ae58743ed00810ab7c25b53052a98e6815d89e 100644 GIT binary patch delta 534 zcmYjNF>X{r4Ap0pDg}rGq~QXd8ISGhzC?jI00o2~&5S(~D5pruh-$TbSi&OF(jaXS znv`545*@{AC2qjbMY3h-`T5z;m$yfkw?{wD)(=0rPi}D=_t|}MTX(%WU%xvZ)qQmz z-01Coum8L_{!iKr=-O>phyCBxul>n=YxqCFdobGo9`}xh)<7xYBZY5ZO zD8`CmWEHGXF=r*L+D%$607VS}YT-^2C`Cd@o*|^NynQuo=7^1{$C4YBz_AY|3kB5{ zQ{#}?_i95+dZW}05ym1BWDhNPY0J~oDa{&+uhhq!7xfxAkaQ^0iUDWxxr(;Zdhj_$ zuo$_J9|-0&?#p@kc{=T8L{Z4nm65U_Na0p$422TMfT?01YG^G-MDDR87pqkf0>qx{ z^8NMnZSIy@GadJ822xg&h>3>HEa(u;iaSi delta 534 zcmYk2zlu~*492-$w%S7R0c?DM{ys2e8m}h4Uu|6raK^#cCL@j_U}vHo_EZ zv!$;g*jWq%zJX`EB}K^h{UG^raeZ=eee&acbNAEyabD)_{CWN|U(UPro6YOf(dV!8 zhk1DWKbyZ#Pj8^@kaqLs`gr)a{&je8TiYKG$A@=BuYTW~o=vx%K|i^AcYoSFUTKFU zj#eRM#12uiMZ!Y0W~e~HxSOL;qTn2iTq+r+UIqd=Ew7$W+f`AOWaw%dhexhpEn2n? zo**i9mdq_k3Y;P$kbuNd=AlbV%cHX?u5wb&9@J`4C_tbsVD{W=wv5s#FqhgRDg$_| zA^~E{TnxtQ+?Stc(|(nQWdSP$i6L7Fo)R*-tAOQRwDm>}yJL|=7JTebVs8y8rsT`_ z7t^;DaEa1DOEQVAng(IkUK=q>WkRiH0cxUFb9Ye%t}-}S8{f9h424H1wiLNn>LUOy)641Ye~ty9b^rhX diff --git a/doc-index.json b/doc-index.json index b87cff9f4..8677ad58b 100644 --- a/doc-index.json +++ b/doc-index.json @@ -1 +1 @@ -[{"display_html":"quickTokenName :: String -> TokenName","name":"quickTokenName","module":"Cooked.Currencies","link":"Cooked-Currencies.html#v:quickTokenName"},{"display_html":"quickAssetClass :: String -> AssetClass","name":"quickAssetClass","module":"Cooked.Currencies","link":"Cooked-Currencies.html#v:quickAssetClass"},{"display_html":"quickValue :: String -> Integer -> Value","name":"quickValue","module":"Cooked.Currencies","link":"Cooked-Currencies.html#v:quickValue"},{"display_html":"permanentTokenName :: String -> TokenName","name":"permanentTokenName","module":"Cooked.Currencies","link":"Cooked-Currencies.html#v:permanentTokenName"},{"display_html":"permanentAssetClass :: String -> AssetClass","name":"permanentAssetClass","module":"Cooked.Currencies","link":"Cooked-Currencies.html#v:permanentAssetClass"},{"display_html":"permanentValue :: String -> Integer -> Value","name":"permanentValue","module":"Cooked.Currencies","link":"Cooked-Currencies.html#v:permanentValue"},{"display_html":"quickCurrencyPolicy :: MintingPolicy","name":"quickCurrencyPolicy","module":"Cooked.Currencies","link":"Cooked-Currencies.html#v:quickCurrencyPolicy"},{"display_html":"quickCurrencySymbol :: CurrencySymbol","name":"quickCurrencySymbol","module":"Cooked.Currencies","link":"Cooked-Currencies.html#v:quickCurrencySymbol"},{"display_html":"permanentCurrencyPolicy :: MintingPolicy","name":"permanentCurrencyPolicy","module":"Cooked.Currencies","link":"Cooked-Currencies.html#v:permanentCurrencyPolicy"},{"display_html":"permanentCurrencySymbol :: CurrencySymbol","name":"permanentCurrencySymbol","module":"Cooked.Currencies","link":"Cooked-Currencies.html#v:permanentCurrencySymbol"},{"display_html":"data Ltl a","name":"Ltl LtlTruth LtlFalsity LtlAtom LtlOr LtlAnd LtlNext LtlUntil LtlRelease","module":"Cooked.Ltl","link":"Cooked-Ltl.html#t:Ltl"},{"display_html":"nowLater :: Monoid a => Ltl a -> [(a, Ltl a)]","name":"nowLater","module":"Cooked.Ltl","link":"Cooked-Ltl.html#v:nowLater"},{"display_html":"nowLaterList :: Monoid a => [Ltl a] -> [(a, [Ltl a])]","name":"nowLaterList","module":"Cooked.Ltl","link":"Cooked-Ltl.html#v:nowLaterList"},{"display_html":"data LtlOp (modification :: *) (builtin :: * -> *) :: * -> * where","name":"LtlOp Builtin StartLtl StopLtl","module":"Cooked.Ltl","link":"Cooked-Ltl.html#t:LtlOp"},{"display_html":"data Staged (op :: * -> *) :: * -> * where","name":"Staged Return Instr","module":"Cooked.Ltl","link":"Cooked-Ltl.html#t:Staged"},{"display_html":"interpLtl :: InterpLtl modification builtin m => Staged (LtlOp modification builtin) a -> StateT [Ltl modification] m a","name":"interpLtl","module":"Cooked.Ltl","link":"Cooked-Ltl.html#v:interpLtl"},{"display_html":"interpLtlAndPruneUnfinished :: InterpLtl modification builtin m => Staged (LtlOp modification builtin) a -> StateT [Ltl modification] m a","name":"interpLtlAndPruneUnfinished","module":"Cooked.Ltl","link":"Cooked-Ltl.html#v:interpLtlAndPruneUnfinished"},{"display_html":"class MonadPlus m => InterpLtl modification builtin m where","name":"InterpLtl interpBuiltin","module":"Cooked.Ltl","link":"Cooked-Ltl.html#t:InterpLtl"},{"display_html":"class Monad m => MonadModal m where","name":"MonadModal Modification modifyLtl","module":"Cooked.Ltl","link":"Cooked-Ltl.html#t:MonadModal"},{"display_html":"class IsAbstractOutput o","name":"IsAbstractOutput","module":"Cooked.Output","link":"Cooked-Output.html#t:IsAbstractOutput"},{"display_html":"type family OwnerType o","name":"OwnerType","module":"Cooked.Output","link":"Cooked-Output.html#t:OwnerType"},{"display_html":"type family DatumType o","name":"DatumType","module":"Cooked.Output","link":"Cooked-Output.html#t:DatumType"},{"display_html":"type family ValueType o","name":"ValueType","module":"Cooked.Output","link":"Cooked-Output.html#t:ValueType"},{"display_html":"type family ReferenceScriptType o","name":"ReferenceScriptType","module":"Cooked.Output","link":"Cooked-Output.html#t:ReferenceScriptType"},{"display_html":"outputOwnerL :: IsAbstractOutput o => Lens' o (OwnerType o)","name":"outputOwnerL","module":"Cooked.Output","link":"Cooked-Output.html#v:outputOwnerL"},{"display_html":"outputStakingCredentialL :: IsAbstractOutput o => Lens' o (Maybe StakingCredential)","name":"outputStakingCredentialL","module":"Cooked.Output","link":"Cooked-Output.html#v:outputStakingCredentialL"},{"display_html":"outputDatumL :: IsAbstractOutput o => Lens' o (DatumType o)","name":"outputDatumL","module":"Cooked.Output","link":"Cooked-Output.html#v:outputDatumL"},{"display_html":"outputValueL :: IsAbstractOutput o => Lens' o (ValueType o)","name":"outputValueL","module":"Cooked.Output","link":"Cooked-Output.html#v:outputValueL"},{"display_html":"outputReferenceScriptL :: IsAbstractOutput o => Lens' o (Maybe (ReferenceScriptType o))","name":"outputReferenceScriptL","module":"Cooked.Output","link":"Cooked-Output.html#v:outputReferenceScriptL"},{"display_html":"class ToCredential a where","name":"ToCredential toCredential","module":"Cooked.Output","link":"Cooked-Output.html#t:ToCredential"},{"display_html":"class ToOutputDatum a where","name":"ToOutputDatum toOutputDatum","module":"Cooked.Output","link":"Cooked-Output.html#t:ToOutputDatum"},{"display_html":"class ToValue a where","name":"ToValue toValue","module":"Cooked.Output","link":"Cooked-Output.html#t:ToValue"},{"display_html":"class ToScript a where","name":"ToScript toScript","module":"Cooked.Output","link":"Cooked-Output.html#t:ToScript"},{"display_html":"class ToScriptHash a where","name":"ToScriptHash toScriptHash","module":"Cooked.Output","link":"Cooked-Output.html#t:ToScriptHash"},{"display_html":"type IsTxInfoOutput o = (IsAbstractOutput o, ToCredential (OwnerType o), ToOutputDatum (DatumType o), ToValue (ValueType o), ToScriptHash (ReferenceScriptType o))","name":"IsTxInfoOutput","module":"Cooked.Output","link":"Cooked-Output.html#t:IsTxInfoOutput"},{"display_html":"outputAddress :: (IsAbstractOutput o, ToCredential (OwnerType o)) => o -> Address","name":"outputAddress","module":"Cooked.Output","link":"Cooked-Output.html#v:outputAddress"},{"display_html":"outputOutputDatum :: (IsAbstractOutput o, ToOutputDatum (DatumType o)) => o -> OutputDatum","name":"outputOutputDatum","module":"Cooked.Output","link":"Cooked-Output.html#v:outputOutputDatum"},{"display_html":"outputValue :: (IsAbstractOutput o, ToValue (ValueType o)) => o -> Value","name":"outputValue","module":"Cooked.Output","link":"Cooked-Output.html#v:outputValue"},{"display_html":"outputReferenceScriptHash :: (IsAbstractOutput o, ToScriptHash (ReferenceScriptType o)) => o -> Maybe ScriptHash","name":"outputReferenceScriptHash","module":"Cooked.Output","link":"Cooked-Output.html#v:outputReferenceScriptHash"},{"display_html":"outputTxOut :: IsTxInfoOutput o => o -> TxOut","name":"outputTxOut","module":"Cooked.Output","link":"Cooked-Output.html#v:outputTxOut"},{"display_html":"data ConcreteOutput ownerType datumType valueType referenceScriptType where","name":"ConcreteOutput ConcreteOutput","module":"Cooked.Output","link":"Cooked-Output.html#t:ConcreteOutput"},{"display_html":"toOutputWithReferenceScriptHash :: (IsAbstractOutput output, ToScriptHash (ReferenceScriptType output)) => output -> ConcreteOutput (OwnerType output) (DatumType output) (ValueType output) ScriptHash","name":"toOutputWithReferenceScriptHash","module":"Cooked.Output","link":"Cooked-Output.html#v:toOutputWithReferenceScriptHash"},{"display_html":"isOutputWithoutDatum :: IsTxInfoOutput output => output -> Maybe (ConcreteOutput (OwnerType output) () (ValueType output) (ReferenceScriptType output))","name":"isOutputWithoutDatum","module":"Cooked.Output","link":"Cooked-Output.html#v:isOutputWithoutDatum"},{"display_html":"isOutputWithInlineDatum :: IsTxInfoOutput output => output -> Maybe (ConcreteOutput (OwnerType output) Datum (ValueType output) (ReferenceScriptType output))","name":"isOutputWithInlineDatum","module":"Cooked.Output","link":"Cooked-Output.html#v:isOutputWithInlineDatum"},{"display_html":"isOutputWithDatumHash :: IsTxInfoOutput output => output -> Maybe (ConcreteOutput (OwnerType output) DatumHash (ValueType output) (ReferenceScriptType output))","name":"isOutputWithDatumHash","module":"Cooked.Output","link":"Cooked-Output.html#v:isOutputWithDatumHash"},{"display_html":"isOutputWithInlineDatumOfType :: (FromData a, IsTxInfoOutput output) => output -> Maybe (ConcreteOutput (OwnerType output) a (ValueType output) (ReferenceScriptType output))","name":"isOutputWithInlineDatumOfType","module":"Cooked.Output","link":"Cooked-Output.html#v:isOutputWithInlineDatumOfType"},{"display_html":"isScriptOutputFrom :: IsTxInfoOutput output => TypedValidator a -> output -> Maybe (ConcreteOutput (TypedValidator a) (DatumType output) (ValueType output) (ReferenceScriptType output))","name":"isScriptOutputFrom","module":"Cooked.Output","link":"Cooked-Output.html#v:isScriptOutputFrom"},{"display_html":"isPKOutputFrom :: IsTxInfoOutput output => PubKeyHash -> output -> Maybe (ConcreteOutput PubKeyHash (DatumType output) (ValueType output) (ReferenceScriptType output))","name":"isPKOutputFrom","module":"Cooked.Output","link":"Cooked-Output.html#v:isPKOutputFrom"},{"display_html":"isOnlyAdaOutput :: IsTxInfoOutput output => output -> Maybe (ConcreteOutput (OwnerType output) (DatumType output) Ada (ReferenceScriptType output))","name":"isOnlyAdaOutput","module":"Cooked.Output","link":"Cooked-Output.html#v:isOnlyAdaOutput"},{"display_html":"type DocCooked = Doc ()","name":"DocCooked","module":"Cooked.Pretty.Common","link":"Cooked-Pretty-Common.html#t:DocCooked"},{"display_html":"renderString :: (a -> DocCooked) -> a -> String","name":"renderString","module":"Cooked.Pretty.Common","link":"Cooked-Pretty-Common.html#v:renderString"},{"display_html":"prettyItemize :: DocCooked -> DocCooked -> [DocCooked] -> DocCooked","name":"prettyItemize","module":"Cooked.Pretty.Common","link":"Cooked-Pretty-Common.html#v:prettyItemize"},{"display_html":"prettyItemizeNoTitle :: DocCooked -> [DocCooked] -> DocCooked","name":"prettyItemizeNoTitle","module":"Cooked.Pretty.Common","link":"Cooked-Pretty-Common.html#v:prettyItemizeNoTitle"},{"display_html":"prettyItemizeNonEmpty :: DocCooked -> DocCooked -> [DocCooked] -> Maybe DocCooked","name":"prettyItemizeNonEmpty","module":"Cooked.Pretty.Common","link":"Cooked-Pretty-Common.html#v:prettyItemizeNonEmpty"},{"display_html":"prettyEnumerate :: DocCooked -> DocCooked -> [DocCooked] -> DocCooked","name":"prettyEnumerate","module":"Cooked.Pretty.Common","link":"Cooked-Pretty-Common.html#v:prettyEnumerate"},{"display_html":"prettyHash :: Show a => Int -> a -> DocCooked","name":"prettyHash","module":"Cooked.Pretty.Common","link":"Cooked-Pretty-Common.html#v:prettyHash"},{"display_html":"data PrettyCookedOpts = PrettyCookedOpts {}","name":"PrettyCookedOpts PrettyCookedOpts pcOptPrintTxHashes pcOptPrintTxOutRefs pcOptPrintDefaultTxOpts pcOptPrintedHashLength pcOptNumericUnderscores","module":"Cooked.Pretty.Options","link":"Cooked-Pretty-Options.html#t:PrettyCookedOpts"},{"display_html":"data PCOptTxOutRefs","name":"PCOptTxOutRefs PCOptTxOutRefsHidden PCOptTxOutRefsFull PCOptTxOutRefsPartial","module":"Cooked.Pretty.Options","link":"Cooked-Pretty-Options.html#t:PCOptTxOutRefs"},{"display_html":"unsafeTypedValidatorFromUPLC :: forall a. Program NamedDeBruijn DefaultUni DefaultFun () -> TypedValidator a","name":"unsafeTypedValidatorFromUPLC","module":"Cooked.RawUPLC","link":"Cooked-RawUPLC.html#v:unsafeTypedValidatorFromUPLC"},{"display_html":"typedValidatorFromUPLC :: Program NamedDeBruijn DefaultUni DefaultFun () -> TypedValidator Any","name":"typedValidatorFromUPLC","module":"Cooked.RawUPLC","link":"Cooked-RawUPLC.html#v:typedValidatorFromUPLC"},{"display_html":"unsafeTypedValidatorFromBS :: forall a. ByteString -> Either String (TypedValidator a)","name":"unsafeTypedValidatorFromBS","module":"Cooked.RawUPLC","link":"Cooked-RawUPLC.html#v:unsafeTypedValidatorFromBS"},{"display_html":"typedValidatorFromBS :: ByteString -> Either String (TypedValidator Any)","name":"typedValidatorFromBS","module":"Cooked.RawUPLC","link":"Cooked-RawUPLC.html#v:typedValidatorFromBS"},{"display_html":"class ShowBS a where","name":"ShowBS showBS showBSsPrec","module":"Cooked.ShowBS","link":"Cooked-ShowBS.html#t:ShowBS"},{"display_html":"showBSs :: ShowBS a => a -> BuiltinString -> BuiltinString","name":"showBSs","module":"Cooked.ShowBS","link":"Cooked-ShowBS.html#v:showBSs"},{"display_html":"app_prec :: Integer","name":"app_prec","module":"Cooked.ShowBS","link":"Cooked-ShowBS.html#v:app_prec"},{"display_html":"flattenValueI :: Iso' Value [(AssetClass, Integer)]","name":"flattenValueI","module":"Cooked.ValueUtils","link":"Cooked-ValueUtils.html#v:flattenValueI"},{"display_html":"positivePart :: Value -> Value","name":"positivePart","module":"Cooked.ValueUtils","link":"Cooked-ValueUtils.html#v:positivePart"},{"display_html":"negativePart :: Value -> Value","name":"negativePart","module":"Cooked.ValueUtils","link":"Cooked-ValueUtils.html#v:negativePart"},{"display_html":"adaL :: Lens' Value Ada","name":"adaL","module":"Cooked.ValueUtils","link":"Cooked-ValueUtils.html#v:adaL"},{"display_html":"knownWallets :: [Wallet]","name":"knownWallets","module":"Cooked.Wallet","link":"Cooked-Wallet.html#v:knownWallets"},{"display_html":"wallet :: Int -> Wallet","name":"wallet","module":"Cooked.Wallet","link":"Cooked-Wallet.html#v:wallet"},{"display_html":"walletPKHashToId :: PubKeyHash -> Maybe Int","name":"walletPKHashToId","module":"Cooked.Wallet","link":"Cooked-Wallet.html#v:walletPKHashToId"},{"display_html":"walletPK :: Wallet -> PubKey","name":"walletPK","module":"Cooked.Wallet","link":"Cooked-Wallet.html#v:walletPK"},{"display_html":"walletStakingPK :: Wallet -> Maybe PubKey","name":"walletStakingPK","module":"Cooked.Wallet","link":"Cooked-Wallet.html#v:walletStakingPK"},{"display_html":"walletPKHash :: Wallet -> PubKeyHash","name":"walletPKHash","module":"Cooked.Wallet","link":"Cooked-Wallet.html#v:walletPKHash"},{"display_html":"walletStakingPKHash :: Wallet -> Maybe PubKeyHash","name":"walletStakingPKHash","module":"Cooked.Wallet","link":"Cooked-Wallet.html#v:walletStakingPKHash"},{"display_html":"walletAddress :: Wallet -> Address","name":"walletAddress","module":"Cooked.Wallet","link":"Cooked-Wallet.html#v:walletAddress"},{"display_html":"walletSK :: MockWallet -> PrivateKey","name":"walletSK","module":"Cooked.Wallet","link":"Cooked-Wallet.html#v:walletSK"},{"display_html":"walletStakingSK :: Wallet -> Maybe PrivateKey","name":"walletStakingSK","module":"Cooked.Wallet","link":"Cooked-Wallet.html#v:walletStakingSK"},{"display_html":"initialDistribution :: [(Wallet, [Value])] -> InitialDistribution","name":"initialDistribution","module":"Cooked.Wallet","link":"Cooked-Wallet.html#v:initialDistribution"},{"display_html":"newtype InitialDistribution = InitialDistribution {}","name":"InitialDistribution InitialDistribution unInitialDistribution","module":"Cooked.Wallet","link":"Cooked-Wallet.html#t:InitialDistribution"},{"display_html":"type Wallet = MockWallet","name":"Wallet","module":"Cooked.Wallet","link":"Cooked-Wallet.html#t:Wallet"},{"display_html":"type PrivateKey = XPrv","name":"PrivateKey","module":"Cooked.Wallet","link":"Cooked-Wallet.html#t:PrivateKey"},{"display_html":"class PrettyCooked a where","name":"PrettyCooked prettyCookedOpt prettyCooked","module":"Cooked.Pretty.Class","link":"Cooked-Pretty-Class.html#t:PrettyCooked"},{"display_html":"printCookedOpt :: PrettyCooked a => PrettyCookedOpts -> a -> IO ()","name":"printCookedOpt","module":"Cooked.Pretty.Class","link":"Cooked-Pretty-Class.html#v:printCookedOpt"},{"display_html":"printCooked :: PrettyCooked a => a -> IO ()","name":"printCooked","module":"Cooked.Pretty.Class","link":"Cooked-Pretty-Class.html#v:printCooked"},{"display_html":"type LabelConstrs x = (Show x, Typeable x, Eq x, Ord x)","name":"LabelConstrs","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#t:LabelConstrs"},{"display_html":"data TxLabel where","name":"TxLabel TxLabel","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#t:TxLabel"},{"display_html":"data BalanceOutputPolicy","name":"BalanceOutputPolicy AdjustExistingOutput DontAdjustExistingOutput","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#t:BalanceOutputPolicy"},{"display_html":"data BalancingWallet","name":"BalancingWallet BalanceWithFirstSigner BalanceWith","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#t:BalancingWallet"},{"display_html":"newtype RawModTx = RawModTxAfterBalancing (Tx BabbageEra -> Tx BabbageEra)","name":"RawModTx RawModTxAfterBalancing","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#t:RawModTx"},{"display_html":"newtype EmulatorParamsModification = EmulatorParamsModification (Params -> Params)","name":"EmulatorParamsModification EmulatorParamsModification","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#t:EmulatorParamsModification"},{"display_html":"data BalancingUtxos","name":"BalancingUtxos BalancingUtxosAll BalancingUtxosDatumless BalancingUtxosAllowlist BalancingUtxosBlocklist","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#t:BalancingUtxos"},{"display_html":"applyEmulatorParamsModification :: Maybe EmulatorParamsModification -> Params -> Params","name":"applyEmulatorParamsModification","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#v:applyEmulatorParamsModification"},{"display_html":"applyRawModOnBalancedTx :: [RawModTx] -> Tx BabbageEra -> Tx BabbageEra","name":"applyRawModOnBalancedTx","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#v:applyRawModOnBalancedTx"},{"display_html":"data TxOpts = TxOpts {}","name":"TxOpts TxOpts txOptEmulatorParamsModification txOptEnsureMinAda txOptAwaitTxConfirmed txOptAutoSlotIncrease txOptUnsafeModTx txOptBalance txOptBalanceOutputPolicy txOptBalanceWallet txOptBalancingUtxos","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#t:TxOpts"},{"display_html":"txOptEnsureMinAdaL :: Lens' TxOpts Bool","name":"txOptEnsureMinAdaL","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#v:txOptEnsureMinAdaL"},{"display_html":"txOptAwaitTxConfirmedL :: Lens' TxOpts Bool","name":"txOptAwaitTxConfirmedL","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#v:txOptAwaitTxConfirmedL"},{"display_html":"txOptAutoSlotIncreaseL :: Lens' TxOpts Bool","name":"txOptAutoSlotIncreaseL","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#v:txOptAutoSlotIncreaseL"},{"display_html":"txOptUnsafeModTxL :: Lens' TxOpts [RawModTx]","name":"txOptUnsafeModTxL","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#v:txOptUnsafeModTxL"},{"display_html":"txOptBalanceL :: Lens' TxOpts Bool","name":"txOptBalanceL","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#v:txOptBalanceL"},{"display_html":"txOptBalanceOutputPolicyL :: Lens' TxOpts BalanceOutputPolicy","name":"txOptBalanceOutputPolicyL","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#v:txOptBalanceOutputPolicyL"},{"display_html":"txOptBalanceWalletL :: Lens' TxOpts BalancingWallet","name":"txOptBalanceWalletL","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#v:txOptBalanceWalletL"},{"display_html":"txOptBalancingUtxosL :: Lens' TxOpts BalancingUtxos","name":"txOptBalancingUtxosL","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#v:txOptBalancingUtxosL"},{"display_html":"txOptEmulatorParamsModificationL :: Lens' TxOpts (Maybe EmulatorParamsModification)","name":"txOptEmulatorParamsModificationL","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#v:txOptEmulatorParamsModificationL"},{"display_html":"type MintsConstrs redeemer = (ToData redeemer, Show redeemer, PrettyCooked redeemer, Typeable redeemer)","name":"MintsConstrs","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#t:MintsConstrs"},{"display_html":"data MintsRedeemer where","name":"MintsRedeemer NoMintsRedeemer SomeMintsRedeemer","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#t:MintsRedeemer"},{"display_html":"type TxSkelMints = Map (Versioned MintingPolicy) (MintsRedeemer, NEMap TokenName (NonZero Integer))","name":"TxSkelMints","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#t:TxSkelMints"},{"display_html":"addToTxSkelMints :: (Versioned MintingPolicy, MintsRedeemer, TokenName, Integer) -> TxSkelMints -> TxSkelMints","name":"addToTxSkelMints","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#v:addToTxSkelMints"},{"display_html":"txSkelMintsToList :: TxSkelMints -> [(Versioned MintingPolicy, MintsRedeemer, TokenName, Integer)]","name":"txSkelMintsToList","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#v:txSkelMintsToList"},{"display_html":"txSkelMintsFromList :: [(Versioned MintingPolicy, MintsRedeemer, TokenName, Integer)] -> TxSkelMints","name":"txSkelMintsFromList","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#v:txSkelMintsFromList"},{"display_html":"txSkelMintsValue :: TxSkelMints -> Value","name":"txSkelMintsValue","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#v:txSkelMintsValue"},{"display_html":"txSkelOutValueL :: Lens' TxSkelOut Value","name":"txSkelOutValueL","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#v:txSkelOutValueL"},{"display_html":"txSkelOutDatumL :: Lens' TxSkelOut TxSkelOutDatum","name":"txSkelOutDatumL","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#v:txSkelOutDatumL"},{"display_html":"txSkelOutValue :: TxSkelOut -> Value","name":"txSkelOutValue","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#v:txSkelOutValue"},{"display_html":"txSkelOutValidator :: TxSkelOut -> Maybe (Versioned Validator)","name":"txSkelOutValidator","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#v:txSkelOutValidator"},{"display_html":"type TxSkelOutDatumConstrs a = (Show a, PrettyCooked a, ToData a, Eq a, Typeable a)","name":"TxSkelOutDatumConstrs","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#t:TxSkelOutDatumConstrs"},{"display_html":"data TxSkelOutDatum where","name":"TxSkelOutDatum TxSkelOutDatum TxSkelOutNoDatum TxSkelOutDatumHash TxSkelOutInlineDatum","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#t:TxSkelOutDatum"},{"display_html":"data TxSkelOut where","name":"TxSkelOut Pays producedOutput","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#t:TxSkelOut"},{"display_html":"txSkelOutTypedDatum :: FromData a => TxSkelOutDatum -> Maybe a","name":"txSkelOutTypedDatum","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#v:txSkelOutTypedDatum"},{"display_html":"txSkelOutUntypedDatum :: TxSkelOutDatum -> Maybe Datum","name":"txSkelOutUntypedDatum","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#v:txSkelOutUntypedDatum"},{"display_html":"paysPK :: PubKeyHash -> Value -> TxSkelOut","name":"paysPK","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#v:paysPK"},{"display_html":"paysScript :: (ToData (DatumType a), Show (DatumType a), Typeable (DatumType a), Eq (DatumType a), PrettyCooked (DatumType a), Typeable a) => TypedValidator a -> DatumType a -> Value -> TxSkelOut","name":"paysScript","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#v:paysScript"},{"display_html":"paysScriptInlineDatum :: (ToData (DatumType a), Show (DatumType a), Typeable (DatumType a), Eq (DatumType a), PrettyCooked (DatumType a), Typeable a) => TypedValidator a -> DatumType a -> Value -> TxSkelOut","name":"paysScriptInlineDatum","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#v:paysScriptInlineDatum"},{"display_html":"paysScriptDatumHash :: (ToData (DatumType a), Show (DatumType a), Typeable (DatumType a), Eq (DatumType a), PrettyCooked (DatumType a), Typeable a) => TypedValidator a -> DatumType a -> Value -> TxSkelOut","name":"paysScriptDatumHash","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#v:paysScriptDatumHash"},{"display_html":"paysScriptNoDatum :: Typeable a => TypedValidator a -> Value -> TxSkelOut","name":"paysScriptNoDatum","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#v:paysScriptNoDatum"},{"display_html":"withDatum :: (ToData a, Show a, Typeable a, Eq a, PrettyCooked a) => TxSkelOut -> a -> TxSkelOut","name":"withDatum","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#v:withDatum"},{"display_html":"withInlineDatum :: (ToData a, Show a, Typeable a, Eq a, PrettyCooked a) => TxSkelOut -> a -> TxSkelOut","name":"withInlineDatum","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#v:withInlineDatum"},{"display_html":"withDatumHash :: (ToData a, Show a, Typeable a, Eq a, PrettyCooked a) => TxSkelOut -> a -> TxSkelOut","name":"withDatumHash","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#v:withDatumHash"},{"display_html":"withReferenceScript :: (Show script, ToScript script, Typeable script, ToScriptHash script) => TxSkelOut -> script -> TxSkelOut","name":"withReferenceScript","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#v:withReferenceScript"},{"display_html":"withStakingCredential :: TxSkelOut -> StakingCredential -> TxSkelOut","name":"withStakingCredential","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#v:withStakingCredential"},{"display_html":"data TxSkelRedeemer where","name":"TxSkelRedeemer TxSkelNoRedeemerForPK TxSkelRedeemerForScript TxSkelRedeemerForReferencedScript","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#t:TxSkelRedeemer"},{"display_html":"txSkelTypedRedeemer :: FromData (RedeemerType a) => TxSkelRedeemer -> Maybe (RedeemerType a)","name":"txSkelTypedRedeemer","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#v:txSkelTypedRedeemer"},{"display_html":"data TxSkel where","name":"TxSkel TxSkel txSkelLabel txSkelOpts txSkelMints txSkelSigners txSkelValidityRange txSkelIns txSkelInsReference txSkelOuts","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#t:TxSkel"},{"display_html":"txSkelLabelL :: Lens' TxSkel (Set TxLabel)","name":"txSkelLabelL","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#v:txSkelLabelL"},{"display_html":"txSkelOptsL :: Lens' TxSkel TxOpts","name":"txSkelOptsL","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#v:txSkelOptsL"},{"display_html":"txSkelMintsL :: Lens' TxSkel TxSkelMints","name":"txSkelMintsL","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#v:txSkelMintsL"},{"display_html":"txSkelValidityRangeL :: Lens' TxSkel SlotRange","name":"txSkelValidityRangeL","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#v:txSkelValidityRangeL"},{"display_html":"txSkelSignersL :: Lens' TxSkel [Wallet]","name":"txSkelSignersL","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#v:txSkelSignersL"},{"display_html":"txSkelInsL :: Lens' TxSkel (Map TxOutRef TxSkelRedeemer)","name":"txSkelInsL","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#v:txSkelInsL"},{"display_html":"txSkelInsReferenceL :: Lens' TxSkel (Set TxOutRef)","name":"txSkelInsReferenceL","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#v:txSkelInsReferenceL"},{"display_html":"txSkelOutsL :: Lens' TxSkel [TxSkelOut]","name":"txSkelOutsL","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#v:txSkelOutsL"},{"display_html":"txSkelTemplate :: TxSkel","name":"txSkelTemplate","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#v:txSkelTemplate"},{"display_html":"txSkelOutputData :: TxSkel -> Map DatumHash TxSkelOutDatum","name":"txSkelOutputData","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#v:txSkelOutputData"},{"display_html":"newtype Fee = Fee {}","name":"Fee Fee feeLovelace","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#t:Fee"},{"display_html":"txSkelOutputValue :: TxSkel -> Fee -> Value","name":"txSkelOutputValue","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#v:txSkelOutputValue"},{"display_html":"txSkelOutValidators :: TxSkel -> Map ValidatorHash (Versioned Validator)","name":"txSkelOutValidators","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#v:txSkelOutValidators"},{"display_html":"txSkelOutOwnerTypeP :: forall ownerType. (ToCredential ownerType, Show ownerType, IsTxSkelOutAllowedOwner ownerType, Typeable ownerType) => Prism' TxSkelOut (ConcreteOutput ownerType TxSkelOutDatum Value (Versioned Script))","name":"txSkelOutOwnerTypeP","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#v:txSkelOutOwnerTypeP"},{"display_html":"txSkelOutputDatumTypeAT :: (FromData a, Typeable a) => AffineTraversal' TxSkelOut a","name":"txSkelOutputDatumTypeAT","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#v:txSkelOutputDatumTypeAT"},{"display_html":"data SkelContext = SkelContext {}","name":"SkelContext SkelContext skelContextTxOuts skelContextTxSkelOutDatums","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#t:SkelContext"},{"display_html":"txSkelOutReferenceScripts :: TxSkel -> Map ValidatorHash (Versioned Validator)","name":"txSkelOutReferenceScripts","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#v:txSkelOutReferenceScripts"},{"display_html":"newtype UtxoState = UtxoState {}","name":"UtxoState UtxoState utxoState","module":"Cooked.MockChain.UtxoState","link":"Cooked-MockChain-UtxoState.html#t:UtxoState"},{"display_html":"newtype UtxoPayloadSet = UtxoPayloadSet {}","name":"UtxoPayloadSet UtxoPayloadSet utxoPayloadSet","module":"Cooked.MockChain.UtxoState","link":"Cooked-MockChain-UtxoState.html#t:UtxoPayloadSet"},{"display_html":"data UtxoPayload = UtxoPayload {}","name":"UtxoPayload UtxoPayload utxoPayloadTxOutRef utxoPayloadValue utxoPayloadSkelOutDatum utxoPayloadReferenceScript","module":"Cooked.MockChain.UtxoState","link":"Cooked-MockChain-UtxoState.html#t:UtxoPayload"},{"display_html":"holdsInState :: Address -> UtxoState -> Value","name":"holdsInState","module":"Cooked.MockChain.UtxoState","link":"Cooked-MockChain-UtxoState.html#v:holdsInState"},{"display_html":"data GenerateTxError","name":"GenerateTxError TxBodyError ToCardanoError GenerateTxErrorGeneral","module":"Cooked.MockChain.GenerateTx","link":"Cooked-MockChain-GenerateTx.html#t:GenerateTxError"},{"display_html":"data GenTxParams","name":"GenTxParams gtpCollateralIns gtpFee","module":"Cooked.MockChain.GenerateTx","link":"Cooked-MockChain-GenerateTx.html#t:GenTxParams"},{"display_html":"generateTxBodyContent :: GenTxParams -> Params -> Map DatumHash Datum -> Map TxOutRef TxOut -> Map ValidatorHash (Versioned Validator) -> TxSkel -> Either GenerateTxError (TxBodyContent BuildTx BabbageEra)","name":"generateTxBodyContent","module":"Cooked.MockChain.GenerateTx","link":"Cooked-MockChain-GenerateTx.html#v:generateTxBodyContent"},{"display_html":"txSkelOutToCardanoTxOut :: Params -> TxSkelOut -> Either GenerateTxError (TxOut CtxTx BabbageEra)","name":"txSkelOutToCardanoTxOut","module":"Cooked.MockChain.GenerateTx","link":"Cooked-MockChain-GenerateTx.html#v:txSkelOutToCardanoTxOut"},{"display_html":"generateTx :: GenTxParams -> Params -> Map DatumHash Datum -> Map TxOutRef TxOut -> Map ValidatorHash (Versioned Validator) -> TxSkel -> Either GenerateTxError (Tx BabbageEra)","name":"generateTx","module":"Cooked.MockChain.GenerateTx","link":"Cooked-MockChain-GenerateTx.html#v:generateTx"},{"display_html":"data MockChainError where","name":"MockChainError MCEValidationError MCEUnbalanceable MCENoSuitableCollateral MCEGenerationError MCECalcFee MCEUnknownOutRefError MCEUnknownValidator MCEUnknownDatum FailWith OtherMockChainError","module":"Cooked.MockChain.BlockChain","link":"Cooked-MockChain-BlockChain.html#t:MockChainError"},{"display_html":"data MCEUnbalanceableError","name":"MCEUnbalanceableError MCEUnbalNotEnoughFunds MCEUnbalNotEnoughReturning","module":"Cooked.MockChain.BlockChain","link":"Cooked-MockChain-BlockChain.html#t:MCEUnbalanceableError"},{"display_html":"class (MonadFail m, MonadError MockChainError m) => MonadBlockChainBalancing m where","name":"MonadBlockChainBalancing getParams datumFromHash utxosAtLedger validatorFromHash txOutByRefLedger","module":"Cooked.MockChain.BlockChain","link":"Cooked-MockChain-BlockChain.html#t:MonadBlockChainBalancing"},{"display_html":"class MonadBlockChainBalancing m => MonadBlockChainWithoutValidation m where","name":"MonadBlockChainWithoutValidation awaitSlot currentSlot allUtxosLedger","module":"Cooked.MockChain.BlockChain","link":"Cooked-MockChain-BlockChain.html#t:MonadBlockChainWithoutValidation"},{"display_html":"class MonadBlockChainWithoutValidation m => MonadBlockChain m where","name":"MonadBlockChain validateTxSkel","module":"Cooked.MockChain.BlockChain","link":"Cooked-MockChain-BlockChain.html#t:MonadBlockChain"},{"display_html":"newtype AsTrans t (m :: Type -> Type) a = AsTrans {}","name":"AsTrans AsTrans getTrans","module":"Cooked.MockChain.BlockChain","link":"Cooked-MockChain-BlockChain.html#t:AsTrans"},{"display_html":"allUtxos :: MonadBlockChainWithoutValidation m => m [(TxOutRef, TxOut)]","name":"allUtxos","module":"Cooked.MockChain.BlockChain","link":"Cooked-MockChain-BlockChain.html#v:allUtxos"},{"display_html":"currentTime :: MonadBlockChainWithoutValidation m => m (POSIXTime, POSIXTime)","name":"currentTime","module":"Cooked.MockChain.BlockChain","link":"Cooked-MockChain-BlockChain.html#v:currentTime"},{"display_html":"waitNSlots :: MonadBlockChainWithoutValidation m => Integer -> m Slot","name":"waitNSlots","module":"Cooked.MockChain.BlockChain","link":"Cooked-MockChain-BlockChain.html#v:waitNSlots"},{"display_html":"utxosAt :: MonadBlockChainBalancing m => Address -> m [(TxOutRef, TxOut)]","name":"utxosAt","module":"Cooked.MockChain.BlockChain","link":"Cooked-MockChain-BlockChain.html#v:utxosAt"},{"display_html":"txOutByRef :: MonadBlockChainBalancing m => TxOutRef -> m (Maybe TxOut)","name":"txOutByRef","module":"Cooked.MockChain.BlockChain","link":"Cooked-MockChain-BlockChain.html#v:txOutByRef"},{"display_html":"utxosFromCardanoTx :: CardanoTx -> [(TxOutRef, TxOut)]","name":"utxosFromCardanoTx","module":"Cooked.MockChain.BlockChain","link":"Cooked-MockChain-BlockChain.html#v:utxosFromCardanoTx"},{"display_html":"txOutV2FromLedger :: TxOut -> TxOut","name":"txOutV2FromLedger","module":"Cooked.MockChain.BlockChain","link":"Cooked-MockChain-BlockChain.html#v:txOutV2FromLedger"},{"display_html":"typedDatumFromTxOutRef :: (FromData a, MonadBlockChainWithoutValidation m) => TxOutRef -> m (Maybe a)","name":"typedDatumFromTxOutRef","module":"Cooked.MockChain.BlockChain","link":"Cooked-MockChain-BlockChain.html#v:typedDatumFromTxOutRef"},{"display_html":"valueFromTxOutRef :: MonadBlockChainWithoutValidation m => TxOutRef -> m (Maybe Value)","name":"valueFromTxOutRef","module":"Cooked.MockChain.BlockChain","link":"Cooked-MockChain-BlockChain.html#v:valueFromTxOutRef"},{"display_html":"outputDatumFromTxOutRef :: MonadBlockChainWithoutValidation m => TxOutRef -> m (Maybe OutputDatum)","name":"outputDatumFromTxOutRef","module":"Cooked.MockChain.BlockChain","link":"Cooked-MockChain-BlockChain.html#v:outputDatumFromTxOutRef"},{"display_html":"datumFromTxOutRef :: MonadBlockChainWithoutValidation m => TxOutRef -> m (Maybe Datum)","name":"datumFromTxOutRef","module":"Cooked.MockChain.BlockChain","link":"Cooked-MockChain-BlockChain.html#v:datumFromTxOutRef"},{"display_html":"resolveDatum :: (IsAbstractOutput out, ToOutputDatum (DatumType out), MonadBlockChainBalancing m) => out -> m (Maybe (ConcreteOutput (OwnerType out) Datum (ValueType out) (ReferenceScriptType out)))","name":"resolveDatum","module":"Cooked.MockChain.BlockChain","link":"Cooked-MockChain-BlockChain.html#v:resolveDatum"},{"display_html":"resolveTypedDatum :: (IsAbstractOutput out, ToOutputDatum (DatumType out), MonadBlockChainBalancing m, FromData a) => out -> m (Maybe (ConcreteOutput (OwnerType out) a (ValueType out) (ReferenceScriptType out)))","name":"resolveTypedDatum","module":"Cooked.MockChain.BlockChain","link":"Cooked-MockChain-BlockChain.html#v:resolveTypedDatum"},{"display_html":"resolveValidator :: (IsAbstractOutput out, ToCredential (OwnerType out), MonadBlockChainBalancing m) => out -> m (Maybe (ConcreteOutput (Versioned Validator) (DatumType out) (ValueType out) (ReferenceScriptType out)))","name":"resolveValidator","module":"Cooked.MockChain.BlockChain","link":"Cooked-MockChain-BlockChain.html#v:resolveValidator"},{"display_html":"resolveReferenceScript :: (IsAbstractOutput out, ToScriptHash (ReferenceScriptType out), MonadBlockChainBalancing m) => out -> m (Maybe (ConcreteOutput (OwnerType out) (DatumType out) (ValueType out) (Versioned Validator)))","name":"resolveReferenceScript","module":"Cooked.MockChain.BlockChain","link":"Cooked-MockChain-BlockChain.html#v:resolveReferenceScript"},{"display_html":"getEnclosingSlot :: MonadBlockChainWithoutValidation m => POSIXTime -> m Slot","name":"getEnclosingSlot","module":"Cooked.MockChain.BlockChain","link":"Cooked-MockChain-BlockChain.html#v:getEnclosingSlot"},{"display_html":"awaitEnclosingSlot :: MonadBlockChainWithoutValidation m => POSIXTime -> m Slot","name":"awaitEnclosingSlot","module":"Cooked.MockChain.BlockChain","link":"Cooked-MockChain-BlockChain.html#v:awaitEnclosingSlot"},{"display_html":"slotRangeBefore :: MonadBlockChainWithoutValidation m => POSIXTime -> m SlotRange","name":"slotRangeBefore","module":"Cooked.MockChain.BlockChain","link":"Cooked-MockChain-BlockChain.html#v:slotRangeBefore"},{"display_html":"slotRangeAfter :: MonadBlockChainWithoutValidation m => POSIXTime -> m SlotRange","name":"slotRangeAfter","module":"Cooked.MockChain.BlockChain","link":"Cooked-MockChain-BlockChain.html#v:slotRangeAfter"},{"display_html":"slotToTimeInterval :: MonadBlockChainWithoutValidation m => Slot -> m (POSIXTime, POSIXTime)","name":"slotToTimeInterval","module":"Cooked.MockChain.BlockChain","link":"Cooked-MockChain-BlockChain.html#v:slotToTimeInterval"},{"display_html":"runTweakInChain :: (MonadBlockChainWithoutValidation m, MonadPlus m) => Tweak m a -> TxSkel -> m (a, TxSkel)","name":"runTweakInChain","module":"Cooked.Tweak.Common","link":"Cooked-Tweak-Common.html#v:runTweakInChain"},{"display_html":"runTweakInChain' :: MonadBlockChainWithoutValidation m => Tweak m a -> TxSkel -> m [(a, TxSkel)]","name":"runTweakInChain'","module":"Cooked.Tweak.Common","link":"Cooked-Tweak-Common.html#v:runTweakInChain-39-"},{"display_html":"type Tweak m = StateT TxSkel (ListT m)","name":"Tweak","module":"Cooked.Tweak.Common","link":"Cooked-Tweak-Common.html#t:Tweak"},{"display_html":"data UntypedTweak m where","name":"UntypedTweak UntypedTweak","module":"Cooked.Tweak.Common","link":"Cooked-Tweak-Common.html#t:UntypedTweak"},{"display_html":"class (MonadPlus m, MonadBlockChainWithoutValidation m) => MonadTweak m where","name":"MonadTweak getTxSkel putTxSkel","module":"Cooked.Tweak.Common","link":"Cooked-Tweak-Common.html#t:MonadTweak"},{"display_html":"failingTweak :: MonadTweak m => m a","name":"failingTweak","module":"Cooked.Tweak.Common","link":"Cooked-Tweak-Common.html#v:failingTweak"},{"display_html":"doNothingTweak :: MonadTweak m => m ()","name":"doNothingTweak","module":"Cooked.Tweak.Common","link":"Cooked-Tweak-Common.html#v:doNothingTweak"},{"display_html":"viewTweak :: (MonadTweak m, Is k A_Getter) => Optic' k is TxSkel a -> m a","name":"viewTweak","module":"Cooked.Tweak.Common","link":"Cooked-Tweak-Common.html#v:viewTweak"},{"display_html":"viewAllTweak :: (MonadTweak m, Is k A_Fold) => Optic' k is TxSkel a -> m [a]","name":"viewAllTweak","module":"Cooked.Tweak.Common","link":"Cooked-Tweak-Common.html#v:viewAllTweak"},{"display_html":"setTweak :: (MonadTweak m, Is k A_Setter) => Optic' k is TxSkel a -> a -> m ()","name":"setTweak","module":"Cooked.Tweak.Common","link":"Cooked-Tweak-Common.html#v:setTweak"},{"display_html":"overTweak :: (MonadTweak m, Is k A_Setter) => Optic' k is TxSkel a -> (a -> a) -> m ()","name":"overTweak","module":"Cooked.Tweak.Common","link":"Cooked-Tweak-Common.html#v:overTweak"},{"display_html":"overMaybeTweak :: (MonadTweak m, Is k A_Traversal) => Optic' k is TxSkel a -> (a -> Maybe a) -> m [a]","name":"overMaybeTweak","module":"Cooked.Tweak.Common","link":"Cooked-Tweak-Common.html#v:overMaybeTweak"},{"display_html":"overMaybeSelectingTweak :: forall a m k is. (MonadTweak m, Is k A_Traversal) => Optic' k is TxSkel a -> (a -> Maybe a) -> (Integer -> Bool) -> m [a]","name":"overMaybeSelectingTweak","module":"Cooked.Tweak.Common","link":"Cooked-Tweak-Common.html#v:overMaybeSelectingTweak"},{"display_html":"selectP :: (a -> Bool) -> Prism' a a","name":"selectP","module":"Cooked.Tweak.Common","link":"Cooked-Tweak-Common.html#v:selectP"},{"display_html":"combineModsTweak :: (Eq is, Is k A_Traversal, MonadTweak m) => ([is] -> [[is]]) -> Optic' k (WithIx is) TxSkel x -> (is -> x -> m [(x, l)]) -> m [l]","name":"combineModsTweak","module":"Cooked.Tweak.Common","link":"Cooked-Tweak-Common.html#v:combineModsTweak"},{"display_html":"iviewTweak :: (MonadTweak m, Is k A_Getter) => Optic' k (WithIx is) TxSkel a -> m (is, a)","name":"iviewTweak","module":"Cooked.Tweak.Common","link":"Cooked-Tweak-Common.html#v:iviewTweak"},{"display_html":"getSignersTweak :: MonadTweak m => m [Wallet]","name":"getSignersTweak","module":"Cooked.Tweak.Signers","link":"Cooked-Tweak-Signers.html#v:getSignersTweak"},{"display_html":"modifySignersTweak :: MonadTweak m => ([Wallet] -> [Wallet]) -> m [Wallet]","name":"modifySignersTweak","module":"Cooked.Tweak.Signers","link":"Cooked-Tweak-Signers.html#v:modifySignersTweak"},{"display_html":"setSignersTweak :: MonadTweak m => [Wallet] -> m [Wallet]","name":"setSignersTweak","module":"Cooked.Tweak.Signers","link":"Cooked-Tweak-Signers.html#v:setSignersTweak"},{"display_html":"signersSatisfyTweak :: MonadTweak m => ([Wallet] -> Bool) -> m Bool","name":"signersSatisfyTweak","module":"Cooked.Tweak.Signers","link":"Cooked-Tweak-Signers.html#v:signersSatisfyTweak"},{"display_html":"isSignerTweak :: MonadTweak m => Wallet -> m Bool","name":"isSignerTweak","module":"Cooked.Tweak.Signers","link":"Cooked-Tweak-Signers.html#v:isSignerTweak"},{"display_html":"hasSignersTweak :: MonadTweak m => m Bool","name":"hasSignersTweak","module":"Cooked.Tweak.Signers","link":"Cooked-Tweak-Signers.html#v:hasSignersTweak"},{"display_html":"addFirstSignerTweak :: MonadTweak m => Wallet -> m [Wallet]","name":"addFirstSignerTweak","module":"Cooked.Tweak.Signers","link":"Cooked-Tweak-Signers.html#v:addFirstSignerTweak"},{"display_html":"addSignersTweak :: MonadTweak m => [Wallet] -> m [Wallet]","name":"addSignersTweak","module":"Cooked.Tweak.Signers","link":"Cooked-Tweak-Signers.html#v:addSignersTweak"},{"display_html":"addLastSignerTweak :: MonadTweak m => Wallet -> m [Wallet]","name":"addLastSignerTweak","module":"Cooked.Tweak.Signers","link":"Cooked-Tweak-Signers.html#v:addLastSignerTweak"},{"display_html":"removeSignersTweak :: MonadTweak m => [Wallet] -> m [Wallet]","name":"removeSignersTweak","module":"Cooked.Tweak.Signers","link":"Cooked-Tweak-Signers.html#v:removeSignersTweak"},{"display_html":"removeSignerTweak :: MonadTweak m => Wallet -> m [Wallet]","name":"removeSignerTweak","module":"Cooked.Tweak.Signers","link":"Cooked-Tweak-Signers.html#v:removeSignerTweak"},{"display_html":"replaceFirstSignerTweak :: MonadTweak m => Wallet -> m [Wallet]","name":"replaceFirstSignerTweak","module":"Cooked.Tweak.Signers","link":"Cooked-Tweak-Signers.html#v:replaceFirstSignerTweak"},{"display_html":"data PermutOutTweakMode","name":"PermutOutTweakMode KeepIdentity OmitIdentity","module":"Cooked.Tweak.OutPermutations","link":"Cooked-Tweak-OutPermutations.html#t:PermutOutTweakMode"},{"display_html":"allOutPermutsTweak :: MonadTweak m => PermutOutTweakMode -> m ()","name":"allOutPermutsTweak","module":"Cooked.Tweak.OutPermutations","link":"Cooked-Tweak-OutPermutations.html#v:allOutPermutsTweak"},{"display_html":"singleOutPermutTweak :: MonadTweak m => Int -> m ()","name":"singleOutPermutTweak","module":"Cooked.Tweak.OutPermutations","link":"Cooked-Tweak-OutPermutations.html#v:singleOutPermutTweak"},{"display_html":"distinctPermutations :: Eq a => [a] -> [[a]]","name":"distinctPermutations","module":"Cooked.Tweak.OutPermutations","link":"Cooked-Tweak-OutPermutations.html#v:distinctPermutations"},{"display_html":"addLabelTweak :: (MonadTweak m, LabelConstrs x) => x -> m ()","name":"addLabelTweak","module":"Cooked.Tweak.Labels","link":"Cooked-Tweak-Labels.html#v:addLabelTweak"},{"display_html":"removeLabelTweak :: (MonadTweak m, LabelConstrs x) => x -> m ()","name":"removeLabelTweak","module":"Cooked.Tweak.Labels","link":"Cooked-Tweak-Labels.html#v:removeLabelTweak"},{"display_html":"hasLabelTweak :: (MonadTweak m, LabelConstrs x) => x -> m Bool","name":"hasLabelTweak","module":"Cooked.Tweak.Labels","link":"Cooked-Tweak-Labels.html#v:hasLabelTweak"},{"display_html":"tamperDatumTweak :: forall a m. (MonadTweak m, Show a, PrettyCooked a, ToData a, FromData a, Typeable a) => (a -> Maybe a) -> m [a]","name":"tamperDatumTweak","module":"Cooked.Tweak.TamperDatum","link":"Cooked-Tweak-TamperDatum.html#v:tamperDatumTweak"},{"display_html":"data TamperDatumLbl = TamperDatumLbl","name":"TamperDatumLbl TamperDatumLbl","module":"Cooked.Tweak.TamperDatum","link":"Cooked-Tweak-TamperDatum.html#t:TamperDatumLbl"},{"display_html":"malformDatumTweak :: forall a m. (MonadTweak m, ToData a, FromData a, Typeable a) => (a -> [BuiltinData]) -> m ()","name":"malformDatumTweak","module":"Cooked.Tweak.TamperDatum","link":"Cooked-Tweak-TamperDatum.html#v:malformDatumTweak"},{"display_html":"data MalformDatumLbl = MalformDatumLbl","name":"MalformDatumLbl MalformDatumLbl","module":"Cooked.Tweak.TamperDatum","link":"Cooked-Tweak-TamperDatum.html#t:MalformDatumLbl"},{"display_html":"ensureInputTweak :: MonadTweak m => TxOutRef -> TxSkelRedeemer -> m (Maybe (TxOutRef, TxSkelRedeemer))","name":"ensureInputTweak","module":"Cooked.Tweak.AddInputsAndOutputs","link":"Cooked-Tweak-AddInputsAndOutputs.html#v:ensureInputTweak"},{"display_html":"addInputTweak :: MonadTweak m => TxOutRef -> TxSkelRedeemer -> m ()","name":"addInputTweak","module":"Cooked.Tweak.AddInputsAndOutputs","link":"Cooked-Tweak-AddInputsAndOutputs.html#v:addInputTweak"},{"display_html":"removeInputTweak :: MonadTweak m => (TxOutRef -> TxSkelRedeemer -> Bool) -> m [(TxOutRef, TxSkelRedeemer)]","name":"removeInputTweak","module":"Cooked.Tweak.AddInputsAndOutputs","link":"Cooked-Tweak-AddInputsAndOutputs.html#v:removeInputTweak"},{"display_html":"ensureOutputTweak :: MonadTweak m => TxSkelOut -> m (Maybe TxSkelOut)","name":"ensureOutputTweak","module":"Cooked.Tweak.AddInputsAndOutputs","link":"Cooked-Tweak-AddInputsAndOutputs.html#v:ensureOutputTweak"},{"display_html":"addOutputTweak :: MonadTweak m => TxSkelOut -> m ()","name":"addOutputTweak","module":"Cooked.Tweak.AddInputsAndOutputs","link":"Cooked-Tweak-AddInputsAndOutputs.html#v:addOutputTweak"},{"display_html":"removeOutputTweak :: MonadTweak m => (TxSkelOut -> Bool) -> m [TxSkelOut]","name":"removeOutputTweak","module":"Cooked.Tweak.AddInputsAndOutputs","link":"Cooked-Tweak-AddInputsAndOutputs.html#v:removeOutputTweak"},{"display_html":"addMintTweak :: MonadTweak m => (Versioned MintingPolicy, MintsRedeemer, TokenName, Integer) -> m ()","name":"addMintTweak","module":"Cooked.Tweak.AddInputsAndOutputs","link":"Cooked-Tweak-AddInputsAndOutputs.html#v:addMintTweak"},{"display_html":"removeMintTweak :: MonadTweak m => ((Versioned MintingPolicy, MintsRedeemer, TokenName, Integer) -> Bool) -> m [(Versioned MintingPolicy, MintsRedeemer, TokenName, Integer)]","name":"removeMintTweak","module":"Cooked.Tweak.AddInputsAndOutputs","link":"Cooked-Tweak-AddInputsAndOutputs.html#v:removeMintTweak"},{"display_html":"runUtxoSearch :: Monad m => UtxoSearch m a -> m [(TxOutRef, a)]","name":"runUtxoSearch","module":"Cooked.MockChain.UtxoSearch","link":"Cooked-MockChain-UtxoSearch.html#v:runUtxoSearch"},{"display_html":"allUtxosSearch :: MonadBlockChain m => UtxoSearch m TxOut","name":"allUtxosSearch","module":"Cooked.MockChain.UtxoSearch","link":"Cooked-MockChain-UtxoSearch.html#v:allUtxosSearch"},{"display_html":"allUtxosLedgerSearch :: MonadBlockChain m => UtxoSearch m TxOut","name":"allUtxosLedgerSearch","module":"Cooked.MockChain.UtxoSearch","link":"Cooked-MockChain-UtxoSearch.html#v:allUtxosLedgerSearch"},{"display_html":"utxosAtSearch :: MonadBlockChainBalancing m => Address -> UtxoSearch m TxOut","name":"utxosAtSearch","module":"Cooked.MockChain.UtxoSearch","link":"Cooked-MockChain-UtxoSearch.html#v:utxosAtSearch"},{"display_html":"utxosAtLedgerSearch :: MonadBlockChainBalancing m => Address -> UtxoSearch m TxOut","name":"utxosAtLedgerSearch","module":"Cooked.MockChain.UtxoSearch","link":"Cooked-MockChain-UtxoSearch.html#v:utxosAtLedgerSearch"},{"display_html":"utxosFromCardanoTxSearch :: Monad m => CardanoTx -> UtxoSearch m TxOut","name":"utxosFromCardanoTxSearch","module":"Cooked.MockChain.UtxoSearch","link":"Cooked-MockChain-UtxoSearch.html#v:utxosFromCardanoTxSearch"},{"display_html":"txOutByRefSearch :: MonadBlockChainBalancing m => [TxOutRef] -> UtxoSearch m TxOut","name":"txOutByRefSearch","module":"Cooked.MockChain.UtxoSearch","link":"Cooked-MockChain-UtxoSearch.html#v:txOutByRefSearch"},{"display_html":"filterWith :: Monad m => UtxoSearch m a -> (a -> m (Maybe b)) -> UtxoSearch m b","name":"filterWith","module":"Cooked.MockChain.UtxoSearch","link":"Cooked-MockChain-UtxoSearch.html#v:filterWith"},{"display_html":"filterWithPure :: Monad m => UtxoSearch m a -> (a -> Maybe b) -> UtxoSearch m b","name":"filterWithPure","module":"Cooked.MockChain.UtxoSearch","link":"Cooked-MockChain-UtxoSearch.html#v:filterWithPure"},{"display_html":"filterWithOptic :: (Is k An_AffineFold, Monad m) => UtxoSearch m a -> Optic' k is a b -> UtxoSearch m b","name":"filterWithOptic","module":"Cooked.MockChain.UtxoSearch","link":"Cooked-MockChain-UtxoSearch.html#v:filterWithOptic"},{"display_html":"filterWithPred :: Monad m => UtxoSearch m a -> (a -> Bool) -> UtxoSearch m a","name":"filterWithPred","module":"Cooked.MockChain.UtxoSearch","link":"Cooked-MockChain-UtxoSearch.html#v:filterWithPred"},{"display_html":"filterWithValuePred :: Monad m => UtxoSearch m TxOut -> (Value -> Bool) -> UtxoSearch m Value","name":"filterWithValuePred","module":"Cooked.MockChain.UtxoSearch","link":"Cooked-MockChain-UtxoSearch.html#v:filterWithValuePred"},{"display_html":"filterWithOnlyAda :: Monad m => UtxoSearch m TxOut -> UtxoSearch m Value","name":"filterWithOnlyAda","module":"Cooked.MockChain.UtxoSearch","link":"Cooked-MockChain-UtxoSearch.html#v:filterWithOnlyAda"},{"display_html":"filterWithNotOnlyAda :: Monad m => UtxoSearch m TxOut -> UtxoSearch m Value","name":"filterWithNotOnlyAda","module":"Cooked.MockChain.UtxoSearch","link":"Cooked-MockChain-UtxoSearch.html#v:filterWithNotOnlyAda"},{"display_html":"balancedTxSkel :: MonadBlockChainBalancing m => TxSkel -> m (TxSkel, Fee, Set TxOutRef)","name":"balancedTxSkel","module":"Cooked.MockChain.Balancing","link":"Cooked-MockChain-Balancing.html#v:balancedTxSkel"},{"display_html":"balancedTx :: MonadBlockChainBalancing m => (TxSkel, Fee, Set TxOutRef) -> m (Tx BabbageEra)","name":"balancedTx","module":"Cooked.MockChain.Balancing","link":"Cooked-MockChain-Balancing.html#v:balancedTx"},{"display_html":"txSkelInputData :: MonadBlockChainBalancing m => TxSkel -> m (Map DatumHash Datum)","name":"txSkelInputData","module":"Cooked.MockChain.Balancing","link":"Cooked-MockChain-Balancing.html#v:txSkelInputData"},{"display_html":"mcstToUtxoState :: MockChainSt -> UtxoState","name":"mcstToUtxoState","module":"Cooked.MockChain.Direct","link":"Cooked-MockChain-Direct.html#v:mcstToUtxoState"},{"display_html":"data MockChainSt = MockChainSt {}","name":"MockChainSt MockChainSt mcstCurrentSlot mcstValidators mcstDatums mcstIndex","module":"Cooked.MockChain.Direct","link":"Cooked-MockChain-Direct.html#t:MockChainSt"},{"display_html":"newtype MockChainEnv = MockChainEnv {}","name":"MockChainEnv MockChainEnv mceParams","module":"Cooked.MockChain.Direct","link":"Cooked-MockChain-Direct.html#t:MockChainEnv"},{"display_html":"newtype MockChainT m a = MockChainT {}","name":"MockChainT MockChainT unMockChain","module":"Cooked.MockChain.Direct","link":"Cooked-MockChain-Direct.html#t:MockChainT"},{"display_html":"type MockChain = MockChainT Identity","name":"MockChain","module":"Cooked.MockChain.Direct","link":"Cooked-MockChain-Direct.html#t:MockChain"},{"display_html":"combineMockChainT :: Monad m => (forall a. m a -> m a -> m a) -> MockChainT m x -> MockChainT m x -> MockChainT m x","name":"combineMockChainT","module":"Cooked.MockChain.Direct","link":"Cooked-MockChain-Direct.html#v:combineMockChainT"},{"display_html":"mapMockChainT :: (m (Either MockChainError (a, MockChainSt)) -> n (Either MockChainError (b, MockChainSt))) -> MockChainT m a -> MockChainT n b","name":"mapMockChainT","module":"Cooked.MockChain.Direct","link":"Cooked-MockChain-Direct.html#v:mapMockChainT"},{"display_html":"runMockChainTRaw :: Monad m => MockChainEnv -> MockChainSt -> MockChainT m a -> m (Either MockChainError (a, MockChainSt))","name":"runMockChainTRaw","module":"Cooked.MockChain.Direct","link":"Cooked-MockChain-Direct.html#v:runMockChainTRaw"},{"display_html":"runMockChainTFrom :: Monad m => InitialDistribution -> MockChainT m a -> m (Either MockChainError (a, UtxoState))","name":"runMockChainTFrom","module":"Cooked.MockChain.Direct","link":"Cooked-MockChain-Direct.html#v:runMockChainTFrom"},{"display_html":"runMockChainT :: Monad m => MockChainT m a -> m (Either MockChainError (a, UtxoState))","name":"runMockChainT","module":"Cooked.MockChain.Direct","link":"Cooked-MockChain-Direct.html#v:runMockChainT"},{"display_html":"runMockChainRaw :: MockChainEnv -> MockChainSt -> MockChain a -> Either MockChainError (a, MockChainSt)","name":"runMockChainRaw","module":"Cooked.MockChain.Direct","link":"Cooked-MockChain-Direct.html#v:runMockChainRaw"},{"display_html":"runMockChainFrom :: InitialDistribution -> MockChain a -> Either MockChainError (a, UtxoState)","name":"runMockChainFrom","module":"Cooked.MockChain.Direct","link":"Cooked-MockChain-Direct.html#v:runMockChainFrom"},{"display_html":"runMockChain :: MockChain a -> Either MockChainError (a, UtxoState)","name":"runMockChain","module":"Cooked.MockChain.Direct","link":"Cooked-MockChain-Direct.html#v:runMockChain"},{"display_html":"utxoState0 :: UtxoState","name":"utxoState0","module":"Cooked.MockChain.Direct","link":"Cooked-MockChain-Direct.html#v:utxoState0"},{"display_html":"mockChainSt0 :: MockChainSt","name":"mockChainSt0","module":"Cooked.MockChain.Direct","link":"Cooked-MockChain-Direct.html#v:mockChainSt0"},{"display_html":"mockChainSt0From :: InitialDistribution -> MockChainSt","name":"mockChainSt0From","module":"Cooked.MockChain.Direct","link":"Cooked-MockChain-Direct.html#v:mockChainSt0From"},{"display_html":"utxoIndex0From :: InitialDistribution -> UtxoIndex","name":"utxoIndex0From","module":"Cooked.MockChain.Direct","link":"Cooked-MockChain-Direct.html#v:utxoIndex0From"},{"display_html":"utxoIndex0 :: UtxoIndex","name":"utxoIndex0","module":"Cooked.MockChain.Direct","link":"Cooked-MockChain-Direct.html#v:utxoIndex0"},{"display_html":"getIndex :: UtxoIndex -> Map TxOutRef TxOut","name":"getIndex","module":"Cooked.MockChain.Direct","link":"Cooked-MockChain-Direct.html#v:getIndex"},{"display_html":"runTransactionValidation :: Monad m => Params -> Tx BabbageEra -> [RawModTx] -> Map DatumHash Datum -> Map DatumHash TxSkelOutDatum -> Map ValidatorHash (Versioned Validator) -> MockChainT m CardanoTx","name":"runTransactionValidation","module":"Cooked.MockChain.Direct","link":"Cooked-MockChain-Direct.html#v:runTransactionValidation"},{"display_html":"interpretAndRunWith :: (forall m. Monad m => MockChainT m a -> m res) -> StagedMockChain a -> [(res, MockChainLog)]","name":"interpretAndRunWith","module":"Cooked.MockChain.Staged","link":"Cooked-MockChain-Staged.html#v:interpretAndRunWith"},{"display_html":"interpretAndRun :: StagedMockChain a -> [(Either MockChainError (a, UtxoState), MockChainLog)]","name":"interpretAndRun","module":"Cooked.MockChain.Staged","link":"Cooked-MockChain-Staged.html#v:interpretAndRun"},{"display_html":"data MockChainLogEntry","name":"MockChainLogEntry MCLogSubmittedTxSkel MCLogNewTx MCLogFail","module":"Cooked.MockChain.Staged","link":"Cooked-MockChain-Staged.html#t:MockChainLogEntry"},{"display_html":"newtype MockChainLog = MockChainLog {}","name":"MockChainLog MockChainLog unMockChainLog","module":"Cooked.MockChain.Staged","link":"Cooked-MockChain-Staged.html#t:MockChainLog"},{"display_html":"type StagedMockChain = Staged MockChainOp","name":"StagedMockChain","module":"Cooked.MockChain.Staged","link":"Cooked-MockChain-Staged.html#t:StagedMockChain"},{"display_html":"runTweakFrom :: MockChainEnv -> MockChainSt -> Tweak InterpMockChain a -> TxSkel -> [Either MockChainError (a, TxSkel)]","name":"runTweakFrom","module":"Cooked.MockChain.Staged","link":"Cooked-MockChain-Staged.html#v:runTweakFrom"},{"display_html":"type MonadModalBlockChain m = (MonadBlockChain m, MonadModal m, Modification m ~ UntypedTweak InterpMockChain)","name":"MonadModalBlockChain","module":"Cooked.MockChain.Staged","link":"Cooked-MockChain-Staged.html#t:MonadModalBlockChain"},{"display_html":"somewhere :: MonadModalBlockChain m => Tweak InterpMockChain b -> m a -> m a","name":"somewhere","module":"Cooked.MockChain.Staged","link":"Cooked-MockChain-Staged.html#v:somewhere"},{"display_html":"runTweak :: Tweak InterpMockChain a -> TxSkel -> [Either MockChainError (a, TxSkel)]","name":"runTweak","module":"Cooked.MockChain.Staged","link":"Cooked-MockChain-Staged.html#v:runTweak"},{"display_html":"everywhere :: MonadModalBlockChain m => Tweak InterpMockChain b -> m a -> m a","name":"everywhere","module":"Cooked.MockChain.Staged","link":"Cooked-MockChain-Staged.html#v:everywhere"},{"display_html":"withTweak :: MonadModalBlockChain m => m x -> Tweak InterpMockChain a -> m x","name":"withTweak","module":"Cooked.MockChain.Staged","link":"Cooked-MockChain-Staged.html#v:withTweak"},{"display_html":"there :: MonadModalBlockChain m => Integer -> Tweak InterpMockChain b -> m a -> m a","name":"there","module":"Cooked.MockChain.Staged","link":"Cooked-MockChain-Staged.html#v:there"},{"display_html":"prettyTxSkel :: PrettyCookedOpts -> SkelContext -> TxSkel -> DocCooked","name":"prettyTxSkel","module":"Cooked.Pretty.Cooked","link":"Cooked-Pretty-Cooked.html#v:prettyTxSkel"},{"display_html":"prettyBalancingWallet :: PrettyCookedOpts -> Wallet -> DocCooked","name":"prettyBalancingWallet","module":"Cooked.Pretty.Cooked","link":"Cooked-Pretty-Cooked.html#v:prettyBalancingWallet"},{"display_html":"prettySigners :: PrettyCookedOpts -> TxOpts -> [Wallet] -> [DocCooked]","name":"prettySigners","module":"Cooked.Pretty.Cooked","link":"Cooked-Pretty-Cooked.html#v:prettySigners"},{"display_html":"prettyMints :: PrettyCookedOpts -> (Versioned MintingPolicy, MintsRedeemer, TokenName, Integer) -> DocCooked","name":"prettyMints","module":"Cooked.Pretty.Cooked","link":"Cooked-Pretty-Cooked.html#v:prettyMints"},{"display_html":"mPrettyTxOpts :: PrettyCookedOpts -> TxOpts -> Maybe DocCooked","name":"mPrettyTxOpts","module":"Cooked.Pretty.Cooked","link":"Cooked-Pretty-Cooked.html#v:mPrettyTxOpts"},{"display_html":"prettyTxSkelOut :: PrettyCookedOpts -> TxSkelOut -> DocCooked","name":"prettyTxSkelOut","module":"Cooked.Pretty.Cooked","link":"Cooked-Pretty-Cooked.html#v:prettyTxSkelOut"},{"display_html":"prettyTxSkelOutDatumMaybe :: PrettyCookedOpts -> TxSkelOutDatum -> Maybe DocCooked","name":"prettyTxSkelOutDatumMaybe","module":"Cooked.Pretty.Cooked","link":"Cooked-Pretty-Cooked.html#v:prettyTxSkelOutDatumMaybe"},{"display_html":"prettyTxSkelIn :: PrettyCookedOpts -> SkelContext -> (TxOutRef, TxSkelRedeemer) -> DocCooked","name":"prettyTxSkelIn","module":"Cooked.Pretty.Cooked","link":"Cooked-Pretty-Cooked.html#v:prettyTxSkelIn"},{"display_html":"prettyTxSkelInReference :: PrettyCookedOpts -> SkelContext -> TxOutRef -> Maybe DocCooked","name":"prettyTxSkelInReference","module":"Cooked.Pretty.Cooked","link":"Cooked-Pretty-Cooked.html#v:prettyTxSkelInReference"},{"display_html":"prettyAddressState :: PrettyCookedOpts -> Address -> UtxoPayloadSet -> DocCooked","name":"prettyAddressState","module":"Cooked.Pretty.Cooked","link":"Cooked-Pretty-Cooked.html#v:prettyAddressState"},{"display_html":"prettyPayloadGrouped :: PrettyCookedOpts -> [UtxoPayload] -> Maybe DocCooked","name":"prettyPayloadGrouped","module":"Cooked.Pretty.Cooked","link":"Cooked-Pretty-Cooked.html#v:prettyPayloadGrouped"},{"display_html":"prettyPayload :: PrettyCookedOpts -> Bool -> UtxoPayload -> Maybe DocCooked","name":"prettyPayload","module":"Cooked.Pretty.Cooked","link":"Cooked-Pretty-Cooked.html#v:prettyPayload"},{"display_html":"prettyReferenceScriptHash :: PrettyCookedOpts -> ScriptHash -> DocCooked","name":"prettyReferenceScriptHash","module":"Cooked.Pretty.Cooked","link":"Cooked-Pretty-Cooked.html#v:prettyReferenceScriptHash"},{"display_html":"module Cooked.Pretty.Options","name":"","module":"Cooked.Pretty","link":""},{"display_html":"module Cooked.Pretty.Cooked","name":"","module":"Cooked.Pretty","link":""},{"display_html":"module Cooked.Pretty.Common","name":"","module":"Cooked.Pretty","link":""},{"display_html":"module Cooked.Pretty.Class","name":"","module":"Cooked.Pretty","link":""},{"display_html":"class IsProp prop where","name":"IsProp testFailureMsg testSuccess testFailure testDisjoin testConjoin testCounterexample","module":"Cooked.MockChain.Testing","link":"Cooked-MockChain-Testing.html#t:IsProp"},{"display_html":"testBool :: IsProp prop => Bool -> prop","name":"testBool","module":"Cooked.MockChain.Testing","link":"Cooked-MockChain-Testing.html#v:testBool"},{"display_html":"testAll :: IsProp prop => (a -> prop) -> [a] -> prop","name":"testAll","module":"Cooked.MockChain.Testing","link":"Cooked-MockChain-Testing.html#v:testAll"},{"display_html":"(.==.) :: (IsProp prop, Eq a) => a -> a -> prop","name":".==.","module":"Cooked.MockChain.Testing","link":"Cooked-MockChain-Testing.html#v:.-61--61-."},{"display_html":"(.&&.) :: IsProp prop => prop -> prop -> prop","name":".&&.","module":"Cooked.MockChain.Testing","link":"Cooked-MockChain-Testing.html#v:.-38--38-."},{"display_html":"(.||.) :: IsProp prop => prop -> prop -> prop","name":".||.","module":"Cooked.MockChain.Testing","link":"Cooked-MockChain-Testing.html#v:.-124--124-."},{"display_html":"testSucceeds :: IsProp prop => PrettyCookedOpts -> StagedMockChain a -> prop","name":"testSucceeds","module":"Cooked.MockChain.Testing","link":"Cooked-MockChain-Testing.html#v:testSucceeds"},{"display_html":"testFails :: (IsProp prop, Show a) => PrettyCookedOpts -> (MockChainError -> prop) -> StagedMockChain a -> prop","name":"testFails","module":"Cooked.MockChain.Testing","link":"Cooked-MockChain-Testing.html#v:testFails"},{"display_html":"testSucceedsFrom :: IsProp prop => PrettyCookedOpts -> InitialDistribution -> StagedMockChain a -> prop","name":"testSucceedsFrom","module":"Cooked.MockChain.Testing","link":"Cooked-MockChain-Testing.html#v:testSucceedsFrom"},{"display_html":"testSucceedsFrom' :: IsProp prop => PrettyCookedOpts -> (a -> UtxoState -> prop) -> InitialDistribution -> StagedMockChain a -> prop","name":"testSucceedsFrom'","module":"Cooked.MockChain.Testing","link":"Cooked-MockChain-Testing.html#v:testSucceedsFrom-39-"},{"display_html":"testFailsFrom :: (IsProp prop, Show a) => PrettyCookedOpts -> (MockChainError -> prop) -> InitialDistribution -> StagedMockChain a -> prop","name":"testFailsFrom","module":"Cooked.MockChain.Testing","link":"Cooked-MockChain-Testing.html#v:testFailsFrom"},{"display_html":"isCekEvaluationFailure :: IsProp prop => PrettyCookedOpts -> MockChainError -> prop","name":"isCekEvaluationFailure","module":"Cooked.MockChain.Testing","link":"Cooked-MockChain-Testing.html#v:isCekEvaluationFailure"},{"display_html":"isCekEvaluationFailureWithMsg :: IsProp prop => PrettyCookedOpts -> (String -> Bool) -> MockChainError -> prop","name":"isCekEvaluationFailureWithMsg","module":"Cooked.MockChain.Testing","link":"Cooked-MockChain-Testing.html#v:isCekEvaluationFailureWithMsg"},{"display_html":"testAllSatisfiesFrom :: forall prop a. IsProp prop => PrettyCookedOpts -> (Either MockChainError (a, UtxoState) -> prop) -> InitialDistribution -> StagedMockChain a -> prop","name":"testAllSatisfiesFrom","module":"Cooked.MockChain.Testing","link":"Cooked-MockChain-Testing.html#v:testAllSatisfiesFrom"},{"display_html":"testBinaryRelatedBy :: IsProp prop => PrettyCookedOpts -> (UtxoState -> UtxoState -> prop) -> InitialDistribution -> StagedMockChain a -> prop","name":"testBinaryRelatedBy","module":"Cooked.MockChain.Testing","link":"Cooked-MockChain-Testing.html#v:testBinaryRelatedBy"},{"display_html":"testOneEquivClass :: IsProp prop => PrettyCookedOpts -> (UtxoState -> UtxoState -> prop) -> InitialDistribution -> StagedMockChain a -> prop","name":"testOneEquivClass","module":"Cooked.MockChain.Testing","link":"Cooked-MockChain-Testing.html#v:testOneEquivClass"},{"display_html":"testSatisfiesFrom' :: ([(Either MockChainError (a, UtxoState), MockChainLog)] -> prop) -> InitialDistribution -> StagedMockChain a -> prop","name":"testSatisfiesFrom'","module":"Cooked.MockChain.Testing","link":"Cooked-MockChain-Testing.html#v:testSatisfiesFrom-39-"},{"display_html":"assertionToMaybe :: Assertion -> IO (Maybe HUnitFailure)","name":"assertionToMaybe","module":"Cooked.MockChain.Testing","link":"Cooked-MockChain-Testing.html#v:assertionToMaybe"},{"display_html":"forAll :: Show a => Gen a -> (a -> Property) -> Property","name":"forAll","module":"Cooked.MockChain.Testing","link":"Cooked-MockChain-Testing.html#v:forAll"},{"display_html":"utxoPayloadReferenceScript :: UtxoPayload -> Maybe ScriptHash","name":"utxoPayloadReferenceScript","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:utxoPayloadReferenceScript"},{"display_html":"utxoPayloadSkelOutDatum :: UtxoPayload -> TxSkelOutDatum","name":"utxoPayloadSkelOutDatum","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:utxoPayloadSkelOutDatum"},{"display_html":"utxoPayloadTxOutRef :: UtxoPayload -> TxOutRef","name":"utxoPayloadTxOutRef","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:utxoPayloadTxOutRef"},{"display_html":"utxoPayloadValue :: UtxoPayload -> Value","name":"utxoPayloadValue","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:utxoPayloadValue"},{"display_html":"utxoPayloadSet :: UtxoPayloadSet -> [UtxoPayload]","name":"utxoPayloadSet","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:utxoPayloadSet"},{"display_html":"data UtxoState","name":"UtxoState","module":"Cooked.MockChain","link":"Cooked-MockChain.html#t:UtxoState"},{"display_html":"holdsInState :: Address -> UtxoState -> Value","name":"holdsInState","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:holdsInState"},{"display_html":"newtype AsTrans t (m :: Type -> Type) a = AsTrans {}","name":"AsTrans AsTrans getTrans","module":"Cooked.MockChain","link":"Cooked-MockChain.html#t:AsTrans"},{"display_html":"class MonadBlockChainWithoutValidation m => MonadBlockChain m where","name":"MonadBlockChain validateTxSkel","module":"Cooked.MockChain","link":"Cooked-MockChain.html#t:MonadBlockChain"},{"display_html":"class MonadBlockChainBalancing m => MonadBlockChainWithoutValidation m where","name":"MonadBlockChainWithoutValidation allUtxosLedger awaitSlot currentSlot","module":"Cooked.MockChain","link":"Cooked-MockChain.html#t:MonadBlockChainWithoutValidation"},{"display_html":"class (MonadFail m, MonadError MockChainError m) => MonadBlockChainBalancing m where","name":"MonadBlockChainBalancing txOutByRefLedger validatorFromHash utxosAtLedger getParams datumFromHash","module":"Cooked.MockChain","link":"Cooked-MockChain.html#t:MonadBlockChainBalancing"},{"display_html":"data MCEUnbalanceableError","name":"MCEUnbalanceableError MCEUnbalNotEnoughFunds MCEUnbalNotEnoughReturning","module":"Cooked.MockChain","link":"Cooked-MockChain.html#t:MCEUnbalanceableError"},{"display_html":"data MockChainError where","name":"MockChainError OtherMockChainError FailWith MCEUnknownDatum MCEUnknownValidator MCEUnknownOutRefError MCECalcFee MCEGenerationError MCENoSuitableCollateral MCEValidationError MCEUnbalanceable","module":"Cooked.MockChain","link":"Cooked-MockChain.html#t:MockChainError"},{"display_html":"allUtxos :: MonadBlockChainWithoutValidation m => m [(TxOutRef, TxOut)]","name":"allUtxos","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:allUtxos"},{"display_html":"utxosAt :: MonadBlockChainBalancing m => Address -> m [(TxOutRef, TxOut)]","name":"utxosAt","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:utxosAt"},{"display_html":"txOutByRef :: MonadBlockChainBalancing m => TxOutRef -> m (Maybe TxOut)","name":"txOutByRef","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:txOutByRef"},{"display_html":"utxosFromCardanoTx :: CardanoTx -> [(TxOutRef, TxOut)]","name":"utxosFromCardanoTx","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:utxosFromCardanoTx"},{"display_html":"txOutV2FromLedger :: TxOut -> TxOut","name":"txOutV2FromLedger","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:txOutV2FromLedger"},{"display_html":"resolveDatum :: (IsAbstractOutput out, ToOutputDatum (DatumType out), MonadBlockChainBalancing m) => out -> m (Maybe (ConcreteOutput (OwnerType out) Datum (ValueType out) (ReferenceScriptType out)))","name":"resolveDatum","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:resolveDatum"},{"display_html":"resolveTypedDatum :: (IsAbstractOutput out, ToOutputDatum (DatumType out), MonadBlockChainBalancing m, FromData a) => out -> m (Maybe (ConcreteOutput (OwnerType out) a (ValueType out) (ReferenceScriptType out)))","name":"resolveTypedDatum","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:resolveTypedDatum"},{"display_html":"resolveValidator :: (IsAbstractOutput out, ToCredential (OwnerType out), MonadBlockChainBalancing m) => out -> m (Maybe (ConcreteOutput (Versioned Validator) (DatumType out) (ValueType out) (ReferenceScriptType out)))","name":"resolveValidator","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:resolveValidator"},{"display_html":"resolveReferenceScript :: (IsAbstractOutput out, ToScriptHash (ReferenceScriptType out), MonadBlockChainBalancing m) => out -> m (Maybe (ConcreteOutput (OwnerType out) (DatumType out) (ValueType out) (Versioned Validator)))","name":"resolveReferenceScript","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:resolveReferenceScript"},{"display_html":"outputDatumFromTxOutRef :: MonadBlockChainWithoutValidation m => TxOutRef -> m (Maybe OutputDatum)","name":"outputDatumFromTxOutRef","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:outputDatumFromTxOutRef"},{"display_html":"datumFromTxOutRef :: MonadBlockChainWithoutValidation m => TxOutRef -> m (Maybe Datum)","name":"datumFromTxOutRef","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:datumFromTxOutRef"},{"display_html":"typedDatumFromTxOutRef :: (FromData a, MonadBlockChainWithoutValidation m) => TxOutRef -> m (Maybe a)","name":"typedDatumFromTxOutRef","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:typedDatumFromTxOutRef"},{"display_html":"valueFromTxOutRef :: MonadBlockChainWithoutValidation m => TxOutRef -> m (Maybe Value)","name":"valueFromTxOutRef","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:valueFromTxOutRef"},{"display_html":"waitNSlots :: MonadBlockChainWithoutValidation m => Integer -> m Slot","name":"waitNSlots","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:waitNSlots"},{"display_html":"currentTime :: MonadBlockChainWithoutValidation m => m (POSIXTime, POSIXTime)","name":"currentTime","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:currentTime"},{"display_html":"slotToTimeInterval :: MonadBlockChainWithoutValidation m => Slot -> m (POSIXTime, POSIXTime)","name":"slotToTimeInterval","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:slotToTimeInterval"},{"display_html":"getEnclosingSlot :: MonadBlockChainWithoutValidation m => POSIXTime -> m Slot","name":"getEnclosingSlot","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:getEnclosingSlot"},{"display_html":"awaitEnclosingSlot :: MonadBlockChainWithoutValidation m => POSIXTime -> m Slot","name":"awaitEnclosingSlot","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:awaitEnclosingSlot"},{"display_html":"slotRangeBefore :: MonadBlockChainWithoutValidation m => POSIXTime -> m SlotRange","name":"slotRangeBefore","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:slotRangeBefore"},{"display_html":"slotRangeAfter :: MonadBlockChainWithoutValidation m => POSIXTime -> m SlotRange","name":"slotRangeAfter","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:slotRangeAfter"},{"display_html":"runUtxoSearch :: Monad m => UtxoSearch m a -> m [(TxOutRef, a)]","name":"runUtxoSearch","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:runUtxoSearch"},{"display_html":"allUtxosSearch :: MonadBlockChain m => UtxoSearch m TxOut","name":"allUtxosSearch","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:allUtxosSearch"},{"display_html":"allUtxosLedgerSearch :: MonadBlockChain m => UtxoSearch m TxOut","name":"allUtxosLedgerSearch","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:allUtxosLedgerSearch"},{"display_html":"utxosAtSearch :: MonadBlockChainBalancing m => Address -> UtxoSearch m TxOut","name":"utxosAtSearch","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:utxosAtSearch"},{"display_html":"utxosAtLedgerSearch :: MonadBlockChainBalancing m => Address -> UtxoSearch m TxOut","name":"utxosAtLedgerSearch","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:utxosAtLedgerSearch"},{"display_html":"utxosFromCardanoTxSearch :: Monad m => CardanoTx -> UtxoSearch m TxOut","name":"utxosFromCardanoTxSearch","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:utxosFromCardanoTxSearch"},{"display_html":"txOutByRefSearch :: MonadBlockChainBalancing m => [TxOutRef] -> UtxoSearch m TxOut","name":"txOutByRefSearch","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:txOutByRefSearch"},{"display_html":"filterWith :: Monad m => UtxoSearch m a -> (a -> m (Maybe b)) -> UtxoSearch m b","name":"filterWith","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:filterWith"},{"display_html":"filterWithPure :: Monad m => UtxoSearch m a -> (a -> Maybe b) -> UtxoSearch m b","name":"filterWithPure","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:filterWithPure"},{"display_html":"filterWithOptic :: (Is k An_AffineFold, Monad m) => UtxoSearch m a -> Optic' k is a b -> UtxoSearch m b","name":"filterWithOptic","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:filterWithOptic"},{"display_html":"filterWithPred :: Monad m => UtxoSearch m a -> (a -> Bool) -> UtxoSearch m a","name":"filterWithPred","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:filterWithPred"},{"display_html":"filterWithValuePred :: Monad m => UtxoSearch m TxOut -> (Value -> Bool) -> UtxoSearch m Value","name":"filterWithValuePred","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:filterWithValuePred"},{"display_html":"filterWithOnlyAda :: Monad m => UtxoSearch m TxOut -> UtxoSearch m Value","name":"filterWithOnlyAda","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:filterWithOnlyAda"},{"display_html":"filterWithNotOnlyAda :: Monad m => UtxoSearch m TxOut -> UtxoSearch m Value","name":"filterWithNotOnlyAda","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:filterWithNotOnlyAda"},{"display_html":"balancedTxSkel :: MonadBlockChainBalancing m => TxSkel -> m (TxSkel, Fee, Set TxOutRef)","name":"balancedTxSkel","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:balancedTxSkel"},{"display_html":"balancedTx :: MonadBlockChainBalancing m => (TxSkel, Fee, Set TxOutRef) -> m (Tx BabbageEra)","name":"balancedTx","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:balancedTx"},{"display_html":"txSkelInputData :: MonadBlockChainBalancing m => TxSkel -> m (Map DatumHash Datum)","name":"txSkelInputData","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:txSkelInputData"},{"display_html":"type MockChain = MockChainT Identity","name":"MockChain","module":"Cooked.MockChain","link":"Cooked-MockChain.html#t:MockChain"},{"display_html":"newtype MockChainT m a = MockChainT {}","name":"MockChainT MockChainT unMockChain","module":"Cooked.MockChain","link":"Cooked-MockChain.html#t:MockChainT"},{"display_html":"newtype MockChainEnv = MockChainEnv {}","name":"MockChainEnv MockChainEnv mceParams","module":"Cooked.MockChain","link":"Cooked-MockChain.html#t:MockChainEnv"},{"display_html":"data MockChainSt = MockChainSt {}","name":"MockChainSt MockChainSt mcstCurrentSlot mcstValidators mcstIndex mcstDatums","module":"Cooked.MockChain","link":"Cooked-MockChain.html#t:MockChainSt"},{"display_html":"mcstToUtxoState :: MockChainSt -> UtxoState","name":"mcstToUtxoState","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:mcstToUtxoState"},{"display_html":"combineMockChainT :: Monad m => (forall a. m a -> m a -> m a) -> MockChainT m x -> MockChainT m x -> MockChainT m x","name":"combineMockChainT","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:combineMockChainT"},{"display_html":"mapMockChainT :: (m (Either MockChainError (a, MockChainSt)) -> n (Either MockChainError (b, MockChainSt))) -> MockChainT m a -> MockChainT n b","name":"mapMockChainT","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:mapMockChainT"},{"display_html":"runMockChainTRaw :: Monad m => MockChainEnv -> MockChainSt -> MockChainT m a -> m (Either MockChainError (a, MockChainSt))","name":"runMockChainTRaw","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:runMockChainTRaw"},{"display_html":"runMockChainTFrom :: Monad m => InitialDistribution -> MockChainT m a -> m (Either MockChainError (a, UtxoState))","name":"runMockChainTFrom","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:runMockChainTFrom"},{"display_html":"runMockChainT :: Monad m => MockChainT m a -> m (Either MockChainError (a, UtxoState))","name":"runMockChainT","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:runMockChainT"},{"display_html":"runMockChainRaw :: MockChainEnv -> MockChainSt -> MockChain a -> Either MockChainError (a, MockChainSt)","name":"runMockChainRaw","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:runMockChainRaw"},{"display_html":"runMockChainFrom :: InitialDistribution -> MockChain a -> Either MockChainError (a, UtxoState)","name":"runMockChainFrom","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:runMockChainFrom"},{"display_html":"runMockChain :: MockChain a -> Either MockChainError (a, UtxoState)","name":"runMockChain","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:runMockChain"},{"display_html":"utxoState0 :: UtxoState","name":"utxoState0","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:utxoState0"},{"display_html":"mockChainSt0 :: MockChainSt","name":"mockChainSt0","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:mockChainSt0"},{"display_html":"mockChainSt0From :: InitialDistribution -> MockChainSt","name":"mockChainSt0From","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:mockChainSt0From"},{"display_html":"utxoIndex0From :: InitialDistribution -> UtxoIndex","name":"utxoIndex0From","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:utxoIndex0From"},{"display_html":"utxoIndex0 :: UtxoIndex","name":"utxoIndex0","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:utxoIndex0"},{"display_html":"getIndex :: UtxoIndex -> Map TxOutRef TxOut","name":"getIndex","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:getIndex"},{"display_html":"runTransactionValidation :: Monad m => Params -> Tx BabbageEra -> [RawModTx] -> Map DatumHash Datum -> Map DatumHash TxSkelOutDatum -> Map ValidatorHash (Versioned Validator) -> MockChainT m CardanoTx","name":"runTransactionValidation","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:runTransactionValidation"},{"display_html":"type MonadModalBlockChain m = (MonadBlockChain m, MonadModal m, Modification m ~ UntypedTweak InterpMockChain)","name":"MonadModalBlockChain","module":"Cooked.MockChain","link":"Cooked-MockChain.html#t:MonadModalBlockChain"},{"display_html":"unMockChainLog :: MockChainLog -> [MockChainLogEntry]","name":"unMockChainLog","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:unMockChainLog"},{"display_html":"pattern MCLogFail :: String -> MockChainLogEntry","name":"MCLogFail","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:MCLogFail"},{"display_html":"pattern MCLogSubmittedTxSkel :: SkelContext -> TxSkel -> MockChainLogEntry","name":"MCLogSubmittedTxSkel","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:MCLogSubmittedTxSkel"},{"display_html":"pattern MCLogNewTx :: TxId -> MockChainLogEntry","name":"MCLogNewTx","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:MCLogNewTx"},{"display_html":"interpretAndRunWith :: (forall m. Monad m => MockChainT m a -> m res) -> StagedMockChain a -> [(res, MockChainLog)]","name":"interpretAndRunWith","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:interpretAndRunWith"},{"display_html":"interpretAndRun :: StagedMockChain a -> [(Either MockChainError (a, UtxoState), MockChainLog)]","name":"interpretAndRun","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:interpretAndRun"},{"display_html":"runTweak :: Tweak InterpMockChain a -> TxSkel -> [Either MockChainError (a, TxSkel)]","name":"runTweak","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:runTweak"},{"display_html":"runTweakFrom :: MockChainEnv -> MockChainSt -> Tweak InterpMockChain a -> TxSkel -> [Either MockChainError (a, TxSkel)]","name":"runTweakFrom","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:runTweakFrom"},{"display_html":"somewhere :: MonadModalBlockChain m => Tweak InterpMockChain b -> m a -> m a","name":"somewhere","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:somewhere"},{"display_html":"everywhere :: MonadModalBlockChain m => Tweak InterpMockChain b -> m a -> m a","name":"everywhere","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:everywhere"},{"display_html":"there :: MonadModalBlockChain m => Integer -> Tweak InterpMockChain b -> m a -> m a","name":"there","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:there"},{"display_html":"withTweak :: MonadModalBlockChain m => m x -> Tweak InterpMockChain a -> m x","name":"withTweak","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:withTweak"},{"display_html":"class IsProp prop where","name":"IsProp testFailureMsg testSuccess testFailure testDisjoin testCounterexample testConjoin","module":"Cooked.MockChain","link":"Cooked-MockChain.html#t:IsProp"},{"display_html":"testBool :: IsProp prop => Bool -> prop","name":"testBool","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:testBool"},{"display_html":"testAll :: IsProp prop => (a -> prop) -> [a] -> prop","name":"testAll","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:testAll"},{"display_html":"(.==.) :: (IsProp prop, Eq a) => a -> a -> prop","name":".==.","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:.-61--61-."},{"display_html":"(.&&.) :: IsProp prop => prop -> prop -> prop","name":".&&.","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:.-38--38-."},{"display_html":"(.||.) :: IsProp prop => prop -> prop -> prop","name":".||.","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:.-124--124-."},{"display_html":"testSucceeds :: IsProp prop => PrettyCookedOpts -> StagedMockChain a -> prop","name":"testSucceeds","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:testSucceeds"},{"display_html":"testFails :: (IsProp prop, Show a) => PrettyCookedOpts -> (MockChainError -> prop) -> StagedMockChain a -> prop","name":"testFails","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:testFails"},{"display_html":"testSucceedsFrom :: IsProp prop => PrettyCookedOpts -> InitialDistribution -> StagedMockChain a -> prop","name":"testSucceedsFrom","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:testSucceedsFrom"},{"display_html":"testSucceedsFrom' :: IsProp prop => PrettyCookedOpts -> (a -> UtxoState -> prop) -> InitialDistribution -> StagedMockChain a -> prop","name":"testSucceedsFrom'","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:testSucceedsFrom-39-"},{"display_html":"testFailsFrom :: (IsProp prop, Show a) => PrettyCookedOpts -> (MockChainError -> prop) -> InitialDistribution -> StagedMockChain a -> prop","name":"testFailsFrom","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:testFailsFrom"},{"display_html":"isCekEvaluationFailure :: IsProp prop => PrettyCookedOpts -> MockChainError -> prop","name":"isCekEvaluationFailure","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:isCekEvaluationFailure"},{"display_html":"isCekEvaluationFailureWithMsg :: IsProp prop => PrettyCookedOpts -> (String -> Bool) -> MockChainError -> prop","name":"isCekEvaluationFailureWithMsg","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:isCekEvaluationFailureWithMsg"},{"display_html":"testAllSatisfiesFrom :: forall prop a. IsProp prop => PrettyCookedOpts -> (Either MockChainError (a, UtxoState) -> prop) -> InitialDistribution -> StagedMockChain a -> prop","name":"testAllSatisfiesFrom","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:testAllSatisfiesFrom"},{"display_html":"testBinaryRelatedBy :: IsProp prop => PrettyCookedOpts -> (UtxoState -> UtxoState -> prop) -> InitialDistribution -> StagedMockChain a -> prop","name":"testBinaryRelatedBy","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:testBinaryRelatedBy"},{"display_html":"testOneEquivClass :: IsProp prop => PrettyCookedOpts -> (UtxoState -> UtxoState -> prop) -> InitialDistribution -> StagedMockChain a -> prop","name":"testOneEquivClass","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:testOneEquivClass"},{"display_html":"testSatisfiesFrom' :: ([(Either MockChainError (a, UtxoState), MockChainLog)] -> prop) -> InitialDistribution -> StagedMockChain a -> prop","name":"testSatisfiesFrom'","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:testSatisfiesFrom-39-"},{"display_html":"assertionToMaybe :: Assertion -> IO (Maybe HUnitFailure)","name":"assertionToMaybe","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:assertionToMaybe"},{"display_html":"forAll :: Show a => Gen a -> (a -> Property) -> Property","name":"forAll","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:forAll"},{"display_html":"getValidityRangeTweak :: MonadTweak m => m SlotRange","name":"getValidityRangeTweak","module":"Cooked.Tweak.ValidityRange","link":"Cooked-Tweak-ValidityRange.html#v:getValidityRangeTweak"},{"display_html":"setValidityRangeTweak :: MonadTweak m => SlotRange -> m SlotRange","name":"setValidityRangeTweak","module":"Cooked.Tweak.ValidityRange","link":"Cooked-Tweak-ValidityRange.html#v:setValidityRangeTweak"},{"display_html":"setAlwaysValidRangeTweak :: MonadTweak m => m SlotRange","name":"setAlwaysValidRangeTweak","module":"Cooked.Tweak.ValidityRange","link":"Cooked-Tweak-ValidityRange.html#v:setAlwaysValidRangeTweak"},{"display_html":"setValidityStartTweak :: MonadTweak m => Slot -> m SlotRange","name":"setValidityStartTweak","module":"Cooked.Tweak.ValidityRange","link":"Cooked-Tweak-ValidityRange.html#v:setValidityStartTweak"},{"display_html":"setValidityEndTweak :: MonadTweak m => Slot -> m SlotRange","name":"setValidityEndTweak","module":"Cooked.Tweak.ValidityRange","link":"Cooked-Tweak-ValidityRange.html#v:setValidityEndTweak"},{"display_html":"validityRangeSatisfiesTweak :: MonadTweak m => (SlotRange -> Bool) -> m Bool","name":"validityRangeSatisfiesTweak","module":"Cooked.Tweak.ValidityRange","link":"Cooked-Tweak-ValidityRange.html#v:validityRangeSatisfiesTweak"},{"display_html":"isValidAtTweak :: MonadTweak m => Slot -> m Bool","name":"isValidAtTweak","module":"Cooked.Tweak.ValidityRange","link":"Cooked-Tweak-ValidityRange.html#v:isValidAtTweak"},{"display_html":"isValidNowTweak :: MonadTweak m => m Bool","name":"isValidNowTweak","module":"Cooked.Tweak.ValidityRange","link":"Cooked-Tweak-ValidityRange.html#v:isValidNowTweak"},{"display_html":"isValidDuringTweak :: MonadTweak m => SlotRange -> m Bool","name":"isValidDuringTweak","module":"Cooked.Tweak.ValidityRange","link":"Cooked-Tweak-ValidityRange.html#v:isValidDuringTweak"},{"display_html":"hasEmptyTimeRangeTweak :: MonadTweak m => m Bool","name":"hasEmptyTimeRangeTweak","module":"Cooked.Tweak.ValidityRange","link":"Cooked-Tweak-ValidityRange.html#v:hasEmptyTimeRangeTweak"},{"display_html":"hasFullTimeRangeTweak :: MonadTweak m => m Bool","name":"hasFullTimeRangeTweak","module":"Cooked.Tweak.ValidityRange","link":"Cooked-Tweak-ValidityRange.html#v:hasFullTimeRangeTweak"},{"display_html":"intersectValidityRangeTweak :: MonadTweak m => SlotRange -> m SlotRange","name":"intersectValidityRangeTweak","module":"Cooked.Tweak.ValidityRange","link":"Cooked-Tweak-ValidityRange.html#v:intersectValidityRangeTweak"},{"display_html":"centerAroundValidityRangeTweak :: MonadTweak m => Slot -> Integer -> m SlotRange","name":"centerAroundValidityRangeTweak","module":"Cooked.Tweak.ValidityRange","link":"Cooked-Tweak-ValidityRange.html#v:centerAroundValidityRangeTweak"},{"display_html":"makeValidityRangeSingletonTweak :: MonadTweak m => Slot -> m SlotRange","name":"makeValidityRangeSingletonTweak","module":"Cooked.Tweak.ValidityRange","link":"Cooked-Tweak-ValidityRange.html#v:makeValidityRangeSingletonTweak"},{"display_html":"makeValidityRangeNowTweak :: MonadTweak m => m SlotRange","name":"makeValidityRangeNowTweak","module":"Cooked.Tweak.ValidityRange","link":"Cooked-Tweak-ValidityRange.html#v:makeValidityRangeNowTweak"},{"display_html":"waitUntilValidTweak :: MonadTweak m => m Slot","name":"waitUntilValidTweak","module":"Cooked.Tweak.ValidityRange","link":"Cooked-Tweak-ValidityRange.html#v:waitUntilValidTweak"},{"display_html":"class (MonadPlus m, MonadBlockChainWithoutValidation m) => MonadTweak m where","name":"MonadTweak getTxSkel putTxSkel","module":"Cooked.Tweak","link":"Cooked-Tweak.html#t:MonadTweak"},{"display_html":"failingTweak :: MonadTweak m => m a","name":"failingTweak","module":"Cooked.Tweak","link":"Cooked-Tweak.html#v:failingTweak"},{"display_html":"doNothingTweak :: MonadTweak m => m ()","name":"doNothingTweak","module":"Cooked.Tweak","link":"Cooked-Tweak.html#v:doNothingTweak"},{"display_html":"viewTweak :: (MonadTweak m, Is k A_Getter) => Optic' k is TxSkel a -> m a","name":"viewTweak","module":"Cooked.Tweak","link":"Cooked-Tweak.html#v:viewTweak"},{"display_html":"iviewTweak :: (MonadTweak m, Is k A_Getter) => Optic' k (WithIx is) TxSkel a -> m (is, a)","name":"iviewTweak","module":"Cooked.Tweak","link":"Cooked-Tweak.html#v:iviewTweak"},{"display_html":"viewAllTweak :: (MonadTweak m, Is k A_Fold) => Optic' k is TxSkel a -> m [a]","name":"viewAllTweak","module":"Cooked.Tweak","link":"Cooked-Tweak.html#v:viewAllTweak"},{"display_html":"setTweak :: (MonadTweak m, Is k A_Setter) => Optic' k is TxSkel a -> a -> m ()","name":"setTweak","module":"Cooked.Tweak","link":"Cooked-Tweak.html#v:setTweak"},{"display_html":"overTweak :: (MonadTweak m, Is k A_Setter) => Optic' k is TxSkel a -> (a -> a) -> m ()","name":"overTweak","module":"Cooked.Tweak","link":"Cooked-Tweak.html#v:overTweak"},{"display_html":"overMaybeTweak :: (MonadTweak m, Is k A_Traversal) => Optic' k is TxSkel a -> (a -> Maybe a) -> m [a]","name":"overMaybeTweak","module":"Cooked.Tweak","link":"Cooked-Tweak.html#v:overMaybeTweak"},{"display_html":"overMaybeSelectingTweak :: forall a m k is. (MonadTweak m, Is k A_Traversal) => Optic' k is TxSkel a -> (a -> Maybe a) -> (Integer -> Bool) -> m [a]","name":"overMaybeSelectingTweak","module":"Cooked.Tweak","link":"Cooked-Tweak.html#v:overMaybeSelectingTweak"},{"display_html":"combineModsTweak :: (Eq is, Is k A_Traversal, MonadTweak m) => ([is] -> [[is]]) -> Optic' k (WithIx is) TxSkel x -> (is -> x -> m [(x, l)]) -> m [l]","name":"combineModsTweak","module":"Cooked.Tweak","link":"Cooked-Tweak.html#v:combineModsTweak"},{"display_html":"selectP :: (a -> Bool) -> Prism' a a","name":"selectP","module":"Cooked.Tweak","link":"Cooked-Tweak.html#v:selectP"},{"display_html":"getSignersTweak :: MonadTweak m => m [Wallet]","name":"getSignersTweak","module":"Cooked.Tweak","link":"Cooked-Tweak.html#v:getSignersTweak"},{"display_html":"modifySignersTweak :: MonadTweak m => ([Wallet] -> [Wallet]) -> m [Wallet]","name":"modifySignersTweak","module":"Cooked.Tweak","link":"Cooked-Tweak.html#v:modifySignersTweak"},{"display_html":"setSignersTweak :: MonadTweak m => [Wallet] -> m [Wallet]","name":"setSignersTweak","module":"Cooked.Tweak","link":"Cooked-Tweak.html#v:setSignersTweak"},{"display_html":"signersSatisfyTweak :: MonadTweak m => ([Wallet] -> Bool) -> m Bool","name":"signersSatisfyTweak","module":"Cooked.Tweak","link":"Cooked-Tweak.html#v:signersSatisfyTweak"},{"display_html":"isSignerTweak :: MonadTweak m => Wallet -> m Bool","name":"isSignerTweak","module":"Cooked.Tweak","link":"Cooked-Tweak.html#v:isSignerTweak"},{"display_html":"hasSignersTweak :: MonadTweak m => m Bool","name":"hasSignersTweak","module":"Cooked.Tweak","link":"Cooked-Tweak.html#v:hasSignersTweak"},{"display_html":"addFirstSignerTweak :: MonadTweak m => Wallet -> m [Wallet]","name":"addFirstSignerTweak","module":"Cooked.Tweak","link":"Cooked-Tweak.html#v:addFirstSignerTweak"},{"display_html":"addSignersTweak :: MonadTweak m => [Wallet] -> m [Wallet]","name":"addSignersTweak","module":"Cooked.Tweak","link":"Cooked-Tweak.html#v:addSignersTweak"},{"display_html":"addLastSignerTweak :: MonadTweak m => Wallet -> m [Wallet]","name":"addLastSignerTweak","module":"Cooked.Tweak","link":"Cooked-Tweak.html#v:addLastSignerTweak"},{"display_html":"removeSignersTweak :: MonadTweak m => [Wallet] -> m [Wallet]","name":"removeSignersTweak","module":"Cooked.Tweak","link":"Cooked-Tweak.html#v:removeSignersTweak"},{"display_html":"removeSignerTweak :: MonadTweak m => Wallet -> m [Wallet]","name":"removeSignerTweak","module":"Cooked.Tweak","link":"Cooked-Tweak.html#v:removeSignerTweak"},{"display_html":"replaceFirstSignerTweak :: MonadTweak m => Wallet -> m [Wallet]","name":"replaceFirstSignerTweak","module":"Cooked.Tweak","link":"Cooked-Tweak.html#v:replaceFirstSignerTweak"},{"display_html":"data PermutOutTweakMode","name":"PermutOutTweakMode KeepIdentity OmitIdentity","module":"Cooked.Tweak","link":"Cooked-Tweak.html#t:PermutOutTweakMode"},{"display_html":"allOutPermutsTweak :: MonadTweak m => PermutOutTweakMode -> m ()","name":"allOutPermutsTweak","module":"Cooked.Tweak","link":"Cooked-Tweak.html#v:allOutPermutsTweak"},{"display_html":"singleOutPermutTweak :: MonadTweak m => Int -> m ()","name":"singleOutPermutTweak","module":"Cooked.Tweak","link":"Cooked-Tweak.html#v:singleOutPermutTweak"},{"display_html":"addLabelTweak :: (MonadTweak m, LabelConstrs x) => x -> m ()","name":"addLabelTweak","module":"Cooked.Tweak","link":"Cooked-Tweak.html#v:addLabelTweak"},{"display_html":"removeLabelTweak :: (MonadTweak m, LabelConstrs x) => x -> m ()","name":"removeLabelTweak","module":"Cooked.Tweak","link":"Cooked-Tweak.html#v:removeLabelTweak"},{"display_html":"hasLabelTweak :: (MonadTweak m, LabelConstrs x) => x -> m Bool","name":"hasLabelTweak","module":"Cooked.Tweak","link":"Cooked-Tweak.html#v:hasLabelTweak"},{"display_html":"data MalformDatumLbl = MalformDatumLbl","name":"MalformDatumLbl MalformDatumLbl","module":"Cooked.Tweak","link":"Cooked-Tweak.html#t:MalformDatumLbl"},{"display_html":"data TamperDatumLbl = TamperDatumLbl","name":"TamperDatumLbl TamperDatumLbl","module":"Cooked.Tweak","link":"Cooked-Tweak.html#t:TamperDatumLbl"},{"display_html":"tamperDatumTweak :: forall a m. (MonadTweak m, Show a, PrettyCooked a, ToData a, FromData a, Typeable a) => (a -> Maybe a) -> m [a]","name":"tamperDatumTweak","module":"Cooked.Tweak","link":"Cooked-Tweak.html#v:tamperDatumTweak"},{"display_html":"malformDatumTweak :: forall a m. (MonadTweak m, ToData a, FromData a, Typeable a) => (a -> [BuiltinData]) -> m ()","name":"malformDatumTweak","module":"Cooked.Tweak","link":"Cooked-Tweak.html#v:malformDatumTweak"},{"display_html":"ensureInputTweak :: MonadTweak m => TxOutRef -> TxSkelRedeemer -> m (Maybe (TxOutRef, TxSkelRedeemer))","name":"ensureInputTweak","module":"Cooked.Tweak","link":"Cooked-Tweak.html#v:ensureInputTweak"},{"display_html":"addInputTweak :: MonadTweak m => TxOutRef -> TxSkelRedeemer -> m ()","name":"addInputTweak","module":"Cooked.Tweak","link":"Cooked-Tweak.html#v:addInputTweak"},{"display_html":"removeInputTweak :: MonadTweak m => (TxOutRef -> TxSkelRedeemer -> Bool) -> m [(TxOutRef, TxSkelRedeemer)]","name":"removeInputTweak","module":"Cooked.Tweak","link":"Cooked-Tweak.html#v:removeInputTweak"},{"display_html":"ensureOutputTweak :: MonadTweak m => TxSkelOut -> m (Maybe TxSkelOut)","name":"ensureOutputTweak","module":"Cooked.Tweak","link":"Cooked-Tweak.html#v:ensureOutputTweak"},{"display_html":"addOutputTweak :: MonadTweak m => TxSkelOut -> m ()","name":"addOutputTweak","module":"Cooked.Tweak","link":"Cooked-Tweak.html#v:addOutputTweak"},{"display_html":"removeOutputTweak :: MonadTweak m => (TxSkelOut -> Bool) -> m [TxSkelOut]","name":"removeOutputTweak","module":"Cooked.Tweak","link":"Cooked-Tweak.html#v:removeOutputTweak"},{"display_html":"addMintTweak :: MonadTweak m => (Versioned MintingPolicy, MintsRedeemer, TokenName, Integer) -> m ()","name":"addMintTweak","module":"Cooked.Tweak","link":"Cooked-Tweak.html#v:addMintTweak"},{"display_html":"removeMintTweak :: MonadTweak m => ((Versioned MintingPolicy, MintsRedeemer, TokenName, Integer) -> Bool) -> m [(Versioned MintingPolicy, MintsRedeemer, TokenName, Integer)]","name":"removeMintTweak","module":"Cooked.Tweak","link":"Cooked-Tweak.html#v:removeMintTweak"},{"display_html":"getValidityRangeTweak :: MonadTweak m => m SlotRange","name":"getValidityRangeTweak","module":"Cooked.Tweak","link":"Cooked-Tweak.html#v:getValidityRangeTweak"},{"display_html":"setValidityRangeTweak :: MonadTweak m => SlotRange -> m SlotRange","name":"setValidityRangeTweak","module":"Cooked.Tweak","link":"Cooked-Tweak.html#v:setValidityRangeTweak"},{"display_html":"setAlwaysValidRangeTweak :: MonadTweak m => m SlotRange","name":"setAlwaysValidRangeTweak","module":"Cooked.Tweak","link":"Cooked-Tweak.html#v:setAlwaysValidRangeTweak"},{"display_html":"setValidityStartTweak :: MonadTweak m => Slot -> m SlotRange","name":"setValidityStartTweak","module":"Cooked.Tweak","link":"Cooked-Tweak.html#v:setValidityStartTweak"},{"display_html":"setValidityEndTweak :: MonadTweak m => Slot -> m SlotRange","name":"setValidityEndTweak","module":"Cooked.Tweak","link":"Cooked-Tweak.html#v:setValidityEndTweak"},{"display_html":"validityRangeSatisfiesTweak :: MonadTweak m => (SlotRange -> Bool) -> m Bool","name":"validityRangeSatisfiesTweak","module":"Cooked.Tweak","link":"Cooked-Tweak.html#v:validityRangeSatisfiesTweak"},{"display_html":"isValidAtTweak :: MonadTweak m => Slot -> m Bool","name":"isValidAtTweak","module":"Cooked.Tweak","link":"Cooked-Tweak.html#v:isValidAtTweak"},{"display_html":"isValidNowTweak :: MonadTweak m => m Bool","name":"isValidNowTweak","module":"Cooked.Tweak","link":"Cooked-Tweak.html#v:isValidNowTweak"},{"display_html":"isValidDuringTweak :: MonadTweak m => SlotRange -> m Bool","name":"isValidDuringTweak","module":"Cooked.Tweak","link":"Cooked-Tweak.html#v:isValidDuringTweak"},{"display_html":"hasEmptyTimeRangeTweak :: MonadTweak m => m Bool","name":"hasEmptyTimeRangeTweak","module":"Cooked.Tweak","link":"Cooked-Tweak.html#v:hasEmptyTimeRangeTweak"},{"display_html":"hasFullTimeRangeTweak :: MonadTweak m => m Bool","name":"hasFullTimeRangeTweak","module":"Cooked.Tweak","link":"Cooked-Tweak.html#v:hasFullTimeRangeTweak"},{"display_html":"intersectValidityRangeTweak :: MonadTweak m => SlotRange -> m SlotRange","name":"intersectValidityRangeTweak","module":"Cooked.Tweak","link":"Cooked-Tweak.html#v:intersectValidityRangeTweak"},{"display_html":"centerAroundValidityRangeTweak :: MonadTweak m => Slot -> Integer -> m SlotRange","name":"centerAroundValidityRangeTweak","module":"Cooked.Tweak","link":"Cooked-Tweak.html#v:centerAroundValidityRangeTweak"},{"display_html":"makeValidityRangeSingletonTweak :: MonadTweak m => Slot -> m SlotRange","name":"makeValidityRangeSingletonTweak","module":"Cooked.Tweak","link":"Cooked-Tweak.html#v:makeValidityRangeSingletonTweak"},{"display_html":"makeValidityRangeNowTweak :: MonadTweak m => m SlotRange","name":"makeValidityRangeNowTweak","module":"Cooked.Tweak","link":"Cooked-Tweak.html#v:makeValidityRangeNowTweak"},{"display_html":"waitUntilValidTweak :: MonadTweak m => m Slot","name":"waitUntilValidTweak","module":"Cooked.Tweak","link":"Cooked-Tweak.html#v:waitUntilValidTweak"},{"display_html":"redirectScriptOutputTweak :: (MonadTweak m, Is k A_Traversal, Show (DatumType a), ToData (DatumType a)) => Optic' k is TxSkel (ConcreteOutput (TypedValidator a) TxSkelOutDatum Value (Versioned Script)) -> (ConcreteOutput (TypedValidator a) TxSkelOutDatum Value (Versioned Script) -> Maybe (TypedValidator a)) -> (Integer -> Bool) -> m [ConcreteOutput (TypedValidator a) TxSkelOutDatum Value (Versioned Script)]","name":"redirectScriptOutputTweak","module":"Cooked.Attack.DatumHijacking","link":"Cooked-Attack-DatumHijacking.html#v:redirectScriptOutputTweak"},{"display_html":"datumHijackingAttack :: forall a m. (MonadTweak m, Show (DatumType a), PrettyCooked (DatumType a), ToData (DatumType a), Typeable (DatumType a), Typeable a) => (ConcreteOutput (TypedValidator a) TxSkelOutDatum Value (Versioned Script) -> Bool) -> (Integer -> Bool) -> m [ConcreteOutput (TypedValidator a) TxSkelOutDatum Value (Versioned Script)]","name":"datumHijackingAttack","module":"Cooked.Attack.DatumHijacking","link":"Cooked-Attack-DatumHijacking.html#v:datumHijackingAttack"},{"display_html":"newtype DatumHijackingLbl = DatumHijackingLbl Address","name":"DatumHijackingLbl DatumHijackingLbl","module":"Cooked.Attack.DatumHijacking","link":"Cooked-Attack-DatumHijacking.html#t:DatumHijackingLbl"},{"display_html":"datumHijackingTarget :: TypedValidator a","name":"datumHijackingTarget","module":"Cooked.Attack.DatumHijacking","link":"Cooked-Attack-DatumHijacking.html#v:datumHijackingTarget"},{"display_html":"dupTokenAttack :: MonadTweak m => (AssetClass -> Integer -> Integer) -> Wallet -> m Value","name":"dupTokenAttack","module":"Cooked.Attack.DupToken","link":"Cooked-Attack-DupToken.html#v:dupTokenAttack"},{"display_html":"data DupTokenLbl = DupTokenLbl","name":"DupTokenLbl DupTokenLbl","module":"Cooked.Attack.DupToken","link":"Cooked-Attack-DupToken.html#t:DupTokenLbl"},{"display_html":"type DoubleSatDelta = (Map TxOutRef TxSkelRedeemer, [TxSkelOut], TxSkelMints)","name":"DoubleSatDelta","module":"Cooked.Attack.DoubleSat","link":"Cooked-Attack-DoubleSat.html#t:DoubleSatDelta"},{"display_html":"data DoubleSatLbl = DoubleSatLbl","name":"DoubleSatLbl DoubleSatLbl","module":"Cooked.Attack.DoubleSat","link":"Cooked-Attack-DoubleSat.html#t:DoubleSatLbl"},{"display_html":"doubleSatAttack :: (MonadTweak m, Eq is, Is k A_Traversal) => ([is] -> [[is]]) -> Optic' k (WithIx is) TxSkel a -> (is -> a -> m [(a, DoubleSatDelta)]) -> Wallet -> m ()","name":"doubleSatAttack","module":"Cooked.Attack.DoubleSat","link":"Cooked-Attack-DoubleSat.html#v:doubleSatAttack"},{"display_html":"addTokenAttack :: MonadTweak m => (Versioned MintingPolicy -> [(TokenName, Integer)]) -> Wallet -> m Value","name":"addTokenAttack","module":"Cooked.Attack.AddToken","link":"Cooked-Attack-AddToken.html#v:addTokenAttack"},{"display_html":"newtype AddTokenLbl = AddTokenLbl TokenName","name":"AddTokenLbl AddTokenLbl","module":"Cooked.Attack.AddToken","link":"Cooked-Attack-AddToken.html#t:AddTokenLbl"},{"display_html":"module Cooked.Attack.DupToken","name":"","module":"Cooked.Attack","link":""},{"display_html":"module Cooked.Attack.DoubleSat","name":"","module":"Cooked.Attack","link":""},{"display_html":"module Cooked.Attack.DatumHijacking","name":"","module":"Cooked.Attack","link":""},{"display_html":"module Cooked.Attack.AddToken","name":"","module":"Cooked.Attack","link":""},{"display_html":"module Cooked.Wallet","name":"","module":"Cooked","link":""},{"display_html":"module Cooked.ValueUtils","name":"","module":"Cooked","link":""},{"display_html":"module Cooked.Tweak","name":"","module":"Cooked","link":""},{"display_html":"module Cooked.Skeleton","name":"","module":"Cooked","link":""},{"display_html":"module Cooked.ShowBS","name":"","module":"Cooked","link":""},{"display_html":"module Cooked.RawUPLC","name":"","module":"Cooked","link":""},{"display_html":"module Cooked.Pretty","name":"","module":"Cooked","link":""},{"display_html":"module Cooked.Output","name":"","module":"Cooked","link":""},{"display_html":"module Cooked.MockChain","name":"","module":"Cooked","link":""},{"display_html":"module Cooked.Currencies","name":"","module":"Cooked","link":""},{"display_html":"module Cooked.Attack","name":"","module":"Cooked","link":""},{"display_html":"class Monad m => MonadModal m where","name":"MonadModal Modification modifyLtl","module":"Cooked","link":"Cooked.html#t:MonadModal"},{"display_html":"data Ltl a","name":"Ltl LtlTruth LtlFalsity LtlAtom LtlOr LtlAnd LtlNext LtlUntil LtlRelease","module":"Cooked","link":"Cooked.html#t:Ltl"}] \ No newline at end of file +[{"display_html":"quickTokenName :: String -> TokenName","name":"quickTokenName","module":"Cooked.Currencies","link":"Cooked-Currencies.html#v:quickTokenName"},{"display_html":"quickAssetClass :: String -> AssetClass","name":"quickAssetClass","module":"Cooked.Currencies","link":"Cooked-Currencies.html#v:quickAssetClass"},{"display_html":"quickValue :: String -> Integer -> Value","name":"quickValue","module":"Cooked.Currencies","link":"Cooked-Currencies.html#v:quickValue"},{"display_html":"permanentTokenName :: String -> TokenName","name":"permanentTokenName","module":"Cooked.Currencies","link":"Cooked-Currencies.html#v:permanentTokenName"},{"display_html":"permanentAssetClass :: String -> AssetClass","name":"permanentAssetClass","module":"Cooked.Currencies","link":"Cooked-Currencies.html#v:permanentAssetClass"},{"display_html":"permanentValue :: String -> Integer -> Value","name":"permanentValue","module":"Cooked.Currencies","link":"Cooked-Currencies.html#v:permanentValue"},{"display_html":"quickCurrencyPolicy :: MintingPolicy","name":"quickCurrencyPolicy","module":"Cooked.Currencies","link":"Cooked-Currencies.html#v:quickCurrencyPolicy"},{"display_html":"quickCurrencySymbol :: CurrencySymbol","name":"quickCurrencySymbol","module":"Cooked.Currencies","link":"Cooked-Currencies.html#v:quickCurrencySymbol"},{"display_html":"permanentCurrencyPolicy :: MintingPolicy","name":"permanentCurrencyPolicy","module":"Cooked.Currencies","link":"Cooked-Currencies.html#v:permanentCurrencyPolicy"},{"display_html":"permanentCurrencySymbol :: CurrencySymbol","name":"permanentCurrencySymbol","module":"Cooked.Currencies","link":"Cooked-Currencies.html#v:permanentCurrencySymbol"},{"display_html":"data Ltl a","name":"Ltl LtlTruth LtlFalsity LtlAtom LtlOr LtlAnd LtlNext LtlUntil LtlRelease","module":"Cooked.Ltl","link":"Cooked-Ltl.html#t:Ltl"},{"display_html":"nowLater :: Monoid a => Ltl a -> [(a, Ltl a)]","name":"nowLater","module":"Cooked.Ltl","link":"Cooked-Ltl.html#v:nowLater"},{"display_html":"nowLaterList :: Monoid a => [Ltl a] -> [(a, [Ltl a])]","name":"nowLaterList","module":"Cooked.Ltl","link":"Cooked-Ltl.html#v:nowLaterList"},{"display_html":"data LtlOp (modification :: *) (builtin :: * -> *) :: * -> * where","name":"LtlOp Builtin StartLtl StopLtl","module":"Cooked.Ltl","link":"Cooked-Ltl.html#t:LtlOp"},{"display_html":"data Staged (op :: * -> *) :: * -> * where","name":"Staged Return Instr","module":"Cooked.Ltl","link":"Cooked-Ltl.html#t:Staged"},{"display_html":"interpLtl :: InterpLtl modification builtin m => Staged (LtlOp modification builtin) a -> StateT [Ltl modification] m a","name":"interpLtl","module":"Cooked.Ltl","link":"Cooked-Ltl.html#v:interpLtl"},{"display_html":"interpLtlAndPruneUnfinished :: InterpLtl modification builtin m => Staged (LtlOp modification builtin) a -> StateT [Ltl modification] m a","name":"interpLtlAndPruneUnfinished","module":"Cooked.Ltl","link":"Cooked-Ltl.html#v:interpLtlAndPruneUnfinished"},{"display_html":"class MonadPlus m => InterpLtl modification builtin m where","name":"InterpLtl interpBuiltin","module":"Cooked.Ltl","link":"Cooked-Ltl.html#t:InterpLtl"},{"display_html":"class Monad m => MonadModal m where","name":"MonadModal Modification modifyLtl","module":"Cooked.Ltl","link":"Cooked-Ltl.html#t:MonadModal"},{"display_html":"class IsAbstractOutput o","name":"IsAbstractOutput","module":"Cooked.Output","link":"Cooked-Output.html#t:IsAbstractOutput"},{"display_html":"type family OwnerType o","name":"OwnerType","module":"Cooked.Output","link":"Cooked-Output.html#t:OwnerType"},{"display_html":"type family DatumType o","name":"DatumType","module":"Cooked.Output","link":"Cooked-Output.html#t:DatumType"},{"display_html":"type family ValueType o","name":"ValueType","module":"Cooked.Output","link":"Cooked-Output.html#t:ValueType"},{"display_html":"type family ReferenceScriptType o","name":"ReferenceScriptType","module":"Cooked.Output","link":"Cooked-Output.html#t:ReferenceScriptType"},{"display_html":"outputOwnerL :: IsAbstractOutput o => Lens' o (OwnerType o)","name":"outputOwnerL","module":"Cooked.Output","link":"Cooked-Output.html#v:outputOwnerL"},{"display_html":"outputStakingCredentialL :: IsAbstractOutput o => Lens' o (Maybe StakingCredential)","name":"outputStakingCredentialL","module":"Cooked.Output","link":"Cooked-Output.html#v:outputStakingCredentialL"},{"display_html":"outputDatumL :: IsAbstractOutput o => Lens' o (DatumType o)","name":"outputDatumL","module":"Cooked.Output","link":"Cooked-Output.html#v:outputDatumL"},{"display_html":"outputValueL :: IsAbstractOutput o => Lens' o (ValueType o)","name":"outputValueL","module":"Cooked.Output","link":"Cooked-Output.html#v:outputValueL"},{"display_html":"outputReferenceScriptL :: IsAbstractOutput o => Lens' o (Maybe (ReferenceScriptType o))","name":"outputReferenceScriptL","module":"Cooked.Output","link":"Cooked-Output.html#v:outputReferenceScriptL"},{"display_html":"class ToCredential a where","name":"ToCredential toCredential","module":"Cooked.Output","link":"Cooked-Output.html#t:ToCredential"},{"display_html":"class ToOutputDatum a where","name":"ToOutputDatum toOutputDatum","module":"Cooked.Output","link":"Cooked-Output.html#t:ToOutputDatum"},{"display_html":"class ToValue a where","name":"ToValue toValue","module":"Cooked.Output","link":"Cooked-Output.html#t:ToValue"},{"display_html":"class ToScript a where","name":"ToScript toScript","module":"Cooked.Output","link":"Cooked-Output.html#t:ToScript"},{"display_html":"class ToScriptHash a where","name":"ToScriptHash toScriptHash","module":"Cooked.Output","link":"Cooked-Output.html#t:ToScriptHash"},{"display_html":"type IsTxInfoOutput o = (IsAbstractOutput o, ToCredential (OwnerType o), ToOutputDatum (DatumType o), ToValue (ValueType o), ToScriptHash (ReferenceScriptType o))","name":"IsTxInfoOutput","module":"Cooked.Output","link":"Cooked-Output.html#t:IsTxInfoOutput"},{"display_html":"outputAddress :: (IsAbstractOutput o, ToCredential (OwnerType o)) => o -> Address","name":"outputAddress","module":"Cooked.Output","link":"Cooked-Output.html#v:outputAddress"},{"display_html":"outputOutputDatum :: (IsAbstractOutput o, ToOutputDatum (DatumType o)) => o -> OutputDatum","name":"outputOutputDatum","module":"Cooked.Output","link":"Cooked-Output.html#v:outputOutputDatum"},{"display_html":"outputValue :: (IsAbstractOutput o, ToValue (ValueType o)) => o -> Value","name":"outputValue","module":"Cooked.Output","link":"Cooked-Output.html#v:outputValue"},{"display_html":"outputReferenceScriptHash :: (IsAbstractOutput o, ToScriptHash (ReferenceScriptType o)) => o -> Maybe ScriptHash","name":"outputReferenceScriptHash","module":"Cooked.Output","link":"Cooked-Output.html#v:outputReferenceScriptHash"},{"display_html":"outputTxOut :: IsTxInfoOutput o => o -> TxOut","name":"outputTxOut","module":"Cooked.Output","link":"Cooked-Output.html#v:outputTxOut"},{"display_html":"data ConcreteOutput ownerType datumType valueType referenceScriptType where","name":"ConcreteOutput ConcreteOutput","module":"Cooked.Output","link":"Cooked-Output.html#t:ConcreteOutput"},{"display_html":"toOutputWithReferenceScriptHash :: (IsAbstractOutput output, ToScriptHash (ReferenceScriptType output)) => output -> ConcreteOutput (OwnerType output) (DatumType output) (ValueType output) ScriptHash","name":"toOutputWithReferenceScriptHash","module":"Cooked.Output","link":"Cooked-Output.html#v:toOutputWithReferenceScriptHash"},{"display_html":"isOutputWithoutDatum :: IsTxInfoOutput output => output -> Maybe (ConcreteOutput (OwnerType output) () (ValueType output) (ReferenceScriptType output))","name":"isOutputWithoutDatum","module":"Cooked.Output","link":"Cooked-Output.html#v:isOutputWithoutDatum"},{"display_html":"isOutputWithInlineDatum :: IsTxInfoOutput output => output -> Maybe (ConcreteOutput (OwnerType output) Datum (ValueType output) (ReferenceScriptType output))","name":"isOutputWithInlineDatum","module":"Cooked.Output","link":"Cooked-Output.html#v:isOutputWithInlineDatum"},{"display_html":"isOutputWithDatumHash :: IsTxInfoOutput output => output -> Maybe (ConcreteOutput (OwnerType output) DatumHash (ValueType output) (ReferenceScriptType output))","name":"isOutputWithDatumHash","module":"Cooked.Output","link":"Cooked-Output.html#v:isOutputWithDatumHash"},{"display_html":"isOutputWithInlineDatumOfType :: (FromData a, IsTxInfoOutput output) => output -> Maybe (ConcreteOutput (OwnerType output) a (ValueType output) (ReferenceScriptType output))","name":"isOutputWithInlineDatumOfType","module":"Cooked.Output","link":"Cooked-Output.html#v:isOutputWithInlineDatumOfType"},{"display_html":"isScriptOutputFrom :: IsTxInfoOutput output => TypedValidator a -> output -> Maybe (ConcreteOutput (TypedValidator a) (DatumType output) (ValueType output) (ReferenceScriptType output))","name":"isScriptOutputFrom","module":"Cooked.Output","link":"Cooked-Output.html#v:isScriptOutputFrom"},{"display_html":"isPKOutputFrom :: IsTxInfoOutput output => PubKeyHash -> output -> Maybe (ConcreteOutput PubKeyHash (DatumType output) (ValueType output) (ReferenceScriptType output))","name":"isPKOutputFrom","module":"Cooked.Output","link":"Cooked-Output.html#v:isPKOutputFrom"},{"display_html":"isOnlyAdaOutput :: IsTxInfoOutput output => output -> Maybe (ConcreteOutput (OwnerType output) (DatumType output) Ada (ReferenceScriptType output))","name":"isOnlyAdaOutput","module":"Cooked.Output","link":"Cooked-Output.html#v:isOnlyAdaOutput"},{"display_html":"type DocCooked = Doc ()","name":"DocCooked","module":"Cooked.Pretty.Common","link":"Cooked-Pretty-Common.html#t:DocCooked"},{"display_html":"renderString :: (a -> DocCooked) -> a -> String","name":"renderString","module":"Cooked.Pretty.Common","link":"Cooked-Pretty-Common.html#v:renderString"},{"display_html":"prettyItemize :: DocCooked -> DocCooked -> [DocCooked] -> DocCooked","name":"prettyItemize","module":"Cooked.Pretty.Common","link":"Cooked-Pretty-Common.html#v:prettyItemize"},{"display_html":"prettyItemizeNoTitle :: DocCooked -> [DocCooked] -> DocCooked","name":"prettyItemizeNoTitle","module":"Cooked.Pretty.Common","link":"Cooked-Pretty-Common.html#v:prettyItemizeNoTitle"},{"display_html":"prettyItemizeNonEmpty :: DocCooked -> DocCooked -> [DocCooked] -> Maybe DocCooked","name":"prettyItemizeNonEmpty","module":"Cooked.Pretty.Common","link":"Cooked-Pretty-Common.html#v:prettyItemizeNonEmpty"},{"display_html":"prettyEnumerate :: DocCooked -> DocCooked -> [DocCooked] -> DocCooked","name":"prettyEnumerate","module":"Cooked.Pretty.Common","link":"Cooked-Pretty-Common.html#v:prettyEnumerate"},{"display_html":"prettyHash :: Show a => Int -> a -> DocCooked","name":"prettyHash","module":"Cooked.Pretty.Common","link":"Cooked-Pretty-Common.html#v:prettyHash"},{"display_html":"data PrettyCookedOpts = PrettyCookedOpts {}","name":"PrettyCookedOpts PrettyCookedOpts pcOptPrintTxHashes pcOptPrintTxOutRefs pcOptPrintDefaultTxOpts pcOptPrintedHashLength pcOptNumericUnderscores","module":"Cooked.Pretty.Options","link":"Cooked-Pretty-Options.html#t:PrettyCookedOpts"},{"display_html":"data PCOptTxOutRefs","name":"PCOptTxOutRefs PCOptTxOutRefsHidden PCOptTxOutRefsFull PCOptTxOutRefsPartial","module":"Cooked.Pretty.Options","link":"Cooked-Pretty-Options.html#t:PCOptTxOutRefs"},{"display_html":"unsafeTypedValidatorFromUPLC :: forall a. Program NamedDeBruijn DefaultUni DefaultFun () -> TypedValidator a","name":"unsafeTypedValidatorFromUPLC","module":"Cooked.RawUPLC","link":"Cooked-RawUPLC.html#v:unsafeTypedValidatorFromUPLC"},{"display_html":"typedValidatorFromUPLC :: Program NamedDeBruijn DefaultUni DefaultFun () -> TypedValidator Any","name":"typedValidatorFromUPLC","module":"Cooked.RawUPLC","link":"Cooked-RawUPLC.html#v:typedValidatorFromUPLC"},{"display_html":"unsafeTypedValidatorFromBS :: forall a. ByteString -> Either String (TypedValidator a)","name":"unsafeTypedValidatorFromBS","module":"Cooked.RawUPLC","link":"Cooked-RawUPLC.html#v:unsafeTypedValidatorFromBS"},{"display_html":"typedValidatorFromBS :: ByteString -> Either String (TypedValidator Any)","name":"typedValidatorFromBS","module":"Cooked.RawUPLC","link":"Cooked-RawUPLC.html#v:typedValidatorFromBS"},{"display_html":"class ShowBS a where","name":"ShowBS showBS showBSsPrec","module":"Cooked.ShowBS","link":"Cooked-ShowBS.html#t:ShowBS"},{"display_html":"showBSs :: ShowBS a => a -> BuiltinString -> BuiltinString","name":"showBSs","module":"Cooked.ShowBS","link":"Cooked-ShowBS.html#v:showBSs"},{"display_html":"app_prec :: Integer","name":"app_prec","module":"Cooked.ShowBS","link":"Cooked-ShowBS.html#v:app_prec"},{"display_html":"flattenValueI :: Iso' Value [(AssetClass, Integer)]","name":"flattenValueI","module":"Cooked.ValueUtils","link":"Cooked-ValueUtils.html#v:flattenValueI"},{"display_html":"positivePart :: Value -> Value","name":"positivePart","module":"Cooked.ValueUtils","link":"Cooked-ValueUtils.html#v:positivePart"},{"display_html":"negativePart :: Value -> Value","name":"negativePart","module":"Cooked.ValueUtils","link":"Cooked-ValueUtils.html#v:negativePart"},{"display_html":"adaL :: Lens' Value Ada","name":"adaL","module":"Cooked.ValueUtils","link":"Cooked-ValueUtils.html#v:adaL"},{"display_html":"knownWallets :: [Wallet]","name":"knownWallets","module":"Cooked.Wallet","link":"Cooked-Wallet.html#v:knownWallets"},{"display_html":"wallet :: Int -> Wallet","name":"wallet","module":"Cooked.Wallet","link":"Cooked-Wallet.html#v:wallet"},{"display_html":"walletPKHashToId :: PubKeyHash -> Maybe Int","name":"walletPKHashToId","module":"Cooked.Wallet","link":"Cooked-Wallet.html#v:walletPKHashToId"},{"display_html":"walletPK :: Wallet -> PubKey","name":"walletPK","module":"Cooked.Wallet","link":"Cooked-Wallet.html#v:walletPK"},{"display_html":"walletStakingPK :: Wallet -> Maybe PubKey","name":"walletStakingPK","module":"Cooked.Wallet","link":"Cooked-Wallet.html#v:walletStakingPK"},{"display_html":"walletPKHash :: Wallet -> PubKeyHash","name":"walletPKHash","module":"Cooked.Wallet","link":"Cooked-Wallet.html#v:walletPKHash"},{"display_html":"walletStakingPKHash :: Wallet -> Maybe PubKeyHash","name":"walletStakingPKHash","module":"Cooked.Wallet","link":"Cooked-Wallet.html#v:walletStakingPKHash"},{"display_html":"walletAddress :: Wallet -> Address","name":"walletAddress","module":"Cooked.Wallet","link":"Cooked-Wallet.html#v:walletAddress"},{"display_html":"walletSK :: MockWallet -> PrivateKey","name":"walletSK","module":"Cooked.Wallet","link":"Cooked-Wallet.html#v:walletSK"},{"display_html":"walletStakingSK :: Wallet -> Maybe PrivateKey","name":"walletStakingSK","module":"Cooked.Wallet","link":"Cooked-Wallet.html#v:walletStakingSK"},{"display_html":"initialDistribution :: [(Wallet, [Value])] -> InitialDistribution","name":"initialDistribution","module":"Cooked.Wallet","link":"Cooked-Wallet.html#v:initialDistribution"},{"display_html":"newtype InitialDistribution = InitialDistribution {}","name":"InitialDistribution InitialDistribution unInitialDistribution","module":"Cooked.Wallet","link":"Cooked-Wallet.html#t:InitialDistribution"},{"display_html":"type Wallet = MockWallet","name":"Wallet","module":"Cooked.Wallet","link":"Cooked-Wallet.html#t:Wallet"},{"display_html":"type PrivateKey = XPrv","name":"PrivateKey","module":"Cooked.Wallet","link":"Cooked-Wallet.html#t:PrivateKey"},{"display_html":"class PrettyCooked a where","name":"PrettyCooked prettyCookedOpt prettyCooked","module":"Cooked.Pretty.Class","link":"Cooked-Pretty-Class.html#t:PrettyCooked"},{"display_html":"printCookedOpt :: PrettyCooked a => PrettyCookedOpts -> a -> IO ()","name":"printCookedOpt","module":"Cooked.Pretty.Class","link":"Cooked-Pretty-Class.html#v:printCookedOpt"},{"display_html":"printCooked :: PrettyCooked a => a -> IO ()","name":"printCooked","module":"Cooked.Pretty.Class","link":"Cooked-Pretty-Class.html#v:printCooked"},{"display_html":"type LabelConstrs x = (Show x, Typeable x, Eq x, Ord x)","name":"LabelConstrs","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#t:LabelConstrs"},{"display_html":"data TxLabel where","name":"TxLabel TxLabel","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#t:TxLabel"},{"display_html":"data BalanceOutputPolicy","name":"BalanceOutputPolicy AdjustExistingOutput DontAdjustExistingOutput","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#t:BalanceOutputPolicy"},{"display_html":"data BalancingWallet","name":"BalancingWallet BalanceWithFirstSigner BalanceWith","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#t:BalancingWallet"},{"display_html":"newtype RawModTx = RawModTxAfterBalancing (Tx BabbageEra -> Tx BabbageEra)","name":"RawModTx RawModTxAfterBalancing","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#t:RawModTx"},{"display_html":"newtype EmulatorParamsModification = EmulatorParamsModification (Params -> Params)","name":"EmulatorParamsModification EmulatorParamsModification","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#t:EmulatorParamsModification"},{"display_html":"data BalancingUtxos","name":"BalancingUtxos BalancingUtxosAll BalancingUtxosDatumless BalancingUtxosAllowlist BalancingUtxosBlocklist","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#t:BalancingUtxos"},{"display_html":"applyEmulatorParamsModification :: Maybe EmulatorParamsModification -> Params -> Params","name":"applyEmulatorParamsModification","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#v:applyEmulatorParamsModification"},{"display_html":"applyRawModOnBalancedTx :: [RawModTx] -> Tx BabbageEra -> Tx BabbageEra","name":"applyRawModOnBalancedTx","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#v:applyRawModOnBalancedTx"},{"display_html":"data TxOpts = TxOpts {}","name":"TxOpts TxOpts txOptEmulatorParamsModification txOptEnsureMinAda txOptAwaitTxConfirmed txOptAutoSlotIncrease txOptUnsafeModTx txOptBalance txOptBalanceOutputPolicy txOptBalanceWallet txOptBalancingUtxos","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#t:TxOpts"},{"display_html":"txOptEnsureMinAdaL :: Lens' TxOpts Bool","name":"txOptEnsureMinAdaL","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#v:txOptEnsureMinAdaL"},{"display_html":"txOptAwaitTxConfirmedL :: Lens' TxOpts Bool","name":"txOptAwaitTxConfirmedL","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#v:txOptAwaitTxConfirmedL"},{"display_html":"txOptAutoSlotIncreaseL :: Lens' TxOpts Bool","name":"txOptAutoSlotIncreaseL","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#v:txOptAutoSlotIncreaseL"},{"display_html":"txOptUnsafeModTxL :: Lens' TxOpts [RawModTx]","name":"txOptUnsafeModTxL","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#v:txOptUnsafeModTxL"},{"display_html":"txOptBalanceL :: Lens' TxOpts Bool","name":"txOptBalanceL","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#v:txOptBalanceL"},{"display_html":"txOptBalanceOutputPolicyL :: Lens' TxOpts BalanceOutputPolicy","name":"txOptBalanceOutputPolicyL","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#v:txOptBalanceOutputPolicyL"},{"display_html":"txOptBalanceWalletL :: Lens' TxOpts BalancingWallet","name":"txOptBalanceWalletL","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#v:txOptBalanceWalletL"},{"display_html":"txOptBalancingUtxosL :: Lens' TxOpts BalancingUtxos","name":"txOptBalancingUtxosL","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#v:txOptBalancingUtxosL"},{"display_html":"txOptEmulatorParamsModificationL :: Lens' TxOpts (Maybe EmulatorParamsModification)","name":"txOptEmulatorParamsModificationL","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#v:txOptEmulatorParamsModificationL"},{"display_html":"type MintsConstrs redeemer = (ToData redeemer, Show redeemer, PrettyCooked redeemer, Typeable redeemer)","name":"MintsConstrs","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#t:MintsConstrs"},{"display_html":"data MintsRedeemer where","name":"MintsRedeemer NoMintsRedeemer SomeMintsRedeemer","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#t:MintsRedeemer"},{"display_html":"type TxSkelMints = Map (Versioned MintingPolicy) (MintsRedeemer, NEMap TokenName (NonZero Integer))","name":"TxSkelMints","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#t:TxSkelMints"},{"display_html":"addToTxSkelMints :: (Versioned MintingPolicy, MintsRedeemer, TokenName, Integer) -> TxSkelMints -> TxSkelMints","name":"addToTxSkelMints","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#v:addToTxSkelMints"},{"display_html":"txSkelMintsToList :: TxSkelMints -> [(Versioned MintingPolicy, MintsRedeemer, TokenName, Integer)]","name":"txSkelMintsToList","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#v:txSkelMintsToList"},{"display_html":"txSkelMintsFromList :: [(Versioned MintingPolicy, MintsRedeemer, TokenName, Integer)] -> TxSkelMints","name":"txSkelMintsFromList","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#v:txSkelMintsFromList"},{"display_html":"txSkelMintsValue :: TxSkelMints -> Value","name":"txSkelMintsValue","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#v:txSkelMintsValue"},{"display_html":"txSkelOutValueL :: Lens' TxSkelOut Value","name":"txSkelOutValueL","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#v:txSkelOutValueL"},{"display_html":"txSkelOutDatumL :: Lens' TxSkelOut TxSkelOutDatum","name":"txSkelOutDatumL","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#v:txSkelOutDatumL"},{"display_html":"txSkelOutValue :: TxSkelOut -> Value","name":"txSkelOutValue","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#v:txSkelOutValue"},{"display_html":"txSkelOutValidator :: TxSkelOut -> Maybe (Versioned Validator)","name":"txSkelOutValidator","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#v:txSkelOutValidator"},{"display_html":"type TxSkelOutDatumConstrs a = (Show a, PrettyCooked a, ToData a, Eq a, Typeable a)","name":"TxSkelOutDatumConstrs","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#t:TxSkelOutDatumConstrs"},{"display_html":"data TxSkelOutDatum where","name":"TxSkelOutDatum TxSkelOutDatum TxSkelOutNoDatum TxSkelOutDatumHash TxSkelOutInlineDatum","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#t:TxSkelOutDatum"},{"display_html":"data TxSkelOut where","name":"TxSkelOut Pays producedOutput","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#t:TxSkelOut"},{"display_html":"txSkelOutTypedDatum :: FromData a => TxSkelOutDatum -> Maybe a","name":"txSkelOutTypedDatum","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#v:txSkelOutTypedDatum"},{"display_html":"txSkelOutUntypedDatum :: TxSkelOutDatum -> Maybe Datum","name":"txSkelOutUntypedDatum","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#v:txSkelOutUntypedDatum"},{"display_html":"paysPK :: PubKeyHash -> Value -> TxSkelOut","name":"paysPK","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#v:paysPK"},{"display_html":"paysScript :: (ToData (DatumType a), Show (DatumType a), Typeable (DatumType a), Eq (DatumType a), PrettyCooked (DatumType a), Typeable a) => TypedValidator a -> DatumType a -> Value -> TxSkelOut","name":"paysScript","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#v:paysScript"},{"display_html":"paysScriptInlineDatum :: (ToData (DatumType a), Show (DatumType a), Typeable (DatumType a), Eq (DatumType a), PrettyCooked (DatumType a), Typeable a) => TypedValidator a -> DatumType a -> Value -> TxSkelOut","name":"paysScriptInlineDatum","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#v:paysScriptInlineDatum"},{"display_html":"paysScriptDatumHash :: (ToData (DatumType a), Show (DatumType a), Typeable (DatumType a), Eq (DatumType a), PrettyCooked (DatumType a), Typeable a) => TypedValidator a -> DatumType a -> Value -> TxSkelOut","name":"paysScriptDatumHash","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#v:paysScriptDatumHash"},{"display_html":"paysScriptNoDatum :: Typeable a => TypedValidator a -> Value -> TxSkelOut","name":"paysScriptNoDatum","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#v:paysScriptNoDatum"},{"display_html":"withDatum :: (ToData a, Show a, Typeable a, Eq a, PrettyCooked a) => TxSkelOut -> a -> TxSkelOut","name":"withDatum","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#v:withDatum"},{"display_html":"withInlineDatum :: (ToData a, Show a, Typeable a, Eq a, PrettyCooked a) => TxSkelOut -> a -> TxSkelOut","name":"withInlineDatum","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#v:withInlineDatum"},{"display_html":"withDatumHash :: (ToData a, Show a, Typeable a, Eq a, PrettyCooked a) => TxSkelOut -> a -> TxSkelOut","name":"withDatumHash","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#v:withDatumHash"},{"display_html":"withReferenceScript :: (Show script, ToScript script, Typeable script, ToScriptHash script) => TxSkelOut -> script -> TxSkelOut","name":"withReferenceScript","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#v:withReferenceScript"},{"display_html":"withStakingCredential :: TxSkelOut -> StakingCredential -> TxSkelOut","name":"withStakingCredential","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#v:withStakingCredential"},{"display_html":"data TxSkelRedeemer where","name":"TxSkelRedeemer TxSkelNoRedeemerForPK TxSkelRedeemerForScript TxSkelRedeemerForReferencedScript","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#t:TxSkelRedeemer"},{"display_html":"txSkelTypedRedeemer :: FromData (RedeemerType a) => TxSkelRedeemer -> Maybe (RedeemerType a)","name":"txSkelTypedRedeemer","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#v:txSkelTypedRedeemer"},{"display_html":"data TxSkel where","name":"TxSkel TxSkel txSkelLabel txSkelOpts txSkelMints txSkelSigners txSkelValidityRange txSkelIns txSkelInsReference txSkelOuts","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#t:TxSkel"},{"display_html":"txSkelLabelL :: Lens' TxSkel (Set TxLabel)","name":"txSkelLabelL","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#v:txSkelLabelL"},{"display_html":"txSkelOptsL :: Lens' TxSkel TxOpts","name":"txSkelOptsL","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#v:txSkelOptsL"},{"display_html":"txSkelMintsL :: Lens' TxSkel TxSkelMints","name":"txSkelMintsL","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#v:txSkelMintsL"},{"display_html":"txSkelValidityRangeL :: Lens' TxSkel SlotRange","name":"txSkelValidityRangeL","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#v:txSkelValidityRangeL"},{"display_html":"txSkelSignersL :: Lens' TxSkel [Wallet]","name":"txSkelSignersL","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#v:txSkelSignersL"},{"display_html":"txSkelInsL :: Lens' TxSkel (Map TxOutRef TxSkelRedeemer)","name":"txSkelInsL","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#v:txSkelInsL"},{"display_html":"txSkelInsReferenceL :: Lens' TxSkel (Set TxOutRef)","name":"txSkelInsReferenceL","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#v:txSkelInsReferenceL"},{"display_html":"txSkelOutsL :: Lens' TxSkel [TxSkelOut]","name":"txSkelOutsL","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#v:txSkelOutsL"},{"display_html":"txSkelTemplate :: TxSkel","name":"txSkelTemplate","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#v:txSkelTemplate"},{"display_html":"txSkelOutputData :: TxSkel -> Map DatumHash TxSkelOutDatum","name":"txSkelOutputData","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#v:txSkelOutputData"},{"display_html":"newtype Fee = Fee {}","name":"Fee Fee feeLovelace","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#t:Fee"},{"display_html":"txSkelOutputValue :: TxSkel -> Fee -> Value","name":"txSkelOutputValue","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#v:txSkelOutputValue"},{"display_html":"txSkelOutValidators :: TxSkel -> Map ValidatorHash (Versioned Validator)","name":"txSkelOutValidators","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#v:txSkelOutValidators"},{"display_html":"txSkelOutOwnerTypeP :: forall ownerType. (ToCredential ownerType, Show ownerType, IsTxSkelOutAllowedOwner ownerType, Typeable ownerType) => Prism' TxSkelOut (ConcreteOutput ownerType TxSkelOutDatum Value (Versioned Script))","name":"txSkelOutOwnerTypeP","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#v:txSkelOutOwnerTypeP"},{"display_html":"txSkelOutputDatumTypeAT :: (FromData a, Typeable a) => AffineTraversal' TxSkelOut a","name":"txSkelOutputDatumTypeAT","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#v:txSkelOutputDatumTypeAT"},{"display_html":"data SkelContext = SkelContext {}","name":"SkelContext SkelContext skelContextTxOuts skelContextTxSkelOutDatums","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#t:SkelContext"},{"display_html":"txSkelOutReferenceScripts :: TxSkel -> Map ValidatorHash (Versioned Validator)","name":"txSkelOutReferenceScripts","module":"Cooked.Skeleton","link":"Cooked-Skeleton.html#v:txSkelOutReferenceScripts"},{"display_html":"newtype UtxoState = UtxoState {}","name":"UtxoState UtxoState utxoState","module":"Cooked.MockChain.UtxoState","link":"Cooked-MockChain-UtxoState.html#t:UtxoState"},{"display_html":"newtype UtxoPayloadSet = UtxoPayloadSet {}","name":"UtxoPayloadSet UtxoPayloadSet utxoPayloadSet","module":"Cooked.MockChain.UtxoState","link":"Cooked-MockChain-UtxoState.html#t:UtxoPayloadSet"},{"display_html":"data UtxoPayload = UtxoPayload {}","name":"UtxoPayload UtxoPayload utxoPayloadTxOutRef utxoPayloadValue utxoPayloadSkelOutDatum utxoPayloadReferenceScript","module":"Cooked.MockChain.UtxoState","link":"Cooked-MockChain-UtxoState.html#t:UtxoPayload"},{"display_html":"holdsInState :: Address -> UtxoState -> Value","name":"holdsInState","module":"Cooked.MockChain.UtxoState","link":"Cooked-MockChain-UtxoState.html#v:holdsInState"},{"display_html":"data GenerateTxError","name":"GenerateTxError TxBodyError ToCardanoError GenerateTxErrorGeneral","module":"Cooked.MockChain.GenerateTx","link":"Cooked-MockChain-GenerateTx.html#t:GenerateTxError"},{"display_html":"data GenTxParams","name":"GenTxParams gtpCollateralIns gtpFee","module":"Cooked.MockChain.GenerateTx","link":"Cooked-MockChain-GenerateTx.html#t:GenTxParams"},{"display_html":"generateTxBodyContent :: GenTxParams -> Params -> Map DatumHash Datum -> Map TxOutRef TxOut -> Map ValidatorHash (Versioned Validator) -> TxSkel -> Either GenerateTxError (TxBodyContent BuildTx BabbageEra)","name":"generateTxBodyContent","module":"Cooked.MockChain.GenerateTx","link":"Cooked-MockChain-GenerateTx.html#v:generateTxBodyContent"},{"display_html":"txSkelOutToCardanoTxOut :: Params -> TxSkelOut -> Either GenerateTxError (TxOut CtxTx BabbageEra)","name":"txSkelOutToCardanoTxOut","module":"Cooked.MockChain.GenerateTx","link":"Cooked-MockChain-GenerateTx.html#v:txSkelOutToCardanoTxOut"},{"display_html":"generateTx :: GenTxParams -> Params -> Map DatumHash Datum -> Map TxOutRef TxOut -> Map ValidatorHash (Versioned Validator) -> TxSkel -> Either GenerateTxError (Tx BabbageEra)","name":"generateTx","module":"Cooked.MockChain.GenerateTx","link":"Cooked-MockChain-GenerateTx.html#v:generateTx"},{"display_html":"data MockChainError where","name":"MockChainError MCEValidationError MCEUnbalanceable MCENoSuitableCollateral MCEGenerationError MCECalcFee MCEUnknownOutRefError MCEUnknownValidator MCEUnknownDatum FailWith OtherMockChainError","module":"Cooked.MockChain.BlockChain","link":"Cooked-MockChain-BlockChain.html#t:MockChainError"},{"display_html":"data MCEUnbalanceableError","name":"MCEUnbalanceableError MCEUnbalNotEnoughFunds MCEUnbalNotEnoughReturning","module":"Cooked.MockChain.BlockChain","link":"Cooked-MockChain-BlockChain.html#t:MCEUnbalanceableError"},{"display_html":"class (MonadFail m, MonadError MockChainError m) => MonadBlockChainBalancing m where","name":"MonadBlockChainBalancing getParams datumFromHash validatorFromHash utxosAtLedger txOutByRefLedger","module":"Cooked.MockChain.BlockChain","link":"Cooked-MockChain-BlockChain.html#t:MonadBlockChainBalancing"},{"display_html":"class MonadBlockChainBalancing m => MonadBlockChainWithoutValidation m where","name":"MonadBlockChainWithoutValidation currentSlot awaitSlot allUtxosLedger","module":"Cooked.MockChain.BlockChain","link":"Cooked-MockChain-BlockChain.html#t:MonadBlockChainWithoutValidation"},{"display_html":"class MonadBlockChainWithoutValidation m => MonadBlockChain m where","name":"MonadBlockChain validateTxSkel","module":"Cooked.MockChain.BlockChain","link":"Cooked-MockChain-BlockChain.html#t:MonadBlockChain"},{"display_html":"newtype AsTrans t (m :: Type -> Type) a = AsTrans {}","name":"AsTrans AsTrans getTrans","module":"Cooked.MockChain.BlockChain","link":"Cooked-MockChain-BlockChain.html#t:AsTrans"},{"display_html":"allUtxos :: MonadBlockChainWithoutValidation m => m [(TxOutRef, TxOut)]","name":"allUtxos","module":"Cooked.MockChain.BlockChain","link":"Cooked-MockChain-BlockChain.html#v:allUtxos"},{"display_html":"currentTime :: MonadBlockChainWithoutValidation m => m (POSIXTime, POSIXTime)","name":"currentTime","module":"Cooked.MockChain.BlockChain","link":"Cooked-MockChain-BlockChain.html#v:currentTime"},{"display_html":"waitNSlots :: MonadBlockChainWithoutValidation m => Integer -> m Slot","name":"waitNSlots","module":"Cooked.MockChain.BlockChain","link":"Cooked-MockChain-BlockChain.html#v:waitNSlots"},{"display_html":"utxosAt :: MonadBlockChainBalancing m => Address -> m [(TxOutRef, TxOut)]","name":"utxosAt","module":"Cooked.MockChain.BlockChain","link":"Cooked-MockChain-BlockChain.html#v:utxosAt"},{"display_html":"txOutByRef :: MonadBlockChainBalancing m => TxOutRef -> m (Maybe TxOut)","name":"txOutByRef","module":"Cooked.MockChain.BlockChain","link":"Cooked-MockChain-BlockChain.html#v:txOutByRef"},{"display_html":"utxosFromCardanoTx :: CardanoTx -> [(TxOutRef, TxOut)]","name":"utxosFromCardanoTx","module":"Cooked.MockChain.BlockChain","link":"Cooked-MockChain-BlockChain.html#v:utxosFromCardanoTx"},{"display_html":"txOutV2FromLedger :: TxOut -> TxOut","name":"txOutV2FromLedger","module":"Cooked.MockChain.BlockChain","link":"Cooked-MockChain-BlockChain.html#v:txOutV2FromLedger"},{"display_html":"typedDatumFromTxOutRef :: (FromData a, MonadBlockChainWithoutValidation m) => TxOutRef -> m (Maybe a)","name":"typedDatumFromTxOutRef","module":"Cooked.MockChain.BlockChain","link":"Cooked-MockChain-BlockChain.html#v:typedDatumFromTxOutRef"},{"display_html":"valueFromTxOutRef :: MonadBlockChainWithoutValidation m => TxOutRef -> m (Maybe Value)","name":"valueFromTxOutRef","module":"Cooked.MockChain.BlockChain","link":"Cooked-MockChain-BlockChain.html#v:valueFromTxOutRef"},{"display_html":"outputDatumFromTxOutRef :: MonadBlockChainWithoutValidation m => TxOutRef -> m (Maybe OutputDatum)","name":"outputDatumFromTxOutRef","module":"Cooked.MockChain.BlockChain","link":"Cooked-MockChain-BlockChain.html#v:outputDatumFromTxOutRef"},{"display_html":"datumFromTxOutRef :: MonadBlockChainWithoutValidation m => TxOutRef -> m (Maybe Datum)","name":"datumFromTxOutRef","module":"Cooked.MockChain.BlockChain","link":"Cooked-MockChain-BlockChain.html#v:datumFromTxOutRef"},{"display_html":"resolveDatum :: (IsAbstractOutput out, ToOutputDatum (DatumType out), MonadBlockChainBalancing m) => out -> m (Maybe (ConcreteOutput (OwnerType out) Datum (ValueType out) (ReferenceScriptType out)))","name":"resolveDatum","module":"Cooked.MockChain.BlockChain","link":"Cooked-MockChain-BlockChain.html#v:resolveDatum"},{"display_html":"resolveTypedDatum :: (IsAbstractOutput out, ToOutputDatum (DatumType out), MonadBlockChainBalancing m, FromData a) => out -> m (Maybe (ConcreteOutput (OwnerType out) a (ValueType out) (ReferenceScriptType out)))","name":"resolveTypedDatum","module":"Cooked.MockChain.BlockChain","link":"Cooked-MockChain-BlockChain.html#v:resolveTypedDatum"},{"display_html":"resolveValidator :: (IsAbstractOutput out, ToCredential (OwnerType out), MonadBlockChainBalancing m) => out -> m (Maybe (ConcreteOutput (Versioned Validator) (DatumType out) (ValueType out) (ReferenceScriptType out)))","name":"resolveValidator","module":"Cooked.MockChain.BlockChain","link":"Cooked-MockChain-BlockChain.html#v:resolveValidator"},{"display_html":"resolveReferenceScript :: (IsAbstractOutput out, ToScriptHash (ReferenceScriptType out), MonadBlockChainBalancing m) => out -> m (Maybe (ConcreteOutput (OwnerType out) (DatumType out) (ValueType out) (Versioned Validator)))","name":"resolveReferenceScript","module":"Cooked.MockChain.BlockChain","link":"Cooked-MockChain-BlockChain.html#v:resolveReferenceScript"},{"display_html":"getEnclosingSlot :: MonadBlockChainWithoutValidation m => POSIXTime -> m Slot","name":"getEnclosingSlot","module":"Cooked.MockChain.BlockChain","link":"Cooked-MockChain-BlockChain.html#v:getEnclosingSlot"},{"display_html":"awaitEnclosingSlot :: MonadBlockChainWithoutValidation m => POSIXTime -> m Slot","name":"awaitEnclosingSlot","module":"Cooked.MockChain.BlockChain","link":"Cooked-MockChain-BlockChain.html#v:awaitEnclosingSlot"},{"display_html":"slotRangeBefore :: MonadBlockChainWithoutValidation m => POSIXTime -> m SlotRange","name":"slotRangeBefore","module":"Cooked.MockChain.BlockChain","link":"Cooked-MockChain-BlockChain.html#v:slotRangeBefore"},{"display_html":"slotRangeAfter :: MonadBlockChainWithoutValidation m => POSIXTime -> m SlotRange","name":"slotRangeAfter","module":"Cooked.MockChain.BlockChain","link":"Cooked-MockChain-BlockChain.html#v:slotRangeAfter"},{"display_html":"slotToTimeInterval :: MonadBlockChainWithoutValidation m => Slot -> m (POSIXTime, POSIXTime)","name":"slotToTimeInterval","module":"Cooked.MockChain.BlockChain","link":"Cooked-MockChain-BlockChain.html#v:slotToTimeInterval"},{"display_html":"runTweakInChain :: (MonadBlockChainWithoutValidation m, MonadPlus m) => Tweak m a -> TxSkel -> m (a, TxSkel)","name":"runTweakInChain","module":"Cooked.Tweak.Common","link":"Cooked-Tweak-Common.html#v:runTweakInChain"},{"display_html":"runTweakInChain' :: MonadBlockChainWithoutValidation m => Tweak m a -> TxSkel -> m [(a, TxSkel)]","name":"runTweakInChain'","module":"Cooked.Tweak.Common","link":"Cooked-Tweak-Common.html#v:runTweakInChain-39-"},{"display_html":"type Tweak m = StateT TxSkel (ListT m)","name":"Tweak","module":"Cooked.Tweak.Common","link":"Cooked-Tweak-Common.html#t:Tweak"},{"display_html":"data UntypedTweak m where","name":"UntypedTweak UntypedTweak","module":"Cooked.Tweak.Common","link":"Cooked-Tweak-Common.html#t:UntypedTweak"},{"display_html":"class (MonadPlus m, MonadBlockChainWithoutValidation m) => MonadTweak m where","name":"MonadTweak getTxSkel putTxSkel","module":"Cooked.Tweak.Common","link":"Cooked-Tweak-Common.html#t:MonadTweak"},{"display_html":"failingTweak :: MonadTweak m => m a","name":"failingTweak","module":"Cooked.Tweak.Common","link":"Cooked-Tweak-Common.html#v:failingTweak"},{"display_html":"doNothingTweak :: MonadTweak m => m ()","name":"doNothingTweak","module":"Cooked.Tweak.Common","link":"Cooked-Tweak-Common.html#v:doNothingTweak"},{"display_html":"viewTweak :: (MonadTweak m, Is k A_Getter) => Optic' k is TxSkel a -> m a","name":"viewTweak","module":"Cooked.Tweak.Common","link":"Cooked-Tweak-Common.html#v:viewTweak"},{"display_html":"viewAllTweak :: (MonadTweak m, Is k A_Fold) => Optic' k is TxSkel a -> m [a]","name":"viewAllTweak","module":"Cooked.Tweak.Common","link":"Cooked-Tweak-Common.html#v:viewAllTweak"},{"display_html":"setTweak :: (MonadTweak m, Is k A_Setter) => Optic' k is TxSkel a -> a -> m ()","name":"setTweak","module":"Cooked.Tweak.Common","link":"Cooked-Tweak-Common.html#v:setTweak"},{"display_html":"overTweak :: (MonadTweak m, Is k A_Setter) => Optic' k is TxSkel a -> (a -> a) -> m ()","name":"overTweak","module":"Cooked.Tweak.Common","link":"Cooked-Tweak-Common.html#v:overTweak"},{"display_html":"overMaybeTweak :: (MonadTweak m, Is k A_Traversal) => Optic' k is TxSkel a -> (a -> Maybe a) -> m [a]","name":"overMaybeTweak","module":"Cooked.Tweak.Common","link":"Cooked-Tweak-Common.html#v:overMaybeTweak"},{"display_html":"overMaybeSelectingTweak :: forall a m k is. (MonadTweak m, Is k A_Traversal) => Optic' k is TxSkel a -> (a -> Maybe a) -> (Integer -> Bool) -> m [a]","name":"overMaybeSelectingTweak","module":"Cooked.Tweak.Common","link":"Cooked-Tweak-Common.html#v:overMaybeSelectingTweak"},{"display_html":"selectP :: (a -> Bool) -> Prism' a a","name":"selectP","module":"Cooked.Tweak.Common","link":"Cooked-Tweak-Common.html#v:selectP"},{"display_html":"combineModsTweak :: (Eq is, Is k A_Traversal, MonadTweak m) => ([is] -> [[is]]) -> Optic' k (WithIx is) TxSkel x -> (is -> x -> m [(x, l)]) -> m [l]","name":"combineModsTweak","module":"Cooked.Tweak.Common","link":"Cooked-Tweak-Common.html#v:combineModsTweak"},{"display_html":"iviewTweak :: (MonadTweak m, Is k A_Getter) => Optic' k (WithIx is) TxSkel a -> m (is, a)","name":"iviewTweak","module":"Cooked.Tweak.Common","link":"Cooked-Tweak-Common.html#v:iviewTweak"},{"display_html":"getSignersTweak :: MonadTweak m => m [Wallet]","name":"getSignersTweak","module":"Cooked.Tweak.Signers","link":"Cooked-Tweak-Signers.html#v:getSignersTweak"},{"display_html":"modifySignersTweak :: MonadTweak m => ([Wallet] -> [Wallet]) -> m [Wallet]","name":"modifySignersTweak","module":"Cooked.Tweak.Signers","link":"Cooked-Tweak-Signers.html#v:modifySignersTweak"},{"display_html":"setSignersTweak :: MonadTweak m => [Wallet] -> m [Wallet]","name":"setSignersTweak","module":"Cooked.Tweak.Signers","link":"Cooked-Tweak-Signers.html#v:setSignersTweak"},{"display_html":"signersSatisfyTweak :: MonadTweak m => ([Wallet] -> Bool) -> m Bool","name":"signersSatisfyTweak","module":"Cooked.Tweak.Signers","link":"Cooked-Tweak-Signers.html#v:signersSatisfyTweak"},{"display_html":"isSignerTweak :: MonadTweak m => Wallet -> m Bool","name":"isSignerTweak","module":"Cooked.Tweak.Signers","link":"Cooked-Tweak-Signers.html#v:isSignerTweak"},{"display_html":"hasSignersTweak :: MonadTweak m => m Bool","name":"hasSignersTweak","module":"Cooked.Tweak.Signers","link":"Cooked-Tweak-Signers.html#v:hasSignersTweak"},{"display_html":"addFirstSignerTweak :: MonadTweak m => Wallet -> m [Wallet]","name":"addFirstSignerTweak","module":"Cooked.Tweak.Signers","link":"Cooked-Tweak-Signers.html#v:addFirstSignerTweak"},{"display_html":"addSignersTweak :: MonadTweak m => [Wallet] -> m [Wallet]","name":"addSignersTweak","module":"Cooked.Tweak.Signers","link":"Cooked-Tweak-Signers.html#v:addSignersTweak"},{"display_html":"addLastSignerTweak :: MonadTweak m => Wallet -> m [Wallet]","name":"addLastSignerTweak","module":"Cooked.Tweak.Signers","link":"Cooked-Tweak-Signers.html#v:addLastSignerTweak"},{"display_html":"removeSignersTweak :: MonadTweak m => [Wallet] -> m [Wallet]","name":"removeSignersTweak","module":"Cooked.Tweak.Signers","link":"Cooked-Tweak-Signers.html#v:removeSignersTweak"},{"display_html":"removeSignerTweak :: MonadTweak m => Wallet -> m [Wallet]","name":"removeSignerTweak","module":"Cooked.Tweak.Signers","link":"Cooked-Tweak-Signers.html#v:removeSignerTweak"},{"display_html":"replaceFirstSignerTweak :: MonadTweak m => Wallet -> m [Wallet]","name":"replaceFirstSignerTweak","module":"Cooked.Tweak.Signers","link":"Cooked-Tweak-Signers.html#v:replaceFirstSignerTweak"},{"display_html":"data PermutOutTweakMode","name":"PermutOutTweakMode KeepIdentity OmitIdentity","module":"Cooked.Tweak.OutPermutations","link":"Cooked-Tweak-OutPermutations.html#t:PermutOutTweakMode"},{"display_html":"allOutPermutsTweak :: MonadTweak m => PermutOutTweakMode -> m ()","name":"allOutPermutsTweak","module":"Cooked.Tweak.OutPermutations","link":"Cooked-Tweak-OutPermutations.html#v:allOutPermutsTweak"},{"display_html":"singleOutPermutTweak :: MonadTweak m => Int -> m ()","name":"singleOutPermutTweak","module":"Cooked.Tweak.OutPermutations","link":"Cooked-Tweak-OutPermutations.html#v:singleOutPermutTweak"},{"display_html":"distinctPermutations :: Eq a => [a] -> [[a]]","name":"distinctPermutations","module":"Cooked.Tweak.OutPermutations","link":"Cooked-Tweak-OutPermutations.html#v:distinctPermutations"},{"display_html":"addLabelTweak :: (MonadTweak m, LabelConstrs x) => x -> m ()","name":"addLabelTweak","module":"Cooked.Tweak.Labels","link":"Cooked-Tweak-Labels.html#v:addLabelTweak"},{"display_html":"removeLabelTweak :: (MonadTweak m, LabelConstrs x) => x -> m ()","name":"removeLabelTweak","module":"Cooked.Tweak.Labels","link":"Cooked-Tweak-Labels.html#v:removeLabelTweak"},{"display_html":"hasLabelTweak :: (MonadTweak m, LabelConstrs x) => x -> m Bool","name":"hasLabelTweak","module":"Cooked.Tweak.Labels","link":"Cooked-Tweak-Labels.html#v:hasLabelTweak"},{"display_html":"tamperDatumTweak :: forall a m. (MonadTweak m, Show a, PrettyCooked a, ToData a, FromData a, Typeable a) => (a -> Maybe a) -> m [a]","name":"tamperDatumTweak","module":"Cooked.Tweak.TamperDatum","link":"Cooked-Tweak-TamperDatum.html#v:tamperDatumTweak"},{"display_html":"data TamperDatumLbl = TamperDatumLbl","name":"TamperDatumLbl TamperDatumLbl","module":"Cooked.Tweak.TamperDatum","link":"Cooked-Tweak-TamperDatum.html#t:TamperDatumLbl"},{"display_html":"malformDatumTweak :: forall a m. (MonadTweak m, ToData a, FromData a, Typeable a) => (a -> [BuiltinData]) -> m ()","name":"malformDatumTweak","module":"Cooked.Tweak.TamperDatum","link":"Cooked-Tweak-TamperDatum.html#v:malformDatumTweak"},{"display_html":"data MalformDatumLbl = MalformDatumLbl","name":"MalformDatumLbl MalformDatumLbl","module":"Cooked.Tweak.TamperDatum","link":"Cooked-Tweak-TamperDatum.html#t:MalformDatumLbl"},{"display_html":"ensureInputTweak :: MonadTweak m => TxOutRef -> TxSkelRedeemer -> m (Maybe (TxOutRef, TxSkelRedeemer))","name":"ensureInputTweak","module":"Cooked.Tweak.AddInputsAndOutputs","link":"Cooked-Tweak-AddInputsAndOutputs.html#v:ensureInputTweak"},{"display_html":"addInputTweak :: MonadTweak m => TxOutRef -> TxSkelRedeemer -> m ()","name":"addInputTweak","module":"Cooked.Tweak.AddInputsAndOutputs","link":"Cooked-Tweak-AddInputsAndOutputs.html#v:addInputTweak"},{"display_html":"removeInputTweak :: MonadTweak m => (TxOutRef -> TxSkelRedeemer -> Bool) -> m [(TxOutRef, TxSkelRedeemer)]","name":"removeInputTweak","module":"Cooked.Tweak.AddInputsAndOutputs","link":"Cooked-Tweak-AddInputsAndOutputs.html#v:removeInputTweak"},{"display_html":"ensureOutputTweak :: MonadTweak m => TxSkelOut -> m (Maybe TxSkelOut)","name":"ensureOutputTweak","module":"Cooked.Tweak.AddInputsAndOutputs","link":"Cooked-Tweak-AddInputsAndOutputs.html#v:ensureOutputTweak"},{"display_html":"addOutputTweak :: MonadTweak m => TxSkelOut -> m ()","name":"addOutputTweak","module":"Cooked.Tweak.AddInputsAndOutputs","link":"Cooked-Tweak-AddInputsAndOutputs.html#v:addOutputTweak"},{"display_html":"removeOutputTweak :: MonadTweak m => (TxSkelOut -> Bool) -> m [TxSkelOut]","name":"removeOutputTweak","module":"Cooked.Tweak.AddInputsAndOutputs","link":"Cooked-Tweak-AddInputsAndOutputs.html#v:removeOutputTweak"},{"display_html":"addMintTweak :: MonadTweak m => (Versioned MintingPolicy, MintsRedeemer, TokenName, Integer) -> m ()","name":"addMintTweak","module":"Cooked.Tweak.AddInputsAndOutputs","link":"Cooked-Tweak-AddInputsAndOutputs.html#v:addMintTweak"},{"display_html":"removeMintTweak :: MonadTweak m => ((Versioned MintingPolicy, MintsRedeemer, TokenName, Integer) -> Bool) -> m [(Versioned MintingPolicy, MintsRedeemer, TokenName, Integer)]","name":"removeMintTweak","module":"Cooked.Tweak.AddInputsAndOutputs","link":"Cooked-Tweak-AddInputsAndOutputs.html#v:removeMintTweak"},{"display_html":"runUtxoSearch :: Monad m => UtxoSearch m a -> m [(TxOutRef, a)]","name":"runUtxoSearch","module":"Cooked.MockChain.UtxoSearch","link":"Cooked-MockChain-UtxoSearch.html#v:runUtxoSearch"},{"display_html":"allUtxosSearch :: MonadBlockChain m => UtxoSearch m TxOut","name":"allUtxosSearch","module":"Cooked.MockChain.UtxoSearch","link":"Cooked-MockChain-UtxoSearch.html#v:allUtxosSearch"},{"display_html":"allUtxosLedgerSearch :: MonadBlockChain m => UtxoSearch m TxOut","name":"allUtxosLedgerSearch","module":"Cooked.MockChain.UtxoSearch","link":"Cooked-MockChain-UtxoSearch.html#v:allUtxosLedgerSearch"},{"display_html":"utxosAtSearch :: MonadBlockChainBalancing m => Address -> UtxoSearch m TxOut","name":"utxosAtSearch","module":"Cooked.MockChain.UtxoSearch","link":"Cooked-MockChain-UtxoSearch.html#v:utxosAtSearch"},{"display_html":"utxosAtLedgerSearch :: MonadBlockChainBalancing m => Address -> UtxoSearch m TxOut","name":"utxosAtLedgerSearch","module":"Cooked.MockChain.UtxoSearch","link":"Cooked-MockChain-UtxoSearch.html#v:utxosAtLedgerSearch"},{"display_html":"utxosFromCardanoTxSearch :: Monad m => CardanoTx -> UtxoSearch m TxOut","name":"utxosFromCardanoTxSearch","module":"Cooked.MockChain.UtxoSearch","link":"Cooked-MockChain-UtxoSearch.html#v:utxosFromCardanoTxSearch"},{"display_html":"txOutByRefSearch :: MonadBlockChainBalancing m => [TxOutRef] -> UtxoSearch m TxOut","name":"txOutByRefSearch","module":"Cooked.MockChain.UtxoSearch","link":"Cooked-MockChain-UtxoSearch.html#v:txOutByRefSearch"},{"display_html":"filterWith :: Monad m => UtxoSearch m a -> (a -> m (Maybe b)) -> UtxoSearch m b","name":"filterWith","module":"Cooked.MockChain.UtxoSearch","link":"Cooked-MockChain-UtxoSearch.html#v:filterWith"},{"display_html":"filterWithPure :: Monad m => UtxoSearch m a -> (a -> Maybe b) -> UtxoSearch m b","name":"filterWithPure","module":"Cooked.MockChain.UtxoSearch","link":"Cooked-MockChain-UtxoSearch.html#v:filterWithPure"},{"display_html":"filterWithOptic :: (Is k An_AffineFold, Monad m) => UtxoSearch m a -> Optic' k is a b -> UtxoSearch m b","name":"filterWithOptic","module":"Cooked.MockChain.UtxoSearch","link":"Cooked-MockChain-UtxoSearch.html#v:filterWithOptic"},{"display_html":"filterWithPred :: Monad m => UtxoSearch m a -> (a -> Bool) -> UtxoSearch m a","name":"filterWithPred","module":"Cooked.MockChain.UtxoSearch","link":"Cooked-MockChain-UtxoSearch.html#v:filterWithPred"},{"display_html":"filterWithValuePred :: Monad m => UtxoSearch m TxOut -> (Value -> Bool) -> UtxoSearch m Value","name":"filterWithValuePred","module":"Cooked.MockChain.UtxoSearch","link":"Cooked-MockChain-UtxoSearch.html#v:filterWithValuePred"},{"display_html":"filterWithOnlyAda :: Monad m => UtxoSearch m TxOut -> UtxoSearch m Value","name":"filterWithOnlyAda","module":"Cooked.MockChain.UtxoSearch","link":"Cooked-MockChain-UtxoSearch.html#v:filterWithOnlyAda"},{"display_html":"filterWithNotOnlyAda :: Monad m => UtxoSearch m TxOut -> UtxoSearch m Value","name":"filterWithNotOnlyAda","module":"Cooked.MockChain.UtxoSearch","link":"Cooked-MockChain-UtxoSearch.html#v:filterWithNotOnlyAda"},{"display_html":"balancedTxSkel :: MonadBlockChainBalancing m => TxSkel -> m (TxSkel, Fee, Set TxOutRef)","name":"balancedTxSkel","module":"Cooked.MockChain.Balancing","link":"Cooked-MockChain-Balancing.html#v:balancedTxSkel"},{"display_html":"balancedTx :: MonadBlockChainBalancing m => (TxSkel, Fee, Set TxOutRef) -> m (Tx BabbageEra)","name":"balancedTx","module":"Cooked.MockChain.Balancing","link":"Cooked-MockChain-Balancing.html#v:balancedTx"},{"display_html":"txSkelInputData :: MonadBlockChainBalancing m => TxSkel -> m (Map DatumHash Datum)","name":"txSkelInputData","module":"Cooked.MockChain.Balancing","link":"Cooked-MockChain-Balancing.html#v:txSkelInputData"},{"display_html":"mcstToUtxoState :: MockChainSt -> UtxoState","name":"mcstToUtxoState","module":"Cooked.MockChain.Direct","link":"Cooked-MockChain-Direct.html#v:mcstToUtxoState"},{"display_html":"data MockChainSt = MockChainSt {}","name":"MockChainSt MockChainSt mcstCurrentSlot mcstValidators mcstDatums mcstIndex","module":"Cooked.MockChain.Direct","link":"Cooked-MockChain-Direct.html#t:MockChainSt"},{"display_html":"newtype MockChainEnv = MockChainEnv {}","name":"MockChainEnv MockChainEnv mceParams","module":"Cooked.MockChain.Direct","link":"Cooked-MockChain-Direct.html#t:MockChainEnv"},{"display_html":"newtype MockChainT m a = MockChainT {}","name":"MockChainT MockChainT unMockChain","module":"Cooked.MockChain.Direct","link":"Cooked-MockChain-Direct.html#t:MockChainT"},{"display_html":"type MockChain = MockChainT Identity","name":"MockChain","module":"Cooked.MockChain.Direct","link":"Cooked-MockChain-Direct.html#t:MockChain"},{"display_html":"combineMockChainT :: Monad m => (forall a. m a -> m a -> m a) -> MockChainT m x -> MockChainT m x -> MockChainT m x","name":"combineMockChainT","module":"Cooked.MockChain.Direct","link":"Cooked-MockChain-Direct.html#v:combineMockChainT"},{"display_html":"mapMockChainT :: (m (Either MockChainError (a, MockChainSt)) -> n (Either MockChainError (b, MockChainSt))) -> MockChainT m a -> MockChainT n b","name":"mapMockChainT","module":"Cooked.MockChain.Direct","link":"Cooked-MockChain-Direct.html#v:mapMockChainT"},{"display_html":"runMockChainTRaw :: Monad m => MockChainEnv -> MockChainSt -> MockChainT m a -> m (Either MockChainError (a, MockChainSt))","name":"runMockChainTRaw","module":"Cooked.MockChain.Direct","link":"Cooked-MockChain-Direct.html#v:runMockChainTRaw"},{"display_html":"runMockChainTFrom :: Monad m => InitialDistribution -> MockChainT m a -> m (Either MockChainError (a, UtxoState))","name":"runMockChainTFrom","module":"Cooked.MockChain.Direct","link":"Cooked-MockChain-Direct.html#v:runMockChainTFrom"},{"display_html":"runMockChainT :: Monad m => MockChainT m a -> m (Either MockChainError (a, UtxoState))","name":"runMockChainT","module":"Cooked.MockChain.Direct","link":"Cooked-MockChain-Direct.html#v:runMockChainT"},{"display_html":"runMockChainRaw :: MockChainEnv -> MockChainSt -> MockChain a -> Either MockChainError (a, MockChainSt)","name":"runMockChainRaw","module":"Cooked.MockChain.Direct","link":"Cooked-MockChain-Direct.html#v:runMockChainRaw"},{"display_html":"runMockChainFrom :: InitialDistribution -> MockChain a -> Either MockChainError (a, UtxoState)","name":"runMockChainFrom","module":"Cooked.MockChain.Direct","link":"Cooked-MockChain-Direct.html#v:runMockChainFrom"},{"display_html":"runMockChain :: MockChain a -> Either MockChainError (a, UtxoState)","name":"runMockChain","module":"Cooked.MockChain.Direct","link":"Cooked-MockChain-Direct.html#v:runMockChain"},{"display_html":"utxoState0 :: UtxoState","name":"utxoState0","module":"Cooked.MockChain.Direct","link":"Cooked-MockChain-Direct.html#v:utxoState0"},{"display_html":"mockChainSt0 :: MockChainSt","name":"mockChainSt0","module":"Cooked.MockChain.Direct","link":"Cooked-MockChain-Direct.html#v:mockChainSt0"},{"display_html":"mockChainSt0From :: InitialDistribution -> MockChainSt","name":"mockChainSt0From","module":"Cooked.MockChain.Direct","link":"Cooked-MockChain-Direct.html#v:mockChainSt0From"},{"display_html":"utxoIndex0From :: InitialDistribution -> UtxoIndex","name":"utxoIndex0From","module":"Cooked.MockChain.Direct","link":"Cooked-MockChain-Direct.html#v:utxoIndex0From"},{"display_html":"utxoIndex0 :: UtxoIndex","name":"utxoIndex0","module":"Cooked.MockChain.Direct","link":"Cooked-MockChain-Direct.html#v:utxoIndex0"},{"display_html":"getIndex :: UtxoIndex -> Map TxOutRef TxOut","name":"getIndex","module":"Cooked.MockChain.Direct","link":"Cooked-MockChain-Direct.html#v:getIndex"},{"display_html":"runTransactionValidation :: Monad m => Params -> Tx BabbageEra -> [RawModTx] -> Map DatumHash Datum -> Map DatumHash TxSkelOutDatum -> Map ValidatorHash (Versioned Validator) -> MockChainT m CardanoTx","name":"runTransactionValidation","module":"Cooked.MockChain.Direct","link":"Cooked-MockChain-Direct.html#v:runTransactionValidation"},{"display_html":"interpretAndRunWith :: (forall m. Monad m => MockChainT m a -> m res) -> StagedMockChain a -> [(res, MockChainLog)]","name":"interpretAndRunWith","module":"Cooked.MockChain.Staged","link":"Cooked-MockChain-Staged.html#v:interpretAndRunWith"},{"display_html":"interpretAndRun :: StagedMockChain a -> [(Either MockChainError (a, UtxoState), MockChainLog)]","name":"interpretAndRun","module":"Cooked.MockChain.Staged","link":"Cooked-MockChain-Staged.html#v:interpretAndRun"},{"display_html":"data MockChainLogEntry","name":"MockChainLogEntry MCLogSubmittedTxSkel MCLogNewTx MCLogFail","module":"Cooked.MockChain.Staged","link":"Cooked-MockChain-Staged.html#t:MockChainLogEntry"},{"display_html":"newtype MockChainLog = MockChainLog {}","name":"MockChainLog MockChainLog unMockChainLog","module":"Cooked.MockChain.Staged","link":"Cooked-MockChain-Staged.html#t:MockChainLog"},{"display_html":"type StagedMockChain = Staged MockChainOp","name":"StagedMockChain","module":"Cooked.MockChain.Staged","link":"Cooked-MockChain-Staged.html#t:StagedMockChain"},{"display_html":"runTweakFrom :: MockChainEnv -> MockChainSt -> Tweak InterpMockChain a -> TxSkel -> [Either MockChainError (a, TxSkel)]","name":"runTweakFrom","module":"Cooked.MockChain.Staged","link":"Cooked-MockChain-Staged.html#v:runTweakFrom"},{"display_html":"type MonadModalBlockChain m = (MonadBlockChain m, MonadModal m, Modification m ~ UntypedTweak InterpMockChain)","name":"MonadModalBlockChain","module":"Cooked.MockChain.Staged","link":"Cooked-MockChain-Staged.html#t:MonadModalBlockChain"},{"display_html":"somewhere :: MonadModalBlockChain m => Tweak InterpMockChain b -> m a -> m a","name":"somewhere","module":"Cooked.MockChain.Staged","link":"Cooked-MockChain-Staged.html#v:somewhere"},{"display_html":"runTweak :: Tweak InterpMockChain a -> TxSkel -> [Either MockChainError (a, TxSkel)]","name":"runTweak","module":"Cooked.MockChain.Staged","link":"Cooked-MockChain-Staged.html#v:runTweak"},{"display_html":"everywhere :: MonadModalBlockChain m => Tweak InterpMockChain b -> m a -> m a","name":"everywhere","module":"Cooked.MockChain.Staged","link":"Cooked-MockChain-Staged.html#v:everywhere"},{"display_html":"withTweak :: MonadModalBlockChain m => m x -> Tweak InterpMockChain a -> m x","name":"withTweak","module":"Cooked.MockChain.Staged","link":"Cooked-MockChain-Staged.html#v:withTweak"},{"display_html":"there :: MonadModalBlockChain m => Integer -> Tweak InterpMockChain b -> m a -> m a","name":"there","module":"Cooked.MockChain.Staged","link":"Cooked-MockChain-Staged.html#v:there"},{"display_html":"prettyTxSkel :: PrettyCookedOpts -> SkelContext -> TxSkel -> DocCooked","name":"prettyTxSkel","module":"Cooked.Pretty.Cooked","link":"Cooked-Pretty-Cooked.html#v:prettyTxSkel"},{"display_html":"prettyBalancingWallet :: PrettyCookedOpts -> Wallet -> DocCooked","name":"prettyBalancingWallet","module":"Cooked.Pretty.Cooked","link":"Cooked-Pretty-Cooked.html#v:prettyBalancingWallet"},{"display_html":"prettySigners :: PrettyCookedOpts -> TxOpts -> [Wallet] -> [DocCooked]","name":"prettySigners","module":"Cooked.Pretty.Cooked","link":"Cooked-Pretty-Cooked.html#v:prettySigners"},{"display_html":"prettyMints :: PrettyCookedOpts -> (Versioned MintingPolicy, MintsRedeemer, TokenName, Integer) -> DocCooked","name":"prettyMints","module":"Cooked.Pretty.Cooked","link":"Cooked-Pretty-Cooked.html#v:prettyMints"},{"display_html":"mPrettyTxOpts :: PrettyCookedOpts -> TxOpts -> Maybe DocCooked","name":"mPrettyTxOpts","module":"Cooked.Pretty.Cooked","link":"Cooked-Pretty-Cooked.html#v:mPrettyTxOpts"},{"display_html":"prettyTxSkelOut :: PrettyCookedOpts -> TxSkelOut -> DocCooked","name":"prettyTxSkelOut","module":"Cooked.Pretty.Cooked","link":"Cooked-Pretty-Cooked.html#v:prettyTxSkelOut"},{"display_html":"prettyTxSkelOutDatumMaybe :: PrettyCookedOpts -> TxSkelOutDatum -> Maybe DocCooked","name":"prettyTxSkelOutDatumMaybe","module":"Cooked.Pretty.Cooked","link":"Cooked-Pretty-Cooked.html#v:prettyTxSkelOutDatumMaybe"},{"display_html":"prettyTxSkelIn :: PrettyCookedOpts -> SkelContext -> (TxOutRef, TxSkelRedeemer) -> DocCooked","name":"prettyTxSkelIn","module":"Cooked.Pretty.Cooked","link":"Cooked-Pretty-Cooked.html#v:prettyTxSkelIn"},{"display_html":"prettyTxSkelInReference :: PrettyCookedOpts -> SkelContext -> TxOutRef -> Maybe DocCooked","name":"prettyTxSkelInReference","module":"Cooked.Pretty.Cooked","link":"Cooked-Pretty-Cooked.html#v:prettyTxSkelInReference"},{"display_html":"prettyAddressState :: PrettyCookedOpts -> Address -> UtxoPayloadSet -> DocCooked","name":"prettyAddressState","module":"Cooked.Pretty.Cooked","link":"Cooked-Pretty-Cooked.html#v:prettyAddressState"},{"display_html":"prettyPayloadGrouped :: PrettyCookedOpts -> [UtxoPayload] -> Maybe DocCooked","name":"prettyPayloadGrouped","module":"Cooked.Pretty.Cooked","link":"Cooked-Pretty-Cooked.html#v:prettyPayloadGrouped"},{"display_html":"prettyPayload :: PrettyCookedOpts -> Bool -> UtxoPayload -> Maybe DocCooked","name":"prettyPayload","module":"Cooked.Pretty.Cooked","link":"Cooked-Pretty-Cooked.html#v:prettyPayload"},{"display_html":"prettyReferenceScriptHash :: PrettyCookedOpts -> ScriptHash -> DocCooked","name":"prettyReferenceScriptHash","module":"Cooked.Pretty.Cooked","link":"Cooked-Pretty-Cooked.html#v:prettyReferenceScriptHash"},{"display_html":"module Cooked.Pretty.Options","name":"","module":"Cooked.Pretty","link":""},{"display_html":"module Cooked.Pretty.Cooked","name":"","module":"Cooked.Pretty","link":""},{"display_html":"module Cooked.Pretty.Common","name":"","module":"Cooked.Pretty","link":""},{"display_html":"module Cooked.Pretty.Class","name":"","module":"Cooked.Pretty","link":""},{"display_html":"class IsProp prop where","name":"IsProp testFailureMsg testSuccess testFailure testDisjoin testConjoin testCounterexample","module":"Cooked.MockChain.Testing","link":"Cooked-MockChain-Testing.html#t:IsProp"},{"display_html":"testBool :: IsProp prop => Bool -> prop","name":"testBool","module":"Cooked.MockChain.Testing","link":"Cooked-MockChain-Testing.html#v:testBool"},{"display_html":"testAll :: IsProp prop => (a -> prop) -> [a] -> prop","name":"testAll","module":"Cooked.MockChain.Testing","link":"Cooked-MockChain-Testing.html#v:testAll"},{"display_html":"(.==.) :: (IsProp prop, Eq a) => a -> a -> prop","name":".==.","module":"Cooked.MockChain.Testing","link":"Cooked-MockChain-Testing.html#v:.-61--61-."},{"display_html":"(.&&.) :: IsProp prop => prop -> prop -> prop","name":".&&.","module":"Cooked.MockChain.Testing","link":"Cooked-MockChain-Testing.html#v:.-38--38-."},{"display_html":"(.||.) :: IsProp prop => prop -> prop -> prop","name":".||.","module":"Cooked.MockChain.Testing","link":"Cooked-MockChain-Testing.html#v:.-124--124-."},{"display_html":"testSucceeds :: IsProp prop => PrettyCookedOpts -> StagedMockChain a -> prop","name":"testSucceeds","module":"Cooked.MockChain.Testing","link":"Cooked-MockChain-Testing.html#v:testSucceeds"},{"display_html":"testFails :: (IsProp prop, Show a) => PrettyCookedOpts -> (MockChainError -> prop) -> StagedMockChain a -> prop","name":"testFails","module":"Cooked.MockChain.Testing","link":"Cooked-MockChain-Testing.html#v:testFails"},{"display_html":"testSucceedsFrom :: IsProp prop => PrettyCookedOpts -> InitialDistribution -> StagedMockChain a -> prop","name":"testSucceedsFrom","module":"Cooked.MockChain.Testing","link":"Cooked-MockChain-Testing.html#v:testSucceedsFrom"},{"display_html":"testSucceedsFrom' :: IsProp prop => PrettyCookedOpts -> (a -> UtxoState -> prop) -> InitialDistribution -> StagedMockChain a -> prop","name":"testSucceedsFrom'","module":"Cooked.MockChain.Testing","link":"Cooked-MockChain-Testing.html#v:testSucceedsFrom-39-"},{"display_html":"testFailsFrom :: (IsProp prop, Show a) => PrettyCookedOpts -> (MockChainError -> prop) -> InitialDistribution -> StagedMockChain a -> prop","name":"testFailsFrom","module":"Cooked.MockChain.Testing","link":"Cooked-MockChain-Testing.html#v:testFailsFrom"},{"display_html":"isCekEvaluationFailure :: IsProp prop => PrettyCookedOpts -> MockChainError -> prop","name":"isCekEvaluationFailure","module":"Cooked.MockChain.Testing","link":"Cooked-MockChain-Testing.html#v:isCekEvaluationFailure"},{"display_html":"isCekEvaluationFailureWithMsg :: IsProp prop => PrettyCookedOpts -> (String -> Bool) -> MockChainError -> prop","name":"isCekEvaluationFailureWithMsg","module":"Cooked.MockChain.Testing","link":"Cooked-MockChain-Testing.html#v:isCekEvaluationFailureWithMsg"},{"display_html":"testAllSatisfiesFrom :: forall prop a. IsProp prop => PrettyCookedOpts -> (Either MockChainError (a, UtxoState) -> prop) -> InitialDistribution -> StagedMockChain a -> prop","name":"testAllSatisfiesFrom","module":"Cooked.MockChain.Testing","link":"Cooked-MockChain-Testing.html#v:testAllSatisfiesFrom"},{"display_html":"testBinaryRelatedBy :: IsProp prop => PrettyCookedOpts -> (UtxoState -> UtxoState -> prop) -> InitialDistribution -> StagedMockChain a -> prop","name":"testBinaryRelatedBy","module":"Cooked.MockChain.Testing","link":"Cooked-MockChain-Testing.html#v:testBinaryRelatedBy"},{"display_html":"testOneEquivClass :: IsProp prop => PrettyCookedOpts -> (UtxoState -> UtxoState -> prop) -> InitialDistribution -> StagedMockChain a -> prop","name":"testOneEquivClass","module":"Cooked.MockChain.Testing","link":"Cooked-MockChain-Testing.html#v:testOneEquivClass"},{"display_html":"testSatisfiesFrom' :: ([(Either MockChainError (a, UtxoState), MockChainLog)] -> prop) -> InitialDistribution -> StagedMockChain a -> prop","name":"testSatisfiesFrom'","module":"Cooked.MockChain.Testing","link":"Cooked-MockChain-Testing.html#v:testSatisfiesFrom-39-"},{"display_html":"assertionToMaybe :: Assertion -> IO (Maybe HUnitFailure)","name":"assertionToMaybe","module":"Cooked.MockChain.Testing","link":"Cooked-MockChain-Testing.html#v:assertionToMaybe"},{"display_html":"forAll :: Show a => Gen a -> (a -> Property) -> Property","name":"forAll","module":"Cooked.MockChain.Testing","link":"Cooked-MockChain-Testing.html#v:forAll"},{"display_html":"utxoPayloadReferenceScript :: UtxoPayload -> Maybe ScriptHash","name":"utxoPayloadReferenceScript","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:utxoPayloadReferenceScript"},{"display_html":"utxoPayloadSkelOutDatum :: UtxoPayload -> TxSkelOutDatum","name":"utxoPayloadSkelOutDatum","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:utxoPayloadSkelOutDatum"},{"display_html":"utxoPayloadTxOutRef :: UtxoPayload -> TxOutRef","name":"utxoPayloadTxOutRef","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:utxoPayloadTxOutRef"},{"display_html":"utxoPayloadValue :: UtxoPayload -> Value","name":"utxoPayloadValue","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:utxoPayloadValue"},{"display_html":"utxoPayloadSet :: UtxoPayloadSet -> [UtxoPayload]","name":"utxoPayloadSet","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:utxoPayloadSet"},{"display_html":"data UtxoState","name":"UtxoState","module":"Cooked.MockChain","link":"Cooked-MockChain.html#t:UtxoState"},{"display_html":"holdsInState :: Address -> UtxoState -> Value","name":"holdsInState","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:holdsInState"},{"display_html":"newtype AsTrans t (m :: Type -> Type) a = AsTrans {}","name":"AsTrans AsTrans getTrans","module":"Cooked.MockChain","link":"Cooked-MockChain.html#t:AsTrans"},{"display_html":"class MonadBlockChainWithoutValidation m => MonadBlockChain m where","name":"MonadBlockChain validateTxSkel","module":"Cooked.MockChain","link":"Cooked-MockChain.html#t:MonadBlockChain"},{"display_html":"class MonadBlockChainBalancing m => MonadBlockChainWithoutValidation m where","name":"MonadBlockChainWithoutValidation allUtxosLedger currentSlot awaitSlot","module":"Cooked.MockChain","link":"Cooked-MockChain.html#t:MonadBlockChainWithoutValidation"},{"display_html":"class (MonadFail m, MonadError MockChainError m) => MonadBlockChainBalancing m where","name":"MonadBlockChainBalancing txOutByRefLedger utxosAtLedger validatorFromHash getParams datumFromHash","module":"Cooked.MockChain","link":"Cooked-MockChain.html#t:MonadBlockChainBalancing"},{"display_html":"data MCEUnbalanceableError","name":"MCEUnbalanceableError MCEUnbalNotEnoughFunds MCEUnbalNotEnoughReturning","module":"Cooked.MockChain","link":"Cooked-MockChain.html#t:MCEUnbalanceableError"},{"display_html":"data MockChainError where","name":"MockChainError OtherMockChainError FailWith MCEUnknownDatum MCEUnknownValidator MCEUnknownOutRefError MCECalcFee MCEGenerationError MCENoSuitableCollateral MCEValidationError MCEUnbalanceable","module":"Cooked.MockChain","link":"Cooked-MockChain.html#t:MockChainError"},{"display_html":"allUtxos :: MonadBlockChainWithoutValidation m => m [(TxOutRef, TxOut)]","name":"allUtxos","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:allUtxos"},{"display_html":"utxosAt :: MonadBlockChainBalancing m => Address -> m [(TxOutRef, TxOut)]","name":"utxosAt","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:utxosAt"},{"display_html":"txOutByRef :: MonadBlockChainBalancing m => TxOutRef -> m (Maybe TxOut)","name":"txOutByRef","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:txOutByRef"},{"display_html":"utxosFromCardanoTx :: CardanoTx -> [(TxOutRef, TxOut)]","name":"utxosFromCardanoTx","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:utxosFromCardanoTx"},{"display_html":"txOutV2FromLedger :: TxOut -> TxOut","name":"txOutV2FromLedger","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:txOutV2FromLedger"},{"display_html":"resolveDatum :: (IsAbstractOutput out, ToOutputDatum (DatumType out), MonadBlockChainBalancing m) => out -> m (Maybe (ConcreteOutput (OwnerType out) Datum (ValueType out) (ReferenceScriptType out)))","name":"resolveDatum","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:resolveDatum"},{"display_html":"resolveTypedDatum :: (IsAbstractOutput out, ToOutputDatum (DatumType out), MonadBlockChainBalancing m, FromData a) => out -> m (Maybe (ConcreteOutput (OwnerType out) a (ValueType out) (ReferenceScriptType out)))","name":"resolveTypedDatum","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:resolveTypedDatum"},{"display_html":"resolveValidator :: (IsAbstractOutput out, ToCredential (OwnerType out), MonadBlockChainBalancing m) => out -> m (Maybe (ConcreteOutput (Versioned Validator) (DatumType out) (ValueType out) (ReferenceScriptType out)))","name":"resolveValidator","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:resolveValidator"},{"display_html":"resolveReferenceScript :: (IsAbstractOutput out, ToScriptHash (ReferenceScriptType out), MonadBlockChainBalancing m) => out -> m (Maybe (ConcreteOutput (OwnerType out) (DatumType out) (ValueType out) (Versioned Validator)))","name":"resolveReferenceScript","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:resolveReferenceScript"},{"display_html":"outputDatumFromTxOutRef :: MonadBlockChainWithoutValidation m => TxOutRef -> m (Maybe OutputDatum)","name":"outputDatumFromTxOutRef","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:outputDatumFromTxOutRef"},{"display_html":"datumFromTxOutRef :: MonadBlockChainWithoutValidation m => TxOutRef -> m (Maybe Datum)","name":"datumFromTxOutRef","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:datumFromTxOutRef"},{"display_html":"typedDatumFromTxOutRef :: (FromData a, MonadBlockChainWithoutValidation m) => TxOutRef -> m (Maybe a)","name":"typedDatumFromTxOutRef","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:typedDatumFromTxOutRef"},{"display_html":"valueFromTxOutRef :: MonadBlockChainWithoutValidation m => TxOutRef -> m (Maybe Value)","name":"valueFromTxOutRef","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:valueFromTxOutRef"},{"display_html":"waitNSlots :: MonadBlockChainWithoutValidation m => Integer -> m Slot","name":"waitNSlots","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:waitNSlots"},{"display_html":"currentTime :: MonadBlockChainWithoutValidation m => m (POSIXTime, POSIXTime)","name":"currentTime","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:currentTime"},{"display_html":"slotToTimeInterval :: MonadBlockChainWithoutValidation m => Slot -> m (POSIXTime, POSIXTime)","name":"slotToTimeInterval","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:slotToTimeInterval"},{"display_html":"getEnclosingSlot :: MonadBlockChainWithoutValidation m => POSIXTime -> m Slot","name":"getEnclosingSlot","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:getEnclosingSlot"},{"display_html":"awaitEnclosingSlot :: MonadBlockChainWithoutValidation m => POSIXTime -> m Slot","name":"awaitEnclosingSlot","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:awaitEnclosingSlot"},{"display_html":"slotRangeBefore :: MonadBlockChainWithoutValidation m => POSIXTime -> m SlotRange","name":"slotRangeBefore","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:slotRangeBefore"},{"display_html":"slotRangeAfter :: MonadBlockChainWithoutValidation m => POSIXTime -> m SlotRange","name":"slotRangeAfter","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:slotRangeAfter"},{"display_html":"runUtxoSearch :: Monad m => UtxoSearch m a -> m [(TxOutRef, a)]","name":"runUtxoSearch","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:runUtxoSearch"},{"display_html":"allUtxosSearch :: MonadBlockChain m => UtxoSearch m TxOut","name":"allUtxosSearch","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:allUtxosSearch"},{"display_html":"allUtxosLedgerSearch :: MonadBlockChain m => UtxoSearch m TxOut","name":"allUtxosLedgerSearch","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:allUtxosLedgerSearch"},{"display_html":"utxosAtSearch :: MonadBlockChainBalancing m => Address -> UtxoSearch m TxOut","name":"utxosAtSearch","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:utxosAtSearch"},{"display_html":"utxosAtLedgerSearch :: MonadBlockChainBalancing m => Address -> UtxoSearch m TxOut","name":"utxosAtLedgerSearch","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:utxosAtLedgerSearch"},{"display_html":"utxosFromCardanoTxSearch :: Monad m => CardanoTx -> UtxoSearch m TxOut","name":"utxosFromCardanoTxSearch","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:utxosFromCardanoTxSearch"},{"display_html":"txOutByRefSearch :: MonadBlockChainBalancing m => [TxOutRef] -> UtxoSearch m TxOut","name":"txOutByRefSearch","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:txOutByRefSearch"},{"display_html":"filterWith :: Monad m => UtxoSearch m a -> (a -> m (Maybe b)) -> UtxoSearch m b","name":"filterWith","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:filterWith"},{"display_html":"filterWithPure :: Monad m => UtxoSearch m a -> (a -> Maybe b) -> UtxoSearch m b","name":"filterWithPure","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:filterWithPure"},{"display_html":"filterWithOptic :: (Is k An_AffineFold, Monad m) => UtxoSearch m a -> Optic' k is a b -> UtxoSearch m b","name":"filterWithOptic","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:filterWithOptic"},{"display_html":"filterWithPred :: Monad m => UtxoSearch m a -> (a -> Bool) -> UtxoSearch m a","name":"filterWithPred","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:filterWithPred"},{"display_html":"filterWithValuePred :: Monad m => UtxoSearch m TxOut -> (Value -> Bool) -> UtxoSearch m Value","name":"filterWithValuePred","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:filterWithValuePred"},{"display_html":"filterWithOnlyAda :: Monad m => UtxoSearch m TxOut -> UtxoSearch m Value","name":"filterWithOnlyAda","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:filterWithOnlyAda"},{"display_html":"filterWithNotOnlyAda :: Monad m => UtxoSearch m TxOut -> UtxoSearch m Value","name":"filterWithNotOnlyAda","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:filterWithNotOnlyAda"},{"display_html":"balancedTxSkel :: MonadBlockChainBalancing m => TxSkel -> m (TxSkel, Fee, Set TxOutRef)","name":"balancedTxSkel","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:balancedTxSkel"},{"display_html":"balancedTx :: MonadBlockChainBalancing m => (TxSkel, Fee, Set TxOutRef) -> m (Tx BabbageEra)","name":"balancedTx","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:balancedTx"},{"display_html":"txSkelInputData :: MonadBlockChainBalancing m => TxSkel -> m (Map DatumHash Datum)","name":"txSkelInputData","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:txSkelInputData"},{"display_html":"type MockChain = MockChainT Identity","name":"MockChain","module":"Cooked.MockChain","link":"Cooked-MockChain.html#t:MockChain"},{"display_html":"newtype MockChainT m a = MockChainT {}","name":"MockChainT MockChainT unMockChain","module":"Cooked.MockChain","link":"Cooked-MockChain.html#t:MockChainT"},{"display_html":"newtype MockChainEnv = MockChainEnv {}","name":"MockChainEnv MockChainEnv mceParams","module":"Cooked.MockChain","link":"Cooked-MockChain.html#t:MockChainEnv"},{"display_html":"data MockChainSt = MockChainSt {}","name":"MockChainSt MockChainSt mcstCurrentSlot mcstValidators mcstIndex mcstDatums","module":"Cooked.MockChain","link":"Cooked-MockChain.html#t:MockChainSt"},{"display_html":"mcstToUtxoState :: MockChainSt -> UtxoState","name":"mcstToUtxoState","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:mcstToUtxoState"},{"display_html":"combineMockChainT :: Monad m => (forall a. m a -> m a -> m a) -> MockChainT m x -> MockChainT m x -> MockChainT m x","name":"combineMockChainT","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:combineMockChainT"},{"display_html":"mapMockChainT :: (m (Either MockChainError (a, MockChainSt)) -> n (Either MockChainError (b, MockChainSt))) -> MockChainT m a -> MockChainT n b","name":"mapMockChainT","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:mapMockChainT"},{"display_html":"runMockChainTRaw :: Monad m => MockChainEnv -> MockChainSt -> MockChainT m a -> m (Either MockChainError (a, MockChainSt))","name":"runMockChainTRaw","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:runMockChainTRaw"},{"display_html":"runMockChainTFrom :: Monad m => InitialDistribution -> MockChainT m a -> m (Either MockChainError (a, UtxoState))","name":"runMockChainTFrom","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:runMockChainTFrom"},{"display_html":"runMockChainT :: Monad m => MockChainT m a -> m (Either MockChainError (a, UtxoState))","name":"runMockChainT","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:runMockChainT"},{"display_html":"runMockChainRaw :: MockChainEnv -> MockChainSt -> MockChain a -> Either MockChainError (a, MockChainSt)","name":"runMockChainRaw","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:runMockChainRaw"},{"display_html":"runMockChainFrom :: InitialDistribution -> MockChain a -> Either MockChainError (a, UtxoState)","name":"runMockChainFrom","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:runMockChainFrom"},{"display_html":"runMockChain :: MockChain a -> Either MockChainError (a, UtxoState)","name":"runMockChain","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:runMockChain"},{"display_html":"utxoState0 :: UtxoState","name":"utxoState0","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:utxoState0"},{"display_html":"mockChainSt0 :: MockChainSt","name":"mockChainSt0","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:mockChainSt0"},{"display_html":"mockChainSt0From :: InitialDistribution -> MockChainSt","name":"mockChainSt0From","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:mockChainSt0From"},{"display_html":"utxoIndex0From :: InitialDistribution -> UtxoIndex","name":"utxoIndex0From","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:utxoIndex0From"},{"display_html":"utxoIndex0 :: UtxoIndex","name":"utxoIndex0","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:utxoIndex0"},{"display_html":"getIndex :: UtxoIndex -> Map TxOutRef TxOut","name":"getIndex","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:getIndex"},{"display_html":"runTransactionValidation :: Monad m => Params -> Tx BabbageEra -> [RawModTx] -> Map DatumHash Datum -> Map DatumHash TxSkelOutDatum -> Map ValidatorHash (Versioned Validator) -> MockChainT m CardanoTx","name":"runTransactionValidation","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:runTransactionValidation"},{"display_html":"type MonadModalBlockChain m = (MonadBlockChain m, MonadModal m, Modification m ~ UntypedTweak InterpMockChain)","name":"MonadModalBlockChain","module":"Cooked.MockChain","link":"Cooked-MockChain.html#t:MonadModalBlockChain"},{"display_html":"unMockChainLog :: MockChainLog -> [MockChainLogEntry]","name":"unMockChainLog","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:unMockChainLog"},{"display_html":"pattern MCLogFail :: String -> MockChainLogEntry","name":"MCLogFail","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:MCLogFail"},{"display_html":"pattern MCLogSubmittedTxSkel :: SkelContext -> TxSkel -> MockChainLogEntry","name":"MCLogSubmittedTxSkel","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:MCLogSubmittedTxSkel"},{"display_html":"pattern MCLogNewTx :: TxId -> MockChainLogEntry","name":"MCLogNewTx","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:MCLogNewTx"},{"display_html":"interpretAndRunWith :: (forall m. Monad m => MockChainT m a -> m res) -> StagedMockChain a -> [(res, MockChainLog)]","name":"interpretAndRunWith","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:interpretAndRunWith"},{"display_html":"interpretAndRun :: StagedMockChain a -> [(Either MockChainError (a, UtxoState), MockChainLog)]","name":"interpretAndRun","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:interpretAndRun"},{"display_html":"runTweak :: Tweak InterpMockChain a -> TxSkel -> [Either MockChainError (a, TxSkel)]","name":"runTweak","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:runTweak"},{"display_html":"runTweakFrom :: MockChainEnv -> MockChainSt -> Tweak InterpMockChain a -> TxSkel -> [Either MockChainError (a, TxSkel)]","name":"runTweakFrom","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:runTweakFrom"},{"display_html":"somewhere :: MonadModalBlockChain m => Tweak InterpMockChain b -> m a -> m a","name":"somewhere","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:somewhere"},{"display_html":"everywhere :: MonadModalBlockChain m => Tweak InterpMockChain b -> m a -> m a","name":"everywhere","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:everywhere"},{"display_html":"there :: MonadModalBlockChain m => Integer -> Tweak InterpMockChain b -> m a -> m a","name":"there","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:there"},{"display_html":"withTweak :: MonadModalBlockChain m => m x -> Tweak InterpMockChain a -> m x","name":"withTweak","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:withTweak"},{"display_html":"class IsProp prop where","name":"IsProp testFailureMsg testSuccess testFailure testDisjoin testCounterexample testConjoin","module":"Cooked.MockChain","link":"Cooked-MockChain.html#t:IsProp"},{"display_html":"testBool :: IsProp prop => Bool -> prop","name":"testBool","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:testBool"},{"display_html":"testAll :: IsProp prop => (a -> prop) -> [a] -> prop","name":"testAll","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:testAll"},{"display_html":"(.==.) :: (IsProp prop, Eq a) => a -> a -> prop","name":".==.","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:.-61--61-."},{"display_html":"(.&&.) :: IsProp prop => prop -> prop -> prop","name":".&&.","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:.-38--38-."},{"display_html":"(.||.) :: IsProp prop => prop -> prop -> prop","name":".||.","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:.-124--124-."},{"display_html":"testSucceeds :: IsProp prop => PrettyCookedOpts -> StagedMockChain a -> prop","name":"testSucceeds","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:testSucceeds"},{"display_html":"testFails :: (IsProp prop, Show a) => PrettyCookedOpts -> (MockChainError -> prop) -> StagedMockChain a -> prop","name":"testFails","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:testFails"},{"display_html":"testSucceedsFrom :: IsProp prop => PrettyCookedOpts -> InitialDistribution -> StagedMockChain a -> prop","name":"testSucceedsFrom","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:testSucceedsFrom"},{"display_html":"testSucceedsFrom' :: IsProp prop => PrettyCookedOpts -> (a -> UtxoState -> prop) -> InitialDistribution -> StagedMockChain a -> prop","name":"testSucceedsFrom'","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:testSucceedsFrom-39-"},{"display_html":"testFailsFrom :: (IsProp prop, Show a) => PrettyCookedOpts -> (MockChainError -> prop) -> InitialDistribution -> StagedMockChain a -> prop","name":"testFailsFrom","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:testFailsFrom"},{"display_html":"isCekEvaluationFailure :: IsProp prop => PrettyCookedOpts -> MockChainError -> prop","name":"isCekEvaluationFailure","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:isCekEvaluationFailure"},{"display_html":"isCekEvaluationFailureWithMsg :: IsProp prop => PrettyCookedOpts -> (String -> Bool) -> MockChainError -> prop","name":"isCekEvaluationFailureWithMsg","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:isCekEvaluationFailureWithMsg"},{"display_html":"testAllSatisfiesFrom :: forall prop a. IsProp prop => PrettyCookedOpts -> (Either MockChainError (a, UtxoState) -> prop) -> InitialDistribution -> StagedMockChain a -> prop","name":"testAllSatisfiesFrom","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:testAllSatisfiesFrom"},{"display_html":"testBinaryRelatedBy :: IsProp prop => PrettyCookedOpts -> (UtxoState -> UtxoState -> prop) -> InitialDistribution -> StagedMockChain a -> prop","name":"testBinaryRelatedBy","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:testBinaryRelatedBy"},{"display_html":"testOneEquivClass :: IsProp prop => PrettyCookedOpts -> (UtxoState -> UtxoState -> prop) -> InitialDistribution -> StagedMockChain a -> prop","name":"testOneEquivClass","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:testOneEquivClass"},{"display_html":"testSatisfiesFrom' :: ([(Either MockChainError (a, UtxoState), MockChainLog)] -> prop) -> InitialDistribution -> StagedMockChain a -> prop","name":"testSatisfiesFrom'","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:testSatisfiesFrom-39-"},{"display_html":"assertionToMaybe :: Assertion -> IO (Maybe HUnitFailure)","name":"assertionToMaybe","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:assertionToMaybe"},{"display_html":"forAll :: Show a => Gen a -> (a -> Property) -> Property","name":"forAll","module":"Cooked.MockChain","link":"Cooked-MockChain.html#v:forAll"},{"display_html":"getValidityRangeTweak :: MonadTweak m => m SlotRange","name":"getValidityRangeTweak","module":"Cooked.Tweak.ValidityRange","link":"Cooked-Tweak-ValidityRange.html#v:getValidityRangeTweak"},{"display_html":"setValidityRangeTweak :: MonadTweak m => SlotRange -> m SlotRange","name":"setValidityRangeTweak","module":"Cooked.Tweak.ValidityRange","link":"Cooked-Tweak-ValidityRange.html#v:setValidityRangeTweak"},{"display_html":"setAlwaysValidRangeTweak :: MonadTweak m => m SlotRange","name":"setAlwaysValidRangeTweak","module":"Cooked.Tweak.ValidityRange","link":"Cooked-Tweak-ValidityRange.html#v:setAlwaysValidRangeTweak"},{"display_html":"setValidityStartTweak :: MonadTweak m => Slot -> m SlotRange","name":"setValidityStartTweak","module":"Cooked.Tweak.ValidityRange","link":"Cooked-Tweak-ValidityRange.html#v:setValidityStartTweak"},{"display_html":"setValidityEndTweak :: MonadTweak m => Slot -> m SlotRange","name":"setValidityEndTweak","module":"Cooked.Tweak.ValidityRange","link":"Cooked-Tweak-ValidityRange.html#v:setValidityEndTweak"},{"display_html":"validityRangeSatisfiesTweak :: MonadTweak m => (SlotRange -> Bool) -> m Bool","name":"validityRangeSatisfiesTweak","module":"Cooked.Tweak.ValidityRange","link":"Cooked-Tweak-ValidityRange.html#v:validityRangeSatisfiesTweak"},{"display_html":"isValidAtTweak :: MonadTweak m => Slot -> m Bool","name":"isValidAtTweak","module":"Cooked.Tweak.ValidityRange","link":"Cooked-Tweak-ValidityRange.html#v:isValidAtTweak"},{"display_html":"isValidNowTweak :: MonadTweak m => m Bool","name":"isValidNowTweak","module":"Cooked.Tweak.ValidityRange","link":"Cooked-Tweak-ValidityRange.html#v:isValidNowTweak"},{"display_html":"isValidDuringTweak :: MonadTweak m => SlotRange -> m Bool","name":"isValidDuringTweak","module":"Cooked.Tweak.ValidityRange","link":"Cooked-Tweak-ValidityRange.html#v:isValidDuringTweak"},{"display_html":"hasEmptyTimeRangeTweak :: MonadTweak m => m Bool","name":"hasEmptyTimeRangeTweak","module":"Cooked.Tweak.ValidityRange","link":"Cooked-Tweak-ValidityRange.html#v:hasEmptyTimeRangeTweak"},{"display_html":"hasFullTimeRangeTweak :: MonadTweak m => m Bool","name":"hasFullTimeRangeTweak","module":"Cooked.Tweak.ValidityRange","link":"Cooked-Tweak-ValidityRange.html#v:hasFullTimeRangeTweak"},{"display_html":"intersectValidityRangeTweak :: MonadTweak m => SlotRange -> m SlotRange","name":"intersectValidityRangeTweak","module":"Cooked.Tweak.ValidityRange","link":"Cooked-Tweak-ValidityRange.html#v:intersectValidityRangeTweak"},{"display_html":"centerAroundValidityRangeTweak :: MonadTweak m => Slot -> Integer -> m SlotRange","name":"centerAroundValidityRangeTweak","module":"Cooked.Tweak.ValidityRange","link":"Cooked-Tweak-ValidityRange.html#v:centerAroundValidityRangeTweak"},{"display_html":"makeValidityRangeSingletonTweak :: MonadTweak m => Slot -> m SlotRange","name":"makeValidityRangeSingletonTweak","module":"Cooked.Tweak.ValidityRange","link":"Cooked-Tweak-ValidityRange.html#v:makeValidityRangeSingletonTweak"},{"display_html":"makeValidityRangeNowTweak :: MonadTweak m => m SlotRange","name":"makeValidityRangeNowTweak","module":"Cooked.Tweak.ValidityRange","link":"Cooked-Tweak-ValidityRange.html#v:makeValidityRangeNowTweak"},{"display_html":"waitUntilValidTweak :: MonadTweak m => m Slot","name":"waitUntilValidTweak","module":"Cooked.Tweak.ValidityRange","link":"Cooked-Tweak-ValidityRange.html#v:waitUntilValidTweak"},{"display_html":"class (MonadPlus m, MonadBlockChainWithoutValidation m) => MonadTweak m where","name":"MonadTweak getTxSkel putTxSkel","module":"Cooked.Tweak","link":"Cooked-Tweak.html#t:MonadTweak"},{"display_html":"failingTweak :: MonadTweak m => m a","name":"failingTweak","module":"Cooked.Tweak","link":"Cooked-Tweak.html#v:failingTweak"},{"display_html":"doNothingTweak :: MonadTweak m => m ()","name":"doNothingTweak","module":"Cooked.Tweak","link":"Cooked-Tweak.html#v:doNothingTweak"},{"display_html":"viewTweak :: (MonadTweak m, Is k A_Getter) => Optic' k is TxSkel a -> m a","name":"viewTweak","module":"Cooked.Tweak","link":"Cooked-Tweak.html#v:viewTweak"},{"display_html":"iviewTweak :: (MonadTweak m, Is k A_Getter) => Optic' k (WithIx is) TxSkel a -> m (is, a)","name":"iviewTweak","module":"Cooked.Tweak","link":"Cooked-Tweak.html#v:iviewTweak"},{"display_html":"viewAllTweak :: (MonadTweak m, Is k A_Fold) => Optic' k is TxSkel a -> m [a]","name":"viewAllTweak","module":"Cooked.Tweak","link":"Cooked-Tweak.html#v:viewAllTweak"},{"display_html":"setTweak :: (MonadTweak m, Is k A_Setter) => Optic' k is TxSkel a -> a -> m ()","name":"setTweak","module":"Cooked.Tweak","link":"Cooked-Tweak.html#v:setTweak"},{"display_html":"overTweak :: (MonadTweak m, Is k A_Setter) => Optic' k is TxSkel a -> (a -> a) -> m ()","name":"overTweak","module":"Cooked.Tweak","link":"Cooked-Tweak.html#v:overTweak"},{"display_html":"overMaybeTweak :: (MonadTweak m, Is k A_Traversal) => Optic' k is TxSkel a -> (a -> Maybe a) -> m [a]","name":"overMaybeTweak","module":"Cooked.Tweak","link":"Cooked-Tweak.html#v:overMaybeTweak"},{"display_html":"overMaybeSelectingTweak :: forall a m k is. (MonadTweak m, Is k A_Traversal) => Optic' k is TxSkel a -> (a -> Maybe a) -> (Integer -> Bool) -> m [a]","name":"overMaybeSelectingTweak","module":"Cooked.Tweak","link":"Cooked-Tweak.html#v:overMaybeSelectingTweak"},{"display_html":"combineModsTweak :: (Eq is, Is k A_Traversal, MonadTweak m) => ([is] -> [[is]]) -> Optic' k (WithIx is) TxSkel x -> (is -> x -> m [(x, l)]) -> m [l]","name":"combineModsTweak","module":"Cooked.Tweak","link":"Cooked-Tweak.html#v:combineModsTweak"},{"display_html":"selectP :: (a -> Bool) -> Prism' a a","name":"selectP","module":"Cooked.Tweak","link":"Cooked-Tweak.html#v:selectP"},{"display_html":"getSignersTweak :: MonadTweak m => m [Wallet]","name":"getSignersTweak","module":"Cooked.Tweak","link":"Cooked-Tweak.html#v:getSignersTweak"},{"display_html":"modifySignersTweak :: MonadTweak m => ([Wallet] -> [Wallet]) -> m [Wallet]","name":"modifySignersTweak","module":"Cooked.Tweak","link":"Cooked-Tweak.html#v:modifySignersTweak"},{"display_html":"setSignersTweak :: MonadTweak m => [Wallet] -> m [Wallet]","name":"setSignersTweak","module":"Cooked.Tweak","link":"Cooked-Tweak.html#v:setSignersTweak"},{"display_html":"signersSatisfyTweak :: MonadTweak m => ([Wallet] -> Bool) -> m Bool","name":"signersSatisfyTweak","module":"Cooked.Tweak","link":"Cooked-Tweak.html#v:signersSatisfyTweak"},{"display_html":"isSignerTweak :: MonadTweak m => Wallet -> m Bool","name":"isSignerTweak","module":"Cooked.Tweak","link":"Cooked-Tweak.html#v:isSignerTweak"},{"display_html":"hasSignersTweak :: MonadTweak m => m Bool","name":"hasSignersTweak","module":"Cooked.Tweak","link":"Cooked-Tweak.html#v:hasSignersTweak"},{"display_html":"addFirstSignerTweak :: MonadTweak m => Wallet -> m [Wallet]","name":"addFirstSignerTweak","module":"Cooked.Tweak","link":"Cooked-Tweak.html#v:addFirstSignerTweak"},{"display_html":"addSignersTweak :: MonadTweak m => [Wallet] -> m [Wallet]","name":"addSignersTweak","module":"Cooked.Tweak","link":"Cooked-Tweak.html#v:addSignersTweak"},{"display_html":"addLastSignerTweak :: MonadTweak m => Wallet -> m [Wallet]","name":"addLastSignerTweak","module":"Cooked.Tweak","link":"Cooked-Tweak.html#v:addLastSignerTweak"},{"display_html":"removeSignersTweak :: MonadTweak m => [Wallet] -> m [Wallet]","name":"removeSignersTweak","module":"Cooked.Tweak","link":"Cooked-Tweak.html#v:removeSignersTweak"},{"display_html":"removeSignerTweak :: MonadTweak m => Wallet -> m [Wallet]","name":"removeSignerTweak","module":"Cooked.Tweak","link":"Cooked-Tweak.html#v:removeSignerTweak"},{"display_html":"replaceFirstSignerTweak :: MonadTweak m => Wallet -> m [Wallet]","name":"replaceFirstSignerTweak","module":"Cooked.Tweak","link":"Cooked-Tweak.html#v:replaceFirstSignerTweak"},{"display_html":"data PermutOutTweakMode","name":"PermutOutTweakMode KeepIdentity OmitIdentity","module":"Cooked.Tweak","link":"Cooked-Tweak.html#t:PermutOutTweakMode"},{"display_html":"allOutPermutsTweak :: MonadTweak m => PermutOutTweakMode -> m ()","name":"allOutPermutsTweak","module":"Cooked.Tweak","link":"Cooked-Tweak.html#v:allOutPermutsTweak"},{"display_html":"singleOutPermutTweak :: MonadTweak m => Int -> m ()","name":"singleOutPermutTweak","module":"Cooked.Tweak","link":"Cooked-Tweak.html#v:singleOutPermutTweak"},{"display_html":"addLabelTweak :: (MonadTweak m, LabelConstrs x) => x -> m ()","name":"addLabelTweak","module":"Cooked.Tweak","link":"Cooked-Tweak.html#v:addLabelTweak"},{"display_html":"removeLabelTweak :: (MonadTweak m, LabelConstrs x) => x -> m ()","name":"removeLabelTweak","module":"Cooked.Tweak","link":"Cooked-Tweak.html#v:removeLabelTweak"},{"display_html":"hasLabelTweak :: (MonadTweak m, LabelConstrs x) => x -> m Bool","name":"hasLabelTweak","module":"Cooked.Tweak","link":"Cooked-Tweak.html#v:hasLabelTweak"},{"display_html":"data MalformDatumLbl = MalformDatumLbl","name":"MalformDatumLbl MalformDatumLbl","module":"Cooked.Tweak","link":"Cooked-Tweak.html#t:MalformDatumLbl"},{"display_html":"data TamperDatumLbl = TamperDatumLbl","name":"TamperDatumLbl TamperDatumLbl","module":"Cooked.Tweak","link":"Cooked-Tweak.html#t:TamperDatumLbl"},{"display_html":"tamperDatumTweak :: forall a m. (MonadTweak m, Show a, PrettyCooked a, ToData a, FromData a, Typeable a) => (a -> Maybe a) -> m [a]","name":"tamperDatumTweak","module":"Cooked.Tweak","link":"Cooked-Tweak.html#v:tamperDatumTweak"},{"display_html":"malformDatumTweak :: forall a m. (MonadTweak m, ToData a, FromData a, Typeable a) => (a -> [BuiltinData]) -> m ()","name":"malformDatumTweak","module":"Cooked.Tweak","link":"Cooked-Tweak.html#v:malformDatumTweak"},{"display_html":"ensureInputTweak :: MonadTweak m => TxOutRef -> TxSkelRedeemer -> m (Maybe (TxOutRef, TxSkelRedeemer))","name":"ensureInputTweak","module":"Cooked.Tweak","link":"Cooked-Tweak.html#v:ensureInputTweak"},{"display_html":"addInputTweak :: MonadTweak m => TxOutRef -> TxSkelRedeemer -> m ()","name":"addInputTweak","module":"Cooked.Tweak","link":"Cooked-Tweak.html#v:addInputTweak"},{"display_html":"removeInputTweak :: MonadTweak m => (TxOutRef -> TxSkelRedeemer -> Bool) -> m [(TxOutRef, TxSkelRedeemer)]","name":"removeInputTweak","module":"Cooked.Tweak","link":"Cooked-Tweak.html#v:removeInputTweak"},{"display_html":"ensureOutputTweak :: MonadTweak m => TxSkelOut -> m (Maybe TxSkelOut)","name":"ensureOutputTweak","module":"Cooked.Tweak","link":"Cooked-Tweak.html#v:ensureOutputTweak"},{"display_html":"addOutputTweak :: MonadTweak m => TxSkelOut -> m ()","name":"addOutputTweak","module":"Cooked.Tweak","link":"Cooked-Tweak.html#v:addOutputTweak"},{"display_html":"removeOutputTweak :: MonadTweak m => (TxSkelOut -> Bool) -> m [TxSkelOut]","name":"removeOutputTweak","module":"Cooked.Tweak","link":"Cooked-Tweak.html#v:removeOutputTweak"},{"display_html":"addMintTweak :: MonadTweak m => (Versioned MintingPolicy, MintsRedeemer, TokenName, Integer) -> m ()","name":"addMintTweak","module":"Cooked.Tweak","link":"Cooked-Tweak.html#v:addMintTweak"},{"display_html":"removeMintTweak :: MonadTweak m => ((Versioned MintingPolicy, MintsRedeemer, TokenName, Integer) -> Bool) -> m [(Versioned MintingPolicy, MintsRedeemer, TokenName, Integer)]","name":"removeMintTweak","module":"Cooked.Tweak","link":"Cooked-Tweak.html#v:removeMintTweak"},{"display_html":"getValidityRangeTweak :: MonadTweak m => m SlotRange","name":"getValidityRangeTweak","module":"Cooked.Tweak","link":"Cooked-Tweak.html#v:getValidityRangeTweak"},{"display_html":"setValidityRangeTweak :: MonadTweak m => SlotRange -> m SlotRange","name":"setValidityRangeTweak","module":"Cooked.Tweak","link":"Cooked-Tweak.html#v:setValidityRangeTweak"},{"display_html":"setAlwaysValidRangeTweak :: MonadTweak m => m SlotRange","name":"setAlwaysValidRangeTweak","module":"Cooked.Tweak","link":"Cooked-Tweak.html#v:setAlwaysValidRangeTweak"},{"display_html":"setValidityStartTweak :: MonadTweak m => Slot -> m SlotRange","name":"setValidityStartTweak","module":"Cooked.Tweak","link":"Cooked-Tweak.html#v:setValidityStartTweak"},{"display_html":"setValidityEndTweak :: MonadTweak m => Slot -> m SlotRange","name":"setValidityEndTweak","module":"Cooked.Tweak","link":"Cooked-Tweak.html#v:setValidityEndTweak"},{"display_html":"validityRangeSatisfiesTweak :: MonadTweak m => (SlotRange -> Bool) -> m Bool","name":"validityRangeSatisfiesTweak","module":"Cooked.Tweak","link":"Cooked-Tweak.html#v:validityRangeSatisfiesTweak"},{"display_html":"isValidAtTweak :: MonadTweak m => Slot -> m Bool","name":"isValidAtTweak","module":"Cooked.Tweak","link":"Cooked-Tweak.html#v:isValidAtTweak"},{"display_html":"isValidNowTweak :: MonadTweak m => m Bool","name":"isValidNowTweak","module":"Cooked.Tweak","link":"Cooked-Tweak.html#v:isValidNowTweak"},{"display_html":"isValidDuringTweak :: MonadTweak m => SlotRange -> m Bool","name":"isValidDuringTweak","module":"Cooked.Tweak","link":"Cooked-Tweak.html#v:isValidDuringTweak"},{"display_html":"hasEmptyTimeRangeTweak :: MonadTweak m => m Bool","name":"hasEmptyTimeRangeTweak","module":"Cooked.Tweak","link":"Cooked-Tweak.html#v:hasEmptyTimeRangeTweak"},{"display_html":"hasFullTimeRangeTweak :: MonadTweak m => m Bool","name":"hasFullTimeRangeTweak","module":"Cooked.Tweak","link":"Cooked-Tweak.html#v:hasFullTimeRangeTweak"},{"display_html":"intersectValidityRangeTweak :: MonadTweak m => SlotRange -> m SlotRange","name":"intersectValidityRangeTweak","module":"Cooked.Tweak","link":"Cooked-Tweak.html#v:intersectValidityRangeTweak"},{"display_html":"centerAroundValidityRangeTweak :: MonadTweak m => Slot -> Integer -> m SlotRange","name":"centerAroundValidityRangeTweak","module":"Cooked.Tweak","link":"Cooked-Tweak.html#v:centerAroundValidityRangeTweak"},{"display_html":"makeValidityRangeSingletonTweak :: MonadTweak m => Slot -> m SlotRange","name":"makeValidityRangeSingletonTweak","module":"Cooked.Tweak","link":"Cooked-Tweak.html#v:makeValidityRangeSingletonTweak"},{"display_html":"makeValidityRangeNowTweak :: MonadTweak m => m SlotRange","name":"makeValidityRangeNowTweak","module":"Cooked.Tweak","link":"Cooked-Tweak.html#v:makeValidityRangeNowTweak"},{"display_html":"waitUntilValidTweak :: MonadTweak m => m Slot","name":"waitUntilValidTweak","module":"Cooked.Tweak","link":"Cooked-Tweak.html#v:waitUntilValidTweak"},{"display_html":"redirectScriptOutputTweak :: (MonadTweak m, Is k A_Traversal, Show (DatumType a), ToData (DatumType a)) => Optic' k is TxSkel (ConcreteOutput (TypedValidator a) TxSkelOutDatum Value (Versioned Script)) -> (ConcreteOutput (TypedValidator a) TxSkelOutDatum Value (Versioned Script) -> Maybe (TypedValidator a)) -> (Integer -> Bool) -> m [ConcreteOutput (TypedValidator a) TxSkelOutDatum Value (Versioned Script)]","name":"redirectScriptOutputTweak","module":"Cooked.Attack.DatumHijacking","link":"Cooked-Attack-DatumHijacking.html#v:redirectScriptOutputTweak"},{"display_html":"datumHijackingAttack :: forall a m. (MonadTweak m, Show (DatumType a), PrettyCooked (DatumType a), ToData (DatumType a), Typeable (DatumType a), Typeable a) => (ConcreteOutput (TypedValidator a) TxSkelOutDatum Value (Versioned Script) -> Bool) -> (Integer -> Bool) -> m [ConcreteOutput (TypedValidator a) TxSkelOutDatum Value (Versioned Script)]","name":"datumHijackingAttack","module":"Cooked.Attack.DatumHijacking","link":"Cooked-Attack-DatumHijacking.html#v:datumHijackingAttack"},{"display_html":"newtype DatumHijackingLbl = DatumHijackingLbl Address","name":"DatumHijackingLbl DatumHijackingLbl","module":"Cooked.Attack.DatumHijacking","link":"Cooked-Attack-DatumHijacking.html#t:DatumHijackingLbl"},{"display_html":"datumHijackingTarget :: TypedValidator a","name":"datumHijackingTarget","module":"Cooked.Attack.DatumHijacking","link":"Cooked-Attack-DatumHijacking.html#v:datumHijackingTarget"},{"display_html":"dupTokenAttack :: MonadTweak m => (AssetClass -> Integer -> Integer) -> Wallet -> m Value","name":"dupTokenAttack","module":"Cooked.Attack.DupToken","link":"Cooked-Attack-DupToken.html#v:dupTokenAttack"},{"display_html":"data DupTokenLbl = DupTokenLbl","name":"DupTokenLbl DupTokenLbl","module":"Cooked.Attack.DupToken","link":"Cooked-Attack-DupToken.html#t:DupTokenLbl"},{"display_html":"type DoubleSatDelta = (Map TxOutRef TxSkelRedeemer, [TxSkelOut], TxSkelMints)","name":"DoubleSatDelta","module":"Cooked.Attack.DoubleSat","link":"Cooked-Attack-DoubleSat.html#t:DoubleSatDelta"},{"display_html":"data DoubleSatLbl = DoubleSatLbl","name":"DoubleSatLbl DoubleSatLbl","module":"Cooked.Attack.DoubleSat","link":"Cooked-Attack-DoubleSat.html#t:DoubleSatLbl"},{"display_html":"doubleSatAttack :: (MonadTweak m, Eq is, Is k A_Traversal) => ([is] -> [[is]]) -> Optic' k (WithIx is) TxSkel a -> (is -> a -> m [(a, DoubleSatDelta)]) -> Wallet -> m ()","name":"doubleSatAttack","module":"Cooked.Attack.DoubleSat","link":"Cooked-Attack-DoubleSat.html#v:doubleSatAttack"},{"display_html":"addTokenAttack :: MonadTweak m => (Versioned MintingPolicy -> [(TokenName, Integer)]) -> Wallet -> m Value","name":"addTokenAttack","module":"Cooked.Attack.AddToken","link":"Cooked-Attack-AddToken.html#v:addTokenAttack"},{"display_html":"newtype AddTokenLbl = AddTokenLbl TokenName","name":"AddTokenLbl AddTokenLbl","module":"Cooked.Attack.AddToken","link":"Cooked-Attack-AddToken.html#t:AddTokenLbl"},{"display_html":"module Cooked.Attack.DupToken","name":"","module":"Cooked.Attack","link":""},{"display_html":"module Cooked.Attack.DoubleSat","name":"","module":"Cooked.Attack","link":""},{"display_html":"module Cooked.Attack.DatumHijacking","name":"","module":"Cooked.Attack","link":""},{"display_html":"module Cooked.Attack.AddToken","name":"","module":"Cooked.Attack","link":""},{"display_html":"module Cooked.Wallet","name":"","module":"Cooked","link":""},{"display_html":"module Cooked.ValueUtils","name":"","module":"Cooked","link":""},{"display_html":"module Cooked.Tweak","name":"","module":"Cooked","link":""},{"display_html":"module Cooked.Skeleton","name":"","module":"Cooked","link":""},{"display_html":"module Cooked.ShowBS","name":"","module":"Cooked","link":""},{"display_html":"module Cooked.RawUPLC","name":"","module":"Cooked","link":""},{"display_html":"module Cooked.Pretty","name":"","module":"Cooked","link":""},{"display_html":"module Cooked.Output","name":"","module":"Cooked","link":""},{"display_html":"module Cooked.MockChain","name":"","module":"Cooked","link":""},{"display_html":"module Cooked.Currencies","name":"","module":"Cooked","link":""},{"display_html":"module Cooked.Attack","name":"","module":"Cooked","link":""},{"display_html":"class Monad m => MonadModal m where","name":"MonadModal Modification modifyLtl","module":"Cooked","link":"Cooked.html#t:MonadModal"},{"display_html":"data Ltl a","name":"Ltl LtlTruth LtlFalsity LtlAtom LtlOr LtlAnd LtlNext LtlUntil LtlRelease","module":"Cooked","link":"Cooked.html#t:Ltl"}] \ No newline at end of file diff --git a/src/Cooked.Attack.AddToken.html b/src/Cooked.Attack.AddToken.html index 5f4e4e950..1d6c831bc 100644 --- a/src/Cooked.Attack.AddToken.html +++ b/src/Cooked.Attack.AddToken.html @@ -1,14 +1,14 @@
    module Cooked.Attack.AddToken (addTokenAttack, AddTokenLbl (..)) where
     
    -import Control.Monad
    +import Control.Monad
     import Cooked.Skeleton
     import Cooked.Tweak
     import Cooked.Wallet
    -import qualified Data.Map as Map
    -import qualified Plutus.Script.Utils.Scripts as Pl
    -import qualified Plutus.V1.Ledger.Value as Pl
    -import qualified Plutus.V2.Ledger.Api as Pl
    -import qualified PlutusTx.Numeric as Pl
    +import qualified Data.Map as Map
    +import qualified Plutus.Script.Utils.Scripts as Pl
    +import qualified Plutus.V1.Ledger.Value as Pl
    +import qualified Plutus.V2.Ledger.Api as Pl
    +import qualified PlutusTx.Numeric as Pl
     
     -- | This attack adds extra tokens, depending on the minting policy. It is
     -- different from the 'dupTokenAttack' in that it does not merely try to
    @@ -17,8 +17,8 @@
     --
     -- This attack adds an 'AddTokenLbl' with the token name of the additional
     -- minted token(s). It returns additional value minted.
    -addTokenAttack ::
    -  MonadTweak m =>
    +addTokenAttack ::
    +  (MonadTweak m) =>
       -- | For each policy that occurs in some 'Mints' constraint, return a list of
       -- token names together with how many tokens with that name should be
       -- minted.
    @@ -30,17 +30,17 @@
       -- there'll be n*m*o modified transactions.)
       --
       -- The redeemer will be the one that's already being used on the transaction.
    -  (Pl.Versioned Pl.MintingPolicy -> [(Pl.TokenName, Integer)]) ->
    +  (Pl.Versioned Pl.MintingPolicy -> [(Pl.TokenName, Integer)]) ->
       -- | The wallet of the attacker. Any extra tokens will be paid to this wallet.
       Wallet ->
    -  m Pl.Value
    +  m Pl.Value
     addTokenAttack :: (Versioned MintingPolicy -> [(TokenName, Integer)])
     -> Wallet -> m Value
    -addTokenAttack Versioned MintingPolicy -> [(TokenName, Integer)]
    -extraTokens Wallet
    -attacker = do
    -  TxSkelMints
    -oldMints <- Optic' A_Lens NoIx TxSkel TxSkelMints -> m TxSkelMints
    +addTokenAttack Versioned MintingPolicy -> [(TokenName, Integer)]
    +extraTokens Wallet
    +attacker = do
    +  TxSkelMints
    +oldMints <- Optic' A_Lens NoIx TxSkel TxSkelMints -> m TxSkelMints
     forall (m :: * -> *) k (is :: IxList) a.
     (MonadTweak m, Is k A_Getter) =>
     Optic' k is TxSkel a -> m a
    @@ -50,9 +50,9 @@
     forall (t :: * -> *) (m :: * -> *) a.
     (Foldable t, MonadPlus m) =>
     t (m a) -> m a
    -msum ([m Value] -> m Value) -> [m Value] -> m Value
    +msum ([m Value] -> m Value) -> [m Value] -> m Value
     forall a b. (a -> b) -> a -> b
    -$
    +$
         ((Versioned MintingPolicy,
       (MintsRedeemer, NEMap TokenName (NonZero Integer)))
      -> m Value)
    @@ -60,51 +60,51 @@
          (MintsRedeemer, NEMap TokenName (NonZero Integer)))]
     -> [m Value]
     forall a b. (a -> b) -> [a] -> [b]
    -map
    -      ( \(Versioned MintingPolicy
    -policy, (MintsRedeemer
    -redeemer, NEMap TokenName (NonZero Integer)
    +map
    +      ( \(Versioned MintingPolicy
    +policy, (MintsRedeemer
    +redeemer, NEMap TokenName (NonZero Integer)
     _)) ->
               [m Value] -> m Value
     forall (t :: * -> *) (m :: * -> *) a.
     (Foldable t, MonadPlus m) =>
     t (m a) -> m a
    -msum ([m Value] -> m Value) -> [m Value] -> m Value
    +msum ([m Value] -> m Value) -> [m Value] -> m Value
     forall a b. (a -> b) -> a -> b
    -$
    +$
                 ((TokenName, Integer) -> m Value)
     -> [(TokenName, Integer)] -> [m Value]
     forall a b. (a -> b) -> [a] -> [b]
    -map
    -              ( \(TokenName
    -tName, Integer
    -amount) ->
    -                  let newMints :: TxSkelMints
    -newMints = (Versioned MintingPolicy, MintsRedeemer, TokenName, Integer)
    +map
    +              ( \(TokenName
    +tName, Integer
    +amount) ->
    +                  let newMints :: TxSkelMints
    +newMints = (Versioned MintingPolicy, MintsRedeemer, TokenName, Integer)
     -> TxSkelMints -> TxSkelMints
     addToTxSkelMints (Versioned MintingPolicy
    -policy, MintsRedeemer
    -redeemer, TokenName
    -tName, Integer
    -amount) TxSkelMints
    -oldMints
    -                      increment :: Value
    -increment =
    +policy, MintsRedeemer
    +redeemer, TokenName
    +tName, Integer
    +amount) TxSkelMints
    +oldMints
    +                      increment :: Value
    +increment =
                             TxSkelMints -> Value
     txSkelMintsValue TxSkelMints
    -newMints
    +newMints
                               Value -> Value -> Value
     forall a. Semigroup a => a -> a -> a
    -<> Value -> Value
    +<> Value -> Value
     forall a. AdditiveGroup a => a -> a
    -Pl.negate (TxSkelMints -> Value
    +Pl.negate (TxSkelMints -> Value
     txSkelMintsValue TxSkelMints
    -oldMints)
    +oldMints)
                        in if Value
    -increment Value -> Value -> Bool
    -`Pl.geq` Value
    +increment Value -> Value -> Bool
    +`Pl.geq` Value
     forall a. Monoid a => a
    -mempty
    +mempty
                             then do
                               Optic' A_Lens NoIx TxSkel TxSkelMints -> TxSkelMints -> m ()
     forall (m :: * -> *) k (is :: IxList) a.
    @@ -112,36 +112,36 @@
     Optic' k is TxSkel a -> a -> m ()
     setTweak Optic' A_Lens NoIx TxSkel TxSkelMints
     txSkelMintsL TxSkelMints
    -newMints
    +newMints
                               TxSkelOut -> m ()
     forall (m :: * -> *). MonadTweak m => TxSkelOut -> m ()
     addOutputTweak (TxSkelOut -> m ()) -> TxSkelOut -> m ()
     forall a b. (a -> b) -> a -> b
    -$ PubKeyHash -> Value -> TxSkelOut
    +$ PubKeyHash -> Value -> TxSkelOut
     paysPK (Wallet -> PubKeyHash
     walletPKHash Wallet
    -attacker) Value
    -increment
    +attacker) Value
    +increment
                               Value -> m Value
     forall (m :: * -> *) a. Monad m => a -> m a
    -return Value
    -increment
    +return Value
    +increment
                             else m Value
     forall (m :: * -> *) a. MonadTweak m => m a
     failingTweak
                   )
                   (Versioned MintingPolicy -> [(TokenName, Integer)]
    -extraTokens Versioned MintingPolicy
    -policy)
    +extraTokens Versioned MintingPolicy
    +policy)
           )
           (TxSkelMints
     -> [(Versioned MintingPolicy,
          (MintsRedeemer, NEMap TokenName (NonZero Integer)))]
     forall k a. Map k a -> [(k, a)]
    -Map.toList TxSkelMints
    -oldMints)
    +Map.toList TxSkelMints
    +oldMints)
     
    -newtype AddTokenLbl = AddTokenLbl Pl.TokenName deriving (Int -> AddTokenLbl -> ShowS
    +newtype AddTokenLbl = AddTokenLbl Pl.TokenName deriving (Int -> AddTokenLbl -> ShowS
     [AddTokenLbl] -> ShowS
     AddTokenLbl -> String
     (Int -> AddTokenLbl -> ShowS)
    @@ -156,7 +156,7 @@
     $cshow :: AddTokenLbl -> String
     showsPrec :: Int -> AddTokenLbl -> ShowS
     $cshowsPrec :: Int -> AddTokenLbl -> ShowS
    -Show, AddTokenLbl -> AddTokenLbl -> Bool
    +Show, AddTokenLbl -> AddTokenLbl -> Bool
     (AddTokenLbl -> AddTokenLbl -> Bool)
     -> (AddTokenLbl -> AddTokenLbl -> Bool) -> Eq AddTokenLbl
     forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    @@ -164,5 +164,5 @@
     $c/= :: AddTokenLbl -> AddTokenLbl -> Bool
     == :: AddTokenLbl -> AddTokenLbl -> Bool
     $c== :: AddTokenLbl -> AddTokenLbl -> Bool
    -Eq)
    +Eq)
     
    \ No newline at end of file diff --git a/src/Cooked.Attack.DatumHijacking.html b/src/Cooked.Attack.DatumHijacking.html index 156bce48f..2eacb4ec5 100644 --- a/src/Cooked.Attack.DatumHijacking.html +++ b/src/Cooked.Attack.DatumHijacking.html @@ -16,17 +16,17 @@ ) where -import Control.Monad +import Control.Monad import Cooked.Output import Cooked.Pretty.Class import Cooked.RawUPLC import Cooked.Skeleton import Cooked.Tweak -import Optics.Core -import qualified Plutus.Script.Utils.Typed as Pl -import qualified Plutus.V2.Ledger.Api as Pl -import qualified PlutusTx as Pl -import Type.Reflection +import Optics.Core +import qualified Plutus.Script.Utils.Typed as Pl +import qualified Plutus.V2.Ledger.Api as Pl +import qualified PlutusTx as Pl +import Type.Reflection -- | Redirect script outputs from one validator to another validator of the same -- type. Returns the list of outputs it redirected (as they were before the @@ -35,23 +35,23 @@ -- -- Something like @txSkelOutsL % traversed % txSkelOutOwnerTypeP @(Pl.TypedValidator a)@ -- might be useful to construct the optics used by this tweak. -redirectScriptOutputTweak :: - ( MonadTweak m, - Is k A_Traversal, - Show (Pl.DatumType a), - Pl.ToData (Pl.DatumType a) +redirectScriptOutputTweak :: + ( MonadTweak m, + Is k A_Traversal, + Show (Pl.DatumType a), + Pl.ToData (Pl.DatumType a) ) => - Optic' k is TxSkel (ConcreteOutput (Pl.TypedValidator a) TxSkelOutDatum Pl.Value (Pl.Versioned Pl.Script)) -> + Optic' k is TxSkel (ConcreteOutput (Pl.TypedValidator a) TxSkelOutDatum Pl.Value (Pl.Versioned Pl.Script)) -> -- | Return @Just@ the new validator, or @Nothing@ if you want to leave this -- output unchanged. - (ConcreteOutput (Pl.TypedValidator a) TxSkelOutDatum Pl.Value (Pl.Versioned Pl.Script) -> Maybe (Pl.TypedValidator a)) -> + (ConcreteOutput (Pl.TypedValidator a) TxSkelOutDatum Pl.Value (Pl.Versioned Pl.Script) -> Maybe (Pl.TypedValidator a)) -> -- | The redirection described by the previous argument might apply to more -- than one of the script outputs of the transaction. Use this predicate to -- select which of the redirectable script outputs to actually redirect. We -- count the redirectable script outputs from the left to the right, starting -- with zero. - (Integer -> Bool) -> - m [ConcreteOutput (Pl.TypedValidator a) TxSkelOutDatum Pl.Value (Pl.Versioned Pl.Script)] + (Integer -> Bool) -> + m [ConcreteOutput (Pl.TypedValidator a) TxSkelOutDatum Pl.Value (Pl.Versioned Pl.Script)] redirectScriptOutputTweak :: Optic' k is @@ -64,16 +64,16 @@ -> (Integer -> Bool) -> m [ConcreteOutput (TypedValidator a) TxSkelOutDatum Value (Versioned Script)] -redirectScriptOutputTweak Optic' +redirectScriptOutputTweak Optic' k is TxSkel (ConcreteOutput (TypedValidator a) TxSkelOutDatum Value (Versioned Script)) -optic ConcreteOutput +optic ConcreteOutput (TypedValidator a) TxSkelOutDatum Value (Versioned Script) -> Maybe (TypedValidator a) -change = +change = Optic' k is @@ -99,29 +99,29 @@ TxSkel (ConcreteOutput (TypedValidator a) TxSkelOutDatum Value (Versioned Script)) -optic - ( \ConcreteOutput +optic + ( \ConcreteOutput (TypedValidator a) TxSkelOutDatum Value (Versioned Script) -output -> case ConcreteOutput +output -> case ConcreteOutput (TypedValidator a) TxSkelOutDatum Value (Versioned Script) -> Maybe (TypedValidator a) -change ConcreteOutput +change ConcreteOutput (TypedValidator a) TxSkelOutDatum Value (Versioned Script) -output of +output of Maybe (TypedValidator a) -Nothing -> Maybe +Nothing -> Maybe (ConcreteOutput (TypedValidator a) TxSkelOutDatum Value (Versioned Script)) forall a. Maybe a -Nothing - Just TypedValidator a -newValidator -> ConcreteOutput +Nothing + Just TypedValidator a +newValidator -> ConcreteOutput (TypedValidator a) TxSkelOutDatum Value (Versioned Script) -> Maybe (ConcreteOutput (TypedValidator a) TxSkelOutDatum Value (Versioned Script)) forall a. a -> Maybe a -Just (ConcreteOutput +Just (ConcreteOutput (TypedValidator a) TxSkelOutDatum Value (Versioned Script) -> Maybe (ConcreteOutput @@ -132,9 +132,9 @@ (ConcreteOutput (TypedValidator a) TxSkelOutDatum Value (Versioned Script)) forall a b. (a -> b) -> a -> b -$ ConcreteOutput +$ ConcreteOutput (TypedValidator a) TxSkelOutDatum Value (Versioned Script) -output ConcreteOutput +output ConcreteOutput (TypedValidator a) TxSkelOutDatum Value (Versioned Script) -> (ConcreteOutput (TypedValidator a) TxSkelOutDatum Value (Versioned Script) @@ -143,7 +143,7 @@ -> ConcreteOutput (TypedValidator a) TxSkelOutDatum Value (Versioned Script) forall a b. a -> (a -> b) -> b -& Optic +& Optic A_Lens NoIx (ConcreteOutput @@ -170,8 +170,8 @@ forall k (is :: IxList) s t a b. Is k A_Setter => Optic k is s t a b -> b -> s -> t -.~ TypedValidator a -newValidator +.~ TypedValidator a +newValidator ) -- | A datum hijacking attack, simplified: This attack tries to substitute a @@ -189,36 +189,36 @@ -- they occurred on the original transaction. If no output is redirected, this -- attack fails. datumHijackingAttack :: - forall a m. - ( MonadTweak m, - Show (Pl.DatumType a), - PrettyCooked (Pl.DatumType a), - Pl.ToData (Pl.DatumType a), - Typeable (Pl.DatumType a), - Typeable a + forall a m. + ( MonadTweak m, + Show (Pl.DatumType a), + PrettyCooked (Pl.DatumType a), + Pl.ToData (Pl.DatumType a), + Typeable (Pl.DatumType a), + Typeable a ) => -- | Predicate to select outputs to steal, depending on the intended -- recipient, the datum, and the value. - (ConcreteOutput (Pl.TypedValidator a) TxSkelOutDatum Pl.Value (Pl.Versioned Pl.Script) -> Bool) -> + (ConcreteOutput (Pl.TypedValidator a) TxSkelOutDatum Pl.Value (Pl.Versioned Pl.Script) -> Bool) -> -- | The selection predicate may match more than one output. Use this -- predicate to restrict to the i-th of the outputs (counting from the left, -- starting at zero) chosen by the selection predicate with this predicate. - (Integer -> Bool) -> - m [ConcreteOutput (Pl.TypedValidator a) TxSkelOutDatum Pl.Value (Pl.Versioned Pl.Script)] + (Integer -> Bool) -> + m [ConcreteOutput (Pl.TypedValidator a) TxSkelOutDatum Pl.Value (Pl.Versioned Pl.Script)] datumHijackingAttack :: (ConcreteOutput (TypedValidator a) TxSkelOutDatum Value (Versioned Script) -> Bool) -> (Integer -> Bool) -> m [ConcreteOutput (TypedValidator a) TxSkelOutDatum Value (Versioned Script)] -datumHijackingAttack ConcreteOutput +datumHijackingAttack ConcreteOutput (TypedValidator a) TxSkelOutDatum Value (Versioned Script) -> Bool -change Integer -> Bool -select = do - [ConcreteOutput +change Integer -> Bool +select = do + [ConcreteOutput (TypedValidator a) TxSkelOutDatum Value (Versioned Script)] -redirected <- +redirected <- Optic' A_Traversal NoIx @@ -256,11 +256,11 @@ 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 -% Optic A_Traversal NoIx [TxSkelOut] [TxSkelOut] TxSkelOut TxSkelOut +% Optic A_Traversal NoIx [TxSkelOut] [TxSkelOut] TxSkelOut TxSkelOut forall (t :: * -> *) a b. Traversable t => Traversal (t a) (t b) a b -traversed Optic A_Traversal NoIx TxSkel TxSkel TxSkelOut TxSkelOut +traversed Optic A_Traversal NoIx TxSkel TxSkel TxSkelOut TxSkelOut -> Optic A_Prism NoIx @@ -280,7 +280,7 @@ 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 -% (ToCredential (TypedValidator a), Show (TypedValidator a), +% (ToCredential (TypedValidator a), Show (TypedValidator a), IsTxSkelOutAllowedOwner (TypedValidator a), Typeable (TypedValidator a)) => Optic @@ -298,63 +298,63 @@ Prism' TxSkelOut (ConcreteOutput ownerType TxSkelOutDatum Value (Versioned Script)) -txSkelOutOwnerTypeP @(Pl.TypedValidator a)) - (\ConcreteOutput +txSkelOutOwnerTypeP @(Pl.TypedValidator a)) + (\ConcreteOutput (TypedValidator a) TxSkelOutDatum Value (Versioned Script) -output -> if ConcreteOutput +output -> if ConcreteOutput (TypedValidator a) TxSkelOutDatum Value (Versioned Script) -> Bool -change ConcreteOutput +change ConcreteOutput (TypedValidator a) TxSkelOutDatum Value (Versioned Script) -output then TypedValidator a -> Maybe (TypedValidator a) +output then TypedValidator a -> Maybe (TypedValidator a) forall a. a -> Maybe a -Just TypedValidator a -thief else Maybe (TypedValidator a) +Just TypedValidator a +thief else Maybe (TypedValidator a) forall a. Maybe a -Nothing) +Nothing) Integer -> Bool -select +select Bool -> m () forall (f :: * -> *). Alternative f => Bool -> f () -guard (Bool -> m ()) -> (Bool -> Bool) -> Bool -> m () +guard (Bool -> m ()) -> (Bool -> Bool) -> Bool -> m () forall b c a. (b -> c) -> (a -> b) -> a -> c -. Bool -> Bool -not (Bool -> m ()) -> Bool -> m () +. Bool -> Bool +not (Bool -> m ()) -> Bool -> m () forall a b. (a -> b) -> a -> b -$ [ConcreteOutput +$ [ConcreteOutput (TypedValidator a) TxSkelOutDatum Value (Versioned Script)] -> Bool forall (t :: * -> *) a. Foldable t => t a -> Bool -null [ConcreteOutput +null [ConcreteOutput (TypedValidator a) TxSkelOutDatum Value (Versioned Script)] -redirected +redirected DatumHijackingLbl -> m () forall (m :: * -> *) x. (MonadTweak m, LabelConstrs x) => x -> m () addLabelTweak (DatumHijackingLbl -> m ()) -> DatumHijackingLbl -> m () forall a b. (a -> b) -> a -> b -$ Address -> DatumHijackingLbl +$ Address -> DatumHijackingLbl DatumHijackingLbl (Address -> DatumHijackingLbl) -> Address -> DatumHijackingLbl forall a b. (a -> b) -> a -> b -$ TypedValidator a -> Address +$ TypedValidator a -> Address forall a. TypedValidator a -> Address -Pl.validatorAddress TypedValidator a -thief +Pl.validatorAddress TypedValidator a +thief [ConcreteOutput (TypedValidator a) TxSkelOutDatum Value (Versioned Script)] -> m [ConcreteOutput (TypedValidator a) TxSkelOutDatum Value (Versioned Script)] forall (m :: * -> *) a. Monad m => a -> m a -return [ConcreteOutput +return [ConcreteOutput (TypedValidator a) TxSkelOutDatum Value (Versioned Script)] -redirected +redirected where - thief :: TypedValidator a -thief = TypedValidator a + thief :: TypedValidator a +thief = TypedValidator a forall a. TypedValidator a -datumHijackingTarget @a +datumHijackingTarget @a -newtype DatumHijackingLbl = DatumHijackingLbl Pl.Address - deriving (Int -> DatumHijackingLbl -> ShowS +newtype DatumHijackingLbl = DatumHijackingLbl Pl.Address + deriving (Int -> DatumHijackingLbl -> ShowS [DatumHijackingLbl] -> ShowS DatumHijackingLbl -> String (Int -> DatumHijackingLbl -> ShowS) @@ -369,7 +369,7 @@ $cshow :: DatumHijackingLbl -> String showsPrec :: Int -> DatumHijackingLbl -> ShowS $cshowsPrec :: Int -> DatumHijackingLbl -> ShowS -Show, DatumHijackingLbl -> DatumHijackingLbl -> Bool +Show, DatumHijackingLbl -> DatumHijackingLbl -> Bool (DatumHijackingLbl -> DatumHijackingLbl -> Bool) -> (DatumHijackingLbl -> DatumHijackingLbl -> Bool) -> Eq DatumHijackingLbl @@ -378,7 +378,7 @@ $c/= :: DatumHijackingLbl -> DatumHijackingLbl -> Bool == :: DatumHijackingLbl -> DatumHijackingLbl -> Bool $c== :: DatumHijackingLbl -> DatumHijackingLbl -> Bool -Eq, Eq DatumHijackingLbl +Eq, Eq DatumHijackingLbl Eq DatumHijackingLbl -> (DatumHijackingLbl -> DatumHijackingLbl -> Ordering) -> (DatumHijackingLbl -> DatumHijackingLbl -> Bool) @@ -416,12 +416,12 @@ compare :: DatumHijackingLbl -> DatumHijackingLbl -> Ordering $ccompare :: DatumHijackingLbl -> DatumHijackingLbl -> Ordering $cp1Ord :: Eq DatumHijackingLbl -Ord) +Ord) -- | The trivial validator that always succeds; this is a sufficient target for -- the datum hijacking attack since we only want to show feasibility of the -- attack. -datumHijackingTarget :: Pl.TypedValidator a +datumHijackingTarget :: Pl.TypedValidator a datumHijackingTarget :: TypedValidator a datumHijackingTarget = Program NamedDeBruijn DefaultUni DefaultFun () -> TypedValidator a forall a. @@ -435,11 +435,11 @@ (Closed uni, Everywhere uni Flat, Flat fun, Everywhere uni PrettyConst, GShow uni, Pretty fun) => CompiledCodeIn uni fun a -> Program NamedDeBruijn uni fun () -Pl.getPlc $$(Pl.compile [||tgt||])) +Pl.getPlc $$(Pl.compile [||tgt||])) where - tgt :: Pl.BuiltinData -> Pl.BuiltinData -> Pl.BuiltinData -> () - tgt :: BuiltinData -> BuiltinData -> BuiltinData -> () -tgt BuiltinData + tgt :: Pl.BuiltinData -> Pl.BuiltinData -> Pl.BuiltinData -> () + tgt :: BuiltinData -> BuiltinData -> BuiltinData -> () +tgt BuiltinData _ BuiltinData _ BuiltinData _ = () diff --git a/src/Cooked.Attack.DoubleSat.html b/src/Cooked.Attack.DoubleSat.html index 3cef817bf..e945cb6e5 100644 --- a/src/Cooked.Attack.DoubleSat.html +++ b/src/Cooked.Attack.DoubleSat.html @@ -16,12 +16,12 @@ import Cooked.Skeleton import Cooked.Tweak import Cooked.Wallet -import Data.Map (Map) -import qualified Data.Map as Map -import Optics.Core -import qualified Plutus.V1.Ledger.Value as Pl -import qualified Plutus.V2.Ledger.Api as Pl -import qualified PlutusTx.Numeric as Pl +import Data.Map (Map) +import qualified Data.Map as Map +import Optics.Core +import qualified Plutus.V1.Ledger.Value as Pl +import qualified Plutus.V2.Ledger.Api as Pl +import qualified PlutusTx.Numeric as Pl {- Note: What is a double satisfaction attack? @@ -47,42 +47,42 @@ -- | A triple of transaction inputs, transaction outputs, and minted value. This -- is what we can add to the transaction in order to try a double satisfaction -- attack. -type DoubleSatDelta = (Map Pl.TxOutRef TxSkelRedeemer, [TxSkelOut], TxSkelMints) +type DoubleSatDelta = (Map Pl.TxOutRef TxSkelRedeemer, [TxSkelOut], TxSkelMints) -instance {-# OVERLAPPING #-} Semigroup DoubleSatDelta where - (Map TxOutRef TxSkelRedeemer -i, [TxSkelOut] -o, TxSkelMints -m) <> :: DoubleSatDelta -> DoubleSatDelta -> DoubleSatDelta -<> (Map TxOutRef TxSkelRedeemer -i', [TxSkelOut] -o', TxSkelMints -m') = +instance {-# OVERLAPPING #-} Semigroup DoubleSatDelta where + (Map TxOutRef TxSkelRedeemer +i, [TxSkelOut] +o, TxSkelMints +m) <> :: DoubleSatDelta -> DoubleSatDelta -> DoubleSatDelta +<> (Map TxOutRef TxSkelRedeemer +i', [TxSkelOut] +o', TxSkelMints +m') = ( Map TxOutRef TxSkelRedeemer -i Map TxOutRef TxSkelRedeemer +i Map TxOutRef TxSkelRedeemer -> Map TxOutRef TxSkelRedeemer -> Map TxOutRef TxSkelRedeemer forall a. Semigroup a => a -> a -> a -<> Map TxOutRef TxSkelRedeemer -i', -- this is left-biased union +<> Map TxOutRef TxSkelRedeemer +i', -- this is left-biased union [TxSkelOut] -o [TxSkelOut] -> [TxSkelOut] -> [TxSkelOut] +o [TxSkelOut] -> [TxSkelOut] -> [TxSkelOut] forall a. [a] -> [a] -> [a] -++ [TxSkelOut] -o', +++ [TxSkelOut] +o', TxSkelMints -m TxSkelMints -> TxSkelMints -> TxSkelMints +m TxSkelMints -> TxSkelMints -> TxSkelMints forall a. Semigroup a => a -> a -> a -<> TxSkelMints -m' -- see the 'Semigroup' instance of 'TxSkelMints' +<> TxSkelMints +m' -- see the 'Semigroup' instance of 'TxSkelMints' ) -instance {-# OVERLAPPING #-} Monoid DoubleSatDelta where - mempty :: DoubleSatDelta -mempty = (Map TxOutRef TxSkelRedeemer +instance {-# OVERLAPPING #-} Monoid DoubleSatDelta where + mempty :: DoubleSatDelta +mempty = (Map TxOutRef TxSkelRedeemer forall k a. Map k a -Map.empty, [], TxSkelMints +Map.empty, [], TxSkelMints forall a. Monoid a => a -mempty) +mempty) -- | Double satisfacion attack. See the comment above for what such an attack is -- about conceptually. @@ -92,11 +92,11 @@ -- involved are fooled by what's already present on the transaction. Any extra -- value contained in new inputs to the transaction is then paid to the -- attacker. -doubleSatAttack :: - (MonadTweak m, Eq is, Is k A_Traversal) => +doubleSatAttack :: + (MonadTweak m, Eq is, Is k A_Traversal) => -- | how to combine modifications from caused by different foci. See the -- comment at 'combineModsTweak', which uses the same logic. - ([is] -> [[is]]) -> + ([is] -> [[is]]) -> -- | Each focus of this optic is a potential reason to add some extra -- constraints. -- @@ -104,7 +104,7 @@ -- validators of type @t@ with the following traversal: -- -- > txSkelOutsL % itaversed % txSkelOutputToTypedValidatorP @t - Optic' k (WithIx is) TxSkel a -> + Optic' k (WithIx is) TxSkel a -> -- | How to change each focus, and which inputs, outputs, and mints to add, -- for each of the foci. There might be different options for each focus, -- that's why the return value is a list. @@ -129,25 +129,25 @@ -- 'UtxoState' argument. -- -- ################################### - (is -> a -> m [(a, DoubleSatDelta)]) -> + (is -> a -> m [(a, DoubleSatDelta)]) -> -- | The wallet of the attacker, where any surplus is paid to. -- -- In the example, the extra value in the added 'spendsScript' constraints -- will be paid to the attacker. Wallet -> - m () + m () doubleSatAttack :: ([is] -> [[is]]) -> Optic' k (WithIx is) TxSkel a -> (is -> a -> m [(a, DoubleSatDelta)]) -> Wallet -> m () -doubleSatAttack [is] -> [[is]] -groupings Optic' k (WithIx is) TxSkel a -optic is -> a -> m [(a, DoubleSatDelta)] -change Wallet -attacker = do - [DoubleSatDelta] -deltas <- ([is] -> [[is]]) +doubleSatAttack [is] -> [[is]] +groupings Optic' k (WithIx is) TxSkel a +optic is -> a -> m [(a, DoubleSatDelta)] +change Wallet +attacker = do + [DoubleSatDelta] +deltas <- ([is] -> [[is]]) -> Optic' k (WithIx is) TxSkel a -> (is -> a -> m [(a, DoubleSatDelta)]) -> m [DoubleSatDelta] @@ -158,36 +158,36 @@ -> (is -> x -> m [(x, l)]) -> m [l] combineModsTweak [is] -> [[is]] -groupings Optic' k (WithIx is) TxSkel a -optic is -> a -> m [(a, DoubleSatDelta)] -change - let delta :: DoubleSatDelta -delta = [DoubleSatDelta] -> DoubleSatDelta -joinDoubleSatDeltas [DoubleSatDelta] -deltas +groupings Optic' k (WithIx is) TxSkel a +optic is -> a -> m [(a, DoubleSatDelta)] +change + let delta :: DoubleSatDelta +delta = [DoubleSatDelta] -> DoubleSatDelta +joinDoubleSatDeltas [DoubleSatDelta] +deltas DoubleSatDelta -> m () forall (m :: * -> *). MonadTweak m => DoubleSatDelta -> m () -addDoubleSatDeltaTweak DoubleSatDelta -delta - Value -addedValue <- DoubleSatDelta -> m Value +addDoubleSatDeltaTweak DoubleSatDelta +delta + Value +addedValue <- DoubleSatDelta -> m Value forall (m :: * -> *). MonadTweak m => DoubleSatDelta -> m Value -deltaBalance DoubleSatDelta -delta +deltaBalance DoubleSatDelta +delta if Value -addedValue Value -> Value -> Bool -`Pl.gt` Value +addedValue Value -> Value -> Bool +`Pl.gt` Value forall a. Monoid a => a -mempty +mempty then TxSkelOut -> m () forall (m :: * -> *). MonadTweak m => TxSkelOut -> m () addOutputTweak (TxSkelOut -> m ()) -> TxSkelOut -> m () forall a b. (a -> b) -> a -> b -$ PubKeyHash -> Value -> TxSkelOut +$ PubKeyHash -> Value -> TxSkelOut paysPK (Wallet -> PubKeyHash walletPKHash Wallet -attacker) Value -addedValue +attacker) Value +addedValue else m () forall (m :: * -> *) a. MonadTweak m => m a failingTweak @@ -197,131 +197,131 @@ DoubleSatLbl where -- for each triple of additional inputs, outputs, and mints, calculate its balance - deltaBalance :: MonadTweak m => DoubleSatDelta -> m Pl.Value - deltaBalance :: DoubleSatDelta -> m Value -deltaBalance (Map TxOutRef TxSkelRedeemer -inputs, [TxSkelOut] -outputs, TxSkelMints -mints) = do - Value -inValue <- ((TxOutRef, TxOut) -> Value) -> [(TxOutRef, TxOut)] -> Value + deltaBalance :: (MonadTweak m) => DoubleSatDelta -> m Pl.Value + deltaBalance :: DoubleSatDelta -> m Value +deltaBalance (Map TxOutRef TxSkelRedeemer +inputs, [TxSkelOut] +outputs, TxSkelMints +mints) = do + Value +inValue <- ((TxOutRef, TxOut) -> Value) -> [(TxOutRef, TxOut)] -> Value forall (t :: * -> *) m a. (Foldable t, Monoid m) => (a -> m) -> t a -> m -foldMap (TxOut -> Value +foldMap (TxOut -> Value forall o. (IsAbstractOutput o, ToValue (ValueType o)) => o -> Value outputValue (TxOut -> Value) -> ((TxOutRef, TxOut) -> TxOut) -> (TxOutRef, TxOut) -> Value forall b c a. (b -> c) -> (a -> b) -> a -> c -. (TxOutRef, TxOut) -> TxOut +. (TxOutRef, TxOut) -> TxOut forall a b. (a, b) -> b -snd) ([(TxOutRef, TxOut)] -> Value) +snd) ([(TxOutRef, TxOut)] -> Value) -> ([(TxOutRef, TxOut)] -> [(TxOutRef, TxOut)]) -> [(TxOutRef, TxOut)] -> Value forall b c a. (b -> c) -> (a -> b) -> a -> c -. ((TxOutRef, TxOut) -> Bool) +. ((TxOutRef, TxOut) -> Bool) -> [(TxOutRef, TxOut)] -> [(TxOutRef, TxOut)] forall a. (a -> Bool) -> [a] -> [a] -filter ((TxOutRef -> [TxOutRef] -> Bool +filter ((TxOutRef -> [TxOutRef] -> Bool forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool -`elem` Map TxOutRef TxSkelRedeemer -> [TxOutRef] +`elem` Map TxOutRef TxSkelRedeemer -> [TxOutRef] forall k a. Map k a -> [k] -Map.keys Map TxOutRef TxSkelRedeemer -inputs) (TxOutRef -> Bool) +Map.keys Map TxOutRef TxSkelRedeemer +inputs) (TxOutRef -> Bool) -> ((TxOutRef, TxOut) -> TxOutRef) -> (TxOutRef, TxOut) -> Bool forall b c a. (b -> c) -> (a -> b) -> a -> c -. (TxOutRef, TxOut) -> TxOutRef +. (TxOutRef, TxOut) -> TxOutRef forall a b. (a, b) -> a -fst) ([(TxOutRef, TxOut)] -> Value) -> m [(TxOutRef, TxOut)] -> m Value +fst) ([(TxOutRef, TxOut)] -> Value) -> m [(TxOutRef, TxOut)] -> m Value forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b -<$> m [(TxOutRef, TxOut)] +<$> m [(TxOutRef, TxOut)] forall (m :: * -> *). MonadBlockChainWithoutValidation m => m [(TxOutRef, TxOut)] allUtxos Value -> m Value forall (m :: * -> *) a. Monad m => a -> m a -return (Value -> m Value) -> Value -> m Value +return (Value -> m Value) -> Value -> m Value forall a b. (a -> b) -> a -> b -$ Value -inValue Value -> Value -> Value +$ Value +inValue Value -> Value -> Value forall a. Semigroup a => a -> a -> a -<> Value -> Value +<> Value -> Value forall a. AdditiveGroup a => a -> a -Pl.negate Value -outValue Value -> Value -> Value +Pl.negate Value +outValue Value -> Value -> Value forall a. Semigroup a => a -> a -> a -<> Value -mintValue +<> Value +mintValue where - outValue :: Value -outValue = Optic' A_Traversal '[] [TxSkelOut] Value -> [TxSkelOut] -> Value + outValue :: Value +outValue = Optic' A_Traversal '[] [TxSkelOut] Value -> [TxSkelOut] -> Value forall k a (is :: IxList) s. (Is k A_Fold, Monoid a) => Optic' k is s a -> s -> a -foldOf (Traversal [TxSkelOut] [TxSkelOut] TxSkelOut TxSkelOut +foldOf (Traversal [TxSkelOut] [TxSkelOut] TxSkelOut TxSkelOut forall (t :: * -> *) a b. Traversable t => Traversal (t a) (t b) a b -traversed Traversal [TxSkelOut] [TxSkelOut] TxSkelOut TxSkelOut +traversed Traversal [TxSkelOut] [TxSkelOut] TxSkelOut TxSkelOut -> Optic A_Lens '[] TxSkelOut TxSkelOut Value Value -> Optic' A_Traversal '[] [TxSkelOut] Value 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 -% Optic A_Lens '[] TxSkelOut TxSkelOut Value Value +% Optic A_Lens '[] TxSkelOut TxSkelOut Value Value txSkelOutValueL) [TxSkelOut] -outputs - mintValue :: Value -mintValue = TxSkelMints -> Value +outputs + mintValue :: Value +mintValue = TxSkelMints -> Value txSkelMintsValue TxSkelMints -mints +mints -- Helper tweak to add a 'DoubleSatDelta' to a transaction - addDoubleSatDeltaTweak :: MonadTweak m => DoubleSatDelta -> m () - addDoubleSatDeltaTweak :: DoubleSatDelta -> m () -addDoubleSatDeltaTweak (Map TxOutRef TxSkelRedeemer -ins, [TxSkelOut] -outs, TxSkelMints -mints) = + addDoubleSatDeltaTweak :: (MonadTweak m) => DoubleSatDelta -> m () + addDoubleSatDeltaTweak :: DoubleSatDelta -> m () +addDoubleSatDeltaTweak (Map TxOutRef TxSkelRedeemer +ins, [TxSkelOut] +outs, TxSkelMints +mints) = ((TxOutRef, TxSkelRedeemer) -> m ()) -> [(TxOutRef, TxSkelRedeemer)] -> m () forall (t :: * -> *) (m :: * -> *) a b. (Foldable t, Monad m) => (a -> m b) -> t a -> m () -mapM_ ((TxOutRef -> TxSkelRedeemer -> m ()) +mapM_ ((TxOutRef -> TxSkelRedeemer -> m ()) -> (TxOutRef, TxSkelRedeemer) -> m () forall a b c. (a -> b -> c) -> (a, b) -> c -uncurry TxOutRef -> TxSkelRedeemer -> m () +uncurry TxOutRef -> TxSkelRedeemer -> m () forall (m :: * -> *). MonadTweak m => TxOutRef -> TxSkelRedeemer -> m () addInputTweak) (Map TxOutRef TxSkelRedeemer -> [(TxOutRef, TxSkelRedeemer)] forall k a. Map k a -> [(k, a)] -Map.toList Map TxOutRef TxSkelRedeemer -ins) +Map.toList Map TxOutRef TxSkelRedeemer +ins) m () -> m () -> m () forall (m :: * -> *) a b. Monad m => m a -> m b -> m b ->> (TxSkelOut -> m ()) -> [TxSkelOut] -> m () +>> (TxSkelOut -> m ()) -> [TxSkelOut] -> m () forall (t :: * -> *) (m :: * -> *) a b. (Foldable t, Monad m) => (a -> m b) -> t a -> m () -mapM_ TxSkelOut -> m () +mapM_ TxSkelOut -> m () forall (m :: * -> *). MonadTweak m => TxSkelOut -> m () addOutputTweak [TxSkelOut] -outs +outs m () -> m () -> m () forall (m :: * -> *) a b. Monad m => m a -> m b -> m b ->> ((Versioned MintingPolicy, MintsRedeemer, TokenName, Integer) +>> ((Versioned MintingPolicy, MintsRedeemer, TokenName, Integer) -> m ()) -> [(Versioned MintingPolicy, MintsRedeemer, TokenName, Integer)] -> m () forall (t :: * -> *) (m :: * -> *) a b. (Foldable t, Monad m) => (a -> m b) -> t a -> m () -mapM_ (Versioned MintingPolicy, MintsRedeemer, TokenName, Integer) +mapM_ (Versioned MintingPolicy, MintsRedeemer, TokenName, Integer) -> m () forall (m :: * -> *). MonadTweak m => @@ -330,18 +330,18 @@ addMintTweak (TxSkelMints -> [(Versioned MintingPolicy, MintsRedeemer, TokenName, Integer)] txSkelMintsToList TxSkelMints -mints) +mints) -- Join a list of 'DoubleSatDelta's into one 'DoubleSatDelta' that specifies -- eveything that is contained in the input. - joinDoubleSatDeltas :: [DoubleSatDelta] -> DoubleSatDelta - joinDoubleSatDeltas :: [DoubleSatDelta] -> DoubleSatDelta -joinDoubleSatDeltas = [DoubleSatDelta] -> DoubleSatDelta + joinDoubleSatDeltas :: [DoubleSatDelta] -> DoubleSatDelta + joinDoubleSatDeltas :: [DoubleSatDelta] -> DoubleSatDelta +joinDoubleSatDeltas = [DoubleSatDelta] -> DoubleSatDelta forall a. Monoid a => [a] -> a -mconcat +mconcat data DoubleSatLbl = DoubleSatLbl - deriving (DoubleSatLbl -> DoubleSatLbl -> Bool + deriving (DoubleSatLbl -> DoubleSatLbl -> Bool (DoubleSatLbl -> DoubleSatLbl -> Bool) -> (DoubleSatLbl -> DoubleSatLbl -> Bool) -> Eq DoubleSatLbl forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a @@ -349,7 +349,7 @@ $c/= :: DoubleSatLbl -> DoubleSatLbl -> Bool == :: DoubleSatLbl -> DoubleSatLbl -> Bool $c== :: DoubleSatLbl -> DoubleSatLbl -> Bool -Eq, Int -> DoubleSatLbl -> ShowS +Eq, Int -> DoubleSatLbl -> ShowS [DoubleSatLbl] -> ShowS DoubleSatLbl -> String (Int -> DoubleSatLbl -> ShowS) @@ -364,7 +364,7 @@ $cshow :: DoubleSatLbl -> String showsPrec :: Int -> DoubleSatLbl -> ShowS $cshowsPrec :: Int -> DoubleSatLbl -> ShowS -Show, Eq DoubleSatLbl +Show, Eq DoubleSatLbl Eq DoubleSatLbl -> (DoubleSatLbl -> DoubleSatLbl -> Ordering) -> (DoubleSatLbl -> DoubleSatLbl -> Bool) @@ -402,5 +402,5 @@ compare :: DoubleSatLbl -> DoubleSatLbl -> Ordering $ccompare :: DoubleSatLbl -> DoubleSatLbl -> Ordering $cp1Ord :: Eq DoubleSatLbl -Ord) +Ord) \ No newline at end of file diff --git a/src/Cooked.Attack.DupToken.html b/src/Cooked.Attack.DupToken.html index a8c02c03a..89fdf5fdc 100644 --- a/src/Cooked.Attack.DupToken.html +++ b/src/Cooked.Attack.DupToken.html @@ -2,66 +2,66 @@ module Cooked.Attack.DupToken (dupTokenAttack, DupTokenLbl (..)) where -import Control.Monad +import Control.Monad import Cooked.Skeleton import Cooked.Tweak import Cooked.Wallet -import Optics.Core -import qualified Plutus.Script.Utils.Typed as Pl -import qualified Plutus.Script.Utils.V2.Scripts as Pl -import qualified Plutus.V1.Ledger.Value as Pl -import qualified PlutusTx.Numeric as Pl +import Optics.Core +import qualified Plutus.Script.Utils.Typed as Pl +import qualified Plutus.Script.Utils.V2.Scripts as Pl +import qualified Plutus.V1.Ledger.Value as Pl +import qualified PlutusTx.Numeric as Pl -- | A token duplication attack increases values in 'Mints'-constraints of a -- 'TxSkel' according to some conditions, and pays the extra minted value to a -- given recipient wallet. This adds a 'DupTokenLbl' to the labels of the -- transaction using 'addLabel'. Returns the 'Value' by which the minted value -- was increased. -dupTokenAttack :: - MonadTweak m => +dupTokenAttack :: + (MonadTweak m) => -- | A function describing how the amount of tokens specified by a 'Mints' -- constraint should be changed, depending on the asset class and the amount -- specified by the constraint. The given function @f@ should probably satisfy -- @f ac i > i@ for all @ac@ and @i@, i.e. it should increase the minted -- amount. If it does *not* increase the minted amount, the amount will be -- left unchanged. - (Pl.AssetClass -> Integer -> Integer) -> + (Pl.AssetClass -> Integer -> Integer) -> -- | The wallet of the attacker. Any additional tokens that are minted by the -- modified transaction but were not minted by the original transaction are -- paid to this wallet. Wallet -> - m Pl.Value + m Pl.Value dupTokenAttack :: (AssetClass -> Integer -> Integer) -> Wallet -> m Value -dupTokenAttack AssetClass -> Integer -> Integer -change Wallet -attacker = do - Value -totalIncrement <- m Value +dupTokenAttack AssetClass -> Integer -> Integer +change Wallet +attacker = do + Value +totalIncrement <- m Value forall (m :: * -> *). MonadTweak m => m Value -changeMintAmountsTweak +changeMintAmountsTweak TxSkelOut -> m () forall (m :: * -> *). MonadTweak m => TxSkelOut -> m () addOutputTweak (TxSkelOut -> m ()) -> TxSkelOut -> m () forall a b. (a -> b) -> a -> b -$ PubKeyHash -> Value -> TxSkelOut +$ PubKeyHash -> Value -> TxSkelOut paysPK (Wallet -> PubKeyHash walletPKHash Wallet -attacker) Value -totalIncrement +attacker) Value +totalIncrement DupTokenLbl -> m () forall (m :: * -> *) x. (MonadTweak m, LabelConstrs x) => x -> m () addLabelTweak DupTokenLbl DupTokenLbl Value -> m Value forall (m :: * -> *) a. Monad m => a -> m a -return Value -totalIncrement +return Value +totalIncrement where - changeMintAmountsTweak :: MonadTweak m => m Pl.Value - changeMintAmountsTweak :: m Value -changeMintAmountsTweak = do - [(Versioned MintingPolicy, MintsRedeemer, TokenName, Integer)] -oldMintsList <- Optic' + changeMintAmountsTweak :: (MonadTweak m) => m Pl.Value + changeMintAmountsTweak :: m Value +changeMintAmountsTweak = do + [(Versioned MintingPolicy, MintsRedeemer, TokenName, Integer)] +oldMintsList <- Optic' A_Getter '[] TxSkel @@ -84,7 +84,7 @@ [(Versioned MintingPolicy, MintsRedeemer, TokenName, Integer)] -> m [(Versioned MintingPolicy, MintsRedeemer, TokenName, Integer)] forall a b. (a -> b) -> a -> b -$ Lens' TxSkel TxSkelMints +$ Lens' TxSkel TxSkelMints txSkelMintsL Lens' TxSkel TxSkelMints -> Optic A_Getter @@ -102,7 +102,7 @@ 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 -% (TxSkelMints +% (TxSkelMints -> [(Versioned MintingPolicy, MintsRedeemer, TokenName, Integer)]) -> Optic A_Getter @@ -112,101 +112,101 @@ [(Versioned MintingPolicy, MintsRedeemer, TokenName, Integer)] [(Versioned MintingPolicy, MintsRedeemer, TokenName, Integer)] forall s a. (s -> a) -> Getter s a -to TxSkelMints +to TxSkelMints -> [(Versioned MintingPolicy, MintsRedeemer, TokenName, Integer)] txSkelMintsToList - let newMintsList :: [(Versioned MintingPolicy, MintsRedeemer, TokenName, Integer)] -newMintsList = + let newMintsList :: [(Versioned MintingPolicy, MintsRedeemer, TokenName, Integer)] +newMintsList = ((Versioned MintingPolicy, MintsRedeemer, TokenName, Integer) -> (Versioned MintingPolicy, MintsRedeemer, TokenName, Integer)) -> [(Versioned MintingPolicy, MintsRedeemer, TokenName, Integer)] -> [(Versioned MintingPolicy, MintsRedeemer, TokenName, Integer)] forall a b. (a -> b) -> [a] -> [b] -map - ( \(Pl.Versioned MintingPolicy -policy Language -version, MintsRedeemer -redeemer, TokenName -tName, Integer -oldAmount) -> - let ac :: AssetClass -ac = CurrencySymbol -> TokenName -> AssetClass -Pl.assetClass (MintingPolicyHash -> CurrencySymbol -Pl.mpsSymbol (MintingPolicyHash -> CurrencySymbol) +map + ( \(Pl.Versioned MintingPolicy +policy Language +version, MintsRedeemer +redeemer, TokenName +tName, Integer +oldAmount) -> + let ac :: AssetClass +ac = CurrencySymbol -> TokenName -> AssetClass +Pl.assetClass (MintingPolicyHash -> CurrencySymbol +Pl.mpsSymbol (MintingPolicyHash -> CurrencySymbol) -> MintingPolicyHash -> CurrencySymbol forall a b. (a -> b) -> a -> b -$ MintingPolicy -> MintingPolicyHash -Pl.mintingPolicyHash MintingPolicy -policy) TokenName -tName - newAmount :: Integer -newAmount = AssetClass -> Integer -> Integer -change AssetClass -ac Integer -oldAmount +$ MintingPolicy -> MintingPolicyHash +Pl.mintingPolicyHash MintingPolicy +policy) TokenName +tName + newAmount :: Integer +newAmount = AssetClass -> Integer -> Integer +change AssetClass +ac Integer +oldAmount in (MintingPolicy -> Language -> Versioned MintingPolicy forall script. script -> Language -> Versioned script -Pl.Versioned MintingPolicy -policy Language -version, MintsRedeemer -redeemer, TokenName -tName, Integer -> Integer -> Integer +Pl.Versioned MintingPolicy +policy Language +version, MintsRedeemer +redeemer, TokenName +tName, Integer -> Integer -> Integer forall a. Ord a => a -> a -> a -max Integer -newAmount Integer -oldAmount) +max Integer +newAmount Integer +oldAmount) ) [(Versioned MintingPolicy, MintsRedeemer, TokenName, Integer)] -oldMintsList +oldMintsList Bool -> m () forall (f :: * -> *). Alternative f => Bool -> f () -guard (Bool -> m ()) -> Bool -> m () +guard (Bool -> m ()) -> Bool -> m () forall a b. (a -> b) -> a -> b -$ [(Versioned MintingPolicy, MintsRedeemer, TokenName, Integer)] -newMintsList [(Versioned MintingPolicy, MintsRedeemer, TokenName, Integer)] +$ [(Versioned MintingPolicy, MintsRedeemer, TokenName, Integer)] +newMintsList [(Versioned MintingPolicy, MintsRedeemer, TokenName, Integer)] -> [(Versioned MintingPolicy, MintsRedeemer, TokenName, Integer)] -> Bool forall a. Eq a => a -> a -> Bool -/= [(Versioned MintingPolicy, MintsRedeemer, TokenName, Integer)] -oldMintsList - let newMints :: TxSkelMints -newMints = [(Versioned MintingPolicy, MintsRedeemer, TokenName, Integer)] +/= [(Versioned MintingPolicy, MintsRedeemer, TokenName, Integer)] +oldMintsList + let newMints :: TxSkelMints +newMints = [(Versioned MintingPolicy, MintsRedeemer, TokenName, Integer)] -> TxSkelMints txSkelMintsFromList [(Versioned MintingPolicy, MintsRedeemer, TokenName, Integer)] -newMintsList - newValue :: Value -newValue = TxSkelMints -> Value +newMintsList + newValue :: Value +newValue = TxSkelMints -> Value txSkelMintsValue TxSkelMints -newMints - oldValue :: Value -oldValue = TxSkelMints -> Value +newMints + oldValue :: Value +oldValue = TxSkelMints -> Value txSkelMintsValue (TxSkelMints -> Value) -> TxSkelMints -> Value forall a b. (a -> b) -> a -> b -$ [(Versioned MintingPolicy, MintsRedeemer, TokenName, Integer)] +$ [(Versioned MintingPolicy, MintsRedeemer, TokenName, Integer)] -> TxSkelMints txSkelMintsFromList [(Versioned MintingPolicy, MintsRedeemer, TokenName, Integer)] -oldMintsList +oldMintsList Lens' TxSkel TxSkelMints -> TxSkelMints -> m () forall (m :: * -> *) k (is :: IxList) a. (MonadTweak m, Is k A_Setter) => Optic' k is TxSkel a -> a -> m () setTweak Lens' TxSkel TxSkelMints txSkelMintsL TxSkelMints -newMints +newMints Value -> m Value forall (m :: * -> *) a. Monad m => a -> m a -return (Value -> m Value) -> Value -> m Value +return (Value -> m Value) -> Value -> m Value forall a b. (a -> b) -> a -> b -$ Value -newValue Value -> Value -> Value +$ Value +newValue Value -> Value -> Value forall a. Semigroup a => a -> a -> a -<> Value -> Value +<> Value -> Value forall a. AdditiveGroup a => a -> a -Pl.negate Value -oldValue +Pl.negate Value +oldValue data DupTokenLbl = DupTokenLbl - deriving (DupTokenLbl -> DupTokenLbl -> Bool + deriving (DupTokenLbl -> DupTokenLbl -> Bool (DupTokenLbl -> DupTokenLbl -> Bool) -> (DupTokenLbl -> DupTokenLbl -> Bool) -> Eq DupTokenLbl forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a @@ -214,7 +214,7 @@ $c/= :: DupTokenLbl -> DupTokenLbl -> Bool == :: DupTokenLbl -> DupTokenLbl -> Bool $c== :: DupTokenLbl -> DupTokenLbl -> Bool -Eq, Int -> DupTokenLbl -> ShowS +Eq, Int -> DupTokenLbl -> ShowS [DupTokenLbl] -> ShowS DupTokenLbl -> String (Int -> DupTokenLbl -> ShowS) @@ -229,7 +229,7 @@ $cshow :: DupTokenLbl -> String showsPrec :: Int -> DupTokenLbl -> ShowS $cshowsPrec :: Int -> DupTokenLbl -> ShowS -Show, Eq DupTokenLbl +Show, Eq DupTokenLbl Eq DupTokenLbl -> (DupTokenLbl -> DupTokenLbl -> Ordering) -> (DupTokenLbl -> DupTokenLbl -> Bool) @@ -267,5 +267,5 @@ compare :: DupTokenLbl -> DupTokenLbl -> Ordering $ccompare :: DupTokenLbl -> DupTokenLbl -> Ordering $cp1Ord :: Eq DupTokenLbl -Ord) +Ord) \ No newline at end of file diff --git a/src/Cooked.Currencies.html b/src/Cooked.Currencies.html index 7ed204422..1f3e70786 100644 --- a/src/Cooked.Currencies.html +++ b/src/Cooked.Currencies.html @@ -41,127 +41,127 @@ ) where -import qualified Ledger.Typed.Scripts as Scripts -import qualified Plutus.Script.Utils.V2.Scripts as Validation -import qualified Plutus.Script.Utils.Value as Pl -import qualified Plutus.V2.Ledger.Api as Pl -import qualified PlutusTx -import qualified PlutusTx.Builtins.Class as Pl -import PlutusTx.Prelude hiding (Applicative (..)) -import qualified Prelude as Haskell +import qualified Ledger.Typed.Scripts as Scripts +import qualified Plutus.Script.Utils.V2.Scripts as Validation +import qualified Plutus.Script.Utils.Value as Pl +import qualified Plutus.V2.Ledger.Api as Pl +import qualified PlutusTx +import qualified PlutusTx.Builtins.Class as Pl +import PlutusTx.Prelude hiding (Applicative (..)) +import qualified Prelude as Haskell -- * Quick Values -- | Token name of a /quick/ asset class; prefixes the name with a @'q'@ to -- make it easy to distinguish between quick and permanent tokens. -quickTokenName :: Haskell.String -> Pl.TokenName +quickTokenName :: Haskell.String -> Pl.TokenName quickTokenName :: String -> TokenName quickTokenName = BuiltinByteString -> TokenName -Pl.TokenName (BuiltinByteString -> TokenName) +Pl.TokenName (BuiltinByteString -> TokenName) -> (String -> BuiltinByteString) -> String -> TokenName forall b c a. (b -> c) -> (a -> b) -> a -> c -. String -> BuiltinByteString -Pl.stringToBuiltinByteString +. String -> BuiltinByteString +Pl.stringToBuiltinByteString -- | /Quick/ asset class from a token name -quickAssetClass :: Haskell.String -> Pl.AssetClass +quickAssetClass :: Haskell.String -> Pl.AssetClass quickAssetClass :: String -> AssetClass quickAssetClass = ((CurrencySymbol, TokenName) -> AssetClass) -> CurrencySymbol -> TokenName -> AssetClass forall a b c. ((a, b) -> c) -> a -> b -> c -curry (CurrencySymbol, TokenName) -> AssetClass -Pl.AssetClass CurrencySymbol +curry (CurrencySymbol, TokenName) -> AssetClass +Pl.AssetClass CurrencySymbol quickCurrencySymbol (TokenName -> AssetClass) -> (String -> TokenName) -> String -> AssetClass forall b c a. (b -> c) -> (a -> b) -> a -> c -. String -> TokenName +. String -> TokenName quickTokenName -- | Constructor for /quick/ values from token name and amount -quickValue :: Haskell.String -> Integer -> Pl.Value +quickValue :: Haskell.String -> Integer -> Pl.Value quickValue :: String -> Integer -> Value quickValue = AssetClass -> Integer -> Value -Pl.assetClassValue (AssetClass -> Integer -> Value) +Pl.assetClassValue (AssetClass -> Integer -> Value) -> (String -> AssetClass) -> String -> Integer -> Value forall b c a. (b -> c) -> (a -> b) -> a -> c -. String -> AssetClass +. String -> AssetClass quickAssetClass {-# INLINEABLE mkQuickCurrencyPolicy #-} -mkQuickCurrencyPolicy :: () -> Pl.ScriptContext -> Bool +mkQuickCurrencyPolicy :: () -> Pl.ScriptContext -> Bool mkQuickCurrencyPolicy :: () -> ScriptContext -> Bool mkQuickCurrencyPolicy () _ ScriptContext _ = Bool -True +True -quickCurrencyPolicy :: Scripts.MintingPolicy +quickCurrencyPolicy :: Scripts.MintingPolicy quickCurrencyPolicy :: MintingPolicy quickCurrencyPolicy = CompiledCode (BuiltinData -> BuiltinData -> ()) -> MintingPolicy -Pl.mkMintingPolicyScript - $$(PlutusTx.compile [||Scripts.mkUntypedMintingPolicy mkQuickCurrencyPolicy||]) +Pl.mkMintingPolicyScript + $$(PlutusTx.compile [||Scripts.mkUntypedMintingPolicy mkQuickCurrencyPolicy||]) -quickCurrencySymbol :: Pl.CurrencySymbol +quickCurrencySymbol :: Pl.CurrencySymbol quickCurrencySymbol :: CurrencySymbol quickCurrencySymbol = MintingPolicy -> CurrencySymbol -Validation.scriptCurrencySymbol MintingPolicy +Validation.scriptCurrencySymbol MintingPolicy quickCurrencyPolicy -- * Permanent values -- | Token name of a /permanent/ asset class -permanentTokenName :: Haskell.String -> Pl.TokenName +permanentTokenName :: Haskell.String -> Pl.TokenName permanentTokenName :: String -> TokenName permanentTokenName = BuiltinByteString -> TokenName -Pl.TokenName (BuiltinByteString -> TokenName) +Pl.TokenName (BuiltinByteString -> TokenName) -> (String -> BuiltinByteString) -> String -> TokenName forall b c a. (b -> c) -> (a -> b) -> a -> c -. String -> BuiltinByteString -Pl.stringToBuiltinByteString +. String -> BuiltinByteString +Pl.stringToBuiltinByteString -- | /Permanent/ asset class from a token name -permanentAssetClass :: Haskell.String -> Pl.AssetClass +permanentAssetClass :: Haskell.String -> Pl.AssetClass permanentAssetClass :: String -> AssetClass permanentAssetClass = ((CurrencySymbol, TokenName) -> AssetClass) -> CurrencySymbol -> TokenName -> AssetClass forall a b c. ((a, b) -> c) -> a -> b -> c -curry (CurrencySymbol, TokenName) -> AssetClass -Pl.AssetClass CurrencySymbol +curry (CurrencySymbol, TokenName) -> AssetClass +Pl.AssetClass CurrencySymbol permanentCurrencySymbol (TokenName -> AssetClass) -> (String -> TokenName) -> String -> AssetClass forall b c a. (b -> c) -> (a -> b) -> a -> c -. String -> TokenName +. String -> TokenName permanentTokenName -- | Constructor for /Permanent/ values from token name and amount -permanentValue :: Haskell.String -> Integer -> Pl.Value +permanentValue :: Haskell.String -> Integer -> Pl.Value permanentValue :: String -> Integer -> Value permanentValue = AssetClass -> Integer -> Value -Pl.assetClassValue (AssetClass -> Integer -> Value) +Pl.assetClassValue (AssetClass -> Integer -> Value) -> (String -> AssetClass) -> String -> Integer -> Value forall b c a. (b -> c) -> (a -> b) -> a -> c -. String -> AssetClass +. String -> AssetClass permanentAssetClass {-# INLINEABLE mkPermanentCurrencyPolicy #-} -mkPermanentCurrencyPolicy :: () -> Pl.ScriptContext -> Bool +mkPermanentCurrencyPolicy :: () -> Pl.ScriptContext -> Bool mkPermanentCurrencyPolicy :: () -> ScriptContext -> Bool mkPermanentCurrencyPolicy () _ ScriptContext _ = Bool -False +False -permanentCurrencyPolicy :: Scripts.MintingPolicy +permanentCurrencyPolicy :: Scripts.MintingPolicy permanentCurrencyPolicy :: MintingPolicy permanentCurrencyPolicy = CompiledCode (BuiltinData -> BuiltinData -> ()) -> MintingPolicy -Pl.mkMintingPolicyScript - $$(PlutusTx.compile [||Scripts.mkUntypedMintingPolicy mkPermanentCurrencyPolicy||]) +Pl.mkMintingPolicyScript + $$(PlutusTx.compile [||Scripts.mkUntypedMintingPolicy mkPermanentCurrencyPolicy||]) -permanentCurrencySymbol :: Pl.CurrencySymbol +permanentCurrencySymbol :: Pl.CurrencySymbol permanentCurrencySymbol :: CurrencySymbol permanentCurrencySymbol = MintingPolicy -> CurrencySymbol -Validation.scriptCurrencySymbol MintingPolicy +Validation.scriptCurrencySymbol MintingPolicy permanentCurrencyPolicy \ No newline at end of file diff --git a/src/Cooked.Ltl.html b/src/Cooked.Ltl.html index 7ef1447b6..08a15cf78 100644 --- a/src/Cooked.Ltl.html +++ b/src/Cooked.Ltl.html @@ -18,9 +18,9 @@ ) where -import Control.Monad -import Control.Monad.State -import Data.Kind +import Control.Monad +import Control.Monad.State +import Data.Kind -- * LTL formulas and operations on them @@ -29,33 +29,33 @@ -- apply modifications. Since it does not make (obvious) sense to talk of a -- negated modification or of one modification (possibly in the future) to -- imply another modification, implication and negation are absent. -data Ltl a +data Ltl a = -- | The "do nothing" modification that never fails LtlTruth | -- | The modification that never applies (i.e. always fails) LtlFalsity | -- | The modification that applies a given atomic modification at the current time step - LtlAtom a + LtlAtom a | -- | Disjunction will be interpreted in an "intuitionistic" way, i.e. as -- branching into the "timeline" where the left disjunct holds and the one -- where the right disjunct holds. In that sense, it is an exclusive or, -- as it does not introduce the branch where both disjuncts hold. - LtlOr (Ltl a) (Ltl a) + LtlOr (Ltl a) (Ltl a) | -- | Conjunction will be interpreted as "apply both -- modifications". Attention: The "apply both" operation will be -- user-defined for atomic modifications, so that conjunction may for -- example fail to be commutative if the operation on atomic modification is -- not commutative. - LtlAnd (Ltl a) (Ltl a) + LtlAnd (Ltl a) (Ltl a) | -- | Assert that the given formula holds at the next time step. - LtlNext (Ltl a) + LtlNext (Ltl a) | -- | Assert that the first formula holds at least until the second one begins -- to hold, which must happen eventually. The formulas -- > a `LtlUntil` b -- and -- > b `LtlOr` (a `LtlAnd` LtlNext (a `LtlUntil` b)) -- are equivalent. - LtlUntil (Ltl a) (Ltl a) + LtlUntil (Ltl a) (Ltl a) | -- | Assert that the second formula has to be true up to and including the -- point when the first one becomes true; if that never happens, the second -- formula has to remain true forever. View this as dual to 'LtlUntil'. The @@ -64,8 +64,8 @@ -- and -- > b `LtlAnd` (a `LtlOr` LtlNext (a `LtlRelease` b)) -- are equivalent. - LtlRelease (Ltl a) (Ltl a) - deriving (Int -> Ltl a -> ShowS + LtlRelease (Ltl a) (Ltl a) + deriving (Int -> Ltl a -> ShowS [Ltl a] -> ShowS Ltl a -> String (Int -> Ltl a -> ShowS) @@ -81,7 +81,7 @@ $cshow :: forall a. Show a => Ltl a -> String showsPrec :: Int -> Ltl a -> ShowS $cshowsPrec :: forall a. Show a => Int -> Ltl a -> ShowS -Show) +Show) -- | Split an LTL formula that describes a modification of a computation into a -- list of @(doNow, doLater)@ pairs, where @@ -102,151 +102,151 @@ -- <> b@ as the modification that first applies @b@ and then @a@. Attention: -- Since we use '<>' to define conjunction, if '<>' is not commutative, -- conjunction will also fail to be commutative! -nowLater :: Monoid a => Ltl a -> [(a, Ltl a)] +nowLater :: (Monoid a) => Ltl a -> [(a, Ltl a)] nowLater :: Ltl a -> [(a, Ltl a)] nowLater Ltl a LtlTruth = [(a forall a. Monoid a => a -mempty, Ltl a +mempty, Ltl a forall a. Ltl a LtlTruth)] nowLater Ltl a LtlFalsity = [] -nowLater (LtlAtom a -g) = [(a -g, Ltl a +nowLater (LtlAtom a +g) = [(a +g, Ltl a forall a. Ltl a LtlTruth)] -nowLater (Ltl a -a `LtlOr` Ltl a -b) = Ltl a -> [(a, Ltl a)] +nowLater (Ltl a +a `LtlOr` Ltl a +b) = Ltl a -> [(a, Ltl a)] forall a. Monoid a => Ltl a -> [(a, Ltl a)] nowLater Ltl a -a [(a, Ltl a)] -> [(a, Ltl a)] -> [(a, Ltl a)] +a [(a, Ltl a)] -> [(a, Ltl a)] -> [(a, Ltl a)] forall a. [a] -> [a] -> [a] -++ Ltl a -> [(a, Ltl a)] +++ Ltl a -> [(a, Ltl a)] forall a. Monoid a => Ltl a -> [(a, Ltl a)] nowLater Ltl a -b -nowLater (Ltl a -a `LtlAnd` Ltl a -b) = +b +nowLater (Ltl a +a `LtlAnd` Ltl a +b) = [ (a -f a -> a -> a +f a -> a -> a forall a. Semigroup a => a -> a -> a -<> a -g, Ltl a -> Ltl a +<> a +g, Ltl a -> Ltl a forall a. Ltl a -> Ltl a ltlSimpl (Ltl a -> Ltl a) -> Ltl a -> Ltl a forall a b. (a -> b) -> a -> b -$ Ltl a -c Ltl a -> Ltl a -> Ltl a +$ Ltl a +c Ltl a -> Ltl a -> Ltl a forall a. Ltl a -> Ltl a -> Ltl a `LtlAnd` Ltl a -d) - | (a -f, Ltl a -c) <- Ltl a -> [(a, Ltl a)] +d) + | (a +f, Ltl a +c) <- Ltl a -> [(a, Ltl a)] forall a. Monoid a => Ltl a -> [(a, Ltl a)] nowLater Ltl a -a, - (a -g, Ltl a -d) <- Ltl a -> [(a, Ltl a)] +a, + (a +g, Ltl a +d) <- Ltl a -> [(a, Ltl a)] forall a. Monoid a => Ltl a -> [(a, Ltl a)] nowLater Ltl a -b +b ] -nowLater (LtlNext Ltl a -a) = [(a +nowLater (LtlNext Ltl a +a) = [(a forall a. Monoid a => a -mempty, Ltl a -a)] -nowLater (Ltl a -a `LtlUntil` Ltl a -b) = +mempty, Ltl a +a)] +nowLater (Ltl a +a `LtlUntil` Ltl a +b) = Ltl a -> [(a, Ltl a)] forall a. Monoid a => Ltl a -> [(a, Ltl a)] nowLater (Ltl a -> [(a, Ltl a)]) -> Ltl a -> [(a, Ltl a)] forall a b. (a -> b) -> a -> b -$ Ltl a -b Ltl a -> Ltl a -> Ltl a +$ Ltl a +b Ltl a -> Ltl a -> Ltl a forall a. Ltl a -> Ltl a -> Ltl a `LtlOr` (Ltl a -a Ltl a -> Ltl a -> Ltl a +a Ltl a -> Ltl a -> Ltl a forall a. Ltl a -> Ltl a -> Ltl a `LtlAnd` Ltl a -> Ltl a forall a. Ltl a -> Ltl a LtlNext (Ltl a -a Ltl a -> Ltl a -> Ltl a +a Ltl a -> Ltl a -> Ltl a forall a. Ltl a -> Ltl a -> Ltl a `LtlUntil` Ltl a -b)) -nowLater (Ltl a -a `LtlRelease` Ltl a -b) = +b)) +nowLater (Ltl a +a `LtlRelease` Ltl a +b) = Ltl a -> [(a, Ltl a)] forall a. Monoid a => Ltl a -> [(a, Ltl a)] nowLater (Ltl a -> [(a, Ltl a)]) -> Ltl a -> [(a, Ltl a)] forall a b. (a -> b) -> a -> b -$ Ltl a -b Ltl a -> Ltl a -> Ltl a +$ Ltl a +b Ltl a -> Ltl a -> Ltl a forall a. Ltl a -> Ltl a -> Ltl a `LtlAnd` (Ltl a -a Ltl a -> Ltl a -> Ltl a +a Ltl a -> Ltl a -> Ltl a forall a. Ltl a -> Ltl a -> Ltl a `LtlOr` Ltl a -> Ltl a forall a. Ltl a -> Ltl a LtlNext (Ltl a -a Ltl a -> Ltl a -> Ltl a +a Ltl a -> Ltl a -> Ltl a forall a. Ltl a -> Ltl a -> Ltl a `LtlRelease` Ltl a -b)) +b)) -- | If there are no more steps and the next step should satisfy the given -- formula: Are we finished, i.e. was the initial formula satisfied by now? -finished :: Ltl a -> Bool +finished :: Ltl a -> Bool finished :: Ltl a -> Bool finished Ltl a LtlTruth = Bool -True +True finished Ltl a LtlFalsity = Bool -False -- we want falsity to fail always, even on the empty computation +False -- we want falsity to fail always, even on the empty computation finished (LtlAtom a _) = Bool -False -finished (Ltl a -a `LtlAnd` Ltl a -b) = Ltl a -> Bool +False +finished (Ltl a +a `LtlAnd` Ltl a +b) = Ltl a -> Bool forall a. Ltl a -> Bool finished Ltl a -a Bool -> Bool -> Bool -&& Ltl a -> Bool +a Bool -> Bool -> Bool +&& Ltl a -> Bool forall a. Ltl a -> Bool finished Ltl a -b -finished (Ltl a -a `LtlOr` Ltl a -b) = Ltl a -> Bool +b +finished (Ltl a +a `LtlOr` Ltl a +b) = Ltl a -> Bool forall a. Ltl a -> Bool finished Ltl a -a Bool -> Bool -> Bool -|| Ltl a -> Bool +a Bool -> Bool -> Bool +|| Ltl a -> Bool forall a. Ltl a -> Bool finished Ltl a -b +b finished (LtlNext Ltl a _) = Bool -False +False finished (LtlUntil Ltl a _ Ltl a _) = Bool -False +False finished (LtlRelease Ltl a _ Ltl a _) = Bool -True +True -- | Say we're passing around more than one formula from each time step to the -- next, where the intended meaning of a list of formulas is the modification @@ -254,44 +254,44 @@ -- then the third and so on. We'd still like to compute a list of @(doNow, -- doLater)@ pairs as in 'nowLater', only that the @doLater@ should again be a -- list of formulas. -nowLaterList :: Monoid a => [Ltl a] -> [(a, [Ltl a])] +nowLaterList :: (Monoid a) => [Ltl a] -> [(a, [Ltl a])] nowLaterList :: [Ltl a] -> [(a, [Ltl a])] nowLaterList = [[(a, Ltl a)]] -> [(a, [Ltl a])] forall a a. Monoid a => [[(a, a)]] -> [(a, [a])] -joinNowLaters ([[(a, Ltl a)]] -> [(a, [Ltl a])]) +joinNowLaters ([[(a, Ltl a)]] -> [(a, [Ltl a])]) -> ([Ltl a] -> [[(a, Ltl a)]]) -> [Ltl a] -> [(a, [Ltl a])] forall b c a. (b -> c) -> (a -> b) -> a -> c -. (Ltl a -> [(a, Ltl a)]) -> [Ltl a] -> [[(a, Ltl a)]] +. (Ltl a -> [(a, Ltl a)]) -> [Ltl a] -> [[(a, Ltl a)]] forall a b. (a -> b) -> [a] -> [b] -map Ltl a -> [(a, Ltl a)] +map Ltl a -> [(a, Ltl a)] forall a. Monoid a => Ltl a -> [(a, Ltl a)] nowLater where - joinNowLaters :: [[(a, a)]] -> [(a, [a])] -joinNowLaters [] = [(a + joinNowLaters :: [[(a, a)]] -> [(a, [a])] +joinNowLaters [] = [(a forall a. Monoid a => a -mempty, [])] - joinNowLaters ([(a, a)] -l : [[(a, a)]] -ls) = +mempty, [])] + joinNowLaters ([(a, a)] +l : [[(a, a)]] +ls) = [ (a -g a -> a -> a +g a -> a -> a forall a. Semigroup a => a -> a -> a -<> a -f, a -c a -> [a] -> [a] +<> a +f, a +c a -> [a] -> [a] forall a. a -> [a] -> [a] -: [a] -cs) - | (a -f, a -c) <- [(a, a)] -l, - (a -g, [a] -cs) <- [[(a, a)]] -> [(a, [a])] -joinNowLaters [[(a, a)]] -ls +: [a] +cs) + | (a +f, a +c) <- [(a, a)] +l, + (a +g, [a] +cs) <- [[(a, a)]] -> [(a, [a])] +joinNowLaters [[(a, a)]] +ls ] -- | Straightforward simplification procedure for LTL formulas. This function @@ -299,234 +299,234 @@ -- and recursively applies this knowledge; it does not do anything "fancy" like -- computing a normal form and is only used to keep the formulas 'nowLater' -- generates from growing too wildly. -ltlSimpl :: Ltl a -> Ltl a +ltlSimpl :: Ltl a -> Ltl a ltlSimpl :: Ltl a -> Ltl a -ltlSimpl Ltl a -expr = - let (Ltl a -expr', Bool -progress) = Ltl a -> (Ltl a, Bool) +ltlSimpl Ltl a +expr = + let (Ltl a +expr', Bool +progress) = Ltl a -> (Ltl a, Bool) forall a. Ltl a -> (Ltl a, Bool) -simpl Ltl a -expr +simpl Ltl a +expr in if Bool -progress then Ltl a -expr' else Ltl a -expr +progress then Ltl a +expr' else Ltl a +expr where - simpl :: Ltl a -> (Ltl a, Bool) - simpl :: Ltl a -> (Ltl a, Bool) -simpl (LtlAnd Ltl a -a Ltl a -b) = Ltl a -> Ltl a -> (Ltl a, Bool) + simpl :: Ltl a -> (Ltl a, Bool) + simpl :: Ltl a -> (Ltl a, Bool) +simpl (LtlAnd Ltl a +a Ltl a +b) = Ltl a -> Ltl a -> (Ltl a, Bool) forall a. Ltl a -> Ltl a -> (Ltl a, Bool) -simplAnd Ltl a -a Ltl a -b - simpl (LtlOr Ltl a -a Ltl a -b) = Ltl a -> Ltl a -> (Ltl a, Bool) +simplAnd Ltl a +a Ltl a +b + simpl (LtlOr Ltl a +a Ltl a +b) = Ltl a -> Ltl a -> (Ltl a, Bool) forall a. Ltl a -> Ltl a -> (Ltl a, Bool) -simplOr Ltl a -a Ltl a -b - simpl (LtlNext Ltl a -a) = - let (Ltl a -a', Bool -pa) = Ltl a -> (Ltl a, Bool) +simplOr Ltl a +a Ltl a +b + simpl (LtlNext Ltl a +a) = + let (Ltl a +a', Bool +pa) = Ltl a -> (Ltl a, Bool) forall a. Ltl a -> (Ltl a, Bool) -simpl Ltl a -a +simpl Ltl a +a in if Bool -pa +pa then (Ltl a -> Ltl a forall a. Ltl a -> Ltl a LtlNext Ltl a -a', Bool -True) +a', Bool +True) else (Ltl a -> Ltl a forall a. Ltl a -> Ltl a LtlNext Ltl a -a, Bool -False) - simpl (LtlUntil Ltl a -a Ltl a -b) = (Ltl a -> Ltl a -> Ltl a) -> Ltl a -> Ltl a -> (Ltl a, Bool) +a, Bool +False) + simpl (LtlUntil Ltl a +a Ltl a +b) = (Ltl a -> Ltl a -> Ltl a) -> Ltl a -> Ltl a -> (Ltl a, Bool) forall a. (Ltl a -> Ltl a -> Ltl a) -> Ltl a -> Ltl a -> (Ltl a, Bool) -recurse2 Ltl a -> Ltl a -> Ltl a +recurse2 Ltl a -> Ltl a -> Ltl a forall a. Ltl a -> Ltl a -> Ltl a LtlUntil Ltl a -a Ltl a -b - simpl (LtlRelease Ltl a -a Ltl a -b) = (Ltl a -> Ltl a -> Ltl a) -> Ltl a -> Ltl a -> (Ltl a, Bool) +a Ltl a +b + simpl (LtlRelease Ltl a +a Ltl a +b) = (Ltl a -> Ltl a -> Ltl a) -> Ltl a -> Ltl a -> (Ltl a, Bool) forall a. (Ltl a -> Ltl a -> Ltl a) -> Ltl a -> Ltl a -> (Ltl a, Bool) -recurse2 Ltl a -> Ltl a -> Ltl a +recurse2 Ltl a -> Ltl a -> Ltl a forall a. Ltl a -> Ltl a -> Ltl a LtlRelease Ltl a -a Ltl a -b - simpl Ltl a -x = (Ltl a -x, Bool -False) +a Ltl a +b + simpl Ltl a +x = (Ltl a +x, Bool +False) - simplAnd :: Ltl a -> Ltl a -> (Ltl a, Bool) - simplAnd :: Ltl a -> Ltl a -> (Ltl a, Bool) -simplAnd Ltl a -a Ltl a -b = - let (Ltl a -a', Bool -pa) = Ltl a -> (Ltl a, Bool) + simplAnd :: Ltl a -> Ltl a -> (Ltl a, Bool) + simplAnd :: Ltl a -> Ltl a -> (Ltl a, Bool) +simplAnd Ltl a +a Ltl a +b = + let (Ltl a +a', Bool +pa) = Ltl a -> (Ltl a, Bool) forall a. Ltl a -> (Ltl a, Bool) -simpl Ltl a -a - (Ltl a -b', Bool -pb) = Ltl a -> (Ltl a, Bool) +simpl Ltl a +a + (Ltl a +b', Bool +pb) = Ltl a -> (Ltl a, Bool) forall a. Ltl a -> (Ltl a, Bool) -simpl Ltl a -b +simpl Ltl a +b in case (Ltl a -a', Ltl a -b') of +a', Ltl a +b') of (Ltl a LtlTruth, Ltl a _) -> (Ltl a -b', Bool -True) +b', Bool +True) (Ltl a _, Ltl a LtlTruth) -> (Ltl a -a', Bool -True) +a', Bool +True) (Ltl a LtlFalsity, Ltl a _) -> (Ltl a forall a. Ltl a LtlFalsity, Bool -True) +True) (Ltl a _, Ltl a LtlFalsity) -> (Ltl a forall a. Ltl a LtlFalsity, Bool -True) +True) (Ltl a, Ltl a) _ -> if Bool -pa Bool -> Bool -> Bool -|| Bool -pb then (Ltl a -> Ltl a -> Ltl a +pa Bool -> Bool -> Bool +|| Bool +pb then (Ltl a -> Ltl a -> Ltl a forall a. Ltl a -> Ltl a -> Ltl a LtlAnd Ltl a -a' Ltl a -b', Bool -True) else (Ltl a -> Ltl a -> Ltl a +a' Ltl a +b', Bool +True) else (Ltl a -> Ltl a -> Ltl a forall a. Ltl a -> Ltl a -> Ltl a LtlAnd Ltl a -a Ltl a -b, Bool -False) +a Ltl a +b, Bool +False) - simplOr :: Ltl a -> Ltl a -> (Ltl a, Bool) - simplOr :: Ltl a -> Ltl a -> (Ltl a, Bool) -simplOr Ltl a -a Ltl a -b = - let (Ltl a -a', Bool -pa) = Ltl a -> (Ltl a, Bool) + simplOr :: Ltl a -> Ltl a -> (Ltl a, Bool) + simplOr :: Ltl a -> Ltl a -> (Ltl a, Bool) +simplOr Ltl a +a Ltl a +b = + let (Ltl a +a', Bool +pa) = Ltl a -> (Ltl a, Bool) forall a. Ltl a -> (Ltl a, Bool) -simpl Ltl a -a - (Ltl a -b', Bool -pb) = Ltl a -> (Ltl a, Bool) +simpl Ltl a +a + (Ltl a +b', Bool +pb) = Ltl a -> (Ltl a, Bool) forall a. Ltl a -> (Ltl a, Bool) -simpl Ltl a -b +simpl Ltl a +b in case (Ltl a -a', Ltl a -b') of +a', Ltl a +b') of (Ltl a LtlTruth, Ltl a _) -> (Ltl a forall a. Ltl a LtlTruth, Bool -True) +True) (Ltl a _, Ltl a LtlTruth) -> (Ltl a forall a. Ltl a LtlTruth, Bool -True) +True) (Ltl a LtlFalsity, Ltl a _) -> (Ltl a -b', Bool -True) +b', Bool +True) (Ltl a _, Ltl a LtlFalsity) -> (Ltl a -a', Bool -True) +a', Bool +True) (Ltl a, Ltl a) _ -> if Bool -pa Bool -> Bool -> Bool -|| Bool -pb then (Ltl a -> Ltl a -> Ltl a +pa Bool -> Bool -> Bool +|| Bool +pb then (Ltl a -> Ltl a -> Ltl a forall a. Ltl a -> Ltl a -> Ltl a LtlOr Ltl a -a' Ltl a -b', Bool -True) else (Ltl a -> Ltl a -> Ltl a +a' Ltl a +b', Bool +True) else (Ltl a -> Ltl a -> Ltl a forall a. Ltl a -> Ltl a -> Ltl a LtlOr Ltl a -a Ltl a -b, Bool -False) +a Ltl a +b, Bool +False) - recurse2 :: - (Ltl a -> Ltl a -> Ltl a) -> - Ltl a -> - Ltl a -> - (Ltl a, Bool) - recurse2 :: (Ltl a -> Ltl a -> Ltl a) -> Ltl a -> Ltl a -> (Ltl a, Bool) -recurse2 Ltl a -> Ltl a -> Ltl a -f Ltl a -a Ltl a -b = - let (Ltl a -a', Bool -pa) = Ltl a -> (Ltl a, Bool) + recurse2 :: + (Ltl a -> Ltl a -> Ltl a) -> + Ltl a -> + Ltl a -> + (Ltl a, Bool) + recurse2 :: (Ltl a -> Ltl a -> Ltl a) -> Ltl a -> Ltl a -> (Ltl a, Bool) +recurse2 Ltl a -> Ltl a -> Ltl a +f Ltl a +a Ltl a +b = + let (Ltl a +a', Bool +pa) = Ltl a -> (Ltl a, Bool) forall a. Ltl a -> (Ltl a, Bool) -simpl Ltl a -a - (Ltl a -b', Bool -pb) = Ltl a -> (Ltl a, Bool) +simpl Ltl a +a + (Ltl a +b', Bool +pb) = Ltl a -> (Ltl a, Bool) forall a. Ltl a -> (Ltl a, Bool) -simpl Ltl a -b +simpl Ltl a +b in if Bool -pa Bool -> Bool -> Bool -|| Bool -pb +pa Bool -> Bool -> Bool +|| Bool +pb then (Ltl a -> Ltl a -> Ltl a -f Ltl a -a' Ltl a -b', Bool -True) +f Ltl a +a' Ltl a +b', Bool +True) else (Ltl a -> Ltl a -> Ltl a -f Ltl a -a Ltl a -b, Bool -False) +f Ltl a +a Ltl a +b, Bool +False) -- * An AST for "reified computations" @@ -539,81 +539,81 @@ -- * every step can be modified by a @modification@. -- | Operations for computations that can be modified using LTL formulas. -data LtlOp (modification :: *) (builtin :: * -> *) :: * -> * where +data LtlOp (modification :: *) (builtin :: * -> *) :: * -> * where -- | The operation that introduces a new LTL formula that should be used to -- modify the following computations. Think of this operation as coming -- between time steps and adding a new formula to be applied before all of the -- formulas that should already be applied to the next time step. - StartLtl :: Ltl modification -> LtlOp modification builtin () + StartLtl :: Ltl modification -> LtlOp modification builtin () -- | The operation that removes the last LTL formula that was introduced. If -- the formula is not yet 'finished', the current time line will fail. - StopLtl :: LtlOp modification builtin () - Builtin :: builtin a -> LtlOp modification builtin a + StopLtl :: LtlOp modification builtin () + Builtin :: builtin a -> LtlOp modification builtin a -- | The freer monad on @op@. We think of this as the AST of a computation with -- operations of types @op a@. -data Staged (op :: * -> *) :: * -> * where - Return :: a -> Staged op a - Instr :: op a -> (a -> Staged op b) -> Staged op b +data Staged (op :: * -> *) :: * -> * where + Return :: a -> Staged op a + Instr :: op a -> (a -> Staged op b) -> Staged op b -instance Functor (Staged op) where - fmap :: (a -> b) -> Staged op a -> Staged op b -fmap a -> b -f (Return a -x) = b -> Staged op b +instance Functor (Staged op) where + fmap :: (a -> b) -> Staged op a -> Staged op b +fmap a -> b +f (Return a +x) = b -> Staged op b forall a (op :: * -> *). a -> Staged op a Return (b -> Staged op b) -> b -> Staged op b forall a b. (a -> b) -> a -> b -$ a -> b -f a -x - fmap a -> b -f (Instr op a -op a -> Staged op a -cont) = op a -> (a -> Staged op b) -> Staged op b +$ a -> b +f a +x + fmap a -> b +f (Instr op a +op a -> Staged op a +cont) = op a -> (a -> Staged op b) -> Staged op b forall (op :: * -> *) a b. op a -> (a -> Staged op b) -> Staged op b Instr op a -op ((a -> b) -> Staged op a -> Staged op b +op ((a -> b) -> Staged op a -> Staged op b forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b -fmap a -> b -f (Staged op a -> Staged op b) +fmap a -> b +f (Staged op a -> Staged op b) -> (a -> Staged op a) -> a -> Staged op b forall b c a. (b -> c) -> (a -> b) -> a -> c -. a -> Staged op a -cont) +. a -> Staged op a +cont) -instance Applicative (Staged op) where - pure :: a -> Staged op a -pure = a -> Staged op a +instance Applicative (Staged op) where + pure :: a -> Staged op a +pure = a -> Staged op a forall a (op :: * -> *). a -> Staged op a Return - <*> :: Staged op (a -> b) -> Staged op a -> Staged op b -(<*>) = Staged op (a -> b) -> Staged op a -> Staged op b + <*> :: Staged op (a -> b) -> Staged op a -> Staged op b +(<*>) = Staged op (a -> b) -> Staged op a -> Staged op b forall (m :: * -> *) a b. Monad m => m (a -> b) -> m a -> m b -ap +ap -instance Monad (Staged op) where - (Return a -x) >>= :: Staged op a -> (a -> Staged op b) -> Staged op b ->>= a -> Staged op b -f = a -> Staged op b -f a -x - (Instr op a -i a -> Staged op a -m) >>= a -> Staged op b -f = op a -> (a -> Staged op b) -> Staged op b +instance Monad (Staged op) where + (Return a +x) >>= :: Staged op a -> (a -> Staged op b) -> Staged op b +>>= a -> Staged op b +f = a -> Staged op b +f a +x + (Instr op a +i a -> Staged op a +m) >>= a -> Staged op b +f = op a -> (a -> Staged op b) -> Staged op b forall (op :: * -> *) a b. op a -> (a -> Staged op b) -> Staged op b Instr op a -i (a -> Staged op a -m (a -> Staged op a) -> (a -> Staged op b) -> a -> Staged op b +i (a -> Staged op a +m (a -> Staged op a) -> (a -> Staged op b) -> a -> Staged op b forall (m :: * -> *) a b c. Monad m => (a -> m b) -> (b -> m c) -> a -> m c ->=> a -> Staged op b -f) +>=> a -> Staged op b +f) -- * Interpreting the AST @@ -640,45 +640,45 @@ -- (But to write this, @modification@ has to be a 'Monoid' to make -- 'nowLaterList' work!) Look at the tests for this module and at -- "Cooked.MockChain.Monad.Staged" for examples of how to use this type class. -class MonadPlus m => InterpLtl modification builtin m where - interpBuiltin :: builtin a -> StateT [Ltl modification] m a +class (MonadPlus m) => InterpLtl modification builtin m where + interpBuiltin :: builtin a -> StateT [Ltl modification] m a -- | Interpret a 'Staged' computation into a suitable domain, using the function -- 'interpBuiltin' to interpret the builtins. -interpLtl :: - (InterpLtl modification builtin m) => - Staged (LtlOp modification builtin) a -> - StateT [Ltl modification] m a +interpLtl :: + (InterpLtl modification builtin m) => + Staged (LtlOp modification builtin) a -> + StateT [Ltl modification] m a interpLtl :: Staged (LtlOp modification builtin) a -> StateT [Ltl modification] m a -interpLtl (Return a -a) = a -> StateT [Ltl modification] m a +interpLtl (Return a +a) = a -> StateT [Ltl modification] m a forall (m :: * -> *) a. Monad m => a -> m a -return a -a -interpLtl (Instr (StartLtl Ltl modification -x) a -> Staged (LtlOp modification builtin) a -f) = StateT [Ltl modification] m [Ltl modification] +return a +a +interpLtl (Instr (StartLtl Ltl modification +x) a -> Staged (LtlOp modification builtin) a +f) = StateT [Ltl modification] m [Ltl modification] forall s (m :: * -> *). MonadState s m => m s -get StateT [Ltl modification] m [Ltl modification] +get StateT [Ltl modification] m [Ltl modification] -> ([Ltl modification] -> StateT [Ltl modification] m ()) -> StateT [Ltl modification] m () forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b ->>= [Ltl modification] -> StateT [Ltl modification] m () +>>= [Ltl modification] -> StateT [Ltl modification] m () forall s (m :: * -> *). MonadState s m => s -> m () -put ([Ltl modification] -> StateT [Ltl modification] m ()) +put ([Ltl modification] -> StateT [Ltl modification] m ()) -> ([Ltl modification] -> [Ltl modification]) -> [Ltl modification] -> StateT [Ltl modification] m () forall b c a. (b -> c) -> (a -> b) -> a -> c -. (Ltl modification -x Ltl modification -> [Ltl modification] -> [Ltl modification] +. (Ltl modification +x Ltl modification -> [Ltl modification] -> [Ltl modification] forall a. a -> [a] -> [a] -:) StateT [Ltl modification] m () +:) StateT [Ltl modification] m () -> (() -> StateT [Ltl modification] m a) -> StateT [Ltl modification] m a forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b ->>= Staged (LtlOp modification builtin) a +>>= Staged (LtlOp modification builtin) a -> StateT [Ltl modification] m a forall modification (builtin :: * -> *) (m :: * -> *) a. InterpLtl modification builtin m => @@ -690,33 +690,33 @@ -> a -> StateT [Ltl modification] m a forall b c a. (b -> c) -> (a -> b) -> a -> c -. a -> Staged (LtlOp modification builtin) a -f +. a -> Staged (LtlOp modification builtin) a +f interpLtl (Instr LtlOp modification builtin a -StopLtl a -> Staged (LtlOp modification builtin) a -f) = do - [Ltl modification] -xs <- StateT [Ltl modification] m [Ltl modification] +StopLtl a -> Staged (LtlOp modification builtin) a +f) = do + [Ltl modification] +xs <- StateT [Ltl modification] m [Ltl modification] forall s (m :: * -> *). MonadState s m => m s -get +get case [Ltl modification] -xs of +xs of [] -> String -> StateT [Ltl modification] m a forall a. HasCallStack => String -> a -error String +error String "You called 'StopLtl' before 'StartLtl'. This is only possible if you're using internals." - Ltl modification -x : [Ltl modification] -rest -> + Ltl modification +x : [Ltl modification] +rest -> if Ltl modification -> Bool forall a. Ltl a -> Bool finished Ltl modification -x +x then do [Ltl modification] -> StateT [Ltl modification] m () forall s (m :: * -> *). MonadState s m => s -> m () -put [Ltl modification] -rest +put [Ltl modification] +rest Staged (LtlOp modification builtin) a -> StateT [Ltl modification] m a forall modification (builtin :: * -> *) (m :: * -> *) a. @@ -728,23 +728,23 @@ -> Staged (LtlOp modification builtin) a -> StateT [Ltl modification] m a forall a b. (a -> b) -> a -> b -$ a -> Staged (LtlOp modification builtin) a -f () +$ a -> Staged (LtlOp modification builtin) a +f () else StateT [Ltl modification] m a forall (m :: * -> *) a. MonadPlus m => m a -mzero -interpLtl (Instr (Builtin builtin a -b) a -> Staged (LtlOp modification builtin) a -f) = builtin a -> StateT [Ltl modification] m a +mzero +interpLtl (Instr (Builtin builtin a +b) a -> Staged (LtlOp modification builtin) a +f) = builtin a -> StateT [Ltl modification] m a forall modification (builtin :: * -> *) (m :: * -> *) a. InterpLtl modification builtin m => builtin a -> StateT [Ltl modification] m a interpBuiltin builtin a -b StateT [Ltl modification] m a +b StateT [Ltl modification] m a -> (a -> StateT [Ltl modification] m a) -> StateT [Ltl modification] m a forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b ->>= Staged (LtlOp modification builtin) a +>>= Staged (LtlOp modification builtin) a -> StateT [Ltl modification] m a forall modification (builtin :: * -> *) (m :: * -> *) a. InterpLtl modification builtin m => @@ -756,46 +756,46 @@ -> a -> StateT [Ltl modification] m a forall b c a. (b -> c) -> (a -> b) -> a -> c -. a -> Staged (LtlOp modification builtin) a -f +. a -> Staged (LtlOp modification builtin) a +f -- | Interpret a 'Staged' computation into a suitable domain, using the function -- 'interpBuiltin' to interpret the builtins. At the end of the computation, -- prune branches that still have un'finished' modifications applied to -- them. See the discussion on the regression test case for PRs 110 and 131 in -- 'StagedSpec.hs' for a discussion on why this function has to exist. -interpLtlAndPruneUnfinished :: - (InterpLtl modification builtin m) => - Staged (LtlOp modification builtin) a -> - StateT [Ltl modification] m a +interpLtlAndPruneUnfinished :: + (InterpLtl modification builtin m) => + Staged (LtlOp modification builtin) a -> + StateT [Ltl modification] m a interpLtlAndPruneUnfinished :: Staged (LtlOp modification builtin) a -> StateT [Ltl modification] m a -interpLtlAndPruneUnfinished Staged (LtlOp modification builtin) a -f = do - a -res <- Staged (LtlOp modification builtin) a +interpLtlAndPruneUnfinished Staged (LtlOp modification builtin) a +f = do + a +res <- Staged (LtlOp modification builtin) a -> StateT [Ltl modification] m a forall modification (builtin :: * -> *) (m :: * -> *) a. InterpLtl modification builtin m => Staged (LtlOp modification builtin) a -> StateT [Ltl modification] m a interpLtl Staged (LtlOp modification builtin) a -f - [Ltl modification] -mods <- StateT [Ltl modification] m [Ltl modification] +f + [Ltl modification] +mods <- StateT [Ltl modification] m [Ltl modification] forall s (m :: * -> *). MonadState s m => m s -get +get if (Ltl modification -> Bool) -> [Ltl modification] -> Bool forall (t :: * -> *) a. Foldable t => (a -> Bool) -> t a -> Bool -all Ltl modification -> Bool +all Ltl modification -> Bool forall a. Ltl a -> Bool finished [Ltl modification] -mods then a -> StateT [Ltl modification] m a +mods then a -> StateT [Ltl modification] m a forall (m :: * -> *) a. Monad m => a -> m a -return a -res else StateT [Ltl modification] m a +return a +res else StateT [Ltl modification] m a forall (m :: * -> *) a. MonadPlus m => m a -mzero +mzero -- * Convenience functions @@ -806,18 +806,18 @@ -- LTL modifications beside the method above. -- | Monads that allow modificaitons with LTL formulas. -class Monad m => MonadModal m where - type Modification m :: Type - modifyLtl :: Ltl (Modification m) -> m a -> m a +class (Monad m) => MonadModal m where + type Modification m :: Type + modifyLtl :: Ltl (Modification m) -> m a -> m a -instance MonadModal (Staged (LtlOp modification builtin)) where - type Modification (Staged (LtlOp modification builtin)) = modification - modifyLtl :: Ltl (Modification (Staged (LtlOp modification builtin))) +instance MonadModal (Staged (LtlOp modification builtin)) where + type Modification (Staged (LtlOp modification builtin)) = modification + modifyLtl :: Ltl (Modification (Staged (LtlOp modification builtin))) -> Staged (LtlOp modification builtin) a -> Staged (LtlOp modification builtin) a -modifyLtl Ltl (Modification (Staged (LtlOp modification builtin))) -x Staged (LtlOp modification builtin) a -tr = LtlOp modification builtin () +modifyLtl Ltl (Modification (Staged (LtlOp modification builtin))) +x Staged (LtlOp modification builtin) a +tr = LtlOp modification builtin () -> (() -> Staged (LtlOp modification builtin) ()) -> Staged (LtlOp modification builtin) () forall (op :: * -> *) a b. @@ -827,19 +827,19 @@ Ltl modification -> LtlOp modification builtin () StartLtl Ltl modification Ltl (Modification (Staged (LtlOp modification builtin))) -x) () -> Staged (LtlOp modification builtin) () +x) () -> Staged (LtlOp modification builtin) () forall a (op :: * -> *). a -> Staged op a Return Staged (LtlOp modification builtin) () -> Staged (LtlOp modification builtin) a -> Staged (LtlOp modification builtin) a forall (m :: * -> *) a b. Monad m => m a -> m b -> m b ->> Staged (LtlOp modification builtin) a -tr Staged (LtlOp modification builtin) a +>> Staged (LtlOp modification builtin) a +tr Staged (LtlOp modification builtin) a -> (a -> Staged (LtlOp modification builtin) a) -> Staged (LtlOp modification builtin) a forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b ->>= \a -res -> LtlOp modification builtin () +>>= \a +res -> LtlOp modification builtin () -> (() -> Staged (LtlOp modification builtin) ()) -> Staged (LtlOp modification builtin) () forall (op :: * -> *) a b. @@ -853,8 +853,8 @@ -> Staged (LtlOp modification builtin) a -> Staged (LtlOp modification builtin) a forall (m :: * -> *) a b. Monad m => m a -> m b -> m b ->> a -> Staged (LtlOp modification builtin) a +>> a -> Staged (LtlOp modification builtin) a forall (m :: * -> *) a. Monad m => a -> m a -return a -res +return a +res \ No newline at end of file diff --git a/src/Cooked.MockChain.Balancing.html b/src/Cooked.MockChain.Balancing.html index 294d95a7c..ebd3cf578 100644 --- a/src/Cooked.MockChain.Balancing.html +++ b/src/Cooked.MockChain.Balancing.html @@ -11,12 +11,12 @@ ) where -import qualified Cardano.Api as C -import qualified Cardano.Api.Shelley as C -import qualified Cardano.Ledger.Shelley.API as CardanoLedger -import qualified Cardano.Node.Emulator as Emulator -import Control.Arrow -import Control.Monad.Except +import qualified Cardano.Api as C +import qualified Cardano.Api.Shelley as C +import qualified Cardano.Ledger.Shelley.API as CardanoLedger +import qualified Cardano.Node.Emulator as Emulator +import Control.Arrow +import Control.Monad.Except import Cooked.MockChain.BlockChain import Cooked.MockChain.GenerateTx import Cooked.MockChain.UtxoSearch @@ -24,68 +24,68 @@ import Cooked.Skeleton import Cooked.ValueUtils import Cooked.Wallet -import Data.Default -import Data.Function -import Data.List -import Data.Map (Map) -import qualified Data.Map as Map -import Data.Maybe -import Data.Set (Set) -import qualified Data.Set as Set -import qualified Ledger.Index as Ledger -import qualified Ledger.Tx as Ledger -import qualified Ledger.Tx.CardanoAPI as Ledger -import Optics.Core -import qualified Plutus.Script.Utils.Ada as Pl -import qualified Plutus.Script.Utils.Scripts as Pl -import qualified Plutus.Script.Utils.Value as Pl -import qualified Plutus.V2.Ledger.Api as PV2 -import qualified PlutusTx.Numeric as Pl +import Data.Default +import Data.Function +import Data.List +import Data.Map (Map) +import qualified Data.Map as Map +import Data.Maybe +import Data.Set (Set) +import qualified Data.Set as Set +import qualified Ledger.Index as Ledger +import qualified Ledger.Tx as Ledger +import qualified Ledger.Tx.CardanoAPI as Ledger +import Optics.Core +import qualified Plutus.Script.Utils.Ada as Pl +import qualified Plutus.Script.Utils.Scripts as Pl +import qualified Plutus.Script.Utils.Value as Pl +import qualified Plutus.V2.Ledger.Api as PV2 +import qualified PlutusTx.Numeric as Pl -balancedTxSkel :: MonadBlockChainBalancing m => TxSkel -> m (TxSkel, Fee, Set PV2.TxOutRef) +balancedTxSkel :: (MonadBlockChainBalancing m) => TxSkel -> m (TxSkel, Fee, Set PV2.TxOutRef) balancedTxSkel :: TxSkel -> m (TxSkel, Fee, Set TxOutRef) -balancedTxSkel TxSkel -skelUnbal = do - let balancingWallet :: Wallet -balancingWallet = +balancedTxSkel TxSkel +skelUnbal = do + let balancingWallet :: Wallet +balancingWallet = case TxOpts -> BalancingWallet txOptBalanceWallet (TxOpts -> BalancingWallet) -> (TxSkel -> TxOpts) -> TxSkel -> BalancingWallet forall b c a. (b -> c) -> (a -> b) -> a -> c -. TxSkel -> TxOpts +. TxSkel -> TxOpts txSkelOpts (TxSkel -> BalancingWallet) -> TxSkel -> BalancingWallet forall a b. (a -> b) -> a -> b -$ TxSkel -skelUnbal of +$ TxSkel +skelUnbal of BalancingWallet BalanceWithFirstSigner -> case TxSkel -> [Wallet] txSkelSigners TxSkel -skelUnbal of +skelUnbal of [] -> [Char] -> Wallet forall a. HasCallStack => [Char] -> a -error [Char] +error [Char] "Can't select balancing wallet: There has to be at least one wallet in txSkelSigners" - Wallet -bw : [Wallet] + Wallet +bw : [Wallet] _ -> Wallet -bw - BalanceWith Wallet -bWallet -> Wallet -bWallet - let collateralWallet :: Wallet -collateralWallet = Wallet -balancingWallet - (TxSkel -skel, Fee -fee) <- +bw + BalanceWith Wallet +bWallet -> Wallet +bWallet + let collateralWallet :: Wallet +collateralWallet = Wallet +balancingWallet + (TxSkel +skel, Fee +fee) <- if TxOpts -> Bool txOptBalance (TxOpts -> Bool) -> (TxSkel -> TxOpts) -> TxSkel -> Bool forall b c a. (b -> c) -> (a -> b) -> a -> c -. TxSkel -> TxOpts +. TxSkel -> TxOpts txSkelOpts (TxSkel -> Bool) -> TxSkel -> Bool forall a b. (a -> b) -> a -> b -$ TxSkel -skelUnbal +$ TxSkel +skelUnbal then Wallet -> TxSkel -> m (TxSkel, Fee) forall (m :: * -> *). @@ -93,142 +93,142 @@ Wallet -> TxSkel -> m (TxSkel, Fee) setFeeAndBalance Wallet -balancingWallet +balancingWallet TxSkel -skelUnbal +skelUnbal else (TxSkel, Fee) -> m (TxSkel, Fee) forall (m :: * -> *) a. Monad m => a -> m a -return (TxSkel -skelUnbal, Integer -> Fee +return (TxSkel +skelUnbal, Integer -> Fee Fee Integer 0) - Set TxOutRef -collateralInputs <- Wallet -> m (Set TxOutRef) + Set TxOutRef +collateralInputs <- Wallet -> m (Set TxOutRef) forall (m :: * -> *). MonadBlockChainBalancing m => Wallet -> m (Set TxOutRef) calcCollateral Wallet -collateralWallet -- TODO: Why is it OK to balance first and then add collateral? +collateralWallet -- TODO: Why is it OK to balance first and then add collateral? (TxSkel, Fee, Set TxOutRef) -> m (TxSkel, Fee, Set TxOutRef) forall (m :: * -> *) a. Monad m => a -> m a -return (TxSkel -skel, Fee -fee, Set TxOutRef -collateralInputs) +return (TxSkel +skel, Fee +fee, Set TxOutRef +collateralInputs) -- | Take the output of 'balancedTxSkel' and turn it into an actual Cardano -- transaction. -balancedTx :: MonadBlockChainBalancing m => (TxSkel, Fee, Set PV2.TxOutRef) -> m (C.Tx C.BabbageEra) +balancedTx :: (MonadBlockChainBalancing m) => (TxSkel, Fee, Set PV2.TxOutRef) -> m (C.Tx C.BabbageEra) balancedTx :: (TxSkel, Fee, Set TxOutRef) -> m (Tx BabbageEra) -balancedTx (TxSkel -skel, Fee -fee, Set TxOutRef -collateralInputs) = do - Params -params <- Maybe EmulatorParamsModification -> Params -> Params +balancedTx (TxSkel +skel, Fee +fee, Set TxOutRef +collateralInputs) = do + Params +params <- Maybe EmulatorParamsModification -> Params -> Params applyEmulatorParamsModification (TxOpts -> Maybe EmulatorParamsModification txOptEmulatorParamsModification (TxOpts -> Maybe EmulatorParamsModification) -> (TxSkel -> TxOpts) -> TxSkel -> Maybe EmulatorParamsModification forall b c a. (b -> c) -> (a -> b) -> a -> c -. TxSkel -> TxOpts +. TxSkel -> TxOpts txSkelOpts (TxSkel -> Maybe EmulatorParamsModification) -> TxSkel -> Maybe EmulatorParamsModification forall a b. (a -> b) -> a -> b -$ TxSkel -skel) (Params -> Params) -> m Params -> m Params +$ TxSkel +skel) (Params -> Params) -> m Params -> m Params forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b -<$> m Params +<$> m Params forall (m :: * -> *). MonadBlockChainBalancing m => m Params getParams - Map DatumHash Datum -consumedData <- TxSkel -> m (Map DatumHash Datum) + Map DatumHash Datum +consumedData <- TxSkel -> m (Map DatumHash Datum) forall (m :: * -> *). MonadBlockChainBalancing m => TxSkel -> m (Map DatumHash Datum) txSkelInputData TxSkel -skel - Map TxOutRef TxOut -consumedOrReferencedTxOuts <- do - Map TxOutRef TxOut -ins <- TxSkel -> m (Map TxOutRef TxOut) +skel + Map TxOutRef TxOut +consumedOrReferencedTxOuts <- do + Map TxOutRef TxOut +ins <- TxSkel -> m (Map TxOutRef TxOut) forall (m :: * -> *). MonadBlockChainBalancing m => TxSkel -> m (Map TxOutRef TxOut) txSkelInputUtxosPV2 TxSkel -skel - Map TxOutRef TxOut -insRef <- TxSkel -> m (Map TxOutRef TxOut) +skel + Map TxOutRef TxOut +insRef <- TxSkel -> m (Map TxOutRef TxOut) forall (m :: * -> *). MonadBlockChainBalancing m => TxSkel -> m (Map TxOutRef TxOut) txSkelReferenceInputUtxosPV2 TxSkel -skel - Map TxOutRef TxOut -insCollateral <- +skel + Map TxOutRef TxOut +insCollateral <- [(TxOutRef, TxOut)] -> Map TxOutRef TxOut forall k a. Ord k => [(k, a)] -> Map k a -Map.fromList +Map.fromList ([(TxOutRef, TxOut)] -> Map TxOutRef TxOut) -> m [(TxOutRef, TxOut)] -> m (Map TxOutRef TxOut) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b -<$> (TxOutRef -> m (TxOutRef, TxOut)) +<$> (TxOutRef -> m (TxOutRef, TxOut)) -> [TxOutRef] -> m [(TxOutRef, TxOut)] forall (t :: * -> *) (m :: * -> *) a b. (Traversable t, Monad m) => (a -> m b) -> t a -> m (t b) -mapM - ( \TxOutRef -oref -> do - Maybe TxOut -mTxOut <- TxOutRef -> m (Maybe TxOut) +mapM + ( \TxOutRef +oref -> do + Maybe TxOut +mTxOut <- TxOutRef -> m (Maybe TxOut) forall (m :: * -> *). MonadBlockChainBalancing m => TxOutRef -> m (Maybe TxOut) txOutByRef TxOutRef -oref +oref case Maybe TxOut -mTxOut of +mTxOut of Maybe TxOut -Nothing -> MockChainError -> m (TxOutRef, TxOut) +Nothing -> MockChainError -> m (TxOutRef, TxOut) forall e (m :: * -> *) a. MonadError e m => e -> m a -throwError (MockChainError -> m (TxOutRef, TxOut)) +throwError (MockChainError -> m (TxOutRef, TxOut)) -> MockChainError -> m (TxOutRef, TxOut) forall a b. (a -> b) -> a -> b -$ [Char] -> MockChainError +$ [Char] -> MockChainError forall err. (Show err, Eq err) => err -> MockChainError OtherMockChainError [Char] "unkown collateral input TxOutRef" - Just TxOut -txOut -> (TxOutRef, TxOut) -> m (TxOutRef, TxOut) + Just TxOut +txOut -> (TxOutRef, TxOut) -> m (TxOutRef, TxOut) forall (m :: * -> *) a. Monad m => a -> m a -return (TxOutRef -oref, TxOut -txOut) +return (TxOutRef +oref, TxOut +txOut) ) (Set TxOutRef -> [TxOutRef] forall a. Set a -> [a] -Set.toList Set TxOutRef -collateralInputs) +Set.toList Set TxOutRef +collateralInputs) Map TxOutRef TxOut -> m (Map TxOutRef TxOut) forall (m :: * -> *) a. Monad m => a -> m a -return (Map TxOutRef TxOut -> m (Map TxOutRef TxOut)) +return (Map TxOutRef TxOut -> m (Map TxOutRef TxOut)) -> Map TxOutRef TxOut -> m (Map TxOutRef TxOut) forall a b. (a -> b) -> a -> b -$ Map TxOutRef TxOut -ins Map TxOutRef TxOut -> Map TxOutRef TxOut -> Map TxOutRef TxOut +$ Map TxOutRef TxOut +ins Map TxOutRef TxOut -> Map TxOutRef TxOut -> Map TxOutRef TxOut forall a. Semigroup a => a -> a -> a -<> Map TxOutRef TxOut -insRef Map TxOutRef TxOut -> Map TxOutRef TxOut -> Map TxOutRef TxOut +<> Map TxOutRef TxOut +insRef Map TxOutRef TxOut -> Map TxOutRef TxOut -> Map TxOutRef TxOut forall a. Semigroup a => a -> a -> a -<> Map TxOutRef TxOut -insCollateral - Map ValidatorHash (Versioned Validator) -consumedValidators <- TxSkel -> m (Map ValidatorHash (Versioned Validator)) +<> Map TxOutRef TxOut +insCollateral + Map ValidatorHash (Versioned Validator) +consumedValidators <- TxSkel -> m (Map ValidatorHash (Versioned Validator)) forall (m :: * -> *). MonadBlockChainBalancing m => TxSkel -> m (Map ValidatorHash (Versioned Validator)) txSkelInputValidators TxSkel -skel +skel case GenTxParams -> Params -> Map DatumHash Datum @@ -238,57 +238,57 @@ -> Either GenerateTxError (Tx BabbageEra) generateTx GenTxParams forall a. Default a => a -def {gtpCollateralIns :: Set TxOutRef +def {gtpCollateralIns :: Set TxOutRef gtpCollateralIns = Set TxOutRef -collateralInputs, gtpFee :: Fee +collateralInputs, gtpFee :: Fee gtpFee = Fee -fee} Params -params Map DatumHash Datum -consumedData Map TxOutRef TxOut -consumedOrReferencedTxOuts Map ValidatorHash (Versioned Validator) -consumedValidators TxSkel -skel of - Left GenerateTxError -err -> MockChainError -> m (Tx BabbageEra) +fee} Params +params Map DatumHash Datum +consumedData Map TxOutRef TxOut +consumedOrReferencedTxOuts Map ValidatorHash (Versioned Validator) +consumedValidators TxSkel +skel of + Left GenerateTxError +err -> MockChainError -> m (Tx BabbageEra) forall e (m :: * -> *) a. MonadError e m => e -> m a -throwError (MockChainError -> m (Tx BabbageEra)) +throwError (MockChainError -> m (Tx BabbageEra)) -> (GenerateTxError -> MockChainError) -> GenerateTxError -> m (Tx BabbageEra) forall b c a. (b -> c) -> (a -> b) -> a -> c -. GenerateTxError -> MockChainError +. GenerateTxError -> MockChainError MCEGenerationError (GenerateTxError -> m (Tx BabbageEra)) -> GenerateTxError -> m (Tx BabbageEra) forall a b. (a -> b) -> a -> b -$ GenerateTxError -err - Right Tx BabbageEra -tx -> Tx BabbageEra -> m (Tx BabbageEra) +$ GenerateTxError +err + Right Tx BabbageEra +tx -> Tx BabbageEra -> m (Tx BabbageEra) forall (m :: * -> *) a. Monad m => a -> m a -return Tx BabbageEra -tx +return Tx BabbageEra +tx -- | Ensure that the transaction outputs have the necessary minimum amount of -- Ada on them. This will only be applied if the 'txOptEnsureMinAda' is set to -- @True@. -ensureTxSkelOutsMinAda :: MonadBlockChainBalancing m => TxSkel -> m TxSkel +ensureTxSkelOutsMinAda :: (MonadBlockChainBalancing m) => TxSkel -> m TxSkel ensureTxSkelOutsMinAda :: TxSkel -> m TxSkel -ensureTxSkelOutsMinAda TxSkel -skel = do - Params -theParams <- Maybe EmulatorParamsModification -> Params -> Params +ensureTxSkelOutsMinAda TxSkel +skel = do + Params +theParams <- Maybe EmulatorParamsModification -> Params -> Params applyEmulatorParamsModification (TxOpts -> Maybe EmulatorParamsModification txOptEmulatorParamsModification (TxOpts -> Maybe EmulatorParamsModification) -> (TxSkel -> TxOpts) -> TxSkel -> Maybe EmulatorParamsModification forall b c a. (b -> c) -> (a -> b) -> a -> c -. TxSkel -> TxOpts +. TxSkel -> TxOpts txSkelOpts (TxSkel -> Maybe EmulatorParamsModification) -> TxSkel -> Maybe EmulatorParamsModification forall a b. (a -> b) -> a -> b -$ TxSkel -skel) (Params -> Params) -> m Params -> m Params +$ TxSkel +skel) (Params -> Params) -> m Params -> m Params forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b -<$> m Params +<$> m Params forall (m :: * -> *). MonadBlockChainBalancing m => m Params getParams case (TxSkelOut -> Either GenerateTxError TxSkelOut) @@ -296,62 +296,62 @@ forall (t :: * -> *) (m :: * -> *) a b. (Traversable t, Monad m) => (a -> m b) -> t a -> m (t b) -mapM (Params -> TxSkelOut -> Either GenerateTxError TxSkelOut -ensureTxSkelOutHasMinAda Params -theParams) ([TxSkelOut] -> Either GenerateTxError [TxSkelOut]) +mapM (Params -> TxSkelOut -> Either GenerateTxError TxSkelOut +ensureTxSkelOutHasMinAda Params +theParams) ([TxSkelOut] -> Either GenerateTxError [TxSkelOut]) -> [TxSkelOut] -> Either GenerateTxError [TxSkelOut] forall a b. (a -> b) -> a -> b -$ TxSkel -skel TxSkel -> Optic' A_Lens NoIx TxSkel [TxSkelOut] -> [TxSkelOut] +$ TxSkel +skel TxSkel -> Optic' A_Lens NoIx TxSkel [TxSkelOut] -> [TxSkelOut] forall k s (is :: IxList) a. Is k A_Getter => s -> Optic' k is s a -> a -^. Optic' A_Lens NoIx TxSkel [TxSkelOut] +^. Optic' A_Lens NoIx TxSkel [TxSkelOut] txSkelOutsL of - Left GenerateTxError -err -> MockChainError -> m TxSkel + Left GenerateTxError +err -> MockChainError -> m TxSkel forall e (m :: * -> *) a. MonadError e m => e -> m a -throwError (MockChainError -> m TxSkel) -> MockChainError -> m TxSkel +throwError (MockChainError -> m TxSkel) -> MockChainError -> m TxSkel forall a b. (a -> b) -> a -> b -$ GenerateTxError -> MockChainError +$ GenerateTxError -> MockChainError MCEGenerationError GenerateTxError -err - Right [TxSkelOut] -newTxSkelOuts -> TxSkel -> m TxSkel +err + Right [TxSkelOut] +newTxSkelOuts -> TxSkel -> m TxSkel forall (m :: * -> *) a. Monad m => a -> m a -return (TxSkel -> m TxSkel) -> TxSkel -> m TxSkel +return (TxSkel -> m TxSkel) -> TxSkel -> m TxSkel forall a b. (a -> b) -> a -> b -$ TxSkel -skel TxSkel -> (TxSkel -> TxSkel) -> TxSkel +$ TxSkel +skel TxSkel -> (TxSkel -> TxSkel) -> TxSkel forall a b. a -> (a -> b) -> b -& Optic' A_Lens NoIx TxSkel [TxSkelOut] +& Optic' A_Lens NoIx TxSkel [TxSkelOut] txSkelOutsL Optic' A_Lens NoIx TxSkel [TxSkelOut] -> [TxSkelOut] -> TxSkel -> TxSkel forall k (is :: IxList) s t a b. Is k A_Setter => Optic k is s t a b -> b -> s -> t -.~ [TxSkelOut] -newTxSkelOuts +.~ [TxSkelOut] +newTxSkelOuts where - ensureTxSkelOutHasMinAda :: Emulator.Params -> TxSkelOut -> Either GenerateTxError TxSkelOut - ensureTxSkelOutHasMinAda :: Params -> TxSkelOut -> Either GenerateTxError TxSkelOut -ensureTxSkelOutHasMinAda Params -theParams txSkelOut :: TxSkelOut -txSkelOut@(Pays o -output) = do - TxOut CtxTx BabbageEra -cardanoTxOut <- Params + ensureTxSkelOutHasMinAda :: Emulator.Params -> TxSkelOut -> Either GenerateTxError TxSkelOut + ensureTxSkelOutHasMinAda :: Params -> TxSkelOut -> Either GenerateTxError TxSkelOut +ensureTxSkelOutHasMinAda Params +theParams txSkelOut :: TxSkelOut +txSkelOut@(Pays o +output) = do + TxOut CtxTx BabbageEra +cardanoTxOut <- Params -> TxSkelOut -> Either GenerateTxError (TxOut CtxTx BabbageEra) txSkelOutToCardanoTxOut Params -theParams TxSkelOut -txSkelOut - let Pl.Lovelace Integer -oldAda = o -output o -> Optic' A_Lens NoIx o Ada -> Ada +theParams TxSkelOut +txSkelOut + let Pl.Lovelace Integer +oldAda = o +output o -> Optic' A_Lens NoIx o Ada -> Ada forall k s (is :: IxList) a. Is k A_Getter => s -> Optic' k is s a -> a -^. Optic A_Lens NoIx o o Value Value +^. Optic A_Lens NoIx o o Value Value forall o. IsAbstractOutput o => Lens' o (ValueType o) outputValueL Optic A_Lens NoIx o o Value Value -> Optic A_Lens NoIx Value Value Ada Ada @@ -360,42 +360,42 @@ 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 -% Optic A_Lens NoIx Value Value Ada Ada +% Optic A_Lens NoIx Value Value Ada Ada adaL - CardanoLedger.Coin Integer -requiredAda = + CardanoLedger.Coin Integer +requiredAda = PParams (BabbageEra StandardCrypto) -> TxOut (BabbageEra StandardCrypto) -> Coin forall era. CLI era => PParams era -> TxOut era -> Coin -CardanoLedger.evaluateMinLovelaceOutput (Params -> PParams -Emulator.emulatorPParams Params -theParams) +CardanoLedger.evaluateMinLovelaceOutput (Params -> PParams +Emulator.emulatorPParams Params +theParams) (TxOut (BabbageEra StandardCrypto) -> Coin) -> (TxOut CtxTx BabbageEra -> TxOut (BabbageEra StandardCrypto)) -> TxOut CtxTx BabbageEra -> Coin forall b c a. (b -> c) -> (a -> b) -> a -> c -. ShelleyBasedEra BabbageEra +. ShelleyBasedEra BabbageEra -> TxOut CtxUTxO BabbageEra -> TxOut (BabbageEra StandardCrypto) forall era ledgerera. (ShelleyLedgerEra era ~ ledgerera) => ShelleyBasedEra era -> TxOut CtxUTxO era -> TxOut ledgerera -C.toShelleyTxOut ShelleyBasedEra BabbageEra -C.ShelleyBasedEraBabbage +C.toShelleyTxOut ShelleyBasedEra BabbageEra +C.ShelleyBasedEraBabbage (TxOut CtxUTxO BabbageEra -> TxOut (BabbageEra StandardCrypto)) -> (TxOut CtxTx BabbageEra -> TxOut CtxUTxO BabbageEra) -> TxOut CtxTx BabbageEra -> TxOut (BabbageEra StandardCrypto) forall b c a. (b -> c) -> (a -> b) -> a -> c -. TxOut CtxTx BabbageEra -> TxOut CtxUTxO BabbageEra +. TxOut CtxTx BabbageEra -> TxOut CtxUTxO BabbageEra forall era. TxOut CtxTx era -> TxOut CtxUTxO era -C.toCtxUTxOTxOut +C.toCtxUTxOTxOut (TxOut CtxTx BabbageEra -> Coin) -> TxOut CtxTx BabbageEra -> Coin forall a b. (a -> b) -> a -> b -$ TxOut CtxTx BabbageEra -cardanoTxOut - updatedTxSkelOut :: TxSkelOut -updatedTxSkelOut = o -> TxSkelOut +$ TxOut CtxTx BabbageEra +cardanoTxOut + updatedTxSkelOut :: TxSkelOut +updatedTxSkelOut = o -> TxSkelOut forall o. (Show o, Typeable o, IsTxInfoOutput o, IsTxSkelOutAllowedOwner (OwnerType o), Typeable (OwnerType o), @@ -406,10 +406,10 @@ o -> TxSkelOut Pays (o -> TxSkelOut) -> o -> TxSkelOut forall a b. (a -> b) -> a -> b -$ o -output o -> (o -> o) -> o +$ o +output o -> (o -> o) -> o forall a b. a -> (a -> b) -> b -& Optic A_Lens NoIx o o Value Value +& Optic A_Lens NoIx o o Value Value forall o. IsAbstractOutput o => Lens' o (ValueType o) outputValueL Optic A_Lens NoIx o o Value Value -> Optic A_Lens NoIx Value Value Ada Ada @@ -418,17 +418,17 @@ 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 -% Optic A_Lens NoIx Value Value Ada Ada +% Optic A_Lens NoIx Value Value Ada Ada adaL Optic' A_Lens NoIx o Ada -> Ada -> o -> o forall k (is :: IxList) s t a b. Is k A_Setter => Optic k is s t a b -> b -> s -> t -.~ Integer -> Ada -Pl.Lovelace (Integer -> Integer -> Integer +.~ Integer -> Ada +Pl.Lovelace (Integer -> Integer -> Integer forall a. Ord a => a -> a -> a -max Integer -oldAda Integer -requiredAda) +max Integer +oldAda Integer +requiredAda) -- The following iterative approach to calculate the minimum Ada amount -- of a TxOut is necessary, because the additional value might make the -- TxOut heavier. @@ -436,20 +436,20 @@ -- It is inspired by -- https://github.com/input-output-hk/plutus-apps/blob/8706e6c7c525b4973a7b6d2ed7c9d0ef9cd4ef46/plutus-ledger/src/Ledger/Index.hs#L124 if Integer -oldAda Integer -> Integer -> Bool +oldAda Integer -> Integer -> Bool forall a. Ord a => a -> a -> Bool -< Integer -requiredAda +< Integer +requiredAda then Params -> TxSkelOut -> Either GenerateTxError TxSkelOut -ensureTxSkelOutHasMinAda Params -theParams TxSkelOut -updatedTxSkelOut +ensureTxSkelOutHasMinAda Params +theParams TxSkelOut +updatedTxSkelOut else TxSkelOut -> Either GenerateTxError TxSkelOut forall (m :: * -> *) a. Monad m => a -> m a -return TxSkelOut -txSkelOut +return TxSkelOut +txSkelOut -txSkelInputUtxosPV2 :: MonadBlockChainBalancing m => TxSkel -> m (Map PV2.TxOutRef PV2.TxOut) +txSkelInputUtxosPV2 :: (MonadBlockChainBalancing m) => TxSkel -> m (Map PV2.TxOutRef PV2.TxOut) txSkelInputUtxosPV2 :: TxSkel -> m (Map TxOutRef TxOut) txSkelInputUtxosPV2 = [TxOutRef] -> m (Map TxOutRef TxOut) forall (m :: * -> *). @@ -458,15 +458,15 @@ lookupUtxosPV2 ([TxOutRef] -> m (Map TxOutRef TxOut)) -> (TxSkel -> [TxOutRef]) -> TxSkel -> m (Map TxOutRef TxOut) forall b c a. (b -> c) -> (a -> b) -> a -> c -. Map TxOutRef TxSkelRedeemer -> [TxOutRef] +. Map TxOutRef TxSkelRedeemer -> [TxOutRef] forall k a. Map k a -> [k] -Map.keys (Map TxOutRef TxSkelRedeemer -> [TxOutRef]) +Map.keys (Map TxOutRef TxSkelRedeemer -> [TxOutRef]) -> (TxSkel -> Map TxOutRef TxSkelRedeemer) -> TxSkel -> [TxOutRef] forall b c a. (b -> c) -> (a -> b) -> a -> c -. TxSkel -> Map TxOutRef TxSkelRedeemer +. TxSkel -> Map TxOutRef TxSkelRedeemer txSkelIns -txSkelInputUtxos :: MonadBlockChainBalancing m => TxSkel -> m (Map PV2.TxOutRef Ledger.TxOut) +txSkelInputUtxos :: (MonadBlockChainBalancing m) => TxSkel -> m (Map PV2.TxOutRef Ledger.TxOut) txSkelInputUtxos :: TxSkel -> m (Map TxOutRef TxOut) txSkelInputUtxos = [TxOutRef] -> m (Map TxOutRef TxOut) forall (m :: * -> *). @@ -475,34 +475,34 @@ lookupUtxos ([TxOutRef] -> m (Map TxOutRef TxOut)) -> (TxSkel -> [TxOutRef]) -> TxSkel -> m (Map TxOutRef TxOut) forall b c a. (b -> c) -> (a -> b) -> a -> c -. Map TxOutRef TxSkelRedeemer -> [TxOutRef] +. Map TxOutRef TxSkelRedeemer -> [TxOutRef] forall k a. Map k a -> [k] -Map.keys (Map TxOutRef TxSkelRedeemer -> [TxOutRef]) +Map.keys (Map TxOutRef TxSkelRedeemer -> [TxOutRef]) -> (TxSkel -> Map TxOutRef TxSkelRedeemer) -> TxSkel -> [TxOutRef] forall b c a. (b -> c) -> (a -> b) -> a -> c -. TxSkel -> Map TxOutRef TxSkelRedeemer +. TxSkel -> Map TxOutRef TxSkelRedeemer txSkelIns -txSkelReferenceInputUtxosPV2 :: MonadBlockChainBalancing m => TxSkel -> m (Map PV2.TxOutRef PV2.TxOut) +txSkelReferenceInputUtxosPV2 :: (MonadBlockChainBalancing m) => TxSkel -> m (Map PV2.TxOutRef PV2.TxOut) txSkelReferenceInputUtxosPV2 :: TxSkel -> m (Map TxOutRef TxOut) -txSkelReferenceInputUtxosPV2 TxSkel -skel = (TxOut -> TxOut) -> Map TxOutRef TxOut -> Map TxOutRef TxOut +txSkelReferenceInputUtxosPV2 TxSkel +skel = (TxOut -> TxOut) -> Map TxOutRef TxOut -> Map TxOutRef TxOut forall a b k. (a -> b) -> Map k a -> Map k b -Map.map TxOut -> TxOut +Map.map TxOut -> TxOut txOutV2FromLedger (Map TxOutRef TxOut -> Map TxOutRef TxOut) -> m (Map TxOutRef TxOut) -> m (Map TxOutRef TxOut) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b -<$> TxSkel -> m (Map TxOutRef TxOut) +<$> TxSkel -> m (Map TxOutRef TxOut) forall (m :: * -> *). MonadBlockChainBalancing m => TxSkel -> m (Map TxOutRef TxOut) txSkelReferenceInputUtxos TxSkel -skel +skel -txSkelReferenceInputUtxos :: MonadBlockChainBalancing m => TxSkel -> m (Map PV2.TxOutRef Ledger.TxOut) +txSkelReferenceInputUtxos :: (MonadBlockChainBalancing m) => TxSkel -> m (Map PV2.TxOutRef Ledger.TxOut) txSkelReferenceInputUtxos :: TxSkel -> m (Map TxOutRef TxOut) -txSkelReferenceInputUtxos TxSkel -skel = +txSkelReferenceInputUtxos TxSkel +skel = [TxOutRef] -> m (Map TxOutRef TxOut) forall (m :: * -> *). MonadBlockChainBalancing m => @@ -510,71 +510,71 @@ lookupUtxos ([TxOutRef] -> m (Map TxOutRef TxOut)) -> [TxOutRef] -> m (Map TxOutRef TxOut) forall a b. (a -> b) -> a -> b -$ +$ (TxSkelRedeemer -> Maybe TxOutRef) -> [TxSkelRedeemer] -> [TxOutRef] forall a b. (a -> Maybe b) -> [a] -> [b] -mapMaybe +mapMaybe ( \case - TxSkelRedeemerForReferencedScript TxOutRef -oref redeemer + TxSkelRedeemerForReferencedScript TxOutRef +oref redeemer _ -> TxOutRef -> Maybe TxOutRef forall a. a -> Maybe a -Just TxOutRef -oref +Just TxOutRef +oref TxSkelRedeemer _ -> Maybe TxOutRef forall a. Maybe a -Nothing +Nothing ) (Map TxOutRef TxSkelRedeemer -> [TxSkelRedeemer] forall k a. Map k a -> [a] -Map.elems (Map TxOutRef TxSkelRedeemer -> [TxSkelRedeemer]) +Map.elems (Map TxOutRef TxSkelRedeemer -> [TxSkelRedeemer]) -> Map TxOutRef TxSkelRedeemer -> [TxSkelRedeemer] forall a b. (a -> b) -> a -> b -$ TxSkel -> Map TxOutRef TxSkelRedeemer +$ TxSkel -> Map TxOutRef TxSkelRedeemer txSkelIns TxSkel -skel) +skel) [TxOutRef] -> [TxOutRef] -> [TxOutRef] forall a. [a] -> [a] -> [a] -++ (Set TxOutRef -> [TxOutRef] +++ (Set TxOutRef -> [TxOutRef] forall a. Set a -> [a] -Set.toList (Set TxOutRef -> [TxOutRef]) +Set.toList (Set TxOutRef -> [TxOutRef]) -> (TxSkel -> Set TxOutRef) -> TxSkel -> [TxOutRef] forall b c a. (b -> c) -> (a -> b) -> a -> c -. TxSkel -> Set TxOutRef +. TxSkel -> Set TxOutRef txSkelInsReference (TxSkel -> [TxOutRef]) -> TxSkel -> [TxOutRef] forall a b. (a -> b) -> a -> b -$ TxSkel -skel) +$ TxSkel +skel) -- | All validators which protect transaction inputs -txSkelInputValidators :: MonadBlockChainBalancing m => TxSkel -> m (Map PV2.ValidatorHash (Pl.Versioned PV2.Validator)) +txSkelInputValidators :: (MonadBlockChainBalancing m) => TxSkel -> m (Map PV2.ValidatorHash (Pl.Versioned PV2.Validator)) txSkelInputValidators :: TxSkel -> m (Map ValidatorHash (Versioned Validator)) -txSkelInputValidators TxSkel -skel = do - [(TxOutRef, TxOut)] -utxos <- Map TxOutRef TxOut -> [(TxOutRef, TxOut)] +txSkelInputValidators TxSkel +skel = do + [(TxOutRef, TxOut)] +utxos <- Map TxOutRef TxOut -> [(TxOutRef, TxOut)] forall k a. Map k a -> [(k, a)] -Map.toList (Map TxOutRef TxOut -> [(TxOutRef, TxOut)]) +Map.toList (Map TxOutRef TxOut -> [(TxOutRef, TxOut)]) -> m (Map TxOutRef TxOut) -> m [(TxOutRef, TxOut)] forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b -<$> [TxOutRef] -> m (Map TxOutRef TxOut) +<$> [TxOutRef] -> m (Map TxOutRef TxOut) forall (m :: * -> *). MonadBlockChainBalancing m => [TxOutRef] -> m (Map TxOutRef TxOut) lookupUtxosPV2 (Map TxOutRef TxSkelRedeemer -> [TxOutRef] forall k a. Map k a -> [k] -Map.keys (Map TxOutRef TxSkelRedeemer -> [TxOutRef]) +Map.keys (Map TxOutRef TxSkelRedeemer -> [TxOutRef]) -> (TxSkel -> Map TxOutRef TxSkelRedeemer) -> TxSkel -> [TxOutRef] forall b c a. (b -> c) -> (a -> b) -> a -> c -. TxSkel -> Map TxOutRef TxSkelRedeemer +. TxSkel -> Map TxOutRef TxSkelRedeemer txSkelIns (TxSkel -> [TxOutRef]) -> TxSkel -> [TxOutRef] forall a b. (a -> b) -> a -> b -$ TxSkel -skel) - [Maybe (ValidatorHash, Versioned Validator)] -mValidators <- +$ TxSkel +skel) + [Maybe (ValidatorHash, Versioned Validator)] +mValidators <- ((TxOutRef, TxOut) -> m (Maybe (ValidatorHash, Versioned Validator))) -> [(TxOutRef, TxOut)] @@ -582,374 +582,374 @@ forall (t :: * -> *) (m :: * -> *) a b. (Traversable t, Monad m) => (a -> m b) -> t a -> m (t b) -mapM - ( \(TxOutRef -_oref, TxOut -out) -> case TxOut -> Address +mapM + ( \(TxOutRef +_oref, TxOut +out) -> case TxOut -> Address forall o. (IsAbstractOutput o, ToCredential (OwnerType o)) => o -> Address outputAddress TxOut -out of - PV2.Address (PV2.ScriptCredential ValidatorHash -valHash) Maybe StakingCredential +out of + PV2.Address (PV2.ScriptCredential ValidatorHash +valHash) Maybe StakingCredential _ -> do - Maybe (Versioned Validator) -mVal <- ValidatorHash -> m (Maybe (Versioned Validator)) + Maybe (Versioned Validator) +mVal <- ValidatorHash -> m (Maybe (Versioned Validator)) forall (m :: * -> *). MonadBlockChainBalancing m => ValidatorHash -> m (Maybe (Versioned Validator)) validatorFromHash ValidatorHash -valHash +valHash case Maybe (Versioned Validator) -mVal of +mVal of Maybe (Versioned Validator) -Nothing -> +Nothing -> MockChainError -> m (Maybe (ValidatorHash, Versioned Validator)) forall e (m :: * -> *) a. MonadError e m => e -> m a -throwError (MockChainError -> m (Maybe (ValidatorHash, Versioned Validator))) +throwError (MockChainError -> m (Maybe (ValidatorHash, Versioned Validator))) -> MockChainError -> m (Maybe (ValidatorHash, Versioned Validator)) forall a b. (a -> b) -> a -> b -$ +$ [Char] -> ValidatorHash -> MockChainError MCEUnknownValidator [Char] "txSkelInputValidators: unkown validator hash on transaction input" ValidatorHash -valHash - Just Versioned Validator -val -> Maybe (ValidatorHash, Versioned Validator) +valHash + Just Versioned Validator +val -> Maybe (ValidatorHash, Versioned Validator) -> m (Maybe (ValidatorHash, Versioned Validator)) forall (m :: * -> *) a. Monad m => a -> m a -return (Maybe (ValidatorHash, Versioned Validator) +return (Maybe (ValidatorHash, Versioned Validator) -> m (Maybe (ValidatorHash, Versioned Validator))) -> Maybe (ValidatorHash, Versioned Validator) -> m (Maybe (ValidatorHash, Versioned Validator)) forall a b. (a -> b) -> a -> b -$ (ValidatorHash, Versioned Validator) +$ (ValidatorHash, Versioned Validator) -> Maybe (ValidatorHash, Versioned Validator) forall a. a -> Maybe a -Just (ValidatorHash -valHash, Versioned Validator -val) +Just (ValidatorHash +valHash, Versioned Validator +val) Address _ -> Maybe (ValidatorHash, Versioned Validator) -> m (Maybe (ValidatorHash, Versioned Validator)) forall (m :: * -> *) a. Monad m => a -> m a -return Maybe (ValidatorHash, Versioned Validator) +return Maybe (ValidatorHash, Versioned Validator) forall a. Maybe a -Nothing +Nothing ) [(TxOutRef, TxOut)] -utxos +utxos Map ValidatorHash (Versioned Validator) -> m (Map ValidatorHash (Versioned Validator)) forall (m :: * -> *) a. Monad m => a -> m a -return (Map ValidatorHash (Versioned Validator) +return (Map ValidatorHash (Versioned Validator) -> m (Map ValidatorHash (Versioned Validator))) -> ([Maybe (ValidatorHash, Versioned Validator)] -> Map ValidatorHash (Versioned Validator)) -> [Maybe (ValidatorHash, Versioned Validator)] -> m (Map ValidatorHash (Versioned Validator)) forall b c a. (b -> c) -> (a -> b) -> a -> c -. [(ValidatorHash, Versioned Validator)] +. [(ValidatorHash, Versioned Validator)] -> Map ValidatorHash (Versioned Validator) forall k a. Ord k => [(k, a)] -> Map k a -Map.fromList ([(ValidatorHash, Versioned Validator)] +Map.fromList ([(ValidatorHash, Versioned Validator)] -> Map ValidatorHash (Versioned Validator)) -> ([Maybe (ValidatorHash, Versioned Validator)] -> [(ValidatorHash, Versioned Validator)]) -> [Maybe (ValidatorHash, Versioned Validator)] -> Map ValidatorHash (Versioned Validator) forall b c a. (b -> c) -> (a -> b) -> a -> c -. [Maybe (ValidatorHash, Versioned Validator)] +. [Maybe (ValidatorHash, Versioned Validator)] -> [(ValidatorHash, Versioned Validator)] forall a. [Maybe a] -> [a] -catMaybes ([Maybe (ValidatorHash, Versioned Validator)] +catMaybes ([Maybe (ValidatorHash, Versioned Validator)] -> m (Map ValidatorHash (Versioned Validator))) -> [Maybe (ValidatorHash, Versioned Validator)] -> m (Map ValidatorHash (Versioned Validator)) forall a b. (a -> b) -> a -> b -$ [Maybe (ValidatorHash, Versioned Validator)] -mValidators +$ [Maybe (ValidatorHash, Versioned Validator)] +mValidators -- Go through all of the 'PV2.TxOutRef's in the list and look them up in the -- state of the blockchain. If any 'PV2.TxOutRef' can't be resolved, throw an -- error. -lookupUtxosPV2 :: MonadBlockChainBalancing m => [PV2.TxOutRef] -> m (Map PV2.TxOutRef PV2.TxOut) +lookupUtxosPV2 :: (MonadBlockChainBalancing m) => [PV2.TxOutRef] -> m (Map PV2.TxOutRef PV2.TxOut) lookupUtxosPV2 :: [TxOutRef] -> m (Map TxOutRef TxOut) -lookupUtxosPV2 [TxOutRef] -outRefs = (TxOut -> TxOut) -> Map TxOutRef TxOut -> Map TxOutRef TxOut +lookupUtxosPV2 [TxOutRef] +outRefs = (TxOut -> TxOut) -> Map TxOutRef TxOut -> Map TxOutRef TxOut forall a b k. (a -> b) -> Map k a -> Map k b -Map.map TxOut -> TxOut +Map.map TxOut -> TxOut txOutV2FromLedger (Map TxOutRef TxOut -> Map TxOutRef TxOut) -> m (Map TxOutRef TxOut) -> m (Map TxOutRef TxOut) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b -<$> [TxOutRef] -> m (Map TxOutRef TxOut) +<$> [TxOutRef] -> m (Map TxOutRef TxOut) forall (m :: * -> *). MonadBlockChainBalancing m => [TxOutRef] -> m (Map TxOutRef TxOut) lookupUtxos [TxOutRef] -outRefs +outRefs -lookupUtxos :: MonadBlockChainBalancing m => [PV2.TxOutRef] -> m (Map PV2.TxOutRef Ledger.TxOut) +lookupUtxos :: (MonadBlockChainBalancing m) => [PV2.TxOutRef] -> m (Map PV2.TxOutRef Ledger.TxOut) lookupUtxos :: [TxOutRef] -> m (Map TxOutRef TxOut) -lookupUtxos [TxOutRef] -outRefs = do +lookupUtxos [TxOutRef] +outRefs = do [(TxOutRef, TxOut)] -> Map TxOutRef TxOut forall k a. Ord k => [(k, a)] -> Map k a -Map.fromList +Map.fromList ([(TxOutRef, TxOut)] -> Map TxOutRef TxOut) -> m [(TxOutRef, TxOut)] -> m (Map TxOutRef TxOut) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b -<$> (TxOutRef -> m (TxOutRef, TxOut)) +<$> (TxOutRef -> m (TxOutRef, TxOut)) -> [TxOutRef] -> m [(TxOutRef, TxOut)] forall (t :: * -> *) (m :: * -> *) a b. (Traversable t, Monad m) => (a -> m b) -> t a -> m (t b) -mapM - ( \TxOutRef -oRef -> do - Maybe TxOut -mOut <- TxOutRef -> m (Maybe TxOut) +mapM + ( \TxOutRef +oRef -> do + Maybe TxOut +mOut <- TxOutRef -> m (Maybe TxOut) forall (m :: * -> *). MonadBlockChainBalancing m => TxOutRef -> m (Maybe TxOut) txOutByRefLedger TxOutRef -oRef - TxOut -out <- case Maybe TxOut -mOut of +oRef + TxOut +out <- case Maybe TxOut +mOut of Maybe TxOut -Nothing -> +Nothing -> MockChainError -> m TxOut forall e (m :: * -> *) a. MonadError e m => e -> m a -throwError (MockChainError -> m TxOut) -> MockChainError -> m TxOut +throwError (MockChainError -> m TxOut) -> MockChainError -> m TxOut forall a b. (a -> b) -> a -> b -$ +$ [Char] -> TxOutRef -> MockChainError MCEUnknownOutRefError [Char] "lookupUtxos: unknown TxOutRef" TxOutRef -oRef - Just TxOut -out -> TxOut -> m TxOut +oRef + Just TxOut +out -> TxOut -> m TxOut forall (m :: * -> *) a. Monad m => a -> m a -return TxOut -out +return TxOut +out (TxOutRef, TxOut) -> m (TxOutRef, TxOut) forall (m :: * -> *) a. Monad m => a -> m a -return (TxOutRef -oRef, TxOut -out) +return (TxOutRef +oRef, TxOut +out) ) [TxOutRef] -outRefs +outRefs -- | look up the UTxOs the transaction consumes, and sum the value contained in -- them. -txSkelInputValue :: MonadBlockChainBalancing m => TxSkel -> m PV2.Value +txSkelInputValue :: (MonadBlockChainBalancing m) => TxSkel -> m PV2.Value txSkelInputValue :: TxSkel -> m Value -txSkelInputValue TxSkel -skel = do - Map TxOutRef TxOut -txSkelInputs <- TxSkel -> m (Map TxOutRef TxOut) +txSkelInputValue TxSkel +skel = do + Map TxOutRef TxOut +txSkelInputs <- TxSkel -> m (Map TxOutRef TxOut) forall (m :: * -> *). MonadBlockChainBalancing m => TxSkel -> m (Map TxOutRef TxOut) txSkelInputUtxos TxSkel -skel +skel Value -> m Value forall (m :: * -> *) a. Monad m => a -> m a -return (Value -> m Value) -> Value -> m Value +return (Value -> m Value) -> Value -> m Value forall a b. (a -> b) -> a -> b -$ (TxOut -> Value) -> Map TxOutRef TxOut -> Value +$ (TxOut -> Value) -> Map TxOutRef TxOut -> Value forall (t :: * -> *) m a. (Foldable t, Monoid m) => (a -> m) -> t a -> m -foldMap (TxOut -> Value -PV2.txOutValue (TxOut -> Value) -> (TxOut -> TxOut) -> TxOut -> Value +foldMap (TxOut -> Value +PV2.txOutValue (TxOut -> Value) -> (TxOut -> TxOut) -> TxOut -> Value forall b c a. (b -> c) -> (a -> b) -> a -> c -. TxOut -> TxOut +. TxOut -> TxOut txOutV2FromLedger) Map TxOutRef TxOut -txSkelInputs +txSkelInputs -- | Look up the data on UTxOs the transaction consumes. -txSkelInputData :: MonadBlockChainBalancing m => TxSkel -> m (Map PV2.DatumHash PV2.Datum) +txSkelInputData :: (MonadBlockChainBalancing m) => TxSkel -> m (Map PV2.DatumHash PV2.Datum) txSkelInputData :: TxSkel -> m (Map DatumHash Datum) -txSkelInputData TxSkel -skel = do - [TxOut] -txSkelInputs <- Map TxOutRef TxOut -> [TxOut] +txSkelInputData TxSkel +skel = do + [TxOut] +txSkelInputs <- Map TxOutRef TxOut -> [TxOut] forall k a. Map k a -> [a] -Map.elems (Map TxOutRef TxOut -> [TxOut]) +Map.elems (Map TxOutRef TxOut -> [TxOut]) -> m (Map TxOutRef TxOut) -> m [TxOut] forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b -<$> TxSkel -> m (Map TxOutRef TxOut) +<$> TxSkel -> m (Map TxOutRef TxOut) forall (m :: * -> *). MonadBlockChainBalancing m => TxSkel -> m (Map TxOutRef TxOut) txSkelInputUtxosPV2 TxSkel -skel - [Maybe (DatumHash, Datum)] -mDatums <- +skel + [Maybe (DatumHash, Datum)] +mDatums <- (TxOut -> m (Maybe (DatumHash, Datum))) -> [TxOut] -> m [Maybe (DatumHash, Datum)] forall (t :: * -> *) (m :: * -> *) a b. (Traversable t, Monad m) => (a -> m b) -> t a -> m (t b) -mapM - ( \TxOut -output -> +mapM + ( \TxOut +output -> case TxOut -output TxOut -> Optic' A_Lens NoIx TxOut OutputDatum -> OutputDatum +output TxOut -> Optic' A_Lens NoIx TxOut OutputDatum -> OutputDatum forall k s (is :: IxList) a. Is k A_Getter => s -> Optic' k is s a -> a -^. Optic' A_Lens NoIx TxOut OutputDatum +^. Optic' A_Lens NoIx TxOut OutputDatum forall o. IsAbstractOutput o => Lens' o (DatumType o) outputDatumL of OutputDatum -PV2.NoOutputDatum -> Maybe (DatumHash, Datum) -> m (Maybe (DatumHash, Datum)) +PV2.NoOutputDatum -> Maybe (DatumHash, Datum) -> m (Maybe (DatumHash, Datum)) forall (m :: * -> *) a. Monad m => a -> m a -return Maybe (DatumHash, Datum) +return Maybe (DatumHash, Datum) forall a. Maybe a -Nothing - PV2.OutputDatum Datum -datum -> - let dHash :: DatumHash -dHash = Datum -> DatumHash -Pl.datumHash Datum -datum +Nothing + PV2.OutputDatum Datum +datum -> + let dHash :: DatumHash +dHash = Datum -> DatumHash +Pl.datumHash Datum +datum in (DatumHash, Datum) -> Maybe (DatumHash, Datum) forall a. a -> Maybe a -Just ((DatumHash, Datum) -> Maybe (DatumHash, Datum)) +Just ((DatumHash, Datum) -> Maybe (DatumHash, Datum)) -> (Datum -> (DatumHash, Datum)) -> Datum -> Maybe (DatumHash, Datum) forall b c a. (b -> c) -> (a -> b) -> a -> c -. (DatumHash -dHash,) (Datum -> Maybe (DatumHash, Datum)) +. (DatumHash +dHash,) (Datum -> Maybe (DatumHash, Datum)) -> m Datum -> m (Maybe (DatumHash, Datum)) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b -<$> DatumHash -> m Datum +<$> DatumHash -> m Datum forall (m :: * -> *). MonadBlockChainBalancing m => DatumHash -> m Datum -datumFromHashWithError DatumHash -dHash - PV2.OutputDatumHash DatumHash -dHash -> +datumFromHashWithError DatumHash +dHash + PV2.OutputDatumHash DatumHash +dHash -> (DatumHash, Datum) -> Maybe (DatumHash, Datum) forall a. a -> Maybe a -Just ((DatumHash, Datum) -> Maybe (DatumHash, Datum)) +Just ((DatumHash, Datum) -> Maybe (DatumHash, Datum)) -> (Datum -> (DatumHash, Datum)) -> Datum -> Maybe (DatumHash, Datum) forall b c a. (b -> c) -> (a -> b) -> a -> c -. (DatumHash -dHash,) (Datum -> Maybe (DatumHash, Datum)) +. (DatumHash +dHash,) (Datum -> Maybe (DatumHash, Datum)) -> m Datum -> m (Maybe (DatumHash, Datum)) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b -<$> DatumHash -> m Datum +<$> DatumHash -> m Datum forall (m :: * -> *). MonadBlockChainBalancing m => DatumHash -> m Datum -datumFromHashWithError DatumHash -dHash +datumFromHashWithError DatumHash +dHash ) [TxOut] -txSkelInputs +txSkelInputs Map DatumHash Datum -> m (Map DatumHash Datum) forall (m :: * -> *) a. Monad m => a -> m a -return (Map DatumHash Datum -> m (Map DatumHash Datum)) +return (Map DatumHash Datum -> m (Map DatumHash Datum)) -> ([Maybe (DatumHash, Datum)] -> Map DatumHash Datum) -> [Maybe (DatumHash, Datum)] -> m (Map DatumHash Datum) forall b c a. (b -> c) -> (a -> b) -> a -> c -. [(DatumHash, Datum)] -> Map DatumHash Datum +. [(DatumHash, Datum)] -> Map DatumHash Datum forall k a. Ord k => [(k, a)] -> Map k a -Map.fromList ([(DatumHash, Datum)] -> Map DatumHash Datum) +Map.fromList ([(DatumHash, Datum)] -> Map DatumHash Datum) -> ([Maybe (DatumHash, Datum)] -> [(DatumHash, Datum)]) -> [Maybe (DatumHash, Datum)] -> Map DatumHash Datum forall b c a. (b -> c) -> (a -> b) -> a -> c -. [Maybe (DatumHash, Datum)] -> [(DatumHash, Datum)] +. [Maybe (DatumHash, Datum)] -> [(DatumHash, Datum)] forall a. [Maybe a] -> [a] -catMaybes ([Maybe (DatumHash, Datum)] -> m (Map DatumHash Datum)) +catMaybes ([Maybe (DatumHash, Datum)] -> m (Map DatumHash Datum)) -> [Maybe (DatumHash, Datum)] -> m (Map DatumHash Datum) forall a b. (a -> b) -> a -> b -$ [Maybe (DatumHash, Datum)] -mDatums +$ [Maybe (DatumHash, Datum)] +mDatums where - datumFromHashWithError :: MonadBlockChainBalancing m => Pl.DatumHash -> m PV2.Datum - datumFromHashWithError :: DatumHash -> m Datum -datumFromHashWithError DatumHash -dHash = do - Maybe Datum -mDatum <- DatumHash -> m (Maybe Datum) + datumFromHashWithError :: (MonadBlockChainBalancing m) => Pl.DatumHash -> m PV2.Datum + datumFromHashWithError :: DatumHash -> m Datum +datumFromHashWithError DatumHash +dHash = do + Maybe Datum +mDatum <- DatumHash -> m (Maybe Datum) forall (m :: * -> *). MonadBlockChainBalancing m => DatumHash -> m (Maybe Datum) datumFromHash DatumHash -dHash +dHash case Maybe Datum -mDatum of +mDatum of Maybe Datum -Nothing -> +Nothing -> MockChainError -> m Datum forall e (m :: * -> *) a. MonadError e m => e -> m a -throwError (MockChainError -> m Datum) -> MockChainError -> m Datum +throwError (MockChainError -> m Datum) -> MockChainError -> m Datum forall a b. (a -> b) -> a -> b -$ +$ [Char] -> DatumHash -> MockChainError MCEUnknownDatum [Char] "txSkelInputData: Transaction input with un-resolvable datum hash" DatumHash -dHash - Just Datum -datum -> Datum -> m Datum +dHash + Just Datum +datum -> Datum -> m Datum forall (m :: * -> *) a. Monad m => a -> m a -return Datum -datum +return Datum +datum getEmulatorUTxO :: - Map PV2.TxOutRef Ledger.TxOut -> - Either Ledger.ToCardanoError (Emulator.UTxO Emulator.EmulatorEra) + Map PV2.TxOutRef Ledger.TxOut -> + Either Ledger.ToCardanoError (Emulator.UTxO Emulator.EmulatorEra) getEmulatorUTxO :: Map TxOutRef TxOut -> Either ToCardanoError (UTxO (BabbageEra StandardCrypto)) -getEmulatorUTxO Map TxOutRef TxOut -m = +getEmulatorUTxO Map TxOutRef TxOut +m = ([(TxIn, TxOut CtxUTxO BabbageEra)] -> UTxO (BabbageEra StandardCrypto)) -> Either ToCardanoError [(TxIn, TxOut CtxUTxO BabbageEra)] -> Either ToCardanoError (UTxO (BabbageEra StandardCrypto)) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b -fmap (UtxoIndex -> UTxO (BabbageEra StandardCrypto) -Ledger.fromPlutusIndex (UtxoIndex -> UTxO (BabbageEra StandardCrypto)) +fmap (UtxoIndex -> UTxO (BabbageEra StandardCrypto) +Ledger.fromPlutusIndex (UtxoIndex -> UTxO (BabbageEra StandardCrypto)) -> ([(TxIn, TxOut CtxUTxO BabbageEra)] -> UtxoIndex) -> [(TxIn, TxOut CtxUTxO BabbageEra)] -> UTxO (BabbageEra StandardCrypto) forall b c a. (b -> c) -> (a -> b) -> a -> c -. Map TxIn (TxOut CtxUTxO BabbageEra) -> UtxoIndex +. Map TxIn (TxOut CtxUTxO BabbageEra) -> UtxoIndex forall era. Map TxIn (TxOut CtxUTxO era) -> UTxO era -C.UTxO (Map TxIn (TxOut CtxUTxO BabbageEra) -> UtxoIndex) +C.UTxO (Map TxIn (TxOut CtxUTxO BabbageEra) -> UtxoIndex) -> ([(TxIn, TxOut CtxUTxO BabbageEra)] -> Map TxIn (TxOut CtxUTxO BabbageEra)) -> [(TxIn, TxOut CtxUTxO BabbageEra)] -> UtxoIndex forall b c a. (b -> c) -> (a -> b) -> a -> c -. [(TxIn, TxOut CtxUTxO BabbageEra)] +. [(TxIn, TxOut CtxUTxO BabbageEra)] -> Map TxIn (TxOut CtxUTxO BabbageEra) forall k a. Ord k => [(k, a)] -> Map k a -Map.fromList) (Either ToCardanoError [(TxIn, TxOut CtxUTxO BabbageEra)] +Map.fromList) (Either ToCardanoError [(TxIn, TxOut CtxUTxO BabbageEra)] -> Either ToCardanoError (UTxO (BabbageEra StandardCrypto))) -> Either ToCardanoError [(TxIn, TxOut CtxUTxO BabbageEra)] -> Either ToCardanoError (UTxO (BabbageEra StandardCrypto)) forall a b. (a -> b) -> a -> b -$ +$ ((TxOutRef, TxOut) -> Either ToCardanoError (TxIn, TxOut CtxUTxO BabbageEra)) -> [(TxOutRef, TxOut)] @@ -957,38 +957,38 @@ forall (t :: * -> *) (m :: * -> *) a b. (Traversable t, Monad m) => (a -> m b) -> t a -> m (t b) -mapM (\(TxOutRef -k, TxOut -v) -> (,) (TxIn +mapM (\(TxOutRef +k, TxOut +v) -> (,) (TxIn -> TxOut CtxUTxO BabbageEra -> (TxIn, TxOut CtxUTxO BabbageEra)) -> Either ToCardanoError TxIn -> Either ToCardanoError (TxOut CtxUTxO BabbageEra -> (TxIn, TxOut CtxUTxO BabbageEra)) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b -<$> TxOutRef -> Either ToCardanoError TxIn -Ledger.toCardanoTxIn TxOutRef -k Either +<$> TxOutRef -> Either ToCardanoError TxIn +Ledger.toCardanoTxIn TxOutRef +k Either ToCardanoError (TxOut CtxUTxO BabbageEra -> (TxIn, TxOut CtxUTxO BabbageEra)) -> Either ToCardanoError (TxOut CtxUTxO BabbageEra) -> Either ToCardanoError (TxIn, TxOut CtxUTxO BabbageEra) forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b -<*> TxOut CtxUTxO BabbageEra +<*> TxOut CtxUTxO BabbageEra -> Either ToCardanoError (TxOut CtxUTxO BabbageEra) forall (f :: * -> *) a. Applicative f => a -> f a -pure (TxOut -> TxOut CtxUTxO BabbageEra -Ledger.toCtxUTxOTxOut TxOut -v)) ([(TxOutRef, TxOut)] +pure (TxOut -> TxOut CtxUTxO BabbageEra +Ledger.toCtxUTxOTxOut TxOut +v)) ([(TxOutRef, TxOut)] -> Either ToCardanoError [(TxIn, TxOut CtxUTxO BabbageEra)]) -> [(TxOutRef, TxOut)] -> Either ToCardanoError [(TxIn, TxOut CtxUTxO BabbageEra)] forall a b. (a -> b) -> a -> b -$ +$ Map TxOutRef TxOut -> [(TxOutRef, TxOut)] forall k a. Map k a -> [(k, a)] -Map.toList Map TxOutRef TxOut -m +Map.toList Map TxOutRef TxOut +m -- ensuring that the equation -- @@ -1003,77 +1003,77 @@ -- -- This function also adjusts the transaction outputs to contain at least the -- minimum Ada amount, if the 'txOptEnsureMinAda option is @True@. -setFeeAndBalance :: MonadBlockChainBalancing m => Wallet -> TxSkel -> m (TxSkel, Fee) +setFeeAndBalance :: (MonadBlockChainBalancing m) => Wallet -> TxSkel -> m (TxSkel, Fee) setFeeAndBalance :: Wallet -> TxSkel -> m (TxSkel, Fee) -setFeeAndBalance Wallet -balanceWallet TxSkel -skel0 = do +setFeeAndBalance Wallet +balanceWallet TxSkel +skel0 = do -- do the min Ada adjustment if it's requested - TxSkel -skel <- + TxSkel +skel <- if TxOpts -> Bool txOptEnsureMinAda (TxOpts -> Bool) -> (TxSkel -> TxOpts) -> TxSkel -> Bool forall b c a. (b -> c) -> (a -> b) -> a -> c -. TxSkel -> TxOpts +. TxSkel -> TxOpts txSkelOpts (TxSkel -> Bool) -> TxSkel -> Bool forall a b. (a -> b) -> a -> b -$ TxSkel -skel0 +$ TxSkel +skel0 then TxSkel -> m TxSkel forall (m :: * -> *). MonadBlockChainBalancing m => TxSkel -> m TxSkel ensureTxSkelOutsMinAda TxSkel -skel0 +skel0 else TxSkel -> m TxSkel forall (m :: * -> *) a. Monad m => a -> m a -return TxSkel -skel0 +return TxSkel +skel0 -- Candidate UTxOs to spend for balancing - Map TxOutRef TxOut -balancePKUtxos <- + Map TxOutRef TxOut +balancePKUtxos <- [(TxOutRef, TxOut)] -> Map TxOutRef TxOut forall k a. Ord k => [(k, a)] -> Map k a -Map.fromList +Map.fromList ([(TxOutRef, TxOut)] -> Map TxOutRef TxOut) -> m [(TxOutRef, TxOut)] -> m (Map TxOutRef TxOut) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b -<$> let balanceWalletAddress :: Address -balanceWalletAddress = Wallet -> Address +<$> let balanceWalletAddress :: Address +balanceWalletAddress = Wallet -> Address walletAddress Wallet -balanceWallet - noDatumPredicate :: TxOut -> Bool -noDatumPredicate = (\case OutputDatum -PV2.NoOutputDatum -> Bool -True; OutputDatum +balanceWallet + noDatumPredicate :: TxOut -> Bool +noDatumPredicate = (\case OutputDatum +PV2.NoOutputDatum -> Bool +True; OutputDatum _ -> Bool -False) (OutputDatum -> Bool) -> (TxOut -> OutputDatum) -> TxOut -> Bool +False) (OutputDatum -> Bool) -> (TxOut -> OutputDatum) -> TxOut -> Bool forall b c a. (b -> c) -> (a -> b) -> a -> c -. TxOut -> OutputDatum +. TxOut -> OutputDatum forall o. (IsAbstractOutput o, ToOutputDatum (DatumType o)) => o -> OutputDatum outputOutputDatum (TxOut -> OutputDatum) -> (TxOut -> TxOut) -> TxOut -> OutputDatum forall b c a. (b -> c) -> (a -> b) -> a -> c -. TxOut -> TxOut +. TxOut -> TxOut txOutV2FromLedger in case TxOpts -> BalancingUtxos txOptBalancingUtxos (TxOpts -> BalancingUtxos) -> (TxSkel -> TxOpts) -> TxSkel -> BalancingUtxos forall b c a. (b -> c) -> (a -> b) -> a -> c -. TxSkel -> TxOpts +. TxSkel -> TxOpts txSkelOpts (TxSkel -> BalancingUtxos) -> TxSkel -> BalancingUtxos forall a b. (a -> b) -> a -> b -$ TxSkel -skel0 of +$ TxSkel +skel0 of BalancingUtxos BalancingUtxosAll -> Address -> m [(TxOutRef, TxOut)] forall (m :: * -> *). MonadBlockChainBalancing m => Address -> m [(TxOutRef, TxOut)] utxosAtLedger Address -balanceWalletAddress +balanceWalletAddress BalancingUtxos BalancingUtxosDatumless -> UtxoSearch m TxOut -> m [(TxOutRef, TxOut)] forall (m :: * -> *) a. @@ -1084,118 +1084,118 @@ MonadBlockChainBalancing m => Address -> UtxoSearch m TxOut utxosAtLedgerSearch Address -balanceWalletAddress UtxoSearch m TxOut -> (TxOut -> Bool) -> UtxoSearch m TxOut +balanceWalletAddress UtxoSearch m TxOut -> (TxOut -> Bool) -> UtxoSearch m TxOut forall (m :: * -> *) a. Monad m => UtxoSearch m a -> (a -> Bool) -> UtxoSearch m a `filterWithPred` TxOut -> Bool -noDatumPredicate) - BalancingUtxosAllowlist [TxOutRef] -txOutRefs -> ((TxOutRef, TxOut) -> Bool) +noDatumPredicate) + BalancingUtxosAllowlist [TxOutRef] +txOutRefs -> ((TxOutRef, TxOut) -> Bool) -> [(TxOutRef, TxOut)] -> [(TxOutRef, TxOut)] forall a. (a -> Bool) -> [a] -> [a] -filter ((TxOutRef -> [TxOutRef] -> Bool +filter ((TxOutRef -> [TxOutRef] -> Bool forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool -`elem` [TxOutRef] -txOutRefs) (TxOutRef -> Bool) +`elem` [TxOutRef] +txOutRefs) (TxOutRef -> Bool) -> ((TxOutRef, TxOut) -> TxOutRef) -> (TxOutRef, TxOut) -> Bool forall b c a. (b -> c) -> (a -> b) -> a -> c -. (TxOutRef, TxOut) -> TxOutRef +. (TxOutRef, TxOut) -> TxOutRef forall a b. (a, b) -> a -fst) ([(TxOutRef, TxOut)] -> [(TxOutRef, TxOut)]) +fst) ([(TxOutRef, TxOut)] -> [(TxOutRef, TxOut)]) -> m [(TxOutRef, TxOut)] -> m [(TxOutRef, TxOut)] forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b -<$> Address -> m [(TxOutRef, TxOut)] +<$> Address -> m [(TxOutRef, TxOut)] forall (m :: * -> *). MonadBlockChainBalancing m => Address -> m [(TxOutRef, TxOut)] utxosAtLedger Address -balanceWalletAddress - BalancingUtxosBlocklist [TxOutRef] -txOutRefs -> ((TxOutRef, TxOut) -> Bool) +balanceWalletAddress + BalancingUtxosBlocklist [TxOutRef] +txOutRefs -> ((TxOutRef, TxOut) -> Bool) -> [(TxOutRef, TxOut)] -> [(TxOutRef, TxOut)] forall a. (a -> Bool) -> [a] -> [a] -filter (Bool -> Bool -not (Bool -> Bool) +filter (Bool -> Bool +not (Bool -> Bool) -> ((TxOutRef, TxOut) -> Bool) -> (TxOutRef, TxOut) -> Bool forall b c a. (b -> c) -> (a -> b) -> a -> c -. (TxOutRef -> [TxOutRef] -> Bool +. (TxOutRef -> [TxOutRef] -> Bool forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool -`elem` [TxOutRef] -txOutRefs) (TxOutRef -> Bool) +`elem` [TxOutRef] +txOutRefs) (TxOutRef -> Bool) -> ((TxOutRef, TxOut) -> TxOutRef) -> (TxOutRef, TxOut) -> Bool forall b c a. (b -> c) -> (a -> b) -> a -> c -. (TxOutRef, TxOut) -> TxOutRef +. (TxOutRef, TxOut) -> TxOutRef forall a b. (a, b) -> a -fst) ([(TxOutRef, TxOut)] -> [(TxOutRef, TxOut)]) +fst) ([(TxOutRef, TxOut)] -> [(TxOutRef, TxOut)]) -> m [(TxOutRef, TxOut)] -> m [(TxOutRef, TxOut)] forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b -<$> Address -> m [(TxOutRef, TxOut)] +<$> Address -> m [(TxOutRef, TxOut)] forall (m :: * -> *). MonadBlockChainBalancing m => Address -> m [(TxOutRef, TxOut)] utxosAtLedger Address -balanceWalletAddress +balanceWalletAddress -- all UTxOs that the txSkel consumes. - Map TxOutRef TxOut -txSkelUtxos <- TxSkel -> m (Map TxOutRef TxOut) + Map TxOutRef TxOut +txSkelUtxos <- TxSkel -> m (Map TxOutRef TxOut) forall (m :: * -> *). MonadBlockChainBalancing m => TxSkel -> m (Map TxOutRef TxOut) txSkelInputUtxos TxSkel -skel +skel -- all UTxOs that the txSkel references. - Map TxOutRef TxOut -txSkelReferencedUtxos <- TxSkel -> m (Map TxOutRef TxOut) + Map TxOutRef TxOut +txSkelReferencedUtxos <- TxSkel -> m (Map TxOutRef TxOut) forall (m :: * -> *). MonadBlockChainBalancing m => TxSkel -> m (Map TxOutRef TxOut) txSkelReferenceInputUtxos TxSkel -skel - let index :: Either ToCardanoError (UTxO (BabbageEra StandardCrypto)) -index = Map TxOutRef TxOut +skel + let index :: Either ToCardanoError (UTxO (BabbageEra StandardCrypto)) +index = Map TxOutRef TxOut -> Either ToCardanoError (UTxO (BabbageEra StandardCrypto)) getEmulatorUTxO (Map TxOutRef TxOut -> Either ToCardanoError (UTxO (BabbageEra StandardCrypto))) -> Map TxOutRef TxOut -> Either ToCardanoError (UTxO (BabbageEra StandardCrypto)) forall a b. (a -> b) -> a -> b -$ Map TxOutRef TxOut -txSkelReferencedUtxos Map TxOutRef TxOut -> Map TxOutRef TxOut -> Map TxOutRef TxOut +$ Map TxOutRef TxOut +txSkelReferencedUtxos Map TxOutRef TxOut -> Map TxOutRef TxOut -> Map TxOutRef TxOut forall a. Semigroup a => a -> a -> a -<> Map TxOutRef TxOut -txSkelUtxos Map TxOutRef TxOut -> Map TxOutRef TxOut -> Map TxOutRef TxOut +<> Map TxOutRef TxOut +txSkelUtxos Map TxOutRef TxOut -> Map TxOutRef TxOut -> Map TxOutRef TxOut forall a. Semigroup a => a -> a -> a -<> Map TxOutRef TxOut -balancePKUtxos +<> Map TxOutRef TxOut +balancePKUtxos case Either ToCardanoError (UTxO (BabbageEra StandardCrypto)) -index of - Left ToCardanoError -err -> MockChainError -> m (TxSkel, Fee) +index of + Left ToCardanoError +err -> MockChainError -> m (TxSkel, Fee) forall e (m :: * -> *) a. MonadError e m => e -> m a -throwError (MockChainError -> m (TxSkel, Fee)) +throwError (MockChainError -> m (TxSkel, Fee)) -> MockChainError -> m (TxSkel, Fee) forall a b. (a -> b) -> a -> b -$ [Char] -> MockChainError +$ [Char] -> MockChainError FailWith ([Char] -> MockChainError) -> [Char] -> MockChainError forall a b. (a -> b) -> a -> b -$ [Char] +$ [Char] "setFeeAndValidRange: " [Char] -> [Char] -> [Char] forall a. [a] -> [a] -> [a] -++ ToCardanoError -> [Char] +++ ToCardanoError -> [Char] forall a. Show a => a -> [Char] -show ToCardanoError -err - Right UTxO (BabbageEra StandardCrypto) -cUtxoIndex -> do +show ToCardanoError +err + Right UTxO (BabbageEra StandardCrypto) +cUtxoIndex -> do -- We start with a high startingFee, but theres a chance that 'w' doesn't have enough funds -- so we'll see an unbalanceable error; in that case, we switch to the minimum fee and try again. -- That feels very much like a hack, and it is. Maybe we should witch to starting with a small -- fee and then increasing, but that might require more iterations until its settled. -- For now, let's keep it just like the folks from plutus-apps did it. - let startingFee :: Fee -startingFee = Integer -> Fee + let startingFee :: Fee +startingFee = Integer -> Fee Fee Integer 3000000 Int @@ -1210,17 +1210,17 @@ -> UTxO (BabbageEra StandardCrypto) -> TxSkel -> m (TxSkel, Fee) -calcFee Int +calcFee Int 5 Fee -startingFee UTxO (BabbageEra StandardCrypto) -cUtxoIndex TxSkel -skel +startingFee UTxO (BabbageEra StandardCrypto) +cUtxoIndex TxSkel +skel m (TxSkel, Fee) -> (MockChainError -> m (TxSkel, Fee)) -> m (TxSkel, Fee) forall e (m :: * -> *) a. MonadError e m => m a -> (e -> m a) -> m a -`catchError` \case +`catchError` \case -- Impossible to balance the transaction MCEUnbalanceable MCEUnbalanceableError _ TxSkel @@ -1230,8 +1230,8 @@ -- since we work on "TxSkel". However, for now, the -- implementation of "Pl.minFee" is a constant of 10 lovelace. -- https://github.com/input-output-hk/plutus-apps/blob/d4255f05477fd8477ee9673e850ebb9ebb8c9657/plutus-ledger/src/Ledger/Index.hs#L116 - let minFee :: Fee -minFee = Integer -> Fee + let minFee :: Fee +minFee = Integer -> Fee Fee Integer 10 -- forall tx. Pl.minFee tx = 10 lovelace in Int @@ -1246,100 +1246,100 @@ -> UTxO (BabbageEra StandardCrypto) -> TxSkel -> m (TxSkel, Fee) -calcFee Int +calcFee Int 5 Fee -minFee UTxO (BabbageEra StandardCrypto) -cUtxoIndex TxSkel -skel +minFee UTxO (BabbageEra StandardCrypto) +cUtxoIndex TxSkel +skel -- Impossible to generate the Cardano transaction at all - MockChainError -e -> MockChainError -> m (TxSkel, Fee) + MockChainError +e -> MockChainError -> m (TxSkel, Fee) forall e (m :: * -> *) a. MonadError e m => e -> m a -throwError MockChainError -e +throwError MockChainError +e where -- Inspired by https://github.com/input-output-hk/plutus-apps/blob/d4255f05477fd8477ee9673e850ebb9ebb8c9657/plutus-contract/src/Wallet/Emulator/Wallet.hs#L329 - calcFee :: - MonadBlockChainBalancing m => - Int -> + calcFee :: + (MonadBlockChainBalancing m) => + Int -> Fee -> - Emulator.UTxO Emulator.EmulatorEra -> + Emulator.UTxO Emulator.EmulatorEra -> TxSkel -> - m (TxSkel, Fee) - calcFee :: Int + m (TxSkel, Fee) + calcFee :: Int -> Fee -> UTxO (BabbageEra StandardCrypto) -> TxSkel -> m (TxSkel, Fee) -calcFee Int -n Fee -fee UTxO (BabbageEra StandardCrypto) -cUtxoIndex TxSkel -skel = do - TxSkel -attemptedSkel <- Wallet -> TxSkel -> Fee -> m TxSkel +calcFee Int +n Fee +fee UTxO (BabbageEra StandardCrypto) +cUtxoIndex TxSkel +skel = do + TxSkel +attemptedSkel <- Wallet -> TxSkel -> Fee -> m TxSkel forall (m :: * -> *). MonadBlockChainBalancing m => Wallet -> TxSkel -> Fee -> m TxSkel balanceTxFromAux Wallet -balanceWallet TxSkel -skel Fee -fee - Map DatumHash Datum -managedData <- TxSkel -> m (Map DatumHash Datum) +balanceWallet TxSkel +skel Fee +fee + Map DatumHash Datum +managedData <- TxSkel -> m (Map DatumHash Datum) forall (m :: * -> *). MonadBlockChainBalancing m => TxSkel -> m (Map DatumHash Datum) txSkelInputData TxSkel -skel - Map TxOutRef TxOut -managedTxOuts <- do - Map TxOutRef TxOut -ins <- TxSkel -> m (Map TxOutRef TxOut) +skel + Map TxOutRef TxOut +managedTxOuts <- do + Map TxOutRef TxOut +ins <- TxSkel -> m (Map TxOutRef TxOut) forall (m :: * -> *). MonadBlockChainBalancing m => TxSkel -> m (Map TxOutRef TxOut) txSkelInputUtxosPV2 TxSkel -skel - Map TxOutRef TxOut -insRef <- TxSkel -> m (Map TxOutRef TxOut) +skel + Map TxOutRef TxOut +insRef <- TxSkel -> m (Map TxOutRef TxOut) forall (m :: * -> *). MonadBlockChainBalancing m => TxSkel -> m (Map TxOutRef TxOut) txSkelReferenceInputUtxosPV2 TxSkel -skel +skel Map TxOutRef TxOut -> m (Map TxOutRef TxOut) forall (m :: * -> *) a. Monad m => a -> m a -return (Map TxOutRef TxOut -> m (Map TxOutRef TxOut)) +return (Map TxOutRef TxOut -> m (Map TxOutRef TxOut)) -> Map TxOutRef TxOut -> m (Map TxOutRef TxOut) forall a b. (a -> b) -> a -> b -$ Map TxOutRef TxOut -ins Map TxOutRef TxOut -> Map TxOutRef TxOut -> Map TxOutRef TxOut +$ Map TxOutRef TxOut +ins Map TxOutRef TxOut -> Map TxOutRef TxOut -> Map TxOutRef TxOut forall a. Semigroup a => a -> a -> a -<> Map TxOutRef TxOut -insRef - Map ValidatorHash (Versioned Validator) -managedValidators <- TxSkel -> m (Map ValidatorHash (Versioned Validator)) +<> Map TxOutRef TxOut +insRef + Map ValidatorHash (Versioned Validator) +managedValidators <- TxSkel -> m (Map ValidatorHash (Versioned Validator)) forall (m :: * -> *). MonadBlockChainBalancing m => TxSkel -> m (Map ValidatorHash (Versioned Validator)) txSkelInputValidators TxSkel -skel - Params -theParams <- Maybe EmulatorParamsModification -> Params -> Params +skel + Params +theParams <- Maybe EmulatorParamsModification -> Params -> Params applyEmulatorParamsModification (TxOpts -> Maybe EmulatorParamsModification txOptEmulatorParamsModification (TxOpts -> Maybe EmulatorParamsModification) -> (TxSkel -> TxOpts) -> TxSkel -> Maybe EmulatorParamsModification forall b c a. (b -> c) -> (a -> b) -> a -> c -. TxSkel -> TxOpts +. TxSkel -> TxOpts txSkelOpts (TxSkel -> Maybe EmulatorParamsModification) -> TxSkel -> Maybe EmulatorParamsModification forall a b. (a -> b) -> a -> b -$ TxSkel -skel) (Params -> Params) -> m Params -> m Params +$ TxSkel +skel) (Params -> Params) -> m Params -> m Params forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b -<$> m Params +<$> m Params forall (m :: * -> *). MonadBlockChainBalancing m => m Params getParams case Params @@ -1351,59 +1351,59 @@ -> Fee -> Either MockChainError Fee estimateTxSkelFee Params -theParams UTxO (BabbageEra StandardCrypto) -cUtxoIndex Map DatumHash Datum -managedData Map TxOutRef TxOut -managedTxOuts Map ValidatorHash (Versioned Validator) -managedValidators TxSkel -attemptedSkel Fee -fee of +theParams UTxO (BabbageEra StandardCrypto) +cUtxoIndex Map DatumHash Datum +managedData Map TxOutRef TxOut +managedTxOuts Map ValidatorHash (Versioned Validator) +managedValidators TxSkel +attemptedSkel Fee +fee of -- necessary to capture script failure for failed cases - Left err :: MockChainError -err@MCEValidationError {} -> MockChainError -> m (TxSkel, Fee) + Left err :: MockChainError +err@MCEValidationError {} -> MockChainError -> m (TxSkel, Fee) forall e (m :: * -> *) a. MonadError e m => e -> m a -throwError MockChainError -err - Left MockChainError -err -> MockChainError -> m (TxSkel, Fee) +throwError MockChainError +err + Left MockChainError +err -> MockChainError -> m (TxSkel, Fee) forall e (m :: * -> *) a. MonadError e m => e -> m a -throwError (MockChainError -> m (TxSkel, Fee)) +throwError (MockChainError -> m (TxSkel, Fee)) -> MockChainError -> m (TxSkel, Fee) forall a b. (a -> b) -> a -> b -$ MockChainError -> MockChainError +$ MockChainError -> MockChainError MCECalcFee MockChainError -err - Right Fee -newFee +err + Right Fee +newFee | Fee -newFee Fee -> Fee -> Bool +newFee Fee -> Fee -> Bool forall a. Eq a => a -> a -> Bool -== Fee -fee -> do +== Fee +fee -> do -- Debug.Trace.traceM "Reached fixpoint:" -- Debug.Trace.traceM $ "- fee = " <> show fee -- Debug.Trace.traceM $ "- skeleton = " <> show (attemptedSkel {_txSkelFee = fee}) (TxSkel, Fee) -> m (TxSkel, Fee) forall (f :: * -> *) a. Applicative f => a -> f a -pure (TxSkel -attemptedSkel, Fee -fee) -- reached fixpoint +pure (TxSkel +attemptedSkel, Fee +fee) -- reached fixpoint | Int -n Int -> Int -> Bool +n Int -> Int -> Bool forall a. Eq a => a -> a -> Bool -== Int +== Int 0 -> do -- Debug.Trace.traceM $ "Max iteration reached: newFee = " <> show newFee (TxSkel, Fee) -> m (TxSkel, Fee) forall (f :: * -> *) a. Applicative f => a -> f a -pure (TxSkel -attemptedSkel, Fee -> Fee -> Fee +pure (TxSkel +attemptedSkel, Fee -> Fee -> Fee forall a. Ord a => a -> a -> a -max Fee -newFee Fee -fee) -- maximum number of iterations +max Fee +newFee Fee +fee) -- maximum number of iterations | Bool -otherwise -> do +otherwise -> do -- Debug.Trace.traceM $ "New iteration: newfee = " <> show newFee Int -> Fee @@ -1417,26 +1417,26 @@ -> UTxO (BabbageEra StandardCrypto) -> TxSkel -> m (TxSkel, Fee) -calcFee (Int -n Int -> Int -> Int +calcFee (Int +n Int -> Int -> Int forall a. Num a => a -> a -> a -- Int +- Int 1) Fee -newFee UTxO (BabbageEra StandardCrypto) -cUtxoIndex TxSkel -skel +newFee UTxO (BabbageEra StandardCrypto) +cUtxoIndex TxSkel +skel -- | This funcion is essentially a copy of -- https://github.com/input-output-hk/plutus-apps/blob/d4255f05477fd8477ee9673e850ebb9ebb8c9657/plutus-ledger/src/Ledger/Fee.hs#L19 estimateTxSkelFee :: - Emulator.Params -> - Emulator.UTxO Emulator.EmulatorEra -> - Map Pl.DatumHash Pl.Datum -> - Map PV2.TxOutRef PV2.TxOut -> - Map PV2.ValidatorHash (Pl.Versioned PV2.Validator) -> + Emulator.Params -> + Emulator.UTxO Emulator.EmulatorEra -> + Map Pl.DatumHash Pl.Datum -> + Map PV2.TxOutRef PV2.TxOut -> + Map PV2.ValidatorHash (Pl.Versioned PV2.Validator) -> TxSkel -> Fee -> - Either MockChainError Fee + Either MockChainError Fee estimateTxSkelFee :: Params -> UTxO (BabbageEra StandardCrypto) -> Map DatumHash Datum @@ -1445,29 +1445,29 @@ -> TxSkel -> Fee -> Either MockChainError Fee -estimateTxSkelFee Params -params UTxO (BabbageEra StandardCrypto) -cUtxoIndex Map DatumHash Datum -managedData Map TxOutRef TxOut -managedTxOuts Map ValidatorHash (Versioned Validator) -managedValidators TxSkel -skel Fee -fee = do - TxBodyContent BuildTx BabbageEra -txBodyContent <- +estimateTxSkelFee Params +params UTxO (BabbageEra StandardCrypto) +cUtxoIndex Map DatumHash Datum +managedData Map TxOutRef TxOut +managedTxOuts Map ValidatorHash (Versioned Validator) +managedValidators TxSkel +skel Fee +fee = do + TxBodyContent BuildTx BabbageEra +txBodyContent <- (GenerateTxError -> MockChainError) -> Either GenerateTxError (TxBodyContent BuildTx BabbageEra) -> Either MockChainError (TxBodyContent BuildTx BabbageEra) forall (a :: * -> * -> *) b c d. ArrowChoice a => a b c -> a (Either b d) (Either c d) -left GenerateTxError -> MockChainError +left GenerateTxError -> MockChainError MCEGenerationError (Either GenerateTxError (TxBodyContent BuildTx BabbageEra) -> Either MockChainError (TxBodyContent BuildTx BabbageEra)) -> Either GenerateTxError (TxBodyContent BuildTx BabbageEra) -> Either MockChainError (TxBodyContent BuildTx BabbageEra) forall a b. (a -> b) -> a -> b -$ +$ GenTxParams -> Params -> Map DatumHash Datum @@ -1477,21 +1477,21 @@ -> Either GenerateTxError (TxBodyContent BuildTx BabbageEra) generateTxBodyContent GenTxParams forall a. Default a => a -def {gtpFee :: Fee +def {gtpFee :: Fee gtpFee = Fee -fee} Params -params Map DatumHash Datum -managedData Map TxOutRef TxOut -managedTxOuts Map ValidatorHash (Versioned Validator) -managedValidators TxSkel -skel - let nkeys :: Word -nkeys = TxBodyContent BuildTx BabbageEra -> Word +fee} Params +params Map DatumHash Datum +managedData Map TxOutRef TxOut +managedTxOuts Map ValidatorHash (Versioned Validator) +managedValidators TxSkel +skel + let nkeys :: Word +nkeys = TxBodyContent BuildTx BabbageEra -> Word forall era. TxBodyContent BuildTx era -> Word -C.estimateTransactionKeyWitnessCount TxBodyContent BuildTx BabbageEra -txBodyContent - TxBody BabbageEra -txBody <- +C.estimateTransactionKeyWitnessCount TxBodyContent BuildTx BabbageEra +txBodyContent + TxBody BabbageEra +txBody <- (Either ValidationErrorInPhase ToCardanoError -> MockChainError) -> Either (Either ValidationErrorInPhase ToCardanoError) (TxBody BabbageEra) @@ -1499,18 +1499,18 @@ forall (a :: * -> * -> *) b c d. ArrowChoice a => a b c -> a (Either b d) (Either c d) -left +left ( \case - Left ValidationErrorInPhase -err -> ValidationErrorInPhase -> MockChainError + Left ValidationErrorInPhase +err -> ValidationErrorInPhase -> MockChainError MCEValidationError ValidationErrorInPhase -err - Right ToCardanoError -err -> GenerateTxError -> MockChainError +err + Right ToCardanoError +err -> GenerateTxError -> MockChainError MCEGenerationError ([Char] -> ToCardanoError -> GenerateTxError ToCardanoError [Char] "makeTransactionBody" ToCardanoError -err) +err) ) (Either (Either ValidationErrorInPhase ToCardanoError) (TxBody BabbageEra) @@ -1519,43 +1519,43 @@ (Either ValidationErrorInPhase ToCardanoError) (TxBody BabbageEra) -> Either MockChainError (TxBody BabbageEra) forall a b. (a -> b) -> a -> b -$ Params +$ Params -> UTxO (BabbageEra StandardCrypto) -> CardanoBuildTx -> Either (Either ValidationErrorInPhase ToCardanoError) (TxBody BabbageEra) -Emulator.makeTransactionBody Params -params UTxO (BabbageEra StandardCrypto) -cUtxoIndex (TxBodyContent BuildTx BabbageEra -> CardanoBuildTx -Ledger.CardanoBuildTx TxBodyContent BuildTx BabbageEra -txBodyContent) +Emulator.makeTransactionBody Params +params UTxO (BabbageEra StandardCrypto) +cUtxoIndex (TxBodyContent BuildTx BabbageEra -> CardanoBuildTx +Ledger.CardanoBuildTx TxBodyContent BuildTx BabbageEra +txBodyContent) case ProtocolParameters -> TxBody BabbageEra -> Word -> Word -> Lovelace forall era. IsShelleyBasedEra era => ProtocolParameters -> TxBody era -> Word -> Word -> Lovelace -C.evaluateTransactionFee (Params -> ProtocolParameters -Emulator.pProtocolParams Params -params) TxBody BabbageEra -txBody Word -nkeys Word +C.evaluateTransactionFee (Params -> ProtocolParameters +Emulator.pProtocolParams Params +params) TxBody BabbageEra +txBody Word +nkeys Word 0 of - C.Lovelace Integer -fee -> Fee -> Either MockChainError Fee + C.Lovelace Integer +fee -> Fee -> Either MockChainError Fee forall (f :: * -> *) a. Applicative f => a -> f a -pure (Fee -> Either MockChainError Fee) +pure (Fee -> Either MockChainError Fee) -> Fee -> Either MockChainError Fee forall a b. (a -> b) -> a -> b -$ Integer -> Fee +$ Integer -> Fee Fee Integer -fee +fee -- | Calculates the collateral for a transaction -calcCollateral :: MonadBlockChainBalancing m => Wallet -> m (Set PV2.TxOutRef) +calcCollateral :: (MonadBlockChainBalancing m) => Wallet -> m (Set PV2.TxOutRef) calcCollateral :: Wallet -> m (Set TxOutRef) -calcCollateral Wallet -w = do - [(TxOutRef, ConcreteOutput Credential () Ada ScriptHash)] -souts <- +calcCollateral Wallet +w = do + [(TxOutRef, ConcreteOutput Credential () Ada ScriptHash)] +souts <- UtxoSearch m (ConcreteOutput Credential () Ada ScriptHash) -> m [(TxOutRef, ConcreteOutput Credential () Ada ScriptHash)] forall (m :: * -> *) a. @@ -1566,14 +1566,14 @@ -> UtxoSearch m (ConcreteOutput Credential () Ada ScriptHash) -> m [(TxOutRef, ConcreteOutput Credential () Ada ScriptHash)] forall a b. (a -> b) -> a -> b -$ +$ Address -> UtxoSearch m TxOut forall (m :: * -> *). MonadBlockChainBalancing m => Address -> UtxoSearch m TxOut utxosAtSearch (Wallet -> Address walletAddress Wallet -w) +w) UtxoSearch m TxOut -> (TxOut -> Maybe (ConcreteOutput Credential () Value ScriptHash)) -> UtxoSearch m (ConcreteOutput Credential () Value ScriptHash) @@ -1612,55 +1612,55 @@ isOnlyAdaOutput Bool -> m () -> m () forall (f :: * -> *). Applicative f => Bool -> f () -> f () -when ([(TxOutRef, ConcreteOutput Credential () Ada ScriptHash)] -> Bool +when ([(TxOutRef, ConcreteOutput Credential () Ada ScriptHash)] -> Bool forall (t :: * -> *) a. Foldable t => t a -> Bool -null [(TxOutRef, ConcreteOutput Credential () Ada ScriptHash)] -souts) (m () -> m ()) -> m () -> m () +null [(TxOutRef, ConcreteOutput Credential () Ada ScriptHash)] +souts) (m () -> m ()) -> m () -> m () forall a b. (a -> b) -> a -> b -$ +$ MockChainError -> m () forall e (m :: * -> *) a. MonadError e m => e -> m a -throwError MockChainError +throwError MockChainError MCENoSuitableCollateral -- TODO We only keep one element of the list because we are limited on -- how many collateral inputs a transaction can have. Should this be -- investigated further for a better approach? Set TxOutRef -> m (Set TxOutRef) forall (m :: * -> *) a. Monad m => a -> m a -return (Set TxOutRef -> m (Set TxOutRef)) +return (Set TxOutRef -> m (Set TxOutRef)) -> Set TxOutRef -> m (Set TxOutRef) forall a b. (a -> b) -> a -> b -$ [TxOutRef] -> Set TxOutRef +$ [TxOutRef] -> Set TxOutRef forall a. Ord a => [a] -> Set a -Set.fromList ([TxOutRef] -> Set TxOutRef) -> [TxOutRef] -> Set TxOutRef +Set.fromList ([TxOutRef] -> Set TxOutRef) -> [TxOutRef] -> Set TxOutRef forall a b. (a -> b) -> a -> b -$ Int -> [TxOutRef] -> [TxOutRef] +$ Int -> [TxOutRef] -> [TxOutRef] forall a. Int -> [a] -> [a] -take Int +take Int 1 ((TxOutRef, ConcreteOutput Credential () Ada ScriptHash) -> TxOutRef forall a b. (a, b) -> a -fst ((TxOutRef, ConcreteOutput Credential () Ada ScriptHash) +fst ((TxOutRef, ConcreteOutput Credential () Ada ScriptHash) -> TxOutRef) -> [(TxOutRef, ConcreteOutput Credential () Ada ScriptHash)] -> [TxOutRef] forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b -<$> [(TxOutRef, ConcreteOutput Credential () Ada ScriptHash)] -souts) +<$> [(TxOutRef, ConcreteOutput Credential () Ada ScriptHash)] +souts) -balanceTxFromAux :: MonadBlockChainBalancing m => Wallet -> TxSkel -> Fee -> m TxSkel +balanceTxFromAux :: (MonadBlockChainBalancing m) => Wallet -> TxSkel -> Fee -> m TxSkel balanceTxFromAux :: Wallet -> TxSkel -> Fee -> m TxSkel -balanceTxFromAux Wallet -balanceWallet TxSkel -txskel Fee -fee = do - bres :: BalanceTxRes -bres@(BalanceTxRes {[(TxOutRef, TxOut)] +balanceTxFromAux Wallet +balanceWallet TxSkel +txskel Fee +fee = do + bres :: BalanceTxRes +bres@(BalanceTxRes {[(TxOutRef, TxOut)] newInputs :: BalanceTxRes -> [(TxOutRef, TxOut)] newInputs :: [(TxOutRef, TxOut)] -newInputs, Value +newInputs, Value returnValue :: BalanceTxRes -> Value returnValue :: Value -returnValue, [(TxOutRef, TxOut)] +returnValue, [(TxOutRef, TxOut)] availableUtxos :: BalanceTxRes -> [(TxOutRef, TxOut)] availableUtxos :: [(TxOutRef, TxOut)] availableUtxos}) <- Wallet -> TxSkel -> Fee -> m BalanceTxRes @@ -1668,85 +1668,85 @@ MonadBlockChainBalancing m => Wallet -> TxSkel -> Fee -> m BalanceTxRes calcBalanceTx Wallet -balanceWallet TxSkel -txskel Fee -fee +balanceWallet TxSkel +txskel Fee +fee case PubKeyHash -> BalanceTxRes -> TxSkel -> Maybe TxSkel applyBalanceTx (Wallet -> PubKeyHash walletPKHash Wallet -balanceWallet) BalanceTxRes -bres TxSkel -txskel of - Just TxSkel -txskel' -> TxSkel -> m TxSkel +balanceWallet) BalanceTxRes +bres TxSkel +txskel of + Just TxSkel +txskel' -> TxSkel -> m TxSkel forall (m :: * -> *) a. Monad m => a -> m a -return TxSkel -txskel' +return TxSkel +txskel' Maybe TxSkel -Nothing -> +Nothing -> MockChainError -> m TxSkel forall e (m :: * -> *) a. MonadError e m => e -> m a -throwError (MockChainError -> m TxSkel) -> MockChainError -> m TxSkel +throwError (MockChainError -> m TxSkel) -> MockChainError -> m TxSkel forall a b. (a -> b) -> a -> b -$ +$ MCEUnbalanceableError -> TxSkel -> MockChainError MCEUnbalanceable ( (Value, [TxOutRef]) -> (Value, [TxOutRef]) -> Value -> MCEUnbalanceableError MCEUnbalNotEnoughReturning ([(TxOutRef, TxOut)] -> (Value, [TxOutRef]) -valueAndRefs [(TxOutRef, TxOut)] -newInputs) +valueAndRefs [(TxOutRef, TxOut)] +newInputs) ([(TxOutRef, TxOut)] -> (Value, [TxOutRef]) -valueAndRefs [(TxOutRef, TxOut)] -availableUtxos) +valueAndRefs [(TxOutRef, TxOut)] +availableUtxos) Value -returnValue +returnValue ) TxSkel -txskel +txskel where - valueAndRefs :: [(PV2.TxOutRef, PV2.TxOut)] -> (PV2.Value, [PV2.TxOutRef]) - valueAndRefs :: [(TxOutRef, TxOut)] -> (Value, [TxOutRef]) -valueAndRefs [(TxOutRef, TxOut)] -x = ([Value] -> Value + valueAndRefs :: [(PV2.TxOutRef, PV2.TxOut)] -> (PV2.Value, [PV2.TxOutRef]) + valueAndRefs :: [(TxOutRef, TxOut)] -> (Value, [TxOutRef]) +valueAndRefs [(TxOutRef, TxOut)] +x = ([Value] -> Value forall a. Monoid a => [a] -> a -mconcat (TxOut -> Value +mconcat (TxOut -> Value forall o. (IsAbstractOutput o, ToValue (ValueType o)) => o -> Value outputValue (TxOut -> Value) -> ((TxOutRef, TxOut) -> TxOut) -> (TxOutRef, TxOut) -> Value forall b c a. (b -> c) -> (a -> b) -> a -> c -. (TxOutRef, TxOut) -> TxOut +. (TxOutRef, TxOut) -> TxOut forall a b. (a, b) -> b -snd ((TxOutRef, TxOut) -> Value) -> [(TxOutRef, TxOut)] -> [Value] +snd ((TxOutRef, TxOut) -> Value) -> [(TxOutRef, TxOut)] -> [Value] forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b -<$> [(TxOutRef, TxOut)] -x), (TxOutRef, TxOut) -> TxOutRef +<$> [(TxOutRef, TxOut)] +x), (TxOutRef, TxOut) -> TxOutRef forall a b. (a, b) -> a -fst ((TxOutRef, TxOut) -> TxOutRef) +fst ((TxOutRef, TxOut) -> TxOutRef) -> [(TxOutRef, TxOut)] -> [TxOutRef] forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b -<$> [(TxOutRef, TxOut)] -x) +<$> [(TxOutRef, TxOut)] +x) data BalanceTxRes = BalanceTxRes { -- | Inputs that need to be added in order to cover the value in the -- transaction outputs BalanceTxRes -> [(TxOutRef, TxOut)] -newInputs :: [(PV2.TxOutRef, PV2.TxOut)], +newInputs :: [(PV2.TxOutRef, PV2.TxOut)], -- | The 'newInputs' will add _at least_ the missing value to cover the -- outputs, this is the difference of the input value together with the -- 'newInputs' and the output value. This value must be nonnegative in -- every asset class. BalanceTxRes -> Value -returnValue :: PV2.Value, +returnValue :: PV2.Value, -- | Some additional UTxOs that could be used as extra inputs. These all -- belong to the same wallet that was passed to 'calcBalanceTx' as an -- argument, and are sorted in decreasing order of their Ada value. BalanceTxRes -> [(TxOutRef, TxOut)] -availableUtxos :: [(PV2.TxOutRef, PV2.TxOut)] +availableUtxos :: [(PV2.TxOutRef, PV2.TxOut)] } - deriving (Int -> BalanceTxRes -> [Char] -> [Char] + deriving (Int -> BalanceTxRes -> [Char] -> [Char] [BalanceTxRes] -> [Char] -> [Char] BalanceTxRes -> [Char] (Int -> BalanceTxRes -> [Char] -> [Char]) @@ -1762,70 +1762,70 @@ $cshow :: BalanceTxRes -> [Char] showsPrec :: Int -> BalanceTxRes -> [Char] -> [Char] $cshowsPrec :: Int -> BalanceTxRes -> [Char] -> [Char] -Show) +Show) -- | Calculate the changes needed to balance a transaction with money from a -- given wallet. Every transaction that is sent to the chain must be balanced, -- that is: @inputs + mints == outputs + fee + burns@. -calcBalanceTx :: MonadBlockChainBalancing m => Wallet -> TxSkel -> Fee -> m BalanceTxRes +calcBalanceTx :: (MonadBlockChainBalancing m) => Wallet -> TxSkel -> Fee -> m BalanceTxRes calcBalanceTx :: Wallet -> TxSkel -> Fee -> m BalanceTxRes -calcBalanceTx Wallet -balanceWallet TxSkel -skel Fee -fee = do - Value -inValue <- (Value -> Value -> Value +calcBalanceTx Wallet +balanceWallet TxSkel +skel Fee +fee = do + Value +inValue <- (Value -> Value -> Value forall a. Semigroup a => a -> a -> a -<> Value -> Value +<> Value -> Value positivePart (TxSkelMints -> Value txSkelMintsValue (TxSkelMints -> Value) -> TxSkelMints -> Value forall a b. (a -> b) -> a -> b -$ TxSkel -> TxSkelMints +$ TxSkel -> TxSkelMints txSkelMints TxSkel -skel)) (Value -> Value) -> m Value -> m Value +skel)) (Value -> Value) -> m Value -> m Value forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b -<$> TxSkel -> m Value +<$> TxSkel -> m Value forall (m :: * -> *). MonadBlockChainBalancing m => TxSkel -> m Value txSkelInputValue TxSkel -skel -- transaction inputs + minted value - let outValue :: Value -outValue = TxSkel -> Fee -> Value +skel -- transaction inputs + minted value + let outValue :: Value +outValue = TxSkel -> Fee -> Value txSkelOutputValue TxSkel -skel Fee -fee -- transaction outputs + fee + burned value - difference :: Value -difference = Value -outValue Value -> Value -> Value +skel Fee +fee -- transaction outputs + fee + burned value + difference :: Value +difference = Value +outValue Value -> Value -> Value forall a. Semigroup a => a -> a -> a -<> Value -> Value +<> Value -> Value forall a. AdditiveGroup a => a -> a -Pl.negate Value -inValue +Pl.negate Value +inValue -- This is the value that must still be paid by 'balancePK' in order to -- balance the transaction: - missingValue :: Value -missingValue = Value -> Value + missingValue :: Value +missingValue = Value -> Value positivePart Value -difference +difference -- This will be paid to 'balancePK' in any case: - initialExcess :: Value -initialExcess = Value -> Value + initialExcess :: Value +initialExcess = Value -> Value negativePart Value -difference +difference -- All TxOutRefs that the transaction consumes. We'll need them to make sure -- that no additional UTxOs are chosen that are in fact already present on the -- transaction. - inputOrefs :: [TxOutRef] -inputOrefs = Map TxOutRef TxSkelRedeemer -> [TxOutRef] + inputOrefs :: [TxOutRef] +inputOrefs = Map TxOutRef TxSkelRedeemer -> [TxOutRef] forall k a. Map k a -> [k] -Map.keys (Map TxOutRef TxSkelRedeemer -> [TxOutRef]) +Map.keys (Map TxOutRef TxSkelRedeemer -> [TxOutRef]) -> Map TxOutRef TxSkelRedeemer -> [TxOutRef] forall a b. (a -> b) -> a -> b -$ TxSkel -> Map TxOutRef TxSkelRedeemer +$ TxSkel -> Map TxOutRef TxSkelRedeemer txSkelIns TxSkel -skel +skel -- Get all UTxOs that belong to the given wallet, and that are not yet being -- consumed on the transaction. -- @@ -1835,122 +1835,122 @@ -- therefore become less likely for the 'returnValue' to be less than the -- minimum Ada amount required for each output. See this comment for context: -- https://github.com/tweag/cooked-validators/issues/71#issuecomment-1016406041 - [(TxOutRef, TxOut)] -candidateUtxos <- + [(TxOutRef, TxOut)] +candidateUtxos <- ((TxOutRef, TxOut) -> (TxOutRef, TxOut) -> Ordering) -> [(TxOutRef, TxOut)] -> [(TxOutRef, TxOut)] forall a. (a -> a -> Ordering) -> [a] -> [a] -sortBy ((Ada -> Ada -> Ordering) -> Ada -> Ada -> Ordering +sortBy ((Ada -> Ada -> Ordering) -> Ada -> Ada -> Ordering forall a b c. (a -> b -> c) -> b -> a -> c -flip Ada -> Ada -> Ordering +flip Ada -> Ada -> Ordering forall a. Ord a => a -> a -> Ordering -compare (Ada -> Ada -> Ordering) +compare (Ada -> Ada -> Ordering) -> ((TxOutRef, TxOut) -> Ada) -> (TxOutRef, TxOut) -> (TxOutRef, TxOut) -> Ordering forall b c a. (b -> b -> c) -> (a -> b) -> a -> a -> c -`on` Value -> Ada -Pl.fromValue (Value -> Ada) +`on` Value -> Ada +Pl.fromValue (Value -> Ada) -> ((TxOutRef, TxOut) -> Value) -> (TxOutRef, TxOut) -> Ada forall b c a. (b -> c) -> (a -> b) -> a -> c -. TxOut -> Value +. TxOut -> Value forall o. (IsAbstractOutput o, ToValue (ValueType o)) => o -> Value outputValue (TxOut -> Value) -> ((TxOutRef, TxOut) -> TxOut) -> (TxOutRef, TxOut) -> Value forall b c a. (b -> c) -> (a -> b) -> a -> c -. (TxOutRef, TxOut) -> TxOut +. (TxOutRef, TxOut) -> TxOut forall a b. (a, b) -> b -snd) +snd) ([(TxOutRef, TxOut)] -> [(TxOutRef, TxOut)]) -> ([(TxOutRef, TxOut)] -> [(TxOutRef, TxOut)]) -> [(TxOutRef, TxOut)] -> [(TxOutRef, TxOut)] forall b c a. (b -> c) -> (a -> b) -> a -> c -. ((TxOutRef, TxOut) -> Bool) +. ((TxOutRef, TxOut) -> Bool) -> [(TxOutRef, TxOut)] -> [(TxOutRef, TxOut)] forall a. (a -> Bool) -> [a] -> [a] -filter ((TxOutRef -> [TxOutRef] -> Bool +filter ((TxOutRef -> [TxOutRef] -> Bool forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool -`notElem` [TxOutRef] -inputOrefs) (TxOutRef -> Bool) +`notElem` [TxOutRef] +inputOrefs) (TxOutRef -> Bool) -> ((TxOutRef, TxOut) -> TxOutRef) -> (TxOutRef, TxOut) -> Bool forall b c a. (b -> c) -> (a -> b) -> a -> c -. (TxOutRef, TxOut) -> TxOutRef +. (TxOutRef, TxOut) -> TxOutRef forall a b. (a, b) -> a -fst) +fst) ([(TxOutRef, TxOut)] -> [(TxOutRef, TxOut)]) -> m [(TxOutRef, TxOut)] -> m [(TxOutRef, TxOut)] forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b -<$> Address -> m [(TxOutRef, TxOut)] +<$> Address -> m [(TxOutRef, TxOut)] forall (m :: * -> *). MonadBlockChainBalancing m => Address -> m [(TxOutRef, TxOut)] utxosAt (Wallet -> Address walletAddress Wallet -balanceWallet) +balanceWallet) case [(TxOutRef, TxOut)] -> [(TxOutRef, TxOut)] -> Value -> Value -> Maybe BalanceTxRes -selectNewInputs [(TxOutRef, TxOut)] -candidateUtxos [] Value -initialExcess Value -missingValue of +selectNewInputs [(TxOutRef, TxOut)] +candidateUtxos [] Value +initialExcess Value +missingValue of Maybe BalanceTxRes -Nothing -> +Nothing -> MockChainError -> m BalanceTxRes forall e (m :: * -> *) a. MonadError e m => e -> m a -throwError (MockChainError -> m BalanceTxRes) +throwError (MockChainError -> m BalanceTxRes) -> MockChainError -> m BalanceTxRes forall a b. (a -> b) -> a -> b -$ +$ MCEUnbalanceableError -> TxSkel -> MockChainError MCEUnbalanceable (Wallet -> Value -> MCEUnbalanceableError MCEUnbalNotEnoughFunds Wallet -balanceWallet Value -missingValue) +balanceWallet Value +missingValue) TxSkel -skel - Just BalanceTxRes -bTxRes -> BalanceTxRes -> m BalanceTxRes +skel + Just BalanceTxRes +bTxRes -> BalanceTxRes -> m BalanceTxRes forall (m :: * -> *) a. Monad m => a -> m a -return BalanceTxRes -bTxRes +return BalanceTxRes +bTxRes where - selectNewInputs :: - [(PV2.TxOutRef, PV2.TxOut)] -> - [(PV2.TxOutRef, PV2.TxOut)] -> - PV2.Value -> - PV2.Value -> - Maybe BalanceTxRes - selectNewInputs :: [(TxOutRef, TxOut)] + selectNewInputs :: + [(PV2.TxOutRef, PV2.TxOut)] -> + [(PV2.TxOutRef, PV2.TxOut)] -> + PV2.Value -> + PV2.Value -> + Maybe BalanceTxRes + selectNewInputs :: [(TxOutRef, TxOut)] -> [(TxOutRef, TxOut)] -> Value -> Value -> Maybe BalanceTxRes -selectNewInputs [(TxOutRef, TxOut)] -available [(TxOutRef, TxOut)] -chosen Value -excess Value -missing = +selectNewInputs [(TxOutRef, TxOut)] +available [(TxOutRef, TxOut)] +chosen Value +excess Value +missing = case Optic' An_Iso NoIx Value [(AssetClass, Integer)] -> Value -> [(AssetClass, Integer)] forall k (is :: IxList) s a. Is k A_Getter => Optic' k is s a -> s -> a -view Optic' An_Iso NoIx Value [(AssetClass, Integer)] +view Optic' An_Iso NoIx Value [(AssetClass, Integer)] flattenValueI Value -missing of +missing of [] -> BalanceTxRes -> Maybe BalanceTxRes forall a. a -> Maybe a -Just (BalanceTxRes -> Maybe BalanceTxRes) +Just (BalanceTxRes -> Maybe BalanceTxRes) -> BalanceTxRes -> Maybe BalanceTxRes forall a b. (a -> b) -> a -> b -$ [(TxOutRef, TxOut)] -> Value -> [(TxOutRef, TxOut)] -> BalanceTxRes +$ [(TxOutRef, TxOut)] -> Value -> [(TxOutRef, TxOut)] -> BalanceTxRes BalanceTxRes [(TxOutRef, TxOut)] -chosen Value -excess [(TxOutRef, TxOut)] -available - (AssetClass -ac, Integer -_) : [(AssetClass, Integer)] +chosen Value +excess [(TxOutRef, TxOut)] +available + (AssetClass +ac, Integer +_) : [(AssetClass, Integer)] _ -> -- Find the first UTxO belonging to the wallet that contains at least -- one token of the required asset class (The hope is that it'll @@ -1958,78 +1958,78 @@ -- fewer; we might need to add several UTxOs): case ((TxOutRef, TxOut) -> Bool) -> [(TxOutRef, TxOut)] -> Maybe Int forall a. (a -> Bool) -> [a] -> Maybe Int -findIndex ((Value -> Value -> Bool -`Pl.geq` AssetClass -> Integer -> Value -Pl.assetClassValue AssetClass -ac Integer +findIndex ((Value -> Value -> Bool +`Pl.geq` AssetClass -> Integer -> Value +Pl.assetClassValue AssetClass +ac Integer 1) (Value -> Bool) -> ((TxOutRef, TxOut) -> Value) -> (TxOutRef, TxOut) -> Bool forall b c a. (b -> c) -> (a -> b) -> a -> c -. TxOut -> Value +. TxOut -> Value forall o. (IsAbstractOutput o, ToValue (ValueType o)) => o -> Value outputValue (TxOut -> Value) -> ((TxOutRef, TxOut) -> TxOut) -> (TxOutRef, TxOut) -> Value forall b c a. (b -> c) -> (a -> b) -> a -> c -. (TxOutRef, TxOut) -> TxOut +. (TxOutRef, TxOut) -> TxOut forall a b. (a, b) -> b -snd) [(TxOutRef, TxOut)] -available of +snd) [(TxOutRef, TxOut)] +available of Maybe Int -Nothing -> Maybe BalanceTxRes +Nothing -> Maybe BalanceTxRes forall a. Maybe a -Nothing -- The wallet owns nothing of the required asset class. We can't balance with this wallet. - Just Int -i -> - let ([(TxOutRef, TxOut)] -left, (TxOutRef, TxOut) -theChosenUtxo : [(TxOutRef, TxOut)] -right) = Int +Nothing -- The wallet owns nothing of the required asset class. We can't balance with this wallet. + Just Int +i -> + let ([(TxOutRef, TxOut)] +left, (TxOutRef, TxOut) +theChosenUtxo : [(TxOutRef, TxOut)] +right) = Int -> [(TxOutRef, TxOut)] -> ([(TxOutRef, TxOut)], [(TxOutRef, TxOut)]) forall a. Int -> [a] -> ([a], [a]) -splitAt Int -i [(TxOutRef, TxOut)] -available - available' :: [(TxOutRef, TxOut)] -available' = [(TxOutRef, TxOut)] -left [(TxOutRef, TxOut)] -> [(TxOutRef, TxOut)] -> [(TxOutRef, TxOut)] +splitAt Int +i [(TxOutRef, TxOut)] +available + available' :: [(TxOutRef, TxOut)] +available' = [(TxOutRef, TxOut)] +left [(TxOutRef, TxOut)] -> [(TxOutRef, TxOut)] -> [(TxOutRef, TxOut)] forall a. [a] -> [a] -> [a] -++ [(TxOutRef, TxOut)] -right - chosen' :: [(TxOutRef, TxOut)] -chosen' = (TxOutRef, TxOut) -theChosenUtxo (TxOutRef, TxOut) -> [(TxOutRef, TxOut)] -> [(TxOutRef, TxOut)] +++ [(TxOutRef, TxOut)] +right + chosen' :: [(TxOutRef, TxOut)] +chosen' = (TxOutRef, TxOut) +theChosenUtxo (TxOutRef, TxOut) -> [(TxOutRef, TxOut)] -> [(TxOutRef, TxOut)] forall a. a -> [a] -> [a] -: [(TxOutRef, TxOut)] -chosen - theChosenValue :: Value -theChosenValue = TxOut -> Value +: [(TxOutRef, TxOut)] +chosen + theChosenValue :: Value +theChosenValue = TxOut -> Value forall o. (IsAbstractOutput o, ToValue (ValueType o)) => o -> Value outputValue (TxOut -> Value) -> TxOut -> Value forall a b. (a -> b) -> a -> b -$ (TxOutRef, TxOut) -> TxOut +$ (TxOutRef, TxOut) -> TxOut forall a b. (a, b) -> b -snd (TxOutRef, TxOut) -theChosenUtxo - theChosenDifference :: Value -theChosenDifference = Value -missing Value -> Value -> Value +snd (TxOutRef, TxOut) +theChosenUtxo + theChosenDifference :: Value +theChosenDifference = Value +missing Value -> Value -> Value forall a. Semigroup a => a -> a -> a -<> Value -> Value +<> Value -> Value forall a. AdditiveGroup a => a -> a -Pl.negate Value -theChosenValue - excess' :: Value -excess' = Value -excess Value -> Value -> Value +Pl.negate Value +theChosenValue + excess' :: Value +excess' = Value +excess Value -> Value -> Value forall a. Semigroup a => a -> a -> a -<> Value -> Value +<> Value -> Value negativePart Value -theChosenDifference - missing' :: Value -missing' = Value -> Value +theChosenDifference + missing' :: Value +missing' = Value -> Value positivePart Value -theChosenDifference +theChosenDifference in -- A remark on why the following line should not lead to an -- infinite recursion: The value described by @missing'@ is -- strictly smaller than the value described by @missing@, @@ -2037,11 +2037,11 @@ -- in @theChosenValue@. [(TxOutRef, TxOut)] -> [(TxOutRef, TxOut)] -> Value -> Value -> Maybe BalanceTxRes -selectNewInputs [(TxOutRef, TxOut)] -available' [(TxOutRef, TxOut)] -chosen' Value -excess' Value -missing' +selectNewInputs [(TxOutRef, TxOut)] +available' [(TxOutRef, TxOut)] +chosen' Value +excess' Value +missing' -- | Once we calculated what is needed to balance a transaction @skel@, we still -- need to apply those changes to @skel@. Because of the 'Pl.minAdaTxOut' @@ -2053,14 +2053,14 @@ -- UTxO belonging to the wallet to then create the output with the proper -- leftover. If the wallet has no UTxO, then there's no way to balance this -- transaction. -applyBalanceTx :: PV2.PubKeyHash -> BalanceTxRes -> TxSkel -> Maybe TxSkel +applyBalanceTx :: PV2.PubKeyHash -> BalanceTxRes -> TxSkel -> Maybe TxSkel applyBalanceTx :: PubKeyHash -> BalanceTxRes -> TxSkel -> Maybe TxSkel -applyBalanceTx PubKeyHash -balancePK (BalanceTxRes [(TxOutRef, TxOut)] -newInputs Value -returnValue [(TxOutRef, TxOut)] -availableUtxos) TxSkel -skel = do +applyBalanceTx PubKeyHash +balancePK (BalanceTxRes [(TxOutRef, TxOut)] +newInputs Value +returnValue [(TxOutRef, TxOut)] +availableUtxos) TxSkel +skel = do -- Here we'll try a few things, in order, until one of them succeeds: -- -- 1. If allowed by the balanceOutputPolicy, pick out the best possible output @@ -2082,27 +2082,27 @@ -- In that case, we could forget about adding several additional inputs. If -- one isn't enough, there's nothing we can do, no? let -- All transaction outputs - outs :: [TxSkelOut] - outs :: [TxSkelOut] -outs = TxSkel -> [TxSkelOut] + outs :: [TxSkelOut] + outs :: [TxSkelOut] +outs = TxSkel -> [TxSkelOut] txSkelOuts TxSkel -skel +skel -- All transaction outputs that are ada-only, datum-free, and belong to -- 'balancePK', together with the index of the corresponding 'TxSkelOut' -- in 'outs'. - candidateOutputsWithIndices :: [(Int, ConcreteOutput PV2.PubKeyHash () Pl.Ada PV2.ScriptHash)] - candidateOutputsWithIndices :: [(Int, ConcreteOutput PubKeyHash () Ada ScriptHash)] -candidateOutputsWithIndices = + candidateOutputsWithIndices :: [(Int, ConcreteOutput PV2.PubKeyHash () Pl.Ada PV2.ScriptHash)] + candidateOutputsWithIndices :: [(Int, ConcreteOutput PubKeyHash () Ada ScriptHash)] +candidateOutputsWithIndices = ((Int, TxSkelOut) -> Maybe (Int, ConcreteOutput PubKeyHash () Ada ScriptHash)) -> [(Int, TxSkelOut)] -> [(Int, ConcreteOutput PubKeyHash () Ada ScriptHash)] forall a b. (a -> Maybe b) -> [a] -> [b] -mapMaybe - ( \(Int -i, Pays o -output) -> +mapMaybe + ( \(Int +i, Pays o +output) -> case ( PubKeyHash -> o -> Maybe @@ -2119,7 +2119,7 @@ (ValueType output) (ReferenceScriptType output)) isPKOutputFrom PubKeyHash -balancePK +balancePK (o -> Maybe (ConcreteOutput @@ -2132,7 +2132,7 @@ forall (m :: * -> *) a b c. Monad m => (a -> m b) -> (b -> m c) -> a -> m c ->=> ConcreteOutput +>=> ConcreteOutput PubKeyHash TxSkelOutDatum Value (ReferenceScriptType o) -> Maybe (ConcreteOutput @@ -2161,7 +2161,7 @@ forall (m :: * -> *) a b c. Monad m => (a -> m b) -> (b -> m c) -> a -> m c ->=> ConcreteOutput +>=> ConcreteOutput PubKeyHash TxSkelOutDatum Ada (ReferenceScriptType o) -> Maybe (ConcreteOutput PubKeyHash () Ada (ReferenceScriptType o)) forall output. @@ -2186,17 +2186,17 @@ forall (m :: * -> *) a b c. Monad m => (a -> m b) -> (b -> m c) -> a -> m c ->=> ConcreteOutput PubKeyHash () Ada ScriptHash +>=> ConcreteOutput PubKeyHash () Ada ScriptHash -> Maybe (ConcreteOutput PubKeyHash () Ada ScriptHash) forall a. a -> Maybe a -Just (ConcreteOutput PubKeyHash () Ada ScriptHash +Just (ConcreteOutput PubKeyHash () Ada ScriptHash -> Maybe (ConcreteOutput PubKeyHash () Ada ScriptHash)) -> (ConcreteOutput PubKeyHash () Ada (ReferenceScriptType o) -> ConcreteOutput PubKeyHash () Ada ScriptHash) -> ConcreteOutput PubKeyHash () Ada (ReferenceScriptType o) -> Maybe (ConcreteOutput PubKeyHash () Ada ScriptHash) forall b c a. (b -> c) -> (a -> b) -> a -> c -. ConcreteOutput PubKeyHash () Ada (ReferenceScriptType o) +. ConcreteOutput PubKeyHash () Ada (ReferenceScriptType o) -> ConcreteOutput PubKeyHash () Ada ScriptHash forall output. (IsAbstractOutput output, @@ -2207,61 +2207,61 @@ toOutputWithReferenceScriptHash ) o -output of +output of Maybe (ConcreteOutput PubKeyHash () Ada ScriptHash) -Nothing -> Maybe (Int, ConcreteOutput PubKeyHash () Ada ScriptHash) +Nothing -> Maybe (Int, ConcreteOutput PubKeyHash () Ada ScriptHash) forall a. Maybe a -Nothing - Just ConcreteOutput PubKeyHash () Ada ScriptHash -output' -> (Int, ConcreteOutput PubKeyHash () Ada ScriptHash) +Nothing + Just ConcreteOutput PubKeyHash () Ada ScriptHash +output' -> (Int, ConcreteOutput PubKeyHash () Ada ScriptHash) -> Maybe (Int, ConcreteOutput PubKeyHash () Ada ScriptHash) forall a. a -> Maybe a -Just (Int -> Int +Just (Int -> Int forall a b. (Integral a, Num b) => a -> b -fromIntegral Int -i, ConcreteOutput PubKeyHash () Ada ScriptHash -output') +fromIntegral Int +i, ConcreteOutput PubKeyHash () Ada ScriptHash +output') ) ([(Int, TxSkelOut)] -> [(Int, ConcreteOutput PubKeyHash () Ada ScriptHash)]) -> [(Int, TxSkelOut)] -> [(Int, ConcreteOutput PubKeyHash () Ada ScriptHash)] forall a b. (a -> b) -> a -> b -$ [Int] -> [TxSkelOut] -> [(Int, TxSkelOut)] +$ [Int] -> [TxSkelOut] -> [(Int, TxSkelOut)] forall a b. [a] -> [b] -> [(a, b)] -zip [Int -0 :: Int ..] [TxSkelOut] -outs +zip [Int +0 :: Int ..] [TxSkelOut] +outs -- The index of the "best possible transaction output", as described -- above. - mBestOutputIndex :: Maybe Int - mBestOutputIndex :: Maybe Int -mBestOutputIndex = case ((Int, ConcreteOutput PubKeyHash () Ada ScriptHash) + mBestOutputIndex :: Maybe Int + mBestOutputIndex :: Maybe Int +mBestOutputIndex = case ((Int, ConcreteOutput PubKeyHash () Ada ScriptHash) -> (Int, ConcreteOutput PubKeyHash () Ada ScriptHash) -> Ordering) -> [(Int, ConcreteOutput PubKeyHash () Ada ScriptHash)] -> [(Int, ConcreteOutput PubKeyHash () Ada ScriptHash)] forall a. (a -> a -> Ordering) -> [a] -> [a] -sortBy +sortBy ( (Ada -> Ada -> Ordering) -> Ada -> Ada -> Ordering forall a b c. (a -> b -> c) -> b -> a -> c -flip Ada -> Ada -> Ordering +flip Ada -> Ada -> Ordering forall a. Ord a => a -> a -> Ordering -compare +compare (Ada -> Ada -> Ordering) -> ((Int, ConcreteOutput PubKeyHash () Ada ScriptHash) -> Ada) -> (Int, ConcreteOutput PubKeyHash () Ada ScriptHash) -> (Int, ConcreteOutput PubKeyHash () Ada ScriptHash) -> Ordering forall b c a. (b -> b -> c) -> (a -> b) -> a -> a -> c -`on` (ConcreteOutput PubKeyHash () Ada ScriptHash +`on` (ConcreteOutput PubKeyHash () Ada ScriptHash -> Optic' A_Lens NoIx (ConcreteOutput PubKeyHash () Ada ScriptHash) Ada -> Ada forall k s (is :: IxList) a. Is k A_Getter => s -> Optic' k is s a -> a -^. Optic' +^. Optic' A_Lens NoIx (ConcreteOutput PubKeyHash () Ada ScriptHash) Ada forall o. IsAbstractOutput o => Lens' o (ValueType o) outputValueL) -- This lens use means something different than 'outputValue', because it returns 'Pl.Ada'! @@ -2271,299 +2271,299 @@ -> (Int, ConcreteOutput PubKeyHash () Ada ScriptHash) -> Ada forall b c a. (b -> c) -> (a -> b) -> a -> c -. (Int, ConcreteOutput PubKeyHash () Ada ScriptHash) +. (Int, ConcreteOutput PubKeyHash () Ada ScriptHash) -> ConcreteOutput PubKeyHash () Ada ScriptHash forall a b. (a, b) -> b -snd +snd ) [(Int, ConcreteOutput PubKeyHash () Ada ScriptHash)] -candidateOutputsWithIndices of +candidateOutputsWithIndices of [] -> Maybe Int forall a. Maybe a -Nothing - (Int -best, ConcreteOutput PubKeyHash () Ada ScriptHash -_) : [(Int, ConcreteOutput PubKeyHash () Ada ScriptHash)] +Nothing + (Int +best, ConcreteOutput PubKeyHash () Ada ScriptHash +_) : [(Int, ConcreteOutput PubKeyHash () Ada ScriptHash)] _ -> Int -> Maybe Int forall a. a -> Maybe a -Just Int -best +Just Int +best - ins :: Map TxOutRef TxSkelRedeemer -ins = TxSkel -> Map TxOutRef TxSkelRedeemer + ins :: Map TxOutRef TxSkelRedeemer +ins = TxSkel -> Map TxOutRef TxSkelRedeemer txSkelIns TxSkel -skel - (Map TxOutRef TxSkelRedeemer -newIns, [TxSkelOut] -newOuts) <- +skel + (Map TxOutRef TxSkelRedeemer +newIns, [TxSkelOut] +newOuts) <- case Maybe Int -mBestOutputIndex of - Just Int -i -> - let ([TxSkelOut] -left, TxSkelOut -bestTxOut : [TxSkelOut] -right) = Int -> [TxSkelOut] -> ([TxSkelOut], [TxSkelOut]) +mBestOutputIndex of + Just Int +i -> + let ([TxSkelOut] +left, TxSkelOut +bestTxOut : [TxSkelOut] +right) = Int -> [TxSkelOut] -> ([TxSkelOut], [TxSkelOut]) forall a. Int -> [a] -> ([a], [a]) -splitAt Int -i [TxSkelOut] -outs +splitAt Int +i [TxSkelOut] +outs in case TxOpts -> BalanceOutputPolicy txOptBalanceOutputPolicy (TxOpts -> BalanceOutputPolicy) -> TxOpts -> BalanceOutputPolicy forall a b. (a -> b) -> a -> b -$ TxSkel -> TxOpts +$ TxSkel -> TxOpts txSkelOpts TxSkel -skel of +skel of BalanceOutputPolicy AdjustExistingOutput -> - let bestTxOutValue :: Value -bestTxOutValue = TxSkelOut -> Value + let bestTxOutValue :: Value +bestTxOutValue = TxSkelOut -> Value txSkelOutValue TxSkelOut -bestTxOut - adjustedValue :: Value -adjustedValue = Value -bestTxOutValue Value -> Value -> Value +bestTxOut + adjustedValue :: Value +adjustedValue = Value +bestTxOutValue Value -> Value -> Value forall a. Semigroup a => a -> a -> a -<> Value -returnValue +<> Value +returnValue in if Value -adjustedValue Value -> Value -> Bool -`Pl.geq` Ada -> Value -Pl.toValue Ada -Ledger.minAdaTxOutEstimated -- TODO make thid dependen on the atual TxOut +adjustedValue Value -> Value -> Bool +`Pl.geq` Ada -> Value +Pl.toValue Ada +Ledger.minAdaTxOutEstimated -- TODO make thid dependen on the atual TxOut then (Map TxOutRef TxSkelRedeemer, [TxSkelOut]) -> Maybe (Map TxOutRef TxSkelRedeemer, [TxSkelOut]) forall a. a -> Maybe a -Just -- (1) +Just -- (1) ( Map TxOutRef TxSkelRedeemer -ins Map TxOutRef TxSkelRedeemer +ins Map TxOutRef TxSkelRedeemer -> Map TxOutRef TxSkelRedeemer -> Map TxOutRef TxSkelRedeemer forall a. Semigroup a => a -> a -> a -<> (TxOutRef -> TxSkelRedeemer) +<> (TxOutRef -> TxSkelRedeemer) -> Set TxOutRef -> Map TxOutRef TxSkelRedeemer forall k a. (k -> a) -> Set k -> Map k a -Map.fromSet (TxSkelRedeemer -> TxOutRef -> TxSkelRedeemer +Map.fromSet (TxSkelRedeemer -> TxOutRef -> TxSkelRedeemer forall a b. a -> b -> a -const TxSkelRedeemer +const TxSkelRedeemer TxSkelNoRedeemerForPK) ([TxOutRef] -> Set TxOutRef forall a. Ord a => [a] -> Set a -Set.fromList ([TxOutRef] -> Set TxOutRef) -> [TxOutRef] -> Set TxOutRef +Set.fromList ([TxOutRef] -> Set TxOutRef) -> [TxOutRef] -> Set TxOutRef forall a b. (a -> b) -> a -> b -$ ((TxOutRef, TxOut) -> TxOutRef) +$ ((TxOutRef, TxOut) -> TxOutRef) -> [(TxOutRef, TxOut)] -> [TxOutRef] forall a b. (a -> b) -> [a] -> [b] -map (TxOutRef, TxOut) -> TxOutRef +map (TxOutRef, TxOut) -> TxOutRef forall a b. (a, b) -> a -fst [(TxOutRef, TxOut)] -newInputs), +fst [(TxOutRef, TxOut)] +newInputs), [TxSkelOut] -left [TxSkelOut] -> [TxSkelOut] -> [TxSkelOut] +left [TxSkelOut] -> [TxSkelOut] -> [TxSkelOut] forall a. [a] -> [a] -> [a] -++ (TxSkelOut -bestTxOut TxSkelOut -> (TxSkelOut -> TxSkelOut) -> TxSkelOut +++ (TxSkelOut +bestTxOut TxSkelOut -> (TxSkelOut -> TxSkelOut) -> TxSkelOut forall a b. a -> (a -> b) -> b -& Lens' TxSkelOut Value +& Lens' TxSkelOut Value txSkelOutValueL Lens' TxSkelOut Value -> Value -> TxSkelOut -> TxSkelOut forall k (is :: IxList) s t a b. Is k A_Setter => Optic k is s t a b -> b -> s -> t -.~ Value -adjustedValue) TxSkelOut -> [TxSkelOut] -> [TxSkelOut] +.~ Value +adjustedValue) TxSkelOut -> [TxSkelOut] -> [TxSkelOut] forall a. a -> [a] -> [a] -: [TxSkelOut] -right +: [TxSkelOut] +right ) else Map TxOutRef TxSkelRedeemer -> [TxSkelOut] -> [(TxOutRef, TxOut)] -> Value -> Maybe (Map TxOutRef TxSkelRedeemer, [TxSkelOut]) -tryAdditionalInputs Map TxOutRef TxSkelRedeemer -ins [TxSkelOut] -outs [(TxOutRef, TxOut)] -availableUtxos Value -returnValue +tryAdditionalInputs Map TxOutRef TxSkelRedeemer +ins [TxSkelOut] +outs [(TxOutRef, TxOut)] +availableUtxos Value +returnValue BalanceOutputPolicy DontAdjustExistingOutput -> Map TxOutRef TxSkelRedeemer -> [TxSkelOut] -> Maybe (Map TxOutRef TxSkelRedeemer, [TxSkelOut]) -tryAdditionalOutput Map TxOutRef TxSkelRedeemer -ins [TxSkelOut] -outs +tryAdditionalOutput Map TxOutRef TxSkelRedeemer +ins [TxSkelOut] +outs Maybe Int -Nothing -> +Nothing -> -- There's no "best possible transaction output" in the sense described -- above. Map TxOutRef TxSkelRedeemer -> [TxSkelOut] -> Maybe (Map TxOutRef TxSkelRedeemer, [TxSkelOut]) -tryAdditionalOutput Map TxOutRef TxSkelRedeemer -ins [TxSkelOut] -outs +tryAdditionalOutput Map TxOutRef TxSkelRedeemer +ins [TxSkelOut] +outs TxSkel -> Maybe TxSkel forall (m :: * -> *) a. Monad m => a -> m a -return TxSkel -skel {txSkelIns :: Map TxOutRef TxSkelRedeemer +return TxSkel +skel {txSkelIns :: Map TxOutRef TxSkelRedeemer txSkelIns = Map TxOutRef TxSkelRedeemer -newIns, txSkelOuts :: [TxSkelOut] +newIns, txSkelOuts :: [TxSkelOut] txSkelOuts = [TxSkelOut] -newOuts} +newOuts} where - tryAdditionalOutput :: - Map PV2.TxOutRef TxSkelRedeemer -> + tryAdditionalOutput :: + Map PV2.TxOutRef TxSkelRedeemer -> [TxSkelOut] -> - Maybe (Map PV2.TxOutRef TxSkelRedeemer, [TxSkelOut]) - tryAdditionalOutput :: Map TxOutRef TxSkelRedeemer + Maybe (Map PV2.TxOutRef TxSkelRedeemer, [TxSkelOut]) + tryAdditionalOutput :: Map TxOutRef TxSkelRedeemer -> [TxSkelOut] -> Maybe (Map TxOutRef TxSkelRedeemer, [TxSkelOut]) -tryAdditionalOutput Map TxOutRef TxSkelRedeemer -ins [TxSkelOut] -outs = +tryAdditionalOutput Map TxOutRef TxSkelRedeemer +ins [TxSkelOut] +outs = if Value -> Ada -Pl.fromValue Value -returnValue Ada -> Ada -> Bool +Pl.fromValue Value +returnValue Ada -> Ada -> Bool forall a. Ord a => a -> a -> Bool ->= Ada -Ledger.minAdaTxOutEstimated -- TODO make thid dependen on the atual TxOut +>= Ada +Ledger.minAdaTxOutEstimated -- TODO make thid dependen on the atual TxOut then (Map TxOutRef TxSkelRedeemer, [TxSkelOut]) -> Maybe (Map TxOutRef TxSkelRedeemer, [TxSkelOut]) forall a. a -> Maybe a -Just -- (2) +Just -- (2) ( Map TxOutRef TxSkelRedeemer -ins Map TxOutRef TxSkelRedeemer +ins Map TxOutRef TxSkelRedeemer -> Map TxOutRef TxSkelRedeemer -> Map TxOutRef TxSkelRedeemer forall a. Semigroup a => a -> a -> a -<> (TxOutRef -> TxSkelRedeemer) +<> (TxOutRef -> TxSkelRedeemer) -> Set TxOutRef -> Map TxOutRef TxSkelRedeemer forall k a. (k -> a) -> Set k -> Map k a -Map.fromSet (TxSkelRedeemer -> TxOutRef -> TxSkelRedeemer +Map.fromSet (TxSkelRedeemer -> TxOutRef -> TxSkelRedeemer forall a b. a -> b -> a -const TxSkelRedeemer +const TxSkelRedeemer TxSkelNoRedeemerForPK) ([TxOutRef] -> Set TxOutRef forall a. Ord a => [a] -> Set a -Set.fromList ([TxOutRef] -> Set TxOutRef) -> [TxOutRef] -> Set TxOutRef +Set.fromList ([TxOutRef] -> Set TxOutRef) -> [TxOutRef] -> Set TxOutRef forall a b. (a -> b) -> a -> b -$ ((TxOutRef, TxOut) -> TxOutRef) +$ ((TxOutRef, TxOut) -> TxOutRef) -> [(TxOutRef, TxOut)] -> [TxOutRef] forall a b. (a -> b) -> [a] -> [b] -map (TxOutRef, TxOut) -> TxOutRef +map (TxOutRef, TxOut) -> TxOutRef forall a b. (a, b) -> a -fst [(TxOutRef, TxOut)] -newInputs), +fst [(TxOutRef, TxOut)] +newInputs), [TxSkelOut] -outs [TxSkelOut] -> [TxSkelOut] -> [TxSkelOut] +outs [TxSkelOut] -> [TxSkelOut] -> [TxSkelOut] forall a. [a] -> [a] -> [a] -++ [PubKeyHash -> Value -> TxSkelOut +++ [PubKeyHash -> Value -> TxSkelOut paysPK PubKeyHash -balancePK Value -returnValue] +balancePK Value +returnValue] ) else Map TxOutRef TxSkelRedeemer -> [TxSkelOut] -> [(TxOutRef, TxOut)] -> Value -> Maybe (Map TxOutRef TxSkelRedeemer, [TxSkelOut]) -tryAdditionalInputs Map TxOutRef TxSkelRedeemer -ins [TxSkelOut] -outs [(TxOutRef, TxOut)] -availableUtxos Value -returnValue +tryAdditionalInputs Map TxOutRef TxSkelRedeemer +ins [TxSkelOut] +outs [(TxOutRef, TxOut)] +availableUtxos Value +returnValue - tryAdditionalInputs :: - Map PV2.TxOutRef TxSkelRedeemer -> + tryAdditionalInputs :: + Map PV2.TxOutRef TxSkelRedeemer -> [TxSkelOut] -> - [(PV2.TxOutRef, PV2.TxOut)] -> - Pl.Value -> - Maybe (Map PV2.TxOutRef TxSkelRedeemer, [TxSkelOut]) - tryAdditionalInputs :: Map TxOutRef TxSkelRedeemer + [(PV2.TxOutRef, PV2.TxOut)] -> + Pl.Value -> + Maybe (Map PV2.TxOutRef TxSkelRedeemer, [TxSkelOut]) + tryAdditionalInputs :: Map TxOutRef TxSkelRedeemer -> [TxSkelOut] -> [(TxOutRef, TxOut)] -> Value -> Maybe (Map TxOutRef TxSkelRedeemer, [TxSkelOut]) -tryAdditionalInputs Map TxOutRef TxSkelRedeemer -ins [TxSkelOut] -outs [(TxOutRef, TxOut)] -available Value -return = +tryAdditionalInputs Map TxOutRef TxSkelRedeemer +ins [TxSkelOut] +outs [(TxOutRef, TxOut)] +available Value +return = case [(TxOutRef, TxOut)] -available of +available of [] -> Maybe (Map TxOutRef TxSkelRedeemer, [TxSkelOut]) forall a. Maybe a -Nothing - (TxOutRef -newTxOutRef, TxOut -newTxOut) : [(TxOutRef, TxOut)] -newAvailable -> - let additionalValue :: Value -additionalValue = TxOut -> Value +Nothing + (TxOutRef +newTxOutRef, TxOut +newTxOut) : [(TxOutRef, TxOut)] +newAvailable -> + let additionalValue :: Value +additionalValue = TxOut -> Value forall o. (IsAbstractOutput o, ToValue (ValueType o)) => o -> Value outputValue TxOut -newTxOut - newReturn :: Value -newReturn = Value -additionalValue Value -> Value -> Value +newTxOut + newReturn :: Value +newReturn = Value +additionalValue Value -> Value -> Value forall a. Semigroup a => a -> a -> a -<> Value -return - newIns :: Map TxOutRef TxSkelRedeemer -newIns = +<> Value +return + newIns :: Map TxOutRef TxSkelRedeemer +newIns = ( Map TxOutRef TxSkelRedeemer -ins +ins Map TxOutRef TxSkelRedeemer -> Map TxOutRef TxSkelRedeemer -> Map TxOutRef TxSkelRedeemer forall a. Semigroup a => a -> a -> a -<> (TxOutRef -> TxSkelRedeemer) +<> (TxOutRef -> TxSkelRedeemer) -> Set TxOutRef -> Map TxOutRef TxSkelRedeemer forall k a. (k -> a) -> Set k -> Map k a -Map.fromSet (TxSkelRedeemer -> TxOutRef -> TxSkelRedeemer +Map.fromSet (TxSkelRedeemer -> TxOutRef -> TxSkelRedeemer forall a b. a -> b -> a -const TxSkelRedeemer +const TxSkelRedeemer TxSkelNoRedeemerForPK) ([TxOutRef] -> Set TxOutRef forall a. Ord a => [a] -> Set a -Set.fromList ([TxOutRef] -> Set TxOutRef) -> [TxOutRef] -> Set TxOutRef +Set.fromList ([TxOutRef] -> Set TxOutRef) -> [TxOutRef] -> Set TxOutRef forall a b. (a -> b) -> a -> b -$ ((TxOutRef, TxOut) -> TxOutRef) +$ ((TxOutRef, TxOut) -> TxOutRef) -> [(TxOutRef, TxOut)] -> [TxOutRef] forall a b. (a -> b) -> [a] -> [b] -map (TxOutRef, TxOut) -> TxOutRef +map (TxOutRef, TxOut) -> TxOutRef forall a b. (a, b) -> a -fst [(TxOutRef, TxOut)] -newInputs) +fst [(TxOutRef, TxOut)] +newInputs) Map TxOutRef TxSkelRedeemer -> Map TxOutRef TxSkelRedeemer -> Map TxOutRef TxSkelRedeemer forall a. Semigroup a => a -> a -> a -<> TxOutRef -> TxSkelRedeemer -> Map TxOutRef TxSkelRedeemer +<> TxOutRef -> TxSkelRedeemer -> Map TxOutRef TxSkelRedeemer forall k a. k -> a -> Map k a -Map.singleton TxOutRef -newTxOutRef TxSkelRedeemer +Map.singleton TxOutRef +newTxOutRef TxSkelRedeemer TxSkelNoRedeemerForPK ) - newOuts :: [TxSkelOut] -newOuts = [TxSkelOut] -outs [TxSkelOut] -> [TxSkelOut] -> [TxSkelOut] + newOuts :: [TxSkelOut] +newOuts = [TxSkelOut] +outs [TxSkelOut] -> [TxSkelOut] -> [TxSkelOut] forall a. [a] -> [a] -> [a] -++ [PubKeyHash -> Value -> TxSkelOut +++ [PubKeyHash -> Value -> TxSkelOut paysPK PubKeyHash -balancePK Value -newReturn] +balancePK Value +newReturn] in if Value -newReturn Value -> Value -> Bool -`Pl.geq` Ada -> Value -Pl.toValue Ada -Ledger.minAdaTxOutEstimated -- TODO make thid dependen on the atual TxOut +newReturn Value -> Value -> Bool +`Pl.geq` Ada -> Value +Pl.toValue Ada +Ledger.minAdaTxOutEstimated -- TODO make thid dependen on the atual TxOut then (Map TxOutRef TxSkelRedeemer, [TxSkelOut]) -> Maybe (Map TxOutRef TxSkelRedeemer, [TxSkelOut]) forall a. a -> Maybe a -Just (Map TxOutRef TxSkelRedeemer -newIns, [TxSkelOut] -newOuts) -- (3) +Just (Map TxOutRef TxSkelRedeemer +newIns, [TxSkelOut] +newOuts) -- (3) else Map TxOutRef TxSkelRedeemer -> [TxSkelOut] -> [(TxOutRef, TxOut)] -> Value -> Maybe (Map TxOutRef TxSkelRedeemer, [TxSkelOut]) -tryAdditionalInputs Map TxOutRef TxSkelRedeemer -newIns [TxSkelOut] -newOuts [(TxOutRef, TxOut)] -newAvailable Value -newReturn +tryAdditionalInputs Map TxOutRef TxSkelRedeemer +newIns [TxSkelOut] +newOuts [(TxOutRef, TxOut)] +newAvailable Value +newReturn \ No newline at end of file diff --git a/src/Cooked.MockChain.BlockChain.html b/src/Cooked.MockChain.BlockChain.html index 0f27a8862..e7bd04e23 100644 --- a/src/Cooked.MockChain.BlockChain.html +++ b/src/Cooked.MockChain.BlockChain.html @@ -42,32 +42,32 @@ ) where -import qualified Cardano.Node.Emulator as Emulator -import Control.Arrow -import Control.Monad.Except -import Control.Monad.Reader -import Control.Monad.State -import Control.Monad.Trans.Control -import Control.Monad.Trans.Writer +import qualified Cardano.Node.Emulator as Emulator +import Control.Arrow +import Control.Monad.Except +import Control.Monad.Reader +import Control.Monad.State +import Control.Monad.Trans.Control +import Control.Monad.Trans.Writer import Cooked.MockChain.GenerateTx (GenerateTxError) import Cooked.Output import Cooked.Skeleton import Cooked.Wallet -import Data.Kind -import qualified Ledger.Index as Ledger -import qualified Ledger.Slot as Ledger -import qualified Ledger.Tx as Ledger -import qualified Ledger.Tx.CardanoAPI as Ledger -import ListT -import Optics.Core -import qualified Plutus.Script.Utils.Scripts as Pl -import qualified Plutus.V2.Ledger.Api as PV2 +import Data.Kind +import qualified Ledger.Index as Ledger +import qualified Ledger.Slot as Ledger +import qualified Ledger.Tx as Ledger +import qualified Ledger.Tx.CardanoAPI as Ledger +import ListT +import Optics.Core +import qualified Plutus.Script.Utils.Scripts as Pl +import qualified Plutus.V2.Ledger.Api as PV2 -- * BlockChain monad -- | The errors that can be produced by the 'MockChainT' monad data MockChainError where - MCEValidationError :: Ledger.ValidationErrorInPhase -> MockChainError + MCEValidationError :: Ledger.ValidationErrorInPhase -> MockChainError MCEUnbalanceable :: MCEUnbalanceableError -> TxSkel -> MockChainError -- | Thrown when the balancing wallet owns no output that is pure Ada and -- with no datum. @@ -77,27 +77,27 @@ MCECalcFee :: MockChainError -> MockChainError -- | Thrown when an output reference should be in the state of the mockchain, -- but isn't. - MCEUnknownOutRefError :: String -> PV2.TxOutRef -> MockChainError + MCEUnknownOutRefError :: String -> PV2.TxOutRef -> MockChainError -- | Same as 'MCEUnknownOutRefError' for validators. - MCEUnknownValidator :: String -> PV2.ValidatorHash -> MockChainError + MCEUnknownValidator :: String -> PV2.ValidatorHash -> MockChainError -- | Same as 'MCEUnknownOutRefError' for datums. - MCEUnknownDatum :: String -> PV2.DatumHash -> MockChainError + MCEUnknownDatum :: String -> PV2.DatumHash -> MockChainError -- | Used to provide 'MonadFail' instances. - FailWith :: String -> MockChainError - OtherMockChainError :: (Show err, Eq err) => err -> MockChainError + FailWith :: String -> MockChainError + OtherMockChainError :: (Show err, Eq err) => err -> MockChainError data MCEUnbalanceableError = -- | The balancing wallet misses some value to pay what is needed to balance -- the transaction. - MCEUnbalNotEnoughFunds Wallet PV2.Value + MCEUnbalNotEnoughFunds Wallet PV2.Value | -- | There is value to return to the balancing wallet but not enough to -- fullfill the min ada requirement and there is not enough in additional -- inputs to make it possible. MCEUnbalNotEnoughReturning - (PV2.Value, [PV2.TxOutRef]) -- What was spent - (PV2.Value, [PV2.TxOutRef]) -- What is left to spend - PV2.Value -- What cannot be given back - deriving (Int -> MCEUnbalanceableError -> ShowS + (PV2.Value, [PV2.TxOutRef]) -- What was spent + (PV2.Value, [PV2.TxOutRef]) -- What is left to spend + PV2.Value -- What cannot be given back + deriving (Int -> MCEUnbalanceableError -> ShowS [MCEUnbalanceableError] -> ShowS MCEUnbalanceableError -> String (Int -> MCEUnbalanceableError -> ShowS) @@ -112,50 +112,50 @@ $cshow :: MCEUnbalanceableError -> String showsPrec :: Int -> MCEUnbalanceableError -> ShowS $cshowsPrec :: Int -> MCEUnbalanceableError -> ShowS -Show) +Show) -deriving instance Show MockChainError +deriving instance Show MockChainError -instance Eq MockChainError where - == :: MockChainError -> MockChainError -> Bool -(==) = MockChainError -> MockChainError -> Bool +instance Eq MockChainError where + == :: MockChainError -> MockChainError -> Bool +(==) = MockChainError -> MockChainError -> Bool forall a. HasCallStack => a -undefined +undefined -- | Contains methods needed for balancing. -class (MonadFail m, MonadError MockChainError m) => MonadBlockChainBalancing m where +class (MonadFail m, MonadError MockChainError m) => MonadBlockChainBalancing m where -- | Returns the parameters of the chain. - getParams :: m Emulator.Params + getParams :: m Emulator.Params -- | Returns a list of all UTxOs at a certain address. - utxosAtLedger :: PV2.Address -> m [(PV2.TxOutRef, Ledger.TxOut)] + utxosAtLedger :: PV2.Address -> m [(PV2.TxOutRef, Ledger.TxOut)] -- | Returns the datum with the given hash or 'Nothing' if there is none - datumFromHash :: PV2.DatumHash -> m (Maybe PV2.Datum) + datumFromHash :: PV2.DatumHash -> m (Maybe PV2.Datum) -- | Returns the full validator corresponding to hash, if that validator owns -- something or if it is stored in the reference script field of some UTxO. - validatorFromHash :: PV2.ValidatorHash -> m (Maybe (Pl.Versioned PV2.Validator)) + validatorFromHash :: PV2.ValidatorHash -> m (Maybe (Pl.Versioned PV2.Validator)) -- | Returns an output given a reference to it - txOutByRefLedger :: PV2.TxOutRef -> m (Maybe Ledger.TxOut) + txOutByRefLedger :: PV2.TxOutRef -> m (Maybe Ledger.TxOut) -class MonadBlockChainBalancing m => MonadBlockChainWithoutValidation m where +class (MonadBlockChainBalancing m) => MonadBlockChainWithoutValidation m where -- | Returns a list of all currently known outputs. - allUtxosLedger :: m [(PV2.TxOutRef, Ledger.TxOut)] + allUtxosLedger :: m [(PV2.TxOutRef, Ledger.TxOut)] -- | Returns the current slot number - currentSlot :: m Ledger.Slot + currentSlot :: m Ledger.Slot -- | Waits until the current slot becomes greater or equal to the given slot, -- and returns the current slot after waiting. -- -- Note that it might not wait for anything if the current slot is large -- enough. - awaitSlot :: Ledger.Slot -> m Ledger.Slot + awaitSlot :: Ledger.Slot -> m Ledger.Slot -- | The main abstraction of the blockchain. -class MonadBlockChainWithoutValidation m => MonadBlockChain m where +class (MonadBlockChainWithoutValidation m) => MonadBlockChain m where -- | Generates, balances and validates a transaction from a skeleton. -- It returns the validated transaction and updates the state of the -- blockchain. In 'MockChainT', this means: @@ -164,147 +164,147 @@ -- - deletes the consumed datums from 'mcstDatums' -- - adds the produced datums to 'mcstDatums' -- - adds the validators on outputs to the 'mcstValidators'. - validateTxSkel :: TxSkel -> m Ledger.CardanoTx + validateTxSkel :: TxSkel -> m Ledger.CardanoTx -allUtxos :: MonadBlockChainWithoutValidation m => m [(PV2.TxOutRef, PV2.TxOut)] +allUtxos :: (MonadBlockChainWithoutValidation m) => m [(PV2.TxOutRef, PV2.TxOut)] allUtxos :: m [(TxOutRef, TxOut)] allUtxos = ((TxOutRef, TxOut) -> (TxOutRef, TxOut)) -> [(TxOutRef, TxOut)] -> [(TxOutRef, TxOut)] forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b -fmap ((TxOut -> TxOut) -> (TxOutRef, TxOut) -> (TxOutRef, TxOut) +fmap ((TxOut -> TxOut) -> (TxOutRef, TxOut) -> (TxOutRef, TxOut) forall (a :: * -> * -> *) b c d. Arrow a => a b c -> a (d, b) (d, c) -second TxOut -> TxOut +second TxOut -> TxOut txOutV2FromLedger) ([(TxOutRef, TxOut)] -> [(TxOutRef, TxOut)]) -> m [(TxOutRef, TxOut)] -> m [(TxOutRef, TxOut)] forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b -<$> m [(TxOutRef, TxOut)] +<$> m [(TxOutRef, TxOut)] forall (m :: * -> *). MonadBlockChainWithoutValidation m => m [(TxOutRef, TxOut)] allUtxosLedger -utxosAt :: MonadBlockChainBalancing m => PV2.Address -> m [(PV2.TxOutRef, PV2.TxOut)] +utxosAt :: (MonadBlockChainBalancing m) => PV2.Address -> m [(PV2.TxOutRef, PV2.TxOut)] utxosAt :: Address -> m [(TxOutRef, TxOut)] -utxosAt Address -address = ((TxOutRef, TxOut) -> (TxOutRef, TxOut)) +utxosAt Address +address = ((TxOutRef, TxOut) -> (TxOutRef, TxOut)) -> [(TxOutRef, TxOut)] -> [(TxOutRef, TxOut)] forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b -fmap ((TxOut -> TxOut) -> (TxOutRef, TxOut) -> (TxOutRef, TxOut) +fmap ((TxOut -> TxOut) -> (TxOutRef, TxOut) -> (TxOutRef, TxOut) forall (a :: * -> * -> *) b c d. Arrow a => a b c -> a (d, b) (d, c) -second TxOut -> TxOut +second TxOut -> TxOut txOutV2FromLedger) ([(TxOutRef, TxOut)] -> [(TxOutRef, TxOut)]) -> m [(TxOutRef, TxOut)] -> m [(TxOutRef, TxOut)] forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b -<$> Address -> m [(TxOutRef, TxOut)] +<$> Address -> m [(TxOutRef, TxOut)] forall (m :: * -> *). MonadBlockChainBalancing m => Address -> m [(TxOutRef, TxOut)] utxosAtLedger Address -address +address -txOutByRef :: MonadBlockChainBalancing m => PV2.TxOutRef -> m (Maybe PV2.TxOut) +txOutByRef :: (MonadBlockChainBalancing m) => PV2.TxOutRef -> m (Maybe PV2.TxOut) txOutByRef :: TxOutRef -> m (Maybe TxOut) -txOutByRef TxOutRef -oref = (TxOut -> TxOut) -> Maybe TxOut -> Maybe TxOut +txOutByRef TxOutRef +oref = (TxOut -> TxOut) -> Maybe TxOut -> Maybe TxOut forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b -fmap TxOut -> TxOut +fmap TxOut -> TxOut txOutV2FromLedger (Maybe TxOut -> Maybe TxOut) -> m (Maybe TxOut) -> m (Maybe TxOut) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b -<$> TxOutRef -> m (Maybe TxOut) +<$> TxOutRef -> m (Maybe TxOut) forall (m :: * -> *). MonadBlockChainBalancing m => TxOutRef -> m (Maybe TxOut) txOutByRefLedger TxOutRef -oref +oref -- | Retrieve the ordered list of outputs of the given "CardanoTx". -- -- This is useful when writing endpoints and/or traces to fetch utxos of -- interest right from the start and avoid querying the chain for them -- afterwards using 'allUtxos' or similar functions. -utxosFromCardanoTx :: Ledger.CardanoTx -> [(PV2.TxOutRef, PV2.TxOut)] +utxosFromCardanoTx :: Ledger.CardanoTx -> [(PV2.TxOutRef, PV2.TxOut)] utxosFromCardanoTx :: CardanoTx -> [(TxOutRef, TxOut)] utxosFromCardanoTx = ((TxOut, TxIn) -> (TxOutRef, TxOut)) -> [(TxOut, TxIn)] -> [(TxOutRef, TxOut)] forall a b. (a -> b) -> [a] -> [b] -map (\(TxOut -txOut, TxIn -txOutRef) -> (TxIn -> TxOutRef -Ledger.fromCardanoTxIn TxIn -txOutRef, TxOut -> TxOut +map (\(TxOut +txOut, TxIn +txOutRef) -> (TxIn -> TxOutRef +Ledger.fromCardanoTxIn TxIn +txOutRef, TxOut -> TxOut txOutV2FromLedger TxOut -txOut)) ([(TxOut, TxIn)] -> [(TxOutRef, TxOut)]) +txOut)) ([(TxOut, TxIn)] -> [(TxOutRef, TxOut)]) -> (CardanoTx -> [(TxOut, TxIn)]) -> CardanoTx -> [(TxOutRef, TxOut)] forall b c a. (b -> c) -> (a -> b) -> a -> c -. CardanoTx -> [(TxOut, TxIn)] -Ledger.getCardanoTxOutRefs +. CardanoTx -> [(TxOut, TxIn)] +Ledger.getCardanoTxOutRefs -txOutV2FromLedger :: Ledger.TxOut -> PV2.TxOut +txOutV2FromLedger :: Ledger.TxOut -> PV2.TxOut txOutV2FromLedger :: TxOut -> TxOut txOutV2FromLedger = TxOut CtxTx BabbageEra -> TxOut forall era. TxOut CtxTx era -> TxOut -Ledger.fromCardanoTxOutToPV2TxInfoTxOut (TxOut CtxTx BabbageEra -> TxOut) +Ledger.fromCardanoTxOutToPV2TxInfoTxOut (TxOut CtxTx BabbageEra -> TxOut) -> (TxOut -> TxOut CtxTx BabbageEra) -> TxOut -> TxOut forall b c a. (b -> c) -> (a -> b) -> a -> c -. TxOut -> TxOut CtxTx BabbageEra -Ledger.getTxOut +. TxOut -> TxOut CtxTx BabbageEra +Ledger.getTxOut -- | Try to resolve the datum on the output: If there's an inline datum, take -- that; if there's a datum hash, look the corresponding datum up (with -- 'datumFromHash'), returning @Nothing@ if it can't be found; if there's no -- datum or hash at all, return @Nothing@. -resolveDatum :: - ( IsAbstractOutput out, - ToOutputDatum (DatumType out), - MonadBlockChainBalancing m +resolveDatum :: + ( IsAbstractOutput out, + ToOutputDatum (DatumType out), + MonadBlockChainBalancing m ) => - out -> - m (Maybe (ConcreteOutput (OwnerType out) PV2.Datum (ValueType out) (ReferenceScriptType out))) + out -> + m (Maybe (ConcreteOutput (OwnerType out) PV2.Datum (ValueType out) (ReferenceScriptType out))) resolveDatum :: out -> m (Maybe (ConcreteOutput (OwnerType out) Datum (ValueType out) (ReferenceScriptType out))) -resolveDatum out -out = +resolveDatum out +out = case out -> OutputDatum forall o. (IsAbstractOutput o, ToOutputDatum (DatumType o)) => o -> OutputDatum outputOutputDatum out -out of - PV2.OutputDatumHash DatumHash -datumHash -> do - Maybe Datum -mDatum <- DatumHash -> m (Maybe Datum) +out of + PV2.OutputDatumHash DatumHash +datumHash -> do + Maybe Datum +mDatum <- DatumHash -> m (Maybe Datum) forall (m :: * -> *). MonadBlockChainBalancing m => DatumHash -> m (Maybe Datum) datumFromHash DatumHash -datumHash +datumHash case Maybe Datum -mDatum of +mDatum of Maybe Datum -Nothing -> Maybe +Nothing -> Maybe (ConcreteOutput (OwnerType out) Datum (ValueType out) (ReferenceScriptType out)) -> m (Maybe (ConcreteOutput (OwnerType out) Datum (ValueType out) (ReferenceScriptType out))) forall (m :: * -> *) a. Monad m => a -> m a -return Maybe +return Maybe (ConcreteOutput (OwnerType out) Datum (ValueType out) (ReferenceScriptType out)) forall a. Maybe a -Nothing - Just Datum -datum -> +Nothing + Just Datum +datum -> Maybe (ConcreteOutput (OwnerType out) Datum (ValueType out) (ReferenceScriptType out)) @@ -312,7 +312,7 @@ (ConcreteOutput (OwnerType out) Datum (ValueType out) (ReferenceScriptType out))) forall (m :: * -> *) a. Monad m => a -> m a -return (Maybe +return (Maybe (ConcreteOutput (OwnerType out) Datum (ValueType out) (ReferenceScriptType out)) -> m (Maybe @@ -329,13 +329,13 @@ (ConcreteOutput (OwnerType out) Datum (ValueType out) (ReferenceScriptType out))) forall b c a. (b -> c) -> (a -> b) -> a -> c -. ConcreteOutput +. ConcreteOutput (OwnerType out) Datum (ValueType out) (ReferenceScriptType out) -> Maybe (ConcreteOutput (OwnerType out) Datum (ValueType out) (ReferenceScriptType out)) forall a. a -> Maybe a -Just (ConcreteOutput +Just (ConcreteOutput (OwnerType out) Datum (ValueType out) (ReferenceScriptType out) -> m (Maybe (ConcreteOutput @@ -346,7 +346,7 @@ (ConcreteOutput (OwnerType out) Datum (ValueType out) (ReferenceScriptType out))) forall a b. (a -> b) -> a -> b -$ +$ OwnerType out -> Maybe StakingCredential -> ValueType out @@ -363,47 +363,47 @@ -> ConcreteOutput ownerType datumType valueType referenceScriptType ConcreteOutput (out -out out -> Optic' A_Lens NoIx out (OwnerType out) -> OwnerType out +out 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) +^. Optic' A_Lens NoIx out (OwnerType out) forall o. IsAbstractOutput o => Lens' o (OwnerType o) outputOwnerL) (out -out 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) +^. Optic' A_Lens NoIx out (Maybe StakingCredential) forall o. IsAbstractOutput o => Lens' o (Maybe StakingCredential) outputStakingCredentialL) (out -out out -> Optic' A_Lens NoIx out (ValueType out) -> ValueType out +out 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) +^. Optic' A_Lens NoIx out (ValueType out) forall o. IsAbstractOutput o => Lens' o (ValueType o) outputValueL) Datum -datum +datum (out -out 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)) +^. Optic' A_Lens NoIx out (Maybe (ReferenceScriptType out)) forall o. IsAbstractOutput o => Lens' o (Maybe (ReferenceScriptType o)) outputReferenceScriptL) - PV2.OutputDatum Datum -datum -> + PV2.OutputDatum Datum +datum -> Maybe (ConcreteOutput (OwnerType out) Datum (ValueType out) (ReferenceScriptType out)) @@ -411,7 +411,7 @@ (ConcreteOutput (OwnerType out) Datum (ValueType out) (ReferenceScriptType out))) forall (m :: * -> *) a. Monad m => a -> m a -return (Maybe +return (Maybe (ConcreteOutput (OwnerType out) Datum (ValueType out) (ReferenceScriptType out)) -> m (Maybe @@ -428,13 +428,13 @@ (ConcreteOutput (OwnerType out) Datum (ValueType out) (ReferenceScriptType out))) forall b c a. (b -> c) -> (a -> b) -> a -> c -. ConcreteOutput +. ConcreteOutput (OwnerType out) Datum (ValueType out) (ReferenceScriptType out) -> Maybe (ConcreteOutput (OwnerType out) Datum (ValueType out) (ReferenceScriptType out)) forall a. a -> Maybe a -Just (ConcreteOutput +Just (ConcreteOutput (OwnerType out) Datum (ValueType out) (ReferenceScriptType out) -> m (Maybe (ConcreteOutput @@ -445,7 +445,7 @@ (ConcreteOutput (OwnerType out) Datum (ValueType out) (ReferenceScriptType out))) forall a b. (a -> b) -> a -> b -$ +$ OwnerType out -> Maybe StakingCredential -> ValueType out @@ -462,79 +462,79 @@ -> ConcreteOutput ownerType datumType valueType referenceScriptType ConcreteOutput (out -out out -> Optic' A_Lens NoIx out (OwnerType out) -> OwnerType out +out 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) +^. Optic' A_Lens NoIx out (OwnerType out) forall o. IsAbstractOutput o => Lens' o (OwnerType o) outputOwnerL) (out -out 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) +^. Optic' A_Lens NoIx out (Maybe StakingCredential) forall o. IsAbstractOutput o => Lens' o (Maybe StakingCredential) outputStakingCredentialL) (out -out out -> Optic' A_Lens NoIx out (ValueType out) -> ValueType out +out 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) +^. Optic' A_Lens NoIx out (ValueType out) forall o. IsAbstractOutput o => Lens' o (ValueType o) outputValueL) Datum -datum +datum (out -out 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)) +^. Optic' A_Lens NoIx out (Maybe (ReferenceScriptType out)) forall o. IsAbstractOutput o => Lens' o (Maybe (ReferenceScriptType o)) outputReferenceScriptL) OutputDatum -PV2.NoOutputDatum -> Maybe +PV2.NoOutputDatum -> Maybe (ConcreteOutput (OwnerType out) Datum (ValueType out) (ReferenceScriptType out)) -> m (Maybe (ConcreteOutput (OwnerType out) Datum (ValueType out) (ReferenceScriptType out))) forall (m :: * -> *) a. Monad m => a -> m a -return Maybe +return Maybe (ConcreteOutput (OwnerType out) Datum (ValueType out) (ReferenceScriptType out)) forall a. Maybe a -Nothing +Nothing -- | Like 'resolveDatum', but also tries to use 'fromBuiltinData' to extract a -- datum of the suitable type. -resolveTypedDatum :: - ( IsAbstractOutput out, - ToOutputDatum (DatumType out), - MonadBlockChainBalancing m, - PV2.FromData a +resolveTypedDatum :: + ( IsAbstractOutput out, + ToOutputDatum (DatumType out), + MonadBlockChainBalancing m, + PV2.FromData a ) => - out -> - m (Maybe (ConcreteOutput (OwnerType out) a (ValueType out) (ReferenceScriptType out))) + out -> + m (Maybe (ConcreteOutput (OwnerType out) a (ValueType out) (ReferenceScriptType out))) resolveTypedDatum :: out -> m (Maybe (ConcreteOutput (OwnerType out) a (ValueType out) (ReferenceScriptType out))) -resolveTypedDatum out -out = do - Maybe +resolveTypedDatum out +out = do + Maybe (ConcreteOutput (OwnerType out) Datum (ValueType out) (ReferenceScriptType out)) -mOut <- out +mOut <- out -> m (Maybe (ConcreteOutput (OwnerType out) Datum (ValueType out) (ReferenceScriptType out))) @@ -546,29 +546,29 @@ (ConcreteOutput (OwnerType out) Datum (ValueType out) (ReferenceScriptType out))) resolveDatum out -out +out case Maybe (ConcreteOutput (OwnerType out) Datum (ValueType out) (ReferenceScriptType out)) -mOut of +mOut of Maybe (ConcreteOutput (OwnerType out) Datum (ValueType out) (ReferenceScriptType out)) -Nothing -> Maybe +Nothing -> Maybe (ConcreteOutput (OwnerType out) a (ValueType out) (ReferenceScriptType out)) -> m (Maybe (ConcreteOutput (OwnerType out) a (ValueType out) (ReferenceScriptType out))) forall (m :: * -> *) a. Monad m => a -> m a -return Maybe +return Maybe (ConcreteOutput (OwnerType out) a (ValueType out) (ReferenceScriptType out)) forall a. Maybe a -Nothing - Just ConcreteOutput +Nothing + Just ConcreteOutput (OwnerType out) Datum (ValueType out) (ReferenceScriptType out) -out' -> +out' -> Maybe (ConcreteOutput (OwnerType out) a (ValueType out) (ReferenceScriptType out)) @@ -576,7 +576,7 @@ (ConcreteOutput (OwnerType out) a (ValueType out) (ReferenceScriptType out))) forall (m :: * -> *) a. Monad m => a -> m a -return (Maybe +return (Maybe (ConcreteOutput (OwnerType out) a (ValueType out) (ReferenceScriptType out)) -> m (Maybe @@ -589,7 +589,7 @@ (ConcreteOutput (OwnerType out) a (ValueType out) (ReferenceScriptType out))) forall a b. (a -> b) -> a -> b -$ +$ OwnerType out -> Maybe StakingCredential -> ValueType out @@ -621,11 +621,11 @@ -> ConcreteOutput (OwnerType out) a (ValueType out) (ReferenceScriptType out)) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b -<$> OwnerType out -> Maybe (OwnerType out) +<$> OwnerType out -> Maybe (OwnerType out) forall a. a -> Maybe a -Just (ConcreteOutput +Just (ConcreteOutput (OwnerType out) Datum (ValueType out) (ReferenceScriptType out) -out' ConcreteOutput +out' ConcreteOutput (OwnerType out) Datum (ValueType out) (ReferenceScriptType out) -> Optic' A_Lens @@ -637,7 +637,7 @@ forall k s (is :: IxList) a. Is k A_Getter => s -> Optic' k is s a -> a -^. Optic' +^. Optic' A_Lens NoIx (ConcreteOutput @@ -660,11 +660,11 @@ -> ConcreteOutput (OwnerType out) a (ValueType out) (ReferenceScriptType out)) forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b -<*> Maybe StakingCredential -> Maybe (Maybe StakingCredential) +<*> Maybe StakingCredential -> Maybe (Maybe StakingCredential) forall a. a -> Maybe a -Just (ConcreteOutput +Just (ConcreteOutput (OwnerType out) Datum (ValueType out) (ReferenceScriptType out) -out' ConcreteOutput +out' ConcreteOutput (OwnerType out) Datum (ValueType out) (ReferenceScriptType out) -> Optic' A_Lens @@ -676,7 +676,7 @@ forall k s (is :: IxList) a. Is k A_Getter => s -> Optic' k is s a -> a -^. Optic' +^. Optic' A_Lens NoIx (ConcreteOutput @@ -697,11 +697,11 @@ -> ConcreteOutput (OwnerType out) a (ValueType out) (ReferenceScriptType out)) forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b -<*> ValueType out -> Maybe (ValueType out) +<*> ValueType out -> Maybe (ValueType out) forall a. a -> Maybe a -Just (ConcreteOutput +Just (ConcreteOutput (OwnerType out) Datum (ValueType out) (ReferenceScriptType out) -out' ConcreteOutput +out' ConcreteOutput (OwnerType out) Datum (ValueType out) (ReferenceScriptType out) -> Optic' A_Lens @@ -713,7 +713,7 @@ forall k s (is :: IxList) a. Is k A_Getter => s -> Optic' k is s a -> a -^. Optic' +^. Optic' A_Lens NoIx (ConcreteOutput @@ -732,10 +732,10 @@ -> ConcreteOutput (OwnerType out) a (ValueType out) (ReferenceScriptType out)) forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b -<*> (let PV2.Datum BuiltinData -datum = ConcreteOutput +<*> (let PV2.Datum BuiltinData +datum = ConcreteOutput (OwnerType out) Datum (ValueType out) (ReferenceScriptType out) -out' ConcreteOutput +out' ConcreteOutput (OwnerType out) Datum (ValueType out) (ReferenceScriptType out) -> Optic' A_Lens @@ -747,7 +747,7 @@ forall k s (is :: IxList) a. Is k A_Getter => s -> Optic' k is s a -> a -^. Optic' +^. Optic' A_Lens NoIx (ConcreteOutput @@ -756,8 +756,8 @@ forall o. IsAbstractOutput o => Lens' o (DatumType o) outputDatumL in BuiltinData -> Maybe a forall a. FromData a => BuiltinData -> Maybe a -PV2.fromBuiltinData BuiltinData -datum) +PV2.fromBuiltinData BuiltinData +datum) Maybe (Maybe (ReferenceScriptType out) -> ConcreteOutput @@ -767,12 +767,12 @@ (ConcreteOutput (OwnerType out) a (ValueType out) (ReferenceScriptType out)) forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b -<*> Maybe (ReferenceScriptType out) +<*> Maybe (ReferenceScriptType out) -> Maybe (Maybe (ReferenceScriptType out)) forall a. a -> Maybe a -Just (ConcreteOutput +Just (ConcreteOutput (OwnerType out) Datum (ValueType out) (ReferenceScriptType out) -out' ConcreteOutput +out' ConcreteOutput (OwnerType out) Datum (ValueType out) (ReferenceScriptType out) -> Optic' A_Lens @@ -784,7 +784,7 @@ forall k s (is :: IxList) a. Is k A_Getter => s -> Optic' k is s a -> a -^. Optic' +^. Optic' A_Lens NoIx (ConcreteOutput @@ -798,13 +798,13 @@ -- | Try to resolve the validator that owns an output: If the output is owned by -- a public key, or if the validator's hash is not known (i.e. if -- 'validatorFromHash' returns @Nothing@) return @Nothing@. -resolveValidator :: - ( IsAbstractOutput out, - ToCredential (OwnerType out), - MonadBlockChainBalancing m +resolveValidator :: + ( IsAbstractOutput out, + ToCredential (OwnerType out), + MonadBlockChainBalancing m ) => - out -> - m (Maybe (ConcreteOutput (Pl.Versioned PV2.Validator) (DatumType out) (ValueType out) (ReferenceScriptType out))) + out -> + m (Maybe (ConcreteOutput (Pl.Versioned PV2.Validator) (DatumType out) (ValueType out) (ReferenceScriptType out))) resolveValidator :: out -> m (Maybe (ConcreteOutput @@ -812,19 +812,19 @@ (DatumType out) (ValueType out) (ReferenceScriptType out))) -resolveValidator out -out = +resolveValidator out +out = case OwnerType out -> Credential forall a. ToCredential a => a -> Credential toCredential (out -out out -> Optic' A_Lens NoIx out (OwnerType out) -> OwnerType out +out 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) +^. Optic' A_Lens NoIx out (OwnerType out) forall o. IsAbstractOutput o => Lens' o (OwnerType o) outputOwnerL) of - PV2.PubKeyCredential PubKeyHash + PV2.PubKeyCredential PubKeyHash _ -> Maybe (ConcreteOutput (Versioned Validator) @@ -838,27 +838,27 @@ (ValueType out) (ReferenceScriptType out))) forall (m :: * -> *) a. Monad m => a -> m a -return Maybe +return Maybe (ConcreteOutput (Versioned Validator) (DatumType out) (ValueType out) (ReferenceScriptType out)) forall a. Maybe a -Nothing - PV2.ScriptCredential ValidatorHash -valHash -> do - Maybe (Versioned Validator) -mVal <- ValidatorHash -> m (Maybe (Versioned Validator)) +Nothing + PV2.ScriptCredential ValidatorHash +valHash -> do + Maybe (Versioned Validator) +mVal <- ValidatorHash -> m (Maybe (Versioned Validator)) forall (m :: * -> *). MonadBlockChainBalancing m => ValidatorHash -> m (Maybe (Versioned Validator)) validatorFromHash ValidatorHash -valHash +valHash case Maybe (Versioned Validator) -mVal of +mVal of Maybe (Versioned Validator) -Nothing -> Maybe +Nothing -> Maybe (ConcreteOutput (Versioned Validator) (DatumType out) @@ -871,16 +871,16 @@ (ValueType out) (ReferenceScriptType out))) forall (m :: * -> *) a. Monad m => a -> m a -return Maybe +return Maybe (ConcreteOutput (Versioned Validator) (DatumType out) (ValueType out) (ReferenceScriptType out)) forall a. Maybe a -Nothing - Just Versioned Validator -val -> +Nothing + Just Versioned Validator +val -> Maybe (ConcreteOutput (Versioned Validator) @@ -894,7 +894,7 @@ (ValueType out) (ReferenceScriptType out))) forall (m :: * -> *) a. Monad m => a -> m a -return (Maybe +return (Maybe (ConcreteOutput (Versioned Validator) (DatumType out) @@ -929,7 +929,7 @@ (ValueType out) (ReferenceScriptType out))) forall b c a. (b -> c) -> (a -> b) -> a -> c -. ConcreteOutput +. ConcreteOutput (Versioned Validator) (DatumType out) (ValueType out) @@ -941,7 +941,7 @@ (ValueType out) (ReferenceScriptType out)) forall a. a -> Maybe a -Just (ConcreteOutput +Just (ConcreteOutput (Versioned Validator) (DatumType out) (ValueType out) @@ -964,7 +964,7 @@ (ValueType out) (ReferenceScriptType out))) forall a b. (a -> b) -> a -> b -$ +$ Versioned Validator -> Maybe StakingCredential -> ValueType out @@ -984,41 +984,41 @@ -> ConcreteOutput ownerType datumType valueType referenceScriptType ConcreteOutput Versioned Validator -val +val (out -out 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) +^. Optic' A_Lens NoIx out (Maybe StakingCredential) forall o. IsAbstractOutput o => Lens' o (Maybe StakingCredential) outputStakingCredentialL) (out -out out -> Optic' A_Lens NoIx out (ValueType out) -> ValueType out +out 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) +^. Optic' A_Lens NoIx out (ValueType out) forall o. IsAbstractOutput o => Lens' o (ValueType o) outputValueL) (out -out out -> Optic' A_Lens NoIx out (DatumType out) -> DatumType out +out 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) +^. Optic' A_Lens NoIx out (DatumType out) forall o. IsAbstractOutput o => Lens' o (DatumType o) outputDatumL) (out -out 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)) +^. Optic' A_Lens NoIx out (Maybe (ReferenceScriptType out)) forall o. IsAbstractOutput o => Lens' o (Maybe (ReferenceScriptType o)) @@ -1027,13 +1027,13 @@ -- | Try to resolve the reference script on an output: If the output has no -- reference script, or if the reference script's hash is not known (i.e. if -- 'validatorFromHash' returns @Nothing@), this function will return @Nothing@. -resolveReferenceScript :: - ( IsAbstractOutput out, - ToScriptHash (ReferenceScriptType out), - MonadBlockChainBalancing m +resolveReferenceScript :: + ( IsAbstractOutput out, + ToScriptHash (ReferenceScriptType out), + MonadBlockChainBalancing m ) => - out -> - m (Maybe (ConcreteOutput (OwnerType out) (DatumType out) (ValueType out) (Pl.Versioned PV2.Validator))) + out -> + m (Maybe (ConcreteOutput (OwnerType out) (DatumType out) (ValueType out) (Pl.Versioned PV2.Validator))) resolveReferenceScript :: out -> m (Maybe (ConcreteOutput @@ -1041,16 +1041,16 @@ (DatumType out) (ValueType out) (Versioned Validator))) -resolveReferenceScript out -out = +resolveReferenceScript out +out = case out -> Maybe ScriptHash forall o. (IsAbstractOutput o, ToScriptHash (ReferenceScriptType o)) => o -> Maybe ScriptHash outputReferenceScriptHash out -out of +out of Maybe ScriptHash -Nothing -> Maybe +Nothing -> Maybe (ConcreteOutput (OwnerType out) (DatumType out) @@ -1063,28 +1063,28 @@ (ValueType out) (Versioned Validator))) forall (m :: * -> *) a. Monad m => a -> m a -return Maybe +return Maybe (ConcreteOutput (OwnerType out) (DatumType out) (ValueType out) (Versioned Validator)) forall a. Maybe a -Nothing - Just (PV2.ScriptHash BuiltinByteString -hash) -> do - Maybe (Versioned Validator) -mVal <- ValidatorHash -> m (Maybe (Versioned Validator)) +Nothing + Just (PV2.ScriptHash BuiltinByteString +hash) -> do + Maybe (Versioned Validator) +mVal <- ValidatorHash -> m (Maybe (Versioned Validator)) forall (m :: * -> *). MonadBlockChainBalancing m => ValidatorHash -> m (Maybe (Versioned Validator)) validatorFromHash (BuiltinByteString -> ValidatorHash -PV2.ValidatorHash BuiltinByteString -hash) +PV2.ValidatorHash BuiltinByteString +hash) case Maybe (Versioned Validator) -mVal of +mVal of Maybe (Versioned Validator) -Nothing -> Maybe +Nothing -> Maybe (ConcreteOutput (OwnerType out) (DatumType out) @@ -1097,16 +1097,16 @@ (ValueType out) (Versioned Validator))) forall (m :: * -> *) a. Monad m => a -> m a -return Maybe +return Maybe (ConcreteOutput (OwnerType out) (DatumType out) (ValueType out) (Versioned Validator)) forall a. Maybe a -Nothing - Just Versioned Validator -val -> +Nothing + Just Versioned Validator +val -> Maybe (ConcreteOutput (OwnerType out) @@ -1120,7 +1120,7 @@ (ValueType out) (Versioned Validator))) forall (m :: * -> *) a. Monad m => a -> m a -return (Maybe +return (Maybe (ConcreteOutput (OwnerType out) (DatumType out) @@ -1155,7 +1155,7 @@ (ValueType out) (Versioned Validator))) forall b c a. (b -> c) -> (a -> b) -> a -> c -. ConcreteOutput +. ConcreteOutput (OwnerType out) (DatumType out) (ValueType out) @@ -1167,7 +1167,7 @@ (ValueType out) (Versioned Validator)) forall a. a -> Maybe a -Just (ConcreteOutput +Just (ConcreteOutput (OwnerType out) (DatumType out) (ValueType out) @@ -1190,7 +1190,7 @@ (ValueType out) (Versioned Validator))) forall a b. (a -> b) -> a -> b -$ +$ OwnerType out -> Maybe StakingCredential -> ValueType out @@ -1210,206 +1210,206 @@ -> ConcreteOutput ownerType datumType valueType referenceScriptType ConcreteOutput (out -out out -> Optic' A_Lens NoIx out (OwnerType out) -> OwnerType out +out 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) +^. Optic' A_Lens NoIx out (OwnerType out) forall o. IsAbstractOutput o => Lens' o (OwnerType o) outputOwnerL) (out -out 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) +^. Optic' A_Lens NoIx out (Maybe StakingCredential) forall o. IsAbstractOutput o => Lens' o (Maybe StakingCredential) outputStakingCredentialL) (out -out out -> Optic' A_Lens NoIx out (ValueType out) -> ValueType out +out 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) +^. Optic' A_Lens NoIx out (ValueType out) forall o. IsAbstractOutput o => Lens' o (ValueType o) outputValueL) (out -out out -> Optic' A_Lens NoIx out (DatumType out) -> DatumType out +out 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) +^. Optic' A_Lens NoIx out (DatumType out) forall o. IsAbstractOutput o => Lens' o (DatumType o) outputDatumL) (Versioned Validator -> Maybe (Versioned Validator) forall a. a -> Maybe a -Just Versioned Validator -val) +Just Versioned Validator +val) -outputDatumFromTxOutRef :: MonadBlockChainWithoutValidation m => PV2.TxOutRef -> m (Maybe PV2.OutputDatum) +outputDatumFromTxOutRef :: (MonadBlockChainWithoutValidation m) => PV2.TxOutRef -> m (Maybe PV2.OutputDatum) outputDatumFromTxOutRef :: TxOutRef -> m (Maybe OutputDatum) -outputDatumFromTxOutRef TxOutRef -oref = do - Maybe TxOut -mOut <- TxOutRef -> m (Maybe TxOut) +outputDatumFromTxOutRef TxOutRef +oref = do + Maybe TxOut +mOut <- TxOutRef -> m (Maybe TxOut) forall (m :: * -> *). MonadBlockChainBalancing m => TxOutRef -> m (Maybe TxOut) txOutByRef TxOutRef -oref +oref case Maybe TxOut -mOut of +mOut of Maybe TxOut -Nothing -> Maybe OutputDatum -> m (Maybe OutputDatum) +Nothing -> Maybe OutputDatum -> m (Maybe OutputDatum) forall (m :: * -> *) a. Monad m => a -> m a -return Maybe OutputDatum +return Maybe OutputDatum forall a. Maybe a -Nothing - Just TxOut -out -> Maybe OutputDatum -> m (Maybe OutputDatum) +Nothing + Just TxOut +out -> Maybe OutputDatum -> m (Maybe OutputDatum) forall (m :: * -> *) a. Monad m => a -> m a -return (Maybe OutputDatum -> m (Maybe OutputDatum)) +return (Maybe OutputDatum -> m (Maybe OutputDatum)) -> (OutputDatum -> Maybe OutputDatum) -> OutputDatum -> m (Maybe OutputDatum) forall b c a. (b -> c) -> (a -> b) -> a -> c -. OutputDatum -> Maybe OutputDatum +. OutputDatum -> Maybe OutputDatum forall a. a -> Maybe a -Just (OutputDatum -> m (Maybe OutputDatum)) +Just (OutputDatum -> m (Maybe OutputDatum)) -> OutputDatum -> m (Maybe OutputDatum) forall a b. (a -> b) -> a -> b -$ TxOut -> OutputDatum +$ TxOut -> OutputDatum forall o. (IsAbstractOutput o, ToOutputDatum (DatumType o)) => o -> OutputDatum outputOutputDatum TxOut -out +out -datumFromTxOutRef :: MonadBlockChainWithoutValidation m => PV2.TxOutRef -> m (Maybe PV2.Datum) +datumFromTxOutRef :: (MonadBlockChainWithoutValidation m) => PV2.TxOutRef -> m (Maybe PV2.Datum) datumFromTxOutRef :: TxOutRef -> m (Maybe Datum) -datumFromTxOutRef TxOutRef -oref = do - Maybe OutputDatum -mOutputDatum <- TxOutRef -> m (Maybe OutputDatum) +datumFromTxOutRef TxOutRef +oref = do + Maybe OutputDatum +mOutputDatum <- TxOutRef -> m (Maybe OutputDatum) forall (m :: * -> *). MonadBlockChainWithoutValidation m => TxOutRef -> m (Maybe OutputDatum) outputDatumFromTxOutRef TxOutRef -oref +oref case Maybe OutputDatum -mOutputDatum of +mOutputDatum of Maybe OutputDatum -Nothing -> Maybe Datum -> m (Maybe Datum) +Nothing -> Maybe Datum -> m (Maybe Datum) forall (m :: * -> *) a. Monad m => a -> m a -return Maybe Datum +return Maybe Datum forall a. Maybe a -Nothing - Just OutputDatum -PV2.NoOutputDatum -> Maybe Datum -> m (Maybe Datum) +Nothing + Just OutputDatum +PV2.NoOutputDatum -> Maybe Datum -> m (Maybe Datum) forall (m :: * -> *) a. Monad m => a -> m a -return Maybe Datum +return Maybe Datum forall a. Maybe a -Nothing - Just (PV2.OutputDatum Datum -datum) -> Maybe Datum -> m (Maybe Datum) +Nothing + Just (PV2.OutputDatum Datum +datum) -> Maybe Datum -> m (Maybe Datum) forall (m :: * -> *) a. Monad m => a -> m a -return (Maybe Datum -> m (Maybe Datum)) -> Maybe Datum -> m (Maybe Datum) +return (Maybe Datum -> m (Maybe Datum)) -> Maybe Datum -> m (Maybe Datum) forall a b. (a -> b) -> a -> b -$ Datum -> Maybe Datum +$ Datum -> Maybe Datum forall a. a -> Maybe a -Just Datum -datum - Just (PV2.OutputDatumHash DatumHash -datumHash) -> do - Maybe Datum -mDatum <- DatumHash -> m (Maybe Datum) +Just Datum +datum + Just (PV2.OutputDatumHash DatumHash +datumHash) -> do + Maybe Datum +mDatum <- DatumHash -> m (Maybe Datum) forall (m :: * -> *). MonadBlockChainBalancing m => DatumHash -> m (Maybe Datum) datumFromHash DatumHash -datumHash +datumHash case Maybe Datum -mDatum of - Just Datum -datum -> Maybe Datum -> m (Maybe Datum) +mDatum of + Just Datum +datum -> Maybe Datum -> m (Maybe Datum) forall (m :: * -> *) a. Monad m => a -> m a -return (Maybe Datum -> m (Maybe Datum)) -> Maybe Datum -> m (Maybe Datum) +return (Maybe Datum -> m (Maybe Datum)) -> Maybe Datum -> m (Maybe Datum) forall a b. (a -> b) -> a -> b -$ Datum -> Maybe Datum +$ Datum -> Maybe Datum forall a. a -> Maybe a -Just Datum -datum +Just Datum +datum Maybe Datum -Nothing -> Maybe Datum -> m (Maybe Datum) +Nothing -> Maybe Datum -> m (Maybe Datum) forall (m :: * -> *) a. Monad m => a -> m a -return Maybe Datum +return Maybe Datum forall a. Maybe a -Nothing +Nothing -typedDatumFromTxOutRef :: (PV2.FromData a, MonadBlockChainWithoutValidation m) => PV2.TxOutRef -> m (Maybe a) +typedDatumFromTxOutRef :: (PV2.FromData a, MonadBlockChainWithoutValidation m) => PV2.TxOutRef -> m (Maybe a) typedDatumFromTxOutRef :: TxOutRef -> m (Maybe a) -typedDatumFromTxOutRef TxOutRef -oref = do - Maybe Datum -mDatum <- TxOutRef -> m (Maybe Datum) +typedDatumFromTxOutRef TxOutRef +oref = do + Maybe Datum +mDatum <- TxOutRef -> m (Maybe Datum) forall (m :: * -> *). MonadBlockChainWithoutValidation m => TxOutRef -> m (Maybe Datum) datumFromTxOutRef TxOutRef -oref +oref case Maybe Datum -mDatum of +mDatum of Maybe Datum -Nothing -> Maybe a -> m (Maybe a) +Nothing -> Maybe a -> m (Maybe a) forall (m :: * -> *) a. Monad m => a -> m a -return Maybe a +return Maybe a forall a. Maybe a -Nothing - Just (PV2.Datum BuiltinData -datum) -> Maybe a -> m (Maybe a) +Nothing + Just (PV2.Datum BuiltinData +datum) -> Maybe a -> m (Maybe a) forall (m :: * -> *) a. Monad m => a -> m a -return (Maybe a -> m (Maybe a)) -> Maybe a -> m (Maybe a) +return (Maybe a -> m (Maybe a)) -> Maybe a -> m (Maybe a) forall a b. (a -> b) -> a -> b -$ BuiltinData -> Maybe a +$ BuiltinData -> Maybe a forall a. FromData a => BuiltinData -> Maybe a -PV2.fromBuiltinData BuiltinData -datum +PV2.fromBuiltinData BuiltinData +datum -valueFromTxOutRef :: MonadBlockChainWithoutValidation m => PV2.TxOutRef -> m (Maybe PV2.Value) +valueFromTxOutRef :: (MonadBlockChainWithoutValidation m) => PV2.TxOutRef -> m (Maybe PV2.Value) valueFromTxOutRef :: TxOutRef -> m (Maybe Value) -valueFromTxOutRef TxOutRef -oref = do - Maybe TxOut -mOut <- TxOutRef -> m (Maybe TxOut) +valueFromTxOutRef TxOutRef +oref = do + Maybe TxOut +mOut <- TxOutRef -> m (Maybe TxOut) forall (m :: * -> *). MonadBlockChainBalancing m => TxOutRef -> m (Maybe TxOut) txOutByRef TxOutRef -oref +oref case Maybe TxOut -mOut of +mOut of Maybe TxOut -Nothing -> Maybe Value -> m (Maybe Value) +Nothing -> Maybe Value -> m (Maybe Value) forall (m :: * -> *) a. Monad m => a -> m a -return Maybe Value +return Maybe Value forall a. Maybe a -Nothing - Just TxOut -out -> Maybe Value -> m (Maybe Value) +Nothing + Just TxOut +out -> Maybe Value -> m (Maybe Value) forall (m :: * -> *) a. Monad m => a -> m a -return (Maybe Value -> m (Maybe Value)) +return (Maybe Value -> m (Maybe Value)) -> (Value -> Maybe Value) -> Value -> m (Maybe Value) forall b c a. (b -> c) -> (a -> b) -> a -> c -. Value -> Maybe Value +. Value -> Maybe Value forall a. a -> Maybe a -Just (Value -> m (Maybe Value)) -> Value -> m (Maybe Value) +Just (Value -> m (Maybe Value)) -> Value -> m (Maybe Value) forall a b. (a -> b) -> a -> b -$ TxOut -> Value +$ TxOut -> Value forall o. (IsAbstractOutput o, ToValue (ValueType o)) => o -> Value outputValue TxOut -out +out -- ** Slot and Time Management @@ -1423,38 +1423,38 @@ -- the docs on 'autoSlotIncrease' to be able to simulate sending transactions in parallel. -- | Moves n slots fowards -waitNSlots :: (MonadBlockChainWithoutValidation m) => Integer -> m Ledger.Slot +waitNSlots :: (MonadBlockChainWithoutValidation m) => Integer -> m Ledger.Slot waitNSlots :: Integer -> m Slot -waitNSlots Integer -n = +waitNSlots Integer +n = if Integer -n Integer -> Integer -> Bool +n Integer -> Integer -> Bool forall a. Ord a => a -> a -> Bool -< Integer +< Integer 0 then String -> m Slot forall (m :: * -> *) a. MonadFail m => String -> m a -fail String +fail String "waitNSlots: negative argument" else m Slot forall (m :: * -> *). MonadBlockChainWithoutValidation m => m Slot currentSlot m Slot -> (Slot -> m Slot) -> m Slot forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b ->>= Slot -> m Slot +>>= Slot -> m Slot forall (m :: * -> *). MonadBlockChainWithoutValidation m => Slot -> m Slot awaitSlot (Slot -> m Slot) -> (Slot -> Slot) -> Slot -> m Slot forall b c a. (b -> c) -> (a -> b) -> a -> c -. (Slot -> Slot -> Slot +. (Slot -> Slot -> Slot forall a. Num a => a -> a -> a -+ Integer -> Slot ++ Integer -> Slot forall a b. (Integral a, Num b) => a -> b -fromIntegral Integer -n) +fromIntegral Integer +n) -- | Returns the closed ms interval corresponding to the current slot -currentTime :: (MonadBlockChainWithoutValidation m) => m (PV2.POSIXTime, PV2.POSIXTime) +currentTime :: (MonadBlockChainWithoutValidation m) => m (PV2.POSIXTime, PV2.POSIXTime) currentTime :: m (POSIXTime, POSIXTime) currentTime = Slot -> m (POSIXTime, POSIXTime) forall (m :: * -> *). @@ -1463,7 +1463,7 @@ slotToTimeInterval (Slot -> m (POSIXTime, POSIXTime)) -> m Slot -> m (POSIXTime, POSIXTime) forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b -=<< m Slot +=<< m Slot forall (m :: * -> *). MonadBlockChainWithoutValidation m => m Slot currentSlot @@ -1479,77 +1479,77 @@ -- and -- -- > slotToTimeInterval n == (a, b) ==> getEnclosingSlot (a-1) == n-1 && getEnclosingSlot (b+1) == n+1 -slotToTimeInterval :: (MonadBlockChainWithoutValidation m) => Ledger.Slot -> m (PV2.POSIXTime, PV2.POSIXTime) +slotToTimeInterval :: (MonadBlockChainWithoutValidation m) => Ledger.Slot -> m (PV2.POSIXTime, PV2.POSIXTime) slotToTimeInterval :: Slot -> m (POSIXTime, POSIXTime) -slotToTimeInterval Slot -slot = do - SlotConfig -slotConfig <- Params -> SlotConfig -Emulator.pSlotConfig (Params -> SlotConfig) -> m Params -> m SlotConfig +slotToTimeInterval Slot +slot = do + SlotConfig +slotConfig <- Params -> SlotConfig +Emulator.pSlotConfig (Params -> SlotConfig) -> m Params -> m SlotConfig forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b -<$> m Params +<$> m Params forall (m :: * -> *). MonadBlockChainBalancing m => m Params getParams case SlotConfig -> Slot -> POSIXTimeRange -Emulator.slotToPOSIXTimeRange SlotConfig -slotConfig Slot -slot of - PV2.Interval - (PV2.LowerBound (PV2.Finite POSIXTime -l) Bool -leftclosed) - (PV2.UpperBound (PV2.Finite POSIXTime -r) Bool -rightclosed) -> +Emulator.slotToPOSIXTimeRange SlotConfig +slotConfig Slot +slot of + PV2.Interval + (PV2.LowerBound (PV2.Finite POSIXTime +l) Bool +leftclosed) + (PV2.UpperBound (PV2.Finite POSIXTime +r) Bool +rightclosed) -> (POSIXTime, POSIXTime) -> m (POSIXTime, POSIXTime) forall (m :: * -> *) a. Monad m => a -> m a -return +return ( if Bool -leftclosed then POSIXTime -l else POSIXTime -l POSIXTime -> POSIXTime -> POSIXTime +leftclosed then POSIXTime +l else POSIXTime +l POSIXTime -> POSIXTime -> POSIXTime forall a. Num a => a -> a -> a -+ POSIXTime ++ POSIXTime 1, if Bool -rightclosed then POSIXTime -r else POSIXTime -r POSIXTime -> POSIXTime -> POSIXTime +rightclosed then POSIXTime +r else POSIXTime +r POSIXTime -> POSIXTime -> POSIXTime forall a. Num a => a -> a -> a -- POSIXTime +- POSIXTime 1 ) POSIXTimeRange _ -> String -> m (POSIXTime, POSIXTime) forall a. HasCallStack => String -> a -error String +error String "The time interval corresponding to a slot should be finite on both ends." -- | Return the slot that contains the given time. See 'slotToTimeInterval' for -- some equational properties this function satisfies. -getEnclosingSlot :: (MonadBlockChainWithoutValidation m) => PV2.POSIXTime -> m Ledger.Slot +getEnclosingSlot :: (MonadBlockChainWithoutValidation m) => PV2.POSIXTime -> m Ledger.Slot getEnclosingSlot :: POSIXTime -> m Slot -getEnclosingSlot POSIXTime -t = do - SlotConfig -slotConfig <- Params -> SlotConfig -Emulator.pSlotConfig (Params -> SlotConfig) -> m Params -> m SlotConfig +getEnclosingSlot POSIXTime +t = do + SlotConfig +slotConfig <- Params -> SlotConfig +Emulator.pSlotConfig (Params -> SlotConfig) -> m Params -> m SlotConfig forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b -<$> m Params +<$> m Params forall (m :: * -> *). MonadBlockChainBalancing m => m Params getParams Slot -> m Slot forall (m :: * -> *) a. Monad m => a -> m a -return (Slot -> m Slot) -> Slot -> m Slot +return (Slot -> m Slot) -> Slot -> m Slot forall a b. (a -> b) -> a -> b -$ SlotConfig -> POSIXTime -> Slot -Emulator.posixTimeToEnclosingSlot SlotConfig -slotConfig POSIXTime -t +$ SlotConfig -> POSIXTime -> Slot +Emulator.posixTimeToEnclosingSlot SlotConfig +slotConfig POSIXTime +t -- | Waits until the current slot becomes greater or equal to the slot containing the given POSIX time. -- Note that that it might not wait for anything if the current slot is large enough. -awaitEnclosingSlot :: (MonadBlockChainWithoutValidation m) => PV2.POSIXTime -> m Ledger.Slot +awaitEnclosingSlot :: (MonadBlockChainWithoutValidation m) => PV2.POSIXTime -> m Ledger.Slot awaitEnclosingSlot :: POSIXTime -> m Slot awaitEnclosingSlot = Slot -> m Slot forall (m :: * -> *). @@ -1559,104 +1559,104 @@ forall (m :: * -> *) b c a. Monad m => (b -> m c) -> (a -> m b) -> a -> m c -<=< POSIXTime -> m Slot +<=< POSIXTime -> m Slot forall (m :: * -> *). MonadBlockChainWithoutValidation m => POSIXTime -> m Slot getEnclosingSlot -- | The infinite range of slots ending before or at the given POSIX time -slotRangeBefore :: MonadBlockChainWithoutValidation m => PV2.POSIXTime -> m Ledger.SlotRange +slotRangeBefore :: (MonadBlockChainWithoutValidation m) => PV2.POSIXTime -> m Ledger.SlotRange slotRangeBefore :: POSIXTime -> m SlotRange -slotRangeBefore POSIXTime -t = do - Slot -n <- POSIXTime -> m Slot +slotRangeBefore POSIXTime +t = do + Slot +n <- POSIXTime -> m Slot forall (m :: * -> *). MonadBlockChainWithoutValidation m => POSIXTime -> m Slot getEnclosingSlot POSIXTime -t +t (POSIXTime -_, POSIXTime -b) <- Slot -> m (POSIXTime, POSIXTime) +_, POSIXTime +b) <- Slot -> m (POSIXTime, POSIXTime) forall (m :: * -> *). MonadBlockChainWithoutValidation m => Slot -> m (POSIXTime, POSIXTime) slotToTimeInterval Slot -n +n -- If the given time @t@ happens to be the last millisecond of its slot, we -- can include the whole slot. Otherwise, the only way to be sure that the -- returned slot range contains no time after @t@ is to go to the preceding -- slot. if POSIXTime -t POSIXTime -> POSIXTime -> Bool +t POSIXTime -> POSIXTime -> Bool forall a. Eq a => a -> a -> Bool -== POSIXTime -b +== POSIXTime +b then SlotRange -> m SlotRange forall (m :: * -> *) a. Monad m => a -> m a -return (SlotRange -> m SlotRange) -> SlotRange -> m SlotRange +return (SlotRange -> m SlotRange) -> SlotRange -> m SlotRange forall a b. (a -> b) -> a -> b -$ Slot -> SlotRange +$ Slot -> SlotRange forall a. a -> Interval a -PV2.to Slot -n +PV2.to Slot +n else SlotRange -> m SlotRange forall (m :: * -> *) a. Monad m => a -> m a -return (SlotRange -> m SlotRange) -> SlotRange -> m SlotRange +return (SlotRange -> m SlotRange) -> SlotRange -> m SlotRange forall a b. (a -> b) -> a -> b -$ Slot -> SlotRange +$ Slot -> SlotRange forall a. a -> Interval a -PV2.to (Slot -n Slot -> Slot -> Slot +PV2.to (Slot +n Slot -> Slot -> Slot forall a. Num a => a -> a -> a -- Slot +- Slot 1) -- | The infinite range of slots starting after or at the given POSIX time -slotRangeAfter :: MonadBlockChainWithoutValidation m => PV2.POSIXTime -> m Ledger.SlotRange +slotRangeAfter :: (MonadBlockChainWithoutValidation m) => PV2.POSIXTime -> m Ledger.SlotRange slotRangeAfter :: POSIXTime -> m SlotRange -slotRangeAfter POSIXTime -t = do - Slot -n <- POSIXTime -> m Slot +slotRangeAfter POSIXTime +t = do + Slot +n <- POSIXTime -> m Slot forall (m :: * -> *). MonadBlockChainWithoutValidation m => POSIXTime -> m Slot getEnclosingSlot POSIXTime -t - (POSIXTime -a, POSIXTime +t + (POSIXTime +a, POSIXTime _) <- Slot -> m (POSIXTime, POSIXTime) forall (m :: * -> *). MonadBlockChainWithoutValidation m => Slot -> m (POSIXTime, POSIXTime) slotToTimeInterval Slot -n +n if POSIXTime -t POSIXTime -> POSIXTime -> Bool +t POSIXTime -> POSIXTime -> Bool forall a. Eq a => a -> a -> Bool -== POSIXTime -a +== POSIXTime +a then SlotRange -> m SlotRange forall (m :: * -> *) a. Monad m => a -> m a -return (SlotRange -> m SlotRange) -> SlotRange -> m SlotRange +return (SlotRange -> m SlotRange) -> SlotRange -> m SlotRange forall a b. (a -> b) -> a -> b -$ Slot -> SlotRange +$ Slot -> SlotRange forall a. a -> Interval a -PV2.from Slot -n +PV2.from Slot +n else SlotRange -> m SlotRange forall (m :: * -> *) a. Monad m => a -> m a -return (SlotRange -> m SlotRange) -> SlotRange -> m SlotRange +return (SlotRange -> m SlotRange) -> SlotRange -> m SlotRange forall a b. (a -> b) -> a -> b -$ Slot -> SlotRange +$ Slot -> SlotRange forall a. a -> Interval a -PV2.from (Slot -n Slot -> Slot -> Slot +PV2.from (Slot +n Slot -> Slot -> Slot forall a. Num a => a -> a -> a -+ Slot ++ Slot 1) -- ** Deriving further 'MonadBlockChain' instances @@ -1669,9 +1669,9 @@ -- > deriving via (AsTrans (ReaderT r) m) instance MonadBlockChain m => MonadBlockChain (ReaderT r m) -- -- and avoid the boilerplate of defining all the methods of the class yourself. -newtype AsTrans t (m :: Type -> Type) a = AsTrans {AsTrans t m a -> t m a -getTrans :: t m a} - deriving newtype (a -> AsTrans t m b -> AsTrans t m a +newtype AsTrans t (m :: Type -> Type) a = AsTrans {AsTrans t m a -> t m a +getTrans :: t m a} + deriving newtype (a -> AsTrans t m b -> AsTrans t m a (a -> b) -> AsTrans t m a -> AsTrans t m b (forall a b. (a -> b) -> AsTrans t m a -> AsTrans t m b) -> (forall a b. a -> AsTrans t m b -> AsTrans t m a) @@ -1695,7 +1695,7 @@ $cfmap :: forall (t :: (* -> *) -> * -> *) (m :: * -> *) a b. Functor (t m) => (a -> b) -> AsTrans t m a -> AsTrans t m b -Functor, Functor (AsTrans t m) +Functor, Functor (AsTrans t m) a -> AsTrans t m a Functor (AsTrans t m) -> (forall a. a -> AsTrans t m a) @@ -1765,7 +1765,7 @@ $cp1Applicative :: forall (t :: (* -> *) -> * -> *) (m :: * -> *). Applicative (t m) => Functor (AsTrans t m) -Applicative, Applicative (AsTrans t m) +Applicative, Applicative (AsTrans t m) a -> AsTrans t m a Applicative (AsTrans t m) -> (forall a b. @@ -1811,7 +1811,7 @@ $cp1Monad :: forall (t :: (* -> *) -> * -> *) (m :: * -> *). Monad (t m) => Applicative (AsTrans t m) -Monad, m a -> AsTrans t m a +Monad, m a -> AsTrans t m a (forall (m :: * -> *) a. Monad m => m a -> AsTrans t m a) -> MonadTrans (AsTrans t) forall (m :: * -> *) a. Monad m => m a -> AsTrans t m a @@ -1824,7 +1824,7 @@ $clift :: forall (t :: (* -> *) -> * -> *) (m :: * -> *) a. (MonadTrans t, Monad m) => m a -> AsTrans t m a -MonadTrans, MonadTrans (AsTrans t) +MonadTrans, MonadTrans (AsTrans t) m (StT (AsTrans t) a) -> AsTrans t m a MonadTrans (AsTrans t) -> (forall (m :: * -> *) a. @@ -1866,205 +1866,205 @@ $cp1MonadTransControl :: forall (t :: (* -> *) -> * -> *). MonadTransControl t => MonadTrans (AsTrans t) -MonadTransControl) +MonadTransControl) -instance (MonadTrans t, MonadFail m, Monad (t m)) => MonadFail (AsTrans t m) where - fail :: String -> AsTrans t m a -fail = m a -> AsTrans t m a +instance (MonadTrans t, MonadFail m, Monad (t m)) => MonadFail (AsTrans t m) where + fail :: String -> AsTrans t m a +fail = m a -> AsTrans t m a forall (t :: (* -> *) -> * -> *) (m :: * -> *) a. (MonadTrans t, Monad m) => m a -> t m a -lift (m a -> AsTrans t m a) +lift (m a -> AsTrans t m a) -> (String -> m a) -> String -> AsTrans t m a forall b c a. (b -> c) -> (a -> b) -> a -> c -. String -> m a +. String -> m a forall (m :: * -> *) a. MonadFail m => String -> m a -fail +fail -instance (MonadTransControl t, MonadError MockChainError m, Monad (t m)) => MonadError MockChainError (AsTrans t m) where - throwError :: MockChainError -> AsTrans t m a -throwError = m a -> AsTrans t m a +instance (MonadTransControl t, MonadError MockChainError m, Monad (t m)) => MonadError MockChainError (AsTrans t m) where + throwError :: MockChainError -> AsTrans t m a +throwError = m a -> AsTrans t m a forall (t :: (* -> *) -> * -> *) (m :: * -> *) a. (MonadTrans t, Monad m) => m a -> t m a -lift (m a -> AsTrans t m a) +lift (m a -> AsTrans t m a) -> (MockChainError -> m a) -> MockChainError -> AsTrans t m a forall b c a. (b -> c) -> (a -> b) -> a -> c -. MockChainError -> m a +. MockChainError -> m a forall e (m :: * -> *) a. MonadError e m => e -> m a -throwError - catchError :: AsTrans t m a -> (MockChainError -> AsTrans t m a) -> AsTrans t m a -catchError AsTrans t m a -act MockChainError -> AsTrans t m a -f = (Run (AsTrans t) -> m (StT t a)) -> AsTrans t m (StT t a) +throwError + catchError :: AsTrans t m a -> (MockChainError -> AsTrans t m a) -> AsTrans t m a +catchError AsTrans t m a +act MockChainError -> AsTrans t m a +f = (Run (AsTrans t) -> m (StT t a)) -> AsTrans t m (StT t a) forall (t :: (* -> *) -> * -> *) (m :: * -> *) a. (MonadTransControl t, Monad m) => (Run t -> m a) -> t m a -liftWith (\Run (AsTrans t) -run -> m (StT t a) -> (MockChainError -> m (StT t a)) -> m (StT t a) +liftWith (\Run (AsTrans t) +run -> m (StT t a) -> (MockChainError -> m (StT t a)) -> m (StT t a) forall e (m :: * -> *) a. MonadError e m => m a -> (e -> m a) -> m a -catchError (AsTrans t m a -> m (StT (AsTrans t) a) +catchError (AsTrans t m a -> m (StT (AsTrans t) a) Run (AsTrans t) -run AsTrans t m a -act) (AsTrans t m a -> m (StT t a) +run AsTrans t m a +act) (AsTrans t m a -> m (StT t a) Run (AsTrans t) -run (AsTrans t m a -> m (StT t a)) +run (AsTrans t m a -> m (StT t a)) -> (MockChainError -> AsTrans t m a) -> MockChainError -> m (StT t a) forall b c a. (b -> c) -> (a -> b) -> a -> c -. MockChainError -> AsTrans t m a -f)) AsTrans t m (StT t a) +. MockChainError -> AsTrans t m a +f)) AsTrans t m (StT t a) -> (StT t a -> AsTrans t m a) -> AsTrans t m a forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b ->>= m (StT t a) -> AsTrans t m a +>>= m (StT t a) -> AsTrans t m a forall (t :: (* -> *) -> * -> *) (m :: * -> *) a. (MonadTransControl t, Monad m) => m (StT t a) -> t m a -restoreT (m (StT t a) -> AsTrans t m a) +restoreT (m (StT t a) -> AsTrans t m a) -> (StT t a -> m (StT t a)) -> StT t a -> AsTrans t m a forall b c a. (b -> c) -> (a -> b) -> a -> c -. StT t a -> m (StT t a) +. StT t a -> m (StT t a) forall (m :: * -> *) a. Monad m => a -> m a -return +return -instance (MonadTrans t, MonadBlockChainBalancing m, Monad (t m), MonadError MockChainError (AsTrans t m)) => MonadBlockChainBalancing (AsTrans t m) where - getParams :: AsTrans t m Params -getParams = m Params -> AsTrans t m Params +instance (MonadTrans t, MonadBlockChainBalancing m, Monad (t m), MonadError MockChainError (AsTrans t m)) => MonadBlockChainBalancing (AsTrans t m) where + getParams :: AsTrans t m Params +getParams = m Params -> AsTrans t m Params forall (t :: (* -> *) -> * -> *) (m :: * -> *) a. (MonadTrans t, Monad m) => m a -> t m a -lift m Params +lift m Params forall (m :: * -> *). MonadBlockChainBalancing m => m Params getParams - validatorFromHash :: ValidatorHash -> AsTrans t m (Maybe (Versioned Validator)) -validatorFromHash = m (Maybe (Versioned Validator)) + validatorFromHash :: ValidatorHash -> AsTrans t m (Maybe (Versioned Validator)) +validatorFromHash = m (Maybe (Versioned Validator)) -> AsTrans t m (Maybe (Versioned Validator)) forall (t :: (* -> *) -> * -> *) (m :: * -> *) a. (MonadTrans t, Monad m) => m a -> t m a -lift (m (Maybe (Versioned Validator)) +lift (m (Maybe (Versioned Validator)) -> AsTrans t m (Maybe (Versioned Validator))) -> (ValidatorHash -> m (Maybe (Versioned Validator))) -> ValidatorHash -> AsTrans t m (Maybe (Versioned Validator)) forall b c a. (b -> c) -> (a -> b) -> a -> c -. ValidatorHash -> m (Maybe (Versioned Validator)) +. ValidatorHash -> m (Maybe (Versioned Validator)) forall (m :: * -> *). MonadBlockChainBalancing m => ValidatorHash -> m (Maybe (Versioned Validator)) validatorFromHash - utxosAtLedger :: Address -> AsTrans t m [(TxOutRef, TxOut)] -utxosAtLedger = m [(TxOutRef, TxOut)] -> AsTrans t m [(TxOutRef, TxOut)] + utxosAtLedger :: Address -> AsTrans t m [(TxOutRef, TxOut)] +utxosAtLedger = m [(TxOutRef, TxOut)] -> AsTrans t m [(TxOutRef, TxOut)] forall (t :: (* -> *) -> * -> *) (m :: * -> *) a. (MonadTrans t, Monad m) => m a -> t m a -lift (m [(TxOutRef, TxOut)] -> AsTrans t m [(TxOutRef, TxOut)]) +lift (m [(TxOutRef, TxOut)] -> AsTrans t m [(TxOutRef, TxOut)]) -> (Address -> m [(TxOutRef, TxOut)]) -> Address -> AsTrans t m [(TxOutRef, TxOut)] forall b c a. (b -> c) -> (a -> b) -> a -> c -. Address -> m [(TxOutRef, TxOut)] +. Address -> m [(TxOutRef, TxOut)] forall (m :: * -> *). MonadBlockChainBalancing m => Address -> m [(TxOutRef, TxOut)] utxosAtLedger - txOutByRefLedger :: TxOutRef -> AsTrans t m (Maybe TxOut) -txOutByRefLedger = m (Maybe TxOut) -> AsTrans t m (Maybe TxOut) + txOutByRefLedger :: TxOutRef -> AsTrans t m (Maybe TxOut) +txOutByRefLedger = m (Maybe TxOut) -> AsTrans t m (Maybe TxOut) forall (t :: (* -> *) -> * -> *) (m :: * -> *) a. (MonadTrans t, Monad m) => m a -> t m a -lift (m (Maybe TxOut) -> AsTrans t m (Maybe TxOut)) +lift (m (Maybe TxOut) -> AsTrans t m (Maybe TxOut)) -> (TxOutRef -> m (Maybe TxOut)) -> TxOutRef -> AsTrans t m (Maybe TxOut) forall b c a. (b -> c) -> (a -> b) -> a -> c -. TxOutRef -> m (Maybe TxOut) +. TxOutRef -> m (Maybe TxOut) forall (m :: * -> *). MonadBlockChainBalancing m => TxOutRef -> m (Maybe TxOut) txOutByRefLedger - datumFromHash :: DatumHash -> AsTrans t m (Maybe Datum) -datumFromHash = m (Maybe Datum) -> AsTrans t m (Maybe Datum) + datumFromHash :: DatumHash -> AsTrans t m (Maybe Datum) +datumFromHash = m (Maybe Datum) -> AsTrans t m (Maybe Datum) forall (t :: (* -> *) -> * -> *) (m :: * -> *) a. (MonadTrans t, Monad m) => m a -> t m a -lift (m (Maybe Datum) -> AsTrans t m (Maybe Datum)) +lift (m (Maybe Datum) -> AsTrans t m (Maybe Datum)) -> (DatumHash -> m (Maybe Datum)) -> DatumHash -> AsTrans t m (Maybe Datum) forall b c a. (b -> c) -> (a -> b) -> a -> c -. DatumHash -> m (Maybe Datum) +. DatumHash -> m (Maybe Datum) forall (m :: * -> *). MonadBlockChainBalancing m => DatumHash -> m (Maybe Datum) datumFromHash -instance (MonadTrans t, MonadBlockChainWithoutValidation m, Monad (t m), MonadError MockChainError (AsTrans t m)) => MonadBlockChainWithoutValidation (AsTrans t m) where - allUtxosLedger :: AsTrans t m [(TxOutRef, TxOut)] -allUtxosLedger = m [(TxOutRef, TxOut)] -> AsTrans t m [(TxOutRef, TxOut)] +instance (MonadTrans t, MonadBlockChainWithoutValidation m, Monad (t m), MonadError MockChainError (AsTrans t m)) => MonadBlockChainWithoutValidation (AsTrans t m) where + allUtxosLedger :: AsTrans t m [(TxOutRef, TxOut)] +allUtxosLedger = m [(TxOutRef, TxOut)] -> AsTrans t m [(TxOutRef, TxOut)] forall (t :: (* -> *) -> * -> *) (m :: * -> *) a. (MonadTrans t, Monad m) => m a -> t m a -lift m [(TxOutRef, TxOut)] +lift m [(TxOutRef, TxOut)] forall (m :: * -> *). MonadBlockChainWithoutValidation m => m [(TxOutRef, TxOut)] allUtxosLedger - currentSlot :: AsTrans t m Slot -currentSlot = m Slot -> AsTrans t m Slot + currentSlot :: AsTrans t m Slot +currentSlot = m Slot -> AsTrans t m Slot forall (t :: (* -> *) -> * -> *) (m :: * -> *) a. (MonadTrans t, Monad m) => m a -> t m a -lift m Slot +lift m Slot forall (m :: * -> *). MonadBlockChainWithoutValidation m => m Slot currentSlot - awaitSlot :: Slot -> AsTrans t m Slot -awaitSlot = m Slot -> AsTrans t m Slot + awaitSlot :: Slot -> AsTrans t m Slot +awaitSlot = m Slot -> AsTrans t m Slot forall (t :: (* -> *) -> * -> *) (m :: * -> *) a. (MonadTrans t, Monad m) => m a -> t m a -lift (m Slot -> AsTrans t m Slot) +lift (m Slot -> AsTrans t m Slot) -> (Slot -> m Slot) -> Slot -> AsTrans t m Slot forall b c a. (b -> c) -> (a -> b) -> a -> c -. Slot -> m Slot +. Slot -> m Slot forall (m :: * -> *). MonadBlockChainWithoutValidation m => Slot -> m Slot awaitSlot -instance (MonadTrans t, MonadBlockChain m, MonadBlockChainWithoutValidation (AsTrans t m)) => MonadBlockChain (AsTrans t m) where - validateTxSkel :: TxSkel -> AsTrans t m CardanoTx -validateTxSkel = m CardanoTx -> AsTrans t m CardanoTx +instance (MonadTrans t, MonadBlockChain m, MonadBlockChainWithoutValidation (AsTrans t m)) => MonadBlockChain (AsTrans t m) where + validateTxSkel :: TxSkel -> AsTrans t m CardanoTx +validateTxSkel = m CardanoTx -> AsTrans t m CardanoTx forall (t :: (* -> *) -> * -> *) (m :: * -> *) a. (MonadTrans t, Monad m) => m a -> t m a -lift (m CardanoTx -> AsTrans t m CardanoTx) +lift (m CardanoTx -> AsTrans t m CardanoTx) -> (TxSkel -> m CardanoTx) -> TxSkel -> AsTrans t m CardanoTx forall b c a. (b -> c) -> (a -> b) -> a -> c -. TxSkel -> m CardanoTx +. TxSkel -> m CardanoTx forall (m :: * -> *). MonadBlockChain m => TxSkel -> m CardanoTx validateTxSkel -deriving via (AsTrans (WriterT w) m) instance (Monoid w, MonadBlockChainBalancing m) => MonadBlockChainBalancing (WriterT w m) +deriving via (AsTrans (WriterT w) m) instance (Monoid w, MonadBlockChainBalancing m) => MonadBlockChainBalancing (WriterT w m) -deriving via (AsTrans (WriterT w) m) instance (Monoid w, MonadBlockChainWithoutValidation m) => MonadBlockChainWithoutValidation (WriterT w m) +deriving via (AsTrans (WriterT w) m) instance (Monoid w, MonadBlockChainWithoutValidation m) => MonadBlockChainWithoutValidation (WriterT w m) -deriving via (AsTrans (WriterT w) m) instance (Monoid w, MonadBlockChain m) => MonadBlockChain (WriterT w m) +deriving via (AsTrans (WriterT w) m) instance (Monoid w, MonadBlockChain m) => MonadBlockChain (WriterT w m) -deriving via (AsTrans (ReaderT r) m) instance MonadBlockChainBalancing m => MonadBlockChainBalancing (ReaderT r m) +deriving via (AsTrans (ReaderT r) m) instance (MonadBlockChainBalancing m) => MonadBlockChainBalancing (ReaderT r m) -deriving via (AsTrans (ReaderT r) m) instance MonadBlockChainWithoutValidation m => MonadBlockChainWithoutValidation (ReaderT r m) +deriving via (AsTrans (ReaderT r) m) instance (MonadBlockChainWithoutValidation m) => MonadBlockChainWithoutValidation (ReaderT r m) -deriving via (AsTrans (ReaderT r) m) instance MonadBlockChain m => MonadBlockChain (ReaderT r m) +deriving via (AsTrans (ReaderT r) m) instance (MonadBlockChain m) => MonadBlockChain (ReaderT r m) -deriving via (AsTrans (StateT s) m) instance MonadBlockChainBalancing m => MonadBlockChainBalancing (StateT s m) +deriving via (AsTrans (StateT s) m) instance (MonadBlockChainBalancing m) => MonadBlockChainBalancing (StateT s m) -deriving via (AsTrans (StateT s) m) instance MonadBlockChainWithoutValidation m => MonadBlockChainWithoutValidation (StateT s m) +deriving via (AsTrans (StateT s) m) instance (MonadBlockChainWithoutValidation m) => MonadBlockChainWithoutValidation (StateT s m) -deriving via (AsTrans (StateT s) m) instance MonadBlockChain m => MonadBlockChain (StateT s m) +deriving via (AsTrans (StateT s) m) instance (MonadBlockChain m) => MonadBlockChain (StateT s m) -- 'ListT' has no 'MonadTransControl' instance, so the @deriving via ...@ -- machinery is unusable here. However, there is @@ -2075,121 +2075,121 @@ -- 'MonadBlockChainWithoutValidation' and 'MonadBlockChain' instances for -- 'ListT', instead of more black magic... -instance MonadBlockChainBalancing m => MonadBlockChainBalancing (ListT m) where - getParams :: ListT m Params -getParams = m Params -> ListT m Params +instance (MonadBlockChainBalancing m) => MonadBlockChainBalancing (ListT m) where + getParams :: ListT m Params +getParams = m Params -> ListT m Params forall (t :: (* -> *) -> * -> *) (m :: * -> *) a. (MonadTrans t, Monad m) => m a -> t m a -lift m Params +lift m Params forall (m :: * -> *). MonadBlockChainBalancing m => m Params getParams - validatorFromHash :: ValidatorHash -> ListT m (Maybe (Versioned Validator)) -validatorFromHash = m (Maybe (Versioned Validator)) + validatorFromHash :: ValidatorHash -> ListT m (Maybe (Versioned Validator)) +validatorFromHash = m (Maybe (Versioned Validator)) -> ListT m (Maybe (Versioned Validator)) forall (t :: (* -> *) -> * -> *) (m :: * -> *) a. (MonadTrans t, Monad m) => m a -> t m a -lift (m (Maybe (Versioned Validator)) +lift (m (Maybe (Versioned Validator)) -> ListT m (Maybe (Versioned Validator))) -> (ValidatorHash -> m (Maybe (Versioned Validator))) -> ValidatorHash -> ListT m (Maybe (Versioned Validator)) forall b c a. (b -> c) -> (a -> b) -> a -> c -. ValidatorHash -> m (Maybe (Versioned Validator)) +. ValidatorHash -> m (Maybe (Versioned Validator)) forall (m :: * -> *). MonadBlockChainBalancing m => ValidatorHash -> m (Maybe (Versioned Validator)) validatorFromHash - utxosAtLedger :: Address -> ListT m [(TxOutRef, TxOut)] -utxosAtLedger = m [(TxOutRef, TxOut)] -> ListT m [(TxOutRef, TxOut)] + utxosAtLedger :: Address -> ListT m [(TxOutRef, TxOut)] +utxosAtLedger = m [(TxOutRef, TxOut)] -> ListT m [(TxOutRef, TxOut)] forall (t :: (* -> *) -> * -> *) (m :: * -> *) a. (MonadTrans t, Monad m) => m a -> t m a -lift (m [(TxOutRef, TxOut)] -> ListT m [(TxOutRef, TxOut)]) +lift (m [(TxOutRef, TxOut)] -> ListT m [(TxOutRef, TxOut)]) -> (Address -> m [(TxOutRef, TxOut)]) -> Address -> ListT m [(TxOutRef, TxOut)] forall b c a. (b -> c) -> (a -> b) -> a -> c -. Address -> m [(TxOutRef, TxOut)] +. Address -> m [(TxOutRef, TxOut)] forall (m :: * -> *). MonadBlockChainBalancing m => Address -> m [(TxOutRef, TxOut)] utxosAtLedger - txOutByRefLedger :: TxOutRef -> ListT m (Maybe TxOut) -txOutByRefLedger = m (Maybe TxOut) -> ListT m (Maybe TxOut) + txOutByRefLedger :: TxOutRef -> ListT m (Maybe TxOut) +txOutByRefLedger = m (Maybe TxOut) -> ListT m (Maybe TxOut) forall (t :: (* -> *) -> * -> *) (m :: * -> *) a. (MonadTrans t, Monad m) => m a -> t m a -lift (m (Maybe TxOut) -> ListT m (Maybe TxOut)) +lift (m (Maybe TxOut) -> ListT m (Maybe TxOut)) -> (TxOutRef -> m (Maybe TxOut)) -> TxOutRef -> ListT m (Maybe TxOut) forall b c a. (b -> c) -> (a -> b) -> a -> c -. TxOutRef -> m (Maybe TxOut) +. TxOutRef -> m (Maybe TxOut) forall (m :: * -> *). MonadBlockChainBalancing m => TxOutRef -> m (Maybe TxOut) txOutByRefLedger - datumFromHash :: DatumHash -> ListT m (Maybe Datum) -datumFromHash = m (Maybe Datum) -> ListT m (Maybe Datum) + datumFromHash :: DatumHash -> ListT m (Maybe Datum) +datumFromHash = m (Maybe Datum) -> ListT m (Maybe Datum) forall (t :: (* -> *) -> * -> *) (m :: * -> *) a. (MonadTrans t, Monad m) => m a -> t m a -lift (m (Maybe Datum) -> ListT m (Maybe Datum)) +lift (m (Maybe Datum) -> ListT m (Maybe Datum)) -> (DatumHash -> m (Maybe Datum)) -> DatumHash -> ListT m (Maybe Datum) forall b c a. (b -> c) -> (a -> b) -> a -> c -. DatumHash -> m (Maybe Datum) +. DatumHash -> m (Maybe Datum) forall (m :: * -> *). MonadBlockChainBalancing m => DatumHash -> m (Maybe Datum) datumFromHash -instance MonadBlockChainWithoutValidation m => MonadBlockChainWithoutValidation (ListT m) where - allUtxosLedger :: ListT m [(TxOutRef, TxOut)] -allUtxosLedger = m [(TxOutRef, TxOut)] -> ListT m [(TxOutRef, TxOut)] +instance (MonadBlockChainWithoutValidation m) => MonadBlockChainWithoutValidation (ListT m) where + allUtxosLedger :: ListT m [(TxOutRef, TxOut)] +allUtxosLedger = m [(TxOutRef, TxOut)] -> ListT m [(TxOutRef, TxOut)] forall (t :: (* -> *) -> * -> *) (m :: * -> *) a. (MonadTrans t, Monad m) => m a -> t m a -lift m [(TxOutRef, TxOut)] +lift m [(TxOutRef, TxOut)] forall (m :: * -> *). MonadBlockChainWithoutValidation m => m [(TxOutRef, TxOut)] allUtxosLedger - currentSlot :: ListT m Slot -currentSlot = m Slot -> ListT m Slot + currentSlot :: ListT m Slot +currentSlot = m Slot -> ListT m Slot forall (t :: (* -> *) -> * -> *) (m :: * -> *) a. (MonadTrans t, Monad m) => m a -> t m a -lift m Slot +lift m Slot forall (m :: * -> *). MonadBlockChainWithoutValidation m => m Slot currentSlot - awaitSlot :: Slot -> ListT m Slot -awaitSlot = m Slot -> ListT m Slot + awaitSlot :: Slot -> ListT m Slot +awaitSlot = m Slot -> ListT m Slot forall (t :: (* -> *) -> * -> *) (m :: * -> *) a. (MonadTrans t, Monad m) => m a -> t m a -lift (m Slot -> ListT m Slot) +lift (m Slot -> ListT m Slot) -> (Slot -> m Slot) -> Slot -> ListT m Slot forall b c a. (b -> c) -> (a -> b) -> a -> c -. Slot -> m Slot +. Slot -> m Slot forall (m :: * -> *). MonadBlockChainWithoutValidation m => Slot -> m Slot awaitSlot -instance MonadBlockChain m => MonadBlockChain (ListT m) where - validateTxSkel :: TxSkel -> ListT m CardanoTx -validateTxSkel = m CardanoTx -> ListT m CardanoTx +instance (MonadBlockChain m) => MonadBlockChain (ListT m) where + validateTxSkel :: TxSkel -> ListT m CardanoTx +validateTxSkel = m CardanoTx -> ListT m CardanoTx forall (t :: (* -> *) -> * -> *) (m :: * -> *) a. (MonadTrans t, Monad m) => m a -> t m a -lift (m CardanoTx -> ListT m CardanoTx) +lift (m CardanoTx -> ListT m CardanoTx) -> (TxSkel -> m CardanoTx) -> TxSkel -> ListT m CardanoTx forall b c a. (b -> c) -> (a -> b) -> a -> c -. TxSkel -> m CardanoTx +. TxSkel -> m CardanoTx forall (m :: * -> *). MonadBlockChain m => TxSkel -> m CardanoTx validateTxSkel \ No newline at end of file diff --git a/src/Cooked.MockChain.Direct.html b/src/Cooked.MockChain.Direct.html index 319bef379..ec0dbb9d6 100644 --- a/src/Cooked.MockChain.Direct.html +++ b/src/Cooked.MockChain.Direct.html @@ -15,37 +15,37 @@ module Cooked.MockChain.Direct where -import qualified Cardano.Api as C -import qualified Cardano.Api.Shelley as C -import qualified Cardano.Ledger.Shelley.API as CardanoLedger -import qualified Cardano.Node.Emulator.Params as Emulator -import qualified Cardano.Node.Emulator.Validation as Emulator -import Control.Applicative -import Control.Arrow -import Control.Monad.Except -import Control.Monad.Identity -import Control.Monad.Reader -import Control.Monad.State.Strict +import qualified Cardano.Api as C +import qualified Cardano.Api.Shelley as C +import qualified Cardano.Ledger.Shelley.API as CardanoLedger +import qualified Cardano.Node.Emulator.Params as Emulator +import qualified Cardano.Node.Emulator.Validation as Emulator +import Control.Applicative +import Control.Arrow +import Control.Monad.Except +import Control.Monad.Identity +import Control.Monad.Reader +import Control.Monad.State.Strict import Cooked.MockChain.Balancing import Cooked.MockChain.BlockChain import Cooked.MockChain.UtxoState import Cooked.Output import Cooked.Skeleton import Cooked.Wallet -import Data.Default -import Data.Map.Strict (Map) -import qualified Data.Map.Strict as Map -import Data.Maybe (mapMaybe) -import qualified Ledger.Blockchain as Ledger -import qualified Ledger.Index as Ledger -import Ledger.Orphans () -import qualified Ledger.Slot as Ledger -import qualified Ledger.Tx as Ledger -import qualified Ledger.Tx.CardanoAPI as Ledger -import qualified Plutus.Script.Utils.Scripts as Pl -import qualified Plutus.Script.Utils.V2.Scripts as Pl -import qualified Plutus.V2.Ledger.Api as PV2 -import qualified Plutus.V2.Ledger.Api as Pl +import Data.Default +import Data.Map.Strict (Map) +import qualified Data.Map.Strict as Map +import Data.Maybe (mapMaybe) +import qualified Ledger.Blockchain as Ledger +import qualified Ledger.Index as Ledger +import Ledger.Orphans () +import qualified Ledger.Slot as Ledger +import qualified Ledger.Tx as Ledger +import qualified Ledger.Tx.CardanoAPI as Ledger +import qualified Plutus.Script.Utils.Scripts as Pl +import qualified Plutus.Script.Utils.V2.Scripts as Pl +import qualified Plutus.V2.Ledger.Api as PV2 +import qualified Plutus.V2.Ledger.Api as Pl -- * Direct Emulation @@ -60,10 +60,10 @@ mcstToUtxoState :: MockChainSt -> UtxoState mcstToUtxoState :: MockChainSt -> UtxoState -mcstToUtxoState MockChainSt {UtxoIndex +mcstToUtxoState MockChainSt {UtxoIndex mcstIndex :: MockChainSt -> UtxoIndex mcstIndex :: UtxoIndex -mcstIndex, Map DatumHash (TxSkelOutDatum, Integer) +mcstIndex, Map DatumHash (TxSkelOutDatum, Integer) mcstDatums :: MockChainSt -> Map DatumHash (TxSkelOutDatum, Integer) mcstDatums :: Map DatumHash (TxSkelOutDatum, Integer) mcstDatums} = @@ -74,7 +74,7 @@ -> UtxoIndex -> UtxoState forall b c a. (b -> c) -> (a -> b) -> a -> c -. ((Address, UtxoPayloadSet) +. ((Address, UtxoPayloadSet) -> Map Address UtxoPayloadSet -> Map Address UtxoPayloadSet) -> Map Address UtxoPayloadSet -> [(Address, UtxoPayloadSet)] @@ -82,162 +82,162 @@ forall (t :: * -> *) a b. Foldable t => (a -> b -> b) -> b -> t a -> b -foldr (\(Address -address, UtxoPayloadSet -utxoValueSet) Map Address UtxoPayloadSet -acc -> (UtxoPayloadSet -> UtxoPayloadSet -> UtxoPayloadSet) +foldr (\(Address +address, UtxoPayloadSet +utxoValueSet) Map Address UtxoPayloadSet +acc -> (UtxoPayloadSet -> UtxoPayloadSet -> UtxoPayloadSet) -> Address -> UtxoPayloadSet -> Map Address UtxoPayloadSet -> Map Address UtxoPayloadSet forall k a. Ord k => (a -> a -> a) -> k -> a -> Map k a -> Map k a -Map.insertWith UtxoPayloadSet -> UtxoPayloadSet -> UtxoPayloadSet +Map.insertWith UtxoPayloadSet -> UtxoPayloadSet -> UtxoPayloadSet forall a. Semigroup a => a -> a -> a -(<>) Address -address UtxoPayloadSet -utxoValueSet Map Address UtxoPayloadSet -acc) Map Address UtxoPayloadSet +(<>) Address +address UtxoPayloadSet +utxoValueSet Map Address UtxoPayloadSet +acc) Map Address UtxoPayloadSet forall k a. Map k a -Map.empty +Map.empty ([(Address, UtxoPayloadSet)] -> Map Address UtxoPayloadSet) -> (UtxoIndex -> [(Address, UtxoPayloadSet)]) -> UtxoIndex -> Map Address UtxoPayloadSet forall b c a. (b -> c) -> (a -> b) -> a -> c -. ((TxOutRef, TxOut) -> Maybe (Address, UtxoPayloadSet)) +. ((TxOutRef, TxOut) -> Maybe (Address, UtxoPayloadSet)) -> [(TxOutRef, TxOut)] -> [(Address, UtxoPayloadSet)] forall a b. (a -> Maybe b) -> [a] -> [b] -mapMaybe (TxOutRef, TxOut) -> Maybe (Address, UtxoPayloadSet) -extractPayload +mapMaybe (TxOutRef, TxOut) -> Maybe (Address, UtxoPayloadSet) +extractPayload ([(TxOutRef, TxOut)] -> [(Address, UtxoPayloadSet)]) -> (UtxoIndex -> [(TxOutRef, TxOut)]) -> UtxoIndex -> [(Address, UtxoPayloadSet)] forall b c a. (b -> c) -> (a -> b) -> a -> c -. ((TxIn, TxOut CtxUTxO BabbageEra) -> (TxOutRef, TxOut)) +. ((TxIn, TxOut CtxUTxO BabbageEra) -> (TxOutRef, TxOut)) -> [(TxIn, TxOut CtxUTxO BabbageEra)] -> [(TxOutRef, TxOut)] forall a b. (a -> b) -> [a] -> [b] -map (\(TxIn -k, TxOut CtxUTxO BabbageEra -v) -> (TxIn -> TxOutRef -Ledger.fromCardanoTxIn TxIn -k, TxOut CtxUTxO BabbageEra -> TxOut +map (\(TxIn +k, TxOut CtxUTxO BabbageEra +v) -> (TxIn -> TxOutRef +Ledger.fromCardanoTxIn TxIn +k, TxOut CtxUTxO BabbageEra -> TxOut forall era. TxOut CtxUTxO era -> TxOut -Ledger.fromCardanoTxOutToPV2TxInfoTxOut' TxOut CtxUTxO BabbageEra -v)) +Ledger.fromCardanoTxOutToPV2TxInfoTxOut' TxOut CtxUTxO BabbageEra +v)) ([(TxIn, TxOut CtxUTxO BabbageEra)] -> [(TxOutRef, TxOut)]) -> (UtxoIndex -> [(TxIn, TxOut CtxUTxO BabbageEra)]) -> UtxoIndex -> [(TxOutRef, TxOut)] forall b c a. (b -> c) -> (a -> b) -> a -> c -. Map TxIn (TxOut CtxUTxO BabbageEra) +. Map TxIn (TxOut CtxUTxO BabbageEra) -> [(TxIn, TxOut CtxUTxO BabbageEra)] forall k a. Map k a -> [(k, a)] -Map.toList +Map.toList (Map TxIn (TxOut CtxUTxO BabbageEra) -> [(TxIn, TxOut CtxUTxO BabbageEra)]) -> (UtxoIndex -> Map TxIn (TxOut CtxUTxO BabbageEra)) -> UtxoIndex -> [(TxIn, TxOut CtxUTxO BabbageEra)] forall b c a. (b -> c) -> (a -> b) -> a -> c -. UtxoIndex -> Map TxIn (TxOut CtxUTxO BabbageEra) +. UtxoIndex -> Map TxIn (TxOut CtxUTxO BabbageEra) forall era. UTxO era -> Map TxIn (TxOut CtxUTxO era) -C.unUTxO +C.unUTxO (UtxoIndex -> UtxoState) -> UtxoIndex -> UtxoState forall a b. (a -> b) -> a -> b -$ UtxoIndex -mcstIndex +$ UtxoIndex +mcstIndex where - extractPayload :: (Pl.TxOutRef, PV2.TxOut) -> Maybe (Pl.Address, UtxoPayloadSet) - extractPayload :: (TxOutRef, TxOut) -> Maybe (Address, UtxoPayloadSet) -extractPayload (TxOutRef -txOutRef, out :: TxOut -out@PV2.TxOut {Address + extractPayload :: (Pl.TxOutRef, PV2.TxOut) -> Maybe (Pl.Address, UtxoPayloadSet) + extractPayload :: (TxOutRef, TxOut) -> Maybe (Address, UtxoPayloadSet) +extractPayload (TxOutRef +txOutRef, out :: TxOut +out@PV2.TxOut {Address txOutAddress :: TxOut -> Address txOutAddress :: Address -PV2.txOutAddress, Value +PV2.txOutAddress, Value txOutValue :: TxOut -> Value txOutValue :: Value -PV2.txOutValue, OutputDatum +PV2.txOutValue, OutputDatum txOutDatum :: TxOut -> OutputDatum txOutDatum :: OutputDatum -PV2.txOutDatum}) = +PV2.txOutDatum}) = do - let mRefScript :: Maybe ScriptHash -mRefScript = TxOut -> Maybe ScriptHash + let mRefScript :: Maybe ScriptHash +mRefScript = TxOut -> Maybe ScriptHash forall o. (IsAbstractOutput o, ToScriptHash (ReferenceScriptType o)) => o -> Maybe ScriptHash outputReferenceScriptHash TxOut -out - TxSkelOutDatum -txSkelOutDatum <- +out + TxSkelOutDatum +txSkelOutDatum <- case OutputDatum -txOutDatum of +txOutDatum of OutputDatum -Pl.NoOutputDatum -> TxSkelOutDatum -> Maybe TxSkelOutDatum +Pl.NoOutputDatum -> TxSkelOutDatum -> Maybe TxSkelOutDatum forall a. a -> Maybe a -Just TxSkelOutDatum +Just TxSkelOutDatum TxSkelOutNoDatum - Pl.OutputDatum Datum -datum -> (TxSkelOutDatum, Integer) -> TxSkelOutDatum + Pl.OutputDatum Datum +datum -> (TxSkelOutDatum, Integer) -> TxSkelOutDatum forall a b. (a, b) -> a -fst ((TxSkelOutDatum, Integer) -> TxSkelOutDatum) +fst ((TxSkelOutDatum, Integer) -> TxSkelOutDatum) -> Maybe (TxSkelOutDatum, Integer) -> Maybe TxSkelOutDatum forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b -<$> DatumHash +<$> DatumHash -> Map DatumHash (TxSkelOutDatum, Integer) -> Maybe (TxSkelOutDatum, Integer) forall k a. Ord k => k -> Map k a -> Maybe a -Map.lookup (Datum -> DatumHash -Pl.datumHash Datum -datum) Map DatumHash (TxSkelOutDatum, Integer) -mcstDatums - Pl.OutputDatumHash DatumHash -hash -> (TxSkelOutDatum, Integer) -> TxSkelOutDatum +Map.lookup (Datum -> DatumHash +Pl.datumHash Datum +datum) Map DatumHash (TxSkelOutDatum, Integer) +mcstDatums + Pl.OutputDatumHash DatumHash +hash -> (TxSkelOutDatum, Integer) -> TxSkelOutDatum forall a b. (a, b) -> a -fst ((TxSkelOutDatum, Integer) -> TxSkelOutDatum) +fst ((TxSkelOutDatum, Integer) -> TxSkelOutDatum) -> Maybe (TxSkelOutDatum, Integer) -> Maybe TxSkelOutDatum forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b -<$> DatumHash +<$> DatumHash -> Map DatumHash (TxSkelOutDatum, Integer) -> Maybe (TxSkelOutDatum, Integer) forall k a. Ord k => k -> Map k a -> Maybe a -Map.lookup DatumHash -hash Map DatumHash (TxSkelOutDatum, Integer) -mcstDatums +Map.lookup DatumHash +hash Map DatumHash (TxSkelOutDatum, Integer) +mcstDatums (Address, UtxoPayloadSet) -> Maybe (Address, UtxoPayloadSet) forall (m :: * -> *) a. Monad m => a -> m a -return +return ( Address -txOutAddress, +txOutAddress, [UtxoPayload] -> UtxoPayloadSet UtxoPayloadSet [TxOutRef -> Value -> TxSkelOutDatum -> Maybe ScriptHash -> UtxoPayload UtxoPayload TxOutRef -txOutRef Value -txOutValue TxSkelOutDatum -txSkelOutDatum Maybe ScriptHash -mRefScript] +txOutRef Value +txOutValue TxSkelOutDatum +txSkelOutDatum Maybe ScriptHash +mRefScript] ) -- | Slightly more concrete version of 'UtxoState', used to actually run the -- simulation. data MockChainSt = MockChainSt { MockChainSt -> UtxoIndex -mcstIndex :: Ledger.UtxoIndex, +mcstIndex :: Ledger.UtxoIndex, -- map from datum hash to (datum, count), where count is the number of -- UTxOs that currently have the datum. This map is used to display the -- contents of the state to the user, and to recover datums for transaction -- generation. MockChainSt -> Map DatumHash (TxSkelOutDatum, Integer) -mcstDatums :: Map Pl.DatumHash (TxSkelOutDatum, Integer), +mcstDatums :: Map Pl.DatumHash (TxSkelOutDatum, Integer), MockChainSt -> Map ValidatorHash (Versioned Validator) -mcstValidators :: Map Pl.ValidatorHash (Pl.Versioned Pl.Validator), +mcstValidators :: Map Pl.ValidatorHash (Pl.Versioned Pl.Validator), MockChainSt -> Slot -mcstCurrentSlot :: Ledger.Slot +mcstCurrentSlot :: Ledger.Slot } - deriving (Int -> MockChainSt -> ShowS + deriving (Int -> MockChainSt -> ShowS [MockChainSt] -> ShowS MockChainSt -> String (Int -> MockChainSt -> ShowS) @@ -252,56 +252,56 @@ $cshow :: MockChainSt -> String showsPrec :: Int -> MockChainSt -> ShowS $cshowsPrec :: Int -> MockChainSt -> ShowS -Show) +Show) -instance Eq MockChainSt where - (MockChainSt UtxoIndex -index1 Map DatumHash (TxSkelOutDatum, Integer) -datums1 Map ValidatorHash (Versioned Validator) -validators1 Slot -currentSlot1) - == :: MockChainSt -> MockChainSt -> Bool -== (MockChainSt UtxoIndex -index2 Map DatumHash (TxSkelOutDatum, Integer) -datums2 Map ValidatorHash (Versioned Validator) -validators2 Slot -currentSlot2) = +instance Eq MockChainSt where + (MockChainSt UtxoIndex +index1 Map DatumHash (TxSkelOutDatum, Integer) +datums1 Map ValidatorHash (Versioned Validator) +validators1 Slot +currentSlot1) + == :: MockChainSt -> MockChainSt -> Bool +== (MockChainSt UtxoIndex +index2 Map DatumHash (TxSkelOutDatum, Integer) +datums2 Map ValidatorHash (Versioned Validator) +validators2 Slot +currentSlot2) = [Bool] -> Bool forall (t :: * -> *). Foldable t => t Bool -> Bool -and +and [ UtxoIndex -index1 UtxoIndex -> UtxoIndex -> Bool +index1 UtxoIndex -> UtxoIndex -> Bool forall a. Eq a => a -> a -> Bool -== UtxoIndex -index2, +== UtxoIndex +index2, Map DatumHash (TxSkelOutDatum, Integer) -datums1 Map DatumHash (TxSkelOutDatum, Integer) +datums1 Map DatumHash (TxSkelOutDatum, Integer) -> Map DatumHash (TxSkelOutDatum, Integer) -> Bool forall a. Eq a => a -> a -> Bool -== Map DatumHash (TxSkelOutDatum, Integer) -datums2, +== Map DatumHash (TxSkelOutDatum, Integer) +datums2, Map ValidatorHash (Versioned Validator) -validators1 Map ValidatorHash (Versioned Validator) +validators1 Map ValidatorHash (Versioned Validator) -> Map ValidatorHash (Versioned Validator) -> Bool forall a. Eq a => a -> a -> Bool -== Map ValidatorHash (Versioned Validator) -validators2, +== Map ValidatorHash (Versioned Validator) +validators2, Slot -currentSlot1 Slot -> Slot -> Bool +currentSlot1 Slot -> Slot -> Bool forall a. Eq a => a -> a -> Bool -== Slot -currentSlot2 +== Slot +currentSlot2 ] -instance Default Ledger.Slot where - def :: Slot -def = Integer -> Slot -Ledger.Slot Integer +instance Default Ledger.Slot where + def :: Slot +def = Integer -> Slot +Ledger.Slot Integer 0 newtype MockChainEnv = MockChainEnv {MockChainEnv -> Params -mceParams :: Emulator.Params} - deriving (Int -> MockChainEnv -> ShowS +mceParams :: Emulator.Params} + deriving (Int -> MockChainEnv -> ShowS [MockChainEnv] -> ShowS MockChainEnv -> String (Int -> MockChainEnv -> ShowS) @@ -316,21 +316,21 @@ $cshow :: MockChainEnv -> String showsPrec :: Int -> MockChainEnv -> ShowS $cshowsPrec :: Int -> MockChainEnv -> ShowS -Show) +Show) -instance Default MockChainEnv where - def :: MockChainEnv -def = Params -> MockChainEnv +instance Default MockChainEnv where + def :: MockChainEnv +def = Params -> MockChainEnv MockChainEnv Params forall a. Default a => a -def +def -newtype MockChainT m a = MockChainT +newtype MockChainT m a = MockChainT {MockChainT m a -> ReaderT MockChainEnv (StateT MockChainSt (ExceptT MockChainError m)) a -unMockChain :: ReaderT MockChainEnv (StateT MockChainSt (ExceptT MockChainError m)) a} - deriving newtype (a -> MockChainT m b -> MockChainT m a +unMockChain :: ReaderT MockChainEnv (StateT MockChainSt (ExceptT MockChainError m)) a} + deriving newtype (a -> MockChainT m b -> MockChainT m a (a -> b) -> MockChainT m a -> MockChainT m b (forall a b. (a -> b) -> MockChainT m a -> MockChainT m b) -> (forall a b. a -> MockChainT m b -> MockChainT m a) @@ -354,7 +354,7 @@ $cfmap :: forall (m :: * -> *) a b. Functor m => (a -> b) -> MockChainT m a -> MockChainT m b -Functor, Functor (MockChainT m) +Functor, Functor (MockChainT m) a -> MockChainT m a Functor (MockChainT m) -> (forall a. a -> MockChainT m a) @@ -418,21 +418,21 @@ pure :: a -> MockChainT m a $cpure :: forall (m :: * -> *) a. Monad m => a -> MockChainT m a $cp1Applicative :: forall (m :: * -> *). Monad m => Functor (MockChainT m) -Applicative, MonadState MockChainSt, MonadError MockChainError, MonadReader MockChainEnv) +Applicative, MonadState MockChainSt, MonadError MockChainError, MonadReader MockChainEnv) -type MockChain = MockChainT Identity +type MockChain = MockChainT Identity -- | Custom monad instance made to increase the slot count automatically -instance (Monad m) => Monad (MockChainT m) where - return :: a -> MockChainT m a -return = a -> MockChainT m a +instance (Monad m) => Monad (MockChainT m) where + return :: a -> MockChainT m a +return = a -> MockChainT m a forall (f :: * -> *) a. Applicative f => a -> f a -pure - MockChainT ReaderT +pure + MockChainT ReaderT MockChainEnv (StateT MockChainSt (ExceptT MockChainError m)) a -x >>= :: MockChainT m a -> (a -> MockChainT m b) -> MockChainT m b ->>= a -> MockChainT m b -f = ReaderT +x >>= :: MockChainT m a -> (a -> MockChainT m b) -> MockChainT m b +>>= a -> MockChainT m b +f = ReaderT MockChainEnv (StateT MockChainSt (ExceptT MockChainError m)) b -> MockChainT m b forall (m :: * -> *) a. @@ -446,9 +446,9 @@ MockChainEnv (StateT MockChainSt (ExceptT MockChainError m)) b -> MockChainT m b forall a b. (a -> b) -> a -> b -$ ReaderT +$ ReaderT MockChainEnv (StateT MockChainSt (ExceptT MockChainError m)) a -x ReaderT +x ReaderT MockChainEnv (StateT MockChainSt (ExceptT MockChainError m)) a -> (a -> ReaderT @@ -456,7 +456,7 @@ -> ReaderT MockChainEnv (StateT MockChainSt (ExceptT MockChainError m)) b forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b ->>= MockChainT m b +>>= MockChainT m b -> ReaderT MockChainEnv (StateT MockChainSt (ExceptT MockChainError m)) b forall (m :: * -> *) a. @@ -471,22 +471,22 @@ -> ReaderT MockChainEnv (StateT MockChainSt (ExceptT MockChainError m)) b forall b c a. (b -> c) -> (a -> b) -> a -> c -. a -> MockChainT m b -f +. a -> MockChainT m b +f -instance (Monad m) => MonadFail (MockChainT m) where - fail :: String -> MockChainT m a -fail = MockChainError -> MockChainT m a +instance (Monad m) => MonadFail (MockChainT m) where + fail :: String -> MockChainT m a +fail = MockChainError -> MockChainT m a forall e (m :: * -> *) a. MonadError e m => e -> m a -throwError (MockChainError -> MockChainT m a) +throwError (MockChainError -> MockChainT m a) -> (String -> MockChainError) -> String -> MockChainT m a forall b c a. (b -> c) -> (a -> b) -> a -> c -. String -> MockChainError +. String -> MockChainError FailWith -instance MonadTrans MockChainT where - lift :: m a -> MockChainT m a -lift = ReaderT +instance MonadTrans MockChainT where + lift :: m a -> MockChainT m a +lift = ReaderT MockChainEnv (StateT MockChainSt (ExceptT MockChainError m)) a -> MockChainT m a forall (m :: * -> *) a. @@ -502,13 +502,13 @@ -> m a -> MockChainT m a forall b c a. (b -> c) -> (a -> b) -> a -> c -. StateT MockChainSt (ExceptT MockChainError m) a +. StateT MockChainSt (ExceptT MockChainError m) a -> ReaderT MockChainEnv (StateT MockChainSt (ExceptT MockChainError m)) a forall (t :: (* -> *) -> * -> *) (m :: * -> *) a. (MonadTrans t, Monad m) => m a -> t m a -lift (StateT MockChainSt (ExceptT MockChainError m) a +lift (StateT MockChainSt (ExceptT MockChainError m) a -> ReaderT MockChainEnv (StateT MockChainSt (ExceptT MockChainError m)) a) -> (m a -> StateT MockChainSt (ExceptT MockChainError m) a) @@ -516,26 +516,26 @@ -> ReaderT MockChainEnv (StateT MockChainSt (ExceptT MockChainError m)) a forall b c a. (b -> c) -> (a -> b) -> a -> c -. ExceptT MockChainError m a +. ExceptT MockChainError m a -> StateT MockChainSt (ExceptT MockChainError m) a forall (t :: (* -> *) -> * -> *) (m :: * -> *) a. (MonadTrans t, Monad m) => m a -> t m a -lift (ExceptT MockChainError m a +lift (ExceptT MockChainError m a -> StateT MockChainSt (ExceptT MockChainError m) a) -> (m a -> ExceptT MockChainError m a) -> m a -> StateT MockChainSt (ExceptT MockChainError m) a forall b c a. (b -> c) -> (a -> b) -> a -> c -. m a -> ExceptT MockChainError m a +. m a -> ExceptT MockChainError m a forall (t :: (* -> *) -> * -> *) (m :: * -> *) a. (MonadTrans t, Monad m) => m a -> t m a -lift +lift -instance (Monad m, Alternative m) => Alternative (MockChainT m) where - empty :: MockChainT m a -empty = ReaderT +instance (Monad m, Alternative m) => Alternative (MockChainT m) where + empty :: MockChainT m a +empty = ReaderT MockChainEnv (StateT MockChainSt (ExceptT MockChainError m)) a -> MockChainT m a forall (m :: * -> *) a. @@ -549,11 +549,11 @@ MockChainEnv (StateT MockChainSt (ExceptT MockChainError m)) a -> MockChainT m a forall a b. (a -> b) -> a -> b -$ (MockChainEnv -> StateT MockChainSt (ExceptT MockChainError m) a) +$ (MockChainEnv -> StateT MockChainSt (ExceptT MockChainError m) a) -> ReaderT MockChainEnv (StateT MockChainSt (ExceptT MockChainError m)) a forall r (m :: * -> *) a. (r -> m a) -> ReaderT r m a -ReaderT ((MockChainEnv -> StateT MockChainSt (ExceptT MockChainError m) a) +ReaderT ((MockChainEnv -> StateT MockChainSt (ExceptT MockChainError m) a) -> ReaderT MockChainEnv (StateT MockChainSt (ExceptT MockChainError m)) a) -> (MockChainEnv @@ -561,40 +561,40 @@ -> ReaderT MockChainEnv (StateT MockChainSt (ExceptT MockChainError m)) a forall a b. (a -> b) -> a -> b -$ StateT MockChainSt (ExceptT MockChainError m) a +$ StateT MockChainSt (ExceptT MockChainError m) a -> MockChainEnv -> StateT MockChainSt (ExceptT MockChainError m) a forall a b. a -> b -> a -const (StateT MockChainSt (ExceptT MockChainError m) a +const (StateT MockChainSt (ExceptT MockChainError m) a -> MockChainEnv -> StateT MockChainSt (ExceptT MockChainError m) a) -> StateT MockChainSt (ExceptT MockChainError m) a -> MockChainEnv -> StateT MockChainSt (ExceptT MockChainError m) a forall a b. (a -> b) -> a -> b -$ (MockChainSt -> ExceptT MockChainError m (a, MockChainSt)) +$ (MockChainSt -> ExceptT MockChainError m (a, MockChainSt)) -> StateT MockChainSt (ExceptT MockChainError m) a forall s (m :: * -> *) a. (s -> m (a, s)) -> StateT s m a -StateT ((MockChainSt -> ExceptT MockChainError m (a, MockChainSt)) +StateT ((MockChainSt -> ExceptT MockChainError m (a, MockChainSt)) -> StateT MockChainSt (ExceptT MockChainError m) a) -> (MockChainSt -> ExceptT MockChainError m (a, MockChainSt)) -> StateT MockChainSt (ExceptT MockChainError m) a forall a b. (a -> b) -> a -> b -$ ExceptT MockChainError m (a, MockChainSt) +$ ExceptT MockChainError m (a, MockChainSt) -> MockChainSt -> ExceptT MockChainError m (a, MockChainSt) forall a b. a -> b -> a -const (ExceptT MockChainError m (a, MockChainSt) +const (ExceptT MockChainError m (a, MockChainSt) -> MockChainSt -> ExceptT MockChainError m (a, MockChainSt)) -> ExceptT MockChainError m (a, MockChainSt) -> MockChainSt -> ExceptT MockChainError m (a, MockChainSt) forall a b. (a -> b) -> a -> b -$ m (Either MockChainError (a, MockChainSt)) +$ m (Either MockChainError (a, MockChainSt)) -> ExceptT MockChainError m (a, MockChainSt) forall e (m :: * -> *) a. m (Either e a) -> ExceptT e m a -ExceptT m (Either MockChainError (a, MockChainSt)) +ExceptT m (Either MockChainError (a, MockChainSt)) forall (f :: * -> *) a. Alternative f => f a -empty - <|> :: MockChainT m a -> MockChainT m a -> MockChainT m a -(<|>) = (forall a. m a -> m a -> m a) +empty + <|> :: MockChainT m a -> MockChainT m a -> MockChainT m a +(<|>) = (forall a. m a -> m a -> m a) -> MockChainT m a -> MockChainT m a -> MockChainT m a forall (m :: * -> *) x. Monad m => @@ -602,20 +602,20 @@ -> MockChainT m x -> MockChainT m x -> MockChainT m x combineMockChainT forall a. m a -> m a -> m a forall (f :: * -> *) a. Alternative f => f a -> f a -> f a -(<|>) +(<|>) -combineMockChainT :: - (Monad m) => - (forall a. m a -> m a -> m a) -> - MockChainT m x -> - MockChainT m x -> - MockChainT m x +combineMockChainT :: + (Monad m) => + (forall a. m a -> m a -> m a) -> + MockChainT m x -> + MockChainT m x -> + MockChainT m x combineMockChainT :: (forall a. m a -> m a -> m a) -> MockChainT m x -> MockChainT m x -> MockChainT m x -combineMockChainT forall a. m a -> m a -> m a -f MockChainT m x -ma MockChainT m x -mb = ReaderT +combineMockChainT forall a. m a -> m a -> m a +f MockChainT m x +ma MockChainT m x +mb = ReaderT MockChainEnv (StateT MockChainSt (ExceptT MockChainError m)) x -> MockChainT m x forall (m :: * -> *) a. @@ -629,12 +629,12 @@ MockChainEnv (StateT MockChainSt (ExceptT MockChainError m)) x -> MockChainT m x forall a b. (a -> b) -> a -> b -$ +$ (MockChainEnv -> StateT MockChainSt (ExceptT MockChainError m) x) -> ReaderT MockChainEnv (StateT MockChainSt (ExceptT MockChainError m)) x forall r (m :: * -> *) a. (r -> m a) -> ReaderT r m a -ReaderT ((MockChainEnv -> StateT MockChainSt (ExceptT MockChainError m) x) +ReaderT ((MockChainEnv -> StateT MockChainSt (ExceptT MockChainError m) x) -> ReaderT MockChainEnv (StateT MockChainSt (ExceptT MockChainError m)) x) -> (MockChainEnv @@ -642,35 +642,35 @@ -> ReaderT MockChainEnv (StateT MockChainSt (ExceptT MockChainError m)) x forall a b. (a -> b) -> a -> b -$ \MockChainEnv -r -> +$ \MockChainEnv +r -> (MockChainSt -> ExceptT MockChainError m (x, MockChainSt)) -> StateT MockChainSt (ExceptT MockChainError m) x forall s (m :: * -> *) a. (s -> m (a, s)) -> StateT s m a -StateT ((MockChainSt -> ExceptT MockChainError m (x, MockChainSt)) +StateT ((MockChainSt -> ExceptT MockChainError m (x, MockChainSt)) -> StateT MockChainSt (ExceptT MockChainError m) x) -> (MockChainSt -> ExceptT MockChainError m (x, MockChainSt)) -> StateT MockChainSt (ExceptT MockChainError m) x forall a b. (a -> b) -> a -> b -$ \MockChainSt -s -> - let resA :: m (Either MockChainError (x, MockChainSt)) -resA = ExceptT MockChainError m (x, MockChainSt) +$ \MockChainSt +s -> + let resA :: m (Either MockChainError (x, MockChainSt)) +resA = ExceptT MockChainError m (x, MockChainSt) -> m (Either MockChainError (x, MockChainSt)) forall e (m :: * -> *) a. ExceptT e m a -> m (Either e a) -runExceptT (ExceptT MockChainError m (x, MockChainSt) +runExceptT (ExceptT MockChainError m (x, MockChainSt) -> m (Either MockChainError (x, MockChainSt))) -> ExceptT MockChainError m (x, MockChainSt) -> m (Either MockChainError (x, MockChainSt)) forall a b. (a -> b) -> a -> b -$ StateT MockChainSt (ExceptT MockChainError m) x +$ StateT MockChainSt (ExceptT MockChainError m) x -> MockChainSt -> ExceptT MockChainError m (x, MockChainSt) forall s (m :: * -> *) a. StateT s m a -> s -> m (a, s) -runStateT (ReaderT +runStateT (ReaderT MockChainEnv (StateT MockChainSt (ExceptT MockChainError m)) x -> MockChainEnv -> StateT MockChainSt (ExceptT MockChainError m) x forall r (m :: * -> *) a. ReaderT r m a -> r -> m a -runReaderT (MockChainT m x +runReaderT (MockChainT m x -> ReaderT MockChainEnv (StateT MockChainSt (ExceptT MockChainError m)) x forall (m :: * -> *) a. @@ -678,26 +678,26 @@ -> ReaderT MockChainEnv (StateT MockChainSt (ExceptT MockChainError m)) a unMockChain MockChainT m x -ma) MockChainEnv -r) MockChainSt -s - resB :: m (Either MockChainError (x, MockChainSt)) -resB = ExceptT MockChainError m (x, MockChainSt) +ma) MockChainEnv +r) MockChainSt +s + resB :: m (Either MockChainError (x, MockChainSt)) +resB = ExceptT MockChainError m (x, MockChainSt) -> m (Either MockChainError (x, MockChainSt)) forall e (m :: * -> *) a. ExceptT e m a -> m (Either e a) -runExceptT (ExceptT MockChainError m (x, MockChainSt) +runExceptT (ExceptT MockChainError m (x, MockChainSt) -> m (Either MockChainError (x, MockChainSt))) -> ExceptT MockChainError m (x, MockChainSt) -> m (Either MockChainError (x, MockChainSt)) forall a b. (a -> b) -> a -> b -$ StateT MockChainSt (ExceptT MockChainError m) x +$ StateT MockChainSt (ExceptT MockChainError m) x -> MockChainSt -> ExceptT MockChainError m (x, MockChainSt) forall s (m :: * -> *) a. StateT s m a -> s -> m (a, s) -runStateT (ReaderT +runStateT (ReaderT MockChainEnv (StateT MockChainSt (ExceptT MockChainError m)) x -> MockChainEnv -> StateT MockChainSt (ExceptT MockChainError m) x forall r (m :: * -> *) a. ReaderT r m a -> r -> m a -runReaderT (MockChainT m x +runReaderT (MockChainT m x -> ReaderT MockChainEnv (StateT MockChainSt (ExceptT MockChainError m)) x forall (m :: * -> *) a. @@ -705,35 +705,35 @@ -> ReaderT MockChainEnv (StateT MockChainSt (ExceptT MockChainError m)) a unMockChain MockChainT m x -mb) MockChainEnv -r) MockChainSt -s +mb) MockChainEnv +r) MockChainSt +s in m (Either MockChainError (x, MockChainSt)) -> ExceptT MockChainError m (x, MockChainSt) forall e (m :: * -> *) a. m (Either e a) -> ExceptT e m a -ExceptT (m (Either MockChainError (x, MockChainSt)) +ExceptT (m (Either MockChainError (x, MockChainSt)) -> ExceptT MockChainError m (x, MockChainSt)) -> m (Either MockChainError (x, MockChainSt)) -> ExceptT MockChainError m (x, MockChainSt) forall a b. (a -> b) -> a -> b -$ m (Either MockChainError (x, MockChainSt)) +$ m (Either MockChainError (x, MockChainSt)) -> m (Either MockChainError (x, MockChainSt)) -> m (Either MockChainError (x, MockChainSt)) forall a. m a -> m a -> m a -f m (Either MockChainError (x, MockChainSt)) -resA m (Either MockChainError (x, MockChainSt)) -resB +f m (Either MockChainError (x, MockChainSt)) +resA m (Either MockChainError (x, MockChainSt)) +resB -mapMockChainT :: - (m (Either MockChainError (a, MockChainSt)) -> n (Either MockChainError (b, MockChainSt))) -> - MockChainT m a -> - MockChainT n b +mapMockChainT :: + (m (Either MockChainError (a, MockChainSt)) -> n (Either MockChainError (b, MockChainSt))) -> + MockChainT m a -> + MockChainT n b mapMockChainT :: (m (Either MockChainError (a, MockChainSt)) -> n (Either MockChainError (b, MockChainSt))) -> MockChainT m a -> MockChainT n b -mapMockChainT m (Either MockChainError (a, MockChainSt)) +mapMockChainT m (Either MockChainError (a, MockChainSt)) -> n (Either MockChainError (b, MockChainSt)) -f = ReaderT +f = ReaderT MockChainEnv (StateT MockChainSt (ExceptT MockChainError n)) b -> MockChainT n b forall (m :: * -> *) a. @@ -749,7 +749,7 @@ -> MockChainT m a -> MockChainT n b forall b c a. (b -> c) -> (a -> b) -> a -> c -. (StateT MockChainSt (ExceptT MockChainError m) a +. (StateT MockChainSt (ExceptT MockChainError m) a -> StateT MockChainSt (ExceptT MockChainError n) b) -> ReaderT MockChainEnv (StateT MockChainSt (ExceptT MockChainError m)) a @@ -757,22 +757,22 @@ MockChainEnv (StateT MockChainSt (ExceptT MockChainError n)) b forall (m :: * -> *) a (n :: * -> *) b r. (m a -> n b) -> ReaderT r m a -> ReaderT r n b -mapReaderT ((ExceptT MockChainError m (a, MockChainSt) +mapReaderT ((ExceptT MockChainError m (a, MockChainSt) -> ExceptT MockChainError n (b, MockChainSt)) -> StateT MockChainSt (ExceptT MockChainError m) a -> StateT MockChainSt (ExceptT MockChainError n) b forall (m :: * -> *) a s (n :: * -> *) b. (m (a, s) -> n (b, s)) -> StateT s m a -> StateT s n b -mapStateT ((m (Either MockChainError (a, MockChainSt)) +mapStateT ((m (Either MockChainError (a, MockChainSt)) -> n (Either MockChainError (b, MockChainSt))) -> ExceptT MockChainError m (a, MockChainSt) -> ExceptT MockChainError n (b, MockChainSt) forall (m :: * -> *) e a (n :: * -> *) e' b. (m (Either e a) -> n (Either e' b)) -> ExceptT e m a -> ExceptT e' n b -mapExceptT m (Either MockChainError (a, MockChainSt)) +mapExceptT m (Either MockChainError (a, MockChainSt)) -> n (Either MockChainError (b, MockChainSt)) -f)) (ReaderT +f)) (ReaderT MockChainEnv (StateT MockChainSt (ExceptT MockChainError m)) a -> ReaderT MockChainEnv (StateT MockChainSt (ExceptT MockChainError n)) b) @@ -783,7 +783,7 @@ -> ReaderT MockChainEnv (StateT MockChainSt (ExceptT MockChainError n)) b forall b c a. (b -> c) -> (a -> b) -> a -> c -. MockChainT m a +. MockChainT m a -> ReaderT MockChainEnv (StateT MockChainSt (ExceptT MockChainError m)) a forall (m :: * -> *) a. @@ -794,40 +794,40 @@ -- | Executes a 'MockChainT' from some initial state and environment; does /not/ -- convert the 'MockChainSt' into a 'UtxoState'. -runMockChainTRaw :: - (Monad m) => +runMockChainTRaw :: + (Monad m) => MockChainEnv -> MockChainSt -> - MockChainT m a -> - m (Either MockChainError (a, MockChainSt)) + MockChainT m a -> + m (Either MockChainError (a, MockChainSt)) runMockChainTRaw :: MockChainEnv -> MockChainSt -> MockChainT m a -> m (Either MockChainError (a, MockChainSt)) -runMockChainTRaw MockChainEnv -e0 MockChainSt -i0 = +runMockChainTRaw MockChainEnv +e0 MockChainSt +i0 = ExceptT MockChainError m (a, MockChainSt) -> m (Either MockChainError (a, MockChainSt)) forall e (m :: * -> *) a. ExceptT e m a -> m (Either e a) -runExceptT +runExceptT (ExceptT MockChainError m (a, MockChainSt) -> m (Either MockChainError (a, MockChainSt))) -> (MockChainT m a -> ExceptT MockChainError m (a, MockChainSt)) -> MockChainT m a -> m (Either MockChainError (a, MockChainSt)) forall b c a. (b -> c) -> (a -> b) -> a -> c -. (StateT MockChainSt (ExceptT MockChainError m) a +. (StateT MockChainSt (ExceptT MockChainError m) a -> MockChainSt -> ExceptT MockChainError m (a, MockChainSt)) -> MockChainSt -> StateT MockChainSt (ExceptT MockChainError m) a -> ExceptT MockChainError m (a, MockChainSt) forall a b c. (a -> b -> c) -> b -> a -> c -flip StateT MockChainSt (ExceptT MockChainError m) a +flip StateT MockChainSt (ExceptT MockChainError m) a -> MockChainSt -> ExceptT MockChainError m (a, MockChainSt) forall s (m :: * -> *) a. StateT s m a -> s -> m (a, s) -runStateT MockChainSt -i0 +runStateT MockChainSt +i0 (StateT MockChainSt (ExceptT MockChainError m) a -> ExceptT MockChainError m (a, MockChainSt)) -> (MockChainT m a @@ -835,7 +835,7 @@ -> MockChainT m a -> ExceptT MockChainError m (a, MockChainSt) forall b c a. (b -> c) -> (a -> b) -> a -> c -. (ReaderT +. (ReaderT MockChainEnv (StateT MockChainSt (ExceptT MockChainError m)) a -> MockChainEnv -> StateT MockChainSt (ExceptT MockChainError m) a) -> MockChainEnv @@ -843,12 +843,12 @@ MockChainEnv (StateT MockChainSt (ExceptT MockChainError m)) a -> StateT MockChainSt (ExceptT MockChainError m) a forall a b c. (a -> b -> c) -> b -> a -> c -flip ReaderT +flip ReaderT MockChainEnv (StateT MockChainSt (ExceptT MockChainError m)) a -> MockChainEnv -> StateT MockChainSt (ExceptT MockChainError m) a forall r (m :: * -> *) a. ReaderT r m a -> r -> m a -runReaderT MockChainEnv -e0 +runReaderT MockChainEnv +e0 (ReaderT MockChainEnv (StateT MockChainSt (ExceptT MockChainError m)) a -> StateT MockChainSt (ExceptT MockChainError m) a) @@ -858,7 +858,7 @@ -> MockChainT m a -> StateT MockChainSt (ExceptT MockChainError m) a forall b c a. (b -> c) -> (a -> b) -> a -> c -. MockChainT m a +. MockChainT m a -> ReaderT MockChainEnv (StateT MockChainSt (ExceptT MockChainError m)) a forall (m :: * -> *) a. @@ -871,43 +871,43 @@ -- initial value distribution. Similar to 'runMockChainT', uses the default -- environment. Returns a 'UtxoState' instead of a 'MockChainSt'. If you need -- the later, use 'runMockChainTRaw' -runMockChainTFrom :: - (Monad m) => +runMockChainTFrom :: + (Monad m) => InitialDistribution -> - MockChainT m a -> - m (Either MockChainError (a, UtxoState)) + MockChainT m a -> + m (Either MockChainError (a, UtxoState)) runMockChainTFrom :: InitialDistribution -> MockChainT m a -> m (Either MockChainError (a, UtxoState)) -runMockChainTFrom InitialDistribution -i0 = +runMockChainTFrom InitialDistribution +i0 = (Either MockChainError (a, MockChainSt) -> Either MockChainError (a, UtxoState)) -> m (Either MockChainError (a, MockChainSt)) -> m (Either MockChainError (a, UtxoState)) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b -fmap (((a, MockChainSt) -> (a, UtxoState)) +fmap (((a, MockChainSt) -> (a, UtxoState)) -> Either MockChainError (a, MockChainSt) -> Either MockChainError (a, UtxoState) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b -fmap (((a, MockChainSt) -> (a, UtxoState)) +fmap (((a, MockChainSt) -> (a, UtxoState)) -> Either MockChainError (a, MockChainSt) -> Either MockChainError (a, UtxoState)) -> ((a, MockChainSt) -> (a, UtxoState)) -> Either MockChainError (a, MockChainSt) -> Either MockChainError (a, UtxoState) forall a b. (a -> b) -> a -> b -$ (MockChainSt -> UtxoState) -> (a, MockChainSt) -> (a, UtxoState) +$ (MockChainSt -> UtxoState) -> (a, MockChainSt) -> (a, UtxoState) forall (a :: * -> * -> *) b c d. Arrow a => a b c -> a (d, b) (d, c) -second MockChainSt -> UtxoState +second MockChainSt -> UtxoState mcstToUtxoState) (m (Either MockChainError (a, MockChainSt)) -> m (Either MockChainError (a, UtxoState))) -> (MockChainT m a -> m (Either MockChainError (a, MockChainSt))) -> MockChainT m a -> m (Either MockChainError (a, UtxoState)) forall b c a. (b -> c) -> (a -> b) -> a -> c -. MockChainEnv +. MockChainEnv -> MockChainSt -> MockChainT m a -> m (Either MockChainError (a, MockChainSt)) @@ -919,14 +919,14 @@ -> m (Either MockChainError (a, MockChainSt)) runMockChainTRaw MockChainEnv forall a. Default a => a -def (InitialDistribution -> MockChainSt +def (InitialDistribution -> MockChainSt mockChainSt0From InitialDistribution -i0) +i0) -- | Executes a 'MockChainT' from the canonical initial state and environment. -- The canonical environment uses the default 'SlotConfig' and -- @Cooked.Wallet.wallet 1@ as the sole wallet signing transactions. -runMockChainT :: (Monad m) => MockChainT m a -> m (Either MockChainError (a, UtxoState)) +runMockChainT :: (Monad m) => MockChainT m a -> m (Either MockChainError (a, UtxoState)) runMockChainT :: MockChainT m a -> m (Either MockChainError (a, UtxoState)) runMockChainT = InitialDistribution -> MockChainT m a -> m (Either MockChainError (a, UtxoState)) @@ -936,27 +936,27 @@ -> MockChainT m a -> m (Either MockChainError (a, UtxoState)) runMockChainTFrom InitialDistribution forall a. Default a => a -def +def -- | See 'runMockChainTRaw' -runMockChainRaw :: MockChainEnv -> MockChainSt -> MockChain a -> Either MockChainError (a, MockChainSt) +runMockChainRaw :: MockChainEnv -> MockChainSt -> MockChain a -> Either MockChainError (a, MockChainSt) runMockChainRaw :: MockChainEnv -> MockChainSt -> MockChain a -> Either MockChainError (a, MockChainSt) -runMockChainRaw MockChainEnv -e0 MockChainSt -i0 = Identity (Either MockChainError (a, MockChainSt)) +runMockChainRaw MockChainEnv +e0 MockChainSt +i0 = Identity (Either MockChainError (a, MockChainSt)) -> Either MockChainError (a, MockChainSt) forall a. Identity a -> a -runIdentity (Identity (Either MockChainError (a, MockChainSt)) +runIdentity (Identity (Either MockChainError (a, MockChainSt)) -> Either MockChainError (a, MockChainSt)) -> (MockChain a -> Identity (Either MockChainError (a, MockChainSt))) -> MockChain a -> Either MockChainError (a, MockChainSt) forall b c a. (b -> c) -> (a -> b) -> a -> c -. MockChainEnv +. MockChainEnv -> MockChainSt -> MockChain a -> Identity (Either MockChainError (a, MockChainSt)) @@ -967,46 +967,46 @@ -> MockChainT m a -> m (Either MockChainError (a, MockChainSt)) runMockChainTRaw MockChainEnv -e0 MockChainSt -i0 +e0 MockChainSt +i0 -- | See 'runMockChainTFrom' -runMockChainFrom :: - InitialDistribution -> MockChain a -> Either MockChainError (a, UtxoState) +runMockChainFrom :: + InitialDistribution -> MockChain a -> Either MockChainError (a, UtxoState) runMockChainFrom :: InitialDistribution -> MockChain a -> Either MockChainError (a, UtxoState) -runMockChainFrom InitialDistribution -i0 = Identity (Either MockChainError (a, UtxoState)) +runMockChainFrom InitialDistribution +i0 = Identity (Either MockChainError (a, UtxoState)) -> Either MockChainError (a, UtxoState) forall a. Identity a -> a -runIdentity (Identity (Either MockChainError (a, UtxoState)) +runIdentity (Identity (Either MockChainError (a, UtxoState)) -> Either MockChainError (a, UtxoState)) -> (MockChain a -> Identity (Either MockChainError (a, UtxoState))) -> MockChain a -> Either MockChainError (a, UtxoState) forall b c a. (b -> c) -> (a -> b) -> a -> c -. InitialDistribution +. InitialDistribution -> MockChain a -> Identity (Either MockChainError (a, UtxoState)) forall (m :: * -> *) a. Monad m => InitialDistribution -> MockChainT m a -> m (Either MockChainError (a, UtxoState)) runMockChainTFrom InitialDistribution -i0 +i0 -- | See 'runMockChainT' -runMockChain :: MockChain a -> Either MockChainError (a, UtxoState) +runMockChain :: MockChain a -> Either MockChainError (a, UtxoState) runMockChain :: MockChain a -> Either MockChainError (a, UtxoState) runMockChain = Identity (Either MockChainError (a, UtxoState)) -> Either MockChainError (a, UtxoState) forall a. Identity a -> a -runIdentity (Identity (Either MockChainError (a, UtxoState)) +runIdentity (Identity (Either MockChainError (a, UtxoState)) -> Either MockChainError (a, UtxoState)) -> (MockChain a -> Identity (Either MockChainError (a, UtxoState))) -> MockChain a -> Either MockChainError (a, UtxoState) forall b c a. (b -> c) -> (a -> b) -> a -> c -. MockChain a -> Identity (Either MockChainError (a, UtxoState)) +. MockChain a -> Identity (Either MockChainError (a, UtxoState)) forall (m :: * -> *) a. Monad m => MockChainT m a -> m (Either MockChainError (a, UtxoState)) @@ -1030,83 +1030,83 @@ MockChainSt UtxoIndex utxoIndex0 Map DatumHash (TxSkelOutDatum, Integer) forall k a. Map k a -Map.empty Map ValidatorHash (Versioned Validator) +Map.empty Map ValidatorHash (Versioned Validator) forall k a. Map k a -Map.empty Slot +Map.empty Slot forall a. Default a => a -def +def mockChainSt0From :: InitialDistribution -> MockChainSt mockChainSt0From :: InitialDistribution -> MockChainSt -mockChainSt0From InitialDistribution -i0 = UtxoIndex +mockChainSt0From InitialDistribution +i0 = UtxoIndex -> Map DatumHash (TxSkelOutDatum, Integer) -> Map ValidatorHash (Versioned Validator) -> Slot -> MockChainSt MockChainSt (InitialDistribution -> UtxoIndex utxoIndex0From InitialDistribution -i0) Map DatumHash (TxSkelOutDatum, Integer) +i0) Map DatumHash (TxSkelOutDatum, Integer) forall k a. Map k a -Map.empty Map ValidatorHash (Versioned Validator) +Map.empty Map ValidatorHash (Versioned Validator) forall k a. Map k a -Map.empty Slot +Map.empty Slot forall a. Default a => a -def +def -instance Default MockChainSt where - def :: MockChainSt -def = MockChainSt +instance Default MockChainSt where + def :: MockChainSt +def = MockChainSt mockChainSt0 -utxoIndex0From :: InitialDistribution -> Ledger.UtxoIndex +utxoIndex0From :: InitialDistribution -> Ledger.UtxoIndex utxoIndex0From :: InitialDistribution -> UtxoIndex -utxoIndex0From InitialDistribution -i0 = Blockchain -> UtxoIndex -Ledger.initialise [[CardanoTx -> OnChainTx -Ledger.Valid (CardanoTx -> OnChainTx) -> CardanoTx -> OnChainTx +utxoIndex0From InitialDistribution +i0 = Blockchain -> UtxoIndex +Ledger.initialise [[CardanoTx -> OnChainTx +Ledger.Valid (CardanoTx -> OnChainTx) -> CardanoTx -> OnChainTx forall a b. (a -> b) -> a -> b -$ InitialDistribution -> CardanoTx -initialTxFor InitialDistribution -i0]] +$ InitialDistribution -> CardanoTx +initialTxFor InitialDistribution +i0]] where -- Bootstraps an initial transaction resulting in a state where wallets -- possess UTxOs fitting a given 'InitialDistribution' - initialTxFor :: InitialDistribution -> Ledger.CardanoTx - initialTxFor :: InitialDistribution -> CardanoTx -initialTxFor InitialDistribution -initDist = Tx BabbageEra -> CardanoTx -Ledger.CardanoEmulatorEraTx (Tx BabbageEra -> CardanoTx) -> Tx BabbageEra -> CardanoTx + initialTxFor :: InitialDistribution -> Ledger.CardanoTx + initialTxFor :: InitialDistribution -> CardanoTx +initialTxFor InitialDistribution +initDist = Tx BabbageEra -> CardanoTx +Ledger.CardanoEmulatorEraTx (Tx BabbageEra -> CardanoTx) -> Tx BabbageEra -> CardanoTx forall a b. (a -> b) -> a -> b -$ TxBody BabbageEra -> [KeyWitness BabbageEra] -> Tx BabbageEra +$ TxBody BabbageEra -> [KeyWitness BabbageEra] -> Tx BabbageEra forall era. TxBody era -> [KeyWitness era] -> Tx era -C.Tx TxBody BabbageEra -body [] +C.Tx TxBody BabbageEra +body [] where - body :: C.TxBody C.BabbageEra - body :: TxBody BabbageEra -body = + body :: C.TxBody C.BabbageEra + body :: TxBody BabbageEra +body = Either TxBodyError (TxBody BabbageEra) -> TxBody BabbageEra forall e a. Show e => Either e a -> a -fromRight' (Either TxBodyError (TxBody BabbageEra) -> TxBody BabbageEra) +fromRight' (Either TxBodyError (TxBody BabbageEra) -> TxBody BabbageEra) -> Either TxBodyError (TxBody BabbageEra) -> TxBody BabbageEra forall a b. (a -> b) -> a -> b -$ +$ TxBodyContent BuildTx BabbageEra -> Either TxBodyError (TxBody BabbageEra) forall era. IsCardanoEra era => TxBodyContent BuildTx era -> Either TxBodyError (TxBody era) -C.makeTransactionBody (TxBodyContent BuildTx BabbageEra +C.makeTransactionBody (TxBodyContent BuildTx BabbageEra -> Either TxBodyError (TxBody BabbageEra)) -> TxBodyContent BuildTx BabbageEra -> Either TxBodyError (TxBody BabbageEra) forall a b. (a -> b) -> a -> b -$ +$ TxBodyContent BuildTx BabbageEra -Ledger.emptyTxBodyContent +Ledger.emptyTxBodyContent { txMintValue :: TxMintValue BuildTx BabbageEra -C.txMintValue = +C.txMintValue = (Value -> BuildTxWith BuildTx (Map PolicyId (ScriptWitness WitCtxMint BabbageEra)) @@ -1116,7 +1116,7 @@ -> Value -> TxMintValue BuildTx BabbageEra forall a b c. (a -> b -> c) -> b -> a -> c -flip (MultiAssetSupportedInEra BabbageEra +flip (MultiAssetSupportedInEra BabbageEra -> Value -> BuildTxWith BuildTx (Map PolicyId (ScriptWitness WitCtxMint BabbageEra)) @@ -1126,321 +1126,321 @@ -> Value -> BuildTxWith build (Map PolicyId (ScriptWitness WitCtxMint era)) -> TxMintValue build era -C.TxMintValue MultiAssetSupportedInEra BabbageEra -C.MultiAssetInBabbageEra) (Map PolicyId (ScriptWitness WitCtxMint BabbageEra) +C.TxMintValue MultiAssetSupportedInEra BabbageEra +C.MultiAssetInBabbageEra) (Map PolicyId (ScriptWitness WitCtxMint BabbageEra) -> BuildTxWith BuildTx (Map PolicyId (ScriptWitness WitCtxMint BabbageEra)) forall a. a -> BuildTxWith BuildTx a -C.BuildTxWith Map PolicyId (ScriptWitness WitCtxMint BabbageEra) +C.BuildTxWith Map PolicyId (ScriptWitness WitCtxMint BabbageEra) forall a. Monoid a => a -mempty) +mempty) (Value -> TxMintValue BuildTx BabbageEra) -> (Value -> Value) -> Value -> TxMintValue BuildTx BabbageEra forall b c a. (b -> c) -> (a -> b) -> a -> c -. (AssetId -> Bool) -> Value -> Value -C.filterValue (AssetId -> AssetId -> Bool +. (AssetId -> Bool) -> Value -> Value +C.filterValue (AssetId -> AssetId -> Bool forall a. Eq a => a -> a -> Bool -/= AssetId -C.AdaAssetId) +/= AssetId +C.AdaAssetId) (Value -> Value) -> (Value -> Value) -> Value -> Value forall b c a. (b -> c) -> (a -> b) -> a -> c -. Either ToCardanoError Value -> Value +. Either ToCardanoError Value -> Value forall e a. Show e => Either e a -> a -fromRight' +fromRight' (Either ToCardanoError Value -> Value) -> (Value -> Either ToCardanoError Value) -> Value -> Value forall b c a. (b -> c) -> (a -> b) -> a -> c -. Value -> Either ToCardanoError Value -Ledger.toCardanoValue +. Value -> Either ToCardanoError Value +Ledger.toCardanoValue (Value -> TxMintValue BuildTx BabbageEra) -> Value -> TxMintValue BuildTx BabbageEra forall a b. (a -> b) -> a -> b -$ [Value] -> Value +$ [Value] -> Value forall a. Monoid a => [a] -> a -mconcat (((Wallet, [Value]) -> Value) -> [(Wallet, [Value])] -> [Value] +mconcat (((Wallet, [Value]) -> Value) -> [(Wallet, [Value])] -> [Value] forall a b. (a -> b) -> [a] -> [b] -map ([Value] -> Value +map ([Value] -> Value forall a. Monoid a => [a] -> a -mconcat ([Value] -> Value) +mconcat ([Value] -> Value) -> ((Wallet, [Value]) -> [Value]) -> (Wallet, [Value]) -> Value forall b c a. (b -> c) -> (a -> b) -> a -> c -. (Wallet, [Value]) -> [Value] +. (Wallet, [Value]) -> [Value] forall a b. (a, b) -> b -snd) [(Wallet, [Value])] -initDist'), +snd) [(Wallet, [Value])] +initDist'), txOuts :: [TxOut CtxTx BabbageEra] -C.txOuts = ((Wallet, [Value]) -> [TxOut CtxTx BabbageEra]) +C.txOuts = ((Wallet, [Value]) -> [TxOut CtxTx BabbageEra]) -> [(Wallet, [Value])] -> [TxOut CtxTx BabbageEra] forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b] -concatMap (\(Wallet -w, [Value] -vs) -> (Value -> TxOut CtxTx BabbageEra) +concatMap (\(Wallet +w, [Value] +vs) -> (Value -> TxOut CtxTx BabbageEra) -> [Value] -> [TxOut CtxTx BabbageEra] forall a b. (a -> b) -> [a] -> [b] -map (Wallet -> Value -> TxOut CtxTx BabbageEra -initUtxosFor Wallet -w) [Value] -vs) [(Wallet, [Value])] -initDist', +map (Wallet -> Value -> TxOut CtxTx BabbageEra +initUtxosFor Wallet +w) [Value] +vs) [(Wallet, [Value])] +initDist', txIns :: TxIns BuildTx BabbageEra -C.txIns = [(NetworkId -> Hash GenesisUTxOKey -> TxIn -C.genesisUTxOPseudoTxIn NetworkId -theNetworkId Hash GenesisUTxOKey -genesisKeyHash, Witness WitCtxTxIn BabbageEra +C.txIns = [(NetworkId -> Hash GenesisUTxOKey -> TxIn +C.genesisUTxOPseudoTxIn NetworkId +theNetworkId Hash GenesisUTxOKey +genesisKeyHash, Witness WitCtxTxIn BabbageEra -> BuildTxWith BuildTx (Witness WitCtxTxIn BabbageEra) forall a. a -> BuildTxWith BuildTx a -C.BuildTxWith Witness WitCtxTxIn BabbageEra +C.BuildTxWith Witness WitCtxTxIn BabbageEra forall era. Witness WitCtxTxIn era -spendWit)] +spendWit)] } - spendWit :: Witness WitCtxTxIn era -spendWit = KeyWitnessInCtx WitCtxTxIn -> Witness WitCtxTxIn era + spendWit :: Witness WitCtxTxIn era +spendWit = KeyWitnessInCtx WitCtxTxIn -> Witness WitCtxTxIn era forall witctx era. KeyWitnessInCtx witctx -> Witness witctx era -C.KeyWitness KeyWitnessInCtx WitCtxTxIn -C.KeyWitnessForSpending +C.KeyWitness KeyWitnessInCtx WitCtxTxIn +C.KeyWitnessForSpending -- This has been taken from the Test.Cardano.Api.Genesis example transaction here: -- https://github.com/input-output-hk/cardano-node/blob/543b267d75d3d448e1940f9ec04b42bd01bbb16b/cardano-api/test/Test/Cardano/Api/Genesis.hs#L60 - genesisKeyHash :: C.Hash C.GenesisUTxOKey - genesisKeyHash :: Hash GenesisUTxOKey -genesisKeyHash = + genesisKeyHash :: C.Hash C.GenesisUTxOKey + genesisKeyHash :: Hash GenesisUTxOKey +genesisKeyHash = KeyHash 'Payment StandardCrypto -> Hash GenesisUTxOKey -C.GenesisUTxOKeyHash (KeyHash 'Payment StandardCrypto -> Hash GenesisUTxOKey) +C.GenesisUTxOKeyHash (KeyHash 'Payment StandardCrypto -> Hash GenesisUTxOKey) -> KeyHash 'Payment StandardCrypto -> Hash GenesisUTxOKey forall a b. (a -> b) -> a -> b -$ +$ Hash (ADDRHASH StandardCrypto) (VerKeyDSIGN (DSIGN StandardCrypto)) -> KeyHash 'Payment StandardCrypto forall (discriminator :: KeyRole) crypto. Hash (ADDRHASH crypto) (VerKeyDSIGN (DSIGN crypto)) -> KeyHash discriminator crypto -CardanoLedger.KeyHash (Hash +CardanoLedger.KeyHash (Hash (ADDRHASH StandardCrypto) (VerKeyDSIGN (DSIGN StandardCrypto)) -> KeyHash 'Payment StandardCrypto) -> Hash (ADDRHASH StandardCrypto) (VerKeyDSIGN (DSIGN StandardCrypto)) -> KeyHash 'Payment StandardCrypto forall a b. (a -> b) -> a -> b -$ +$ Hash (ADDRHASH StandardCrypto) (VerKeyDSIGN (DSIGN StandardCrypto)) "23d51e91ae5adc7ae801e9de4cd54175fb7464ec2680b25686bbb194" - initDist' :: [(Wallet, [Value])] -initDist' = Map Wallet [Value] -> [(Wallet, [Value])] + initDist' :: [(Wallet, [Value])] +initDist' = Map Wallet [Value] -> [(Wallet, [Value])] forall k a. Map k a -> [(k, a)] -Map.toList (Map Wallet [Value] -> [(Wallet, [Value])]) +Map.toList (Map Wallet [Value] -> [(Wallet, [Value])]) -> Map Wallet [Value] -> [(Wallet, [Value])] forall a b. (a -> b) -> a -> b -$ InitialDistribution -> Map Wallet [Value] +$ InitialDistribution -> Map Wallet [Value] unInitialDistribution InitialDistribution -initDist +initDist - initUtxosFor :: Wallet -> Value -> TxOut CtxTx BabbageEra -initUtxosFor Wallet -w Value -v = Address -> Value -> Maybe () -> TxOut CtxTx BabbageEra + initUtxosFor :: Wallet -> Value -> TxOut CtxTx BabbageEra +initUtxosFor Wallet +w Value +v = Address -> Value -> Maybe () -> TxOut CtxTx BabbageEra forall a. ToData a => Address -> Value -> Maybe a -> TxOut CtxTx BabbageEra -txOut (Wallet -> Address +txOut (Wallet -> Address walletAddress Wallet -w) Value -v (Maybe () +w) Value +v (Maybe () forall a. Maybe a -Nothing @()) +Nothing @()) - fromRight' :: Show e => Either e a -> a - fromRight' :: Either e a -> a -fromRight' Either e a -x = case Either e a -x of - Left e -err -> String -> a + fromRight' :: (Show e) => Either e a -> a + fromRight' :: Either e a -> a +fromRight' Either e a +x = case Either e a +x of + Left e +err -> String -> a forall a. HasCallStack => String -> a -error (String -> a) -> String -> a +error (String -> a) -> String -> a forall a b. (a -> b) -> a -> b -$ e -> String +$ e -> String forall a. Show a => a -> String -show e -err - Right a -res -> a -res +show e +err + Right a +res -> a +res - txOut :: Address -> Value -> Maybe a -> TxOut CtxTx BabbageEra -txOut Address -addr Value -value Maybe a -datum = Address -> Value -> OutputDatum -> TxOut CtxTx BabbageEra -toCardanoTxOut' Address -addr Value -value OutputDatum -datum' + txOut :: Address -> Value -> Maybe a -> TxOut CtxTx BabbageEra +txOut Address +addr Value +value Maybe a +datum = Address -> Value -> OutputDatum -> TxOut CtxTx BabbageEra +toCardanoTxOut' Address +addr Value +value OutputDatum +datum' where - datum' :: OutputDatum -datum' = + datum' :: OutputDatum +datum' = OutputDatum -> (a -> OutputDatum) -> Maybe a -> OutputDatum forall b a. b -> (a -> b) -> Maybe a -> b -maybe +maybe OutputDatum -PV2.NoOutputDatum +PV2.NoOutputDatum ( DatumHash -> OutputDatum -PV2.OutputDatumHash +PV2.OutputDatumHash (DatumHash -> OutputDatum) -> (a -> DatumHash) -> a -> OutputDatum forall b c a. (b -> c) -> (a -> b) -> a -> c -. Datum -> DatumHash -Pl.datumHash +. Datum -> DatumHash +Pl.datumHash (Datum -> DatumHash) -> (a -> Datum) -> a -> DatumHash forall b c a. (b -> c) -> (a -> b) -> a -> c -. BuiltinData -> Datum -Pl.Datum +. BuiltinData -> Datum +Pl.Datum (BuiltinData -> Datum) -> (a -> BuiltinData) -> a -> Datum forall b c a. (b -> c) -> (a -> b) -> a -> c -. a -> BuiltinData +. a -> BuiltinData forall a. ToData a => a -> BuiltinData -Pl.toBuiltinData +Pl.toBuiltinData ) Maybe a -datum +datum - toCardanoTxOut' :: - Pl.Address -> - Pl.Value -> - PV2.OutputDatum -> - C.TxOut C.CtxTx C.BabbageEra - toCardanoTxOut' :: Address -> Value -> OutputDatum -> TxOut CtxTx BabbageEra -toCardanoTxOut' Address -addr Value -value OutputDatum -datum = + toCardanoTxOut' :: + Pl.Address -> + Pl.Value -> + PV2.OutputDatum -> + C.TxOut C.CtxTx C.BabbageEra + toCardanoTxOut' :: Address -> Value -> OutputDatum -> TxOut CtxTx BabbageEra +toCardanoTxOut' Address +addr Value +value OutputDatum +datum = Either ToCardanoError (TxOut CtxTx BabbageEra) -> TxOut CtxTx BabbageEra forall e a. Show e => Either e a -> a -fromRight' (Either ToCardanoError (TxOut CtxTx BabbageEra) +fromRight' (Either ToCardanoError (TxOut CtxTx BabbageEra) -> TxOut CtxTx BabbageEra) -> Either ToCardanoError (TxOut CtxTx BabbageEra) -> TxOut CtxTx BabbageEra forall a b. (a -> b) -> a -> b -$ +$ NetworkId -> TxOut -> Either ToCardanoError (TxOut CtxTx BabbageEra) -Ledger.toCardanoTxOut +Ledger.toCardanoTxOut NetworkId -theNetworkId +theNetworkId (Address -> Value -> OutputDatum -> Maybe ScriptHash -> TxOut -PV2.TxOut Address -addr Value -value OutputDatum -datum Maybe ScriptHash +PV2.TxOut Address +addr Value +value OutputDatum +datum Maybe ScriptHash forall a. Maybe a -Nothing) +Nothing) - theNetworkId :: C.NetworkId - theNetworkId :: NetworkId -theNetworkId = NetworkMagic -> NetworkId -C.Testnet (NetworkMagic -> NetworkId) -> NetworkMagic -> NetworkId + theNetworkId :: C.NetworkId + theNetworkId :: NetworkId +theNetworkId = NetworkMagic -> NetworkId +C.Testnet (NetworkMagic -> NetworkId) -> NetworkMagic -> NetworkId forall a b. (a -> b) -> a -> b -$ Word32 -> NetworkMagic -C.NetworkMagic Word32 +$ Word32 -> NetworkMagic +C.NetworkMagic Word32 42 -- TODO PORT what's magic? -utxoIndex0 :: Ledger.UtxoIndex +utxoIndex0 :: Ledger.UtxoIndex utxoIndex0 :: UtxoIndex utxoIndex0 = InitialDistribution -> UtxoIndex utxoIndex0From InitialDistribution forall a. Default a => a -def +def -- * Direct Interpretation of Operations -getIndex :: Ledger.UtxoIndex -> Map Pl.TxOutRef Ledger.TxOut +getIndex :: Ledger.UtxoIndex -> Map Pl.TxOutRef Ledger.TxOut getIndex :: UtxoIndex -> Map TxOutRef TxOut getIndex = [(TxOutRef, TxOut)] -> Map TxOutRef TxOut forall k a. Ord k => [(k, a)] -> Map k a -Map.fromList +Map.fromList ([(TxOutRef, TxOut)] -> Map TxOutRef TxOut) -> (UtxoIndex -> [(TxOutRef, TxOut)]) -> UtxoIndex -> Map TxOutRef TxOut forall b c a. (b -> c) -> (a -> b) -> a -> c -. ((TxIn, TxOut CtxUTxO BabbageEra) -> (TxOutRef, TxOut)) +. ((TxIn, TxOut CtxUTxO BabbageEra) -> (TxOutRef, TxOut)) -> [(TxIn, TxOut CtxUTxO BabbageEra)] -> [(TxOutRef, TxOut)] forall a b. (a -> b) -> [a] -> [b] -map (\(TxIn -k, TxOut CtxUTxO BabbageEra -v) -> (TxIn -> TxOutRef -Ledger.fromCardanoTxIn TxIn -k, TxOut CtxTx BabbageEra -> TxOut -Ledger.TxOut (TxOut CtxTx BabbageEra -> TxOut) +map (\(TxIn +k, TxOut CtxUTxO BabbageEra +v) -> (TxIn -> TxOutRef +Ledger.fromCardanoTxIn TxIn +k, TxOut CtxTx BabbageEra -> TxOut +Ledger.TxOut (TxOut CtxTx BabbageEra -> TxOut) -> (TxOut CtxUTxO BabbageEra -> TxOut CtxTx BabbageEra) -> TxOut CtxUTxO BabbageEra -> TxOut forall b c a. (b -> c) -> (a -> b) -> a -> c -. TxOut CtxUTxO BabbageEra -> TxOut CtxTx BabbageEra +. TxOut CtxUTxO BabbageEra -> TxOut CtxTx BabbageEra forall era. TxOut CtxUTxO era -> TxOut CtxTx era -toCtxTxTxOut (TxOut CtxUTxO BabbageEra -> TxOut) +toCtxTxTxOut (TxOut CtxUTxO BabbageEra -> TxOut) -> TxOut CtxUTxO BabbageEra -> TxOut forall a b. (a -> b) -> a -> b -$ TxOut CtxUTxO BabbageEra -v)) +$ TxOut CtxUTxO BabbageEra +v)) ([(TxIn, TxOut CtxUTxO BabbageEra)] -> [(TxOutRef, TxOut)]) -> (UtxoIndex -> [(TxIn, TxOut CtxUTxO BabbageEra)]) -> UtxoIndex -> [(TxOutRef, TxOut)] forall b c a. (b -> c) -> (a -> b) -> a -> c -. Map TxIn (TxOut CtxUTxO BabbageEra) +. Map TxIn (TxOut CtxUTxO BabbageEra) -> [(TxIn, TxOut CtxUTxO BabbageEra)] forall k a. Map k a -> [(k, a)] -Map.toList +Map.toList (Map TxIn (TxOut CtxUTxO BabbageEra) -> [(TxIn, TxOut CtxUTxO BabbageEra)]) -> (UtxoIndex -> Map TxIn (TxOut CtxUTxO BabbageEra)) -> UtxoIndex -> [(TxIn, TxOut CtxUTxO BabbageEra)] forall b c a. (b -> c) -> (a -> b) -> a -> c -. UtxoIndex -> Map TxIn (TxOut CtxUTxO BabbageEra) +. UtxoIndex -> Map TxIn (TxOut CtxUTxO BabbageEra) forall era. UTxO era -> Map TxIn (TxOut CtxUTxO era) -C.unUTxO +C.unUTxO where -- We need to convert a UTxO context TxOut to a Transaction context Tx out. -- One could be forgiven for thinking this exists somewhere, but I couldn't find -- it. It's this complicated because the datum type is indexed by the context. - toCtxTxTxOut :: C.TxOut C.CtxUTxO era -> C.TxOut C.CtxTx era - toCtxTxTxOut :: TxOut CtxUTxO era -> TxOut CtxTx era -toCtxTxTxOut (C.TxOut AddressInEra era -addr TxOutValue era -val TxOutDatum CtxUTxO era -d ReferenceScript era -refS) = - let dat :: TxOutDatum CtxTx era -dat = case TxOutDatum CtxUTxO era -d of + toCtxTxTxOut :: C.TxOut C.CtxUTxO era -> C.TxOut C.CtxTx era + toCtxTxTxOut :: TxOut CtxUTxO era -> TxOut CtxTx era +toCtxTxTxOut (C.TxOut AddressInEra era +addr TxOutValue era +val TxOutDatum CtxUTxO era +d ReferenceScript era +refS) = + let dat :: TxOutDatum CtxTx era +dat = case TxOutDatum CtxUTxO era +d of TxOutDatum CtxUTxO era -C.TxOutDatumNone -> TxOutDatum CtxTx era +C.TxOutDatumNone -> TxOutDatum CtxTx era forall ctx era. TxOutDatum ctx era -C.TxOutDatumNone - C.TxOutDatumHash ScriptDataSupportedInEra era -s Hash ScriptData -h -> ScriptDataSupportedInEra era +C.TxOutDatumNone + C.TxOutDatumHash ScriptDataSupportedInEra era +s Hash ScriptData +h -> ScriptDataSupportedInEra era -> Hash ScriptData -> TxOutDatum CtxTx era forall era ctx. ScriptDataSupportedInEra era -> Hash ScriptData -> TxOutDatum ctx era -C.TxOutDatumHash ScriptDataSupportedInEra era -s Hash ScriptData -h - C.TxOutDatumInline ReferenceTxInsScriptsInlineDatumsSupportedInEra era -s ScriptData -sd -> ReferenceTxInsScriptsInlineDatumsSupportedInEra era +C.TxOutDatumHash ScriptDataSupportedInEra era +s Hash ScriptData +h + C.TxOutDatumInline ReferenceTxInsScriptsInlineDatumsSupportedInEra era +s ScriptData +sd -> ReferenceTxInsScriptsInlineDatumsSupportedInEra era -> ScriptData -> TxOutDatum CtxTx era forall era ctx. ReferenceTxInsScriptsInlineDatumsSupportedInEra era -> ScriptData -> TxOutDatum ctx era -C.TxOutDatumInline ReferenceTxInsScriptsInlineDatumsSupportedInEra era -s ScriptData -sd +C.TxOutDatumInline ReferenceTxInsScriptsInlineDatumsSupportedInEra era +s ScriptData +sd in AddressInEra era -> TxOutValue era -> TxOutDatum CtxTx era @@ -1452,65 +1452,65 @@ -> TxOutDatum ctx era -> ReferenceScript era -> TxOut ctx era -C.TxOut AddressInEra era -addr TxOutValue era -val TxOutDatum CtxTx era -dat ReferenceScript era -refS +C.TxOut AddressInEra era +addr TxOutValue era +val TxOutDatum CtxTx era +dat ReferenceScript era +refS -instance Monad m => MonadBlockChainBalancing (MockChainT m) where - getParams :: MockChainT m Params +instance (Monad m) => MonadBlockChainBalancing (MockChainT m) where + getParams :: MockChainT m Params getParams = (MockChainEnv -> Params) -> MockChainT m Params forall r (m :: * -> *) a. MonadReader r m => (r -> a) -> m a -asks MockChainEnv -> Params +asks MockChainEnv -> Params mceParams - validatorFromHash :: ValidatorHash -> MockChainT m (Maybe (Versioned Validator)) -validatorFromHash ValidatorHash -valHash = (MockChainSt -> Maybe (Versioned Validator)) + validatorFromHash :: ValidatorHash -> MockChainT m (Maybe (Versioned Validator)) +validatorFromHash ValidatorHash +valHash = (MockChainSt -> Maybe (Versioned Validator)) -> MockChainT m (Maybe (Versioned Validator)) forall s (m :: * -> *) a. MonadState s m => (s -> a) -> m a -gets ((MockChainSt -> Maybe (Versioned Validator)) +gets ((MockChainSt -> Maybe (Versioned Validator)) -> MockChainT m (Maybe (Versioned Validator))) -> (MockChainSt -> Maybe (Versioned Validator)) -> MockChainT m (Maybe (Versioned Validator)) forall a b. (a -> b) -> a -> b -$ ValidatorHash +$ ValidatorHash -> Map ValidatorHash (Versioned Validator) -> Maybe (Versioned Validator) forall k a. Ord k => k -> Map k a -> Maybe a -Map.lookup ValidatorHash -valHash (Map ValidatorHash (Versioned Validator) +Map.lookup ValidatorHash +valHash (Map ValidatorHash (Versioned Validator) -> Maybe (Versioned Validator)) -> (MockChainSt -> Map ValidatorHash (Versioned Validator)) -> MockChainSt -> Maybe (Versioned Validator) forall b c a. (b -> c) -> (a -> b) -> a -> c -. MockChainSt -> Map ValidatorHash (Versioned Validator) +. MockChainSt -> Map ValidatorHash (Versioned Validator) mcstValidators - txOutByRefLedger :: TxOutRef -> MockChainT m (Maybe TxOut) -txOutByRefLedger TxOutRef -outref = (MockChainSt -> Maybe TxOut) -> MockChainT m (Maybe TxOut) + txOutByRefLedger :: TxOutRef -> MockChainT m (Maybe TxOut) +txOutByRefLedger TxOutRef +outref = (MockChainSt -> Maybe TxOut) -> MockChainT m (Maybe TxOut) forall s (m :: * -> *) a. MonadState s m => (s -> a) -> m a -gets ((MockChainSt -> Maybe TxOut) -> MockChainT m (Maybe TxOut)) +gets ((MockChainSt -> Maybe TxOut) -> MockChainT m (Maybe TxOut)) -> (MockChainSt -> Maybe TxOut) -> MockChainT m (Maybe TxOut) forall a b. (a -> b) -> a -> b -$ TxOutRef -> Map TxOutRef TxOut -> Maybe TxOut +$ TxOutRef -> Map TxOutRef TxOut -> Maybe TxOut forall k a. Ord k => k -> Map k a -> Maybe a -Map.lookup TxOutRef -outref (Map TxOutRef TxOut -> Maybe TxOut) +Map.lookup TxOutRef +outref (Map TxOutRef TxOut -> Maybe TxOut) -> (MockChainSt -> Map TxOutRef TxOut) -> MockChainSt -> Maybe TxOut forall b c a. (b -> c) -> (a -> b) -> a -> c -. UtxoIndex -> Map TxOutRef TxOut +. UtxoIndex -> Map TxOutRef TxOut getIndex (UtxoIndex -> Map TxOutRef TxOut) -> (MockChainSt -> UtxoIndex) -> MockChainSt -> Map TxOutRef TxOut forall b c a. (b -> c) -> (a -> b) -> a -> c -. MockChainSt -> UtxoIndex +. MockChainSt -> UtxoIndex mcstIndex - datumFromHash :: DatumHash -> MockChainT m (Maybe Datum) -datumFromHash DatumHash -datumHash = (TxSkelOutDatum -> Maybe Datum + datumFromHash :: DatumHash -> MockChainT m (Maybe Datum) +datumFromHash DatumHash +datumHash = (TxSkelOutDatum -> Maybe Datum txSkelOutUntypedDatum (TxSkelOutDatum -> Maybe Datum) -> (Map DatumHash (TxSkelOutDatum, Integer) -> Maybe TxSkelOutDatum) @@ -1519,16 +1519,16 @@ forall (m :: * -> *) b c a. Monad m => (b -> m c) -> (a -> m b) -> a -> m c -<=< TxSkelOutDatum -> Maybe TxSkelOutDatum +<=< TxSkelOutDatum -> Maybe TxSkelOutDatum forall a. a -> Maybe a -Just (TxSkelOutDatum -> Maybe TxSkelOutDatum) +Just (TxSkelOutDatum -> Maybe TxSkelOutDatum) -> ((TxSkelOutDatum, Integer) -> TxSkelOutDatum) -> (TxSkelOutDatum, Integer) -> Maybe TxSkelOutDatum forall b c a. (b -> c) -> (a -> b) -> a -> c -. (TxSkelOutDatum, Integer) -> TxSkelOutDatum +. (TxSkelOutDatum, Integer) -> TxSkelOutDatum forall a b. (a, b) -> a -fst ((TxSkelOutDatum, Integer) -> Maybe TxSkelOutDatum) +fst ((TxSkelOutDatum, Integer) -> Maybe TxSkelOutDatum) -> (Map DatumHash (TxSkelOutDatum, Integer) -> Maybe (TxSkelOutDatum, Integer)) -> Map DatumHash (TxSkelOutDatum, Integer) @@ -1536,149 +1536,149 @@ forall (m :: * -> *) b c a. Monad m => (b -> m c) -> (a -> m b) -> a -> m c -<=< DatumHash +<=< DatumHash -> Map DatumHash (TxSkelOutDatum, Integer) -> Maybe (TxSkelOutDatum, Integer) forall k a. Ord k => k -> Map k a -> Maybe a -Map.lookup DatumHash -datumHash) (Map DatumHash (TxSkelOutDatum, Integer) -> Maybe Datum) +Map.lookup DatumHash +datumHash) (Map DatumHash (TxSkelOutDatum, Integer) -> Maybe Datum) -> MockChainT m (Map DatumHash (TxSkelOutDatum, Integer)) -> MockChainT m (Maybe Datum) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b -<$> (MockChainSt -> Map DatumHash (TxSkelOutDatum, Integer)) +<$> (MockChainSt -> Map DatumHash (TxSkelOutDatum, Integer)) -> MockChainT m (Map DatumHash (TxSkelOutDatum, Integer)) forall s (m :: * -> *) a. MonadState s m => (s -> a) -> m a -gets MockChainSt -> Map DatumHash (TxSkelOutDatum, Integer) +gets MockChainSt -> Map DatumHash (TxSkelOutDatum, Integer) mcstDatums - utxosAtLedger :: Address -> MockChainT m [(TxOutRef, TxOut)] -utxosAtLedger Address -addr = ((TxOutRef, TxOut) -> Bool) + utxosAtLedger :: Address -> MockChainT m [(TxOutRef, TxOut)] +utxosAtLedger Address +addr = ((TxOutRef, TxOut) -> Bool) -> [(TxOutRef, TxOut)] -> [(TxOutRef, TxOut)] forall a. (a -> Bool) -> [a] -> [a] -filter ((Address -addr Address -> Address -> Bool +filter ((Address +addr Address -> Address -> Bool forall a. Eq a => a -> a -> Bool -==) (Address -> Bool) +==) (Address -> Bool) -> ((TxOutRef, TxOut) -> Address) -> (TxOutRef, TxOut) -> Bool forall b c a. (b -> c) -> (a -> b) -> a -> c -. TxOut -> Address +. TxOut -> Address forall o. (IsAbstractOutput o, ToCredential (OwnerType o)) => o -> Address outputAddress (TxOut -> Address) -> ((TxOutRef, TxOut) -> TxOut) -> (TxOutRef, TxOut) -> Address forall b c a. (b -> c) -> (a -> b) -> a -> c -. TxOut -> TxOut +. TxOut -> TxOut txOutV2FromLedger (TxOut -> TxOut) -> ((TxOutRef, TxOut) -> TxOut) -> (TxOutRef, TxOut) -> TxOut forall b c a. (b -> c) -> (a -> b) -> a -> c -. (TxOutRef, TxOut) -> TxOut +. (TxOutRef, TxOut) -> TxOut forall a b. (a, b) -> b -snd) ([(TxOutRef, TxOut)] -> [(TxOutRef, TxOut)]) +snd) ([(TxOutRef, TxOut)] -> [(TxOutRef, TxOut)]) -> MockChainT m [(TxOutRef, TxOut)] -> MockChainT m [(TxOutRef, TxOut)] forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b -<$> MockChainT m [(TxOutRef, TxOut)] +<$> MockChainT m [(TxOutRef, TxOut)] forall (m :: * -> *). MonadBlockChainWithoutValidation m => m [(TxOutRef, TxOut)] allUtxosLedger -instance Monad m => MonadBlockChainWithoutValidation (MockChainT m) where - allUtxosLedger :: MockChainT m [(TxOutRef, TxOut)] -allUtxosLedger = (MockChainSt -> [(TxOutRef, TxOut)]) +instance (Monad m) => MonadBlockChainWithoutValidation (MockChainT m) where + allUtxosLedger :: MockChainT m [(TxOutRef, TxOut)] +allUtxosLedger = (MockChainSt -> [(TxOutRef, TxOut)]) -> MockChainT m [(TxOutRef, TxOut)] forall s (m :: * -> *) a. MonadState s m => (s -> a) -> m a -gets ((MockChainSt -> [(TxOutRef, TxOut)]) +gets ((MockChainSt -> [(TxOutRef, TxOut)]) -> MockChainT m [(TxOutRef, TxOut)]) -> (MockChainSt -> [(TxOutRef, TxOut)]) -> MockChainT m [(TxOutRef, TxOut)] forall a b. (a -> b) -> a -> b -$ Map TxOutRef TxOut -> [(TxOutRef, TxOut)] +$ Map TxOutRef TxOut -> [(TxOutRef, TxOut)] forall k a. Map k a -> [(k, a)] -Map.toList (Map TxOutRef TxOut -> [(TxOutRef, TxOut)]) +Map.toList (Map TxOutRef TxOut -> [(TxOutRef, TxOut)]) -> (MockChainSt -> Map TxOutRef TxOut) -> MockChainSt -> [(TxOutRef, TxOut)] forall b c a. (b -> c) -> (a -> b) -> a -> c -. UtxoIndex -> Map TxOutRef TxOut +. UtxoIndex -> Map TxOutRef TxOut getIndex (UtxoIndex -> Map TxOutRef TxOut) -> (MockChainSt -> UtxoIndex) -> MockChainSt -> Map TxOutRef TxOut forall b c a. (b -> c) -> (a -> b) -> a -> c -. MockChainSt -> UtxoIndex +. MockChainSt -> UtxoIndex mcstIndex - currentSlot :: MockChainT m Slot + currentSlot :: MockChainT m Slot currentSlot = (MockChainSt -> Slot) -> MockChainT m Slot forall s (m :: * -> *) a. MonadState s m => (s -> a) -> m a -gets MockChainSt -> Slot +gets MockChainSt -> Slot mcstCurrentSlot - awaitSlot :: Slot -> MockChainT m Slot -awaitSlot Slot -s = (MockChainSt -> MockChainSt) -> MockChainT m () + awaitSlot :: Slot -> MockChainT m Slot +awaitSlot Slot +s = (MockChainSt -> MockChainSt) -> MockChainT m () forall s (m :: * -> *). MonadState s m => (s -> s) -> m () -modify' (\MockChainSt -st -> MockChainSt -st {mcstCurrentSlot :: Slot +modify' (\MockChainSt +st -> MockChainSt +st {mcstCurrentSlot :: Slot mcstCurrentSlot = Slot -> Slot -> Slot forall a. Ord a => a -> a -> a -max Slot -s (MockChainSt -> Slot +max Slot +s (MockChainSt -> Slot mcstCurrentSlot MockChainSt -st)}) MockChainT m () -> MockChainT m Slot -> MockChainT m Slot +st)}) MockChainT m () -> MockChainT m Slot -> MockChainT m Slot forall (m :: * -> *) a b. Monad m => m a -> m b -> m b ->> MockChainT m Slot +>> MockChainT m Slot forall (m :: * -> *). MonadBlockChainWithoutValidation m => m Slot currentSlot -instance Monad m => MonadBlockChain (MockChainT m) where - validateTxSkel :: TxSkel -> MockChainT m CardanoTx -validateTxSkel TxSkel -skelUnbal = do - (TxSkel -skel, Fee -fee, Set TxOutRef -collateralInputs) <- TxSkel -> MockChainT m (TxSkel, Fee, Set TxOutRef) +instance (Monad m) => MonadBlockChain (MockChainT m) where + validateTxSkel :: TxSkel -> MockChainT m CardanoTx +validateTxSkel TxSkel +skelUnbal = do + (TxSkel +skel, Fee +fee, Set TxOutRef +collateralInputs) <- TxSkel -> MockChainT m (TxSkel, Fee, Set TxOutRef) forall (m :: * -> *). MonadBlockChainBalancing m => TxSkel -> m (TxSkel, Fee, Set TxOutRef) balancedTxSkel TxSkel -skelUnbal - Tx BabbageEra -tx <- (TxSkel, Fee, Set TxOutRef) -> MockChainT m (Tx BabbageEra) +skelUnbal + Tx BabbageEra +tx <- (TxSkel, Fee, Set TxOutRef) -> MockChainT m (Tx BabbageEra) forall (m :: * -> *). MonadBlockChainBalancing m => (TxSkel, Fee, Set TxOutRef) -> m (Tx BabbageEra) balancedTx (TxSkel -skel, Fee -fee, Set TxOutRef -collateralInputs) - Map DatumHash Datum -consumedData <- TxSkel -> MockChainT m (Map DatumHash Datum) +skel, Fee +fee, Set TxOutRef +collateralInputs) + Map DatumHash Datum +consumedData <- TxSkel -> MockChainT m (Map DatumHash Datum) forall (m :: * -> *). MonadBlockChainBalancing m => TxSkel -> m (Map DatumHash Datum) txSkelInputData TxSkel -skel - Params -theParams <- Maybe EmulatorParamsModification -> Params -> Params +skel + Params +theParams <- Maybe EmulatorParamsModification -> Params -> Params applyEmulatorParamsModification (TxOpts -> Maybe EmulatorParamsModification txOptEmulatorParamsModification (TxOpts -> Maybe EmulatorParamsModification) -> (TxSkel -> TxOpts) -> TxSkel -> Maybe EmulatorParamsModification forall b c a. (b -> c) -> (a -> b) -> a -> c -. TxSkel -> TxOpts +. TxSkel -> TxOpts txSkelOpts (TxSkel -> Maybe EmulatorParamsModification) -> TxSkel -> Maybe EmulatorParamsModification forall a b. (a -> b) -> a -> b -$ TxSkel -skel) (Params -> Params) -> MockChainT m Params -> MockChainT m Params +$ TxSkel +skel) (Params -> Params) -> MockChainT m Params -> MockChainT m Params forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b -<$> MockChainT m Params +<$> MockChainT m Params forall (m :: * -> *). MonadBlockChainBalancing m => m Params getParams - CardanoTx -someCardanoTx <- + CardanoTx +someCardanoTx <- Params -> Tx BabbageEra -> [RawModTx] @@ -1697,74 +1697,74 @@ -> MockChainT m CardanoTx runTransactionValidation Params -theParams +theParams Tx BabbageEra -tx +tx (TxOpts -> [RawModTx] txOptUnsafeModTx (TxOpts -> [RawModTx]) -> TxOpts -> [RawModTx] forall a b. (a -> b) -> a -> b -$ TxSkel -> TxOpts +$ TxSkel -> TxOpts txSkelOpts TxSkel -skel) +skel) Map DatumHash Datum -consumedData +consumedData (TxSkel -> Map DatumHash TxSkelOutDatum txSkelOutputData TxSkel -skel) +skel) (TxSkel -> Map ValidatorHash (Versioned Validator) txSkelOutValidators TxSkel -skel Map ValidatorHash (Versioned Validator) +skel Map ValidatorHash (Versioned Validator) -> Map ValidatorHash (Versioned Validator) -> Map ValidatorHash (Versioned Validator) forall a. Semigroup a => a -> a -> a -<> TxSkel -> Map ValidatorHash (Versioned Validator) +<> TxSkel -> Map ValidatorHash (Versioned Validator) txSkelOutReferenceScripts TxSkel -skel) +skel) Bool -> MockChainT m () -> MockChainT m () forall (f :: * -> *). Applicative f => Bool -> f () -> f () -when (TxOpts -> Bool +when (TxOpts -> Bool txOptAutoSlotIncrease (TxOpts -> Bool) -> TxOpts -> Bool forall a b. (a -> b) -> a -> b -$ TxSkel -> TxOpts +$ TxSkel -> TxOpts txSkelOpts TxSkel -skel) (MockChainT m () -> MockChainT m ()) +skel) (MockChainT m () -> MockChainT m ()) -> MockChainT m () -> MockChainT m () forall a b. (a -> b) -> a -> b -$ +$ (MockChainSt -> MockChainSt) -> MockChainT m () forall s (m :: * -> *). MonadState s m => (s -> s) -> m () -modify' (\MockChainSt -st -> MockChainSt -st {mcstCurrentSlot :: Slot +modify' (\MockChainSt +st -> MockChainSt +st {mcstCurrentSlot :: Slot mcstCurrentSlot = MockChainSt -> Slot mcstCurrentSlot MockChainSt -st Slot -> Slot -> Slot +st Slot -> Slot -> Slot forall a. Num a => a -> a -> a -+ Slot ++ Slot 1}) CardanoTx -> MockChainT m CardanoTx forall (m :: * -> *) a. Monad m => a -> m a -return CardanoTx -someCardanoTx +return CardanoTx +someCardanoTx -runTransactionValidation :: - Monad m => +runTransactionValidation :: + (Monad m) => -- | The emulator parameters to use. They might have been changed by the 'txOptEmulatorParamsModification'. - Emulator.Params -> + Emulator.Params -> -- | The transaction to validate. It should already be balanced, and include -- appropriate fees and collateral. - C.Tx C.BabbageEra -> + C.Tx C.BabbageEra -> -- | Modifications to apply to the transaction right before it is submitted. [RawModTx] -> -- | The data consumed by the transaction - Map Pl.DatumHash Pl.Datum -> + Map Pl.DatumHash Pl.Datum -> -- | The data produced by the transaction - Map Pl.DatumHash TxSkelOutDatum -> + Map Pl.DatumHash TxSkelOutDatum -> -- | The validators protecting transaction outputs, and the validators in the -- reference script field of transaction outputs. The 'MockChain' will -- remember them. - Map Pl.ValidatorHash (Pl.Versioned Pl.Validator) -> - MockChainT m Ledger.CardanoTx + Map Pl.ValidatorHash (Pl.Versioned Pl.Validator) -> + MockChainT m Ledger.CardanoTx runTransactionValidation :: Params -> Tx BabbageEra -> [RawModTx] @@ -1772,81 +1772,81 @@ -> Map DatumHash TxSkelOutDatum -> Map ValidatorHash (Versioned Validator) -> MockChainT m CardanoTx -runTransactionValidation Params -theParams Tx BabbageEra -cardanoTx [RawModTx] -rawModTx Map DatumHash Datum -consumedData Map DatumHash TxSkelOutDatum -producedData Map ValidatorHash (Versioned Validator) -outputValidators = do - UtxoIndex -utxoIndex <- (MockChainSt -> UtxoIndex) -> MockChainT m UtxoIndex +runTransactionValidation Params +theParams Tx BabbageEra +cardanoTx [RawModTx] +rawModTx Map DatumHash Datum +consumedData Map DatumHash TxSkelOutDatum +producedData Map ValidatorHash (Versioned Validator) +outputValidators = do + UtxoIndex +utxoIndex <- (MockChainSt -> UtxoIndex) -> MockChainT m UtxoIndex forall s (m :: * -> *) a. MonadState s m => (s -> a) -> m a -gets MockChainSt -> UtxoIndex +gets MockChainSt -> UtxoIndex mcstIndex - Slot -theSlot <- MockChainT m Slot + Slot +theSlot <- MockChainT m Slot forall (m :: * -> *). MonadBlockChainWithoutValidation m => m Slot currentSlot - let cardanoIndex :: CardanoLedger.UTxO Emulator.EmulatorEra - cardanoIndex :: UTxO EmulatorEra -cardanoIndex = UtxoIndex -> UTxO EmulatorEra -Ledger.fromPlutusIndex UtxoIndex -utxoIndex + let cardanoIndex :: CardanoLedger.UTxO Emulator.EmulatorEra + cardanoIndex :: UTxO EmulatorEra +cardanoIndex = UtxoIndex -> UTxO EmulatorEra +Ledger.fromPlutusIndex UtxoIndex +utxoIndex -- "Ledger.CardanoTx" is a plutus-apps type 'Tx BabbageEra' is a -- cardano-api type with the information we need. This wraps the latter -- inside the former. - txWrapped :: Ledger.CardanoTx - txWrapped :: CardanoTx -txWrapped = Tx BabbageEra -> CardanoTx -Ledger.CardanoEmulatorEraTx Tx BabbageEra -cardanoTx + txWrapped :: Ledger.CardanoTx + txWrapped :: CardanoTx +txWrapped = Tx BabbageEra -> CardanoTx +Ledger.CardanoEmulatorEraTx Tx BabbageEra +cardanoTx - mValidationError :: Either Ledger.ValidationErrorInPhase Ledger.ValidationSuccess - mValidationError :: Either ValidationErrorInPhase ValidationSuccess -mValidationError = Params + mValidationError :: Either Ledger.ValidationErrorInPhase Ledger.ValidationSuccess + mValidationError :: Either ValidationErrorInPhase ValidationSuccess +mValidationError = Params -> Slot -> UTxO EmulatorEra -> CardanoTx -> Either ValidationErrorInPhase ValidationSuccess -Emulator.validateCardanoTx Params -theParams Slot -theSlot UTxO EmulatorEra -cardanoIndex CardanoTx -txWrapped +Emulator.validateCardanoTx Params +theParams Slot +theSlot UTxO EmulatorEra +cardanoIndex CardanoTx +txWrapped - newUtxoIndex :: Ledger.UtxoIndex - newUtxoIndex :: UtxoIndex -newUtxoIndex = case Either ValidationErrorInPhase ValidationSuccess -mValidationError of - Left (ValidationPhase -Ledger.Phase1, ValidationError + newUtxoIndex :: Ledger.UtxoIndex + newUtxoIndex :: UtxoIndex +newUtxoIndex = case Either ValidationErrorInPhase ValidationSuccess +mValidationError of + Left (ValidationPhase +Ledger.Phase1, ValidationError _) -> UtxoIndex -utxoIndex - Left (ValidationPhase -Ledger.Phase2, ValidationError +utxoIndex + Left (ValidationPhase +Ledger.Phase2, ValidationError _) -> -- Despite its name, this actually deletes the collateral UTxOs from -- the index CardanoTx -> UtxoIndex -> UtxoIndex -Ledger.insertCollateral CardanoTx -txWrapped UtxoIndex -utxoIndex - Right ValidationSuccess +Ledger.insertCollateral CardanoTx +txWrapped UtxoIndex +utxoIndex + Right ValidationSuccess _ -> CardanoTx -> UtxoIndex -> UtxoIndex -Ledger.insert CardanoTx -txWrapped UtxoIndex -utxoIndex +Ledger.insert CardanoTx +txWrapped UtxoIndex +utxoIndex case Either ValidationErrorInPhase ValidationSuccess -mValidationError of - Left ValidationErrorInPhase -err -> MockChainError -> MockChainT m CardanoTx +mValidationError of + Left ValidationErrorInPhase +err -> MockChainError -> MockChainT m CardanoTx forall e (m :: * -> *) a. MonadError e m => e -> m a -throwError (ValidationErrorInPhase -> MockChainError +throwError (ValidationErrorInPhase -> MockChainError MCEValidationError ValidationErrorInPhase -err) - Right ValidationSuccess +err) + Right ValidationSuccess _ -> do -- Validation succeeded; now we update the UTxO index, the managed -- datums, and the managed Validators. The new mcstIndex is just @@ -1855,79 +1855,79 @@ -- consumed (or reducing their count in the 'mcstDatums'). (MockChainSt -> MockChainSt) -> MockChainT m () forall s (m :: * -> *). MonadState s m => (s -> s) -> m () -modify' - ( \MockChainSt -st -> +modify' + ( \MockChainSt +st -> MockChainSt -st +st { mcstIndex :: UtxoIndex mcstIndex = UtxoIndex -newUtxoIndex, +newUtxoIndex, mcstDatums :: Map DatumHash (TxSkelOutDatum, Integer) mcstDatums = (MockChainSt -> Map DatumHash (TxSkelOutDatum, Integer) mcstDatums MockChainSt -st Map DatumHash (TxSkelOutDatum, Integer) +st Map DatumHash (TxSkelOutDatum, Integer) -> Map DatumHash Datum -> Map DatumHash (TxSkelOutDatum, Integer) forall a b. Map DatumHash (a, Integer) -> Map DatumHash b -> Map DatumHash (a, Integer) -`removeMcstDatums` Map DatumHash Datum -consumedData) Map DatumHash (TxSkelOutDatum, Integer) +`removeMcstDatums` Map DatumHash Datum +consumedData) Map DatumHash (TxSkelOutDatum, Integer) -> Map DatumHash TxSkelOutDatum -> Map DatumHash (TxSkelOutDatum, Integer) forall k a a. (Ord k, Num a) => Map k (a, a) -> Map k a -> Map k (a, a) -`addMcstDatums` Map DatumHash TxSkelOutDatum -producedData, +`addMcstDatums` Map DatumHash TxSkelOutDatum +producedData, mcstValidators :: Map ValidatorHash (Versioned Validator) mcstValidators = MockChainSt -> Map ValidatorHash (Versioned Validator) mcstValidators MockChainSt -st Map ValidatorHash (Versioned Validator) +st Map ValidatorHash (Versioned Validator) -> Map ValidatorHash (Versioned Validator) -> Map ValidatorHash (Versioned Validator) forall k a. Ord k => Map k a -> Map k a -> Map k a -`Map.union` Map ValidatorHash (Versioned Validator) -outputValidators +`Map.union` Map ValidatorHash (Versioned Validator) +outputValidators } ) CardanoTx -> MockChainT m CardanoTx forall (m :: * -> *) a. Monad m => a -> m a -return (Tx BabbageEra -> CardanoTx -Ledger.CardanoEmulatorEraTx Tx BabbageEra -cardanoTx) +return (Tx BabbageEra -> CardanoTx +Ledger.CardanoEmulatorEraTx Tx BabbageEra +cardanoTx) where - addMcstDatums :: Map k (a, a) -> Map k a -> Map k (a, a) -addMcstDatums Map k (a, a) -stored Map k a -new = ((a, a) -> (a, a) -> (a, a)) + addMcstDatums :: Map k (a, a) -> Map k a -> Map k (a, a) +addMcstDatums Map k (a, a) +stored Map k a +new = ((a, a) -> (a, a) -> (a, a)) -> Map k (a, a) -> Map k (a, a) -> Map k (a, a) forall k a. Ord k => (a -> a -> a) -> Map k a -> Map k a -> Map k a -Map.unionWith (\(a -d, a -n1) (a -_, a -n2) -> (a -d, a -n1 a -> a -> a +Map.unionWith (\(a +d, a +n1) (a +_, a +n2) -> (a +d, a +n1 a -> a -> a forall a. Num a => a -> a -> a -+ a -n2)) Map k (a, a) -stored ((a -> (a, a)) -> Map k a -> Map k (a, a) ++ a +n2)) Map k (a, a) +stored ((a -> (a, a)) -> Map k a -> Map k (a, a) forall a b k. (a -> b) -> Map k a -> Map k b -Map.map (,a +Map.map (,a 1) Map k a -new) - removeMcstDatums :: Map DatumHash (a, Integer) +new) + removeMcstDatums :: Map DatumHash (a, Integer) -> Map DatumHash b -> Map DatumHash (a, Integer) -removeMcstDatums = ((a, Integer) -> b -> Maybe (a, Integer)) +removeMcstDatums = ((a, Integer) -> b -> Maybe (a, Integer)) -> Map DatumHash (a, Integer) -> Map DatumHash b -> Map DatumHash (a, Integer) forall k a b. Ord k => (a -> b -> Maybe a) -> Map k a -> Map k b -> Map k a -Map.differenceWith (((a, Integer) -> b -> Maybe (a, Integer)) +Map.differenceWith (((a, Integer) -> b -> Maybe (a, Integer)) -> Map DatumHash (a, Integer) -> Map DatumHash b -> Map DatumHash (a, Integer)) @@ -1936,21 +1936,21 @@ -> Map DatumHash b -> Map DatumHash (a, Integer) forall a b. (a -> b) -> a -> b -$ \(a -d, Integer -n) b +$ \(a +d, Integer +n) b _ -> if Integer -n Integer -> Integer -> Bool +n Integer -> Integer -> Bool forall a. Eq a => a -> a -> Bool -== Integer +== Integer 1 then Maybe (a, Integer) forall a. Maybe a -Nothing else (a, Integer) -> Maybe (a, Integer) +Nothing else (a, Integer) -> Maybe (a, Integer) forall a. a -> Maybe a -Just (a -d, Integer -n Integer -> Integer -> Integer +Just (a +d, Integer +n Integer -> Integer -> Integer forall a. Num a => a -> a -> a -- Integer +- Integer 1) \ No newline at end of file diff --git a/src/Cooked.MockChain.GenerateTx.html b/src/Cooked.MockChain.GenerateTx.html index 5fef89366..e36822d0f 100644 --- a/src/Cooked.MockChain.GenerateTx.html +++ b/src/Cooked.MockChain.GenerateTx.html @@ -15,35 +15,35 @@ ) where -import qualified Cardano.Api as C -import qualified Cardano.Api.Shelley as C -import qualified Cardano.Node.Emulator.Params as Emulator -import Control.Arrow -import Control.Monad +import qualified Cardano.Api as C +import qualified Cardano.Api.Shelley as C +import qualified Cardano.Node.Emulator.Params as Emulator +import Control.Arrow +import Control.Monad import Cooked.Output import Cooked.Skeleton import Cooked.Wallet -import Data.Bifunctor -import Data.Default -import Data.Foldable -import Data.Map (Map) -import qualified Data.Map as Map -import qualified Data.Maybe as Maybe -import Data.Set (Set) -import qualified Data.Set as Set -import qualified Ledger as Pl hiding (TxOut, validatorHash) -import qualified Ledger.Tx as Ledger -import qualified Ledger.Tx.CardanoAPI as Pl -import Optics.Core -import qualified Plutus.Script.Utils.Ada as Pl -import qualified Plutus.V2.Ledger.Api as Pl -import qualified Wallet.API as Pl +import Data.Bifunctor +import Data.Default +import Data.Foldable +import Data.Map (Map) +import qualified Data.Map as Map +import qualified Data.Maybe as Maybe +import Data.Set (Set) +import qualified Data.Set as Set +import qualified Ledger as Pl hiding (TxOut, validatorHash) +import qualified Ledger.Tx as Ledger +import qualified Ledger.Tx.CardanoAPI as Pl +import Optics.Core +import qualified Plutus.Script.Utils.Ada as Pl +import qualified Plutus.V2.Ledger.Api as Pl +import qualified Wallet.API as Pl data GenerateTxError - = ToCardanoError String Pl.ToCardanoError - | TxBodyError String C.TxBodyError - | GenerateTxErrorGeneral String - deriving (Int -> GenerateTxError -> ShowS + = ToCardanoError String Pl.ToCardanoError + | TxBodyError String C.TxBodyError + | GenerateTxErrorGeneral String + deriving (Int -> GenerateTxError -> ShowS [GenerateTxError] -> ShowS GenerateTxError -> String (Int -> GenerateTxError -> ShowS) @@ -58,7 +58,7 @@ $cshow :: GenerateTxError -> String showsPrec :: Int -> GenerateTxError -> ShowS $cshowsPrec :: Int -> GenerateTxError -> ShowS -Show, GenerateTxError -> GenerateTxError -> Bool +Show, GenerateTxError -> GenerateTxError -> Bool (GenerateTxError -> GenerateTxError -> Bool) -> (GenerateTxError -> GenerateTxError -> Bool) -> Eq GenerateTxError @@ -67,7 +67,7 @@ $c/= :: GenerateTxError -> GenerateTxError -> Bool == :: GenerateTxError -> GenerateTxError -> Bool $c== :: GenerateTxError -> GenerateTxError -> Bool -Eq) +Eq) -- | The internal (do-not-modify unless you know what you're doing) parameters -- for 'generateTxBodyContent'. @@ -77,19 +77,19 @@ -- It is the duty of the caller to choose and set the collateral UTxOs. -- 'generateTxBodyContent' will not do it. GenTxParams -> Set TxOutRef -gtpCollateralIns :: Set Pl.TxOutRef, +gtpCollateralIns :: Set Pl.TxOutRef, -- | The transaction fee (in Lovelace) GenTxParams -> Fee gtpFee :: Fee } -instance Default GenTxParams where - def :: GenTxParams -def = GenTxParams :: Set TxOutRef -> Fee -> GenTxParams +instance Default GenTxParams where + def :: GenTxParams +def = GenTxParams :: Set TxOutRef -> Fee -> GenTxParams GenTxParams {gtpCollateralIns :: Set TxOutRef gtpCollateralIns = Set TxOutRef forall a. Monoid a => a -mempty, gtpFee :: Fee +mempty, gtpFee :: Fee gtpFee = Fee 0} @@ -97,18 +97,18 @@ -- | Parameters controlling transaction generation. GenTxParams -> -- | Some parameters, coming from the 'MockChain'. - Pl.Params -> + Pl.Params -> -- | All of the currently known data on transaction inputs, also coming from the 'MockChain'. - Map Pl.DatumHash Pl.Datum -> + Map Pl.DatumHash Pl.Datum -> -- | All of the currently known UTxOs which will be used as transaction inputs or referenced, also coming from the 'MockChain'. - Map Pl.TxOutRef Pl.TxOut -> + Map Pl.TxOutRef Pl.TxOut -> -- | All of the currently known validators which protect transaction inputs, also coming from the 'MockChain'. - Map Pl.ValidatorHash (Pl.Versioned Pl.Validator) -> + Map Pl.ValidatorHash (Pl.Versioned Pl.Validator) -> -- | The transaction skeleton to translate. TxSkel -> - Either + Either GenerateTxError - (C.TxBodyContent C.BuildTx C.BabbageEra) + (C.TxBodyContent C.BuildTx C.BabbageEra) generateTxBodyContent :: GenTxParams -> Params -> Map DatumHash Datum @@ -116,20 +116,20 @@ -> Map ValidatorHash (Versioned Validator) -> TxSkel -> Either GenerateTxError (TxBodyContent BuildTx BabbageEra) -generateTxBodyContent GenTxParams {Set TxOutRef +generateTxBodyContent GenTxParams {Set TxOutRef Fee gtpFee :: Fee gtpCollateralIns :: Set TxOutRef gtpFee :: GenTxParams -> Fee gtpCollateralIns :: GenTxParams -> Set TxOutRef -..} Params -theParams Map DatumHash Datum -managedData Map TxOutRef TxOut -managedTxOuts Map ValidatorHash (Versioned Validator) -managedValidators TxSkel -skel = do - [(TxIn, BuildTxWith BuildTx (Witness WitCtxTxIn BabbageEra))] -txIns <- ((TxOutRef, TxSkelRedeemer) +..} Params +theParams Map DatumHash Datum +managedData Map TxOutRef TxOut +managedTxOuts Map ValidatorHash (Versioned Validator) +managedValidators TxSkel +skel = do + [(TxIn, BuildTxWith BuildTx (Witness WitCtxTxIn BabbageEra))] +txIns <- ((TxOutRef, TxSkelRedeemer) -> Either GenerateTxError (TxIn, BuildTxWith BuildTx (Witness WitCtxTxIn BabbageEra))) @@ -140,11 +140,11 @@ forall (t :: * -> *) (m :: * -> *) a b. (Traversable t, Monad m) => (a -> m b) -> t a -> m (t b) -mapM (TxOutRef, TxSkelRedeemer) +mapM (TxOutRef, TxSkelRedeemer) -> Either GenerateTxError (TxIn, BuildTxWith BuildTx (Witness WitCtxTxIn BabbageEra)) -txSkelInToTxIn ([(TxOutRef, TxSkelRedeemer)] +txSkelInToTxIn ([(TxOutRef, TxSkelRedeemer)] -> Either GenerateTxError [(TxIn, BuildTxWith BuildTx (Witness WitCtxTxIn BabbageEra))]) @@ -153,79 +153,79 @@ GenerateTxError [(TxIn, BuildTxWith BuildTx (Witness WitCtxTxIn BabbageEra))] forall a b. (a -> b) -> a -> b -$ Map TxOutRef TxSkelRedeemer -> [(TxOutRef, TxSkelRedeemer)] +$ Map TxOutRef TxSkelRedeemer -> [(TxOutRef, TxSkelRedeemer)] forall k a. Map k a -> [(k, a)] -Map.toList (TxSkel -> Map TxOutRef TxSkelRedeemer +Map.toList (TxSkel -> Map TxOutRef TxSkelRedeemer txSkelIns TxSkel -skel) - TxInsReference BuildTx BabbageEra -txInsReference <- +skel) + TxInsReference BuildTx BabbageEra +txInsReference <- [TxOutRef] -> Either GenerateTxError (TxInsReference BuildTx BabbageEra) -txOutRefsToTxInsReference ([TxOutRef] +txOutRefsToTxInsReference ([TxOutRef] -> Either GenerateTxError (TxInsReference BuildTx BabbageEra)) -> [TxOutRef] -> Either GenerateTxError (TxInsReference BuildTx BabbageEra) forall a b. (a -> b) -> a -> b -$ +$ (TxSkelRedeemer -> Maybe TxOutRef) -> [TxSkelRedeemer] -> [TxOutRef] forall a b. (a -> Maybe b) -> [a] -> [b] -Maybe.mapMaybe +Maybe.mapMaybe ( \case - TxSkelRedeemerForReferencedScript TxOutRef -oref redeemer + TxSkelRedeemerForReferencedScript TxOutRef +oref redeemer _ -> TxOutRef -> Maybe TxOutRef forall a. a -> Maybe a -Just TxOutRef -oref +Just TxOutRef +oref TxSkelRedeemer _ -> Maybe TxOutRef forall a. Maybe a -Nothing +Nothing ) (Map TxOutRef TxSkelRedeemer -> [TxSkelRedeemer] forall k a. Map k a -> [a] -Map.elems (Map TxOutRef TxSkelRedeemer -> [TxSkelRedeemer]) +Map.elems (Map TxOutRef TxSkelRedeemer -> [TxSkelRedeemer]) -> Map TxOutRef TxSkelRedeemer -> [TxSkelRedeemer] forall a b. (a -> b) -> a -> b -$ TxSkel -> Map TxOutRef TxSkelRedeemer +$ TxSkel -> Map TxOutRef TxSkelRedeemer txSkelIns TxSkel -skel) +skel) [TxOutRef] -> [TxOutRef] -> [TxOutRef] forall a. [a] -> [a] -> [a] -++ Set TxOutRef -> [TxOutRef] +++ Set TxOutRef -> [TxOutRef] forall a. Set a -> [a] -Set.toList (TxSkel -> Set TxOutRef +Set.toList (TxSkel -> Set TxOutRef txSkelInsReference TxSkel -skel) - TxInsCollateral BabbageEra -txInsCollateral <- [TxOutRef] -> Either GenerateTxError (TxInsCollateral BabbageEra) -txOutRefsToTxSkelInsCollateral ([TxOutRef] -> Either GenerateTxError (TxInsCollateral BabbageEra)) +skel) + TxInsCollateral BabbageEra +txInsCollateral <- [TxOutRef] -> Either GenerateTxError (TxInsCollateral BabbageEra) +txOutRefsToTxSkelInsCollateral ([TxOutRef] -> Either GenerateTxError (TxInsCollateral BabbageEra)) -> [TxOutRef] -> Either GenerateTxError (TxInsCollateral BabbageEra) forall a b. (a -> b) -> a -> b -$ Set TxOutRef -> [TxOutRef] +$ Set TxOutRef -> [TxOutRef] forall a. Set a -> [a] -Set.toList Set TxOutRef -gtpCollateralIns - [TxOut CtxTx BabbageEra] -txOuts <- (TxSkelOut -> Either GenerateTxError (TxOut CtxTx BabbageEra)) +Set.toList Set TxOutRef +gtpCollateralIns + [TxOut CtxTx BabbageEra] +txOuts <- (TxSkelOut -> Either GenerateTxError (TxOut CtxTx BabbageEra)) -> [TxSkelOut] -> Either GenerateTxError [TxOut CtxTx BabbageEra] forall (t :: * -> *) (m :: * -> *) a b. (Traversable t, Monad m) => (a -> m b) -> t a -> m (t b) -mapM (Params +mapM (Params -> TxSkelOut -> Either GenerateTxError (TxOut CtxTx BabbageEra) txSkelOutToCardanoTxOut Params -theParams) ([TxSkelOut] -> Either GenerateTxError [TxOut CtxTx BabbageEra]) +theParams) ([TxSkelOut] -> Either GenerateTxError [TxOut CtxTx BabbageEra]) -> [TxSkelOut] -> Either GenerateTxError [TxOut CtxTx BabbageEra] forall a b. (a -> b) -> a -> b -$ TxSkel -> [TxSkelOut] +$ TxSkel -> [TxSkelOut] txSkelOuts TxSkel -skel - (TxValidityLowerBound BabbageEra, TxValidityUpperBound BabbageEra) -txValidityRange <- +skel + (TxValidityLowerBound BabbageEra, TxValidityUpperBound BabbageEra) +txValidityRange <- (ToCardanoError -> GenerateTxError) -> Either ToCardanoError @@ -236,7 +236,7 @@ forall (a :: * -> * -> *) b c d. ArrowChoice a => a b c -> a (Either b d) (Either c d) -left +left (String -> ToCardanoError -> GenerateTxError ToCardanoError String "translating the transaction validity range") @@ -255,11 +255,11 @@ GenerateTxError (TxValidityLowerBound BabbageEra, TxValidityUpperBound BabbageEra) forall b c a. (b -> c) -> (a -> b) -> a -> c -. SlotRange +. SlotRange -> Either ToCardanoError (TxValidityLowerBound BabbageEra, TxValidityUpperBound BabbageEra) -Pl.toCardanoValidityRange +Pl.toCardanoValidityRange (SlotRange -> Either GenerateTxError @@ -269,39 +269,39 @@ GenerateTxError (TxValidityLowerBound BabbageEra, TxValidityUpperBound BabbageEra) forall a b. (a -> b) -> a -> b -$ TxSkel -> SlotRange +$ TxSkel -> SlotRange txSkelValidityRange TxSkel -skel - TxMintValue BuildTx BabbageEra -txMintValue <- TxSkelMints +skel + TxMintValue BuildTx BabbageEra +txMintValue <- TxSkelMints -> Either GenerateTxError (TxMintValue BuildTx BabbageEra) -txSkelMintsToTxMintValue (TxSkelMints +txSkelMintsToTxMintValue (TxSkelMints -> Either GenerateTxError (TxMintValue BuildTx BabbageEra)) -> TxSkelMints -> Either GenerateTxError (TxMintValue BuildTx BabbageEra) forall a b. (a -> b) -> a -> b -$ TxSkel -> TxSkelMints +$ TxSkel -> TxSkelMints txSkelMints TxSkel -skel - TxExtraKeyWitnesses BabbageEra -txExtraKeyWits <- - let signers :: [Wallet] -signers = TxSkel -> [Wallet] +skel + TxExtraKeyWitnesses BabbageEra +txExtraKeyWits <- + let signers :: [Wallet] +signers = TxSkel -> [Wallet] txSkelSigners TxSkel -skel +skel in if [Wallet] -> Bool forall (t :: * -> *) a. Foldable t => t a -> Bool -null [Wallet] -signers +null [Wallet] +signers then GenerateTxError -> Either GenerateTxError (TxExtraKeyWitnesses BabbageEra) forall a b. a -> Either a b -Left (GenerateTxError +Left (GenerateTxError -> Either GenerateTxError (TxExtraKeyWitnesses BabbageEra)) -> GenerateTxError -> Either GenerateTxError (TxExtraKeyWitnesses BabbageEra) forall a b. (a -> b) -> a -> b -$ String -> GenerateTxError +$ String -> GenerateTxError GenerateTxErrorGeneral String "empty txSkelSigners. You must provide at least one signer" else @@ -312,7 +312,7 @@ forall (p :: * -> * -> *) a b c d. Bifunctor p => (a -> b) -> (c -> d) -> p a c -> p b d -bimap +bimap (String -> ToCardanoError -> GenerateTxError ToCardanoError String "translating the required signers") @@ -321,130 +321,130 @@ forall era. TxExtraKeyWitnessesSupportedInEra era -> [Hash PaymentKey] -> TxExtraKeyWitnesses era -C.TxExtraKeyWitnesses TxExtraKeyWitnessesSupportedInEra BabbageEra -C.ExtraKeyWitnessesInBabbageEra) +C.TxExtraKeyWitnesses TxExtraKeyWitnessesSupportedInEra BabbageEra +C.ExtraKeyWitnessesInBabbageEra) (Either ToCardanoError [Hash PaymentKey] -> Either GenerateTxError (TxExtraKeyWitnesses BabbageEra)) -> Either ToCardanoError [Hash PaymentKey] -> Either GenerateTxError (TxExtraKeyWitnesses BabbageEra) forall a b. (a -> b) -> a -> b -$ (Wallet -> Either ToCardanoError (Hash PaymentKey)) +$ (Wallet -> Either ToCardanoError (Hash PaymentKey)) -> [Wallet] -> Either ToCardanoError [Hash PaymentKey] forall (t :: * -> *) (m :: * -> *) a b. (Traversable t, Monad m) => (a -> m b) -> t a -> m (t b) -mapM +mapM (PaymentPubKeyHash -> Either ToCardanoError (Hash PaymentKey) -Pl.toCardanoPaymentKeyHash (PaymentPubKeyHash -> Either ToCardanoError (Hash PaymentKey)) +Pl.toCardanoPaymentKeyHash (PaymentPubKeyHash -> Either ToCardanoError (Hash PaymentKey)) -> (Wallet -> PaymentPubKeyHash) -> Wallet -> Either ToCardanoError (Hash PaymentKey) forall b c a. (b -> c) -> (a -> b) -> a -> c -. PubKeyHash -> PaymentPubKeyHash -Pl.PaymentPubKeyHash (PubKeyHash -> PaymentPubKeyHash) +. PubKeyHash -> PaymentPubKeyHash +Pl.PaymentPubKeyHash (PubKeyHash -> PaymentPubKeyHash) -> (Wallet -> PubKeyHash) -> Wallet -> PaymentPubKeyHash forall b c a. (b -> c) -> (a -> b) -> a -> c -. Wallet -> PubKeyHash +. Wallet -> PubKeyHash walletPKHash) [Wallet] -signers - TxTotalCollateral BabbageEra -txTotalCollateral <- +signers + TxTotalCollateral BabbageEra +txTotalCollateral <- ([Value] -> TxTotalCollateral BabbageEra) -> Either GenerateTxError [Value] -> Either GenerateTxError (TxTotalCollateral BabbageEra) forall (a :: * -> * -> *) b c d. ArrowChoice a => a b c -> a (Either d b) (Either d c) -right +right ( TxTotalAndReturnCollateralSupportedInEra BabbageEra -> Lovelace -> TxTotalCollateral BabbageEra forall era. TxTotalAndReturnCollateralSupportedInEra era -> Lovelace -> TxTotalCollateral era -C.TxTotalCollateral (Maybe (TxTotalAndReturnCollateralSupportedInEra BabbageEra) +C.TxTotalCollateral (Maybe (TxTotalAndReturnCollateralSupportedInEra BabbageEra) -> TxTotalAndReturnCollateralSupportedInEra BabbageEra forall a. HasCallStack => Maybe a -> a -Maybe.fromJust (CardanoEra BabbageEra +Maybe.fromJust (CardanoEra BabbageEra -> Maybe (TxTotalAndReturnCollateralSupportedInEra BabbageEra) forall era. CardanoEra era -> Maybe (TxTotalAndReturnCollateralSupportedInEra era) -C.totalAndReturnCollateralSupportedInEra CardanoEra BabbageEra -C.BabbageEra)) +C.totalAndReturnCollateralSupportedInEra CardanoEra BabbageEra +C.BabbageEra)) (Lovelace -> TxTotalCollateral BabbageEra) -> ([Value] -> Lovelace) -> [Value] -> TxTotalCollateral BabbageEra forall b c a. (b -> c) -> (a -> b) -> a -> c -. Integer -> Lovelace -C.Lovelace +. Integer -> Lovelace +C.Lovelace (Integer -> Lovelace) -> ([Value] -> Integer) -> [Value] -> Lovelace forall b c a. (b -> c) -> (a -> b) -> a -> c -. Ada -> Integer -Pl.getLovelace +. Ada -> Integer +Pl.getLovelace (Ada -> Integer) -> ([Value] -> Ada) -> [Value] -> Integer forall b c a. (b -> c) -> (a -> b) -> a -> c -. Value -> Ada -Pl.fromValue +. Value -> Ada +Pl.fromValue (Value -> Ada) -> ([Value] -> Value) -> [Value] -> Ada forall b c a. (b -> c) -> (a -> b) -> a -> c -. [Value] -> Value +. [Value] -> Value forall a. Monoid a => [a] -> a -mconcat +mconcat ) ( (TxOutRef -> Either GenerateTxError Value) -> [TxOutRef] -> Either GenerateTxError [Value] forall (t :: * -> *) (m :: * -> *) a b. (Traversable t, Monad m) => (a -> m b) -> t a -> m (t b) -mapM - ( \TxOutRef -txOutRef -> do - Pl.TxOut Address -_ Value -outValue OutputDatum +mapM + ( \TxOutRef +txOutRef -> do + Pl.TxOut Address +_ Value +outValue OutputDatum _ Maybe ScriptHash _ <- GenerateTxError -> Maybe TxOut -> Either GenerateTxError TxOut forall e a. e -> Maybe a -> Either e a -throwOnNothing +throwOnNothing (String -> GenerateTxError GenerateTxErrorGeneral (String -> GenerateTxError) -> String -> GenerateTxError forall a b. (a -> b) -> a -> b -$ String +$ String "computing the total collateral: Unknown TxOutRef" String -> ShowS forall a. [a] -> [a] -> [a] -++ TxOutRef -> String +++ TxOutRef -> String forall a. Show a => a -> String -show TxOutRef -txOutRef) +show TxOutRef +txOutRef) (TxOutRef -> Map TxOutRef TxOut -> Maybe TxOut forall k a. Ord k => k -> Map k a -> Maybe a -Map.lookup TxOutRef -txOutRef Map TxOutRef TxOut -managedTxOuts) +Map.lookup TxOutRef +txOutRef Map TxOutRef TxOut +managedTxOuts) Value -> Either GenerateTxError Value forall a b. b -> Either a b -Right Value -outValue +Right Value +outValue ) ([TxOutRef] -> Either GenerateTxError [Value]) -> [TxOutRef] -> Either GenerateTxError [Value] forall a b. (a -> b) -> a -> b -$ Set TxOutRef -> [TxOutRef] +$ Set TxOutRef -> [TxOutRef] forall a. Set a -> [a] -Set.toList Set TxOutRef -gtpCollateralIns +Set.toList Set TxOutRef +gtpCollateralIns ) TxBodyContent BuildTx BabbageEra -> Either GenerateTxError (TxBodyContent BuildTx BabbageEra) forall a b. b -> Either a b -Right (TxBodyContent BuildTx BabbageEra +Right (TxBodyContent BuildTx BabbageEra -> Either GenerateTxError (TxBodyContent BuildTx BabbageEra)) -> TxBodyContent BuildTx BabbageEra -> Either GenerateTxError (TxBodyContent BuildTx BabbageEra) forall a b. (a -> b) -> a -> b -$ +$ TxBodyContent :: forall build era. TxIns build era -> TxInsCollateral era @@ -464,135 +464,135 @@ -> TxMintValue build era -> TxScriptValidity era -> TxBodyContent build era -C.TxBodyContent +C.TxBodyContent { txIns :: [(TxIn, BuildTxWith BuildTx (Witness WitCtxTxIn BabbageEra))] -C.txIns = [(TxIn, BuildTxWith BuildTx (Witness WitCtxTxIn BabbageEra))] -txIns, +C.txIns = [(TxIn, BuildTxWith BuildTx (Witness WitCtxTxIn BabbageEra))] +txIns, txInsCollateral :: TxInsCollateral BabbageEra -C.txInsCollateral = TxInsCollateral BabbageEra -txInsCollateral, +C.txInsCollateral = TxInsCollateral BabbageEra +txInsCollateral, txInsReference :: TxInsReference BuildTx BabbageEra -C.txInsReference = TxInsReference BuildTx BabbageEra -txInsReference, +C.txInsReference = TxInsReference BuildTx BabbageEra +txInsReference, txOuts :: [TxOut CtxTx BabbageEra] -C.txOuts = [TxOut CtxTx BabbageEra] -txOuts, +C.txOuts = [TxOut CtxTx BabbageEra] +txOuts, txTotalCollateral :: TxTotalCollateral BabbageEra -C.txTotalCollateral = TxTotalCollateral BabbageEra -txTotalCollateral, +C.txTotalCollateral = TxTotalCollateral BabbageEra +txTotalCollateral, -- WARN For now we are not dealing with return collateral txReturnCollateral :: TxReturnCollateral CtxTx BabbageEra -C.txReturnCollateral = TxReturnCollateral CtxTx BabbageEra +C.txReturnCollateral = TxReturnCollateral CtxTx BabbageEra forall ctx era. TxReturnCollateral ctx era -C.TxReturnCollateralNone, -- That's what plutus-apps does as well +C.TxReturnCollateralNone, -- That's what plutus-apps does as well txFee :: TxFee BabbageEra -C.txFee = TxFeesExplicitInEra BabbageEra -> Lovelace -> TxFee BabbageEra +C.txFee = TxFeesExplicitInEra BabbageEra -> Lovelace -> TxFee BabbageEra forall era. TxFeesExplicitInEra era -> Lovelace -> TxFee era -C.TxFeeExplicit TxFeesExplicitInEra BabbageEra -C.TxFeesExplicitInBabbageEra (Lovelace -> TxFee BabbageEra) -> Lovelace -> TxFee BabbageEra +C.TxFeeExplicit TxFeesExplicitInEra BabbageEra +C.TxFeesExplicitInBabbageEra (Lovelace -> TxFee BabbageEra) -> Lovelace -> TxFee BabbageEra forall a b. (a -> b) -> a -> b -$ Integer -> Lovelace -C.Lovelace (Integer -> Lovelace) -> Integer -> Lovelace +$ Integer -> Lovelace +C.Lovelace (Integer -> Lovelace) -> Integer -> Lovelace forall a b. (a -> b) -> a -> b -$ Fee -> Integer +$ Fee -> Integer feeLovelace Fee -gtpFee, +gtpFee, txValidityRange :: (TxValidityLowerBound BabbageEra, TxValidityUpperBound BabbageEra) -C.txValidityRange = (TxValidityLowerBound BabbageEra, TxValidityUpperBound BabbageEra) -txValidityRange, +C.txValidityRange = (TxValidityLowerBound BabbageEra, TxValidityUpperBound BabbageEra) +txValidityRange, txMetadata :: TxMetadataInEra BabbageEra -C.txMetadata = TxMetadataInEra BabbageEra +C.txMetadata = TxMetadataInEra BabbageEra forall era. TxMetadataInEra era -C.TxMetadataNone, -- That's what plutus-apps does as well +C.TxMetadataNone, -- That's what plutus-apps does as well txAuxScripts :: TxAuxScripts BabbageEra -C.txAuxScripts = TxAuxScripts BabbageEra +C.txAuxScripts = TxAuxScripts BabbageEra forall era. TxAuxScripts era -C.TxAuxScriptsNone, -- That's what plutus-apps does as well +C.TxAuxScriptsNone, -- That's what plutus-apps does as well txExtraKeyWits :: TxExtraKeyWitnesses BabbageEra -C.txExtraKeyWits = TxExtraKeyWitnesses BabbageEra -txExtraKeyWits, +C.txExtraKeyWits = TxExtraKeyWitnesses BabbageEra +txExtraKeyWits, txProtocolParams :: BuildTxWith BuildTx (Maybe ProtocolParameters) -C.txProtocolParams = Maybe ProtocolParameters +C.txProtocolParams = Maybe ProtocolParameters -> BuildTxWith BuildTx (Maybe ProtocolParameters) forall a. a -> BuildTxWith BuildTx a -C.BuildTxWith (Maybe ProtocolParameters +C.BuildTxWith (Maybe ProtocolParameters -> BuildTxWith BuildTx (Maybe ProtocolParameters)) -> (Params -> Maybe ProtocolParameters) -> Params -> BuildTxWith BuildTx (Maybe ProtocolParameters) forall b c a. (b -> c) -> (a -> b) -> a -> c -. ProtocolParameters -> Maybe ProtocolParameters +. ProtocolParameters -> Maybe ProtocolParameters forall a. a -> Maybe a -Just (ProtocolParameters -> Maybe ProtocolParameters) +Just (ProtocolParameters -> Maybe ProtocolParameters) -> (Params -> ProtocolParameters) -> Params -> Maybe ProtocolParameters forall b c a. (b -> c) -> (a -> b) -> a -> c -. Params -> ProtocolParameters -Emulator.pProtocolParams (Params -> BuildTxWith BuildTx (Maybe ProtocolParameters)) +. Params -> ProtocolParameters +Emulator.pProtocolParams (Params -> BuildTxWith BuildTx (Maybe ProtocolParameters)) -> Params -> BuildTxWith BuildTx (Maybe ProtocolParameters) forall a b. (a -> b) -> a -> b -$ Params -theParams, -- That's what plutus-apps does as well +$ Params +theParams, -- That's what plutus-apps does as well txWithdrawals :: TxWithdrawals BuildTx BabbageEra -C.txWithdrawals = TxWithdrawals BuildTx BabbageEra +C.txWithdrawals = TxWithdrawals BuildTx BabbageEra forall build era. TxWithdrawals build era -C.TxWithdrawalsNone, -- That's what plutus-apps does as well +C.TxWithdrawalsNone, -- That's what plutus-apps does as well txCertificates :: TxCertificates BuildTx BabbageEra -C.txCertificates = TxCertificates BuildTx BabbageEra +C.txCertificates = TxCertificates BuildTx BabbageEra forall build era. TxCertificates build era -C.TxCertificatesNone, -- That's what plutus-apps does as well +C.TxCertificatesNone, -- That's what plutus-apps does as well txUpdateProposal :: TxUpdateProposal BabbageEra -C.txUpdateProposal = TxUpdateProposal BabbageEra +C.txUpdateProposal = TxUpdateProposal BabbageEra forall era. TxUpdateProposal era -C.TxUpdateProposalNone, -- That's what plutus-apps does as well +C.TxUpdateProposalNone, -- That's what plutus-apps does as well txMintValue :: TxMintValue BuildTx BabbageEra -C.txMintValue = TxMintValue BuildTx BabbageEra -txMintValue, +C.txMintValue = TxMintValue BuildTx BabbageEra +txMintValue, txScriptValidity :: TxScriptValidity BabbageEra -C.txScriptValidity = TxScriptValidity BabbageEra +C.txScriptValidity = TxScriptValidity BabbageEra forall era. TxScriptValidity era -C.TxScriptValidityNone -- That's what plutus-apps does as well +C.TxScriptValidityNone -- That's what plutus-apps does as well } where -- Helper function to throw errors. - throwOnNothing :: e -> Maybe a -> Either e a - throwOnNothing :: e -> Maybe a -> Either e a -throwOnNothing e -err = Either e a -> (a -> Either e a) -> Maybe a -> Either e a + throwOnNothing :: e -> Maybe a -> Either e a + throwOnNothing :: e -> Maybe a -> Either e a +throwOnNothing e +err = Either e a -> (a -> Either e a) -> Maybe a -> Either e a forall b a. b -> (a -> b) -> Maybe a -> b -maybe (e -> Either e a +maybe (e -> Either e a forall a b. a -> Either a b -Left e -err) a -> Either e a +Left e +err) a -> Either e a forall a b. b -> Either a b -Right +Right -- Convert a 'TxSkel' input, which consists of a 'Pl.TxOutRef' and a -- 'TxSkelIn', into a 'C.TxIn', together with the appropriate witness. If -- you add reference inputs, don't forget to also update the -- 'txInsReference'! - txSkelInToTxIn :: - (Pl.TxOutRef, TxSkelRedeemer) -> - Either + txSkelInToTxIn :: + (Pl.TxOutRef, TxSkelRedeemer) -> + Either GenerateTxError - ( C.TxIn, - C.BuildTxWith - C.BuildTx - (C.Witness C.WitCtxTxIn C.BabbageEra) + ( C.TxIn, + C.BuildTxWith + C.BuildTx + (C.Witness C.WitCtxTxIn C.BabbageEra) ) - txSkelInToTxIn :: (TxOutRef, TxSkelRedeemer) + txSkelInToTxIn :: (TxOutRef, TxSkelRedeemer) -> Either GenerateTxError (TxIn, BuildTxWith BuildTx (Witness WitCtxTxIn BabbageEra)) -txSkelInToTxIn (TxOutRef -txOutRef, TxSkelRedeemer -txSkelRedeemer) = do - Witness WitCtxTxIn BabbageEra -witness <- TxSkelRedeemer +txSkelInToTxIn (TxOutRef +txOutRef, TxSkelRedeemer +txSkelRedeemer) = do + Witness WitCtxTxIn BabbageEra +witness <- TxSkelRedeemer -> Either GenerateTxError (Witness WitCtxTxIn BabbageEra) -mkWitness TxSkelRedeemer -txSkelRedeemer +mkWitness TxSkelRedeemer +txSkelRedeemer (ToCardanoError -> GenerateTxError) -> (TxIn -> (TxIn, BuildTxWith BuildTx (Witness WitCtxTxIn BabbageEra))) @@ -603,15 +603,15 @@ forall (p :: * -> * -> *) a b c d. Bifunctor p => (a -> b) -> (c -> d) -> p a c -> p b d -bimap +bimap (String -> ToCardanoError -> GenerateTxError ToCardanoError String "txSkelIntoTxIn, translating TxOutRef") (,Witness WitCtxTxIn BabbageEra -> BuildTxWith BuildTx (Witness WitCtxTxIn BabbageEra) forall a. a -> BuildTxWith BuildTx a -C.BuildTxWith Witness WitCtxTxIn BabbageEra -witness) +C.BuildTxWith Witness WitCtxTxIn BabbageEra +witness) (Either ToCardanoError TxIn -> Either GenerateTxError @@ -621,61 +621,61 @@ GenerateTxError (TxIn, BuildTxWith BuildTx (Witness WitCtxTxIn BabbageEra)) forall a b. (a -> b) -> a -> b -$ TxOutRef -> Either ToCardanoError TxIn -Pl.toCardanoTxIn TxOutRef -txOutRef +$ TxOutRef -> Either ToCardanoError TxIn +Pl.toCardanoTxIn TxOutRef +txOutRef where - resolveScriptOutputOwnerAndDatum :: - Either + resolveScriptOutputOwnerAndDatum :: + Either GenerateTxError - ( Pl.ValidatorHash, - Pl.Versioned Pl.Validator, - C.ScriptDatum C.WitCtxTxIn + ( Pl.ValidatorHash, + Pl.Versioned Pl.Validator, + C.ScriptDatum C.WitCtxTxIn ) - resolveScriptOutputOwnerAndDatum :: Either + resolveScriptOutputOwnerAndDatum :: Either GenerateTxError (ValidatorHash, Versioned Validator, ScriptDatum WitCtxTxIn) -resolveScriptOutputOwnerAndDatum = do - TxOut -txOut <- +resolveScriptOutputOwnerAndDatum = do + TxOut +txOut <- GenerateTxError -> Maybe TxOut -> Either GenerateTxError TxOut forall e a. e -> Maybe a -> Either e a -throwOnNothing +throwOnNothing (String -> GenerateTxError GenerateTxErrorGeneral String "txSkelInToTxIn: Unknown txOutRef") (TxOutRef -> Map TxOutRef TxOut -> Maybe TxOut forall k a. Ord k => k -> Map k a -> Maybe a -Map.lookup TxOutRef -txOutRef Map TxOutRef TxOut -managedTxOuts) - ValidatorHash -validatorHash <- +Map.lookup TxOutRef +txOutRef Map TxOutRef TxOut +managedTxOuts) + ValidatorHash +validatorHash <- case TxOut -> Address forall o. (IsAbstractOutput o, ToCredential (OwnerType o)) => o -> Address outputAddress TxOut -txOut of - (Pl.Address (Pl.ScriptCredential ValidatorHash -validatorHash) Maybe StakingCredential +txOut of + (Pl.Address (Pl.ScriptCredential ValidatorHash +validatorHash) Maybe StakingCredential _) -> ValidatorHash -> Either GenerateTxError ValidatorHash forall a b. b -> Either a b -Right ValidatorHash -validatorHash +Right ValidatorHash +validatorHash Address _ -> GenerateTxError -> Either GenerateTxError ValidatorHash forall a b. a -> Either a b -Left (String -> GenerateTxError +Left (String -> GenerateTxError GenerateTxErrorGeneral String "txSkelInToTxIn: Output is not a script output") - Versioned Validator -validator <- + Versioned Validator +validator <- GenerateTxError -> Maybe (Versioned Validator) -> Either GenerateTxError (Versioned Validator) forall e a. e -> Maybe a -> Either e a -throwOnNothing +throwOnNothing (String -> GenerateTxError GenerateTxErrorGeneral String "txSkelInToTxIn: Unknown validator") @@ -683,94 +683,94 @@ -> Map ValidatorHash (Versioned Validator) -> Maybe (Versioned Validator) forall k a. Ord k => k -> Map k a -> Maybe a -Map.lookup ValidatorHash -validatorHash Map ValidatorHash (Versioned Validator) -managedValidators) - ScriptDatum WitCtxTxIn -datum <- +Map.lookup ValidatorHash +validatorHash Map ValidatorHash (Versioned Validator) +managedValidators) + ScriptDatum WitCtxTxIn +datum <- case TxOut -> OutputDatum forall o. (IsAbstractOutput o, ToOutputDatum (DatumType o)) => o -> OutputDatum outputOutputDatum TxOut -txOut of +txOut of OutputDatum -Pl.NoOutputDatum -> GenerateTxError -> Either GenerateTxError (ScriptDatum WitCtxTxIn) +Pl.NoOutputDatum -> GenerateTxError -> Either GenerateTxError (ScriptDatum WitCtxTxIn) forall a b. a -> Either a b -Left (String -> GenerateTxError +Left (String -> GenerateTxError GenerateTxErrorGeneral String "txSkelInToTxIn: No datum found on script output") - Pl.OutputDatum Datum -_datum -> ScriptDatum WitCtxTxIn + Pl.OutputDatum Datum +_datum -> ScriptDatum WitCtxTxIn -> Either GenerateTxError (ScriptDatum WitCtxTxIn) forall a b. b -> Either a b -Right ScriptDatum WitCtxTxIn -C.InlineScriptDatum - Pl.OutputDatumHash DatumHash -datumHash -> +Right ScriptDatum WitCtxTxIn +C.InlineScriptDatum + Pl.OutputDatumHash DatumHash +datumHash -> GenerateTxError -> Maybe (ScriptDatum WitCtxTxIn) -> Either GenerateTxError (ScriptDatum WitCtxTxIn) forall e a. e -> Maybe a -> Either e a -throwOnNothing +throwOnNothing (String -> GenerateTxError GenerateTxErrorGeneral String "txSkelInToTxIn: Datum hash could not be resolved") (ScriptData -> ScriptDatum WitCtxTxIn -C.ScriptDatumForTxIn (ScriptData -> ScriptDatum WitCtxTxIn) +C.ScriptDatumForTxIn (ScriptData -> ScriptDatum WitCtxTxIn) -> (Datum -> ScriptData) -> Datum -> ScriptDatum WitCtxTxIn forall b c a. (b -> c) -> (a -> b) -> a -> c -. BuiltinData -> ScriptData -Pl.toCardanoScriptData (BuiltinData -> ScriptData) +. BuiltinData -> ScriptData +Pl.toCardanoScriptData (BuiltinData -> ScriptData) -> (Datum -> BuiltinData) -> Datum -> ScriptData forall b c a. (b -> c) -> (a -> b) -> a -> c -. Datum -> BuiltinData -Pl.getDatum (Datum -> ScriptDatum WitCtxTxIn) +. Datum -> BuiltinData +Pl.getDatum (Datum -> ScriptDatum WitCtxTxIn) -> Maybe Datum -> Maybe (ScriptDatum WitCtxTxIn) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b -<$> DatumHash -> Map DatumHash Datum -> Maybe Datum +<$> DatumHash -> Map DatumHash Datum -> Maybe Datum forall k a. Ord k => k -> Map k a -> Maybe a -Map.lookup DatumHash -datumHash Map DatumHash Datum -managedData) +Map.lookup DatumHash +datumHash Map DatumHash Datum +managedData) (ValidatorHash, Versioned Validator, ScriptDatum WitCtxTxIn) -> Either GenerateTxError (ValidatorHash, Versioned Validator, ScriptDatum WitCtxTxIn) forall (m :: * -> *) a. Monad m => a -> m a -return (ValidatorHash -validatorHash, Versioned Validator -validator, ScriptDatum WitCtxTxIn -datum) +return (ValidatorHash +validatorHash, Versioned Validator +validator, ScriptDatum WitCtxTxIn +datum) - mkWitness :: TxSkelRedeemer -> Either GenerateTxError (C.Witness C.WitCtxTxIn C.BabbageEra) - mkWitness :: TxSkelRedeemer + mkWitness :: TxSkelRedeemer -> Either GenerateTxError (C.Witness C.WitCtxTxIn C.BabbageEra) + mkWitness :: TxSkelRedeemer -> Either GenerateTxError (Witness WitCtxTxIn BabbageEra) -mkWitness TxSkelRedeemer +mkWitness TxSkelRedeemer TxSkelNoRedeemerForPK = Witness WitCtxTxIn BabbageEra -> Either GenerateTxError (Witness WitCtxTxIn BabbageEra) forall a b. b -> Either a b -Right (Witness WitCtxTxIn BabbageEra +Right (Witness WitCtxTxIn BabbageEra -> Either GenerateTxError (Witness WitCtxTxIn BabbageEra)) -> Witness WitCtxTxIn BabbageEra -> Either GenerateTxError (Witness WitCtxTxIn BabbageEra) forall a b. (a -> b) -> a -> b -$ KeyWitnessInCtx WitCtxTxIn -> Witness WitCtxTxIn BabbageEra +$ KeyWitnessInCtx WitCtxTxIn -> Witness WitCtxTxIn BabbageEra forall witctx era. KeyWitnessInCtx witctx -> Witness witctx era -C.KeyWitness KeyWitnessInCtx WitCtxTxIn -C.KeyWitnessForSpending - mkWitness (TxSkelRedeemerForReferencedScript TxOutRef -validatorOref redeemer -redeemer) = do - (ValidatorHash -validatorHash, Versioned Validator -validator, ScriptDatum WitCtxTxIn -datum) <- Either +C.KeyWitness KeyWitnessInCtx WitCtxTxIn +C.KeyWitnessForSpending + mkWitness (TxSkelRedeemerForReferencedScript TxOutRef +validatorOref redeemer +redeemer) = do + (ValidatorHash +validatorHash, Versioned Validator +validator, ScriptDatum WitCtxTxIn +datum) <- Either GenerateTxError (ValidatorHash, Versioned Validator, ScriptDatum WitCtxTxIn) -resolveScriptOutputOwnerAndDatum - ScriptHash -scriptHashAtOref <- +resolveScriptOutputOwnerAndDatum + ScriptHash +scriptHashAtOref <- -- In our own MockChainT implementation, this error should never -- been thrown, because we collect the 'managedTxOuts' using -- (eventually) 'lookupUtxos', which will already fail on @@ -778,91 +778,91 @@ GenerateTxError -> Maybe ScriptHash -> Either GenerateTxError ScriptHash forall e a. e -> Maybe a -> Either e a -throwOnNothing +throwOnNothing (String -> GenerateTxError GenerateTxErrorGeneral String "txSkelInToTxIn: Can't resolve reference script outref. This might mean that you either never created or accidentally consumed the UTxO where the reference script is stored") (Maybe ScriptHash -> Either GenerateTxError ScriptHash) -> Maybe ScriptHash -> Either GenerateTxError ScriptHash forall a b. (a -> b) -> a -> b -$ TxOutRef -> Map TxOutRef TxOut -> Maybe TxOut +$ TxOutRef -> Map TxOutRef TxOut -> Maybe TxOut forall k a. Ord k => k -> Map k a -> Maybe a -Map.lookup TxOutRef -validatorOref Map TxOutRef TxOut -managedTxOuts Maybe TxOut -> (TxOut -> Maybe ScriptHash) -> Maybe ScriptHash +Map.lookup TxOutRef +validatorOref Map TxOutRef TxOut +managedTxOuts Maybe TxOut -> (TxOut -> Maybe ScriptHash) -> Maybe ScriptHash forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b ->>= (TxOut +>>= (TxOut -> Optic' A_Lens NoIx TxOut (Maybe ScriptHash) -> Maybe ScriptHash forall k s (is :: IxList) a. Is k A_Getter => s -> Optic' k is s a -> a -^. Optic' A_Lens NoIx TxOut (Maybe ScriptHash) +^. Optic' A_Lens NoIx TxOut (Maybe ScriptHash) forall o. IsAbstractOutput o => Lens' o (Maybe (ReferenceScriptType o)) outputReferenceScriptL) Bool -> Either GenerateTxError () -> Either GenerateTxError () forall (f :: * -> *). Applicative f => Bool -> f () -> f () -when (ScriptHash -scriptHashAtOref ScriptHash -> ScriptHash -> Bool +when (ScriptHash +scriptHashAtOref ScriptHash -> ScriptHash -> Bool forall a. Eq a => a -> a -> Bool -/= ValidatorHash -> ScriptHash +/= ValidatorHash -> ScriptHash forall a. ToScriptHash a => a -> ScriptHash toScriptHash ValidatorHash -validatorHash) (Either GenerateTxError () -> Either GenerateTxError ()) +validatorHash) (Either GenerateTxError () -> Either GenerateTxError ()) -> Either GenerateTxError () -> Either GenerateTxError () forall a b. (a -> b) -> a -> b -$ +$ GenerateTxError -> Either GenerateTxError () forall a b. a -> Either a b -Left (GenerateTxError -> Either GenerateTxError ()) +Left (GenerateTxError -> Either GenerateTxError ()) -> GenerateTxError -> Either GenerateTxError () forall a b. (a -> b) -> a -> b -$ +$ String -> GenerateTxError GenerateTxErrorGeneral String "txSkelInToTxIn: Wrong reference script hash. Are you using the correct TxOutRef on your TxSkelRedeemerForReferencedScript?" - TxIn -validatorTxIn <- + TxIn +validatorTxIn <- (ToCardanoError -> GenerateTxError) -> Either ToCardanoError TxIn -> Either GenerateTxError TxIn forall (a :: * -> * -> *) b c d. ArrowChoice a => a b c -> a (Either b d) (Either c d) -left +left (String -> ToCardanoError -> GenerateTxError ToCardanoError String "txSkelIntoTxIn: translating TxOutRef where the reference script sits") (Either ToCardanoError TxIn -> Either GenerateTxError TxIn) -> Either ToCardanoError TxIn -> Either GenerateTxError TxIn forall a b. (a -> b) -> a -> b -$ TxOutRef -> Either ToCardanoError TxIn -Pl.toCardanoTxIn TxOutRef -validatorOref - ScriptHash -scriptHash <- +$ TxOutRef -> Either ToCardanoError TxIn +Pl.toCardanoTxIn TxOutRef +validatorOref + ScriptHash +scriptHash <- (ToCardanoError -> GenerateTxError) -> Either ToCardanoError ScriptHash -> Either GenerateTxError ScriptHash forall (a :: * -> * -> *) b c d. ArrowChoice a => a b c -> a (Either b d) (Either c d) -left +left (String -> ToCardanoError -> GenerateTxError ToCardanoError String "txSkelInToTxIn: could not convert script hash of referenced script") (ValidatorHash -> Either ToCardanoError ScriptHash -Pl.toCardanoScriptHash ValidatorHash -validatorHash) - let scriptWitnessBuilder :: ScriptDatum WitCtxTxIn +Pl.toCardanoScriptHash ValidatorHash +validatorHash) + let scriptWitnessBuilder :: ScriptDatum WitCtxTxIn -> ScriptData -> ExecutionUnits -> ScriptWitness WitCtxTxIn BabbageEra -scriptWitnessBuilder = case Versioned Validator -validator of - Pl.Versioned Validator +scriptWitnessBuilder = case Versioned Validator +validator of + Pl.Versioned Validator _ Language -Pl.PlutusV1 -> +Pl.PlutusV1 -> ScriptLanguageInEra PlutusScriptV1 BabbageEra -> PlutusScriptVersion PlutusScriptV1 -> PlutusScriptOrReferenceInput PlutusScriptV1 @@ -878,23 +878,23 @@ -> ScriptData -> ExecutionUnits -> ScriptWitness witctx era -C.PlutusScriptWitness +C.PlutusScriptWitness ScriptLanguageInEra PlutusScriptV1 BabbageEra -C.PlutusScriptV1InBabbage +C.PlutusScriptV1InBabbage PlutusScriptVersion PlutusScriptV1 -C.PlutusScriptV1 +C.PlutusScriptV1 (TxIn -> Maybe ScriptHash -> PlutusScriptOrReferenceInput PlutusScriptV1 forall lang. TxIn -> Maybe ScriptHash -> PlutusScriptOrReferenceInput lang -C.PReferenceScript TxIn -validatorTxIn (ScriptHash -> Maybe ScriptHash +C.PReferenceScript TxIn +validatorTxIn (ScriptHash -> Maybe ScriptHash forall a. a -> Maybe a -Just ScriptHash -scriptHash)) - Pl.Versioned Validator +Just ScriptHash +scriptHash)) + Pl.Versioned Validator _ Language -Pl.PlutusV2 -> +Pl.PlutusV2 -> ScriptLanguageInEra PlutusScriptV2 BabbageEra -> PlutusScriptVersion PlutusScriptV2 -> PlutusScriptOrReferenceInput PlutusScriptV2 @@ -910,77 +910,77 @@ -> ScriptData -> ExecutionUnits -> ScriptWitness witctx era -C.PlutusScriptWitness +C.PlutusScriptWitness ScriptLanguageInEra PlutusScriptV2 BabbageEra -C.PlutusScriptV2InBabbage +C.PlutusScriptV2InBabbage PlutusScriptVersion PlutusScriptV2 -C.PlutusScriptV2 +C.PlutusScriptV2 (TxIn -> Maybe ScriptHash -> PlutusScriptOrReferenceInput PlutusScriptV2 forall lang. TxIn -> Maybe ScriptHash -> PlutusScriptOrReferenceInput lang -C.PReferenceScript TxIn -validatorTxIn (ScriptHash -> Maybe ScriptHash +C.PReferenceScript TxIn +validatorTxIn (ScriptHash -> Maybe ScriptHash forall a. a -> Maybe a -Just ScriptHash -scriptHash)) +Just ScriptHash +scriptHash)) Witness WitCtxTxIn BabbageEra -> Either GenerateTxError (Witness WitCtxTxIn BabbageEra) forall (m :: * -> *) a. Monad m => a -> m a -return (Witness WitCtxTxIn BabbageEra +return (Witness WitCtxTxIn BabbageEra -> Either GenerateTxError (Witness WitCtxTxIn BabbageEra)) -> Witness WitCtxTxIn BabbageEra -> Either GenerateTxError (Witness WitCtxTxIn BabbageEra) forall a b. (a -> b) -> a -> b -$ +$ ScriptWitnessInCtx WitCtxTxIn -> ScriptWitness WitCtxTxIn BabbageEra -> Witness WitCtxTxIn BabbageEra forall witctx era. ScriptWitnessInCtx witctx -> ScriptWitness witctx era -> Witness witctx era -C.ScriptWitness ScriptWitnessInCtx WitCtxTxIn -C.ScriptWitnessForSpending (ScriptWitness WitCtxTxIn BabbageEra +C.ScriptWitness ScriptWitnessInCtx WitCtxTxIn +C.ScriptWitnessForSpending (ScriptWitness WitCtxTxIn BabbageEra -> Witness WitCtxTxIn BabbageEra) -> ScriptWitness WitCtxTxIn BabbageEra -> Witness WitCtxTxIn BabbageEra forall a b. (a -> b) -> a -> b -$ +$ ScriptDatum WitCtxTxIn -> ScriptData -> ExecutionUnits -> ScriptWitness WitCtxTxIn BabbageEra -scriptWitnessBuilder +scriptWitnessBuilder ScriptDatum WitCtxTxIn -datum +datum (BuiltinData -> ScriptData -Pl.toCardanoScriptData (BuiltinData -> ScriptData) -> BuiltinData -> ScriptData +Pl.toCardanoScriptData (BuiltinData -> ScriptData) -> BuiltinData -> ScriptData forall a b. (a -> b) -> a -> b -$ redeemer -> BuiltinData +$ redeemer -> BuiltinData forall a. ToData a => a -> BuiltinData -Pl.toBuiltinData redeemer -redeemer) +Pl.toBuiltinData redeemer +redeemer) ExecutionUnits -Pl.zeroExecutionUnits -- We can't guess that yet, no? - mkWitness (TxSkelRedeemerForScript redeemer -redeemer) = do - (ValidatorHash -_validatorHash, Versioned Validator -validator, ScriptDatum WitCtxTxIn -datum) <- Either +Pl.zeroExecutionUnits -- We can't guess that yet, no? + mkWitness (TxSkelRedeemerForScript redeemer +redeemer) = do + (ValidatorHash +_validatorHash, Versioned Validator +validator, ScriptDatum WitCtxTxIn +datum) <- Either GenerateTxError (ValidatorHash, Versioned Validator, ScriptDatum WitCtxTxIn) -resolveScriptOutputOwnerAndDatum - ScriptDatum WitCtxTxIn +resolveScriptOutputOwnerAndDatum + ScriptDatum WitCtxTxIn -> ScriptData -> ExecutionUnits -> ScriptWitness WitCtxTxIn BabbageEra -scriptWitnessBuilder <- +scriptWitnessBuilder <- case Versioned Validator -validator of - Pl.Versioned (Pl.Validator Script -script) Language -Pl.PlutusV1 -> +validator of + Pl.Versioned (Pl.Validator Script +script) Language +Pl.PlutusV1 -> (ToCardanoError -> GenerateTxError) -> (PlutusScript PlutusScriptV1 -> ScriptDatum WitCtxTxIn @@ -997,7 +997,7 @@ forall (p :: * -> * -> *) a b c d. Bifunctor p => (a -> b) -> (c -> d) -> p a c -> p b d -bimap +bimap (String -> ToCardanoError -> GenerateTxError ToCardanoError String "txSkelIntoTxIn, translating to Cardano API PlutusV1 script") @@ -1016,9 +1016,9 @@ -> ScriptData -> ExecutionUnits -> ScriptWitness witctx era -C.PlutusScriptWitness ScriptLanguageInEra PlutusScriptV1 BabbageEra -C.PlutusScriptV1InBabbage PlutusScriptVersion PlutusScriptV1 -C.PlutusScriptV1 (PlutusScriptOrReferenceInput PlutusScriptV1 +C.PlutusScriptWitness ScriptLanguageInEra PlutusScriptV1 BabbageEra +C.PlutusScriptV1InBabbage PlutusScriptVersion PlutusScriptV1 +C.PlutusScriptV1 (PlutusScriptOrReferenceInput PlutusScriptV1 -> ScriptDatum WitCtxTxIn -> ScriptData -> ExecutionUnits @@ -1031,23 +1031,23 @@ -> ExecutionUnits -> ScriptWitness WitCtxTxIn BabbageEra forall b c a. (b -> c) -> (a -> b) -> a -> c -. PlutusScript PlutusScriptV1 +. PlutusScript PlutusScriptV1 -> PlutusScriptOrReferenceInput PlutusScriptV1 forall lang. PlutusScript lang -> PlutusScriptOrReferenceInput lang -C.PScript) +C.PScript) (AsType (PlutusScript PlutusScriptV1) -> Script -> Either ToCardanoError (PlutusScript PlutusScriptV1) forall plutusScript. SerialiseAsRawBytes plutusScript => AsType plutusScript -> Script -> Either ToCardanoError plutusScript -Pl.toCardanoPlutusScript (AsType PlutusScriptV1 -> AsType (PlutusScript PlutusScriptV1) +Pl.toCardanoPlutusScript (AsType PlutusScriptV1 -> AsType (PlutusScript PlutusScriptV1) forall lang. AsType lang -> AsType (PlutusScript lang) -C.AsPlutusScript AsType PlutusScriptV1 -C.AsPlutusScriptV1) Script -script) - Pl.Versioned (Pl.Validator Script -script) Language -Pl.PlutusV2 -> +C.AsPlutusScript AsType PlutusScriptV1 +C.AsPlutusScriptV1) Script +script) + Pl.Versioned (Pl.Validator Script +script) Language +Pl.PlutusV2 -> (ToCardanoError -> GenerateTxError) -> (PlutusScript PlutusScriptV2 -> ScriptDatum WitCtxTxIn @@ -1064,7 +1064,7 @@ forall (p :: * -> * -> *) a b c d. Bifunctor p => (a -> b) -> (c -> d) -> p a c -> p b d -bimap +bimap (String -> ToCardanoError -> GenerateTxError ToCardanoError String "txSkelIntoTxIn, translating to Cardano API PlutusV2 script") @@ -1083,9 +1083,9 @@ -> ScriptData -> ExecutionUnits -> ScriptWitness witctx era -C.PlutusScriptWitness ScriptLanguageInEra PlutusScriptV2 BabbageEra -C.PlutusScriptV2InBabbage PlutusScriptVersion PlutusScriptV2 -C.PlutusScriptV2 (PlutusScriptOrReferenceInput PlutusScriptV2 +C.PlutusScriptWitness ScriptLanguageInEra PlutusScriptV2 BabbageEra +C.PlutusScriptV2InBabbage PlutusScriptVersion PlutusScriptV2 +C.PlutusScriptV2 (PlutusScriptOrReferenceInput PlutusScriptV2 -> ScriptDatum WitCtxTxIn -> ScriptData -> ExecutionUnits @@ -1098,64 +1098,64 @@ -> ExecutionUnits -> ScriptWitness WitCtxTxIn BabbageEra forall b c a. (b -> c) -> (a -> b) -> a -> c -. PlutusScript PlutusScriptV2 +. PlutusScript PlutusScriptV2 -> PlutusScriptOrReferenceInput PlutusScriptV2 forall lang. PlutusScript lang -> PlutusScriptOrReferenceInput lang -C.PScript) +C.PScript) (AsType (PlutusScript PlutusScriptV2) -> Script -> Either ToCardanoError (PlutusScript PlutusScriptV2) forall plutusScript. SerialiseAsRawBytes plutusScript => AsType plutusScript -> Script -> Either ToCardanoError plutusScript -Pl.toCardanoPlutusScript (AsType PlutusScriptV2 -> AsType (PlutusScript PlutusScriptV2) +Pl.toCardanoPlutusScript (AsType PlutusScriptV2 -> AsType (PlutusScript PlutusScriptV2) forall lang. AsType lang -> AsType (PlutusScript lang) -C.AsPlutusScript AsType PlutusScriptV2 -C.AsPlutusScriptV2) Script -script) +C.AsPlutusScript AsType PlutusScriptV2 +C.AsPlutusScriptV2) Script +script) Witness WitCtxTxIn BabbageEra -> Either GenerateTxError (Witness WitCtxTxIn BabbageEra) forall (m :: * -> *) a. Monad m => a -> m a -return (Witness WitCtxTxIn BabbageEra +return (Witness WitCtxTxIn BabbageEra -> Either GenerateTxError (Witness WitCtxTxIn BabbageEra)) -> Witness WitCtxTxIn BabbageEra -> Either GenerateTxError (Witness WitCtxTxIn BabbageEra) forall a b. (a -> b) -> a -> b -$ +$ ScriptWitnessInCtx WitCtxTxIn -> ScriptWitness WitCtxTxIn BabbageEra -> Witness WitCtxTxIn BabbageEra forall witctx era. ScriptWitnessInCtx witctx -> ScriptWitness witctx era -> Witness witctx era -C.ScriptWitness ScriptWitnessInCtx WitCtxTxIn -C.ScriptWitnessForSpending (ScriptWitness WitCtxTxIn BabbageEra +C.ScriptWitness ScriptWitnessInCtx WitCtxTxIn +C.ScriptWitnessForSpending (ScriptWitness WitCtxTxIn BabbageEra -> Witness WitCtxTxIn BabbageEra) -> ScriptWitness WitCtxTxIn BabbageEra -> Witness WitCtxTxIn BabbageEra forall a b. (a -> b) -> a -> b -$ +$ ScriptDatum WitCtxTxIn -> ScriptData -> ExecutionUnits -> ScriptWitness WitCtxTxIn BabbageEra -scriptWitnessBuilder +scriptWitnessBuilder ScriptDatum WitCtxTxIn -datum +datum (BuiltinData -> ScriptData -Pl.toCardanoScriptData (BuiltinData -> ScriptData) -> BuiltinData -> ScriptData +Pl.toCardanoScriptData (BuiltinData -> ScriptData) -> BuiltinData -> ScriptData forall a b. (a -> b) -> a -> b -$ redeemer -> BuiltinData +$ redeemer -> BuiltinData forall a. ToData a => a -> BuiltinData -Pl.toBuiltinData redeemer -redeemer) +Pl.toBuiltinData redeemer +redeemer) ExecutionUnits -Pl.zeroExecutionUnits -- We can't guess that yet, no? +Pl.zeroExecutionUnits -- We can't guess that yet, no? -- Convert a list of 'Pl.TxOutRef' into a 'C.TxInsReference' - txOutRefsToTxInsReference :: [Pl.TxOutRef] -> Either GenerateTxError (C.TxInsReference C.BuildTx C.BabbageEra) - txOutRefsToTxInsReference :: [TxOutRef] + txOutRefsToTxInsReference :: [Pl.TxOutRef] -> Either GenerateTxError (C.TxInsReference C.BuildTx C.BabbageEra) + txOutRefsToTxInsReference :: [TxOutRef] -> Either GenerateTxError (TxInsReference BuildTx BabbageEra) -txOutRefsToTxInsReference = +txOutRefsToTxInsReference = (ToCardanoError -> GenerateTxError) -> ([TxIn] -> TxInsReference BuildTx BabbageEra) -> Either ToCardanoError [TxIn] @@ -1163,23 +1163,23 @@ forall (p :: * -> * -> *) a b c d. Bifunctor p => (a -> b) -> (c -> d) -> p a c -> p b d -bimap +bimap (String -> ToCardanoError -> GenerateTxError ToCardanoError String "txOutRefsToTxInsReference") ( \case [] -> TxInsReference BuildTx BabbageEra forall build era. TxInsReference build era -C.TxInsReferenceNone - [TxIn] -txIns -> ReferenceTxInsScriptsInlineDatumsSupportedInEra BabbageEra +C.TxInsReferenceNone + [TxIn] +txIns -> ReferenceTxInsScriptsInlineDatumsSupportedInEra BabbageEra -> [TxIn] -> TxInsReference BuildTx BabbageEra forall era build. ReferenceTxInsScriptsInlineDatumsSupportedInEra era -> [TxIn] -> TxInsReference build era -C.TxInsReference ReferenceTxInsScriptsInlineDatumsSupportedInEra BabbageEra -C.ReferenceTxInsScriptsInlineDatumsInBabbageEra [TxIn] -txIns +C.TxInsReference ReferenceTxInsScriptsInlineDatumsSupportedInEra BabbageEra +C.ReferenceTxInsScriptsInlineDatumsInBabbageEra [TxIn] +txIns ) (Either ToCardanoError [TxIn] -> Either GenerateTxError (TxInsReference BuildTx BabbageEra)) @@ -1187,25 +1187,25 @@ -> [TxOutRef] -> Either GenerateTxError (TxInsReference BuildTx BabbageEra) forall b c a. (b -> c) -> (a -> b) -> a -> c -. (TxOutRef -> Either ToCardanoError TxIn) +. (TxOutRef -> Either ToCardanoError TxIn) -> [TxOutRef] -> Either ToCardanoError [TxIn] forall (t :: * -> *) (m :: * -> *) a b. (Traversable t, Monad m) => (a -> m b) -> t a -> m (t b) -mapM TxOutRef -> Either ToCardanoError TxIn -Pl.toCardanoTxIn +mapM TxOutRef -> Either ToCardanoError TxIn +Pl.toCardanoTxIn -- Convert a list of 'Pl.TxOutRef' into a 'C.TxInsCollateral' - txOutRefsToTxSkelInsCollateral :: [Pl.TxOutRef] -> Either GenerateTxError (C.TxInsCollateral C.BabbageEra) - txOutRefsToTxSkelInsCollateral :: [TxOutRef] -> Either GenerateTxError (TxInsCollateral BabbageEra) -txOutRefsToTxSkelInsCollateral = + txOutRefsToTxSkelInsCollateral :: [Pl.TxOutRef] -> Either GenerateTxError (C.TxInsCollateral C.BabbageEra) + txOutRefsToTxSkelInsCollateral :: [TxOutRef] -> Either GenerateTxError (TxInsCollateral BabbageEra) +txOutRefsToTxSkelInsCollateral = (ToCardanoError -> GenerateTxError) -> Either ToCardanoError (TxInsCollateral BabbageEra) -> Either GenerateTxError (TxInsCollateral BabbageEra) forall (a :: * -> * -> *) b c d. ArrowChoice a => a b c -> a (Either b d) (Either c d) -left (String -> ToCardanoError -> GenerateTxError +left (String -> ToCardanoError -> GenerateTxError ToCardanoError String "txOutRefsToTxInCollateral") (Either ToCardanoError (TxInsCollateral BabbageEra) @@ -1215,57 +1215,57 @@ -> [TxOutRef] -> Either GenerateTxError (TxInsCollateral BabbageEra) forall b c a. (b -> c) -> (a -> b) -> a -> c -. ([TxIn] -> TxInsCollateral BabbageEra) +. ([TxIn] -> TxInsCollateral BabbageEra) -> Either ToCardanoError [TxIn] -> Either ToCardanoError (TxInsCollateral BabbageEra) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b -fmap [TxIn] -> TxInsCollateral BabbageEra -toTxInsCollateral +fmap [TxIn] -> TxInsCollateral BabbageEra +toTxInsCollateral (Either ToCardanoError [TxIn] -> Either ToCardanoError (TxInsCollateral BabbageEra)) -> ([TxOutRef] -> Either ToCardanoError [TxIn]) -> [TxOutRef] -> Either ToCardanoError (TxInsCollateral BabbageEra) forall b c a. (b -> c) -> (a -> b) -> a -> c -. (TxOutRef -> Either ToCardanoError TxIn) +. (TxOutRef -> Either ToCardanoError TxIn) -> [TxOutRef] -> Either ToCardanoError [TxIn] forall (t :: * -> *) (m :: * -> *) a b. (Traversable t, Monad m) => (a -> m b) -> t a -> m (t b) -mapM TxOutRef -> Either ToCardanoError TxIn -Pl.toCardanoTxIn +mapM TxOutRef -> Either ToCardanoError TxIn +Pl.toCardanoTxIn where - toTxInsCollateral :: [TxIn] -> TxInsCollateral BabbageEra -toTxInsCollateral [] = TxInsCollateral BabbageEra + toTxInsCollateral :: [TxIn] -> TxInsCollateral BabbageEra +toTxInsCollateral [] = TxInsCollateral BabbageEra forall era. TxInsCollateral era -C.TxInsCollateralNone - toTxInsCollateral [TxIn] -ins = CollateralSupportedInEra BabbageEra +C.TxInsCollateralNone + toTxInsCollateral [TxIn] +ins = CollateralSupportedInEra BabbageEra -> [TxIn] -> TxInsCollateral BabbageEra forall era. CollateralSupportedInEra era -> [TxIn] -> TxInsCollateral era -C.TxInsCollateral CollateralSupportedInEra BabbageEra -C.CollateralInBabbageEra [TxIn] -ins +C.TxInsCollateral CollateralSupportedInEra BabbageEra +C.CollateralInBabbageEra [TxIn] +ins -- Convert the 'TxSkelMints' into a 'TxMintValue' - txSkelMintsToTxMintValue :: TxSkelMints -> Either GenerateTxError (C.TxMintValue C.BuildTx C.BabbageEra) - txSkelMintsToTxMintValue :: TxSkelMints + txSkelMintsToTxMintValue :: TxSkelMints -> Either GenerateTxError (C.TxMintValue C.BuildTx C.BabbageEra) + txSkelMintsToTxMintValue :: TxSkelMints -> Either GenerateTxError (TxMintValue BuildTx BabbageEra) -txSkelMintsToTxMintValue TxSkelMints -mints = +txSkelMintsToTxMintValue TxSkelMints +mints = if TxSkelMints -mints TxSkelMints -> TxSkelMints -> Bool +mints TxSkelMints -> TxSkelMints -> Bool forall a. Eq a => a -> a -> Bool -== TxSkelMints +== TxSkelMints forall k a. Map k a -Map.empty +Map.empty then TxMintValue BuildTx BabbageEra -> Either GenerateTxError (TxMintValue BuildTx BabbageEra) forall a b. b -> Either a b -Right TxMintValue BuildTx BabbageEra +Right TxMintValue BuildTx BabbageEra forall build era. TxMintValue build era -C.TxMintNone +C.TxMintNone else MultiAssetSupportedInEra BabbageEra -> Value -> BuildTxWith @@ -1276,8 +1276,8 @@ -> Value -> BuildTxWith build (Map PolicyId (ScriptWitness WitCtxMint era)) -> TxMintValue build era -C.TxMintValue MultiAssetSupportedInEra BabbageEra -C.MultiAssetInBabbageEra (Value +C.TxMintValue MultiAssetSupportedInEra BabbageEra +C.MultiAssetInBabbageEra (Value -> BuildTxWith BuildTx (Map PolicyId (ScriptWitness WitCtxMint BabbageEra)) -> TxMintValue BuildTx BabbageEra) @@ -1288,8 +1288,8 @@ BuildTx (Map PolicyId (ScriptWitness WitCtxMint BabbageEra)) -> TxMintValue BuildTx BabbageEra) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b -<$> Either GenerateTxError Value -mintVal Either +<$> Either GenerateTxError Value +mintVal Either GenerateTxError (BuildTxWith BuildTx (Map PolicyId (ScriptWitness WitCtxMint BabbageEra)) @@ -1300,11 +1300,11 @@ BuildTx (Map PolicyId (ScriptWitness WitCtxMint BabbageEra))) -> Either GenerateTxError (TxMintValue BuildTx BabbageEra) forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b -<*> (Map PolicyId (ScriptWitness WitCtxMint BabbageEra) +<*> (Map PolicyId (ScriptWitness WitCtxMint BabbageEra) -> BuildTxWith BuildTx (Map PolicyId (ScriptWitness WitCtxMint BabbageEra)) forall a. a -> BuildTxWith BuildTx a -C.BuildTxWith (Map PolicyId (ScriptWitness WitCtxMint BabbageEra) +C.BuildTxWith (Map PolicyId (ScriptWitness WitCtxMint BabbageEra) -> BuildTxWith BuildTx (Map PolicyId (ScriptWitness WitCtxMint BabbageEra))) -> Either @@ -1315,20 +1315,20 @@ (BuildTxWith BuildTx (Map PolicyId (ScriptWitness WitCtxMint BabbageEra))) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b -<$> Either +<$> Either GenerateTxError (Map PolicyId (ScriptWitness WitCtxMint BabbageEra)) -witnessMap) +witnessMap) where - mintVal :: Either GenerateTxError C.Value - mintVal :: Either GenerateTxError Value -mintVal = + mintVal :: Either GenerateTxError C.Value + mintVal :: Either GenerateTxError Value +mintVal = (ToCardanoError -> GenerateTxError) -> Either ToCardanoError Value -> Either GenerateTxError Value forall (a :: * -> * -> *) b c d. ArrowChoice a => a b c -> a (Either b d) (Either c d) -left (String -> ToCardanoError -> GenerateTxError +left (String -> ToCardanoError -> GenerateTxError ToCardanoError String "txSkelMintsToTxMintValue, translating minted value") (Either ToCardanoError Value -> Either GenerateTxError Value) @@ -1336,26 +1336,26 @@ -> TxSkelMints -> Either GenerateTxError Value forall b c a. (b -> c) -> (a -> b) -> a -> c -. Value -> Either ToCardanoError Value -Pl.toCardanoValue +. Value -> Either ToCardanoError Value +Pl.toCardanoValue (Value -> Either ToCardanoError Value) -> (TxSkelMints -> Value) -> TxSkelMints -> Either ToCardanoError Value forall b c a. (b -> c) -> (a -> b) -> a -> c -. TxSkelMints -> Value +. TxSkelMints -> Value txSkelMintsValue (TxSkelMints -> Either GenerateTxError Value) -> TxSkelMints -> Either GenerateTxError Value forall a b. (a -> b) -> a -> b -$ TxSkelMints -mints +$ TxSkelMints +mints - witnessMap :: Either GenerateTxError (Map C.PolicyId (C.ScriptWitness C.WitCtxMint C.BabbageEra)) - witnessMap :: Either + witnessMap :: Either GenerateTxError (Map C.PolicyId (C.ScriptWitness C.WitCtxMint C.BabbageEra)) + witnessMap :: Either GenerateTxError (Map PolicyId (ScriptWitness WitCtxMint BabbageEra)) -witnessMap = +witnessMap = ([Map PolicyId (ScriptWitness WitCtxMint BabbageEra)] -> Map PolicyId (ScriptWitness WitCtxMint BabbageEra)) -> Either @@ -1367,10 +1367,10 @@ forall (a :: * -> * -> *) b c d. ArrowChoice a => a b c -> a (Either d b) (Either d c) -right [Map PolicyId (ScriptWitness WitCtxMint BabbageEra)] +right [Map PolicyId (ScriptWitness WitCtxMint BabbageEra)] -> Map PolicyId (ScriptWitness WitCtxMint BabbageEra) forall a. Monoid a => [a] -> a -mconcat +mconcat (Either GenerateTxError [Map PolicyId (ScriptWitness WitCtxMint BabbageEra)] @@ -1384,7 +1384,7 @@ GenerateTxError (Map PolicyId (ScriptWitness WitCtxMint BabbageEra)) forall a b. (a -> b) -> a -> b -$ ((Versioned MintingPolicy, MintsRedeemer, TokenName, Integer) +$ ((Versioned MintingPolicy, MintsRedeemer, TokenName, Integer) -> Either GenerateTxError (Map PolicyId (ScriptWitness WitCtxMint BabbageEra))) @@ -1395,17 +1395,17 @@ forall (t :: * -> *) (m :: * -> *) a b. (Traversable t, Monad m) => (a -> m b) -> t a -> m (t b) -mapM - ( \(Versioned MintingPolicy -policy, MintsRedeemer -redeemer, TokenName -_tName, Integer -_amount) -> +mapM + ( \(Versioned MintingPolicy +policy, MintsRedeemer +redeemer, TokenName +_tName, Integer +_amount) -> PolicyId -> ScriptWitness WitCtxMint BabbageEra -> Map PolicyId (ScriptWitness WitCtxMint BabbageEra) forall k a. k -> a -> Map k a -Map.singleton +Map.singleton (PolicyId -> ScriptWitness WitCtxMint BabbageEra -> Map PolicyId (ScriptWitness WitCtxMint BabbageEra)) @@ -1415,20 +1415,20 @@ (ScriptWitness WitCtxMint BabbageEra -> Map PolicyId (ScriptWitness WitCtxMint BabbageEra)) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b -<$> (ToCardanoError -> GenerateTxError) +<$> (ToCardanoError -> GenerateTxError) -> Either ToCardanoError PolicyId -> Either GenerateTxError PolicyId forall (a :: * -> * -> *) b c d. ArrowChoice a => a b c -> a (Either b d) (Either c d) -left +left (String -> ToCardanoError -> GenerateTxError ToCardanoError String "txSkelMintsToTxMintValue, calculating the witness map") (MintingPolicyHash -> Either ToCardanoError PolicyId -Pl.toCardanoPolicyId (Versioned MintingPolicy -> MintingPolicyHash -Pl.mintingPolicyHash Versioned MintingPolicy -policy)) +Pl.toCardanoPolicyId (Versioned MintingPolicy -> MintingPolicyHash +Pl.mintingPolicyHash Versioned MintingPolicy +policy)) Either GenerateTxError (ScriptWitness WitCtxMint BabbageEra @@ -1438,12 +1438,12 @@ GenerateTxError (Map PolicyId (ScriptWitness WitCtxMint BabbageEra)) forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b -<*> Versioned MintingPolicy +<*> Versioned MintingPolicy -> MintsRedeemer -> Either GenerateTxError (ScriptWitness WitCtxMint BabbageEra) -mkMintWitness Versioned MintingPolicy -policy MintsRedeemer -redeemer +mkMintWitness Versioned MintingPolicy +policy MintsRedeemer +redeemer ) ([(Versioned MintingPolicy, MintsRedeemer, TokenName, Integer)] -> Either @@ -1454,33 +1454,33 @@ GenerateTxError [Map PolicyId (ScriptWitness WitCtxMint BabbageEra)] forall a b. (a -> b) -> a -> b -$ TxSkelMints +$ TxSkelMints -> [(Versioned MintingPolicy, MintsRedeemer, TokenName, Integer)] txSkelMintsToList TxSkelMints -mints +mints - mkMintWitness :: - Pl.Versioned Pl.MintingPolicy -> + mkMintWitness :: + Pl.Versioned Pl.MintingPolicy -> MintsRedeemer -> - Either + Either GenerateTxError - (C.ScriptWitness C.WitCtxMint C.BabbageEra) - mkMintWitness :: Versioned MintingPolicy + (C.ScriptWitness C.WitCtxMint C.BabbageEra) + mkMintWitness :: Versioned MintingPolicy -> MintsRedeemer -> Either GenerateTxError (ScriptWitness WitCtxMint BabbageEra) -mkMintWitness (Pl.Versioned (Pl.MintingPolicy Script -script) Language -version) MintsRedeemer -redeemer = do - ScriptDatum WitCtxMint +mkMintWitness (Pl.Versioned (Pl.MintingPolicy Script +script) Language +version) MintsRedeemer +redeemer = do + ScriptDatum WitCtxMint -> ScriptData -> ExecutionUnits -> ScriptWitness WitCtxMint BabbageEra -scriptWitnessBuilder <- +scriptWitnessBuilder <- case Language -version of +version of Language -Pl.PlutusV1 -> +Pl.PlutusV1 -> (ToCardanoError -> GenerateTxError) -> (PlutusScript PlutusScriptV1 -> ScriptDatum WitCtxMint @@ -1497,7 +1497,7 @@ forall (p :: * -> * -> *) a b c d. Bifunctor p => (a -> b) -> (c -> d) -> p a c -> p b d -bimap +bimap (String -> ToCardanoError -> GenerateTxError ToCardanoError String "txSkelMintsToTxMintValue, translating to Cardano API PlutusV1 script") @@ -1516,9 +1516,9 @@ -> ScriptData -> ExecutionUnits -> ScriptWitness witctx era -C.PlutusScriptWitness ScriptLanguageInEra PlutusScriptV1 BabbageEra -C.PlutusScriptV1InBabbage PlutusScriptVersion PlutusScriptV1 -C.PlutusScriptV1 (PlutusScriptOrReferenceInput PlutusScriptV1 +C.PlutusScriptWitness ScriptLanguageInEra PlutusScriptV1 BabbageEra +C.PlutusScriptV1InBabbage PlutusScriptVersion PlutusScriptV1 +C.PlutusScriptV1 (PlutusScriptOrReferenceInput PlutusScriptV1 -> ScriptDatum WitCtxMint -> ScriptData -> ExecutionUnits @@ -1531,22 +1531,22 @@ -> ExecutionUnits -> ScriptWitness WitCtxMint BabbageEra forall b c a. (b -> c) -> (a -> b) -> a -> c -. PlutusScript PlutusScriptV1 +. PlutusScript PlutusScriptV1 -> PlutusScriptOrReferenceInput PlutusScriptV1 forall lang. PlutusScript lang -> PlutusScriptOrReferenceInput lang -C.PScript) +C.PScript) (AsType (PlutusScript PlutusScriptV1) -> Script -> Either ToCardanoError (PlutusScript PlutusScriptV1) forall plutusScript. SerialiseAsRawBytes plutusScript => AsType plutusScript -> Script -> Either ToCardanoError plutusScript -Pl.toCardanoPlutusScript (AsType PlutusScriptV1 -> AsType (PlutusScript PlutusScriptV1) +Pl.toCardanoPlutusScript (AsType PlutusScriptV1 -> AsType (PlutusScript PlutusScriptV1) forall lang. AsType lang -> AsType (PlutusScript lang) -C.AsPlutusScript AsType PlutusScriptV1 -C.AsPlutusScriptV1) Script -script) +C.AsPlutusScript AsType PlutusScriptV1 +C.AsPlutusScriptV1) Script +script) Language -Pl.PlutusV2 -> +Pl.PlutusV2 -> (ToCardanoError -> GenerateTxError) -> (PlutusScript PlutusScriptV2 -> ScriptDatum WitCtxMint @@ -1563,7 +1563,7 @@ forall (p :: * -> * -> *) a b c d. Bifunctor p => (a -> b) -> (c -> d) -> p a c -> p b d -bimap +bimap (String -> ToCardanoError -> GenerateTxError ToCardanoError String "txSkelMintsToTxMintValue, translating to Cardano API PlutusV2 script") @@ -1582,9 +1582,9 @@ -> ScriptData -> ExecutionUnits -> ScriptWitness witctx era -C.PlutusScriptWitness ScriptLanguageInEra PlutusScriptV2 BabbageEra -C.PlutusScriptV2InBabbage PlutusScriptVersion PlutusScriptV2 -C.PlutusScriptV2 (PlutusScriptOrReferenceInput PlutusScriptV2 +C.PlutusScriptWitness ScriptLanguageInEra PlutusScriptV2 BabbageEra +C.PlutusScriptV2InBabbage PlutusScriptVersion PlutusScriptV2 +C.PlutusScriptV2 (PlutusScriptOrReferenceInput PlutusScriptV2 -> ScriptDatum WitCtxMint -> ScriptData -> ExecutionUnits @@ -1597,78 +1597,78 @@ -> ExecutionUnits -> ScriptWitness WitCtxMint BabbageEra forall b c a. (b -> c) -> (a -> b) -> a -> c -. PlutusScript PlutusScriptV2 +. PlutusScript PlutusScriptV2 -> PlutusScriptOrReferenceInput PlutusScriptV2 forall lang. PlutusScript lang -> PlutusScriptOrReferenceInput lang -C.PScript) +C.PScript) (AsType (PlutusScript PlutusScriptV2) -> Script -> Either ToCardanoError (PlutusScript PlutusScriptV2) forall plutusScript. SerialiseAsRawBytes plutusScript => AsType plutusScript -> Script -> Either ToCardanoError plutusScript -Pl.toCardanoPlutusScript (AsType PlutusScriptV2 -> AsType (PlutusScript PlutusScriptV2) +Pl.toCardanoPlutusScript (AsType PlutusScriptV2 -> AsType (PlutusScript PlutusScriptV2) forall lang. AsType lang -> AsType (PlutusScript lang) -C.AsPlutusScript AsType PlutusScriptV2 -C.AsPlutusScriptV2) Script -script) +C.AsPlutusScript AsType PlutusScriptV2 +C.AsPlutusScriptV2) Script +script) ScriptWitness WitCtxMint BabbageEra -> Either GenerateTxError (ScriptWitness WitCtxMint BabbageEra) forall (m :: * -> *) a. Monad m => a -> m a -return (ScriptWitness WitCtxMint BabbageEra +return (ScriptWitness WitCtxMint BabbageEra -> Either GenerateTxError (ScriptWitness WitCtxMint BabbageEra)) -> ScriptWitness WitCtxMint BabbageEra -> Either GenerateTxError (ScriptWitness WitCtxMint BabbageEra) forall a b. (a -> b) -> a -> b -$ +$ ScriptDatum WitCtxMint -> ScriptData -> ExecutionUnits -> ScriptWitness WitCtxMint BabbageEra -scriptWitnessBuilder +scriptWitnessBuilder ScriptDatum WitCtxMint -C.NoScriptDatumForMint -- This seems to be the only well-typed option (?) +C.NoScriptDatumForMint -- This seems to be the only well-typed option (?) ( case MintsRedeemer -redeemer of +redeemer of MintsRedeemer NoMintsRedeemer -> BuiltinData -> ScriptData -Pl.toCardanoScriptData (BuiltinData -> ScriptData) -> BuiltinData -> ScriptData +Pl.toCardanoScriptData (BuiltinData -> ScriptData) -> BuiltinData -> ScriptData forall a b. (a -> b) -> a -> b -$ () -> BuiltinData +$ () -> BuiltinData forall a. ToData a => a -> BuiltinData -Pl.toBuiltinData () -- This is also how plutus-apps is doing it: Using no redeemer means using '()' on-chain - SomeMintsRedeemer redeemer -red -> BuiltinData -> ScriptData -Pl.toCardanoScriptData (BuiltinData -> ScriptData) -> BuiltinData -> ScriptData +Pl.toBuiltinData () -- This is also how plutus-apps is doing it: Using no redeemer means using '()' on-chain + SomeMintsRedeemer redeemer +red -> BuiltinData -> ScriptData +Pl.toCardanoScriptData (BuiltinData -> ScriptData) -> BuiltinData -> ScriptData forall a b. (a -> b) -> a -> b -$ redeemer -> BuiltinData +$ redeemer -> BuiltinData forall a. ToData a => a -> BuiltinData -Pl.toBuiltinData redeemer -red +Pl.toBuiltinData redeemer +red ) ExecutionUnits -Pl.zeroExecutionUnits -- This is what plutus-apps does as well, we can't know this yet, no? +Pl.zeroExecutionUnits -- This is what plutus-apps does as well, we can't know this yet, no? -- Convert a 'TxSkelOut' to the corresponding 'C.TxOut'. -txSkelOutToCardanoTxOut :: Pl.Params -> TxSkelOut -> Either GenerateTxError (C.TxOut C.CtxTx C.BabbageEra) +txSkelOutToCardanoTxOut :: Pl.Params -> TxSkelOut -> Either GenerateTxError (C.TxOut C.CtxTx C.BabbageEra) txSkelOutToCardanoTxOut :: Params -> TxSkelOut -> Either GenerateTxError (TxOut CtxTx BabbageEra) -txSkelOutToCardanoTxOut Params -theParams (Pays o -output) = +txSkelOutToCardanoTxOut Params +theParams (Pays o +output) = (ToCardanoError -> GenerateTxError) -> Either ToCardanoError (TxOut CtxTx BabbageEra) -> Either GenerateTxError (TxOut CtxTx BabbageEra) forall (a :: * -> * -> *) b c d. ArrowChoice a => a b c -> a (Either b d) (Either c d) -left (String -> ToCardanoError -> GenerateTxError +left (String -> ToCardanoError -> GenerateTxError ToCardanoError String "txSkelOutToTxOut") (Either ToCardanoError (TxOut CtxTx BabbageEra) -> Either GenerateTxError (TxOut CtxTx BabbageEra)) -> Either ToCardanoError (TxOut CtxTx BabbageEra) -> Either GenerateTxError (TxOut CtxTx BabbageEra) forall a b. (a -> b) -> a -> b -$ +$ AddressInEra BabbageEra -> TxOutValue BabbageEra -> TxOutDatum CtxTx BabbageEra @@ -1680,7 +1680,7 @@ -> TxOutDatum ctx era -> ReferenceScript era -> TxOut ctx era -C.TxOut +C.TxOut (AddressInEra BabbageEra -> TxOutValue BabbageEra -> TxOutDatum CtxTx BabbageEra @@ -1694,16 +1694,16 @@ -> ReferenceScript BabbageEra -> TxOut CtxTx BabbageEra) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b -<$> NetworkId +<$> NetworkId -> Address -> Either ToCardanoError (AddressInEra BabbageEra) -Pl.toCardanoAddressInEra (Params -> NetworkId -Pl.pNetworkId Params -theParams) (o -> Address +Pl.toCardanoAddressInEra (Params -> NetworkId +Pl.pNetworkId Params +theParams) (o -> Address forall o. (IsAbstractOutput o, ToCredential (OwnerType o)) => o -> Address outputAddress o -output) +output) Either ToCardanoError (TxOutValue BabbageEra @@ -1716,16 +1716,16 @@ (TxOutDatum CtxTx BabbageEra -> ReferenceScript BabbageEra -> TxOut CtxTx BabbageEra) forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b -<*> (Value -> TxOutValue BabbageEra -Pl.toCardanoTxOutValue (Value -> TxOutValue BabbageEra) +<*> (Value -> TxOutValue BabbageEra +Pl.toCardanoTxOutValue (Value -> TxOutValue BabbageEra) -> Either ToCardanoError Value -> Either ToCardanoError (TxOutValue BabbageEra) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b -<$> Value -> Either ToCardanoError Value -Pl.toCardanoValue (o -> Value +<$> Value -> Either ToCardanoError Value +Pl.toCardanoValue (o -> Value forall o. (IsAbstractOutput o, ToValue (ValueType o)) => o -> Value outputValue o -output)) +output)) Either ToCardanoError (TxOutDatum CtxTx BabbageEra @@ -1735,90 +1735,90 @@ ToCardanoError (ReferenceScript BabbageEra -> TxOut CtxTx BabbageEra) forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b -<*> ( case o -output o -> Optic' A_Lens NoIx o TxSkelOutDatum -> TxSkelOutDatum +<*> ( case o +output o -> Optic' A_Lens NoIx o TxSkelOutDatum -> TxSkelOutDatum forall k s (is :: IxList) a. Is k A_Getter => s -> Optic' k is s a -> a -^. Optic' A_Lens NoIx o TxSkelOutDatum +^. Optic' A_Lens NoIx o TxSkelOutDatum forall o. IsAbstractOutput o => Lens' o (DatumType o) outputDatumL of TxSkelOutDatum TxSkelOutNoDatum -> TxOutDatum CtxTx BabbageEra -> Either ToCardanoError (TxOutDatum CtxTx BabbageEra) forall a b. b -> Either a b -Right TxOutDatum CtxTx BabbageEra -Pl.toCardanoTxOutNoDatum - TxSkelOutDatumHash a -datum -> DatumHash -> Either ToCardanoError (TxOutDatum CtxTx BabbageEra) +Right TxOutDatum CtxTx BabbageEra +Pl.toCardanoTxOutNoDatum + TxSkelOutDatumHash a +datum -> DatumHash -> Either ToCardanoError (TxOutDatum CtxTx BabbageEra) forall ctx. DatumHash -> Either ToCardanoError (TxOutDatum ctx BabbageEra) -Pl.toCardanoTxOutDatumHash (DatumHash -> Either ToCardanoError (TxOutDatum CtxTx BabbageEra)) +Pl.toCardanoTxOutDatumHash (DatumHash -> Either ToCardanoError (TxOutDatum CtxTx BabbageEra)) -> (a -> DatumHash) -> a -> Either ToCardanoError (TxOutDatum CtxTx BabbageEra) forall b c a. (b -> c) -> (a -> b) -> a -> c -. Datum -> DatumHash -Pl.datumHash (Datum -> DatumHash) -> (a -> Datum) -> a -> DatumHash +. Datum -> DatumHash +Pl.datumHash (Datum -> DatumHash) -> (a -> Datum) -> a -> DatumHash forall b c a. (b -> c) -> (a -> b) -> a -> c -. BuiltinData -> Datum -Pl.Datum (BuiltinData -> Datum) -> (a -> BuiltinData) -> a -> Datum +. BuiltinData -> Datum +Pl.Datum (BuiltinData -> Datum) -> (a -> BuiltinData) -> a -> Datum forall b c a. (b -> c) -> (a -> b) -> a -> c -. a -> BuiltinData +. a -> BuiltinData forall a. ToData a => a -> BuiltinData -Pl.toBuiltinData (a -> Either ToCardanoError (TxOutDatum CtxTx BabbageEra)) +Pl.toBuiltinData (a -> Either ToCardanoError (TxOutDatum CtxTx BabbageEra)) -> a -> Either ToCardanoError (TxOutDatum CtxTx BabbageEra) forall a b. (a -> b) -> a -> b -$ a -datum - TxSkelOutDatum a -datum -> TxOutDatum CtxTx BabbageEra +$ a +datum + TxSkelOutDatum a +datum -> TxOutDatum CtxTx BabbageEra -> Either ToCardanoError (TxOutDatum CtxTx BabbageEra) forall a b. b -> Either a b -Right (TxOutDatum CtxTx BabbageEra +Right (TxOutDatum CtxTx BabbageEra -> Either ToCardanoError (TxOutDatum CtxTx BabbageEra)) -> (a -> TxOutDatum CtxTx BabbageEra) -> a -> Either ToCardanoError (TxOutDatum CtxTx BabbageEra) forall b c a. (b -> c) -> (a -> b) -> a -> c -. Datum -> TxOutDatum CtxTx BabbageEra -Pl.toCardanoTxOutDatumInTx (Datum -> TxOutDatum CtxTx BabbageEra) +. Datum -> TxOutDatum CtxTx BabbageEra +Pl.toCardanoTxOutDatumInTx (Datum -> TxOutDatum CtxTx BabbageEra) -> (a -> Datum) -> a -> TxOutDatum CtxTx BabbageEra forall b c a. (b -> c) -> (a -> b) -> a -> c -. BuiltinData -> Datum -Pl.Datum (BuiltinData -> Datum) -> (a -> BuiltinData) -> a -> Datum +. BuiltinData -> Datum +Pl.Datum (BuiltinData -> Datum) -> (a -> BuiltinData) -> a -> Datum forall b c a. (b -> c) -> (a -> b) -> a -> c -. a -> BuiltinData +. a -> BuiltinData forall a. ToData a => a -> BuiltinData -Pl.toBuiltinData (a -> Either ToCardanoError (TxOutDatum CtxTx BabbageEra)) +Pl.toBuiltinData (a -> Either ToCardanoError (TxOutDatum CtxTx BabbageEra)) -> a -> Either ToCardanoError (TxOutDatum CtxTx BabbageEra) forall a b. (a -> b) -> a -> b -$ a -datum - TxSkelOutInlineDatum a -datum -> TxOutDatum CtxTx BabbageEra +$ a +datum + TxSkelOutInlineDatum a +datum -> TxOutDatum CtxTx BabbageEra -> Either ToCardanoError (TxOutDatum CtxTx BabbageEra) forall a b. b -> Either a b -Right (TxOutDatum CtxTx BabbageEra +Right (TxOutDatum CtxTx BabbageEra -> Either ToCardanoError (TxOutDatum CtxTx BabbageEra)) -> (a -> TxOutDatum CtxTx BabbageEra) -> a -> Either ToCardanoError (TxOutDatum CtxTx BabbageEra) forall b c a. (b -> c) -> (a -> b) -> a -> c -. Datum -> TxOutDatum CtxTx BabbageEra -Pl.toCardanoTxOutDatumInline (Datum -> TxOutDatum CtxTx BabbageEra) +. Datum -> TxOutDatum CtxTx BabbageEra +Pl.toCardanoTxOutDatumInline (Datum -> TxOutDatum CtxTx BabbageEra) -> (a -> Datum) -> a -> TxOutDatum CtxTx BabbageEra forall b c a. (b -> c) -> (a -> b) -> a -> c -. BuiltinData -> Datum -Pl.Datum (BuiltinData -> Datum) -> (a -> BuiltinData) -> a -> Datum +. BuiltinData -> Datum +Pl.Datum (BuiltinData -> Datum) -> (a -> BuiltinData) -> a -> Datum forall b c a. (b -> c) -> (a -> b) -> a -> c -. a -> BuiltinData +. a -> BuiltinData forall a. ToData a => a -> BuiltinData -Pl.toBuiltinData (a -> Either ToCardanoError (TxOutDatum CtxTx BabbageEra)) +Pl.toBuiltinData (a -> Either ToCardanoError (TxOutDatum CtxTx BabbageEra)) -> a -> Either ToCardanoError (TxOutDatum CtxTx BabbageEra) forall a b. (a -> b) -> a -> b -$ a -datum +$ a +datum ) Either ToCardanoError @@ -1826,21 +1826,21 @@ -> Either ToCardanoError (ReferenceScript BabbageEra) -> Either ToCardanoError (TxOut CtxTx BabbageEra) forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b -<*> Maybe (Versioned Script) +<*> Maybe (Versioned Script) -> Either ToCardanoError (ReferenceScript BabbageEra) -Pl.toCardanoReferenceScript (ReferenceScriptType o -> Versioned Script +Pl.toCardanoReferenceScript (ReferenceScriptType o -> Versioned Script forall a. ToScript a => a -> Versioned Script toScript (ReferenceScriptType o -> Versioned Script) -> Maybe (ReferenceScriptType o) -> Maybe (Versioned Script) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b -<$> o -output o +<$> o +output 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)) +^. Optic' A_Lens NoIx o (Maybe (ReferenceScriptType o)) forall o. IsAbstractOutput o => Lens' o (Maybe (ReferenceScriptType o)) @@ -1850,18 +1850,18 @@ -- | Parameters controlling transaction generation. GenTxParams -> -- | Some parameters, coming from the 'MockChain'. - Pl.Params -> + Pl.Params -> -- | All of the currently known data on transaction inputs, also coming from the 'MockChain'. - Map Pl.DatumHash Pl.Datum -> + Map Pl.DatumHash Pl.Datum -> -- | All of the currently known UTxOs which will be used as transaction inputs or referenced, also coming from the 'MockChain'. - Map Pl.TxOutRef Pl.TxOut -> + Map Pl.TxOutRef Pl.TxOut -> -- | All of the currently known validators which protect transaction inputs, also coming from the 'MockChain'. - Map Pl.ValidatorHash (Pl.Versioned Pl.Validator) -> + Map Pl.ValidatorHash (Pl.Versioned Pl.Validator) -> -- | The transaction skeleton to translate. TxSkel -> - Either + Either GenerateTxError - (C.Tx C.BabbageEra) + (C.Tx C.BabbageEra) generateTx :: GenTxParams -> Params -> Map DatumHash Datum @@ -1869,15 +1869,15 @@ -> Map ValidatorHash (Versioned Validator) -> TxSkel -> Either GenerateTxError (Tx BabbageEra) -generateTx GenTxParams -genTxParams Params -params Map DatumHash Datum -datums Map TxOutRef TxOut -txOuts Map ValidatorHash (Versioned Validator) -validators TxSkel -skel = do - TxBodyContent BuildTx BabbageEra -txBodyContent <- GenTxParams +generateTx GenTxParams +genTxParams Params +params Map DatumHash Datum +datums Map TxOutRef TxOut +txOuts Map ValidatorHash (Versioned Validator) +validators TxSkel +skel = do + TxBodyContent BuildTx BabbageEra +txBodyContent <- GenTxParams -> Params -> Map DatumHash Datum -> Map TxOutRef TxOut @@ -1885,14 +1885,14 @@ -> TxSkel -> Either GenerateTxError (TxBodyContent BuildTx BabbageEra) generateTxBodyContent GenTxParams -genTxParams Params -params Map DatumHash Datum -datums Map TxOutRef TxOut -txOuts Map ValidatorHash (Versioned Validator) -validators TxSkel -skel - Tx BabbageEra -cardanoTxUnsigned <- +genTxParams Params +params Map DatumHash Datum +datums Map TxOutRef TxOut +txOuts Map ValidatorHash (Versioned Validator) +validators TxSkel +skel + Tx BabbageEra +cardanoTxUnsigned <- (TxBodyError -> GenerateTxError) -> (TxBody BabbageEra -> Tx BabbageEra) -> Either TxBodyError (TxBody BabbageEra) @@ -1900,16 +1900,16 @@ forall (p :: * -> * -> *) a b c d. Bifunctor p => (a -> b) -> (c -> d) -> p a c -> p b d -bimap +bimap (String -> TxBodyError -> GenerateTxError TxBodyError String "generateTx: ") ((TxBody BabbageEra -> [KeyWitness BabbageEra] -> Tx BabbageEra) -> [KeyWitness BabbageEra] -> TxBody BabbageEra -> Tx BabbageEra forall a b c. (a -> b -> c) -> b -> a -> c -flip TxBody BabbageEra -> [KeyWitness BabbageEra] -> Tx BabbageEra +flip TxBody BabbageEra -> [KeyWitness BabbageEra] -> Tx BabbageEra forall era. TxBody era -> [KeyWitness era] -> Tx era -C.Tx []) +C.Tx []) -- WARN 'makeTransactionBody' will be deprecated in newer versions of -- cardano-api -- The new name (which is more fitting as well) is @@ -1919,63 +1919,63 @@ forall era. IsCardanoEra era => TxBodyContent BuildTx era -> Either TxBodyError (TxBody era) -C.makeTransactionBody TxBodyContent BuildTx BabbageEra -txBodyContent) - let cardanoTxSigned :: Tx BabbageEra -cardanoTxSigned = (Tx BabbageEra -> Wallet -> Tx BabbageEra) +C.makeTransactionBody TxBodyContent BuildTx BabbageEra +txBodyContent) + let cardanoTxSigned :: Tx BabbageEra +cardanoTxSigned = (Tx BabbageEra -> Wallet -> Tx BabbageEra) -> Tx BabbageEra -> [Wallet] -> Tx BabbageEra forall (t :: * -> *) b a. Foldable t => (b -> a -> b) -> b -> t a -> b -foldl' Tx BabbageEra -> Wallet -> Tx BabbageEra -txAddSignature Tx BabbageEra -cardanoTxUnsigned (TxSkel -> [Wallet] +foldl' Tx BabbageEra -> Wallet -> Tx BabbageEra +txAddSignature Tx BabbageEra +cardanoTxUnsigned (TxSkel -> [Wallet] txSkelSigners TxSkel -skel) +skel) Tx BabbageEra -> Either GenerateTxError (Tx BabbageEra) forall (m :: * -> *) a. Monad m => a -> m a -return (Tx BabbageEra -> Either GenerateTxError (Tx BabbageEra)) +return (Tx BabbageEra -> Either GenerateTxError (Tx BabbageEra)) -> Tx BabbageEra -> Either GenerateTxError (Tx BabbageEra) forall a b. (a -> b) -> a -> b -$ [RawModTx] -> Tx BabbageEra -> Tx BabbageEra +$ [RawModTx] -> Tx BabbageEra -> Tx BabbageEra applyRawModOnBalancedTx (TxOpts -> [RawModTx] txOptUnsafeModTx (TxOpts -> [RawModTx]) -> (TxSkel -> TxOpts) -> TxSkel -> [RawModTx] forall b c a. (b -> c) -> (a -> b) -> a -> c -. TxSkel -> TxOpts +. TxSkel -> TxOpts txSkelOpts (TxSkel -> [RawModTx]) -> TxSkel -> [RawModTx] forall a b. (a -> b) -> a -> b -$ TxSkel -skel) Tx BabbageEra -cardanoTxSigned +$ TxSkel +skel) Tx BabbageEra +cardanoTxSigned where - txAddSignature :: C.Tx C.BabbageEra -> Wallet -> C.Tx C.BabbageEra - txAddSignature :: Tx BabbageEra -> Wallet -> Tx BabbageEra -txAddSignature Tx BabbageEra -tx Wallet -wal = case PrivateKey -> CardanoTx -> CardanoTx -Ledger.addCardanoTxSignature + txAddSignature :: C.Tx C.BabbageEra -> Wallet -> C.Tx C.BabbageEra + txAddSignature :: Tx BabbageEra -> Wallet -> Tx BabbageEra +txAddSignature Tx BabbageEra +tx Wallet +wal = case PrivateKey -> CardanoTx -> CardanoTx +Ledger.addCardanoTxSignature (Wallet -> PrivateKey walletSK Wallet -wal) +wal) (Tx BabbageEra -> EraInMode BabbageEra CardanoMode -> CardanoTx forall era. IsCardanoEra era => Tx era -> EraInMode era CardanoMode -> CardanoTx -Ledger.CardanoTx Tx BabbageEra -tx EraInMode BabbageEra CardanoMode -C.BabbageEraInCardanoMode) of - Ledger.CardanoTx Tx era -tx' EraInMode era CardanoMode -C.BabbageEraInCardanoMode -> Tx era +Ledger.CardanoTx Tx BabbageEra +tx EraInMode BabbageEra CardanoMode +C.BabbageEraInCardanoMode) of + Ledger.CardanoTx Tx era +tx' EraInMode era CardanoMode +C.BabbageEraInCardanoMode -> Tx era Tx BabbageEra -tx' +tx' -- Looking at the implementation of Ledger.addCardanoTxSignature: -- It never changes the constructor used, so the above branch -- will never happen CardanoTx _ -> String -> Tx BabbageEra forall a. HasCallStack => String -> a -error String +error String "generateTx: expected CardanoTx" \ No newline at end of file diff --git a/src/Cooked.MockChain.Staged.html b/src/Cooked.MockChain.Staged.html index 112f58610..ee4b55a4a 100644 --- a/src/Cooked.MockChain.Staged.html +++ b/src/Cooked.MockChain.Staged.html @@ -24,61 +24,61 @@ ) where -import qualified Cardano.Node.Emulator as Emulator -import Control.Applicative -import Control.Arrow hiding ((<+>)) -import Control.Monad.Except -import Control.Monad.Reader -import Control.Monad.State -import Control.Monad.Writer.Strict hiding (Alt) +import qualified Cardano.Node.Emulator as Emulator +import Control.Applicative +import Control.Arrow hiding ((<+>)) +import Control.Monad.Except +import Control.Monad.Reader +import Control.Monad.State +import Control.Monad.Writer.Strict hiding (Alt) import Cooked.Ltl import Cooked.MockChain.BlockChain import Cooked.MockChain.Direct import Cooked.MockChain.UtxoState import Cooked.Skeleton import Cooked.Tweak.Common -import Data.Default -import qualified Data.Map as Map -import qualified Ledger.Slot as Ledger -import qualified Ledger.Tx as Ledger -import qualified Ledger.Tx.CardanoAPI as Ledger -import qualified Ledger.Typed.Scripts as Pl -import qualified Plutus.V2.Ledger.Api as Pl +import Data.Default +import qualified Data.Map as Map +import qualified Ledger.Slot as Ledger +import qualified Ledger.Tx as Ledger +import qualified Ledger.Tx.CardanoAPI as Ledger +import qualified Ledger.Typed.Scripts as Pl +import qualified Plutus.V2.Ledger.Api as Pl -- * Interpreting and running 'StagedMockChain' -- | Interprets the staged mockchain then runs the resulting computation with a -- custom function. This can be used, for example, to supply a custom -- 'InitialDistribution' by providing 'runMockChainTFrom'. -interpretAndRunWith :: - (forall m. Monad m => MockChainT m a -> m res) -> - StagedMockChain a -> - [(res, MockChainLog)] +interpretAndRunWith :: + (forall m. (Monad m) => MockChainT m a -> m res) -> + StagedMockChain a -> + [(res, MockChainLog)] interpretAndRunWith :: (forall (m :: * -> *). Monad m => MockChainT m a -> m res) -> StagedMockChain a -> [(res, MockChainLog)] -interpretAndRunWith forall (m :: * -> *). Monad m => MockChainT m a -> m res -f StagedMockChain a -smc = WriterT MockChainLog [] res -> [(res, MockChainLog)] +interpretAndRunWith forall (m :: * -> *). Monad m => MockChainT m a -> m res +f StagedMockChain a +smc = WriterT MockChainLog [] res -> [(res, MockChainLog)] forall w (m :: * -> *) a. WriterT w m a -> m (a, w) -runWriterT (WriterT MockChainLog [] res -> [(res, MockChainLog)]) +runWriterT (WriterT MockChainLog [] res -> [(res, MockChainLog)]) -> WriterT MockChainLog [] res -> [(res, MockChainLog)] forall a b. (a -> b) -> a -> b -$ MockChainT (WriterT MockChainLog []) a +$ MockChainT (WriterT MockChainLog []) a -> WriterT MockChainLog [] res forall (m :: * -> *). Monad m => MockChainT m a -> m res -f (MockChainT (WriterT MockChainLog []) a +f (MockChainT (WriterT MockChainLog []) a -> WriterT MockChainLog [] res) -> MockChainT (WriterT MockChainLog []) a -> WriterT MockChainLog [] res forall a b. (a -> b) -> a -> b -$ StagedMockChain a -> MockChainT (WriterT MockChainLog []) a +$ StagedMockChain a -> MockChainT (WriterT MockChainLog []) a forall a. StagedMockChain a -> InterpMockChain a interpret StagedMockChain a -smc +smc -interpretAndRun :: - StagedMockChain a -> - [(Either MockChainError (a, UtxoState), MockChainLog)] +interpretAndRun :: + StagedMockChain a -> + [(Either MockChainError (a, UtxoState), MockChainLog)] interpretAndRun :: StagedMockChain a -> [(Either MockChainError (a, UtxoState), MockChainLog)] interpretAndRun = (forall (m :: * -> *). @@ -99,34 +99,34 @@ data MockChainLogEntry = MCLogSubmittedTxSkel SkelContext TxSkel - | MCLogNewTx Pl.TxId - | MCLogFail String + | MCLogNewTx Pl.TxId + | MCLogFail String newtype MockChainLog = MockChainLog {MockChainLog -> [MockChainLogEntry] unMockChainLog :: [MockChainLogEntry]} -instance Semigroup MockChainLog where - MockChainLog [MockChainLogEntry] -x <> :: MockChainLog -> MockChainLog -> MockChainLog -<> MockChainLog [MockChainLogEntry] -y = [MockChainLogEntry] -> MockChainLog +instance Semigroup MockChainLog where + MockChainLog [MockChainLogEntry] +x <> :: MockChainLog -> MockChainLog -> MockChainLog +<> MockChainLog [MockChainLogEntry] +y = [MockChainLogEntry] -> MockChainLog MockChainLog ([MockChainLogEntry] -> MockChainLog) -> [MockChainLogEntry] -> MockChainLog forall a b. (a -> b) -> a -> b -$ [MockChainLogEntry] -x [MockChainLogEntry] -> [MockChainLogEntry] -> [MockChainLogEntry] +$ [MockChainLogEntry] +x [MockChainLogEntry] -> [MockChainLogEntry] -> [MockChainLogEntry] forall a. Semigroup a => a -> a -> a -<> [MockChainLogEntry] -y +<> [MockChainLogEntry] +y -instance Monoid MockChainLog where - mempty :: MockChainLog -mempty = [MockChainLogEntry] -> MockChainLog +instance Monoid MockChainLog where + mempty :: MockChainLog +mempty = [MockChainLogEntry] -> MockChainLog MockChainLog [] -- | The semantic domain in which 'StagedMockChain' gets interpreted; see the -- 'interpret' function for more. -type InterpMockChain = MockChainT (WriterT MockChainLog []) +type InterpMockChain = MockChainT (WriterT MockChainLog []) -- | The 'interpret' function gives semantics to our traces. One -- 'StagedMockChain' computation yields a potential list of 'MockChainT' @@ -136,7 +136,7 @@ -- > MockChainT (WriterT TraceDescr []) a -- > =~= st -> (WriterT TraceDescr []) (Either err (a, st)) -- > =~= st -> [(Either err (a, st) , TraceDescr)] -interpret :: StagedMockChain a -> InterpMockChain a +interpret :: StagedMockChain a -> InterpMockChain a interpret :: StagedMockChain a -> InterpMockChain a interpret = (StateT [Ltl (UntypedTweak InterpMockChain)] InterpMockChain a -> [Ltl (UntypedTweak InterpMockChain)] -> InterpMockChain a) @@ -144,17 +144,17 @@ -> StateT [Ltl (UntypedTweak InterpMockChain)] InterpMockChain a -> InterpMockChain a forall a b c. (a -> b -> c) -> b -> a -> c -flip StateT [Ltl (UntypedTweak InterpMockChain)] InterpMockChain a +flip StateT [Ltl (UntypedTweak InterpMockChain)] InterpMockChain a -> [Ltl (UntypedTweak InterpMockChain)] -> InterpMockChain a forall (m :: * -> *) s a. Monad m => StateT s m a -> s -> m a -evalStateT [] (StateT [Ltl (UntypedTweak InterpMockChain)] InterpMockChain a +evalStateT [] (StateT [Ltl (UntypedTweak InterpMockChain)] InterpMockChain a -> InterpMockChain a) -> (StagedMockChain a -> StateT [Ltl (UntypedTweak InterpMockChain)] InterpMockChain a) -> StagedMockChain a -> InterpMockChain a forall b c a. (b -> c) -> (a -> b) -> a -> c -. StagedMockChain a +. StagedMockChain a -> StateT [Ltl (UntypedTweak InterpMockChain)] InterpMockChain a forall modification (builtin :: * -> *) (m :: * -> *) a. InterpLtl modification builtin m => @@ -164,38 +164,38 @@ -- * 'StagedMockChain': An AST for 'MonadMockChain' computations -data MockChainBuiltin a where +data MockChainBuiltin a where -- methods of 'MonadBlockChain' - GetParams :: MockChainBuiltin Emulator.Params - ValidateTxSkel :: TxSkel -> MockChainBuiltin Ledger.CardanoTx - TxOutByRefLedger :: Pl.TxOutRef -> MockChainBuiltin (Maybe Ledger.TxOut) - GetCurrentSlot :: MockChainBuiltin Ledger.Slot - AwaitSlot :: Ledger.Slot -> MockChainBuiltin Ledger.Slot - DatumFromHash :: Pl.DatumHash -> MockChainBuiltin (Maybe Pl.Datum) - AllUtxosLedger :: MockChainBuiltin [(Pl.TxOutRef, Ledger.TxOut)] - UtxosAtLedger :: Pl.Address -> MockChainBuiltin [(Pl.TxOutRef, Ledger.TxOut)] - ValidatorFromHash :: Pl.ValidatorHash -> MockChainBuiltin (Maybe (Pl.Versioned Pl.Validator)) + GetParams :: MockChainBuiltin Emulator.Params + ValidateTxSkel :: TxSkel -> MockChainBuiltin Ledger.CardanoTx + TxOutByRefLedger :: Pl.TxOutRef -> MockChainBuiltin (Maybe Ledger.TxOut) + GetCurrentSlot :: MockChainBuiltin Ledger.Slot + AwaitSlot :: Ledger.Slot -> MockChainBuiltin Ledger.Slot + DatumFromHash :: Pl.DatumHash -> MockChainBuiltin (Maybe Pl.Datum) + AllUtxosLedger :: MockChainBuiltin [(Pl.TxOutRef, Ledger.TxOut)] + UtxosAtLedger :: Pl.Address -> MockChainBuiltin [(Pl.TxOutRef, Ledger.TxOut)] + ValidatorFromHash :: Pl.ValidatorHash -> MockChainBuiltin (Maybe (Pl.Versioned Pl.Validator)) -- | The empty set of traces - Empty :: MockChainBuiltin a + Empty :: MockChainBuiltin a -- | The union of two sets of traces - Alt :: - StagedMockChain a -> - StagedMockChain a -> - MockChainBuiltin a + Alt :: + StagedMockChain a -> + StagedMockChain a -> + MockChainBuiltin a -- for the 'MonadFail' instance - Fail :: String -> MockChainBuiltin a + Fail :: String -> MockChainBuiltin a -- for the 'MonadError MockChainError' instance - ThrowError :: MockChainError -> MockChainBuiltin a - CatchError :: StagedMockChain a -> (MockChainError -> StagedMockChain a) -> MockChainBuiltin a + ThrowError :: MockChainError -> MockChainBuiltin a + CatchError :: StagedMockChain a -> (MockChainError -> StagedMockChain a) -> MockChainBuiltin a type MockChainOp = LtlOp (UntypedTweak InterpMockChain) MockChainBuiltin type StagedMockChain = Staged MockChainOp -instance Alternative StagedMockChain where - empty :: StagedMockChain a -empty = LtlOp (UntypedTweak InterpMockChain) MockChainBuiltin a +instance Alternative StagedMockChain where + empty :: StagedMockChain a +empty = LtlOp (UntypedTweak InterpMockChain) MockChainBuiltin a -> (a -> StagedMockChain a) -> StagedMockChain a forall (op :: * -> *) a b. op a -> (a -> Staged op b) -> Staged op b @@ -208,10 +208,10 @@ Empty) a -> StagedMockChain a forall a (op :: * -> *). a -> Staged op a Return - StagedMockChain a -a <|> :: StagedMockChain a -> StagedMockChain a -> StagedMockChain a -<|> StagedMockChain a -b = LtlOp (UntypedTweak InterpMockChain) MockChainBuiltin a + StagedMockChain a +a <|> :: StagedMockChain a -> StagedMockChain a -> StagedMockChain a +<|> StagedMockChain a +b = LtlOp (UntypedTweak InterpMockChain) MockChainBuiltin a -> (a -> StagedMockChain a) -> StagedMockChain a forall (op :: * -> *) a b. op a -> (a -> Staged op b) -> Staged op b @@ -223,15 +223,15 @@ forall a. StagedMockChain a -> StagedMockChain a -> MockChainBuiltin a Alt StagedMockChain a -a StagedMockChain a -b)) a -> StagedMockChain a +a StagedMockChain a +b)) a -> StagedMockChain a forall a (op :: * -> *). a -> Staged op a Return -instance MonadFail StagedMockChain where - fail :: String -> StagedMockChain a -fail String -msg = LtlOp (UntypedTweak InterpMockChain) MockChainBuiltin a +instance MonadFail StagedMockChain where + fail :: String -> StagedMockChain a +fail String +msg = LtlOp (UntypedTweak InterpMockChain) MockChainBuiltin a -> (a -> StagedMockChain a) -> StagedMockChain a forall (op :: * -> *) a b. op a -> (a -> Staged op b) -> Staged op b @@ -242,23 +242,23 @@ Builtin (String -> MockChainBuiltin a forall a. String -> MockChainBuiltin a Fail String -msg)) a -> StagedMockChain a +msg)) a -> StagedMockChain a forall a (op :: * -> *). a -> Staged op a Return -- * 'InterpLtl' instance -instance MonadPlus m => MonadPlus (MockChainT m) where - mzero :: MockChainT m a -mzero = m a -> MockChainT m a +instance (MonadPlus m) => MonadPlus (MockChainT m) where + mzero :: MockChainT m a +mzero = m a -> MockChainT m a forall (t :: (* -> *) -> * -> *) (m :: * -> *) a. (MonadTrans t, Monad m) => m a -> t m a -lift m a +lift m a forall (m :: * -> *) a. MonadPlus m => m a -mzero - mplus :: MockChainT m a -> MockChainT m a -> MockChainT m a -mplus = (forall a. m a -> m a -> m a) +mzero + mplus :: MockChainT m a -> MockChainT m a -> MockChainT m a +mplus = (forall a. m a -> m a -> m a) -> MockChainT m a -> MockChainT m a -> MockChainT m a forall (m :: * -> *) x. Monad m => @@ -266,10 +266,10 @@ -> MockChainT m x -> MockChainT m x -> MockChainT m x combineMockChainT forall a. m a -> m a -> m a forall (m :: * -> *) a. MonadPlus m => m a -> m a -> m a -mplus +mplus instance InterpLtl (UntypedTweak InterpMockChain) MockChainBuiltin InterpMockChain where - interpBuiltin :: MockChainBuiltin a + interpBuiltin :: MockChainBuiltin a -> StateT [Ltl (UntypedTweak InterpMockChain)] InterpMockChain a interpBuiltin MockChainBuiltin a GetParams = InterpMockChain Params @@ -278,25 +278,25 @@ forall (t :: (* -> *) -> * -> *) (m :: * -> *) a. (MonadTrans t, Monad m) => m a -> t m a -lift (InterpMockChain Params +lift (InterpMockChain Params -> StateT [Ltl (UntypedTweak InterpMockChain)] InterpMockChain Params) -> InterpMockChain Params -> StateT [Ltl (UntypedTweak InterpMockChain)] InterpMockChain Params forall a b. (a -> b) -> a -> b -$ (MockChainEnv -> Params) -> InterpMockChain Params +$ (MockChainEnv -> Params) -> InterpMockChain Params forall r (m :: * -> *) a. MonadReader r m => (r -> a) -> m a -asks MockChainEnv -> Params +asks MockChainEnv -> Params mceParams - interpBuiltin (ValidateTxSkel TxSkel -skel) = + interpBuiltin (ValidateTxSkel TxSkel +skel) = StateT [Ltl (UntypedTweak InterpMockChain)] InterpMockChain [Ltl (UntypedTweak InterpMockChain)] forall s (m :: * -> *). MonadState s m => m s -get +get StateT [Ltl (UntypedTweak InterpMockChain)] InterpMockChain @@ -307,14 +307,14 @@ -> StateT [Ltl (UntypedTweak InterpMockChain)] InterpMockChain CardanoTx forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b ->>= [StateT +>>= [StateT [Ltl (UntypedTweak InterpMockChain)] InterpMockChain CardanoTx] -> StateT [Ltl (UntypedTweak InterpMockChain)] InterpMockChain CardanoTx forall (t :: * -> *) (m :: * -> *) a. (Foldable t, MonadPlus m) => t (m a) -> m a -msum +msum ([StateT [Ltl (UntypedTweak InterpMockChain)] InterpMockChain CardanoTx] -> StateT @@ -326,7 +326,7 @@ -> StateT [Ltl (UntypedTweak InterpMockChain)] InterpMockChain CardanoTx forall b c a. (b -> c) -> (a -> b) -> a -> c -. ((UntypedTweak InterpMockChain, +. ((UntypedTweak InterpMockChain, [Ltl (UntypedTweak InterpMockChain)]) -> StateT [Ltl (UntypedTweak InterpMockChain)] InterpMockChain CardanoTx) @@ -335,7 +335,7 @@ -> [StateT [Ltl (UntypedTweak InterpMockChain)] InterpMockChain CardanoTx] forall a b. (a -> b) -> [a] -> [b] -map ((UntypedTweak InterpMockChain +map ((UntypedTweak InterpMockChain -> [Ltl (UntypedTweak InterpMockChain)] -> StateT [Ltl (UntypedTweak InterpMockChain)] InterpMockChain CardanoTx) @@ -344,11 +344,11 @@ -> StateT [Ltl (UntypedTweak InterpMockChain)] InterpMockChain CardanoTx forall a b c. (a -> b -> c) -> (a, b) -> c -uncurry UntypedTweak InterpMockChain +uncurry UntypedTweak InterpMockChain -> [Ltl (UntypedTweak InterpMockChain)] -> StateT [Ltl (UntypedTweak InterpMockChain)] InterpMockChain CardanoTx -interpretAndTell) +interpretAndTell) ([(UntypedTweak InterpMockChain, [Ltl (UntypedTweak InterpMockChain)])] -> [StateT @@ -360,98 +360,98 @@ -> [StateT [Ltl (UntypedTweak InterpMockChain)] InterpMockChain CardanoTx] forall b c a. (b -> c) -> (a -> b) -> a -> c -. [Ltl (UntypedTweak InterpMockChain)] +. [Ltl (UntypedTweak InterpMockChain)] -> [(UntypedTweak InterpMockChain, [Ltl (UntypedTweak InterpMockChain)])] forall a. Monoid a => [Ltl a] -> [(a, [Ltl a])] nowLaterList where - interpretAndTell :: + interpretAndTell :: UntypedTweak InterpMockChain -> [Ltl (UntypedTweak InterpMockChain)] -> - StateT [Ltl (UntypedTweak InterpMockChain)] InterpMockChain Ledger.CardanoTx - interpretAndTell :: UntypedTweak InterpMockChain + StateT [Ltl (UntypedTweak InterpMockChain)] InterpMockChain Ledger.CardanoTx + interpretAndTell :: UntypedTweak InterpMockChain -> [Ltl (UntypedTweak InterpMockChain)] -> StateT [Ltl (UntypedTweak InterpMockChain)] InterpMockChain CardanoTx -interpretAndTell (UntypedTweak Tweak InterpMockChain a -now) [Ltl (UntypedTweak InterpMockChain)] -later = do - MockChainSt -mcst <- InterpMockChain MockChainSt +interpretAndTell (UntypedTweak Tweak InterpMockChain a +now) [Ltl (UntypedTweak InterpMockChain)] +later = do + MockChainSt +mcst <- InterpMockChain MockChainSt -> StateT [Ltl (UntypedTweak InterpMockChain)] InterpMockChain MockChainSt forall (t :: (* -> *) -> * -> *) (m :: * -> *) a. (MonadTrans t, Monad m) => m a -> t m a -lift InterpMockChain MockChainSt +lift InterpMockChain MockChainSt forall s (m :: * -> *). MonadState s m => m s -get - let managedTxOuts :: Map TxOutRef TxOut -managedTxOuts = UtxoIndex -> Map TxOutRef TxOut +get + let managedTxOuts :: Map TxOutRef TxOut +managedTxOuts = UtxoIndex -> Map TxOutRef TxOut getIndex (UtxoIndex -> Map TxOutRef TxOut) -> (MockChainSt -> UtxoIndex) -> MockChainSt -> Map TxOutRef TxOut forall b c a. (b -> c) -> (a -> b) -> a -> c -. MockChainSt -> UtxoIndex +. MockChainSt -> UtxoIndex mcstIndex (MockChainSt -> Map TxOutRef TxOut) -> MockChainSt -> Map TxOutRef TxOut forall a b. (a -> b) -> a -> b -$ MockChainSt -mcst - managedDatums :: Map DatumHash (TxSkelOutDatum, Integer) -managedDatums = MockChainSt -> Map DatumHash (TxSkelOutDatum, Integer) +$ MockChainSt +mcst + managedDatums :: Map DatumHash (TxSkelOutDatum, Integer) +managedDatums = MockChainSt -> Map DatumHash (TxSkelOutDatum, Integer) mcstDatums MockChainSt -mcst +mcst (a -_, TxSkel -skel') <- InterpMockChain (a, TxSkel) +_, TxSkel +skel') <- InterpMockChain (a, TxSkel) -> StateT [Ltl (UntypedTweak InterpMockChain)] InterpMockChain (a, TxSkel) forall (t :: (* -> *) -> * -> *) (m :: * -> *) a. (MonadTrans t, Monad m) => m a -> t m a -lift (InterpMockChain (a, TxSkel) +lift (InterpMockChain (a, TxSkel) -> StateT [Ltl (UntypedTweak InterpMockChain)] InterpMockChain (a, TxSkel)) -> InterpMockChain (a, TxSkel) -> StateT [Ltl (UntypedTweak InterpMockChain)] InterpMockChain (a, TxSkel) forall a b. (a -> b) -> a -> b -$ Tweak InterpMockChain a -> TxSkel -> InterpMockChain (a, TxSkel) +$ Tweak InterpMockChain a -> TxSkel -> InterpMockChain (a, TxSkel) forall (m :: * -> *) a. (MonadBlockChainWithoutValidation m, MonadPlus m) => Tweak m a -> TxSkel -> m (a, TxSkel) runTweakInChain Tweak InterpMockChain a -now TxSkel -skel +now TxSkel +skel MockChainT (WriterT MockChainLog []) () -> StateT [Ltl (UntypedTweak InterpMockChain)] InterpMockChain () forall (t :: (* -> *) -> * -> *) (m :: * -> *) a. (MonadTrans t, Monad m) => m a -> t m a -lift (MockChainT (WriterT MockChainLog []) () +lift (MockChainT (WriterT MockChainLog []) () -> StateT [Ltl (UntypedTweak InterpMockChain)] InterpMockChain ()) -> MockChainT (WriterT MockChainLog []) () -> StateT [Ltl (UntypedTweak InterpMockChain)] InterpMockChain () forall a b. (a -> b) -> a -> b -$ +$ WriterT MockChainLog [] () -> MockChainT (WriterT MockChainLog []) () forall (t :: (* -> *) -> * -> *) (m :: * -> *) a. (MonadTrans t, Monad m) => m a -> t m a -lift (WriterT MockChainLog [] () +lift (WriterT MockChainLog [] () -> MockChainT (WriterT MockChainLog []) ()) -> WriterT MockChainLog [] () -> MockChainT (WriterT MockChainLog []) () forall a b. (a -> b) -> a -> b -$ +$ MockChainLog -> WriterT MockChainLog [] () forall w (m :: * -> *). MonadWriter w m => w -> m () -tell (MockChainLog -> WriterT MockChainLog [] ()) +tell (MockChainLog -> WriterT MockChainLog [] ()) -> MockChainLog -> WriterT MockChainLog [] () forall a b. (a -> b) -> a -> b -$ +$ [MockChainLogEntry] -> MockChainLog MockChainLog [ SkelContext -> TxSkel -> MockChainLogEntry @@ -460,107 +460,107 @@ SkelContext (TxOut -> TxOut txOutV2FromLedger (TxOut -> TxOut) -> Map TxOutRef TxOut -> Map TxOutRef TxOut forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b -<$> Map TxOutRef TxOut -managedTxOuts) (Map DatumHash TxSkelOutDatum -> SkelContext) +<$> Map TxOutRef TxOut +managedTxOuts) (Map DatumHash TxSkelOutDatum -> SkelContext) -> Map DatumHash TxSkelOutDatum -> SkelContext forall a b. (a -> b) -> a -> b -$ ((TxSkelOutDatum, Integer) -> TxSkelOutDatum) +$ ((TxSkelOutDatum, Integer) -> TxSkelOutDatum) -> Map DatumHash (TxSkelOutDatum, Integer) -> Map DatumHash TxSkelOutDatum forall a b k. (a -> b) -> Map k a -> Map k b -Map.map (TxSkelOutDatum, Integer) -> TxSkelOutDatum +Map.map (TxSkelOutDatum, Integer) -> TxSkelOutDatum forall a b. (a, b) -> a -fst Map DatumHash (TxSkelOutDatum, Integer) -managedDatums) +fst Map DatumHash (TxSkelOutDatum, Integer) +managedDatums) TxSkel -skel' +skel' ] - CardanoTx -tx <- TxSkel + CardanoTx +tx <- TxSkel -> StateT [Ltl (UntypedTweak InterpMockChain)] InterpMockChain CardanoTx forall (m :: * -> *). MonadBlockChain m => TxSkel -> m CardanoTx validateTxSkel TxSkel -skel' +skel' MockChainT (WriterT MockChainLog []) () -> StateT [Ltl (UntypedTweak InterpMockChain)] InterpMockChain () forall (t :: (* -> *) -> * -> *) (m :: * -> *) a. (MonadTrans t, Monad m) => m a -> t m a -lift (MockChainT (WriterT MockChainLog []) () +lift (MockChainT (WriterT MockChainLog []) () -> StateT [Ltl (UntypedTweak InterpMockChain)] InterpMockChain ()) -> MockChainT (WriterT MockChainLog []) () -> StateT [Ltl (UntypedTweak InterpMockChain)] InterpMockChain () forall a b. (a -> b) -> a -> b -$ +$ WriterT MockChainLog [] () -> MockChainT (WriterT MockChainLog []) () forall (t :: (* -> *) -> * -> *) (m :: * -> *) a. (MonadTrans t, Monad m) => m a -> t m a -lift (WriterT MockChainLog [] () +lift (WriterT MockChainLog [] () -> MockChainT (WriterT MockChainLog []) ()) -> WriterT MockChainLog [] () -> MockChainT (WriterT MockChainLog []) () forall a b. (a -> b) -> a -> b -$ +$ MockChainLog -> WriterT MockChainLog [] () forall w (m :: * -> *). MonadWriter w m => w -> m () -tell (MockChainLog -> WriterT MockChainLog [] ()) +tell (MockChainLog -> WriterT MockChainLog [] ()) -> MockChainLog -> WriterT MockChainLog [] () forall a b. (a -> b) -> a -> b -$ +$ [MockChainLogEntry] -> MockChainLog MockChainLog [TxId -> MockChainLogEntry MCLogNewTx (TxId -> TxId -Ledger.fromCardanoTxId (TxId -> TxId) -> TxId -> TxId +Ledger.fromCardanoTxId (TxId -> TxId) -> TxId -> TxId forall a b. (a -> b) -> a -> b -$ CardanoTx -> TxId -Ledger.getCardanoTxId CardanoTx -tx)] +$ CardanoTx -> TxId +Ledger.getCardanoTxId CardanoTx +tx)] [Ltl (UntypedTweak InterpMockChain)] -> StateT [Ltl (UntypedTweak InterpMockChain)] InterpMockChain () forall s (m :: * -> *). MonadState s m => s -> m () -put [Ltl (UntypedTweak InterpMockChain)] -later +put [Ltl (UntypedTweak InterpMockChain)] +later CardanoTx -> StateT [Ltl (UntypedTweak InterpMockChain)] InterpMockChain CardanoTx forall (m :: * -> *) a. Monad m => a -> m a -return CardanoTx -tx - interpBuiltin (TxOutByRefLedger TxOutRef -o) = TxOutRef +return CardanoTx +tx + interpBuiltin (TxOutByRefLedger TxOutRef +o) = TxOutRef -> StateT [Ltl (UntypedTweak InterpMockChain)] InterpMockChain (Maybe TxOut) forall (m :: * -> *). MonadBlockChainBalancing m => TxOutRef -> m (Maybe TxOut) txOutByRefLedger TxOutRef -o +o interpBuiltin MockChainBuiltin a GetCurrentSlot = StateT [Ltl (UntypedTweak InterpMockChain)] InterpMockChain a forall (m :: * -> *). MonadBlockChainWithoutValidation m => m Slot currentSlot - interpBuiltin (AwaitSlot Slot -s) = Slot + interpBuiltin (AwaitSlot Slot +s) = Slot -> StateT [Ltl (UntypedTweak InterpMockChain)] InterpMockChain Slot forall (m :: * -> *). MonadBlockChainWithoutValidation m => Slot -> m Slot awaitSlot Slot -s - interpBuiltin (DatumFromHash DatumHash -h) = DatumHash +s + interpBuiltin (DatumFromHash DatumHash +h) = DatumHash -> StateT [Ltl (UntypedTweak InterpMockChain)] InterpMockChain (Maybe Datum) forall (m :: * -> *). MonadBlockChainBalancing m => DatumHash -> m (Maybe Datum) datumFromHash DatumHash -h - interpBuiltin (ValidatorFromHash ValidatorHash -h) = ValidatorHash +h + interpBuiltin (ValidatorFromHash ValidatorHash +h) = ValidatorHash -> StateT [Ltl (UntypedTweak InterpMockChain)] InterpMockChain @@ -569,15 +569,15 @@ MonadBlockChainBalancing m => ValidatorHash -> m (Maybe (Versioned Validator)) validatorFromHash ValidatorHash -h +h interpBuiltin MockChainBuiltin a AllUtxosLedger = StateT [Ltl (UntypedTweak InterpMockChain)] InterpMockChain a forall (m :: * -> *). MonadBlockChainWithoutValidation m => m [(TxOutRef, TxOut)] allUtxosLedger - interpBuiltin (UtxosAtLedger Address -address) = Address + interpBuiltin (UtxosAtLedger Address +address) = Address -> StateT [Ltl (UntypedTweak InterpMockChain)] InterpMockChain @@ -586,91 +586,91 @@ MonadBlockChainBalancing m => Address -> m [(TxOutRef, TxOut)] utxosAtLedger Address -address +address interpBuiltin MockChainBuiltin a Empty = StateT [Ltl (UntypedTweak InterpMockChain)] InterpMockChain a forall (m :: * -> *) a. MonadPlus m => m a -mzero - interpBuiltin (Alt StagedMockChain a -l StagedMockChain a -r) = StagedMockChain a +mzero + interpBuiltin (Alt StagedMockChain a +l StagedMockChain a +r) = StagedMockChain a -> StateT [Ltl (UntypedTweak InterpMockChain)] InterpMockChain a forall modification (builtin :: * -> *) (m :: * -> *) a. InterpLtl modification builtin m => Staged (LtlOp modification builtin) a -> StateT [Ltl modification] m a interpLtl StagedMockChain a -l StateT [Ltl (UntypedTweak InterpMockChain)] InterpMockChain a +l StateT [Ltl (UntypedTweak InterpMockChain)] InterpMockChain a -> StateT [Ltl (UntypedTweak InterpMockChain)] InterpMockChain a -> StateT [Ltl (UntypedTweak InterpMockChain)] InterpMockChain a forall (m :: * -> *) a. MonadPlus m => m a -> m a -> m a -`mplus` StagedMockChain a +`mplus` StagedMockChain a -> StateT [Ltl (UntypedTweak InterpMockChain)] InterpMockChain a forall modification (builtin :: * -> *) (m :: * -> *) a. InterpLtl modification builtin m => Staged (LtlOp modification builtin) a -> StateT [Ltl modification] m a interpLtl StagedMockChain a -r - interpBuiltin (Fail String -msg) = do +r + interpBuiltin (Fail String +msg) = do MockChainT (WriterT MockChainLog []) () -> StateT [Ltl (UntypedTweak InterpMockChain)] InterpMockChain () forall (t :: (* -> *) -> * -> *) (m :: * -> *) a. (MonadTrans t, Monad m) => m a -> t m a -lift (MockChainT (WriterT MockChainLog []) () +lift (MockChainT (WriterT MockChainLog []) () -> StateT [Ltl (UntypedTweak InterpMockChain)] InterpMockChain ()) -> MockChainT (WriterT MockChainLog []) () -> StateT [Ltl (UntypedTweak InterpMockChain)] InterpMockChain () forall a b. (a -> b) -> a -> b -$ WriterT MockChainLog [] () +$ WriterT MockChainLog [] () -> MockChainT (WriterT MockChainLog []) () forall (t :: (* -> *) -> * -> *) (m :: * -> *) a. (MonadTrans t, Monad m) => m a -> t m a -lift (WriterT MockChainLog [] () +lift (WriterT MockChainLog [] () -> MockChainT (WriterT MockChainLog []) ()) -> WriterT MockChainLog [] () -> MockChainT (WriterT MockChainLog []) () forall a b. (a -> b) -> a -> b -$ MockChainLog -> WriterT MockChainLog [] () +$ MockChainLog -> WriterT MockChainLog [] () forall w (m :: * -> *). MonadWriter w m => w -> m () -tell (MockChainLog -> WriterT MockChainLog [] ()) +tell (MockChainLog -> WriterT MockChainLog [] ()) -> MockChainLog -> WriterT MockChainLog [] () forall a b. (a -> b) -> a -> b -$ [MockChainLogEntry] -> MockChainLog +$ [MockChainLogEntry] -> MockChainLog MockChainLog [String -> MockChainLogEntry MCLogFail String -msg] +msg] String -> StateT [Ltl (UntypedTweak InterpMockChain)] InterpMockChain a forall (m :: * -> *) a. MonadFail m => String -> m a -fail String -msg - interpBuiltin (ThrowError MockChainError -err) = MockChainError +fail String +msg + interpBuiltin (ThrowError MockChainError +err) = MockChainError -> StateT [Ltl (UntypedTweak InterpMockChain)] InterpMockChain a forall e (m :: * -> *) a. MonadError e m => e -> m a -throwError MockChainError -err - interpBuiltin (CatchError StagedMockChain a -act MockChainError -> StagedMockChain a -handler) = StateT [Ltl (UntypedTweak InterpMockChain)] InterpMockChain a +throwError MockChainError +err + interpBuiltin (CatchError StagedMockChain a +act MockChainError -> StagedMockChain a +handler) = StateT [Ltl (UntypedTweak InterpMockChain)] InterpMockChain a -> (MockChainError -> StateT [Ltl (UntypedTweak InterpMockChain)] InterpMockChain a) -> StateT [Ltl (UntypedTweak InterpMockChain)] InterpMockChain a forall e (m :: * -> *) a. MonadError e m => m a -> (e -> m a) -> m a -catchError (StagedMockChain a +catchError (StagedMockChain a -> StateT [Ltl (UntypedTweak InterpMockChain)] InterpMockChain a forall modification (builtin :: * -> *) (m :: * -> *) a. InterpLtl modification builtin m => Staged (LtlOp modification builtin) a -> StateT [Ltl modification] m a interpLtl StagedMockChain a -act) (StagedMockChain a +act) (StagedMockChain a -> StateT [Ltl (UntypedTweak InterpMockChain)] InterpMockChain a forall modification (builtin :: * -> *) (m :: * -> *) a. InterpLtl modification builtin m => @@ -682,12 +682,12 @@ -> MockChainError -> StateT [Ltl (UntypedTweak InterpMockChain)] InterpMockChain a forall b c a. (b -> c) -> (a -> b) -> a -> c -. MockChainError -> StagedMockChain a -handler) +. MockChainError -> StagedMockChain a +handler) -- ** Helpers to run tweaks for use in tests for tweaks -runTweak :: Tweak InterpMockChain a -> TxSkel -> [Either MockChainError (a, TxSkel)] +runTweak :: Tweak InterpMockChain a -> TxSkel -> [Either MockChainError (a, TxSkel)] runTweak :: Tweak InterpMockChain a -> TxSkel -> [Either MockChainError (a, TxSkel)] runTweak = MockChainEnv @@ -703,36 +703,36 @@ -> [Either MockChainError (a, TxSkel)] runTweakFrom MockChainEnv forall a. Default a => a -def MockChainSt +def MockChainSt forall a. Default a => a -def +def -runTweakFrom :: MockChainEnv -> MockChainSt -> Tweak InterpMockChain a -> TxSkel -> [Either MockChainError (a, TxSkel)] +runTweakFrom :: MockChainEnv -> MockChainSt -> Tweak InterpMockChain a -> TxSkel -> [Either MockChainError (a, TxSkel)] runTweakFrom :: MockChainEnv -> MockChainSt -> Tweak InterpMockChain a -> TxSkel -> [Either MockChainError (a, TxSkel)] -runTweakFrom MockChainEnv -mcenv MockChainSt -mcst Tweak InterpMockChain a -tweak TxSkel -skel = +runTweakFrom MockChainEnv +mcenv MockChainSt +mcst Tweak InterpMockChain a +tweak TxSkel +skel = ((Either MockChainError ((a, TxSkel), MockChainSt), MockChainLog) -> Either MockChainError (a, TxSkel)) -> [(Either MockChainError ((a, TxSkel), MockChainSt), MockChainLog)] -> [Either MockChainError (a, TxSkel)] forall a b. (a -> b) -> [a] -> [b] -map ((((a, TxSkel), MockChainSt) -> (a, TxSkel)) +map ((((a, TxSkel), MockChainSt) -> (a, TxSkel)) -> Either MockChainError ((a, TxSkel), MockChainSt) -> Either MockChainError (a, TxSkel) forall (a :: * -> * -> *) b c d. ArrowChoice a => a b c -> a (Either d b) (Either d c) -right ((a, TxSkel), MockChainSt) -> (a, TxSkel) +right ((a, TxSkel), MockChainSt) -> (a, TxSkel) forall a b. (a, b) -> a -fst (Either MockChainError ((a, TxSkel), MockChainSt) +fst (Either MockChainError ((a, TxSkel), MockChainSt) -> Either MockChainError (a, TxSkel)) -> ((Either MockChainError ((a, TxSkel), MockChainSt), MockChainLog) @@ -740,10 +740,10 @@ -> (Either MockChainError ((a, TxSkel), MockChainSt), MockChainLog) -> Either MockChainError (a, TxSkel) forall b c a. (b -> c) -> (a -> b) -> a -> c -. (Either MockChainError ((a, TxSkel), MockChainSt), MockChainLog) +. (Either MockChainError ((a, TxSkel), MockChainSt), MockChainLog) -> Either MockChainError ((a, TxSkel), MockChainSt) forall a b. (a, b) -> a -fst) +fst) ([(Either MockChainError ((a, TxSkel), MockChainSt), MockChainLog)] -> [Either MockChainError (a, TxSkel)]) -> (MockChainT (WriterT MockChainLog []) (a, TxSkel) @@ -752,12 +752,12 @@ -> MockChainT (WriterT MockChainLog []) (a, TxSkel) -> [Either MockChainError (a, TxSkel)] forall b c a. (b -> c) -> (a -> b) -> a -> c -. WriterT +. WriterT MockChainLog [] (Either MockChainError ((a, TxSkel), MockChainSt)) -> [(Either MockChainError ((a, TxSkel), MockChainSt), MockChainLog)] forall w (m :: * -> *) a. WriterT w m a -> m (a, w) -runWriterT +runWriterT (WriterT MockChainLog [] (Either MockChainError ((a, TxSkel), MockChainSt)) -> [(Either MockChainError ((a, TxSkel), MockChainSt), @@ -769,7 +769,7 @@ -> [(Either MockChainError ((a, TxSkel), MockChainSt), MockChainLog)] forall b c a. (b -> c) -> (a -> b) -> a -> c -. MockChainEnv +. MockChainEnv -> MockChainSt -> MockChainT (WriterT MockChainLog []) (a, TxSkel) -> WriterT @@ -781,31 +781,31 @@ -> MockChainT m a -> m (Either MockChainError (a, MockChainSt)) runMockChainTRaw MockChainEnv -mcenv MockChainSt -mcst +mcenv MockChainSt +mcst (MockChainT (WriterT MockChainLog []) (a, TxSkel) -> [Either MockChainError (a, TxSkel)]) -> MockChainT (WriterT MockChainLog []) (a, TxSkel) -> [Either MockChainError (a, TxSkel)] forall a b. (a -> b) -> a -> b -$ Tweak InterpMockChain a +$ Tweak InterpMockChain a -> TxSkel -> MockChainT (WriterT MockChainLog []) (a, TxSkel) forall (m :: * -> *) a. (MonadBlockChainWithoutValidation m, MonadPlus m) => Tweak m a -> TxSkel -> m (a, TxSkel) runTweakInChain Tweak InterpMockChain a -tweak TxSkel -skel +tweak TxSkel +skel -- ** Modalities -- | A modal mock chain is a mock chain that allows us to use LTL modifications -- with 'Tweak's -type MonadModalBlockChain m = (MonadBlockChain m, MonadModal m, Modification m ~ UntypedTweak InterpMockChain) +type MonadModalBlockChain m = (MonadBlockChain m, MonadModal m, Modification m ~ UntypedTweak InterpMockChain) -- | Apply a 'Tweak' to some transaction in the given Trace. The tweak must -- apply at least once. -somewhere :: MonadModalBlockChain m => Tweak InterpMockChain b -> m a -> m a +somewhere :: (MonadModalBlockChain m) => Tweak InterpMockChain b -> m a -> m a somewhere :: Tweak InterpMockChain b -> m a -> m a somewhere = Ltl (UntypedTweak InterpMockChain) -> m a -> m a forall (m :: * -> *) a. @@ -817,7 +817,7 @@ -> m a -> m a forall b c a. (b -> c) -> (a -> b) -> a -> c -. Ltl (UntypedTweak InterpMockChain) +. Ltl (UntypedTweak InterpMockChain) -> Ltl (UntypedTweak InterpMockChain) -> Ltl (UntypedTweak InterpMockChain) forall a. Ltl a -> Ltl a -> Ltl a @@ -829,7 +829,7 @@ -> Tweak InterpMockChain b -> Ltl (UntypedTweak InterpMockChain) forall b c a. (b -> c) -> (a -> b) -> a -> c -. UntypedTweak InterpMockChain -> Ltl (UntypedTweak InterpMockChain) +. UntypedTweak InterpMockChain -> Ltl (UntypedTweak InterpMockChain) forall a. a -> Ltl a LtlAtom (UntypedTweak InterpMockChain -> Ltl (UntypedTweak InterpMockChain)) @@ -837,13 +837,13 @@ -> Tweak InterpMockChain b -> Ltl (UntypedTweak InterpMockChain) forall b c a. (b -> c) -> (a -> b) -> a -> c -. Tweak InterpMockChain b -> UntypedTweak InterpMockChain +. Tweak InterpMockChain b -> UntypedTweak InterpMockChain forall (m :: * -> *) a. Tweak m a -> UntypedTweak m UntypedTweak -- | Apply a 'Tweak' to every transaction in a given trace. This is also -- successful if there are no transactions at all. -everywhere :: MonadModalBlockChain m => Tweak InterpMockChain b -> m a -> m a +everywhere :: (MonadModalBlockChain m) => Tweak InterpMockChain b -> m a -> m a everywhere :: Tweak InterpMockChain b -> m a -> m a everywhere = Ltl (UntypedTweak InterpMockChain) -> m a -> m a forall (m :: * -> *) a. @@ -855,7 +855,7 @@ -> m a -> m a forall b c a. (b -> c) -> (a -> b) -> a -> c -. Ltl (UntypedTweak InterpMockChain) +. Ltl (UntypedTweak InterpMockChain) -> Ltl (UntypedTweak InterpMockChain) -> Ltl (UntypedTweak InterpMockChain) forall a. Ltl a -> Ltl a -> Ltl a @@ -867,7 +867,7 @@ -> Tweak InterpMockChain b -> Ltl (UntypedTweak InterpMockChain) forall b c a. (b -> c) -> (a -> b) -> a -> c -. UntypedTweak InterpMockChain -> Ltl (UntypedTweak InterpMockChain) +. UntypedTweak InterpMockChain -> Ltl (UntypedTweak InterpMockChain) forall a. a -> Ltl a LtlAtom (UntypedTweak InterpMockChain -> Ltl (UntypedTweak InterpMockChain)) @@ -875,16 +875,16 @@ -> Tweak InterpMockChain b -> Ltl (UntypedTweak InterpMockChain) forall b c a. (b -> c) -> (a -> b) -> a -> c -. Tweak InterpMockChain b -> UntypedTweak InterpMockChain +. Tweak InterpMockChain b -> UntypedTweak InterpMockChain forall (m :: * -> *) a. Tweak m a -> UntypedTweak m UntypedTweak -- | Apply a 'Tweak' to the nth transaction in a given trace, 0 indexed. -- Only successful when this transaction exists and can be modified. -there :: MonadModalBlockChain m => Integer -> Tweak InterpMockChain b -> m a -> m a +there :: (MonadModalBlockChain m) => Integer -> Tweak InterpMockChain b -> m a -> m a there :: Integer -> Tweak InterpMockChain b -> m a -> m a -there Integer -n = Ltl (UntypedTweak InterpMockChain) -> m a -> m a +there Integer +n = Ltl (UntypedTweak InterpMockChain) -> m a -> m a forall (m :: * -> *) a. MonadModal m => Ltl (Modification m) -> m a -> m a @@ -894,21 +894,21 @@ -> m a -> m a forall b c a. (b -> c) -> (a -> b) -> a -> c -. Integer +. Integer -> Tweak InterpMockChain b -> Ltl (UntypedTweak InterpMockChain) forall t (m :: * -> *) a. (Eq t, Num t) => t -> Tweak m a -> Ltl (UntypedTweak m) -mkLtlFormula Integer -n +mkLtlFormula Integer +n where - mkLtlFormula :: t -> Tweak m a -> Ltl (UntypedTweak m) -mkLtlFormula t -x = + mkLtlFormula :: t -> Tweak m a -> Ltl (UntypedTweak m) +mkLtlFormula t +x = if t -x t -> t -> Bool +x t -> t -> Bool forall a. Eq a => a -> a -> Bool -== t +== t 0 then UntypedTweak m -> Ltl (UntypedTweak m) forall a. a -> Ltl a @@ -917,7 +917,7 @@ -> Tweak m a -> Ltl (UntypedTweak m) forall b c a. (b -> c) -> (a -> b) -> a -> c -. Tweak m a -> UntypedTweak m +. Tweak m a -> UntypedTweak m forall (m :: * -> *) a. Tweak m a -> UntypedTweak m UntypedTweak else Ltl (UntypedTweak m) -> Ltl (UntypedTweak m) @@ -927,11 +927,11 @@ -> Tweak m a -> Ltl (UntypedTweak m) forall b c a. (b -> c) -> (a -> b) -> a -> c -. t -> Tweak m a -> Ltl (UntypedTweak m) -mkLtlFormula (t -x t -> t -> t +. t -> Tweak m a -> Ltl (UntypedTweak m) +mkLtlFormula (t +x t -> t -> t forall a. Num a => a -> a -> a -- t +- t 1) -- | Apply a 'Tweak' to the next transaction in the given trace. The order of @@ -945,12 +945,12 @@ -- where @endpoint@ builds and validates a single transaction depending on the -- given @arguments@. Then `withTweak` says "I want to modify the transaction -- returned by this endpoint in the following way". -withTweak :: MonadModalBlockChain m => m x -> Tweak InterpMockChain a -> m x +withTweak :: (MonadModalBlockChain m) => m x -> Tweak InterpMockChain a -> m x withTweak :: m x -> Tweak InterpMockChain a -> m x withTweak = (Tweak InterpMockChain a -> m x -> m x) -> m x -> Tweak InterpMockChain a -> m x forall a b c. (a -> b -> c) -> b -> a -> c -flip (Integer -> Tweak InterpMockChain a -> m x -> m x +flip (Integer -> Tweak InterpMockChain a -> m x -> m x forall (m :: * -> *) b a. MonadModalBlockChain m => Integer -> Tweak InterpMockChain b -> m a -> m a @@ -959,10 +959,10 @@ -- * 'MonadBlockChain' and 'MonadMockChain' instances -singletonBuiltin :: builtin a -> Staged (LtlOp modification builtin) a +singletonBuiltin :: builtin a -> Staged (LtlOp modification builtin) a singletonBuiltin :: builtin a -> Staged (LtlOp modification builtin) a -singletonBuiltin builtin a -b = LtlOp modification builtin a +singletonBuiltin builtin a +b = LtlOp modification builtin a -> (a -> Staged (LtlOp modification builtin) a) -> Staged (LtlOp modification builtin) a forall (op :: * -> *) a b. @@ -971,13 +971,13 @@ forall (builtin :: * -> *) a modification. builtin a -> LtlOp modification builtin a Builtin builtin a -b) a -> Staged (LtlOp modification builtin) a +b) a -> Staged (LtlOp modification builtin) a forall a (op :: * -> *). a -> Staged op a Return -instance MonadError MockChainError StagedMockChain where - throwError :: MockChainError -> StagedMockChain a -throwError = MockChainBuiltin a -> StagedMockChain a +instance MonadError MockChainError StagedMockChain where + throwError :: MockChainError -> StagedMockChain a +throwError = MockChainBuiltin a -> StagedMockChain a forall (builtin :: * -> *) a modification. builtin a -> Staged (LtlOp modification builtin) a singletonBuiltin (MockChainBuiltin a -> StagedMockChain a) @@ -985,37 +985,37 @@ -> MockChainError -> StagedMockChain a forall b c a. (b -> c) -> (a -> b) -> a -> c -. MockChainError -> MockChainBuiltin a +. MockChainError -> MockChainBuiltin a forall a. MockChainError -> MockChainBuiltin a ThrowError - catchError :: StagedMockChain a + catchError :: StagedMockChain a -> (MockChainError -> StagedMockChain a) -> StagedMockChain a -catchError StagedMockChain a -act MockChainError -> StagedMockChain a -handler = MockChainBuiltin a -> StagedMockChain a +catchError StagedMockChain a +act MockChainError -> StagedMockChain a +handler = MockChainBuiltin a -> StagedMockChain a forall (builtin :: * -> *) a modification. builtin a -> Staged (LtlOp modification builtin) a singletonBuiltin (MockChainBuiltin a -> StagedMockChain a) -> MockChainBuiltin a -> StagedMockChain a forall a b. (a -> b) -> a -> b -$ StagedMockChain a +$ StagedMockChain a -> (MockChainError -> StagedMockChain a) -> MockChainBuiltin a forall a. StagedMockChain a -> (MockChainError -> StagedMockChain a) -> MockChainBuiltin a CatchError StagedMockChain a -act MockChainError -> StagedMockChain a -handler +act MockChainError -> StagedMockChain a +handler instance MonadBlockChainBalancing StagedMockChain where - getParams :: StagedMockChain Params + getParams :: StagedMockChain Params getParams = MockChainBuiltin Params -> StagedMockChain Params forall (builtin :: * -> *) a modification. builtin a -> Staged (LtlOp modification builtin) a singletonBuiltin MockChainBuiltin Params GetParams - datumFromHash :: DatumHash -> StagedMockChain (Maybe Datum) -datumFromHash = MockChainBuiltin (Maybe Datum) -> StagedMockChain (Maybe Datum) + datumFromHash :: DatumHash -> StagedMockChain (Maybe Datum) +datumFromHash = MockChainBuiltin (Maybe Datum) -> StagedMockChain (Maybe Datum) forall (builtin :: * -> *) a modification. builtin a -> Staged (LtlOp modification builtin) a singletonBuiltin (MockChainBuiltin (Maybe Datum) -> StagedMockChain (Maybe Datum)) @@ -1023,10 +1023,10 @@ -> DatumHash -> StagedMockChain (Maybe Datum) forall b c a. (b -> c) -> (a -> b) -> a -> c -. DatumHash -> MockChainBuiltin (Maybe Datum) +. DatumHash -> MockChainBuiltin (Maybe Datum) DatumFromHash - txOutByRefLedger :: TxOutRef -> StagedMockChain (Maybe TxOut) -txOutByRefLedger = MockChainBuiltin (Maybe TxOut) -> StagedMockChain (Maybe TxOut) + txOutByRefLedger :: TxOutRef -> StagedMockChain (Maybe TxOut) +txOutByRefLedger = MockChainBuiltin (Maybe TxOut) -> StagedMockChain (Maybe TxOut) forall (builtin :: * -> *) a modification. builtin a -> Staged (LtlOp modification builtin) a singletonBuiltin (MockChainBuiltin (Maybe TxOut) -> StagedMockChain (Maybe TxOut)) @@ -1034,10 +1034,10 @@ -> TxOutRef -> StagedMockChain (Maybe TxOut) forall b c a. (b -> c) -> (a -> b) -> a -> c -. TxOutRef -> MockChainBuiltin (Maybe TxOut) +. TxOutRef -> MockChainBuiltin (Maybe TxOut) TxOutByRefLedger - utxosAtLedger :: Address -> StagedMockChain [(TxOutRef, TxOut)] -utxosAtLedger = MockChainBuiltin [(TxOutRef, TxOut)] + utxosAtLedger :: Address -> StagedMockChain [(TxOutRef, TxOut)] +utxosAtLedger = MockChainBuiltin [(TxOutRef, TxOut)] -> StagedMockChain [(TxOutRef, TxOut)] forall (builtin :: * -> *) a modification. builtin a -> Staged (LtlOp modification builtin) a @@ -1047,10 +1047,10 @@ -> Address -> StagedMockChain [(TxOutRef, TxOut)] forall b c a. (b -> c) -> (a -> b) -> a -> c -. Address -> MockChainBuiltin [(TxOutRef, TxOut)] +. Address -> MockChainBuiltin [(TxOutRef, TxOut)] UtxosAtLedger - validatorFromHash :: ValidatorHash -> StagedMockChain (Maybe (Versioned Validator)) -validatorFromHash = MockChainBuiltin (Maybe (Versioned Validator)) + validatorFromHash :: ValidatorHash -> StagedMockChain (Maybe (Versioned Validator)) +validatorFromHash = MockChainBuiltin (Maybe (Versioned Validator)) -> StagedMockChain (Maybe (Versioned Validator)) forall (builtin :: * -> *) a modification. builtin a -> Staged (LtlOp modification builtin) a @@ -1061,36 +1061,36 @@ -> ValidatorHash -> StagedMockChain (Maybe (Versioned Validator)) forall b c a. (b -> c) -> (a -> b) -> a -> c -. ValidatorHash -> MockChainBuiltin (Maybe (Versioned Validator)) +. ValidatorHash -> MockChainBuiltin (Maybe (Versioned Validator)) ValidatorFromHash instance MonadBlockChainWithoutValidation StagedMockChain where - allUtxosLedger :: StagedMockChain [(TxOutRef, TxOut)] -allUtxosLedger = MockChainBuiltin [(TxOutRef, TxOut)] + allUtxosLedger :: StagedMockChain [(TxOutRef, TxOut)] +allUtxosLedger = MockChainBuiltin [(TxOutRef, TxOut)] -> StagedMockChain [(TxOutRef, TxOut)] forall (builtin :: * -> *) a modification. builtin a -> Staged (LtlOp modification builtin) a singletonBuiltin MockChainBuiltin [(TxOutRef, TxOut)] AllUtxosLedger - currentSlot :: StagedMockChain Slot -currentSlot = MockChainBuiltin Slot -> StagedMockChain Slot + currentSlot :: StagedMockChain Slot +currentSlot = MockChainBuiltin Slot -> StagedMockChain Slot forall (builtin :: * -> *) a modification. builtin a -> Staged (LtlOp modification builtin) a singletonBuiltin MockChainBuiltin Slot GetCurrentSlot - awaitSlot :: Slot -> StagedMockChain Slot -awaitSlot = MockChainBuiltin Slot -> StagedMockChain Slot + awaitSlot :: Slot -> StagedMockChain Slot +awaitSlot = MockChainBuiltin Slot -> StagedMockChain Slot forall (builtin :: * -> *) a modification. builtin a -> Staged (LtlOp modification builtin) a singletonBuiltin (MockChainBuiltin Slot -> StagedMockChain Slot) -> (Slot -> MockChainBuiltin Slot) -> Slot -> StagedMockChain Slot forall b c a. (b -> c) -> (a -> b) -> a -> c -. Slot -> MockChainBuiltin Slot +. Slot -> MockChainBuiltin Slot AwaitSlot instance MonadBlockChain StagedMockChain where - validateTxSkel :: TxSkel -> StagedMockChain CardanoTx -validateTxSkel = MockChainBuiltin CardanoTx -> StagedMockChain CardanoTx + validateTxSkel :: TxSkel -> StagedMockChain CardanoTx +validateTxSkel = MockChainBuiltin CardanoTx -> StagedMockChain CardanoTx forall (builtin :: * -> *) a modification. builtin a -> Staged (LtlOp modification builtin) a singletonBuiltin (MockChainBuiltin CardanoTx -> StagedMockChain CardanoTx) @@ -1098,6 +1098,6 @@ -> TxSkel -> StagedMockChain CardanoTx forall b c a. (b -> c) -> (a -> b) -> a -> c -. TxSkel -> MockChainBuiltin CardanoTx +. TxSkel -> MockChainBuiltin CardanoTx ValidateTxSkel \ No newline at end of file diff --git a/src/Cooked.MockChain.Testing.html b/src/Cooked.MockChain.Testing.html index c64ab1f17..f644aaede 100644 --- a/src/Cooked.MockChain.Testing.html +++ b/src/Cooked.MockChain.Testing.html @@ -5,147 +5,147 @@ module Cooked.MockChain.Testing where -import qualified Control.Exception as E -import Control.Monad +import qualified Control.Exception as E +import Control.Monad import Cooked.MockChain.BlockChain import Cooked.MockChain.Direct import Cooked.MockChain.Staged import Cooked.MockChain.UtxoState import Cooked.Pretty import Cooked.Wallet -import Data.Default -import qualified Data.Text as T -import Debug.Trace -import Ledger.Index (ValidationError (ScriptFailure)) -import Ledger.Scripts (ScriptError (EvaluationError)) -import qualified Test.QuickCheck as QC -import qualified Test.Tasty.HUnit as HU +import Data.Default +import qualified Data.Text as T +import Debug.Trace +import Ledger.Index (ValidationError (ScriptFailure)) +import Ledger.Scripts (ScriptError (EvaluationError)) +import qualified Test.QuickCheck as QC +import qualified Test.Tasty.HUnit as HU -- | This module provides a common interface for HUnit and QuickCheck tests. -- We do so by abstracting uses of 'HU.Assertion' and 'QC.Property' for @(IsProp prop) => prop@, -- then provide instances for both @HU.Asserton@ and @QC.Property@. -class IsProp prop where +class IsProp prop where -- | Displays the string to the user in case of failure - testCounterexample :: String -> prop -> prop + testCounterexample :: String -> prop -> prop -- | Conjunction of a number of results - testConjoin :: [prop] -> prop + testConjoin :: [prop] -> prop -- | Disjunction of a number of results - testDisjoin :: [prop] -> prop + testDisjoin :: [prop] -> prop -- | Flags a failure - testFailure :: prop - testFailure = [prop] -> prop + testFailure :: prop + testFailure = [prop] -> prop forall prop. IsProp prop => [prop] -> prop testDisjoin [] -- | Flags a success - testSuccess :: prop - testSuccess = [prop] -> prop + testSuccess :: prop + testSuccess = [prop] -> prop forall prop. IsProp prop => [prop] -> prop testConjoin [] -- | Flags a failure with a message - testFailureMsg :: String -> prop - testFailureMsg String -msg = String -> prop -> prop + testFailureMsg :: String -> prop + testFailureMsg String +msg = String -> prop -> prop forall prop. IsProp prop => String -> prop -> prop testCounterexample String -msg prop +msg prop forall prop. IsProp prop => prop testFailure -testBool :: (IsProp prop) => Bool -> prop +testBool :: (IsProp prop) => Bool -> prop testBool :: Bool -> prop testBool Bool -True = prop +True = prop forall prop. IsProp prop => prop testSuccess testBool Bool -False = prop +False = prop forall prop. IsProp prop => prop testFailure -testAll :: (IsProp prop) => (a -> prop) -> [a] -> prop +testAll :: (IsProp prop) => (a -> prop) -> [a] -> prop testAll :: (a -> prop) -> [a] -> prop -testAll a -> prop -f = [prop] -> prop +testAll a -> prop +f = [prop] -> prop forall prop. IsProp prop => [prop] -> prop testConjoin ([prop] -> prop) -> ([a] -> [prop]) -> [a] -> prop forall b c a. (b -> c) -> (a -> b) -> a -> c -. (a -> prop) -> [a] -> [prop] +. (a -> prop) -> [a] -> [prop] forall a b. (a -> b) -> [a] -> [b] -map a -> prop -f +map a -> prop +f infix 4 .==. -(.==.) :: (IsProp prop, Eq a) => a -> a -> prop -a -a .==. :: a -> a -> prop -.==. a -b = Bool -> prop +(.==.) :: (IsProp prop, Eq a) => a -> a -> prop +a +a .==. :: a -> a -> prop +.==. a +b = Bool -> prop forall prop. IsProp prop => Bool -> prop testBool (Bool -> prop) -> Bool -> prop forall a b. (a -> b) -> a -> b -$ a -a a -> a -> Bool +$ a +a a -> a -> Bool forall a. Eq a => a -> a -> Bool -== a -b +== a +b infixr 3 .&&. -(.&&.) :: (IsProp prop) => prop -> prop -> prop -prop -a .&&. :: prop -> prop -> prop -.&&. prop -b = [prop] -> prop +(.&&.) :: (IsProp prop) => prop -> prop -> prop +prop +a .&&. :: prop -> prop -> prop +.&&. prop +b = [prop] -> prop forall prop. IsProp prop => [prop] -> prop testConjoin [prop -a, prop -b] +a, prop +b] infixr 2 .||. -(.||.) :: (IsProp prop) => prop -> prop -> prop -prop -a .||. :: prop -> prop -> prop -.||. prop -b = [prop] -> prop +(.||.) :: (IsProp prop) => prop -> prop -> prop +prop +a .||. :: prop -> prop -> prop +.||. prop +b = [prop] -> prop forall prop. IsProp prop => [prop] -> prop testDisjoin [prop -a, prop -b] +a, prop +b] -- | Ensure that all results produced by the staged mockchain /succeed/, starting -- from the default initial distribution -testSucceeds :: (IsProp prop) => PrettyCookedOpts -> StagedMockChain a -> prop +testSucceeds :: (IsProp prop) => PrettyCookedOpts -> StagedMockChain a -> prop testSucceeds :: PrettyCookedOpts -> StagedMockChain a -> prop -testSucceeds PrettyCookedOpts -pcOpts = PrettyCookedOpts +testSucceeds PrettyCookedOpts +pcOpts = PrettyCookedOpts -> InitialDistribution -> StagedMockChain a -> prop forall prop a. IsProp prop => PrettyCookedOpts -> InitialDistribution -> StagedMockChain a -> prop testSucceedsFrom PrettyCookedOpts -pcOpts InitialDistribution +pcOpts InitialDistribution forall a. Default a => a -def +def -- | Ensure that all results produced by the staged mockchain /fail/ and that a -- predicate holds over the error. -- -- To test that validation fails, use -- > testFails def (isCekEvaluationFailure def) e -testFails :: (IsProp prop, Show a) => PrettyCookedOpts -> (MockChainError -> prop) -> StagedMockChain a -> prop +testFails :: (IsProp prop, Show a) => PrettyCookedOpts -> (MockChainError -> prop) -> StagedMockChain a -> prop testFails :: PrettyCookedOpts -> (MockChainError -> prop) -> StagedMockChain a -> prop -testFails PrettyCookedOpts -pcOpts MockChainError -> prop -predi = PrettyCookedOpts +testFails PrettyCookedOpts +pcOpts MockChainError -> prop +predi = PrettyCookedOpts -> (MockChainError -> prop) -> InitialDistribution -> StagedMockChain a @@ -158,24 +158,24 @@ -> StagedMockChain a -> prop testFailsFrom PrettyCookedOpts -pcOpts MockChainError -> prop -predi InitialDistribution +pcOpts MockChainError -> prop +predi InitialDistribution forall a. Default a => a -def +def -- | Ensure that all results produced by the staged mockchain succeed starting -- from some initial distribution but doesn't impose any additional condition on success. -- Use 'testSucceedsFrom'' for that. -testSucceedsFrom :: - (IsProp prop) => +testSucceedsFrom :: + (IsProp prop) => PrettyCookedOpts -> InitialDistribution -> - StagedMockChain a -> - prop + StagedMockChain a -> + prop testSucceedsFrom :: PrettyCookedOpts -> InitialDistribution -> StagedMockChain a -> prop -testSucceedsFrom PrettyCookedOpts -pcOpts = PrettyCookedOpts +testSucceedsFrom PrettyCookedOpts +pcOpts = PrettyCookedOpts -> (a -> UtxoState -> prop) -> InitialDistribution -> StagedMockChain a @@ -188,7 +188,7 @@ -> StagedMockChain a -> prop testSucceedsFrom' PrettyCookedOpts -pcOpts (\a +pcOpts (\a _ UtxoState _ -> prop forall prop. IsProp prop => prop @@ -197,21 +197,21 @@ -- | Ensure that all results produced by the staged mockchain succeed starting -- from some initial distribution. Additionally impose a condition over the -- resulting state and value. -testSucceedsFrom' :: - (IsProp prop) => +testSucceedsFrom' :: + (IsProp prop) => PrettyCookedOpts -> - (a -> UtxoState -> prop) -> + (a -> UtxoState -> prop) -> InitialDistribution -> - StagedMockChain a -> - prop + StagedMockChain a -> + prop testSucceedsFrom' :: PrettyCookedOpts -> (a -> UtxoState -> prop) -> InitialDistribution -> StagedMockChain a -> prop -testSucceedsFrom' PrettyCookedOpts -pcOpts a -> UtxoState -> prop -prop = PrettyCookedOpts +testSucceedsFrom' PrettyCookedOpts +pcOpts a -> UtxoState -> prop +prop = PrettyCookedOpts -> (Either MockChainError (a, UtxoState) -> prop) -> InitialDistribution -> StagedMockChain a @@ -224,43 +224,43 @@ -> StagedMockChain a -> prop testAllSatisfiesFrom PrettyCookedOpts -pcOpts ((MockChainError -> prop) +pcOpts ((MockChainError -> prop) -> ((a, UtxoState) -> prop) -> Either MockChainError (a, UtxoState) -> prop forall a c b. (a -> c) -> (b -> c) -> Either a b -> c -either (String -> prop +either (String -> prop forall prop. IsProp prop => String -> prop testFailureMsg (String -> prop) -> (MockChainError -> String) -> MockChainError -> prop forall b c a. (b -> c) -> (a -> b) -> a -> c -. (MockChainError -> DocCooked) -> MockChainError -> String +. (MockChainError -> DocCooked) -> MockChainError -> String forall a. (a -> DocCooked) -> a -> String renderString (PrettyCookedOpts -> MockChainError -> DocCooked forall a. PrettyCooked a => PrettyCookedOpts -> a -> DocCooked prettyCookedOpt PrettyCookedOpts -pcOpts)) ((a -> UtxoState -> prop) -> (a, UtxoState) -> prop +pcOpts)) ((a -> UtxoState -> prop) -> (a, UtxoState) -> prop forall a b c. (a -> b -> c) -> (a, b) -> c -uncurry a -> UtxoState -> prop -prop)) +uncurry a -> UtxoState -> prop +prop)) -- | Ensure that all results produced by the staged mockchain /fail/ starting -- from some initial distribution. -testFailsFrom :: - (IsProp prop, Show a) => +testFailsFrom :: + (IsProp prop, Show a) => PrettyCookedOpts -> - (MockChainError -> prop) -> + (MockChainError -> prop) -> InitialDistribution -> - StagedMockChain a -> - prop + StagedMockChain a -> + prop testFailsFrom :: PrettyCookedOpts -> (MockChainError -> prop) -> InitialDistribution -> StagedMockChain a -> prop -testFailsFrom PrettyCookedOpts -pcOpts MockChainError -> prop -predi = +testFailsFrom PrettyCookedOpts +pcOpts MockChainError -> prop +predi = PrettyCookedOpts -> (Either MockChainError (a, UtxoState) -> prop) -> InitialDistribution @@ -275,24 +275,24 @@ -> prop testAllSatisfiesFrom PrettyCookedOpts -pcOpts +pcOpts ((MockChainError -> prop) -> ((a, UtxoState) -> prop) -> Either MockChainError (a, UtxoState) -> prop forall a c b. (a -> c) -> (b -> c) -> Either a b -> c -either MockChainError -> prop -predi (String -> prop +either MockChainError -> prop +predi (String -> prop forall prop. IsProp prop => String -> prop testFailureMsg (String -> prop) -> ((a, UtxoState) -> String) -> (a, UtxoState) -> prop forall b c a. (b -> c) -> (a -> b) -> a -> c -. ((a, UtxoState) -> DocCooked) -> (a, UtxoState) -> String +. ((a, UtxoState) -> DocCooked) -> (a, UtxoState) -> String forall a. (a -> DocCooked) -> a -> String renderString (PrettyCookedOpts -> (a, UtxoState) -> DocCooked forall a. PrettyCooked a => PrettyCookedOpts -> a -> DocCooked prettyCookedOpt PrettyCookedOpts -pcOpts))) +pcOpts))) -- | Is satisfied when the given 'MockChainError' is wrapping a @CekEvaluationFailure@. -- This is particularly important when writing negative tests. For example, if we are simulating @@ -300,87 +300,87 @@ -- yielding a test that fails for reasons such as @ValueLessThanMinAda@ or @ValueNotPreserved@, which -- does not rule out the attack being caught by the validator script. For these scenarios it is -- paramount to rely on @testFailsFrom' isCekEvaluationFailure@ instead. -isCekEvaluationFailure :: (IsProp prop) => PrettyCookedOpts -> MockChainError -> prop +isCekEvaluationFailure :: (IsProp prop) => PrettyCookedOpts -> MockChainError -> prop isCekEvaluationFailure :: PrettyCookedOpts -> MockChainError -> prop isCekEvaluationFailure PrettyCookedOpts _ (MCEValidationError (ValidationPhase -_, ScriptFailure ScriptError +_, ScriptFailure ScriptError _)) = prop forall prop. IsProp prop => prop testSuccess -isCekEvaluationFailure PrettyCookedOpts -pcOpts MockChainError -e = String -> prop +isCekEvaluationFailure PrettyCookedOpts +pcOpts MockChainError +e = String -> prop forall prop. IsProp prop => String -> prop testFailureMsg (String -> prop) -> String -> prop forall a b. (a -> b) -> a -> b -$ String +$ String "Expected 'CekEvaluationFailure', got: " String -> String -> String forall a. [a] -> [a] -> [a] -++ (MockChainError -> DocCooked) -> MockChainError -> String +++ (MockChainError -> DocCooked) -> MockChainError -> String forall a. (a -> DocCooked) -> a -> String renderString (PrettyCookedOpts -> MockChainError -> DocCooked forall a. PrettyCooked a => PrettyCookedOpts -> a -> DocCooked prettyCookedOpt PrettyCookedOpts -pcOpts) MockChainError -e +pcOpts) MockChainError +e -- | Similar to 'isCekEvaluationFailure', but enables us to check for a specific error message in the error. -isCekEvaluationFailureWithMsg :: (IsProp prop) => PrettyCookedOpts -> (String -> Bool) -> MockChainError -> prop +isCekEvaluationFailureWithMsg :: (IsProp prop) => PrettyCookedOpts -> (String -> Bool) -> MockChainError -> prop isCekEvaluationFailureWithMsg :: PrettyCookedOpts -> (String -> Bool) -> MockChainError -> prop isCekEvaluationFailureWithMsg PrettyCookedOpts -_ String -> Bool -f (MCEValidationError (ValidationPhase -_, ScriptFailure (EvaluationError [Text] -msgs String +_ String -> Bool +f (MCEValidationError (ValidationPhase +_, ScriptFailure (EvaluationError [Text] +msgs String _))) | (Text -> Bool) -> [Text] -> Bool forall (t :: * -> *) a. Foldable t => (a -> Bool) -> t a -> Bool -any (String -> Bool -f (String -> Bool) -> (Text -> String) -> Text -> Bool +any (String -> Bool +f (String -> Bool) -> (Text -> String) -> Text -> Bool forall b c a. (b -> c) -> (a -> b) -> a -> c -. Text -> String -T.unpack) [Text] -msgs = prop +. Text -> String +T.unpack) [Text] +msgs = prop forall prop. IsProp prop => prop testSuccess -isCekEvaluationFailureWithMsg PrettyCookedOpts -pcOpts String -> Bool -_ MockChainError -e = String -> prop +isCekEvaluationFailureWithMsg PrettyCookedOpts +pcOpts String -> Bool +_ MockChainError +e = String -> prop forall prop. IsProp prop => String -> prop testFailureMsg (String -> prop) -> String -> prop forall a b. (a -> b) -> a -> b -$ String +$ String "Expected 'CekEvaluationFailure' with specific messages, got: " String -> String -> String forall a. [a] -> [a] -> [a] -++ (MockChainError -> DocCooked) -> MockChainError -> String +++ (MockChainError -> DocCooked) -> MockChainError -> String forall a. (a -> DocCooked) -> a -> String renderString (PrettyCookedOpts -> MockChainError -> DocCooked forall a. PrettyCooked a => PrettyCookedOpts -> a -> DocCooked prettyCookedOpt PrettyCookedOpts -pcOpts) MockChainError -e +pcOpts) MockChainError +e -- | Ensure that all results produced by the set of traces encoded by the 'StagedMockChain' -- satisfy the given predicate. If you wish to build custom predicates -- you can use 'testSatisfiesFrom'' directly and see 'testBinaryRelatedBy' as an example. testAllSatisfiesFrom :: - forall prop a. - (IsProp prop) => + forall prop a. + (IsProp prop) => PrettyCookedOpts -> - (Either MockChainError (a, UtxoState) -> prop) -> + (Either MockChainError (a, UtxoState) -> prop) -> InitialDistribution -> - StagedMockChain a -> - prop + StagedMockChain a -> + prop testAllSatisfiesFrom :: PrettyCookedOpts -> (Either MockChainError (a, UtxoState) -> prop) -> InitialDistribution -> StagedMockChain a -> prop -testAllSatisfiesFrom PrettyCookedOpts -pcOpts Either MockChainError (a, UtxoState) -> prop -f = ([(Either MockChainError (a, UtxoState), MockChainLog)] -> prop) +testAllSatisfiesFrom PrettyCookedOpts +pcOpts Either MockChainError (a, UtxoState) -> prop +f = ([(Either MockChainError (a, UtxoState), MockChainLog)] -> prop) -> InitialDistribution -> StagedMockChain a -> prop forall a prop. ([(Either MockChainError (a, UtxoState), MockChainLog)] -> prop) @@ -389,23 +389,23 @@ -> [(Either MockChainError (a, UtxoState), MockChainLog)] -> prop forall prop a. IsProp prop => (a -> prop) -> [a] -> prop testAll (Either MockChainError (a, UtxoState), MockChainLog) -> prop -go) +go) where - go :: (Either MockChainError (a, UtxoState), MockChainLog) -> prop - go :: (Either MockChainError (a, UtxoState), MockChainLog) -> prop -go (Either MockChainError (a, UtxoState) -prop, MockChainLog -mcLog) = String -> prop -> prop + go :: (Either MockChainError (a, UtxoState), MockChainLog) -> prop + go :: (Either MockChainError (a, UtxoState), MockChainLog) -> prop +go (Either MockChainError (a, UtxoState) +prop, MockChainLog +mcLog) = String -> prop -> prop forall prop. IsProp prop => String -> prop -> prop testCounterexample ((MockChainLog -> DocCooked) -> MockChainLog -> String forall a. (a -> DocCooked) -> a -> String renderString (PrettyCookedOpts -> MockChainLog -> DocCooked forall a. PrettyCooked a => PrettyCookedOpts -> a -> DocCooked prettyCookedOpt PrettyCookedOpts -pcOpts) MockChainLog -mcLog) (Either MockChainError (a, UtxoState) -> prop -f Either MockChainError (a, UtxoState) -prop) +pcOpts) MockChainLog +mcLog) (Either MockChainError (a, UtxoState) -> prop +f Either MockChainError (a, UtxoState) +prop) -- | Asserts that the given 'StagedMockChain' produces exactly two outcomes, both of which -- are successful and have their resulting states related by a given predicate. A typical @@ -414,21 +414,21 @@ -- > testBinaryRelatedBy equalModuloAda myInitDistr $ do -- > x <- trPrepare -- > execOption1 x <|> execOption2 x -testBinaryRelatedBy :: - (IsProp prop) => +testBinaryRelatedBy :: + (IsProp prop) => PrettyCookedOpts -> - (UtxoState -> UtxoState -> prop) -> + (UtxoState -> UtxoState -> prop) -> InitialDistribution -> - StagedMockChain a -> - prop + StagedMockChain a -> + prop testBinaryRelatedBy :: PrettyCookedOpts -> (UtxoState -> UtxoState -> prop) -> InitialDistribution -> StagedMockChain a -> prop -testBinaryRelatedBy PrettyCookedOpts -pcOpts UtxoState -> UtxoState -> prop -rel = ([(Either MockChainError (a, UtxoState), MockChainLog)] -> prop) +testBinaryRelatedBy PrettyCookedOpts +pcOpts UtxoState -> UtxoState -> prop +rel = ([(Either MockChainError (a, UtxoState), MockChainLog)] -> prop) -> InitialDistribution -> StagedMockChain a -> prop forall a prop. ([(Either MockChainError (a, UtxoState), MockChainLog)] -> prop) @@ -440,83 +440,83 @@ -> StagedMockChain a -> prop forall a b. (a -> b) -> a -> b -$ \case - [(Either MockChainError (a, UtxoState) -ra, MockChainLog -ta), (Either MockChainError (a, UtxoState) -rb, MockChainLog -tb)] -> case (Either MockChainError (a, UtxoState) -ra, Either MockChainError (a, UtxoState) -rb) of - (Right (a, UtxoState) -resA, Right (a, UtxoState) -resB) -> UtxoState -> UtxoState -> prop -rel ((a, UtxoState) -> UtxoState +$ \case + [(Either MockChainError (a, UtxoState) +ra, MockChainLog +ta), (Either MockChainError (a, UtxoState) +rb, MockChainLog +tb)] -> case (Either MockChainError (a, UtxoState) +ra, Either MockChainError (a, UtxoState) +rb) of + (Right (a, UtxoState) +resA, Right (a, UtxoState) +resB) -> UtxoState -> UtxoState -> prop +rel ((a, UtxoState) -> UtxoState forall a b. (a, b) -> b -snd (a, UtxoState) -resA) ((a, UtxoState) -> UtxoState +snd (a, UtxoState) +resA) ((a, UtxoState) -> UtxoState forall a b. (a, b) -> b -snd (a, UtxoState) -resB) - (Left MockChainError -errA, Right (a, UtxoState) +snd (a, UtxoState) +resB) + (Left MockChainError +errA, Right (a, UtxoState) _) -> String -> prop forall prop. IsProp prop => String -> prop testFailureMsg (String -> prop) -> String -> prop forall a b. (a -> b) -> a -> b -$ [String] -> String +$ [String] -> String forall (t :: * -> *) a. Foldable t => t [a] -> [a] -concat [String +concat [String "Expected two outcomes, the first failed with:", (MockChainError -> DocCooked) -> MockChainError -> String forall a. (a -> DocCooked) -> a -> String renderString (PrettyCookedOpts -> MockChainError -> DocCooked forall a. PrettyCooked a => PrettyCookedOpts -> a -> DocCooked prettyCookedOpt PrettyCookedOpts -pcOpts) MockChainError -errA, String +pcOpts) MockChainError +errA, String "\n", (MockChainLog -> DocCooked) -> MockChainLog -> String forall a. (a -> DocCooked) -> a -> String renderString (PrettyCookedOpts -> MockChainLog -> DocCooked forall a. PrettyCooked a => PrettyCookedOpts -> a -> DocCooked prettyCookedOpt PrettyCookedOpts -pcOpts) MockChainLog -ta] - (Right (a, UtxoState) -_, Left MockChainError -errB) -> +pcOpts) MockChainLog +ta] + (Right (a, UtxoState) +_, Left MockChainError +errB) -> String -> prop forall prop. IsProp prop => String -> prop testFailureMsg (String -> prop) -> String -> prop forall a b. (a -> b) -> a -> b -$ [String] -> String +$ [String] -> String forall (t :: * -> *) a. Foldable t => t [a] -> [a] -concat [String +concat [String "Expected two outcomes, the second failed with:", (MockChainError -> DocCooked) -> MockChainError -> String forall a. (a -> DocCooked) -> a -> String renderString (PrettyCookedOpts -> MockChainError -> DocCooked forall a. PrettyCooked a => PrettyCookedOpts -> a -> DocCooked prettyCookedOpt PrettyCookedOpts -pcOpts) MockChainError -errB, String +pcOpts) MockChainError +errB, String "\n", (MockChainLog -> DocCooked) -> MockChainLog -> String forall a. (a -> DocCooked) -> a -> String renderString (PrettyCookedOpts -> MockChainLog -> DocCooked forall a. PrettyCooked a => PrettyCookedOpts -> a -> DocCooked prettyCookedOpt PrettyCookedOpts -pcOpts) MockChainLog -tb] - (Left MockChainError -errA, Left MockChainError -errB) -> +pcOpts) MockChainLog +tb] + (Left MockChainError +errA, Left MockChainError +errB) -> String -> prop forall prop. IsProp prop => String -> prop testFailureMsg (String -> prop) -> String -> prop forall a b. (a -> b) -> a -> b -$ +$ [String] -> String forall (t :: * -> *) a. Foldable t => t [a] -> [a] -concat +concat [ String "Expected two outcomes, both failed with:", (MockChainError -> DocCooked) -> MockChainError -> String @@ -524,8 +524,8 @@ renderString (PrettyCookedOpts -> MockChainError -> DocCooked forall a. PrettyCooked a => PrettyCookedOpts -> a -> DocCooked prettyCookedOpt PrettyCookedOpts -pcOpts) MockChainError -errA, +pcOpts) MockChainError +errA, String "; ", (MockChainError -> DocCooked) -> MockChainError -> String @@ -533,8 +533,8 @@ renderString (PrettyCookedOpts -> MockChainError -> DocCooked forall a. PrettyCooked a => PrettyCookedOpts -> a -> DocCooked prettyCookedOpt PrettyCookedOpts -pcOpts) MockChainError -errB, +pcOpts) MockChainError +errB, String "\n First: ", (MockChainLog -> DocCooked) -> MockChainLog -> String @@ -542,8 +542,8 @@ renderString (PrettyCookedOpts -> MockChainLog -> DocCooked forall a. PrettyCooked a => PrettyCookedOpts -> a -> DocCooked prettyCookedOpt PrettyCookedOpts -pcOpts) MockChainLog -ta, +pcOpts) MockChainLog +ta, String "\nSecond: ", (MockChainLog -> DocCooked) -> MockChainLog -> String @@ -551,23 +551,23 @@ renderString (PrettyCookedOpts -> MockChainLog -> DocCooked forall a. PrettyCooked a => PrettyCookedOpts -> a -> DocCooked prettyCookedOpt PrettyCookedOpts -pcOpts) MockChainLog -tb +pcOpts) MockChainLog +tb ] - [(Either MockChainError (a, UtxoState), MockChainLog)] -xs -> String -> prop + [(Either MockChainError (a, UtxoState), MockChainLog)] +xs -> String -> prop forall prop. IsProp prop => String -> prop testFailureMsg (String -> prop) -> String -> prop forall a b. (a -> b) -> a -> b -$ String +$ String "Expected exactly two outcomes, received: " String -> String -> String forall a. [a] -> [a] -> [a] -++ Int -> String +++ Int -> String forall a. Show a => a -> String -show ([(Either MockChainError (a, UtxoState), MockChainLog)] -> Int +show ([(Either MockChainError (a, UtxoState), MockChainLog)] -> Int forall (t :: * -> *) a. Foldable t => t a -> Int -length [(Either MockChainError (a, UtxoState), MockChainLog)] -xs) +length [(Either MockChainError (a, UtxoState), MockChainLog)] +xs) -- | Generalizes 'testBinaryRelatedBy', asserting that the given 'StagedMockChain' produces -- more than two outcomes, say @[x,y,z,w]@, all of which are successful (i.e. are not a 'MockChainError') @@ -577,21 +577,21 @@ -- -- Because @(~)@ should be symmetric and transitive we can estabilish that these states all belong -- to the same equivalence class. This function does /not/ check each pointwise case. -testOneEquivClass :: - (IsProp prop) => +testOneEquivClass :: + (IsProp prop) => PrettyCookedOpts -> - (UtxoState -> UtxoState -> prop) -> + (UtxoState -> UtxoState -> prop) -> InitialDistribution -> - StagedMockChain a -> - prop + StagedMockChain a -> + prop testOneEquivClass :: PrettyCookedOpts -> (UtxoState -> UtxoState -> prop) -> InitialDistribution -> StagedMockChain a -> prop -testOneEquivClass PrettyCookedOpts -pcOpts UtxoState -> UtxoState -> prop -rel = ([(Either MockChainError (a, UtxoState), MockChainLog)] -> prop) +testOneEquivClass PrettyCookedOpts +pcOpts UtxoState -> UtxoState -> prop +rel = ([(Either MockChainError (a, UtxoState), MockChainLog)] -> prop) -> InitialDistribution -> StagedMockChain a -> prop forall a prop. ([(Either MockChainError (a, UtxoState), MockChainLog)] -> prop) @@ -603,7 +603,7 @@ -> StagedMockChain a -> prop forall a b. (a -> b) -> a -> b -$ \case +$ \case [] -> String -> prop forall prop. IsProp prop => String -> prop testFailureMsg String @@ -613,90 +613,90 @@ forall prop. IsProp prop => String -> prop testFailureMsg String "Expected two of more outcomes, received: 1" - ((Left MockChainError -errX, MockChainLog -tx) : [(Either MockChainError (a, UtxoState), MockChainLog)] + ((Left MockChainError +errX, MockChainLog +tx) : [(Either MockChainError (a, UtxoState), MockChainLog)] _) -> String -> prop forall prop. IsProp prop => String -> prop testFailureMsg (String -> prop) -> String -> prop forall a b. (a -> b) -> a -> b -$ [String] -> String +$ [String] -> String forall (t :: * -> *) a. Foldable t => t [a] -> [a] -concat [String +concat [String "First outcome is a failure: ", (MockChainError -> DocCooked) -> MockChainError -> String forall a. (a -> DocCooked) -> a -> String renderString (PrettyCookedOpts -> MockChainError -> DocCooked forall a. PrettyCooked a => PrettyCookedOpts -> a -> DocCooked prettyCookedOpt PrettyCookedOpts -pcOpts) MockChainError -errX, String +pcOpts) MockChainError +errX, String "\n", (MockChainLog -> DocCooked) -> MockChainLog -> String forall a. (a -> DocCooked) -> a -> String renderString (PrettyCookedOpts -> MockChainLog -> DocCooked forall a. PrettyCooked a => PrettyCookedOpts -> a -> DocCooked prettyCookedOpt PrettyCookedOpts -pcOpts) MockChainLog -tx] - ((Right (a, UtxoState) -resX, MockChainLog -_) : [(Either MockChainError (a, UtxoState), MockChainLog)] -xs) -> UtxoState +pcOpts) MockChainLog +tx] + ((Right (a, UtxoState) +resX, MockChainLog +_) : [(Either MockChainError (a, UtxoState), MockChainLog)] +xs) -> UtxoState -> [(Either MockChainError (a, UtxoState), MockChainLog)] -> prop forall a a a. (PrettyCooked a, PrettyCooked a) => UtxoState -> [(Either a (a, UtxoState), a)] -> prop -go ((a, UtxoState) -> UtxoState +go ((a, UtxoState) -> UtxoState forall a b. (a, b) -> b -snd (a, UtxoState) -resX) [(Either MockChainError (a, UtxoState), MockChainLog)] -xs +snd (a, UtxoState) +resX) [(Either MockChainError (a, UtxoState), MockChainLog)] +xs where -- we can flag a success here because 'xs' above is guarnateed to have at least -- one element since we ruled out the empty and the singleton lists in the \case - go :: UtxoState -> [(Either a (a, UtxoState), a)] -> prop -go UtxoState -_resX [] = prop + go :: UtxoState -> [(Either a (a, UtxoState), a)] -> prop +go UtxoState +_resX [] = prop forall prop. IsProp prop => prop testSuccess - go UtxoState -_resX ((Left a -errY, a -ty) : [(Either a (a, UtxoState), a)] + go UtxoState +_resX ((Left a +errY, a +ty) : [(Either a (a, UtxoState), a)] _) = String -> prop forall prop. IsProp prop => String -> prop testFailureMsg (String -> prop) -> String -> prop forall a b. (a -> b) -> a -> b -$ [String] -> String +$ [String] -> String forall (t :: * -> *) a. Foldable t => t [a] -> [a] -concat [String +concat [String "An outcome is a failure: ", (a -> DocCooked) -> a -> String forall a. (a -> DocCooked) -> a -> String renderString (PrettyCookedOpts -> a -> DocCooked forall a. PrettyCooked a => PrettyCookedOpts -> a -> DocCooked prettyCookedOpt PrettyCookedOpts -pcOpts) a -errY, String +pcOpts) a +errY, String "\n", (a -> DocCooked) -> a -> String forall a. (a -> DocCooked) -> a -> String renderString (PrettyCookedOpts -> a -> DocCooked forall a. PrettyCooked a => PrettyCookedOpts -> a -> DocCooked prettyCookedOpt PrettyCookedOpts -pcOpts) a -ty] - go UtxoState -resX ((Right (a -_, UtxoState -resY), a -_) : [(Either a (a, UtxoState), a)] -ys) = [prop] -> prop +pcOpts) a +ty] + go UtxoState +resX ((Right (a +_, UtxoState +resY), a +_) : [(Either a (a, UtxoState), a)] +ys) = [prop] -> prop forall prop. IsProp prop => [prop] -> prop testConjoin [UtxoState -> UtxoState -> prop -rel UtxoState -resX UtxoState -resY, UtxoState -> [(Either a (a, UtxoState), a)] -> prop -go UtxoState -resX [(Either a (a, UtxoState), a)] -ys] +rel UtxoState +resX UtxoState +resY, UtxoState -> [(Either a (a, UtxoState), a)] -> prop +go UtxoState +resX [(Either a (a, UtxoState), a)] +ys] -- | Asserts that the results produced by running the given 'StagedMockChain' from -- some speficied 'InitialDistribution' satisfy a given assertion. In this case, @@ -706,23 +706,23 @@ -- Although this function is mainly used internally, as a building block for the simpler predicates, -- it can be useful in building some custom predicates. Check 'testAllSatisfiesFrom' -- or 'testBinaryRelatedBy' for examples on using this. -testSatisfiesFrom' :: - ([(Either MockChainError (a, UtxoState), MockChainLog)] -> prop) -> +testSatisfiesFrom' :: + ([(Either MockChainError (a, UtxoState), MockChainLog)] -> prop) -> InitialDistribution -> - StagedMockChain a -> - prop + StagedMockChain a -> + prop testSatisfiesFrom' :: ([(Either MockChainError (a, UtxoState), MockChainLog)] -> prop) -> InitialDistribution -> StagedMockChain a -> prop -testSatisfiesFrom' [(Either MockChainError (a, UtxoState), MockChainLog)] -> prop -predi InitialDistribution -i0 = [(Either MockChainError (a, UtxoState), MockChainLog)] -> prop -predi ([(Either MockChainError (a, UtxoState), MockChainLog)] -> prop) +testSatisfiesFrom' [(Either MockChainError (a, UtxoState), MockChainLog)] -> prop +predi InitialDistribution +i0 = [(Either MockChainError (a, UtxoState), MockChainLog)] -> prop +predi ([(Either MockChainError (a, UtxoState), MockChainLog)] -> prop) -> (StagedMockChain a -> [(Either MockChainError (a, UtxoState), MockChainLog)]) -> StagedMockChain a -> prop forall b c a. (b -> c) -> (a -> b) -> a -> c -. (forall (m :: * -> *). +. (forall (m :: * -> *). Monad m => MockChainT m a -> m (Either MockChainError (a, UtxoState))) -> StagedMockChain a @@ -737,12 +737,12 @@ InitialDistribution -> MockChainT m a -> m (Either MockChainError (a, UtxoState)) runMockChainTFrom InitialDistribution -i0) +i0) -- * 'TestResult' instances -- Catches a HUnit test failure, if the test fails. -assertionToMaybe :: HU.Assertion -> IO (Maybe HU.HUnitFailure) +assertionToMaybe :: HU.Assertion -> IO (Maybe HU.HUnitFailure) assertionToMaybe :: Assertion -> IO (Maybe HUnitFailure) assertionToMaybe = (IO (Maybe HUnitFailure) -> [Handler (Maybe HUnitFailure)] -> IO (Maybe HUnitFailure)) @@ -750,183 +750,183 @@ -> IO (Maybe HUnitFailure) -> IO (Maybe HUnitFailure) forall a b c. (a -> b -> c) -> b -> a -> c -flip IO (Maybe HUnitFailure) +flip IO (Maybe HUnitFailure) -> [Handler (Maybe HUnitFailure)] -> IO (Maybe HUnitFailure) forall a. IO a -> [Handler a] -> IO a -E.catches [(HUnitFailure -> IO (Maybe HUnitFailure)) +E.catches [(HUnitFailure -> IO (Maybe HUnitFailure)) -> Handler (Maybe HUnitFailure) forall a e. Exception e => (e -> IO a) -> Handler a -E.Handler ((HUnitFailure -> IO (Maybe HUnitFailure)) +E.Handler ((HUnitFailure -> IO (Maybe HUnitFailure)) -> Handler (Maybe HUnitFailure)) -> (HUnitFailure -> IO (Maybe HUnitFailure)) -> Handler (Maybe HUnitFailure) forall a b. (a -> b) -> a -> b -$ Maybe HUnitFailure -> IO (Maybe HUnitFailure) +$ Maybe HUnitFailure -> IO (Maybe HUnitFailure) forall (m :: * -> *) a. Monad m => a -> m a -return (Maybe HUnitFailure -> IO (Maybe HUnitFailure)) +return (Maybe HUnitFailure -> IO (Maybe HUnitFailure)) -> (HUnitFailure -> Maybe HUnitFailure) -> HUnitFailure -> IO (Maybe HUnitFailure) forall b c a. (b -> c) -> (a -> b) -> a -> c -. HUnitFailure -> Maybe HUnitFailure +. HUnitFailure -> Maybe HUnitFailure forall a. a -> Maybe a -Just] (IO (Maybe HUnitFailure) -> IO (Maybe HUnitFailure)) +Just] (IO (Maybe HUnitFailure) -> IO (Maybe HUnitFailure)) -> (Assertion -> IO (Maybe HUnitFailure)) -> Assertion -> IO (Maybe HUnitFailure) forall b c a. (b -> c) -> (a -> b) -> a -> c -. (Assertion -> IO (Maybe HUnitFailure) -> IO (Maybe HUnitFailure) +. (Assertion -> IO (Maybe HUnitFailure) -> IO (Maybe HUnitFailure) forall (m :: * -> *) a b. Monad m => m a -> m b -> m b ->> Maybe HUnitFailure -> IO (Maybe HUnitFailure) +>> Maybe HUnitFailure -> IO (Maybe HUnitFailure) forall (m :: * -> *) a. Monad m => a -> m a -return Maybe HUnitFailure +return Maybe HUnitFailure forall a. Maybe a -Nothing) +Nothing) -instance IsProp HU.Assertion where - testCounterexample :: String -> Assertion -> Assertion -testCounterexample String -msg = Assertion +instance IsProp HU.Assertion where + testCounterexample :: String -> Assertion -> Assertion +testCounterexample String +msg = Assertion -> (HUnitFailure -> Assertion) -> Maybe HUnitFailure -> Assertion forall b a. b -> (a -> b) -> Maybe a -> b -maybe Assertion +maybe Assertion forall prop. IsProp prop => prop testSuccess (HUnitFailure -> Assertion forall a e. Exception e => e -> a -E.throw (HUnitFailure -> Assertion) +E.throw (HUnitFailure -> Assertion) -> (HUnitFailure -> HUnitFailure) -> HUnitFailure -> Assertion forall b c a. (b -> c) -> (a -> b) -> a -> c -. HUnitFailure -> HUnitFailure -adjustMsg) (Maybe HUnitFailure -> Assertion) +. HUnitFailure -> HUnitFailure +adjustMsg) (Maybe HUnitFailure -> Assertion) -> (Assertion -> IO (Maybe HUnitFailure)) -> Assertion -> Assertion forall (m :: * -> *) b c a. Monad m => (b -> m c) -> (a -> m b) -> a -> m c -<=< Assertion -> IO (Maybe HUnitFailure) +<=< Assertion -> IO (Maybe HUnitFailure) assertionToMaybe where - joinMsg :: String -> String - joinMsg :: String -> String -joinMsg String -rest = String -msg String -> String -> String + joinMsg :: String -> String + joinMsg :: String -> String +joinMsg String +rest = String +msg String -> String -> String forall a. [a] -> [a] -> [a] -++ String +++ String ";\n" String -> String -> String forall a. [a] -> [a] -> [a] -++ String -rest +++ String +rest - adjustMsg :: HU.HUnitFailure -> HU.HUnitFailure - adjustMsg :: HUnitFailure -> HUnitFailure -adjustMsg (HU.HUnitFailure Maybe SrcLoc -loc String -txt) = + adjustMsg :: HU.HUnitFailure -> HU.HUnitFailure + adjustMsg :: HUnitFailure -> HUnitFailure +adjustMsg (HU.HUnitFailure Maybe SrcLoc +loc String +txt) = Maybe SrcLoc -> String -> HUnitFailure -HU.HUnitFailure Maybe SrcLoc -loc (String -> String -joinMsg String -txt) +HU.HUnitFailure Maybe SrcLoc +loc (String -> String +joinMsg String +txt) - testFailure :: Assertion -testFailure = String -> Assertion + testFailure :: Assertion +testFailure = String -> Assertion forall a. HasCallStack => String -> IO a -HU.assertFailure String +HU.assertFailure String "" - testFailureMsg :: String -> Assertion -testFailureMsg = String -> Assertion + testFailureMsg :: String -> Assertion +testFailureMsg = String -> Assertion forall a. HasCallStack => String -> IO a -HU.assertFailure +HU.assertFailure - testConjoin :: [Assertion] -> Assertion -testConjoin = [Assertion] -> Assertion + testConjoin :: [Assertion] -> Assertion +testConjoin = [Assertion] -> Assertion forall (t :: * -> *) (m :: * -> *) a. (Foldable t, Monad m) => t (m a) -> m () -sequence_ +sequence_ - testDisjoin :: [Assertion] -> Assertion -testDisjoin [] = Assertion + testDisjoin :: [Assertion] -> Assertion +testDisjoin [] = Assertion forall prop. IsProp prop => prop testFailure - testDisjoin (Assertion -x : [Assertion] -xs) = Assertion -> IO (Maybe HUnitFailure) + testDisjoin (Assertion +x : [Assertion] +xs) = Assertion -> IO (Maybe HUnitFailure) assertionToMaybe Assertion -x IO (Maybe HUnitFailure) +x IO (Maybe HUnitFailure) -> (Maybe HUnitFailure -> Assertion) -> Assertion forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b ->>= Assertion +>>= Assertion -> (HUnitFailure -> Assertion) -> Maybe HUnitFailure -> Assertion forall b a. b -> (a -> b) -> Maybe a -> b -maybe ([Assertion] -> Assertion +maybe ([Assertion] -> Assertion forall prop. IsProp prop => [prop] -> prop testDisjoin [Assertion] -xs) HUnitFailure -> Assertion +xs) HUnitFailure -> Assertion forall a e. Exception e => e -> a -E.throw +E.throw - testSuccess :: Assertion -testSuccess = () -> Assertion + testSuccess :: Assertion +testSuccess = () -> Assertion forall (m :: * -> *) a. Monad m => a -> m a -return () +return () -instance IsProp QC.Property where - testCounterexample :: String -> Property -> Property -testCounterexample = String -> Property -> Property +instance IsProp QC.Property where + testCounterexample :: String -> Property -> Property +testCounterexample = String -> Property -> Property forall prop. Testable prop => String -> prop -> Property -QC.counterexample - testFailure :: Property -testFailure = Bool -> Property +QC.counterexample + testFailure :: Property +testFailure = Bool -> Property forall prop. Testable prop => prop -> Property -QC.property Bool -False - testSuccess :: Property -testSuccess = Bool -> Property +QC.property Bool +False + testSuccess :: Property +testSuccess = Bool -> Property forall prop. Testable prop => prop -> Property -QC.property Bool -True - testConjoin :: [Property] -> Property -testConjoin = [Property] -> Property +QC.property Bool +True + testConjoin :: [Property] -> Property +testConjoin = [Property] -> Property forall prop. Testable prop => [prop] -> Property -QC.conjoin - testDisjoin :: [Property] -> Property -testDisjoin = [Property] -> Property +QC.conjoin + testDisjoin :: [Property] -> Property +testDisjoin = [Property] -> Property forall prop. Testable prop => [prop] -> Property -QC.disjoin +QC.disjoin -- | Here we provide our own universsal quantifier instead of 'QC.forAll', so we can monomorphize -- it to returning a 'QC.Property' -forAll :: (Show a) => QC.Gen a -> (a -> QC.Property) -> QC.Property +forAll :: (Show a) => QC.Gen a -> (a -> QC.Property) -> QC.Property forAll :: Gen a -> (a -> Property) -> Property forAll = Gen a -> (a -> Property) -> Property forall a prop. (Show a, Testable prop) => Gen a -> (a -> prop) -> Property -QC.forAll +QC.forAll -- TODO: Discuss this instance; its here to enable us to easily -- run things in a repl but I'm not sure whether to ignore the counterexample -- messages or not. -instance IsProp Bool where - testCounterexample :: String -> Bool -> Bool -testCounterexample String -msg Bool -False = String -> Bool -> Bool +instance IsProp Bool where + testCounterexample :: String -> Bool -> Bool +testCounterexample String +msg Bool +False = String -> Bool -> Bool forall a. String -> a -> a -trace String -msg Bool -False +trace String +msg Bool +False testCounterexample String _ Bool -True = Bool -True - testConjoin :: [Bool] -> Bool -testConjoin = [Bool] -> Bool +True = Bool +True + testConjoin :: [Bool] -> Bool +testConjoin = [Bool] -> Bool forall (t :: * -> *). Foldable t => t Bool -> Bool -and - testDisjoin :: [Bool] -> Bool -testDisjoin = [Bool] -> Bool +and + testDisjoin :: [Bool] -> Bool +testDisjoin = [Bool] -> Bool forall (t :: * -> *). Foldable t => t Bool -> Bool -or +or \ No newline at end of file diff --git a/src/Cooked.MockChain.UtxoSearch.html b/src/Cooked.MockChain.UtxoSearch.html index d39a128c5..9c5ef5a98 100644 --- a/src/Cooked.MockChain.UtxoSearch.html +++ b/src/Cooked.MockChain.UtxoSearch.html @@ -20,31 +20,31 @@ ) where -import Control.Monad +import Control.Monad import Cooked.MockChain.BlockChain -import qualified Ledger.Tx as Ledger -import ListT (ListT (..)) -import qualified ListT -import Optics.Core -import qualified Plutus.Script.Utils.Value as Pl2 -import qualified Plutus.V2.Ledger.Api as Pl2 +import qualified Ledger.Tx as Ledger +import ListT (ListT (..)) +import qualified ListT +import Optics.Core +import qualified Plutus.Script.Utils.Value as Pl2 +import qualified Plutus.V2.Ledger.Api as Pl2 -- * The type of UTxO searches -- | If a UTxO is a 'TxOutRef' with some additional information, this type -- captures a "stream" of UTxOs. -type UtxoSearch m a = ListT m (Pl2.TxOutRef, a) +type UtxoSearch m a = ListT m (Pl2.TxOutRef, a) -- | Given a UTxO search, we can run it to obtain a list of UTxOs. -runUtxoSearch :: Monad m => UtxoSearch m a -> m [(Pl2.TxOutRef, a)] +runUtxoSearch :: (Monad m) => UtxoSearch m a -> m [(Pl2.TxOutRef, a)] runUtxoSearch :: UtxoSearch m a -> m [(TxOutRef, a)] runUtxoSearch = UtxoSearch m a -> m [(TxOutRef, a)] forall (m :: * -> *) a. Monad m => ListT m a -> m [a] -ListT.toList +ListT.toList -- | Search all currently known 'TxOutRef's together with their corresponding -- 'TxInfo'-'TxOut'. -allUtxosSearch :: MonadBlockChain m => UtxoSearch m Pl2.TxOut +allUtxosSearch :: (MonadBlockChain m) => UtxoSearch m Pl2.TxOut allUtxosSearch :: UtxoSearch m TxOut allUtxosSearch = ListT m [(TxOutRef, TxOut)] forall (m :: * -> *). @@ -54,15 +54,15 @@ -> ([(TxOutRef, TxOut)] -> UtxoSearch m TxOut) -> UtxoSearch m TxOut forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b ->>= [(TxOutRef, TxOut)] -> UtxoSearch m TxOut +>>= [(TxOutRef, TxOut)] -> UtxoSearch m TxOut forall (m :: * -> *) (f :: * -> *) a. (Monad m, Foldable f) => f a -> ListT m a -ListT.fromFoldable +ListT.fromFoldable -- | Like 'allUtxosSearch', but returns a Ledger-level representation of the -- transaction outputs, which might contain more information. -allUtxosLedgerSearch :: MonadBlockChain m => UtxoSearch m Ledger.TxOut +allUtxosLedgerSearch :: (MonadBlockChain m) => UtxoSearch m Ledger.TxOut allUtxosLedgerSearch :: UtxoSearch m TxOut allUtxosLedgerSearch = ListT m [(TxOutRef, TxOut)] forall (m :: * -> *). @@ -72,15 +72,15 @@ -> ([(TxOutRef, TxOut)] -> UtxoSearch m TxOut) -> UtxoSearch m TxOut forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b ->>= [(TxOutRef, TxOut)] -> UtxoSearch m TxOut +>>= [(TxOutRef, TxOut)] -> UtxoSearch m TxOut forall (m :: * -> *) (f :: * -> *) a. (Monad m, Foldable f) => f a -> ListT m a -ListT.fromFoldable +ListT.fromFoldable -- | Search all 'TxOutRef's at a certain address, together with their -- 'TxInfo'-'TxOut'. -utxosAtSearch :: MonadBlockChainBalancing m => Pl2.Address -> UtxoSearch m Pl2.TxOut +utxosAtSearch :: (MonadBlockChainBalancing m) => Pl2.Address -> UtxoSearch m Pl2.TxOut utxosAtSearch :: Address -> UtxoSearch m TxOut utxosAtSearch = Address -> ListT m [(TxOutRef, TxOut)] forall (m :: * -> *). @@ -93,15 +93,15 @@ forall (m :: * -> *) a b c. Monad m => (a -> m b) -> (b -> m c) -> a -> m c ->=> [(TxOutRef, TxOut)] -> UtxoSearch m TxOut +>=> [(TxOutRef, TxOut)] -> UtxoSearch m TxOut forall (m :: * -> *) (f :: * -> *) a. (Monad m, Foldable f) => f a -> ListT m a -ListT.fromFoldable +ListT.fromFoldable -- | Like 'utxosAtSearch', but returns a Ledger-level representation of the -- transaction outputs, which might contain more information. -utxosAtLedgerSearch :: MonadBlockChainBalancing m => Pl2.Address -> UtxoSearch m Ledger.TxOut +utxosAtLedgerSearch :: (MonadBlockChainBalancing m) => Pl2.Address -> UtxoSearch m Ledger.TxOut utxosAtLedgerSearch :: Address -> UtxoSearch m TxOut utxosAtLedgerSearch = Address -> ListT m [(TxOutRef, TxOut)] forall (m :: * -> *). @@ -114,51 +114,51 @@ forall (m :: * -> *) a b c. Monad m => (a -> m b) -> (b -> m c) -> a -> m c ->=> [(TxOutRef, TxOut)] -> UtxoSearch m TxOut +>=> [(TxOutRef, TxOut)] -> UtxoSearch m TxOut forall (m :: * -> *) (f :: * -> *) a. (Monad m, Foldable f) => f a -> ListT m a -ListT.fromFoldable +ListT.fromFoldable -- | Search all 'TxOutRef's of a transaction, together with their -- 'TxInfo'-'TxOut'. -utxosFromCardanoTxSearch :: Monad m => Ledger.CardanoTx -> UtxoSearch m Pl2.TxOut +utxosFromCardanoTxSearch :: (Monad m) => Ledger.CardanoTx -> UtxoSearch m Pl2.TxOut utxosFromCardanoTxSearch :: CardanoTx -> UtxoSearch m TxOut utxosFromCardanoTxSearch = [(TxOutRef, TxOut)] -> UtxoSearch m TxOut forall (m :: * -> *) (f :: * -> *) a. (Monad m, Foldable f) => f a -> ListT m a -ListT.fromFoldable ([(TxOutRef, TxOut)] -> UtxoSearch m TxOut) +ListT.fromFoldable ([(TxOutRef, TxOut)] -> UtxoSearch m TxOut) -> (CardanoTx -> [(TxOutRef, TxOut)]) -> CardanoTx -> UtxoSearch m TxOut forall b c a. (b -> c) -> (a -> b) -> a -> c -. CardanoTx -> [(TxOutRef, TxOut)] +. CardanoTx -> [(TxOutRef, TxOut)] utxosFromCardanoTx -- | Search all 'TxInfo'-'TxOut's corresponding to given the list of -- 'TxOutRef's. Any 'TxOutRef' that doesn't correspond to a known output will be -- filtered out. -txOutByRefSearch :: MonadBlockChainBalancing m => [Pl2.TxOutRef] -> UtxoSearch m Pl2.TxOut +txOutByRefSearch :: (MonadBlockChainBalancing m) => [Pl2.TxOutRef] -> UtxoSearch m Pl2.TxOut txOutByRefSearch :: [TxOutRef] -> UtxoSearch m TxOut -txOutByRefSearch [TxOutRef] -orefs = +txOutByRefSearch [TxOutRef] +orefs = (TxOutRef -> m (TxOutRef, TxOutRef)) -> ListT m TxOutRef -> ListT m (TxOutRef, TxOutRef) forall (m :: * -> *) a b. Monad m => (a -> m b) -> ListT m a -> ListT m b -ListT.traverse (\TxOutRef -o -> (TxOutRef, TxOutRef) -> m (TxOutRef, TxOutRef) +ListT.traverse (\TxOutRef +o -> (TxOutRef, TxOutRef) -> m (TxOutRef, TxOutRef) forall (m :: * -> *) a. Monad m => a -> m a -return (TxOutRef -o, TxOutRef -o)) ([TxOutRef] -> ListT m TxOutRef +return (TxOutRef +o, TxOutRef +o)) ([TxOutRef] -> ListT m TxOutRef forall (m :: * -> *) (f :: * -> *) a. (Monad m, Foldable f) => f a -> ListT m a -ListT.fromFoldable [TxOutRef] -orefs) +ListT.fromFoldable [TxOutRef] +orefs) ListT m (TxOutRef, TxOutRef) -> (TxOutRef -> m (Maybe TxOut)) -> UtxoSearch m TxOut forall (m :: * -> *) a b. @@ -174,200 +174,200 @@ -- | Transform a 'UtxoSearch' by applying a possibly failing monadic "lookup" -- on every output. -filterWith :: Monad m => UtxoSearch m a -> (a -> m (Maybe b)) -> UtxoSearch m b +filterWith :: (Monad m) => UtxoSearch m a -> (a -> m (Maybe b)) -> UtxoSearch m b filterWith :: UtxoSearch m a -> (a -> m (Maybe b)) -> UtxoSearch m b -filterWith (ListT m (Maybe ((TxOutRef, a), UtxoSearch m a)) -as) a -> m (Maybe b) -f = +filterWith (ListT m (Maybe ((TxOutRef, a), UtxoSearch m a)) +as) a -> m (Maybe b) +f = m (Maybe ((TxOutRef, b), UtxoSearch m b)) -> UtxoSearch m b forall (m :: * -> *) a. m (Maybe (a, ListT m a)) -> ListT m a -ListT (m (Maybe ((TxOutRef, b), UtxoSearch m b)) -> UtxoSearch m b) +ListT (m (Maybe ((TxOutRef, b), UtxoSearch m b)) -> UtxoSearch m b) -> m (Maybe ((TxOutRef, b), UtxoSearch m b)) -> UtxoSearch m b forall a b. (a -> b) -> a -> b -$ +$ m (Maybe ((TxOutRef, a), UtxoSearch m a)) -as m (Maybe ((TxOutRef, a), UtxoSearch m a)) +as m (Maybe ((TxOutRef, a), UtxoSearch m a)) -> (Maybe ((TxOutRef, a), UtxoSearch m a) -> m (Maybe ((TxOutRef, b), UtxoSearch m b))) -> m (Maybe ((TxOutRef, b), UtxoSearch m b)) forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b ->>= \case +>>= \case Maybe ((TxOutRef, a), UtxoSearch m a) -Nothing -> Maybe ((TxOutRef, b), UtxoSearch m b) +Nothing -> Maybe ((TxOutRef, b), UtxoSearch m b) -> m (Maybe ((TxOutRef, b), UtxoSearch m b)) forall (m :: * -> *) a. Monad m => a -> m a -return Maybe ((TxOutRef, b), UtxoSearch m b) +return Maybe ((TxOutRef, b), UtxoSearch m b) forall a. Maybe a -Nothing - Just ((TxOutRef -oref, a -a), UtxoSearch m a -rest) -> - let filteredRest :: UtxoSearch m b -filteredRest@(ListT m (Maybe ((TxOutRef, b), UtxoSearch m b)) -bs) = UtxoSearch m a -> (a -> m (Maybe b)) -> UtxoSearch m b +Nothing + Just ((TxOutRef +oref, a +a), UtxoSearch m a +rest) -> + let filteredRest :: UtxoSearch m b +filteredRest@(ListT m (Maybe ((TxOutRef, b), UtxoSearch m b)) +bs) = UtxoSearch m a -> (a -> m (Maybe b)) -> UtxoSearch m b forall (m :: * -> *) a b. Monad m => UtxoSearch m a -> (a -> m (Maybe b)) -> UtxoSearch m b filterWith UtxoSearch m a -rest a -> m (Maybe b) -f +rest a -> m (Maybe b) +f in a -> m (Maybe b) -f a -a m (Maybe b) +f a +a m (Maybe b) -> (Maybe b -> m (Maybe ((TxOutRef, b), UtxoSearch m b))) -> m (Maybe ((TxOutRef, b), UtxoSearch m b)) forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b ->>= \case +>>= \case Maybe b -Nothing -> m (Maybe ((TxOutRef, b), UtxoSearch m b)) -bs - Just b -b -> Maybe ((TxOutRef, b), UtxoSearch m b) +Nothing -> m (Maybe ((TxOutRef, b), UtxoSearch m b)) +bs + Just b +b -> Maybe ((TxOutRef, b), UtxoSearch m b) -> m (Maybe ((TxOutRef, b), UtxoSearch m b)) forall (m :: * -> *) a. Monad m => a -> m a -return (Maybe ((TxOutRef, b), UtxoSearch m b) +return (Maybe ((TxOutRef, b), UtxoSearch m b) -> m (Maybe ((TxOutRef, b), UtxoSearch m b))) -> Maybe ((TxOutRef, b), UtxoSearch m b) -> m (Maybe ((TxOutRef, b), UtxoSearch m b)) forall a b. (a -> b) -> a -> b -$ ((TxOutRef, b), UtxoSearch m b) +$ ((TxOutRef, b), UtxoSearch m b) -> Maybe ((TxOutRef, b), UtxoSearch m b) forall a. a -> Maybe a -Just ((TxOutRef -oref, b -b), UtxoSearch m b -filteredRest) +Just ((TxOutRef +oref, b +b), UtxoSearch m b +filteredRest) -filterWithPure :: Monad m => UtxoSearch m a -> (a -> Maybe b) -> UtxoSearch m b +filterWithPure :: (Monad m) => UtxoSearch m a -> (a -> Maybe b) -> UtxoSearch m b filterWithPure :: UtxoSearch m a -> (a -> Maybe b) -> UtxoSearch m b -filterWithPure UtxoSearch m a -as a -> Maybe b -f = UtxoSearch m a -> (a -> m (Maybe b)) -> UtxoSearch m b +filterWithPure UtxoSearch m a +as a -> Maybe b +f = UtxoSearch m a -> (a -> m (Maybe b)) -> UtxoSearch m b forall (m :: * -> *) a b. Monad m => UtxoSearch m a -> (a -> m (Maybe b)) -> UtxoSearch m b filterWith UtxoSearch m a -as (Maybe b -> m (Maybe b) +as (Maybe b -> m (Maybe b) forall (m :: * -> *) a. Monad m => a -> m a -return (Maybe b -> m (Maybe b)) -> (a -> Maybe b) -> a -> m (Maybe b) +return (Maybe b -> m (Maybe b)) -> (a -> Maybe b) -> a -> m (Maybe b) forall b c a. (b -> c) -> (a -> b) -> a -> c -. a -> Maybe b -f) +. a -> Maybe b +f) -filterWithOptic :: (Is k An_AffineFold, Monad m) => UtxoSearch m a -> Optic' k is a b -> UtxoSearch m b +filterWithOptic :: (Is k An_AffineFold, Monad m) => UtxoSearch m a -> Optic' k is a b -> UtxoSearch m b filterWithOptic :: UtxoSearch m a -> Optic' k is a b -> UtxoSearch m b -filterWithOptic UtxoSearch m a -as Optic' k is a b -optic = UtxoSearch m a -> (a -> Maybe b) -> UtxoSearch m b +filterWithOptic UtxoSearch m a +as Optic' k is a b +optic = UtxoSearch m a -> (a -> Maybe b) -> UtxoSearch m b forall (m :: * -> *) a b. Monad m => UtxoSearch m a -> (a -> Maybe b) -> UtxoSearch m b filterWithPure UtxoSearch m a -as (a -> Optic' k is a b -> Maybe b +as (a -> Optic' k is a b -> Maybe b forall k s (is :: IxList) a. Is k An_AffineFold => s -> Optic' k is s a -> Maybe a -^? Optic' k is a b -optic) +^? Optic' k is a b +optic) -filterWithPred :: Monad m => UtxoSearch m a -> (a -> Bool) -> UtxoSearch m a +filterWithPred :: (Monad m) => UtxoSearch m a -> (a -> Bool) -> UtxoSearch m a filterWithPred :: UtxoSearch m a -> (a -> Bool) -> UtxoSearch m a -filterWithPred UtxoSearch m a -as a -> Bool -f = UtxoSearch m a -> (a -> Maybe a) -> UtxoSearch m a +filterWithPred UtxoSearch m a +as a -> Bool +f = UtxoSearch m a -> (a -> Maybe a) -> UtxoSearch m a forall (m :: * -> *) a b. Monad m => UtxoSearch m a -> (a -> Maybe b) -> UtxoSearch m b filterWithPure UtxoSearch m a -as ((a -> Maybe a) -> UtxoSearch m a) +as ((a -> Maybe a) -> UtxoSearch m a) -> (a -> Maybe a) -> UtxoSearch m a forall a b. (a -> b) -> a -> b -$ \a -a -> if a -> Bool -f a -a then a -> Maybe a +$ \a +a -> if a -> Bool +f a +a then a -> Maybe a forall a. a -> Maybe a -Just a -a else Maybe a +Just a +a else Maybe a forall a. Maybe a -Nothing +Nothing -filterWithValuePred :: Monad m => UtxoSearch m Pl2.TxOut -> (Pl2.Value -> Bool) -> UtxoSearch m Pl2.Value +filterWithValuePred :: (Monad m) => UtxoSearch m Pl2.TxOut -> (Pl2.Value -> Bool) -> UtxoSearch m Pl2.Value filterWithValuePred :: UtxoSearch m TxOut -> (Value -> Bool) -> UtxoSearch m Value -filterWithValuePred UtxoSearch m TxOut -as Value -> Bool -p = UtxoSearch m TxOut -> (TxOut -> Maybe Value) -> UtxoSearch m Value +filterWithValuePred UtxoSearch m TxOut +as Value -> Bool +p = UtxoSearch m TxOut -> (TxOut -> Maybe Value) -> UtxoSearch m Value forall (m :: * -> *) a b. Monad m => UtxoSearch m a -> (a -> Maybe b) -> UtxoSearch m b filterWithPure UtxoSearch m TxOut -as ((TxOut -> Maybe Value) -> UtxoSearch m Value) +as ((TxOut -> Maybe Value) -> UtxoSearch m Value) -> (TxOut -> Maybe Value) -> UtxoSearch m Value forall a b. (a -> b) -> a -> b -$ - \TxOut -txOut -> let val :: Value -val = TxOut -> Value -Pl2.txOutValue TxOut -txOut in if Value -> Bool -p Value -val then Value -> Maybe Value +$ + \TxOut +txOut -> let val :: Value +val = TxOut -> Value +Pl2.txOutValue TxOut +txOut in if Value -> Bool +p Value +val then Value -> Maybe Value forall a. a -> Maybe a -Just Value -val else Maybe Value +Just Value +val else Maybe Value forall a. Maybe a -Nothing +Nothing -filterWithOnlyAda :: Monad m => UtxoSearch m Pl2.TxOut -> UtxoSearch m Pl2.Value +filterWithOnlyAda :: (Monad m) => UtxoSearch m Pl2.TxOut -> UtxoSearch m Pl2.Value filterWithOnlyAda :: UtxoSearch m TxOut -> UtxoSearch m Value -filterWithOnlyAda UtxoSearch m TxOut -as = UtxoSearch m TxOut -> (Value -> Bool) -> UtxoSearch m Value +filterWithOnlyAda UtxoSearch m TxOut +as = UtxoSearch m TxOut -> (Value -> Bool) -> UtxoSearch m Value forall (m :: * -> *). Monad m => UtxoSearch m TxOut -> (Value -> Bool) -> UtxoSearch m Value filterWithValuePred UtxoSearch m TxOut -as ((Value -> Bool) -> UtxoSearch m Value) +as ((Value -> Bool) -> UtxoSearch m Value) -> (Value -> Bool) -> UtxoSearch m Value forall a b. (a -> b) -> a -> b -$ (Int +$ (Int 1 Int -> Int -> Bool forall a. Eq a => a -> a -> Bool -==) (Int -> Bool) -> (Value -> Int) -> Value -> Bool +==) (Int -> Bool) -> (Value -> Int) -> Value -> Bool forall b c a. (b -> c) -> (a -> b) -> a -> c -. [(CurrencySymbol, TokenName, Integer)] -> Int +. [(CurrencySymbol, TokenName, Integer)] -> Int forall (t :: * -> *) a. Foldable t => t a -> Int -length ([(CurrencySymbol, TokenName, Integer)] -> Int) +length ([(CurrencySymbol, TokenName, Integer)] -> Int) -> (Value -> [(CurrencySymbol, TokenName, Integer)]) -> Value -> Int forall b c a. (b -> c) -> (a -> b) -> a -> c -. Value -> [(CurrencySymbol, TokenName, Integer)] -Pl2.flattenValue +. Value -> [(CurrencySymbol, TokenName, Integer)] +Pl2.flattenValue -filterWithNotOnlyAda :: Monad m => UtxoSearch m Pl2.TxOut -> UtxoSearch m Pl2.Value +filterWithNotOnlyAda :: (Monad m) => UtxoSearch m Pl2.TxOut -> UtxoSearch m Pl2.Value filterWithNotOnlyAda :: UtxoSearch m TxOut -> UtxoSearch m Value -filterWithNotOnlyAda UtxoSearch m TxOut -as = UtxoSearch m TxOut -> (Value -> Bool) -> UtxoSearch m Value +filterWithNotOnlyAda UtxoSearch m TxOut +as = UtxoSearch m TxOut -> (Value -> Bool) -> UtxoSearch m Value forall (m :: * -> *). Monad m => UtxoSearch m TxOut -> (Value -> Bool) -> UtxoSearch m Value filterWithValuePred UtxoSearch m TxOut -as ((Value -> Bool) -> UtxoSearch m Value) +as ((Value -> Bool) -> UtxoSearch m Value) -> (Value -> Bool) -> UtxoSearch m Value forall a b. (a -> b) -> a -> b -$ (Int +$ (Int 1 Int -> Int -> Bool forall a. Ord a => a -> a -> Bool -<) (Int -> Bool) -> (Value -> Int) -> Value -> Bool +<) (Int -> Bool) -> (Value -> Int) -> Value -> Bool forall b c a. (b -> c) -> (a -> b) -> a -> c -. [(CurrencySymbol, TokenName, Integer)] -> Int +. [(CurrencySymbol, TokenName, Integer)] -> Int forall (t :: * -> *) a. Foldable t => t a -> Int -length ([(CurrencySymbol, TokenName, Integer)] -> Int) +length ([(CurrencySymbol, TokenName, Integer)] -> Int) -> (Value -> [(CurrencySymbol, TokenName, Integer)]) -> Value -> Int forall b c a. (b -> c) -> (a -> b) -> a -> c -. Value -> [(CurrencySymbol, TokenName, Integer)] -Pl2.flattenValue +. Value -> [(CurrencySymbol, TokenName, Integer)] +Pl2.flattenValue \ No newline at end of file diff --git a/src/Cooked.MockChain.UtxoState.html b/src/Cooked.MockChain.UtxoState.html index b8e0a32c4..450284c91 100644 --- a/src/Cooked.MockChain.UtxoState.html +++ b/src/Cooked.MockChain.UtxoState.html @@ -7,19 +7,19 @@ where import Cooked.Skeleton (TxSkelOutDatum) -import Data.Function (on) -import qualified Data.List as List -import Data.Map.Strict (Map) -import qualified Data.Map.Strict as Map -import qualified Ledger as Pl hiding (Value) -import qualified Plutus.Script.Utils.Value as Pl -import qualified Plutus.V2.Ledger.Api as PV2 +import Data.Function (on) +import qualified Data.List as List +import Data.Map.Strict (Map) +import qualified Data.Map.Strict as Map +import qualified Ledger as Pl hiding (Value) +import qualified Plutus.Script.Utils.Value as Pl +import qualified Plutus.V2.Ledger.Api as PV2 -- | A description of who owns what in a blockchain. Owners are addresses -- and they each own a 'UtxoPayloadSet'. newtype UtxoState = UtxoState {UtxoState -> Map Address UtxoPayloadSet -utxoState :: Map Pl.Address UtxoPayloadSet} - deriving (UtxoState -> UtxoState -> Bool +utxoState :: Map Pl.Address UtxoPayloadSet} + deriving (UtxoState -> UtxoState -> Bool (UtxoState -> UtxoState -> Bool) -> (UtxoState -> UtxoState -> Bool) -> Eq UtxoState forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a @@ -27,43 +27,43 @@ $c/= :: UtxoState -> UtxoState -> Bool == :: UtxoState -> UtxoState -> Bool $c== :: UtxoState -> UtxoState -> Bool -Eq) +Eq) -- | Total value accessible to what's pointed by the address. -holdsInState :: PV2.Address -> UtxoState -> PV2.Value +holdsInState :: PV2.Address -> UtxoState -> PV2.Value holdsInState :: Address -> UtxoState -> Value -holdsInState Address -address (UtxoState Map Address UtxoPayloadSet -m) = +holdsInState Address +address (UtxoState Map Address UtxoPayloadSet +m) = Value -> (UtxoPayloadSet -> Value) -> Maybe UtxoPayloadSet -> Value forall b a. b -> (a -> b) -> Maybe a -> b -maybe Value +maybe Value forall a. Monoid a => a -mempty UtxoPayloadSet -> Value +mempty UtxoPayloadSet -> Value utxoPayloadSetTotal (Address -> Map Address UtxoPayloadSet -> Maybe UtxoPayloadSet forall k a. Ord k => k -> Map k a -> Maybe a -Map.lookup Address -address Map Address UtxoPayloadSet -m) +Map.lookup Address +address Map Address UtxoPayloadSet +m) -instance Semigroup UtxoState where - (UtxoState Map Address UtxoPayloadSet -a) <> :: UtxoState -> UtxoState -> UtxoState -<> (UtxoState Map Address UtxoPayloadSet -b) = Map Address UtxoPayloadSet -> UtxoState +instance Semigroup UtxoState where + (UtxoState Map Address UtxoPayloadSet +a) <> :: UtxoState -> UtxoState -> UtxoState +<> (UtxoState Map Address UtxoPayloadSet +b) = Map Address UtxoPayloadSet -> UtxoState UtxoState (Map Address UtxoPayloadSet -> UtxoState) -> Map Address UtxoPayloadSet -> UtxoState forall a b. (a -> b) -> a -> b -$ (UtxoPayloadSet -> UtxoPayloadSet -> UtxoPayloadSet) +$ (UtxoPayloadSet -> UtxoPayloadSet -> UtxoPayloadSet) -> Map Address UtxoPayloadSet -> Map Address UtxoPayloadSet -> Map Address UtxoPayloadSet forall k a. Ord k => (a -> a -> a) -> Map k a -> Map k a -> Map k a -Map.unionWith UtxoPayloadSet -> UtxoPayloadSet -> UtxoPayloadSet +Map.unionWith UtxoPayloadSet -> UtxoPayloadSet -> UtxoPayloadSet forall a. Semigroup a => a -> a -> a -(<>) Map Address UtxoPayloadSet -a Map Address UtxoPayloadSet -b +(<>) Map Address UtxoPayloadSet +a Map Address UtxoPayloadSet +b -- | Represents a /set/ of payloads. newtype UtxoPayloadSet = UtxoPayloadSet @@ -73,7 +73,7 @@ -- and because it is possible that we want to distinguish between utxo states -- that have additional utxos, even if these could have been merged together. } - deriving (Int -> UtxoPayloadSet -> ShowS + deriving (Int -> UtxoPayloadSet -> ShowS [UtxoPayloadSet] -> ShowS UtxoPayloadSet -> String (Int -> UtxoPayloadSet -> ShowS) @@ -88,20 +88,20 @@ $cshow :: UtxoPayloadSet -> String showsPrec :: Int -> UtxoPayloadSet -> ShowS $cshowsPrec :: Int -> UtxoPayloadSet -> ShowS -Show) +Show) -- | A convenient wrapping of the interesting information of a UTxO. data UtxoPayload = UtxoPayload { UtxoPayload -> TxOutRef -utxoPayloadTxOutRef :: Pl.TxOutRef, +utxoPayloadTxOutRef :: Pl.TxOutRef, UtxoPayload -> Value -utxoPayloadValue :: PV2.Value, +utxoPayloadValue :: PV2.Value, UtxoPayload -> TxSkelOutDatum utxoPayloadSkelOutDatum :: TxSkelOutDatum, UtxoPayload -> Maybe ScriptHash -utxoPayloadReferenceScript :: Maybe Pl.ScriptHash +utxoPayloadReferenceScript :: Maybe Pl.ScriptHash } - deriving (UtxoPayload -> UtxoPayload -> Bool + deriving (UtxoPayload -> UtxoPayload -> Bool (UtxoPayload -> UtxoPayload -> Bool) -> (UtxoPayload -> UtxoPayload -> Bool) -> Eq UtxoPayload forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a @@ -109,7 +109,7 @@ $c/= :: UtxoPayload -> UtxoPayload -> Bool == :: UtxoPayload -> UtxoPayload -> Bool $c== :: UtxoPayload -> UtxoPayload -> Bool -Eq, Int -> UtxoPayload -> ShowS +Eq, Int -> UtxoPayload -> ShowS [UtxoPayload] -> ShowS UtxoPayload -> String (Int -> UtxoPayload -> ShowS) @@ -124,42 +124,42 @@ $cshow :: UtxoPayload -> String showsPrec :: Int -> UtxoPayload -> ShowS $cshowsPrec :: Int -> UtxoPayload -> ShowS -Show) +Show) -instance Eq UtxoPayloadSet where - (UtxoPayloadSet [UtxoPayload] -xs) == :: UtxoPayloadSet -> UtxoPayloadSet -> Bool -== (UtxoPayloadSet [UtxoPayload] -ys) = [UtxoPayload] -xs' [UtxoPayload] -> [UtxoPayload] -> Bool +instance Eq UtxoPayloadSet where + (UtxoPayloadSet [UtxoPayload] +xs) == :: UtxoPayloadSet -> UtxoPayloadSet -> Bool +== (UtxoPayloadSet [UtxoPayload] +ys) = [UtxoPayload] +xs' [UtxoPayload] -> [UtxoPayload] -> Bool forall a. Eq a => a -> a -> Bool -== [UtxoPayload] -ys' +== [UtxoPayload] +ys' where - k :: UtxoPayload + k :: UtxoPayload -> (TxOutRef, [(CurrencySymbol, TokenName, Integer)], TxSkelOutDatum, Maybe ScriptHash) -k (UtxoPayload TxOutRef -ref Value -val TxSkelOutDatum -dat Maybe ScriptHash -rs) = (TxOutRef -ref, Value -> [(CurrencySymbol, TokenName, Integer)] -Pl.flattenValue Value -val, TxSkelOutDatum -dat, Maybe ScriptHash -rs) - xs' :: [UtxoPayload] -xs' = (UtxoPayload -> UtxoPayload -> Ordering) +k (UtxoPayload TxOutRef +ref Value +val TxSkelOutDatum +dat Maybe ScriptHash +rs) = (TxOutRef +ref, Value -> [(CurrencySymbol, TokenName, Integer)] +Pl.flattenValue Value +val, TxSkelOutDatum +dat, Maybe ScriptHash +rs) + xs' :: [UtxoPayload] +xs' = (UtxoPayload -> UtxoPayload -> Ordering) -> [UtxoPayload] -> [UtxoPayload] forall a. (a -> a -> Ordering) -> [a] -> [a] -List.sortBy ((TxOutRef, [(CurrencySymbol, TokenName, Integer)], TxSkelOutDatum, +List.sortBy ((TxOutRef, [(CurrencySymbol, TokenName, Integer)], TxSkelOutDatum, Maybe ScriptHash) -> (TxOutRef, [(CurrencySymbol, TokenName, Integer)], TxSkelOutDatum, Maybe ScriptHash) -> Ordering forall a. Ord a => a -> a -> Ordering -compare ((TxOutRef, [(CurrencySymbol, TokenName, Integer)], TxSkelOutDatum, +compare ((TxOutRef, [(CurrencySymbol, TokenName, Integer)], TxSkelOutDatum, Maybe ScriptHash) -> (TxOutRef, [(CurrencySymbol, TokenName, Integer)], TxSkelOutDatum, Maybe ScriptHash) @@ -171,22 +171,22 @@ -> UtxoPayload -> Ordering forall b c a. (b -> b -> c) -> (a -> b) -> a -> a -> c -`on` UtxoPayload +`on` UtxoPayload -> (TxOutRef, [(CurrencySymbol, TokenName, Integer)], TxSkelOutDatum, Maybe ScriptHash) -k) [UtxoPayload] -xs - ys' :: [UtxoPayload] -ys' = (UtxoPayload -> UtxoPayload -> Ordering) +k) [UtxoPayload] +xs + ys' :: [UtxoPayload] +ys' = (UtxoPayload -> UtxoPayload -> Ordering) -> [UtxoPayload] -> [UtxoPayload] forall a. (a -> a -> Ordering) -> [a] -> [a] -List.sortBy ((TxOutRef, [(CurrencySymbol, TokenName, Integer)], TxSkelOutDatum, +List.sortBy ((TxOutRef, [(CurrencySymbol, TokenName, Integer)], TxSkelOutDatum, Maybe ScriptHash) -> (TxOutRef, [(CurrencySymbol, TokenName, Integer)], TxSkelOutDatum, Maybe ScriptHash) -> Ordering forall a. Ord a => a -> a -> Ordering -compare ((TxOutRef, [(CurrencySymbol, TokenName, Integer)], TxSkelOutDatum, +compare ((TxOutRef, [(CurrencySymbol, TokenName, Integer)], TxSkelOutDatum, Maybe ScriptHash) -> (TxOutRef, [(CurrencySymbol, TokenName, Integer)], TxSkelOutDatum, Maybe ScriptHash) @@ -198,45 +198,45 @@ -> UtxoPayload -> Ordering forall b c a. (b -> b -> c) -> (a -> b) -> a -> a -> c -`on` UtxoPayload +`on` UtxoPayload -> (TxOutRef, [(CurrencySymbol, TokenName, Integer)], TxSkelOutDatum, Maybe ScriptHash) -k) [UtxoPayload] -ys +k) [UtxoPayload] +ys -instance Semigroup UtxoPayloadSet where - UtxoPayloadSet [UtxoPayload] -a <> :: UtxoPayloadSet -> UtxoPayloadSet -> UtxoPayloadSet -<> UtxoPayloadSet [UtxoPayload] -b = [UtxoPayload] -> UtxoPayloadSet +instance Semigroup UtxoPayloadSet where + UtxoPayloadSet [UtxoPayload] +a <> :: UtxoPayloadSet -> UtxoPayloadSet -> UtxoPayloadSet +<> UtxoPayloadSet [UtxoPayload] +b = [UtxoPayload] -> UtxoPayloadSet UtxoPayloadSet ([UtxoPayload] -> UtxoPayloadSet) -> [UtxoPayload] -> UtxoPayloadSet forall a b. (a -> b) -> a -> b -$ [UtxoPayload] -a [UtxoPayload] -> [UtxoPayload] -> [UtxoPayload] +$ [UtxoPayload] +a [UtxoPayload] -> [UtxoPayload] -> [UtxoPayload] forall a. [a] -> [a] -> [a] -++ [UtxoPayload] -b +++ [UtxoPayload] +b -instance Monoid UtxoPayloadSet where - mempty :: UtxoPayloadSet -mempty = [UtxoPayload] -> UtxoPayloadSet +instance Monoid UtxoPayloadSet where + mempty :: UtxoPayloadSet +mempty = [UtxoPayload] -> UtxoPayloadSet UtxoPayloadSet [] -- | Computes the total value in a set -utxoPayloadSetTotal :: UtxoPayloadSet -> PV2.Value +utxoPayloadSetTotal :: UtxoPayloadSet -> PV2.Value utxoPayloadSetTotal :: UtxoPayloadSet -> Value utxoPayloadSetTotal = [Value] -> Value forall a. Monoid a => [a] -> a -mconcat ([Value] -> Value) +mconcat ([Value] -> Value) -> (UtxoPayloadSet -> [Value]) -> UtxoPayloadSet -> Value forall b c a. (b -> c) -> (a -> b) -> a -> c -. (UtxoPayload -> Value) -> [UtxoPayload] -> [Value] +. (UtxoPayload -> Value) -> [UtxoPayload] -> [Value] forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b -fmap UtxoPayload -> Value +fmap UtxoPayload -> Value utxoPayloadValue ([UtxoPayload] -> [Value]) -> (UtxoPayloadSet -> [UtxoPayload]) -> UtxoPayloadSet -> [Value] forall b c a. (b -> c) -> (a -> b) -> a -> c -. UtxoPayloadSet -> [UtxoPayload] +. UtxoPayloadSet -> [UtxoPayload] utxoPayloadSet \ No newline at end of file diff --git a/src/Cooked.Output.html b/src/Cooked.Output.html index b7e19fb74..20cfea422 100644 --- a/src/Cooked.Output.html +++ b/src/Cooked.Output.html @@ -41,13 +41,13 @@ ) where -import Optics.Core -import qualified Plutus.Script.Utils.Ada as Pl -import qualified Plutus.Script.Utils.Scripts as Pl hiding (validatorHash) -import qualified Plutus.Script.Utils.V2.Typed.Scripts.Validators as Pl -import qualified Plutus.Script.Utils.Value as Pl -import qualified Plutus.V2.Ledger.Api as Pl -import qualified Plutus.V2.Ledger.Tx as Pl +import Optics.Core +import qualified Plutus.Script.Utils.Ada as Pl +import qualified Plutus.Script.Utils.Scripts as Pl hiding (validatorHash) +import qualified Plutus.Script.Utils.V2.Typed.Scripts.Validators as Pl +import qualified Plutus.Script.Utils.Value as Pl +import qualified Plutus.V2.Ledger.Api as Pl +import qualified Plutus.V2.Ledger.Tx as Pl -- | A generalisation of 'Pl.TxOut': With the four type families, we can lift -- some information about @@ -63,291 +63,291 @@ -- complete script, a typed validator...?) -- -- to the type level. -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 Pl.StakingCredential) - outputDatumL :: Lens' o (DatumType o) - outputValueL :: Lens' o (ValueType o) - outputReferenceScriptL :: Lens' o (Maybe (ReferenceScriptType o)) +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 Pl.StakingCredential) + outputDatumL :: Lens' o (DatumType o) + outputValueL :: Lens' o (ValueType o) + outputReferenceScriptL :: Lens' o (Maybe (ReferenceScriptType o)) -class ToCredential a where - toCredential :: a -> Pl.Credential +class ToCredential a where + toCredential :: a -> Pl.Credential -instance ToCredential Pl.Credential where - toCredential :: Credential -> Credential -toCredential = Credential -> Credential +instance ToCredential Pl.Credential where + toCredential :: Credential -> Credential +toCredential = Credential -> Credential forall a. a -> a -id +id -instance ToCredential (Pl.TypedValidator a) where - toCredential :: TypedValidator a -> Credential -toCredential = ValidatorHash -> Credential -Pl.ScriptCredential (ValidatorHash -> Credential) +instance ToCredential (Pl.TypedValidator a) where + toCredential :: TypedValidator a -> Credential +toCredential = ValidatorHash -> Credential +Pl.ScriptCredential (ValidatorHash -> Credential) -> (TypedValidator a -> ValidatorHash) -> TypedValidator a -> Credential forall b c a. (b -> c) -> (a -> b) -> a -> c -. TypedValidator a -> ValidatorHash +. TypedValidator a -> ValidatorHash forall a. TypedValidator a -> ValidatorHash -Pl.validatorHash +Pl.validatorHash -instance ToCredential Pl.PubKeyHash where - toCredential :: PubKeyHash -> Credential -toCredential = PubKeyHash -> Credential -Pl.PubKeyCredential +instance ToCredential Pl.PubKeyHash where + toCredential :: PubKeyHash -> Credential +toCredential = PubKeyHash -> Credential +Pl.PubKeyCredential -class ToOutputDatum a where - toOutputDatum :: a -> Pl.OutputDatum +class ToOutputDatum a where + toOutputDatum :: a -> Pl.OutputDatum -instance ToOutputDatum Pl.OutputDatum where - toOutputDatum :: OutputDatum -> OutputDatum -toOutputDatum = OutputDatum -> OutputDatum +instance ToOutputDatum Pl.OutputDatum where + toOutputDatum :: OutputDatum -> OutputDatum +toOutputDatum = OutputDatum -> OutputDatum forall a. a -> a -id +id -instance ToOutputDatum Pl.Datum where - toOutputDatum :: Datum -> OutputDatum -toOutputDatum = Datum -> OutputDatum -Pl.OutputDatum +instance ToOutputDatum Pl.Datum where + toOutputDatum :: Datum -> OutputDatum +toOutputDatum = Datum -> OutputDatum +Pl.OutputDatum instance ToOutputDatum () where - toOutputDatum :: () -> OutputDatum -toOutputDatum = OutputDatum -> () -> OutputDatum + toOutputDatum :: () -> OutputDatum +toOutputDatum = OutputDatum -> () -> OutputDatum forall a b. a -> b -> a -const OutputDatum -Pl.NoOutputDatum +const OutputDatum +Pl.NoOutputDatum -instance ToOutputDatum Pl.DatumHash where - toOutputDatum :: DatumHash -> OutputDatum -toOutputDatum = DatumHash -> OutputDatum -Pl.OutputDatumHash +instance ToOutputDatum Pl.DatumHash where + toOutputDatum :: DatumHash -> OutputDatum +toOutputDatum = DatumHash -> OutputDatum +Pl.OutputDatumHash -class ToValue a where - toValue :: a -> Pl.Value +class ToValue a where + toValue :: a -> Pl.Value -instance ToValue Pl.Value where - toValue :: Value -> Value -toValue = Value -> Value +instance ToValue Pl.Value where + toValue :: Value -> Value +toValue = Value -> Value forall a. a -> a -id +id -instance ToValue Pl.Ada where - toValue :: Ada -> Value -toValue = Ada -> Value -Pl.toValue +instance ToValue Pl.Ada where + toValue :: Ada -> Value +toValue = Ada -> Value +Pl.toValue -class ToScript a where - toScript :: a -> Pl.Versioned Pl.Script +class ToScript a where + toScript :: a -> Pl.Versioned Pl.Script -instance ToScript (Pl.Versioned Pl.Script) where - toScript :: Versioned Script -> Versioned Script -toScript = Versioned Script -> Versioned Script +instance ToScript (Pl.Versioned Pl.Script) where + toScript :: Versioned Script -> Versioned Script +toScript = Versioned Script -> Versioned Script forall a. a -> a -id +id -instance ToScript (Pl.Versioned Pl.Validator) where - toScript :: Versioned Validator -> Versioned Script -toScript (Pl.Versioned (Pl.Validator Script -script) Language -version) = Script -> Language -> Versioned Script +instance ToScript (Pl.Versioned Pl.Validator) where + toScript :: Versioned Validator -> Versioned Script +toScript (Pl.Versioned (Pl.Validator Script +script) Language +version) = Script -> Language -> Versioned Script forall script. script -> Language -> Versioned script -Pl.Versioned Script -script Language -version +Pl.Versioned Script +script Language +version -instance ToScript (Pl.TypedValidator a) where - toScript :: TypedValidator a -> Versioned Script -toScript = Versioned Validator -> Versioned Script +instance ToScript (Pl.TypedValidator a) where + toScript :: TypedValidator a -> Versioned Script +toScript = Versioned Validator -> Versioned Script forall a. ToScript a => a -> Versioned Script toScript (Versioned Validator -> Versioned Script) -> (TypedValidator a -> Versioned Validator) -> TypedValidator a -> Versioned Script forall b c a. (b -> c) -> (a -> b) -> a -> c -. TypedValidator a -> Versioned Validator +. TypedValidator a -> Versioned Validator forall a. TypedValidator a -> Versioned Validator -Pl.vValidatorScript +Pl.vValidatorScript -class ToScriptHash a where - toScriptHash :: a -> Pl.ScriptHash +class ToScriptHash a where + toScriptHash :: a -> Pl.ScriptHash -instance ToScriptHash Pl.ScriptHash where - toScriptHash :: ScriptHash -> ScriptHash -toScriptHash = ScriptHash -> ScriptHash +instance ToScriptHash Pl.ScriptHash where + toScriptHash :: ScriptHash -> ScriptHash +toScriptHash = ScriptHash -> ScriptHash forall a. a -> a -id +id -instance ToScriptHash (Pl.Versioned Pl.Script) where - toScriptHash :: Versioned Script -> ScriptHash -toScriptHash = Versioned Script -> ScriptHash -Pl.scriptHash +instance ToScriptHash (Pl.Versioned Pl.Script) where + toScriptHash :: Versioned Script -> ScriptHash +toScriptHash = Versioned Script -> ScriptHash +Pl.scriptHash -instance ToScriptHash (Pl.Versioned Pl.Validator) where - toScriptHash :: Versioned Validator -> ScriptHash -toScriptHash = Versioned Script -> ScriptHash +instance ToScriptHash (Pl.Versioned Pl.Validator) where + toScriptHash :: Versioned Validator -> ScriptHash +toScriptHash = Versioned Script -> ScriptHash forall a. ToScriptHash a => a -> ScriptHash toScriptHash (Versioned Script -> ScriptHash) -> (Versioned Validator -> Versioned Script) -> Versioned Validator -> ScriptHash forall b c a. (b -> c) -> (a -> b) -> a -> c -. Versioned Validator -> Versioned Script +. Versioned Validator -> Versioned Script forall a. ToScript a => a -> Versioned Script toScript -instance ToScriptHash Pl.ValidatorHash where - toScriptHash :: ValidatorHash -> ScriptHash -toScriptHash (Pl.ValidatorHash BuiltinByteString -h) = BuiltinByteString -> ScriptHash -Pl.ScriptHash BuiltinByteString -h +instance ToScriptHash Pl.ValidatorHash where + toScriptHash :: ValidatorHash -> ScriptHash +toScriptHash (Pl.ValidatorHash BuiltinByteString +h) = BuiltinByteString -> ScriptHash +Pl.ScriptHash BuiltinByteString +h -instance ToScriptHash (Pl.TypedValidator a) where - toScriptHash :: TypedValidator a -> ScriptHash -toScriptHash = ValidatorHash -> ScriptHash +instance ToScriptHash (Pl.TypedValidator a) where + toScriptHash :: TypedValidator a -> ScriptHash +toScriptHash = ValidatorHash -> ScriptHash forall a. ToScriptHash a => a -> ScriptHash toScriptHash (ValidatorHash -> ScriptHash) -> (TypedValidator a -> ValidatorHash) -> TypedValidator a -> ScriptHash forall b c a. (b -> c) -> (a -> b) -> a -> c -. TypedValidator a -> ValidatorHash +. TypedValidator a -> ValidatorHash forall a. TypedValidator a -> ValidatorHash -Pl.validatorHash +Pl.validatorHash -- | An output that can be translated into its script-perspective (as seen on -- the 'TxInfo') representation -type IsTxInfoOutput o = - ( IsAbstractOutput o, - ToCredential (OwnerType o), - ToOutputDatum (DatumType o), - ToValue (ValueType o), - ToScriptHash (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 -> Pl.Address +outputAddress :: (IsAbstractOutput o, ToCredential (OwnerType o)) => o -> Pl.Address outputAddress :: o -> Address -outputAddress o -out = Credential -> Maybe StakingCredential -> Address -Pl.Address (OwnerType o -> Credential +outputAddress o +out = Credential -> Maybe StakingCredential -> Address +Pl.Address (OwnerType o -> Credential forall a. ToCredential a => a -> Credential toCredential (o -out o -> Optic' A_Lens NoIx o (OwnerType o) -> OwnerType 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) +^. Optic' A_Lens NoIx o (OwnerType o) forall o. IsAbstractOutput o => Lens' o (OwnerType o) outputOwnerL)) (o -out 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) +^. Optic' A_Lens NoIx o (Maybe StakingCredential) forall o. IsAbstractOutput o => Lens' o (Maybe StakingCredential) outputStakingCredentialL) -outputOutputDatum :: (IsAbstractOutput o, ToOutputDatum (DatumType o)) => o -> Pl.OutputDatum +outputOutputDatum :: (IsAbstractOutput o, ToOutputDatum (DatumType o)) => o -> Pl.OutputDatum outputOutputDatum :: 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 +. (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) +^. Optic' A_Lens NoIx o (DatumType o) forall o. IsAbstractOutput o => Lens' o (DatumType o) outputDatumL) -outputValue :: (IsAbstractOutput o, ToValue (ValueType o)) => o -> Pl.Value +outputValue :: (IsAbstractOutput o, ToValue (ValueType o)) => o -> Pl.Value outputValue :: 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 +. (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) +^. Optic' A_Lens NoIx o (ValueType o) forall o. IsAbstractOutput o => Lens' o (ValueType o) outputValueL) -outputReferenceScriptHash :: (IsAbstractOutput o, ToScriptHash (ReferenceScriptType o)) => o -> Maybe Pl.ScriptHash +outputReferenceScriptHash :: (IsAbstractOutput o, ToScriptHash (ReferenceScriptType o)) => o -> Maybe Pl.ScriptHash outputReferenceScriptHash :: 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) +<$>) (Maybe (ReferenceScriptType o) -> Maybe ScriptHash) -> (o -> Maybe (ReferenceScriptType o)) -> o -> Maybe ScriptHash forall b c a. (b -> c) -> (a -> b) -> a -> c -. (o +. (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)) +^. Optic' A_Lens NoIx o (Maybe (ReferenceScriptType o)) forall o. IsAbstractOutput o => Lens' o (Maybe (ReferenceScriptType o)) outputReferenceScriptL) -- | Return the output as it is seen by a validator on the 'TxInfo'. -outputTxOut :: IsTxInfoOutput o => o -> Pl.TxOut +outputTxOut :: (IsTxInfoOutput o) => o -> Pl.TxOut outputTxOut :: o -> TxOut -outputTxOut o -o = +outputTxOut o +o = Address -> Value -> OutputDatum -> Maybe ScriptHash -> TxOut -Pl.TxOut +Pl.TxOut (o -> Address forall o. (IsAbstractOutput o, ToCredential (OwnerType o)) => o -> Address outputAddress o -o) +o) (o -> Value forall o. (IsAbstractOutput o, ToValue (ValueType o)) => o -> Value outputValue o -o) +o) (o -> OutputDatum forall o. (IsAbstractOutput o, ToOutputDatum (DatumType o)) => o -> OutputDatum outputOutputDatum o -o) +o) (o -> Maybe ScriptHash forall o. (IsAbstractOutput o, ToScriptHash (ReferenceScriptType o)) => o -> Maybe ScriptHash outputReferenceScriptHash o -o) +o) -- * 'Pl.TxOut's are outputs -instance IsAbstractOutput Pl.TxOut where - type OwnerType Pl.TxOut = Pl.Credential - type DatumType Pl.TxOut = Pl.OutputDatum - type ValueType Pl.TxOut = Pl.Value - type ReferenceScriptType Pl.TxOut = Pl.ScriptHash - outputOwnerL :: Lens' TxOut (OwnerType TxOut) -outputOwnerL = +instance IsAbstractOutput Pl.TxOut where + type OwnerType Pl.TxOut = Pl.Credential + type DatumType Pl.TxOut = Pl.OutputDatum + type ValueType Pl.TxOut = Pl.Value + type ReferenceScriptType Pl.TxOut = Pl.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 LensVL TxOut TxOut Address Address -Pl.outAddress +lensVL LensVL TxOut TxOut Address Address +Pl.outAddress Lens TxOut TxOut Address Address -> Optic A_Lens NoIx Address Address Credential Credential -> Optic A_Lens NoIx TxOut TxOut Credential Credential @@ -355,98 +355,98 @@ 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 -> 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 +lens Address -> Credential -Pl.addressCredential - (\Address -addr Credential -cred -> Address -addr {addressCredential :: Credential -Pl.addressCredential = Credential -cred}) - outputDatumL :: Lens' TxOut (DatumType TxOut) -outputDatumL = LensVL TxOut TxOut OutputDatum OutputDatum +Pl.addressCredential + (\Address +addr Credential +cred -> Address +addr {addressCredential :: Credential +Pl.addressCredential = Credential +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 LensVL TxOut TxOut OutputDatum OutputDatum -Pl.outDatum - outputStakingCredentialL :: Lens' TxOut (Maybe StakingCredential) -outputStakingCredentialL = +lensVL LensVL TxOut TxOut OutputDatum OutputDatum +Pl.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 +lens (Address -> Maybe StakingCredential -Pl.addressStakingCredential (Address -> Maybe StakingCredential) +Pl.addressStakingCredential (Address -> Maybe StakingCredential) -> (TxOut -> Address) -> TxOut -> Maybe StakingCredential forall b c a. (b -> c) -> (a -> b) -> a -> c -. TxOut -> Address -Pl.txOutAddress) - ( \TxOut -out Maybe StakingCredential -mStCred -> +. TxOut -> Address +Pl.txOutAddress) + ( \TxOut +out Maybe StakingCredential +mStCred -> TxOut -out {txOutAddress :: Address -Pl.txOutAddress = (TxOut -> Address -Pl.txOutAddress TxOut -out) {addressStakingCredential :: Maybe StakingCredential -Pl.addressStakingCredential = Maybe StakingCredential -mStCred}} +out {txOutAddress :: Address +Pl.txOutAddress = (TxOut -> Address +Pl.txOutAddress TxOut +out) {addressStakingCredential :: Maybe StakingCredential +Pl.addressStakingCredential = Maybe StakingCredential +mStCred}} ) - outputValueL :: Lens' TxOut (ValueType TxOut) -outputValueL = LensVL TxOut TxOut Value Value -> Lens TxOut TxOut Value Value + 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 LensVL TxOut TxOut Value Value -Pl.outValue - outputReferenceScriptL :: Lens' TxOut (Maybe (ReferenceScriptType TxOut)) -outputReferenceScriptL = LensVL TxOut TxOut (Maybe ScriptHash) (Maybe ScriptHash) +lensVL LensVL TxOut TxOut Value Value +Pl.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 LensVL TxOut TxOut (Maybe ScriptHash) (Maybe ScriptHash) -Pl.outReferenceScript +lensVL LensVL TxOut TxOut (Maybe ScriptHash) (Maybe ScriptHash) +Pl.outReferenceScript -- * A concrete type for outputs -- | A type constructed to be the most general instance of 'IsAbstractOutput'. -data ConcreteOutput ownerType datumType valueType referenceScriptType where - ConcreteOutput :: +data ConcreteOutput ownerType datumType valueType referenceScriptType where + ConcreteOutput :: { ConcreteOutput ownerType datumType valueType referenceScriptType -> ownerType -concreteOutputOwner :: ownerType, +concreteOutputOwner :: ownerType, ConcreteOutput ownerType datumType valueType referenceScriptType -> Maybe StakingCredential -concreteOutputStakingCredential :: Maybe Pl.StakingCredential, +concreteOutputStakingCredential :: Maybe Pl.StakingCredential, ConcreteOutput ownerType datumType valueType referenceScriptType -> valueType -concreteOutputValue :: valueType, +concreteOutputValue :: valueType, ConcreteOutput ownerType datumType valueType referenceScriptType -> datumType -concreteOutputDatum :: datumType, +concreteOutputDatum :: datumType, ConcreteOutput ownerType datumType valueType referenceScriptType -> Maybe referenceScriptType -concreteOutputReferenceScript :: Maybe referenceScriptType +concreteOutputReferenceScript :: Maybe referenceScriptType } -> - ConcreteOutput ownerType datumType valueType referenceScriptType + ConcreteOutput ownerType datumType valueType referenceScriptType -deriving instance (Show ownerType, Show datumType, Show valueType, Show referenceScriptType) => Show (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) +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 datumType valueType referenceScriptType) = ownerType - type DatumType (ConcreteOutput ownerType datumType valueType referenceScriptType) = datumType - type ValueType (ConcreteOutput ownerType datumType valueType referenceScriptType) = valueType - type ReferenceScriptType (ConcreteOutput ownerType datumType valueType referenceScriptType) = referenceScriptType - outputOwnerL :: Lens' +instance IsAbstractOutput (ConcreteOutput ownerType datumType valueType referenceScriptType) where + type OwnerType (ConcreteOutput ownerType datumType valueType referenceScriptType) = ownerType + type DatumType (ConcreteOutput ownerType datumType valueType referenceScriptType) = datumType + type ValueType (ConcreteOutput ownerType datumType valueType referenceScriptType) = valueType + type ReferenceScriptType (ConcreteOutput ownerType datumType valueType referenceScriptType) = referenceScriptType + outputOwnerL :: Lens' (ConcreteOutput ownerType datumType valueType referenceScriptType) (OwnerType (ConcreteOutput ownerType datumType valueType referenceScriptType)) -outputOwnerL = (ConcreteOutput ownerType datumType valueType referenceScriptType +outputOwnerL = (ConcreteOutput ownerType datumType valueType referenceScriptType -> ownerType) -> (ConcreteOutput ownerType datumType valueType referenceScriptType @@ -459,21 +459,21 @@ ownerType ownerType forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b -lens ConcreteOutput ownerType datumType valueType referenceScriptType +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 :: ownerType +concreteOutputOwner (\ConcreteOutput ownerType datumType valueType referenceScriptType +out ownerType +owner -> ConcreteOutput ownerType datumType valueType referenceScriptType +out {concreteOutputOwner :: ownerType concreteOutputOwner = ownerType -owner}) - outputStakingCredentialL :: Lens' +owner}) + outputStakingCredentialL :: Lens' (ConcreteOutput ownerType datumType valueType referenceScriptType) (Maybe StakingCredential) -outputStakingCredentialL = (ConcreteOutput ownerType datumType valueType referenceScriptType +outputStakingCredentialL = (ConcreteOutput ownerType datumType valueType referenceScriptType -> Maybe StakingCredential) -> (ConcreteOutput ownerType datumType valueType referenceScriptType @@ -484,22 +484,22 @@ (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 +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 :: Maybe StakingCredential +concreteOutputStakingCredential (\ConcreteOutput ownerType datumType valueType referenceScriptType +out Maybe StakingCredential +mStCred -> ConcreteOutput ownerType datumType valueType referenceScriptType +out {concreteOutputStakingCredential :: Maybe StakingCredential concreteOutputStakingCredential = Maybe StakingCredential -mStCred}) - outputDatumL :: Lens' +mStCred}) + outputDatumL :: Lens' (ConcreteOutput ownerType datumType valueType referenceScriptType) (DatumType (ConcreteOutput ownerType datumType valueType referenceScriptType)) -outputDatumL = (ConcreteOutput ownerType datumType valueType referenceScriptType +outputDatumL = (ConcreteOutput ownerType datumType valueType referenceScriptType -> datumType) -> (ConcreteOutput ownerType datumType valueType referenceScriptType @@ -512,22 +512,22 @@ datumType datumType forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b -lens ConcreteOutput ownerType datumType valueType referenceScriptType +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 :: datumType +concreteOutputDatum (\ConcreteOutput ownerType datumType valueType referenceScriptType +out datumType +datum -> ConcreteOutput ownerType datumType valueType referenceScriptType +out {concreteOutputDatum :: datumType concreteOutputDatum = datumType -datum}) - outputValueL :: Lens' +datum}) + outputValueL :: Lens' (ConcreteOutput ownerType datumType valueType referenceScriptType) (ValueType (ConcreteOutput ownerType datumType valueType referenceScriptType)) -outputValueL = (ConcreteOutput ownerType datumType valueType referenceScriptType +outputValueL = (ConcreteOutput ownerType datumType valueType referenceScriptType -> valueType) -> (ConcreteOutput ownerType datumType valueType referenceScriptType @@ -540,24 +540,24 @@ valueType valueType forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b -lens ConcreteOutput ownerType datumType valueType referenceScriptType +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 :: valueType +concreteOutputValue (\ConcreteOutput ownerType datumType valueType referenceScriptType +out valueType +value -> ConcreteOutput ownerType datumType valueType referenceScriptType +out {concreteOutputValue :: valueType concreteOutputValue = valueType -value}) - outputReferenceScriptL :: Lens' +value}) + outputReferenceScriptL :: Lens' (ConcreteOutput ownerType datumType valueType referenceScriptType) (Maybe (ReferenceScriptType (ConcreteOutput ownerType datumType valueType referenceScriptType))) -outputReferenceScriptL = (ConcreteOutput ownerType datumType valueType referenceScriptType +outputReferenceScriptL = (ConcreteOutput ownerType datumType valueType referenceScriptType -> Maybe referenceScriptType) -> (ConcreteOutput ownerType datumType valueType referenceScriptType @@ -570,27 +570,27 @@ (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 +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 :: Maybe referenceScriptType +concreteOutputReferenceScript (\ConcreteOutput ownerType datumType valueType referenceScriptType +out Maybe referenceScriptType +mRefScript -> ConcreteOutput ownerType datumType valueType referenceScriptType +out {concreteOutputReferenceScript :: Maybe referenceScriptType concreteOutputReferenceScript = Maybe referenceScriptType -mRefScript}) +mRefScript}) -- * Functions to translate between different output types -- ** Filtering on the datum -- | Test if there is no datum on an output. -isOutputWithoutDatum :: - IsTxInfoOutput output => - output -> - Maybe (ConcreteOutput (OwnerType output) () (ValueType output) (ReferenceScriptType output)) +isOutputWithoutDatum :: + (IsTxInfoOutput output) => + output -> + Maybe (ConcreteOutput (OwnerType output) () (ValueType output) (ReferenceScriptType output)) isOutputWithoutDatum :: output -> Maybe (ConcreteOutput @@ -598,15 +598,15 @@ () (ValueType output) (ReferenceScriptType output)) -isOutputWithoutDatum output -out = case output -> OutputDatum +isOutputWithoutDatum output +out = case output -> OutputDatum forall o. (IsAbstractOutput o, ToOutputDatum (DatumType o)) => o -> OutputDatum outputOutputDatum output -out of +out of OutputDatum -Pl.NoOutputDatum -> +Pl.NoOutputDatum -> ConcreteOutput (OwnerType output) () @@ -619,7 +619,7 @@ (ValueType output) (ReferenceScriptType output)) forall a. a -> Maybe a -Just (ConcreteOutput +Just (ConcreteOutput (OwnerType output) () (ValueType output) @@ -642,7 +642,7 @@ (ValueType output) (ReferenceScriptType output)) forall a b. (a -> b) -> a -> b -$ +$ OwnerType output -> Maybe StakingCredential -> ValueType output @@ -662,42 +662,42 @@ -> ConcreteOutput ownerType datumType valueType referenceScriptType ConcreteOutput (output -out output +out output -> Optic' A_Lens NoIx output (OwnerType output) -> OwnerType output forall k s (is :: IxList) a. Is k A_Getter => s -> Optic' k is s a -> a -^. Optic' A_Lens NoIx output (OwnerType output) +^. Optic' A_Lens NoIx output (OwnerType output) forall o. IsAbstractOutput o => Lens' o (OwnerType o) outputOwnerL) (output -out output +out output -> Optic' A_Lens NoIx output (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 output (Maybe StakingCredential) +^. Optic' A_Lens NoIx output (Maybe StakingCredential) forall o. IsAbstractOutput o => Lens' o (Maybe StakingCredential) outputStakingCredentialL) (output -out output +out output -> Optic' A_Lens NoIx output (ValueType output) -> ValueType output forall k s (is :: IxList) a. Is k A_Getter => s -> Optic' k is s a -> a -^. Optic' A_Lens NoIx output (ValueType output) +^. Optic' A_Lens NoIx output (ValueType output) forall o. IsAbstractOutput o => Lens' o (ValueType o) outputValueL) () (output -out output +out output -> Optic' A_Lens NoIx output (Maybe (ReferenceScriptType output)) -> Maybe (ReferenceScriptType output) forall k s (is :: IxList) a. Is k A_Getter => s -> Optic' k is s a -> a -^. Optic' A_Lens NoIx output (Maybe (ReferenceScriptType output)) +^. Optic' A_Lens NoIx output (Maybe (ReferenceScriptType output)) forall o. IsAbstractOutput o => Lens' o (Maybe (ReferenceScriptType o)) @@ -710,14 +710,14 @@ (ValueType output) (ReferenceScriptType output)) forall a. Maybe a -Nothing +Nothing -- | Test if the output carries some inlined datum that can be parsed from -- builtin data on to something of a specific type. -isOutputWithInlineDatumOfType :: - (Pl.FromData a, IsTxInfoOutput output) => - output -> - Maybe (ConcreteOutput (OwnerType output) a (ValueType output) (ReferenceScriptType output)) +isOutputWithInlineDatumOfType :: + (Pl.FromData a, IsTxInfoOutput output) => + output -> + Maybe (ConcreteOutput (OwnerType output) a (ValueType output) (ReferenceScriptType output)) isOutputWithInlineDatumOfType :: output -> Maybe (ConcreteOutput @@ -725,16 +725,16 @@ a (ValueType output) (ReferenceScriptType output)) -isOutputWithInlineDatumOfType output -out = +isOutputWithInlineDatumOfType output +out = case output -> OutputDatum forall o. (IsAbstractOutput o, ToOutputDatum (DatumType o)) => o -> OutputDatum outputOutputDatum output -out of - Pl.OutputDatum (Pl.Datum BuiltinData -datum) -> +out of + Pl.OutputDatum (Pl.Datum BuiltinData +datum) -> OwnerType output -> Maybe StakingCredential -> ValueType output @@ -754,31 +754,31 @@ -> ConcreteOutput ownerType datumType valueType referenceScriptType ConcreteOutput (output -out output +out output -> Optic' A_Lens NoIx output (OwnerType output) -> OwnerType output forall k s (is :: IxList) a. Is k A_Getter => s -> Optic' k is s a -> a -^. Optic' A_Lens NoIx output (OwnerType output) +^. Optic' A_Lens NoIx output (OwnerType output) forall o. IsAbstractOutput o => Lens' o (OwnerType o) outputOwnerL) (output -out output +out output -> Optic' A_Lens NoIx output (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 output (Maybe StakingCredential) +^. Optic' A_Lens NoIx output (Maybe StakingCredential) forall o. IsAbstractOutput o => Lens' o (Maybe StakingCredential) outputStakingCredentialL) (output -out output +out output -> Optic' A_Lens NoIx output (ValueType output) -> ValueType output forall k s (is :: IxList) a. Is k A_Getter => s -> Optic' k is s a -> a -^. Optic' A_Lens NoIx output (ValueType output) +^. Optic' A_Lens NoIx output (ValueType output) forall o. IsAbstractOutput o => Lens' o (ValueType o) outputValueL) (a @@ -797,10 +797,10 @@ (ValueType output) (ReferenceScriptType output)) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b -<$> BuiltinData -> Maybe a +<$> BuiltinData -> Maybe a forall a. FromData a => BuiltinData -> Maybe a -Pl.fromBuiltinData BuiltinData -datum +Pl.fromBuiltinData BuiltinData +datum Maybe (Maybe (ReferenceScriptType output) -> ConcreteOutput @@ -816,17 +816,17 @@ (ValueType output) (ReferenceScriptType output)) forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b -<*> Maybe (ReferenceScriptType output) +<*> Maybe (ReferenceScriptType output) -> Maybe (Maybe (ReferenceScriptType output)) forall a. a -> Maybe a -Just (output -out output +Just (output +out output -> Optic' A_Lens NoIx output (Maybe (ReferenceScriptType output)) -> Maybe (ReferenceScriptType output) forall k s (is :: IxList) a. Is k A_Getter => s -> Optic' k is s a -> a -^. Optic' A_Lens NoIx output (Maybe (ReferenceScriptType output)) +^. Optic' A_Lens NoIx output (Maybe (ReferenceScriptType output)) forall o. IsAbstractOutput o => Lens' o (Maybe (ReferenceScriptType o)) @@ -839,13 +839,13 @@ (ValueType output) (ReferenceScriptType output)) forall a. Maybe a -Nothing +Nothing -- | Test if the output carries some inlined datum. -isOutputWithInlineDatum :: - IsTxInfoOutput output => - output -> - Maybe (ConcreteOutput (OwnerType output) Pl.Datum (ValueType output) (ReferenceScriptType output)) +isOutputWithInlineDatum :: + (IsTxInfoOutput output) => + output -> + Maybe (ConcreteOutput (OwnerType output) Pl.Datum (ValueType output) (ReferenceScriptType output)) isOutputWithInlineDatum :: output -> Maybe (ConcreteOutput @@ -853,16 +853,16 @@ Datum (ValueType output) (ReferenceScriptType output)) -isOutputWithInlineDatum output -out = +isOutputWithInlineDatum output +out = case output -> OutputDatum forall o. (IsAbstractOutput o, ToOutputDatum (DatumType o)) => o -> OutputDatum outputOutputDatum output -out of - Pl.OutputDatum datum :: Datum -datum@(Pl.Datum BuiltinData +out of + Pl.OutputDatum datum :: Datum +datum@(Pl.Datum BuiltinData _) -> ConcreteOutput (OwnerType output) @@ -876,7 +876,7 @@ (ValueType output) (ReferenceScriptType output)) forall a. a -> Maybe a -Just (ConcreteOutput +Just (ConcreteOutput (OwnerType output) Datum (ValueType output) @@ -899,7 +899,7 @@ (ValueType output) (ReferenceScriptType output)) forall a b. (a -> b) -> a -> b -$ +$ OwnerType output -> Maybe StakingCredential -> ValueType output @@ -919,43 +919,43 @@ -> ConcreteOutput ownerType datumType valueType referenceScriptType ConcreteOutput (output -out output +out output -> Optic' A_Lens NoIx output (OwnerType output) -> OwnerType output forall k s (is :: IxList) a. Is k A_Getter => s -> Optic' k is s a -> a -^. Optic' A_Lens NoIx output (OwnerType output) +^. Optic' A_Lens NoIx output (OwnerType output) forall o. IsAbstractOutput o => Lens' o (OwnerType o) outputOwnerL) (output -out output +out output -> Optic' A_Lens NoIx output (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 output (Maybe StakingCredential) +^. Optic' A_Lens NoIx output (Maybe StakingCredential) forall o. IsAbstractOutput o => Lens' o (Maybe StakingCredential) outputStakingCredentialL) (output -out output +out output -> Optic' A_Lens NoIx output (ValueType output) -> ValueType output forall k s (is :: IxList) a. Is k A_Getter => s -> Optic' k is s a -> a -^. Optic' A_Lens NoIx output (ValueType output) +^. Optic' A_Lens NoIx output (ValueType output) forall o. IsAbstractOutput o => Lens' o (ValueType o) outputValueL) Datum -datum +datum (output -out output +out output -> Optic' A_Lens NoIx output (Maybe (ReferenceScriptType output)) -> Maybe (ReferenceScriptType output) forall k s (is :: IxList) a. Is k A_Getter => s -> Optic' k is s a -> a -^. Optic' A_Lens NoIx output (Maybe (ReferenceScriptType output)) +^. Optic' A_Lens NoIx output (Maybe (ReferenceScriptType output)) forall o. IsAbstractOutput o => Lens' o (Maybe (ReferenceScriptType o)) @@ -968,13 +968,13 @@ (ValueType output) (ReferenceScriptType output)) forall a. Maybe a -Nothing +Nothing -- | Test if the output carries some datum hash. -isOutputWithDatumHash :: - IsTxInfoOutput output => - output -> - Maybe (ConcreteOutput (OwnerType output) Pl.DatumHash (ValueType output) (ReferenceScriptType output)) +isOutputWithDatumHash :: + (IsTxInfoOutput output) => + output -> + Maybe (ConcreteOutput (OwnerType output) Pl.DatumHash (ValueType output) (ReferenceScriptType output)) isOutputWithDatumHash :: output -> Maybe (ConcreteOutput @@ -982,16 +982,16 @@ DatumHash (ValueType output) (ReferenceScriptType output)) -isOutputWithDatumHash output -out = +isOutputWithDatumHash output +out = case output -> OutputDatum forall o. (IsAbstractOutput o, ToOutputDatum (DatumType o)) => o -> OutputDatum outputOutputDatum output -out of - Pl.OutputDatumHash DatumHash -hash -> +out of + Pl.OutputDatumHash DatumHash +hash -> ConcreteOutput (OwnerType output) DatumHash @@ -1004,7 +1004,7 @@ (ValueType output) (ReferenceScriptType output)) forall a. a -> Maybe a -Just (ConcreteOutput +Just (ConcreteOutput (OwnerType output) DatumHash (ValueType output) @@ -1027,7 +1027,7 @@ (ValueType output) (ReferenceScriptType output)) forall a b. (a -> b) -> a -> b -$ +$ OwnerType output -> Maybe StakingCredential -> ValueType output @@ -1047,46 +1047,46 @@ -> ConcreteOutput ownerType datumType valueType referenceScriptType ConcreteOutput (output -out output +out output -> Optic' A_Lens NoIx output (OwnerType output) -> OwnerType output forall k s (is :: IxList) a. Is k A_Getter => s -> Optic' k is s a -> a -^. Optic' A_Lens NoIx output (OwnerType output) +^. Optic' A_Lens NoIx output (OwnerType output) forall o. IsAbstractOutput o => Lens' o (OwnerType o) outputOwnerL) (Address -> Maybe StakingCredential -Pl.addressStakingCredential (Address -> Maybe StakingCredential) +Pl.addressStakingCredential (Address -> Maybe StakingCredential) -> (output -> Address) -> output -> Maybe StakingCredential forall b c a. (b -> c) -> (a -> b) -> a -> c -. output -> Address +. output -> Address forall o. (IsAbstractOutput o, ToCredential (OwnerType o)) => o -> Address outputAddress (output -> Maybe StakingCredential) -> output -> Maybe StakingCredential forall a b. (a -> b) -> a -> b -$ output -out) +$ output +out) (output -out output +out output -> Optic' A_Lens NoIx output (ValueType output) -> ValueType output forall k s (is :: IxList) a. Is k A_Getter => s -> Optic' k is s a -> a -^. Optic' A_Lens NoIx output (ValueType output) +^. Optic' A_Lens NoIx output (ValueType output) forall o. IsAbstractOutput o => Lens' o (ValueType o) outputValueL) DatumHash -hash +hash (output -out output +out output -> Optic' A_Lens NoIx output (Maybe (ReferenceScriptType output)) -> Maybe (ReferenceScriptType output) forall k s (is :: IxList) a. Is k A_Getter => s -> Optic' k is s a -> a -^. Optic' A_Lens NoIx output (Maybe (ReferenceScriptType output)) +^. Optic' A_Lens NoIx output (Maybe (ReferenceScriptType output)) forall o. IsAbstractOutput o => Lens' o (Maybe (ReferenceScriptType o)) @@ -1099,17 +1099,17 @@ (ValueType output) (ReferenceScriptType output)) forall a. Maybe a -Nothing +Nothing -- ** Filtering on the owner -- | Test if the owner of an output is a specific typed validator. If it is, -- return an output with the validator type as its 'OwnerType'. -isScriptOutputFrom :: - IsTxInfoOutput output => - Pl.TypedValidator a -> - output -> - Maybe (ConcreteOutput (Pl.TypedValidator a) (DatumType output) (ValueType output) (ReferenceScriptType output)) +isScriptOutputFrom :: + (IsTxInfoOutput output) => + Pl.TypedValidator a -> + output -> + Maybe (ConcreteOutput (Pl.TypedValidator a) (DatumType output) (ValueType output) (ReferenceScriptType output)) isScriptOutputFrom :: TypedValidator a -> output -> Maybe @@ -1118,25 +1118,25 @@ (DatumType output) (ValueType output) (ReferenceScriptType output)) -isScriptOutputFrom TypedValidator a -validator output -out = +isScriptOutputFrom TypedValidator a +validator output +out = case output -> Address forall o. (IsAbstractOutput o, ToCredential (OwnerType o)) => o -> Address outputAddress output -out of - Pl.Address (Pl.ScriptCredential ValidatorHash -scriptHash) Maybe StakingCredential -mStCred -> +out of + Pl.Address (Pl.ScriptCredential ValidatorHash +scriptHash) Maybe StakingCredential +mStCred -> if ValidatorHash -scriptHash ValidatorHash -> ValidatorHash -> Bool +scriptHash ValidatorHash -> ValidatorHash -> Bool forall a. Eq a => a -> a -> Bool -== TypedValidator a -> ValidatorHash +== TypedValidator a -> ValidatorHash forall a. TypedValidator a -> ValidatorHash -Pl.validatorHash TypedValidator a -validator +Pl.validatorHash TypedValidator a +validator then ConcreteOutput (TypedValidator a) @@ -1150,7 +1150,7 @@ (ValueType output) (ReferenceScriptType output)) forall a. a -> Maybe a -Just (ConcreteOutput +Just (ConcreteOutput (TypedValidator a) (DatumType output) (ValueType output) @@ -1173,7 +1173,7 @@ (ValueType output) (ReferenceScriptType output)) forall a b. (a -> b) -> a -> b -$ +$ TypedValidator a -> Maybe StakingCredential -> ValueType output @@ -1193,35 +1193,35 @@ -> ConcreteOutput ownerType datumType valueType referenceScriptType ConcreteOutput TypedValidator a -validator +validator Maybe StakingCredential -mStCred +mStCred (output -out output +out output -> Optic' A_Lens NoIx output (ValueType output) -> ValueType output forall k s (is :: IxList) a. Is k A_Getter => s -> Optic' k is s a -> a -^. Optic' A_Lens NoIx output (ValueType output) +^. Optic' A_Lens NoIx output (ValueType output) forall o. IsAbstractOutput o => Lens' o (ValueType o) outputValueL) (output -out output +out output -> Optic' A_Lens NoIx output (DatumType output) -> DatumType output forall k s (is :: IxList) a. Is k A_Getter => s -> Optic' k is s a -> a -^. Optic' A_Lens NoIx output (DatumType output) +^. Optic' A_Lens NoIx output (DatumType output) forall o. IsAbstractOutput o => Lens' o (DatumType o) outputDatumL) (output -out output +out output -> Optic' A_Lens NoIx output (Maybe (ReferenceScriptType output)) -> Maybe (ReferenceScriptType output) forall k s (is :: IxList) a. Is k A_Getter => s -> Optic' k is s a -> a -^. Optic' A_Lens NoIx output (Maybe (ReferenceScriptType output)) +^. Optic' A_Lens NoIx output (Maybe (ReferenceScriptType output)) forall o. IsAbstractOutput o => Lens' o (Maybe (ReferenceScriptType o)) @@ -1233,7 +1233,7 @@ (ValueType output) (ReferenceScriptType output)) forall a. Maybe a -Nothing +Nothing Address _ -> Maybe (ConcreteOutput @@ -1242,16 +1242,16 @@ (ValueType output) (ReferenceScriptType output)) forall a. Maybe a -Nothing +Nothing -- | Test if the owner of an output is a specific public key. If it is, return -- an output of the same 'DatumType', but with 'Pl.PubKeyHash' as its -- 'OwnerType'. -isPKOutputFrom :: - IsTxInfoOutput output => - Pl.PubKeyHash -> - output -> - Maybe (ConcreteOutput Pl.PubKeyHash (DatumType output) (ValueType output) (ReferenceScriptType output)) +isPKOutputFrom :: + (IsTxInfoOutput output) => + Pl.PubKeyHash -> + output -> + Maybe (ConcreteOutput Pl.PubKeyHash (DatumType output) (ValueType output) (ReferenceScriptType output)) isPKOutputFrom :: PubKeyHash -> output -> Maybe @@ -1260,22 +1260,22 @@ (DatumType output) (ValueType output) (ReferenceScriptType output)) -isPKOutputFrom PubKeyHash -pkh output -out = case output -> Address +isPKOutputFrom PubKeyHash +pkh output +out = case output -> Address forall o. (IsAbstractOutput o, ToCredential (OwnerType o)) => o -> Address outputAddress output -out of - Pl.Address (Pl.PubKeyCredential PubKeyHash -pkh') Maybe StakingCredential -_mStCred -> +out of + Pl.Address (Pl.PubKeyCredential PubKeyHash +pkh') Maybe StakingCredential +_mStCred -> if PubKeyHash -pkh PubKeyHash -> PubKeyHash -> Bool +pkh PubKeyHash -> PubKeyHash -> Bool forall a. Eq a => a -> a -> Bool -== PubKeyHash -pkh' +== PubKeyHash +pkh' then ConcreteOutput PubKeyHash @@ -1289,7 +1289,7 @@ (ValueType output) (ReferenceScriptType output)) forall a. a -> Maybe a -Just (ConcreteOutput +Just (ConcreteOutput PubKeyHash (DatumType output) (ValueType output) @@ -1312,7 +1312,7 @@ (ValueType output) (ReferenceScriptType output)) forall a b. (a -> b) -> a -> b -$ +$ PubKeyHash -> Maybe StakingCredential -> ValueType output @@ -1332,43 +1332,43 @@ -> ConcreteOutput ownerType datumType valueType referenceScriptType ConcreteOutput PubKeyHash -pkh +pkh (output -out output +out output -> Optic' A_Lens NoIx output (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 output (Maybe StakingCredential) +^. Optic' A_Lens NoIx output (Maybe StakingCredential) forall o. IsAbstractOutput o => Lens' o (Maybe StakingCredential) outputStakingCredentialL) (output -out output +out output -> Optic' A_Lens NoIx output (ValueType output) -> ValueType output forall k s (is :: IxList) a. Is k A_Getter => s -> Optic' k is s a -> a -^. Optic' A_Lens NoIx output (ValueType output) +^. Optic' A_Lens NoIx output (ValueType output) forall o. IsAbstractOutput o => Lens' o (ValueType o) outputValueL) (output -out output +out output -> Optic' A_Lens NoIx output (DatumType output) -> DatumType output forall k s (is :: IxList) a. Is k A_Getter => s -> Optic' k is s a -> a -^. Optic' A_Lens NoIx output (DatumType output) +^. Optic' A_Lens NoIx output (DatumType output) forall o. IsAbstractOutput o => Lens' o (DatumType o) outputDatumL) (output -out output +out output -> Optic' A_Lens NoIx output (Maybe (ReferenceScriptType output)) -> Maybe (ReferenceScriptType output) forall k s (is :: IxList) a. Is k A_Getter => s -> Optic' k is s a -> a -^. Optic' A_Lens NoIx output (Maybe (ReferenceScriptType output)) +^. Optic' A_Lens NoIx output (Maybe (ReferenceScriptType output)) forall o. IsAbstractOutput o => Lens' o (Maybe (ReferenceScriptType o)) @@ -1380,7 +1380,7 @@ (ValueType output) (ReferenceScriptType output)) forall a. Maybe a -Nothing +Nothing Address _ -> Maybe (ConcreteOutput @@ -1389,15 +1389,15 @@ (ValueType output) (ReferenceScriptType output)) forall a. Maybe a -Nothing +Nothing -- ** Filtering on the value -- | Test if the value on an output contains only Ada. -isOnlyAdaOutput :: - IsTxInfoOutput output => - output -> - Maybe (ConcreteOutput (OwnerType output) (DatumType output) Pl.Ada (ReferenceScriptType output)) +isOnlyAdaOutput :: + (IsTxInfoOutput output) => + output -> + Maybe (ConcreteOutput (OwnerType output) (DatumType output) Pl.Ada (ReferenceScriptType output)) isOnlyAdaOutput :: output -> Maybe (ConcreteOutput @@ -1405,13 +1405,13 @@ (DatumType output) Ada (ReferenceScriptType output)) -isOnlyAdaOutput output -out = +isOnlyAdaOutput output +out = if Value -> Bool -Pl.isAdaOnlyValue (output -> Value +Pl.isAdaOnlyValue (output -> Value forall o. (IsAbstractOutput o, ToValue (ValueType o)) => o -> Value outputValue output -out) +out) then ConcreteOutput (OwnerType output) @@ -1425,7 +1425,7 @@ Ada (ReferenceScriptType output)) forall a. a -> Maybe a -Just (ConcreteOutput +Just (ConcreteOutput (OwnerType output) (DatumType output) Ada @@ -1448,7 +1448,7 @@ Ada (ReferenceScriptType output)) forall a b. (a -> b) -> a -> b -$ +$ OwnerType output -> Maybe StakingCredential -> Ada @@ -1468,48 +1468,48 @@ -> ConcreteOutput ownerType datumType valueType referenceScriptType ConcreteOutput (output -out output +out output -> Optic' A_Lens NoIx output (OwnerType output) -> OwnerType output forall k s (is :: IxList) a. Is k A_Getter => s -> Optic' k is s a -> a -^. Optic' A_Lens NoIx output (OwnerType output) +^. Optic' A_Lens NoIx output (OwnerType output) forall o. IsAbstractOutput o => Lens' o (OwnerType o) outputOwnerL) (output -out output +out output -> Optic' A_Lens NoIx output (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 output (Maybe StakingCredential) +^. Optic' A_Lens NoIx output (Maybe StakingCredential) forall o. IsAbstractOutput o => Lens' o (Maybe StakingCredential) outputStakingCredentialL) (Value -> Ada -Pl.fromValue (Value -> Ada) -> Value -> Ada +Pl.fromValue (Value -> Ada) -> Value -> Ada forall a b. (a -> b) -> a -> b -$ output -> Value +$ output -> Value forall o. (IsAbstractOutput o, ToValue (ValueType o)) => o -> Value outputValue output -out) +out) (output -out output +out output -> Optic' A_Lens NoIx output (DatumType output) -> DatumType output forall k s (is :: IxList) a. Is k A_Getter => s -> Optic' k is s a -> a -^. Optic' A_Lens NoIx output (DatumType output) +^. Optic' A_Lens NoIx output (DatumType output) forall o. IsAbstractOutput o => Lens' o (DatumType o) outputDatumL) (output -out output +out output -> Optic' A_Lens NoIx output (Maybe (ReferenceScriptType output)) -> Maybe (ReferenceScriptType output) forall k s (is :: IxList) a. Is k A_Getter => s -> Optic' k is s a -> a -^. Optic' A_Lens NoIx output (Maybe (ReferenceScriptType output)) +^. Optic' A_Lens NoIx output (Maybe (ReferenceScriptType output)) forall o. IsAbstractOutput o => Lens' o (Maybe (ReferenceScriptType o)) @@ -1521,20 +1521,20 @@ Ada (ReferenceScriptType output)) forall a. Maybe a -Nothing +Nothing -- ** Filtering on the reference script -- | Convert the reference script type on the output to 'Pl.ScriptHash'. -toOutputWithReferenceScriptHash :: - (IsAbstractOutput output, ToScriptHash (ReferenceScriptType output)) => - output -> - ConcreteOutput (OwnerType output) (DatumType output) (ValueType output) Pl.ScriptHash +toOutputWithReferenceScriptHash :: + (IsAbstractOutput output, ToScriptHash (ReferenceScriptType output)) => + output -> + ConcreteOutput (OwnerType output) (DatumType output) (ValueType output) Pl.ScriptHash toOutputWithReferenceScriptHash :: output -> ConcreteOutput (OwnerType output) (DatumType output) (ValueType output) ScriptHash -toOutputWithReferenceScriptHash output -out = +toOutputWithReferenceScriptHash output +out = OwnerType output -> Maybe StakingCredential -> ValueType output @@ -1551,40 +1551,40 @@ -> ConcreteOutput ownerType datumType valueType referenceScriptType ConcreteOutput (output -out output +out output -> Optic' A_Lens NoIx output (OwnerType output) -> OwnerType output forall k s (is :: IxList) a. Is k A_Getter => s -> Optic' k is s a -> a -^. Optic' A_Lens NoIx output (OwnerType output) +^. Optic' A_Lens NoIx output (OwnerType output) forall o. IsAbstractOutput o => Lens' o (OwnerType o) outputOwnerL) (output -out output +out output -> Optic' A_Lens NoIx output (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 output (Maybe StakingCredential) +^. Optic' A_Lens NoIx output (Maybe StakingCredential) forall o. IsAbstractOutput o => Lens' o (Maybe StakingCredential) outputStakingCredentialL) (output -out output +out output -> Optic' A_Lens NoIx output (ValueType output) -> ValueType output forall k s (is :: IxList) a. Is k A_Getter => s -> Optic' k is s a -> a -^. Optic' A_Lens NoIx output (ValueType output) +^. Optic' A_Lens NoIx output (ValueType output) forall o. IsAbstractOutput o => Lens' o (ValueType o) outputValueL) (output -out output +out output -> Optic' A_Lens NoIx output (DatumType output) -> DatumType output forall k s (is :: IxList) a. Is k A_Getter => s -> Optic' k is s a -> a -^. Optic' A_Lens NoIx output (DatumType output) +^. Optic' A_Lens NoIx output (DatumType output) forall o. IsAbstractOutput o => Lens' o (DatumType o) outputDatumL) (ReferenceScriptType output -> ScriptHash @@ -1592,14 +1592,14 @@ toScriptHash (ReferenceScriptType output -> ScriptHash) -> Maybe (ReferenceScriptType output) -> Maybe ScriptHash forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b -<$> output -out output +<$> output +out output -> Optic' A_Lens NoIx output (Maybe (ReferenceScriptType output)) -> Maybe (ReferenceScriptType output) forall k s (is :: IxList) a. Is k A_Getter => s -> Optic' k is s a -> a -^. Optic' A_Lens NoIx output (Maybe (ReferenceScriptType output)) +^. Optic' A_Lens NoIx output (Maybe (ReferenceScriptType output)) forall o. IsAbstractOutput o => Lens' o (Maybe (ReferenceScriptType o)) diff --git a/src/Cooked.Pretty.Class.html b/src/Cooked.Pretty.Class.html index b7a2bce67..200985a6a 100644 --- a/src/Cooked.Pretty.Class.html +++ b/src/Cooked.Pretty.Class.html @@ -20,24 +20,24 @@ import Cooked.Pretty.Common import Cooked.Pretty.Options import Cooked.Wallet -import Data.Default -import qualified Ledger.Index as Pl -import qualified Plutus.Script.Utils.Scripts as Pl -import qualified Plutus.Script.Utils.Value as Pl -import qualified Plutus.V2.Ledger.Api as Pl -import Prettyprinter ((<+>)) -import qualified Prettyprinter as PP -import qualified Prettyprinter.Render.Text as PP +import Data.Default +import qualified Ledger.Index as Pl +import qualified Plutus.Script.Utils.Scripts as Pl +import qualified Plutus.Script.Utils.Value as Pl +import qualified Plutus.V2.Ledger.Api as Pl +import Prettyprinter ((<+>)) +import qualified Prettyprinter as PP +import qualified Prettyprinter.Render.Text as PP -class PrettyCooked a where - prettyCooked :: a -> DocCooked - prettyCooked = PrettyCookedOpts -> a -> DocCooked +class PrettyCooked a where + prettyCooked :: a -> DocCooked + prettyCooked = PrettyCookedOpts -> a -> DocCooked forall a. PrettyCooked a => PrettyCookedOpts -> a -> DocCooked prettyCookedOpt PrettyCookedOpts forall a. Default a => a -def - prettyCookedOpt :: PrettyCookedOpts -> a -> DocCooked - prettyCookedOpt PrettyCookedOpts +def + prettyCookedOpt :: PrettyCookedOpts -> a -> DocCooked + prettyCookedOpt PrettyCookedOpts _ = a -> DocCooked forall a. PrettyCooked a => a -> DocCooked prettyCooked @@ -46,199 +46,199 @@ -- when dealing with pretty-printable cooked values. -- -- For example, @printCookedOpt def runMockChain i0 foo@ -printCookedOpt :: PrettyCooked a => PrettyCookedOpts -> a -> IO () +printCookedOpt :: (PrettyCooked a) => PrettyCookedOpts -> a -> IO () printCookedOpt :: PrettyCookedOpts -> a -> IO () -printCookedOpt PrettyCookedOpts -opts a -e = DocCooked -> IO () +printCookedOpt PrettyCookedOpts +opts a +e = DocCooked -> IO () forall ann. Doc ann -> IO () -PP.putDoc (DocCooked -> IO ()) -> DocCooked -> IO () +PP.putDoc (DocCooked -> IO ()) -> DocCooked -> IO () forall a b. (a -> b) -> a -> b -$ PrettyCookedOpts -> a -> DocCooked +$ PrettyCookedOpts -> a -> DocCooked forall a. PrettyCooked a => PrettyCookedOpts -> a -> DocCooked prettyCookedOpt PrettyCookedOpts -opts a -e DocCooked -> DocCooked -> DocCooked +opts a +e DocCooked -> DocCooked -> DocCooked forall ann. Doc ann -> Doc ann -> Doc ann -<+> DocCooked +<+> DocCooked forall ann. Doc ann -PP.line +PP.line -- | Version of 'printCookedOpt' that uses default pretty printing options. -printCooked :: PrettyCooked a => a -> IO () +printCooked :: (PrettyCooked a) => a -> IO () printCooked :: a -> IO () printCooked = PrettyCookedOpts -> a -> IO () forall a. PrettyCooked a => PrettyCookedOpts -> a -> IO () printCookedOpt PrettyCookedOpts forall a. Default a => a -def +def -instance PrettyCooked Pl.TxId where - prettyCookedOpt :: PrettyCookedOpts -> TxId -> DocCooked -prettyCookedOpt PrettyCookedOpts -opts = Int -> TxId -> DocCooked +instance PrettyCooked Pl.TxId where + prettyCookedOpt :: PrettyCookedOpts -> TxId -> DocCooked +prettyCookedOpt PrettyCookedOpts +opts = Int -> TxId -> DocCooked forall a. Show a => Int -> a -> DocCooked prettyHash (PrettyCookedOpts -> Int pcOptPrintedHashLength PrettyCookedOpts -opts) +opts) -instance PrettyCooked Pl.TxOutRef where - prettyCookedOpt :: PrettyCookedOpts -> TxOutRef -> DocCooked -prettyCookedOpt PrettyCookedOpts -opts (Pl.TxOutRef TxId -txId Integer -index) = +instance PrettyCooked Pl.TxOutRef where + prettyCookedOpt :: PrettyCookedOpts -> TxOutRef -> DocCooked +prettyCookedOpt PrettyCookedOpts +opts (Pl.TxOutRef TxId +txId Integer +index) = Int -> TxId -> DocCooked forall a. Show a => Int -> a -> DocCooked prettyHash (PrettyCookedOpts -> Int pcOptPrintedHashLength PrettyCookedOpts -opts) TxId -txId DocCooked -> DocCooked -> DocCooked +opts) TxId +txId DocCooked -> DocCooked -> DocCooked forall a. Semigroup a => a -> a -> a -<> DocCooked +<> DocCooked "!" DocCooked -> DocCooked -> DocCooked forall a. Semigroup a => a -> a -> a -<> PrettyCookedOpts -> Integer -> DocCooked +<> PrettyCookedOpts -> Integer -> DocCooked forall a. PrettyCooked a => PrettyCookedOpts -> a -> DocCooked prettyCookedOpt PrettyCookedOpts -opts Integer -index +opts Integer +index -instance PrettyCooked (Pl.Versioned Pl.MintingPolicy) where - prettyCookedOpt :: PrettyCookedOpts -> Versioned MintingPolicy -> DocCooked -prettyCookedOpt PrettyCookedOpts -opts = Int -> MintingPolicyHash -> DocCooked +instance PrettyCooked (Pl.Versioned Pl.MintingPolicy) where + prettyCookedOpt :: PrettyCookedOpts -> Versioned MintingPolicy -> DocCooked +prettyCookedOpt PrettyCookedOpts +opts = Int -> MintingPolicyHash -> DocCooked forall a. Show a => Int -> a -> DocCooked prettyHash (PrettyCookedOpts -> Int pcOptPrintedHashLength PrettyCookedOpts -opts) (MintingPolicyHash -> DocCooked) +opts) (MintingPolicyHash -> DocCooked) -> (Versioned MintingPolicy -> MintingPolicyHash) -> Versioned MintingPolicy -> DocCooked forall b c a. (b -> c) -> (a -> b) -> a -> c -. Versioned MintingPolicy -> MintingPolicyHash -Pl.mintingPolicyHash +. Versioned MintingPolicy -> MintingPolicyHash +Pl.mintingPolicyHash -instance PrettyCooked Pl.Address where - prettyCookedOpt :: PrettyCookedOpts -> Address -> DocCooked -prettyCookedOpt PrettyCookedOpts -opts (Pl.Address Credential -addrCr Maybe StakingCredential -Nothing) = PrettyCookedOpts -> Credential -> DocCooked +instance PrettyCooked Pl.Address where + prettyCookedOpt :: PrettyCookedOpts -> Address -> DocCooked +prettyCookedOpt PrettyCookedOpts +opts (Pl.Address Credential +addrCr Maybe StakingCredential +Nothing) = PrettyCookedOpts -> Credential -> DocCooked forall a. PrettyCooked a => PrettyCookedOpts -> a -> DocCooked prettyCookedOpt PrettyCookedOpts -opts Credential -addrCr - prettyCookedOpt PrettyCookedOpts -opts (Pl.Address Credential -addrCr (Just (Pl.StakingHash Credential -stakCr))) = +opts Credential +addrCr + prettyCookedOpt PrettyCookedOpts +opts (Pl.Address Credential +addrCr (Just (Pl.StakingHash Credential +stakCr))) = PrettyCookedOpts -> Credential -> DocCooked forall a. PrettyCooked a => PrettyCookedOpts -> a -> DocCooked prettyCookedOpt PrettyCookedOpts -opts Credential -addrCr DocCooked -> DocCooked -> DocCooked +opts Credential +addrCr DocCooked -> DocCooked -> DocCooked forall ann. Doc ann -> Doc ann -> Doc ann -<+> DocCooked -> DocCooked +<+> DocCooked -> DocCooked forall ann. Doc ann -> Doc ann -PP.angles (DocCooked +PP.angles (DocCooked "staking:" DocCooked -> DocCooked -> DocCooked forall ann. Doc ann -> Doc ann -> Doc ann -<+> PrettyCookedOpts -> Credential -> DocCooked +<+> PrettyCookedOpts -> Credential -> DocCooked forall a. PrettyCooked a => PrettyCookedOpts -> a -> DocCooked prettyCookedOpt PrettyCookedOpts -opts Credential -stakCr) - prettyCookedOpt PrettyCookedOpts -opts (Pl.Address Credential -addrCr (Just (Pl.StakingPtr Integer -p1 Integer -p2 Integer -p3))) = +opts Credential +stakCr) + prettyCookedOpt PrettyCookedOpts +opts (Pl.Address Credential +addrCr (Just (Pl.StakingPtr Integer +p1 Integer +p2 Integer +p3))) = PrettyCookedOpts -> Credential -> DocCooked forall a. PrettyCooked a => PrettyCookedOpts -> a -> DocCooked prettyCookedOpt PrettyCookedOpts -opts Credential -addrCr DocCooked -> DocCooked -> DocCooked +opts Credential +addrCr DocCooked -> DocCooked -> DocCooked forall ann. Doc ann -> Doc ann -> Doc ann -<+> DocCooked -> DocCooked +<+> DocCooked -> DocCooked forall ann. Doc ann -> Doc ann -PP.angles (DocCooked +PP.angles (DocCooked "staking:" DocCooked -> DocCooked -> DocCooked forall ann. Doc ann -> Doc ann -> Doc ann -<+> (Integer, Integer, Integer) -> DocCooked +<+> (Integer, Integer, Integer) -> DocCooked forall a ann. Pretty a => a -> Doc ann -PP.pretty (Integer -p1, Integer -p2, Integer -p3)) +PP.pretty (Integer +p1, Integer +p2, Integer +p3)) -instance PrettyCooked Pl.PubKeyHash where +instance PrettyCooked Pl.PubKeyHash where -- If the pubkey is a known wallet -- #abcdef (wallet 3) -- -- Otherwise -- #123456 -- - prettyCookedOpt :: PrettyCookedOpts -> PubKeyHash -> DocCooked -prettyCookedOpt PrettyCookedOpts -opts PubKeyHash -pkh = + prettyCookedOpt :: PrettyCookedOpts -> PubKeyHash -> DocCooked +prettyCookedOpt PrettyCookedOpts +opts PubKeyHash +pkh = case PubKeyHash -> Maybe Int walletPKHashToId PubKeyHash -pkh of +pkh of Maybe Int -Nothing -> Int -> PubKeyHash -> DocCooked +Nothing -> Int -> PubKeyHash -> DocCooked forall a. Show a => Int -> a -> DocCooked prettyHash (PrettyCookedOpts -> Int pcOptPrintedHashLength PrettyCookedOpts -opts) PubKeyHash -pkh - Just Int -walletId -> +opts) PubKeyHash +pkh + Just Int +walletId -> Int -> PubKeyHash -> DocCooked forall a. Show a => Int -> a -> DocCooked prettyHash (PrettyCookedOpts -> Int pcOptPrintedHashLength PrettyCookedOpts -opts) PubKeyHash -pkh +opts) PubKeyHash +pkh DocCooked -> DocCooked -> DocCooked forall ann. Doc ann -> Doc ann -> Doc ann -<+> DocCooked -> DocCooked +<+> DocCooked -> DocCooked forall ann. Doc ann -> Doc ann -PP.parens (DocCooked +PP.parens (DocCooked "wallet" DocCooked -> DocCooked -> DocCooked forall ann. Doc ann -> Doc ann -> Doc ann -<+> Int -> DocCooked +<+> Int -> DocCooked forall a ann. Show a => a -> Doc ann -PP.viaShow Int -walletId) +PP.viaShow Int +walletId) -instance PrettyCooked Pl.Credential where - prettyCookedOpt :: PrettyCookedOpts -> Credential -> DocCooked -prettyCookedOpt PrettyCookedOpts -opts (Pl.ScriptCredential ValidatorHash -vh) = DocCooked +instance PrettyCooked Pl.Credential where + prettyCookedOpt :: PrettyCookedOpts -> Credential -> DocCooked +prettyCookedOpt PrettyCookedOpts +opts (Pl.ScriptCredential ValidatorHash +vh) = DocCooked "script" DocCooked -> DocCooked -> DocCooked forall ann. Doc ann -> Doc ann -> Doc ann -<+> Int -> ValidatorHash -> DocCooked +<+> Int -> ValidatorHash -> DocCooked forall a. Show a => Int -> a -> DocCooked prettyHash (PrettyCookedOpts -> Int pcOptPrintedHashLength PrettyCookedOpts -opts) ValidatorHash -vh - prettyCookedOpt PrettyCookedOpts -opts (Pl.PubKeyCredential PubKeyHash -pkh) = DocCooked +opts) ValidatorHash +vh + prettyCookedOpt PrettyCookedOpts +opts (Pl.PubKeyCredential PubKeyHash +pkh) = DocCooked "pubkey" DocCooked -> DocCooked -> DocCooked forall ann. Doc ann -> Doc ann -> Doc ann -<+> PrettyCookedOpts -> PubKeyHash -> DocCooked +<+> PrettyCookedOpts -> PubKeyHash -> DocCooked forall a. PrettyCooked a => PrettyCookedOpts -> a -> DocCooked prettyCookedOpt PrettyCookedOpts -opts PubKeyHash -pkh +opts PubKeyHash +pkh -instance PrettyCooked Pl.Value where +instance PrettyCooked Pl.Value where -- Example output: -- -- > Value: @@ -248,35 +248,35 @@ -- -- In case of an empty value (even though not an empty map): -- > Empty value - prettyCookedOpt :: PrettyCookedOpts -> Value -> DocCooked -prettyCookedOpt PrettyCookedOpts -opts = + prettyCookedOpt :: PrettyCookedOpts -> Value -> DocCooked +prettyCookedOpt PrettyCookedOpts +opts = [DocCooked] -> DocCooked -prettySingletons +prettySingletons ([DocCooked] -> DocCooked) -> (Value -> [DocCooked]) -> Value -> DocCooked forall b c a. (b -> c) -> (a -> b) -> a -> c -. ((CurrencySymbol, TokenName, Integer) -> DocCooked) +. ((CurrencySymbol, TokenName, Integer) -> DocCooked) -> [(CurrencySymbol, TokenName, Integer)] -> [DocCooked] forall a b. (a -> b) -> [a] -> [b] -map (CurrencySymbol, TokenName, Integer) -> DocCooked -prettySingletonValue +map (CurrencySymbol, TokenName, Integer) -> DocCooked +prettySingletonValue ([(CurrencySymbol, TokenName, Integer)] -> [DocCooked]) -> (Value -> [(CurrencySymbol, TokenName, Integer)]) -> Value -> [DocCooked] forall b c a. (b -> c) -> (a -> b) -> a -> c -. ((CurrencySymbol, TokenName, Integer) -> Bool) +. ((CurrencySymbol, TokenName, Integer) -> Bool) -> [(CurrencySymbol, TokenName, Integer)] -> [(CurrencySymbol, TokenName, Integer)] forall a. (a -> Bool) -> [a] -> [a] -filter (\(CurrencySymbol +filter (\(CurrencySymbol _, TokenName -_, Integer -n) -> Integer -n Integer -> Integer -> Bool +_, Integer +n) -> Integer +n Integer -> Integer -> Bool forall a. Eq a => a -> a -> Bool -/= Integer +/= Integer 0) ([(CurrencySymbol, TokenName, Integer)] -> [(CurrencySymbol, TokenName, Integer)]) @@ -284,280 +284,280 @@ -> Value -> [(CurrencySymbol, TokenName, Integer)] forall b c a. (b -> c) -> (a -> b) -> a -> c -. Value -> [(CurrencySymbol, TokenName, Integer)] -Pl.flattenValue +. Value -> [(CurrencySymbol, TokenName, Integer)] +Pl.flattenValue where - prettySingletons :: [DocCooked] -> DocCooked - prettySingletons :: [DocCooked] -> DocCooked -prettySingletons [] = DocCooked + prettySingletons :: [DocCooked] -> DocCooked + prettySingletons :: [DocCooked] -> DocCooked +prettySingletons [] = DocCooked "Empty value" - prettySingletons [DocCooked -doc] = DocCooked -doc - prettySingletons [DocCooked] -docs = DocCooked -> DocCooked -> [DocCooked] -> DocCooked + prettySingletons [DocCooked +doc] = DocCooked +doc + prettySingletons [DocCooked] +docs = DocCooked -> DocCooked -> [DocCooked] -> DocCooked prettyItemize DocCooked "Value:" DocCooked "-" [DocCooked] -docs - prettySingletonValue :: (Pl.CurrencySymbol, Pl.TokenName, Integer) -> DocCooked - prettySingletonValue :: (CurrencySymbol, TokenName, Integer) -> DocCooked -prettySingletonValue (CurrencySymbol -symbol, TokenName -name, Integer -amount) = +docs + prettySingletonValue :: (Pl.CurrencySymbol, Pl.TokenName, Integer) -> DocCooked + prettySingletonValue :: (CurrencySymbol, TokenName, Integer) -> DocCooked +prettySingletonValue (CurrencySymbol +symbol, TokenName +name, Integer +amount) = PrettyCookedOpts -> AssetClass -> DocCooked forall a. PrettyCooked a => PrettyCookedOpts -> a -> DocCooked prettyCookedOpt PrettyCookedOpts -opts ((CurrencySymbol, TokenName) -> AssetClass -Pl.AssetClass (CurrencySymbol -symbol, TokenName -name)) DocCooked -> DocCooked -> DocCooked +opts ((CurrencySymbol, TokenName) -> AssetClass +Pl.AssetClass (CurrencySymbol +symbol, TokenName +name)) DocCooked -> DocCooked -> DocCooked forall a. Semigroup a => a -> a -> a -<> DocCooked +<> DocCooked ":" DocCooked -> DocCooked -> DocCooked forall ann. Doc ann -> Doc ann -> Doc ann -<+> PrettyCookedOpts -> Integer -> DocCooked +<+> PrettyCookedOpts -> Integer -> DocCooked forall a. PrettyCooked a => PrettyCookedOpts -> a -> DocCooked prettyCookedOpt PrettyCookedOpts -opts Integer -amount +opts Integer +amount -instance PrettyCooked Pl.CurrencySymbol where - prettyCookedOpt :: PrettyCookedOpts -> CurrencySymbol -> DocCooked -prettyCookedOpt PrettyCookedOpts -opts CurrencySymbol -symbol +instance PrettyCooked Pl.CurrencySymbol where + prettyCookedOpt :: PrettyCookedOpts -> CurrencySymbol -> DocCooked +prettyCookedOpt PrettyCookedOpts +opts CurrencySymbol +symbol | CurrencySymbol -symbol CurrencySymbol -> CurrencySymbol -> Bool +symbol CurrencySymbol -> CurrencySymbol -> Bool forall a. Eq a => a -> a -> Bool -== BuiltinByteString -> CurrencySymbol -Pl.CurrencySymbol BuiltinByteString +== BuiltinByteString -> CurrencySymbol +Pl.CurrencySymbol BuiltinByteString "" = DocCooked "Lovelace" | CurrencySymbol -symbol CurrencySymbol -> CurrencySymbol -> Bool +symbol CurrencySymbol -> CurrencySymbol -> Bool forall a. Eq a => a -> a -> Bool -== CurrencySymbol +== CurrencySymbol quickCurrencySymbol = DocCooked "Quick" | CurrencySymbol -symbol CurrencySymbol -> CurrencySymbol -> Bool +symbol CurrencySymbol -> CurrencySymbol -> Bool forall a. Eq a => a -> a -> Bool -== CurrencySymbol +== CurrencySymbol permanentCurrencySymbol = DocCooked "Permanent" | Bool -otherwise = Int -> CurrencySymbol -> DocCooked +otherwise = Int -> CurrencySymbol -> DocCooked forall a. Show a => Int -> a -> DocCooked prettyHash (PrettyCookedOpts -> Int pcOptPrintedHashLength PrettyCookedOpts -opts) CurrencySymbol -symbol +opts) CurrencySymbol +symbol -instance PrettyCooked Pl.TokenName where - prettyCookedOpt :: PrettyCookedOpts -> TokenName -> DocCooked -prettyCookedOpt PrettyCookedOpts +instance PrettyCooked Pl.TokenName where + prettyCookedOpt :: PrettyCookedOpts -> TokenName -> DocCooked +prettyCookedOpt PrettyCookedOpts _ = TokenName -> DocCooked forall a ann. Pretty a => a -> Doc ann -PP.pretty +PP.pretty -instance PrettyCooked Pl.AssetClass where - prettyCookedOpt :: PrettyCookedOpts -> AssetClass -> DocCooked -prettyCookedOpt PrettyCookedOpts -opts (Pl.AssetClass (CurrencySymbol -symbol, TokenName -name)) = +instance PrettyCooked Pl.AssetClass where + prettyCookedOpt :: PrettyCookedOpts -> AssetClass -> DocCooked +prettyCookedOpt PrettyCookedOpts +opts (Pl.AssetClass (CurrencySymbol +symbol, TokenName +name)) = PrettyCookedOpts -> CurrencySymbol -> DocCooked forall a. PrettyCooked a => PrettyCookedOpts -> a -> DocCooked prettyCookedOpt PrettyCookedOpts -opts CurrencySymbol -symbol +opts CurrencySymbol +symbol DocCooked -> DocCooked -> DocCooked forall ann. Doc ann -> Doc ann -> Doc ann -<+> if CurrencySymbol -symbol CurrencySymbol -> CurrencySymbol -> Bool +<+> if CurrencySymbol +symbol CurrencySymbol -> CurrencySymbol -> Bool forall a. Eq a => a -> a -> Bool -/= BuiltinByteString -> CurrencySymbol -Pl.CurrencySymbol BuiltinByteString +/= BuiltinByteString -> CurrencySymbol +Pl.CurrencySymbol BuiltinByteString "" then PrettyCookedOpts -> TokenName -> DocCooked forall a. PrettyCooked a => PrettyCookedOpts -> a -> DocCooked prettyCookedOpt PrettyCookedOpts -opts TokenName -name +opts TokenName +name else DocCooked forall a. Monoid a => a -mempty +mempty -instance PrettyCooked Pl.ValidationErrorInPhase where +instance PrettyCooked Pl.ValidationErrorInPhase where -- In Plutus V2, most errors no longer have dedicated constructors we can -- pattern match on, they are mostly wrapped as text which makes it difficult -- to improve upon default printing. - prettyCookedOpt :: PrettyCookedOpts -> ValidationErrorInPhase -> DocCooked -prettyCookedOpt PrettyCookedOpts + prettyCookedOpt :: PrettyCookedOpts -> ValidationErrorInPhase -> DocCooked +prettyCookedOpt PrettyCookedOpts _ = ValidationErrorInPhase -> DocCooked forall a ann. Pretty a => a -> Doc ann -PP.pretty +PP.pretty -instance PrettyCooked Pl.POSIXTime where - prettyCookedOpt :: PrettyCookedOpts -> POSIXTime -> DocCooked -prettyCookedOpt PrettyCookedOpts -opts (Pl.POSIXTime Integer -n) = DocCooked +instance PrettyCooked Pl.POSIXTime where + prettyCookedOpt :: PrettyCookedOpts -> POSIXTime -> DocCooked +prettyCookedOpt PrettyCookedOpts +opts (Pl.POSIXTime Integer +n) = DocCooked "POSIXTime" DocCooked -> DocCooked -> DocCooked forall ann. Doc ann -> Doc ann -> Doc ann -<+> PrettyCookedOpts -> Integer -> DocCooked +<+> PrettyCookedOpts -> Integer -> DocCooked forall a. PrettyCooked a => PrettyCookedOpts -> a -> DocCooked prettyCookedOpt PrettyCookedOpts -opts Integer -n +opts Integer +n -instance PrettyCooked Pl.ScriptHash where - prettyCookedOpt :: PrettyCookedOpts -> ScriptHash -> DocCooked -prettyCookedOpt PrettyCookedOpts -opts = Int -> ScriptHash -> DocCooked +instance PrettyCooked Pl.ScriptHash where + prettyCookedOpt :: PrettyCookedOpts -> ScriptHash -> DocCooked +prettyCookedOpt PrettyCookedOpts +opts = Int -> ScriptHash -> DocCooked forall a. Show a => Int -> a -> DocCooked prettyHash (PrettyCookedOpts -> Int pcOptPrintedHashLength PrettyCookedOpts -opts) +opts) -instance PrettyCooked a => PrettyCooked [a] where - prettyCookedOpt :: PrettyCookedOpts -> [a] -> DocCooked -prettyCookedOpt PrettyCookedOpts -opts = DocCooked -> [DocCooked] -> DocCooked +instance (PrettyCooked a) => PrettyCooked [a] where + prettyCookedOpt :: PrettyCookedOpts -> [a] -> DocCooked +prettyCookedOpt PrettyCookedOpts +opts = DocCooked -> [DocCooked] -> DocCooked prettyItemizeNoTitle DocCooked "-" ([DocCooked] -> DocCooked) -> ([a] -> [DocCooked]) -> [a] -> DocCooked forall b c a. (b -> c) -> (a -> b) -> a -> c -. (a -> DocCooked) -> [a] -> [DocCooked] +. (a -> DocCooked) -> [a] -> [DocCooked] forall a b. (a -> b) -> [a] -> [b] -map (PrettyCookedOpts -> a -> DocCooked +map (PrettyCookedOpts -> a -> DocCooked forall a. PrettyCooked a => PrettyCookedOpts -> a -> DocCooked prettyCookedOpt PrettyCookedOpts -opts) +opts) -instance PrettyCooked Int where - prettyCookedOpt :: PrettyCookedOpts -> Int -> DocCooked -prettyCookedOpt PrettyCookedOpts +instance PrettyCooked Int where + prettyCookedOpt :: PrettyCookedOpts -> Int -> DocCooked +prettyCookedOpt PrettyCookedOpts _ = Int -> DocCooked forall a ann. Pretty a => a -> Doc ann -PP.pretty +PP.pretty -instance PrettyCooked Integer where - prettyCookedOpt :: PrettyCookedOpts -> Integer -> DocCooked -prettyCookedOpt PrettyCookedOpts -opts = +instance PrettyCooked Integer where + prettyCookedOpt :: PrettyCookedOpts -> Integer -> DocCooked +prettyCookedOpt PrettyCookedOpts +opts = if PrettyCookedOpts -> Bool pcOptNumericUnderscores PrettyCookedOpts -opts +opts then Integer -> DocCooked -prettyNumericUnderscore +prettyNumericUnderscore else Integer -> DocCooked forall a ann. Pretty a => a -> Doc ann -PP.pretty +PP.pretty where -- prettyNumericUnderscore 23798423723 -- 23_798_423_723 - prettyNumericUnderscore :: Integer -> DocCooked - prettyNumericUnderscore :: Integer -> DocCooked -prettyNumericUnderscore Integer -i + prettyNumericUnderscore :: Integer -> DocCooked + prettyNumericUnderscore :: Integer -> DocCooked +prettyNumericUnderscore Integer +i | Integer 0 Integer -> Integer -> Bool forall a. Eq a => a -> a -> Bool -== Integer -i = DocCooked +== Integer +i = DocCooked "0" | Integer -i Integer -> Integer -> Bool +i Integer -> Integer -> Bool forall a. Ord a => a -> a -> Bool -> Integer +> Integer 0 = DocCooked -> Integer -> Integer -> DocCooked -psnTerm DocCooked +psnTerm DocCooked "" Integer 0 Integer -i +i | Bool -otherwise = DocCooked +otherwise = DocCooked "-" DocCooked -> DocCooked -> DocCooked forall a. Semigroup a => a -> a -> a -<> DocCooked -> Integer -> Integer -> DocCooked -psnTerm DocCooked +<> DocCooked -> Integer -> Integer -> DocCooked +psnTerm DocCooked "" Integer 0 (-Integer -i) +i) where - psnTerm :: DocCooked -> Integer -> Integer -> DocCooked - psnTerm :: DocCooked -> Integer -> Integer -> DocCooked -psnTerm DocCooked -acc Integer + psnTerm :: DocCooked -> Integer -> Integer -> DocCooked + psnTerm :: DocCooked -> Integer -> Integer -> DocCooked +psnTerm DocCooked +acc Integer _ Integer 0 = DocCooked -acc - psnTerm DocCooked -acc Integer -3 Integer -nb = DocCooked -> Integer -> Integer -> DocCooked -psnTerm (Integer -> DocCooked +acc + psnTerm DocCooked +acc Integer +3 Integer +nb = DocCooked -> Integer -> Integer -> DocCooked +psnTerm (Integer -> DocCooked forall a ann. Pretty a => a -> Doc ann -PP.pretty (Integer -nb Integer -> Integer -> Integer +PP.pretty (Integer +nb Integer -> Integer -> Integer forall a. Integral a => a -> a -> a -`mod` Integer +`mod` Integer 10) DocCooked -> DocCooked -> DocCooked forall a. Semigroup a => a -> a -> a -<> DocCooked +<> DocCooked "_" DocCooked -> DocCooked -> DocCooked forall a. Semigroup a => a -> a -> a -<> DocCooked -acc) Integer +<> DocCooked +acc) Integer 1 (Integer -nb Integer -> Integer -> Integer +nb Integer -> Integer -> Integer forall a. Integral a => a -> a -> a -`div` Integer +`div` Integer 10) - psnTerm DocCooked -acc Integer -n Integer -nb = DocCooked -> Integer -> Integer -> DocCooked -psnTerm (Integer -> DocCooked + psnTerm DocCooked +acc Integer +n Integer +nb = DocCooked -> Integer -> Integer -> DocCooked +psnTerm (Integer -> DocCooked forall a ann. Pretty a => a -> Doc ann -PP.pretty (Integer -nb Integer -> Integer -> Integer +PP.pretty (Integer +nb Integer -> Integer -> Integer forall a. Integral a => a -> a -> a -`mod` Integer +`mod` Integer 10) DocCooked -> DocCooked -> DocCooked forall a. Semigroup a => a -> a -> a -<> DocCooked -acc) (Integer -n Integer -> Integer -> Integer +<> DocCooked +acc) (Integer +n Integer -> Integer -> Integer forall a. Num a => a -> a -> a -+ Integer ++ Integer 1) (Integer -nb Integer -> Integer -> Integer +nb Integer -> Integer -> Integer forall a. Integral a => a -> a -> a -`div` Integer +`div` Integer 10) -instance PrettyCooked Bool where - prettyCookedOpt :: PrettyCookedOpts -> Bool -> DocCooked -prettyCookedOpt PrettyCookedOpts +instance PrettyCooked Bool where + prettyCookedOpt :: PrettyCookedOpts -> Bool -> DocCooked +prettyCookedOpt PrettyCookedOpts _ = Bool -> DocCooked forall a ann. Pretty a => a -> Doc ann -PP.pretty +PP.pretty -instance PrettyCooked () where - prettyCookedOpt :: PrettyCookedOpts -> () -> DocCooked -prettyCookedOpt PrettyCookedOpts +instance PrettyCooked () where + prettyCookedOpt :: PrettyCookedOpts -> () -> DocCooked +prettyCookedOpt PrettyCookedOpts _ = () -> DocCooked forall a ann. Pretty a => a -> Doc ann -PP.pretty +PP.pretty -instance PrettyCooked Pl.BuiltinData where - prettyCookedOpt :: PrettyCookedOpts -> BuiltinData -> DocCooked -prettyCookedOpt PrettyCookedOpts +instance PrettyCooked Pl.BuiltinData where + prettyCookedOpt :: PrettyCookedOpts -> BuiltinData -> DocCooked +prettyCookedOpt PrettyCookedOpts _ = BuiltinData -> DocCooked forall a ann. Pretty a => a -> Doc ann -PP.pretty +PP.pretty \ No newline at end of file diff --git a/src/Cooked.Pretty.Common.html b/src/Cooked.Pretty.Common.html index dcba4bbb2..821fbba4b 100644 --- a/src/Cooked.Pretty.Common.html +++ b/src/Cooked.Pretty.Common.html @@ -12,31 +12,31 @@ ) where -import Prettyprinter (Doc, (<+>)) -import qualified Prettyprinter as PP -import qualified Prettyprinter.Render.String as PP +import Prettyprinter (Doc, (<+>)) +import qualified Prettyprinter as PP +import qualified Prettyprinter.Render.String as PP -type DocCooked = Doc () +type DocCooked = Doc () -- | Use this to convert a pretty-printer to a regular show function using -- default layout options. This is used in "Testing" because Tasty uses -- strings. -renderString :: (a -> DocCooked) -> a -> String +renderString :: (a -> DocCooked) -> a -> String renderString :: (a -> DocCooked) -> a -> String -renderString a -> DocCooked -printer = SimpleDocStream () -> String +renderString a -> DocCooked +printer = SimpleDocStream () -> String forall ann. SimpleDocStream ann -> String -PP.renderString (SimpleDocStream () -> String) +PP.renderString (SimpleDocStream () -> String) -> (a -> SimpleDocStream ()) -> a -> String forall b c a. (b -> c) -> (a -> b) -> a -> c -. LayoutOptions -> DocCooked -> SimpleDocStream () +. LayoutOptions -> DocCooked -> SimpleDocStream () forall ann. LayoutOptions -> Doc ann -> SimpleDocStream ann -PP.layoutPretty LayoutOptions -PP.defaultLayoutOptions (DocCooked -> SimpleDocStream ()) +PP.layoutPretty LayoutOptions +PP.defaultLayoutOptions (DocCooked -> SimpleDocStream ()) -> (a -> DocCooked) -> a -> SimpleDocStream () forall b c a. (b -> c) -> (a -> b) -> a -> c -. a -> DocCooked -printer +. a -> DocCooked +printer -- | Print an item list with a title. -- @@ -47,126 +47,126 @@ -- - bar3 prettyItemize :: DocCooked -> DocCooked -> [DocCooked] -> DocCooked prettyItemize :: DocCooked -> DocCooked -> [DocCooked] -> DocCooked -prettyItemize DocCooked -title DocCooked -bullet [DocCooked] -items = +prettyItemize DocCooked +title DocCooked +bullet [DocCooked] +items = [DocCooked] -> DocCooked forall ann. [Doc ann] -> Doc ann -PP.vsep +PP.vsep [ DocCooked -title, +title, Int -> DocCooked -> DocCooked forall ann. Int -> Doc ann -> Doc ann -PP.indent Int +PP.indent Int 2 (DocCooked -> DocCooked) -> ([DocCooked] -> DocCooked) -> [DocCooked] -> DocCooked forall b c a. (b -> c) -> (a -> b) -> a -> c -. DocCooked -> [DocCooked] -> DocCooked +. DocCooked -> [DocCooked] -> DocCooked prettyItemizeNoTitle DocCooked -bullet ([DocCooked] -> DocCooked) -> [DocCooked] -> DocCooked +bullet ([DocCooked] -> DocCooked) -> [DocCooked] -> DocCooked forall a b. (a -> b) -> a -> b -$ [DocCooked] -items +$ [DocCooked] +items ] prettyItemizeNoTitle :: DocCooked -> [DocCooked] -> DocCooked prettyItemizeNoTitle :: DocCooked -> [DocCooked] -> DocCooked -prettyItemizeNoTitle DocCooked -bullet = [DocCooked] -> DocCooked +prettyItemizeNoTitle DocCooked +bullet = [DocCooked] -> DocCooked forall ann. [Doc ann] -> Doc ann -PP.vsep ([DocCooked] -> DocCooked) +PP.vsep ([DocCooked] -> DocCooked) -> ([DocCooked] -> [DocCooked]) -> [DocCooked] -> DocCooked forall b c a. (b -> c) -> (a -> b) -> a -> c -. (DocCooked -> DocCooked) -> [DocCooked] -> [DocCooked] +. (DocCooked -> DocCooked) -> [DocCooked] -> [DocCooked] forall a b. (a -> b) -> [a] -> [b] -map (DocCooked -bullet DocCooked -> DocCooked -> DocCooked +map (DocCooked +bullet DocCooked -> DocCooked -> DocCooked forall ann. Doc ann -> Doc ann -> Doc ann -<+>) +<+>) -prettyItemizeNonEmpty :: DocCooked -> DocCooked -> [DocCooked] -> Maybe DocCooked +prettyItemizeNonEmpty :: DocCooked -> DocCooked -> [DocCooked] -> Maybe DocCooked prettyItemizeNonEmpty :: DocCooked -> DocCooked -> [DocCooked] -> Maybe DocCooked prettyItemizeNonEmpty DocCooked _ DocCooked _ [] = Maybe DocCooked forall a. Maybe a -Nothing -prettyItemizeNonEmpty DocCooked -title DocCooked -bullet [DocCooked] -items = DocCooked -> Maybe DocCooked +Nothing +prettyItemizeNonEmpty DocCooked +title DocCooked +bullet [DocCooked] +items = DocCooked -> Maybe DocCooked forall a. a -> Maybe a -Just (DocCooked -> Maybe DocCooked) -> DocCooked -> Maybe DocCooked +Just (DocCooked -> Maybe DocCooked) -> DocCooked -> Maybe DocCooked forall a b. (a -> b) -> a -> b -$ DocCooked -> DocCooked -> [DocCooked] -> DocCooked +$ DocCooked -> DocCooked -> [DocCooked] -> DocCooked prettyItemize DocCooked -title DocCooked -bullet [DocCooked] -items +title DocCooked +bullet [DocCooked] +items prettyEnumerate :: DocCooked -> DocCooked -> [DocCooked] -> DocCooked prettyEnumerate :: DocCooked -> DocCooked -> [DocCooked] -> DocCooked -prettyEnumerate DocCooked -title DocCooked -bullet [DocCooked] -items = +prettyEnumerate DocCooked +title DocCooked +bullet [DocCooked] +items = [DocCooked] -> DocCooked forall ann. [Doc ann] -> Doc ann -PP.vsep +PP.vsep [ DocCooked -title, +title, Int -> DocCooked -> DocCooked forall ann. Int -> Doc ann -> Doc ann -PP.indent Int +PP.indent Int 2 (DocCooked -> DocCooked) -> ([DocCooked] -> DocCooked) -> [DocCooked] -> DocCooked forall b c a. (b -> c) -> (a -> b) -> a -> c -. [DocCooked] -> DocCooked +. [DocCooked] -> DocCooked forall ann. [Doc ann] -> Doc ann -PP.vsep ([DocCooked] -> DocCooked) -> [DocCooked] -> DocCooked +PP.vsep ([DocCooked] -> DocCooked) -> [DocCooked] -> DocCooked forall a b. (a -> b) -> a -> b -$ +$ (Int -> DocCooked -> DocCooked) -> [Int] -> [DocCooked] -> [DocCooked] forall a b c. (a -> b -> c) -> [a] -> [b] -> [c] -zipWith (\Int -index DocCooked -item -> Int -> DocCooked +zipWith (\Int +index DocCooked +item -> Int -> DocCooked forall a ann. Pretty a => a -> Doc ann -PP.pretty Int -index DocCooked -> DocCooked -> DocCooked +PP.pretty Int +index DocCooked -> DocCooked -> DocCooked forall a. Semigroup a => a -> a -> a -<> DocCooked -bullet DocCooked -> DocCooked -> DocCooked +<> DocCooked +bullet DocCooked -> DocCooked -> DocCooked forall ann. Doc ann -> Doc ann -> Doc ann -<+> DocCooked -> DocCooked +<+> DocCooked -> DocCooked forall ann. Doc ann -> Doc ann -PP.align DocCooked -item) [Int -1 :: Int ..] [DocCooked] -items +PP.align DocCooked +item) [Int +1 :: Int ..] [DocCooked] +items ] -- | Pretty print a prefix of a hash with a given length. -prettyHash :: (Show a) => Int -> a -> DocCooked +prettyHash :: (Show a) => Int -> a -> DocCooked prettyHash :: Int -> a -> DocCooked -prettyHash Int -printedLength = String -> DocCooked +prettyHash Int +printedLength = String -> DocCooked forall a ann. Pretty a => a -> Doc ann -PP.pretty (String -> DocCooked) -> (a -> String) -> a -> DocCooked +PP.pretty (String -> DocCooked) -> (a -> String) -> a -> DocCooked forall b c a. (b -> c) -> (a -> b) -> a -> c -. (Char +. (Char '#' Char -> String -> String forall a. a -> [a] -> [a] -:) (String -> String) -> (a -> String) -> a -> String +:) (String -> String) -> (a -> String) -> a -> String forall b c a. (b -> c) -> (a -> b) -> a -> c -. Int -> String -> String +. Int -> String -> String forall a. Int -> [a] -> [a] -take Int -printedLength (String -> String) -> (a -> String) -> a -> String +take Int +printedLength (String -> String) -> (a -> String) -> a -> String forall b c a. (b -> c) -> (a -> b) -> a -> c -. a -> String +. a -> String forall a. Show a => a -> String -show +show \ No newline at end of file diff --git a/src/Cooked.Pretty.Cooked.html b/src/Cooked.Pretty.Cooked.html index 57c9d4f3d..c00f8a5cf 100644 --- a/src/Cooked.Pretty.Cooked.html +++ b/src/Cooked.Pretty.Cooked.html @@ -44,73 +44,73 @@ import Cooked.Pretty.Options import Cooked.Skeleton import Cooked.Wallet -import Data.Default -import Data.Function (on) -import qualified Data.List as List -import qualified Data.Map as Map -import Data.Maybe (catMaybes, mapMaybe) -import qualified Data.Set as Set -import Optics.Core -import qualified Plutus.Script.Utils.Ada as Ada -import qualified Plutus.Script.Utils.Scripts as Pl -import qualified Plutus.Script.Utils.Value as Pl -import qualified Plutus.V2.Ledger.Api as Pl -import Prettyprinter ((<+>)) -import qualified Prettyprinter as PP +import Data.Default +import Data.Function (on) +import qualified Data.List as List +import qualified Data.Map as Map +import Data.Maybe (catMaybes, mapMaybe) +import qualified Data.Set as Set +import Optics.Core +import qualified Plutus.Script.Utils.Ada as Ada +import qualified Plutus.Script.Utils.Scripts as Pl +import qualified Plutus.Script.Utils.Value as Pl +import qualified Plutus.V2.Ledger.Api as Pl +import Prettyprinter ((<+>)) +import qualified Prettyprinter as PP -- | The 'PrettyCooked' instance for 'TxSkelOutDatum' prints the datum it -- contains according to its own 'PrettyCooked' instance. -instance PrettyCooked TxSkelOutDatum where - prettyCookedOpt :: PrettyCookedOpts -> TxSkelOutDatum -> DocCooked +instance PrettyCooked TxSkelOutDatum where + prettyCookedOpt :: PrettyCookedOpts -> TxSkelOutDatum -> DocCooked prettyCookedOpt PrettyCookedOpts _ TxSkelOutDatum TxSkelOutNoDatum = DocCooked forall a. Monoid a => a -mempty - prettyCookedOpt PrettyCookedOpts -opts (TxSkelOutDatumHash a -datum) = PrettyCookedOpts -> a -> DocCooked +mempty + prettyCookedOpt PrettyCookedOpts +opts (TxSkelOutDatumHash a +datum) = PrettyCookedOpts -> a -> DocCooked forall a. PrettyCooked a => PrettyCookedOpts -> a -> DocCooked prettyCookedOpt PrettyCookedOpts -opts a -datum - prettyCookedOpt PrettyCookedOpts -opts (TxSkelOutDatum a -datum) = PrettyCookedOpts -> a -> DocCooked +opts a +datum + prettyCookedOpt PrettyCookedOpts +opts (TxSkelOutDatum a +datum) = PrettyCookedOpts -> a -> DocCooked forall a. PrettyCooked a => PrettyCookedOpts -> a -> DocCooked prettyCookedOpt PrettyCookedOpts -opts a -datum - prettyCookedOpt PrettyCookedOpts -opts (TxSkelOutInlineDatum a -datum) = PrettyCookedOpts -> a -> DocCooked +opts a +datum + prettyCookedOpt PrettyCookedOpts +opts (TxSkelOutInlineDatum a +datum) = PrettyCookedOpts -> a -> DocCooked forall a. PrettyCooked a => PrettyCookedOpts -> a -> DocCooked prettyCookedOpt PrettyCookedOpts -opts a -datum +opts a +datum -instance PrettyCooked MockChainError where - prettyCookedOpt :: PrettyCookedOpts -> MockChainError -> DocCooked -prettyCookedOpt PrettyCookedOpts -opts (MCEValidationError ValidationErrorInPhase -plutusError) = +instance PrettyCooked MockChainError where + prettyCookedOpt :: PrettyCookedOpts -> MockChainError -> DocCooked +prettyCookedOpt PrettyCookedOpts +opts (MCEValidationError ValidationErrorInPhase +plutusError) = [DocCooked] -> DocCooked forall ann. [Doc ann] -> Doc ann -PP.vsep [DocCooked +PP.vsep [DocCooked "Validation error", Int -> DocCooked -> DocCooked forall ann. Int -> Doc ann -> Doc ann -PP.indent Int +PP.indent Int 2 (PrettyCookedOpts -> ValidationErrorInPhase -> DocCooked forall a. PrettyCooked a => PrettyCookedOpts -> a -> DocCooked prettyCookedOpt PrettyCookedOpts -opts ValidationErrorInPhase -plutusError)] +opts ValidationErrorInPhase +plutusError)] -- Here we don't print the skel because we lack its context and this error is -- printed alongside the skeleton when a test fails - prettyCookedOpt PrettyCookedOpts -opts (MCEUnbalanceable (MCEUnbalNotEnoughFunds Wallet -balWallet Value -targetValue) TxSkel + prettyCookedOpt PrettyCookedOpts +opts (MCEUnbalanceable (MCEUnbalNotEnoughFunds Wallet +balWallet Value +targetValue) TxSkel _) = DocCooked -> DocCooked -> [DocCooked] -> DocCooked prettyItemize @@ -121,28 +121,28 @@ [ PrettyCookedOpts -> PubKeyHash -> DocCooked forall a. PrettyCooked a => PrettyCookedOpts -> a -> DocCooked prettyCookedOpt PrettyCookedOpts -opts (Wallet -> PubKeyHash +opts (Wallet -> PubKeyHash walletPKHash Wallet -balWallet) DocCooked -> DocCooked -> DocCooked +balWallet) DocCooked -> DocCooked -> DocCooked forall ann. Doc ann -> Doc ann -> Doc ann -<+> DocCooked +<+> DocCooked "has not enough funds", DocCooked "Required payment is" DocCooked -> DocCooked -> DocCooked forall ann. Doc ann -> Doc ann -> Doc ann -<+> PrettyCookedOpts -> Value -> DocCooked +<+> PrettyCookedOpts -> Value -> DocCooked forall a. PrettyCooked a => PrettyCookedOpts -> a -> DocCooked prettyCookedOpt PrettyCookedOpts -opts Value -targetValue +opts Value +targetValue ] - prettyCookedOpt PrettyCookedOpts -opts (MCEUnbalanceable (MCEUnbalNotEnoughReturning (Value -spentValue, [TxOutRef] -spentTxOuts) (Value -remainingValue, [TxOutRef] -remainingTxOuts) Value -returnValue) TxSkel + prettyCookedOpt PrettyCookedOpts +opts (MCEUnbalanceable (MCEUnbalNotEnoughReturning (Value +spentValue, [TxOutRef] +spentTxOuts) (Value +remainingValue, [TxOutRef] +remainingTxOuts) Value +returnValue) TxSkel _) = DocCooked -> DocCooked -> [DocCooked] -> DocCooked prettyItemize @@ -154,11 +154,11 @@ "Value to return is below the min ada per UTxO:" DocCooked -> DocCooked -> DocCooked forall ann. Doc ann -> Doc ann -> Doc ann -<+> PrettyCookedOpts -> Value -> DocCooked +<+> PrettyCookedOpts -> Value -> DocCooked forall a. PrettyCooked a => PrettyCookedOpts -> a -> DocCooked prettyCookedOpt PrettyCookedOpts -opts Value -returnValue, +opts Value +returnValue, DocCooked -> DocCooked -> [DocCooked] -> DocCooked prettyItemize DocCooked @@ -168,8 +168,8 @@ [ PrettyCookedOpts -> Value -> DocCooked forall a. PrettyCooked a => PrettyCookedOpts -> a -> DocCooked prettyCookedOpt PrettyCookedOpts -opts Value -spentValue, +opts Value +spentValue, DocCooked -> DocCooked -> [DocCooked] -> DocCooked prettyItemize DocCooked @@ -179,10 +179,10 @@ (PrettyCookedOpts -> TxOutRef -> DocCooked forall a. PrettyCooked a => PrettyCookedOpts -> a -> DocCooked prettyCookedOpt PrettyCookedOpts -opts (TxOutRef -> DocCooked) -> [TxOutRef] -> [DocCooked] +opts (TxOutRef -> DocCooked) -> [TxOutRef] -> [DocCooked] forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b -<$> [TxOutRef] -spentTxOuts) +<$> [TxOutRef] +spentTxOuts) ], DocCooked -> DocCooked -> [DocCooked] -> DocCooked prettyItemize @@ -193,8 +193,8 @@ [ PrettyCookedOpts -> Value -> DocCooked forall a. PrettyCooked a => PrettyCookedOpts -> a -> DocCooked prettyCookedOpt PrettyCookedOpts -opts Value -remainingValue, +opts Value +remainingValue, DocCooked -> DocCooked -> [DocCooked] -> DocCooked prettyItemize DocCooked @@ -204,10 +204,10 @@ (PrettyCookedOpts -> TxOutRef -> DocCooked forall a. PrettyCooked a => PrettyCookedOpts -> a -> DocCooked prettyCookedOpt PrettyCookedOpts -opts (TxOutRef -> DocCooked) -> [TxOutRef] -> [DocCooked] +opts (TxOutRef -> DocCooked) -> [TxOutRef] -> [DocCooked] forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b -<$> [TxOutRef] -remainingTxOuts) +<$> [TxOutRef] +remainingTxOuts) ] ] prettyCookedOpt PrettyCookedOpts @@ -216,9 +216,9 @@ DocCooked "No suitable collateral" prettyCookedOpt PrettyCookedOpts -_ (MCEGenerationError (ToCardanoError String -msg ToCardanoError -cardanoError)) = +_ (MCEGenerationError (ToCardanoError String +msg ToCardanoError +cardanoError)) = DocCooked -> DocCooked -> [DocCooked] -> DocCooked prettyItemize DocCooked @@ -227,14 +227,14 @@ "-" [String -> DocCooked forall a ann. Pretty a => a -> Doc ann -PP.pretty String -msg, ToCardanoError -> DocCooked +PP.pretty String +msg, ToCardanoError -> DocCooked forall a ann. Pretty a => a -> Doc ann -PP.pretty ToCardanoError -cardanoError] +PP.pretty ToCardanoError +cardanoError] prettyCookedOpt PrettyCookedOpts -_ (MCEGenerationError (GenerateTxErrorGeneral String -msg)) = +_ (MCEGenerationError (GenerateTxErrorGeneral String +msg)) = DocCooked -> DocCooked -> [DocCooked] -> DocCooked prettyItemize DocCooked @@ -243,12 +243,12 @@ "-" [String -> DocCooked forall a ann. Pretty a => a -> Doc ann -PP.pretty String -msg] +PP.pretty String +msg] prettyCookedOpt PrettyCookedOpts -_ (MCEGenerationError (TxBodyError String -msg TxBodyError -err)) = +_ (MCEGenerationError (TxBodyError String +msg TxBodyError +err)) = DocCooked -> DocCooked -> [DocCooked] -> DocCooked prettyItemize DocCooked @@ -257,29 +257,29 @@ "-" [String -> DocCooked forall a ann. Pretty a => a -> Doc ann -PP.pretty String -msg, TxBodyError -> DocCooked +PP.pretty String +msg, TxBodyError -> DocCooked forall a ann. Show a => a -> Doc ann -PP.viaShow TxBodyError -err] - prettyCookedOpt PrettyCookedOpts -opts (MCECalcFee MockChainError -err) = +PP.viaShow TxBodyError +err] + prettyCookedOpt PrettyCookedOpts +opts (MCECalcFee MockChainError +err) = [DocCooked] -> DocCooked forall ann. [Doc ann] -> Doc ann -PP.vsep [DocCooked +PP.vsep [DocCooked "Fee calculation error:", Int -> DocCooked -> DocCooked forall ann. Int -> Doc ann -> Doc ann -PP.indent Int +PP.indent Int 2 (PrettyCookedOpts -> MockChainError -> DocCooked forall a. PrettyCooked a => PrettyCookedOpts -> a -> DocCooked prettyCookedOpt PrettyCookedOpts -opts MockChainError -err)] - prettyCookedOpt PrettyCookedOpts -opts (MCEUnknownOutRefError String -msg TxOutRef -txOutRef) = +opts MockChainError +err)] + prettyCookedOpt PrettyCookedOpts +opts (MCEUnknownOutRefError String +msg TxOutRef +txOutRef) = DocCooked -> DocCooked -> [DocCooked] -> DocCooked prettyItemize DocCooked @@ -288,26 +288,26 @@ "-" [String -> DocCooked forall a ann. Pretty a => a -> Doc ann -PP.pretty String -msg, PrettyCookedOpts -> TxOutRef -> DocCooked +PP.pretty String +msg, PrettyCookedOpts -> TxOutRef -> DocCooked forall a. PrettyCooked a => PrettyCookedOpts -> a -> DocCooked prettyCookedOpt PrettyCookedOpts -opts TxOutRef -txOutRef] +opts TxOutRef +txOutRef] prettyCookedOpt PrettyCookedOpts -_ (FailWith String -msg) = +_ (FailWith String +msg) = DocCooked "Failed with:" DocCooked -> DocCooked -> DocCooked forall ann. Doc ann -> Doc ann -> Doc ann -<+> String -> DocCooked +<+> String -> DocCooked forall a ann. Pretty a => a -> Doc ann -PP.pretty String -msg - prettyCookedOpt PrettyCookedOpts -opts (MCEUnknownValidator String -msg ValidatorHash -valHash) = +PP.pretty String +msg + prettyCookedOpt PrettyCookedOpts +opts (MCEUnknownValidator String +msg ValidatorHash +valHash) = DocCooked -> DocCooked -> [DocCooked] -> DocCooked prettyItemize DocCooked @@ -316,20 +316,20 @@ "-" [String -> DocCooked forall a ann. Pretty a => a -> Doc ann -PP.pretty String -msg, DocCooked +PP.pretty String +msg, DocCooked "hash:" DocCooked -> DocCooked -> DocCooked forall ann. Doc ann -> Doc ann -> Doc ann -<+> Int -> ValidatorHash -> DocCooked +<+> Int -> ValidatorHash -> DocCooked forall a. Show a => Int -> a -> DocCooked prettyHash (PrettyCookedOpts -> Int pcOptPrintedHashLength PrettyCookedOpts -opts) ValidatorHash -valHash] - prettyCookedOpt PrettyCookedOpts -opts (MCEUnknownDatum String -msg DatumHash -dHash) = +opts) ValidatorHash +valHash] + prettyCookedOpt PrettyCookedOpts +opts (MCEUnknownDatum String +msg DatumHash +dHash) = DocCooked -> DocCooked -> [DocCooked] -> DocCooked prettyItemize DocCooked @@ -338,19 +338,19 @@ "-" [String -> DocCooked forall a ann. Pretty a => a -> Doc ann -PP.pretty String -msg, DocCooked +PP.pretty String +msg, DocCooked "hash:" DocCooked -> DocCooked -> DocCooked forall ann. Doc ann -> Doc ann -> Doc ann -<+> Int -> DatumHash -> DocCooked +<+> Int -> DatumHash -> DocCooked forall a. Show a => Int -> a -> DocCooked prettyHash (PrettyCookedOpts -> Int pcOptPrintedHashLength PrettyCookedOpts -opts) DatumHash -dHash] +opts) DatumHash +dHash] prettyCookedOpt PrettyCookedOpts -_ (OtherMockChainError err -err) = +_ (OtherMockChainError err +err) = DocCooked -> DocCooked -> [DocCooked] -> DocCooked prettyItemize DocCooked @@ -359,15 +359,15 @@ "-" [err -> DocCooked forall a ann. Show a => a -> Doc ann -PP.viaShow err -err] +PP.viaShow err +err] -instance Show a => PrettyCooked (a, UtxoState) where - prettyCookedOpt :: PrettyCookedOpts -> (a, UtxoState) -> DocCooked -prettyCookedOpt PrettyCookedOpts -opts (a -res, UtxoState -state) = +instance (Show a) => PrettyCooked (a, UtxoState) where + prettyCookedOpt :: PrettyCookedOpts -> (a, UtxoState) -> DocCooked +prettyCookedOpt PrettyCookedOpts +opts (a +res, UtxoState +state) = DocCooked -> DocCooked -> [DocCooked] -> DocCooked prettyItemize DocCooked @@ -377,46 +377,46 @@ [DocCooked "Returns:" DocCooked -> DocCooked -> DocCooked forall ann. Doc ann -> Doc ann -> Doc ann -<+> a -> DocCooked +<+> a -> DocCooked forall a ann. Show a => a -> Doc ann -PP.viaShow a -res, PrettyCookedOpts -> UtxoState -> DocCooked +PP.viaShow a +res, PrettyCookedOpts -> UtxoState -> DocCooked forall a. PrettyCooked a => PrettyCookedOpts -> a -> DocCooked prettyCookedOpt PrettyCookedOpts -opts UtxoState -state] +opts UtxoState +state] -instance Show a => PrettyCooked (Either MockChainError (a, UtxoState)) where - prettyCookedOpt :: PrettyCookedOpts +instance (Show a) => PrettyCooked (Either MockChainError (a, UtxoState)) where + prettyCookedOpt :: PrettyCookedOpts -> Either MockChainError (a, UtxoState) -> DocCooked -prettyCookedOpt PrettyCookedOpts -opts (Left MockChainError -err) = DocCooked +prettyCookedOpt PrettyCookedOpts +opts (Left MockChainError +err) = DocCooked "🔴" DocCooked -> DocCooked -> DocCooked forall ann. Doc ann -> Doc ann -> Doc ann -<+> PrettyCookedOpts -> MockChainError -> DocCooked +<+> PrettyCookedOpts -> MockChainError -> DocCooked forall a. PrettyCooked a => PrettyCookedOpts -> a -> DocCooked prettyCookedOpt PrettyCookedOpts -opts MockChainError -err - prettyCookedOpt PrettyCookedOpts -opts (Right (a, UtxoState) -endState) = DocCooked +opts MockChainError +err + prettyCookedOpt PrettyCookedOpts +opts (Right (a, UtxoState) +endState) = DocCooked "🟢" DocCooked -> DocCooked -> DocCooked forall ann. Doc ann -> Doc ann -> Doc ann -<+> PrettyCookedOpts -> (a, UtxoState) -> DocCooked +<+> PrettyCookedOpts -> (a, UtxoState) -> DocCooked forall a. PrettyCooked a => PrettyCookedOpts -> a -> DocCooked prettyCookedOpt PrettyCookedOpts -opts (a, UtxoState) -endState +opts (a, UtxoState) +endState -- | This pretty prints a 'MockChainLog' that usually consists of the list of -- validated or submitted transactions. In the log, we know a transaction has -- been validated if the 'MCLogSubmittedTxSkel' is followed by a 'MCLogNewTx'. -instance PrettyCooked MockChainLog where - prettyCookedOpt :: PrettyCookedOpts -> MockChainLog -> DocCooked -prettyCookedOpt PrettyCookedOpts -opts = +instance PrettyCooked MockChainLog where + prettyCookedOpt :: PrettyCookedOpts -> MockChainLog -> DocCooked +prettyCookedOpt PrettyCookedOpts +opts = DocCooked -> DocCooked -> [DocCooked] -> DocCooked prettyEnumerate DocCooked "MockChain run:" DocCooked @@ -424,155 +424,155 @@ ([DocCooked] -> DocCooked) -> (MockChainLog -> [DocCooked]) -> MockChainLog -> DocCooked forall b c a. (b -> c) -> (a -> b) -> a -> c -. [DocCooked] -> [MockChainLogEntry] -> [DocCooked] -go [] +. [DocCooked] -> [MockChainLogEntry] -> [DocCooked] +go [] ([MockChainLogEntry] -> [DocCooked]) -> (MockChainLog -> [MockChainLogEntry]) -> MockChainLog -> [DocCooked] forall b c a. (b -> c) -> (a -> b) -> a -> c -. MockChainLog -> [MockChainLogEntry] +. MockChainLog -> [MockChainLogEntry] unMockChainLog where -- In order to avoid printing 'MockChainLogValidateTxSkel' then -- 'MockChainLogNewTx' as two different items, we combine them into one -- single 'DocCooked' - go :: [DocCooked] -> [MockChainLogEntry] -> [DocCooked] - go :: [DocCooked] -> [MockChainLogEntry] -> [DocCooked] -go - [DocCooked] -acc - ( MCLogSubmittedTxSkel SkelContext -skelContext TxSkel -skel - : MCLogNewTx TxId -txId - : [MockChainLogEntry] -entries + go :: [DocCooked] -> [MockChainLogEntry] -> [DocCooked] + go :: [DocCooked] -> [MockChainLogEntry] -> [DocCooked] +go + [DocCooked] +acc + ( MCLogSubmittedTxSkel SkelContext +skelContext TxSkel +skel + : MCLogNewTx TxId +txId + : [MockChainLogEntry] +entries ) | PrettyCookedOpts -> Bool pcOptPrintTxHashes PrettyCookedOpts -opts = +opts = [DocCooked] -> [MockChainLogEntry] -> [DocCooked] -go +go ( DocCooked "Validated" DocCooked -> DocCooked -> DocCooked forall ann. Doc ann -> Doc ann -> Doc ann -<+> DocCooked -> DocCooked +<+> DocCooked -> DocCooked forall ann. Doc ann -> Doc ann -PP.parens (DocCooked +PP.parens (DocCooked "TxId:" DocCooked -> DocCooked -> DocCooked forall ann. Doc ann -> Doc ann -> Doc ann -<+> PrettyCookedOpts -> TxId -> DocCooked +<+> PrettyCookedOpts -> TxId -> DocCooked forall a. PrettyCooked a => PrettyCookedOpts -> a -> DocCooked prettyCookedOpt PrettyCookedOpts -opts TxId -txId) +opts TxId +txId) DocCooked -> DocCooked -> DocCooked forall ann. Doc ann -> Doc ann -> Doc ann -<+> PrettyCookedOpts -> SkelContext -> TxSkel -> DocCooked +<+> PrettyCookedOpts -> SkelContext -> TxSkel -> DocCooked prettyTxSkel PrettyCookedOpts -opts SkelContext -skelContext TxSkel -skel +opts SkelContext +skelContext TxSkel +skel DocCooked -> [DocCooked] -> [DocCooked] forall a. a -> [a] -> [a] -: [DocCooked] -acc +: [DocCooked] +acc ) [MockChainLogEntry] -entries +entries | Bool -otherwise = [DocCooked] -> [MockChainLogEntry] -> [DocCooked] -go (DocCooked +otherwise = [DocCooked] -> [MockChainLogEntry] -> [DocCooked] +go (DocCooked "Validated" DocCooked -> DocCooked -> DocCooked forall ann. Doc ann -> Doc ann -> Doc ann -<+> PrettyCookedOpts -> SkelContext -> TxSkel -> DocCooked +<+> PrettyCookedOpts -> SkelContext -> TxSkel -> DocCooked prettyTxSkel PrettyCookedOpts -opts SkelContext -skelContext TxSkel -skel DocCooked -> [DocCooked] -> [DocCooked] +opts SkelContext +skelContext TxSkel +skel DocCooked -> [DocCooked] -> [DocCooked] forall a. a -> [a] -> [a] -: [DocCooked] -acc) [MockChainLogEntry] -entries - go - [DocCooked] -acc - ( MCLogSubmittedTxSkel SkelContext -skelContext TxSkel -skel - : [MockChainLogEntry] -entries +: [DocCooked] +acc) [MockChainLogEntry] +entries + go + [DocCooked] +acc + ( MCLogSubmittedTxSkel SkelContext +skelContext TxSkel +skel + : [MockChainLogEntry] +entries ) = [DocCooked] -> [MockChainLogEntry] -> [DocCooked] -go (DocCooked +go (DocCooked "Submitted" DocCooked -> DocCooked -> DocCooked forall ann. Doc ann -> Doc ann -> Doc ann -<+> PrettyCookedOpts -> SkelContext -> TxSkel -> DocCooked +<+> PrettyCookedOpts -> SkelContext -> TxSkel -> DocCooked prettyTxSkel PrettyCookedOpts -opts SkelContext -skelContext TxSkel -skel DocCooked -> [DocCooked] -> [DocCooked] +opts SkelContext +skelContext TxSkel +skel DocCooked -> [DocCooked] -> [DocCooked] forall a. a -> [a] -> [a] -: [DocCooked] -acc) [MockChainLogEntry] -entries - go [DocCooked] -acc (MCLogFail String -msg : [MockChainLogEntry] -entries) = +: [DocCooked] +acc) [MockChainLogEntry] +entries + go [DocCooked] +acc (MCLogFail String +msg : [MockChainLogEntry] +entries) = [DocCooked] -> [MockChainLogEntry] -> [DocCooked] -go (DocCooked +go (DocCooked "Fail:" DocCooked -> DocCooked -> DocCooked forall ann. Doc ann -> Doc ann -> Doc ann -<+> String -> DocCooked +<+> String -> DocCooked forall a ann. Pretty a => a -> Doc ann -PP.pretty String -msg DocCooked -> [DocCooked] -> [DocCooked] +PP.pretty String +msg DocCooked -> [DocCooked] -> [DocCooked] forall a. a -> [a] -> [a] -: [DocCooked] -acc) [MockChainLogEntry] -entries +: [DocCooked] +acc) [MockChainLogEntry] +entries -- This case is not supposed to occur because it should follow a -- 'MCLogSubmittedTxSkel' - go [DocCooked] -acc (MCLogNewTx TxId -txId : [MockChainLogEntry] -entries) = + go [DocCooked] +acc (MCLogNewTx TxId +txId : [MockChainLogEntry] +entries) = [DocCooked] -> [MockChainLogEntry] -> [DocCooked] -go (DocCooked +go (DocCooked "New transaction:" DocCooked -> DocCooked -> DocCooked forall ann. Doc ann -> Doc ann -> Doc ann -<+> PrettyCookedOpts -> TxId -> DocCooked +<+> PrettyCookedOpts -> TxId -> DocCooked forall a. PrettyCooked a => PrettyCookedOpts -> a -> DocCooked prettyCookedOpt PrettyCookedOpts -opts TxId -txId DocCooked -> [DocCooked] -> [DocCooked] +opts TxId +txId DocCooked -> [DocCooked] -> [DocCooked] forall a. a -> [a] -> [a] -: [DocCooked] -acc) [MockChainLogEntry] -entries - go [DocCooked] -acc [] = [DocCooked] -> [DocCooked] +: [DocCooked] +acc) [MockChainLogEntry] +entries + go [DocCooked] +acc [] = [DocCooked] -> [DocCooked] forall a. [a] -> [a] -reverse [DocCooked] -acc +reverse [DocCooked] +acc prettyTxSkel :: PrettyCookedOpts -> SkelContext -> TxSkel -> DocCooked prettyTxSkel :: PrettyCookedOpts -> SkelContext -> TxSkel -> DocCooked -prettyTxSkel PrettyCookedOpts -opts SkelContext -skelContext (TxSkel Set TxLabel -lbl TxOpts -txopts TxSkelMints -mints [Wallet] -signers SlotRange -validityRange Map TxOutRef TxSkelRedeemer -ins Set TxOutRef -insReference [TxSkelOut] -outs) = +prettyTxSkel PrettyCookedOpts +opts SkelContext +skelContext (TxSkel Set TxLabel +lbl TxOpts +txopts TxSkelMints +mints [Wallet] +signers SlotRange +validityRange Map TxOutRef TxSkelRedeemer +ins Set TxOutRef +insReference [TxSkelOut] +outs) = DocCooked -> DocCooked -> [DocCooked] -> DocCooked prettyItemize DocCooked @@ -581,22 +581,22 @@ "-" ( [Maybe DocCooked] -> [DocCooked] forall a. [Maybe a] -> [a] -catMaybes +catMaybes [ DocCooked -> DocCooked -> [DocCooked] -> Maybe DocCooked prettyItemizeNonEmpty DocCooked "Labels:" DocCooked "-" (TxLabel -> DocCooked forall a ann. Show a => a -> Doc ann -PP.viaShow (TxLabel -> DocCooked) -> [TxLabel] -> [DocCooked] +PP.viaShow (TxLabel -> DocCooked) -> [TxLabel] -> [DocCooked] forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b -<$> Set TxLabel -> [TxLabel] +<$> Set TxLabel -> [TxLabel] forall a. Set a -> [a] -Set.toList Set TxLabel -lbl), +Set.toList Set TxLabel +lbl), PrettyCookedOpts -> TxOpts -> Maybe DocCooked mPrettyTxOpts PrettyCookedOpts -opts TxOpts -txopts, +opts TxOpts +txopts, DocCooked -> DocCooked -> [DocCooked] -> Maybe DocCooked prettyItemizeNonEmpty DocCooked "Mints:" DocCooked @@ -604,71 +604,71 @@ -> (Versioned MintingPolicy, MintsRedeemer, TokenName, Integer) -> DocCooked prettyMints PrettyCookedOpts -opts ((Versioned MintingPolicy, MintsRedeemer, TokenName, Integer) +opts ((Versioned MintingPolicy, MintsRedeemer, TokenName, Integer) -> DocCooked) -> [(Versioned MintingPolicy, MintsRedeemer, TokenName, Integer)] -> [DocCooked] forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b -<$> TxSkelMints +<$> TxSkelMints -> [(Versioned MintingPolicy, MintsRedeemer, TokenName, Integer)] txSkelMintsToList TxSkelMints -mints), +mints), DocCooked -> Maybe DocCooked forall a. a -> Maybe a -Just (DocCooked -> Maybe DocCooked) -> DocCooked -> Maybe DocCooked +Just (DocCooked -> Maybe DocCooked) -> DocCooked -> Maybe DocCooked forall a b. (a -> b) -> a -> b -$ DocCooked +$ DocCooked "Validity interval:" DocCooked -> DocCooked -> DocCooked forall ann. Doc ann -> Doc ann -> Doc ann -<+> SlotRange -> DocCooked +<+> SlotRange -> DocCooked forall a ann. Pretty a => a -> Doc ann -PP.pretty SlotRange -validityRange, +PP.pretty SlotRange +validityRange, DocCooked -> DocCooked -> [DocCooked] -> Maybe DocCooked prettyItemizeNonEmpty DocCooked "Signers:" DocCooked "-" (PrettyCookedOpts -> TxOpts -> [Wallet] -> [DocCooked] prettySigners PrettyCookedOpts -opts TxOpts -txopts [Wallet] -signers), +opts TxOpts +txopts [Wallet] +signers), DocCooked -> DocCooked -> [DocCooked] -> Maybe DocCooked prettyItemizeNonEmpty DocCooked "Inputs:" DocCooked "-" (PrettyCookedOpts -> SkelContext -> (TxOutRef, TxSkelRedeemer) -> DocCooked prettyTxSkelIn PrettyCookedOpts -opts SkelContext -skelContext ((TxOutRef, TxSkelRedeemer) -> DocCooked) +opts SkelContext +skelContext ((TxOutRef, TxSkelRedeemer) -> DocCooked) -> [(TxOutRef, TxSkelRedeemer)] -> [DocCooked] forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b -<$> Map TxOutRef TxSkelRedeemer -> [(TxOutRef, TxSkelRedeemer)] +<$> Map TxOutRef TxSkelRedeemer -> [(TxOutRef, TxSkelRedeemer)] forall k a. Map k a -> [(k, a)] -Map.toList Map TxOutRef TxSkelRedeemer -ins), +Map.toList Map TxOutRef TxSkelRedeemer +ins), DocCooked -> DocCooked -> [DocCooked] -> Maybe DocCooked prettyItemizeNonEmpty DocCooked "Reference inputs:" DocCooked "-" ((TxOutRef -> Maybe DocCooked) -> [TxOutRef] -> [DocCooked] forall a b. (a -> Maybe b) -> [a] -> [b] -mapMaybe (PrettyCookedOpts -> SkelContext -> TxOutRef -> Maybe DocCooked +mapMaybe (PrettyCookedOpts -> SkelContext -> TxOutRef -> Maybe DocCooked prettyTxSkelInReference PrettyCookedOpts -opts SkelContext -skelContext) ([TxOutRef] -> [DocCooked]) -> [TxOutRef] -> [DocCooked] +opts SkelContext +skelContext) ([TxOutRef] -> [DocCooked]) -> [TxOutRef] -> [DocCooked] forall a b. (a -> b) -> a -> b -$ Set TxOutRef -> [TxOutRef] +$ Set TxOutRef -> [TxOutRef] forall a. Set a -> [a] -Set.toList Set TxOutRef -insReference), +Set.toList Set TxOutRef +insReference), DocCooked -> DocCooked -> [DocCooked] -> Maybe DocCooked prettyItemizeNonEmpty DocCooked "Outputs:" DocCooked "-" (PrettyCookedOpts -> TxSkelOut -> DocCooked prettyTxSkelOut PrettyCookedOpts -opts (TxSkelOut -> DocCooked) -> [TxSkelOut] -> [DocCooked] +opts (TxSkelOut -> DocCooked) -> [TxSkelOut] -> [DocCooked] forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b -<$> [TxSkelOut] -outs) +<$> [TxSkelOut] +outs) ] ) @@ -676,82 +676,82 @@ -- this is the balancing wallet prettyBalancingWallet :: PrettyCookedOpts -> Wallet -> DocCooked prettyBalancingWallet :: PrettyCookedOpts -> Wallet -> DocCooked -prettyBalancingWallet PrettyCookedOpts -opts Wallet -w = +prettyBalancingWallet PrettyCookedOpts +opts Wallet +w = PrettyCookedOpts -> PubKeyHash -> DocCooked forall a. PrettyCooked a => PrettyCookedOpts -> a -> DocCooked prettyCookedOpt PrettyCookedOpts -opts (Wallet -> PubKeyHash +opts (Wallet -> PubKeyHash walletPKHash Wallet -w) DocCooked -> DocCooked -> DocCooked +w) DocCooked -> DocCooked -> DocCooked forall ann. Doc ann -> Doc ann -> Doc ann -<+> DocCooked +<+> DocCooked "[Balancing]" -- | Prints a list of pubkeys with a flag next to the balancing wallet prettySigners :: PrettyCookedOpts -> TxOpts -> [Wallet] -> [DocCooked] prettySigners :: PrettyCookedOpts -> TxOpts -> [Wallet] -> [DocCooked] -prettySigners PrettyCookedOpts -opts TxOpts {txOptBalanceWallet :: TxOpts -> BalancingWallet +prettySigners PrettyCookedOpts +opts TxOpts {txOptBalanceWallet :: TxOpts -> BalancingWallet txOptBalanceWallet = BalancingWallet -BalanceWithFirstSigner} (Wallet -firstSigner : [Wallet] -signers) = +BalanceWithFirstSigner} (Wallet +firstSigner : [Wallet] +signers) = PrettyCookedOpts -> Wallet -> DocCooked prettyBalancingWallet PrettyCookedOpts -opts Wallet -firstSigner DocCooked -> [DocCooked] -> [DocCooked] +opts Wallet +firstSigner DocCooked -> [DocCooked] -> [DocCooked] forall a. a -> [a] -> [a] -: (PrettyCookedOpts -> PubKeyHash -> DocCooked +: (PrettyCookedOpts -> PubKeyHash -> DocCooked forall a. PrettyCooked a => PrettyCookedOpts -> a -> DocCooked prettyCookedOpt PrettyCookedOpts -opts (PubKeyHash -> DocCooked) +opts (PubKeyHash -> DocCooked) -> (Wallet -> PubKeyHash) -> Wallet -> DocCooked forall b c a. (b -> c) -> (a -> b) -> a -> c -. Wallet -> PubKeyHash +. Wallet -> PubKeyHash walletPKHash (Wallet -> DocCooked) -> [Wallet] -> [DocCooked] forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b -<$> [Wallet] -signers) -prettySigners PrettyCookedOpts -opts TxOpts {txOptBalanceWallet :: TxOpts -> BalancingWallet -txOptBalanceWallet = BalanceWith Wallet -balancingWallet} [Wallet] -signers = +<$> [Wallet] +signers) +prettySigners PrettyCookedOpts +opts TxOpts {txOptBalanceWallet :: TxOpts -> BalancingWallet +txOptBalanceWallet = BalanceWith Wallet +balancingWallet} [Wallet] +signers = [Wallet] -> [DocCooked] -aux [Wallet] -signers +aux [Wallet] +signers where - aux :: [Wallet] -> [DocCooked] - aux :: [Wallet] -> [DocCooked] -aux [] = [] - aux (Wallet -s : [Wallet] -ss) + aux :: [Wallet] -> [DocCooked] + aux :: [Wallet] -> [DocCooked] +aux [] = [] + aux (Wallet +s : [Wallet] +ss) | Wallet -s Wallet -> Wallet -> Bool +s Wallet -> Wallet -> Bool forall a. Eq a => a -> a -> Bool -== Wallet -balancingWallet = PrettyCookedOpts -> Wallet -> DocCooked +== Wallet +balancingWallet = PrettyCookedOpts -> Wallet -> DocCooked prettyBalancingWallet PrettyCookedOpts -opts Wallet -balancingWallet DocCooked -> [DocCooked] -> [DocCooked] +opts Wallet +balancingWallet DocCooked -> [DocCooked] -> [DocCooked] forall a. a -> [a] -> [a] -: [Wallet] -> [DocCooked] -aux [Wallet] -ss +: [Wallet] -> [DocCooked] +aux [Wallet] +ss | Bool -otherwise = PrettyCookedOpts -> PubKeyHash -> DocCooked +otherwise = PrettyCookedOpts -> PubKeyHash -> DocCooked forall a. PrettyCooked a => PrettyCookedOpts -> a -> DocCooked prettyCookedOpt PrettyCookedOpts -opts (Wallet -> PubKeyHash +opts (Wallet -> PubKeyHash walletPKHash Wallet -s) DocCooked -> [DocCooked] -> [DocCooked] +s) DocCooked -> [DocCooked] -> [DocCooked] forall a. a -> [a] -> [a] -: [Wallet] -> [DocCooked] -aux [Wallet] -ss +: [Wallet] -> [DocCooked] +aux [Wallet] +ss -- The following case should never happen for real transactions, but if the list -- of signers is empty, this will lead to no signers being printed. prettySigners PrettyCookedOpts @@ -763,558 +763,558 @@ -- Examples without and with redeemer -- > #abcdef "Foo" -> 500 -- > #123456 "Bar" | Redeemer -> 1000 -prettyMints :: PrettyCookedOpts -> (Pl.Versioned Pl.MintingPolicy, MintsRedeemer, Pl.TokenName, Integer) -> DocCooked +prettyMints :: PrettyCookedOpts -> (Pl.Versioned Pl.MintingPolicy, MintsRedeemer, Pl.TokenName, Integer) -> DocCooked prettyMints :: PrettyCookedOpts -> (Versioned MintingPolicy, MintsRedeemer, TokenName, Integer) -> DocCooked -prettyMints PrettyCookedOpts -opts (Versioned MintingPolicy -policy, MintsRedeemer -NoMintsRedeemer, TokenName -tokenName, Integer -amount) = +prettyMints PrettyCookedOpts +opts (Versioned MintingPolicy +policy, MintsRedeemer +NoMintsRedeemer, TokenName +tokenName, Integer +amount) = PrettyCookedOpts -> Versioned MintingPolicy -> DocCooked forall a. PrettyCooked a => PrettyCookedOpts -> a -> DocCooked prettyCookedOpt PrettyCookedOpts -opts Versioned MintingPolicy -policy +opts Versioned MintingPolicy +policy DocCooked -> DocCooked -> DocCooked forall ann. Doc ann -> Doc ann -> Doc ann -<+> TokenName -> DocCooked +<+> TokenName -> DocCooked forall a ann. Show a => a -> Doc ann -PP.viaShow TokenName -tokenName +PP.viaShow TokenName +tokenName DocCooked -> DocCooked -> DocCooked forall ann. Doc ann -> Doc ann -> Doc ann -<+> DocCooked +<+> DocCooked "->" DocCooked -> DocCooked -> DocCooked forall ann. Doc ann -> Doc ann -> Doc ann -<+> Integer -> DocCooked +<+> Integer -> DocCooked forall a ann. Show a => a -> Doc ann -PP.viaShow Integer -amount -prettyMints PrettyCookedOpts -opts (Versioned MintingPolicy -policy, SomeMintsRedeemer redeemer -redeemer, TokenName -tokenName, Integer -amount) = +PP.viaShow Integer +amount +prettyMints PrettyCookedOpts +opts (Versioned MintingPolicy +policy, SomeMintsRedeemer redeemer +redeemer, TokenName +tokenName, Integer +amount) = PrettyCookedOpts -> Versioned MintingPolicy -> DocCooked forall a. PrettyCooked a => PrettyCookedOpts -> a -> DocCooked prettyCookedOpt PrettyCookedOpts -opts Versioned MintingPolicy -policy +opts Versioned MintingPolicy +policy DocCooked -> DocCooked -> DocCooked forall ann. Doc ann -> Doc ann -> Doc ann -<+> TokenName -> DocCooked +<+> TokenName -> DocCooked forall a ann. Show a => a -> Doc ann -PP.viaShow TokenName -tokenName +PP.viaShow TokenName +tokenName DocCooked -> DocCooked -> DocCooked forall ann. Doc ann -> Doc ann -> Doc ann -<+> DocCooked +<+> DocCooked "|" DocCooked -> DocCooked -> DocCooked forall ann. Doc ann -> Doc ann -> Doc ann -<+> PrettyCookedOpts -> redeemer -> DocCooked +<+> PrettyCookedOpts -> redeemer -> DocCooked forall a. PrettyCooked a => PrettyCookedOpts -> a -> DocCooked prettyCookedOpt PrettyCookedOpts -opts redeemer -redeemer +opts redeemer +redeemer DocCooked -> DocCooked -> DocCooked forall ann. Doc ann -> Doc ann -> Doc ann -<+> DocCooked +<+> DocCooked "->" DocCooked -> DocCooked -> DocCooked forall ann. Doc ann -> Doc ann -> Doc ann -<+> Integer -> DocCooked +<+> Integer -> DocCooked forall a ann. Show a => a -> Doc ann -PP.viaShow Integer -amount +PP.viaShow Integer +amount prettyTxSkelOut :: PrettyCookedOpts -> TxSkelOut -> DocCooked prettyTxSkelOut :: PrettyCookedOpts -> TxSkelOut -> DocCooked -prettyTxSkelOut PrettyCookedOpts -opts (Pays o -output) = +prettyTxSkelOut PrettyCookedOpts +opts (Pays o +output) = DocCooked -> DocCooked -> [DocCooked] -> DocCooked prettyItemize (DocCooked "Pays to" DocCooked -> DocCooked -> DocCooked forall ann. Doc ann -> Doc ann -> Doc ann -<+> PrettyCookedOpts -> Address -> DocCooked +<+> PrettyCookedOpts -> Address -> DocCooked forall a. PrettyCooked a => PrettyCookedOpts -> a -> DocCooked prettyCookedOpt PrettyCookedOpts -opts (o -> Address +opts (o -> Address forall o. (IsAbstractOutput o, ToCredential (OwnerType o)) => o -> Address outputAddress o -output)) +output)) DocCooked "-" ( PrettyCookedOpts -> Value -> DocCooked forall a. PrettyCooked a => PrettyCookedOpts -> a -> DocCooked prettyCookedOpt PrettyCookedOpts -opts (o -> Value +opts (o -> Value forall o. (IsAbstractOutput o, ToValue (ValueType o)) => o -> Value outputValue o -output) +output) DocCooked -> [DocCooked] -> [DocCooked] forall a. a -> [a] -> [a] -: [Maybe DocCooked] -> [DocCooked] +: [Maybe DocCooked] -> [DocCooked] forall a. [Maybe a] -> [a] -catMaybes +catMaybes [ case o -> OutputDatum forall o. (IsAbstractOutput o, ToOutputDatum (DatumType o)) => o -> OutputDatum outputOutputDatum o -output of - Pl.OutputDatum Datum -_datum -> +output of + Pl.OutputDatum Datum +_datum -> DocCooked -> Maybe DocCooked forall a. a -> Maybe a -Just (DocCooked -> Maybe DocCooked) -> DocCooked -> Maybe DocCooked +Just (DocCooked -> Maybe DocCooked) -> DocCooked -> Maybe DocCooked forall a b. (a -> b) -> a -> b -$ +$ DocCooked "Datum (inlined):" DocCooked -> DocCooked -> DocCooked forall ann. Doc ann -> Doc ann -> Doc ann -<+> (DocCooked -> DocCooked +<+> (DocCooked -> DocCooked forall ann. Doc ann -> Doc ann -PP.align (DocCooked -> DocCooked) +PP.align (DocCooked -> DocCooked) -> (TxSkelOutDatum -> DocCooked) -> TxSkelOutDatum -> DocCooked forall b c a. (b -> c) -> (a -> b) -> a -> c -. PrettyCookedOpts -> TxSkelOutDatum -> DocCooked +. PrettyCookedOpts -> TxSkelOutDatum -> DocCooked forall a. PrettyCooked a => PrettyCookedOpts -> a -> DocCooked prettyCookedOpt PrettyCookedOpts -opts) +opts) (o -output o -> Optic' A_Lens NoIx o TxSkelOutDatum -> TxSkelOutDatum +output o -> Optic' A_Lens NoIx o TxSkelOutDatum -> TxSkelOutDatum forall k s (is :: IxList) a. Is k A_Getter => s -> Optic' k is s a -> a -^. Optic' A_Lens NoIx o TxSkelOutDatum +^. Optic' A_Lens NoIx o TxSkelOutDatum forall o. IsAbstractOutput o => Lens' o (DatumType o) outputDatumL) - Pl.OutputDatumHash DatumHash -_datum -> + Pl.OutputDatumHash DatumHash +_datum -> DocCooked -> Maybe DocCooked forall a. a -> Maybe a -Just (DocCooked -> Maybe DocCooked) -> DocCooked -> Maybe DocCooked +Just (DocCooked -> Maybe DocCooked) -> DocCooked -> Maybe DocCooked forall a b. (a -> b) -> a -> b -$ +$ DocCooked "Datum (hashed):" DocCooked -> DocCooked -> DocCooked forall ann. Doc ann -> Doc ann -> Doc ann -<+> (DocCooked -> DocCooked +<+> (DocCooked -> DocCooked forall ann. Doc ann -> Doc ann -PP.align (DocCooked -> DocCooked) +PP.align (DocCooked -> DocCooked) -> (TxSkelOutDatum -> DocCooked) -> TxSkelOutDatum -> DocCooked forall b c a. (b -> c) -> (a -> b) -> a -> c -. PrettyCookedOpts -> TxSkelOutDatum -> DocCooked +. PrettyCookedOpts -> TxSkelOutDatum -> DocCooked forall a. PrettyCooked a => PrettyCookedOpts -> a -> DocCooked prettyCookedOpt PrettyCookedOpts -opts) +opts) (o -output o -> Optic' A_Lens NoIx o TxSkelOutDatum -> TxSkelOutDatum +output o -> Optic' A_Lens NoIx o TxSkelOutDatum -> TxSkelOutDatum forall k s (is :: IxList) a. Is k A_Getter => s -> Optic' k is s a -> a -^. Optic' A_Lens NoIx o TxSkelOutDatum +^. Optic' A_Lens NoIx o TxSkelOutDatum forall o. IsAbstractOutput o => Lens' o (DatumType o) outputDatumL) OutputDatum -Pl.NoOutputDatum -> Maybe DocCooked +Pl.NoOutputDatum -> Maybe DocCooked forall a. Maybe a -Nothing, +Nothing, PrettyCookedOpts -> o -> Maybe DocCooked forall output. (IsAbstractOutput output, ToScriptHash (ReferenceScriptType output)) => PrettyCookedOpts -> output -> Maybe DocCooked getReferenceScriptDoc PrettyCookedOpts -opts o -output +opts o +output ] ) -prettyTxSkelOutDatumMaybe :: PrettyCookedOpts -> TxSkelOutDatum -> Maybe DocCooked +prettyTxSkelOutDatumMaybe :: PrettyCookedOpts -> TxSkelOutDatum -> Maybe DocCooked prettyTxSkelOutDatumMaybe :: PrettyCookedOpts -> TxSkelOutDatum -> Maybe DocCooked prettyTxSkelOutDatumMaybe PrettyCookedOpts _ TxSkelOutDatum TxSkelOutNoDatum = Maybe DocCooked forall a. Maybe a -Nothing -prettyTxSkelOutDatumMaybe PrettyCookedOpts -opts txSkelOutDatum :: TxSkelOutDatum -txSkelOutDatum@(TxSkelOutInlineDatum a +Nothing +prettyTxSkelOutDatumMaybe PrettyCookedOpts +opts txSkelOutDatum :: TxSkelOutDatum +txSkelOutDatum@(TxSkelOutInlineDatum a _) = DocCooked -> Maybe DocCooked forall a. a -> Maybe a -Just (DocCooked -> Maybe DocCooked) -> DocCooked -> Maybe DocCooked +Just (DocCooked -> Maybe DocCooked) -> DocCooked -> Maybe DocCooked forall a b. (a -> b) -> a -> b -$ +$ DocCooked "Datum (inlined):" DocCooked -> DocCooked -> DocCooked forall ann. Doc ann -> Doc ann -> Doc ann -<+> DocCooked -> DocCooked +<+> DocCooked -> DocCooked forall ann. Doc ann -> Doc ann -PP.align (PrettyCookedOpts -> TxSkelOutDatum -> DocCooked +PP.align (PrettyCookedOpts -> TxSkelOutDatum -> DocCooked forall a. PrettyCooked a => PrettyCookedOpts -> a -> DocCooked prettyCookedOpt PrettyCookedOpts -opts TxSkelOutDatum -txSkelOutDatum) -prettyTxSkelOutDatumMaybe PrettyCookedOpts -opts TxSkelOutDatum -txSkelOutDatum = +opts TxSkelOutDatum +txSkelOutDatum) +prettyTxSkelOutDatumMaybe PrettyCookedOpts +opts TxSkelOutDatum +txSkelOutDatum = DocCooked -> Maybe DocCooked forall a. a -> Maybe a -Just (DocCooked -> Maybe DocCooked) -> DocCooked -> Maybe DocCooked +Just (DocCooked -> Maybe DocCooked) -> DocCooked -> Maybe DocCooked forall a b. (a -> b) -> a -> b -$ +$ DocCooked "Datum (hashed):" DocCooked -> DocCooked -> DocCooked forall ann. Doc ann -> Doc ann -> Doc ann -<+> DocCooked -> DocCooked +<+> DocCooked -> DocCooked forall ann. Doc ann -> Doc ann -PP.align (PrettyCookedOpts -> TxSkelOutDatum -> DocCooked +PP.align (PrettyCookedOpts -> TxSkelOutDatum -> DocCooked forall a. PrettyCooked a => PrettyCookedOpts -> a -> DocCooked prettyCookedOpt PrettyCookedOpts -opts TxSkelOutDatum -txSkelOutDatum) +opts TxSkelOutDatum +txSkelOutDatum) -prettyTxSkelIn :: PrettyCookedOpts -> SkelContext -> (Pl.TxOutRef, TxSkelRedeemer) -> DocCooked +prettyTxSkelIn :: PrettyCookedOpts -> SkelContext -> (Pl.TxOutRef, TxSkelRedeemer) -> DocCooked prettyTxSkelIn :: PrettyCookedOpts -> SkelContext -> (TxOutRef, TxSkelRedeemer) -> DocCooked -prettyTxSkelIn PrettyCookedOpts -opts SkelContext -skelContext (TxOutRef -txOutRef, TxSkelRedeemer -txSkelRedeemer) = do +prettyTxSkelIn PrettyCookedOpts +opts SkelContext +skelContext (TxOutRef +txOutRef, TxSkelRedeemer +txSkelRedeemer) = do case SkelContext -> TxOutRef -> Maybe (TxOut, TxSkelOutDatum) lookupOutput SkelContext -skelContext TxOutRef -txOutRef of +skelContext TxOutRef +txOutRef of Maybe (TxOut, TxSkelOutDatum) -Nothing -> DocCooked +Nothing -> DocCooked "Spends" DocCooked -> DocCooked -> DocCooked forall ann. Doc ann -> Doc ann -> Doc ann -<+> PrettyCookedOpts -> TxOutRef -> DocCooked +<+> PrettyCookedOpts -> TxOutRef -> DocCooked forall a. PrettyCooked a => PrettyCookedOpts -> a -> DocCooked prettyCookedOpt PrettyCookedOpts -opts TxOutRef -txOutRef DocCooked -> DocCooked -> DocCooked +opts TxOutRef +txOutRef DocCooked -> DocCooked -> DocCooked forall ann. Doc ann -> Doc ann -> Doc ann -<+> DocCooked +<+> DocCooked "(non resolved)" - Just (TxOut -output, TxSkelOutDatum -txSkelOutDatum) -> - let (Maybe DocCooked -redeemerDoc, DocCooked -ownerDoc) = + Just (TxOut +output, TxSkelOutDatum +txSkelOutDatum) -> + let (Maybe DocCooked +redeemerDoc, DocCooked +ownerDoc) = case TxSkelRedeemer -txSkelRedeemer of - TxSkelRedeemerForScript redeemer -redeemer -> +txSkelRedeemer of + TxSkelRedeemerForScript redeemer +redeemer -> ( DocCooked -> Maybe DocCooked forall a. a -> Maybe a -Just (DocCooked +Just (DocCooked "Redeemer:" DocCooked -> DocCooked -> DocCooked forall ann. Doc ann -> Doc ann -> Doc ann -<+> PrettyCookedOpts -> redeemer -> DocCooked +<+> PrettyCookedOpts -> redeemer -> DocCooked forall a. PrettyCooked a => PrettyCookedOpts -> a -> DocCooked prettyCookedOpt PrettyCookedOpts -opts redeemer -redeemer), +opts redeemer +redeemer), PrettyCookedOpts -> Address -> DocCooked forall a. PrettyCooked a => PrettyCookedOpts -> a -> DocCooked prettyCookedOpt PrettyCookedOpts -opts (TxOut -> Address +opts (TxOut -> Address forall o. (IsAbstractOutput o, ToCredential (OwnerType o)) => o -> Address outputAddress TxOut -output) +output) ) - TxSkelRedeemerForReferencedScript TxOutRef -refScriptOref redeemer -redeemer -> + TxSkelRedeemerForReferencedScript TxOutRef +refScriptOref redeemer +redeemer -> ( DocCooked -> Maybe DocCooked forall a. a -> Maybe a -Just (DocCooked +Just (DocCooked "Redeemer:" DocCooked -> DocCooked -> DocCooked forall ann. Doc ann -> Doc ann -> Doc ann -<+> PrettyCookedOpts -> redeemer -> DocCooked +<+> PrettyCookedOpts -> redeemer -> DocCooked forall a. PrettyCooked a => PrettyCookedOpts -> a -> DocCooked prettyCookedOpt PrettyCookedOpts -opts redeemer -redeemer), +opts redeemer +redeemer), PrettyCookedOpts -> Address -> DocCooked forall a. PrettyCooked a => PrettyCookedOpts -> a -> DocCooked prettyCookedOpt PrettyCookedOpts -opts (TxOut -> Address +opts (TxOut -> Address forall o. (IsAbstractOutput o, ToCredential (OwnerType o)) => o -> Address outputAddress TxOut -output) +output) DocCooked -> DocCooked -> DocCooked forall ann. Doc ann -> Doc ann -> Doc ann -<+> DocCooked -> DocCooked +<+> DocCooked -> DocCooked forall ann. Doc ann -> Doc ann -PP.parens (DocCooked +PP.parens (DocCooked "Reference Script at" DocCooked -> DocCooked -> DocCooked forall ann. Doc ann -> Doc ann -> Doc ann -<+> PrettyCookedOpts -> TxOutRef -> DocCooked +<+> PrettyCookedOpts -> TxOutRef -> DocCooked forall a. PrettyCooked a => PrettyCookedOpts -> a -> DocCooked prettyCookedOpt PrettyCookedOpts -opts TxOutRef -refScriptOref) +opts TxOutRef +refScriptOref) ) TxSkelRedeemer TxSkelNoRedeemerForPK -> (Maybe DocCooked forall a. Maybe a -Nothing, PrettyCookedOpts -> Address -> DocCooked +Nothing, PrettyCookedOpts -> Address -> DocCooked forall a. PrettyCooked a => PrettyCookedOpts -> a -> DocCooked prettyCookedOpt PrettyCookedOpts -opts (TxOut -> Address +opts (TxOut -> Address forall o. (IsAbstractOutput o, ToCredential (OwnerType o)) => o -> Address outputAddress TxOut -output)) +output)) in DocCooked -> DocCooked -> [DocCooked] -> DocCooked prettyItemize (DocCooked "Spends from" DocCooked -> DocCooked -> DocCooked forall ann. Doc ann -> Doc ann -> Doc ann -<+> DocCooked -ownerDoc) +<+> DocCooked +ownerDoc) DocCooked "-" ( PrettyCookedOpts -> Value -> DocCooked forall a. PrettyCooked a => PrettyCookedOpts -> a -> DocCooked prettyCookedOpt PrettyCookedOpts -opts (TxOut -> Value +opts (TxOut -> Value forall o. (IsAbstractOutput o, ToValue (ValueType o)) => o -> Value outputValue TxOut -output) +output) DocCooked -> [DocCooked] -> [DocCooked] forall a. a -> [a] -> [a] -: [Maybe DocCooked] -> [DocCooked] +: [Maybe DocCooked] -> [DocCooked] forall a. [Maybe a] -> [a] -catMaybes +catMaybes [ Maybe DocCooked -redeemerDoc, +redeemerDoc, PrettyCookedOpts -> TxSkelOutDatum -> Maybe DocCooked prettyTxSkelOutDatumMaybe PrettyCookedOpts -opts TxSkelOutDatum -txSkelOutDatum, +opts TxSkelOutDatum +txSkelOutDatum, PrettyCookedOpts -> TxOut -> Maybe DocCooked forall output. (IsAbstractOutput output, ToScriptHash (ReferenceScriptType output)) => PrettyCookedOpts -> output -> Maybe DocCooked getReferenceScriptDoc PrettyCookedOpts -opts TxOut -output +opts TxOut +output ] ) -prettyTxSkelInReference :: PrettyCookedOpts -> SkelContext -> Pl.TxOutRef -> Maybe DocCooked +prettyTxSkelInReference :: PrettyCookedOpts -> SkelContext -> Pl.TxOutRef -> Maybe DocCooked prettyTxSkelInReference :: PrettyCookedOpts -> SkelContext -> TxOutRef -> Maybe DocCooked -prettyTxSkelInReference PrettyCookedOpts -opts SkelContext -skelContext TxOutRef -txOutRef = do - (TxOut -output, TxSkelOutDatum -txSkelOutDatum) <- SkelContext -> TxOutRef -> Maybe (TxOut, TxSkelOutDatum) +prettyTxSkelInReference PrettyCookedOpts +opts SkelContext +skelContext TxOutRef +txOutRef = do + (TxOut +output, TxSkelOutDatum +txSkelOutDatum) <- SkelContext -> TxOutRef -> Maybe (TxOut, TxSkelOutDatum) lookupOutput SkelContext -skelContext TxOutRef -txOutRef +skelContext TxOutRef +txOutRef DocCooked -> Maybe DocCooked forall (m :: * -> *) a. Monad m => a -> m a -return (DocCooked -> Maybe DocCooked) -> DocCooked -> Maybe DocCooked +return (DocCooked -> Maybe DocCooked) -> DocCooked -> Maybe DocCooked forall a b. (a -> b) -> a -> b -$ +$ DocCooked -> DocCooked -> [DocCooked] -> DocCooked prettyItemize (DocCooked "References output from" DocCooked -> DocCooked -> DocCooked forall ann. Doc ann -> Doc ann -> Doc ann -<+> PrettyCookedOpts -> Address -> DocCooked +<+> PrettyCookedOpts -> Address -> DocCooked forall a. PrettyCooked a => PrettyCookedOpts -> a -> DocCooked prettyCookedOpt PrettyCookedOpts -opts (TxOut -> Address +opts (TxOut -> Address forall o. (IsAbstractOutput o, ToCredential (OwnerType o)) => o -> Address outputAddress TxOut -output)) +output)) DocCooked "-" ( PrettyCookedOpts -> Value -> DocCooked forall a. PrettyCooked a => PrettyCookedOpts -> a -> DocCooked prettyCookedOpt PrettyCookedOpts -opts (TxOut -> Value +opts (TxOut -> Value forall o. (IsAbstractOutput o, ToValue (ValueType o)) => o -> Value outputValue TxOut -output) +output) DocCooked -> [DocCooked] -> [DocCooked] forall a. a -> [a] -> [a] -: [Maybe DocCooked] -> [DocCooked] +: [Maybe DocCooked] -> [DocCooked] forall a. [Maybe a] -> [a] -catMaybes +catMaybes [ PrettyCookedOpts -> TxSkelOutDatum -> Maybe DocCooked prettyTxSkelOutDatumMaybe PrettyCookedOpts -opts TxSkelOutDatum -txSkelOutDatum, +opts TxSkelOutDatum +txSkelOutDatum, PrettyCookedOpts -> TxOut -> Maybe DocCooked forall output. (IsAbstractOutput output, ToScriptHash (ReferenceScriptType output)) => PrettyCookedOpts -> output -> Maybe DocCooked getReferenceScriptDoc PrettyCookedOpts -opts TxOut -output +opts TxOut +output ] ) -getReferenceScriptDoc :: (IsAbstractOutput output, ToScriptHash (ReferenceScriptType output)) => PrettyCookedOpts -> output -> Maybe DocCooked +getReferenceScriptDoc :: (IsAbstractOutput output, ToScriptHash (ReferenceScriptType output)) => PrettyCookedOpts -> output -> Maybe DocCooked getReferenceScriptDoc :: PrettyCookedOpts -> output -> Maybe DocCooked -getReferenceScriptDoc PrettyCookedOpts -opts output -output = +getReferenceScriptDoc PrettyCookedOpts +opts output +output = case output -output output +output output -> Optic' A_Lens NoIx output (Maybe (ReferenceScriptType output)) -> Maybe (ReferenceScriptType output) forall k s (is :: IxList) a. Is k A_Getter => s -> Optic' k is s a -> a -^. Optic' A_Lens NoIx output (Maybe (ReferenceScriptType output)) +^. Optic' A_Lens NoIx output (Maybe (ReferenceScriptType output)) forall o. IsAbstractOutput o => Lens' o (Maybe (ReferenceScriptType o)) outputReferenceScriptL of Maybe (ReferenceScriptType output) -Nothing -> Maybe DocCooked +Nothing -> Maybe DocCooked forall a. Maybe a -Nothing - Just ReferenceScriptType output -refScript -> DocCooked -> Maybe DocCooked +Nothing + Just ReferenceScriptType output +refScript -> DocCooked -> Maybe DocCooked forall a. a -> Maybe a -Just (DocCooked -> Maybe DocCooked) -> DocCooked -> Maybe DocCooked +Just (DocCooked -> Maybe DocCooked) -> DocCooked -> Maybe DocCooked forall a b. (a -> b) -> a -> b -$ DocCooked +$ DocCooked "Reference script hash:" DocCooked -> DocCooked -> DocCooked forall ann. Doc ann -> Doc ann -> Doc ann -<+> Int -> ScriptHash -> DocCooked +<+> Int -> ScriptHash -> DocCooked forall a. Show a => Int -> a -> DocCooked prettyHash (PrettyCookedOpts -> Int pcOptPrintedHashLength PrettyCookedOpts -opts) (ReferenceScriptType output -> ScriptHash +opts) (ReferenceScriptType output -> ScriptHash forall a. ToScriptHash a => a -> ScriptHash toScriptHash ReferenceScriptType output -refScript) +refScript) lookupOutput :: SkelContext -> - Pl.TxOutRef -> - Maybe (Pl.TxOut, TxSkelOutDatum) + Pl.TxOutRef -> + Maybe (Pl.TxOut, TxSkelOutDatum) lookupOutput :: SkelContext -> TxOutRef -> Maybe (TxOut, TxSkelOutDatum) -lookupOutput (SkelContext Map TxOutRef TxOut -managedTxOuts Map DatumHash TxSkelOutDatum -managedTxSkelOutDatums) TxOutRef -txOutRef = do - TxOut -output <- TxOutRef -> Map TxOutRef TxOut -> Maybe TxOut +lookupOutput (SkelContext Map TxOutRef TxOut +managedTxOuts Map DatumHash TxSkelOutDatum +managedTxSkelOutDatums) TxOutRef +txOutRef = do + TxOut +output <- TxOutRef -> Map TxOutRef TxOut -> Maybe TxOut forall k a. Ord k => k -> Map k a -> Maybe a -Map.lookup TxOutRef -txOutRef Map TxOutRef TxOut -managedTxOuts - DatumHash -datumHash <- +Map.lookup TxOutRef +txOutRef Map TxOutRef TxOut +managedTxOuts + DatumHash +datumHash <- case TxOut -> OutputDatum forall o. (IsAbstractOutput o, ToOutputDatum (DatumType o)) => o -> OutputDatum outputOutputDatum TxOut -output of - Pl.OutputDatum Datum -datum -> DatumHash -> Maybe DatumHash +output of + Pl.OutputDatum Datum +datum -> DatumHash -> Maybe DatumHash forall (m :: * -> *) a. Monad m => a -> m a -return (Datum -> DatumHash -Pl.datumHash Datum -datum) - Pl.OutputDatumHash DatumHash -datumHash -> DatumHash -> Maybe DatumHash +return (Datum -> DatumHash +Pl.datumHash Datum +datum) + Pl.OutputDatumHash DatumHash +datumHash -> DatumHash -> Maybe DatumHash forall (m :: * -> *) a. Monad m => a -> m a -return DatumHash -datumHash +return DatumHash +datumHash OutputDatum -Pl.NoOutputDatum -> Maybe DatumHash +Pl.NoOutputDatum -> Maybe DatumHash forall a. Maybe a -Nothing - TxSkelOutDatum -txSkelOutDatum <- DatumHash -> Map DatumHash TxSkelOutDatum -> Maybe TxSkelOutDatum +Nothing + TxSkelOutDatum +txSkelOutDatum <- DatumHash -> Map DatumHash TxSkelOutDatum -> Maybe TxSkelOutDatum forall k a. Ord k => k -> Map k a -> Maybe a -Map.lookup DatumHash -datumHash Map DatumHash TxSkelOutDatum -managedTxSkelOutDatums +Map.lookup DatumHash +datumHash Map DatumHash TxSkelOutDatum +managedTxSkelOutDatums (TxOut, TxSkelOutDatum) -> Maybe (TxOut, TxSkelOutDatum) forall (m :: * -> *) a. Monad m => a -> m a -return (TxOut -output, TxSkelOutDatum -txSkelOutDatum) +return (TxOut +output, TxSkelOutDatum +txSkelOutDatum) -- | Pretty-print a list of transaction skeleton options, only printing an -- option if its value is non-default. If no non-default options are in the -- list, return nothing. -mPrettyTxOpts :: PrettyCookedOpts -> TxOpts -> Maybe DocCooked +mPrettyTxOpts :: PrettyCookedOpts -> TxOpts -> Maybe DocCooked mPrettyTxOpts :: PrettyCookedOpts -> TxOpts -> Maybe DocCooked mPrettyTxOpts - PrettyCookedOpts -opts + PrettyCookedOpts +opts TxOpts - { Bool + { Bool txOptEnsureMinAda :: TxOpts -> Bool txOptEnsureMinAda :: Bool txOptEnsureMinAda, - Bool + Bool txOptAutoSlotIncrease :: TxOpts -> Bool txOptAutoSlotIncrease :: Bool txOptAutoSlotIncrease, - [RawModTx] + [RawModTx] txOptUnsafeModTx :: TxOpts -> [RawModTx] txOptUnsafeModTx :: [RawModTx] txOptUnsafeModTx, - Bool + Bool txOptBalance :: TxOpts -> Bool txOptBalance :: Bool txOptBalance, - BalanceOutputPolicy + BalanceOutputPolicy txOptBalanceOutputPolicy :: TxOpts -> BalanceOutputPolicy txOptBalanceOutputPolicy :: BalanceOutputPolicy txOptBalanceOutputPolicy, - BalancingWallet + BalancingWallet txOptBalanceWallet :: BalancingWallet txOptBalanceWallet :: TxOpts -> BalancingWallet -txOptBalanceWallet, - BalancingUtxos +txOptBalanceWallet, + BalancingUtxos txOptBalancingUtxos :: TxOpts -> BalancingUtxos txOptBalancingUtxos :: BalancingUtxos txOptBalancingUtxos, - Maybe EmulatorParamsModification + Maybe EmulatorParamsModification txOptEmulatorParamsModification :: TxOpts -> Maybe EmulatorParamsModification txOptEmulatorParamsModification :: Maybe EmulatorParamsModification txOptEmulatorParamsModification @@ -1324,226 +1324,226 @@ "Options:" DocCooked "-" ([DocCooked] -> Maybe DocCooked) -> [DocCooked] -> Maybe DocCooked forall a b. (a -> b) -> a -> b -$ +$ [Maybe DocCooked] -> [DocCooked] forall a. [Maybe a] -> [a] -catMaybes +catMaybes [ Bool -> (Bool -> DocCooked) -> Bool -> Maybe DocCooked forall a. Eq a => a -> (a -> DocCooked) -> a -> Maybe DocCooked -prettyIfNot Bool +prettyIfNot Bool forall a. Default a => a -def Bool -> DocCooked -prettyEnsureMinAda Bool -txOptEnsureMinAda, +def Bool -> DocCooked +prettyEnsureMinAda Bool +txOptEnsureMinAda, Bool -> (Bool -> DocCooked) -> Bool -> Maybe DocCooked forall a. Eq a => a -> (a -> DocCooked) -> a -> Maybe DocCooked -prettyIfNot Bool -True Bool -> DocCooked -prettyAutoSlotIncrease Bool -txOptAutoSlotIncrease, +prettyIfNot Bool +True Bool -> DocCooked +prettyAutoSlotIncrease Bool +txOptAutoSlotIncrease, Bool -> (Bool -> DocCooked) -> Bool -> Maybe DocCooked forall a. Eq a => a -> (a -> DocCooked) -> a -> Maybe DocCooked -prettyIfNot Bool -True Bool -> DocCooked -prettyBalance Bool -txOptBalance, +prettyIfNot Bool +True Bool -> DocCooked +prettyBalance Bool +txOptBalance, BalanceOutputPolicy -> (BalanceOutputPolicy -> DocCooked) -> BalanceOutputPolicy -> Maybe DocCooked forall a. Eq a => a -> (a -> DocCooked) -> a -> Maybe DocCooked -prettyIfNot BalanceOutputPolicy +prettyIfNot BalanceOutputPolicy forall a. Default a => a -def BalanceOutputPolicy -> DocCooked -prettyBalanceOutputPolicy BalanceOutputPolicy -txOptBalanceOutputPolicy, +def BalanceOutputPolicy -> DocCooked +prettyBalanceOutputPolicy BalanceOutputPolicy +txOptBalanceOutputPolicy, BalancingWallet -> (BalancingWallet -> DocCooked) -> BalancingWallet -> Maybe DocCooked forall a. Eq a => a -> (a -> DocCooked) -> a -> Maybe DocCooked -prettyIfNot BalancingWallet +prettyIfNot BalancingWallet forall a. Default a => a -def BalancingWallet -> DocCooked -prettyBalanceWallet BalancingWallet -txOptBalanceWallet, +def BalancingWallet -> DocCooked +prettyBalanceWallet BalancingWallet +txOptBalanceWallet, BalancingUtxos -> (BalancingUtxos -> DocCooked) -> BalancingUtxos -> Maybe DocCooked forall a. Eq a => a -> (a -> DocCooked) -> a -> Maybe DocCooked -prettyIfNot BalancingUtxos +prettyIfNot BalancingUtxos forall a. Default a => a -def BalancingUtxos -> DocCooked -prettyBalancingUtxos BalancingUtxos -txOptBalancingUtxos, +def BalancingUtxos -> DocCooked +prettyBalancingUtxos BalancingUtxos +txOptBalancingUtxos, [RawModTx] -> ([RawModTx] -> DocCooked) -> [RawModTx] -> Maybe DocCooked forall a. Eq a => a -> (a -> DocCooked) -> a -> Maybe DocCooked -prettyIfNot [] [RawModTx] -> DocCooked -prettyUnsafeModTx [RawModTx] -txOptUnsafeModTx, +prettyIfNot [] [RawModTx] -> DocCooked +prettyUnsafeModTx [RawModTx] +txOptUnsafeModTx, Maybe EmulatorParamsModification -> (Maybe EmulatorParamsModification -> DocCooked) -> Maybe EmulatorParamsModification -> Maybe DocCooked forall a. Eq a => a -> (a -> DocCooked) -> a -> Maybe DocCooked -prettyIfNot Maybe EmulatorParamsModification +prettyIfNot Maybe EmulatorParamsModification forall a. Default a => a -def Maybe EmulatorParamsModification -> DocCooked -prettyEmulatorParamsModification Maybe EmulatorParamsModification -txOptEmulatorParamsModification +def Maybe EmulatorParamsModification -> DocCooked +prettyEmulatorParamsModification Maybe EmulatorParamsModification +txOptEmulatorParamsModification ] where - prettyIfNot :: Eq a => a -> (a -> DocCooked) -> a -> Maybe DocCooked - prettyIfNot :: a -> (a -> DocCooked) -> a -> Maybe DocCooked -prettyIfNot a -defaultValue a -> DocCooked -f a -x + prettyIfNot :: (Eq a) => a -> (a -> DocCooked) -> a -> Maybe DocCooked + prettyIfNot :: a -> (a -> DocCooked) -> a -> Maybe DocCooked +prettyIfNot a +defaultValue a -> DocCooked +f a +x | a -x a -> a -> Bool +x a -> a -> Bool forall a. Eq a => a -> a -> Bool -== a -defaultValue Bool -> Bool -> Bool -&& Bool -> Bool -not (PrettyCookedOpts -> Bool +== a +defaultValue Bool -> Bool -> Bool +&& Bool -> Bool +not (PrettyCookedOpts -> Bool pcOptPrintDefaultTxOpts PrettyCookedOpts -opts) = Maybe DocCooked +opts) = Maybe DocCooked forall a. Maybe a -Nothing +Nothing | Bool -otherwise = DocCooked -> Maybe DocCooked +otherwise = DocCooked -> Maybe DocCooked forall a. a -> Maybe a -Just (DocCooked -> Maybe DocCooked) -> DocCooked -> Maybe DocCooked +Just (DocCooked -> Maybe DocCooked) -> DocCooked -> Maybe DocCooked forall a b. (a -> b) -> a -> b -$ a -> DocCooked -f a -x - prettyEnsureMinAda :: Bool -> DocCooked - prettyEnsureMinAda :: Bool -> DocCooked -prettyEnsureMinAda Bool -True = DocCooked +$ a -> DocCooked +f a +x + prettyEnsureMinAda :: Bool -> DocCooked + prettyEnsureMinAda :: Bool -> DocCooked +prettyEnsureMinAda Bool +True = DocCooked "Ensure min Ada per transaction" - prettyEnsureMinAda Bool -False = DocCooked + prettyEnsureMinAda Bool +False = DocCooked "Do not ensure min Ada per transaction" - prettyAutoSlotIncrease :: Bool -> DocCooked - prettyAutoSlotIncrease :: Bool -> DocCooked -prettyAutoSlotIncrease Bool -True = DocCooked + prettyAutoSlotIncrease :: Bool -> DocCooked + prettyAutoSlotIncrease :: Bool -> DocCooked +prettyAutoSlotIncrease Bool +True = DocCooked "Automatic slot increase" - prettyAutoSlotIncrease Bool -False = DocCooked + prettyAutoSlotIncrease Bool +False = DocCooked "No automatic slot increase" - prettyBalance :: Bool -> DocCooked - prettyBalance :: Bool -> DocCooked -prettyBalance Bool -True = DocCooked + prettyBalance :: Bool -> DocCooked + prettyBalance :: Bool -> DocCooked +prettyBalance Bool +True = DocCooked "Automatic balancing" - prettyBalance Bool -False = DocCooked + prettyBalance Bool +False = DocCooked "No automatic balancing" - prettyBalanceOutputPolicy :: BalanceOutputPolicy -> DocCooked - prettyBalanceOutputPolicy :: BalanceOutputPolicy -> DocCooked -prettyBalanceOutputPolicy BalanceOutputPolicy + prettyBalanceOutputPolicy :: BalanceOutputPolicy -> DocCooked + prettyBalanceOutputPolicy :: BalanceOutputPolicy -> DocCooked +prettyBalanceOutputPolicy BalanceOutputPolicy AdjustExistingOutput = DocCooked "Balance policy: Adjust existing outputs" - prettyBalanceOutputPolicy BalanceOutputPolicy + prettyBalanceOutputPolicy BalanceOutputPolicy DontAdjustExistingOutput = DocCooked "Balance policy: Don't adjust existing outputs" - prettyBalanceWallet :: BalancingWallet -> DocCooked - prettyBalanceWallet :: BalancingWallet -> DocCooked -prettyBalanceWallet BalancingWallet + prettyBalanceWallet :: BalancingWallet -> DocCooked + prettyBalanceWallet :: BalancingWallet -> DocCooked +prettyBalanceWallet BalancingWallet BalanceWithFirstSigner = DocCooked "Balance with first signer" - prettyBalanceWallet (BalanceWith Wallet -w) = DocCooked + prettyBalanceWallet (BalanceWith Wallet +w) = DocCooked "Balance with" DocCooked -> DocCooked -> DocCooked forall ann. Doc ann -> Doc ann -> Doc ann -<+> PrettyCookedOpts -> PubKeyHash -> DocCooked +<+> PrettyCookedOpts -> PubKeyHash -> DocCooked forall a. PrettyCooked a => PrettyCookedOpts -> a -> DocCooked prettyCookedOpt PrettyCookedOpts -opts (Wallet -> PubKeyHash +opts (Wallet -> PubKeyHash walletPKHash Wallet -w) - prettyUnsafeModTx :: [RawModTx] -> DocCooked - prettyUnsafeModTx :: [RawModTx] -> DocCooked -prettyUnsafeModTx [] = DocCooked +w) + prettyUnsafeModTx :: [RawModTx] -> DocCooked + prettyUnsafeModTx :: [RawModTx] -> DocCooked +prettyUnsafeModTx [] = DocCooked "No transaction modifications" - prettyUnsafeModTx [RawModTx] -xs = - let n :: Int -n = [RawModTx] -> Int + prettyUnsafeModTx [RawModTx] +xs = + let n :: Int +n = [RawModTx] -> Int forall (t :: * -> *) a. Foldable t => t a -> Int -length [RawModTx] -xs +length [RawModTx] +xs in Int -> DocCooked forall a ann. Pretty a => a -> Doc ann -PP.pretty Int -n +PP.pretty Int +n DocCooked -> DocCooked -> DocCooked forall ann. Doc ann -> Doc ann -> Doc ann -<+> DocCooked +<+> DocCooked "transaction" DocCooked -> DocCooked -> DocCooked forall ann. Doc ann -> Doc ann -> Doc ann -<+> DocCooked -> DocCooked -> Int -> DocCooked +<+> DocCooked -> DocCooked -> Int -> DocCooked forall amount doc. (Num amount, Eq amount) => doc -> doc -> amount -> doc -PP.plural DocCooked +PP.plural DocCooked "modification" DocCooked "modifications" Int -n - prettyEmulatorParamsModification :: Maybe EmulatorParamsModification -> DocCooked - prettyEmulatorParamsModification :: Maybe EmulatorParamsModification -> DocCooked -prettyEmulatorParamsModification Maybe EmulatorParamsModification -Nothing = DocCooked +n + prettyEmulatorParamsModification :: Maybe EmulatorParamsModification -> DocCooked + prettyEmulatorParamsModification :: Maybe EmulatorParamsModification -> DocCooked +prettyEmulatorParamsModification Maybe EmulatorParamsModification +Nothing = DocCooked "No modifications of protocol paramters" - prettyEmulatorParamsModification Just {} = DocCooked + prettyEmulatorParamsModification Just {} = DocCooked "With modifications of protocol parameters" - prettyBalancingUtxos :: BalancingUtxos -> DocCooked - prettyBalancingUtxos :: BalancingUtxos -> DocCooked -prettyBalancingUtxos BalancingUtxos + prettyBalancingUtxos :: BalancingUtxos -> DocCooked + prettyBalancingUtxos :: BalancingUtxos -> DocCooked +prettyBalancingUtxos BalancingUtxos BalancingUtxosAll = DocCooked "Balance with all UTxOs of the balancing wallet" - prettyBalancingUtxos BalancingUtxos + prettyBalancingUtxos BalancingUtxos BalancingUtxosDatumless = DocCooked "Balance with datumless UTxOs of the balancing wallet" - prettyBalancingUtxos (BalancingUtxosAllowlist [TxOutRef] -txOutRefs) = + prettyBalancingUtxos (BalancingUtxosAllowlist [TxOutRef] +txOutRefs) = DocCooked -> DocCooked -> [DocCooked] -> DocCooked prettyItemize DocCooked "Only balance with UTxOs of the balancing wallet among:" DocCooked "-" (PrettyCookedOpts -> TxOutRef -> DocCooked forall a. PrettyCooked a => PrettyCookedOpts -> a -> DocCooked prettyCookedOpt PrettyCookedOpts -opts (TxOutRef -> DocCooked) -> [TxOutRef] -> [DocCooked] +opts (TxOutRef -> DocCooked) -> [TxOutRef] -> [DocCooked] forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b -<$> [TxOutRef] -txOutRefs) - prettyBalancingUtxos (BalancingUtxosBlocklist [TxOutRef] -txOutRefs) = +<$> [TxOutRef] +txOutRefs) + prettyBalancingUtxos (BalancingUtxosBlocklist [TxOutRef] +txOutRefs) = DocCooked -> DocCooked -> [DocCooked] -> DocCooked prettyItemize DocCooked "Do not balance with UTxOs among:" DocCooked "-" (PrettyCookedOpts -> TxOutRef -> DocCooked forall a. PrettyCooked a => PrettyCookedOpts -> a -> DocCooked prettyCookedOpt PrettyCookedOpts -opts (TxOutRef -> DocCooked) -> [TxOutRef] -> [DocCooked] +opts (TxOutRef -> DocCooked) -> [TxOutRef] -> [DocCooked] forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b -<$> [TxOutRef] -txOutRefs) +<$> [TxOutRef] +txOutRefs) -- * Pretty-printing -- | Pretty print a 'UtxoState'. Print the known wallets first, then unknown -- pubkeys, then scripts. -instance PrettyCooked UtxoState where - prettyCookedOpt :: PrettyCookedOpts -> UtxoState -> DocCooked -prettyCookedOpt PrettyCookedOpts -opts = +instance PrettyCooked UtxoState where + prettyCookedOpt :: PrettyCookedOpts -> UtxoState -> DocCooked +prettyCookedOpt PrettyCookedOpts +opts = DocCooked -> DocCooked -> [DocCooked] -> DocCooked prettyItemize DocCooked "UTxO state:" DocCooked @@ -1551,289 +1551,289 @@ ([DocCooked] -> DocCooked) -> (UtxoState -> [DocCooked]) -> UtxoState -> DocCooked forall b c a. (b -> c) -> (a -> b) -> a -> c -. ((Address, UtxoPayloadSet) -> DocCooked) +. ((Address, UtxoPayloadSet) -> DocCooked) -> [(Address, UtxoPayloadSet)] -> [DocCooked] forall a b. (a -> b) -> [a] -> [b] -map ((Address -> UtxoPayloadSet -> DocCooked) +map ((Address -> UtxoPayloadSet -> DocCooked) -> (Address, UtxoPayloadSet) -> DocCooked forall a b c. (a -> b -> c) -> (a, b) -> c -uncurry (PrettyCookedOpts -> Address -> UtxoPayloadSet -> DocCooked +uncurry (PrettyCookedOpts -> Address -> UtxoPayloadSet -> DocCooked prettyAddressState PrettyCookedOpts -opts)) +opts)) ([(Address, UtxoPayloadSet)] -> [DocCooked]) -> (UtxoState -> [(Address, UtxoPayloadSet)]) -> UtxoState -> [DocCooked] forall b c a. (b -> c) -> (a -> b) -> a -> c -. ((Address, UtxoPayloadSet) +. ((Address, UtxoPayloadSet) -> (Address, UtxoPayloadSet) -> Ordering) -> [(Address, UtxoPayloadSet)] -> [(Address, UtxoPayloadSet)] forall a. (a -> a -> Ordering) -> [a] -> [a] -List.sortBy (Address, UtxoPayloadSet) -> (Address, UtxoPayloadSet) -> Ordering +List.sortBy (Address, UtxoPayloadSet) -> (Address, UtxoPayloadSet) -> Ordering forall a. (Address, a) -> (Address, a) -> Ordering -addressOrdering +addressOrdering ([(Address, UtxoPayloadSet)] -> [(Address, UtxoPayloadSet)]) -> (UtxoState -> [(Address, UtxoPayloadSet)]) -> UtxoState -> [(Address, UtxoPayloadSet)] forall b c a. (b -> c) -> (a -> b) -> a -> c -. Map Address UtxoPayloadSet -> [(Address, UtxoPayloadSet)] +. Map Address UtxoPayloadSet -> [(Address, UtxoPayloadSet)] forall k a. Map k a -> [(k, a)] -Map.toList +Map.toList (Map Address UtxoPayloadSet -> [(Address, UtxoPayloadSet)]) -> (UtxoState -> Map Address UtxoPayloadSet) -> UtxoState -> [(Address, UtxoPayloadSet)] forall b c a. (b -> c) -> (a -> b) -> a -> c -. UtxoState -> Map Address UtxoPayloadSet +. UtxoState -> Map Address UtxoPayloadSet utxoState where - addressOrdering :: (Pl.Address, a) -> (Pl.Address, a) -> Ordering - addressOrdering :: (Address, a) -> (Address, a) -> Ordering -addressOrdering - (a1 :: Address -a1@(Pl.Address (Pl.PubKeyCredential PubKeyHash -pkh1) Maybe StakingCredential + addressOrdering :: (Pl.Address, a) -> (Pl.Address, a) -> Ordering + addressOrdering :: (Address, a) -> (Address, a) -> Ordering +addressOrdering + (a1 :: Address +a1@(Pl.Address (Pl.PubKeyCredential PubKeyHash +pkh1) Maybe StakingCredential _), a _) - (a2 :: Address -a2@(Pl.Address (Pl.PubKeyCredential PubKeyHash -pkh2) Maybe StakingCredential + (a2 :: Address +a2@(Pl.Address (Pl.PubKeyCredential PubKeyHash +pkh2) Maybe StakingCredential _), a _) = case (PubKeyHash -> Maybe Int walletPKHashToId PubKeyHash -pkh1, PubKeyHash -> Maybe Int +pkh1, PubKeyHash -> Maybe Int walletPKHashToId PubKeyHash -pkh2) of - (Just Int -i, Just Int -j) -> Int -> Int -> Ordering +pkh2) of + (Just Int +i, Just Int +j) -> Int -> Int -> Ordering forall a. Ord a => a -> a -> Ordering -compare Int -i Int -j - (Just Int +compare Int +i Int +j + (Just Int _, Maybe Int -Nothing) -> Ordering -LT +Nothing) -> Ordering +LT (Maybe Int -Nothing, Just Int +Nothing, Just Int _) -> Ordering -GT +GT (Maybe Int -Nothing, Maybe Int -Nothing) -> Address -> Address -> Ordering +Nothing, Maybe Int +Nothing) -> Address -> Address -> Ordering forall a. Ord a => a -> a -> Ordering -compare Address -a1 Address -a2 - addressOrdering - (Pl.Address (Pl.PubKeyCredential PubKeyHash +compare Address +a1 Address +a2 + addressOrdering + (Pl.Address (Pl.PubKeyCredential PubKeyHash _) Maybe StakingCredential _, a _) - (Pl.Address (Pl.ScriptCredential ValidatorHash + (Pl.Address (Pl.ScriptCredential ValidatorHash _) Maybe StakingCredential _, a _) = Ordering -LT - addressOrdering (Address -a1, a -_) (Address -a2, a +LT + addressOrdering (Address +a1, a +_) (Address +a2, a _) = Address -> Address -> Ordering forall a. Ord a => a -> a -> Ordering -compare Address -a1 Address -a2 +compare Address +a1 Address +a2 -- | Pretty prints the state of an address, that is the list of UTxOs -- (including value and datum), grouped -prettyAddressState :: PrettyCookedOpts -> Pl.Address -> UtxoPayloadSet -> DocCooked +prettyAddressState :: PrettyCookedOpts -> Pl.Address -> UtxoPayloadSet -> DocCooked prettyAddressState :: PrettyCookedOpts -> Address -> UtxoPayloadSet -> DocCooked -prettyAddressState PrettyCookedOpts -opts Address -address UtxoPayloadSet -payloadSet = +prettyAddressState PrettyCookedOpts +opts Address +address UtxoPayloadSet +payloadSet = DocCooked -> DocCooked -> [DocCooked] -> DocCooked prettyItemize (PrettyCookedOpts -> Address -> DocCooked forall a. PrettyCooked a => PrettyCookedOpts -> a -> DocCooked prettyCookedOpt PrettyCookedOpts -opts Address -address) +opts Address +address) DocCooked "-" ( ([UtxoPayload] -> Maybe DocCooked) -> [[UtxoPayload]] -> [DocCooked] forall a b. (a -> Maybe b) -> [a] -> [b] -mapMaybe (PrettyCookedOpts -> [UtxoPayload] -> Maybe DocCooked +mapMaybe (PrettyCookedOpts -> [UtxoPayload] -> Maybe DocCooked prettyPayloadGrouped PrettyCookedOpts -opts) +opts) ([[UtxoPayload]] -> [DocCooked]) -> (UtxoPayloadSet -> [[UtxoPayload]]) -> UtxoPayloadSet -> [DocCooked] forall b c a. (b -> c) -> (a -> b) -> a -> c -. [UtxoPayload] -> [[UtxoPayload]] -group +. [UtxoPayload] -> [[UtxoPayload]] +group ([UtxoPayload] -> [[UtxoPayload]]) -> (UtxoPayloadSet -> [UtxoPayload]) -> UtxoPayloadSet -> [[UtxoPayload]] forall b c a. (b -> c) -> (a -> b) -> a -> c -. (UtxoPayload -> UtxoPayload -> Ordering) +. (UtxoPayload -> UtxoPayload -> Ordering) -> [UtxoPayload] -> [UtxoPayload] forall a. (a -> a -> Ordering) -> [a] -> [a] -List.sortBy (Ada -> Ada -> Ordering +List.sortBy (Ada -> Ada -> Ordering forall a. Ord a => a -> a -> Ordering -compare (Ada -> Ada -> Ordering) +compare (Ada -> Ada -> Ordering) -> (UtxoPayload -> Ada) -> UtxoPayload -> UtxoPayload -> Ordering forall b c a. (b -> b -> c) -> (a -> b) -> a -> a -> c -`on` (Value -> Ada -Ada.fromValue (Value -> Ada) -> (UtxoPayload -> Value) -> UtxoPayload -> Ada +`on` (Value -> Ada +Ada.fromValue (Value -> Ada) -> (UtxoPayload -> Value) -> UtxoPayload -> Ada forall b c a. (b -> c) -> (a -> b) -> a -> c -. UtxoPayload -> Value +. UtxoPayload -> Value utxoPayloadValue)) ([UtxoPayload] -> [UtxoPayload]) -> (UtxoPayloadSet -> [UtxoPayload]) -> UtxoPayloadSet -> [UtxoPayload] forall b c a. (b -> c) -> (a -> b) -> a -> c -. UtxoPayloadSet -> [UtxoPayload] +. UtxoPayloadSet -> [UtxoPayload] utxoPayloadSet (UtxoPayloadSet -> [DocCooked]) -> UtxoPayloadSet -> [DocCooked] forall a b. (a -> b) -> a -> b -$ UtxoPayloadSet -payloadSet +$ UtxoPayloadSet +payloadSet ) where - similar :: UtxoPayload -> UtxoPayload -> Bool - similar :: UtxoPayload -> UtxoPayload -> Bool -similar + similar :: UtxoPayload -> UtxoPayload -> Bool + similar :: UtxoPayload -> UtxoPayload -> Bool +similar (UtxoPayload TxOutRef -_ Value -value1 TxSkelOutDatum -skelOutDatum1 Maybe ScriptHash -refScript1) +_ Value +value1 TxSkelOutDatum +skelOutDatum1 Maybe ScriptHash +refScript1) (UtxoPayload TxOutRef -_ Value -value2 TxSkelOutDatum -skelOutDatum2 Maybe ScriptHash -refScript2) = +_ Value +value2 TxSkelOutDatum +skelOutDatum2 Maybe ScriptHash +refScript2) = Value -value1 Value -> Value -> Bool +value1 Value -> Value -> Bool forall a. Eq a => a -> a -> Bool -== Value -value2 +== Value +value2 Bool -> Bool -> Bool -&& TxSkelOutDatum -skelOutDatum1 TxSkelOutDatum -> TxSkelOutDatum -> Bool +&& TxSkelOutDatum +skelOutDatum1 TxSkelOutDatum -> TxSkelOutDatum -> Bool forall a. Eq a => a -> a -> Bool -== TxSkelOutDatum -skelOutDatum2 +== TxSkelOutDatum +skelOutDatum2 Bool -> Bool -> Bool -&& Maybe ScriptHash -refScript1 Maybe ScriptHash -> Maybe ScriptHash -> Bool +&& Maybe ScriptHash +refScript1 Maybe ScriptHash -> Maybe ScriptHash -> Bool forall a. Eq a => a -> a -> Bool -== Maybe ScriptHash -refScript2 - group :: [UtxoPayload] -> [[UtxoPayload]] - group :: [UtxoPayload] -> [[UtxoPayload]] -group = +== Maybe ScriptHash +refScript2 + group :: [UtxoPayload] -> [[UtxoPayload]] + group :: [UtxoPayload] -> [[UtxoPayload]] +group = case PrettyCookedOpts -> PCOptTxOutRefs pcOptPrintTxOutRefs PrettyCookedOpts -opts of +opts of PCOptTxOutRefs PCOptTxOutRefsFull -> (UtxoPayload -> [UtxoPayload]) -> [UtxoPayload] -> [[UtxoPayload]] forall a b. (a -> b) -> [a] -> [b] -map (UtxoPayload -> [UtxoPayload] -> [UtxoPayload] +map (UtxoPayload -> [UtxoPayload] -> [UtxoPayload] forall a. a -> [a] -> [a] -: []) +: []) PCOptTxOutRefs _ -> (UtxoPayload -> UtxoPayload -> Bool) -> [UtxoPayload] -> [[UtxoPayload]] forall a. (a -> a -> Bool) -> [a] -> [[a]] -List.groupBy UtxoPayload -> UtxoPayload -> Bool -similar +List.groupBy UtxoPayload -> UtxoPayload -> Bool +similar -- | Pretty prints payloads (datum and value corresponding to 1 UTxO) that have -- been grouped together when they carry same value and datum -prettyPayloadGrouped :: PrettyCookedOpts -> [UtxoPayload] -> Maybe DocCooked +prettyPayloadGrouped :: PrettyCookedOpts -> [UtxoPayload] -> Maybe DocCooked prettyPayloadGrouped :: PrettyCookedOpts -> [UtxoPayload] -> Maybe DocCooked prettyPayloadGrouped PrettyCookedOpts _ [] = Maybe DocCooked forall a. Maybe a -Nothing -prettyPayloadGrouped PrettyCookedOpts -opts [UtxoPayload -payload] = +Nothing +prettyPayloadGrouped PrettyCookedOpts +opts [UtxoPayload +payload] = PrettyCookedOpts -> Bool -> UtxoPayload -> Maybe DocCooked prettyPayload PrettyCookedOpts -opts +opts (PrettyCookedOpts -> PCOptTxOutRefs pcOptPrintTxOutRefs PrettyCookedOpts -opts PCOptTxOutRefs -> PCOptTxOutRefs -> Bool +opts PCOptTxOutRefs -> PCOptTxOutRefs -> Bool forall a. Eq a => a -> a -> Bool -/= PCOptTxOutRefs +/= PCOptTxOutRefs PCOptTxOutRefsHidden) UtxoPayload -payload -prettyPayloadGrouped PrettyCookedOpts -opts (UtxoPayload -payload : [UtxoPayload] -rest) = - let cardinality :: Int -cardinality = Int +payload +prettyPayloadGrouped PrettyCookedOpts +opts (UtxoPayload +payload : [UtxoPayload] +rest) = + let cardinality :: Int +cardinality = Int 1 Int -> Int -> Int forall a. Num a => a -> a -> a -+ [UtxoPayload] -> Int ++ [UtxoPayload] -> Int forall (t :: * -> *) a. Foldable t => t a -> Int -length [UtxoPayload] -rest +length [UtxoPayload] +rest in (DocCooked -> DocCooked forall ann. Doc ann -> Doc ann -PP.parens (DocCooked +PP.parens (DocCooked "×" DocCooked -> DocCooked -> DocCooked forall a. Semigroup a => a -> a -> a -<> PrettyCookedOpts -> Int -> DocCooked +<> PrettyCookedOpts -> Int -> DocCooked forall a. PrettyCooked a => PrettyCookedOpts -> a -> DocCooked prettyCookedOpt PrettyCookedOpts -opts Int -cardinality) DocCooked -> DocCooked -> DocCooked +opts Int +cardinality) DocCooked -> DocCooked -> DocCooked forall ann. Doc ann -> Doc ann -> Doc ann -<+>) +<+>) (DocCooked -> DocCooked) -> Maybe DocCooked -> Maybe DocCooked forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b -<$> PrettyCookedOpts -> Bool -> UtxoPayload -> Maybe DocCooked +<$> PrettyCookedOpts -> Bool -> UtxoPayload -> Maybe DocCooked prettyPayload PrettyCookedOpts -opts Bool -False UtxoPayload -payload +opts Bool +False UtxoPayload +payload -prettyPayload :: PrettyCookedOpts -> Bool -> UtxoPayload -> Maybe DocCooked +prettyPayload :: PrettyCookedOpts -> Bool -> UtxoPayload -> Maybe DocCooked prettyPayload :: PrettyCookedOpts -> Bool -> UtxoPayload -> Maybe DocCooked prettyPayload - PrettyCookedOpts -opts - Bool -showTxOutRef + PrettyCookedOpts +opts + Bool +showTxOutRef ( UtxoPayload - { TxOutRef + { TxOutRef utxoPayloadTxOutRef :: UtxoPayload -> TxOutRef utxoPayloadTxOutRef :: TxOutRef utxoPayloadTxOutRef, - Value + Value utxoPayloadValue :: Value utxoPayloadValue :: UtxoPayload -> Value -utxoPayloadValue, - TxSkelOutDatum +utxoPayloadValue, + TxSkelOutDatum utxoPayloadSkelOutDatum :: UtxoPayload -> TxSkelOutDatum utxoPayloadSkelOutDatum :: TxSkelOutDatum utxoPayloadSkelOutDatum, - Maybe ScriptHash + Maybe ScriptHash utxoPayloadReferenceScript :: UtxoPayload -> Maybe ScriptHash utxoPayloadReferenceScript :: Maybe ScriptHash utxoPayloadReferenceScript @@ -1841,82 +1841,82 @@ ) = case [Maybe DocCooked] -> [DocCooked] forall a. [Maybe a] -> [a] -catMaybes +catMaybes [ if Bool -showTxOutRef +showTxOutRef then DocCooked -> Maybe DocCooked forall a. a -> Maybe a -Just (DocCooked -> Maybe DocCooked) -> DocCooked -> Maybe DocCooked +Just (DocCooked -> Maybe DocCooked) -> DocCooked -> Maybe DocCooked forall a b. (a -> b) -> a -> b -$ PrettyCookedOpts -> TxOutRef -> DocCooked +$ PrettyCookedOpts -> TxOutRef -> DocCooked forall a. PrettyCooked a => PrettyCookedOpts -> a -> DocCooked prettyCookedOpt PrettyCookedOpts -opts TxOutRef -utxoPayloadTxOutRef +opts TxOutRef +utxoPayloadTxOutRef else Maybe DocCooked forall a. Maybe a -Nothing, +Nothing, DocCooked -> Maybe DocCooked forall a. a -> Maybe a -Just (PrettyCookedOpts -> Value -> DocCooked +Just (PrettyCookedOpts -> Value -> DocCooked forall a. PrettyCooked a => PrettyCookedOpts -> a -> DocCooked prettyCookedOpt PrettyCookedOpts -opts Value -utxoPayloadValue), +opts Value +utxoPayloadValue), PrettyCookedOpts -> TxSkelOutDatum -> Maybe DocCooked prettyTxSkelOutDatumMaybe PrettyCookedOpts -opts TxSkelOutDatum -utxoPayloadSkelOutDatum, +opts TxSkelOutDatum +utxoPayloadSkelOutDatum, PrettyCookedOpts -> ScriptHash -> DocCooked prettyReferenceScriptHash PrettyCookedOpts -opts (ScriptHash -> DocCooked) -> Maybe ScriptHash -> Maybe DocCooked +opts (ScriptHash -> DocCooked) -> Maybe ScriptHash -> Maybe DocCooked forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b -<$> Maybe ScriptHash -utxoPayloadReferenceScript +<$> Maybe ScriptHash +utxoPayloadReferenceScript ] of [] -> Maybe DocCooked forall a. Maybe a -Nothing - [DocCooked -doc] -> DocCooked -> Maybe DocCooked +Nothing + [DocCooked +doc] -> DocCooked -> Maybe DocCooked forall a. a -> Maybe a -Just (DocCooked -> Maybe DocCooked) -> DocCooked -> Maybe DocCooked +Just (DocCooked -> Maybe DocCooked) -> DocCooked -> Maybe DocCooked forall a b. (a -> b) -> a -> b -$ DocCooked -> DocCooked +$ DocCooked -> DocCooked forall ann. Doc ann -> Doc ann -PP.align DocCooked -doc - [DocCooked] -docs -> DocCooked -> Maybe DocCooked +PP.align DocCooked +doc + [DocCooked] +docs -> DocCooked -> Maybe DocCooked forall a. a -> Maybe a -Just (DocCooked -> Maybe DocCooked) +Just (DocCooked -> Maybe DocCooked) -> ([DocCooked] -> DocCooked) -> [DocCooked] -> Maybe DocCooked forall b c a. (b -> c) -> (a -> b) -> a -> c -. DocCooked -> DocCooked +. DocCooked -> DocCooked forall ann. Doc ann -> Doc ann -PP.align (DocCooked -> DocCooked) +PP.align (DocCooked -> DocCooked) -> ([DocCooked] -> DocCooked) -> [DocCooked] -> DocCooked forall b c a. (b -> c) -> (a -> b) -> a -> c -. [DocCooked] -> DocCooked +. [DocCooked] -> DocCooked forall ann. [Doc ann] -> Doc ann -PP.vsep ([DocCooked] -> Maybe DocCooked) -> [DocCooked] -> Maybe DocCooked +PP.vsep ([DocCooked] -> Maybe DocCooked) -> [DocCooked] -> Maybe DocCooked forall a b. (a -> b) -> a -> b -$ [DocCooked] -docs +$ [DocCooked] +docs -prettyReferenceScriptHash :: PrettyCookedOpts -> Pl.ScriptHash -> DocCooked +prettyReferenceScriptHash :: PrettyCookedOpts -> Pl.ScriptHash -> DocCooked prettyReferenceScriptHash :: PrettyCookedOpts -> ScriptHash -> DocCooked -prettyReferenceScriptHash PrettyCookedOpts -opts ScriptHash -scriptHash = +prettyReferenceScriptHash PrettyCookedOpts +opts ScriptHash +scriptHash = DocCooked "Reference script hash:" DocCooked -> DocCooked -> DocCooked forall ann. Doc ann -> Doc ann -> Doc ann -<+> Int -> ScriptHash -> DocCooked +<+> Int -> ScriptHash -> DocCooked forall a. Show a => Int -> a -> DocCooked prettyHash (PrettyCookedOpts -> Int pcOptPrintedHashLength PrettyCookedOpts -opts) ScriptHash -scriptHash +opts) ScriptHash +scriptHash \ No newline at end of file diff --git a/src/Cooked.Pretty.Options.html b/src/Cooked.Pretty.Options.html index 4fc269971..746422ae2 100644 --- a/src/Cooked.Pretty.Options.html +++ b/src/Cooked.Pretty.Options.html @@ -5,13 +5,13 @@ ) where -import Data.Default +import Data.Default data PrettyCookedOpts = PrettyCookedOpts { -- | Whether to print transaction ids of validated transactions. -- By default: False PrettyCookedOpts -> Bool -pcOptPrintTxHashes :: Bool, +pcOptPrintTxHashes :: Bool, -- | Whether to print transaction outputs references. -- By default: hidden PrettyCookedOpts -> PCOptTxOutRefs @@ -20,18 +20,18 @@ -- default. -- By default: False PrettyCookedOpts -> Bool -pcOptPrintDefaultTxOpts :: Bool, +pcOptPrintDefaultTxOpts :: Bool, -- | Length of printed hashes (e.g. addresses, transaction ids) -- By default: 7 PrettyCookedOpts -> Int -pcOptPrintedHashLength :: Int, +pcOptPrintedHashLength :: Int, -- | Whether to print big integers with numeric underscores. -- For example @53_000_000@ instead of @53000000@. -- By default: True PrettyCookedOpts -> Bool -pcOptNumericUnderscores :: Bool +pcOptNumericUnderscores :: Bool } - deriving (PrettyCookedOpts -> PrettyCookedOpts -> Bool + deriving (PrettyCookedOpts -> PrettyCookedOpts -> Bool (PrettyCookedOpts -> PrettyCookedOpts -> Bool) -> (PrettyCookedOpts -> PrettyCookedOpts -> Bool) -> Eq PrettyCookedOpts @@ -40,7 +40,7 @@ $c/= :: PrettyCookedOpts -> PrettyCookedOpts -> Bool == :: PrettyCookedOpts -> PrettyCookedOpts -> Bool $c== :: PrettyCookedOpts -> PrettyCookedOpts -> Bool -Eq, Int -> PrettyCookedOpts -> ShowS +Eq, Int -> PrettyCookedOpts -> ShowS [PrettyCookedOpts] -> ShowS PrettyCookedOpts -> String (Int -> PrettyCookedOpts -> ShowS) @@ -55,7 +55,7 @@ $cshow :: PrettyCookedOpts -> String showsPrec :: Int -> PrettyCookedOpts -> ShowS $cshowsPrec :: Int -> PrettyCookedOpts -> ShowS -Show) +Show) -- | Whether to print transaction outputs references. data PCOptTxOutRefs @@ -69,7 +69,7 @@ -- This avoids the downside of 'PCOptTxOutRefsFull' which disables printing -- UTxOs as a group. PCOptTxOutRefsPartial - deriving (PCOptTxOutRefs -> PCOptTxOutRefs -> Bool + deriving (PCOptTxOutRefs -> PCOptTxOutRefs -> Bool (PCOptTxOutRefs -> PCOptTxOutRefs -> Bool) -> (PCOptTxOutRefs -> PCOptTxOutRefs -> Bool) -> Eq PCOptTxOutRefs forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a @@ -77,7 +77,7 @@ $c/= :: PCOptTxOutRefs -> PCOptTxOutRefs -> Bool == :: PCOptTxOutRefs -> PCOptTxOutRefs -> Bool $c== :: PCOptTxOutRefs -> PCOptTxOutRefs -> Bool -Eq, Int -> PCOptTxOutRefs -> ShowS +Eq, Int -> PCOptTxOutRefs -> ShowS [PCOptTxOutRefs] -> ShowS PCOptTxOutRefs -> String (Int -> PCOptTxOutRefs -> ShowS) @@ -92,27 +92,27 @@ $cshow :: PCOptTxOutRefs -> String showsPrec :: Int -> PCOptTxOutRefs -> ShowS $cshowsPrec :: Int -> PCOptTxOutRefs -> ShowS -Show) +Show) -instance Default PrettyCookedOpts where - def :: PrettyCookedOpts -def = +instance Default PrettyCookedOpts where + def :: PrettyCookedOpts +def = PrettyCookedOpts :: Bool -> PCOptTxOutRefs -> Bool -> Int -> Bool -> PrettyCookedOpts PrettyCookedOpts { pcOptPrintTxHashes :: Bool pcOptPrintTxHashes = Bool -False, +False, pcOptPrintTxOutRefs :: PCOptTxOutRefs pcOptPrintTxOutRefs = PCOptTxOutRefs PCOptTxOutRefsHidden, pcOptPrintDefaultTxOpts :: Bool pcOptPrintDefaultTxOpts = Bool -False, +False, pcOptPrintedHashLength :: Int pcOptPrintedHashLength = Int 7, pcOptNumericUnderscores :: Bool pcOptNumericUnderscores = Bool -True +True } \ No newline at end of file diff --git a/src/Cooked.RawUPLC.html b/src/Cooked.RawUPLC.html index 2f698b7eb..2758c3704 100644 --- a/src/Cooked.RawUPLC.html +++ b/src/Cooked.RawUPLC.html @@ -8,12 +8,12 @@ ) where -import qualified Data.ByteString as BS -import qualified Flat -import Ledger.Scripts (Language (PlutusV2), Script (..), Validator (..), Versioned (Versioned)) -import qualified Ledger.Typed.Scripts as TScripts -import Unsafe.Coerce -import qualified UntypedPlutusCore as UPLC +import qualified Data.ByteString as BS +import qualified Flat +import Ledger.Scripts (Language (PlutusV2), Script (..), Validator (..), Versioned (Versioned)) +import qualified Ledger.Typed.Scripts as TScripts +import Unsafe.Coerce +import qualified UntypedPlutusCore as UPLC -- | Returns a 'TypedValidator' from a UPLC program. The "unsafe" refers to the use of 'unsafeCoerce' -- to cast a @TypedValidator Any@, resulting from 'typedValidatorFromUPLC', to a @TypedValidator a@. This @@ -23,19 +23,19 @@ -- ensuring that the type variable @a@, below, gets instantiated -- to the correct type. unsafeTypedValidatorFromUPLC :: - forall a. - UPLC.Program UPLC.NamedDeBruijn UPLC.DefaultUni UPLC.DefaultFun () -> - TScripts.TypedValidator a + forall a. + UPLC.Program UPLC.NamedDeBruijn UPLC.DefaultUni UPLC.DefaultFun () -> + TScripts.TypedValidator a unsafeTypedValidatorFromUPLC :: Program NamedDeBruijn DefaultUni DefaultFun () -> TypedValidator a unsafeTypedValidatorFromUPLC = TypedValidator Any -> TypedValidator a forall a b. a -> b -unsafeCoerce (TypedValidator Any -> TypedValidator a) +unsafeCoerce (TypedValidator Any -> TypedValidator a) -> (Program NamedDeBruijn DefaultUni DefaultFun () -> TypedValidator Any) -> Program NamedDeBruijn DefaultUni DefaultFun () -> TypedValidator a forall b c a. (b -> c) -> (a -> b) -> a -> c -. Program NamedDeBruijn DefaultUni DefaultFun () +. Program NamedDeBruijn DefaultUni DefaultFun () -> TypedValidator Any typedValidatorFromUPLC @@ -44,74 +44,74 @@ -- -- TODO: At the moment this wraps everything as a PlutusV2 script. Make this more flexible. typedValidatorFromUPLC :: - UPLC.Program UPLC.NamedDeBruijn UPLC.DefaultUni UPLC.DefaultFun () -> - TScripts.TypedValidator TScripts.Any + UPLC.Program UPLC.NamedDeBruijn UPLC.DefaultUni UPLC.DefaultFun () -> + TScripts.TypedValidator TScripts.Any typedValidatorFromUPLC :: Program NamedDeBruijn DefaultUni DefaultFun () -> TypedValidator Any typedValidatorFromUPLC = Versioned Validator -> TypedValidator Any -TScripts.unsafeMkTypedValidator (Versioned Validator -> TypedValidator Any) +TScripts.unsafeMkTypedValidator (Versioned Validator -> TypedValidator Any) -> (Program NamedDeBruijn DefaultUni DefaultFun () -> Versioned Validator) -> Program NamedDeBruijn DefaultUni DefaultFun () -> TypedValidator Any forall b c a. (b -> c) -> (a -> b) -> a -> c -. (Validator -> Language -> Versioned Validator) +. (Validator -> Language -> Versioned Validator) -> Language -> Validator -> Versioned Validator forall a b c. (a -> b -> c) -> b -> a -> c -flip Validator -> Language -> Versioned Validator +flip Validator -> Language -> Versioned Validator forall script. script -> Language -> Versioned script -Versioned Language -PlutusV2 (Validator -> Versioned Validator) +Versioned Language +PlutusV2 (Validator -> Versioned Validator) -> (Program NamedDeBruijn DefaultUni DefaultFun () -> Validator) -> Program NamedDeBruijn DefaultUni DefaultFun () -> Versioned Validator forall b c a. (b -> c) -> (a -> b) -> a -> c -. Script -> Validator -Validator (Script -> Validator) +. Script -> Validator +Validator (Script -> Validator) -> (Program NamedDeBruijn DefaultUni DefaultFun () -> Script) -> Program NamedDeBruijn DefaultUni DefaultFun () -> Validator forall b c a. (b -> c) -> (a -> b) -> a -> c -. Program NamedDeBruijn DefaultUni DefaultFun () -> Script -fromPlc +. Program NamedDeBruijn DefaultUni DefaultFun () -> Script +fromPlc where -- copied from: github.com/input-output-hk/plutus/blob/1f31e640e8a258185db01fa899da63f9018c0e85/plutus-ledger-api/src/Plutus/V1/Ledger/Scripts.hs#L169 - fromPlc :: UPLC.Program UPLC.NamedDeBruijn UPLC.DefaultUni UPLC.DefaultFun () -> Script - fromPlc :: Program NamedDeBruijn DefaultUni DefaultFun () -> Script -fromPlc (UPLC.Program () -a Version () -v Term NamedDeBruijn DefaultUni DefaultFun () -t) = - let nameless :: Term DeBruijn DefaultUni DefaultFun () -nameless = (NamedDeBruijn -> DeBruijn) + fromPlc :: UPLC.Program UPLC.NamedDeBruijn UPLC.DefaultUni UPLC.DefaultFun () -> Script + fromPlc :: Program NamedDeBruijn DefaultUni DefaultFun () -> Script +fromPlc (UPLC.Program () +a Version () +v Term NamedDeBruijn DefaultUni DefaultFun () +t) = + let nameless :: Term DeBruijn DefaultUni DefaultFun () +nameless = (NamedDeBruijn -> DeBruijn) -> Term NamedDeBruijn DefaultUni DefaultFun () -> Term DeBruijn DefaultUni DefaultFun () forall name name' (uni :: * -> *) fun ann. (name -> name') -> Term name uni fun ann -> Term name' uni fun ann -UPLC.termMapNames NamedDeBruijn -> DeBruijn -UPLC.unNameDeBruijn Term NamedDeBruijn DefaultUni DefaultFun () -t +UPLC.termMapNames NamedDeBruijn -> DeBruijn +UPLC.unNameDeBruijn Term NamedDeBruijn DefaultUni DefaultFun () +t in Program DeBruijn DefaultUni DefaultFun () -> Script -Script (Program DeBruijn DefaultUni DefaultFun () -> Script) +Script (Program DeBruijn DefaultUni DefaultFun () -> Script) -> Program DeBruijn DefaultUni DefaultFun () -> Script forall a b. (a -> b) -> a -> b -$ () +$ () -> Version () -> Term DeBruijn DefaultUni DefaultFun () -> Program DeBruijn DefaultUni DefaultFun () forall name (uni :: * -> *) fun ann. ann -> Version ann -> Term name uni fun ann -> Program name uni fun ann -UPLC.Program () -a Version () -v Term DeBruijn DefaultUni DefaultFun () -nameless +UPLC.Program () +a Version () +v Term DeBruijn DefaultUni DefaultFun () +nameless -- | Loads a typed validator from a bytestring that was produced by 'Flat.flat' the outputs -- of [getPlc](https://github.com/input-output-hk/plutus/blob/master/plutus-tx/src/PlutusTx/Code.hs#L84) -- applied to a 'TScripts.mkTypedValidator'. If the compiled validator was /not/ wrapped, -- stick to 'typedValidatorFromBS'. -unsafeTypedValidatorFromBS :: forall a. BS.ByteString -> Either String (TScripts.TypedValidator a) +unsafeTypedValidatorFromBS :: forall a. BS.ByteString -> Either String (TScripts.TypedValidator a) unsafeTypedValidatorFromBS :: ByteString -> Either String (TypedValidator a) unsafeTypedValidatorFromBS = (DecodeException -> Either String (TypedValidator a)) -> (Program NamedDeBruijn DefaultUni DefaultFun () @@ -120,24 +120,24 @@ DecodeException (Program NamedDeBruijn DefaultUni DefaultFun ()) -> Either String (TypedValidator a) forall a c b. (a -> c) -> (b -> c) -> Either a b -> c -either (String -> Either String (TypedValidator a) +either (String -> Either String (TypedValidator a) forall a b. a -> Either a b -Left (String -> Either String (TypedValidator a)) +Left (String -> Either String (TypedValidator a)) -> (DecodeException -> String) -> DecodeException -> Either String (TypedValidator a) forall b c a. (b -> c) -> (a -> b) -> a -> c -. DecodeException -> String +. DecodeException -> String forall a. Show a => a -> String -show) (TypedValidator a -> Either String (TypedValidator a) +show) (TypedValidator a -> Either String (TypedValidator a) forall a b. b -> Either a b -Right (TypedValidator a -> Either String (TypedValidator a)) +Right (TypedValidator a -> Either String (TypedValidator a)) -> (Program NamedDeBruijn DefaultUni DefaultFun () -> TypedValidator a) -> Program NamedDeBruijn DefaultUni DefaultFun () -> Either String (TypedValidator a) forall b c a. (b -> c) -> (a -> b) -> a -> c -. Program NamedDeBruijn DefaultUni DefaultFun () -> TypedValidator a +. Program NamedDeBruijn DefaultUni DefaultFun () -> TypedValidator a forall a. Program NamedDeBruijn DefaultUni DefaultFun () -> TypedValidator a unsafeTypedValidatorFromUPLC) (Either @@ -149,15 +149,15 @@ -> ByteString -> Either String (TypedValidator a) forall b c a. (b -> c) -> (a -> b) -> a -> c -. ByteString +. ByteString -> Either DecodeException (Program NamedDeBruijn DefaultUni DefaultFun ()) forall a b. (Flat a, AsByteString b) => b -> Decoded a -Flat.unflat +Flat.unflat -- | Loads a typed validator from a bytestring that was produced by 'Flat.flat' the outputs -- of [getPlc](https://github.com/input-output-hk/plutus/blob/master/plutus-tx/src/PlutusTx/Code.hs#L84). -typedValidatorFromBS :: BS.ByteString -> Either String (TScripts.TypedValidator TScripts.Any) +typedValidatorFromBS :: BS.ByteString -> Either String (TScripts.TypedValidator TScripts.Any) typedValidatorFromBS :: ByteString -> Either String (TypedValidator Any) typedValidatorFromBS = (DecodeException -> Either String (TypedValidator Any)) -> (Program NamedDeBruijn DefaultUni DefaultFun () @@ -166,24 +166,24 @@ DecodeException (Program NamedDeBruijn DefaultUni DefaultFun ()) -> Either String (TypedValidator Any) forall a c b. (a -> c) -> (b -> c) -> Either a b -> c -either (String -> Either String (TypedValidator Any) +either (String -> Either String (TypedValidator Any) forall a b. a -> Either a b -Left (String -> Either String (TypedValidator Any)) +Left (String -> Either String (TypedValidator Any)) -> (DecodeException -> String) -> DecodeException -> Either String (TypedValidator Any) forall b c a. (b -> c) -> (a -> b) -> a -> c -. DecodeException -> String +. DecodeException -> String forall a. Show a => a -> String -show) (TypedValidator Any -> Either String (TypedValidator Any) +show) (TypedValidator Any -> Either String (TypedValidator Any) forall a b. b -> Either a b -Right (TypedValidator Any -> Either String (TypedValidator Any)) +Right (TypedValidator Any -> Either String (TypedValidator Any)) -> (Program NamedDeBruijn DefaultUni DefaultFun () -> TypedValidator Any) -> Program NamedDeBruijn DefaultUni DefaultFun () -> Either String (TypedValidator Any) forall b c a. (b -> c) -> (a -> b) -> a -> c -. Program NamedDeBruijn DefaultUni DefaultFun () +. Program NamedDeBruijn DefaultUni DefaultFun () -> TypedValidator Any forall a. Program NamedDeBruijn DefaultUni DefaultFun () -> TypedValidator a @@ -196,9 +196,9 @@ -> ByteString -> Either String (TypedValidator Any) forall b c a. (b -> c) -> (a -> b) -> a -> c -. ByteString +. ByteString -> Either DecodeException (Program NamedDeBruijn DefaultUni DefaultFun ()) forall a b. (Flat a, AsByteString b) => b -> Decoded a -Flat.unflat +Flat.unflat \ No newline at end of file diff --git a/src/Cooked.ShowBS.html b/src/Cooked.ShowBS.html index 6b2f6d97d..32197f12a 100644 --- a/src/Cooked.ShowBS.html +++ b/src/Cooked.ShowBS.html @@ -18,43 +18,43 @@ -- mainnet) module Cooked.ShowBS (ShowBS (..), showBSs, app_prec) where -import Plutus.V2.Ledger.Api -import qualified PlutusTx.AssocMap as PlMap -import PlutusTx.Builtins -import PlutusTx.Prelude +import Plutus.V2.Ledger.Api +import qualified PlutusTx.AssocMap as PlMap +import PlutusTx.Builtins +import PlutusTx.Prelude -- | analogue of Haskell's 'Show' class for use in Plutus scripts. -class ShowBS a where +class ShowBS a where -- | analogue of 'show' {-# INLINEABLE showBS #-} - showBS :: a -> BuiltinString - showBS a -x = Integer -> a -> BuiltinString -> BuiltinString + showBS :: a -> BuiltinString + showBS a +x = Integer -> a -> BuiltinString -> BuiltinString forall a. ShowBS a => Integer -> a -> BuiltinString -> BuiltinString showBSsPrec Integer 0 a -x BuiltinString +x BuiltinString "" -- | analogue of 'showsPrec' {-# INLINEABLE showBSsPrec #-} - showBSsPrec :: Integer -> a -> BuiltinString -> BuiltinString - showBSsPrec Integer -_ a -x BuiltinString -s = a -> BuiltinString + showBSsPrec :: Integer -> a -> BuiltinString -> BuiltinString + showBSsPrec Integer +_ a +x BuiltinString +s = a -> BuiltinString forall a. ShowBS a => a -> BuiltinString showBS a -x BuiltinString -> BuiltinString -> BuiltinString +x BuiltinString -> BuiltinString -> BuiltinString forall a. Semigroup a => a -> a -> a -<> BuiltinString -s +<> BuiltinString +s -- | analogue of 'shows' {-# INLINEABLE showBSs #-} -showBSs :: ShowBS a => a -> BuiltinString -> BuiltinString +showBSs :: (ShowBS a) => a -> BuiltinString -> BuiltinString showBSs :: a -> BuiltinString -> BuiltinString showBSs = Integer -> a -> BuiltinString -> BuiltinString forall a. @@ -65,120 +65,120 @@ -- | Precedence of function applications {-# INLINEABLE app_prec #-} -app_prec :: Integer +app_prec :: Integer app_prec :: Integer app_prec = Integer 10 {-# INLINEABLE literal #-} -literal :: BuiltinString -> BuiltinString -> BuiltinString +literal :: BuiltinString -> BuiltinString -> BuiltinString literal :: BuiltinString -> BuiltinString -> BuiltinString literal = BuiltinString -> BuiltinString -> BuiltinString forall a. Semigroup a => a -> a -> a -(<>) +(<>) {-# INLINEABLE cat #-} -cat :: [BuiltinString] -> BuiltinString -> BuiltinString +cat :: [BuiltinString] -> BuiltinString -> BuiltinString cat :: [BuiltinString] -> BuiltinString -> BuiltinString cat [] = BuiltinString -> BuiltinString forall a. a -> a -id -- we cannot use foldr here for some reason with the plutus compiler -cat (BuiltinString -x : [BuiltinString] -xs) = BuiltinString -> BuiltinString -> BuiltinString +id -- we cannot use foldr here for some reason with the plutus compiler +cat (BuiltinString +x : [BuiltinString] +xs) = BuiltinString -> BuiltinString -> BuiltinString literal BuiltinString -x (BuiltinString -> BuiltinString) +x (BuiltinString -> BuiltinString) -> (BuiltinString -> BuiltinString) -> BuiltinString -> BuiltinString forall b c a. (b -> c) -> (a -> b) -> a -> c -. [BuiltinString] -> BuiltinString -> BuiltinString +. [BuiltinString] -> BuiltinString -> BuiltinString cat [BuiltinString] -xs +xs -- | print with a surrounding parenthesis, if the boolean argument is true {-# INLINEABLE showBSParen #-} -showBSParen :: Bool -> (BuiltinString -> BuiltinString) -> BuiltinString -> BuiltinString +showBSParen :: Bool -> (BuiltinString -> BuiltinString) -> BuiltinString -> BuiltinString showBSParen :: Bool -> (BuiltinString -> BuiltinString) -> BuiltinString -> BuiltinString showBSParen Bool -False BuiltinString -> BuiltinString -s = BuiltinString -> BuiltinString -s +False BuiltinString -> BuiltinString +s = BuiltinString -> BuiltinString +s showBSParen Bool -True BuiltinString -> BuiltinString -s = BuiltinString -> BuiltinString -> BuiltinString +True BuiltinString -> BuiltinString +s = BuiltinString -> BuiltinString -> BuiltinString literal BuiltinString "(" (BuiltinString -> BuiltinString) -> (BuiltinString -> BuiltinString) -> BuiltinString -> BuiltinString forall b c a. (b -> c) -> (a -> b) -> a -> c -. BuiltinString -> BuiltinString -s (BuiltinString -> BuiltinString) +. BuiltinString -> BuiltinString +s (BuiltinString -> BuiltinString) -> (BuiltinString -> BuiltinString) -> BuiltinString -> BuiltinString forall b c a. (b -> c) -> (a -> b) -> a -> c -. BuiltinString -> BuiltinString -> BuiltinString +. BuiltinString -> BuiltinString -> BuiltinString literal BuiltinString ")" -- | print an application of a constructor to an argument {-# INLINEABLE application1 #-} -application1 :: ShowBS a => Integer -> BuiltinString -> a -> BuiltinString -> BuiltinString +application1 :: (ShowBS a) => Integer -> BuiltinString -> a -> BuiltinString -> BuiltinString application1 :: Integer -> BuiltinString -> a -> BuiltinString -> BuiltinString -application1 Integer -prec BuiltinString -f a -x = Bool +application1 Integer +prec BuiltinString +f a +x = Bool -> (BuiltinString -> BuiltinString) -> BuiltinString -> BuiltinString showBSParen (Integer app_prec Integer -> Integer -> Bool forall a. Ord a => a -> a -> Bool -<= Integer -prec) ((BuiltinString -> BuiltinString) +<= Integer +prec) ((BuiltinString -> BuiltinString) -> BuiltinString -> BuiltinString) -> (BuiltinString -> BuiltinString) -> BuiltinString -> BuiltinString forall a b. (a -> b) -> a -> b -$ BuiltinString -> BuiltinString -> BuiltinString +$ BuiltinString -> BuiltinString -> BuiltinString literal BuiltinString -f (BuiltinString -> BuiltinString) +f (BuiltinString -> BuiltinString) -> (BuiltinString -> BuiltinString) -> BuiltinString -> BuiltinString forall b c a. (b -> c) -> (a -> b) -> a -> c -. BuiltinString -> BuiltinString -> BuiltinString +. BuiltinString -> BuiltinString -> BuiltinString literal BuiltinString " " (BuiltinString -> BuiltinString) -> (BuiltinString -> BuiltinString) -> BuiltinString -> BuiltinString forall b c a. (b -> c) -> (a -> b) -> a -> c -. Integer -> a -> BuiltinString -> BuiltinString +. Integer -> a -> BuiltinString -> BuiltinString forall a. ShowBS a => Integer -> a -> BuiltinString -> BuiltinString showBSsPrec Integer app_prec a -x +x -- | like 'application1' with two arguments {-# INLINEABLE application2 #-} -application2 :: (ShowBS a, ShowBS b) => Integer -> BuiltinString -> a -> b -> BuiltinString -> BuiltinString +application2 :: (ShowBS a, ShowBS b) => Integer -> BuiltinString -> a -> b -> BuiltinString -> BuiltinString application2 :: Integer -> BuiltinString -> a -> b -> BuiltinString -> BuiltinString -application2 Integer -prec BuiltinString -f a -x b -y = +application2 Integer +prec BuiltinString +f a +x b +y = Bool -> (BuiltinString -> BuiltinString) -> BuiltinString @@ -186,23 +186,23 @@ showBSParen (Integer app_prec Integer -> Integer -> Bool forall a. Ord a => a -> a -> Bool -<= Integer -prec) ((BuiltinString -> BuiltinString) +<= Integer +prec) ((BuiltinString -> BuiltinString) -> BuiltinString -> BuiltinString) -> (BuiltinString -> BuiltinString) -> BuiltinString -> BuiltinString forall a b. (a -> b) -> a -> b -$ +$ BuiltinString -> BuiltinString -> BuiltinString literal BuiltinString -f +f (BuiltinString -> BuiltinString) -> (BuiltinString -> BuiltinString) -> BuiltinString -> BuiltinString forall b c a. (b -> c) -> (a -> b) -> a -> c -. BuiltinString -> BuiltinString -> BuiltinString +. BuiltinString -> BuiltinString -> BuiltinString literal BuiltinString " " (BuiltinString -> BuiltinString) @@ -210,19 +210,19 @@ -> BuiltinString -> BuiltinString forall b c a. (b -> c) -> (a -> b) -> a -> c -. Integer -> a -> BuiltinString -> BuiltinString +. Integer -> a -> BuiltinString -> BuiltinString forall a. ShowBS a => Integer -> a -> BuiltinString -> BuiltinString showBSsPrec Integer app_prec a -x +x (BuiltinString -> BuiltinString) -> (BuiltinString -> BuiltinString) -> BuiltinString -> BuiltinString forall b c a. (b -> c) -> (a -> b) -> a -> c -. BuiltinString -> BuiltinString -> BuiltinString +. BuiltinString -> BuiltinString -> BuiltinString literal BuiltinString " " (BuiltinString -> BuiltinString) @@ -230,25 +230,25 @@ -> BuiltinString -> BuiltinString forall b c a. (b -> c) -> (a -> b) -> a -> c -. Integer -> b -> BuiltinString -> BuiltinString +. Integer -> b -> BuiltinString -> BuiltinString forall a. ShowBS a => Integer -> a -> BuiltinString -> BuiltinString showBSsPrec Integer app_prec b -y +y -- | like 'application1' with three arguments {-# INLINEABLE application3 #-} -application3 :: (ShowBS a, ShowBS b, ShowBS c) => Integer -> BuiltinString -> a -> b -> c -> BuiltinString -> BuiltinString +application3 :: (ShowBS a, ShowBS b, ShowBS c) => Integer -> BuiltinString -> a -> b -> c -> BuiltinString -> BuiltinString application3 :: Integer -> BuiltinString -> a -> b -> c -> BuiltinString -> BuiltinString -application3 Integer -prec BuiltinString -f a -x b -y c -z = +application3 Integer +prec BuiltinString +f a +x b +y c +z = Bool -> (BuiltinString -> BuiltinString) -> BuiltinString @@ -256,23 +256,23 @@ showBSParen (Integer app_prec Integer -> Integer -> Bool forall a. Ord a => a -> a -> Bool -<= Integer -prec) ((BuiltinString -> BuiltinString) +<= Integer +prec) ((BuiltinString -> BuiltinString) -> BuiltinString -> BuiltinString) -> (BuiltinString -> BuiltinString) -> BuiltinString -> BuiltinString forall a b. (a -> b) -> a -> b -$ +$ BuiltinString -> BuiltinString -> BuiltinString literal BuiltinString -f +f (BuiltinString -> BuiltinString) -> (BuiltinString -> BuiltinString) -> BuiltinString -> BuiltinString forall b c a. (b -> c) -> (a -> b) -> a -> c -. BuiltinString -> BuiltinString -> BuiltinString +. BuiltinString -> BuiltinString -> BuiltinString literal BuiltinString " " (BuiltinString -> BuiltinString) @@ -280,19 +280,19 @@ -> BuiltinString -> BuiltinString forall b c a. (b -> c) -> (a -> b) -> a -> c -. Integer -> a -> BuiltinString -> BuiltinString +. Integer -> a -> BuiltinString -> BuiltinString forall a. ShowBS a => Integer -> a -> BuiltinString -> BuiltinString showBSsPrec Integer app_prec a -x +x (BuiltinString -> BuiltinString) -> (BuiltinString -> BuiltinString) -> BuiltinString -> BuiltinString forall b c a. (b -> c) -> (a -> b) -> a -> c -. BuiltinString -> BuiltinString -> BuiltinString +. BuiltinString -> BuiltinString -> BuiltinString literal BuiltinString " " (BuiltinString -> BuiltinString) @@ -300,19 +300,19 @@ -> BuiltinString -> BuiltinString forall b c a. (b -> c) -> (a -> b) -> a -> c -. Integer -> b -> BuiltinString -> BuiltinString +. Integer -> b -> BuiltinString -> BuiltinString forall a. ShowBS a => Integer -> a -> BuiltinString -> BuiltinString showBSsPrec Integer app_prec b -y +y (BuiltinString -> BuiltinString) -> (BuiltinString -> BuiltinString) -> BuiltinString -> BuiltinString forall b c a. (b -> c) -> (a -> b) -> a -> c -. BuiltinString -> BuiltinString -> BuiltinString +. BuiltinString -> BuiltinString -> BuiltinString literal BuiltinString " " (BuiltinString -> BuiltinString) @@ -320,17 +320,17 @@ -> BuiltinString -> BuiltinString forall b c a. (b -> c) -> (a -> b) -> a -> c -. Integer -> c -> BuiltinString -> BuiltinString +. Integer -> c -> BuiltinString -> BuiltinString forall a. ShowBS a => Integer -> a -> BuiltinString -> BuiltinString showBSsPrec Integer app_prec c -z +z -- | like 'application1' with four arguments {-# INLINEABLE application4 #-} -application4 :: (ShowBS a, ShowBS b, ShowBS c, ShowBS d) => Integer -> BuiltinString -> a -> b -> c -> d -> BuiltinString -> BuiltinString +application4 :: (ShowBS a, ShowBS b, ShowBS c, ShowBS d) => Integer -> BuiltinString -> a -> b -> c -> d -> BuiltinString -> BuiltinString application4 :: Integer -> BuiltinString -> a @@ -339,13 +339,13 @@ -> d -> BuiltinString -> BuiltinString -application4 Integer -prec BuiltinString -f a -x b -y c -z d -w = +application4 Integer +prec BuiltinString +f a +x b +y c +z d +w = Bool -> (BuiltinString -> BuiltinString) -> BuiltinString @@ -353,23 +353,23 @@ showBSParen (Integer app_prec Integer -> Integer -> Bool forall a. Ord a => a -> a -> Bool -<= Integer -prec) ((BuiltinString -> BuiltinString) +<= Integer +prec) ((BuiltinString -> BuiltinString) -> BuiltinString -> BuiltinString) -> (BuiltinString -> BuiltinString) -> BuiltinString -> BuiltinString forall a b. (a -> b) -> a -> b -$ +$ BuiltinString -> BuiltinString -> BuiltinString literal BuiltinString -f +f (BuiltinString -> BuiltinString) -> (BuiltinString -> BuiltinString) -> BuiltinString -> BuiltinString forall b c a. (b -> c) -> (a -> b) -> a -> c -. BuiltinString -> BuiltinString -> BuiltinString +. BuiltinString -> BuiltinString -> BuiltinString literal BuiltinString " " (BuiltinString -> BuiltinString) @@ -377,19 +377,19 @@ -> BuiltinString -> BuiltinString forall b c a. (b -> c) -> (a -> b) -> a -> c -. Integer -> a -> BuiltinString -> BuiltinString +. Integer -> a -> BuiltinString -> BuiltinString forall a. ShowBS a => Integer -> a -> BuiltinString -> BuiltinString showBSsPrec Integer app_prec a -x +x (BuiltinString -> BuiltinString) -> (BuiltinString -> BuiltinString) -> BuiltinString -> BuiltinString forall b c a. (b -> c) -> (a -> b) -> a -> c -. BuiltinString -> BuiltinString -> BuiltinString +. BuiltinString -> BuiltinString -> BuiltinString literal BuiltinString " " (BuiltinString -> BuiltinString) @@ -397,19 +397,19 @@ -> BuiltinString -> BuiltinString forall b c a. (b -> c) -> (a -> b) -> a -> c -. Integer -> b -> BuiltinString -> BuiltinString +. Integer -> b -> BuiltinString -> BuiltinString forall a. ShowBS a => Integer -> a -> BuiltinString -> BuiltinString showBSsPrec Integer app_prec b -y +y (BuiltinString -> BuiltinString) -> (BuiltinString -> BuiltinString) -> BuiltinString -> BuiltinString forall b c a. (b -> c) -> (a -> b) -> a -> c -. BuiltinString -> BuiltinString -> BuiltinString +. BuiltinString -> BuiltinString -> BuiltinString literal BuiltinString " " (BuiltinString -> BuiltinString) @@ -417,19 +417,19 @@ -> BuiltinString -> BuiltinString forall b c a. (b -> c) -> (a -> b) -> a -> c -. Integer -> c -> BuiltinString -> BuiltinString +. Integer -> c -> BuiltinString -> BuiltinString forall a. ShowBS a => Integer -> a -> BuiltinString -> BuiltinString showBSsPrec Integer app_prec c -z +z (BuiltinString -> BuiltinString) -> (BuiltinString -> BuiltinString) -> BuiltinString -> BuiltinString forall b c a. (b -> c) -> (a -> b) -> a -> c -. BuiltinString -> BuiltinString -> BuiltinString +. BuiltinString -> BuiltinString -> BuiltinString literal BuiltinString " " (BuiltinString -> BuiltinString) @@ -437,150 +437,150 @@ -> BuiltinString -> BuiltinString forall b c a. (b -> c) -> (a -> b) -> a -> c -. Integer -> d -> BuiltinString -> BuiltinString +. Integer -> d -> BuiltinString -> BuiltinString forall a. ShowBS a => Integer -> a -> BuiltinString -> BuiltinString showBSsPrec Integer app_prec d -w +w -instance ShowBS Integer where +instance ShowBS Integer where {-# INLINEABLE showBSsPrec #-} - showBSsPrec :: Integer -> Integer -> BuiltinString -> BuiltinString -showBSsPrec Integer -_ Integer -i = [BuiltinString] -> BuiltinString -> BuiltinString + showBSsPrec :: Integer -> Integer -> BuiltinString -> BuiltinString +showBSsPrec Integer +_ Integer +i = [BuiltinString] -> BuiltinString -> BuiltinString cat (Integer -> [BuiltinString] integerToDigits Integer -i) +i) {-# INLINEABLE integerToDigits #-} -integerToDigits :: Integer -> [BuiltinString] +integerToDigits :: Integer -> [BuiltinString] integerToDigits :: Integer -> [BuiltinString] -integerToDigits Integer -n +integerToDigits Integer +n | Integer -n Integer -> Integer -> Bool +n Integer -> Integer -> Bool forall a. Ord a => a -> a -> Bool -< Integer +< Integer 0 = BuiltinString "-" BuiltinString -> [BuiltinString] -> [BuiltinString] forall a. a -> [a] -> [a] -: Integer -> [BuiltinString] -> [BuiltinString] -go (Integer -> Integer +: Integer -> [BuiltinString] -> [BuiltinString] +go (Integer -> Integer forall a. AdditiveGroup a => a -> a -negate Integer -n) [] +negate Integer +n) [] | Integer -n Integer -> Integer -> Bool +n Integer -> Integer -> Bool forall a. Eq a => a -> a -> Bool -== Integer +== Integer 0 = [BuiltinString "0"] | Bool -otherwise = Integer -> [BuiltinString] -> [BuiltinString] -go Integer -n [] +otherwise = Integer -> [BuiltinString] -> [BuiltinString] +go Integer +n [] where - go :: Integer -> [BuiltinString] -> [BuiltinString] -go Integer -i [BuiltinString] -acc + go :: Integer -> [BuiltinString] -> [BuiltinString] +go Integer +i [BuiltinString] +acc | Integer -i Integer -> Integer -> Bool +i Integer -> Integer -> Bool forall a. Eq a => a -> a -> Bool -== Integer +== Integer 0 = [BuiltinString] -acc +acc | Bool -otherwise = let (Integer -q, Integer -r) = Integer -> Integer -> (Integer, Integer) -quotRem Integer -i Integer +otherwise = let (Integer +q, Integer +r) = Integer -> Integer -> (Integer, Integer) +quotRem Integer +i Integer 10 in Integer -> [BuiltinString] -> [BuiltinString] -go Integer -q (Integer -> BuiltinString +go Integer +q (Integer -> BuiltinString digitToBS Integer -r BuiltinString -> [BuiltinString] -> [BuiltinString] +r BuiltinString -> [BuiltinString] -> [BuiltinString] forall a. a -> [a] -> [a] -: [BuiltinString] -acc) +: [BuiltinString] +acc) {-# INLINEABLE digitToBS #-} -digitToBS :: Integer -> BuiltinString +digitToBS :: Integer -> BuiltinString digitToBS :: Integer -> BuiltinString -digitToBS Integer -x +digitToBS Integer +x | Integer -x Integer -> Integer -> Bool +x Integer -> Integer -> Bool forall a. Eq a => a -> a -> Bool -== Integer +== Integer 0 = BuiltinString "0" | Integer -x Integer -> Integer -> Bool +x Integer -> Integer -> Bool forall a. Eq a => a -> a -> Bool -== Integer +== Integer 1 = BuiltinString "1" | Integer -x Integer -> Integer -> Bool +x Integer -> Integer -> Bool forall a. Eq a => a -> a -> Bool -== Integer +== Integer 2 = BuiltinString "2" | Integer -x Integer -> Integer -> Bool +x Integer -> Integer -> Bool forall a. Eq a => a -> a -> Bool -== Integer +== Integer 3 = BuiltinString "3" | Integer -x Integer -> Integer -> Bool +x Integer -> Integer -> Bool forall a. Eq a => a -> a -> Bool -== Integer +== Integer 4 = BuiltinString "4" | Integer -x Integer -> Integer -> Bool +x Integer -> Integer -> Bool forall a. Eq a => a -> a -> Bool -== Integer +== Integer 5 = BuiltinString "5" | Integer -x Integer -> Integer -> Bool +x Integer -> Integer -> Bool forall a. Eq a => a -> a -> Bool -== Integer +== Integer 6 = BuiltinString "6" | Integer -x Integer -> Integer -> Bool +x Integer -> Integer -> Bool forall a. Eq a => a -> a -> Bool -== Integer +== Integer 7 = BuiltinString "7" | Integer -x Integer -> Integer -> Bool +x Integer -> Integer -> Bool forall a. Eq a => a -> a -> Bool -== Integer +== Integer 8 = BuiltinString "8" | Integer -x Integer -> Integer -> Bool +x Integer -> Integer -> Bool forall a. Eq a => a -> a -> Bool -== Integer +== Integer 9 = BuiltinString "9" | Bool -otherwise = BuiltinString +otherwise = BuiltinString "?" -instance ShowBS a => ShowBS [a] where +instance (ShowBS a) => ShowBS [a] where {-# INLINEABLE showBSsPrec #-} - showBSsPrec :: Integer -> [a] -> BuiltinString -> BuiltinString -showBSsPrec Integer + showBSsPrec :: Integer -> [a] -> BuiltinString -> BuiltinString +showBSsPrec Integer _ = BuiltinString -> BuiltinString -> BuiltinString @@ -604,7 +604,7 @@ showBSs {-# INLINEABLE catList #-} -catList :: BuiltinString -> BuiltinString -> BuiltinString -> (a -> BuiltinString -> BuiltinString) -> [a] -> BuiltinString -> BuiltinString +catList :: BuiltinString -> BuiltinString -> BuiltinString -> (a -> BuiltinString -> BuiltinString) -> [a] -> BuiltinString -> BuiltinString catList :: BuiltinString -> BuiltinString -> BuiltinString @@ -612,300 +612,300 @@ -> [a] -> BuiltinString -> BuiltinString -catList BuiltinString -open BuiltinString -_ BuiltinString -close a -> BuiltinString -> BuiltinString +catList BuiltinString +open BuiltinString +_ BuiltinString +close a -> BuiltinString -> BuiltinString _ [] = BuiltinString -> BuiltinString -> BuiltinString literal BuiltinString -open (BuiltinString -> BuiltinString) +open (BuiltinString -> BuiltinString) -> (BuiltinString -> BuiltinString) -> BuiltinString -> BuiltinString forall b c a. (b -> c) -> (a -> b) -> a -> c -. BuiltinString -> BuiltinString -> BuiltinString +. BuiltinString -> BuiltinString -> BuiltinString literal BuiltinString -close -catList BuiltinString -open BuiltinString -sep BuiltinString -close a -> BuiltinString -> BuiltinString -print (a -x : [a] -xs) = BuiltinString -> BuiltinString -> BuiltinString +close +catList BuiltinString +open BuiltinString +sep BuiltinString +close a -> BuiltinString -> BuiltinString +print (a +x : [a] +xs) = BuiltinString -> BuiltinString -> BuiltinString literal BuiltinString -open (BuiltinString -> BuiltinString) +open (BuiltinString -> BuiltinString) -> (BuiltinString -> BuiltinString) -> BuiltinString -> BuiltinString forall b c a. (b -> c) -> (a -> b) -> a -> c -. a -> BuiltinString -> BuiltinString -print a -x (BuiltinString -> BuiltinString) +. a -> BuiltinString -> BuiltinString +print a +x (BuiltinString -> BuiltinString) -> (BuiltinString -> BuiltinString) -> BuiltinString -> BuiltinString forall b c a. (b -> c) -> (a -> b) -> a -> c -. [a] -> BuiltinString -> BuiltinString -printSeparated [a] -xs (BuiltinString -> BuiltinString) +. [a] -> BuiltinString -> BuiltinString +printSeparated [a] +xs (BuiltinString -> BuiltinString) -> (BuiltinString -> BuiltinString) -> BuiltinString -> BuiltinString forall b c a. (b -> c) -> (a -> b) -> a -> c -. BuiltinString -> BuiltinString -> BuiltinString +. BuiltinString -> BuiltinString -> BuiltinString literal BuiltinString -close +close where - printSeparated :: [a] -> BuiltinString -> BuiltinString -printSeparated [] = BuiltinString -> BuiltinString + printSeparated :: [a] -> BuiltinString -> BuiltinString +printSeparated [] = BuiltinString -> BuiltinString forall a. a -> a -id - printSeparated (a -y : [a] -ys) = BuiltinString -> BuiltinString -> BuiltinString +id + printSeparated (a +y : [a] +ys) = BuiltinString -> BuiltinString -> BuiltinString literal BuiltinString -sep (BuiltinString -> BuiltinString) +sep (BuiltinString -> BuiltinString) -> (BuiltinString -> BuiltinString) -> BuiltinString -> BuiltinString forall b c a. (b -> c) -> (a -> b) -> a -> c -. a -> BuiltinString -> BuiltinString -print a -y (BuiltinString -> BuiltinString) +. a -> BuiltinString -> BuiltinString +print a +y (BuiltinString -> BuiltinString) -> (BuiltinString -> BuiltinString) -> BuiltinString -> BuiltinString forall b c a. (b -> c) -> (a -> b) -> a -> c -. [a] -> BuiltinString -> BuiltinString -printSeparated [a] -ys +. [a] -> BuiltinString -> BuiltinString +printSeparated [a] +ys -instance (ShowBS a, ShowBS b) => ShowBS (a, b) where +instance (ShowBS a, ShowBS b) => ShowBS (a, b) where {-# INLINEABLE showBSsPrec #-} - showBSsPrec :: Integer -> (a, b) -> BuiltinString -> BuiltinString -showBSsPrec Integer -_ (a -x, b -y) = BuiltinString -> BuiltinString -> BuiltinString + showBSsPrec :: Integer -> (a, b) -> BuiltinString -> BuiltinString +showBSsPrec Integer +_ (a +x, b +y) = BuiltinString -> BuiltinString -> BuiltinString literal BuiltinString "(" (BuiltinString -> BuiltinString) -> (BuiltinString -> BuiltinString) -> BuiltinString -> BuiltinString forall b c a. (b -> c) -> (a -> b) -> a -> c -. a -> BuiltinString -> BuiltinString +. a -> BuiltinString -> BuiltinString forall a. ShowBS a => a -> BuiltinString -> BuiltinString showBSs a -x (BuiltinString -> BuiltinString) +x (BuiltinString -> BuiltinString) -> (BuiltinString -> BuiltinString) -> BuiltinString -> BuiltinString forall b c a. (b -> c) -> (a -> b) -> a -> c -. BuiltinString -> BuiltinString -> BuiltinString +. BuiltinString -> BuiltinString -> BuiltinString literal BuiltinString "," (BuiltinString -> BuiltinString) -> (BuiltinString -> BuiltinString) -> BuiltinString -> BuiltinString forall b c a. (b -> c) -> (a -> b) -> a -> c -. b -> BuiltinString -> BuiltinString +. b -> BuiltinString -> BuiltinString forall a. ShowBS a => a -> BuiltinString -> BuiltinString showBSs b -y (BuiltinString -> BuiltinString) +y (BuiltinString -> BuiltinString) -> (BuiltinString -> BuiltinString) -> BuiltinString -> BuiltinString forall b c a. (b -> c) -> (a -> b) -> a -> c -. BuiltinString -> BuiltinString -> BuiltinString +. BuiltinString -> BuiltinString -> BuiltinString literal BuiltinString ")" -instance ShowBS Bool where +instance ShowBS Bool where {-# INLINEABLE showBSsPrec #-} - showBSsPrec :: Integer -> Bool -> BuiltinString -> BuiltinString -showBSsPrec Integer + showBSsPrec :: Integer -> Bool -> BuiltinString -> BuiltinString +showBSsPrec Integer _ Bool -True = BuiltinString -> BuiltinString -> BuiltinString +True = BuiltinString -> BuiltinString -> BuiltinString literal BuiltinString "True" showBSsPrec Integer _ Bool -False = BuiltinString -> BuiltinString -> BuiltinString +False = BuiltinString -> BuiltinString -> BuiltinString literal BuiltinString "False" -instance ShowBS a => ShowBS (Maybe a) where +instance (ShowBS a) => ShowBS (Maybe a) where {-# INLINEABLE showBSsPrec #-} - showBSsPrec :: Integer -> Maybe a -> BuiltinString -> BuiltinString -showBSsPrec Integer + showBSsPrec :: Integer -> Maybe a -> BuiltinString -> BuiltinString +showBSsPrec Integer _ Maybe a -Nothing = BuiltinString -> BuiltinString -> BuiltinString +Nothing = BuiltinString -> BuiltinString -> BuiltinString literal BuiltinString "Nothing" - showBSsPrec Integer -p (Just a -x) = Integer -> BuiltinString -> a -> BuiltinString -> BuiltinString + showBSsPrec Integer +p (Just a +x) = Integer -> BuiltinString -> a -> BuiltinString -> BuiltinString forall a. ShowBS a => Integer -> BuiltinString -> a -> BuiltinString -> BuiltinString application1 Integer -p BuiltinString +p BuiltinString "Just" a -x +x -instance (ShowBS k, ShowBS v) => ShowBS (Map k v) where +instance (ShowBS k, ShowBS v) => ShowBS (Map k v) where {-# INLINEABLE showBSsPrec #-} - showBSsPrec :: Integer -> Map k v -> BuiltinString -> BuiltinString -showBSsPrec Integer -p Map k v -m = Integer + showBSsPrec :: Integer -> Map k v -> BuiltinString -> BuiltinString +showBSsPrec Integer +p Map k v +m = Integer -> BuiltinString -> [(k, v)] -> BuiltinString -> BuiltinString forall a. ShowBS a => Integer -> BuiltinString -> a -> BuiltinString -> BuiltinString application1 Integer -p BuiltinString +p BuiltinString "fromList" (Map k v -> [(k, v)] forall k v. Map k v -> [(k, v)] -PlMap.toList Map k v -m) +PlMap.toList Map k v +m) -instance ShowBS BuiltinByteString where +instance ShowBS BuiltinByteString where -- base16 representation {-# INLINEABLE showBSsPrec #-} - showBSsPrec :: Integer -> BuiltinByteString -> BuiltinString -> BuiltinString -showBSsPrec Integer -_ BuiltinByteString -bs = BuiltinString -> BuiltinString -> BuiltinString + showBSsPrec :: Integer -> BuiltinByteString -> BuiltinString -> BuiltinString +showBSsPrec Integer +_ BuiltinByteString +bs = BuiltinString -> BuiltinString -> BuiltinString literal BuiltinString "\"" (BuiltinString -> BuiltinString) -> (BuiltinString -> BuiltinString) -> BuiltinString -> BuiltinString forall b c a. (b -> c) -> (a -> b) -> a -> c -. [BuiltinString] -> BuiltinString -> BuiltinString +. [BuiltinString] -> BuiltinString -> BuiltinString cat (BuiltinByteString -> [BuiltinString] builtinByteStringCharacters BuiltinByteString -bs) (BuiltinString -> BuiltinString) +bs) (BuiltinString -> BuiltinString) -> (BuiltinString -> BuiltinString) -> BuiltinString -> BuiltinString forall b c a. (b -> c) -> (a -> b) -> a -> c -. BuiltinString -> BuiltinString -> BuiltinString +. BuiltinString -> BuiltinString -> BuiltinString literal BuiltinString "\"" {-# INLINEABLE builtinByteStringCharacters #-} -builtinByteStringCharacters :: BuiltinByteString -> [BuiltinString] +builtinByteStringCharacters :: BuiltinByteString -> [BuiltinString] builtinByteStringCharacters :: BuiltinByteString -> [BuiltinString] -builtinByteStringCharacters BuiltinByteString -s = Integer -> [BuiltinString] -> [BuiltinString] -go (Integer -len Integer -> Integer -> Integer +builtinByteStringCharacters BuiltinByteString +s = Integer -> [BuiltinString] -> [BuiltinString] +go (Integer +len Integer -> Integer -> Integer forall a. AdditiveGroup a => a -> a -> a -- Integer +- Integer 1) [] where - len :: Integer -len = BuiltinByteString -> Integer -lengthOfByteString BuiltinByteString -s + len :: Integer +len = BuiltinByteString -> Integer +lengthOfByteString BuiltinByteString +s - go :: Integer -> [BuiltinString] -> [BuiltinString] - go :: Integer -> [BuiltinString] -> [BuiltinString] -go Integer -i [BuiltinString] -acc + go :: Integer -> [BuiltinString] -> [BuiltinString] + go :: Integer -> [BuiltinString] -> [BuiltinString] +go Integer +i [BuiltinString] +acc | Integer -i Integer -> Integer -> Bool +i Integer -> Integer -> Bool forall a. Ord a => a -> a -> Bool ->= Integer +>= Integer 0 = - let (Integer -highNibble, Integer -lowNibble) = Integer -> Integer -> (Integer, Integer) -quotRem (BuiltinByteString -> Integer -> Integer -indexByteString BuiltinByteString -s Integer -i) Integer + let (Integer +highNibble, Integer +lowNibble) = Integer -> Integer -> (Integer, Integer) +quotRem (BuiltinByteString -> Integer -> Integer +indexByteString BuiltinByteString +s Integer +i) Integer 16 in Integer -> [BuiltinString] -> [BuiltinString] -go (Integer -i Integer -> Integer -> Integer +go (Integer +i Integer -> Integer -> Integer forall a. AdditiveGroup a => a -> a -> a -- Integer +- Integer 1) (Integer -> BuiltinString -toHex Integer -highNibble BuiltinString -> [BuiltinString] -> [BuiltinString] +toHex Integer +highNibble BuiltinString -> [BuiltinString] -> [BuiltinString] forall a. a -> [a] -> [a] -: Integer -> BuiltinString -toHex Integer -lowNibble BuiltinString -> [BuiltinString] -> [BuiltinString] +: Integer -> BuiltinString +toHex Integer +lowNibble BuiltinString -> [BuiltinString] -> [BuiltinString] forall a. a -> [a] -> [a] -: [BuiltinString] -acc) +: [BuiltinString] +acc) | Bool -otherwise = [BuiltinString] -acc +otherwise = [BuiltinString] +acc - toHex :: Integer -> BuiltinString - toHex :: Integer -> BuiltinString -toHex Integer -x + toHex :: Integer -> BuiltinString + toHex :: Integer -> BuiltinString +toHex Integer +x | Integer -x Integer -> Integer -> Bool +x Integer -> Integer -> Bool forall a. Ord a => a -> a -> Bool -<= Integer +<= Integer 9 = Integer -> BuiltinString digitToBS Integer -x +x | Integer -x Integer -> Integer -> Bool +x Integer -> Integer -> Bool forall a. Eq a => a -> a -> Bool -== Integer +== Integer 10 = BuiltinString "a" | Integer -x Integer -> Integer -> Bool +x Integer -> Integer -> Bool forall a. Eq a => a -> a -> Bool -== Integer +== Integer 11 = BuiltinString "b" | Integer -x Integer -> Integer -> Bool +x Integer -> Integer -> Bool forall a. Eq a => a -> a -> Bool -== Integer +== Integer 12 = BuiltinString "c" | Integer -x Integer -> Integer -> Bool +x Integer -> Integer -> Bool forall a. Eq a => a -> a -> Bool -== Integer +== Integer 13 = BuiltinString "d" | Integer -x Integer -> Integer -> Bool +x Integer -> Integer -> Bool forall a. Eq a => a -> a -> Bool -== Integer +== Integer 14 = BuiltinString "e" | Integer -x Integer -> Integer -> Bool +x Integer -> Integer -> Bool forall a. Eq a => a -> a -> Bool -== Integer +== Integer 15 = BuiltinString "f" | Bool -otherwise = BuiltinString +otherwise = BuiltinString "?" -instance ShowBS TokenName where +instance ShowBS TokenName where {-# INLINEABLE showBSsPrec #-} - showBSsPrec :: Integer -> TokenName -> BuiltinString -> BuiltinString -showBSsPrec Integer -p (TokenName BuiltinByteString -x) = Integer + showBSsPrec :: Integer -> TokenName -> BuiltinString -> BuiltinString +showBSsPrec Integer +p (TokenName BuiltinByteString +x) = Integer -> BuiltinString -> BuiltinByteString -> BuiltinString @@ -914,16 +914,16 @@ ShowBS a => Integer -> BuiltinString -> a -> BuiltinString -> BuiltinString application1 Integer -p BuiltinString +p BuiltinString "TokenName" BuiltinByteString -x +x -instance ShowBS CurrencySymbol where +instance ShowBS CurrencySymbol where {-# INLINEABLE showBSsPrec #-} - showBSsPrec :: Integer -> CurrencySymbol -> BuiltinString -> BuiltinString -showBSsPrec Integer -p (CurrencySymbol BuiltinByteString -x) = Integer + showBSsPrec :: Integer -> CurrencySymbol -> BuiltinString -> BuiltinString +showBSsPrec Integer +p (CurrencySymbol BuiltinByteString +x) = Integer -> BuiltinString -> BuiltinByteString -> BuiltinString @@ -932,16 +932,16 @@ ShowBS a => Integer -> BuiltinString -> a -> BuiltinString -> BuiltinString application1 Integer -p BuiltinString +p BuiltinString "CurrencySymbol" BuiltinByteString -x +x -instance ShowBS Value where +instance ShowBS Value where {-# INLINEABLE showBSsPrec #-} - showBSsPrec :: Integer -> Value -> BuiltinString -> BuiltinString -showBSsPrec Integer -p (Value Map CurrencySymbol (Map TokenName Integer) -m) = Integer + showBSsPrec :: Integer -> Value -> BuiltinString -> BuiltinString +showBSsPrec Integer +p (Value Map CurrencySymbol (Map TokenName Integer) +m) = Integer -> BuiltinString -> Map CurrencySymbol (Map TokenName Integer) -> BuiltinString @@ -950,16 +950,16 @@ ShowBS a => Integer -> BuiltinString -> a -> BuiltinString -> BuiltinString application1 Integer -p BuiltinString +p BuiltinString "Value" Map CurrencySymbol (Map TokenName Integer) -m +m -instance ShowBS TxId where +instance ShowBS TxId where {-# INLINEABLE showBSsPrec #-} - showBSsPrec :: Integer -> TxId -> BuiltinString -> BuiltinString -showBSsPrec Integer -p (TxId BuiltinByteString -x) = Integer + showBSsPrec :: Integer -> TxId -> BuiltinString -> BuiltinString +showBSsPrec Integer +p (TxId BuiltinByteString +x) = Integer -> BuiltinString -> BuiltinByteString -> BuiltinString @@ -968,17 +968,17 @@ ShowBS a => Integer -> BuiltinString -> a -> BuiltinString -> BuiltinString application1 Integer -p BuiltinString +p BuiltinString "TxId" BuiltinByteString -x +x -instance ShowBS TxOutRef where +instance ShowBS TxOutRef where {-# INLINEABLE showBSsPrec #-} - showBSsPrec :: Integer -> TxOutRef -> BuiltinString -> BuiltinString -showBSsPrec Integer -p (TxOutRef TxId -txid Integer -i) = Integer + showBSsPrec :: Integer -> TxOutRef -> BuiltinString -> BuiltinString +showBSsPrec Integer +p (TxOutRef TxId +txid Integer +i) = Integer -> BuiltinString -> TxId -> Integer @@ -989,17 +989,17 @@ Integer -> BuiltinString -> a -> b -> BuiltinString -> BuiltinString application2 Integer -p BuiltinString +p BuiltinString "TxOutRef" TxId -txid Integer -i +txid Integer +i -instance ShowBS ValidatorHash where +instance ShowBS ValidatorHash where {-# INLINEABLE showBSsPrec #-} - showBSsPrec :: Integer -> ValidatorHash -> BuiltinString -> BuiltinString -showBSsPrec Integer -p (ValidatorHash BuiltinByteString -h) = Integer + showBSsPrec :: Integer -> ValidatorHash -> BuiltinString -> BuiltinString +showBSsPrec Integer +p (ValidatorHash BuiltinByteString +h) = Integer -> BuiltinString -> BuiltinByteString -> BuiltinString @@ -1008,16 +1008,16 @@ ShowBS a => Integer -> BuiltinString -> a -> BuiltinString -> BuiltinString application1 Integer -p BuiltinString +p BuiltinString "ValidatorHash" BuiltinByteString -h +h -instance ShowBS PubKeyHash where +instance ShowBS PubKeyHash where {-# INLINEABLE showBSsPrec #-} - showBSsPrec :: Integer -> PubKeyHash -> BuiltinString -> BuiltinString -showBSsPrec Integer -p (PubKeyHash BuiltinByteString -h) = Integer + showBSsPrec :: Integer -> PubKeyHash -> BuiltinString -> BuiltinString +showBSsPrec Integer +p (PubKeyHash BuiltinByteString +h) = Integer -> BuiltinString -> BuiltinByteString -> BuiltinString @@ -1026,55 +1026,55 @@ ShowBS a => Integer -> BuiltinString -> a -> BuiltinString -> BuiltinString application1 Integer -p BuiltinString +p BuiltinString "PubKeyHash" BuiltinByteString -h +h -instance ShowBS Credential where +instance ShowBS Credential where {-# INLINEABLE showBSsPrec #-} - showBSsPrec :: Integer -> Credential -> BuiltinString -> BuiltinString -showBSsPrec Integer -p (ScriptCredential ValidatorHash -scriptHash) = Integer + showBSsPrec :: Integer -> Credential -> BuiltinString -> BuiltinString +showBSsPrec Integer +p (ScriptCredential ValidatorHash +scriptHash) = Integer -> BuiltinString -> ValidatorHash -> BuiltinString -> BuiltinString forall a. ShowBS a => Integer -> BuiltinString -> a -> BuiltinString -> BuiltinString application1 Integer -p BuiltinString +p BuiltinString "ScriptCredential" ValidatorHash -scriptHash - showBSsPrec Integer -p (PubKeyCredential PubKeyHash -pkh) = Integer +scriptHash + showBSsPrec Integer +p (PubKeyCredential PubKeyHash +pkh) = Integer -> BuiltinString -> PubKeyHash -> BuiltinString -> BuiltinString forall a. ShowBS a => Integer -> BuiltinString -> a -> BuiltinString -> BuiltinString application1 Integer -p BuiltinString +p BuiltinString "PubKeyCredential" PubKeyHash -pkh +pkh -instance ShowBS StakingCredential where +instance ShowBS StakingCredential where {-# INLINEABLE showBSsPrec #-} - showBSsPrec :: Integer -> StakingCredential -> BuiltinString -> BuiltinString -showBSsPrec Integer -p (StakingHash Credential -cred) = Integer + showBSsPrec :: Integer -> StakingCredential -> BuiltinString -> BuiltinString +showBSsPrec Integer +p (StakingHash Credential +cred) = Integer -> BuiltinString -> Credential -> BuiltinString -> BuiltinString forall a. ShowBS a => Integer -> BuiltinString -> a -> BuiltinString -> BuiltinString application1 Integer -p BuiltinString +p BuiltinString "StakingCredential" Credential -cred - showBSsPrec Integer -p (StakingPtr Integer -i Integer -j Integer -k) = Integer +cred + showBSsPrec Integer +p (StakingPtr Integer +i Integer +j Integer +k) = Integer -> BuiltinString -> Integer -> Integer @@ -1086,19 +1086,19 @@ Integer -> BuiltinString -> a -> b -> c -> BuiltinString -> BuiltinString application3 Integer -p BuiltinString +p BuiltinString "StakingPtr" Integer -i Integer -j Integer -k +i Integer +j Integer +k -instance ShowBS Address where +instance ShowBS Address where {-# INLINEABLE showBSsPrec #-} - showBSsPrec :: Integer -> Address -> BuiltinString -> BuiltinString -showBSsPrec Integer -p (Address Credential -cred Maybe StakingCredential -mStCred) = Integer + showBSsPrec :: Integer -> Address -> BuiltinString -> BuiltinString +showBSsPrec Integer +p (Address Credential +cred Maybe StakingCredential +mStCred) = Integer -> BuiltinString -> Credential -> Maybe StakingCredential @@ -1109,17 +1109,17 @@ Integer -> BuiltinString -> a -> b -> BuiltinString -> BuiltinString application2 Integer -p BuiltinString +p BuiltinString "Address" Credential -cred Maybe StakingCredential -mStCred +cred Maybe StakingCredential +mStCred -instance ShowBS DatumHash where +instance ShowBS DatumHash where {-# INLINEABLE showBSsPrec #-} - showBSsPrec :: Integer -> DatumHash -> BuiltinString -> BuiltinString -showBSsPrec Integer -p (DatumHash BuiltinByteString -h) = Integer + showBSsPrec :: Integer -> DatumHash -> BuiltinString -> BuiltinString +showBSsPrec Integer +p (DatumHash BuiltinByteString +h) = Integer -> BuiltinString -> BuiltinByteString -> BuiltinString @@ -1128,47 +1128,47 @@ ShowBS a => Integer -> BuiltinString -> a -> BuiltinString -> BuiltinString application1 Integer -p BuiltinString +p BuiltinString "DatumHash" BuiltinByteString -h +h -instance ShowBS BuiltinData where +instance ShowBS BuiltinData where {-# INLINEABLE showBSsPrec #-} - showBSsPrec :: Integer -> BuiltinData -> BuiltinString -> BuiltinString -showBSsPrec Integer -p BuiltinData -d = Bool + showBSsPrec :: Integer -> BuiltinData -> BuiltinString -> BuiltinString +showBSsPrec Integer +p BuiltinData +d = Bool -> (BuiltinString -> BuiltinString) -> BuiltinString -> BuiltinString showBSParen (Integer app_prec Integer -> Integer -> Bool forall a. Ord a => a -> a -> Bool -<= Integer -p) ((BuiltinString -> BuiltinString) +<= Integer +p) ((BuiltinString -> BuiltinString) -> BuiltinString -> BuiltinString) -> (BuiltinString -> BuiltinString) -> BuiltinString -> BuiltinString forall a b. (a -> b) -> a -> b -$ BuiltinString -> BuiltinString -> BuiltinString +$ BuiltinString -> BuiltinString -> BuiltinString literal BuiltinString "BuiltinData " (BuiltinString -> BuiltinString) -> (BuiltinString -> BuiltinString) -> BuiltinString -> BuiltinString forall b c a. (b -> c) -> (a -> b) -> a -> c -. Integer -> BuiltinData -> BuiltinString -> BuiltinString +. Integer -> BuiltinData -> BuiltinString -> BuiltinString builtinDataShowBSsPrec Integer app_prec BuiltinData -d +d {-# INLINEABLE builtinDataShowBSsPrec #-} -builtinDataShowBSsPrec :: Integer -> BuiltinData -> BuiltinString -> BuiltinString +builtinDataShowBSsPrec :: Integer -> BuiltinData -> BuiltinString -> BuiltinString builtinDataShowBSsPrec :: Integer -> BuiltinData -> BuiltinString -> BuiltinString -builtinDataShowBSsPrec Integer -p BuiltinData -d = +builtinDataShowBSsPrec Integer +p BuiltinData +d = BuiltinData -> (Integer -> [BuiltinData] -> BuiltinString -> BuiltinString) -> ([(BuiltinData, BuiltinData)] -> BuiltinString -> BuiltinString) @@ -1185,12 +1185,12 @@ -> (Integer -> r) -> (BuiltinByteString -> r) -> r -matchData +matchData BuiltinData -d - ( \Integer -i [BuiltinData] -ds -> +d + ( \Integer +i [BuiltinData] +ds -> Bool -> (BuiltinString -> BuiltinString) -> BuiltinString @@ -1198,14 +1198,14 @@ showBSParen (Integer app_prec Integer -> Integer -> Bool forall a. Ord a => a -> a -> Bool -<= Integer -p) ((BuiltinString -> BuiltinString) +<= Integer +p) ((BuiltinString -> BuiltinString) -> BuiltinString -> BuiltinString) -> (BuiltinString -> BuiltinString) -> BuiltinString -> BuiltinString forall a b. (a -> b) -> a -> b -$ +$ BuiltinString -> BuiltinString -> BuiltinString literal BuiltinString "Constr " @@ -1214,16 +1214,16 @@ -> BuiltinString -> BuiltinString forall b c a. (b -> c) -> (a -> b) -> a -> c -. Integer -> BuiltinString -> BuiltinString +. Integer -> BuiltinString -> BuiltinString forall a. ShowBS a => a -> BuiltinString -> BuiltinString showBSs Integer -i +i (BuiltinString -> BuiltinString) -> (BuiltinString -> BuiltinString) -> BuiltinString -> BuiltinString forall b c a. (b -> c) -> (a -> b) -> a -> c -. BuiltinString -> BuiltinString -> BuiltinString +. BuiltinString -> BuiltinString -> BuiltinString literal BuiltinString " " (BuiltinString -> BuiltinString) @@ -1231,7 +1231,7 @@ -> BuiltinString -> BuiltinString forall b c a. (b -> c) -> (a -> b) -> a -> c -. BuiltinString +. BuiltinString -> BuiltinString -> BuiltinString -> (BuiltinData -> BuiltinString -> BuiltinString) @@ -1252,10 +1252,10 @@ "]" (Integer -> BuiltinData -> BuiltinString -> BuiltinString builtinDataShowBSsPrec Integer 0) [BuiltinData] -ds +ds ) - ( \[(BuiltinData, BuiltinData)] -alist -> + ( \[(BuiltinData, BuiltinData)] +alist -> Bool -> (BuiltinString -> BuiltinString) -> BuiltinString @@ -1263,14 +1263,14 @@ showBSParen (Integer app_prec Integer -> Integer -> Bool forall a. Ord a => a -> a -> Bool -<= Integer -p) ((BuiltinString -> BuiltinString) +<= Integer +p) ((BuiltinString -> BuiltinString) -> BuiltinString -> BuiltinString) -> (BuiltinString -> BuiltinString) -> BuiltinString -> BuiltinString forall a b. (a -> b) -> a -> b -$ +$ BuiltinString -> BuiltinString -> BuiltinString literal BuiltinString "Map " @@ -1279,7 +1279,7 @@ -> BuiltinString -> BuiltinString forall b c a. (b -> c) -> (a -> b) -> a -> c -. BuiltinString +. BuiltinString -> BuiltinString -> BuiltinString -> ((BuiltinData, BuiltinData) -> BuiltinString -> BuiltinString) @@ -1301,46 +1301,46 @@ "," BuiltinString "]" - (\(BuiltinData -a, BuiltinData -b) -> BuiltinString -> BuiltinString -> BuiltinString + (\(BuiltinData +a, BuiltinData +b) -> BuiltinString -> BuiltinString -> BuiltinString literal BuiltinString "(" (BuiltinString -> BuiltinString) -> (BuiltinString -> BuiltinString) -> BuiltinString -> BuiltinString forall b c a. (b -> c) -> (a -> b) -> a -> c -. Integer -> BuiltinData -> BuiltinString -> BuiltinString +. Integer -> BuiltinData -> BuiltinString -> BuiltinString builtinDataShowBSsPrec Integer 0 BuiltinData -a (BuiltinString -> BuiltinString) +a (BuiltinString -> BuiltinString) -> (BuiltinString -> BuiltinString) -> BuiltinString -> BuiltinString forall b c a. (b -> c) -> (a -> b) -> a -> c -. BuiltinString -> BuiltinString -> BuiltinString +. BuiltinString -> BuiltinString -> BuiltinString literal BuiltinString "," (BuiltinString -> BuiltinString) -> (BuiltinString -> BuiltinString) -> BuiltinString -> BuiltinString forall b c a. (b -> c) -> (a -> b) -> a -> c -. Integer -> BuiltinData -> BuiltinString -> BuiltinString +. Integer -> BuiltinData -> BuiltinString -> BuiltinString builtinDataShowBSsPrec Integer 0 BuiltinData -b (BuiltinString -> BuiltinString) +b (BuiltinString -> BuiltinString) -> (BuiltinString -> BuiltinString) -> BuiltinString -> BuiltinString forall b c a. (b -> c) -> (a -> b) -> a -> c -. BuiltinString -> BuiltinString -> BuiltinString +. BuiltinString -> BuiltinString -> BuiltinString literal BuiltinString ")") [(BuiltinData, BuiltinData)] -alist +alist ) - ( \[BuiltinData] -list -> + ( \[BuiltinData] +list -> Bool -> (BuiltinString -> BuiltinString) -> BuiltinString @@ -1348,14 +1348,14 @@ showBSParen (Integer app_prec Integer -> Integer -> Bool forall a. Ord a => a -> a -> Bool -<= Integer -p) ((BuiltinString -> BuiltinString) +<= Integer +p) ((BuiltinString -> BuiltinString) -> BuiltinString -> BuiltinString) -> (BuiltinString -> BuiltinString) -> BuiltinString -> BuiltinString forall a b. (a -> b) -> a -> b -$ +$ BuiltinString -> BuiltinString -> BuiltinString literal BuiltinString "List " @@ -1364,7 +1364,7 @@ -> BuiltinString -> BuiltinString forall b c a. (b -> c) -> (a -> b) -> a -> c -. BuiltinString +. BuiltinString -> BuiltinString -> BuiltinString -> (BuiltinData -> BuiltinString -> BuiltinString) @@ -1385,112 +1385,112 @@ "]" (Integer -> BuiltinData -> BuiltinString -> BuiltinString builtinDataShowBSsPrec Integer 0) [BuiltinData] -list +list ) - (\Integer -i -> Bool + (\Integer +i -> Bool -> (BuiltinString -> BuiltinString) -> BuiltinString -> BuiltinString showBSParen (Integer app_prec Integer -> Integer -> Bool forall a. Ord a => a -> a -> Bool -<= Integer -p) ((BuiltinString -> BuiltinString) +<= Integer +p) ((BuiltinString -> BuiltinString) -> BuiltinString -> BuiltinString) -> (BuiltinString -> BuiltinString) -> BuiltinString -> BuiltinString forall a b. (a -> b) -> a -> b -$ BuiltinString -> BuiltinString -> BuiltinString +$ BuiltinString -> BuiltinString -> BuiltinString literal BuiltinString "I " (BuiltinString -> BuiltinString) -> (BuiltinString -> BuiltinString) -> BuiltinString -> BuiltinString forall b c a. (b -> c) -> (a -> b) -> a -> c -. Integer -> BuiltinString -> BuiltinString +. Integer -> BuiltinString -> BuiltinString forall a. ShowBS a => a -> BuiltinString -> BuiltinString showBSs Integer -i) - (\BuiltinByteString -bs -> Bool +i) + (\BuiltinByteString +bs -> Bool -> (BuiltinString -> BuiltinString) -> BuiltinString -> BuiltinString showBSParen (Integer app_prec Integer -> Integer -> Bool forall a. Ord a => a -> a -> Bool -<= Integer -p) ((BuiltinString -> BuiltinString) +<= Integer +p) ((BuiltinString -> BuiltinString) -> BuiltinString -> BuiltinString) -> (BuiltinString -> BuiltinString) -> BuiltinString -> BuiltinString forall a b. (a -> b) -> a -> b -$ BuiltinString -> BuiltinString -> BuiltinString +$ BuiltinString -> BuiltinString -> BuiltinString literal BuiltinString "B " (BuiltinString -> BuiltinString) -> (BuiltinString -> BuiltinString) -> BuiltinString -> BuiltinString forall b c a. (b -> c) -> (a -> b) -> a -> c -. BuiltinByteString -> BuiltinString -> BuiltinString +. BuiltinByteString -> BuiltinString -> BuiltinString forall a. ShowBS a => a -> BuiltinString -> BuiltinString showBSs BuiltinByteString -bs) +bs) -instance ShowBS Datum where +instance ShowBS Datum where {-# INLINEABLE showBSsPrec #-} - showBSsPrec :: Integer -> Datum -> BuiltinString -> BuiltinString -showBSsPrec Integer -p (Datum BuiltinData -d) = Integer + showBSsPrec :: Integer -> Datum -> BuiltinString -> BuiltinString +showBSsPrec Integer +p (Datum BuiltinData +d) = Integer -> BuiltinString -> BuiltinData -> BuiltinString -> BuiltinString forall a. ShowBS a => Integer -> BuiltinString -> a -> BuiltinString -> BuiltinString application1 Integer -p BuiltinString +p BuiltinString "Datum" BuiltinData -d +d -instance ShowBS OutputDatum where +instance ShowBS OutputDatum where {-# INLINEABLE showBSsPrec #-} - showBSsPrec :: Integer -> OutputDatum -> BuiltinString -> BuiltinString -showBSsPrec Integer + showBSsPrec :: Integer -> OutputDatum -> BuiltinString -> BuiltinString +showBSsPrec Integer _ OutputDatum -NoOutputDatum = BuiltinString -> BuiltinString -> BuiltinString +NoOutputDatum = BuiltinString -> BuiltinString -> BuiltinString literal BuiltinString "NoOutputDatum" - showBSsPrec Integer -p (OutputDatumHash DatumHash -h) = Integer + showBSsPrec Integer +p (OutputDatumHash DatumHash +h) = Integer -> BuiltinString -> DatumHash -> BuiltinString -> BuiltinString forall a. ShowBS a => Integer -> BuiltinString -> a -> BuiltinString -> BuiltinString application1 Integer -p BuiltinString +p BuiltinString "OutputDatumHash" DatumHash -h - showBSsPrec Integer -p (OutputDatum Datum -d) = Integer -> BuiltinString -> Datum -> BuiltinString -> BuiltinString +h + showBSsPrec Integer +p (OutputDatum Datum +d) = Integer -> BuiltinString -> Datum -> BuiltinString -> BuiltinString forall a. ShowBS a => Integer -> BuiltinString -> a -> BuiltinString -> BuiltinString application1 Integer -p BuiltinString +p BuiltinString "OutputDatum" Datum -d +d -instance ShowBS ScriptHash where +instance ShowBS ScriptHash where {-# INLINEABLE showBSsPrec #-} - showBSsPrec :: Integer -> ScriptHash -> BuiltinString -> BuiltinString -showBSsPrec Integer -p (ScriptHash BuiltinByteString -h) = Integer + showBSsPrec :: Integer -> ScriptHash -> BuiltinString -> BuiltinString +showBSsPrec Integer +p (ScriptHash BuiltinByteString +h) = Integer -> BuiltinString -> BuiltinByteString -> BuiltinString @@ -1499,19 +1499,19 @@ ShowBS a => Integer -> BuiltinString -> a -> BuiltinString -> BuiltinString application1 Integer -p BuiltinString +p BuiltinString "ScriptHash" BuiltinByteString -h +h -instance ShowBS TxOut where +instance ShowBS TxOut where {-# INLINEABLE showBSsPrec #-} - showBSsPrec :: Integer -> TxOut -> BuiltinString -> BuiltinString -showBSsPrec Integer -p (TxOut Address -address Value -value OutputDatum -datum Maybe ScriptHash -mRefScriptHash) = Integer + showBSsPrec :: Integer -> TxOut -> BuiltinString -> BuiltinString +showBSsPrec Integer +p (TxOut Address +address Value +value OutputDatum +datum Maybe ScriptHash +mRefScriptHash) = Integer -> BuiltinString -> Address -> Value @@ -1530,20 +1530,20 @@ -> BuiltinString -> BuiltinString application4 Integer -p BuiltinString +p BuiltinString "TxOut" Address -address Value -value OutputDatum -datum Maybe ScriptHash -mRefScriptHash +address Value +value OutputDatum +datum Maybe ScriptHash +mRefScriptHash -instance ShowBS TxInInfo where +instance ShowBS TxInInfo where {-# INLINEABLE showBSsPrec #-} - showBSsPrec :: Integer -> TxInInfo -> BuiltinString -> BuiltinString -showBSsPrec Integer -p (TxInInfo TxOutRef -oref TxOut -out) = Integer + showBSsPrec :: Integer -> TxInInfo -> BuiltinString -> BuiltinString +showBSsPrec Integer +p (TxInInfo TxOutRef +oref TxOut +out) = Integer -> BuiltinString -> TxOutRef -> TxOut @@ -1554,57 +1554,57 @@ Integer -> BuiltinString -> a -> b -> BuiltinString -> BuiltinString application2 Integer -p BuiltinString +p BuiltinString "TxInInfo" TxOutRef -oref TxOut -out +oref TxOut +out -instance ShowBS POSIXTime where +instance ShowBS POSIXTime where {-# INLINEABLE showBSsPrec #-} - showBSsPrec :: Integer -> POSIXTime -> BuiltinString -> BuiltinString -showBSsPrec Integer -p (POSIXTime Integer -t) = Integer + showBSsPrec :: Integer -> POSIXTime -> BuiltinString -> BuiltinString +showBSsPrec Integer +p (POSIXTime Integer +t) = Integer -> BuiltinString -> Integer -> BuiltinString -> BuiltinString forall a. ShowBS a => Integer -> BuiltinString -> a -> BuiltinString -> BuiltinString application1 Integer -p BuiltinString +p BuiltinString "POSIXTime" Integer -t +t -instance ShowBS a => ShowBS (Extended a) where +instance (ShowBS a) => ShowBS (Extended a) where {-# INLINEABLE showBSsPrec #-} - showBSsPrec :: Integer -> Extended a -> BuiltinString -> BuiltinString -showBSsPrec Integer + showBSsPrec :: Integer -> Extended a -> BuiltinString -> BuiltinString +showBSsPrec Integer _ Extended a -NegInf = BuiltinString -> BuiltinString -> BuiltinString +NegInf = BuiltinString -> BuiltinString -> BuiltinString literal BuiltinString "NegInf" showBSsPrec Integer _ Extended a -PosInf = BuiltinString -> BuiltinString -> BuiltinString +PosInf = BuiltinString -> BuiltinString -> BuiltinString literal BuiltinString "PosInf" - showBSsPrec Integer -p (Finite a -x) = Integer -> BuiltinString -> a -> BuiltinString -> BuiltinString + showBSsPrec Integer +p (Finite a +x) = Integer -> BuiltinString -> a -> BuiltinString -> BuiltinString forall a. ShowBS a => Integer -> BuiltinString -> a -> BuiltinString -> BuiltinString application1 Integer -p BuiltinString +p BuiltinString "Finite" a -x +x -instance ShowBS a => ShowBS (LowerBound a) where +instance (ShowBS a) => ShowBS (LowerBound a) where {-# INLINEABLE showBSsPrec #-} - showBSsPrec :: Integer -> LowerBound a -> BuiltinString -> BuiltinString -showBSsPrec Integer -p (LowerBound Extended a -x Bool -closure) = Integer + showBSsPrec :: Integer -> LowerBound a -> BuiltinString -> BuiltinString +showBSsPrec Integer +p (LowerBound Extended a +x Bool +closure) = Integer -> BuiltinString -> Extended a -> Bool @@ -1615,18 +1615,18 @@ Integer -> BuiltinString -> a -> b -> BuiltinString -> BuiltinString application2 Integer -p BuiltinString +p BuiltinString "LowerBound" Extended a -x Bool -closure +x Bool +closure -instance ShowBS a => ShowBS (UpperBound a) where +instance (ShowBS a) => ShowBS (UpperBound a) where {-# INLINEABLE showBSsPrec #-} - showBSsPrec :: Integer -> UpperBound a -> BuiltinString -> BuiltinString -showBSsPrec Integer -p (UpperBound Extended a -x Bool -closure) = Integer + showBSsPrec :: Integer -> UpperBound a -> BuiltinString -> BuiltinString +showBSsPrec Integer +p (UpperBound Extended a +x Bool +closure) = Integer -> BuiltinString -> Extended a -> Bool @@ -1637,18 +1637,18 @@ Integer -> BuiltinString -> a -> b -> BuiltinString -> BuiltinString application2 Integer -p BuiltinString +p BuiltinString "UpperBound" Extended a -x Bool -closure +x Bool +closure -instance ShowBS a => ShowBS (Interval a) where +instance (ShowBS a) => ShowBS (Interval a) where {-# INLINEABLE showBSsPrec #-} - showBSsPrec :: Integer -> Interval a -> BuiltinString -> BuiltinString -showBSsPrec Integer -p (Interval LowerBound a -lb UpperBound a -ub) = Integer + showBSsPrec :: Integer -> Interval a -> BuiltinString -> BuiltinString +showBSsPrec Integer +p (Interval LowerBound a +lb UpperBound a +ub) = Integer -> BuiltinString -> LowerBound a -> UpperBound a @@ -1659,17 +1659,17 @@ Integer -> BuiltinString -> a -> b -> BuiltinString -> BuiltinString application2 Integer -p BuiltinString +p BuiltinString "Interval" LowerBound a -lb UpperBound a -ub +lb UpperBound a +ub -instance ShowBS DCert where +instance ShowBS DCert where {-# INLINEABLE showBSsPrec #-} - showBSsPrec :: Integer -> DCert -> BuiltinString -> BuiltinString -showBSsPrec Integer -p (DCertDelegRegKey StakingCredential -stCred) = Integer + showBSsPrec :: Integer -> DCert -> BuiltinString -> BuiltinString +showBSsPrec Integer +p (DCertDelegRegKey StakingCredential +stCred) = Integer -> BuiltinString -> StakingCredential -> BuiltinString @@ -1678,12 +1678,12 @@ ShowBS a => Integer -> BuiltinString -> a -> BuiltinString -> BuiltinString application1 Integer -p BuiltinString +p BuiltinString "DCertDelegRegKey" StakingCredential -stCred - showBSsPrec Integer -p (DCertDelegDeRegKey StakingCredential -stCred) = Integer +stCred + showBSsPrec Integer +p (DCertDelegDeRegKey StakingCredential +stCred) = Integer -> BuiltinString -> StakingCredential -> BuiltinString @@ -1692,13 +1692,13 @@ ShowBS a => Integer -> BuiltinString -> a -> BuiltinString -> BuiltinString application1 Integer -p BuiltinString +p BuiltinString "DCertDelegDeRegKey" StakingCredential -stCred - showBSsPrec Integer -p (DCertDelegDelegate StakingCredential -stCred PubKeyHash -pkh) = Integer +stCred + showBSsPrec Integer +p (DCertDelegDelegate StakingCredential +stCred PubKeyHash +pkh) = Integer -> BuiltinString -> StakingCredential -> PubKeyHash @@ -1709,14 +1709,14 @@ Integer -> BuiltinString -> a -> b -> BuiltinString -> BuiltinString application2 Integer -p BuiltinString +p BuiltinString "DCertDelegDelegate" StakingCredential -stCred PubKeyHash -pkh - showBSsPrec Integer -p (DCertPoolRegister PubKeyHash -stCred1 PubKeyHash -stCred2) = Integer +stCred PubKeyHash +pkh + showBSsPrec Integer +p (DCertPoolRegister PubKeyHash +stCred1 PubKeyHash +stCred2) = Integer -> BuiltinString -> PubKeyHash -> PubKeyHash @@ -1727,14 +1727,14 @@ Integer -> BuiltinString -> a -> b -> BuiltinString -> BuiltinString application2 Integer -p BuiltinString +p BuiltinString "DCertPoolRegister" PubKeyHash -stCred1 PubKeyHash -stCred2 - showBSsPrec Integer -p (DCertPoolRetire PubKeyHash -stCred Integer -i) = Integer +stCred1 PubKeyHash +stCred2 + showBSsPrec Integer +p (DCertPoolRetire PubKeyHash +stCred Integer +i) = Integer -> BuiltinString -> PubKeyHash -> Integer @@ -1745,27 +1745,27 @@ Integer -> BuiltinString -> a -> b -> BuiltinString -> BuiltinString application2 Integer -p BuiltinString +p BuiltinString "DCertPoolRetire" PubKeyHash -stCred Integer -i +stCred Integer +i showBSsPrec Integer _ DCert -DCertGenesis = BuiltinString -> BuiltinString -> BuiltinString +DCertGenesis = BuiltinString -> BuiltinString -> BuiltinString literal BuiltinString "DCertGenesis" showBSsPrec Integer _ DCert -DCertMir = BuiltinString -> BuiltinString -> BuiltinString +DCertMir = BuiltinString -> BuiltinString -> BuiltinString literal BuiltinString "DCertMir" -instance ShowBS ScriptPurpose where +instance ShowBS ScriptPurpose where {-# INLINEABLE showBSsPrec #-} - showBSsPrec :: Integer -> ScriptPurpose -> BuiltinString -> BuiltinString -showBSsPrec Integer -p (Minting CurrencySymbol -cs) = Integer + showBSsPrec :: Integer -> ScriptPurpose -> BuiltinString -> BuiltinString +showBSsPrec Integer +p (Minting CurrencySymbol +cs) = Integer -> BuiltinString -> CurrencySymbol -> BuiltinString @@ -1774,23 +1774,23 @@ ShowBS a => Integer -> BuiltinString -> a -> BuiltinString -> BuiltinString application1 Integer -p BuiltinString +p BuiltinString "Minting" CurrencySymbol -cs - showBSsPrec Integer -p (Spending TxOutRef -oref) = Integer +cs + showBSsPrec Integer +p (Spending TxOutRef +oref) = Integer -> BuiltinString -> TxOutRef -> BuiltinString -> BuiltinString forall a. ShowBS a => Integer -> BuiltinString -> a -> BuiltinString -> BuiltinString application1 Integer -p BuiltinString +p BuiltinString "Spending" TxOutRef -oref - showBSsPrec Integer -p (Rewarding StakingCredential -stCred) = Integer +oref + showBSsPrec Integer +p (Rewarding StakingCredential +stCred) = Integer -> BuiltinString -> StakingCredential -> BuiltinString @@ -1799,61 +1799,61 @@ ShowBS a => Integer -> BuiltinString -> a -> BuiltinString -> BuiltinString application1 Integer -p BuiltinString +p BuiltinString "Rewarding" StakingCredential -stCred - showBSsPrec Integer -p (Certifying DCert -dCert) = Integer -> BuiltinString -> DCert -> BuiltinString -> BuiltinString +stCred + showBSsPrec Integer +p (Certifying DCert +dCert) = Integer -> BuiltinString -> DCert -> BuiltinString -> BuiltinString forall a. ShowBS a => Integer -> BuiltinString -> a -> BuiltinString -> BuiltinString application1 Integer -p BuiltinString +p BuiltinString "Certifying" DCert -dCert +dCert -instance ShowBS Redeemer where +instance ShowBS Redeemer where {-# INLINEABLE showBSsPrec #-} - showBSsPrec :: Integer -> Redeemer -> BuiltinString -> BuiltinString -showBSsPrec Integer -p (Redeemer BuiltinData -builtinData) = Integer + showBSsPrec :: Integer -> Redeemer -> BuiltinString -> BuiltinString +showBSsPrec Integer +p (Redeemer BuiltinData +builtinData) = Integer -> BuiltinString -> BuiltinData -> BuiltinString -> BuiltinString forall a. ShowBS a => Integer -> BuiltinString -> a -> BuiltinString -> BuiltinString application1 Integer -p BuiltinString +p BuiltinString "Redeemer" BuiltinData -builtinData +builtinData -instance ShowBS TxInfo where +instance ShowBS TxInfo where {-# INLINEABLE showBSsPrec #-} - showBSsPrec :: Integer -> TxInfo -> BuiltinString -> BuiltinString -showBSsPrec Integer -p TxInfo {[PubKeyHash] + showBSsPrec :: Integer -> TxInfo -> BuiltinString -> BuiltinString +showBSsPrec Integer +p TxInfo {[PubKeyHash] [DCert] [TxInInfo] [TxOut] Value -Map DatumHash Datum -Map ScriptPurpose Redeemer -Map StakingCredential Integer POSIXTimeRange TxId +Map DatumHash Datum +Map StakingCredential Integer +Map ScriptPurpose Redeemer +txInfoInputs :: TxInfo -> [TxInInfo] +txInfoReferenceInputs :: TxInfo -> [TxInInfo] +txInfoOutputs :: TxInfo -> [TxOut] +txInfoFee :: TxInfo -> Value +txInfoMint :: TxInfo -> Value +txInfoDCert :: TxInfo -> [DCert] txInfoWdrl :: TxInfo -> Map StakingCredential Integer txInfoValidRange :: TxInfo -> POSIXTimeRange txInfoSignatories :: TxInfo -> [PubKeyHash] -txInfoReferenceInputs :: TxInfo -> [TxInInfo] txInfoRedeemers :: TxInfo -> Map ScriptPurpose Redeemer -txInfoOutputs :: TxInfo -> [TxOut] -txInfoMint :: TxInfo -> Value -txInfoInputs :: TxInfo -> [TxInInfo] -txInfoId :: TxInfo -> TxId -txInfoFee :: TxInfo -> Value txInfoData :: TxInfo -> Map DatumHash Datum -txInfoDCert :: TxInfo -> [DCert] +txInfoId :: TxInfo -> TxId txInfoId :: TxId txInfoData :: Map DatumHash Datum txInfoRedeemers :: Map ScriptPurpose Redeemer @@ -1866,7 +1866,7 @@ txInfoOutputs :: [TxOut] txInfoReferenceInputs :: [TxInInfo] txInfoInputs :: [TxInInfo] -..} = +..} = Bool -> (BuiltinString -> BuiltinString) -> BuiltinString @@ -1874,14 +1874,14 @@ showBSParen (Integer app_prec Integer -> Integer -> Bool forall a. Ord a => a -> a -> Bool -<= Integer -p) ((BuiltinString -> BuiltinString) +<= Integer +p) ((BuiltinString -> BuiltinString) -> BuiltinString -> BuiltinString) -> (BuiltinString -> BuiltinString) -> BuiltinString -> BuiltinString forall a b. (a -> b) -> a -> b -$ +$ BuiltinString -> BuiltinString -> BuiltinString literal BuiltinString "TxInfo " @@ -1890,19 +1890,19 @@ -> BuiltinString -> BuiltinString forall b c a. (b -> c) -> (a -> b) -> a -> c -. Integer -> [TxInInfo] -> BuiltinString -> BuiltinString +. Integer -> [TxInInfo] -> BuiltinString -> BuiltinString forall a. ShowBS a => Integer -> a -> BuiltinString -> BuiltinString showBSsPrec Integer app_prec [TxInInfo] -txInfoInputs +txInfoInputs (BuiltinString -> BuiltinString) -> (BuiltinString -> BuiltinString) -> BuiltinString -> BuiltinString forall b c a. (b -> c) -> (a -> b) -> a -> c -. BuiltinString -> BuiltinString -> BuiltinString +. BuiltinString -> BuiltinString -> BuiltinString literal BuiltinString " " (BuiltinString -> BuiltinString) @@ -1910,19 +1910,19 @@ -> BuiltinString -> BuiltinString forall b c a. (b -> c) -> (a -> b) -> a -> c -. Integer -> [TxInInfo] -> BuiltinString -> BuiltinString +. Integer -> [TxInInfo] -> BuiltinString -> BuiltinString forall a. ShowBS a => Integer -> a -> BuiltinString -> BuiltinString showBSsPrec Integer app_prec [TxInInfo] -txInfoReferenceInputs +txInfoReferenceInputs (BuiltinString -> BuiltinString) -> (BuiltinString -> BuiltinString) -> BuiltinString -> BuiltinString forall b c a. (b -> c) -> (a -> b) -> a -> c -. BuiltinString -> BuiltinString -> BuiltinString +. BuiltinString -> BuiltinString -> BuiltinString literal BuiltinString " " (BuiltinString -> BuiltinString) @@ -1930,19 +1930,19 @@ -> BuiltinString -> BuiltinString forall b c a. (b -> c) -> (a -> b) -> a -> c -. Integer -> [TxOut] -> BuiltinString -> BuiltinString +. Integer -> [TxOut] -> BuiltinString -> BuiltinString forall a. ShowBS a => Integer -> a -> BuiltinString -> BuiltinString showBSsPrec Integer app_prec [TxOut] -txInfoOutputs +txInfoOutputs (BuiltinString -> BuiltinString) -> (BuiltinString -> BuiltinString) -> BuiltinString -> BuiltinString forall b c a. (b -> c) -> (a -> b) -> a -> c -. BuiltinString -> BuiltinString -> BuiltinString +. BuiltinString -> BuiltinString -> BuiltinString literal BuiltinString " " (BuiltinString -> BuiltinString) @@ -1950,19 +1950,19 @@ -> BuiltinString -> BuiltinString forall b c a. (b -> c) -> (a -> b) -> a -> c -. Integer -> Value -> BuiltinString -> BuiltinString +. Integer -> Value -> BuiltinString -> BuiltinString forall a. ShowBS a => Integer -> a -> BuiltinString -> BuiltinString showBSsPrec Integer app_prec Value -txInfoFee +txInfoFee (BuiltinString -> BuiltinString) -> (BuiltinString -> BuiltinString) -> BuiltinString -> BuiltinString forall b c a. (b -> c) -> (a -> b) -> a -> c -. BuiltinString -> BuiltinString -> BuiltinString +. BuiltinString -> BuiltinString -> BuiltinString literal BuiltinString " " (BuiltinString -> BuiltinString) @@ -1970,19 +1970,19 @@ -> BuiltinString -> BuiltinString forall b c a. (b -> c) -> (a -> b) -> a -> c -. Integer -> Value -> BuiltinString -> BuiltinString +. Integer -> Value -> BuiltinString -> BuiltinString forall a. ShowBS a => Integer -> a -> BuiltinString -> BuiltinString showBSsPrec Integer app_prec Value -txInfoMint +txInfoMint (BuiltinString -> BuiltinString) -> (BuiltinString -> BuiltinString) -> BuiltinString -> BuiltinString forall b c a. (b -> c) -> (a -> b) -> a -> c -. BuiltinString -> BuiltinString -> BuiltinString +. BuiltinString -> BuiltinString -> BuiltinString literal BuiltinString " " (BuiltinString -> BuiltinString) @@ -1990,19 +1990,19 @@ -> BuiltinString -> BuiltinString forall b c a. (b -> c) -> (a -> b) -> a -> c -. Integer -> [DCert] -> BuiltinString -> BuiltinString +. Integer -> [DCert] -> BuiltinString -> BuiltinString forall a. ShowBS a => Integer -> a -> BuiltinString -> BuiltinString showBSsPrec Integer app_prec [DCert] -txInfoDCert +txInfoDCert (BuiltinString -> BuiltinString) -> (BuiltinString -> BuiltinString) -> BuiltinString -> BuiltinString forall b c a. (b -> c) -> (a -> b) -> a -> c -. BuiltinString -> BuiltinString -> BuiltinString +. BuiltinString -> BuiltinString -> BuiltinString literal BuiltinString " " (BuiltinString -> BuiltinString) @@ -2010,20 +2010,20 @@ -> BuiltinString -> BuiltinString forall b c a. (b -> c) -> (a -> b) -> a -> c -. Integer +. Integer -> Map StakingCredential Integer -> BuiltinString -> BuiltinString forall a. ShowBS a => Integer -> a -> BuiltinString -> BuiltinString showBSsPrec Integer app_prec Map StakingCredential Integer -txInfoWdrl +txInfoWdrl (BuiltinString -> BuiltinString) -> (BuiltinString -> BuiltinString) -> BuiltinString -> BuiltinString forall b c a. (b -> c) -> (a -> b) -> a -> c -. BuiltinString -> BuiltinString -> BuiltinString +. BuiltinString -> BuiltinString -> BuiltinString literal BuiltinString " " (BuiltinString -> BuiltinString) @@ -2031,19 +2031,19 @@ -> BuiltinString -> BuiltinString forall b c a. (b -> c) -> (a -> b) -> a -> c -. Integer -> POSIXTimeRange -> BuiltinString -> BuiltinString +. Integer -> POSIXTimeRange -> BuiltinString -> BuiltinString forall a. ShowBS a => Integer -> a -> BuiltinString -> BuiltinString showBSsPrec Integer app_prec POSIXTimeRange -txInfoValidRange +txInfoValidRange (BuiltinString -> BuiltinString) -> (BuiltinString -> BuiltinString) -> BuiltinString -> BuiltinString forall b c a. (b -> c) -> (a -> b) -> a -> c -. BuiltinString -> BuiltinString -> BuiltinString +. BuiltinString -> BuiltinString -> BuiltinString literal BuiltinString " " (BuiltinString -> BuiltinString) @@ -2051,19 +2051,19 @@ -> BuiltinString -> BuiltinString forall b c a. (b -> c) -> (a -> b) -> a -> c -. Integer -> [PubKeyHash] -> BuiltinString -> BuiltinString +. Integer -> [PubKeyHash] -> BuiltinString -> BuiltinString forall a. ShowBS a => Integer -> a -> BuiltinString -> BuiltinString showBSsPrec Integer app_prec [PubKeyHash] -txInfoSignatories +txInfoSignatories (BuiltinString -> BuiltinString) -> (BuiltinString -> BuiltinString) -> BuiltinString -> BuiltinString forall b c a. (b -> c) -> (a -> b) -> a -> c -. BuiltinString -> BuiltinString -> BuiltinString +. BuiltinString -> BuiltinString -> BuiltinString literal BuiltinString " " (BuiltinString -> BuiltinString) @@ -2071,20 +2071,20 @@ -> BuiltinString -> BuiltinString forall b c a. (b -> c) -> (a -> b) -> a -> c -. Integer +. Integer -> Map ScriptPurpose Redeemer -> BuiltinString -> BuiltinString forall a. ShowBS a => Integer -> a -> BuiltinString -> BuiltinString showBSsPrec Integer app_prec Map ScriptPurpose Redeemer -txInfoRedeemers +txInfoRedeemers (BuiltinString -> BuiltinString) -> (BuiltinString -> BuiltinString) -> BuiltinString -> BuiltinString forall b c a. (b -> c) -> (a -> b) -> a -> c -. BuiltinString -> BuiltinString -> BuiltinString +. BuiltinString -> BuiltinString -> BuiltinString literal BuiltinString " " (BuiltinString -> BuiltinString) @@ -2092,19 +2092,19 @@ -> BuiltinString -> BuiltinString forall b c a. (b -> c) -> (a -> b) -> a -> c -. Integer -> Map DatumHash Datum -> BuiltinString -> BuiltinString +. Integer -> Map DatumHash Datum -> BuiltinString -> BuiltinString forall a. ShowBS a => Integer -> a -> BuiltinString -> BuiltinString showBSsPrec Integer app_prec Map DatumHash Datum -txInfoData +txInfoData (BuiltinString -> BuiltinString) -> (BuiltinString -> BuiltinString) -> BuiltinString -> BuiltinString forall b c a. (b -> c) -> (a -> b) -> a -> c -. BuiltinString -> BuiltinString -> BuiltinString +. BuiltinString -> BuiltinString -> BuiltinString literal BuiltinString " " (BuiltinString -> BuiltinString) @@ -2112,11 +2112,11 @@ -> BuiltinString -> BuiltinString forall b c a. (b -> c) -> (a -> b) -> a -> c -. Integer -> TxId -> BuiltinString -> BuiltinString +. Integer -> TxId -> BuiltinString -> BuiltinString forall a. ShowBS a => Integer -> a -> BuiltinString -> BuiltinString showBSsPrec Integer app_prec TxId -txInfoId +txInfoId \ No newline at end of file diff --git a/src/Cooked.Skeleton.html b/src/Cooked.Skeleton.html index 964ba133a..48dc7782b 100644 --- a/src/Cooked.Skeleton.html +++ b/src/Cooked.Skeleton.html @@ -82,116 +82,116 @@ ) where -import qualified Cardano.Api as C -import qualified Cardano.Node.Emulator as Emulator -import Control.Monad +import qualified Cardano.Api as C +import qualified Cardano.Node.Emulator as Emulator +import Control.Monad import Cooked.Output import Cooked.Pretty.Class import Cooked.ValueUtils import Cooked.Wallet -import Data.Default -import Data.Either.Combinators -import Data.Function -import qualified Data.List.NonEmpty as NEList -import Data.Map (Map) -import qualified Data.Map as Map -import Data.Map.NonEmpty (NEMap) -import qualified Data.Map.NonEmpty as NEMap -import Data.Maybe -import Data.Set (Set) -import qualified Data.Set as Set -import qualified Ledger.Scripts (validatorHash) -import qualified Ledger.Scripts as Pl hiding (validatorHash) -import qualified Ledger.Slot as Pl -import qualified Ledger.Typed.Scripts as Pl -import Optics.Core -import Optics.TH -import qualified Plutus.Script.Utils.Ada as Pl -import qualified Plutus.Script.Utils.Value as Pl hiding (adaSymbol, adaToken) -import qualified Plutus.V1.Ledger.Interval as Pl -import qualified Plutus.V2.Ledger.Api as Pl hiding (TxOut, adaSymbol, adaToken) -import qualified Plutus.V2.Ledger.Tx as Pl -import qualified Plutus.V2.Ledger.Tx as Pl2 -import qualified PlutusTx.Prelude as Pl -import Test.QuickCheck (NonZero (..)) -import Type.Reflection +import Data.Default +import Data.Either.Combinators +import Data.Function +import qualified Data.List.NonEmpty as NEList +import Data.Map (Map) +import qualified Data.Map as Map +import Data.Map.NonEmpty (NEMap) +import qualified Data.Map.NonEmpty as NEMap +import Data.Maybe +import Data.Set (Set) +import qualified Data.Set as Set +import qualified Ledger.Scripts (validatorHash) +import qualified Ledger.Scripts as Pl hiding (validatorHash) +import qualified Ledger.Slot as Pl +import qualified Ledger.Typed.Scripts as Pl +import Optics.Core +import Optics.TH +import qualified Plutus.Script.Utils.Ada as Pl +import qualified Plutus.Script.Utils.Value as Pl hiding (adaSymbol, adaToken) +import qualified Plutus.V1.Ledger.Interval as Pl +import qualified Plutus.V2.Ledger.Api as Pl hiding (TxOut, adaSymbol, adaToken) +import qualified Plutus.V2.Ledger.Tx as Pl +import qualified Plutus.V2.Ledger.Tx as Pl2 +import qualified PlutusTx.Prelude as Pl +import Test.QuickCheck (NonZero (..)) +import Type.Reflection -- * Transaction labels -type LabelConstrs x = (Show x, Typeable x, Eq x, Ord x) +type LabelConstrs x = (Show x, Typeable x, Eq x, Ord x) data TxLabel where - TxLabel :: LabelConstrs x => x -> TxLabel + TxLabel :: (LabelConstrs x) => x -> TxLabel -instance Eq TxLabel where - TxLabel -a == :: TxLabel -> TxLabel -> Bool -== TxLabel -x = TxLabel -> TxLabel -> Ordering +instance Eq TxLabel where + TxLabel +a == :: TxLabel -> TxLabel -> Bool +== TxLabel +x = TxLabel -> TxLabel -> Ordering forall a. Ord a => a -> a -> Ordering -compare TxLabel -a TxLabel -x Ordering -> Ordering -> Bool +compare TxLabel +a TxLabel +x Ordering -> Ordering -> Bool forall a. Eq a => a -> a -> Bool -== Ordering -EQ +== Ordering +EQ -instance Show TxLabel where - show :: TxLabel -> String -show (TxLabel x -x) = x -> String +instance Show TxLabel where + show :: TxLabel -> String +show (TxLabel x +x) = x -> String forall a. Show a => a -> String -show x -x +show x +x -instance Ord TxLabel where - compare :: TxLabel -> TxLabel -> Ordering -compare (TxLabel x -a) (TxLabel x -x) = +instance Ord TxLabel where + compare :: TxLabel -> TxLabel -> Ordering +compare (TxLabel x +a) (TxLabel x +x) = case SomeTypeRep -> SomeTypeRep -> Ordering forall a. Ord a => a -> a -> Ordering -compare (TypeRep x -> SomeTypeRep +compare (TypeRep x -> SomeTypeRep forall k (a :: k). TypeRep a -> SomeTypeRep -SomeTypeRep (x -> TypeRep x +SomeTypeRep (x -> TypeRep x forall a. Typeable a => a -> TypeRep a -typeOf x -a)) (TypeRep x -> SomeTypeRep +typeOf x +a)) (TypeRep x -> SomeTypeRep forall k (a :: k). TypeRep a -> SomeTypeRep -SomeTypeRep (x -> TypeRep x +SomeTypeRep (x -> TypeRep x forall a. Typeable a => a -> TypeRep a -typeOf x -x)) of +typeOf x +x)) of Ordering -LT -> Ordering -LT +LT -> Ordering +LT Ordering -GT -> Ordering -GT +GT -> Ordering +GT Ordering -EQ -> case x -> TypeRep x +EQ -> case x -> TypeRep x forall a. Typeable a => a -> TypeRep a -typeOf x -a TypeRep x -> TypeRep x -> Maybe (x :~~: x) +typeOf x +a TypeRep x -> TypeRep x -> Maybe (x :~~: x) forall k1 k2 (a :: k1) (b :: k2). TypeRep a -> TypeRep b -> Maybe (a :~~: b) -`eqTypeRep` x -> TypeRep x +`eqTypeRep` x -> TypeRep x forall a. Typeable a => a -> TypeRep a -typeOf x -x of - Just x :~~: x -HRefl -> x -> x -> Ordering +typeOf x +x of + Just x :~~: x +HRefl -> x -> x -> Ordering forall a. Ord a => a -> a -> Ordering -compare x -a x +compare x +a x x -x +x -- This can never happen, since 'eqTypeRep' is implemented in terms of -- '==' on the type representation: Maybe (x :~~: x) -Nothing -> String -> Ordering +Nothing -> String -> Ordering forall a. HasCallStack => String -> a -error String +error String "Type representations compare as EQ, but are not eqTypeRep" -- * Transaction options @@ -205,7 +205,7 @@ | -- | Do not change the existing outputs, always create a new change -- output. DontAdjustExistingOutput - deriving (BalanceOutputPolicy -> BalanceOutputPolicy -> Bool + deriving (BalanceOutputPolicy -> BalanceOutputPolicy -> Bool (BalanceOutputPolicy -> BalanceOutputPolicy -> Bool) -> (BalanceOutputPolicy -> BalanceOutputPolicy -> Bool) -> Eq BalanceOutputPolicy @@ -214,7 +214,7 @@ $c/= :: BalanceOutputPolicy -> BalanceOutputPolicy -> Bool == :: BalanceOutputPolicy -> BalanceOutputPolicy -> Bool $c== :: BalanceOutputPolicy -> BalanceOutputPolicy -> Bool -Eq, Eq BalanceOutputPolicy +Eq, Eq BalanceOutputPolicy Eq BalanceOutputPolicy -> (BalanceOutputPolicy -> BalanceOutputPolicy -> Ordering) -> (BalanceOutputPolicy -> BalanceOutputPolicy -> Bool) @@ -254,7 +254,7 @@ compare :: BalanceOutputPolicy -> BalanceOutputPolicy -> Ordering $ccompare :: BalanceOutputPolicy -> BalanceOutputPolicy -> Ordering $cp1Ord :: Eq BalanceOutputPolicy -Ord, Int -> BalanceOutputPolicy -> ShowS +Ord, Int -> BalanceOutputPolicy -> ShowS [BalanceOutputPolicy] -> ShowS BalanceOutputPolicy -> String (Int -> BalanceOutputPolicy -> ShowS) @@ -269,11 +269,11 @@ $cshow :: BalanceOutputPolicy -> String showsPrec :: Int -> BalanceOutputPolicy -> ShowS $cshowsPrec :: Int -> BalanceOutputPolicy -> ShowS -Show) +Show) -instance Default BalanceOutputPolicy where - def :: BalanceOutputPolicy -def = BalanceOutputPolicy +instance Default BalanceOutputPolicy where + def :: BalanceOutputPolicy +def = BalanceOutputPolicy AdjustExistingOutput -- | Which wallet to use to provide outputs for balancing and collaterals. @@ -282,7 +282,7 @@ data BalancingWallet = BalanceWithFirstSigner | BalanceWith Wallet - deriving (BalancingWallet -> BalancingWallet -> Bool + deriving (BalancingWallet -> BalancingWallet -> Bool (BalancingWallet -> BalancingWallet -> Bool) -> (BalancingWallet -> BalancingWallet -> Bool) -> Eq BalancingWallet @@ -291,7 +291,7 @@ $c/= :: BalancingWallet -> BalancingWallet -> Bool == :: BalancingWallet -> BalancingWallet -> Bool $c== :: BalancingWallet -> BalancingWallet -> Bool -Eq, Eq BalancingWallet +Eq, Eq BalancingWallet Eq BalancingWallet -> (BalancingWallet -> BalancingWallet -> Ordering) -> (BalancingWallet -> BalancingWallet -> Bool) @@ -329,7 +329,7 @@ compare :: BalancingWallet -> BalancingWallet -> Ordering $ccompare :: BalancingWallet -> BalancingWallet -> Ordering $cp1Ord :: Eq BalancingWallet -Ord, Int -> BalancingWallet -> ShowS +Ord, Int -> BalancingWallet -> ShowS [BalancingWallet] -> ShowS BalancingWallet -> String (Int -> BalancingWallet -> ShowS) @@ -344,11 +344,11 @@ $cshow :: BalancingWallet -> String showsPrec :: Int -> BalancingWallet -> ShowS $cshowsPrec :: Int -> BalancingWallet -> ShowS -Show) +Show) -instance Default BalancingWallet where - def :: BalancingWallet -def = BalancingWallet +instance Default BalancingWallet where + def :: BalancingWallet +def = BalancingWallet BalanceWithFirstSigner -- | Wraps a function that will be applied to a transaction right before @@ -356,69 +356,69 @@ newtype RawModTx = -- | Apply modification on transaction after balancing, fee calculation, and -- final signing are performed - RawModTxAfterBalancing (C.Tx C.BabbageEra -> C.Tx C.BabbageEra) + RawModTxAfterBalancing (C.Tx C.BabbageEra -> C.Tx C.BabbageEra) -- This instance always returns @False@, which is no problem, because 'Eq -- TxSkel' is only used for tests that never depend on this comparison -instance Eq RawModTx where +instance Eq RawModTx where RawModTx -_ == :: RawModTx -> RawModTx -> Bool -== RawModTx +_ == :: RawModTx -> RawModTx -> Bool +== RawModTx _ = Bool -False +False -instance Show RawModTx where - show :: RawModTx -> String -show (RawModTxAfterBalancing Tx BabbageEra -> Tx BabbageEra +instance Show RawModTx where + show :: RawModTx -> String +show (RawModTxAfterBalancing Tx BabbageEra -> Tx BabbageEra _) = String "RawModTxAfterBalancing" -- | Applies a list of modifications right before the transaction is -- submitted. The leftmost function in the argument list is applied first. -applyRawModOnBalancedTx :: [RawModTx] -> C.Tx C.BabbageEra -> C.Tx C.BabbageEra +applyRawModOnBalancedTx :: [RawModTx] -> C.Tx C.BabbageEra -> C.Tx C.BabbageEra applyRawModOnBalancedTx :: [RawModTx] -> Tx BabbageEra -> Tx BabbageEra applyRawModOnBalancedTx [] = Tx BabbageEra -> Tx BabbageEra forall a. a -> a -id -applyRawModOnBalancedTx (RawModTxAfterBalancing Tx BabbageEra -> Tx BabbageEra -f : [RawModTx] -fs) = [RawModTx] -> Tx BabbageEra -> Tx BabbageEra +id +applyRawModOnBalancedTx (RawModTxAfterBalancing Tx BabbageEra -> Tx BabbageEra +f : [RawModTx] +fs) = [RawModTx] -> Tx BabbageEra -> Tx BabbageEra applyRawModOnBalancedTx [RawModTx] -fs (Tx BabbageEra -> Tx BabbageEra) +fs (Tx BabbageEra -> Tx BabbageEra) -> (Tx BabbageEra -> Tx BabbageEra) -> Tx BabbageEra -> Tx BabbageEra forall b c a. (b -> c) -> (a -> b) -> a -> c -. Tx BabbageEra -> Tx BabbageEra -f +. Tx BabbageEra -> Tx BabbageEra +f -- | Wraps a function that will temporarily change the emulator parameters for -- the transaction's balancing and submission. -newtype EmulatorParamsModification = EmulatorParamsModification (Emulator.Params -> Emulator.Params) +newtype EmulatorParamsModification = EmulatorParamsModification (Emulator.Params -> Emulator.Params) -- This instance always returns @False@, which is no problem, because 'Eq -- TxSkel' is only used for tests that never depend on this comparison -instance Eq EmulatorParamsModification where +instance Eq EmulatorParamsModification where EmulatorParamsModification -_ == :: EmulatorParamsModification -> EmulatorParamsModification -> Bool -== EmulatorParamsModification +_ == :: EmulatorParamsModification -> EmulatorParamsModification -> Bool +== EmulatorParamsModification _ = Bool -False +False -instance Show EmulatorParamsModification where - show :: EmulatorParamsModification -> String -show EmulatorParamsModification {} = String +instance Show EmulatorParamsModification where + show :: EmulatorParamsModification -> String +show EmulatorParamsModification {} = String "EmulatorParamsModification <function>" -applyEmulatorParamsModification :: Maybe EmulatorParamsModification -> Emulator.Params -> Emulator.Params +applyEmulatorParamsModification :: Maybe EmulatorParamsModification -> Emulator.Params -> Emulator.Params applyEmulatorParamsModification :: Maybe EmulatorParamsModification -> Params -> Params -applyEmulatorParamsModification (Just (EmulatorParamsModification Params -> Params -f)) = Params -> Params -f +applyEmulatorParamsModification (Just (EmulatorParamsModification Params -> Params +f)) = Params -> Params +f applyEmulatorParamsModification Maybe EmulatorParamsModification -Nothing = Params -> Params +Nothing = Params -> Params forall a. a -> a -id +id -- | Describes which UTxOs of the balancing wallet can be spent for balancing. data BalancingUtxos @@ -427,10 +427,10 @@ | -- | Use all UTxOs without datum BalancingUtxosDatumless | -- | Use only the provided UTxOs - BalancingUtxosAllowlist [Pl2.TxOutRef] + BalancingUtxosAllowlist [Pl2.TxOutRef] | -- | Do not use the provided UTxOs - BalancingUtxosBlocklist [Pl2.TxOutRef] - deriving (BalancingUtxos -> BalancingUtxos -> Bool + BalancingUtxosBlocklist [Pl2.TxOutRef] + deriving (BalancingUtxos -> BalancingUtxos -> Bool (BalancingUtxos -> BalancingUtxos -> Bool) -> (BalancingUtxos -> BalancingUtxos -> Bool) -> Eq BalancingUtxos forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a @@ -438,7 +438,7 @@ $c/= :: BalancingUtxos -> BalancingUtxos -> Bool == :: BalancingUtxos -> BalancingUtxos -> Bool $c== :: BalancingUtxos -> BalancingUtxos -> Bool -Eq, Eq BalancingUtxos +Eq, Eq BalancingUtxos Eq BalancingUtxos -> (BalancingUtxos -> BalancingUtxos -> Ordering) -> (BalancingUtxos -> BalancingUtxos -> Bool) @@ -476,7 +476,7 @@ compare :: BalancingUtxos -> BalancingUtxos -> Ordering $ccompare :: BalancingUtxos -> BalancingUtxos -> Ordering $cp1Ord :: Eq BalancingUtxos -Ord, Int -> BalancingUtxos -> ShowS +Ord, Int -> BalancingUtxos -> ShowS [BalancingUtxos] -> ShowS BalancingUtxos -> String (Int -> BalancingUtxos -> ShowS) @@ -491,11 +491,11 @@ $cshow :: BalancingUtxos -> String showsPrec :: Int -> BalancingUtxos -> ShowS $cshowsPrec :: Int -> BalancingUtxos -> ShowS -Show) +Show) -instance Default BalancingUtxos where - def :: BalancingUtxos -def = BalancingUtxos +instance Default BalancingUtxos where + def :: BalancingUtxos +def = BalancingUtxos BalancingUtxosAll -- | Set of options to modify the behavior of generating and validating some transaction. @@ -505,10 +505,10 @@ -- -- Default is @False@. TxOpts -> Bool -txOptEnsureMinAda :: Bool, +txOptEnsureMinAda :: Bool, -- | Ignore this for now. Deprecated. TxOpts -> Bool -txOptAwaitTxConfirmed :: Bool, +txOptAwaitTxConfirmed :: Bool, -- | Whether to increase the slot counter automatically on transaction -- submission. This is useful for modelling transactions that could be -- submitted in parallel in reality, so there should be no explicit ordering @@ -516,7 +516,7 @@ -- -- Default is @True@. TxOpts -> Bool -txOptAutoSlotIncrease :: Bool, +txOptAutoSlotIncrease :: Bool, -- | Applies an arbitrary modification to a transaction after it has been -- potentially adjusted ('txOptEnsureMinAda') and balanced. The name of this -- option contains /unsafe/ to draw attention to the fact that modifying a @@ -546,7 +546,7 @@ -- Default is @True@, and nobody in their right mind will ever set it -- otherwise. TxOpts -> Bool -txOptBalance :: Bool, +txOptBalance :: Bool, -- | The 'BalanceOutputPolicy' to apply when balancing the transaction. -- -- Default is 'AdjustExistingOutput'. @@ -581,9 +581,9 @@ -- -- Default is 'Nothing'. TxOpts -> Maybe EmulatorParamsModification -txOptEmulatorParamsModification :: Maybe EmulatorParamsModification +txOptEmulatorParamsModification :: Maybe EmulatorParamsModification } - deriving (TxOpts -> TxOpts -> Bool + deriving (TxOpts -> TxOpts -> Bool (TxOpts -> TxOpts -> Bool) -> (TxOpts -> TxOpts -> Bool) -> Eq TxOpts forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a @@ -591,7 +591,7 @@ $c/= :: TxOpts -> TxOpts -> Bool == :: TxOpts -> TxOpts -> Bool $c== :: TxOpts -> TxOpts -> Bool -Eq, Int -> TxOpts -> ShowS +Eq, Int -> TxOpts -> ShowS [TxOpts] -> ShowS TxOpts -> String (Int -> TxOpts -> ShowS) @@ -604,7 +604,7 @@ $cshow :: TxOpts -> String showsPrec :: Int -> TxOpts -> ShowS $cshowsPrec :: Int -> TxOpts -> ShowS -Show) +Show) makeLensesFor [ ("txOptEnsureMinAda", "txOptEnsureMinAdaL"), @@ -619,9 +619,9 @@ ] ''TxOpts -instance Default TxOpts where - def :: TxOpts -def = +instance Default TxOpts where + def :: TxOpts +def = TxOpts :: Bool -> Bool -> Bool @@ -635,147 +635,147 @@ TxOpts { txOptEnsureMinAda :: Bool txOptEnsureMinAda = Bool -False, +False, txOptAwaitTxConfirmed :: Bool txOptAwaitTxConfirmed = Bool -True, +True, txOptAutoSlotIncrease :: Bool txOptAutoSlotIncrease = Bool -True, +True, txOptUnsafeModTx :: [RawModTx] txOptUnsafeModTx = [], txOptBalance :: Bool txOptBalance = Bool -True, +True, txOptBalanceOutputPolicy :: BalanceOutputPolicy txOptBalanceOutputPolicy = BalanceOutputPolicy forall a. Default a => a -def, +def, txOptBalanceWallet :: BalancingWallet txOptBalanceWallet = BalancingWallet forall a. Default a => a -def, +def, txOptBalancingUtxos :: BalancingUtxos txOptBalancingUtxos = BalancingUtxos forall a. Default a => a -def, +def, txOptEmulatorParamsModification :: Maybe EmulatorParamsModification txOptEmulatorParamsModification = Maybe EmulatorParamsModification forall a. Maybe a -Nothing +Nothing } -- * Description of the Minting -type MintsConstrs redeemer = - ( Pl.ToData redeemer, - Show redeemer, - PrettyCooked redeemer, - Typeable redeemer +type MintsConstrs redeemer = + ( Pl.ToData redeemer, + Show redeemer, + PrettyCooked redeemer, + Typeable redeemer ) -- | Which redeemer to use for minting. Note that using 'NoMintsRedeemer' -- corresponds to the redeemer @()@ on-chain. data MintsRedeemer where NoMintsRedeemer :: MintsRedeemer - SomeMintsRedeemer :: MintsConstrs redeemer => redeemer -> MintsRedeemer + SomeMintsRedeemer :: (MintsConstrs redeemer) => redeemer -> MintsRedeemer -instance Show MintsRedeemer where - show :: MintsRedeemer -> String -show MintsRedeemer +instance Show MintsRedeemer where + show :: MintsRedeemer -> String +show MintsRedeemer NoMintsRedeemer = String "NoMintsRedeemer" - show (SomeMintsRedeemer redeemer -x) = String + show (SomeMintsRedeemer redeemer +x) = String "(SomeMintsRedeemer " String -> ShowS forall a. [a] -> [a] -> [a] -++ redeemer -> String +++ redeemer -> String forall a. Show a => a -> String -show redeemer -x String -> ShowS +show redeemer +x String -> ShowS forall a. [a] -> [a] -> [a] -++ String +++ String ")" -instance Eq MintsRedeemer where - MintsRedeemer -a == :: MintsRedeemer -> MintsRedeemer -> Bool -== MintsRedeemer -b = MintsRedeemer -> MintsRedeemer -> Ordering +instance Eq MintsRedeemer where + MintsRedeemer +a == :: MintsRedeemer -> MintsRedeemer -> Bool +== MintsRedeemer +b = MintsRedeemer -> MintsRedeemer -> Ordering forall a. Ord a => a -> a -> Ordering -compare MintsRedeemer -a MintsRedeemer -b Ordering -> Ordering -> Bool +compare MintsRedeemer +a MintsRedeemer +b Ordering -> Ordering -> Bool forall a. Eq a => a -> a -> Bool -== Ordering -EQ +== Ordering +EQ -instance Ord MintsRedeemer where - compare :: MintsRedeemer -> MintsRedeemer -> Ordering -compare MintsRedeemer +instance Ord MintsRedeemer where + compare :: MintsRedeemer -> MintsRedeemer -> Ordering +compare MintsRedeemer NoMintsRedeemer MintsRedeemer NoMintsRedeemer = Ordering -EQ - compare MintsRedeemer +EQ + compare MintsRedeemer NoMintsRedeemer SomeMintsRedeemer {} = Ordering -LT - compare SomeMintsRedeemer {} MintsRedeemer +LT + compare SomeMintsRedeemer {} MintsRedeemer NoMintsRedeemer = Ordering -GT - compare (SomeMintsRedeemer redeemer -a) (SomeMintsRedeemer redeemer -b) = +GT + compare (SomeMintsRedeemer redeemer +a) (SomeMintsRedeemer redeemer +b) = case SomeTypeRep -> SomeTypeRep -> Ordering forall a. Ord a => a -> a -> Ordering -compare (TypeRep redeemer -> SomeTypeRep +compare (TypeRep redeemer -> SomeTypeRep forall k (a :: k). TypeRep a -> SomeTypeRep -SomeTypeRep (TypeRep redeemer -> SomeTypeRep) +SomeTypeRep (TypeRep redeemer -> SomeTypeRep) -> TypeRep redeemer -> SomeTypeRep forall a b. (a -> b) -> a -> b -$ redeemer -> TypeRep redeemer +$ redeemer -> TypeRep redeemer forall a. Typeable a => a -> TypeRep a -typeOf redeemer -a) (TypeRep redeemer -> SomeTypeRep +typeOf redeemer +a) (TypeRep redeemer -> SomeTypeRep forall k (a :: k). TypeRep a -> SomeTypeRep -SomeTypeRep (TypeRep redeemer -> SomeTypeRep) +SomeTypeRep (TypeRep redeemer -> SomeTypeRep) -> TypeRep redeemer -> SomeTypeRep forall a b. (a -> b) -> a -> b -$ redeemer -> TypeRep redeemer +$ redeemer -> TypeRep redeemer forall a. Typeable a => a -> TypeRep a -typeOf redeemer -b) of +typeOf redeemer +b) of Ordering -LT -> Ordering -LT +LT -> Ordering +LT Ordering -GT -> Ordering -GT +GT -> Ordering +GT Ordering -EQ -> case redeemer -> TypeRep redeemer +EQ -> case redeemer -> TypeRep redeemer forall a. Typeable a => a -> TypeRep a -typeOf redeemer -a TypeRep redeemer +typeOf redeemer +a TypeRep redeemer -> TypeRep redeemer -> Maybe (redeemer :~~: redeemer) forall k1 k2 (a :: k1) (b :: k2). TypeRep a -> TypeRep b -> Maybe (a :~~: b) -`eqTypeRep` redeemer -> TypeRep redeemer +`eqTypeRep` redeemer -> TypeRep redeemer forall a. Typeable a => a -> TypeRep a -typeOf redeemer -b of - Just redeemer :~~: redeemer -HRefl -> Data -> Data -> Ordering +typeOf redeemer +b of + Just redeemer :~~: redeemer +HRefl -> Data -> Data -> Ordering forall a. Ord a => a -> a -> Ordering -compare (redeemer -> Data +compare (redeemer -> Data forall a. ToData a => a -> Data -Pl.toData redeemer -a) (redeemer -> Data +Pl.toData redeemer +a) (redeemer -> Data forall a. ToData a => a -> Data -Pl.toData redeemer -b) +Pl.toData redeemer +b) Maybe (redeemer :~~: redeemer) -Nothing -> String -> Ordering +Nothing -> String -> Ordering forall a. HasCallStack => String -> a -error String +error String "Type representations compare as EQ, but are not eqTypeRep" -- | A description of what a transaction mints. For every policy, there can only @@ -784,9 +784,9 @@ -- -- You'll probably not construct this by hand, but use 'txSkelMintsFromList'. type TxSkelMints = - Map - (Pl.Versioned Pl.MintingPolicy) - (MintsRedeemer, NEMap Pl.TokenName (NonZero Integer)) + Map + (Pl.Versioned Pl.MintingPolicy) + (MintsRedeemer, NEMap Pl.TokenName (NonZero Integer)) -- | Combining 'TxSkelMints' in a sensible way. In particular, this means that -- @@ -802,11 +802,11 @@ -- -- In every case, if you add mints with a different redeemer for the same -- policy, the redeemer used in the right argument takes precedence. -instance {-# OVERLAPPING #-} Semigroup TxSkelMints where - TxSkelMints -a <> :: TxSkelMints -> TxSkelMints -> TxSkelMints -<> TxSkelMints -b = +instance {-# OVERLAPPING #-} Semigroup TxSkelMints where + TxSkelMints +a <> :: TxSkelMints -> TxSkelMints -> TxSkelMints +<> TxSkelMints +b = (TxSkelMints -> (Versioned MintingPolicy, MintsRedeemer, TokenName, Integer) -> TxSkelMints) @@ -816,28 +816,28 @@ forall (t :: * -> *) b a. Foldable t => (b -> a -> b) -> b -> t a -> b -foldl +foldl (((Versioned MintingPolicy, MintsRedeemer, TokenName, Integer) -> TxSkelMints -> TxSkelMints) -> TxSkelMints -> (Versioned MintingPolicy, MintsRedeemer, TokenName, Integer) -> TxSkelMints forall a b c. (a -> b -> c) -> b -> a -> c -flip (Versioned MintingPolicy, MintsRedeemer, TokenName, Integer) +flip (Versioned MintingPolicy, MintsRedeemer, TokenName, Integer) -> TxSkelMints -> TxSkelMints addToTxSkelMints) TxSkelMints -a +a (TxSkelMints -> [(Versioned MintingPolicy, MintsRedeemer, TokenName, Integer)] txSkelMintsToList TxSkelMints -b) +b) -instance {-# OVERLAPPING #-} Monoid TxSkelMints where - mempty :: TxSkelMints -mempty = TxSkelMints +instance {-# OVERLAPPING #-} Monoid TxSkelMints where + mempty :: TxSkelMints +mempty = TxSkelMints forall k a. Map k a -Map.empty +Map.empty -- | Add a new entry to a 'TxSkelMints'. There are a few wrinkles: -- @@ -865,33 +865,33 @@ -- redeemer per minting policy, and no conflicting mints of the same asset -- class, since they'll just cancel. addToTxSkelMints :: - (Pl.Versioned Pl.MintingPolicy, MintsRedeemer, Pl.TokenName, Integer) -> + (Pl.Versioned Pl.MintingPolicy, MintsRedeemer, Pl.TokenName, Integer) -> TxSkelMints -> TxSkelMints addToTxSkelMints :: (Versioned MintingPolicy, MintsRedeemer, TokenName, Integer) -> TxSkelMints -> TxSkelMints -addToTxSkelMints (Versioned MintingPolicy -pol, MintsRedeemer -red, TokenName -tName, Integer -amount) TxSkelMints -mints +addToTxSkelMints (Versioned MintingPolicy +pol, MintsRedeemer +red, TokenName +tName, Integer +amount) TxSkelMints +mints | Integer 0 Integer -> Integer -> Bool forall a. Eq a => a -> a -> Bool -== Integer -amount = TxSkelMints -mints +== Integer +amount = TxSkelMints +mints | Bool -otherwise = case TxSkelMints -mints TxSkelMints +otherwise = case TxSkelMints +mints TxSkelMints -> Versioned MintingPolicy -> Maybe (MintsRedeemer, NEMap TokenName (NonZero Integer)) forall k a. Ord k => Map k a -> k -> Maybe a -Map.!? Versioned MintingPolicy -pol of +Map.!? Versioned MintingPolicy +pol of Maybe (MintsRedeemer, NEMap TokenName (NonZero Integer)) -Nothing -> +Nothing -> -- The policy isn't yet in the given 'TxSkelMints', so we can just add a -- new entry: Versioned MintingPolicy @@ -899,29 +899,29 @@ -> TxSkelMints -> TxSkelMints forall k a. Ord k => k -> a -> Map k a -> Map k a -Map.insert Versioned MintingPolicy -pol (MintsRedeemer -red, TokenName -> NonZero Integer -> NEMap TokenName (NonZero Integer) +Map.insert Versioned MintingPolicy +pol (MintsRedeemer +red, TokenName -> NonZero Integer -> NEMap TokenName (NonZero Integer) forall k a. k -> a -> NEMap k a -NEMap.singleton TokenName -tName (Integer -> NonZero Integer +NEMap.singleton TokenName +tName (Integer -> NonZero Integer forall a. a -> NonZero a -NonZero Integer -amount)) TxSkelMints -mints - Just (MintsRedeemer -_oldRed, NEMap TokenName (NonZero Integer) -innerMap) -> +NonZero Integer +amount)) TxSkelMints +mints + Just (MintsRedeemer +_oldRed, NEMap TokenName (NonZero Integer) +innerMap) -> -- Ignore the old redeemer: If it's the same as the new one, nothing will -- change, if not, the new redeemer will be kept. case NEMap TokenName (NonZero Integer) -innerMap NEMap TokenName (NonZero Integer) +innerMap NEMap TokenName (NonZero Integer) -> TokenName -> Maybe (NonZero Integer) forall k a. Ord k => NEMap k a -> k -> Maybe a -NEMap.!? TokenName -tName of +NEMap.!? TokenName +tName of Maybe (NonZero Integer) -Nothing -> +Nothing -> -- The given token name has not yet occurred for the given -- policy. This means that we can just add the new tokens to the -- inner map: @@ -930,32 +930,32 @@ -> TxSkelMints -> TxSkelMints forall k a. Ord k => k -> a -> Map k a -> Map k a -Map.insert Versioned MintingPolicy -pol (MintsRedeemer -red, TokenName +Map.insert Versioned MintingPolicy +pol (MintsRedeemer +red, TokenName -> NonZero Integer -> NEMap TokenName (NonZero Integer) -> NEMap TokenName (NonZero Integer) forall k a. Ord k => k -> a -> NEMap k a -> NEMap k a -NEMap.insert TokenName -tName (Integer -> NonZero Integer +NEMap.insert TokenName +tName (Integer -> NonZero Integer forall a. a -> NonZero a -NonZero Integer -amount) NEMap TokenName (NonZero Integer) -innerMap) TxSkelMints -mints - Just (NonZero Integer -oldAmount) -> - let newAmount :: Integer -newAmount = Integer -oldAmount Integer -> Integer -> Integer +NonZero Integer +amount) NEMap TokenName (NonZero Integer) +innerMap) TxSkelMints +mints + Just (NonZero Integer +oldAmount) -> + let newAmount :: Integer +newAmount = Integer +oldAmount Integer -> Integer -> Integer forall a. Num a => a -> a -> a -+ Integer -amount ++ Integer +amount in if Integer -newAmount Integer -> Integer -> Bool +newAmount Integer -> Integer -> Bool forall a. Eq a => a -> a -> Bool -/= Integer +/= Integer 0 then -- If the sum of the old amount of tokens and the additional -- tokens is non-zero, we can just update the amount in the @@ -965,59 +965,59 @@ -> TxSkelMints -> TxSkelMints forall k a. Ord k => k -> a -> Map k a -> Map k a -Map.insert Versioned MintingPolicy -pol (MintsRedeemer -red, TokenName +Map.insert Versioned MintingPolicy +pol (MintsRedeemer +red, TokenName -> NonZero Integer -> NEMap TokenName (NonZero Integer) -> NEMap TokenName (NonZero Integer) forall k a. Ord k => k -> a -> NEMap k a -> NEMap k a -NEMap.insert TokenName -tName (Integer -> NonZero Integer +NEMap.insert TokenName +tName (Integer -> NonZero Integer forall a. a -> NonZero a -NonZero Integer -newAmount) NEMap TokenName (NonZero Integer) -innerMap) TxSkelMints -mints +NonZero Integer +newAmount) NEMap TokenName (NonZero Integer) +innerMap) TxSkelMints +mints else -- If the sum is zero, we'll have to delete the token name -- from the inner map. If that yields a completely empty -- inner map, we'll have to remove the entry altogether: case Map TokenName (NonZero Integer) -> Maybe (NEMap TokenName (NonZero Integer)) forall k a. Map k a -> Maybe (NEMap k a) -NEMap.nonEmptyMap (Map TokenName (NonZero Integer) +NEMap.nonEmptyMap (Map TokenName (NonZero Integer) -> Maybe (NEMap TokenName (NonZero Integer))) -> Map TokenName (NonZero Integer) -> Maybe (NEMap TokenName (NonZero Integer)) forall a b. (a -> b) -> a -> b -$ TokenName +$ TokenName -> NEMap TokenName (NonZero Integer) -> Map TokenName (NonZero Integer) forall k a. Ord k => k -> NEMap k a -> Map k a -NEMap.delete TokenName -tName NEMap TokenName (NonZero Integer) -innerMap of +NEMap.delete TokenName +tName NEMap TokenName (NonZero Integer) +innerMap of Maybe (NEMap TokenName (NonZero Integer)) -Nothing -> Versioned MintingPolicy -> TxSkelMints -> TxSkelMints +Nothing -> Versioned MintingPolicy -> TxSkelMints -> TxSkelMints forall k a. Ord k => k -> Map k a -> Map k a -Map.delete Versioned MintingPolicy -pol TxSkelMints -mints - Just NEMap TokenName (NonZero Integer) -newInnerMap -> Versioned MintingPolicy +Map.delete Versioned MintingPolicy +pol TxSkelMints +mints + Just NEMap TokenName (NonZero Integer) +newInnerMap -> Versioned MintingPolicy -> (MintsRedeemer, NEMap TokenName (NonZero Integer)) -> TxSkelMints -> TxSkelMints forall k a. Ord k => k -> a -> Map k a -> Map k a -Map.insert Versioned MintingPolicy -pol (MintsRedeemer -red, NEMap TokenName (NonZero Integer) -newInnerMap) TxSkelMints -mints +Map.insert Versioned MintingPolicy +pol (MintsRedeemer +red, NEMap TokenName (NonZero Integer) +newInnerMap) TxSkelMints +mints -- | Convert from 'TxSkelMints' to a list of tuples describing eveything that's -- being minted. -txSkelMintsToList :: TxSkelMints -> [(Pl.Versioned Pl.MintingPolicy, MintsRedeemer, Pl.TokenName, Integer)] +txSkelMintsToList :: TxSkelMints -> [(Pl.Versioned Pl.MintingPolicy, MintsRedeemer, Pl.TokenName, Integer)] txSkelMintsToList :: TxSkelMints -> [(Versioned MintingPolicy, MintsRedeemer, TokenName, Integer)] txSkelMintsToList = @@ -1028,31 +1028,31 @@ (MintsRedeemer, NEMap TokenName (NonZero Integer)))] -> [(Versioned MintingPolicy, MintsRedeemer, TokenName, Integer)] forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b] -concatMap - ( \(Versioned MintingPolicy -p, (MintsRedeemer -r, NEMap TokenName (NonZero Integer) -m)) -> - (\(TokenName -t, NonZero Integer -n) -> (Versioned MintingPolicy -p, MintsRedeemer -r, TokenName -t, Integer -n)) +concatMap + ( \(Versioned MintingPolicy +p, (MintsRedeemer +r, NEMap TokenName (NonZero Integer) +m)) -> + (\(TokenName +t, NonZero Integer +n) -> (Versioned MintingPolicy +p, MintsRedeemer +r, TokenName +t, Integer +n)) ((TokenName, NonZero Integer) -> (Versioned MintingPolicy, MintsRedeemer, TokenName, Integer)) -> [(TokenName, NonZero Integer)] -> [(Versioned MintingPolicy, MintsRedeemer, TokenName, Integer)] forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b -<$> NonEmpty (TokenName, NonZero Integer) +<$> NonEmpty (TokenName, NonZero Integer) -> [(TokenName, NonZero Integer)] forall a. NonEmpty a -> [a] -NEList.toList (NEMap TokenName (NonZero Integer) +NEList.toList (NEMap TokenName (NonZero Integer) -> NonEmpty (TokenName, NonZero Integer) forall k a. NEMap k a -> NonEmpty (k, a) -NEMap.toList NEMap TokenName (NonZero Integer) -m) +NEMap.toList NEMap TokenName (NonZero Integer) +m) ) ([(Versioned MintingPolicy, (MintsRedeemer, NEMap TokenName (NonZero Integer)))] @@ -1063,17 +1063,17 @@ -> TxSkelMints -> [(Versioned MintingPolicy, MintsRedeemer, TokenName, Integer)] forall b c a. (b -> c) -> (a -> b) -> a -> c -. TxSkelMints +. TxSkelMints -> [(Versioned MintingPolicy, (MintsRedeemer, NEMap TokenName (NonZero Integer)))] forall k a. Map k a -> [(k, a)] -Map.toList +Map.toList -- | Smart constructor for 'TxSkelMints'. This function relies on -- 'addToTxSkelMints'. So, some non-empty lists (where all amounts for a given -- asset class an redeemer add up to zero) might be translated into the empty -- 'TxSkelMints'. -txSkelMintsFromList :: [(Pl.Versioned Pl.MintingPolicy, MintsRedeemer, Pl.TokenName, Integer)] -> TxSkelMints +txSkelMintsFromList :: [(Pl.Versioned Pl.MintingPolicy, MintsRedeemer, Pl.TokenName, Integer)] -> TxSkelMints txSkelMintsFromList :: [(Versioned MintingPolicy, MintsRedeemer, TokenName, Integer)] -> TxSkelMints txSkelMintsFromList = ((Versioned MintingPolicy, MintsRedeemer, TokenName, Integer) @@ -1084,14 +1084,14 @@ forall (t :: * -> *) a b. Foldable t => (a -> b -> b) -> b -> t a -> b -foldr (Versioned MintingPolicy, MintsRedeemer, TokenName, Integer) +foldr (Versioned MintingPolicy, MintsRedeemer, TokenName, Integer) -> TxSkelMints -> TxSkelMints addToTxSkelMints TxSkelMints forall a. Monoid a => a -mempty +mempty -- | The value described by a 'TxSkelMints' -txSkelMintsValue :: TxSkelMints -> Pl.Value +txSkelMintsValue :: TxSkelMints -> Pl.Value txSkelMintsValue :: TxSkelMints -> Value txSkelMintsValue = Optic' @@ -1106,14 +1106,14 @@ forall k m (is :: IxList) s a. (Is k A_Fold, Monoid m) => Optic' k is s a -> (a -> m) -> s -> m -foldMapOf +foldMapOf ((TxSkelMints -> [(Versioned MintingPolicy, MintsRedeemer, TokenName, Integer)]) -> Getter TxSkelMints [(Versioned MintingPolicy, MintsRedeemer, TokenName, Integer)] forall s a. (s -> a) -> Getter s a -to TxSkelMints +to TxSkelMints -> [(Versioned MintingPolicy, MintsRedeemer, TokenName, Integer)] txSkelMintsToList Getter TxSkelMints @@ -1134,7 +1134,7 @@ 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 -% Optic +% Optic A_Fold '[] [(Versioned MintingPolicy, MintsRedeemer, TokenName, Integer)] @@ -1142,122 +1142,122 @@ (Versioned MintingPolicy, MintsRedeemer, TokenName, Integer) (Versioned MintingPolicy, MintsRedeemer, TokenName, Integer) forall (f :: * -> *) a. Foldable f => Fold (f a) a -folded) - ( \(Versioned MintingPolicy -policy, MintsRedeemer -_, TokenName -tName, Integer -amount) -> +folded) + ( \(Versioned MintingPolicy +policy, MintsRedeemer +_, TokenName +tName, Integer +amount) -> AssetClass -> Integer -> Value -Pl.assetClassValue +Pl.assetClassValue ( CurrencySymbol -> TokenName -> AssetClass -Pl.assetClass +Pl.assetClass (Versioned MintingPolicy -> CurrencySymbol -Pl.scriptCurrencySymbol Versioned MintingPolicy -policy) +Pl.scriptCurrencySymbol Versioned MintingPolicy +policy) TokenName -tName +tName ) Integer -amount +amount ) -- * Transaction outputs -class IsTxSkelOutAllowedOwner a where - toPKHOrValidator :: a -> Either Pl.PubKeyHash (Pl.Versioned Pl.Validator) +class IsTxSkelOutAllowedOwner a where + toPKHOrValidator :: a -> Either Pl.PubKeyHash (Pl.Versioned Pl.Validator) -instance IsTxSkelOutAllowedOwner Pl.PubKeyHash where - toPKHOrValidator :: PubKeyHash -> Either PubKeyHash (Versioned Validator) -toPKHOrValidator = PubKeyHash -> Either PubKeyHash (Versioned Validator) +instance IsTxSkelOutAllowedOwner Pl.PubKeyHash where + toPKHOrValidator :: PubKeyHash -> Either PubKeyHash (Versioned Validator) +toPKHOrValidator = PubKeyHash -> Either PubKeyHash (Versioned Validator) forall a b. a -> Either a b -Left +Left -instance IsTxSkelOutAllowedOwner (Pl.TypedValidator a) where - toPKHOrValidator :: TypedValidator a -> Either PubKeyHash (Versioned Validator) -toPKHOrValidator = Versioned Validator -> Either PubKeyHash (Versioned Validator) +instance IsTxSkelOutAllowedOwner (Pl.TypedValidator a) where + toPKHOrValidator :: TypedValidator a -> Either PubKeyHash (Versioned Validator) +toPKHOrValidator = Versioned Validator -> Either PubKeyHash (Versioned Validator) forall a b. b -> Either a b -Right (Versioned Validator -> Either PubKeyHash (Versioned Validator)) +Right (Versioned Validator -> Either PubKeyHash (Versioned Validator)) -> (TypedValidator a -> Versioned Validator) -> TypedValidator a -> Either PubKeyHash (Versioned Validator) forall b c a. (b -> c) -> (a -> b) -> a -> c -. TypedValidator a -> Versioned Validator +. TypedValidator a -> Versioned Validator forall a. TypedValidator a -> Versioned Validator -Pl.vValidatorScript +Pl.vValidatorScript -- | Transaction outputs. The 'Pays' constructor is really general, and you'll -- probably want to use one of the smart constructors like 'paysScript' or -- 'paysPK' in most cases. data TxSkelOut where - Pays :: - ( Show o, -- This is needed only for the 'Show' instance of 'TxSkel', which in turn is only needed in tests. - Typeable o, - IsTxInfoOutput o, - IsTxSkelOutAllowedOwner (OwnerType o), - Typeable (OwnerType o), - ToCredential (OwnerType o), - DatumType o ~ TxSkelOutDatum, - ValueType o ~ Pl.Value, -- needed for the 'txSkelOutValueL' - ToScript (ReferenceScriptType o), - Show (OwnerType o), - Show (ReferenceScriptType o), - Typeable (ReferenceScriptType o) + Pays :: + ( Show o, -- This is needed only for the 'Show' instance of 'TxSkel', which in turn is only needed in tests. + Typeable o, + IsTxInfoOutput o, + IsTxSkelOutAllowedOwner (OwnerType o), + Typeable (OwnerType o), + ToCredential (OwnerType o), + DatumType o ~ TxSkelOutDatum, + ValueType o ~ Pl.Value, -- needed for the 'txSkelOutValueL' + ToScript (ReferenceScriptType o), + Show (OwnerType o), + Show (ReferenceScriptType o), + Typeable (ReferenceScriptType o) ) => {() -producedOutput :: o} -> +producedOutput :: o} -> TxSkelOut -instance Eq TxSkelOut where - Pays o -a == :: TxSkelOut -> TxSkelOut -> Bool -== Pays o -b = case o -> TypeRep o +instance Eq TxSkelOut where + Pays o +a == :: TxSkelOut -> TxSkelOut -> Bool +== Pays o +b = case o -> TypeRep o forall a. Typeable a => a -> TypeRep a -typeOf o -a TypeRep o -> TypeRep o -> Maybe (o :~~: o) +typeOf o +a TypeRep o -> TypeRep o -> Maybe (o :~~: o) forall k1 k2 (a :: k1) (b :: k2). TypeRep a -> TypeRep b -> Maybe (a :~~: b) -`eqTypeRep` o -> TypeRep o +`eqTypeRep` o -> TypeRep o forall a. Typeable a => a -> TypeRep a -typeOf o -b of - Just o :~~: o -HRefl -> o -> TxOut +typeOf o +b of + Just o :~~: o +HRefl -> o -> TxOut forall o. IsTxInfoOutput o => o -> TxOut outputTxOut o -a TxOut -> TxOut -> Bool +a TxOut -> TxOut -> Bool forall a. Eq a => a -> a -> Bool -== o -> TxOut +== o -> TxOut forall o. IsTxInfoOutput o => o -> TxOut outputTxOut o -b +b Maybe (o :~~: o) -Nothing -> Bool -False +Nothing -> Bool +False -deriving instance Show TxSkelOut +deriving instance Show TxSkelOut -txSkelOutDatumL :: Lens' TxSkelOut TxSkelOutDatum +txSkelOutDatumL :: Lens' TxSkelOut TxSkelOutDatum txSkelOutDatumL :: Lens' TxSkelOut TxSkelOutDatum txSkelOutDatumL = (TxSkelOut -> TxSkelOutDatum) -> (TxSkelOut -> TxSkelOutDatum -> TxSkelOut) -> Lens' TxSkelOut TxSkelOutDatum forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b -lens - (\(Pays o -output) -> o -output o -> Optic' A_Lens '[] o TxSkelOutDatum -> TxSkelOutDatum +lens + (\(Pays o +output) -> o +output o -> Optic' A_Lens '[] o TxSkelOutDatum -> TxSkelOutDatum forall k s (is :: IxList) a. Is k A_Getter => s -> Optic' k is s a -> a -^. Optic' A_Lens '[] o TxSkelOutDatum +^. Optic' A_Lens '[] o TxSkelOutDatum forall o. IsAbstractOutput o => Lens' o (DatumType o) outputDatumL) - (\(Pays o -output) TxSkelOutDatum -newDatum -> o -> TxSkelOut + (\(Pays o +output) TxSkelOutDatum +newDatum -> o -> TxSkelOut forall o. (Show o, Typeable o, IsTxInfoOutput o, IsTxSkelOutAllowedOwner (OwnerType o), Typeable (OwnerType o), @@ -1268,34 +1268,34 @@ o -> TxSkelOut Pays (o -> TxSkelOut) -> o -> TxSkelOut forall a b. (a -> b) -> a -> b -$ o -output o -> (o -> o) -> o +$ o +output o -> (o -> o) -> o forall a b. a -> (a -> b) -> b -& Optic A_Lens '[] o o TxSkelOutDatum TxSkelOutDatum +& Optic A_Lens '[] o o TxSkelOutDatum TxSkelOutDatum forall o. IsAbstractOutput o => Lens' o (DatumType o) outputDatumL Optic A_Lens '[] o o TxSkelOutDatum TxSkelOutDatum -> TxSkelOutDatum -> o -> o forall k (is :: IxList) s t a b. Is k A_Setter => Optic k is s t a b -> b -> s -> t -.~ TxSkelOutDatum -newDatum) +.~ TxSkelOutDatum +newDatum) -txSkelOutValueL :: Lens' TxSkelOut Pl.Value +txSkelOutValueL :: Lens' TxSkelOut Pl.Value txSkelOutValueL :: Lens' TxSkelOut Value txSkelOutValueL = (TxSkelOut -> Value) -> (TxSkelOut -> Value -> TxSkelOut) -> Lens' TxSkelOut Value forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b -lens - (\(Pays o -output) -> o -> Value +lens + (\(Pays o +output) -> o -> Value forall o. (IsAbstractOutput o, ToValue (ValueType o)) => o -> Value outputValue o -output) - (\(Pays o -output) Value -newValue -> o -> TxSkelOut +output) + (\(Pays o +output) Value +newValue -> o -> TxSkelOut forall o. (Show o, Typeable o, IsTxInfoOutput o, IsTxSkelOutAllowedOwner (OwnerType o), Typeable (OwnerType o), @@ -1306,50 +1306,50 @@ o -> TxSkelOut Pays (o -> TxSkelOut) -> o -> TxSkelOut forall a b. (a -> b) -> a -> b -$ o -output o -> (o -> o) -> o +$ o +output o -> (o -> o) -> o forall a b. a -> (a -> b) -> b -& Optic A_Lens '[] o o Value Value +& Optic A_Lens '[] o o Value Value forall o. IsAbstractOutput o => Lens' o (ValueType o) outputValueL Optic A_Lens '[] o o Value Value -> Value -> o -> o forall k (is :: IxList) s t a b. Is k A_Setter => Optic k is s t a b -> b -> s -> t -.~ Value -newValue) +.~ Value +newValue) -txSkelOutValue :: TxSkelOut -> Pl.Value +txSkelOutValue :: TxSkelOut -> Pl.Value txSkelOutValue :: TxSkelOut -> Value txSkelOutValue = (TxSkelOut -> Lens' TxSkelOut Value -> Value forall k s (is :: IxList) a. Is k A_Getter => s -> Optic' k is s a -> a -^. Lens' TxSkelOut Value +^. Lens' TxSkelOut Value txSkelOutValueL) -txSkelOutValidator :: TxSkelOut -> Maybe (Pl.Versioned Pl.Validator) +txSkelOutValidator :: TxSkelOut -> Maybe (Pl.Versioned Pl.Validator) txSkelOutValidator :: TxSkelOut -> Maybe (Versioned Validator) -txSkelOutValidator (Pays o -output) = Either PubKeyHash (Versioned Validator) +txSkelOutValidator (Pays o +output) = Either PubKeyHash (Versioned Validator) -> Maybe (Versioned Validator) forall a b. Either a b -> Maybe b -rightToMaybe (OwnerType o -> Either PubKeyHash (Versioned Validator) +rightToMaybe (OwnerType o -> Either PubKeyHash (Versioned Validator) forall a. IsTxSkelOutAllowedOwner a => a -> Either PubKeyHash (Versioned Validator) toPKHOrValidator (OwnerType o -> Either PubKeyHash (Versioned Validator)) -> OwnerType o -> Either PubKeyHash (Versioned Validator) forall a b. (a -> b) -> a -> b -$ o -output o -> Optic' A_Lens '[] o (OwnerType o) -> OwnerType o +$ o +output o -> Optic' A_Lens '[] 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 '[] o (OwnerType o) +^. Optic' A_Lens '[] o (OwnerType o) forall o. IsAbstractOutput o => Lens' o (OwnerType o) outputOwnerL) -type TxSkelOutDatumConstrs a = (Show a, PrettyCooked a, Pl.ToData a, Pl.Eq a, Typeable a) +type TxSkelOutDatumConstrs a = (Show a, PrettyCooked a, Pl.ToData a, Pl.Eq a, Typeable a) -- | On transaction outputs, we have the options to use -- @@ -1389,236 +1389,236 @@ -- | use no datum TxSkelOutNoDatum :: TxSkelOutDatum -- | only include the hash on the transaction - TxSkelOutDatumHash :: TxSkelOutDatumConstrs a => a -> TxSkelOutDatum + TxSkelOutDatumHash :: (TxSkelOutDatumConstrs a) => a -> TxSkelOutDatum -- | use a 'Pl.OutputDatumHash' on the transaction output, but generate the -- transaction in such a way that the complete datum is included in the -- 'txInfoData' seen by validators - TxSkelOutDatum :: TxSkelOutDatumConstrs a => a -> TxSkelOutDatum + TxSkelOutDatum :: (TxSkelOutDatumConstrs a) => a -> TxSkelOutDatum -- | use an inline datum - TxSkelOutInlineDatum :: TxSkelOutDatumConstrs a => a -> TxSkelOutDatum + TxSkelOutInlineDatum :: (TxSkelOutDatumConstrs a) => a -> TxSkelOutDatum -deriving instance Show TxSkelOutDatum +deriving instance Show TxSkelOutDatum -instance Eq TxSkelOutDatum where - TxSkelOutDatum -x == :: TxSkelOutDatum -> TxSkelOutDatum -> Bool -== TxSkelOutDatum -y = TxSkelOutDatum -> TxSkelOutDatum -> Ordering +instance Eq TxSkelOutDatum where + TxSkelOutDatum +x == :: TxSkelOutDatum -> TxSkelOutDatum -> Bool +== TxSkelOutDatum +y = TxSkelOutDatum -> TxSkelOutDatum -> Ordering forall a. Ord a => a -> a -> Ordering -compare TxSkelOutDatum -x TxSkelOutDatum -y Ordering -> Ordering -> Bool +compare TxSkelOutDatum +x TxSkelOutDatum +y Ordering -> Ordering -> Bool forall a. Eq a => a -> a -> Bool -== Ordering -EQ +== Ordering +EQ -instance Ord TxSkelOutDatum where - compare :: TxSkelOutDatum -> TxSkelOutDatum -> Ordering -compare TxSkelOutDatum +instance Ord TxSkelOutDatum where + compare :: TxSkelOutDatum -> TxSkelOutDatum -> Ordering +compare TxSkelOutDatum TxSkelOutNoDatum TxSkelOutDatum TxSkelOutNoDatum = Ordering -EQ - compare (TxSkelOutDatumHash a -d1) (TxSkelOutDatumHash a -d2) = +EQ + compare (TxSkelOutDatumHash a +d1) (TxSkelOutDatumHash a +d2) = case SomeTypeRep -> SomeTypeRep -> Ordering forall a. Ord a => a -> a -> Ordering -compare (TypeRep a -> SomeTypeRep +compare (TypeRep a -> SomeTypeRep forall k (a :: k). TypeRep a -> SomeTypeRep -SomeTypeRep (a -> TypeRep a +SomeTypeRep (a -> TypeRep a forall a. Typeable a => a -> TypeRep a -typeOf a -d1)) (TypeRep a -> SomeTypeRep +typeOf a +d1)) (TypeRep a -> SomeTypeRep forall k (a :: k). TypeRep a -> SomeTypeRep -SomeTypeRep (a -> TypeRep a +SomeTypeRep (a -> TypeRep a forall a. Typeable a => a -> TypeRep a -typeOf a -d2)) of +typeOf a +d2)) of Ordering -LT -> Ordering -LT +LT -> Ordering +LT Ordering -GT -> Ordering -GT +GT -> Ordering +GT Ordering -EQ -> case a -> TypeRep a +EQ -> case a -> TypeRep a forall a. Typeable a => a -> TypeRep a -typeOf a -d1 TypeRep a -> TypeRep a -> Maybe (a :~~: a) +typeOf a +d1 TypeRep a -> TypeRep a -> Maybe (a :~~: a) forall k1 k2 (a :: k1) (b :: k2). TypeRep a -> TypeRep b -> Maybe (a :~~: b) -`eqTypeRep` a -> TypeRep a +`eqTypeRep` a -> TypeRep a forall a. Typeable a => a -> TypeRep a -typeOf a -d2 of - Just a :~~: a -HRefl -> BuiltinData -> BuiltinData -> Ordering +typeOf a +d2 of + Just a :~~: a +HRefl -> BuiltinData -> BuiltinData -> Ordering forall a. Ord a => a -> a -> Ordering -compare (a -> BuiltinData +compare (a -> BuiltinData forall a. ToData a => a -> BuiltinData -Pl.toBuiltinData a -d1) (a -> BuiltinData +Pl.toBuiltinData a +d1) (a -> BuiltinData forall a. ToData a => a -> BuiltinData -Pl.toBuiltinData a -d2) +Pl.toBuiltinData a +d2) Maybe (a :~~: a) -Nothing -> String -> Ordering +Nothing -> String -> Ordering forall a. HasCallStack => String -> a -error String +error String "This branch cannot happen: un-equal type representations that compare to EQ" - compare (TxSkelOutDatum a -d1) (TxSkelOutDatum a -d2) = + compare (TxSkelOutDatum a +d1) (TxSkelOutDatum a +d2) = TxSkelOutDatum -> TxSkelOutDatum -> Ordering forall a. Ord a => a -> a -> Ordering -compare (a -> TxSkelOutDatum +compare (a -> TxSkelOutDatum forall a. TxSkelOutDatumConstrs a => a -> TxSkelOutDatum TxSkelOutDatumHash a -d1) (a -> TxSkelOutDatum +d1) (a -> TxSkelOutDatum forall a. TxSkelOutDatumConstrs a => a -> TxSkelOutDatum TxSkelOutDatumHash a -d2) - compare (TxSkelOutInlineDatum a -d1) (TxSkelOutInlineDatum a -d2) = +d2) + compare (TxSkelOutInlineDatum a +d1) (TxSkelOutInlineDatum a +d2) = TxSkelOutDatum -> TxSkelOutDatum -> Ordering forall a. Ord a => a -> a -> Ordering -compare (a -> TxSkelOutDatum +compare (a -> TxSkelOutDatum forall a. TxSkelOutDatumConstrs a => a -> TxSkelOutDatum TxSkelOutDatumHash a -d1) (a -> TxSkelOutDatum +d1) (a -> TxSkelOutDatum forall a. TxSkelOutDatumConstrs a => a -> TxSkelOutDatum TxSkelOutDatumHash a -d2) - compare TxSkelOutDatumHash {} TxSkelOutDatum +d2) + compare TxSkelOutDatumHash {} TxSkelOutDatum TxSkelOutNoDatum = Ordering -GT - compare TxSkelOutDatum {} TxSkelOutDatum +GT + compare TxSkelOutDatum {} TxSkelOutDatum TxSkelOutNoDatum = Ordering -GT - compare TxSkelOutDatum {} TxSkelOutDatumHash {} = Ordering -GT - compare TxSkelOutInlineDatum {} TxSkelOutDatum +GT + compare TxSkelOutDatum {} TxSkelOutDatumHash {} = Ordering +GT + compare TxSkelOutInlineDatum {} TxSkelOutDatum _ = Ordering -GT - compare TxSkelOutDatum +GT + compare TxSkelOutDatum _ TxSkelOutDatum _ = Ordering -LT +LT instance ToOutputDatum TxSkelOutDatum where - toOutputDatum :: TxSkelOutDatum -> OutputDatum + toOutputDatum :: TxSkelOutDatum -> OutputDatum toOutputDatum TxSkelOutDatum TxSkelOutNoDatum = OutputDatum -Pl.NoOutputDatum - toOutputDatum (TxSkelOutDatumHash a -datum) = DatumHash -> OutputDatum -Pl.OutputDatumHash (DatumHash -> OutputDatum) -> (a -> DatumHash) -> a -> OutputDatum +Pl.NoOutputDatum + toOutputDatum (TxSkelOutDatumHash a +datum) = DatumHash -> OutputDatum +Pl.OutputDatumHash (DatumHash -> OutputDatum) -> (a -> DatumHash) -> a -> OutputDatum forall b c a. (b -> c) -> (a -> b) -> a -> c -. Datum -> DatumHash -Pl.datumHash (Datum -> DatumHash) -> (a -> Datum) -> a -> DatumHash +. Datum -> DatumHash +Pl.datumHash (Datum -> DatumHash) -> (a -> Datum) -> a -> DatumHash forall b c a. (b -> c) -> (a -> b) -> a -> c -. BuiltinData -> Datum -Pl.Datum (BuiltinData -> Datum) -> (a -> BuiltinData) -> a -> Datum +. BuiltinData -> Datum +Pl.Datum (BuiltinData -> Datum) -> (a -> BuiltinData) -> a -> Datum forall b c a. (b -> c) -> (a -> b) -> a -> c -. a -> BuiltinData +. a -> BuiltinData forall a. ToData a => a -> BuiltinData -Pl.toBuiltinData (a -> OutputDatum) -> a -> OutputDatum +Pl.toBuiltinData (a -> OutputDatum) -> a -> OutputDatum forall a b. (a -> b) -> a -> b -$ a -datum - toOutputDatum (TxSkelOutDatum a -datum) = DatumHash -> OutputDatum -Pl.OutputDatumHash (DatumHash -> OutputDatum) -> (a -> DatumHash) -> a -> OutputDatum +$ a +datum + toOutputDatum (TxSkelOutDatum a +datum) = DatumHash -> OutputDatum +Pl.OutputDatumHash (DatumHash -> OutputDatum) -> (a -> DatumHash) -> a -> OutputDatum forall b c a. (b -> c) -> (a -> b) -> a -> c -. Datum -> DatumHash -Pl.datumHash (Datum -> DatumHash) -> (a -> Datum) -> a -> DatumHash +. Datum -> DatumHash +Pl.datumHash (Datum -> DatumHash) -> (a -> Datum) -> a -> DatumHash forall b c a. (b -> c) -> (a -> b) -> a -> c -. BuiltinData -> Datum -Pl.Datum (BuiltinData -> Datum) -> (a -> BuiltinData) -> a -> Datum +. BuiltinData -> Datum +Pl.Datum (BuiltinData -> Datum) -> (a -> BuiltinData) -> a -> Datum forall b c a. (b -> c) -> (a -> b) -> a -> c -. a -> BuiltinData +. a -> BuiltinData forall a. ToData a => a -> BuiltinData -Pl.toBuiltinData (a -> OutputDatum) -> a -> OutputDatum +Pl.toBuiltinData (a -> OutputDatum) -> a -> OutputDatum forall a b. (a -> b) -> a -> b -$ a -datum - toOutputDatum (TxSkelOutInlineDatum a -datum) = Datum -> OutputDatum -Pl.OutputDatum (Datum -> OutputDatum) -> (a -> Datum) -> a -> OutputDatum +$ a +datum + toOutputDatum (TxSkelOutInlineDatum a +datum) = Datum -> OutputDatum +Pl.OutputDatum (Datum -> OutputDatum) -> (a -> Datum) -> a -> OutputDatum forall b c a. (b -> c) -> (a -> b) -> a -> c -. BuiltinData -> Datum -Pl.Datum (BuiltinData -> Datum) -> (a -> BuiltinData) -> a -> Datum +. BuiltinData -> Datum +Pl.Datum (BuiltinData -> Datum) -> (a -> BuiltinData) -> a -> Datum forall b c a. (b -> c) -> (a -> b) -> a -> c -. a -> BuiltinData +. a -> BuiltinData forall a. ToData a => a -> BuiltinData -Pl.toBuiltinData (a -> OutputDatum) -> a -> OutputDatum +Pl.toBuiltinData (a -> OutputDatum) -> a -> OutputDatum forall a b. (a -> b) -> a -> b -$ a -datum +$ a +datum -txSkelOutUntypedDatum :: TxSkelOutDatum -> Maybe Pl.Datum +txSkelOutUntypedDatum :: TxSkelOutDatum -> Maybe Pl.Datum txSkelOutUntypedDatum :: TxSkelOutDatum -> Maybe Datum txSkelOutUntypedDatum = \case TxSkelOutDatum TxSkelOutNoDatum -> Maybe Datum forall a. Maybe a -Nothing - TxSkelOutDatumHash a -x -> Datum -> Maybe Datum +Nothing + TxSkelOutDatumHash a +x -> Datum -> Maybe Datum forall a. a -> Maybe a -Just (BuiltinData -> Datum -Pl.Datum (BuiltinData -> Datum) -> BuiltinData -> Datum +Just (BuiltinData -> Datum +Pl.Datum (BuiltinData -> Datum) -> BuiltinData -> Datum forall a b. (a -> b) -> a -> b -$ a -> BuiltinData +$ a -> BuiltinData forall a. ToData a => a -> BuiltinData -Pl.toBuiltinData a -x) - TxSkelOutDatum a -x -> Datum -> Maybe Datum +Pl.toBuiltinData a +x) + TxSkelOutDatum a +x -> Datum -> Maybe Datum forall a. a -> Maybe a -Just (BuiltinData -> Datum -Pl.Datum (BuiltinData -> Datum) -> BuiltinData -> Datum +Just (BuiltinData -> Datum +Pl.Datum (BuiltinData -> Datum) -> BuiltinData -> Datum forall a b. (a -> b) -> a -> b -$ a -> BuiltinData +$ a -> BuiltinData forall a. ToData a => a -> BuiltinData -Pl.toBuiltinData a -x) - TxSkelOutInlineDatum a -x -> Datum -> Maybe Datum +Pl.toBuiltinData a +x) + TxSkelOutInlineDatum a +x -> Datum -> Maybe Datum forall a. a -> Maybe a -Just (BuiltinData -> Datum -Pl.Datum (BuiltinData -> Datum) -> BuiltinData -> Datum +Just (BuiltinData -> Datum +Pl.Datum (BuiltinData -> Datum) -> BuiltinData -> Datum forall a b. (a -> b) -> a -> b -$ a -> BuiltinData +$ a -> BuiltinData forall a. ToData a => a -> BuiltinData -Pl.toBuiltinData a -x) +Pl.toBuiltinData a +x) -txSkelOutTypedDatum :: Pl.FromData a => TxSkelOutDatum -> Maybe a +txSkelOutTypedDatum :: (Pl.FromData a) => TxSkelOutDatum -> Maybe a txSkelOutTypedDatum :: TxSkelOutDatum -> Maybe a txSkelOutTypedDatum = BuiltinData -> Maybe a forall a. FromData a => BuiltinData -> Maybe a -Pl.fromBuiltinData (BuiltinData -> Maybe a) +Pl.fromBuiltinData (BuiltinData -> Maybe a) -> (Datum -> BuiltinData) -> Datum -> Maybe a forall b c a. (b -> c) -> (a -> b) -> a -> c -. Datum -> BuiltinData -Pl.getDatum (Datum -> Maybe a) +. Datum -> BuiltinData +Pl.getDatum (Datum -> Maybe a) -> (TxSkelOutDatum -> Maybe Datum) -> TxSkelOutDatum -> Maybe a forall (m :: * -> *) b c a. Monad m => (b -> m c) -> (a -> m b) -> a -> m c -<=< TxSkelOutDatum -> Maybe Datum +<=< TxSkelOutDatum -> Maybe Datum txSkelOutUntypedDatum -- ** Smart constructors for transaction outputs -- | Pay a certain value to a public key. -paysPK :: Pl.PubKeyHash -> Pl.Value -> TxSkelOut +paysPK :: Pl.PubKeyHash -> Pl.Value -> TxSkelOut paysPK :: PubKeyHash -> Value -> TxSkelOut -paysPK PubKeyHash -pkh Value -value = +paysPK PubKeyHash +pkh Value +value = ConcreteOutput PubKeyHash TxSkelOutDatum Value (Versioned Script) -> TxSkelOut forall o. @@ -1646,38 +1646,38 @@ -> ConcreteOutput ownerType datumType valueType referenceScriptType ConcreteOutput PubKeyHash -pkh +pkh Maybe StakingCredential forall a. Maybe a -Nothing +Nothing Value -value +value TxSkelOutDatum TxSkelOutNoDatum (Maybe (Versioned Script) forall a. Maybe a -Nothing @(Pl.Versioned Pl.Script)) +Nothing @(Pl.Versioned Pl.Script)) ) -- | Pays a script a certain value with a certain datum, using the -- 'TxSkelOutDatum' constructor. (See the documentation of 'TxSkelOutDatum'.) -paysScript :: - ( Pl.ToData (Pl.DatumType a), - Show (Pl.DatumType a), - Typeable (Pl.DatumType a), - Pl.Eq (Pl.DatumType a), - PrettyCooked (Pl.DatumType a), - Typeable a +paysScript :: + ( Pl.ToData (Pl.DatumType a), + Show (Pl.DatumType a), + Typeable (Pl.DatumType a), + Pl.Eq (Pl.DatumType a), + PrettyCooked (Pl.DatumType a), + Typeable a ) => - Pl.TypedValidator a -> - Pl.DatumType a -> - Pl.Value -> + Pl.TypedValidator a -> + Pl.DatumType a -> + Pl.Value -> TxSkelOut paysScript :: TypedValidator a -> DatumType a -> Value -> TxSkelOut -paysScript TypedValidator a -validator DatumType a -datum Value -value = +paysScript TypedValidator a +validator DatumType a +datum Value +value = ConcreteOutput (TypedValidator a) TxSkelOutDatum Value (Versioned Script) -> TxSkelOut @@ -1706,39 +1706,39 @@ -> ConcreteOutput ownerType datumType valueType referenceScriptType ConcreteOutput TypedValidator a -validator +validator Maybe StakingCredential forall a. Maybe a -Nothing +Nothing Value -value +value (DatumType a -> TxSkelOutDatum forall a. TxSkelOutDatumConstrs a => a -> TxSkelOutDatum TxSkelOutDatum DatumType a -datum) +datum) (Maybe (Versioned Script) forall a. Maybe a -Nothing @(Pl.Versioned Pl.Script)) +Nothing @(Pl.Versioned Pl.Script)) ) -- | Pays a script a certain value with a certain inlined datum. -paysScriptInlineDatum :: - ( Pl.ToData (Pl.DatumType a), - Show (Pl.DatumType a), - Typeable (Pl.DatumType a), - Pl.Eq (Pl.DatumType a), - PrettyCooked (Pl.DatumType a), - Typeable a +paysScriptInlineDatum :: + ( Pl.ToData (Pl.DatumType a), + Show (Pl.DatumType a), + Typeable (Pl.DatumType a), + Pl.Eq (Pl.DatumType a), + PrettyCooked (Pl.DatumType a), + Typeable a ) => - Pl.TypedValidator a -> - Pl.DatumType a -> - Pl.Value -> + Pl.TypedValidator a -> + Pl.DatumType a -> + Pl.Value -> TxSkelOut paysScriptInlineDatum :: TypedValidator a -> DatumType a -> Value -> TxSkelOut -paysScriptInlineDatum TypedValidator a -validator DatumType a -datum Value -value = +paysScriptInlineDatum TypedValidator a +validator DatumType a +datum Value +value = ConcreteOutput (TypedValidator a) TxSkelOutDatum Value (Versioned Script) -> TxSkelOut @@ -1767,40 +1767,40 @@ -> ConcreteOutput ownerType datumType valueType referenceScriptType ConcreteOutput TypedValidator a -validator +validator Maybe StakingCredential forall a. Maybe a -Nothing +Nothing Value -value +value (DatumType a -> TxSkelOutDatum forall a. TxSkelOutDatumConstrs a => a -> TxSkelOutDatum TxSkelOutInlineDatum DatumType a -datum) +datum) (Maybe (Versioned Script) forall a. Maybe a -Nothing @(Pl.Versioned Pl.Script)) +Nothing @(Pl.Versioned Pl.Script)) ) -- | Pays a script a certain value with a certain hashed (not resolved in -- transaction) datum. -paysScriptDatumHash :: - ( Pl.ToData (Pl.DatumType a), - Show (Pl.DatumType a), - Typeable (Pl.DatumType a), - Pl.Eq (Pl.DatumType a), - PrettyCooked (Pl.DatumType a), - Typeable a +paysScriptDatumHash :: + ( Pl.ToData (Pl.DatumType a), + Show (Pl.DatumType a), + Typeable (Pl.DatumType a), + Pl.Eq (Pl.DatumType a), + PrettyCooked (Pl.DatumType a), + Typeable a ) => - Pl.TypedValidator a -> - Pl.DatumType a -> - Pl.Value -> + Pl.TypedValidator a -> + Pl.DatumType a -> + Pl.Value -> TxSkelOut paysScriptDatumHash :: TypedValidator a -> DatumType a -> Value -> TxSkelOut -paysScriptDatumHash TypedValidator a -validator DatumType a -datum Value -value = +paysScriptDatumHash TypedValidator a +validator DatumType a +datum Value +value = ConcreteOutput (TypedValidator a) TxSkelOutDatum Value (Versioned Script) -> TxSkelOut @@ -1829,29 +1829,29 @@ -> ConcreteOutput ownerType datumType valueType referenceScriptType ConcreteOutput TypedValidator a -validator +validator Maybe StakingCredential forall a. Maybe a -Nothing +Nothing Value -value +value (DatumType a -> TxSkelOutDatum forall a. TxSkelOutDatumConstrs a => a -> TxSkelOutDatum TxSkelOutDatumHash DatumType a -datum) +datum) (Maybe (Versioned Script) forall a. Maybe a -Nothing @(Pl.Versioned Pl.Script)) +Nothing @(Pl.Versioned Pl.Script)) ) -- | Pays a script a certain value without any datum. Intended to be used with -- 'withDatum', 'withDatumHash', or 'withInlineDatum' to try a datum whose type -- does not match the validator's. -paysScriptNoDatum :: Typeable a => Pl.TypedValidator a -> Pl.Value -> TxSkelOut +paysScriptNoDatum :: (Typeable a) => Pl.TypedValidator a -> Pl.Value -> TxSkelOut paysScriptNoDatum :: TypedValidator a -> Value -> TxSkelOut -paysScriptNoDatum TypedValidator a -validator Value -value = +paysScriptNoDatum TypedValidator a +validator Value +value = ConcreteOutput (TypedValidator a) TxSkelOutDatum Value (Versioned Script) -> TxSkelOut @@ -1880,35 +1880,35 @@ -> ConcreteOutput ownerType datumType valueType referenceScriptType ConcreteOutput TypedValidator a -validator +validator Maybe StakingCredential forall a. Maybe a -Nothing +Nothing Value -value +value TxSkelOutDatum TxSkelOutNoDatum (Maybe (Versioned Script) forall a. Maybe a -Nothing @(Pl.Versioned Pl.Script)) +Nothing @(Pl.Versioned Pl.Script)) ) -- | Set the datum in a payment to the given datum (whose type may not fit the -- typed validator in case of a script). -withDatum :: - ( Pl.ToData a, - Show a, - Typeable a, - Pl.Eq a, - PrettyCooked a +withDatum :: + ( Pl.ToData a, + Show a, + Typeable a, + Pl.Eq a, + PrettyCooked a ) => TxSkelOut -> - a -> + a -> TxSkelOut withDatum :: TxSkelOut -> a -> TxSkelOut -withDatum (Pays o -output) a -datum = +withDatum (Pays o +output) a +datum = ConcreteOutput (OwnerType o) TxSkelOutDatum Value (ReferenceScriptType o) -> TxSkelOut @@ -1927,7 +1927,7 @@ (OwnerType o) TxSkelOutDatum Value (ReferenceScriptType o) -> TxSkelOut forall a b. (a -> b) -> a -> b -$ +$ OwnerType o -> Maybe StakingCredential -> Value @@ -1944,43 +1944,43 @@ -> ConcreteOutput ownerType datumType valueType referenceScriptType ConcreteOutput (o -output o -> Optic' A_Lens '[] o (OwnerType o) -> OwnerType o +output o -> Optic' A_Lens '[] 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 '[] o (OwnerType o) +^. Optic' A_Lens '[] o (OwnerType o) forall o. IsAbstractOutput o => Lens' o (OwnerType o) outputOwnerL) (o -output o +output o -> Optic' A_Lens '[] 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 '[] o (Maybe StakingCredential) +^. Optic' A_Lens '[] o (Maybe StakingCredential) forall o. IsAbstractOutput o => Lens' o (Maybe StakingCredential) outputStakingCredentialL) (o -output o -> Optic' A_Lens '[] o Value -> Value +output o -> Optic' A_Lens '[] o Value -> Value forall k s (is :: IxList) a. Is k A_Getter => s -> Optic' k is s a -> a -^. Optic' A_Lens '[] o Value +^. Optic' A_Lens '[] o Value forall o. IsAbstractOutput o => Lens' o (ValueType o) outputValueL) (a -> TxSkelOutDatum forall a. TxSkelOutDatumConstrs a => a -> TxSkelOutDatum TxSkelOutDatum a -datum) +datum) (o -output o +output o -> Optic' A_Lens '[] 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 '[] o (Maybe (ReferenceScriptType o)) +^. Optic' A_Lens '[] o (Maybe (ReferenceScriptType o)) forall o. IsAbstractOutput o => Lens' o (Maybe (ReferenceScriptType o)) @@ -1988,20 +1988,20 @@ -- | Set the datum in a payment to the given inlined datum (whose type may not -- fit the typed validator in case of a script). -withInlineDatum :: - ( Pl.ToData a, - Show a, - Typeable a, - Pl.Eq a, - PrettyCooked a +withInlineDatum :: + ( Pl.ToData a, + Show a, + Typeable a, + Pl.Eq a, + PrettyCooked a ) => TxSkelOut -> - a -> + a -> TxSkelOut withInlineDatum :: TxSkelOut -> a -> TxSkelOut -withInlineDatum (Pays o -output) a -datum = +withInlineDatum (Pays o +output) a +datum = ConcreteOutput (OwnerType o) TxSkelOutDatum Value (ReferenceScriptType o) -> TxSkelOut @@ -2020,7 +2020,7 @@ (OwnerType o) TxSkelOutDatum Value (ReferenceScriptType o) -> TxSkelOut forall a b. (a -> b) -> a -> b -$ +$ OwnerType o -> Maybe StakingCredential -> Value @@ -2037,43 +2037,43 @@ -> ConcreteOutput ownerType datumType valueType referenceScriptType ConcreteOutput (o -output o -> Optic' A_Lens '[] o (OwnerType o) -> OwnerType o +output o -> Optic' A_Lens '[] 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 '[] o (OwnerType o) +^. Optic' A_Lens '[] o (OwnerType o) forall o. IsAbstractOutput o => Lens' o (OwnerType o) outputOwnerL) (o -output o +output o -> Optic' A_Lens '[] 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 '[] o (Maybe StakingCredential) +^. Optic' A_Lens '[] o (Maybe StakingCredential) forall o. IsAbstractOutput o => Lens' o (Maybe StakingCredential) outputStakingCredentialL) (o -output o -> Optic' A_Lens '[] o Value -> Value +output o -> Optic' A_Lens '[] o Value -> Value forall k s (is :: IxList) a. Is k A_Getter => s -> Optic' k is s a -> a -^. Optic' A_Lens '[] o Value +^. Optic' A_Lens '[] o Value forall o. IsAbstractOutput o => Lens' o (ValueType o) outputValueL) (a -> TxSkelOutDatum forall a. TxSkelOutDatumConstrs a => a -> TxSkelOutDatum TxSkelOutInlineDatum a -datum) +datum) (o -output o +output o -> Optic' A_Lens '[] 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 '[] o (Maybe (ReferenceScriptType o)) +^. Optic' A_Lens '[] o (Maybe (ReferenceScriptType o)) forall o. IsAbstractOutput o => Lens' o (Maybe (ReferenceScriptType o)) @@ -2082,20 +2082,20 @@ -- | Set the datum in a payment to the given hashed (not resolved in the -- transaction) datum (whose type may not fit the typed validator in case of a -- script). -withDatumHash :: - ( Pl.ToData a, - Show a, - Typeable a, - Pl.Eq a, - PrettyCooked a +withDatumHash :: + ( Pl.ToData a, + Show a, + Typeable a, + Pl.Eq a, + PrettyCooked a ) => TxSkelOut -> - a -> + a -> TxSkelOut withDatumHash :: TxSkelOut -> a -> TxSkelOut -withDatumHash (Pays o -output) a -datum = +withDatumHash (Pays o +output) a +datum = ConcreteOutput (OwnerType o) TxSkelOutDatum Value (ReferenceScriptType o) -> TxSkelOut @@ -2114,7 +2114,7 @@ (OwnerType o) TxSkelOutDatum Value (ReferenceScriptType o) -> TxSkelOut forall a b. (a -> b) -> a -> b -$ +$ OwnerType o -> Maybe StakingCredential -> Value @@ -2131,62 +2131,62 @@ -> ConcreteOutput ownerType datumType valueType referenceScriptType ConcreteOutput (o -output o -> Optic' A_Lens '[] o (OwnerType o) -> OwnerType o +output o -> Optic' A_Lens '[] 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 '[] o (OwnerType o) +^. Optic' A_Lens '[] o (OwnerType o) forall o. IsAbstractOutput o => Lens' o (OwnerType o) outputOwnerL) (o -output o +output o -> Optic' A_Lens '[] 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 '[] o (Maybe StakingCredential) +^. Optic' A_Lens '[] o (Maybe StakingCredential) forall o. IsAbstractOutput o => Lens' o (Maybe StakingCredential) outputStakingCredentialL) (o -output o -> Optic' A_Lens '[] o Value -> Value +output o -> Optic' A_Lens '[] o Value -> Value forall k s (is :: IxList) a. Is k A_Getter => s -> Optic' k is s a -> a -^. Optic' A_Lens '[] o Value +^. Optic' A_Lens '[] o Value forall o. IsAbstractOutput o => Lens' o (ValueType o) outputValueL) (a -> TxSkelOutDatum forall a. TxSkelOutDatumConstrs a => a -> TxSkelOutDatum TxSkelOutDatumHash a -datum) +datum) (o -output o +output o -> Optic' A_Lens '[] 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 '[] o (Maybe (ReferenceScriptType o)) +^. Optic' A_Lens '[] o (Maybe (ReferenceScriptType o)) forall o. IsAbstractOutput o => Lens' o (Maybe (ReferenceScriptType o)) outputReferenceScriptL) -- | Add a reference script to a transaction output (or replace it if there is already one) -withReferenceScript :: - ( Show script, - ToScript script, - Typeable script, - ToScriptHash script +withReferenceScript :: + ( Show script, + ToScript script, + Typeable script, + ToScriptHash script ) => TxSkelOut -> - script -> + script -> TxSkelOut withReferenceScript :: TxSkelOut -> script -> TxSkelOut -withReferenceScript (Pays o -output) script -script = +withReferenceScript (Pays o +output) script +script = ConcreteOutput (OwnerType o) TxSkelOutDatum Value script -> TxSkelOut forall o. @@ -2202,7 +2202,7 @@ -> ConcreteOutput (OwnerType o) TxSkelOutDatum Value script -> TxSkelOut forall a b. (a -> b) -> a -> b -$ +$ OwnerType o -> Maybe StakingCredential -> Value @@ -2218,50 +2218,50 @@ -> ConcreteOutput ownerType datumType valueType referenceScriptType ConcreteOutput (o -output o -> Optic' A_Lens '[] o (OwnerType o) -> OwnerType o +output o -> Optic' A_Lens '[] 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 '[] o (OwnerType o) +^. Optic' A_Lens '[] o (OwnerType o) forall o. IsAbstractOutput o => Lens' o (OwnerType o) outputOwnerL) (o -output o +output o -> Optic' A_Lens '[] 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 '[] o (Maybe StakingCredential) +^. Optic' A_Lens '[] o (Maybe StakingCredential) forall o. IsAbstractOutput o => Lens' o (Maybe StakingCredential) outputStakingCredentialL) (o -output o -> Optic' A_Lens '[] o Value -> Value +output o -> Optic' A_Lens '[] o Value -> Value forall k s (is :: IxList) a. Is k A_Getter => s -> Optic' k is s a -> a -^. Optic' A_Lens '[] o Value +^. Optic' A_Lens '[] o Value forall o. IsAbstractOutput o => Lens' o (ValueType o) outputValueL) (o -output o -> Optic' A_Lens '[] o TxSkelOutDatum -> TxSkelOutDatum +output o -> Optic' A_Lens '[] o TxSkelOutDatum -> TxSkelOutDatum forall k s (is :: IxList) a. Is k A_Getter => s -> Optic' k is s a -> a -^. Optic' A_Lens '[] o TxSkelOutDatum +^. Optic' A_Lens '[] o TxSkelOutDatum forall o. IsAbstractOutput o => Lens' o (DatumType o) outputDatumL) (script -> Maybe script forall a. a -> Maybe a -Just script -script) +Just script +script) -- | Add a staking credential to a transaction output (or replace it if there is already one) -withStakingCredential :: TxSkelOut -> Pl.StakingCredential -> TxSkelOut +withStakingCredential :: TxSkelOut -> Pl.StakingCredential -> TxSkelOut withStakingCredential :: TxSkelOut -> StakingCredential -> TxSkelOut -withStakingCredential (Pays o -output) StakingCredential -stakingCredential = +withStakingCredential (Pays o +output) StakingCredential +stakingCredential = ConcreteOutput (OwnerType o) TxSkelOutDatum Value (ReferenceScriptType o) -> TxSkelOut @@ -2280,7 +2280,7 @@ (OwnerType o) TxSkelOutDatum Value (ReferenceScriptType o) -> TxSkelOut forall a b. (a -> b) -> a -> b -$ +$ OwnerType o -> Maybe StakingCredential -> Value @@ -2297,41 +2297,41 @@ -> ConcreteOutput ownerType datumType valueType referenceScriptType ConcreteOutput (o -output o -> Optic' A_Lens '[] o (OwnerType o) -> OwnerType o +output o -> Optic' A_Lens '[] 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 '[] o (OwnerType o) +^. Optic' A_Lens '[] o (OwnerType o) forall o. IsAbstractOutput o => Lens' o (OwnerType o) outputOwnerL) (StakingCredential -> Maybe StakingCredential forall a. a -> Maybe a -Just StakingCredential -stakingCredential) +Just StakingCredential +stakingCredential) (o -output o -> Optic' A_Lens '[] o Value -> Value +output o -> Optic' A_Lens '[] o Value -> Value forall k s (is :: IxList) a. Is k A_Getter => s -> Optic' k is s a -> a -^. Optic' A_Lens '[] o Value +^. Optic' A_Lens '[] o Value forall o. IsAbstractOutput o => Lens' o (ValueType o) outputValueL) (o -output o -> Optic' A_Lens '[] o TxSkelOutDatum -> TxSkelOutDatum +output o -> Optic' A_Lens '[] o TxSkelOutDatum -> TxSkelOutDatum forall k s (is :: IxList) a. Is k A_Getter => s -> Optic' k is s a -> a -^. Optic' A_Lens '[] o TxSkelOutDatum +^. Optic' A_Lens '[] o TxSkelOutDatum forall o. IsAbstractOutput o => Lens' o (DatumType o) outputDatumL) (o -output o +output o -> Optic' A_Lens '[] 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 '[] o (Maybe (ReferenceScriptType o)) +^. Optic' A_Lens '[] o (Maybe (ReferenceScriptType o)) forall o. IsAbstractOutput o => Lens' o (Maybe (ReferenceScriptType o)) @@ -2339,115 +2339,115 @@ -- * Redeemers for transaction inputs -type SpendsScriptConstrs redeemer = - ( Pl.ToData redeemer, - Show redeemer, - PrettyCooked redeemer, - Pl.Eq redeemer, - Typeable redeemer +type SpendsScriptConstrs redeemer = + ( Pl.ToData redeemer, + Show redeemer, + PrettyCooked redeemer, + Pl.Eq redeemer, + Typeable redeemer ) data TxSkelRedeemer where TxSkelNoRedeemerForPK :: TxSkelRedeemer - TxSkelRedeemerForScript :: SpendsScriptConstrs redeemer => redeemer -> TxSkelRedeemer + TxSkelRedeemerForScript :: (SpendsScriptConstrs redeemer) => redeemer -> TxSkelRedeemer -- | The first argument is a reference to the output where the referenced -- script is stored. - TxSkelRedeemerForReferencedScript :: SpendsScriptConstrs redeemer => Pl.TxOutRef -> redeemer -> TxSkelRedeemer + TxSkelRedeemerForReferencedScript :: (SpendsScriptConstrs redeemer) => Pl.TxOutRef -> redeemer -> TxSkelRedeemer -txSkelTypedRedeemer :: Pl.FromData (Pl.RedeemerType a) => TxSkelRedeemer -> Maybe (Pl.RedeemerType a) +txSkelTypedRedeemer :: (Pl.FromData (Pl.RedeemerType a)) => TxSkelRedeemer -> Maybe (Pl.RedeemerType a) txSkelTypedRedeemer :: TxSkelRedeemer -> Maybe (RedeemerType a) -txSkelTypedRedeemer (TxSkelRedeemerForScript redeemer -redeemer) = Data -> Maybe (RedeemerType a) +txSkelTypedRedeemer (TxSkelRedeemerForScript redeemer +redeemer) = Data -> Maybe (RedeemerType a) forall a. FromData a => Data -> Maybe a -Pl.fromData (Data -> Maybe (RedeemerType a)) +Pl.fromData (Data -> Maybe (RedeemerType a)) -> (redeemer -> Data) -> redeemer -> Maybe (RedeemerType a) forall b c a. (b -> c) -> (a -> b) -> a -> c -. redeemer -> Data +. redeemer -> Data forall a. ToData a => a -> Data -Pl.toData (redeemer -> Maybe (RedeemerType a)) +Pl.toData (redeemer -> Maybe (RedeemerType a)) -> redeemer -> Maybe (RedeemerType a) forall a b. (a -> b) -> a -> b -$ redeemer -redeemer +$ redeemer +redeemer txSkelTypedRedeemer (TxSkelRedeemerForReferencedScript TxOutRef -_ redeemer -redeemer) = Data -> Maybe (RedeemerType a) +_ redeemer +redeemer) = Data -> Maybe (RedeemerType a) forall a. FromData a => Data -> Maybe a -Pl.fromData (Data -> Maybe (RedeemerType a)) +Pl.fromData (Data -> Maybe (RedeemerType a)) -> (redeemer -> Data) -> redeemer -> Maybe (RedeemerType a) forall b c a. (b -> c) -> (a -> b) -> a -> c -. redeemer -> Data +. redeemer -> Data forall a. ToData a => a -> Data -Pl.toData (redeemer -> Maybe (RedeemerType a)) +Pl.toData (redeemer -> Maybe (RedeemerType a)) -> redeemer -> Maybe (RedeemerType a) forall a b. (a -> b) -> a -> b -$ redeemer -redeemer +$ redeemer +redeemer txSkelTypedRedeemer TxSkelRedeemer _ = Maybe (RedeemerType a) forall a. Maybe a -Nothing +Nothing -deriving instance (Show TxSkelRedeemer) +deriving instance (Show TxSkelRedeemer) -instance Eq TxSkelRedeemer where +instance Eq TxSkelRedeemer where TxSkelRedeemer -TxSkelNoRedeemerForPK == :: TxSkelRedeemer -> TxSkelRedeemer -> Bool -== TxSkelRedeemer +TxSkelNoRedeemerForPK == :: TxSkelRedeemer -> TxSkelRedeemer -> Bool +== TxSkelRedeemer TxSkelNoRedeemerForPK = Bool -True - (TxSkelRedeemerForScript redeemer -r1) == (TxSkelRedeemerForScript redeemer -r2) = +True + (TxSkelRedeemerForScript redeemer +r1) == (TxSkelRedeemerForScript redeemer +r2) = case redeemer -> TypeRep redeemer forall a. Typeable a => a -> TypeRep a -typeOf redeemer -r1 TypeRep redeemer +typeOf redeemer +r1 TypeRep redeemer -> TypeRep redeemer -> Maybe (redeemer :~~: redeemer) forall k1 k2 (a :: k1) (b :: k2). TypeRep a -> TypeRep b -> Maybe (a :~~: b) -`eqTypeRep` redeemer -> TypeRep redeemer +`eqTypeRep` redeemer -> TypeRep redeemer forall a. Typeable a => a -> TypeRep a -typeOf redeemer -r2 of - Just redeemer :~~: redeemer -HRefl -> redeemer -r1 redeemer -> redeemer -> Bool +typeOf redeemer +r2 of + Just redeemer :~~: redeemer +HRefl -> redeemer +r1 redeemer -> redeemer -> Bool forall a. Eq a => a -> a -> Bool -Pl.== redeemer +Pl.== redeemer redeemer -r2 +r2 Maybe (redeemer :~~: redeemer) -Nothing -> Bool -False - (TxSkelRedeemerForReferencedScript TxOutRef -o1 redeemer -r1) == (TxSkelRedeemerForReferencedScript TxOutRef -o2 redeemer -r2) = +Nothing -> Bool +False + (TxSkelRedeemerForReferencedScript TxOutRef +o1 redeemer +r1) == (TxSkelRedeemerForReferencedScript TxOutRef +o2 redeemer +r2) = redeemer -> TxSkelRedeemer forall redeemer. SpendsScriptConstrs redeemer => redeemer -> TxSkelRedeemer TxSkelRedeemerForScript redeemer -r1 TxSkelRedeemer -> TxSkelRedeemer -> Bool +r1 TxSkelRedeemer -> TxSkelRedeemer -> Bool forall a. Eq a => a -> a -> Bool -== redeemer -> TxSkelRedeemer +== redeemer -> TxSkelRedeemer forall redeemer. SpendsScriptConstrs redeemer => redeemer -> TxSkelRedeemer TxSkelRedeemerForScript redeemer -r2 +r2 Bool -> Bool -> Bool -&& TxOutRef -o1 TxOutRef -> TxOutRef -> Bool +&& TxOutRef +o1 TxOutRef -> TxOutRef -> Bool forall a. Eq a => a -> a -> Bool -== TxOutRef -o2 +== TxOutRef +o2 TxSkelRedeemer -_ == TxSkelRedeemer +_ == TxSkelRedeemer _ = Bool -False +False -- * Transaction skeletons @@ -2457,7 +2457,7 @@ -- pretty-printed whenever cooked-validators prints a transaction, and can -- therefore make the output more informative (and greppable). TxSkel -> Set TxLabel -txSkelLabel :: Set TxLabel, +txSkelLabel :: Set TxLabel, -- | Some options that control transaction generation. TxSkel -> TxOpts txSkelOpts :: TxOpts, @@ -2471,7 +2471,7 @@ TxSkel -> [Wallet] txSkelSigners :: [Wallet], TxSkel -> SlotRange -txSkelValidityRange :: Pl.SlotRange, +txSkelValidityRange :: Pl.SlotRange, -- | To each 'TxOutRef' the transaction should consume, add a redeemer -- specifying how to spend it. You must make sure that -- @@ -2481,17 +2481,17 @@ -- - On 'TxOutRef's referencing UTxOs belonging to scripts, you must make -- sure that the type of the redeemer is appropriate for the script. TxSkel -> Map TxOutRef TxSkelRedeemer -txSkelIns :: Map Pl.TxOutRef TxSkelRedeemer, +txSkelIns :: Map Pl.TxOutRef TxSkelRedeemer, -- | All outputs referenced by the transaction. TxSkel -> Set TxOutRef -txSkelInsReference :: Set Pl.TxOutRef, +txSkelInsReference :: Set Pl.TxOutRef, -- | The outputs of the transaction. These will occur in exactly this -- order on the transaction. TxSkel -> [TxSkelOut] txSkelOuts :: [TxSkelOut] } -> TxSkel - deriving (Int -> TxSkel -> ShowS + deriving (Int -> TxSkel -> ShowS [TxSkel] -> ShowS TxSkel -> String (Int -> TxSkel -> ShowS) @@ -2504,7 +2504,7 @@ $cshow :: TxSkel -> String showsPrec :: Int -> TxSkel -> ShowS $cshowsPrec :: Int -> TxSkel -> ShowS -Show, TxSkel -> TxSkel -> Bool +Show, TxSkel -> TxSkel -> Bool (TxSkel -> TxSkel -> Bool) -> (TxSkel -> TxSkel -> Bool) -> Eq TxSkel forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a @@ -2512,7 +2512,7 @@ $c/= :: TxSkel -> TxSkel -> Bool == :: TxSkel -> TxSkel -> Bool $c== :: TxSkel -> TxSkel -> Bool -Eq) +Eq) makeLensesFor [ ("txSkelLabel", "txSkelLabelL"), @@ -2545,29 +2545,29 @@ { txSkelLabel :: Set TxLabel txSkelLabel = Set TxLabel forall a. Set a -Set.empty, +Set.empty, txSkelOpts :: TxOpts txSkelOpts = TxOpts forall a. Default a => a -def, +def, txSkelMints :: TxSkelMints txSkelMints = TxSkelMints forall k a. Map k a -Map.empty, +Map.empty, txSkelValidityRange :: SlotRange txSkelValidityRange = SlotRange forall a. Interval a -Pl.always, +Pl.always, txSkelSigners :: [Wallet] txSkelSigners = [], txSkelIns :: Map TxOutRef TxSkelRedeemer txSkelIns = Map TxOutRef TxSkelRedeemer forall k a. Map k a -Map.empty, +Map.empty, txSkelInsReference :: Set TxOutRef txSkelInsReference = Set TxOutRef forall a. Set a -Set.empty, +Set.empty, txSkelOuts :: [TxSkelOut] txSkelOuts = [] } @@ -2576,13 +2576,13 @@ -- the state of the blockchain. data SkelContext = SkelContext { SkelContext -> Map TxOutRef TxOut -skelContextTxOuts :: Map Pl.TxOutRef Pl.TxOut, +skelContextTxOuts :: Map Pl.TxOutRef Pl.TxOut, SkelContext -> Map DatumHash TxSkelOutDatum -skelContextTxSkelOutDatums :: Map Pl.DatumHash TxSkelOutDatum +skelContextTxSkelOutDatums :: Map Pl.DatumHash TxSkelOutDatum } -- | Return all data on transaction outputs. -txSkelOutputData :: TxSkel -> Map Pl.DatumHash TxSkelOutDatum +txSkelOutputData :: TxSkel -> Map Pl.DatumHash TxSkelOutDatum txSkelOutputData :: TxSkel -> Map DatumHash TxSkelOutDatum txSkelOutputData = Optic' A_Fold '[] TxSkel TxSkelOutDatum @@ -2592,7 +2592,7 @@ forall k m (is :: IxList) s a. (Is k A_Fold, Monoid m) => Optic' k is s a -> (a -> m) -> s -> m -foldMapOf +foldMapOf ( Lens' TxSkel [TxSkelOut] txSkelOutsL Lens' TxSkel [TxSkelOut] @@ -2602,9 +2602,9 @@ 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 -% Optic A_Fold '[] [TxSkelOut] [TxSkelOut] TxSkelOut TxSkelOut +% Optic A_Fold '[] [TxSkelOut] [TxSkelOut] TxSkelOut TxSkelOut forall (f :: * -> *) a. Foldable f => Fold (f a) a -folded +folded Optic A_Fold '[] TxSkel TxSkel TxSkelOut TxSkelOut -> Lens' TxSkelOut TxSkelOutDatum -> Optic' A_Fold '[] TxSkel TxSkelOutDatum @@ -2612,41 +2612,41 @@ 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 -% Lens' TxSkelOut TxSkelOutDatum +% Lens' TxSkelOut TxSkelOutDatum txSkelOutDatumL ) - ( \TxSkelOutDatum -txSkelOutDatum -> do + ( \TxSkelOutDatum +txSkelOutDatum -> do Map DatumHash TxSkelOutDatum -> (Datum -> Map DatumHash TxSkelOutDatum) -> Maybe Datum -> Map DatumHash TxSkelOutDatum forall b a. b -> (a -> b) -> Maybe a -> b -maybe +maybe Map DatumHash TxSkelOutDatum forall k a. Map k a -Map.empty - (\Datum -datum -> DatumHash -> TxSkelOutDatum -> Map DatumHash TxSkelOutDatum +Map.empty + (\Datum +datum -> DatumHash -> TxSkelOutDatum -> Map DatumHash TxSkelOutDatum forall k a. k -> a -> Map k a -Map.singleton (Datum -> DatumHash -Pl.datumHash Datum -datum) TxSkelOutDatum -txSkelOutDatum) +Map.singleton (Datum -> DatumHash +Pl.datumHash Datum +datum) TxSkelOutDatum +txSkelOutDatum) (TxSkelOutDatum -> Maybe Datum txSkelOutUntypedDatum TxSkelOutDatum -txSkelOutDatum) +txSkelOutDatum) ) newtype Fee = Fee {Fee -> Integer -feeLovelace :: Integer} deriving (Fee -> Fee -> Bool +feeLovelace :: Integer} deriving (Fee -> Fee -> Bool (Fee -> Fee -> Bool) -> (Fee -> Fee -> Bool) -> Eq Fee forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a /= :: Fee -> Fee -> Bool $c/= :: Fee -> Fee -> Bool == :: Fee -> Fee -> Bool $c== :: Fee -> Fee -> Bool -Eq, Eq Fee +Eq, Eq Fee Eq Fee -> (Fee -> Fee -> Ordering) -> (Fee -> Fee -> Bool) @@ -2684,7 +2684,7 @@ compare :: Fee -> Fee -> Ordering $ccompare :: Fee -> Fee -> Ordering $cp1Ord :: Eq Fee -Ord, Int -> Fee -> ShowS +Ord, Int -> Fee -> ShowS [Fee] -> ShowS Fee -> String (Int -> Fee -> ShowS) @@ -2697,7 +2697,7 @@ $cshow :: Fee -> String showsPrec :: Int -> Fee -> ShowS $cshowsPrec :: Int -> Fee -> ShowS -Show, Integer -> Fee +Show, Integer -> Fee Fee -> Fee Fee -> Fee -> Fee (Fee -> Fee -> Fee) @@ -2731,30 +2731,30 @@ $c- :: Fee -> Fee -> Fee + :: Fee -> Fee -> Fee $c+ :: Fee -> Fee -> Fee -Num) +Num) -- | The value in all transaction inputs, plus the negative parts of the minted -- value. This is the right hand side of the "balancing equation": -- -- > mints + inputs = fees + burns + outputs -txSkelOutputValue :: TxSkel -> Fee -> Pl.Value +txSkelOutputValue :: TxSkel -> Fee -> Pl.Value txSkelOutputValue :: TxSkel -> Fee -> Value -txSkelOutputValue skel :: TxSkel -skel@TxSkel {txSkelMints :: TxSkel -> TxSkelMints -txSkelMints = TxSkelMints -mints} Fee -fees = +txSkelOutputValue skel :: TxSkel +skel@TxSkel {txSkelMints :: TxSkel -> TxSkelMints +txSkelMints = TxSkelMints +mints} Fee +fees = Value -> Value negativePart (TxSkelMints -> Value txSkelMintsValue TxSkelMints -mints) +mints) Value -> Value -> Value forall a. Semigroup a => a -> a -> a -<> Optic' A_Fold '[] TxSkel Value -> TxSkel -> Value +<> Optic' A_Fold '[] TxSkel Value -> TxSkel -> Value forall k a (is :: IxList) s. (Is k A_Fold, Monoid a) => Optic' k is s a -> s -> a -foldOf (Lens' TxSkel [TxSkelOut] +foldOf (Lens' TxSkel [TxSkelOut] txSkelOutsL Lens' TxSkel [TxSkelOut] -> Optic A_Fold '[] [TxSkelOut] [TxSkelOut] TxSkelOut TxSkelOut -> Optic A_Fold '[] TxSkel TxSkel TxSkelOut TxSkelOut @@ -2762,149 +2762,149 @@ 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 -% Optic A_Fold '[] [TxSkelOut] [TxSkelOut] TxSkelOut TxSkelOut +% Optic A_Fold '[] [TxSkelOut] [TxSkelOut] TxSkelOut TxSkelOut forall (f :: * -> *) a. Foldable f => Fold (f a) a -folded Optic A_Fold '[] TxSkel TxSkel TxSkelOut TxSkelOut +folded Optic A_Fold '[] TxSkel TxSkel TxSkelOut TxSkelOut -> Lens' TxSkelOut Value -> Optic' A_Fold '[] TxSkel Value 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 -% Lens' TxSkelOut Value +% Lens' TxSkelOut Value txSkelOutValueL) TxSkel -skel +skel Value -> Value -> Value forall a. Semigroup a => a -> a -> a -<> Integer -> Value -Pl.lovelaceValueOf (Fee -> Integer +<> Integer -> Value +Pl.lovelaceValueOf (Fee -> Integer feeLovelace Fee -fees) +fees) -- | All validators which will receive transaction outputs -txSkelOutValidators :: TxSkel -> Map Pl.ValidatorHash (Pl.Versioned Pl.Validator) +txSkelOutValidators :: TxSkel -> Map Pl.ValidatorHash (Pl.Versioned Pl.Validator) txSkelOutValidators :: TxSkel -> Map ValidatorHash (Versioned Validator) txSkelOutValidators = [(ValidatorHash, Versioned Validator)] -> Map ValidatorHash (Versioned Validator) forall k a. Ord k => [(k, a)] -> Map k a -Map.fromList +Map.fromList ([(ValidatorHash, Versioned Validator)] -> Map ValidatorHash (Versioned Validator)) -> (TxSkel -> [(ValidatorHash, Versioned Validator)]) -> TxSkel -> Map ValidatorHash (Versioned Validator) forall b c a. (b -> c) -> (a -> b) -> a -> c -. (TxSkelOut -> Maybe (ValidatorHash, Versioned Validator)) +. (TxSkelOut -> Maybe (ValidatorHash, Versioned Validator)) -> [TxSkelOut] -> [(ValidatorHash, Versioned Validator)] forall a b. (a -> Maybe b) -> [a] -> [b] -mapMaybe ((Versioned Validator -> (ValidatorHash, Versioned Validator)) +mapMaybe ((Versioned Validator -> (ValidatorHash, Versioned Validator)) -> Maybe (Versioned Validator) -> Maybe (ValidatorHash, Versioned Validator) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b -fmap (\Versioned Validator -script -> (Versioned Validator -> ValidatorHash -Ledger.Scripts.validatorHash Versioned Validator -script, Versioned Validator -script)) (Maybe (Versioned Validator) +fmap (\Versioned Validator +script -> (Versioned Validator -> ValidatorHash +Ledger.Scripts.validatorHash Versioned Validator +script, Versioned Validator +script)) (Maybe (Versioned Validator) -> Maybe (ValidatorHash, Versioned Validator)) -> (TxSkelOut -> Maybe (Versioned Validator)) -> TxSkelOut -> Maybe (ValidatorHash, Versioned Validator) forall b c a. (b -> c) -> (a -> b) -> a -> c -. TxSkelOut -> Maybe (Versioned Validator) +. TxSkelOut -> Maybe (Versioned Validator) txSkelOutValidator) ([TxSkelOut] -> [(ValidatorHash, Versioned Validator)]) -> (TxSkel -> [TxSkelOut]) -> TxSkel -> [(ValidatorHash, Versioned Validator)] forall b c a. (b -> c) -> (a -> b) -> a -> c -. TxSkel -> [TxSkelOut] +. TxSkel -> [TxSkelOut] txSkelOuts -- | All validators in the reference script field of transaction outputs -txSkelOutReferenceScripts :: TxSkel -> Map Pl.ValidatorHash (Pl.Versioned Pl.Validator) +txSkelOutReferenceScripts :: TxSkel -> Map Pl.ValidatorHash (Pl.Versioned Pl.Validator) txSkelOutReferenceScripts :: TxSkel -> Map ValidatorHash (Versioned Validator) txSkelOutReferenceScripts = [Map ValidatorHash (Versioned Validator)] -> Map ValidatorHash (Versioned Validator) forall a. Monoid a => [a] -> a -mconcat +mconcat ([Map ValidatorHash (Versioned Validator)] -> Map ValidatorHash (Versioned Validator)) -> (TxSkel -> [Map ValidatorHash (Versioned Validator)]) -> TxSkel -> Map ValidatorHash (Versioned Validator) forall b c a. (b -> c) -> (a -> b) -> a -> c -. (TxSkelOut -> Map ValidatorHash (Versioned Validator)) +. (TxSkelOut -> Map ValidatorHash (Versioned Validator)) -> [TxSkelOut] -> [Map ValidatorHash (Versioned Validator)] forall a b. (a -> b) -> [a] -> [b] -map - ( \(Pays o -output) -> +map + ( \(Pays o +output) -> case o -output o +output o -> Optic' A_Lens '[] 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 '[] o (Maybe (ReferenceScriptType o)) +^. Optic' A_Lens '[] o (Maybe (ReferenceScriptType o)) forall o. IsAbstractOutput o => Lens' o (Maybe (ReferenceScriptType o)) outputReferenceScriptL of Maybe (ReferenceScriptType o) -Nothing -> Map ValidatorHash (Versioned Validator) +Nothing -> Map ValidatorHash (Versioned Validator) forall k a. Map k a -Map.empty - Just ReferenceScriptType o -x -> - let vScript :: Versioned Script -vScript@(Pl.Versioned Script -script Language -version) = ReferenceScriptType o -> Versioned Script +Map.empty + Just ReferenceScriptType o +x -> + let vScript :: Versioned Script +vScript@(Pl.Versioned Script +script Language +version) = ReferenceScriptType o -> Versioned Script forall a. ToScript a => a -> Versioned Script toScript ReferenceScriptType o -x - Pl.ScriptHash BuiltinByteString -hash = Versioned Script -> ScriptHash +x + Pl.ScriptHash BuiltinByteString +hash = Versioned Script -> ScriptHash forall a. ToScriptHash a => a -> ScriptHash toScriptHash Versioned Script -vScript +vScript in ValidatorHash -> Versioned Validator -> Map ValidatorHash (Versioned Validator) forall k a. k -> a -> Map k a -Map.singleton (BuiltinByteString -> ValidatorHash -Pl.ValidatorHash BuiltinByteString -hash) (Versioned Validator -> Map ValidatorHash (Versioned Validator)) +Map.singleton (BuiltinByteString -> ValidatorHash +Pl.ValidatorHash BuiltinByteString +hash) (Versioned Validator -> Map ValidatorHash (Versioned Validator)) -> Versioned Validator -> Map ValidatorHash (Versioned Validator) forall a b. (a -> b) -> a -> b -$ Validator -> Language -> Versioned Validator +$ Validator -> Language -> Versioned Validator forall script. script -> Language -> Versioned script -Pl.Versioned (Script -> Validator -Pl.Validator Script -script) Language -version +Pl.Versioned (Script -> Validator +Pl.Validator Script +script) Language +version ) ([TxSkelOut] -> [Map ValidatorHash (Versioned Validator)]) -> (TxSkel -> [TxSkelOut]) -> TxSkel -> [Map ValidatorHash (Versioned Validator)] forall b c a. (b -> c) -> (a -> b) -> a -> c -. TxSkel -> [TxSkelOut] +. TxSkel -> [TxSkelOut] txSkelOuts -- * Various Optics on 'TxSkels' and all the other types defined here -- | Decide if a transaction output has a certain owner and datum type. txSkelOutOwnerTypeP :: - forall ownerType. - ( ToCredential ownerType, - Show ownerType, - IsTxSkelOutAllowedOwner ownerType, - Typeable ownerType + forall ownerType. + ( ToCredential ownerType, + Show ownerType, + IsTxSkelOutAllowedOwner ownerType, + Typeable ownerType ) => - Prism' TxSkelOut (ConcreteOutput ownerType TxSkelOutDatum Pl.Value (Pl.Versioned Pl.Script)) + Prism' TxSkelOut (ConcreteOutput ownerType TxSkelOutDatum Pl.Value (Pl.Versioned Pl.Script)) txSkelOutOwnerTypeP :: Prism' TxSkelOut (ConcreteOutput ownerType TxSkelOutDatum Value (Versioned Script)) @@ -2918,7 +2918,7 @@ TxSkelOut (ConcreteOutput ownerType TxSkelOutDatum Value (Versioned Script)) forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b -prism' +prism' ConcreteOutput ownerType TxSkelOutDatum Value (Versioned Script) -> TxSkelOut forall o. @@ -2930,36 +2930,36 @@ Typeable (ReferenceScriptType o)) => o -> TxSkelOut Pays - ( \(Pays o -output) -> - let owner :: OwnerType o -owner = o -output o -> Optic' A_Lens '[] o (OwnerType o) -> OwnerType o + ( \(Pays o +output) -> + let owner :: OwnerType o +owner = o +output o -> Optic' A_Lens '[] 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 '[] o (OwnerType o) +^. Optic' A_Lens '[] o (OwnerType o) forall o. IsAbstractOutput o => Lens' o (OwnerType o) outputOwnerL in case OwnerType o -> TypeRep (OwnerType o) forall a. Typeable a => a -> TypeRep a -typeOf OwnerType o -owner TypeRep (OwnerType o) +typeOf OwnerType o +owner TypeRep (OwnerType o) -> TypeRep ownerType -> Maybe (OwnerType o :~~: ownerType) forall k1 k2 (a :: k1) (b :: k2). TypeRep a -> TypeRep b -> Maybe (a :~~: b) -`eqTypeRep` Typeable ownerType => TypeRep ownerType +`eqTypeRep` Typeable ownerType => TypeRep ownerType forall k (a :: k). Typeable a => TypeRep a -typeRep @ownerType of - Just OwnerType o :~~: ownerType -HRefl -> +typeRep @ownerType of + Just OwnerType o :~~: ownerType +HRefl -> ConcreteOutput (OwnerType o) TxSkelOutDatum Value (Versioned Script) -> Maybe (ConcreteOutput (OwnerType o) TxSkelOutDatum Value (Versioned Script)) forall a. a -> Maybe a -Just (ConcreteOutput +Just (ConcreteOutput (OwnerType o) TxSkelOutDatum Value (Versioned Script) -> Maybe (ConcreteOutput @@ -2970,7 +2970,7 @@ (ConcreteOutput (OwnerType o) TxSkelOutDatum Value (Versioned Script)) forall a b. (a -> b) -> a -> b -$ +$ OwnerType o -> Maybe StakingCredential -> Value @@ -2987,31 +2987,31 @@ -> ConcreteOutput ownerType datumType valueType referenceScriptType ConcreteOutput OwnerType o -owner +owner (o -output o +output o -> Optic' A_Lens '[] 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 '[] o (Maybe StakingCredential) +^. Optic' A_Lens '[] o (Maybe StakingCredential) forall o. IsAbstractOutput o => Lens' o (Maybe StakingCredential) outputStakingCredentialL) (o -output o -> Optic' A_Lens '[] o Value -> Value +output o -> Optic' A_Lens '[] o Value -> Value forall k s (is :: IxList) a. Is k A_Getter => s -> Optic' k is s a -> a -^. Optic' A_Lens '[] o Value +^. Optic' A_Lens '[] o Value forall o. IsAbstractOutput o => Lens' o (ValueType o) outputValueL) (o -output o -> Optic' A_Lens '[] o TxSkelOutDatum -> TxSkelOutDatum +output o -> Optic' A_Lens '[] o TxSkelOutDatum -> TxSkelOutDatum forall k s (is :: IxList) a. Is k A_Getter => s -> Optic' k is s a -> a -^. Optic' A_Lens '[] o TxSkelOutDatum +^. Optic' A_Lens '[] o TxSkelOutDatum forall o. IsAbstractOutput o => Lens' o (DatumType o) outputDatumL) (ReferenceScriptType o -> Versioned Script @@ -3019,63 +3019,63 @@ toScript (ReferenceScriptType o -> Versioned Script) -> Maybe (ReferenceScriptType o) -> Maybe (Versioned Script) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b -<$> o -output o +<$> o +output o -> Optic' A_Lens '[] 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 '[] o (Maybe (ReferenceScriptType o)) +^. Optic' A_Lens '[] o (Maybe (ReferenceScriptType o)) forall o. IsAbstractOutput o => Lens' o (Maybe (ReferenceScriptType o)) outputReferenceScriptL) Maybe (OwnerType o :~~: ownerType) -Nothing -> Maybe +Nothing -> Maybe (ConcreteOutput ownerType TxSkelOutDatum Value (Versioned Script)) forall a. Maybe a -Nothing +Nothing ) -txSkelOutputDatumTypeAT :: - (Pl.FromData a, Typeable a) => - AffineTraversal' TxSkelOut a +txSkelOutputDatumTypeAT :: + (Pl.FromData a, Typeable a) => + AffineTraversal' TxSkelOut a txSkelOutputDatumTypeAT :: AffineTraversal' TxSkelOut a txSkelOutputDatumTypeAT = (TxSkelOut -> Either TxSkelOut a) -> (TxSkelOut -> a -> TxSkelOut) -> AffineTraversal' TxSkelOut a forall s t a b. (s -> Either t a) -> (s -> b -> t) -> AffineTraversal s t a b -atraversal - ( \TxSkelOut -txSkelOut -> case TxSkelOut -> Maybe Datum -txSkelOutDatumComplete TxSkelOut -txSkelOut of +atraversal + ( \TxSkelOut +txSkelOut -> case TxSkelOut -> Maybe Datum +txSkelOutDatumComplete TxSkelOut +txSkelOut of Maybe Datum -Nothing -> TxSkelOut -> Either TxSkelOut a +Nothing -> TxSkelOut -> Either TxSkelOut a forall a b. a -> Either a b -Left TxSkelOut -txSkelOut - Just (Pl.Datum BuiltinData -datum) -> case BuiltinData -> Maybe a +Left TxSkelOut +txSkelOut + Just (Pl.Datum BuiltinData +datum) -> case BuiltinData -> Maybe a forall a. FromData a => BuiltinData -> Maybe a -Pl.fromBuiltinData BuiltinData -datum of - Just a -tyDatum -> a -> Either TxSkelOut a +Pl.fromBuiltinData BuiltinData +datum of + Just a +tyDatum -> a -> Either TxSkelOut a forall a b. b -> Either a b -Right a -tyDatum +Right a +tyDatum Maybe a -Nothing -> TxSkelOut -> Either TxSkelOut a +Nothing -> TxSkelOut -> Either TxSkelOut a forall a b. a -> Either a b -Left TxSkelOut -txSkelOut +Left TxSkelOut +txSkelOut ) - ( \(Pays o -output) a -newTyDatum -> + ( \(Pays o +output) a +newTyDatum -> o -> TxSkelOut forall o. (Show o, Typeable o, IsTxInfoOutput o, @@ -3087,13 +3087,13 @@ o -> TxSkelOut Pays (o -> TxSkelOut) -> o -> TxSkelOut forall a b. (a -> b) -> a -> b -$ +$ Optic A_Lens '[] o o TxSkelOutDatum TxSkelOutDatum -> (TxSkelOutDatum -> TxSkelOutDatum) -> o -> o forall k (is :: IxList) s t a b. Is k A_Setter => Optic k is s t a b -> (a -> b) -> s -> t -over +over Optic A_Lens '[] o o TxSkelOutDatum TxSkelOutDatum forall o. IsAbstractOutput o => Lens' o (DatumType o) outputDatumL @@ -3101,75 +3101,75 @@ TxSkelOutDatum TxSkelOutNoDatum -> TxSkelOutDatum TxSkelOutNoDatum - TxSkelOutDatum a -tyDatum -> a -> TxSkelOutDatum + TxSkelOutDatum a +tyDatum -> a -> TxSkelOutDatum forall a. TxSkelOutDatumConstrs a => a -> TxSkelOutDatum TxSkelOutDatum (a -> TxSkelOutDatum) -> a -> TxSkelOutDatum forall a b. (a -> b) -> a -> b -$ a -> a -> a +$ a -> a -> a forall b a. (Typeable b, Typeable a) => b -> a -> b -replaceDatumOnCorrectType a -tyDatum a -newTyDatum - TxSkelOutDatumHash a -tyDatum -> a -> TxSkelOutDatum +replaceDatumOnCorrectType a +tyDatum a +newTyDatum + TxSkelOutDatumHash a +tyDatum -> a -> TxSkelOutDatum forall a. TxSkelOutDatumConstrs a => a -> TxSkelOutDatum TxSkelOutDatumHash (a -> TxSkelOutDatum) -> a -> TxSkelOutDatum forall a b. (a -> b) -> a -> b -$ a -> a -> a +$ a -> a -> a forall b a. (Typeable b, Typeable a) => b -> a -> b -replaceDatumOnCorrectType a -tyDatum a -newTyDatum - TxSkelOutInlineDatum a -tyDatum -> a -> TxSkelOutDatum +replaceDatumOnCorrectType a +tyDatum a +newTyDatum + TxSkelOutInlineDatum a +tyDatum -> a -> TxSkelOutDatum forall a. TxSkelOutDatumConstrs a => a -> TxSkelOutDatum TxSkelOutInlineDatum (a -> TxSkelOutDatum) -> a -> TxSkelOutDatum forall a b. (a -> b) -> a -> b -$ a -> a -> a +$ a -> a -> a forall b a. (Typeable b, Typeable a) => b -> a -> b -replaceDatumOnCorrectType a -tyDatum a -newTyDatum +replaceDatumOnCorrectType a +tyDatum a +newTyDatum ) o -output +output ) where - replaceDatumOnCorrectType :: (Typeable b, Typeable a) => b -> a -> b - replaceDatumOnCorrectType :: b -> a -> b -replaceDatumOnCorrectType b -old a -new = case b -> TypeRep b + replaceDatumOnCorrectType :: (Typeable b, Typeable a) => b -> a -> b + replaceDatumOnCorrectType :: b -> a -> b +replaceDatumOnCorrectType b +old a +new = case b -> TypeRep b forall a. Typeable a => a -> TypeRep a -typeOf b -old TypeRep b -> TypeRep a -> Maybe (b :~~: a) +typeOf b +old TypeRep b -> TypeRep a -> Maybe (b :~~: a) forall k1 k2 (a :: k1) (b :: k2). TypeRep a -> TypeRep b -> Maybe (a :~~: b) -`eqTypeRep` a -> TypeRep a +`eqTypeRep` a -> TypeRep a forall a. Typeable a => a -> TypeRep a -typeOf a -new of - Just b :~~: a -HRefl -> b +typeOf a +new of + Just b :~~: a +HRefl -> b a -new +new Maybe (b :~~: a) -Nothing -> b -old +Nothing -> b +old - txSkelOutDatumComplete :: TxSkelOut -> Maybe Pl.Datum - txSkelOutDatumComplete :: TxSkelOut -> Maybe Datum -txSkelOutDatumComplete (Pays o -output) = TxSkelOutDatum -> Maybe Datum + txSkelOutDatumComplete :: TxSkelOut -> Maybe Pl.Datum + txSkelOutDatumComplete :: TxSkelOut -> Maybe Datum +txSkelOutDatumComplete (Pays o +output) = TxSkelOutDatum -> Maybe Datum txSkelOutUntypedDatum (TxSkelOutDatum -> Maybe Datum) -> TxSkelOutDatum -> Maybe Datum forall a b. (a -> b) -> a -> b -$ o -output o -> Optic' A_Lens '[] o TxSkelOutDatum -> TxSkelOutDatum +$ o +output o -> Optic' A_Lens '[] o TxSkelOutDatum -> TxSkelOutDatum forall k s (is :: IxList) a. Is k A_Getter => s -> Optic' k is s a -> a -^. Optic' A_Lens '[] o TxSkelOutDatum +^. Optic' A_Lens '[] o TxSkelOutDatum forall o. IsAbstractOutput o => Lens' o (DatumType o) outputDatumL \ No newline at end of file diff --git a/src/Cooked.Tweak.AddInputsAndOutputs.html b/src/Cooked.Tweak.AddInputsAndOutputs.html index 45c6ef55f..195734f37 100644 --- a/src/Cooked.Tweak.AddInputsAndOutputs.html +++ b/src/Cooked.Tweak.AddInputsAndOutputs.html @@ -17,27 +17,27 @@ ) where -import Control.Monad +import Control.Monad import Cooked.Skeleton import Cooked.Tweak.Common -import Data.List -import qualified Data.Map as Map -import qualified Ledger as Pl -import Optics.Core -import qualified Plutus.V2.Ledger.Api as Pl +import Data.List +import qualified Data.Map as Map +import qualified Ledger as Pl +import Optics.Core +import qualified Plutus.V2.Ledger.Api as Pl -- * Adding and removing transaction inputs -- | Ensure that a given 'Pl.TxOutRef' is being spent with a given -- 'TxSkelRedeemer'. The return value will be @Just@ the added data, if anything -- changed. -ensureInputTweak :: MonadTweak m => Pl.TxOutRef -> TxSkelRedeemer -> m (Maybe (Pl.TxOutRef, TxSkelRedeemer)) +ensureInputTweak :: (MonadTweak m) => Pl.TxOutRef -> TxSkelRedeemer -> m (Maybe (Pl.TxOutRef, TxSkelRedeemer)) ensureInputTweak :: TxOutRef -> TxSkelRedeemer -> m (Maybe (TxOutRef, TxSkelRedeemer)) -ensureInputTweak TxOutRef -oref TxSkelRedeemer -howConsumed = do - Map TxOutRef TxSkelRedeemer -presentInputs <- Optic' A_Lens NoIx TxSkel (Map TxOutRef TxSkelRedeemer) +ensureInputTweak TxOutRef +oref TxSkelRedeemer +howConsumed = do + Map TxOutRef TxSkelRedeemer +presentInputs <- Optic' A_Lens NoIx TxSkel (Map TxOutRef TxSkelRedeemer) -> m (Map TxOutRef TxSkelRedeemer) forall (m :: * -> *) k (is :: IxList) a. (MonadTweak m, Is k A_Getter) => @@ -45,21 +45,21 @@ viewTweak Optic' A_Lens NoIx TxSkel (Map TxOutRef TxSkelRedeemer) txSkelInsL if Map TxOutRef TxSkelRedeemer -presentInputs Map TxOutRef TxSkelRedeemer -> TxOutRef -> Maybe TxSkelRedeemer +presentInputs Map TxOutRef TxSkelRedeemer -> TxOutRef -> Maybe TxSkelRedeemer forall k a. Ord k => Map k a -> k -> Maybe a -Map.!? TxOutRef -oref Maybe TxSkelRedeemer -> Maybe TxSkelRedeemer -> Bool +Map.!? TxOutRef +oref Maybe TxSkelRedeemer -> Maybe TxSkelRedeemer -> Bool forall a. Eq a => a -> a -> Bool -== TxSkelRedeemer -> Maybe TxSkelRedeemer +== TxSkelRedeemer -> Maybe TxSkelRedeemer forall a. a -> Maybe a -Just TxSkelRedeemer -howConsumed +Just TxSkelRedeemer +howConsumed then Maybe (TxOutRef, TxSkelRedeemer) -> m (Maybe (TxOutRef, TxSkelRedeemer)) forall (m :: * -> *) a. Monad m => a -> m a -return Maybe (TxOutRef, TxSkelRedeemer) +return Maybe (TxOutRef, TxSkelRedeemer) forall a. Maybe a -Nothing +Nothing else do Optic' A_Lens NoIx TxSkel (Map TxOutRef TxSkelRedeemer) -> (Map TxOutRef TxSkelRedeemer -> Map TxOutRef TxSkelRedeemer) @@ -73,32 +73,32 @@ -> Map TxOutRef TxSkelRedeemer -> Map TxOutRef TxSkelRedeemer forall k a. Ord k => k -> a -> Map k a -> Map k a -Map.insert TxOutRef -oref TxSkelRedeemer -howConsumed) +Map.insert TxOutRef +oref TxSkelRedeemer +howConsumed) Maybe (TxOutRef, TxSkelRedeemer) -> m (Maybe (TxOutRef, TxSkelRedeemer)) forall (m :: * -> *) a. Monad m => a -> m a -return (Maybe (TxOutRef, TxSkelRedeemer) +return (Maybe (TxOutRef, TxSkelRedeemer) -> m (Maybe (TxOutRef, TxSkelRedeemer))) -> Maybe (TxOutRef, TxSkelRedeemer) -> m (Maybe (TxOutRef, TxSkelRedeemer)) forall a b. (a -> b) -> a -> b -$ (TxOutRef, TxSkelRedeemer) -> Maybe (TxOutRef, TxSkelRedeemer) +$ (TxOutRef, TxSkelRedeemer) -> Maybe (TxOutRef, TxSkelRedeemer) forall a. a -> Maybe a -Just (TxOutRef -oref, TxSkelRedeemer -howConsumed) +Just (TxOutRef +oref, TxSkelRedeemer +howConsumed) -- | Add an input to a transaction. If the given 'Pl.TxOutRef' is already being -- consumed by the transaction, fail. -addInputTweak :: MonadTweak m => Pl.TxOutRef -> TxSkelRedeemer -> m () +addInputTweak :: (MonadTweak m) => Pl.TxOutRef -> TxSkelRedeemer -> m () addInputTweak :: TxOutRef -> TxSkelRedeemer -> m () -addInputTweak TxOutRef -oref TxSkelRedeemer -howConsumed = do - Map TxOutRef TxSkelRedeemer -presentInputs <- Optic' A_Lens NoIx TxSkel (Map TxOutRef TxSkelRedeemer) +addInputTweak TxOutRef +oref TxSkelRedeemer +howConsumed = do + Map TxOutRef TxSkelRedeemer +presentInputs <- Optic' A_Lens NoIx TxSkel (Map TxOutRef TxSkelRedeemer) -> m (Map TxOutRef TxSkelRedeemer) forall (m :: * -> *) k (is :: IxList) a. (MonadTweak m, Is k A_Getter) => @@ -107,11 +107,11 @@ txSkelInsL Bool -> m () forall (f :: * -> *). Alternative f => Bool -> f () -guard (TxOutRef -> Map TxOutRef TxSkelRedeemer -> Bool +guard (TxOutRef -> Map TxOutRef TxSkelRedeemer -> Bool forall k a. Ord k => k -> Map k a -> Bool -Map.notMember TxOutRef -oref Map TxOutRef TxSkelRedeemer -presentInputs) +Map.notMember TxOutRef +oref Map TxOutRef TxSkelRedeemer +presentInputs) Optic' A_Lens NoIx TxSkel (Map TxOutRef TxSkelRedeemer) -> (Map TxOutRef TxSkelRedeemer -> Map TxOutRef TxSkelRedeemer) -> m () @@ -124,34 +124,34 @@ -> Map TxOutRef TxSkelRedeemer -> Map TxOutRef TxSkelRedeemer forall k a. Ord k => k -> a -> Map k a -> Map k a -Map.insert TxOutRef -oref TxSkelRedeemer -howConsumed) +Map.insert TxOutRef +oref TxSkelRedeemer +howConsumed) -- | Remove transaction inputs according to a given predicate. The returned list -- contains all removed inputs. -removeInputTweak :: MonadTweak m => (Pl.TxOutRef -> TxSkelRedeemer -> Bool) -> m [(Pl.TxOutRef, TxSkelRedeemer)] +removeInputTweak :: (MonadTweak m) => (Pl.TxOutRef -> TxSkelRedeemer -> Bool) -> m [(Pl.TxOutRef, TxSkelRedeemer)] removeInputTweak :: (TxOutRef -> TxSkelRedeemer -> Bool) -> m [(TxOutRef, TxSkelRedeemer)] -removeInputTweak TxOutRef -> TxSkelRedeemer -> Bool -removePred = do - Map TxOutRef TxSkelRedeemer -presentInputs <- Optic' A_Lens NoIx TxSkel (Map TxOutRef TxSkelRedeemer) +removeInputTweak TxOutRef -> TxSkelRedeemer -> Bool +removePred = do + Map TxOutRef TxSkelRedeemer +presentInputs <- Optic' A_Lens NoIx TxSkel (Map TxOutRef TxSkelRedeemer) -> m (Map TxOutRef TxSkelRedeemer) forall (m :: * -> *) k (is :: IxList) a. (MonadTweak m, Is k A_Getter) => Optic' k is TxSkel a -> m a viewTweak Optic' A_Lens NoIx TxSkel (Map TxOutRef TxSkelRedeemer) txSkelInsL - let (Map TxOutRef TxSkelRedeemer -removed, Map TxOutRef TxSkelRedeemer -kept) = (TxOutRef -> TxSkelRedeemer -> Bool) + let (Map TxOutRef TxSkelRedeemer +removed, Map TxOutRef TxSkelRedeemer +kept) = (TxOutRef -> TxSkelRedeemer -> Bool) -> Map TxOutRef TxSkelRedeemer -> (Map TxOutRef TxSkelRedeemer, Map TxOutRef TxSkelRedeemer) forall k a. (k -> a -> Bool) -> Map k a -> (Map k a, Map k a) -Map.partitionWithKey TxOutRef -> TxSkelRedeemer -> Bool -removePred Map TxOutRef TxSkelRedeemer -presentInputs +Map.partitionWithKey TxOutRef -> TxSkelRedeemer -> Bool +removePred Map TxOutRef TxSkelRedeemer +presentInputs Optic' A_Lens NoIx TxSkel (Map TxOutRef TxSkelRedeemer) -> Map TxOutRef TxSkelRedeemer -> m () forall (m :: * -> *) k (is :: IxList) a. @@ -159,63 +159,63 @@ Optic' k is TxSkel a -> a -> m () setTweak Optic' A_Lens NoIx TxSkel (Map TxOutRef TxSkelRedeemer) txSkelInsL Map TxOutRef TxSkelRedeemer -kept +kept [(TxOutRef, TxSkelRedeemer)] -> m [(TxOutRef, TxSkelRedeemer)] forall (m :: * -> *) a. Monad m => a -> m a -return ([(TxOutRef, TxSkelRedeemer)] -> m [(TxOutRef, TxSkelRedeemer)]) +return ([(TxOutRef, TxSkelRedeemer)] -> m [(TxOutRef, TxSkelRedeemer)]) -> [(TxOutRef, TxSkelRedeemer)] -> m [(TxOutRef, TxSkelRedeemer)] forall a b. (a -> b) -> a -> b -$ Map TxOutRef TxSkelRedeemer -> [(TxOutRef, TxSkelRedeemer)] +$ Map TxOutRef TxSkelRedeemer -> [(TxOutRef, TxSkelRedeemer)] forall k a. Map k a -> [(k, a)] -Map.toList Map TxOutRef TxSkelRedeemer -removed +Map.toList Map TxOutRef TxSkelRedeemer +removed -- * Adding and removing transaction outputs -- | Ensure that a certain output is produced by a transaction. The return value -- will be @Just@ the added output, if there was any change. -ensureOutputTweak :: MonadTweak m => TxSkelOut -> m (Maybe TxSkelOut) +ensureOutputTweak :: (MonadTweak m) => TxSkelOut -> m (Maybe TxSkelOut) ensureOutputTweak :: TxSkelOut -> m (Maybe TxSkelOut) -ensureOutputTweak TxSkelOut -txSkelOut = do - [TxSkelOut] -presentOutputs <- Optic' A_Lens NoIx TxSkel [TxSkelOut] -> m [TxSkelOut] +ensureOutputTweak TxSkelOut +txSkelOut = do + [TxSkelOut] +presentOutputs <- Optic' A_Lens NoIx TxSkel [TxSkelOut] -> m [TxSkelOut] forall (m :: * -> *) k (is :: IxList) a. (MonadTweak m, Is k A_Getter) => Optic' k is TxSkel a -> m a viewTweak Optic' A_Lens NoIx TxSkel [TxSkelOut] txSkelOutsL if TxSkelOut -txSkelOut TxSkelOut -> [TxSkelOut] -> Bool +txSkelOut TxSkelOut -> [TxSkelOut] -> Bool forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool -`elem` [TxSkelOut] -presentOutputs +`elem` [TxSkelOut] +presentOutputs then Maybe TxSkelOut -> m (Maybe TxSkelOut) forall (m :: * -> *) a. Monad m => a -> m a -return Maybe TxSkelOut +return Maybe TxSkelOut forall a. Maybe a -Nothing +Nothing else do TxSkelOut -> m () forall (m :: * -> *). MonadTweak m => TxSkelOut -> m () addOutputTweak TxSkelOut -txSkelOut +txSkelOut Maybe TxSkelOut -> m (Maybe TxSkelOut) forall (m :: * -> *) a. Monad m => a -> m a -return (Maybe TxSkelOut -> m (Maybe TxSkelOut)) +return (Maybe TxSkelOut -> m (Maybe TxSkelOut)) -> Maybe TxSkelOut -> m (Maybe TxSkelOut) forall a b. (a -> b) -> a -> b -$ TxSkelOut -> Maybe TxSkelOut +$ TxSkelOut -> Maybe TxSkelOut forall a. a -> Maybe a -Just TxSkelOut -txSkelOut +Just TxSkelOut +txSkelOut -- | Add a transaction output, at the end of the current list of outputs, -- thus retaining the order in which they have been specified. -addOutputTweak :: MonadTweak m => TxSkelOut -> m () +addOutputTweak :: (MonadTweak m) => TxSkelOut -> m () addOutputTweak :: TxSkelOut -> m () -addOutputTweak TxSkelOut -txSkelOut = Optic' A_Lens NoIx TxSkel [TxSkelOut] +addOutputTweak TxSkelOut +txSkelOut = Optic' A_Lens NoIx TxSkel [TxSkelOut] -> ([TxSkelOut] -> [TxSkelOut]) -> m () forall (m :: * -> *) k (is :: IxList) a. (MonadTweak m, Is k A_Setter) => @@ -223,51 +223,51 @@ overTweak Optic' A_Lens NoIx TxSkel [TxSkelOut] txSkelOutsL ([TxSkelOut] -> [TxSkelOut] -> [TxSkelOut] forall a. [a] -> [a] -> [a] -++ [TxSkelOut -txSkelOut]) +++ [TxSkelOut +txSkelOut]) -- | Remove transaction outputs according to some predicate. The returned list -- contains all the removed outputs. -removeOutputTweak :: MonadTweak m => (TxSkelOut -> Bool) -> m [TxSkelOut] +removeOutputTweak :: (MonadTweak m) => (TxSkelOut -> Bool) -> m [TxSkelOut] removeOutputTweak :: (TxSkelOut -> Bool) -> m [TxSkelOut] -removeOutputTweak TxSkelOut -> Bool -removePred = do - [TxSkelOut] -presentOutputs <- Optic' A_Lens NoIx TxSkel [TxSkelOut] -> m [TxSkelOut] +removeOutputTweak TxSkelOut -> Bool +removePred = do + [TxSkelOut] +presentOutputs <- Optic' A_Lens NoIx TxSkel [TxSkelOut] -> m [TxSkelOut] forall (m :: * -> *) k (is :: IxList) a. (MonadTweak m, Is k A_Getter) => Optic' k is TxSkel a -> m a viewTweak Optic' A_Lens NoIx TxSkel [TxSkelOut] txSkelOutsL - let ([TxSkelOut] -removed, [TxSkelOut] -kept) = (TxSkelOut -> Bool) -> [TxSkelOut] -> ([TxSkelOut], [TxSkelOut]) + let ([TxSkelOut] +removed, [TxSkelOut] +kept) = (TxSkelOut -> Bool) -> [TxSkelOut] -> ([TxSkelOut], [TxSkelOut]) forall a. (a -> Bool) -> [a] -> ([a], [a]) -partition TxSkelOut -> Bool -removePred [TxSkelOut] -presentOutputs +partition TxSkelOut -> Bool +removePred [TxSkelOut] +presentOutputs Optic' A_Lens NoIx TxSkel [TxSkelOut] -> [TxSkelOut] -> m () forall (m :: * -> *) k (is :: IxList) a. (MonadTweak m, Is k A_Setter) => Optic' k is TxSkel a -> a -> m () setTweak Optic' A_Lens NoIx TxSkel [TxSkelOut] txSkelOutsL [TxSkelOut] -kept +kept [TxSkelOut] -> m [TxSkelOut] forall (m :: * -> *) a. Monad m => a -> m a -return [TxSkelOut] -removed +return [TxSkelOut] +removed -- * Adding and removing minted values -- | Add a new entry to the 'TxSkelMints' of the transaction skeleton under -- modification. As this is implemented in terms of 'addToTxSkelMints', the same -- caveats apply as do to that function! -addMintTweak :: MonadTweak m => (Pl.Versioned Pl.MintingPolicy, MintsRedeemer, Pl.TokenName, Integer) -> m () +addMintTweak :: (MonadTweak m) => (Pl.Versioned Pl.MintingPolicy, MintsRedeemer, Pl.TokenName, Integer) -> m () addMintTweak :: (Versioned MintingPolicy, MintsRedeemer, TokenName, Integer) -> m () -addMintTweak (Versioned MintingPolicy, MintsRedeemer, TokenName, Integer) -mint = Optic' A_Lens NoIx TxSkel TxSkelMints +addMintTweak (Versioned MintingPolicy, MintsRedeemer, TokenName, Integer) +mint = Optic' A_Lens NoIx TxSkel TxSkelMints -> (TxSkelMints -> TxSkelMints) -> m () forall (m :: * -> *) k (is :: IxList) a. (MonadTweak m, Is k A_Setter) => @@ -276,25 +276,25 @@ txSkelMintsL ((TxSkelMints -> TxSkelMints) -> m ()) -> (TxSkelMints -> TxSkelMints) -> m () forall a b. (a -> b) -> a -> b -$ (Versioned MintingPolicy, MintsRedeemer, TokenName, Integer) +$ (Versioned MintingPolicy, MintsRedeemer, TokenName, Integer) -> TxSkelMints -> TxSkelMints addToTxSkelMints (Versioned MintingPolicy, MintsRedeemer, TokenName, Integer) -mint +mint -- | Remove some entries from the 'TxSkelMints' of a transaction, according to -- some predicate. The returned list holds the removed entries. -removeMintTweak :: - MonadTweak m => - ((Pl.Versioned Pl.MintingPolicy, MintsRedeemer, Pl.TokenName, Integer) -> Bool) -> - m [(Pl.Versioned Pl.MintingPolicy, MintsRedeemer, Pl.TokenName, Integer)] +removeMintTweak :: + (MonadTweak m) => + ((Pl.Versioned Pl.MintingPolicy, MintsRedeemer, Pl.TokenName, Integer) -> Bool) -> + m [(Pl.Versioned Pl.MintingPolicy, MintsRedeemer, Pl.TokenName, Integer)] removeMintTweak :: ((Versioned MintingPolicy, MintsRedeemer, TokenName, Integer) -> Bool) -> m [(Versioned MintingPolicy, MintsRedeemer, TokenName, Integer)] -removeMintTweak (Versioned MintingPolicy, MintsRedeemer, TokenName, Integer) +removeMintTweak (Versioned MintingPolicy, MintsRedeemer, TokenName, Integer) -> Bool -removePred = do - [(Versioned MintingPolicy, MintsRedeemer, TokenName, Integer)] -presentMints <- Optic' +removePred = do + [(Versioned MintingPolicy, MintsRedeemer, TokenName, Integer)] +presentMints <- Optic' A_Getter NoIx TxSkel @@ -317,7 +317,7 @@ [(Versioned MintingPolicy, MintsRedeemer, TokenName, Integer)] -> m [(Versioned MintingPolicy, MintsRedeemer, TokenName, Integer)] forall a b. (a -> b) -> a -> b -$ Optic' A_Lens NoIx TxSkel TxSkelMints +$ Optic' A_Lens NoIx TxSkel TxSkelMints txSkelMintsL Optic' A_Lens NoIx TxSkel TxSkelMints -> Optic A_Getter @@ -335,7 +335,7 @@ 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 -% (TxSkelMints +% (TxSkelMints -> [(Versioned MintingPolicy, MintsRedeemer, TokenName, Integer)]) -> Optic A_Getter @@ -345,21 +345,21 @@ [(Versioned MintingPolicy, MintsRedeemer, TokenName, Integer)] [(Versioned MintingPolicy, MintsRedeemer, TokenName, Integer)] forall s a. (s -> a) -> Getter s a -to TxSkelMints +to TxSkelMints -> [(Versioned MintingPolicy, MintsRedeemer, TokenName, Integer)] txSkelMintsToList - let ([(Versioned MintingPolicy, MintsRedeemer, TokenName, Integer)] -removed, [(Versioned MintingPolicy, MintsRedeemer, TokenName, Integer)] -kept) = ((Versioned MintingPolicy, MintsRedeemer, TokenName, Integer) + let ([(Versioned MintingPolicy, MintsRedeemer, TokenName, Integer)] +removed, [(Versioned MintingPolicy, MintsRedeemer, TokenName, Integer)] +kept) = ((Versioned MintingPolicy, MintsRedeemer, TokenName, Integer) -> Bool) -> [(Versioned MintingPolicy, MintsRedeemer, TokenName, Integer)] -> ([(Versioned MintingPolicy, MintsRedeemer, TokenName, Integer)], [(Versioned MintingPolicy, MintsRedeemer, TokenName, Integer)]) forall a. (a -> Bool) -> [a] -> ([a], [a]) -partition (Versioned MintingPolicy, MintsRedeemer, TokenName, Integer) +partition (Versioned MintingPolicy, MintsRedeemer, TokenName, Integer) -> Bool -removePred [(Versioned MintingPolicy, MintsRedeemer, TokenName, Integer)] -presentMints +removePred [(Versioned MintingPolicy, MintsRedeemer, TokenName, Integer)] +presentMints Optic' A_Lens NoIx TxSkel TxSkelMints -> TxSkelMints -> m () forall (m :: * -> *) k (is :: IxList) a. (MonadTweak m, Is k A_Setter) => @@ -367,13 +367,13 @@ setTweak Optic' A_Lens NoIx TxSkel TxSkelMints txSkelMintsL (TxSkelMints -> m ()) -> TxSkelMints -> m () forall a b. (a -> b) -> a -> b -$ [(Versioned MintingPolicy, MintsRedeemer, TokenName, Integer)] +$ [(Versioned MintingPolicy, MintsRedeemer, TokenName, Integer)] -> TxSkelMints txSkelMintsFromList [(Versioned MintingPolicy, MintsRedeemer, TokenName, Integer)] -kept +kept [(Versioned MintingPolicy, MintsRedeemer, TokenName, Integer)] -> m [(Versioned MintingPolicy, MintsRedeemer, TokenName, Integer)] forall (m :: * -> *) a. Monad m => a -> m a -return [(Versioned MintingPolicy, MintsRedeemer, TokenName, Integer)] -removed +return [(Versioned MintingPolicy, MintsRedeemer, TokenName, Integer)] +removed \ No newline at end of file diff --git a/src/Cooked.Tweak.Common.html b/src/Cooked.Tweak.Common.html index 33fca24f3..119c2b43d 100644 --- a/src/Cooked.Tweak.Common.html +++ b/src/Cooked.Tweak.Common.html @@ -28,35 +28,35 @@ ) where -import Control.Arrow (second) -import Control.Monad -import Control.Monad.State +import Control.Arrow (second) +import Control.Monad +import Control.Monad.State import Cooked.MockChain.BlockChain import Cooked.Skeleton -import Data.Either.Combinators (rightToMaybe) -import Data.List -import Data.Maybe -import ListT (ListT) -import qualified ListT -import Optics.Core +import Data.Either.Combinators (rightToMaybe) +import Data.List +import Data.Maybe +import ListT (ListT) +import qualified ListT +import Optics.Core -- * The type of tweaks -class (MonadPlus m, MonadBlockChainWithoutValidation m) => MonadTweak m where - getTxSkel :: m TxSkel - putTxSkel :: TxSkel -> m () +class (MonadPlus m, MonadBlockChainWithoutValidation m) => MonadTweak m where + getTxSkel :: m TxSkel + putTxSkel :: TxSkel -> m () -type Tweak m = StateT TxSkel (ListT m) +type Tweak m = StateT TxSkel (ListT m) -instance MonadBlockChainWithoutValidation m => MonadTweak (Tweak m) where - getTxSkel :: Tweak m TxSkel -getTxSkel = Tweak m TxSkel +instance (MonadBlockChainWithoutValidation m) => MonadTweak (Tweak m) where + getTxSkel :: Tweak m TxSkel +getTxSkel = Tweak m TxSkel forall s (m :: * -> *). MonadState s m => m s -get - putTxSkel :: TxSkel -> Tweak m () -putTxSkel = TxSkel -> Tweak m () +get + putTxSkel :: TxSkel -> Tweak m () +putTxSkel = TxSkel -> Tweak m () forall s (m :: * -> *). MonadState s m => s -> m () -put +put -- | This is the function that gives a meaning to 'Tweak's: A 'Tweak' is a -- computation that, depending on the state of the chain, looks at a transaction @@ -79,22 +79,22 @@ -- If you're using tweaks in a 'MonadModalBlockChain' together with mechanisms -- like 'withTweak', 'somewhere', or 'everywhere', you should never have areason -- to use this function. -runTweakInChain :: (MonadBlockChainWithoutValidation m, MonadPlus m) => Tweak m a -> TxSkel -> m (a, TxSkel) +runTweakInChain :: (MonadBlockChainWithoutValidation m, MonadPlus m) => Tweak m a -> TxSkel -> m (a, TxSkel) runTweakInChain :: Tweak m a -> TxSkel -> m (a, TxSkel) -runTweakInChain Tweak m a -tweak TxSkel -skel = ListT m (a, TxSkel) -> m (a, TxSkel) +runTweakInChain Tweak m a +tweak TxSkel +skel = ListT m (a, TxSkel) -> m (a, TxSkel) forall (m :: * -> *) a. (Alternative m, Monad m) => ListT m a -> m a -ListT.alternate (ListT m (a, TxSkel) -> m (a, TxSkel)) +ListT.alternate (ListT m (a, TxSkel) -> m (a, TxSkel)) -> ListT m (a, TxSkel) -> m (a, TxSkel) forall a b. (a -> b) -> a -> b -$ Tweak m a -> TxSkel -> ListT m (a, TxSkel) +$ Tweak m a -> TxSkel -> ListT m (a, TxSkel) forall s (m :: * -> *) a. StateT s m a -> s -> m (a, s) -runStateT Tweak m a -tweak TxSkel -skel +runStateT Tweak m a +tweak TxSkel +skel -- | Like 'runTweakInChain', but for when you want to explicitly apply a tweak -- to a transaction skeleton and get all results as a list. @@ -102,177 +102,177 @@ -- If you're trying to apply a tweak to a transaction directly before it's -- modified, consider using 'MonadModalBlockChain' and idioms like 'withTweak', -- 'somewhere', or 'everywhere'. -runTweakInChain' :: MonadBlockChainWithoutValidation m => Tweak m a -> TxSkel -> m [(a, TxSkel)] +runTweakInChain' :: (MonadBlockChainWithoutValidation m) => Tweak m a -> TxSkel -> m [(a, TxSkel)] runTweakInChain' :: Tweak m a -> TxSkel -> m [(a, TxSkel)] -runTweakInChain' Tweak m a -tweak TxSkel -skel = ListT m (a, TxSkel) -> m [(a, TxSkel)] +runTweakInChain' Tweak m a +tweak TxSkel +skel = ListT m (a, TxSkel) -> m [(a, TxSkel)] forall (m :: * -> *) a. Monad m => ListT m a -> m [a] -ListT.toList (ListT m (a, TxSkel) -> m [(a, TxSkel)]) +ListT.toList (ListT m (a, TxSkel) -> m [(a, TxSkel)]) -> ListT m (a, TxSkel) -> m [(a, TxSkel)] forall a b. (a -> b) -> a -> b -$ Tweak m a -> TxSkel -> ListT m (a, TxSkel) +$ Tweak m a -> TxSkel -> ListT m (a, TxSkel) forall s (m :: * -> *) a. StateT s m a -> s -> m (a, s) -runStateT Tweak m a -tweak TxSkel -skel +runStateT Tweak m a +tweak TxSkel +skel -- | This is a wrapper type used in the implementation of the Staged monad. You -- will probably never use it while you're building 'Tweak's. -data UntypedTweak m where - UntypedTweak :: Tweak m a -> UntypedTweak m +data UntypedTweak m where + UntypedTweak :: Tweak m a -> UntypedTweak m -instance Monad m => Semigroup (UntypedTweak m) where +instance (Monad m) => Semigroup (UntypedTweak m) where -- The right tweak is applied first - UntypedTweak Tweak m a -f <> :: UntypedTweak m -> UntypedTweak m -> UntypedTweak m -<> UntypedTweak Tweak m a -g = Tweak m a -> UntypedTweak m + UntypedTweak Tweak m a +f <> :: UntypedTweak m -> UntypedTweak m -> UntypedTweak m +<> UntypedTweak Tweak m a +g = Tweak m a -> UntypedTweak m forall (m :: * -> *) a. Tweak m a -> UntypedTweak m UntypedTweak (Tweak m a -> UntypedTweak m) -> Tweak m a -> UntypedTweak m forall a b. (a -> b) -> a -> b -$ Tweak m a -g Tweak m a -> Tweak m a -> Tweak m a +$ Tweak m a +g Tweak m a -> Tweak m a -> Tweak m a forall (m :: * -> *) a b. Monad m => m a -> m b -> m b ->> Tweak m a -f +>> Tweak m a +f -instance Monad m => Monoid (UntypedTweak m) where - mempty :: UntypedTweak m -mempty = Tweak m () -> UntypedTweak m +instance (Monad m) => Monoid (UntypedTweak m) where + mempty :: UntypedTweak m +mempty = Tweak m () -> UntypedTweak m forall (m :: * -> *) a. Tweak m a -> UntypedTweak m UntypedTweak (Tweak m () -> UntypedTweak m) -> Tweak m () -> UntypedTweak m forall a b. (a -> b) -> a -> b -$ () -> Tweak m () +$ () -> Tweak m () forall (m :: * -> *) a. Monad m => a -> m a -return () +return () -- * A few fundamental tweaks -- | The never-applicable tweak. -failingTweak :: MonadTweak m => m a +failingTweak :: (MonadTweak m) => m a failingTweak :: m a failingTweak = m a forall (m :: * -> *) a. MonadPlus m => m a -mzero +mzero -- | The tweak that always applies and leaves the transaction unchanged. -doNothingTweak :: MonadTweak m => m () +doNothingTweak :: (MonadTweak m) => m () doNothingTweak :: m () doNothingTweak = () -> m () forall (m :: * -> *) a. Monad m => a -> m a -return () +return () -- * Constructing Tweaks from Optics -- | The "tweak" that obtains some value from the 'TxSkel'. This does *not* -- modify the transaction. -viewTweak :: (MonadTweak m, Is k A_Getter) => Optic' k is TxSkel a -> m a +viewTweak :: (MonadTweak m, Is k A_Getter) => Optic' k is TxSkel a -> m a viewTweak :: Optic' k is TxSkel a -> m a -viewTweak Optic' k is TxSkel a -optic = m TxSkel +viewTweak Optic' k is TxSkel a +optic = m TxSkel forall (m :: * -> *). MonadTweak m => m TxSkel getTxSkel m TxSkel -> (TxSkel -> a) -> m a forall (f :: * -> *) a b. Functor f => f a -> (a -> b) -> f b -<&> Optic' k is TxSkel a -> TxSkel -> a +<&> Optic' k is TxSkel a -> TxSkel -> a forall k (is :: IxList) s a. Is k A_Getter => Optic' k is s a -> s -> a -view Optic' k is TxSkel a -optic +view Optic' k is TxSkel a +optic -- | Like 'viewTweak', only for indexed optics. -iviewTweak :: (MonadTweak m, Is k A_Getter) => Optic' k (WithIx is) TxSkel a -> m (is, a) +iviewTweak :: (MonadTweak m, Is k A_Getter) => Optic' k (WithIx is) TxSkel a -> m (is, a) iviewTweak :: Optic' k (WithIx is) TxSkel a -> m (is, a) -iviewTweak Optic' k (WithIx is) TxSkel a -optic = m TxSkel +iviewTweak Optic' k (WithIx is) TxSkel a +optic = m TxSkel forall (m :: * -> *). MonadTweak m => m TxSkel getTxSkel m TxSkel -> (TxSkel -> (is, a)) -> m (is, a) forall (f :: * -> *) a b. Functor f => f a -> (a -> b) -> f b -<&> Optic' k (WithIx is) TxSkel a -> TxSkel -> (is, a) +<&> Optic' k (WithIx is) TxSkel a -> TxSkel -> (is, a) forall k (is :: IxList) i s a. (Is k A_Getter, HasSingleIndex is i) => Optic' k is s a -> s -> (i, a) -iview Optic' k (WithIx is) TxSkel a -optic +iview Optic' k (WithIx is) TxSkel a +optic -- | Like the 'viewTweak', but returns a list of all foci -viewAllTweak :: (MonadTweak m, Is k A_Fold) => Optic' k is TxSkel a -> m [a] +viewAllTweak :: (MonadTweak m, Is k A_Fold) => Optic' k is TxSkel a -> m [a] viewAllTweak :: Optic' k is TxSkel a -> m [a] -viewAllTweak Optic' k is TxSkel a -optic = m TxSkel +viewAllTweak Optic' k is TxSkel a +optic = m TxSkel forall (m :: * -> *). MonadTweak m => m TxSkel getTxSkel m TxSkel -> (TxSkel -> [a]) -> m [a] forall (f :: * -> *) a b. Functor f => f a -> (a -> b) -> f b -<&> Optic' k is TxSkel a -> TxSkel -> [a] +<&> Optic' k is TxSkel a -> TxSkel -> [a] forall k (is :: IxList) s a. Is k A_Fold => Optic' k is s a -> s -> [a] -toListOf Optic' k is TxSkel a -optic +toListOf Optic' k is TxSkel a +optic -- | The tweak that sets a certain value in the 'TxSkel'. -setTweak :: (MonadTweak m, Is k A_Setter) => Optic' k is TxSkel a -> a -> m () +setTweak :: (MonadTweak m, Is k A_Setter) => Optic' k is TxSkel a -> a -> m () setTweak :: Optic' k is TxSkel a -> a -> m () -setTweak Optic' k is TxSkel a -optic a -newValue = m TxSkel +setTweak Optic' k is TxSkel a +optic a +newValue = m TxSkel forall (m :: * -> *). MonadTweak m => m TxSkel getTxSkel m TxSkel -> (TxSkel -> m ()) -> m () forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b ->>= TxSkel -> m () +>>= TxSkel -> m () forall (m :: * -> *). MonadTweak m => TxSkel -> m () putTxSkel (TxSkel -> m ()) -> (TxSkel -> TxSkel) -> TxSkel -> m () forall b c a. (b -> c) -> (a -> b) -> a -> c -. Optic' k is TxSkel a -> a -> TxSkel -> TxSkel +. Optic' k is TxSkel a -> a -> TxSkel -> TxSkel forall k (is :: IxList) s t a b. Is k A_Setter => Optic k is s t a b -> b -> s -> t -set Optic' k is TxSkel a -optic a -newValue +set Optic' k is TxSkel a +optic a +newValue -- | The tweak that modifies a certain value in the 'TxSkel'. -overTweak :: (MonadTweak m, Is k A_Setter) => Optic' k is TxSkel a -> (a -> a) -> m () +overTweak :: (MonadTweak m, Is k A_Setter) => Optic' k is TxSkel a -> (a -> a) -> m () overTweak :: Optic' k is TxSkel a -> (a -> a) -> m () -overTweak Optic' k is TxSkel a -optic a -> a -change = m TxSkel +overTweak Optic' k is TxSkel a +optic a -> a +change = m TxSkel forall (m :: * -> *). MonadTweak m => m TxSkel getTxSkel m TxSkel -> (TxSkel -> m ()) -> m () forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b ->>= TxSkel -> m () +>>= TxSkel -> m () forall (m :: * -> *). MonadTweak m => TxSkel -> m () putTxSkel (TxSkel -> m ()) -> (TxSkel -> TxSkel) -> TxSkel -> m () forall b c a. (b -> c) -> (a -> b) -> a -> c -. Optic' k is TxSkel a -> (a -> a) -> TxSkel -> TxSkel +. Optic' k is TxSkel a -> (a -> a) -> TxSkel -> TxSkel forall k (is :: IxList) s t a b. Is k A_Setter => Optic k is s t a b -> (a -> b) -> s -> t -over Optic' k is TxSkel a -optic a -> a -change +over Optic' k is TxSkel a +optic a -> a +change -- | Like 'overTweak', but only modifies foci on which the argument function -- returns @Just@ the new focus. Returns a list of the foci that were modified, -- as they were /before/ the tweak, and in the order in which they occurred on -- the original transaction. -overMaybeTweak :: (MonadTweak m, Is k A_Traversal) => Optic' k is TxSkel a -> (a -> Maybe a) -> m [a] +overMaybeTweak :: (MonadTweak m, Is k A_Traversal) => Optic' k is TxSkel a -> (a -> Maybe a) -> m [a] overMaybeTweak :: Optic' k is TxSkel a -> (a -> Maybe a) -> m [a] -overMaybeTweak Optic' k is TxSkel a -optic a -> Maybe a -mChange = Optic' k is TxSkel a +overMaybeTweak Optic' k is TxSkel a +optic a -> Maybe a +mChange = Optic' k is TxSkel a -> (a -> Maybe a) -> (Integer -> Bool) -> m [a] forall a (m :: * -> *) k (is :: IxList). (MonadTweak m, Is k A_Traversal) => Optic' k is TxSkel a -> (a -> Maybe a) -> (Integer -> Bool) -> m [a] overMaybeSelectingTweak Optic' k is TxSkel a -optic a -> Maybe a -mChange (Bool -> Integer -> Bool +optic a -> Maybe a +mChange (Bool -> Integer -> Bool forall a b. a -> b -> a -const Bool -True) +const Bool +True) -- | Sometimes 'overMaybeTweak' modifies too many foci. This might be the case -- if there are several identical foci, but you only want to modify some of @@ -280,86 +280,86 @@ -- argument can be used to select which of the modifiable foci should be -- actually modified. overMaybeSelectingTweak :: - forall a m k is. - (MonadTweak m, Is k A_Traversal) => - Optic' k is TxSkel a -> - (a -> Maybe a) -> - (Integer -> Bool) -> - m [a] + forall a m k is. + (MonadTweak m, Is k A_Traversal) => + Optic' k is TxSkel a -> + (a -> Maybe a) -> + (Integer -> Bool) -> + m [a] overMaybeSelectingTweak :: Optic' k is TxSkel a -> (a -> Maybe a) -> (Integer -> Bool) -> m [a] -overMaybeSelectingTweak Optic' k is TxSkel a -optic a -> Maybe a -mChange Integer -> Bool -select = do - [a] -allFoci <- Optic' A_Lens NoIx TxSkel [a] -> m [a] +overMaybeSelectingTweak Optic' k is TxSkel a +optic a -> Maybe a +mChange Integer -> Bool +select = do + [a] +allFoci <- Optic' A_Lens NoIx TxSkel [a] -> m [a] forall (m :: * -> *) k (is :: IxList) a. (MonadTweak m, Is k A_Getter) => Optic' k is TxSkel a -> m a viewTweak (Optic' A_Lens NoIx TxSkel [a] -> m [a]) -> Optic' A_Lens NoIx TxSkel [a] -> m [a] forall a b. (a -> b) -> a -> b -$ Optic' k is TxSkel a -> Optic' A_Lens NoIx TxSkel [a] +$ Optic' k is TxSkel a -> Optic' A_Lens NoIx TxSkel [a] forall k (is :: IxList) s t a. Is k A_Traversal => Optic k is s t a a -> Lens s t [a] [a] -partsOf Optic' k is TxSkel a -optic - let evaluatedFoci :: [(a, Maybe a)] - evaluatedFoci :: [(a, Maybe a)] -evaluatedFoci = +partsOf Optic' k is TxSkel a +optic + let evaluatedFoci :: [(a, Maybe a)] + evaluatedFoci :: [(a, Maybe a)] +evaluatedFoci = (Integer, [(a, Maybe a)]) -> [(a, Maybe a)] forall a b. (a, b) -> b -snd ((Integer, [(a, Maybe a)]) -> [(a, Maybe a)]) +snd ((Integer, [(a, Maybe a)]) -> [(a, Maybe a)]) -> (Integer, [(a, Maybe a)]) -> [(a, Maybe a)] forall a b. (a -> b) -> a -> b -$ +$ (Integer -> a -> (Integer, (a, Maybe a))) -> Integer -> [a] -> (Integer, [(a, Maybe a)]) forall (t :: * -> *) a b c. Traversable t => (a -> b -> (a, c)) -> a -> t b -> (a, t c) -mapAccumL - ( \Integer -i a -unmodifiedFocus -> +mapAccumL + ( \Integer +i a +unmodifiedFocus -> case a -> Maybe a -mChange a -unmodifiedFocus of - Just a -modifiedFocus -> +mChange a +unmodifiedFocus of + Just a +modifiedFocus -> if Integer -> Bool -select Integer -i +select Integer +i then (Integer -i Integer -> Integer -> Integer +i Integer -> Integer -> Integer forall a. Num a => a -> a -> a -+ Integer ++ Integer 1, (a -unmodifiedFocus, a -> Maybe a +unmodifiedFocus, a -> Maybe a forall a. a -> Maybe a -Just a -modifiedFocus)) +Just a +modifiedFocus)) else (Integer -i Integer -> Integer -> Integer +i Integer -> Integer -> Integer forall a. Num a => a -> a -> a -+ Integer ++ Integer 1, (a -unmodifiedFocus, Maybe a +unmodifiedFocus, Maybe a forall a. Maybe a -Nothing)) +Nothing)) Maybe a -Nothing -> (Integer -i, (a -unmodifiedFocus, Maybe a +Nothing -> (Integer +i, (a +unmodifiedFocus, Maybe a forall a. Maybe a -Nothing)) +Nothing)) ) Integer 0 [a] -allFoci +allFoci Optic' A_Lens NoIx TxSkel [a] -> [a] -> m () forall (m :: * -> *) k (is :: IxList) a. (MonadTweak m, Is k A_Setter) => @@ -368,38 +368,38 @@ forall k (is :: IxList) s t a. Is k A_Traversal => Optic k is s t a a -> Lens s t [a] [a] -partsOf Optic' k is TxSkel a -optic) ([a] -> m ()) -> [a] -> m () +partsOf Optic' k is TxSkel a +optic) ([a] -> m ()) -> [a] -> m () forall a b. (a -> b) -> a -> b -$ ((a, Maybe a) -> a) -> [(a, Maybe a)] -> [a] +$ ((a, Maybe a) -> a) -> [(a, Maybe a)] -> [a] forall a b. (a -> b) -> [a] -> [b] -map ((a -> Maybe a -> a) -> (a, Maybe a) -> a +map ((a -> Maybe a -> a) -> (a, Maybe a) -> a forall a b c. (a -> b -> c) -> (a, b) -> c -uncurry a -> Maybe a -> a +uncurry a -> Maybe a -> a forall a. a -> Maybe a -> a -fromMaybe) [(a, Maybe a)] -evaluatedFoci -- If the second component of the pair is @Just@, use it. +fromMaybe) [(a, Maybe a)] +evaluatedFoci -- If the second component of the pair is @Just@, use it. [a] -> m [a] forall (m :: * -> *) a. Monad m => a -> m a -return ([a] -> m [a]) -> [a] -> m [a] +return ([a] -> m [a]) -> [a] -> m [a] forall a b. (a -> b) -> a -> b -$ +$ ((a, Maybe a) -> Maybe a) -> [(a, Maybe a)] -> [a] forall a b. (a -> Maybe b) -> [a] -> [b] -mapMaybe - (\(a -original, Maybe a -mNew) -> if Maybe a -> Bool +mapMaybe + (\(a +original, Maybe a +mNew) -> if Maybe a -> Bool forall a. Maybe a -> Bool -isJust Maybe a -mNew then a -> Maybe a +isJust Maybe a +mNew then a -> Maybe a forall a. a -> Maybe a -Just a -original else Maybe a +Just a +original else Maybe a forall a. Maybe a -Nothing) +Nothing) [(a, Maybe a)] -evaluatedFoci +evaluatedFoci -- | When constructing a tweak from an optic and a modification of foci, there -- are in principle two options for optics with many foci: (a) apply the @@ -493,23 +493,23 @@ -- -- So you see that tweaks constructed like this can branch quite wildly. Use -- with caution! -combineModsTweak :: - (Eq is, Is k A_Traversal, MonadTweak m) => - ([is] -> [[is]]) -> - Optic' k (WithIx is) TxSkel x -> - (is -> x -> m [(x, l)]) -> - m [l] +combineModsTweak :: + (Eq is, Is k A_Traversal, MonadTweak m) => + ([is] -> [[is]]) -> + Optic' k (WithIx is) TxSkel x -> + (is -> x -> m [(x, l)]) -> + m [l] combineModsTweak :: ([is] -> [[is]]) -> Optic' k (WithIx is) TxSkel x -> (is -> x -> m [(x, l)]) -> m [l] -combineModsTweak [is] -> [[is]] -groupings Optic' k (WithIx is) TxSkel x -optic is -> x -> m [(x, l)] -changes = do - ([is] -indexes, [x] -foci) <- Optic' A_Lens (WithIx [is]) TxSkel [x] -> m ([is], [x]) +combineModsTweak [is] -> [[is]] +groupings Optic' k (WithIx is) TxSkel x +optic is -> x -> m [(x, l)] +changes = do + ([is] +indexes, [x] +foci) <- Optic' A_Lens (WithIx [is]) TxSkel [x] -> m ([is], [x]) forall (m :: * -> *) k is a. (MonadTweak m, Is k A_Getter) => Optic' k (WithIx is) TxSkel a -> m (is, a) @@ -518,79 +518,79 @@ forall k (is :: IxList) i s t a. (Is k A_Traversal, HasSingleIndex is i) => Optic k is s t a a -> IxLens [i] s t [a] [a] -ipartsOf Optic' k (WithIx is) TxSkel x -optic) +ipartsOf Optic' k (WithIx is) TxSkel x +optic) [m [l]] -> m [l] forall (t :: * -> *) (m :: * -> *) a. (Foldable t, MonadPlus m) => t (m a) -> m a -msum ([m [l]] -> m [l]) -> [m [l]] -> m [l] +msum ([m [l]] -> m [l]) -> [m [l]] -> m [l] forall a b. (a -> b) -> a -> b -$ +$ ([is] -> m [l]) -> [[is]] -> [m [l]] forall a b. (a -> b) -> [a] -> [b] -map - ( \[is] -grouping -> do - let mChangedFoci :: [m [(x, Either () l)]] -mChangedFoci = +map + ( \[is] +grouping -> do + let mChangedFoci :: [m [(x, Either () l)]] +mChangedFoci = (is -> x -> m [(x, Either () l)]) -> [is] -> [x] -> [m [(x, Either () l)]] forall a b c. (a -> b -> c) -> [a] -> [b] -> [c] -zipWith - ( \is -i x -a -> +zipWith + ( \is +i x +a -> if is -i is -> [is] -> Bool +i is -> [is] -> Bool forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool -`elem` [is] -grouping +`elem` [is] +grouping then ((x, l) -> (x, Either () l)) -> [(x, l)] -> [(x, Either () l)] forall a b. (a -> b) -> [a] -> [b] -map ((l -> Either () l) -> (x, l) -> (x, Either () l) +map ((l -> Either () l) -> (x, l) -> (x, Either () l) forall (a :: * -> * -> *) b c d. Arrow a => a b c -> a (d, b) (d, c) -second l -> Either () l +second l -> Either () l forall a b. b -> Either a b -Right) ([(x, l)] -> [(x, Either () l)]) +Right) ([(x, l)] -> [(x, Either () l)]) -> m [(x, l)] -> m [(x, Either () l)] forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b -<$> is -> x -> m [(x, l)] -changes is -i x -a +<$> is -> x -> m [(x, l)] +changes is +i x +a else [(x, Either () l)] -> m [(x, Either () l)] forall (m :: * -> *) a. Monad m => a -> m a -return [(x -a, () -> Either () l +return [(x +a, () -> Either () l forall a b. a -> Either a b -Left ())] +Left ())] ) [is] -indexes +indexes [x] -foci - [[(x, Either () l)]] -changedFoci <- [m [(x, Either () l)]] -> m [[(x, Either () l)]] +foci + [[(x, Either () l)]] +changedFoci <- [m [(x, Either () l)]] -> m [[(x, Either () l)]] forall (t :: * -> *) (m :: * -> *) a. (Traversable t, Monad m) => t (m a) -> m (t a) -sequence [m [(x, Either () l)]] -mChangedFoci +sequence [m [(x, Either () l)]] +mChangedFoci [m [l]] -> m [l] forall (t :: * -> *) (m :: * -> *) a. (Foldable t, MonadPlus m) => t (m a) -> m a -msum ([m [l]] -> m [l]) -> [m [l]] -> m [l] +msum ([m [l]] -> m [l]) -> [m [l]] -> m [l] forall a b. (a -> b) -> a -> b -$ +$ ([(x, Either () l)] -> m [l]) -> [[(x, Either () l)]] -> [m [l]] forall a b. (a -> b) -> [a] -> [b] -map - ( \[(x, Either () l)] -combination -> do +map + ( \[(x, Either () l)] +combination -> do Optic' A_Lens NoIx TxSkel [x] -> [x] -> m () forall (m :: * -> *) k (is :: IxList) a. (MonadTweak m, Is k A_Setter) => @@ -599,56 +599,56 @@ forall k (is :: IxList) s t a. Is k A_Traversal => Optic k is s t a a -> Lens s t [a] [a] -partsOf Optic' k (WithIx is) TxSkel x -optic) ([x] -> m ()) -> [x] -> m () +partsOf Optic' k (WithIx is) TxSkel x +optic) ([x] -> m ()) -> [x] -> m () forall a b. (a -> b) -> a -> b -$ ((x, Either () l) -> x) -> [(x, Either () l)] -> [x] +$ ((x, Either () l) -> x) -> [(x, Either () l)] -> [x] forall a b. (a -> b) -> [a] -> [b] -map (x, Either () l) -> x +map (x, Either () l) -> x forall a b. (a, b) -> a -fst [(x, Either () l)] -combination +fst [(x, Either () l)] +combination [l] -> m [l] forall (m :: * -> *) a. Monad m => a -> m a -return ([l] -> m [l]) -> [l] -> m [l] +return ([l] -> m [l]) -> [l] -> m [l] forall a b. (a -> b) -> a -> b -$ ((x, Either () l) -> Maybe l) -> [(x, Either () l)] -> [l] +$ ((x, Either () l) -> Maybe l) -> [(x, Either () l)] -> [l] forall a b. (a -> Maybe b) -> [a] -> [b] -mapMaybe (Either () l -> Maybe l +mapMaybe (Either () l -> Maybe l forall a b. Either a b -> Maybe b -rightToMaybe (Either () l -> Maybe l) +rightToMaybe (Either () l -> Maybe l) -> ((x, Either () l) -> Either () l) -> (x, Either () l) -> Maybe l forall b c a. (b -> c) -> (a -> b) -> a -> c -. (x, Either () l) -> Either () l +. (x, Either () l) -> Either () l forall a b. (a, b) -> b -snd) [(x, Either () l)] -combination +snd) [(x, Either () l)] +combination ) ([[(x, Either () l)]] -> [[(x, Either () l)]] forall a. [[a]] -> [[a]] -allCombinations [[(x, Either () l)]] -changedFoci) +allCombinations [[(x, Either () l)]] +changedFoci) ) ([is] -> [[is]] -groupings [is] -indexes) +groupings [is] +indexes) where - allCombinations :: [[a]] -> [[a]] - allCombinations :: [[a]] -> [[a]] -allCombinations [] = [[]] - allCombinations ([a] -first : [[a]] -rest) = [a -x a -> [a] -> [a] + allCombinations :: [[a]] -> [[a]] + allCombinations :: [[a]] -> [[a]] +allCombinations [] = [[]] + allCombinations ([a] +first : [[a]] +rest) = [a +x a -> [a] -> [a] forall a. a -> [a] -> [a] -: [a] -xs | a -x <- [a] -first, [a] -xs <- [[a]] -> [[a]] +: [a] +xs | a +x <- [a] +first, [a] +xs <- [[a]] -> [[a]] forall a. [[a]] -> [[a]] -allCombinations [[a]] -rest] +allCombinations [[a]] +rest] -- | 'overMaybeTweak' requires a modification that can fail (targeting 'Maybe'). -- Sometimes, it can prove more convenient to explicitly state which property @@ -657,20 +657,20 @@ -- The intended use case is 'overTweak (optic % selectP prop) mod' -- where 'optic' gives the candidate foci, 'prop' is the predicate to be satisfied -- by the foci, and 'mod' is the modification to be applied to the selected foci. -selectP :: (a -> Bool) -> Prism' a a +selectP :: (a -> Bool) -> Prism' a a selectP :: (a -> Bool) -> Prism' a a -selectP a -> Bool -prop = (a -> a) -> (a -> Maybe a) -> Prism' a a +selectP a -> Bool +prop = (a -> a) -> (a -> Maybe a) -> Prism' a a forall b s a. (b -> s) -> (s -> Maybe a) -> Prism s s a b -prism' a -> a +prism' a -> a forall a. a -> a -id (\a -a -> if a -> Bool -prop a -a then a -> Maybe a +id (\a +a -> if a -> Bool +prop a +a then a -> Maybe a forall a. a -> Maybe a -Just a -a else Maybe a +Just a +a else Maybe a forall a. Maybe a -Nothing) +Nothing) \ No newline at end of file diff --git a/src/Cooked.Tweak.Labels.html b/src/Cooked.Tweak.Labels.html index e2c47bb21..be1f7bcc1 100644 --- a/src/Cooked.Tweak.Labels.html +++ b/src/Cooked.Tweak.Labels.html @@ -9,11 +9,11 @@ import Cooked.Skeleton import Cooked.Tweak.Common -import Data.Functor ((<&>)) -import Data.Set qualified as Set +import Data.Functor ((<&>)) +import Data.Set qualified as Set -- | Add a label to a 'TxSkel'. -addLabelTweak :: (MonadTweak m, LabelConstrs x) => x -> m () +addLabelTweak :: (MonadTweak m, LabelConstrs x) => x -> m () addLabelTweak :: x -> m () addLabelTweak = Optic' A_Lens NoIx TxSkel (Set TxLabel) -> (Set TxLabel -> Set TxLabel) -> m () @@ -24,17 +24,17 @@ txSkelLabelL ((Set TxLabel -> Set TxLabel) -> m ()) -> (x -> Set TxLabel -> Set TxLabel) -> x -> m () forall b c a. (b -> c) -> (a -> b) -> a -> c -. TxLabel -> Set TxLabel -> Set TxLabel +. TxLabel -> Set TxLabel -> Set TxLabel forall a. Ord a => a -> Set a -> Set a -Set.insert (TxLabel -> Set TxLabel -> Set TxLabel) +Set.insert (TxLabel -> Set TxLabel -> Set TxLabel) -> (x -> TxLabel) -> x -> Set TxLabel -> Set TxLabel forall b c a. (b -> c) -> (a -> b) -> a -> c -. x -> TxLabel +. x -> TxLabel forall x. LabelConstrs x => x -> TxLabel TxLabel -- | Removes a label from a 'TxSkel' -removeLabelTweak :: (MonadTweak m, LabelConstrs x) => x -> m () +removeLabelTweak :: (MonadTweak m, LabelConstrs x) => x -> m () removeLabelTweak :: x -> m () removeLabelTweak = Optic' A_Lens NoIx TxSkel (Set TxLabel) -> (Set TxLabel -> Set TxLabel) -> m () @@ -45,17 +45,17 @@ txSkelLabelL ((Set TxLabel -> Set TxLabel) -> m ()) -> (x -> Set TxLabel -> Set TxLabel) -> x -> m () forall b c a. (b -> c) -> (a -> b) -> a -> c -. TxLabel -> Set TxLabel -> Set TxLabel +. TxLabel -> Set TxLabel -> Set TxLabel forall a. Ord a => a -> Set a -> Set a -Set.delete (TxLabel -> Set TxLabel -> Set TxLabel) +Set.delete (TxLabel -> Set TxLabel -> Set TxLabel) -> (x -> TxLabel) -> x -> Set TxLabel -> Set TxLabel forall b c a. (b -> c) -> (a -> b) -> a -> c -. x -> TxLabel +. x -> TxLabel forall x. LabelConstrs x => x -> TxLabel TxLabel -- | Checks if a given label is present in the 'TxSkel' -hasLabelTweak :: (MonadTweak m, LabelConstrs x) => x -> m Bool +hasLabelTweak :: (MonadTweak m, LabelConstrs x) => x -> m Bool hasLabelTweak :: x -> m Bool hasLabelTweak = (Optic' A_Lens NoIx TxSkel (Set TxLabel) -> m (Set TxLabel) forall (m :: * -> *) k (is :: IxList) a. @@ -64,15 +64,15 @@ viewTweak Optic' A_Lens NoIx TxSkel (Set TxLabel) txSkelLabelL m (Set TxLabel) -> (Set TxLabel -> Bool) -> m Bool forall (f :: * -> *) a b. Functor f => f a -> (a -> b) -> f b -<&>) ((Set TxLabel -> Bool) -> m Bool) +<&>) ((Set TxLabel -> Bool) -> m Bool) -> (x -> Set TxLabel -> Bool) -> x -> m Bool forall b c a. (b -> c) -> (a -> b) -> a -> c -. TxLabel -> Set TxLabel -> Bool +. TxLabel -> Set TxLabel -> Bool forall a. Ord a => a -> Set a -> Bool -Set.member (TxLabel -> Set TxLabel -> Bool) +Set.member (TxLabel -> Set TxLabel -> Bool) -> (x -> TxLabel) -> x -> Set TxLabel -> Bool forall b c a. (b -> c) -> (a -> b) -> a -> c -. x -> TxLabel +. x -> TxLabel forall x. LabelConstrs x => x -> TxLabel TxLabel \ No newline at end of file diff --git a/src/Cooked.Tweak.OutPermutations.html b/src/Cooked.Tweak.OutPermutations.html index 094378356..91937f839 100644 --- a/src/Cooked.Tweak.OutPermutations.html +++ b/src/Cooked.Tweak.OutPermutations.html @@ -8,13 +8,13 @@ ) where -import Control.Monad +import Control.Monad import Cooked.Skeleton import Cooked.Tweak.Common -import System.Random -import System.Random.Shuffle +import System.Random +import System.Random.Shuffle -data PermutOutTweakMode = KeepIdentity (Maybe Int) | OmitIdentity (Maybe Int) +data PermutOutTweakMode = KeepIdentity (Maybe Int) | OmitIdentity (Maybe Int) -- | Modify transactions by changing the ordering of output constraints. If the -- 'PermutTweakMode' is @@ -35,12 +35,12 @@ -- -- (In particular, this is clever enough to generate only the distinct -- permutations, even if some outputs are identical.) -allOutPermutsTweak :: MonadTweak m => PermutOutTweakMode -> m () +allOutPermutsTweak :: (MonadTweak m) => PermutOutTweakMode -> m () allOutPermutsTweak :: PermutOutTweakMode -> m () -allOutPermutsTweak PermutOutTweakMode -mode = do - [TxSkelOut] -oldOut <- Optic' A_Lens NoIx TxSkel [TxSkelOut] -> m [TxSkelOut] +allOutPermutsTweak PermutOutTweakMode +mode = do + [TxSkelOut] +oldOut <- Optic' A_Lens NoIx TxSkel [TxSkelOut] -> m [TxSkelOut] forall (m :: * -> *) k (is :: IxList) a. (MonadTweak m, Is k A_Getter) => Optic' k is TxSkel a -> m a @@ -50,12 +50,12 @@ forall (t :: * -> *) (m :: * -> *) a. (Foldable t, MonadPlus m) => t (m a) -> m a -msum ([m ()] -> m ()) -> [m ()] -> m () +msum ([m ()] -> m ()) -> [m ()] -> m () forall a b. (a -> b) -> a -> b -$ +$ ([TxSkelOut] -> m ()) -> [[TxSkelOut]] -> [m ()] forall a b. (a -> b) -> [a] -> [b] -map +map (Optic' A_Lens NoIx TxSkel [TxSkelOut] -> [TxSkelOut] -> m () forall (m :: * -> *) k (is :: IxList) a. (MonadTweak m, Is k A_Setter) => @@ -63,259 +63,259 @@ setTweak Optic' A_Lens NoIx TxSkel [TxSkelOut] txSkelOutsL) ([TxSkelOut] -> [[TxSkelOut]] -perms [TxSkelOut] -oldOut) +perms [TxSkelOut] +oldOut) where - perms :: [TxSkelOut] -> [[TxSkelOut]] -perms = case PermutOutTweakMode -mode of - KeepIdentity (Just Int -n) -> \[TxSkelOut] -l -> ([TxSkelOut] -> [TxSkelOut]) -> [[TxSkelOut]] -> [[TxSkelOut]] + perms :: [TxSkelOut] -> [[TxSkelOut]] +perms = case PermutOutTweakMode +mode of + KeepIdentity (Just Int +n) -> \[TxSkelOut] +l -> ([TxSkelOut] -> [TxSkelOut]) -> [[TxSkelOut]] -> [[TxSkelOut]] forall a b. (a -> b) -> [a] -> [b] -map ([TxSkelOut] -> [TxSkelOut] -> [TxSkelOut] +map ([TxSkelOut] -> [TxSkelOut] -> [TxSkelOut] forall a. [a] -> [a] -> [a] -++ Int -> [TxSkelOut] -> [TxSkelOut] +++ Int -> [TxSkelOut] -> [TxSkelOut] forall a. Int -> [a] -> [a] -drop Int -n [TxSkelOut] -l) ([[TxSkelOut]] -> [[TxSkelOut]]) -> [[TxSkelOut]] -> [[TxSkelOut]] +drop Int +n [TxSkelOut] +l) ([[TxSkelOut]] -> [[TxSkelOut]]) -> [[TxSkelOut]] -> [[TxSkelOut]] forall a b. (a -> b) -> a -> b -$ [TxSkelOut] -> [[TxSkelOut]] +$ [TxSkelOut] -> [[TxSkelOut]] forall a. Eq a => [a] -> [[a]] distinctPermutations (Int -> [TxSkelOut] -> [TxSkelOut] forall a. Int -> [a] -> [a] -take Int -n [TxSkelOut] -l) +take Int +n [TxSkelOut] +l) KeepIdentity Maybe Int -Nothing -> [TxSkelOut] -> [[TxSkelOut]] +Nothing -> [TxSkelOut] -> [[TxSkelOut]] forall a. Eq a => [a] -> [[a]] distinctPermutations - OmitIdentity (Just Int -n) -> \[TxSkelOut] -l -> ([TxSkelOut] -> [TxSkelOut]) -> [[TxSkelOut]] -> [[TxSkelOut]] + OmitIdentity (Just Int +n) -> \[TxSkelOut] +l -> ([TxSkelOut] -> [TxSkelOut]) -> [[TxSkelOut]] -> [[TxSkelOut]] forall a b. (a -> b) -> [a] -> [b] -map ([TxSkelOut] -> [TxSkelOut] -> [TxSkelOut] +map ([TxSkelOut] -> [TxSkelOut] -> [TxSkelOut] forall a. [a] -> [a] -> [a] -++ Int -> [TxSkelOut] -> [TxSkelOut] +++ Int -> [TxSkelOut] -> [TxSkelOut] forall a. Int -> [a] -> [a] -drop Int -n [TxSkelOut] -l) ([[TxSkelOut]] -> [[TxSkelOut]]) -> [[TxSkelOut]] -> [[TxSkelOut]] +drop Int +n [TxSkelOut] +l) ([[TxSkelOut]] -> [[TxSkelOut]]) -> [[TxSkelOut]] -> [[TxSkelOut]] forall a b. (a -> b) -> a -> b -$ [TxSkelOut] -> [[TxSkelOut]] +$ [TxSkelOut] -> [[TxSkelOut]] forall a. Eq a => [a] -> [[a]] nonIdentityPermutations (Int -> [TxSkelOut] -> [TxSkelOut] forall a. Int -> [a] -> [a] -take Int -n [TxSkelOut] -l) +take Int +n [TxSkelOut] +l) OmitIdentity Maybe Int -Nothing -> [TxSkelOut] -> [[TxSkelOut]] +Nothing -> [TxSkelOut] -> [[TxSkelOut]] forall a. Eq a => [a] -> [[a]] nonIdentityPermutations -- This is implemented so that duplicate entries in the input list don't give -- rise to duplicate permutations. -distinctPermutations :: Eq a => [a] -> [[a]] +distinctPermutations :: (Eq a) => [a] -> [[a]] distinctPermutations :: [a] -> [[a]] distinctPermutations = ([a] -> [[a]] -> [[a]]) -> [[a]] -> [[a]] -> [[a]] forall (t :: * -> *) a b. Foldable t => (a -> b -> b) -> b -> t a -> b -foldr (([a] -> [[a]]) -> [[a]] -> [[a]] +foldr (([a] -> [[a]]) -> [[a]] -> [[a]] forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b] -concatMap (([a] -> [[a]]) -> [[a]] -> [[a]]) +concatMap (([a] -> [[a]]) -> [[a]] -> [[a]]) -> ([a] -> [a] -> [[a]]) -> [a] -> [[a]] -> [[a]] forall b c a. (b -> c) -> (a -> b) -> a -> c -. [a] -> [a] -> [[a]] +. [a] -> [a] -> [[a]] forall a. [a] -> [a] -> [[a]] -insertSomewhere) [[]] ([[a]] -> [[a]]) -> ([a] -> [[a]]) -> [a] -> [[a]] +insertSomewhere) [[]] ([[a]] -> [[a]]) -> ([a] -> [[a]]) -> [a] -> [[a]] forall b c a. (b -> c) -> (a -> b) -> a -> c -. [a] -> [[a]] +. [a] -> [[a]] forall a. Eq a => [a] -> [[a]] -groupEq +groupEq where -- group all equal elements. If we had @Ord a@, we could implement this more -- effifiently as @group . sort@. - groupEq :: Eq a => [a] -> [[a]] - groupEq :: [a] -> [[a]] -groupEq [a] -l = (a -> [a]) -> [a] -> [[a]] + groupEq :: (Eq a) => [a] -> [[a]] + groupEq :: [a] -> [[a]] +groupEq [a] +l = (a -> [a]) -> [a] -> [[a]] forall a b. (a -> b) -> [a] -> [b] -map (\a -x -> Int -> a -> [a] +map (\a +x -> Int -> a -> [a] forall a. Int -> a -> [a] -replicate (a -> [a] -> Int +replicate (a -> [a] -> Int forall a. Eq a => a -> [a] -> Int -count a -x [a] -l) a -x) ([a] -> [[a]]) -> [a] -> [[a]] +count a +x [a] +l) a +x) ([a] -> [[a]]) -> [a] -> [[a]] forall a b. (a -> b) -> a -> b -$ [a] -> [a] +$ [a] -> [a] forall a. Eq a => [a] -> [a] -makeUnique [a] -l +makeUnique [a] +l where - count :: Eq a => a -> [a] -> Int - count :: a -> [a] -> Int -count a + count :: (Eq a) => a -> [a] -> Int + count :: a -> [a] -> Int +count a _ [] = Int 0 - count a -a (a -b : [a] -bs) = if a -a a -> a -> Bool + count a +a (a +b : [a] +bs) = if a +a a -> a -> Bool forall a. Eq a => a -> a -> Bool -/= a -b then a -> [a] -> Int +/= a +b then a -> [a] -> Int forall a. Eq a => a -> [a] -> Int -count a -a [a] -bs else Int +count a +a [a] +bs else Int 1 Int -> Int -> Int forall a. Num a => a -> a -> a -+ a -> [a] -> Int ++ a -> [a] -> Int forall a. Eq a => a -> [a] -> Int -count a -a [a] -bs +count a +a [a] +bs - makeUnique :: Eq a => [a] -> [a] - makeUnique :: [a] -> [a] -makeUnique [] = [] - makeUnique (a -x : [a] -xs) = - let xs' :: [a] -xs' = [a] -> [a] + makeUnique :: (Eq a) => [a] -> [a] + makeUnique :: [a] -> [a] +makeUnique [] = [] + makeUnique (a +x : [a] +xs) = + let xs' :: [a] +xs' = [a] -> [a] forall a. Eq a => [a] -> [a] -makeUnique [a] -xs +makeUnique [a] +xs in if a -x a -> [a] -> Bool +x a -> [a] -> Bool forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool -`elem` [a] -xs' then [a] -xs' else a -x a -> [a] -> [a] +`elem` [a] +xs' then [a] +xs' else a +x a -> [a] -> [a] forall a. a -> [a] -> [a] -: [a] -xs' +: [a] +xs' -- all possibilities to insert elements from the left list into the right -- list - insertSomewhere :: [a] -> [a] -> [[a]] - insertSomewhere :: [a] -> [a] -> [[a]] -insertSomewhere [] [a] -ys = [[a] -ys] - insertSomewhere [a] -xs [] = [[a] -xs] - insertSomewhere l :: [a] -l@(a -x : [a] -xs) r :: [a] -r@(a -y : [a] -ys) = + insertSomewhere :: [a] -> [a] -> [[a]] + insertSomewhere :: [a] -> [a] -> [[a]] +insertSomewhere [] [a] +ys = [[a] +ys] + insertSomewhere [a] +xs [] = [[a] +xs] + insertSomewhere l :: [a] +l@(a +x : [a] +xs) r :: [a] +r@(a +y : [a] +ys) = ([a] -> [a]) -> [[a]] -> [[a]] forall a b. (a -> b) -> [a] -> [b] -map (a -x a -> [a] -> [a] +map (a +x a -> [a] -> [a] forall a. a -> [a] -> [a] -:) ([a] -> [a] -> [[a]] +:) ([a] -> [a] -> [[a]] forall a. [a] -> [a] -> [[a]] -insertSomewhere [a] -xs [a] -r) [[a]] -> [[a]] -> [[a]] +insertSomewhere [a] +xs [a] +r) [[a]] -> [[a]] -> [[a]] forall a. [a] -> [a] -> [a] -++ ([a] -> [a]) -> [[a]] -> [[a]] +++ ([a] -> [a]) -> [[a]] -> [[a]] forall a b. (a -> b) -> [a] -> [b] -map (a -y a -> [a] -> [a] +map (a +y a -> [a] -> [a] forall a. a -> [a] -> [a] -:) ([a] -> [a] -> [[a]] +:) ([a] -> [a] -> [[a]] forall a. [a] -> [a] -> [[a]] -insertSomewhere [a] -l [a] -ys) +insertSomewhere [a] +l [a] +ys) -nonIdentityPermutations :: Eq a => [a] -> [[a]] +nonIdentityPermutations :: (Eq a) => [a] -> [[a]] nonIdentityPermutations :: [a] -> [[a]] -nonIdentityPermutations [a] -l = [a] -> [[a]] -> [[a]] +nonIdentityPermutations [a] +l = [a] -> [[a]] -> [[a]] forall a. Eq a => a -> [a] -> [a] -removeFirst [a] -l ([[a]] -> [[a]]) -> [[a]] -> [[a]] +removeFirst [a] +l ([[a]] -> [[a]]) -> [[a]] -> [[a]] forall a b. (a -> b) -> a -> b -$ [a] -> [[a]] +$ [a] -> [[a]] forall a. Eq a => [a] -> [[a]] distinctPermutations [a] -l +l where - removeFirst :: Eq a => a -> [a] -> [a] - removeFirst :: a -> [a] -> [a] -removeFirst a + removeFirst :: (Eq a) => a -> [a] -> [a] + removeFirst :: a -> [a] -> [a] +removeFirst a _ [] = [] - removeFirst a -x (a -y : [a] -ys) = if a -x a -> a -> Bool + removeFirst a +x (a +y : [a] +ys) = if a +x a -> a -> Bool forall a. Eq a => a -> a -> Bool -== a -y then [a] -ys else a -y a -> [a] -> [a] +== a +y then [a] +ys else a +y a -> [a] -> [a] forall a. a -> [a] -> [a] -: a -> [a] -> [a] +: a -> [a] -> [a] forall a. Eq a => a -> [a] -> [a] -removeFirst a -x [a] -ys +removeFirst a +x [a] +ys -- | This randomly permutes the outputs of a transaction with a given seed -- Can be used to assess if a certain validator is order-dependant -singleOutPermutTweak :: MonadTweak m => Int -> m () +singleOutPermutTweak :: (MonadTweak m) => Int -> m () singleOutPermutTweak :: Int -> m () -singleOutPermutTweak Int -seed = do - [TxSkelOut] -outputs <- Optic' A_Lens NoIx TxSkel [TxSkelOut] -> m [TxSkelOut] +singleOutPermutTweak Int +seed = do + [TxSkelOut] +outputs <- Optic' A_Lens NoIx TxSkel [TxSkelOut] -> m [TxSkelOut] forall (m :: * -> *) k (is :: IxList) a. (MonadTweak m, Is k A_Getter) => Optic' k is TxSkel a -> m a viewTweak Optic' A_Lens NoIx TxSkel [TxSkelOut] txSkelOutsL - let outputs' :: [TxSkelOut] -outputs' = [TxSkelOut] -> Int -> StdGen -> [TxSkelOut] + let outputs' :: [TxSkelOut] +outputs' = [TxSkelOut] -> Int -> StdGen -> [TxSkelOut] forall gen a. RandomGen gen => [a] -> Int -> gen -> [a] -shuffle' [TxSkelOut] -outputs ([TxSkelOut] -> Int +shuffle' [TxSkelOut] +outputs ([TxSkelOut] -> Int forall (t :: * -> *) a. Foldable t => t a -> Int -length [TxSkelOut] -outputs) (Int -> StdGen -mkStdGen Int -seed) +length [TxSkelOut] +outputs) (Int -> StdGen +mkStdGen Int +seed) Bool -> m () forall (f :: * -> *). Alternative f => Bool -> f () -guard (Bool -> m ()) -> Bool -> m () +guard (Bool -> m ()) -> Bool -> m () forall a b. (a -> b) -> a -> b -$ [TxSkelOut] -outputs' [TxSkelOut] -> [TxSkelOut] -> Bool +$ [TxSkelOut] +outputs' [TxSkelOut] -> [TxSkelOut] -> Bool forall a. Eq a => a -> a -> Bool -/= [TxSkelOut] -outputs +/= [TxSkelOut] +outputs Optic' A_Lens NoIx TxSkel [TxSkelOut] -> [TxSkelOut] -> m () forall (m :: * -> *) k (is :: IxList) a. (MonadTweak m, Is k A_Setter) => Optic' k is TxSkel a -> a -> m () setTweak Optic' A_Lens NoIx TxSkel [TxSkelOut] txSkelOutsL [TxSkelOut] -outputs' +outputs' \ No newline at end of file diff --git a/src/Cooked.Tweak.Signers.html b/src/Cooked.Tweak.Signers.html index 461f8f28a..a6693cac6 100644 --- a/src/Cooked.Tweak.Signers.html +++ b/src/Cooked.Tweak.Signers.html @@ -22,10 +22,10 @@ import Cooked.Skeleton (txSkelSignersL) import Cooked.Tweak.Common (MonadTweak, setTweak, viewTweak) import Cooked.Wallet (Wallet) -import Data.List (delete, (\\)) +import Data.List (delete, (\\)) -- | Returns the current list of signers -getSignersTweak :: MonadTweak m => m [Wallet] +getSignersTweak :: (MonadTweak m) => m [Wallet] getSignersTweak :: m [Wallet] getSignersTweak = Optic' A_Lens NoIx TxSkel [Wallet] -> m [Wallet] forall (m :: * -> *) k (is :: IxList) a. @@ -35,12 +35,12 @@ txSkelSignersL -- | Apply a function to the list of signers and return the old ones -modifySignersTweak :: MonadTweak m => ([Wallet] -> [Wallet]) -> m [Wallet] +modifySignersTweak :: (MonadTweak m) => ([Wallet] -> [Wallet]) -> m [Wallet] modifySignersTweak :: ([Wallet] -> [Wallet]) -> m [Wallet] -modifySignersTweak [Wallet] -> [Wallet] -f = do - [Wallet] -oldSigners <- m [Wallet] +modifySignersTweak [Wallet] -> [Wallet] +f = do + [Wallet] +oldSigners <- m [Wallet] forall (m :: * -> *). MonadTweak m => m [Wallet] getSignersTweak Optic' A_Lens NoIx TxSkel [Wallet] -> [Wallet] -> m () @@ -49,15 +49,15 @@ Optic' k is TxSkel a -> a -> m () setTweak Optic' A_Lens NoIx TxSkel [Wallet] txSkelSignersL ([Wallet] -> [Wallet] -f [Wallet] -oldSigners) +f [Wallet] +oldSigners) [Wallet] -> m [Wallet] forall (m :: * -> *) a. Monad m => a -> m a -return [Wallet] -oldSigners +return [Wallet] +oldSigners -- | Change the current signers and return the old ones -setSignersTweak :: MonadTweak m => [Wallet] -> m [Wallet] +setSignersTweak :: (MonadTweak m) => [Wallet] -> m [Wallet] setSignersTweak :: [Wallet] -> m [Wallet] setSignersTweak = ([Wallet] -> [Wallet]) -> m [Wallet] forall (m :: * -> *). @@ -66,46 +66,46 @@ modifySignersTweak (([Wallet] -> [Wallet]) -> m [Wallet]) -> ([Wallet] -> [Wallet] -> [Wallet]) -> [Wallet] -> m [Wallet] forall b c a. (b -> c) -> (a -> b) -> a -> c -. [Wallet] -> [Wallet] -> [Wallet] +. [Wallet] -> [Wallet] -> [Wallet] forall a b. a -> b -> a -const +const -- | Check if the signers satisfy a certain predicate -signersSatisfyTweak :: MonadTweak m => ([Wallet] -> Bool) -> m Bool +signersSatisfyTweak :: (MonadTweak m) => ([Wallet] -> Bool) -> m Bool signersSatisfyTweak :: ([Wallet] -> Bool) -> m Bool signersSatisfyTweak = (([Wallet] -> Bool) -> m [Wallet] -> m Bool forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b -<$> m [Wallet] +<$> m [Wallet] forall (m :: * -> *). MonadTweak m => m [Wallet] getSignersTweak) -- | Check if a wallet signs a transaction -isSignerTweak :: MonadTweak m => Wallet -> m Bool +isSignerTweak :: (MonadTweak m) => Wallet -> m Bool isSignerTweak :: Wallet -> m Bool isSignerTweak = ([Wallet] -> Bool) -> m Bool forall (m :: * -> *). MonadTweak m => ([Wallet] -> Bool) -> m Bool signersSatisfyTweak (([Wallet] -> Bool) -> m Bool) -> (Wallet -> [Wallet] -> Bool) -> Wallet -> m Bool forall b c a. (b -> c) -> (a -> b) -> a -> c -. Wallet -> [Wallet] -> Bool +. Wallet -> [Wallet] -> Bool forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool -elem +elem -- | Check if the transaction has at least a signer -hasSignersTweak :: MonadTweak m => m Bool +hasSignersTweak :: (MonadTweak m) => m Bool hasSignersTweak :: m Bool hasSignersTweak = ([Wallet] -> Bool) -> m Bool forall (m :: * -> *). MonadTweak m => ([Wallet] -> Bool) -> m Bool signersSatisfyTweak (Bool -> Bool -not (Bool -> Bool) -> ([Wallet] -> Bool) -> [Wallet] -> Bool +not (Bool -> Bool) -> ([Wallet] -> Bool) -> [Wallet] -> Bool forall b c a. (b -> c) -> (a -> b) -> a -> c -. [Wallet] -> Bool +. [Wallet] -> Bool forall (t :: * -> *) a. Foldable t => t a -> Bool -null) +null) -- | Add a signer to the transaction, at the head of the list of signers, and -- return the old list of signers -addFirstSignerTweak :: MonadTweak m => Wallet -> m [Wallet] +addFirstSignerTweak :: (MonadTweak m) => Wallet -> m [Wallet] addFirstSignerTweak :: Wallet -> m [Wallet] addFirstSignerTweak = ([Wallet] -> [Wallet]) -> m [Wallet] forall (m :: * -> *). @@ -114,11 +114,11 @@ modifySignersTweak (([Wallet] -> [Wallet]) -> m [Wallet]) -> (Wallet -> [Wallet] -> [Wallet]) -> Wallet -> m [Wallet] forall b c a. (b -> c) -> (a -> b) -> a -> c -. (:) +. (:) -- | Add signers at the end of the list of signers, and return the old list of -- signers -addSignersTweak :: MonadTweak m => [Wallet] -> m [Wallet] +addSignersTweak :: (MonadTweak m) => [Wallet] -> m [Wallet] addSignersTweak :: [Wallet] -> m [Wallet] addSignersTweak = ([Wallet] -> [Wallet]) -> m [Wallet] forall (m :: * -> *). @@ -127,25 +127,25 @@ modifySignersTweak (([Wallet] -> [Wallet]) -> m [Wallet]) -> ([Wallet] -> [Wallet] -> [Wallet]) -> [Wallet] -> m [Wallet] forall b c a. (b -> c) -> (a -> b) -> a -> c -. [Wallet] -> [Wallet] -> [Wallet] +. [Wallet] -> [Wallet] -> [Wallet] forall a. Semigroup a => a -> a -> a -(<>) +(<>) -- | Add a signer to the transaction, at the end of the list of signers, and -- return the old list of signers -addLastSignerTweak :: MonadTweak m => Wallet -> m [Wallet] +addLastSignerTweak :: (MonadTweak m) => Wallet -> m [Wallet] addLastSignerTweak :: Wallet -> m [Wallet] addLastSignerTweak = [Wallet] -> m [Wallet] forall (m :: * -> *). MonadTweak m => [Wallet] -> m [Wallet] addSignersTweak ([Wallet] -> m [Wallet]) -> (Wallet -> [Wallet]) -> Wallet -> m [Wallet] forall b c a. (b -> c) -> (a -> b) -> a -> c -. (Wallet -> [Wallet] -> [Wallet] +. (Wallet -> [Wallet] -> [Wallet] forall a. a -> [a] -> [a] -: []) +: []) -- | Remove signers from the transaction and return the old list of signers -removeSignersTweak :: MonadTweak m => [Wallet] -> m [Wallet] +removeSignersTweak :: (MonadTweak m) => [Wallet] -> m [Wallet] removeSignersTweak :: [Wallet] -> m [Wallet] removeSignersTweak = ([Wallet] -> [Wallet]) -> m [Wallet] forall (m :: * -> *). @@ -154,12 +154,12 @@ modifySignersTweak (([Wallet] -> [Wallet]) -> m [Wallet]) -> ([Wallet] -> [Wallet] -> [Wallet]) -> [Wallet] -> m [Wallet] forall b c a. (b -> c) -> (a -> b) -> a -> c -. [Wallet] -> [Wallet] -> [Wallet] +. [Wallet] -> [Wallet] -> [Wallet] forall a. Eq a => [a] -> [a] -> [a] -(\\) +(\\) -- | Remove a signer from the transaction and return the old list of signers -removeSignerTweak :: MonadTweak m => Wallet -> m [Wallet] +removeSignerTweak :: (MonadTweak m) => Wallet -> m [Wallet] removeSignerTweak :: Wallet -> m [Wallet] removeSignerTweak = ([Wallet] -> [Wallet]) -> m [Wallet] forall (m :: * -> *). @@ -168,13 +168,13 @@ modifySignersTweak (([Wallet] -> [Wallet]) -> m [Wallet]) -> (Wallet -> [Wallet] -> [Wallet]) -> Wallet -> m [Wallet] forall b c a. (b -> c) -> (a -> b) -> a -> c -. Wallet -> [Wallet] -> [Wallet] +. Wallet -> [Wallet] -> [Wallet] forall a. Eq a => a -> [a] -> [a] -delete +delete -- | Changes the first signer (adds it if there are no signers) and return the -- old list of signers. -replaceFirstSignerTweak :: MonadTweak m => Wallet -> m [Wallet] +replaceFirstSignerTweak :: (MonadTweak m) => Wallet -> m [Wallet] replaceFirstSignerTweak :: Wallet -> m [Wallet] replaceFirstSignerTweak = ([Wallet] -> [Wallet]) -> m [Wallet] @@ -185,16 +185,16 @@ (([Wallet] -> [Wallet]) -> m [Wallet]) -> (Wallet -> [Wallet] -> [Wallet]) -> Wallet -> m [Wallet] forall b c a. (b -> c) -> (a -> b) -> a -> c -. ( \Wallet -newSigner -> \case +. ( \Wallet +newSigner -> \case [] -> [Wallet -newSigner] +newSigner] (Wallet -_ : [Wallet] -ss) -> Wallet -newSigner Wallet -> [Wallet] -> [Wallet] +_ : [Wallet] +ss) -> Wallet +newSigner Wallet -> [Wallet] -> [Wallet] forall a. a -> [a] -> [a] -: [Wallet] -ss +: [Wallet] +ss ) \ No newline at end of file diff --git a/src/Cooked.Tweak.TamperDatum.html b/src/Cooked.Tweak.TamperDatum.html index e1ed9f8e3..9759f0ea8 100644 --- a/src/Cooked.Tweak.TamperDatum.html +++ b/src/Cooked.Tweak.TamperDatum.html @@ -13,15 +13,15 @@ ) where -import Control.Monad +import Control.Monad import Cooked.Output import Cooked.Pretty.Class import Cooked.Skeleton import Cooked.Tweak.Common import Cooked.Tweak.Labels -import Optics.Core -import qualified PlutusTx as Pl -import Type.Reflection +import Optics.Core +import qualified PlutusTx as Pl +import Type.Reflection -- | A tweak that tries to change the datum on outputs carrying datums of a -- certain type with a prescribed tampering function. @@ -29,24 +29,24 @@ -- The tweak returns a list of the modified datums, as they were *before* the -- modification was applied to them. tamperDatumTweak :: - forall a m. - ( MonadTweak m, - Show a, - PrettyCooked a, - Pl.ToData a, - Pl.FromData a, - Typeable a + forall a m. + ( MonadTweak m, + Show a, + PrettyCooked a, + Pl.ToData a, + Pl.FromData a, + Typeable a ) => -- | Use this function to return 'Just' the changed datum, if you want to -- perform a change, and 'Nothing', if you want to leave it as-is. All datums -- on outputs not paying to a validator of type @a@ are never touched. - (a -> Maybe a) -> - m [a] + (a -> Maybe a) -> + m [a] tamperDatumTweak :: (a -> Maybe a) -> m [a] -tamperDatumTweak a -> Maybe a -change = do - [a] -beforeModification <- +tamperDatumTweak a -> Maybe a +change = do + [a] +beforeModification <- Optic' A_Traversal '[] TxSkel a -> (a -> Maybe a) -> m [a] forall (m :: * -> *) k (is :: IxList) a. (MonadTweak m, Is k A_Traversal) => @@ -62,11 +62,11 @@ 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 -% Optic A_Traversal '[] [TxSkelOut] [TxSkelOut] TxSkelOut TxSkelOut +% Optic A_Traversal '[] [TxSkelOut] [TxSkelOut] TxSkelOut TxSkelOut forall (t :: * -> *) a b. Traversable t => Traversal (t a) (t b) a b -traversed +traversed Optic A_Traversal '[] TxSkel TxSkel TxSkelOut TxSkelOut -> Optic An_AffineTraversal '[] TxSkelOut TxSkelOut a a -> Optic' A_Traversal '[] TxSkel a @@ -74,36 +74,36 @@ 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 -% (FromData a, Typeable a) => +% (FromData a, Typeable a) => Optic An_AffineTraversal '[] TxSkelOut TxSkelOut a a forall a. (FromData a, Typeable a) => AffineTraversal' TxSkelOut a -txSkelOutputDatumTypeAT @a +txSkelOutputDatumTypeAT @a ) a -> Maybe a -change +change Bool -> m () forall (f :: * -> *). Alternative f => Bool -> f () -guard (Bool -> m ()) -> ([a] -> Bool) -> [a] -> m () +guard (Bool -> m ()) -> ([a] -> Bool) -> [a] -> m () forall b c a. (b -> c) -> (a -> b) -> a -> c -. Bool -> Bool -not (Bool -> Bool) -> ([a] -> Bool) -> [a] -> Bool +. Bool -> Bool +not (Bool -> Bool) -> ([a] -> Bool) -> [a] -> Bool forall b c a. (b -> c) -> (a -> b) -> a -> c -. [a] -> Bool +. [a] -> Bool forall (t :: * -> *) a. Foldable t => t a -> Bool -null ([a] -> m ()) -> [a] -> m () +null ([a] -> m ()) -> [a] -> m () forall a b. (a -> b) -> a -> b -$ [a] -beforeModification +$ [a] +beforeModification TamperDatumLbl -> m () forall (m :: * -> *) x. (MonadTweak m, LabelConstrs x) => x -> m () addLabelTweak TamperDatumLbl TamperDatumLbl [a] -> m [a] forall (m :: * -> *) a. Monad m => a -> m a -return [a] -beforeModification +return [a] +beforeModification -data TamperDatumLbl = TamperDatumLbl deriving (Int -> TamperDatumLbl -> ShowS +data TamperDatumLbl = TamperDatumLbl deriving (Int -> TamperDatumLbl -> ShowS [TamperDatumLbl] -> ShowS TamperDatumLbl -> String (Int -> TamperDatumLbl -> ShowS) @@ -118,7 +118,7 @@ $cshow :: TamperDatumLbl -> String showsPrec :: Int -> TamperDatumLbl -> ShowS $cshowsPrec :: Int -> TamperDatumLbl -> ShowS -Show, TamperDatumLbl -> TamperDatumLbl -> Bool +Show, TamperDatumLbl -> TamperDatumLbl -> Bool (TamperDatumLbl -> TamperDatumLbl -> Bool) -> (TamperDatumLbl -> TamperDatumLbl -> Bool) -> Eq TamperDatumLbl forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a @@ -126,7 +126,7 @@ $c/= :: TamperDatumLbl -> TamperDatumLbl -> Bool == :: TamperDatumLbl -> TamperDatumLbl -> Bool $c== :: TamperDatumLbl -> TamperDatumLbl -> Bool -Eq, Eq TamperDatumLbl +Eq, Eq TamperDatumLbl Eq TamperDatumLbl -> (TamperDatumLbl -> TamperDatumLbl -> Ordering) -> (TamperDatumLbl -> TamperDatumLbl -> Bool) @@ -164,7 +164,7 @@ compare :: TamperDatumLbl -> TamperDatumLbl -> Ordering $ccompare :: TamperDatumLbl -> TamperDatumLbl -> Ordering $cp1Ord :: Eq TamperDatumLbl -Ord) +Ord) -- | A tweak that tries to change the datum on outputs carrying datums of a -- certain type with a prescribed tampering function. There are two main @@ -184,19 +184,19 @@ -- -- modified transactions. malformDatumTweak :: - forall a m. - ( MonadTweak m, - Pl.ToData a, - Pl.FromData a, - Typeable a + forall a m. + ( MonadTweak m, + Pl.ToData a, + Pl.FromData a, + Typeable a ) => - (a -> [Pl.BuiltinData]) -> - m () + (a -> [Pl.BuiltinData]) -> + m () malformDatumTweak :: (a -> [BuiltinData]) -> m () -malformDatumTweak a -> [BuiltinData] -change = do - [TxSkelOut] -outputs <- Optic A_Traversal '[] TxSkel TxSkel TxSkelOut TxSkelOut +malformDatumTweak a -> [BuiltinData] +change = do + [TxSkelOut] +outputs <- Optic A_Traversal '[] TxSkel TxSkel TxSkelOut TxSkelOut -> m [TxSkelOut] forall (m :: * -> *) k (is :: IxList) a. (MonadTweak m, Is k A_Fold) => @@ -210,75 +210,75 @@ 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 -% Optic A_Traversal '[] [TxSkelOut] [TxSkelOut] TxSkelOut TxSkelOut +% Optic A_Traversal '[] [TxSkelOut] [TxSkelOut] TxSkelOut TxSkelOut forall (t :: * -> *) a b. Traversable t => Traversal (t a) (t b) a b -traversed) - let modifiedOutputs :: [[TxSkelOut]] -modifiedOutputs = (TxSkelOut -> [TxSkelOut]) -> [TxSkelOut] -> [[TxSkelOut]] +traversed) + let modifiedOutputs :: [[TxSkelOut]] +modifiedOutputs = (TxSkelOut -> [TxSkelOut]) -> [TxSkelOut] -> [[TxSkelOut]] forall a b. (a -> b) -> [a] -> [b] -map (\TxSkelOut -output -> TxSkelOut -output TxSkelOut -> [TxSkelOut] -> [TxSkelOut] +map (\TxSkelOut +output -> TxSkelOut +output TxSkelOut -> [TxSkelOut] -> [TxSkelOut] forall a. a -> [a] -> [a] -: TxSkelOut -> [TxSkelOut] -changeOutput TxSkelOut -output) [TxSkelOut] -outputs +: TxSkelOut -> [TxSkelOut] +changeOutput TxSkelOut +output) [TxSkelOut] +outputs -- We remove the first combination because it consists of all the heads -- and therefore it is the combination consisting of no changes at all. - modifiedOutputGroups :: [[TxSkelOut]] -modifiedOutputGroups = [[TxSkelOut]] -> [[TxSkelOut]] + modifiedOutputGroups :: [[TxSkelOut]] +modifiedOutputGroups = [[TxSkelOut]] -> [[TxSkelOut]] forall a. [a] -> [a] -tail ([[TxSkelOut]] -> [[TxSkelOut]]) -> [[TxSkelOut]] -> [[TxSkelOut]] +tail ([[TxSkelOut]] -> [[TxSkelOut]]) -> [[TxSkelOut]] -> [[TxSkelOut]] forall a b. (a -> b) -> a -> b -$ [[TxSkelOut]] -> [[TxSkelOut]] +$ [[TxSkelOut]] -> [[TxSkelOut]] forall a. [[a]] -> [[a]] allCombinations [[TxSkelOut]] -modifiedOutputs +modifiedOutputs [m ()] -> m () forall (t :: * -> *) (m :: * -> *) a. (Foldable t, MonadPlus m) => t (m a) -> m a -msum ([m ()] -> m ()) -> [m ()] -> m () +msum ([m ()] -> m ()) -> [m ()] -> m () forall a b. (a -> b) -> a -> b -$ ([TxSkelOut] -> m ()) -> [[TxSkelOut]] -> [m ()] +$ ([TxSkelOut] -> m ()) -> [[TxSkelOut]] -> [m ()] forall a b. (a -> b) -> [a] -> [b] -map (Lens' TxSkel [TxSkelOut] -> [TxSkelOut] -> m () +map (Lens' TxSkel [TxSkelOut] -> [TxSkelOut] -> m () forall (m :: * -> *) k (is :: IxList) a. (MonadTweak m, Is k A_Setter) => Optic' k is TxSkel a -> a -> m () setTweak Lens' TxSkel [TxSkelOut] txSkelOutsL) [[TxSkelOut]] -modifiedOutputGroups +modifiedOutputGroups MalformDatumLbl -> m () forall (m :: * -> *) x. (MonadTweak m, LabelConstrs x) => x -> m () addLabelTweak MalformDatumLbl MalformDatumLbl where - changeOutput :: TxSkelOut -> [TxSkelOut] - changeOutput :: TxSkelOut -> [TxSkelOut] -changeOutput (Pays o -out) = - let datums :: [TxSkelOutDatum] -datums = TxSkelOutDatum -> [TxSkelOutDatum] -changeTxSkelOutDatum (TxSkelOutDatum -> [TxSkelOutDatum]) + changeOutput :: TxSkelOut -> [TxSkelOut] + changeOutput :: TxSkelOut -> [TxSkelOut] +changeOutput (Pays o +out) = + let datums :: [TxSkelOutDatum] +datums = TxSkelOutDatum -> [TxSkelOutDatum] +changeTxSkelOutDatum (TxSkelOutDatum -> [TxSkelOutDatum]) -> TxSkelOutDatum -> [TxSkelOutDatum] forall a b. (a -> b) -> a -> b -$ Optic' A_Lens '[] o TxSkelOutDatum -> o -> TxSkelOutDatum +$ Optic' A_Lens '[] o TxSkelOutDatum -> o -> TxSkelOutDatum forall k (is :: IxList) s a. Is k A_Getter => Optic' k is s a -> s -> a -view Optic' A_Lens '[] o TxSkelOutDatum +view Optic' A_Lens '[] o TxSkelOutDatum forall o. IsAbstractOutput o => Lens' o (DatumType o) outputDatumL o -out +out in (TxSkelOutDatum -> TxSkelOut) -> [TxSkelOutDatum] -> [TxSkelOut] forall a b. (a -> b) -> [a] -> [b] -map - ( \TxSkelOutDatum -datum -> +map + ( \TxSkelOutDatum +datum -> ConcreteOutput (OwnerType o) TxSkelOutDatum Value (ReferenceScriptType o) -> TxSkelOut @@ -297,7 +297,7 @@ (OwnerType o) TxSkelOutDatum Value (ReferenceScriptType o) -> TxSkelOut forall a b. (a -> b) -> a -> b -$ +$ OwnerType o -> Maybe StakingCredential -> Value @@ -314,114 +314,114 @@ -> ConcreteOutput ownerType datumType valueType referenceScriptType ConcreteOutput (o -out o -> Optic' A_Lens '[] o (OwnerType o) -> OwnerType o +out o -> Optic' A_Lens '[] 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 '[] o (OwnerType o) +^. Optic' A_Lens '[] o (OwnerType o) forall o. IsAbstractOutput o => Lens' o (OwnerType o) outputOwnerL) (o -out o +out o -> Optic' A_Lens '[] 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 '[] o (Maybe StakingCredential) +^. Optic' A_Lens '[] o (Maybe StakingCredential) forall o. IsAbstractOutput o => Lens' o (Maybe StakingCredential) outputStakingCredentialL) (o -out o -> Optic' A_Lens '[] o Value -> Value +out o -> Optic' A_Lens '[] o Value -> Value forall k s (is :: IxList) a. Is k A_Getter => s -> Optic' k is s a -> a -^. Optic' A_Lens '[] o Value +^. Optic' A_Lens '[] o Value forall o. IsAbstractOutput o => Lens' o (ValueType o) outputValueL) TxSkelOutDatum -datum +datum (o -out o +out o -> Optic' A_Lens '[] 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 '[] o (Maybe (ReferenceScriptType o)) +^. Optic' A_Lens '[] o (Maybe (ReferenceScriptType o)) forall o. IsAbstractOutput o => Lens' o (Maybe (ReferenceScriptType o)) outputReferenceScriptL) ) [TxSkelOutDatum] -datums +datums - changeTxSkelOutDatum :: TxSkelOutDatum -> [TxSkelOutDatum] - changeTxSkelOutDatum :: TxSkelOutDatum -> [TxSkelOutDatum] -changeTxSkelOutDatum TxSkelOutDatum + changeTxSkelOutDatum :: TxSkelOutDatum -> [TxSkelOutDatum] + changeTxSkelOutDatum :: TxSkelOutDatum -> [TxSkelOutDatum] +changeTxSkelOutDatum TxSkelOutDatum TxSkelOutNoDatum = [] - changeTxSkelOutDatum (TxSkelOutDatum a -datum) = (BuiltinData -> TxSkelOutDatum) + changeTxSkelOutDatum (TxSkelOutDatum a +datum) = (BuiltinData -> TxSkelOutDatum) -> [BuiltinData] -> [TxSkelOutDatum] forall a b. (a -> b) -> [a] -> [b] -map BuiltinData -> TxSkelOutDatum +map BuiltinData -> TxSkelOutDatum forall a. TxSkelOutDatumConstrs a => a -> TxSkelOutDatum TxSkelOutDatum ([BuiltinData] -> [TxSkelOutDatum]) -> [BuiltinData] -> [TxSkelOutDatum] forall a b. (a -> b) -> a -> b -$ a -> [BuiltinData] +$ a -> [BuiltinData] forall b. Typeable b => b -> [BuiltinData] -changeOnCorrectType a -datum - changeTxSkelOutDatum (TxSkelOutDatumHash a -datum) = (BuiltinData -> TxSkelOutDatum) +changeOnCorrectType a +datum + changeTxSkelOutDatum (TxSkelOutDatumHash a +datum) = (BuiltinData -> TxSkelOutDatum) -> [BuiltinData] -> [TxSkelOutDatum] forall a b. (a -> b) -> [a] -> [b] -map BuiltinData -> TxSkelOutDatum +map BuiltinData -> TxSkelOutDatum forall a. TxSkelOutDatumConstrs a => a -> TxSkelOutDatum TxSkelOutDatumHash ([BuiltinData] -> [TxSkelOutDatum]) -> [BuiltinData] -> [TxSkelOutDatum] forall a b. (a -> b) -> a -> b -$ a -> [BuiltinData] +$ a -> [BuiltinData] forall b. Typeable b => b -> [BuiltinData] -changeOnCorrectType a -datum - changeTxSkelOutDatum (TxSkelOutInlineDatum a -datum) = (BuiltinData -> TxSkelOutDatum) +changeOnCorrectType a +datum + changeTxSkelOutDatum (TxSkelOutInlineDatum a +datum) = (BuiltinData -> TxSkelOutDatum) -> [BuiltinData] -> [TxSkelOutDatum] forall a b. (a -> b) -> [a] -> [b] -map BuiltinData -> TxSkelOutDatum +map BuiltinData -> TxSkelOutDatum forall a. TxSkelOutDatumConstrs a => a -> TxSkelOutDatum TxSkelOutInlineDatum ([BuiltinData] -> [TxSkelOutDatum]) -> [BuiltinData] -> [TxSkelOutDatum] forall a b. (a -> b) -> a -> b -$ a -> [BuiltinData] +$ a -> [BuiltinData] forall b. Typeable b => b -> [BuiltinData] -changeOnCorrectType a -datum +changeOnCorrectType a +datum - changeOnCorrectType :: Typeable b => b -> [Pl.BuiltinData] - changeOnCorrectType :: b -> [BuiltinData] -changeOnCorrectType b -datum = case b -> TypeRep b + changeOnCorrectType :: (Typeable b) => b -> [Pl.BuiltinData] + changeOnCorrectType :: b -> [BuiltinData] +changeOnCorrectType b +datum = case b -> TypeRep b forall a. Typeable a => a -> TypeRep a -typeOf b -datum TypeRep b -> TypeRep a -> Maybe (b :~~: a) +typeOf b +datum TypeRep b -> TypeRep a -> Maybe (b :~~: a) forall k1 k2 (a :: k1) (b :: k2). TypeRep a -> TypeRep b -> Maybe (a :~~: b) -`eqTypeRep` (Typeable a => TypeRep a +`eqTypeRep` (Typeable a => TypeRep a forall k (a :: k). Typeable a => TypeRep a -typeRep @a) of - Just b :~~: a -HRefl -> a -> [BuiltinData] -change a +typeRep @a) of + Just b :~~: a +HRefl -> a -> [BuiltinData] +change a b -datum +datum Maybe (b :~~: a) -Nothing -> [] +Nothing -> [] -data MalformDatumLbl = MalformDatumLbl deriving (Int -> MalformDatumLbl -> ShowS +data MalformDatumLbl = MalformDatumLbl deriving (Int -> MalformDatumLbl -> ShowS [MalformDatumLbl] -> ShowS MalformDatumLbl -> String (Int -> MalformDatumLbl -> ShowS) @@ -436,7 +436,7 @@ $cshow :: MalformDatumLbl -> String showsPrec :: Int -> MalformDatumLbl -> ShowS $cshowsPrec :: Int -> MalformDatumLbl -> ShowS -Show, MalformDatumLbl -> MalformDatumLbl -> Bool +Show, MalformDatumLbl -> MalformDatumLbl -> Bool (MalformDatumLbl -> MalformDatumLbl -> Bool) -> (MalformDatumLbl -> MalformDatumLbl -> Bool) -> Eq MalformDatumLbl @@ -445,7 +445,7 @@ $c/= :: MalformDatumLbl -> MalformDatumLbl -> Bool == :: MalformDatumLbl -> MalformDatumLbl -> Bool $c== :: MalformDatumLbl -> MalformDatumLbl -> Bool -Eq, Eq MalformDatumLbl +Eq, Eq MalformDatumLbl Eq MalformDatumLbl -> (MalformDatumLbl -> MalformDatumLbl -> Ordering) -> (MalformDatumLbl -> MalformDatumLbl -> Bool) @@ -483,7 +483,7 @@ compare :: MalformDatumLbl -> MalformDatumLbl -> Ordering $ccompare :: MalformDatumLbl -> MalformDatumLbl -> Ordering $cp1Ord :: Eq MalformDatumLbl -Ord) +Ord) -- | Given a list of lists @l@, we call “combination” of @l@ a list @c@ such that -- - @length c == length l@, and @@ -503,21 +503,21 @@ -- and @a1@ comes before @a2@ in the list @l !! length p@. In particular, the -- first element of the result list is the combination consisting of all the -- first elements of the input lists. -allCombinations :: [[a]] -> [[a]] +allCombinations :: [[a]] -> [[a]] allCombinations :: [[a]] -> [[a]] allCombinations [] = [[]] allCombinations [[]] = [] -- included in the next one -allCombinations ([a] -first : [[a]] -rest) = [a -x a -> [a] -> [a] +allCombinations ([a] +first : [[a]] +rest) = [a +x a -> [a] -> [a] forall a. a -> [a] -> [a] -: [a] -xs | a -x <- [a] -first, [a] -xs <- [[a]] -> [[a]] +: [a] +xs | a +x <- [a] +first, [a] +xs <- [[a]] -> [[a]] forall a. [[a]] -> [[a]] allCombinations [[a]] -rest] +rest] \ No newline at end of file diff --git a/src/Cooked.Tweak.ValidityRange.html b/src/Cooked.Tweak.ValidityRange.html index 866581e27..6e627d155 100644 --- a/src/Cooked.Tweak.ValidityRange.html +++ b/src/Cooked.Tweak.ValidityRange.html @@ -1,15 +1,15 @@
    -- | This module defines 'Tweaks' revolving around the validity range of a transaction
     module Cooked.Tweak.ValidityRange where
     
    -import Control.Monad (guard, void)
    +import Control.Monad (guard, void)
     import Cooked.MockChain (awaitSlot, currentSlot)
     import Cooked.Skeleton (txSkelValidityRangeL)
     import Cooked.Tweak.Common (MonadTweak, setTweak, viewTweak)
    -import Ledger (before, contains, intersection, interval, isEmpty, member, never, singleton)
    -import Ledger.Slot (Slot (Slot), SlotRange)
    -import Plutus.V2.Ledger.Api (Extended (Finite), Interval (..), LowerBound (..), UpperBound (..), always)
    +import Ledger (before, contains, intersection, interval, isEmpty, member, never, singleton)
    +import Ledger.Slot (Slot (Slot), SlotRange)
    +import Plutus.V2.Ledger.Api (Extended (Finite), Interval (..), LowerBound (..), UpperBound (..), always)
     
    -getValidityRangeTweak :: MonadTweak m => m SlotRange
    +getValidityRangeTweak :: (MonadTweak m) => m SlotRange
     getValidityRangeTweak :: m SlotRange
     getValidityRangeTweak = Optic' A_Lens NoIx TxSkel SlotRange -> m SlotRange
     forall (m :: * -> *) k (is :: IxList) a.
    @@ -19,12 +19,12 @@
     txSkelValidityRangeL
     
     -- | Changes the current validity range, returning the old one
    -setValidityRangeTweak :: MonadTweak m => SlotRange -> m SlotRange
    +setValidityRangeTweak :: (MonadTweak m) => SlotRange -> m SlotRange
     setValidityRangeTweak :: SlotRange -> m SlotRange
    -setValidityRangeTweak SlotRange
    -newRange = do
    -  SlotRange
    -oldRange <- m SlotRange
    +setValidityRangeTweak SlotRange
    +newRange = do
    +  SlotRange
    +oldRange <- m SlotRange
     forall (m :: * -> *). MonadTweak m => m SlotRange
     getValidityRangeTweak
       Optic' A_Lens NoIx TxSkel SlotRange -> SlotRange -> m ()
    @@ -33,91 +33,91 @@
     Optic' k is TxSkel a -> a -> m ()
     setTweak Optic' A_Lens NoIx TxSkel SlotRange
     txSkelValidityRangeL SlotRange
    -newRange
    +newRange
       SlotRange -> m SlotRange
     forall (m :: * -> *) a. Monad m => a -> m a
    -return SlotRange
    -oldRange
    +return SlotRange
    +oldRange
     
     -- | Ensures the skeleton makes for an unconstrained validity range
    -setAlwaysValidRangeTweak :: MonadTweak m => m SlotRange
    +setAlwaysValidRangeTweak :: (MonadTweak m) => m SlotRange
     setAlwaysValidRangeTweak :: m SlotRange
     setAlwaysValidRangeTweak = SlotRange -> m SlotRange
     forall (m :: * -> *). MonadTweak m => SlotRange -> m SlotRange
     setValidityRangeTweak SlotRange
     forall a. Interval a
    -always
    +always
     
     -- | Sets the left bound of the validity range. Leaves the right bound unchanged
    -setValidityStartTweak :: MonadTweak m => Slot -> m SlotRange
    +setValidityStartTweak :: (MonadTweak m) => Slot -> m SlotRange
     setValidityStartTweak :: Slot -> m SlotRange
    -setValidityStartTweak Slot
    -left = m SlotRange
    +setValidityStartTweak Slot
    +left = m SlotRange
     forall (m :: * -> *). MonadTweak m => m SlotRange
     getValidityRangeTweak m SlotRange -> (SlotRange -> m SlotRange) -> m SlotRange
     forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
    ->>= SlotRange -> m SlotRange
    +>>= SlotRange -> m SlotRange
     forall (m :: * -> *). MonadTweak m => SlotRange -> m SlotRange
     setValidityRangeTweak (SlotRange -> m SlotRange)
     -> (SlotRange -> SlotRange) -> SlotRange -> m SlotRange
     forall b c a. (b -> c) -> (a -> b) -> a -> c
    -. LowerBound Slot -> UpperBound Slot -> SlotRange
    +. LowerBound Slot -> UpperBound Slot -> SlotRange
     forall a. LowerBound a -> UpperBound a -> Interval a
    -Interval (Extended Slot -> Closure -> LowerBound Slot
    +Interval (Extended Slot -> Closure -> LowerBound Slot
     forall a. Extended a -> Closure -> LowerBound a
    -LowerBound (Slot -> Extended Slot
    +LowerBound (Slot -> Extended Slot
     forall a. a -> Extended a
    -Finite Slot
    -left) Closure
    -True) (UpperBound Slot -> SlotRange)
    +Finite Slot
    +left) Closure
    +True) (UpperBound Slot -> SlotRange)
     -> (SlotRange -> UpperBound Slot) -> SlotRange -> SlotRange
     forall b c a. (b -> c) -> (a -> b) -> a -> c
    -. SlotRange -> UpperBound Slot
    +. SlotRange -> UpperBound Slot
     forall a. Interval a -> UpperBound a
    -ivTo
    +ivTo
     
     -- | Sets the right bound of the validity range. Leaves the left bound unchanged
    -setValidityEndTweak :: MonadTweak m => Slot -> m SlotRange
    +setValidityEndTweak :: (MonadTweak m) => Slot -> m SlotRange
     setValidityEndTweak :: Slot -> m SlotRange
    -setValidityEndTweak Slot
    -right = m SlotRange
    +setValidityEndTweak Slot
    +right = m SlotRange
     forall (m :: * -> *). MonadTweak m => m SlotRange
     getValidityRangeTweak m SlotRange -> (SlotRange -> m SlotRange) -> m SlotRange
     forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
    ->>= SlotRange -> m SlotRange
    +>>= SlotRange -> m SlotRange
     forall (m :: * -> *). MonadTweak m => SlotRange -> m SlotRange
     setValidityRangeTweak (SlotRange -> m SlotRange)
     -> (SlotRange -> SlotRange) -> SlotRange -> m SlotRange
     forall b c a. (b -> c) -> (a -> b) -> a -> c
    -. (LowerBound Slot -> UpperBound Slot -> SlotRange)
    +. (LowerBound Slot -> UpperBound Slot -> SlotRange)
     -> UpperBound Slot -> LowerBound Slot -> SlotRange
     forall a b c. (a -> b -> c) -> b -> a -> c
    -flip LowerBound Slot -> UpperBound Slot -> SlotRange
    +flip LowerBound Slot -> UpperBound Slot -> SlotRange
     forall a. LowerBound a -> UpperBound a -> Interval a
    -Interval (Extended Slot -> Closure -> UpperBound Slot
    +Interval (Extended Slot -> Closure -> UpperBound Slot
     forall a. Extended a -> Closure -> UpperBound a
    -UpperBound (Slot -> Extended Slot
    +UpperBound (Slot -> Extended Slot
     forall a. a -> Extended a
    -Finite Slot
    -right) Closure
    -True) (LowerBound Slot -> SlotRange)
    +Finite Slot
    +right) Closure
    +True) (LowerBound Slot -> SlotRange)
     -> (SlotRange -> LowerBound Slot) -> SlotRange -> SlotRange
     forall b c a. (b -> c) -> (a -> b) -> a -> c
    -. SlotRange -> LowerBound Slot
    +. SlotRange -> LowerBound Slot
     forall a. Interval a -> LowerBound a
    -ivFrom
    +ivFrom
     
     -- | Checks if the validity range satisfies a certain predicate
    -validityRangeSatisfiesTweak :: MonadTweak m => (SlotRange -> Bool) -> m Bool
    +validityRangeSatisfiesTweak :: (MonadTweak m) => (SlotRange -> Bool) -> m Bool
     validityRangeSatisfiesTweak :: (SlotRange -> Closure) -> m Closure
     validityRangeSatisfiesTweak = ((SlotRange -> Closure) -> m SlotRange -> m Closure
     forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    -<$> m SlotRange
    +<$> m SlotRange
     forall (m :: * -> *). MonadTweak m => m SlotRange
     getValidityRangeTweak)
     
     -- | Checks if a given time belongs to the validity range of a transaction
    -isValidAtTweak :: MonadTweak m => Slot -> m Bool
    +isValidAtTweak :: (MonadTweak m) => Slot -> m Bool
     isValidAtTweak :: Slot -> m Closure
     isValidAtTweak = (SlotRange -> Closure) -> m Closure
     forall (m :: * -> *).
    @@ -126,23 +126,23 @@
     validityRangeSatisfiesTweak ((SlotRange -> Closure) -> m Closure)
     -> (Slot -> SlotRange -> Closure) -> Slot -> m Closure
     forall b c a. (b -> c) -> (a -> b) -> a -> c
    -. Slot -> SlotRange -> Closure
    +. Slot -> SlotRange -> Closure
     forall a. Ord a => a -> Interval a -> Closure
    -member
    +member
     
     -- | Checks if the current validity range includes the current time
    -isValidNowTweak :: MonadTweak m => m Bool
    +isValidNowTweak :: (MonadTweak m) => m Bool
     isValidNowTweak :: m Closure
     isValidNowTweak = m Slot
     forall (m :: * -> *). MonadBlockChainWithoutValidation m => m Slot
     currentSlot m Slot -> (Slot -> m Closure) -> m Closure
     forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
    ->>= Slot -> m Closure
    +>>= Slot -> m Closure
     forall (m :: * -> *). MonadTweak m => Slot -> m Closure
     isValidAtTweak
     
     -- | Checks if a given range is included in the validity range of a transaction
    -isValidDuringTweak :: MonadTweak m => SlotRange -> m Bool
    +isValidDuringTweak :: (MonadTweak m) => SlotRange -> m Bool
     isValidDuringTweak :: SlotRange -> m Closure
     isValidDuringTweak = (SlotRange -> Closure) -> m Closure
     forall (m :: * -> *).
    @@ -151,15 +151,15 @@
     validityRangeSatisfiesTweak ((SlotRange -> Closure) -> m Closure)
     -> (SlotRange -> SlotRange -> Closure) -> SlotRange -> m Closure
     forall b c a. (b -> c) -> (a -> b) -> a -> c
    -. (SlotRange -> SlotRange -> Closure)
    +. (SlotRange -> SlotRange -> Closure)
     -> SlotRange -> SlotRange -> Closure
     forall a b c. (a -> b -> c) -> b -> a -> c
    -flip SlotRange -> SlotRange -> Closure
    +flip SlotRange -> SlotRange -> Closure
     forall a. Ord a => Interval a -> Interval a -> Closure
    -contains
    +contains
     
     -- | Checks if the validity range is empty
    -hasEmptyTimeRangeTweak :: MonadTweak m => m Bool
    +hasEmptyTimeRangeTweak :: (MonadTweak m) => m Bool
     hasEmptyTimeRangeTweak :: m Closure
     hasEmptyTimeRangeTweak = (SlotRange -> Closure) -> m Closure
     forall (m :: * -> *).
    @@ -167,10 +167,10 @@
     (SlotRange -> Closure) -> m Closure
     validityRangeSatisfiesTweak SlotRange -> Closure
     forall a. (Enum a, Ord a) => Interval a -> Closure
    -isEmpty
    +isEmpty
     
     -- | Checks if the validity range is unconstrained
    -hasFullTimeRangeTweak :: MonadTweak m => m Bool
    +hasFullTimeRangeTweak :: (MonadTweak m) => m Bool
     hasFullTimeRangeTweak :: m Closure
     hasFullTimeRangeTweak = (SlotRange -> Closure) -> m Closure
     forall (m :: * -> *).
    @@ -178,193 +178,193 @@
     (SlotRange -> Closure) -> m Closure
     validityRangeSatisfiesTweak (SlotRange
     forall a. Interval a
    -always SlotRange -> SlotRange -> Closure
    +always SlotRange -> SlotRange -> Closure
     forall a. Eq a => a -> a -> Closure
    -==)
    +==)
     
     -- | Adds a constraint to the current validity range
     -- Returns the old range, and fails is the resulting interval is empty
    -intersectValidityRangeTweak :: MonadTweak m => SlotRange -> m SlotRange
    +intersectValidityRangeTweak :: (MonadTweak m) => SlotRange -> m SlotRange
     intersectValidityRangeTweak :: SlotRange -> m SlotRange
    -intersectValidityRangeTweak SlotRange
    -newRange = do
    -  SlotRange
    -oldRange <- Optic' A_Lens NoIx TxSkel SlotRange -> m SlotRange
    +intersectValidityRangeTweak SlotRange
    +newRange = do
    +  SlotRange
    +oldRange <- Optic' A_Lens NoIx TxSkel SlotRange -> m SlotRange
     forall (m :: * -> *) k (is :: IxList) a.
     (MonadTweak m, Is k A_Getter) =>
     Optic' k is TxSkel a -> m a
     viewTweak Optic' A_Lens NoIx TxSkel SlotRange
     txSkelValidityRangeL
    -  let combinedRange :: SlotRange
    -combinedRange = SlotRange -> SlotRange -> SlotRange
    +  let combinedRange :: SlotRange
    +combinedRange = SlotRange -> SlotRange -> SlotRange
     forall a. Ord a => Interval a -> Interval a -> Interval a
    -intersection SlotRange
    -newRange SlotRange
    -oldRange
    +intersection SlotRange
    +newRange SlotRange
    +oldRange
       Closure -> m ()
     forall (f :: * -> *). Alternative f => Closure -> f ()
    -guard (SlotRange
    -combinedRange SlotRange -> SlotRange -> Closure
    +guard (SlotRange
    +combinedRange SlotRange -> SlotRange -> Closure
     forall a. Eq a => a -> a -> Closure
    -/= SlotRange
    +/= SlotRange
     forall a. Interval a
    -never)
    +never)
       Optic' A_Lens NoIx TxSkel SlotRange -> SlotRange -> m ()
     forall (m :: * -> *) k (is :: IxList) a.
     (MonadTweak m, Is k A_Setter) =>
     Optic' k is TxSkel a -> a -> m ()
     setTweak Optic' A_Lens NoIx TxSkel SlotRange
     txSkelValidityRangeL SlotRange
    -combinedRange
    +combinedRange
       SlotRange -> m SlotRange
     forall (m :: * -> *) a. Monad m => a -> m a
    -return SlotRange
    -oldRange
    +return SlotRange
    +oldRange
     
     -- | Centers the validity range around a value with a certain radius
    -centerAroundValidityRangeTweak :: MonadTweak m => Slot -> Integer -> m SlotRange
    +centerAroundValidityRangeTweak :: (MonadTweak m) => Slot -> Integer -> m SlotRange
     centerAroundValidityRangeTweak :: Slot -> Integer -> m SlotRange
    -centerAroundValidityRangeTweak Slot
    -t Integer
    -r = do
    -  let radius :: Slot
    -radius = Integer -> Slot
    -Slot Integer
    -r
    -      left :: Slot
    -left = Slot
    -t Slot -> Slot -> Slot
    +centerAroundValidityRangeTweak Slot
    +t Integer
    +r = do
    +  let radius :: Slot
    +radius = Integer -> Slot
    +Slot Integer
    +r
    +      left :: Slot
    +left = Slot
    +t Slot -> Slot -> Slot
     forall a. Num a => a -> a -> a
    -- Slot
    -radius
    -      right :: Slot
    -right = Slot
    -t Slot -> Slot -> Slot
    +- Slot
    +radius
    +      right :: Slot
    +right = Slot
    +t Slot -> Slot -> Slot
     forall a. Num a => a -> a -> a
    -+ Slot
    -radius
    -      newRange :: SlotRange
    -newRange = Slot -> Slot -> SlotRange
    ++ Slot
    +radius
    +      newRange :: SlotRange
    +newRange = Slot -> Slot -> SlotRange
     forall a. a -> a -> Interval a
    -interval Slot
    -left Slot
    -right
    +interval Slot
    +left Slot
    +right
       SlotRange -> m SlotRange
     forall (m :: * -> *). MonadTweak m => SlotRange -> m SlotRange
     setValidityRangeTweak SlotRange
    -newRange
    +newRange
     
     -- | Makes a transaction range equal to a singleton
    -makeValidityRangeSingletonTweak :: MonadTweak m => Slot -> m SlotRange
    +makeValidityRangeSingletonTweak :: (MonadTweak m) => Slot -> m SlotRange
     makeValidityRangeSingletonTweak :: Slot -> m SlotRange
     makeValidityRangeSingletonTweak = SlotRange -> m SlotRange
     forall (m :: * -> *). MonadTweak m => SlotRange -> m SlotRange
     setValidityRangeTweak (SlotRange -> m SlotRange)
     -> (Slot -> SlotRange) -> Slot -> m SlotRange
     forall b c a. (b -> c) -> (a -> b) -> a -> c
    -. Slot -> SlotRange
    +. Slot -> SlotRange
     forall a. a -> Interval a
    -singleton
    +singleton
     
     -- | Makes the transaction validity range comply with the current time
    -makeValidityRangeNowTweak :: MonadTweak m => m SlotRange
    +makeValidityRangeNowTweak :: (MonadTweak m) => m SlotRange
     makeValidityRangeNowTweak :: m SlotRange
     makeValidityRangeNowTweak = m Slot
     forall (m :: * -> *). MonadBlockChainWithoutValidation m => m Slot
     currentSlot m Slot -> (Slot -> m SlotRange) -> m SlotRange
     forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
    ->>= Slot -> m SlotRange
    +>>= Slot -> m SlotRange
     forall (m :: * -> *). MonadTweak m => Slot -> m SlotRange
     makeValidityRangeSingletonTweak
     
     -- | Makes current time comply with the validity range of the transaction under
     -- modification. Returns the new current time after the modification; fails if
     -- current time is already after the validity range.
    -waitUntilValidTweak :: MonadTweak m => m Slot
    +waitUntilValidTweak :: (MonadTweak m) => m Slot
     waitUntilValidTweak :: m Slot
     waitUntilValidTweak = do
    -  Slot
    -now <- m Slot
    +  Slot
    +now <- m Slot
     forall (m :: * -> *). MonadBlockChainWithoutValidation m => m Slot
     currentSlot
    -  SlotRange
    -vRange <- m SlotRange
    +  SlotRange
    +vRange <- m SlotRange
     forall (m :: * -> *). MonadTweak m => m SlotRange
     getValidityRangeTweak
       if Slot -> SlotRange -> Closure
     forall a. Ord a => a -> Interval a -> Closure
    -member Slot
    -now SlotRange
    -vRange
    +member Slot
    +now SlotRange
    +vRange
         then Slot -> m Slot
     forall (m :: * -> *) a. Monad m => a -> m a
    -return Slot
    -now
    +return Slot
    +now
         else do
           Closure -> m ()
     forall (f :: * -> *). Alternative f => Closure -> f ()
    -guard (Closure -> m ()) -> Closure -> m ()
    +guard (Closure -> m ()) -> Closure -> m ()
     forall a b. (a -> b) -> a -> b
    -$ Slot -> SlotRange -> Closure
    +$ Slot -> SlotRange -> Closure
     forall a. Ord a => a -> Interval a -> Closure
    -before Slot
    -now SlotRange
    -vRange
    +before Slot
    +now SlotRange
    +vRange
           Closure -> m ()
     forall (f :: * -> *). Alternative f => Closure -> f ()
    -guard (Closure -> m ()) -> Closure -> m ()
    +guard (Closure -> m ()) -> Closure -> m ()
     forall a b. (a -> b) -> a -> b
    -$ Closure -> Closure
    -not (Closure -> Closure) -> Closure -> Closure
    +$ Closure -> Closure
    +not (Closure -> Closure) -> Closure -> Closure
     forall a b. (a -> b) -> a -> b
    -$ SlotRange -> Closure
    +$ SlotRange -> Closure
     forall a. (Enum a, Ord a) => Interval a -> Closure
    -isEmpty SlotRange
    -vRange
    -      Slot
    -later <- case SlotRange -> LowerBound Slot
    +isEmpty SlotRange
    +vRange
    +      Slot
    +later <- case SlotRange -> LowerBound Slot
     forall a. Interval a -> LowerBound a
    -ivFrom SlotRange
    -vRange of
    -        LowerBound (Finite Slot
    -left) Closure
    -isClosed ->
    +ivFrom SlotRange
    +vRange of
    +        LowerBound (Finite Slot
    +left) Closure
    +isClosed ->
               Slot -> m Slot
     forall (m :: * -> *) a. Monad m => a -> m a
    -return (Slot -> m Slot) -> Slot -> m Slot
    +return (Slot -> m Slot) -> Slot -> m Slot
     forall a b. (a -> b) -> a -> b
    -$ Slot
    -left Slot -> Slot -> Slot
    +$ Slot
    +left Slot -> Slot -> Slot
     forall a. Num a => a -> a -> a
    -+ Integer -> Slot
    -Slot (Int -> Integer
    ++ Integer -> Slot
    +Slot (Int -> Integer
     forall a. Integral a => a -> Integer
    -toInteger (Int -> Integer) -> Int -> Integer
    +toInteger (Int -> Integer) -> Int -> Integer
     forall a b. (a -> b) -> a -> b
    -$ Closure -> Int
    +$ Closure -> Int
     forall a. Enum a => a -> Int
    -fromEnum (Closure -> Int) -> Closure -> Int
    +fromEnum (Closure -> Int) -> Closure -> Int
     forall a b. (a -> b) -> a -> b
    -$ Closure -> Closure
    -not Closure
    -isClosed)
    +$ Closure -> Closure
    +not Closure
    +isClosed)
             LowerBound Slot
     _ -> [Char] -> m Slot
     forall a. HasCallStack => [Char] -> a
    -error [Char]
    +error [Char]
     "this should never happen: left-finite interval without left border"
           m Slot -> m ()
     forall (f :: * -> *) a. Functor f => f a -> f ()
    -void (m Slot -> m ()) -> m Slot -> m ()
    +void (m Slot -> m ()) -> m Slot -> m ()
     forall a b. (a -> b) -> a -> b
    -$ Slot -> m Slot
    +$ Slot -> m Slot
     forall (m :: * -> *).
     MonadBlockChainWithoutValidation m =>
     Slot -> m Slot
     awaitSlot Slot
    -later
    +later
           Slot -> m Slot
     forall (m :: * -> *) a. Monad m => a -> m a
    -return Slot
    -later
    +return Slot
    +later
     
    \ No newline at end of file diff --git a/src/Cooked.ValueUtils.html b/src/Cooked.ValueUtils.html index 085aadbc8..ccc32b18f 100644 --- a/src/Cooked.ValueUtils.html +++ b/src/Cooked.ValueUtils.html @@ -7,62 +7,62 @@ ) where -import Data.List -import Optics.Core -import qualified Plutus.Script.Utils.Ada as Pl -import qualified Plutus.Script.Utils.Value as Pl hiding (adaSymbol, adaToken) -import qualified PlutusTx.Numeric as Pl +import Data.List +import Optics.Core +import qualified Plutus.Script.Utils.Ada as Pl +import qualified Plutus.Script.Utils.Value as Pl hiding (adaSymbol, adaToken) +import qualified PlutusTx.Numeric as Pl -flattenValueI :: Iso' Pl.Value [(Pl.AssetClass, Integer)] +flattenValueI :: Iso' Pl.Value [(Pl.AssetClass, Integer)] flattenValueI :: Iso' Value [(AssetClass, Integer)] flattenValueI = (Value -> [(AssetClass, Integer)]) -> ([(AssetClass, Integer)] -> Value) -> Iso' Value [(AssetClass, Integer)] forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b -iso +iso (((CurrencySymbol, TokenName, Integer) -> (AssetClass, Integer)) -> [(CurrencySymbol, TokenName, Integer)] -> [(AssetClass, Integer)] forall a b. (a -> b) -> [a] -> [b] -map (\(CurrencySymbol -cSymbol, TokenName -tName, Integer -amount) -> (CurrencySymbol -> TokenName -> AssetClass -Pl.assetClass CurrencySymbol -cSymbol TokenName -tName, Integer -amount)) ([(CurrencySymbol, TokenName, Integer)] -> [(AssetClass, Integer)]) +map (\(CurrencySymbol +cSymbol, TokenName +tName, Integer +amount) -> (CurrencySymbol -> TokenName -> AssetClass +Pl.assetClass CurrencySymbol +cSymbol TokenName +tName, Integer +amount)) ([(CurrencySymbol, TokenName, Integer)] -> [(AssetClass, Integer)]) -> (Value -> [(CurrencySymbol, TokenName, Integer)]) -> Value -> [(AssetClass, Integer)] forall b c a. (b -> c) -> (a -> b) -> a -> c -. Value -> [(CurrencySymbol, TokenName, Integer)] -Pl.flattenValue) +. Value -> [(CurrencySymbol, TokenName, Integer)] +Pl.flattenValue) ((Value -> (AssetClass, Integer) -> Value) -> Value -> [(AssetClass, Integer)] -> Value forall (t :: * -> *) b a. Foldable t => (b -> a -> b) -> b -> t a -> b -foldl' (\Value -v (AssetClass -ac, Integer -amount) -> Value -v Value -> Value -> Value +foldl' (\Value +v (AssetClass +ac, Integer +amount) -> Value +v Value -> Value -> Value forall a. Semigroup a => a -> a -> a -<> AssetClass -> Integer -> Value -Pl.assetClassValue AssetClass -ac Integer -amount) Value +<> AssetClass -> Integer -> Value +Pl.assetClassValue AssetClass +ac Integer +amount) Value forall a. Monoid a => a -mempty) +mempty) -- | The positive part of a value. For every asset class in the given value, -- this asset class and its amount are included in the output iff the amount is -- strictly positive. It holds -- -- > x == positivePart x <> Pl.negate negativePart x -positivePart :: Pl.Value -> Pl.Value +positivePart :: Pl.Value -> Pl.Value positivePart :: Value -> Value positivePart = Iso' Value [(AssetClass, Integer)] -> ([(AssetClass, Integer)] -> [(AssetClass, Integer)]) @@ -71,54 +71,54 @@ forall k (is :: IxList) s t a b. Is k A_Setter => Optic k is s t a b -> (a -> b) -> s -> t -over Iso' Value [(AssetClass, Integer)] +over Iso' Value [(AssetClass, Integer)] flattenValueI (((AssetClass, Integer) -> Bool) -> [(AssetClass, Integer)] -> [(AssetClass, Integer)] forall a. (a -> Bool) -> [a] -> [a] -filter (((AssetClass, Integer) -> Bool) +filter (((AssetClass, Integer) -> Bool) -> [(AssetClass, Integer)] -> [(AssetClass, Integer)]) -> ((AssetClass, Integer) -> Bool) -> [(AssetClass, Integer)] -> [(AssetClass, Integer)] forall a b. (a -> b) -> a -> b -$ (Integer +$ (Integer 0 Integer -> Integer -> Bool forall a. Ord a => a -> a -> Bool -<) (Integer -> Bool) +<) (Integer -> Bool) -> ((AssetClass, Integer) -> Integer) -> (AssetClass, Integer) -> Bool forall b c a. (b -> c) -> (a -> b) -> a -> c -. (AssetClass, Integer) -> Integer +. (AssetClass, Integer) -> Integer forall a b. (a, b) -> b -snd) +snd) -- | The negative part of a value. For every asset class in the given value, -- this asset class and its negated amount are included in the output iff the -- amount is strictly negative. It holds -- -- > x == positivePart x <> Pl.negate negativePart x -negativePart :: Pl.Value -> Pl.Value +negativePart :: Pl.Value -> Pl.Value negativePart :: Value -> Value negativePart = Value -> Value positivePart (Value -> Value) -> (Value -> Value) -> Value -> Value forall b c a. (b -> c) -> (a -> b) -> a -> c -. Value -> Value +. Value -> Value forall a. AdditiveGroup a => a -> a -Pl.negate +Pl.negate -- | Focus the Ada part in a value. -adaL :: Lens' Pl.Value Pl.Ada +adaL :: Lens' Pl.Value Pl.Ada adaL :: Lens' Value Ada adaL = (Value -> Ada) -> (Value -> Ada -> Value) -> Lens' Value Ada forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b -lens +lens Value -> Ada -Pl.fromValue - ( \Value -value (Pl.Lovelace Integer -ada) -> +Pl.fromValue + ( \Value +value (Pl.Lovelace Integer +ada) -> Iso' Value [(AssetClass, Integer)] -> ([(AssetClass, Integer)] -> [(AssetClass, Integer)]) -> Value @@ -126,41 +126,41 @@ forall k (is :: IxList) s t a b. Is k A_Setter => Optic k is s t a b -> (a -> b) -> s -> t -over +over Iso' Value [(AssetClass, Integer)] flattenValueI - (\[(AssetClass, Integer)] -l -> [(AssetClass, Integer)] + (\[(AssetClass, Integer)] +l -> [(AssetClass, Integer)] -> AssetClass -> Integer -> [(AssetClass, Integer)] forall a b. Eq a => [(a, b)] -> a -> b -> [(a, b)] -insertAssocList [(AssetClass, Integer)] -l (CurrencySymbol -> TokenName -> AssetClass -Pl.assetClass CurrencySymbol -Pl.adaSymbol TokenName -Pl.adaToken) Integer -ada) +insertAssocList [(AssetClass, Integer)] +l (CurrencySymbol -> TokenName -> AssetClass +Pl.assetClass CurrencySymbol +Pl.adaSymbol TokenName +Pl.adaToken) Integer +ada) Value -value +value ) where - insertAssocList :: Eq a => [(a, b)] -> a -> b -> [(a, b)] - insertAssocList :: [(a, b)] -> a -> b -> [(a, b)] -insertAssocList [(a, b)] -l a -a b -b = (a -a, b -b) (a, b) -> [(a, b)] -> [(a, b)] + insertAssocList :: (Eq a) => [(a, b)] -> a -> b -> [(a, b)] + insertAssocList :: [(a, b)] -> a -> b -> [(a, b)] +insertAssocList [(a, b)] +l a +a b +b = (a +a, b +b) (a, b) -> [(a, b)] -> [(a, b)] forall a. a -> [a] -> [a] -: ((a, b) -> Bool) -> [(a, b)] -> [(a, b)] +: ((a, b) -> Bool) -> [(a, b)] -> [(a, b)] forall a. (a -> Bool) -> [a] -> [a] -filter ((a -> a -> Bool +filter ((a -> a -> Bool forall a. Eq a => a -> a -> Bool -/= a -a) (a -> Bool) -> ((a, b) -> a) -> (a, b) -> Bool +/= a +a) (a -> Bool) -> ((a, b) -> a) -> (a, b) -> Bool forall b c a. (b -> c) -> (a -> b) -> a -> c -. (a, b) -> a +. (a, b) -> a forall a b. (a, b) -> a -fst) [(a, b)] -l +fst) [(a, b)] +l \ No newline at end of file diff --git a/src/Cooked.Wallet.html b/src/Cooked.Wallet.html index 8f2e27e43..3462f8d86 100644 --- a/src/Cooked.Wallet.html +++ b/src/Cooked.Wallet.html @@ -27,18 +27,18 @@ ) where -import qualified Cardano.Crypto.Wallet as Cardano -import Data.Default -import Data.Function (on) -import Data.Map.Strict (Map) -import qualified Data.Map.Strict as Map -import qualified Ledger.Address as Pl -import qualified Ledger.CardanoWallet as Pl +import qualified Cardano.Crypto.Wallet as Cardano +import Data.Default +import Data.Function (on) +import Data.Map.Strict (Map) +import qualified Data.Map.Strict as Map +import qualified Ledger.Address as Pl +import qualified Ledger.CardanoWallet as Pl import qualified Ledger.Credential as Pl -import qualified Ledger.Crypto as Pl -import qualified Plutus.Script.Utils.Ada as Pl -import qualified Plutus.Script.Utils.Value as Pl -import Unsafe.Coerce +import qualified Ledger.Crypto as Pl +import qualified Plutus.Script.Utils.Ada as Pl +import qualified Plutus.Script.Utils.Value as Pl +import Unsafe.Coerce -- * MockChain Wallets @@ -48,29 +48,29 @@ -- provide our own wrapper on top of them to make sure that we can easily deal -- changes from Plutus. -type Wallet = Pl.MockWallet +type Wallet = Pl.MockWallet -type PrivateKey = Cardano.XPrv +type PrivateKey = Cardano.XPrv -instance Eq Wallet where - == :: Wallet -> Wallet -> Bool -(==) = Digest Blake2b_160 -> Digest Blake2b_160 -> Bool +instance Eq Wallet where + == :: Wallet -> Wallet -> Bool +(==) = Digest Blake2b_160 -> Digest Blake2b_160 -> Bool forall a. Eq a => a -> a -> Bool -(==) (Digest Blake2b_160 -> Digest Blake2b_160 -> Bool) +(==) (Digest Blake2b_160 -> Digest Blake2b_160 -> Bool) -> (Wallet -> Digest Blake2b_160) -> Wallet -> Wallet -> Bool forall b c a. (b -> b -> c) -> (a -> b) -> a -> a -> c -`on` Wallet -> Digest Blake2b_160 -Pl.mwWalletId +`on` Wallet -> Digest Blake2b_160 +Pl.mwWalletId -instance Ord Wallet where - compare :: Wallet -> Wallet -> Ordering -compare = Digest Blake2b_160 -> Digest Blake2b_160 -> Ordering +instance Ord Wallet where + compare :: Wallet -> Wallet -> Ordering +compare = Digest Blake2b_160 -> Digest Blake2b_160 -> Ordering forall a. Ord a => a -> a -> Ordering -compare (Digest Blake2b_160 -> Digest Blake2b_160 -> Ordering) +compare (Digest Blake2b_160 -> Digest Blake2b_160 -> Ordering) -> (Wallet -> Digest Blake2b_160) -> Wallet -> Wallet -> Ordering forall b c a. (b -> b -> c) -> (a -> b) -> a -> a -> c -`on` Wallet -> Digest Blake2b_160 -Pl.mwWalletId +`on` Wallet -> Digest Blake2b_160 +Pl.mwWalletId -- | All the wallets corresponding to known Plutus mock wallets. This is a list -- of 10 wallets which will @@ -83,191 +83,191 @@ knownWallets :: [Wallet] knownWallets :: [Wallet] knownWallets = [Wallet] -Pl.knownMockWallets +Pl.knownMockWallets -- | Wallet corresponding to a given wallet number (or wallet ID) -wallet :: Int -> Wallet +wallet :: Int -> Wallet wallet :: Int -> Wallet -wallet Int -j +wallet Int +j | Int -j Int -> Int -> Bool +j Int -> Int -> Bool forall a. Ord a => a -> a -> Bool -> Int +> Int 0 Bool -> Bool -> Bool -&& Int -j Int -> Int -> Bool +&& Int +j Int -> Int -> Bool forall a. Ord a => a -> a -> Bool -<= Int -10 = let i :: Int -i = Int -j Int -> Int -> Int +<= Int +10 = let i :: Int +i = Int +j Int -> Int -> Int forall a. Num a => a -> a -> a -- Int +- Int 1 in [Wallet] knownWallets [Wallet] -> Int -> Wallet forall a. [a] -> Int -> a -!! Int -i +!! Int +i | Bool -otherwise = WalletNumber -> Wallet -Pl.fromWalletNumber (Integer -> WalletNumber -Pl.WalletNumber (Integer -> WalletNumber) -> Integer -> WalletNumber +otherwise = WalletNumber -> Wallet +Pl.fromWalletNumber (Integer -> WalletNumber +Pl.WalletNumber (Integer -> WalletNumber) -> Integer -> WalletNumber forall a b. (a -> b) -> a -> b -$ Int -> Integer +$ Int -> Integer forall a b. (Integral a, Num b) => a -> b -fromIntegral Int -j) +fromIntegral Int +j) -- | Retrieves the id of the known wallet that corresponds to a public key -- hash, if any. -- -- @walletPKHashToId (walletPKHash (wallet 3)) == Just 3@ -walletPKHashToId :: Pl.PubKeyHash -> Maybe Int +walletPKHashToId :: Pl.PubKeyHash -> Maybe Int walletPKHashToId :: PubKeyHash -> Maybe Int walletPKHashToId = (PubKeyHash -> Map PubKeyHash Int -> Maybe Int) -> Map PubKeyHash Int -> PubKeyHash -> Maybe Int forall a b c. (a -> b -> c) -> b -> a -> c -flip PubKeyHash -> Map PubKeyHash Int -> Maybe Int +flip PubKeyHash -> Map PubKeyHash Int -> Maybe Int forall k a. Ord k => k -> Map k a -> Maybe a -Map.lookup Map PubKeyHash Int -walletPKHashToIdMap +Map.lookup Map PubKeyHash Int +walletPKHashToIdMap where - walletPKHashToIdMap :: Map PubKeyHash Int -walletPKHashToIdMap = + walletPKHashToIdMap :: Map PubKeyHash Int +walletPKHashToIdMap = [(PubKeyHash, Int)] -> Map PubKeyHash Int forall k a. Ord k => [(k, a)] -> Map k a -Map.fromList ([(PubKeyHash, Int)] -> Map PubKeyHash Int) +Map.fromList ([(PubKeyHash, Int)] -> Map PubKeyHash Int) -> ([Wallet] -> [(PubKeyHash, Int)]) -> [Wallet] -> Map PubKeyHash Int forall b c a. (b -> c) -> (a -> b) -> a -> c -. ([PubKeyHash] -> [Int] -> [(PubKeyHash, Int)]) +. ([PubKeyHash] -> [Int] -> [(PubKeyHash, Int)]) -> [Int] -> [PubKeyHash] -> [(PubKeyHash, Int)] forall a b c. (a -> b -> c) -> b -> a -> c -flip [PubKeyHash] -> [Int] -> [(PubKeyHash, Int)] +flip [PubKeyHash] -> [Int] -> [(PubKeyHash, Int)] forall a b. [a] -> [b] -> [(a, b)] -zip [Int +zip [Int 1 ..] ([PubKeyHash] -> [(PubKeyHash, Int)]) -> ([Wallet] -> [PubKeyHash]) -> [Wallet] -> [(PubKeyHash, Int)] forall b c a. (b -> c) -> (a -> b) -> a -> c -. (Wallet -> PubKeyHash) -> [Wallet] -> [PubKeyHash] +. (Wallet -> PubKeyHash) -> [Wallet] -> [PubKeyHash] forall a b. (a -> b) -> [a] -> [b] -map Wallet -> PubKeyHash +map Wallet -> PubKeyHash walletPKHash ([Wallet] -> Map PubKeyHash Int) -> [Wallet] -> Map PubKeyHash Int forall a b. (a -> b) -> a -> b -$ [Wallet] +$ [Wallet] knownWallets -- | Retrieves a wallet public key (PK) -walletPK :: Wallet -> Pl.PubKey +walletPK :: Wallet -> Pl.PubKey walletPK :: Wallet -> PubKey walletPK = PaymentPubKey -> PubKey -Pl.unPaymentPubKey (PaymentPubKey -> PubKey) +Pl.unPaymentPubKey (PaymentPubKey -> PubKey) -> (Wallet -> PaymentPubKey) -> Wallet -> PubKey forall b c a. (b -> c) -> (a -> b) -> a -> c -. Wallet -> PaymentPubKey -Pl.paymentPubKey +. Wallet -> PaymentPubKey +Pl.paymentPubKey -- | Retrieves a wallet's public staking key (PK), if any -walletStakingPK :: Wallet -> Maybe Pl.PubKey +walletStakingPK :: Wallet -> Maybe Pl.PubKey walletStakingPK :: Wallet -> Maybe PubKey walletStakingPK = (XPrv -> PubKey) -> Maybe XPrv -> Maybe PubKey forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b -fmap XPrv -> PubKey -Pl.toPublicKey (Maybe XPrv -> Maybe PubKey) +fmap XPrv -> PubKey +Pl.toPublicKey (Maybe XPrv -> Maybe PubKey) -> (Wallet -> Maybe XPrv) -> Wallet -> Maybe PubKey forall b c a. (b -> c) -> (a -> b) -> a -> c -. Wallet -> Maybe XPrv +. Wallet -> Maybe XPrv walletStakingSK -- | Retrieves a wallet's public key hash -walletPKHash :: Wallet -> Pl.PubKeyHash +walletPKHash :: Wallet -> Pl.PubKeyHash walletPKHash :: Wallet -> PubKeyHash walletPKHash = PubKey -> PubKeyHash -Pl.pubKeyHash (PubKey -> PubKeyHash) +Pl.pubKeyHash (PubKey -> PubKeyHash) -> (Wallet -> PubKey) -> Wallet -> PubKeyHash forall b c a. (b -> c) -> (a -> b) -> a -> c -. Wallet -> PubKey +. Wallet -> PubKey walletPK -- | Retrieves a wallet's public staking key hash, if any -walletStakingPKHash :: Wallet -> Maybe Pl.PubKeyHash +walletStakingPKHash :: Wallet -> Maybe Pl.PubKeyHash walletStakingPKHash :: Wallet -> Maybe PubKeyHash walletStakingPKHash = (PubKey -> PubKeyHash) -> Maybe PubKey -> Maybe PubKeyHash forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b -fmap PubKey -> PubKeyHash -Pl.pubKeyHash (Maybe PubKey -> Maybe PubKeyHash) +fmap PubKey -> PubKeyHash +Pl.pubKeyHash (Maybe PubKey -> Maybe PubKeyHash) -> (Wallet -> Maybe PubKey) -> Wallet -> Maybe PubKeyHash forall b c a. (b -> c) -> (a -> b) -> a -> c -. Wallet -> Maybe PubKey +. Wallet -> Maybe PubKey walletStakingPK -- | Retrieves a wallet's address -walletAddress :: Wallet -> Pl.Address +walletAddress :: Wallet -> Pl.Address walletAddress :: Wallet -> Address -walletAddress Wallet -w = +walletAddress Wallet +w = Credential -> Maybe StakingCredential -> Address -Pl.Address +Pl.Address (PubKeyHash -> Credential -Pl.PubKeyCredential (PubKeyHash -> Credential) -> PubKeyHash -> Credential +Pl.PubKeyCredential (PubKeyHash -> Credential) -> PubKeyHash -> Credential forall a b. (a -> b) -> a -> b -$ Wallet -> PubKeyHash +$ Wallet -> PubKeyHash walletPKHash Wallet -w) +w) (Credential -> StakingCredential -Pl.StakingHash (Credential -> StakingCredential) +Pl.StakingHash (Credential -> StakingCredential) -> (PubKeyHash -> Credential) -> PubKeyHash -> StakingCredential forall b c a. (b -> c) -> (a -> b) -> a -> c -. PubKeyHash -> Credential -Pl.PubKeyCredential (PubKeyHash -> StakingCredential) +. PubKeyHash -> Credential +Pl.PubKeyCredential (PubKeyHash -> StakingCredential) -> Maybe PubKeyHash -> Maybe StakingCredential forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b -<$> Wallet -> Maybe PubKeyHash +<$> Wallet -> Maybe PubKeyHash walletStakingPKHash Wallet -w) +w) -- | Retrieves a wallet private key (secret key SK) -walletSK :: Pl.MockWallet -> PrivateKey +walletSK :: Pl.MockWallet -> PrivateKey walletSK :: Wallet -> XPrv walletSK = PaymentPrivateKey -> XPrv -Pl.unPaymentPrivateKey (PaymentPrivateKey -> XPrv) +Pl.unPaymentPrivateKey (PaymentPrivateKey -> XPrv) -> (Wallet -> PaymentPrivateKey) -> Wallet -> XPrv forall b c a. (b -> c) -> (a -> b) -> a -> c -. Wallet -> PaymentPrivateKey -Pl.paymentPrivateKey +. Wallet -> PaymentPrivateKey +Pl.paymentPrivateKey -- FIXME Massive hack to be able to open a 'MockPrivateKey'; this is needed -- because the constructor and accessors to 'MockPrivateKey' are not exported. -- Hence, we make an isomorphic datatype, 'unsafeCoerce' to this datatype then -- extract whatever we need from it. -newtype HACK = HACK Cardano.XPrv +newtype HACK = HACK Cardano.XPrv -- | Retrieves a wallet's private staking key (secret key SK), if any -walletStakingSK :: Wallet -> Maybe PrivateKey +walletStakingSK :: Wallet -> Maybe PrivateKey walletStakingSK :: Wallet -> Maybe XPrv walletStakingSK = (MockPrivateKey -> XPrv) -> Maybe MockPrivateKey -> Maybe XPrv forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b -fmap MockPrivateKey -> XPrv +fmap MockPrivateKey -> XPrv forall a. a -> XPrv -hackUnMockPrivateKey (Maybe MockPrivateKey -> Maybe XPrv) +hackUnMockPrivateKey (Maybe MockPrivateKey -> Maybe XPrv) -> (Wallet -> Maybe MockPrivateKey) -> Wallet -> Maybe XPrv forall b c a. (b -> c) -> (a -> b) -> a -> c -. Wallet -> Maybe MockPrivateKey -Pl.mwStakeKey +. Wallet -> Maybe MockPrivateKey +Pl.mwStakeKey where -- Make sure that you only apply it to @MockPrivateKey@; the function is -- polymorphic because @MockPrivateKey@ is not exported either - hackUnMockPrivateKey :: a -> Cardano.XPrv - hackUnMockPrivateKey :: a -> XPrv -hackUnMockPrivateKey a -x = let HACK XPrv -y = a -> HACK + hackUnMockPrivateKey :: a -> Cardano.XPrv + hackUnMockPrivateKey :: a -> XPrv +hackUnMockPrivateKey a +x = let HACK XPrv +y = a -> HACK forall a b. a -> b -unsafeCoerce a -x in XPrv -y +unsafeCoerce a +x in XPrv +y -- * Initial distribution of funds @@ -292,9 +292,9 @@ -- > ] newtype InitialDistribution = InitialDistribution { InitialDistribution -> Map Wallet [Value] -unInitialDistribution :: Map Wallet [Pl.Value] +unInitialDistribution :: Map Wallet [Pl.Value] } - deriving (InitialDistribution -> InitialDistribution -> Bool + deriving (InitialDistribution -> InitialDistribution -> Bool (InitialDistribution -> InitialDistribution -> Bool) -> (InitialDistribution -> InitialDistribution -> Bool) -> Eq InitialDistribution @@ -303,7 +303,7 @@ $c/= :: InitialDistribution -> InitialDistribution -> Bool == :: InitialDistribution -> InitialDistribution -> Bool $c== :: InitialDistribution -> InitialDistribution -> Bool -Eq, Int -> InitialDistribution -> ShowS +Eq, Int -> InitialDistribution -> ShowS [InitialDistribution] -> ShowS InitialDistribution -> String (Int -> InitialDistribution -> ShowS) @@ -318,67 +318,67 @@ $cshow :: InitialDistribution -> String showsPrec :: Int -> InitialDistribution -> ShowS $cshowsPrec :: Int -> InitialDistribution -> ShowS -Show) +Show) -instance Semigroup InitialDistribution where - (InitialDistribution Map Wallet [Value] -i) <> :: InitialDistribution -> InitialDistribution -> InitialDistribution -<> (InitialDistribution Map Wallet [Value] -j) = +instance Semigroup InitialDistribution where + (InitialDistribution Map Wallet [Value] +i) <> :: InitialDistribution -> InitialDistribution -> InitialDistribution +<> (InitialDistribution Map Wallet [Value] +j) = Map Wallet [Value] -> InitialDistribution InitialDistribution (Map Wallet [Value] -> InitialDistribution) -> Map Wallet [Value] -> InitialDistribution forall a b. (a -> b) -> a -> b -$ ([Value] -> [Value] -> [Value]) +$ ([Value] -> [Value] -> [Value]) -> Map Wallet [Value] -> Map Wallet [Value] -> Map Wallet [Value] forall k a. Ord k => (a -> a -> a) -> Map k a -> Map k a -> Map k a -Map.unionWith [Value] -> [Value] -> [Value] +Map.unionWith [Value] -> [Value] -> [Value] forall a. Semigroup a => a -> a -> a -(<>) Map Wallet [Value] -i Map Wallet [Value] -j +(<>) Map Wallet [Value] +i Map Wallet [Value] +j -instance Monoid InitialDistribution where - mempty :: InitialDistribution -mempty = Map Wallet [Value] -> InitialDistribution +instance Monoid InitialDistribution where + mempty :: InitialDistribution +mempty = Map Wallet [Value] -> InitialDistribution InitialDistribution Map Wallet [Value] forall k a. Map k a -Map.empty +Map.empty -- | 10 UTxOs with 100 Ada each, for each of the 'knownWallets'. -instance Default InitialDistribution where - def :: InitialDistribution -def = +instance Default InitialDistribution where + def :: InitialDistribution +def = Map Wallet [Value] -> InitialDistribution InitialDistribution (Map Wallet [Value] -> InitialDistribution) -> Map Wallet [Value] -> InitialDistribution forall a b. (a -> b) -> a -> b -$ +$ [(Wallet, [Value])] -> Map Wallet [Value] forall k a. Ord k => [(k, a)] -> Map k a -Map.fromList ([(Wallet, [Value])] -> Map Wallet [Value]) +Map.fromList ([(Wallet, [Value])] -> Map Wallet [Value]) -> [(Wallet, [Value])] -> Map Wallet [Value] forall a b. (a -> b) -> a -> b -$ +$ [Wallet] -> [[Value]] -> [(Wallet, [Value])] forall a b. [a] -> [b] -> [(a, b)] -zip [Wallet] +zip [Wallet] knownWallets ([Value] -> [[Value]] forall a. a -> [a] -repeat ([Value] -> [[Value]]) -> [Value] -> [[Value]] +repeat ([Value] -> [[Value]]) -> [Value] -> [[Value]] forall a b. (a -> b) -> a -> b -$ Int -> Value -> [Value] +$ Int -> Value -> [Value] forall a. Int -> a -> [a] -replicate Int +replicate Int 10 Value -defLovelace) +defLovelace) where - defLovelace :: Value -defLovelace = Integer -> Value -Pl.lovelaceValueOf Integer + defLovelace :: Value +defLovelace = Integer -> Value +Pl.lovelaceValueOf Integer 100_000_000 -distributionFromList :: [(Wallet, [Pl.Value])] -> InitialDistribution +distributionFromList :: [(Wallet, [Pl.Value])] -> InitialDistribution distributionFromList :: [(Wallet, [Value])] -> InitialDistribution distributionFromList = Map Wallet [Value] -> InitialDistribution InitialDistribution (Map Wallet [Value] -> InitialDistribution) @@ -386,21 +386,21 @@ -> [(Wallet, [Value])] -> InitialDistribution forall b c a. (b -> c) -> (a -> b) -> a -> c -. [(Wallet, [Value])] -> Map Wallet [Value] +. [(Wallet, [Value])] -> Map Wallet [Value] forall k a. Ord k => [(k, a)] -> Map k a -Map.fromList +Map.fromList -initialDistribution :: [(Wallet, [Pl.Value])] -> InitialDistribution +initialDistribution :: [(Wallet, [Pl.Value])] -> InitialDistribution initialDistribution :: [(Wallet, [Value])] -> InitialDistribution initialDistribution = (InitialDistribution forall a. Default a => a -def InitialDistribution -> InitialDistribution -> InitialDistribution +def InitialDistribution -> InitialDistribution -> InitialDistribution forall a. Semigroup a => a -> a -> a -<>) (InitialDistribution -> InitialDistribution) +<>) (InitialDistribution -> InitialDistribution) -> ([(Wallet, [Value])] -> InitialDistribution) -> [(Wallet, [Value])] -> InitialDistribution forall b c a. (b -> c) -> (a -> b) -> a -> c -. [(Wallet, [Value])] -> InitialDistribution +. [(Wallet, [Value])] -> InitialDistribution distributionFromList \ No newline at end of file diff --git a/src/Paths_cooked_validators.html b/src/Paths_cooked_validators.html index 7a82efdeb..a6ca2eaef 100644 --- a/src/Paths_cooked_validators.html +++ b/src/Paths_cooked_validators.html @@ -1,25 +1,28 @@
    {-# LANGUAGE CPP #-}
    -{-# LANGUAGE NoRebindableSyntax #-}
    -{-# OPTIONS_GHC -fno-warn-missing-import-lists #-}
    -{-# OPTIONS_GHC -w #-}
    -module Paths_cooked_validators (
    -    version,
    -    getBinDir, getLibDir, getDynLibDir, getDataDir, getLibexecDir,
    -    getDataFileName, getSysconfDir
    -  ) where
    -
    -
    -import qualified Control.Exception as Exception
    -import qualified Data.List as List
    -import Data.Version (Version(..))
    -import System.Environment (getEnv)
    -import Prelude
    +{-# LANGUAGE NoRebindableSyntax #-}
    +#if __GLASGOW_HASKELL__ >= 810
    +{-# OPTIONS_GHC -Wno-prepositive-qualified-module #-}
    +#endif
    +{-# OPTIONS_GHC -fno-warn-missing-import-lists #-}
    +{-# OPTIONS_GHC -w #-}
    +module Paths_cooked_validators (
    +    version,
    +    getBinDir, getLibDir, getDynLibDir, getDataDir, getLibexecDir,
    +    getDataFileName, getSysconfDir
    +  ) where
    +
    +
    +import qualified Control.Exception as Exception
    +import qualified Data.List as List
    +import Data.Version (Version(..))
    +import System.Environment (getEnv)
    +import Prelude
     
     
     #if defined(VERSION_base)
     
     #if MIN_VERSION_base(4,0,0)
    -catchIO :: IO a -> (Exception.IOException -> IO a) -> IO a
    +catchIO :: IO a -> (Exception.IOException -> IO a) -> IO a
     #else
     catchIO :: IO a -> (Exception.Exception -> IO a) -> IO a
     #endif
    @@ -30,165 +33,165 @@
     catchIO :: IO a -> (IOException -> IO a) -> IO a
     catchIO = IO a -> (IOException -> IO a) -> IO a
     forall e a. Exception e => IO a -> (e -> IO a) -> IO a
    -Exception.catch
    -
    -version :: Version
    -version :: Version
    +Exception.catch
    +
    +version :: Version
    +version :: Version
     version = [Int] -> [String] -> Version
    -Version [Int
    +Version [Int
     2,Int
     0,Int
     0] []
    -
    -getDataFileName :: FilePath -> IO FilePath
    -getDataFileName :: String -> IO String
    -getDataFileName String
    -name = do
    -  String
    -dir <- IO String
    +
    +getDataFileName :: FilePath -> IO FilePath
    +getDataFileName :: String -> IO String
    +getDataFileName String
    +name = do
    +  String
    +dir <- IO String
     getDataDir
    -  String -> IO String
    +  String -> IO String
     forall (m :: * -> *) a. Monad m => a -> m a
    -return (String
    -dir String -> String -> String
    +return (String
    +dir String -> String -> String
     `joinFileName` String
    -name)
    -
    -getBinDir, getLibDir, getDynLibDir, getDataDir, getLibexecDir, getSysconfDir :: IO FilePath
    -
    +name)
     
    -
    -bindir, libdir, dynlibdir, datadir, libexecdir, sysconfdir :: FilePath
    -bindir :: String
    +getBinDir, getLibDir, getDynLibDir, getDataDir, getLibexecDir, getSysconfDir :: IO FilePath
    +
    +
    +
    +
    +bindir, libdir, dynlibdir, datadir, libexecdir, sysconfdir :: FilePath
    +bindir :: String
     bindir     = String
     "/home/runner/.cabal/bin"
    -libdir :: String
    +libdir :: String
     libdir     = String
     "/home/runner/.cabal/lib/x86_64-linux-ghc-8.10.7/cooked-validators-2.0.0-inplace"
    -dynlibdir :: String
    +dynlibdir :: String
     dynlibdir  = String
     "/home/runner/.cabal/lib/x86_64-linux-ghc-8.10.7"
    -datadir :: String
    +datadir :: String
     datadir    = String
     "/home/runner/.cabal/share/x86_64-linux-ghc-8.10.7/cooked-validators-2.0.0"
    -libexecdir :: String
    +libexecdir :: String
     libexecdir = String
     "/home/runner/.cabal/libexec/x86_64-linux-ghc-8.10.7/cooked-validators-2.0.0"
    -sysconfdir :: String
    +sysconfdir :: String
     sysconfdir = String
     "/home/runner/.cabal/etc"
    -
    -getBinDir :: IO String
    +
    +getBinDir :: IO String
     getBinDir     = IO String -> (IOException -> IO String) -> IO String
     forall a. IO a -> (IOException -> IO a) -> IO a
     catchIO (String -> IO String
    -getEnv String
    +getEnv String
     "cooked_validators_bindir")     (\IOException
     _ -> String -> IO String
     forall (m :: * -> *) a. Monad m => a -> m a
    -return String
    +return String
     bindir)
    -getLibDir :: IO String
    +getLibDir :: IO String
     getLibDir     = IO String -> (IOException -> IO String) -> IO String
     forall a. IO a -> (IOException -> IO a) -> IO a
     catchIO (String -> IO String
    -getEnv String
    +getEnv String
     "cooked_validators_libdir")     (\IOException
     _ -> String -> IO String
     forall (m :: * -> *) a. Monad m => a -> m a
    -return String
    +return String
     libdir)
    -getDynLibDir :: IO String
    +getDynLibDir :: IO String
     getDynLibDir  = IO String -> (IOException -> IO String) -> IO String
     forall a. IO a -> (IOException -> IO a) -> IO a
     catchIO (String -> IO String
    -getEnv String
    +getEnv String
     "cooked_validators_dynlibdir")  (\IOException
     _ -> String -> IO String
     forall (m :: * -> *) a. Monad m => a -> m a
    -return String
    +return String
     dynlibdir)
    -getDataDir :: IO String
    +getDataDir :: IO String
     getDataDir    = IO String -> (IOException -> IO String) -> IO String
     forall a. IO a -> (IOException -> IO a) -> IO a
     catchIO (String -> IO String
    -getEnv String
    +getEnv String
     "cooked_validators_datadir")    (\IOException
     _ -> String -> IO String
     forall (m :: * -> *) a. Monad m => a -> m a
    -return String
    +return String
     datadir)
    -getLibexecDir :: IO String
    +getLibexecDir :: IO String
     getLibexecDir = IO String -> (IOException -> IO String) -> IO String
     forall a. IO a -> (IOException -> IO a) -> IO a
     catchIO (String -> IO String
    -getEnv String
    +getEnv String
     "cooked_validators_libexecdir") (\IOException
     _ -> String -> IO String
     forall (m :: * -> *) a. Monad m => a -> m a
    -return String
    +return String
     libexecdir)
    -getSysconfDir :: IO String
    +getSysconfDir :: IO String
     getSysconfDir = IO String -> (IOException -> IO String) -> IO String
     forall a. IO a -> (IOException -> IO a) -> IO a
     catchIO (String -> IO String
    -getEnv String
    +getEnv String
     "cooked_validators_sysconfdir") (\IOException
     _ -> String -> IO String
     forall (m :: * -> *) a. Monad m => a -> m a
    -return String
    +return String
     sysconfdir)
    -
    -
    -
    -
    -joinFileName :: String -> String -> FilePath
    -joinFileName :: String -> String -> String
    +
    +
    +
    +joinFileName :: String -> String -> FilePath
    +joinFileName :: String -> String -> String
     joinFileName String
    -""  String
    -fname = String
    -fname
    -joinFileName String
    -"." String
    -fname = String
    -fname
    -joinFileName String
    -dir String
    +""  String
    +fname = String
    +fname
    +joinFileName String
    +"." String
    +fname = String
    +fname
    +joinFileName String
    +dir String
     ""    = String
    -dir
    -joinFileName String
    -dir String
    -fname
    -  | Char -> Bool
    +dir
    +joinFileName String
    +dir String
    +fname
    +  | Char -> Bool
     isPathSeparator (String -> Char
     forall a. [a] -> a
    -List.last String
    -dir) = String
    -dir String -> String -> String
    +List.last String
    +dir) = String
    +dir String -> String -> String
     forall a. [a] -> [a] -> [a]
    -++ String
    -fname
    -  | Bool
    -otherwise                       = String
    -dir String -> String -> String
    +++ String
    +fname
    +  | Bool
    +otherwise                       = String
    +dir String -> String -> String
     forall a. [a] -> [a] -> [a]
    -++ Char
    +++ Char
     pathSeparator Char -> String -> String
     forall a. a -> [a] -> [a]
    -: String
    -fname
    -
    -pathSeparator :: Char
    -pathSeparator :: Char
    +: String
    +fname
    +
    +pathSeparator :: Char
    +pathSeparator :: Char
     pathSeparator = Char
     '/'
    -
    -isPathSeparator :: Char -> Bool
    -isPathSeparator :: Char -> Bool
    -isPathSeparator Char
    -c = Char
    -c Char -> Char -> Bool
    +
    +isPathSeparator :: Char -> Bool
    +isPathSeparator :: Char -> Bool
    +isPathSeparator Char
    +c = Char
    +c Char -> Char -> Bool
     forall a. Eq a => a -> a -> Bool
    -== Char
    +== Char
     '/'
    -
    \ No newline at end of file + \ No newline at end of file