@@ -14,14 +14,11 @@ module Language.Marlowe.Runtime.Web.Common (
1414) where
1515
1616import Cardano.Api (
17- CardanoEra (.. ),
18- ShelleyBasedEra (ShelleyBasedEraBabbage ),
17+ BabbageEra ,
1918 ShelleyWitnessSigningKey (.. ),
20- TextEnvelopeCddl (.. ),
21- deserialiseTxLedgerCddl ,
19+ Tx ,
2220 getTxBody ,
2321 getTxWitnesses ,
24- serialiseWitnessLedgerCddl ,
2522 signShelleyTransaction ,
2623 )
2724import Control.Concurrent (threadDelay )
@@ -49,7 +46,7 @@ import Language.Marlowe.Runtime.Web.Client (
4946 putTransaction ,
5047 putWithdrawal ,
5148 )
52- import Language.Marlowe.Runtime.Web.Server.DTO (ToDTO (toDTO ))
49+ import Language.Marlowe.Runtime.Web.Server.DTO (FromDTO ( .. ), ToDTO (toDTO ))
5350import qualified PlutusLedgerApi.V2 as PV2
5451import Servant.Client.Streaming (ClientM )
5552
@@ -209,23 +206,9 @@ applyInputs Wallet{..} contractId inputs = do
209206 }
210207
211208signShelleyTransaction' :: Web. UnwitnessedTx -> [ShelleyWitnessSigningKey ] -> IO Web. TxWitness
212- signShelleyTransaction' Web. UnwitnessedTx {.. } wits = do
213- let te =
214- TextEnvelopeCddl
215- { teCddlType = utType
216- , teCddlDescription = utDescription
217- , teCddlRawCBOR = Web. unBase16 utCborHex
218- }
219- txBody <- case deserialiseTxLedgerCddl BabbageEra te of
220- Left err -> fail $ show err
221- Right a -> pure a
222- let witnessCddl =
223- serialiseWitnessLedgerCddl ShelleyBasedEraBabbage $
224- head $
225- getTxWitnesses $
226- signShelleyTransaction (getTxBody txBody) wits
227- pure case witnessCddl of
228- TextEnvelopeCddl ty _ bytes -> Web. TxWitness ty " " $ Web. Base16 bytes
209+ signShelleyTransaction' txEnvelope wits = do
210+ tx :: Tx BabbageEra <- expectJust " Failed to deserialise tx" $ fromDTO txEnvelope
211+ pure $ toDTO $ head $ getTxWitnesses $ signShelleyTransaction (getTxBody tx) wits
229212
230213waitUntilConfirmed :: (MonadIO m ) => (a -> Web. TxStatus ) -> m a -> m a
231214waitUntilConfirmed getStatus getResource = do
0 commit comments