From 798a6b7596b4351f60bc1ecb02508fbb9292da1b Mon Sep 17 00:00:00 2001 From: Erik de Castro Lopo Date: Tue, 7 Feb 2023 13:11:22 +1100 Subject: [PATCH] wip --- lib/wallet/src/Cardano/Wallet/Write/Tx.hs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/lib/wallet/src/Cardano/Wallet/Write/Tx.hs b/lib/wallet/src/Cardano/Wallet/Write/Tx.hs index 7b5e4774126..ceb17253d0c 100644 --- a/lib/wallet/src/Cardano/Wallet/Write/Tx.hs +++ b/lib/wallet/src/Cardano/Wallet/Write/Tx.hs @@ -133,7 +133,7 @@ import Cardano.Crypto.Hash import Cardano.Ledger.Alonzo.Data ( BinaryData, Datum (..) ) import Cardano.Ledger.Alonzo.Scripts - ( Script (..) ) + ( AlonzoScript (..) ) import Cardano.Ledger.Coin ( Coin (..) ) import Cardano.Ledger.Crypto @@ -141,7 +141,7 @@ import Cardano.Ledger.Crypto import Cardano.Ledger.Era ( Crypto ) import Cardano.Ledger.Mary - ( Value ) + ( MaryValue ) import Cardano.Ledger.SafeHash ( SafeHash, extractHash, unsafeMakeSafeHash ) import Cardano.Ledger.Serialization @@ -358,6 +358,9 @@ type TxOutInBabbage = Babbage.TxOut (Babbage.BabbageEra StandardCrypto) type Address = Ledger.Addr StandardCrypto +type Script = AlonzoScript +type Value = MaryValue + unsafeAddressFromBytes :: ByteString -> Address unsafeAddressFromBytes bytes = case Ledger.deserialiseAddr bytes of Just addr -> addr @@ -397,7 +400,7 @@ scriptToCardanoScriptInAnyLang = -- will convert 'SimpleScriptV1' to 'SimpleScriptV2'. Because 'SimpleScriptV1' -- is 'ShelleyEra'-specific, and 'ShelleyEra' is not a 'RecentEra', this should -- not be a problem. -scriptToCardanoEnvelopeJSON :: Script LatestLedgerEra -> Aeson.Value +scriptToCardanoEnvelopeJSON :: AlonzoScript LatestLedgerEra -> Aeson.Value scriptToCardanoEnvelopeJSON = scriptToJSON . scriptToCardanoScriptInAnyLang where scriptToJSON @@ -419,7 +422,7 @@ scriptToCardanoEnvelopeJSON = scriptToJSON . scriptToCardanoScriptInAnyLang scriptFromCardanoEnvelopeJSON :: Aeson.Value - -> Aeson.Parser (Script LatestLedgerEra) + -> Aeson.Parser (AlonzoScript LatestLedgerEra) scriptFromCardanoEnvelopeJSON v = fmap scriptFromCardanoScriptInAnyLang $ do envelope <- Aeson.parseJSON v case textEnvelopeToScript envelope of @@ -514,9 +517,9 @@ datumHashToBytes = Crypto.hashToBytes . extractHash data TxOutInRecentEra = TxOutInRecentEra Address - (Value LatestLedgerEra) + (MaryValue LatestLedgerEra) (Datum LatestLedgerEra) - (Maybe (Script LatestLedgerEra)) + (Maybe (AlonzoScript LatestLedgerEra)) -- Same contents as 'TxOut LatestLedgerEra'. data ErrInvalidTxOutInEra