From c74c589951de62bd81aecab68eccafa01f0f4ae9 Mon Sep 17 00:00:00 2001 From: Pablo Lamela Date: Tue, 21 May 2024 00:40:51 +0200 Subject: [PATCH] Patch for signed transactions that are really not --- .../internal/Cardano/Api/SerialiseLedgerCddl.hs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/cardano-api/internal/Cardano/Api/SerialiseLedgerCddl.hs b/cardano-api/internal/Cardano/Api/SerialiseLedgerCddl.hs index 272cd952d6..a7906d44f3 100644 --- a/cardano-api/internal/Cardano/Api/SerialiseLedgerCddl.hs +++ b/cardano-api/internal/Cardano/Api/SerialiseLedgerCddl.hs @@ -41,7 +41,7 @@ import Cardano.Api.IO import Cardano.Api.Pretty import Cardano.Api.SerialiseTextEnvelope (TextEnvelope (..), TextEnvelopeDescr (TextEnvelopeDescr), TextEnvelopeError (..), - deserialiseFromTextEnvelope, serialiseToTextEnvelope) + deserialiseFromTextEnvelope, serialiseToTextEnvelope, HasTextEnvelope (textEnvelopeType)) import Cardano.Api.Tx.Sign import Cardano.Api.Utils @@ -129,12 +129,19 @@ deserialiseTxLedgerCddl :: forall era . ShelleyBasedEra era -> TextEnvelope -> Either TextEnvelopeError (Tx era) -deserialiseTxLedgerCddl era = shelleyBasedEraConstraints era $ - deserialiseFromTextEnvelope asType +deserialiseTxLedgerCddl era te = + shelleyBasedEraConstraints era $ + case deserialiseFromTextEnvelope asType te of + Left (TextEnvelopeTypeError _ actualType) | textEnvelopeType asTxBodyType == actualType -> + makeSignedTransaction [] <$> deserialiseFromTextEnvelope asTxBodyType te + other -> other where asType :: AsType (Tx era) asType = shelleyBasedEraConstraints era $ proxyToAsType Proxy + asTxBodyType :: AsType (TxBody era) + asTxBodyType = shelleyBasedEraConstraints era $ proxyToAsType Proxy + writeByronTxFileTextEnvelopeCddl :: File content Out -> Byron.ATxAux ByteString