Skip to content

Commit

Permalink
Remove unnecessary *M functions
Browse files Browse the repository at this point in the history
  • Loading branch information
kozross committed Oct 1, 2023
1 parent d786ed7 commit 2cdcf82
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 35 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down
13 changes: 1 addition & 12 deletions src/Contract/ScriptLookups.purs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
10 changes: 1 addition & 9 deletions src/Contract/Transaction.purs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
module Contract.Transaction
( BalancedSignedTransaction(BalancedSignedTransaction)
, balanceTx
, balanceTxM
, balanceTxWithConstraints
, balanceTxs
, balanceTxsWithConstraints
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
15 changes: 1 addition & 14 deletions src/Contract/UnbalancedTx.purs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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

0 comments on commit 2cdcf82

Please sign in to comment.