Skip to content

Commit

Permalink
Patch for signed transactions that are really not
Browse files Browse the repository at this point in the history
  • Loading branch information
palas committed May 20, 2024
1 parent d4d32e4 commit c74c589
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions cardano-api/internal/Cardano/Api/SerialiseLedgerCddl.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit c74c589

Please sign in to comment.