| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Cooked.Skeleton.Withdrawal
Description
This module exposes the withdrawing constructs used in a
TxSkel and their associated utilities. To issue withdrawals
in a skeleton, the usual way is to invoke txSkelWithdrawals =
txSkelWithdrawalsFromList [pubKeyWithdrawal pk amount, scriptWithdrawal
script redeemer amount, ...]
Synopsis
- data Withdrawal where
- Withdrawal :: {..} -> Withdrawal
- data TxSkelWithdrawals
- withdrawalUserL :: Lens' Withdrawal (User 'IsEither 'Redemption)
- withdrawalMAmountL :: Lens' Withdrawal (Maybe Lovelace)
- withdrawalAmountAT :: AffineTraversal' Withdrawal Lovelace
- txSkelWithdrawalsListI :: Iso' TxSkelWithdrawals [Withdrawal]
- pubKeyWithdrawal :: (ToPubKeyHash pkh, Typeable pkh) => pkh -> Withdrawal
- scriptWithdrawal :: (ToVScript script, Typeable script, RedeemerConstrs red) => script -> red -> Withdrawal
- txSkelWithdrawalsFromList :: [Withdrawal] -> TxSkelWithdrawals
- fillAmount :: Lovelace -> Withdrawal -> Withdrawal
Data types
data Withdrawal where Source #
A single Withdrawal, owned by a pubkey or redeemed script
Constructors
| Withdrawal | |
Fields
| |
Instances
| Show Withdrawal Source # | |
Defined in Cooked.Skeleton.Withdrawal Methods showsPrec :: Int -> Withdrawal -> ShowS # show :: Withdrawal -> String # showList :: [Withdrawal] -> ShowS # | |
| PrettyCooked Withdrawal Source # | |
Defined in Cooked.Pretty.Skeleton Methods prettyCookedOpt :: PrettyCookedOpts -> Withdrawal -> DocCooked Source # prettyCooked :: Withdrawal -> DocCooked Source # | |
| Eq Withdrawal Source # | |
Defined in Cooked.Skeleton.Withdrawal | |
data TxSkelWithdrawals Source #
Withdrawals associate either a script or a private key with a redeemer and a certain amount of ada. They are uniquely identified by the hash of either.
Instances
Optics
withdrawalUserL :: Lens' Withdrawal (User 'IsEither 'Redemption) Source #
Focuses on the user owning a Withdrawal
withdrawalMAmountL :: Lens' Withdrawal (Maybe Lovelace) Source #
Focuses on the optional amount in a Withdrawal
withdrawalAmountAT :: AffineTraversal' Withdrawal Lovelace Source #
Focuses on the amount in a Withdrawal
txSkelWithdrawalsListI :: Iso' TxSkelWithdrawals [Withdrawal] Source #
Transforms a [Withdrawal] to a 'TxSkelWithdrawals and vice
versa. Accumulates amount of withdrawals with similar owners, and keep the
latest found redeemer in the case of scripts, discarding the previous ones.
Smart constructors
pubKeyWithdrawal :: (ToPubKeyHash pkh, Typeable pkh) => pkh -> Withdrawal Source #
Creates a Withdrawal from a private key hash
scriptWithdrawal :: (ToVScript script, Typeable script, RedeemerConstrs red) => script -> red -> Withdrawal Source #
Creates a Withdrawal from a redeemed script and lovelace amount
txSkelWithdrawalsFromList :: [Withdrawal] -> TxSkelWithdrawals Source #
Builds a TxSkelWithdrawals from a list of Withdrawal. This is
equivalent to calling review txSkelWithdrawalsListI
Utilities
fillAmount :: Lovelace -> Withdrawal -> Withdrawal Source #
Fills a given amount of lovelace to withdraw, if not already set