Skip to content

Commit

Permalink
Add util to add stake wit with tx body
Browse files Browse the repository at this point in the history
  • Loading branch information
albertodvp committed Jul 18, 2024
1 parent 1d7ecb3 commit 90a0d10
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/base/lib/Convex/BuildTx.hs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ module Convex.BuildTx(
addInputWithTxBody,
addMintWithTxBody,
addWithdrawalWithTxBody,
addStakeWitnessWithTxBody,
addReference,
addCollateral,
addAuxScript,
Expand Down Expand Up @@ -333,6 +334,12 @@ addWithdrawalWithTxBody :: MonadBuildTx m => C.StakeAddress -> C.Quantity -> (T
addWithdrawalWithTxBody address amount f =
addTxBuilder (TxBuilder $ \body -> (over (L.txWithdrawals . L._TxWithdrawals) ((address, C.quantityToLovelace amount, C.BuildTxWith $ f body) :)))

{- | Like @addStakeWitness@ but uses a function that takes a @TxBody@ to build the witness.
-}
addStakeWitnessWithTxBody :: MonadBuildTx m => C.StakeCredential -> (TxBody -> C.Witness C.WitCtxStake C.BabbageEra) -> m ()
addStakeWitnessWithTxBody credential buildWitness =
addTxBuilder (TxBuilder $ \body -> (set (L.txCertificates . L._TxCertificates . _2 . at credential) (Just $ buildWitness body)))

{-| Spend an output locked by a public key
-}
spendPublicKeyOutput :: MonadBuildTx m => C.TxIn -> m ()
Expand Down

0 comments on commit 90a0d10

Please sign in to comment.