From 66e9a342253d73ff6d495c02228ef7cd131f163a Mon Sep 17 00:00:00 2001 From: Erik de Castro Lopo Date: Thu, 16 Mar 2023 13:37:03 +1100 Subject: [PATCH] Remove some deprecation warnings --- lib/wallet/src/Cardano/Wallet/DB/Sqlite/Types.hs | 14 ++++++++------ .../src/Cardano/Wallet/Shelley/Transaction.hs | 11 +---------- 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/lib/wallet/src/Cardano/Wallet/DB/Sqlite/Types.hs b/lib/wallet/src/Cardano/Wallet/DB/Sqlite/Types.hs index c17459b85bd..da6d564913f 100644 --- a/lib/wallet/src/Cardano/Wallet/DB/Sqlite/Types.hs +++ b/lib/wallet/src/Cardano/Wallet/DB/Sqlite/Types.hs @@ -8,9 +8,6 @@ {-# OPTIONS_GHC -fno-warn-orphans #-} --- TODO: https://input-output.atlassian.net/browse/ADP-2841 -{-# OPTIONS_GHC -fno-warn-deprecations #-} - -- | -- Copyright: © 2018-2020 IOHK -- License: Apache-2.0 @@ -112,7 +109,7 @@ import Data.Text.Encoding import Data.Time.Clock.POSIX ( POSIXTime, posixSecondsToUTCTime, utcTimeToPOSIXSeconds ) import Data.Time.Format - ( defaultTimeLocale, formatTime, iso8601DateFormat, parseTimeM ) + ( defaultTimeLocale, formatTime, parseTimeM ) import Data.Word ( Word32, Word64 ) import Data.Word.Odd @@ -710,12 +707,12 @@ instance PersistFieldSql TxScriptValidity where instance PersistField POSIXTime where toPersistValue = PersistText . T.pack - . formatTime defaultTimeLocale (iso8601DateFormat (Just "%H:%M:%S")) + . formatTime defaultTimeLocale iso8601DateFormatHMS . posixSecondsToUTCTime fromPersistValue (PersistText time) = utcTimeToPOSIXSeconds <$> getEitherText (parseTimeM True defaultTimeLocale - (iso8601DateFormat (Just "%H:%M:%S")) (T.unpack time)) + iso8601DateFormatHMS (T.unpack time)) fromPersistValue _ = Left "Could not parse POSIX time value" @@ -751,3 +748,8 @@ instance PersistField BlockHeight where instance PersistFieldSql BlockHeight where sqlType _ = sqlType (Proxy @Word32) + +iso8601DateFormatHMS :: String +-- Equivalent to `iso8601DateFormatHMS (Just "%H:%M:%S")` +-- The function `iso8601DateFormatHMS` has been deprecated from the `time` library. +iso8601DateFormatHMS = "%Y-%m-%d %H:%M:%S" diff --git a/lib/wallet/src/Cardano/Wallet/Shelley/Transaction.hs b/lib/wallet/src/Cardano/Wallet/Shelley/Transaction.hs index 49d9e594f63..215488199d0 100644 --- a/lib/wallet/src/Cardano/Wallet/Shelley/Transaction.hs +++ b/lib/wallet/src/Cardano/Wallet/Shelley/Transaction.hs @@ -24,9 +24,6 @@ {-# LANGUAGE ViewPatterns #-} {- HLINT ignore "Use <$>" -} --- TODO: https://input-output.atlassian.net/browse/ADP-2841 -{-# OPTIONS_GHC -fno-warn-deprecations #-} - -- | -- Copyright: © 2020 IOHK -- License: Apache-2.0 @@ -2427,14 +2424,8 @@ mkUnsignedTx -> Map AssetId (Script KeyHash) -> Map TxIn (Script KeyHash) -> Either ErrMkTransaction (Cardano.TxBody era) --- mkUnsignedTx --- era ttl cs md wdrls certs fees mintData burnData mintingScripts inpsScripts = --- left toErrMkTx $ fmap removeDummyInput $ Cardano.createAndValidateTransactionBody mkUnsignedTx era ttl cs md wdrls certs fees mintData burnData mintingScripts inpsScripts = extractValidatedOutputs cs >>= \outs -> - left toErrMkTx $ fmap removeDummyInput $ Cardano.makeTransactionBody --- mkUnsignedTx --- era ttl cs md wdrls certs fees mintData burnData mintingScripts inpsScripts = --- left toErrMkTx $ fmap removeDummyInput $ Cardano.createAndValidateTransactionBody + left toErrMkTx $ fmap removeDummyInput $ Cardano.createAndValidateTransactionBody Cardano.TxBodyContent { Cardano.txIns = inputWits