Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
This module provides the description of a transaction skeleton. We have our own representation of a transaction for three main reasons:
- our transaction skeletons are typed (datums, validators, outputs...)
- with our own wrapper, we are less affected by plutus updates
- we can have default or automated behavior for the parts of the transactions that are less relevant to testing, such as collaterals or fees
Synopsis
- type LabelConstrs x = (PrettyCooked x, Show x, Typeable x, Eq x, Ord x)
- data TxLabel where
- TxLabel :: LabelConstrs x => x -> TxLabel
- data BalanceOutputPolicy
- data FeePolicy
- data BalancingPolicy
- data BalancingUtxos
- newtype RawModTx = RawModTxAfterBalancing (Tx ConwayEra -> Tx ConwayEra)
- newtype EmulatorParamsModification = EmulatorParamsModification (Params -> Params)
- data CollateralUtxos
- data AnchorResolution
- applyEmulatorParamsModification :: Maybe EmulatorParamsModification -> Params -> Params
- applyRawModOnBalancedTx :: [RawModTx] -> Tx ConwayEra -> Tx ConwayEra
- data TxOpts = TxOpts {
- txOptEnsureMinAda :: Bool
- txOptAutoSlotIncrease :: Bool
- txOptUnsafeModTx :: [RawModTx]
- txOptBalancingPolicy :: BalancingPolicy
- txOptFeePolicy :: FeePolicy
- txOptBalanceOutputPolicy :: BalanceOutputPolicy
- txOptBalancingUtxos :: BalancingUtxos
- txOptEmulatorParamsModification :: Maybe EmulatorParamsModification
- txOptCollateralUtxos :: CollateralUtxos
- txOptAnchorResolution :: AnchorResolution
- txOptAutoReferenceScripts :: Bool
- txOptEnsureMinAdaL :: Lens' TxOpts Bool
- txOptUnsafeModTxL :: Lens' TxOpts [RawModTx]
- txOptAutoSlotIncreaseL :: Lens' TxOpts Bool
- txOptBalancingPolicyL :: Lens' TxOpts BalancingPolicy
- txOptBalanceOutputPolicyL :: Lens' TxOpts BalanceOutputPolicy
- txOptFeePolicyL :: Lens' TxOpts FeePolicy
- txOptBalancingUtxosL :: Lens' TxOpts BalancingUtxos
- txOptEmulatorParamsModificationL :: Lens' TxOpts (Maybe EmulatorParamsModification)
- txOptCollateralUtxosL :: Lens' TxOpts CollateralUtxos
- txOptAnchorResolutionL :: Lens' TxOpts AnchorResolution
- txOptAutoReferenceScriptsL :: Lens' TxOpts Bool
- type TxSkelMints = Map (Versioned MintingPolicy) (TxSkelRedeemer, NEMap TokenName (NonZero Integer))
- addToTxSkelMints :: (Versioned MintingPolicy, TxSkelRedeemer, TokenName, Integer) -> TxSkelMints -> TxSkelMints
- txSkelMintsToList :: TxSkelMints -> [(Versioned MintingPolicy, TxSkelRedeemer, TokenName, Integer)]
- txSkelMintsFromList :: [(Versioned MintingPolicy, TxSkelRedeemer, TokenName, Integer)] -> TxSkelMints
- txSkelMintsFromList' :: [(Versioned MintingPolicy, TxSkelRedeemer, [(TokenName, Integer)])] -> TxSkelMints
- txSkelMintsValue :: TxSkelMints -> Value
- txSkelOutValueL :: Lens' TxSkelOut Value
- txSkelOutDatumL :: Lens' TxSkelOut TxSkelOutDatum
- txSkelOutValue :: TxSkelOut -> Value
- txSkelOutValidator :: TxSkelOut -> Maybe (Versioned Validator)
- type TxSkelOutDatumConstrs a = (Show a, PrettyCooked a, ToData a, Eq a, Typeable a)
- data TxSkelOutDatum where
- TxSkelOutNoDatum :: TxSkelOutDatum
- TxSkelOutDatumHash :: TxSkelOutDatumConstrs a => a -> TxSkelOutDatum
- TxSkelOutDatum :: TxSkelOutDatumConstrs a => a -> TxSkelOutDatum
- TxSkelOutInlineDatum :: TxSkelOutDatumConstrs a => a -> TxSkelOutDatum
- data TxSkelOut where
- Pays :: (Show o, Typeable o, IsTxInfoOutput o, IsTxSkelOutAllowedOwner (OwnerType o), Typeable (OwnerType o), ToCredential (OwnerType o), DatumType o ~ TxSkelOutDatum, ValueType o ~ Value, ToVersionedScript (ReferenceScriptType o), Show (OwnerType o), Show (ReferenceScriptType o), Typeable (ReferenceScriptType o)) => {..} -> TxSkelOut
- txSkelOutTypedDatum :: FromData a => TxSkelOutDatum -> Maybe a
- txSkelOutUntypedDatum :: TxSkelOutDatum -> Maybe Datum
- paysPK :: ToPubKeyHash a => a -> Value -> TxSkelOut
- paysScript :: (ToData (DatumType a), Show (DatumType a), Typeable (DatumType a), Eq (DatumType a), PrettyCooked (DatumType a), Typeable a) => TypedValidator a -> DatumType a -> Value -> TxSkelOut
- paysScriptInlineDatum :: (ToData (DatumType a), Show (DatumType a), Typeable (DatumType a), Eq (DatumType a), PrettyCooked (DatumType a), Typeable a) => TypedValidator a -> DatumType a -> Value -> TxSkelOut
- paysScriptUnresolvedDatumHash :: (ToData (DatumType a), Show (DatumType a), Typeable (DatumType a), Eq (DatumType a), PrettyCooked (DatumType a), Typeable a) => TypedValidator a -> DatumType a -> Value -> TxSkelOut
- paysScriptNoDatum :: Typeable a => TypedValidator a -> Value -> TxSkelOut
- withDatum :: (ToData a, Show a, Typeable a, Eq a, PrettyCooked a) => TxSkelOut -> a -> TxSkelOut
- withInlineDatum :: (ToData a, Show a, Typeable a, Eq a, PrettyCooked a) => TxSkelOut -> a -> TxSkelOut
- withUnresolvedDatumHash :: (ToData a, Show a, Typeable a, Eq a, PrettyCooked a) => TxSkelOut -> a -> TxSkelOut
- withReferenceScript :: (Show script, ToVersionedScript script, Typeable script, ToScriptHash script) => TxSkelOut -> script -> TxSkelOut
- withStakingCredential :: TxSkelOut -> StakingCredential -> TxSkelOut
- data TxSkelRedeemer = TxSkelRedeemer {}
- data Redeemer where
- EmptyRedeemer :: Redeemer
- SomeRedeemer :: RedeemerConstrs redeemer => redeemer -> Redeemer
- withReferenceInput :: TxSkelRedeemer -> TxOutRef -> TxSkelRedeemer
- data TxParameterChange where
- FeePerByte :: Integer -> TxParameterChange
- FeeFixed :: Integer -> TxParameterChange
- MaxBlockBodySize :: Integer -> TxParameterChange
- MaxTxSize :: Integer -> TxParameterChange
- MaxBlockHeaderSize :: Integer -> TxParameterChange
- KeyDeposit :: Integer -> TxParameterChange
- PoolDeposit :: Integer -> TxParameterChange
- PoolRetirementMaxEpoch :: Integer -> TxParameterChange
- PoolNumber :: Integer -> TxParameterChange
- PoolInfluence :: Rational -> TxParameterChange
- MonetaryExpansion :: Rational -> TxParameterChange
- TreasuryCut :: Rational -> TxParameterChange
- MinPoolCost :: Integer -> TxParameterChange
- CoinsPerUTxOByte :: Integer -> TxParameterChange
- CostModels :: {..} -> TxParameterChange
- Prices :: {..} -> TxParameterChange
- MaxTxExUnits :: {..} -> TxParameterChange
- MaxBlockExUnits :: {..} -> TxParameterChange
- MaxValSize :: Integer -> TxParameterChange
- CollateralPercentage :: Integer -> TxParameterChange
- MaxCollateralInputs :: Integer -> TxParameterChange
- PoolVotingThresholds :: {..} -> TxParameterChange
- DRepVotingThresholds :: {..} -> TxParameterChange
- CommitteeMinSize :: Integer -> TxParameterChange
- CommitteeMaxTermLength :: Integer -> TxParameterChange
- GovActionLifetime :: Integer -> TxParameterChange
- GovActionDeposit :: Integer -> TxParameterChange
- DRepRegistrationDeposit :: Integer -> TxParameterChange
- DRepActivity :: Integer -> TxParameterChange
- data TxGovAction where
- TxGovActionParameterChange :: [TxParameterChange] -> TxGovAction
- TxGovActionHardForkInitiation :: ProtocolVersion -> TxGovAction
- TxGovActionTreasuryWithdrawals :: Map Credential Lovelace -> TxGovAction
- TxGovActionNoConfidence :: TxGovAction
- TxGovActionUpdateCommittee :: [ColdCommitteeCredential] -> Map ColdCommitteeCredential Integer -> Rational -> TxGovAction
- TxGovActionNewConstitution :: Constitution -> TxGovAction
- data TxSkelProposal where
- TxSkelProposal :: {..} -> TxSkelProposal
- txSkelProposalsL :: Lens' TxSkel [TxSkelProposal]
- txSkelProposalAddressL :: Lens' TxSkelProposal Address
- txSkelProposalActionL :: Lens' TxSkelProposal TxGovAction
- txSkelProposalWitnessL :: Lens' TxSkelProposal (Maybe (Versioned Script, TxSkelRedeemer))
- txSkelProposalAnchorL :: Lens' TxSkelProposal (Maybe String)
- type TxSkelWithdrawals = Map (Either (Versioned Script) PubKeyHash) (TxSkelRedeemer, Ada)
- txSkelWithdrawnValue :: TxSkel -> Value
- txSkelWithdrawalsScripts :: TxSkel -> [Versioned Script]
- pkWithdrawal :: ToPubKeyHash pkh => pkh -> Ada -> TxSkelWithdrawals
- scriptWithdrawal :: ToVersionedScript script => script -> TxSkelRedeemer -> Ada -> TxSkelWithdrawals
- data TxSkel where
- txSkelLabelL :: Lens' TxSkel (Set TxLabel)
- txSkelOptsL :: Lens' TxSkel TxOpts
- txSkelMintsL :: Lens' TxSkel TxSkelMints
- txSkelValidityRangeL :: Lens' TxSkel SlotRange
- txSkelSignersL :: Lens' TxSkel [Wallet]
- txSkelInsL :: Lens' TxSkel (Map TxOutRef TxSkelRedeemer)
- txSkelInsReferenceL :: Lens' TxSkel (Set TxOutRef)
- txSkelOutsL :: Lens' TxSkel [TxSkelOut]
- txSkelWithdrawalsL :: Lens' TxSkel TxSkelWithdrawals
- txSkelTemplate :: TxSkel
- txSkelDataInOutputs :: TxSkel -> [(DatumHash, TxSkelOutDatum)]
- txSkelValidatorsInOutputs :: TxSkel -> Map ValidatorHash (Versioned Validator)
- txSkelOutOwnerTypeP :: forall ownerType. (ToCredential ownerType, Show ownerType, IsTxSkelOutAllowedOwner ownerType, Typeable ownerType) => Prism' TxSkelOut (ConcreteOutput ownerType TxSkelOutDatum Value (Versioned Script))
- txSkelOutputDatumTypeAT :: (FromData a, Typeable a) => AffineTraversal' TxSkelOut a
- data SkelContext = SkelContext {}
- txSkelKnownTxOutRefs :: TxSkel -> [TxOutRef]
- simpleTxSkelProposal :: ToAddress a => a -> TxGovAction -> TxSkelProposal
- withWitness :: ToVersionedScript a => TxSkelProposal -> (a, TxSkelRedeemer) -> TxSkelProposal
- withAnchor :: TxSkelProposal -> String -> TxSkelProposal
- txSkelValueInOutputs :: TxSkel -> Value
- txSkelReferenceScripts :: TxSkel -> Map ValidatorHash (Versioned Validator)
- txSkelReferenceTxOutRefs :: TxSkel -> [TxOutRef]
- someTxSkelRedeemer :: RedeemerConstrs redeemer => redeemer -> TxSkelRedeemer
- emptyTxSkelRedeemer :: TxSkelRedeemer
Documentation
type LabelConstrs x = (PrettyCooked x, Show x, Typeable x, Eq x, Ord x) Source #
TxLabel :: LabelConstrs x => x -> TxLabel |
data BalanceOutputPolicy Source #
Whether to adjust a potentially existing output to the balancing wallet with the change during transaction balancing.
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. |
Instances
Show BalanceOutputPolicy Source # | |
Defined in Cooked.Skeleton showsPrec :: Int -> BalanceOutputPolicy -> ShowS # show :: BalanceOutputPolicy -> String # showList :: [BalanceOutputPolicy] -> ShowS # | |
Default BalanceOutputPolicy Source # | |
Defined in Cooked.Skeleton | |
Eq BalanceOutputPolicy Source # | |
Defined in Cooked.Skeleton (==) :: BalanceOutputPolicy -> BalanceOutputPolicy -> Bool # (/=) :: BalanceOutputPolicy -> BalanceOutputPolicy -> Bool # | |
Ord BalanceOutputPolicy Source # | |
Defined in Cooked.Skeleton compare :: BalanceOutputPolicy -> BalanceOutputPolicy -> Ordering # (<) :: BalanceOutputPolicy -> BalanceOutputPolicy -> Bool # (<=) :: BalanceOutputPolicy -> BalanceOutputPolicy -> Bool # (>) :: BalanceOutputPolicy -> BalanceOutputPolicy -> Bool # (>=) :: BalanceOutputPolicy -> BalanceOutputPolicy -> Bool # max :: BalanceOutputPolicy -> BalanceOutputPolicy -> BalanceOutputPolicy # min :: BalanceOutputPolicy -> BalanceOutputPolicy -> BalanceOutputPolicy # |
What fee policy to use in the transaction.
AutoFeeComputation | Use automatic fee computation. If balancing is activated, an optimal fee will be computed based on the transaction and existing utxos in the balancing wallet. Otherwise, the maximum transaction fee will be applied. |
ManualFee Integer | Provide a fee to the transaction. If the autobalancing is activated, it will be attempted around this fee, which might lead to failure if it is too low, otherwise, this fee will be given to transaction generation. |
data BalancingPolicy Source #
Whether to balance the transaction or not, and which wallet to use to provide outputs for balancing. Either the first signer or an explicit wallet. In the second case, this wallet must be a signer of the transaction.
Instances
Show BalancingPolicy Source # | |
Defined in Cooked.Skeleton showsPrec :: Int -> BalancingPolicy -> ShowS # show :: BalancingPolicy -> String # showList :: [BalancingPolicy] -> ShowS # | |
Default BalancingPolicy Source # | |
Defined in Cooked.Skeleton def :: BalancingPolicy # | |
Eq BalancingPolicy Source # | |
Defined in Cooked.Skeleton (==) :: BalancingPolicy -> BalancingPolicy -> Bool # (/=) :: BalancingPolicy -> BalancingPolicy -> Bool # | |
Ord BalancingPolicy Source # | |
Defined in Cooked.Skeleton compare :: BalancingPolicy -> BalancingPolicy -> Ordering # (<) :: BalancingPolicy -> BalancingPolicy -> Bool # (<=) :: BalancingPolicy -> BalancingPolicy -> Bool # (>) :: BalancingPolicy -> BalancingPolicy -> Bool # (>=) :: BalancingPolicy -> BalancingPolicy -> Bool # max :: BalancingPolicy -> BalancingPolicy -> BalancingPolicy # min :: BalancingPolicy -> BalancingPolicy -> BalancingPolicy # |
data BalancingUtxos Source #
Which UTxOs to use when balancing. Note that utxos that are already known
by the skeleton being balanced (in the sense of txSkelKnownTxOutRefs
,
i.e. inputs and reference inputs) will be filtered out during balancing.
BalancingUtxosFromBalancingWallet | Use all UTxOs containing only a Value (no datum, no staking credential, and no reference script) belonging to the balancing wallet. |
BalancingUtxosFromSet (Set TxOutRef) | Use the provided UTxOs. UTxOs belonging to scripts will be filtered out |
Instances
Show BalancingUtxos Source # | |
Defined in Cooked.Skeleton showsPrec :: Int -> BalancingUtxos -> ShowS # show :: BalancingUtxos -> String # showList :: [BalancingUtxos] -> ShowS # | |
Default BalancingUtxos Source # | |
Defined in Cooked.Skeleton def :: BalancingUtxos # | |
Eq BalancingUtxos Source # | |
Defined in Cooked.Skeleton (==) :: BalancingUtxos -> BalancingUtxos -> Bool # (/=) :: BalancingUtxos -> BalancingUtxos -> Bool # | |
Ord BalancingUtxos Source # | |
Defined in Cooked.Skeleton compare :: BalancingUtxos -> BalancingUtxos -> Ordering # (<) :: BalancingUtxos -> BalancingUtxos -> Bool # (<=) :: BalancingUtxos -> BalancingUtxos -> Bool # (>) :: BalancingUtxos -> BalancingUtxos -> Bool # (>=) :: BalancingUtxos -> BalancingUtxos -> Bool # max :: BalancingUtxos -> BalancingUtxos -> BalancingUtxos # min :: BalancingUtxos -> BalancingUtxos -> BalancingUtxos # |
Wraps a function that will be applied to a transaction right before submission, and after balancing.
newtype EmulatorParamsModification Source #
Wraps a function that will temporarily change the emulator parameters for the transaction's balancing and submission.
Instances
Show EmulatorParamsModification Source # | |
Defined in Cooked.Skeleton showsPrec :: Int -> EmulatorParamsModification -> ShowS # show :: EmulatorParamsModification -> String # showList :: [EmulatorParamsModification] -> ShowS # | |
Eq EmulatorParamsModification Source # | |
Defined in Cooked.Skeleton |
data CollateralUtxos Source #
Describe which UTxOs to use as collaterals
CollateralUtxosFromBalancingWallet | Rely on automated computation with only-value UTxOs from the balancing wallet. Return collaterals will be sent to this wallet. |
CollateralUtxosFromWallet Wallet | Rely on automated computation with only-value UTxOs from a given wallet. Return collaterals will be sent to this wallet. |
CollateralUtxosFromSet (Set TxOutRef) Wallet | Manually provide a set of candidate UTxOs to be used as collaterals alongside a wallet to send return collaterals back to. |
Instances
Show CollateralUtxos Source # | |
Defined in Cooked.Skeleton showsPrec :: Int -> CollateralUtxos -> ShowS # show :: CollateralUtxos -> String # showList :: [CollateralUtxos] -> ShowS # | |
Default CollateralUtxos Source # | |
Defined in Cooked.Skeleton def :: CollateralUtxos # | |
Eq CollateralUtxos Source # | |
Defined in Cooked.Skeleton (==) :: CollateralUtxos -> CollateralUtxos -> Bool # (/=) :: CollateralUtxos -> CollateralUtxos -> Bool # |
data AnchorResolution Source #
Describes how to resolve anchors in proposal procedures
AnchorResolutionLocal (Map String ByteString) | Provide a map between urls and page content as Bytestring |
AnchorResolutionHttp | Allow online fetch of pages from a given URL. Important note: using this option is unsafe, as it requires a web connection and inherently prevents guarantees of reproducibily. Use at your own discretion. |
Instances
Show AnchorResolution Source # | |
Defined in Cooked.Skeleton showsPrec :: Int -> AnchorResolution -> ShowS # show :: AnchorResolution -> String # showList :: [AnchorResolution] -> ShowS # | |
Default AnchorResolution Source # | |
Defined in Cooked.Skeleton def :: AnchorResolution # | |
Eq AnchorResolution Source # | |
Defined in Cooked.Skeleton (==) :: AnchorResolution -> AnchorResolution -> Bool # (/=) :: AnchorResolution -> AnchorResolution -> Bool # |
applyRawModOnBalancedTx :: [RawModTx] -> Tx ConwayEra -> Tx ConwayEra Source #
Applies a list of modifications right before the transaction is submitted. The leftmost function in the argument list is applied first.
Set of options to modify the behavior of generating and validating some transaction.
TxOpts | |
|
type TxSkelMints = Map (Versioned MintingPolicy) (TxSkelRedeemer, NEMap TokenName (NonZero Integer)) Source #
A description of what a transaction mints. For every policy, there can only
be one TxSkelRedeemer
, 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, TxSkelRedeemer, TokenName, Integer) -> TxSkelMints -> TxSkelMints Source #
Add a new entry to a TxSkelMints
. There are a few wrinkles:
- If for a given policy, redeemer, and token name, there are
n
tokens in the argumentTxSkelMints
, 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 becomes empty, the policy will disappear from theTxSkelMints
altogether. - If a policy is already present on the argument
TxSkelMints
with a redeemera
, and you add a mint with a different redeemerb
, the old redeemer is thrown away. The values associated with the token names of that policy are added as described above, though. This means that any pre-existing values will be minted with a new redeemer.
If, for some reason, you really want to generate a TxSkelMints
that has
both a negative and a positive entry of the same asset class and redeemer,
you'll have to do so manually. Note, however, that even if you do so, NO
VALIDATOR OR MINTING POLICY WILL EVER GET TO SEE A TRANSACTION WITH SUCH
CONFLICTING INFORMATION. This is not a design decision/limitation of
cooked-validators: The Cardano API TxBodyContent
type, that we're
translating everything into eventually, stores minting information as a
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, TxSkelRedeemer, TokenName, Integer)] Source #
Convert from TxSkelMints
to a list of tuples describing eveything that's
being minted.
txSkelMintsFromList :: [(Versioned MintingPolicy, TxSkelRedeemer, 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
.
txSkelMintsFromList' :: [(Versioned MintingPolicy, TxSkelRedeemer, [(TokenName, Integer)])] -> TxSkelMints Source #
Another smart constructor for TxSkelMints
, where the redeemer and minting
policies are not duplicated.
txSkelMintsValue :: TxSkelMints -> Value Source #
The value described by a TxSkelMints
txSkelOutValue :: TxSkelOut -> Value 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
- no datum
- only a datum hash
- a "normal" datum
- 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 txInfoData | OutputDatum
constructor
seen by the validator | |
---|---|---|---|
TxSkelOutNoDatum | no | no | NoOutputDatum |
TxSkelOutDatumHash | yes | no | OutputDatumHash |
TxSkelOutDatum | yes | yes | OutputDatumHash |
TxSkelOutInlineDatum | yes | no | OutputDatum |
That is:
- Whenever there is a datum, we'll store it in the state of our simulated
chain. This will make it possible to retrieve it later, using functions
such as
datumFromHash
. - Both of the
TxSkelOutDatumHash
andTxSkelOutDatum
constructors will create an output that scripts see on thetxInfo
as having a datum hash. The difference is whether that hash will be resolvable using validator functions likefindDatum
.
TxSkelOutNoDatum :: TxSkelOutDatum | use no datum |
TxSkelOutDatumHash :: TxSkelOutDatumConstrs a => a -> TxSkelOutDatum | only include the hash on the transaction |
TxSkelOutDatum :: TxSkelOutDatumConstrs a => a -> TxSkelOutDatum | use a |
TxSkelOutInlineDatum :: TxSkelOutDatumConstrs a => a -> TxSkelOutDatum | use an inline datum |
Instances
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.
Pays | |
|
Instances
Monoid DoubleSatDelta Source # | |
Defined in Cooked.Attack.DoubleSat mappend :: DoubleSatDelta -> DoubleSatDelta -> DoubleSatDelta # mconcat :: [DoubleSatDelta] -> DoubleSatDelta # | |
Semigroup DoubleSatDelta Source # | |
Defined in Cooked.Attack.DoubleSat (<>) :: DoubleSatDelta -> DoubleSatDelta -> DoubleSatDelta # sconcat :: NonEmpty DoubleSatDelta -> DoubleSatDelta # stimes :: Integral b => b -> DoubleSatDelta -> DoubleSatDelta # | |
Show TxSkelOut Source # | |
Eq TxSkelOut Source # | |
txSkelOutTypedDatum :: FromData a => TxSkelOutDatum -> Maybe a Source #
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 hash, using the
TxSkelOutDatum
constructor. The resolved datum is provided in the body of
the transaction that issues the payment.
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.
paysScriptUnresolvedDatumHash :: (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 datum, whose resolved datum is not provided in the transaction body that issues the payment (as opposed to "paysScript").
paysScriptNoDatum :: Typeable a => TypedValidator a -> Value -> TxSkelOut Source #
Pays a script a certain value without any datum. Intended to be used with
withDatum
, withUnresolvedDatumHash
, 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).
withUnresolvedDatumHash :: (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, ToVersionedScript 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 Source #
Instances
EmptyRedeemer :: Redeemer | |
SomeRedeemer :: RedeemerConstrs redeemer => redeemer -> Redeemer |
data TxParameterChange where Source #
Instances
Show TxParameterChange Source # | |
Defined in Cooked.Skeleton showsPrec :: Int -> TxParameterChange -> ShowS # show :: TxParameterChange -> String # showList :: [TxParameterChange] -> ShowS # | |
Eq TxParameterChange Source # | |
Defined in Cooked.Skeleton (==) :: TxParameterChange -> TxParameterChange -> Bool # (/=) :: TxParameterChange -> TxParameterChange -> Bool # |
data TxGovAction where Source #
Instances
Show TxGovAction Source # | |
Defined in Cooked.Skeleton showsPrec :: Int -> TxGovAction -> ShowS # show :: TxGovAction -> String # showList :: [TxGovAction] -> ShowS # | |
Eq TxGovAction Source # | |
Defined in Cooked.Skeleton (==) :: TxGovAction -> TxGovAction -> Bool # (/=) :: TxGovAction -> TxGovAction -> Bool # |
data TxSkelProposal where Source #
TxSkelProposal | |
|
Instances
Show TxSkelProposal Source # | |
Defined in Cooked.Skeleton showsPrec :: Int -> TxSkelProposal -> ShowS # show :: TxSkelProposal -> String # showList :: [TxSkelProposal] -> ShowS # | |
Eq TxSkelProposal Source # | |
Defined in Cooked.Skeleton (==) :: TxSkelProposal -> TxSkelProposal -> Bool # (/=) :: TxSkelProposal -> TxSkelProposal -> Bool # |
type TxSkelWithdrawals = Map (Either (Versioned Script) PubKeyHash) (TxSkelRedeemer, Ada) Source #
Withdrawals associate either a script or a private key with a redeemer and a certain amount of ada. Note that the redeemer will be ignored in the case of a private key.
txSkelWithdrawnValue :: TxSkel -> Value Source #
pkWithdrawal :: ToPubKeyHash pkh => pkh -> Ada -> TxSkelWithdrawals Source #
scriptWithdrawal :: ToVersionedScript script => script -> TxSkelRedeemer -> Ada -> TxSkelWithdrawals Source #
TxSkel | |
|
txSkelTemplate :: TxSkel Source #
A convenience template of an empty transaction skeleton.
txSkelDataInOutputs :: TxSkel -> [(DatumHash, TxSkelOutDatum)] Source #
Return all data on transaction outputs. This can contain duplicates, which is intended.
txSkelValidatorsInOutputs :: 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.
txSkelKnownTxOutRefs :: TxSkel -> [TxOutRef] Source #
All TxOutRefs
known by a given transaction skeleton. This includes
TxOutRef`s used as inputs of the skeleton and TxOutRef
s used as reference
inputs of the skeleton. This does not include additional possible
TxOutRef
s used for balancing and additional TxOutRef
s used as collateral
inputs, as they are not part of the skeleton.
simpleTxSkelProposal :: ToAddress a => a -> TxGovAction -> TxSkelProposal Source #
withWitness :: ToVersionedScript a => TxSkelProposal -> (a, TxSkelRedeemer) -> TxSkelProposal Source #
withAnchor :: TxSkelProposal -> String -> TxSkelProposal Source #
txSkelValueInOutputs :: TxSkel -> Value Source #
Returns the full value contained in the skeleton outputs
txSkelReferenceScripts :: TxSkel -> Map ValidatorHash (Versioned Validator) Source #
All validators in the reference script field of transaction outputs
txSkelReferenceTxOutRefs :: TxSkel -> [TxOutRef] Source #
All TxOutRefs
in reference inputs
someTxSkelRedeemer :: RedeemerConstrs redeemer => redeemer -> TxSkelRedeemer Source #