@@ -63,7 +63,7 @@ import Cardano.Api (
6363 NetworkId (Mainnet ),
6464 PaymentKey ,
6565 SigningKey (PaymentSigningKey ),
66- TextEnvelope ,
66+ TextEnvelope ( TextEnvelope , teDescription , teRawCBOR , teType ) ,
6767 TextEnvelopeDescr ,
6868 TextEnvelopeError (TextEnvelopeAesonDecodeError ),
6969 deserialiseFromTextEnvelope ,
@@ -86,8 +86,8 @@ import Data.Aeson qualified as JSON
8686import Data.Aeson.Extras (encodeByteString )
8787import Data.ByteString qualified as ByteString
8888import Data.Default (Default (def ))
89- import Data.Either.Combinators (mapLeft )
90- import Data.Hex (hex )
89+ import Data.Either.Combinators (fromRight , mapLeft )
90+ import Data.Hex (hex , unhex )
9191import Data.Kind (Type )
9292import Data.List (isPrefixOf , sortOn )
9393import Data.Map (Map )
@@ -326,21 +326,21 @@ mockCallCommand ShellArgs {cmdName, cmdArgs, cmdOutParser} = do
326326 (" cardano-cli" , " transaction" : " build-raw" : args) -> do
327327 case drop 1 $ dropWhile (/= " --out-file" ) args of
328328 filepath : _ ->
329- modify @ (MockContractState w ) (files . at (Text. unpack filepath) ?~ _ )
329+ modify @ (MockContractState w ) (files . at (Text. unpack filepath) ?~ TextEnvelopeFile dummyTxRawFile )
330330 _ -> throwError @ Text " Out file argument is missing"
331331
332332 pure $ Right $ cmdOutParser " "
333333 (" cardano-cli" , " transaction" : " build" : args) -> do
334334 case drop 1 $ dropWhile (/= " --out-file" ) args of
335335 filepath : _ ->
336- modify @ (MockContractState w ) (files . at (Text. unpack filepath) ?~ _ )
336+ modify @ (MockContractState w ) (files . at (Text. unpack filepath) ?~ TextEnvelopeFile dummyTxRawFile )
337337 _ -> throwError @ Text " Out file argument is missing"
338338
339339 pure $ Right $ cmdOutParser " "
340340 (" cardano-cli" , " transaction" : " sign" : args) -> do
341341 case drop 1 $ dropWhile (/= " --out-file" ) args of
342342 filepath : _ ->
343- modify @ (MockContractState w ) (files . at (Text. unpack filepath) ?~ _ )
343+ modify @ (MockContractState w ) (files . at (Text. unpack filepath) ?~ TextEnvelopeFile dummyTxSignedFile )
344344 _ -> throwError @ Text " Out file argument is missing"
345345
346346 pure $ Right $ cmdOutParser " "
@@ -580,3 +580,19 @@ buildOutputsFromKnownUTxOs knownUtxos txId = ValidTx $ fillGaps sortedRelatedRef
580580 | n' == n = txOut : fillGaps outs (n + 1 )
581581 | otherwise = defTxOut : fillGaps (out : outs) (n + 1 )
582582 defTxOut = TxOut (Ledger. Address (PubKeyCredential " " ) Nothing ) mempty Nothing
583+
584+ dummyTxRawFile :: TextEnvelope
585+ dummyTxRawFile =
586+ TextEnvelope
587+ { teType = " TxBodyAlonzo"
588+ , teDescription = " "
589+ , teRawCBOR = fromRight (error "failed to unpack CBOR hex") $ unhex "86a500848258205d677265fa5bb21ce6d8c7502aca70b9316d10e958611f3c6b758f65ad9599960182582076ed2fcda860de2cbacd0f3a169058fa91eff47bc1e1e5b6d84497159fbc9300008258209405c89393ba84b14bf8d3e7ed4788cc6e2257831943b58338bee8d37a3668fc00825820a1be9565ccac4a04d2b5bf0d0167196ae467da0d88161c9c827fbe76452b24ef000d8182582076ed2fcda860de2cbacd0f3a169058fa91eff47bc1e1e5b6d84497159fbc930000018482581d600f45aaf1b2959db6e5ff94dbb1f823bf257680c3c723ac2d49f975461a3b8cc4a582581d600f45aaf1b2959db6e5ff94dbb1f823bf257680c3c723ac2d49f97546821a00150bd0a1581c1d6445ddeda578117f393848e685128f1e78ad0c4e48129c5964dc2ea14974657374546f6b656e1a000d062782581d606696936bb8ae24859d0c2e4d05584106601f58a5e9466282c8561b88821a00150bd0a1581c1d6445ddeda578117f393848e685128f1e78ad0c4e48129c5964dc2ea14974657374546f6b656e1282581d60981fc565bcf0c95c0cfa6ee6693875b60d529d87ed7082e9bf03c6a4821a00150bd0a1581c1d6445ddeda578117f393848e685128f1e78ad0c4e48129c5964dc2ea14974657374546f6b656e0f021a000320250e81581c0f45aaf1b2959db6e5ff94dbb1f823bf257680c3c723ac2d49f975469fff8080f5f6"
590+ }
591+
592+ dummyTxSignedFile :: TextEnvelope
593+ dummyTxSignedFile =
594+ TextEnvelope
595+ { teType = " Tx AlonzoEra"
596+ , teDescription = " "
597+ , teRawCBOR = fromRight (error "failed to unpack CBOR hex") $ unhex "84a500848258205d677265fa5bb21ce6d8c7502aca70b9316d10e958611f3c6b758f65ad9599960182582076ed2fcda860de2cbacd0f3a169058fa91eff47bc1e1e5b6d84497159fbc9300008258209405c89393ba84b14bf8d3e7ed4788cc6e2257831943b58338bee8d37a3668fc00825820a1be9565ccac4a04d2b5bf0d0167196ae467da0d88161c9c827fbe76452b24ef000d8182582076ed2fcda860de2cbacd0f3a169058fa91eff47bc1e1e5b6d84497159fbc930000018482581d600f45aaf1b2959db6e5ff94dbb1f823bf257680c3c723ac2d49f975461a3b8cc4a582581d600f45aaf1b2959db6e5ff94dbb1f823bf257680c3c723ac2d49f97546821a00150bd0a1581c1d6445ddeda578117f393848e685128f1e78ad0c4e48129c5964dc2ea14974657374546f6b656e1a000d062782581d606696936bb8ae24859d0c2e4d05584106601f58a5e9466282c8561b88821a00150bd0a1581c1d6445ddeda578117f393848e685128f1e78ad0c4e48129c5964dc2ea14974657374546f6b656e1282581d60981fc565bcf0c95c0cfa6ee6693875b60d529d87ed7082e9bf03c6a4821a00150bd0a1581c1d6445ddeda578117f393848e685128f1e78ad0c4e48129c5964dc2ea14974657374546f6b656e0f021a000320250e81581c0f45aaf1b2959db6e5ff94dbb1f823bf257680c3c723ac2d49f97546a10081825820096092b8515d75c2a2f75d6aa7c5191996755840e81deaa403dba5b690f091b65840295a93849a67cecabb8286e561c407b6bd49abf8d2da8bfb821105eae4d28ef0ef1b9ee5e8abb8fd334059f3dfc78c0a65e74057a2dc8d1d12e46842abea600ff5f6"
598+ }
0 commit comments