File tree Expand file tree Collapse file tree
src/Cardano/Api/Experimental
test/cardano-api-test/Test/Cardano/Api/Experimental Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -78,7 +78,9 @@ module Cardano.Api.Experimental.Tx
7878 -- 'TxBodyContent' that we defined earlier:
7979 --
8080 -- @
81- -- let (Right unsignedTx) = Exp.makeUnsignedTx era txBodyContent
81+ -- case Exp.makeUnsignedTx era txBodyContent of
82+ -- Left err -> error (show err)
83+ -- Right unsignedTx -> ...
8284 -- @
8385 --
8486 -- Next, use the key witness to sign the unsigned transaction with the 'makeKeyWitness' function:
Original file line number Diff line number Diff line change @@ -105,6 +105,7 @@ import Cardano.Api.Governance.Internal.Action.VotingProcedure
105105import Cardano.Api.Key.Internal
106106import Cardano.Api.Ledger.Internal.Reexport (StrictMaybe (.. ))
107107import Cardano.Api.Ledger.Internal.Reexport qualified as L
108+ import Cardano.Api.Monad.Error (liftMaybe )
108109import Cardano.Api.Plutus.Internal.ScriptData qualified as Api
109110import Cardano.Api.Pretty
110111import Cardano.Api.Tx.Internal.Body
@@ -288,7 +289,7 @@ convPParamsToScriptIntegrityHash mTxProtocolParams redeemers datums languages =
288289 && null languages
289290 if shouldCalculateHash
290291 then do
291- pp <- maybe ( Left MakeUnsignedTxMissingProtocolParams ) Right mTxProtocolParams
292+ pp <- liftMaybe MakeUnsignedTxMissingProtocolParams mTxProtocolParams
292293 pure $
293294 SJust $
294295 L. hashScriptIntegrity $
Original file line number Diff line number Diff line change @@ -15,12 +15,14 @@ import Cardano.Api.Experimental qualified as Exp
1515import Cardano.Api.Experimental.Era (convert )
1616import Cardano.Api.Experimental.Tx qualified as Exp
1717import Cardano.Api.Ledger qualified as L
18+ import Cardano.Api.Monad.Error (failEither )
1819
1920import Cardano.Ledger.Api qualified as UnexportedLedger
2021import Cardano.Ledger.Core qualified as L
2122import Cardano.Ledger.Mary.Value qualified as Mary
2223import Cardano.Ledger.Tools qualified as L (calcMinFeeTx )
2324
25+ import Data.Bifunctor (first )
2426import Data.Foldable (toList )
2527import Data.Map.Strict qualified as Map
2628import Data.Sequence.Strict qualified as Seq
@@ -387,9 +389,8 @@ genTinySurplusTx era = Exp.obtainCommonConstraints era $ do
387389 & Exp. setTxIns [(txIn, Exp. AnyKeyWitnessPlaceholder )]
388390 & Exp. setTxOuts [sendTxOut]
389391 & Exp. setTxFee 0
390- unsignedTx <- case Exp. makeUnsignedTx era txBodyContent of
391- Left err -> fail $ " makeUnsignedTx: " <> show err
392- Right tx -> return tx
392+ unsignedTx <-
393+ failEither . first ((" makeUnsignedTx: " <> ) . show ) $ Exp. makeUnsignedTx era txBodyContent
393394 let
394395 -- Compute F1 via case match on UnsignedTx (needed to bring EraTx into scope)
395396 L. Coin f1 = case unsignedTx of
You can’t perform that action at this time.
0 commit comments