From 2cdcf8261f7e5514ce9ce94ef0a054a2743a495f Mon Sep 17 00:00:00 2001 From: Koz Ross Date: Mon, 2 Oct 2023 10:12:23 +1300 Subject: [PATCH] Remove unnecessary *M functions --- CHANGELOG.md | 1 + src/Contract/ScriptLookups.purs | 13 +------------ src/Contract/Transaction.purs | 10 +--------- src/Contract/UnbalancedTx.purs | 15 +-------------- 4 files changed, 4 insertions(+), 35 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9743d7070..164869b41 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -117,6 +117,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) ### Removed +- `mkUnbalancedTxM` and `balanceTxM` - `E2E_SKIP_JQUERY_DOWNLOAD` configuration variable for [E2E test suite](./doc/e2e-testing.md). It is not needed, because it's expected value can be determined from the environment, and thus it can be an implementation detail ([#1440](https://github.com/Plutonomicon/cardano-transaction-lib/pull/1440)) - `reindexSpentScriptRedeemers` function from the public API - if there is a need to modify the `Transaction` in a way that breaks redeemer indices, it should be done before balancing ([#1462](https://github.com/Plutonomicon/cardano-transaction-lib/pull/1462)) - Typed scripts and constraints interface. In practice, it means that the following types now have no type-level arguments: `TxConstraints`, `ScriptLookups`. diff --git a/src/Contract/ScriptLookups.purs b/src/Contract/ScriptLookups.purs index 7b33c504e..f106d0afa 100644 --- a/src/Contract/ScriptLookups.purs +++ b/src/Contract/ScriptLookups.purs @@ -2,12 +2,9 @@ -- | transaction. module Contract.ScriptLookups ( mkUnbalancedTx - , mkUnbalancedTxM , module X ) where -import Prelude - import Contract.Monad (Contract) import Ctl.Internal.ProcessConstraints (mkUnbalancedTxImpl) as PC import Ctl.Internal.ProcessConstraints.Error @@ -66,8 +63,7 @@ import Ctl.Internal.Types.ScriptLookups , validatorM ) as X import Ctl.Internal.Types.TxConstraints (TxConstraints) -import Data.Either (Either, hush) -import Data.Maybe (Maybe) +import Data.Either (Either) -- | Create an `UnbalancedTx` given `ScriptLookups` and -- | `TxConstraints`. You will probably want to use this version as it returns @@ -79,10 +75,3 @@ mkUnbalancedTx -> TxConstraints -> Contract (Either MkUnbalancedTxError UnbalancedTx) mkUnbalancedTx = PC.mkUnbalancedTxImpl - --- | Same as `mkUnbalancedTx` but hushes the error. -mkUnbalancedTxM - :: ScriptLookups - -> TxConstraints - -> Contract (Maybe UnbalancedTx) -mkUnbalancedTxM lookups = map hush <<< mkUnbalancedTx lookups diff --git a/src/Contract/Transaction.purs b/src/Contract/Transaction.purs index 84e5492ef..6256dde89 100644 --- a/src/Contract/Transaction.purs +++ b/src/Contract/Transaction.purs @@ -3,7 +3,6 @@ module Contract.Transaction ( BalancedSignedTransaction(BalancedSignedTransaction) , balanceTx - , balanceTxM , balanceTxWithConstraints , balanceTxs , balanceTxsWithConstraints @@ -238,13 +237,12 @@ import Ctl.Internal.Types.VRFKeyHash import Data.Array.NonEmpty as NonEmptyArray import Data.Bifunctor (lmap) import Data.BigInt (BigInt) -import Data.Either (Either, hush) +import Data.Either (Either) import Data.Foldable (foldl, length) import Data.Generic.Rep (class Generic) import Data.Lens.Getter (view) import Data.Map (Map) import Data.Map (empty, insert) as Map -import Data.Maybe (Maybe) import Data.Newtype (class Newtype, unwrap) import Data.Show.Generic (genericShow) import Data.Traversable (class Traversable, for_, traverse) @@ -453,12 +451,6 @@ balanceTxs -> Contract (t FinalizedTransaction) balanceTxs = balanceTxsWithConstraints <<< map (flip Tuple mempty) --- | Attempts to balance an `UnbalancedTx` hushing the error. -balanceTxM - :: UnbalancedTx - -> Contract (Maybe FinalizedTransaction) -balanceTxM = map hush <<< balanceTx - balanceAndLockWithConstraints :: UnbalancedTx /\ BalanceTxConstraintsBuilder -> Contract FinalizedTransaction diff --git a/src/Contract/UnbalancedTx.purs b/src/Contract/UnbalancedTx.purs index 4f4a6851e..7d6feee55 100644 --- a/src/Contract/UnbalancedTx.purs +++ b/src/Contract/UnbalancedTx.purs @@ -2,12 +2,9 @@ -- | transaction. module Contract.UnbalancedTx ( mkUnbalancedTx - , mkUnbalancedTxM , module X ) where -import Prelude - import Contract.Monad (Contract) import Ctl.Internal.ProcessConstraints (mkUnbalancedTxImpl) as PC import Ctl.Internal.ProcessConstraints.Error @@ -49,8 +46,7 @@ import Ctl.Internal.Types.ScriptLookups ( ScriptLookups ) import Ctl.Internal.Types.TxConstraints (TxConstraints) -import Data.Either (Either, hush) -import Data.Maybe (Maybe) +import Data.Either (Either) -- | Create an `UnbalancedTx` given `ScriptLookups` and -- | `TxConstraints`. This should be called in conjuction with @@ -60,12 +56,3 @@ mkUnbalancedTx -> TxConstraints -> Contract (Either MkUnbalancedTxError UnbalancedTx) mkUnbalancedTx = PC.mkUnbalancedTxImpl - --- | Same as `mkUnbalancedTx` but hushes the error. --- TODO: remove, reason: it's trivial --- https://github.com/Plutonomicon/cardano-transaction-lib/issues/1047 -mkUnbalancedTxM - :: ScriptLookups - -> TxConstraints - -> Contract (Maybe UnbalancedTx) -mkUnbalancedTxM lookups = map hush <<< mkUnbalancedTx lookups