diff --git a/.stylish-haskell.yaml b/.stylish-haskell.yaml index 338d40ed254..8ce290d3c8c 100644 --- a/.stylish-haskell.yaml +++ b/.stylish-haskell.yaml @@ -4,7 +4,7 @@ # https://github.com/jaspervdj/stylish-haskell/blob/master/data/stylish-haskell.yaml # for usage. -columns: 80 # Should match .editorconfig +columns: 1 # Force diff-friendly import style (one line per symbol). steps: - imports: align: none diff --git a/lib/address-derivation-discovery/lib/Cardano/Byron/Codec/Cbor.hs b/lib/address-derivation-discovery/lib/Cardano/Byron/Codec/Cbor.hs index 296ccb2a9ed..0377f14fd29 100644 --- a/lib/address-derivation-discovery/lib/Cardano/Byron/Codec/Cbor.hs +++ b/lib/address-derivation-discovery/lib/Cardano/Byron/Codec/Cbor.hs @@ -44,39 +44,62 @@ module Cardano.Byron.Codec.Cbor import Prelude import Cardano.Address.Derivation - ( XPub, xpubToBytes ) + ( XPub + , xpubToBytes + ) import Cardano.Wallet.Address.Derivation - ( Depth (..), DerivationType (..), Index (..) ) + ( Depth (..) + , DerivationType (..) + , Index (..) + ) import Cardano.Wallet.Primitive.Passphrase - ( Passphrase (..) ) + ( Passphrase (..) + ) import Cardano.Wallet.Primitive.Types.Address - ( Address (..) ) + ( Address (..) + ) import Cardano.Wallet.Primitive.Types.Hash - ( Hash (..) ) + ( Hash (..) + ) import Cardano.Wallet.Primitive.Types.ProtocolMagic - ( ProtocolMagic (..) ) + ( ProtocolMagic (..) + ) import Cardano.Wallet.Primitive.Types.Tx - ( unsafeCoinToTxOutCoinValue ) + ( unsafeCoinToTxOutCoinValue + ) import Cardano.Wallet.Primitive.Types.Tx.TxIn - ( TxIn (..) ) + ( TxIn (..) + ) import Cardano.Wallet.Primitive.Types.Tx.TxOut - ( TxOut (..) ) + ( TxOut (..) + ) import Control.Monad - ( replicateM, when ) + ( replicateM + , when + ) import Crypto.Error - ( CryptoError (..), CryptoFailable (..) ) + ( CryptoError (..) + , CryptoFailable (..) + ) import Crypto.Hash - ( hash ) + ( hash + ) import Crypto.Hash.Algorithms - ( Blake2b_224, SHA3_256 ) + ( Blake2b_224 + , SHA3_256 + ) import Data.ByteString - ( ByteString ) + ( ByteString + ) import Data.Digest.CRC32 - ( crc32 ) + ( crc32 + ) import Data.Either.Extra - ( eitherToMaybe ) + ( eitherToMaybe + ) import Data.Word - ( Word8 ) + ( Word8 + ) import qualified Cardano.Wallet.Primitive.Types.Coin as Coin import qualified Cardano.Wallet.Primitive.Types.TokenBundle as TokenBundle diff --git a/lib/address-derivation-discovery/lib/Cardano/Wallet/Address/Book.hs b/lib/address-derivation-discovery/lib/Cardano/Wallet/Address/Book.hs index 404f04d193d..af5fc9ec3ce 100644 --- a/lib/address-derivation-discovery/lib/Cardano/Wallet/Address/Book.hs +++ b/lib/address-derivation-discovery/lib/Cardano/Wallet/Address/Book.hs @@ -37,19 +37,29 @@ import Cardano.Wallet.Address.Derivation import Cardano.Wallet.Address.Derivation.Shared () import Cardano.Wallet.Address.Derivation.SharedKey - ( SharedKey (..) ) + ( SharedKey (..) + ) import Cardano.Wallet.Primitive.Types.Address - ( Address, AddressState (..) ) + ( Address + , AddressState (..) + ) import Control.Lens - ( Iso', iso, withIso ) + ( Iso' + , iso + , withIso + ) import Data.Kind - ( Type ) + ( Type + ) import Data.Map.Strict - ( Map ) + ( Map + ) import Data.Type.Equality - ( type (==) ) + ( type (==) + ) import Fmt - ( Buildable (..) ) + ( Buildable (..) + ) import qualified Cardano.Wallet.Address.Discovery.Random as Rnd import qualified Cardano.Wallet.Address.Discovery.Sequential as Seq diff --git a/lib/address-derivation-discovery/lib/Cardano/Wallet/Address/Derivation.hs b/lib/address-derivation-discovery/lib/Cardano/Wallet/Address/Derivation.hs index 1dceacb8d48..6bbc0dd2059 100644 --- a/lib/address-derivation-discovery/lib/Cardano/Wallet/Address/Derivation.hs +++ b/lib/address-derivation-discovery/lib/Cardano/Wallet/Address/Derivation.hs @@ -80,47 +80,74 @@ module Cardano.Wallet.Address.Derivation import Prelude import Cardano.Address.Derivation - ( XPrv, XPub ) + ( XPrv + , XPub + ) import Cardano.Mnemonic - ( SomeMnemonic ) + ( SomeMnemonic + ) import Cardano.Wallet.Primitive.NetworkId - ( HasSNetworkId (..), SNetworkId ) + ( HasSNetworkId (..) + , SNetworkId + ) import Cardano.Wallet.Primitive.Passphrase.Types - ( Passphrase (..) ) + ( Passphrase (..) + ) import Cardano.Wallet.Primitive.Types.Address - ( Address (..) ) + ( Address (..) + ) import Cardano.Wallet.Primitive.Types.RewardAccount - ( RewardAccount (..) ) + ( RewardAccount (..) + ) import Control.Applicative - ( (<|>) ) + ( (<|>) + ) import Control.DeepSeq - ( NFData ) + ( NFData + ) import Control.Monad - ( (>=>) ) + ( (>=>) + ) import Data.Bifunctor - ( first ) + ( first + ) import Data.Bits - ( (.&.) ) + ( (.&.) + ) import Data.ByteArray - ( ByteArray, ByteArrayAccess ) + ( ByteArray + , ByteArrayAccess + ) import Data.ByteArray.Encoding - ( Base (..), convertFromBase, convertToBase ) + ( Base (..) + , convertFromBase + , convertToBase + ) import Data.ByteString - ( ByteString ) + ( ByteString + ) import Data.Kind - ( Type ) + ( Type + ) import Data.List.NonEmpty - ( NonEmpty (..) ) + ( NonEmpty (..) + ) import Data.Maybe - ( fromMaybe ) + ( fromMaybe + ) import Data.Proxy - ( Proxy (..) ) + ( Proxy (..) + ) import Data.Scientific - ( Scientific, toBoundedInteger ) + ( Scientific + , toBoundedInteger + ) import Data.String - ( fromString ) + ( fromString + ) import Data.Text - ( Text ) + ( Text + ) import Data.Text.Class ( CaseStyle (..) , FromText (..) @@ -130,23 +157,36 @@ import Data.Text.Class , toTextFromBoundedEnum ) import Data.Type.Equality - ( (:~:) (..), testEquality ) + ( (:~:) (..) + , testEquality + ) import Data.Word - ( Word32, Word8 ) + ( Word32 + , Word8 + ) import Fmt - ( Buildable (..) ) + ( Buildable (..) + ) import GHC.Generics - ( Generic ) + ( Generic + ) import GHC.Stack - ( HasCallStack ) + ( HasCallStack + ) import GHC.TypeLits - ( Symbol ) + ( Symbol + ) import Quiet - ( Quiet (..) ) + ( Quiet (..) + ) import Safe - ( readMay, toEnumMay ) + ( readMay + , toEnumMay + ) import Type.Reflection - ( Typeable, typeRep ) + ( Typeable + , typeRep + ) import qualified Data.ByteString as BS import qualified Data.Text as T diff --git a/lib/address-derivation-discovery/lib/Cardano/Wallet/Address/Derivation/Byron.hs b/lib/address-derivation-discovery/lib/Cardano/Wallet/Address/Derivation/Byron.hs index a39d464acd5..eb6997be7cd 100644 --- a/lib/address-derivation-discovery/lib/Cardano/Wallet/Address/Derivation/Byron.hs +++ b/lib/address-derivation-discovery/lib/Cardano/Wallet/Address/Derivation/Byron.hs @@ -56,7 +56,10 @@ import Cardano.Crypto.Wallet , unXPub ) import Cardano.Mnemonic - ( SomeMnemonic (..), entropyToBytes, mnemonicToEntropy ) + ( SomeMnemonic (..) + , entropyToBytes + , mnemonicToEntropy + ) import Cardano.Wallet.Address.Derivation ( Depth (..) , DerivationType (..) @@ -67,31 +70,45 @@ import Cardano.Wallet.Address.Derivation , PaymentAddress (..) ) import Cardano.Wallet.Primitive.NetworkId - ( SNetworkId (..) ) + ( SNetworkId (..) + ) import Cardano.Wallet.Primitive.Passphrase - ( Passphrase (..) ) + ( Passphrase (..) + ) import Cardano.Wallet.Primitive.Types.Address - ( Address (..) ) + ( Address (..) + ) import Cardano.Wallet.Primitive.Types.ProtocolMagic - ( magicSNetworkId ) + ( magicSNetworkId + ) import Control.DeepSeq - ( NFData ) + ( NFData + ) import Control.Lens - ( Lens, lens ) + ( Lens + , lens + ) import Crypto.Hash.Algorithms - ( SHA512 (..) ) + ( SHA512 (..) + ) import Crypto.Hash.Extra - ( blake2b256 ) + ( blake2b256 + ) import Data.ByteArray - ( ScrubbedBytes ) + ( ScrubbedBytes + ) import Data.ByteString - ( ByteString ) + ( ByteString + ) import Data.Kind - ( Type ) + ( Type + ) import Data.Proxy - ( Proxy (..) ) + ( Proxy (..) + ) import GHC.Generics - ( Generic ) + ( Generic + ) import qualified Cardano.Byron.Codec.Cbor as CBOR import qualified Cardano.Wallet.Address.Derivation as W diff --git a/lib/address-derivation-discovery/lib/Cardano/Wallet/Address/Derivation/Icarus.hs b/lib/address-derivation-discovery/lib/Cardano/Wallet/Address/Derivation/Icarus.hs index b163bd69745..f2b0e68deef 100644 --- a/lib/address-derivation-discovery/lib/Cardano/Wallet/Address/Derivation/Icarus.hs +++ b/lib/address-derivation-discovery/lib/Cardano/Wallet/Address/Derivation/Icarus.hs @@ -44,7 +44,11 @@ import Cardano.Crypto.Wallet , xprv ) import Cardano.Mnemonic - ( SomeMnemonic (..), entropyToBytes, mnemonicToEntropy, mnemonicToText ) + ( SomeMnemonic (..) + , entropyToBytes + , mnemonicToEntropy + , mnemonicToText + ) import Cardano.Wallet.Address.Derivation ( Depth (..) , DerivationType (..) @@ -62,9 +66,14 @@ import Cardano.Wallet.Address.Derivation , paymentAddressS ) import Cardano.Wallet.Address.Discovery - ( GetPurpose (..), IsOurs (..) ) + ( GetPurpose (..) + , IsOurs (..) + ) import Cardano.Wallet.Address.Discovery.Sequential - ( SeqState, coinTypeAda, purposeBIP44 ) + ( SeqState + , coinTypeAda + , purposeBIP44 + ) import Cardano.Wallet.Primitive.NetworkId ( HasSNetworkId , NetworkDiscriminant @@ -72,41 +81,65 @@ import Cardano.Wallet.Primitive.NetworkId , SNetworkId (..) ) import Cardano.Wallet.Primitive.Passphrase - ( Passphrase (..) ) + ( Passphrase (..) + ) import Cardano.Wallet.Primitive.Types.Address - ( Address (..) ) + ( Address (..) + ) import Cardano.Wallet.Primitive.Types.ProtocolMagic - ( magicSNetworkId ) + ( magicSNetworkId + ) import Control.Arrow - ( first, left ) + ( first + , left + ) import Control.DeepSeq - ( NFData (..) ) + ( NFData (..) + ) import Control.Lens - ( Iso, iso ) + ( Iso + , iso + ) import Control.Monad - ( (<=<) ) + ( (<=<) + ) import Crypto.Error - ( eitherCryptoError ) + ( eitherCryptoError + ) import Crypto.Hash.Algorithms - ( SHA256 (..), SHA512 (..) ) + ( SHA256 (..) + , SHA512 (..) + ) import Crypto.MAC.HMAC - ( HMAC, hmac ) + ( HMAC + , hmac + ) import Data.Bifunctor - ( bimap ) + ( bimap + ) import Data.Bits - ( clearBit, setBit, testBit ) + ( clearBit + , setBit + , testBit + ) import Data.ByteString - ( ByteString ) + ( ByteString + ) import Data.Coerce - ( coerce ) + ( coerce + ) import Data.Function - ( (&) ) + ( (&) + ) import Data.Maybe - ( fromMaybe ) + ( fromMaybe + ) import Data.Proxy - ( Proxy (..) ) + ( Proxy (..) + ) import GHC.Generics - ( Generic ) + ( Generic + ) import qualified Cardano.Byron.Codec.Cbor as CBOR import qualified Cardano.Crypto.Wallet as CC diff --git a/lib/address-derivation-discovery/lib/Cardano/Wallet/Address/Derivation/MintBurn.hs b/lib/address-derivation-discovery/lib/Cardano/Wallet/Address/Derivation/MintBurn.hs index 11e08cf5628..1d985ceccad 100644 --- a/lib/address-derivation-discovery/lib/Cardano/Wallet/Address/Derivation/MintBurn.hs +++ b/lib/address-derivation-discovery/lib/Cardano/Wallet/Address/Derivation/MintBurn.hs @@ -34,15 +34,20 @@ module Cardano.Wallet.Address.Derivation.MintBurn import Prelude import Cardano.Address.Derivation - ( XPrv ) + ( XPrv + ) import Cardano.Address.Script - ( Script (..) ) + ( Script (..) + ) import Cardano.Crypto.Wallet - ( deriveXPrv ) + ( deriveXPrv + ) import Cardano.Crypto.Wallet.Types - ( DerivationScheme (DerivationScheme2) ) + ( DerivationScheme (DerivationScheme2) + ) import Cardano.Slotting.Slot - ( SlotNo (..) ) + ( SlotNo (..) + ) import Cardano.Wallet.Address.Derivation ( Depth (..) , DerivationIndex (..) @@ -51,19 +56,27 @@ import Cardano.Wallet.Address.Derivation , getIndex ) import Cardano.Wallet.Address.Discovery - ( coinTypeAda ) + ( coinTypeAda + ) import Cardano.Wallet.Primitive.Passphrase - ( Passphrase (..) ) + ( Passphrase (..) + ) import Data.IntCast - ( intCast ) + ( intCast + ) import Data.Interval - ( Interval, (<=..<=) ) + ( Interval + , (<=..<=) + ) import Data.List.NonEmpty - ( NonEmpty ) + ( NonEmpty + ) import Data.Word - ( Word64 ) + ( Word64 + ) import Numeric.Natural - ( Natural ) + ( Natural + ) import qualified Data.Interval as I import qualified Data.List as L diff --git a/lib/address-derivation-discovery/lib/Cardano/Wallet/Address/Derivation/Shared.hs b/lib/address-derivation-discovery/lib/Cardano/Wallet/Address/Derivation/Shared.hs index 19943fbab91..eb399a50017 100644 --- a/lib/address-derivation-discovery/lib/Cardano/Wallet/Address/Derivation/Shared.hs +++ b/lib/address-derivation-discovery/lib/Cardano/Wallet/Address/Derivation/Shared.hs @@ -34,11 +34,17 @@ module Cardano.Wallet.Address.Derivation.Shared import Prelude import Cardano.Address.Derivation - ( xpubPublicKey ) + ( xpubPublicKey + ) import Cardano.Crypto.Wallet - ( XPrv, XPub, unXPub, xpub ) + ( XPrv + , XPub + , unXPub + , xpub + ) import Cardano.Mnemonic - ( SomeMnemonic ) + ( SomeMnemonic + ) import Cardano.Wallet.Address.Derivation ( AddressParts (..) , Depth (..) @@ -54,7 +60,9 @@ import Cardano.Wallet.Address.Derivation , toAddressParts ) import Cardano.Wallet.Address.Derivation.SharedKey - ( SharedKey (..), purposeCIP1854 ) + ( SharedKey (..) + , purposeCIP1854 + ) import Cardano.Wallet.Address.Derivation.Shelley ( deriveAccountPrivateKeyShelley , deriveAddressPrivateKeyShelley @@ -62,25 +70,35 @@ import Cardano.Wallet.Address.Derivation.Shelley , unsafeGenerateKeyFromSeedShelley ) import Cardano.Wallet.Address.Discovery - ( GetPurpose (..) ) + ( GetPurpose (..) + ) import Cardano.Wallet.Primitive.NetworkId - ( NetworkDiscriminant ) + ( NetworkDiscriminant + ) import Cardano.Wallet.Primitive.Passphrase.Types - ( Passphrase (..) ) + ( Passphrase (..) + ) import Cardano.Wallet.Primitive.Types.Address - ( Address (..) ) + ( Address (..) + ) import Control.Monad - ( (<=<) ) + ( (<=<) + ) import Crypto.Hash.Algorithms - ( Blake2b_224 (..) ) + ( Blake2b_224 (..) + ) import Crypto.Hash.Extra - ( blake2b224 ) + ( blake2b224 + ) import Crypto.Hash.IO - ( HashAlgorithm (hashDigestSize) ) + ( HashAlgorithm (hashDigestSize) + ) import Data.ByteString - ( ByteString ) + ( ByteString + ) import Data.Proxy - ( Proxy (..) ) + ( Proxy (..) + ) import qualified Data.ByteString as BS diff --git a/lib/address-derivation-discovery/lib/Cardano/Wallet/Address/Derivation/SharedKey.hs b/lib/address-derivation-discovery/lib/Cardano/Wallet/Address/Derivation/SharedKey.hs index 281cab322d1..2765fdc9d4d 100644 --- a/lib/address-derivation-discovery/lib/Cardano/Wallet/Address/Derivation/SharedKey.hs +++ b/lib/address-derivation-discovery/lib/Cardano/Wallet/Address/Derivation/SharedKey.hs @@ -32,27 +32,52 @@ module Cardano.Wallet.Address.Derivation.SharedKey import Prelude import Cardano.Address.Script - ( Cosigner, KeyHash, Script (..), ScriptTemplate (..), toScriptHash ) + ( Cosigner + , KeyHash + , Script (..) + , ScriptTemplate (..) + , toScriptHash + ) import Cardano.Address.Style.Shared - ( deriveAddressPublicKey, deriveDelegationPublicKey, hashKey, liftXPub ) + ( deriveAddressPublicKey + , deriveDelegationPublicKey + , hashKey + , liftXPub + ) import Cardano.Address.Style.Shelley - ( Credential (..), delegationAddress, paymentAddress ) + ( Credential (..) + , delegationAddress + , paymentAddress + ) import Cardano.Wallet.Address.Derivation - ( Depth (..), DerivationType (..), Index (..), Role (..) ) + ( Depth (..) + , DerivationType (..) + , Index (..) + , Role (..) + ) import Cardano.Wallet.Primitive.NetworkId - ( HasSNetworkId (sNetworkId), SNetworkId (..) ) + ( HasSNetworkId (sNetworkId) + , SNetworkId (..) + ) import Cardano.Wallet.Primitive.Types.Address - ( Address (..) ) + ( Address (..) + ) import Control.DeepSeq - ( NFData (..) ) + ( NFData (..) + ) import Control.Lens - ( Iso, iso ) + ( Iso + , iso + ) import Data.Maybe - ( fromJust ) + ( fromJust + ) import GHC.Generics - ( Generic ) + ( Generic + ) import GHC.Stack - ( HasCallStack ) + ( HasCallStack + ) import qualified Cardano.Address as CA import qualified Cardano.Address.Derivation as CA diff --git a/lib/address-derivation-discovery/lib/Cardano/Wallet/Address/Derivation/Shelley.hs b/lib/address-derivation-discovery/lib/Cardano/Wallet/Address/Derivation/Shelley.hs index 7c465cf520d..6df1270fa78 100644 --- a/lib/address-derivation-discovery/lib/Cardano/Wallet/Address/Derivation/Shelley.hs +++ b/lib/address-derivation-discovery/lib/Cardano/Wallet/Address/Derivation/Shelley.hs @@ -54,7 +54,10 @@ import Cardano.Crypto.Wallet , xpub ) import Cardano.Mnemonic - ( SomeMnemonic (..), entropyToBytes, mnemonicToEntropy ) + ( SomeMnemonic (..) + , entropyToBytes + , mnemonicToEntropy + ) import Cardano.Wallet.Address.Derivation ( AccountIxForStaking (..) , AddressParts (..) @@ -79,7 +82,9 @@ import Cardano.Wallet.Address.Derivation , toAddressParts ) import Cardano.Wallet.Address.Discovery - ( GetPurpose (..), IsOurs (..) ) + ( GetPurpose (..) + , IsOurs (..) + ) import Cardano.Wallet.Address.Discovery.Sequential ( DerivationPrefix (..) , SeqState (..) @@ -94,31 +99,50 @@ import Cardano.Wallet.Primitive.NetworkId , networkDiscriminantBits ) import Cardano.Wallet.Primitive.Passphrase - ( Passphrase (..) ) + ( Passphrase (..) + ) import Cardano.Wallet.Primitive.Types.Address - ( Address (..) ) + ( Address (..) + ) import Control.DeepSeq - ( NFData (..) ) + ( NFData (..) + ) import Control.Lens - ( Iso, iso, over, (^.) ) + ( Iso + , iso + , over + , (^.) + ) import Control.Monad - ( guard, (<=<) ) + ( guard + , (<=<) + ) import Crypto.Hash.Algorithms - ( Blake2b_224 (..) ) + ( Blake2b_224 (..) + ) import Crypto.Hash.Extra - ( blake2b224 ) + ( blake2b224 + ) import Crypto.Hash.IO - ( HashAlgorithm (hashDigestSize) ) + ( HashAlgorithm (hashDigestSize) + ) import Data.Binary.Put - ( putByteString, putWord8, runPut ) + ( putByteString + , putWord8 + , runPut + ) import Data.ByteString - ( ByteString ) + ( ByteString + ) import Data.Maybe - ( fromMaybe ) + ( fromMaybe + ) import Data.Proxy - ( Proxy (..) ) + ( Proxy (..) + ) import GHC.Generics - ( Generic ) + ( Generic + ) import qualified Data.ByteArray as BA import qualified Data.ByteString as BS diff --git a/lib/address-derivation-discovery/lib/Cardano/Wallet/Address/Discovery.hs b/lib/address-derivation-discovery/lib/Cardano/Wallet/Address/Discovery.hs index 35f535bff13..c11245a6f30 100644 --- a/lib/address-derivation-discovery/lib/Cardano/Wallet/Address/Discovery.hs +++ b/lib/address-derivation-discovery/lib/Cardano/Wallet/Address/Discovery.hs @@ -39,7 +39,8 @@ module Cardano.Wallet.Address.Discovery import Prelude import Cardano.Crypto.Wallet - ( XPub ) + ( XPub + ) import Cardano.Wallet.Address.Derivation ( Depth (..) , DerivationIndex (..) @@ -48,15 +49,21 @@ import Cardano.Wallet.Address.Derivation , KeyFingerprint (..) ) import Cardano.Wallet.Primitive.Types.Address - ( Address (..), AddressState (..) ) + ( Address (..) + , AddressState (..) + ) import Control.DeepSeq - ( NFData ) + ( NFData + ) import Data.Kind - ( Type ) + ( Type + ) import Data.List.NonEmpty - ( NonEmpty ) + ( NonEmpty + ) import GHC.Generics - ( Generic ) + ( Generic + ) import qualified Cardano.Wallet.Address.Pool as AddressPool import qualified Data.List as L diff --git a/lib/address-derivation-discovery/lib/Cardano/Wallet/Address/Discovery/Random.hs b/lib/address-derivation-discovery/lib/Cardano/Wallet/Address/Discovery/Random.hs index 7e69db92e64..ab1deedbae7 100644 --- a/lib/address-derivation-discovery/lib/Cardano/Wallet/Address/Discovery/Random.hs +++ b/lib/address-derivation-discovery/lib/Cardano/Wallet/Address/Discovery/Random.hs @@ -47,9 +47,14 @@ module Cardano.Wallet.Address.Discovery.Random import Prelude import Cardano.Address.Derivation - ( XPrv, toXPub ) + ( XPrv + , toXPub + ) import Cardano.Byron.Codec.Cbor - ( decodeAddressDerivationPath, decodeAddressPayload, deserialiseCbor ) + ( decodeAddressDerivationPath + , decodeAddressPayload + , deserialiseCbor + ) import Cardano.Wallet.Address.Derivation ( Depth (..) , DerivationIndex (..) @@ -71,31 +76,52 @@ import Cardano.Wallet.Address.Discovery , KnownAddresses (..) ) import Cardano.Wallet.Primitive.NetworkId - ( HasSNetworkId, NetworkDiscriminant ) + ( HasSNetworkId + , NetworkDiscriminant + ) import Cardano.Wallet.Primitive.Passphrase - ( Passphrase (..) ) + ( Passphrase (..) + ) import Cardano.Wallet.Primitive.Types.Address - ( Address (..), AddressState (..) ) + ( Address (..) + , AddressState (..) + ) import Cardano.Wallet.Primitive.Types.RewardAccount - ( RewardAccount ) + ( RewardAccount + ) import Control.DeepSeq - ( NFData (..) ) + ( NFData (..) + ) import Control.Lens - ( over ) + ( over + ) import Control.Monad - ( join ) + ( join + ) import Data.List.NonEmpty - ( NonEmpty (..) ) + ( NonEmpty (..) + ) import Data.Map - ( Map ) + ( Map + ) import Data.Set - ( Set ) + ( Set + ) import Fmt - ( Buildable (..), blockMapF', indentF, tupleF ) + ( Buildable (..) + , blockMapF' + , indentF + , tupleF + ) import GHC.Generics - ( Generic ) + ( Generic + ) import System.Random - ( RandomGen, StdGen, mkStdGen, randomR ) + ( RandomGen + , StdGen + , mkStdGen + , randomR + ) import qualified Data.List.NonEmpty as NE import qualified Data.Map as Map diff --git a/lib/address-derivation-discovery/lib/Cardano/Wallet/Address/Discovery/Sequential.hs b/lib/address-derivation-discovery/lib/Cardano/Wallet/Address/Discovery/Sequential.hs index 2e223397909..ae92586eb21 100644 --- a/lib/address-derivation-discovery/lib/Cardano/Wallet/Address/Discovery/Sequential.hs +++ b/lib/address-derivation-discovery/lib/Cardano/Wallet/Address/Discovery/Sequential.hs @@ -69,11 +69,16 @@ module Cardano.Wallet.Address.Discovery.Sequential import Prelude import Cardano.Address.Derivation - ( XPrv, xpubPublicKey ) + ( XPrv + , xpubPublicKey + ) import Cardano.Address.Script - ( Cosigner (..), ScriptTemplate (..) ) + ( Cosigner (..) + , ScriptTemplate (..) + ) import Cardano.Crypto.Wallet - ( XPub ) + ( XPub + ) import Cardano.Wallet.Address.Derivation ( AddressParts (..) , Depth (..) @@ -107,41 +112,71 @@ import Cardano.Wallet.Address.Discovery , pendingIxsToList ) import Cardano.Wallet.Primitive.NetworkId - ( HasSNetworkId (..), NetworkDiscriminant, NetworkDiscriminantCheck (..) ) + ( HasSNetworkId (..) + , NetworkDiscriminant + , NetworkDiscriminantCheck (..) + ) import Cardano.Wallet.Primitive.Passphrase - ( Passphrase ) + ( Passphrase + ) import Cardano.Wallet.Primitive.Types.Address - ( Address (..), AddressState (..) ) + ( Address (..) + , AddressState (..) + ) import Codec.Binary.Encoding - ( AbstractEncoding (..), encode ) + ( AbstractEncoding (..) + , encode + ) import Control.Applicative - ( (<|>) ) + ( (<|>) + ) import Control.DeepSeq - ( NFData (..), deepseq ) + ( NFData (..) + , deepseq + ) import Control.Monad - ( unless ) + ( unless + ) import Data.Bifunctor - ( first ) + ( first + ) import Data.Kind - ( Type ) + ( Type + ) import Data.List.NonEmpty - ( NonEmpty (..) ) + ( NonEmpty (..) + ) import Data.Proxy - ( Proxy (..) ) + ( Proxy (..) + ) import Data.Text - ( Text ) + ( Text + ) import Data.Text.Class - ( FromText (..), TextDecodingError (..), ToText (..) ) + ( FromText (..) + , TextDecodingError (..) + , ToText (..) + ) import Data.Text.Read - ( decimal ) + ( decimal + ) import Data.Word - ( Word32 ) + ( Word32 + ) import Fmt - ( Buildable (..), blockListF', hexF, indentF, prefixF, suffixF ) + ( Buildable (..) + , blockListF' + , hexF + , indentF + , prefixF + , suffixF + ) import GHC.Generics - ( Generic ) + ( Generic + ) import Type.Reflection - ( Typeable ) + ( Typeable + ) import qualified Cardano.Wallet.Address.Pool as AddressPool import qualified Data.List as L diff --git a/lib/address-derivation-discovery/lib/Cardano/Wallet/Address/Discovery/Shared.hs b/lib/address-derivation-discovery/lib/Cardano/Wallet/Address/Discovery/Shared.hs index 560df5454a7..b952e9411f3 100644 --- a/lib/address-derivation-discovery/lib/Cardano/Wallet/Address/Discovery/Shared.hs +++ b/lib/address-derivation-discovery/lib/Cardano/Wallet/Address/Discovery/Shared.hs @@ -59,9 +59,14 @@ import Cardano.Address.Script , toScriptHash ) import Cardano.Address.Style.Shelley - ( Credential (..), delegationAddress, paymentAddress ) + ( Credential (..) + , delegationAddress + , paymentAddress + ) import Cardano.Crypto.Wallet - ( XPrv, XPub ) + ( XPrv + , XPub + ) import Cardano.Wallet.Address.Derivation ( AccountIxForStaking (..) , AddressParts (..) @@ -84,9 +89,13 @@ import Cardano.Wallet.Address.Derivation , utxoInternal ) import Cardano.Wallet.Address.Derivation.Shared - ( SharedKey ) + ( SharedKey + ) import Cardano.Wallet.Address.Derivation.SharedKey - ( constructAddressFromIx, replaceCosignersWithVerKeys, toNetworkTag ) + ( constructAddressFromIx + , replaceCosignersWithVerKeys + , toNetworkTag + ) import Cardano.Wallet.Address.Discovery ( CompareDiscovery (..) , GenChange (..) @@ -98,39 +107,63 @@ import Cardano.Wallet.Address.Discovery , pendingIxsToList ) import Cardano.Wallet.Address.Discovery.Sequential - ( AddressPoolGap (..) ) + ( AddressPoolGap (..) + ) import Cardano.Wallet.Primitive.NetworkId - ( HasSNetworkId (..), NetworkDiscriminant, networkDiscriminantBits ) + ( HasSNetworkId (..) + , NetworkDiscriminant + , networkDiscriminantBits + ) import Cardano.Wallet.Primitive.Passphrase - ( Passphrase ) + ( Passphrase + ) import Cardano.Wallet.Primitive.Types.Address - ( Address (..), AddressState (..) ) + ( Address (..) + , AddressState (..) + ) import Cardano.Wallet.Primitive.Types.RewardAccount - ( RewardAccount (..) ) + ( RewardAccount (..) + ) import Control.Applicative - ( (<|>) ) + ( (<|>) + ) import Control.Arrow - ( first ) + ( first + ) import Control.DeepSeq - ( NFData ) + ( NFData + ) import Control.Monad - ( guard ) + ( guard + ) import Data.Data - ( Data ) + ( Data + ) import Data.Kind - ( Type ) + ( Type + ) import Data.Proxy - ( Proxy (..) ) + ( Proxy (..) + ) import Data.Text - ( Text ) + ( Text + ) import Data.Text.Class - ( FromText (..), TextDecodingError (..), ToText (..) ) + ( FromText (..) + , TextDecodingError (..) + , ToText (..) + ) import Fmt - ( Buildable (..), blockListF', indentF ) + ( Buildable (..) + , blockListF' + , indentF + ) import GHC.Generics - ( Generic ) + ( Generic + ) import Type.Reflection - ( Typeable ) + ( Typeable + ) import qualified Cardano.Address as CA import qualified Cardano.Address.Style.Shelley as CA diff --git a/lib/address-derivation-discovery/lib/Cardano/Wallet/Address/Encoding.hs b/lib/address-derivation-discovery/lib/Cardano/Wallet/Address/Encoding.hs index 29ff8e486c9..1d501013c2d 100644 --- a/lib/address-derivation-discovery/lib/Cardano/Wallet/Address/Encoding.hs +++ b/lib/address-derivation-discovery/lib/Cardano/Wallet/Address/Encoding.hs @@ -48,39 +48,62 @@ module Cardano.Wallet.Address.Encoding import Prelude import Cardano.Address - ( unsafeMkAddress ) + ( unsafeMkAddress + ) import Cardano.Crypto.Hash.Class - ( hashToBytes ) + ( hashToBytes + ) import Cardano.Wallet.Primitive.NetworkId - ( SNetworkId (..) ) + ( SNetworkId (..) + ) import Codec.Binary.Bech32 - ( dataPartFromBytes, dataPartToBytes ) + ( dataPartFromBytes + , dataPartToBytes + ) import Control.Applicative - ( (<|>) ) + ( (<|>) + ) import Control.Arrow - ( left ) + ( left + ) import Control.Lens - ( (&) ) + ( (&) + ) import Control.Monad - ( when, (>=>) ) + ( when + , (>=>) + ) import Data.Binary.Put - ( putByteString, putWord8, runPut ) + ( putByteString + , putWord8 + , runPut + ) import Data.Bits - ( (.&.), (.|.) ) + ( (.&.) + , (.|.) + ) import Data.ByteString - ( ByteString ) + ( ByteString + ) import Data.ByteString.Base58 - ( bitcoinAlphabet, encodeBase58 ) + ( bitcoinAlphabet + , encodeBase58 + ) import Data.Maybe - ( isJust ) + ( isJust + ) import Data.Text - ( Text ) + ( Text + ) import Data.Text.Class - ( TextDecodingError (..) ) + ( TextDecodingError (..) + ) import Data.Word - ( Word8 ) + ( Word8 + ) import Ouroboros.Consensus.Shelley.Eras - ( StandardCrypto ) + ( StandardCrypto + ) import qualified Cardano.Address as CA import qualified Cardano.Address.Style.Shelley as CA diff --git a/lib/address-derivation-discovery/lib/Cardano/Wallet/Address/HasDelegation.hs b/lib/address-derivation-discovery/lib/Cardano/Wallet/Address/HasDelegation.hs index 2590992b577..43243b098fb 100644 --- a/lib/address-derivation-discovery/lib/Cardano/Wallet/Address/HasDelegation.hs +++ b/lib/address-derivation-discovery/lib/Cardano/Wallet/Address/HasDelegation.hs @@ -13,17 +13,23 @@ module Cardano.Wallet.Address.HasDelegation import Prelude import Cardano.Wallet.Address.Derivation.Icarus - ( IcarusKey ) + ( IcarusKey + ) import Cardano.Wallet.Address.Derivation.SharedKey - ( SharedKey ) + ( SharedKey + ) import Cardano.Wallet.Address.Derivation.Shelley - ( ShelleyKey ) + ( ShelleyKey + ) import Cardano.Wallet.Address.Discovery.Random - ( RndState (..) ) + ( RndState (..) + ) import Cardano.Wallet.Address.Discovery.Sequential - ( SeqState ) + ( SeqState + ) import Cardano.Wallet.Address.Discovery.Shared - ( SharedState ) + ( SharedState + ) -- | Discriminate whether an address state supports delegation. class HasDelegation s where diff --git a/lib/address-derivation-discovery/lib/Cardano/Wallet/Address/Pool.hs b/lib/address-derivation-discovery/lib/Cardano/Wallet/Address/Pool.hs index 5aeef60c08d..648291094e9 100644 --- a/lib/address-derivation-discovery/lib/Cardano/Wallet/Address/Pool.hs +++ b/lib/address-derivation-discovery/lib/Cardano/Wallet/Address/Pool.hs @@ -41,20 +41,28 @@ module Cardano.Wallet.Address.Pool where import Prelude hiding - ( last, lookup ) + ( last + , lookup + ) import Cardano.Wallet.Primitive.Types.Address - ( AddressState (..) ) + ( AddressState (..) + ) import Control.DeepSeq - ( NFData ) + ( NFData + ) import Data.Map.Strict - ( Map ) + ( Map + ) import Data.Ord - ( Down (..) ) + ( Down (..) + ) import Fmt - ( Buildable (..) ) + ( Buildable (..) + ) import GHC.Generics - ( Generic ) + ( Generic + ) import qualified Data.List as L import qualified Data.Map.Strict as Map diff --git a/lib/address-derivation-discovery/lib/Cardano/Wallet/Address/States/Families.hs b/lib/address-derivation-discovery/lib/Cardano/Wallet/Address/States/Families.hs index f5cdc7209d0..2781c49ff42 100644 --- a/lib/address-derivation-discovery/lib/Cardano/Wallet/Address/States/Families.hs +++ b/lib/address-derivation-discovery/lib/Cardano/Wallet/Address/States/Families.hs @@ -4,21 +4,29 @@ module Cardano.Wallet.Address.States.Families where import Cardano.Wallet.Address.Derivation - ( Depth (..) ) + ( Depth (..) + ) import Cardano.Wallet.Address.Derivation.Byron - ( ByronKey ) + ( ByronKey + ) import Cardano.Wallet.Address.Discovery.Random - ( RndState ) + ( RndState + ) import Cardano.Wallet.Address.Discovery.Sequential - ( SeqState ) + ( SeqState + ) import Cardano.Wallet.Address.Discovery.Shared - ( SharedState ) + ( SharedState + ) import Cardano.Wallet.Address.States.Test.State - ( TestState ) + ( TestState + ) import Cardano.Wallet.Primitive.NetworkId - ( NetworkDiscriminant ) + ( NetworkDiscriminant + ) import Data.Kind - ( Type ) + ( Type + ) type family CredFromOf s :: Depth type instance CredFromOf (SharedState n key) = 'CredFromScriptK diff --git a/lib/address-derivation-discovery/lib/Cardano/Wallet/Address/States/Features.hs b/lib/address-derivation-discovery/lib/Cardano/Wallet/Address/States/Features.hs index a18c32437e0..17570cedd84 100644 --- a/lib/address-derivation-discovery/lib/Cardano/Wallet/Address/States/Features.hs +++ b/lib/address-derivation-discovery/lib/Cardano/Wallet/Address/States/Features.hs @@ -10,17 +10,23 @@ module Cardano.Wallet.Address.States.Features import Prelude import Cardano.Crypto.Wallet - ( XPrv ) + ( XPrv + ) import Cardano.Wallet.Address.Derivation - ( Depth (..) ) + ( Depth (..) + ) import Cardano.Wallet.Address.Derivation.Shared () import Cardano.Wallet.Address.States.Families - ( CredFromOf, KeyOf ) + ( CredFromOf + , KeyOf + ) import Cardano.Wallet.Primitive.Passphrase.Types - ( Passphrase (..) ) + ( Passphrase (..) + ) import Cardano.Wallet.Primitive.Types.Address - ( Address (..) ) + ( Address (..) + ) type IsOwned s = s diff --git a/lib/address-derivation-discovery/lib/Cardano/Wallet/Address/States/Test/State.hs b/lib/address-derivation-discovery/lib/Cardano/Wallet/Address/States/Test/State.hs index 6eedcb9379e..827a5f0f905 100644 --- a/lib/address-derivation-discovery/lib/Cardano/Wallet/Address/States/Test/State.hs +++ b/lib/address-derivation-discovery/lib/Cardano/Wallet/Address/States/Test/State.hs @@ -7,13 +7,17 @@ module Cardano.Wallet.Address.States.Test.State where import Prelude import Cardano.Wallet.Address.Derivation - ( Depth ) + ( Depth + ) import Cardano.Wallet.Primitive.NetworkId - ( NetworkDiscriminant ) + ( NetworkDiscriminant + ) import Data.Kind - ( Type ) + ( Type + ) import GHC.Generics - ( Generic ) + ( Generic + ) newtype TestState diff --git a/lib/address-derivation-discovery/lib/Cardano/Wallet/Primitive/Passphrase.hs b/lib/address-derivation-discovery/lib/Cardano/Wallet/Primitive/Passphrase.hs index 409b106ae9f..9f47ed5ad35 100644 --- a/lib/address-derivation-discovery/lib/Cardano/Wallet/Primitive/Passphrase.hs +++ b/lib/address-derivation-discovery/lib/Cardano/Wallet/Primitive/Passphrase.hs @@ -35,10 +35,13 @@ module Cardano.Wallet.Primitive.Passphrase import Prelude import Cardano.Crypto.Wallet - ( XPrv, xPrvChangePass ) + ( XPrv + , xPrvChangePass + ) import Cardano.Wallet.Primitive.Passphrase.Types import Crypto.Random.Types - ( MonadRandom ) + ( MonadRandom + ) import qualified Cardano.Wallet.Primitive.Passphrase.Current as PBKDF2 import qualified Cardano.Wallet.Primitive.Passphrase.Legacy as Scrypt diff --git a/lib/address-derivation-discovery/lib/Cardano/Wallet/Primitive/Passphrase/Current.hs b/lib/address-derivation-discovery/lib/Cardano/Wallet/Primitive/Passphrase/Current.hs index 57447db591a..634a6a1ec95 100644 --- a/lib/address-derivation-discovery/lib/Cardano/Wallet/Primitive/Passphrase/Current.hs +++ b/lib/address-derivation-discovery/lib/Cardano/Wallet/Primitive/Passphrase/Current.hs @@ -18,21 +18,32 @@ module Cardano.Wallet.Primitive.Passphrase.Current import Prelude import Cardano.Wallet.Primitive.Passphrase.Types - ( ErrWrongPassphrase (..), Passphrase (..), PassphraseHash (..) ) + ( ErrWrongPassphrase (..) + , Passphrase (..) + , PassphraseHash (..) + ) import Control.Monad - ( unless ) + ( unless + ) import Crypto.KDF.PBKDF2 - ( Parameters (..), fastPBKDF2_SHA512 ) + ( Parameters (..) + , fastPBKDF2_SHA512 + ) import Crypto.Random.Types - ( MonadRandom (..) ) + ( MonadRandom (..) + ) import Data.ByteArray - ( ScrubbedBytes ) + ( ScrubbedBytes + ) import Data.ByteString - ( ByteString ) + ( ByteString + ) import Data.Coerce - ( coerce ) + ( coerce + ) import Data.Function - ( on ) + ( on + ) import qualified Data.ByteArray as BA import qualified Data.ByteString as BS diff --git a/lib/address-derivation-discovery/lib/Cardano/Wallet/Primitive/Passphrase/Gen.hs b/lib/address-derivation-discovery/lib/Cardano/Wallet/Primitive/Passphrase/Gen.hs index ddc8dd10b1d..564c5ca788b 100644 --- a/lib/address-derivation-discovery/lib/Cardano/Wallet/Primitive/Passphrase/Gen.hs +++ b/lib/address-derivation-discovery/lib/Cardano/Wallet/Primitive/Passphrase/Gen.hs @@ -17,13 +17,19 @@ import Cardano.Wallet.Primitive.Passphrase , preparePassphrase ) import Control.Monad - ( replicateM ) + ( replicateM + ) import Data.Proxy - ( Proxy (..) ) + ( Proxy (..) + ) import Test.QuickCheck - ( Gen, arbitraryPrintableChar, choose ) + ( Gen + , arbitraryPrintableChar + , choose + ) import Test.QuickCheck.Arbitrary.Generic - ( genericArbitrary ) + ( genericArbitrary + ) import qualified Data.ByteArray as BA import qualified Data.ByteString.Char8 as B8 diff --git a/lib/address-derivation-discovery/lib/Cardano/Wallet/Primitive/Passphrase/Legacy.hs b/lib/address-derivation-discovery/lib/Cardano/Wallet/Primitive/Passphrase/Legacy.hs index dfd8cecd277..ec11d32c054 100644 --- a/lib/address-derivation-discovery/lib/Cardano/Wallet/Primitive/Passphrase/Legacy.hs +++ b/lib/address-derivation-discovery/lib/Cardano/Wallet/Primitive/Passphrase/Legacy.hs @@ -37,17 +37,26 @@ module Cardano.Wallet.Primitive.Passphrase.Legacy import Prelude import Cardano.Wallet.Primitive.Passphrase.Types - ( Passphrase (..), PassphraseHash (..) ) + ( Passphrase (..) + , PassphraseHash (..) + ) import Crypto.Hash.Extra - ( blake2b256 ) + ( blake2b256 + ) import Crypto.Random.Types - ( MonadRandom (..) ) + ( MonadRandom (..) + ) import Data.ByteArray.Encoding - ( Base (..), convertFromBase, convertToBase ) + ( Base (..) + , convertFromBase + , convertToBase + ) import Data.ByteString - ( ByteString ) + ( ByteString + ) import Data.Word - ( Word64 ) + ( Word64 + ) import qualified Codec.CBOR.Encoding as CBOR import qualified Codec.CBOR.Write as CBOR @@ -55,11 +64,15 @@ import qualified Crypto.KDF.Scrypt as Scrypt import qualified Data.ByteArray as BA import qualified Data.ByteString.Char8 as B8 import Data.Either.Extra - ( eitherToMaybe ) + ( eitherToMaybe + ) #if HAVE_SCRYPT import Crypto.Scrypt - ( EncryptedPass (..), Pass (..), verifyPass' ) + ( EncryptedPass (..) + , Pass (..) + , verifyPass' + ) -- | Verify a wallet spending password using the legacy Byron scrypt encryption -- scheme. diff --git a/lib/address-derivation-discovery/lib/Cardano/Wallet/Primitive/Passphrase/Types.hs b/lib/address-derivation-discovery/lib/Cardano/Wallet/Primitive/Passphrase/Types.hs index 7e2957e89d2..0501e40e47e 100644 --- a/lib/address-derivation-discovery/lib/Cardano/Wallet/Primitive/Passphrase/Types.hs +++ b/lib/address-derivation-discovery/lib/Cardano/Wallet/Primitive/Passphrase/Types.hs @@ -31,27 +31,43 @@ module Cardano.Wallet.Primitive.Passphrase.Types import Prelude import Control.DeepSeq - ( NFData ) + ( NFData + ) import Crypto.Random.Types - ( MonadRandom (..) ) + ( MonadRandom (..) + ) import Data.Bifunctor - ( first ) + ( first + ) import Data.ByteArray - ( ByteArray, ByteArrayAccess, ScrubbedBytes ) + ( ByteArray + , ByteArrayAccess + , ScrubbedBytes + ) import Data.ByteArray.Encoding - ( Base (..), convertToBase ) + ( Base (..) + , convertToBase + ) import Data.Proxy - ( Proxy (..) ) + ( Proxy (..) + ) import Data.Text - ( Text ) + ( Text + ) import Data.Text.Class - ( FromText (..), TextDecodingError (..), ToText (..) ) + ( FromText (..) + , TextDecodingError (..) + , ToText (..) + ) import Data.Time.Clock - ( UTCTime ) + ( UTCTime + ) import GHC.Generics - ( Generic ) + ( Generic + ) import GHC.TypeLits - ( Symbol ) + ( Symbol + ) import qualified Data.ByteArray as BA import qualified Data.Text as T diff --git a/lib/application-extras/lib/Cardano/Wallet/Network/Ports.hs b/lib/application-extras/lib/Cardano/Wallet/Network/Ports.hs index aabe5265625..8d0289e2f0b 100644 --- a/lib/application-extras/lib/Cardano/Wallet/Network/Ports.hs +++ b/lib/application-extras/lib/Cardano/Wallet/Network/Ports.hs @@ -29,21 +29,31 @@ module Cardano.Wallet.Network.Ports import Prelude import Control.Monad - ( filterM ) + ( filterM + ) import Control.Monad.IO.Class - ( liftIO ) + ( liftIO + ) import Data.List - ( isInfixOf, sort ) + ( isInfixOf + , sort + ) import Data.Maybe - ( fromMaybe ) + ( fromMaybe + ) import Data.Streaming.Network - ( bindRandomPortTCP ) + ( bindRandomPortTCP + ) import Data.Word - ( Word8 ) + ( Word8 + ) import Foreign.C.Error - ( Errno (..), eCONNREFUSED ) + ( Errno (..) + , eCONNREFUSED + ) import GHC.IO.Exception - ( IOException (..) ) + ( IOException (..) + ) import Network.Socket ( Family (AF_INET) , PortNumber @@ -55,13 +65,20 @@ import Network.Socket , tupleToHostAddress ) import Network.URI - ( URI (..), URIAuth (..) ) + ( URI (..) + , URIAuth (..) + ) import Safe - ( readMay ) + ( readMay + ) import System.Random.Shuffle - ( shuffleM ) + ( shuffleM + ) import UnliftIO.Exception - ( bracket, throwIO, try ) + ( bracket + , throwIO + , try + ) -- | Find a TCPv4 port which is likely to be free for listening on -- @localhost@. This binds a socket, receives an OS-assigned port, then closes diff --git a/lib/application-extras/lib/System/Environment/Extended.hs b/lib/application-extras/lib/System/Environment/Extended.hs index 1801f32912e..2ba9606adbd 100644 --- a/lib/application-extras/lib/System/Environment/Extended.hs +++ b/lib/application-extras/lib/System/Environment/Extended.hs @@ -10,13 +10,19 @@ import System.Environment as Reexport import Prelude import Control.Monad - ( mfilter ) + ( mfilter + ) import Data.Maybe - ( isJust ) + ( isJust + ) import Data.Text.Class - ( FromText (..), TextDecodingError ) + ( FromText (..) + , TextDecodingError + ) import UnliftIO - ( MonadIO (liftIO), MonadUnliftIO ) + ( MonadIO (liftIO) + , MonadUnliftIO + ) import qualified Data.Text as T diff --git a/lib/balance-tx/lib/internal/Internal/Cardano/Write/ProtocolParameters.hs b/lib/balance-tx/lib/internal/Internal/Cardano/Write/ProtocolParameters.hs index 13039572e70..77648c4b9fb 100644 --- a/lib/balance-tx/lib/internal/Internal/Cardano/Write/ProtocolParameters.hs +++ b/lib/balance-tx/lib/internal/Internal/Cardano/Write/ProtocolParameters.hs @@ -18,7 +18,8 @@ module Internal.Cardano.Write.ProtocolParameters import Prelude import Data.Functor.Identity - ( Identity ) + ( Identity + ) import qualified Cardano.Ledger.Core as Ledger import qualified Internal.Cardano.Write.Tx as Write diff --git a/lib/balance-tx/lib/internal/Internal/Cardano/Write/Tx.hs b/lib/balance-tx/lib/internal/Internal/Cardano/Write/Tx.hs index bef0ed02701..956ff92cfcc 100644 --- a/lib/balance-tx/lib/internal/Internal/Cardano/Write/Tx.hs +++ b/lib/balance-tx/lib/internal/Internal/Cardano/Write/Tx.hs @@ -149,73 +149,118 @@ module Internal.Cardano.Write.Tx import Prelude import Cardano.Api - ( BabbageEra, ConwayEra ) + ( BabbageEra + , ConwayEra + ) import Cardano.Api.Shelley - ( ShelleyLedgerEra ) + ( ShelleyLedgerEra + ) import Cardano.Crypto.Hash - ( Hash (UnsafeHash) ) + ( Hash (UnsafeHash) + ) import Cardano.Ledger.Allegra.Scripts - ( translateTimelock ) + ( translateTimelock + ) import Cardano.Ledger.Alonzo.Scripts - ( AlonzoScript (..) ) + ( AlonzoScript (..) + ) import Cardano.Ledger.Alonzo.Scripts.Data - ( BinaryData, Datum (..) ) + ( BinaryData + , Datum (..) + ) import Cardano.Ledger.Alonzo.TxInfo - ( ExtendedUTxO ) + ( ExtendedUTxO + ) import Cardano.Ledger.Alonzo.TxWits - ( AlonzoTxWits ) + ( AlonzoTxWits + ) import Cardano.Ledger.Alonzo.UTxO - ( AlonzoScriptsNeeded ) + ( AlonzoScriptsNeeded + ) import Cardano.Ledger.Api.UTxO - ( EraUTxO (ScriptsNeeded) ) + ( EraUTxO (ScriptsNeeded) + ) import Cardano.Ledger.Babbage.TxBody - ( BabbageTxOut (..) ) + ( BabbageTxOut (..) + ) import Cardano.Ledger.BaseTypes - ( ProtVer (..), Version, maybeToStrictMaybe ) + ( ProtVer (..) + , Version + , maybeToStrictMaybe + ) import Cardano.Ledger.Binary - ( Sized (..) ) + ( Sized (..) + ) import Cardano.Ledger.Coin - ( Coin (..) ) + ( Coin (..) + ) import Cardano.Ledger.Crypto - ( StandardCrypto ) + ( StandardCrypto + ) import Cardano.Ledger.Mary - ( MaryValue ) + ( MaryValue + ) import Cardano.Ledger.SafeHash - ( SafeHash, extractHash, unsafeMakeSafeHash ) + ( SafeHash + , extractHash + , unsafeMakeSafeHash + ) import Cardano.Ledger.Val - ( coin, modifyCoin ) + ( coin + , modifyCoin + ) import Cardano.Wallet.Primitive.Types.Tx.Constraints - ( txOutMaxCoin ) + ( txOutMaxCoin + ) import Control.Arrow - ( second, (>>>) ) + ( second + , (>>>) + ) import Data.ByteString - ( ByteString ) + ( ByteString + ) import Data.ByteString.Short - ( toShort ) + ( toShort + ) import Data.Coerce - ( coerce ) + ( coerce + ) import Data.Foldable - ( toList ) + ( toList + ) import Data.Generics.Internal.VL.Lens - ( (^.) ) + ( (^.) + ) import Data.Generics.Labels () import Data.IntCast - ( intCast, intCastMaybe ) + ( intCast + , intCastMaybe + ) import Data.Kind - ( Type ) + ( Type + ) import Data.Maybe - ( fromMaybe, isJust ) + ( fromMaybe + , isJust + ) import Data.Type.Equality - ( (:~:) (Refl), TestEquality (testEquality) ) + ( (:~:) (Refl) + , TestEquality (testEquality) + ) import Data.Typeable - ( Typeable ) + ( Typeable + ) import GHC.Stack - ( HasCallStack ) + ( HasCallStack + ) import Numeric.Natural - ( Natural ) + ( Natural + ) import Ouroboros.Consensus.Shelley.Eras - ( StandardBabbage, StandardConway ) + ( StandardBabbage + , StandardConway + ) import qualified Cardano.Api as Cardano import qualified Cardano.Api.Byron as Cardano diff --git a/lib/balance-tx/lib/internal/Internal/Cardano/Write/Tx/Balance.hs b/lib/balance-tx/lib/internal/Internal/Cardano/Write/Tx/Balance.hs index d3b23587342..8f5348db2ad 100644 --- a/lib/balance-tx/lib/internal/Internal/Cardano/Write/Tx/Balance.hs +++ b/lib/balance-tx/lib/internal/Internal/Cardano/Write/Tx/Balance.hs @@ -79,13 +79,18 @@ module Internal.Cardano.Write.Tx.Balance import Prelude import Cardano.CoinSelection.Size - ( TokenBundleSizeAssessment (..) ) + ( TokenBundleSizeAssessment (..) + ) import Cardano.CoinSelection.UTxOSelection - ( UTxOSelection ) + ( UTxOSelection + ) import Cardano.Ledger.Alonzo.Core - ( ppCollateralPercentageL, ppMaxCollateralInputsL ) + ( ppCollateralPercentageL + , ppMaxCollateralInputsL + ) import Cardano.Ledger.Alonzo.Scripts - ( AlonzoScript (..) ) + ( AlonzoScript (..) + ) import Cardano.Ledger.Api ( bodyTxL , collateralInputsTxBodyL @@ -95,55 +100,102 @@ import Cardano.Ledger.Api , ppMaxTxSizeL ) import Cardano.Ledger.UTxO - ( txinLookup ) + ( txinLookup + ) import Cardano.Wallet.Primitive.Types.Tx - ( SealedTx, sealedTxFromCardano ) + ( SealedTx + , sealedTxFromCardano + ) import Cardano.Wallet.Primitive.Types.Tx.Constraints - ( TxSize (..), txOutMaxCoin, txOutMaxTokenQuantity ) + ( TxSize (..) + , txOutMaxCoin + , txOutMaxTokenQuantity + ) import Control.Arrow - ( left ) + ( left + ) import Control.Monad - ( forM, unless, when ) + ( forM + , unless + , when + ) import Control.Monad.Random - ( MonadRandom, evalRand ) + ( MonadRandom + , evalRand + ) import Control.Monad.Trans.Except - ( ExceptT (ExceptT), catchE, except, runExceptT, throwE, withExceptT ) + ( ExceptT (ExceptT) + , catchE + , except + , runExceptT + , throwE + , withExceptT + ) import Control.Monad.Trans.State - ( runState, state ) + ( runState + , state + ) import Data.Bifunctor - ( bimap, second ) + ( bimap + , second + ) import Data.Bits - ( Bits ) + ( Bits + ) import Data.Either - ( lefts, partitionEithers ) + ( lefts + , partitionEithers + ) import Data.Function - ( (&) ) + ( (&) + ) import Data.Functor - ( (<&>) ) + ( (<&>) + ) import Data.Generics.Internal.VL.Lens - ( over, view, (^.) ) + ( over + , view + , (^.) + ) import Data.Generics.Labels () import Data.IntCast - ( intCastMaybe ) + ( intCastMaybe + ) import Data.List.NonEmpty - ( NonEmpty (..) ) + ( NonEmpty (..) + ) import Data.Maybe - ( fromMaybe, mapMaybe ) + ( fromMaybe + , mapMaybe + ) import Data.Monoid.Monus - ( Monus ((<\>)) ) + ( Monus ((<\>)) + ) import Data.Semigroup.Cancellative - ( Reductive (()) ) + ( Reductive (()) + ) import Data.Type.Equality - ( (:~:) (..), testEquality ) + ( (:~:) (..) + , testEquality + ) import Fmt - ( Buildable, Builder, blockListF', build, nameF, pretty ) + ( Buildable + , Builder + , blockListF' + , build + , nameF + , pretty + ) import GHC.Generics - ( Generic ) + ( Generic + ) import GHC.Stack - ( HasCallStack ) + ( HasCallStack + ) import Internal.Cardano.Write.ProtocolParameters - ( ProtocolParameters (..) ) + ( ProtocolParameters (..) + ) import Internal.Cardano.Write.Tx ( Address , Coin (..) @@ -192,23 +244,40 @@ import Internal.Cardano.Write.Tx.Balance.CoinSelection , toInternalUTxOMap ) import Internal.Cardano.Write.Tx.Balance.TokenBundleSize - ( mkTokenBundleSizeAssessor ) + ( mkTokenBundleSizeAssessor + ) import Internal.Cardano.Write.Tx.Redeemers - ( ErrAssignRedeemers (..), Redeemer (..), assignScriptRedeemers ) + ( ErrAssignRedeemers (..) + , Redeemer (..) + , assignScriptRedeemers + ) import Internal.Cardano.Write.Tx.Sign - ( estimateKeyWitnessCount, estimateSignedTxSize ) + ( estimateKeyWitnessCount + , estimateSignedTxSize + ) import Internal.Cardano.Write.Tx.SizeEstimation - ( TxSkeleton (..), assumedTxWitnessTag, estimateTxCost ) + ( TxSkeleton (..) + , assumedTxWitnessTag + , estimateTxCost + ) import Internal.Cardano.Write.Tx.TimeTranslation - ( TimeTranslation ) + ( TimeTranslation + ) import Internal.Cardano.Write.UTxOAssumptions - ( UTxOAssumptions (..), assumedInputScriptTemplate ) + ( UTxOAssumptions (..) + , assumedInputScriptTemplate + ) import Numeric.Natural - ( Natural ) + ( Natural + ) import System.Random.StdGenSeed - ( StdGenSeed (..), stdGenFromSeed, stdGenSeed ) + ( StdGenSeed (..) + , stdGenFromSeed + , stdGenSeed + ) import Text.Pretty.Simple - ( pShow ) + ( pShow + ) import qualified Cardano.Address.Script as CA import qualified Cardano.Api as Cardano @@ -219,26 +288,34 @@ import qualified Cardano.CoinSelection.UTxOIndex as UTxOIndex import qualified Cardano.CoinSelection.UTxOSelection as UTxOSelection import qualified Cardano.Ledger.Core as Core import qualified Cardano.Wallet.Primitive.Types.Address as W - ( Address ) + ( Address + ) import qualified Cardano.Wallet.Primitive.Types.Coin as W.Coin import qualified Cardano.Wallet.Primitive.Types.Coin as W - ( Coin (..) ) + ( Coin (..) + ) import qualified Cardano.Wallet.Primitive.Types.TokenBundle as W.TokenBundle import qualified Cardano.Wallet.Primitive.Types.TokenBundle as W - ( TokenBundle (..) ) + ( TokenBundle (..) + ) import qualified Cardano.Wallet.Primitive.Types.TokenMap as W.TokenMap import qualified Cardano.Wallet.Primitive.Types.TokenMap as W - ( AssetId ) + ( AssetId + ) import qualified Cardano.Wallet.Primitive.Types.TokenQuantity as W - ( TokenQuantity ) + ( TokenQuantity + ) import qualified Cardano.Wallet.Primitive.Types.Tx.TxIn as W - ( TxIn ) + ( TxIn + ) import qualified Cardano.Wallet.Primitive.Types.Tx.TxOut as W.TxOut import qualified Cardano.Wallet.Primitive.Types.Tx.TxOut as W - ( TxOut (..) ) + ( TxOut (..) + ) import qualified Cardano.Wallet.Primitive.Types.UTxO as W.UTxO import qualified Cardano.Wallet.Primitive.Types.UTxO as W - ( UTxO (..) ) + ( UTxO (..) + ) import qualified Cardano.Wallet.Shelley.Compatibility.Ledger as Convert import qualified Data.Foldable as F import qualified Data.List as L diff --git a/lib/balance-tx/lib/internal/Internal/Cardano/Write/Tx/Balance/CoinSelection.hs b/lib/balance-tx/lib/internal/Internal/Cardano/Write/Tx/Balance/CoinSelection.hs index 2f72e70e62b..89777961d30 100644 --- a/lib/balance-tx/lib/internal/Internal/Cardano/Write/Tx/Balance/CoinSelection.hs +++ b/lib/balance-tx/lib/internal/Internal/Cardano/Write/Tx/Balance/CoinSelection.hs @@ -73,51 +73,77 @@ import Cardano.CoinSelection.Balance , UnableToConstructChangeError (..) ) import Cardano.CoinSelection.Size - ( TokenBundleSizeAssessor (..) ) + ( TokenBundleSizeAssessor (..) + ) import Cardano.CoinSelection.UTxOSelection - ( UTxOSelection ) + ( UTxOSelection + ) import Cardano.Wallet.Primitive.Collateral - ( asCollateral ) + ( asCollateral + ) import Cardano.Wallet.Primitive.Types.Address - ( Address (..) ) + ( Address (..) + ) import Cardano.Wallet.Primitive.Types.Coin - ( Coin (..) ) + ( Coin (..) + ) import Cardano.Wallet.Primitive.Types.TokenBundle - ( Flat (..), TokenBundle (..) ) + ( Flat (..) + , TokenBundle (..) + ) import Cardano.Wallet.Primitive.Types.TokenMap - ( AssetId, TokenMap ) + ( AssetId + , TokenMap + ) import Cardano.Wallet.Primitive.Types.Tx.Constraints - ( txOutMaxCoin, txOutMaxTokenQuantity ) + ( txOutMaxCoin + , txOutMaxTokenQuantity + ) import Cardano.Wallet.Primitive.Types.Tx.TxIn - ( TxIn ) + ( TxIn + ) import Cardano.Wallet.Primitive.Types.Tx.TxOut - ( TxOut (..) ) + ( TxOut (..) + ) import Cardano.Wallet.Primitive.Types.UTxO - ( UTxO (..) ) + ( UTxO (..) + ) import Control.Arrow - ( (&&&) ) + ( (&&&) + ) import Control.DeepSeq - ( NFData ) + ( NFData + ) import Control.Monad.Random.Class - ( MonadRandom (..) ) + ( MonadRandom (..) + ) import Control.Monad.Trans.Except - ( ExceptT (..) ) + ( ExceptT (..) + ) import Data.Generics.Internal.VL.Lens - ( view ) + ( view + ) import Data.List.NonEmpty - ( NonEmpty ) + ( NonEmpty + ) import Data.Map.Strict - ( Map ) + ( Map + ) import Data.Set - ( Set ) + ( Set + ) import Fmt - ( Buildable (..) ) + ( Buildable (..) + ) import GHC.Generics - ( Generic ) + ( Generic + ) import GHC.Stack - ( HasCallStack ) + ( HasCallStack + ) import Numeric.Natural - ( Natural ) + ( Natural + ) import Prelude diff --git a/lib/balance-tx/lib/internal/Internal/Cardano/Write/Tx/Balance/CoinSelection/Gen.hs b/lib/balance-tx/lib/internal/Internal/Cardano/Write/Tx/Balance/CoinSelection/Gen.hs index c49fd40a59b..d743fde8720 100644 --- a/lib/balance-tx/lib/internal/Internal/Cardano/Write/Tx/Balance/CoinSelection/Gen.hs +++ b/lib/balance-tx/lib/internal/Internal/Cardano/Write/Tx/Balance/CoinSelection/Gen.hs @@ -10,17 +10,31 @@ module Internal.Cardano.Write.Tx.Balance.CoinSelection.Gen import Prelude import Cardano.Wallet.Primitive.Types.Address.Gen - ( genAddress, shrinkAddress ) + ( genAddress + , shrinkAddress + ) import Cardano.Wallet.Primitive.Types.Tx.TxIn.Gen - ( genTxIn, genTxInLargeRange, shrinkTxIn ) + ( genTxIn + , genTxInLargeRange + , shrinkTxIn + ) import Generics.SOP - ( NP (..) ) + ( NP (..) + ) import Internal.Cardano.Write.Tx.Balance.CoinSelection - ( WalletUTxO (..) ) + ( WalletUTxO (..) + ) import Test.QuickCheck - ( Gen, coarbitrary ) + ( Gen + , coarbitrary + ) import Test.QuickCheck.Extra - ( genFunction, genSized2, genericRoundRobinShrink, (<:>), (<@>) ) + ( genFunction + , genSized2 + , genericRoundRobinShrink + , (<:>) + , (<@>) + ) -------------------------------------------------------------------------------- -- Wallet UTxO identifiers chosen according to the size parameter diff --git a/lib/balance-tx/lib/internal/Internal/Cardano/Write/Tx/Balance/TokenBundleSize.hs b/lib/balance-tx/lib/internal/Internal/Cardano/Write/Tx/Balance/TokenBundleSize.hs index ec925372933..5ed7dcb621d 100644 --- a/lib/balance-tx/lib/internal/Internal/Cardano/Write/Tx/Balance/TokenBundleSize.hs +++ b/lib/balance-tx/lib/internal/Internal/Cardano/Write/Tx/Balance/TokenBundleSize.hs @@ -9,21 +9,36 @@ module Internal.Cardano.Write.Tx.Balance.TokenBundleSize import Prelude import Cardano.CoinSelection.Size - ( TokenBundleSizeAssessment (..), TokenBundleSizeAssessor (..) ) + ( TokenBundleSizeAssessment (..) + , TokenBundleSizeAssessor (..) + ) import Cardano.Ledger.Api - ( ppMaxValSizeL, ppProtocolVersionL ) + ( ppMaxValSizeL + , ppProtocolVersionL + ) import Cardano.Ledger.BaseTypes - ( ProtVer (pvMajor) ) + ( ProtVer (pvMajor) + ) import Cardano.Ledger.Binary - ( serialize ) + ( serialize + ) import Cardano.Wallet.Primitive.Types.Tx.Constraints - ( TxSize (..) ) + ( TxSize (..) + ) import Control.Lens - ( (^.) ) + ( (^.) + ) import Data.IntCast - ( intCastMaybe ) + ( intCastMaybe + ) import Internal.Cardano.Write.Tx - ( PParams, RecentEra, ShelleyLedgerEra, Value, Version, withConstraints ) + ( PParams + , RecentEra + , ShelleyLedgerEra + , Value + , Version + , withConstraints + ) import qualified Cardano.Wallet.Primitive.Types.TokenBundle as TokenBundle import qualified Cardano.Wallet.Shelley.Compatibility.Ledger as Convert diff --git a/lib/balance-tx/lib/internal/Internal/Cardano/Write/Tx/Gen.hs b/lib/balance-tx/lib/internal/Internal/Cardano/Write/Tx/Gen.hs index ea462dfdb4f..48826791656 100644 --- a/lib/balance-tx/lib/internal/Internal/Cardano/Write/Tx/Gen.hs +++ b/lib/balance-tx/lib/internal/Internal/Cardano/Write/Tx/Gen.hs @@ -13,11 +13,17 @@ module Internal.Cardano.Write.Tx.Gen import Prelude import Data.Maybe - ( fromMaybe ) + ( fromMaybe + ) import Internal.Cardano.Write.Tx - ( DatumHash, datumHashFromBytes ) + ( DatumHash + , datumHashFromBytes + ) import Test.QuickCheck - ( Gen, arbitrary, vectorOf ) + ( Gen + , arbitrary + , vectorOf + ) import qualified Data.ByteString as BS diff --git a/lib/balance-tx/lib/internal/Internal/Cardano/Write/Tx/Redeemers.hs b/lib/balance-tx/lib/internal/Internal/Cardano/Write/Tx/Redeemers.hs index 29000164a0f..9d3cfd36335 100644 --- a/lib/balance-tx/lib/internal/Internal/Cardano/Write/Tx/Redeemers.hs +++ b/lib/balance-tx/lib/internal/Internal/Cardano/Write/Tx/Redeemers.hs @@ -23,51 +23,85 @@ module Internal.Cardano.Write.Tx.Redeemers import Prelude import Cardano.Api - ( StakeAddress, serialiseToBech32 ) + ( StakeAddress + , serialiseToBech32 + ) import Cardano.Crypto.Hash.Class - ( Hash ) + ( Hash + ) import Cardano.Ledger.Alonzo.TxInfo - ( TranslationError ) + ( TranslationError + ) import Cardano.Ledger.Api - ( Tx, bodyTxL, rdmrsTxWitsL, scriptIntegrityHashTxBodyL, witsTxL ) + ( Tx + , bodyTxL + , rdmrsTxWitsL + , scriptIntegrityHashTxBodyL + , witsTxL + ) import Cardano.Ledger.Mary.Value - ( PolicyID (..) ) + ( PolicyID (..) + ) import Cardano.Ledger.Shelley.API - ( ScriptHash (..), StrictMaybe (..) ) + ( ScriptHash (..) + , StrictMaybe (..) + ) import Cardano.Slotting.EpochInfo - ( EpochInfo, hoistEpochInfo ) + ( EpochInfo + , hoistEpochInfo + ) import Cardano.Wallet.Primitive.Types.TokenPolicy - ( TokenPolicyId ) + ( TokenPolicyId + ) import Codec.Serialise - ( deserialiseOrFail ) + ( deserialiseOrFail + ) import Control.Arrow - ( left ) + ( left + ) import Control.Lens - ( (.~) ) + ( (.~) + ) import Control.Monad - ( forM ) + ( forM + ) import Control.Monad.Trans.Class - ( lift ) + ( lift + ) import Control.Monad.Trans.State.Strict - ( StateT (..), execStateT, get, modify', put ) + ( StateT (..) + , execStateT + , get + , modify' + , put + ) import Data.Bifunctor - ( bimap ) + ( bimap + ) import Data.ByteString - ( ByteString ) + ( ByteString + ) import Data.Function - ( (&) ) + ( (&) + ) import Data.Generics.Internal.VL.Lens - ( view ) + ( view + ) import Data.Generics.Labels () import Data.Map.Strict - ( Map, (!) ) + ( Map + , (!) + ) import Data.Maybe - ( fromMaybe ) + ( fromMaybe + ) import Fmt - ( Buildable (..) ) + ( Buildable (..) + ) import GHC.Generics - ( Generic ) + ( Generic + ) import Internal.Cardano.Write.Tx ( IsRecentEra (recentEra) , PParams @@ -81,7 +115,10 @@ import Internal.Cardano.Write.Tx , withConstraints ) import Internal.Cardano.Write.Tx.TimeTranslation - ( TimeTranslation, epochInfo, systemStartTime ) + ( TimeTranslation + , epochInfo + , systemStartTime + ) import qualified Cardano.Api as Cardano import qualified Cardano.Api.Shelley as Cardano diff --git a/lib/balance-tx/lib/internal/Internal/Cardano/Write/Tx/Sign.hs b/lib/balance-tx/lib/internal/Internal/Cardano/Write/Tx/Sign.hs index 6eba918d1f9..652c0937b7c 100644 --- a/lib/balance-tx/lib/internal/Internal/Cardano/Write/Tx/Sign.hs +++ b/lib/balance-tx/lib/internal/Internal/Cardano/Write/Tx/Sign.hs @@ -36,19 +36,29 @@ import Cardano.Ledger.Api , witsTxL ) import Cardano.Ledger.Credential - ( Credential (..) ) + ( Credential (..) + ) import Cardano.Ledger.UTxO - ( txinLookup ) + ( txinLookup + ) import qualified Cardano.Wallet.Primitive.Types.Coin as W - ( Coin (..) ) + ( Coin (..) + ) import Cardano.Wallet.Primitive.Types.Tx.Constraints - ( TxSize (..) ) + ( TxSize (..) + ) import Control.Lens - ( view, (&), (.~), (^.) ) + ( view + , (&) + , (.~) + , (^.) + ) import Data.Maybe - ( mapMaybe ) + ( mapMaybe + ) import Data.Monoid.Monus - ( Monus ((<\>)) ) + ( Monus ((<\>)) + ) import Internal.Cardano.Write.Tx ( IsRecentEra (..) , KeyWitnessCount (..) @@ -61,7 +71,8 @@ import Internal.Cardano.Write.Tx , withConstraints ) import Numeric.Natural - ( Natural ) + ( Natural + ) import qualified Cardano.Address.Script as CA import qualified Cardano.Api as Cardano diff --git a/lib/balance-tx/lib/internal/Internal/Cardano/Write/Tx/SizeEstimation.hs b/lib/balance-tx/lib/internal/Internal/Cardano/Write/Tx/SizeEstimation.hs index 0fb1632fd12..088962f7eb4 100644 --- a/lib/balance-tx/lib/internal/Internal/Cardano/Write/Tx/SizeEstimation.hs +++ b/lib/balance-tx/lib/internal/Internal/Cardano/Write/Tx/SizeEstimation.hs @@ -44,31 +44,43 @@ module Internal.Cardano.Write.Tx.SizeEstimation import Prelude import Cardano.Address.Script - ( Script (..) ) + ( Script (..) + ) import Cardano.Wallet.Primitive.Types.Address - ( Address (..) ) + ( Address (..) + ) import Cardano.Wallet.Primitive.Types.Coin - ( Coin (..) ) + ( Coin (..) + ) import Cardano.Wallet.Primitive.Types.TokenMap - ( AssetId (..) ) + ( AssetId (..) + ) import Cardano.Wallet.Primitive.Types.TokenPolicy - ( TokenName (..) ) + ( TokenName (..) + ) import Cardano.Wallet.Primitive.Types.Tx.Constraints - ( TxSize (..) ) + ( TxSize (..) + ) import Data.Generics.Labels () import Data.Set - ( Set ) + ( Set + ) import GHC.Generics - ( Generic ) + ( Generic + ) import Internal.Cardano.Write.Tx - ( FeePerByte (..) ) + ( FeePerByte (..) + ) import Internal.Cardano.Write.Tx.Sign - ( estimateMaxWitnessRequiredPerInput ) + ( estimateMaxWitnessRequiredPerInput + ) import Internal.Cardano.Write.UTxOAssumptions - ( UTxOAssumptions (..) ) + ( UTxOAssumptions (..) + ) import Numeric.Natural - ( Natural ) + ( Natural + ) import qualified Cardano.Address.Script as CA import qualified Cardano.Wallet.Primitive.Types.Coin as Coin diff --git a/lib/balance-tx/lib/internal/Internal/Cardano/Write/Tx/TimeTranslation.hs b/lib/balance-tx/lib/internal/Internal/Cardano/Write/Tx/TimeTranslation.hs index 964b088f6b4..fd3b0d1381b 100644 --- a/lib/balance-tx/lib/internal/Internal/Cardano/Write/Tx/TimeTranslation.hs +++ b/lib/balance-tx/lib/internal/Internal/Cardano/Write/Tx/TimeTranslation.hs @@ -11,11 +11,14 @@ module Internal.Cardano.Write.Tx.TimeTranslation import Prelude import Cardano.Slotting.EpochInfo - ( EpochInfo ) + ( EpochInfo + ) import Cardano.Slotting.Time - ( SystemStart ) + ( SystemStart + ) import Ouroboros.Consensus.HardFork.History - ( PastHorizonException ) + ( PastHorizonException + ) data TimeTranslation = TimeTranslation (EpochInfo (Either PastHorizonException)) diff --git a/lib/balance-tx/lib/internal/Internal/Cardano/Write/UTxOAssumptions.hs b/lib/balance-tx/lib/internal/Internal/Cardano/Write/UTxOAssumptions.hs index ff9e7979a4b..70e81c17473 100644 --- a/lib/balance-tx/lib/internal/Internal/Cardano/Write/UTxOAssumptions.hs +++ b/lib/balance-tx/lib/internal/Internal/Cardano/Write/UTxOAssumptions.hs @@ -19,9 +19,12 @@ module Internal.Cardano.Write.UTxOAssumptions import Prelude import Cardano.Ledger.Shelley.API - ( Addr (..), Credential (..) ) + ( Addr (..) + , Credential (..) + ) import Internal.Cardano.Write.Tx - ( Address ) + ( Address + ) import qualified Cardano.Address.Script as CA import qualified Cardano.Wallet.Primitive.Types.Address as W diff --git a/lib/balance-tx/test/spec/Internal/Cardano/Write/Tx/Balance/CoinSelectionSpec.hs b/lib/balance-tx/test/spec/Internal/Cardano/Write/Tx/Balance/CoinSelectionSpec.hs index 9f872f8e909..d5ee93e8994 100644 --- a/lib/balance-tx/test/spec/Internal/Cardano/Write/Tx/Balance/CoinSelectionSpec.hs +++ b/lib/balance-tx/test/spec/Internal/Cardano/Write/Tx/Balance/CoinSelectionSpec.hs @@ -7,29 +7,48 @@ module Internal.Cardano.Write.Tx.Balance.CoinSelectionSpec import Prelude import Cardano.Wallet.Primitive.Types.Address.Gen - ( genAddress ) + ( genAddress + ) import Cardano.Wallet.Primitive.Types.Coin.Gen - ( genCoin, shrinkCoin ) + ( genCoin + , shrinkCoin + ) import Cardano.Wallet.Primitive.Types.TokenBundle.Gen - ( genTokenBundle, shrinkTokenBundle ) + ( genTokenBundle + , shrinkTokenBundle + ) import Cardano.Wallet.Primitive.Types.TokenMap.Gen - ( genTokenMap, shrinkTokenMap ) + ( genTokenMap + , shrinkTokenMap + ) import Cardano.Wallet.Primitive.Types.Tx.TxIn - ( TxIn ) + ( TxIn + ) import Cardano.Wallet.Primitive.Types.Tx.TxIn.Gen - ( genTxIn, shrinkTxIn ) + ( genTxIn + , shrinkTxIn + ) import Cardano.Wallet.Primitive.Types.Tx.TxOut - ( TxOut (..) ) + ( TxOut (..) + ) import Cardano.Wallet.Primitive.Types.Tx.TxOut.Gen - ( genTxOut, shrinkTxOut ) + ( genTxOut + , shrinkTxOut + ) import Cardano.Wallet.Primitive.Types.UTxO - ( UTxO ) + ( UTxO + ) import Cardano.Wallet.Primitive.Types.UTxO.Gen - ( genUTxO, genUTxOLarge, shrinkUTxO ) + ( genUTxO + , genUTxOLarge + , shrinkUTxO + ) import Data.Function - ( (&) ) + ( (&) + ) import Generics.SOP - ( NP (..) ) + ( NP (..) + ) import Internal.Cardano.Write.Tx.Balance.CoinSelection ( Selection , SelectionOf (..) @@ -41,9 +60,13 @@ import Internal.Cardano.Write.Tx.Balance.CoinSelection , toInternalUTxOMap ) import Test.Hspec - ( Spec, describe, it ) + ( Spec + , describe + , it + ) import Test.Hspec.Extra - ( parallel ) + ( parallel + ) import Test.QuickCheck ( Arbitrary (..) , Gen @@ -56,9 +79,15 @@ import Test.QuickCheck , (===) ) import Test.QuickCheck.Extra - ( genNonEmpty, genericRoundRobinShrink, shrinkNonEmpty, (<:>), (<@>) ) + ( genNonEmpty + , genericRoundRobinShrink + , shrinkNonEmpty + , (<:>) + , (<@>) + ) import Test.Utils.Pretty - ( (====) ) + ( (====) + ) import qualified Cardano.Wallet.Primitive.Types.TokenBundle as TokenBundle diff --git a/lib/balance-tx/test/spec/Internal/Cardano/Write/Tx/Balance/TokenBundleSizeSpec.hs b/lib/balance-tx/test/spec/Internal/Cardano/Write/Tx/Balance/TokenBundleSizeSpec.hs index 8efb6465ed9..6fc815bc0de 100644 --- a/lib/balance-tx/test/spec/Internal/Cardano/Write/Tx/Balance/TokenBundleSizeSpec.hs +++ b/lib/balance-tx/test/spec/Internal/Cardano/Write/Tx/Balance/TokenBundleSizeSpec.hs @@ -7,27 +7,45 @@ module Internal.Cardano.Write.Tx.Balance.TokenBundleSizeSpec where import Prelude import Cardano.CoinSelection.Size - ( TokenBundleSizeAssessment (..) ) + ( TokenBundleSizeAssessment (..) + ) import Cardano.Ledger.Api.Era - ( eraProtVerLow ) + ( eraProtVerLow + ) import Cardano.Ledger.Api.PParams - ( PParams, ppMaxValSizeL, ppProtocolVersionL ) + ( PParams + , ppMaxValSizeL + , ppProtocolVersionL + ) import Cardano.Wallet.Primitive.Types.TokenBundle - ( TokenBundle ) + ( TokenBundle + ) import Cardano.Wallet.Primitive.Types.TokenBundle.Gen - ( genTokenBundle, genTokenBundleSmallRange, shrinkTokenBundleSmallRange ) + ( genTokenBundle + , genTokenBundleSmallRange + , shrinkTokenBundleSmallRange + ) import Cardano.Wallet.Primitive.Types.Tx.Constraints - ( TxSize (..), txOutMaxCoin, txOutMinCoin ) + ( TxSize (..) + , txOutMaxCoin + , txOutMinCoin + ) import Cardano.Wallet.Primitive.Types.Tx.TxOut.Gen - ( genTxOutTokenBundle ) + ( genTxOutTokenBundle + ) import Control.Lens - ( (&), (.~) ) + ( (&) + , (.~) + ) import Data.Default - ( def ) + ( def + ) import Data.Monoid.Monus - ( Monus ((<\>)) ) + ( Monus ((<\>)) + ) import Data.Word - ( Word64 ) + ( Word64 + ) import Internal.Cardano.Write.Tx ( ProtVer (..) , RecentEra (..) @@ -44,9 +62,13 @@ import Internal.Cardano.Write.Tx.Balance.TokenBundleSize , mkTokenBundleSizeAssessor ) import Numeric.Natural - ( Natural ) + ( Natural + ) import Test.Hspec - ( Spec, describe, it ) + ( Spec + , describe + , it + ) import Test.QuickCheck ( Arbitrary (..) , Blind (..) diff --git a/lib/balance-tx/test/spec/Internal/Cardano/Write/TxSpec.hs b/lib/balance-tx/test/spec/Internal/Cardano/Write/TxSpec.hs index ff0f9f7b775..aa1dd25bf29 100644 --- a/lib/balance-tx/test/spec/Internal/Cardano/Write/TxSpec.hs +++ b/lib/balance-tx/test/spec/Internal/Cardano/Write/TxSpec.hs @@ -11,15 +11,21 @@ module Internal.Cardano.Write.TxSpec where import Prelude import Cardano.Api.Gen - ( genTxIn ) + ( genTxIn + ) import Cardano.Ledger.Api - ( ppCoinsPerUTxOByteL ) + ( ppCoinsPerUTxOByteL + ) import Control.Lens - ( (&), (.~) ) + ( (&) + , (.~) + ) import Data.Aeson - ( (.=) ) + ( (.=) + ) import Data.Default - ( Default (..) ) + ( Default (..) + ) import Internal.Cardano.Write.Tx ( AnyRecentEra , RecentEra (..) @@ -38,7 +44,12 @@ import Test.Cardano.Ledger.Babbage.Arbitrary import Test.Cardano.Ledger.Conway.Arbitrary () import Test.Hspec - ( Spec, describe, it, shouldBe, shouldNotBe ) + ( Spec + , describe + , it + , shouldBe + , shouldNotBe + ) import Test.QuickCheck ( Arbitrary (..) , Arbitrary1 (liftArbitrary) @@ -51,9 +62,13 @@ import Test.QuickCheck , (===) ) import Test.QuickCheck.Classes - ( boundedEnumLaws, eqLaws, showLaws ) + ( boundedEnumLaws + , eqLaws + , showLaws + ) import Test.Utils.Laws - ( testLawsMany ) + ( testLawsMany + ) import qualified Cardano.Api as Cardano import qualified Cardano.Api.Gen as Cardano diff --git a/lib/balance-tx/test/spec/run-test-suite.hs b/lib/balance-tx/test/spec/run-test-suite.hs index 349e4b80090..66edcab2e95 100644 --- a/lib/balance-tx/test/spec/run-test-suite.hs +++ b/lib/balance-tx/test/spec/run-test-suite.hs @@ -3,9 +3,11 @@ module Main where import Prelude import Main.Utf8 - ( withUtf8 ) + ( withUtf8 + ) import Test.Hspec.Extra - ( hspecMain ) + ( hspecMain + ) import qualified Spec diff --git a/lib/cardano-api-extra/lib/Cardano/Api/Gen.hs b/lib/cardano-api-extra/lib/Cardano/Api/Gen.hs index 036c3a0d489..320946d6a9d 100644 --- a/lib/cardano-api-extra/lib/Cardano/Api/Gen.hs +++ b/lib/cardano-api-extra/lib/Cardano/Api/Gen.hs @@ -114,9 +114,12 @@ module Cardano.Api.Gen import Prelude import Cardano.Api hiding - ( txIns ) + ( txIns + ) import Cardano.Api.Byron - ( KeyWitness (ByronKeyWitness), WitnessNetworkIdOrByronAddress (..) ) + ( KeyWitness (ByronKeyWitness) + , WitnessNetworkIdOrByronAddress (..) + ) import Cardano.Api.Shelley ( Hash (..) , PlutusScript (..) @@ -133,53 +136,86 @@ import Cardano.Api.Shelley , refInsScriptsAndInlineDatsSupportedInEra ) import Cardano.Ledger.Alonzo.Language - ( Language (..) ) + ( Language (..) + ) import Cardano.Ledger.Credential.Safe - ( Ptr, SlotNo32 (..), safePtr ) + ( Ptr + , SlotNo32 (..) + , safePtr + ) import Cardano.Ledger.SafeHash - ( unsafeMakeSafeHash ) + ( unsafeMakeSafeHash + ) import Cardano.Ledger.Shelley.API - ( MIRPot (..) ) + ( MIRPot (..) + ) import Data.Aeson - ( ToJSON (..), (.=) ) + ( ToJSON (..) + , (.=) + ) import Data.ByteString - ( ByteString ) + ( ByteString + ) import Data.Coerce - ( coerce ) + ( coerce + ) import Data.Int - ( Int64 ) + ( Int64 + ) import Data.IntCast - ( intCast ) + ( intCast + ) import Data.IP - ( IPv4, IPv6, fromHostAddress, fromHostAddress6 ) + ( IPv4 + , IPv6 + , fromHostAddress + , fromHostAddress6 + ) import Data.List - ( nub ) + ( nub + ) import Data.Map - ( Map ) + ( Map + ) import Data.Maybe - ( isJust ) + ( isJust + ) import Data.Maybe.Strict - ( strictMaybeToMaybe ) + ( strictMaybeToMaybe + ) import Data.Ratio - ( Ratio, (%) ) + ( Ratio + , (%) + ) import Data.Set - ( Set ) + ( Set + ) import Data.String - ( fromString ) + ( fromString + ) import Data.Text - ( Text ) + ( Text + ) import Data.Word - ( Word16, Word32, Word64 ) + ( Word16 + , Word32 + , Word64 + ) import Network.Socket - ( PortNumber ) + ( PortNumber + ) import Numeric.Natural - ( Natural ) + ( Natural + ) import System.Random - ( Random ) + ( Random + ) import Test.Cardano.Chain.UTxO.Gen - ( genVKWitness ) + ( genVKWitness + ) import Test.Cardano.Crypto.Gen - ( genProtocolMagicId ) + ( genProtocolMagicId + ) import Test.QuickCheck ( Gen , Large (..) @@ -208,9 +244,13 @@ import Test.QuickCheck , vectorOf ) import Test.QuickCheck.Extra - ( GenSeed (..), genSizeDefault, generateWith ) + ( GenSeed (..) + , genSizeDefault + , generateWith + ) import Test.QuickCheck.Hedgehog - ( hedgehog ) + ( hedgehog + ) import Test.QuickCheck.Instances.ByteString () diff --git a/lib/cardano-api-extra/lib/Cardano/Ledger/Credential/Safe.hs b/lib/cardano-api-extra/lib/Cardano/Ledger/Credential/Safe.hs index 169afae624b..3103efdfd75 100644 --- a/lib/cardano-api-extra/lib/Cardano/Ledger/Credential/Safe.hs +++ b/lib/cardano-api-extra/lib/Cardano/Ledger/Credential/Safe.hs @@ -26,19 +26,29 @@ module Cardano.Ledger.Credential.Safe import Prelude import Cardano.Api - ( SlotNo (..) ) + ( SlotNo (..) + ) import Cardano.Ledger.BaseTypes - ( CertIx, TxIx ) + ( CertIx + , TxIx + ) import Cardano.Ledger.Credential - ( Ptr (..) ) + ( Ptr (..) + ) import Data.IntCast - ( intCast, intCastMaybe ) + ( intCast + , intCastMaybe + ) import Data.Maybe - ( fromMaybe ) + ( fromMaybe + ) import Data.Word - ( Word32, Word64 ) + ( Word32 + , Word64 + ) import GHC.Stack - ( HasCallStack ) + ( HasCallStack + ) -------------------------------------------------------------------------------- -- Safe public interface diff --git a/lib/cardano-api-extra/test/spec/Cardano/Api/GenSpec.hs b/lib/cardano-api-extra/test/spec/Cardano/Api/GenSpec.hs index de131717b27..aeca8d3348a 100644 --- a/lib/cardano-api-extra/test/spec/Cardano/Api/GenSpec.hs +++ b/lib/cardano-api-extra/test/spec/Cardano/Api/GenSpec.hs @@ -81,7 +81,9 @@ import Cardano.Api , withdrawalsSupportedInEra ) import Cardano.Api.Byron - ( KeyWitness (ByronKeyWitness), WitnessNetworkIdOrByronAddress (..) ) + ( KeyWitness (ByronKeyWitness) + , WitnessNetworkIdOrByronAddress (..) + ) import Cardano.Api.Gen ( genAddressInEra , genAlphaNum @@ -148,31 +150,55 @@ import Cardano.Api.Shelley , refInsScriptsAndInlineDatsSupportedInEra ) import Cardano.Chain.UTxO - ( TxInWitness (..) ) + ( TxInWitness (..) + ) import Cardano.Ledger.Credential.Safe - ( Ptr, SlotNo32, safePtr, safeUnwrapPtr ) + ( Ptr + , SlotNo32 + , safePtr + , safeUnwrapPtr + ) import Cardano.Ledger.Shelley.API - ( MIRPot (..) ) + ( MIRPot (..) + ) import Data.Char - ( isAlphaNum, isDigit, isLower, isUpper ) + ( isAlphaNum + , isDigit + , isLower + , isUpper + ) import Data.Foldable - ( traverse_ ) + ( traverse_ + ) import Data.Function - ( (&) ) + ( (&) + ) import Data.Int - ( Int32 ) + ( Int32 + ) import Data.List - ( (\\) ) + ( (\\) + ) import Data.Map.Strict - ( Map ) + ( Map + ) import Data.Ratio - ( denominator, numerator ) + ( denominator + , numerator + ) import Data.Word - ( Word32, Word64, Word8 ) + ( Word32 + , Word64 + , Word8 + ) import Numeric.Natural - ( Natural ) + ( Natural + ) import Test.Hspec - ( Spec, describe, it ) + ( Spec + , describe + , it + ) import Test.QuickCheck ( Arbitrary , Property @@ -191,7 +217,9 @@ import Test.QuickCheck.Instances.ByteString import qualified Cardano.Ledger.Alonzo.Scripts as Ledger import qualified Cardano.Ledger.BaseTypes as Ledger - ( CertIx (..), TxIx (..) ) + ( CertIx (..) + , TxIx (..) + ) import qualified Data.ByteString as BS import qualified Data.ByteString.Char8 as B8 import qualified Data.Map.Strict as Map diff --git a/lib/cardano-api-extra/test/spec/run-test-suite.hs b/lib/cardano-api-extra/test/spec/run-test-suite.hs index 349e4b80090..66edcab2e95 100644 --- a/lib/cardano-api-extra/test/spec/run-test-suite.hs +++ b/lib/cardano-api-extra/test/spec/run-test-suite.hs @@ -3,9 +3,11 @@ module Main where import Prelude import Main.Utf8 - ( withUtf8 ) + ( withUtf8 + ) import Test.Hspec.Extra - ( hspecMain ) + ( hspecMain + ) import qualified Spec diff --git a/lib/coin-selection/bench/UTxOIndexBench.hs b/lib/coin-selection/bench/UTxOIndexBench.hs index a2e0318ed60..0e4ab3d14c4 100644 --- a/lib/coin-selection/bench/UTxOIndexBench.hs +++ b/lib/coin-selection/bench/UTxOIndexBench.hs @@ -12,35 +12,63 @@ module Main where import Prelude import Cardano.Wallet.Primitive.Types.Coin - ( Coin (..) ) + ( Coin (..) + ) import Cardano.Wallet.Primitive.Types.Hash - ( Hash (..), mockHash ) + ( Hash (..) + , mockHash + ) import Cardano.Wallet.Primitive.Types.TokenBundle - ( TokenBundle (..) ) + ( TokenBundle (..) + ) import Cardano.Wallet.Primitive.Types.TokenMap - ( AssetId (..), TokenMap ) + ( AssetId (..) + , TokenMap + ) import Cardano.Wallet.Primitive.Types.TokenPolicy - ( TokenName (..), TokenPolicyId (..) ) + ( TokenName (..) + , TokenPolicyId (..) + ) import Cardano.Wallet.Primitive.Types.TokenQuantity - ( TokenQuantity (..) ) + ( TokenQuantity (..) + ) import Control.DeepSeq - ( rnf ) + ( rnf + ) import Control.Exception - ( evaluate ) + ( evaluate + ) import Data.Map.Strict - ( Map ) + ( Map + ) import Data.Text.Format.Numbers - ( prettyI ) + ( prettyI + ) import Numeric.Natural - ( Natural ) + ( Natural + ) import Test.QuickCheck - ( choose, frequency, oneof, vectorOf ) + ( choose + , frequency + , oneof + , vectorOf + ) import Test.QuickCheck.Extra - ( GenSeed (GenSeed), chooseNatural, genSizeDefault, generateWith ) + ( GenSeed (GenSeed) + , chooseNatural + , genSizeDefault + , generateWith + ) import Test.QuickCheck.Gen - ( Gen (..) ) + ( Gen (..) + ) import Test.Tasty.Bench - ( Benchmark, bench, bgroup, defaultMain, nf ) + ( Benchmark + , bench + , bgroup + , defaultMain + , nf + ) import qualified Cardano.CoinSelection.UTxOIndex as UTxOIndex import qualified Cardano.Wallet.Primitive.Types.TokenBundle as TokenBundle diff --git a/lib/coin-selection/lib/Cardano/CoinSelection.hs b/lib/coin-selection/lib/Cardano/CoinSelection.hs index 87c11d66742..623b48587d8 100644 --- a/lib/coin-selection/lib/Cardano/CoinSelection.hs +++ b/lib/coin-selection/lib/Cardano/CoinSelection.hs @@ -57,7 +57,8 @@ module Cardano.CoinSelection import Prelude import Algebra.PartialOrd - ( PartialOrd (..) ) + ( PartialOrd (..) + ) import Cardano.CoinSelection.Balance ( SelectionBalanceError (..) , SelectionDelta (..) @@ -65,49 +66,77 @@ import Cardano.CoinSelection.Balance , SelectionStrategy (..) ) import Cardano.CoinSelection.Context - ( SelectionContext (..) ) + ( SelectionContext (..) + ) import Cardano.CoinSelection.Size - ( TokenBundleSizeAssessment (..), TokenBundleSizeAssessor (..) ) + ( TokenBundleSizeAssessment (..) + , TokenBundleSizeAssessor (..) + ) import Cardano.CoinSelection.UTxOSelection - ( UTxOSelection ) + ( UTxOSelection + ) import Cardano.Wallet.Primitive.Types.Coin - ( Coin (..) ) + ( Coin (..) + ) import Cardano.Wallet.Primitive.Types.TokenBundle - ( TokenBundle ) + ( TokenBundle + ) import Cardano.Wallet.Primitive.Types.TokenMap - ( AssetId, TokenMap ) + ( AssetId + , TokenMap + ) import Cardano.Wallet.Primitive.Types.TokenQuantity - ( TokenQuantity ) + ( TokenQuantity + ) import Control.Monad.Random.Class - ( MonadRandom (..) ) + ( MonadRandom (..) + ) import Control.Monad.Random.NonRandom - ( NonRandom (..) ) + ( NonRandom (..) + ) import Control.Monad.Trans.Except - ( ExceptT (..), runExceptT, withExceptT ) + ( ExceptT (..) + , runExceptT + , withExceptT + ) import Data.Function - ( (&) ) + ( (&) + ) import Data.Functor - ( (<&>) ) + ( (<&>) + ) import Data.Generics.Internal.VL.Lens - ( over, view, (^.) ) + ( over + , view + , (^.) + ) import Data.Generics.Labels () import Data.List.NonEmpty - ( NonEmpty (..) ) + ( NonEmpty (..) + ) import Data.Map.Strict - ( Map ) + ( Map + ) import Data.Maybe - ( mapMaybe ) + ( mapMaybe + ) import Data.Ratio - ( (%) ) + ( (%) + ) import Data.Semigroup - ( All (..), mtimesDefault ) + ( All (..) + , mtimesDefault + ) import GHC.Generics - ( Generic ) + ( Generic + ) import GHC.Stack - ( HasCallStack ) + ( HasCallStack + ) import Numeric.Natural - ( Natural ) + ( Natural + ) import qualified Cardano.CoinSelection.Balance as Balance import qualified Cardano.CoinSelection.Collateral as Collateral diff --git a/lib/coin-selection/lib/Cardano/CoinSelection/Balance.hs b/lib/coin-selection/lib/Cardano/CoinSelection/Balance.hs index bbd55e4cce3..2f5e6143b38 100644 --- a/lib/coin-selection/lib/Cardano/CoinSelection/Balance.hs +++ b/lib/coin-selection/lib/Cardano/CoinSelection/Balance.hs @@ -117,67 +117,107 @@ module Cardano.CoinSelection.Balance import Prelude import Algebra.PartialOrd - ( PartialOrd (..) ) + ( PartialOrd (..) + ) import Cardano.CoinSelection.Context - ( SelectionContext (..) ) + ( SelectionContext (..) + ) import Cardano.CoinSelection.Size - ( TokenBundleSizeAssessment (..), TokenBundleSizeAssessor (..) ) + ( TokenBundleSizeAssessment (..) + , TokenBundleSizeAssessor (..) + ) import Cardano.CoinSelection.UTxOIndex - ( Asset (..), SelectionFilter (..), UTxOIndex (..) ) + ( Asset (..) + , SelectionFilter (..) + , UTxOIndex (..) + ) import Cardano.CoinSelection.UTxOSelection - ( IsUTxOSelection, UTxOSelection, UTxOSelectionNonEmpty ) + ( IsUTxOSelection + , UTxOSelection + , UTxOSelectionNonEmpty + ) import Cardano.Numeric.Util - ( padCoalesce ) + ( padCoalesce + ) import Cardano.Wallet.Primitive.Types.Coin - ( Coin (..) ) + ( Coin (..) + ) import Cardano.Wallet.Primitive.Types.TokenBundle - ( TokenBundle (..) ) + ( TokenBundle (..) + ) import Cardano.Wallet.Primitive.Types.TokenMap - ( AssetId, Lexicographic (..), TokenMap ) + ( AssetId + , Lexicographic (..) + , TokenMap + ) import Cardano.Wallet.Primitive.Types.TokenQuantity - ( TokenQuantity (..) ) + ( TokenQuantity (..) + ) import Control.Monad.Extra - ( andM, (<=<) ) + ( andM + , (<=<) + ) import Control.Monad.Random.Class - ( MonadRandom (..) ) + ( MonadRandom (..) + ) import Data.Bifunctor - ( first ) + ( first + ) import Data.Either.Extra - ( maybeToEither ) + ( maybeToEither + ) import Data.Function - ( (&) ) + ( (&) + ) import Data.Functor.Identity - ( Identity (..) ) + ( Identity (..) + ) import Data.Generics.Internal.VL.Lens - ( view ) + ( view + ) import Data.Generics.Labels () import Data.IntCast - ( intCast ) + ( intCast + ) import Data.List.NonEmpty - ( NonEmpty (..) ) + ( NonEmpty (..) + ) import Data.Map.Strict - ( Map ) + ( Map + ) import Data.Maybe - ( fromMaybe ) + ( fromMaybe + ) import Data.Monoid.Monus - ( Monus ((<\>)) ) + ( Monus ((<\>)) + ) import Data.Ord - ( comparing ) + ( comparing + ) import Data.Semigroup - ( mtimesDefault ) + ( mtimesDefault + ) import Data.Semigroup.Cancellative - ( Reductive (()) ) + ( Reductive (()) + ) import Data.Set - ( Set ) + ( Set + ) import Fmt - ( Buildable (..), Builder, blockMapF ) + ( Buildable (..) + , Builder + , blockMapF + ) import GHC.Generics - ( Generic ) + ( Generic + ) import GHC.Stack - ( HasCallStack ) + ( HasCallStack + ) import Numeric.Natural - ( Natural ) + ( Natural + ) import qualified Cardano.CoinSelection.UTxOIndex as UTxOIndex import qualified Cardano.CoinSelection.UTxOSelection as UTxOSelection diff --git a/lib/coin-selection/lib/Cardano/CoinSelection/Balance/Gen.hs b/lib/coin-selection/lib/Cardano/CoinSelection/Balance/Gen.hs index 8dc7ad7a4c3..9024831ae97 100644 --- a/lib/coin-selection/lib/Cardano/CoinSelection/Balance/Gen.hs +++ b/lib/coin-selection/lib/Cardano/CoinSelection/Balance/Gen.hs @@ -12,19 +12,29 @@ module Cardano.CoinSelection.Balance.Gen import Prelude import Cardano.CoinSelection.Balance - ( SelectionSkeleton (..), SelectionStrategy (..) ) + ( SelectionSkeleton (..) + , SelectionStrategy (..) + ) import Cardano.CoinSelection.Context - ( SelectionContext (..) ) + ( SelectionContext (..) + ) import Cardano.Wallet.Primitive.Types.Coin - ( Coin (..) ) + ( Coin (..) + ) import Cardano.Wallet.Primitive.Types.TokenBundle - ( TokenBundle ) + ( TokenBundle + ) import Cardano.Wallet.Primitive.Types.TokenBundle.Gen - ( genTokenBundleSmallRange, shrinkTokenBundleSmallRange ) + ( genTokenBundleSmallRange + , shrinkTokenBundleSmallRange + ) import Cardano.Wallet.Primitive.Types.TokenMap.Gen - ( genAssetId, shrinkAssetId ) + ( genAssetId + , shrinkAssetId + ) import Generics.SOP - ( NP (..) ) + ( NP (..) + ) import Test.QuickCheck ( Gen , NonNegative (..) @@ -37,7 +47,10 @@ import Test.QuickCheck , suchThat ) import Test.QuickCheck.Extra - ( genericRoundRobinShrink, (<:>), (<@>) ) + ( genericRoundRobinShrink + , (<:>) + , (<@>) + ) import qualified Cardano.Wallet.Primitive.Types.TokenBundle as TokenBundle import qualified Data.Set as Set diff --git a/lib/coin-selection/lib/Cardano/CoinSelection/Collateral.hs b/lib/coin-selection/lib/Cardano/CoinSelection/Collateral.hs index d7bddc44189..fb5102dcba7 100644 --- a/lib/coin-selection/lib/Cardano/CoinSelection/Collateral.hs +++ b/lib/coin-selection/lib/Cardano/CoinSelection/Collateral.hs @@ -58,25 +58,37 @@ module Cardano.CoinSelection.Collateral where import Cardano.Wallet.Primitive.Types.Coin - ( Coin ) + ( Coin + ) import Data.Function - ( (&) ) + ( (&) + ) import Data.IntCast - ( intCast, intCastMaybe ) + ( intCast + , intCastMaybe + ) import Data.List.NonEmpty - ( NonEmpty ) + ( NonEmpty + ) import Data.Map.Strict - ( Map ) + ( Map + ) import Data.Maybe - ( listToMaybe, mapMaybe ) + ( listToMaybe + , mapMaybe + ) import Data.Ord - ( Down (..) ) + ( Down (..) + ) import Data.Semigroup - ( sconcat ) + ( sconcat + ) import Data.Set - ( Set ) + ( Set + ) import GHC.Generics - ( Generic ) + ( Generic + ) import Prelude diff --git a/lib/coin-selection/lib/Cardano/CoinSelection/Context.hs b/lib/coin-selection/lib/Cardano/CoinSelection/Context.hs index cb4ca292878..efcad09cccb 100644 --- a/lib/coin-selection/lib/Cardano/CoinSelection/Context.hs +++ b/lib/coin-selection/lib/Cardano/CoinSelection/Context.hs @@ -19,7 +19,8 @@ module Cardano.CoinSelection.Context import Prelude import Fmt - ( Buildable ) + ( Buildable + ) -- | Provides a shared context for types used by coin selection. -- diff --git a/lib/coin-selection/lib/Cardano/CoinSelection/Size.hs b/lib/coin-selection/lib/Cardano/CoinSelection/Size.hs index 9b91bd52636..bfebe0577a5 100644 --- a/lib/coin-selection/lib/Cardano/CoinSelection/Size.hs +++ b/lib/coin-selection/lib/Cardano/CoinSelection/Size.hs @@ -14,9 +14,11 @@ module Cardano.CoinSelection.Size where import Cardano.Wallet.Primitive.Types.TokenBundle - ( TokenBundle (..) ) + ( TokenBundle (..) + ) import GHC.Generics - ( Generic ) + ( Generic + ) import Prelude diff --git a/lib/coin-selection/lib/Cardano/CoinSelection/UTxOIndex/Gen.hs b/lib/coin-selection/lib/Cardano/CoinSelection/UTxOIndex/Gen.hs index cdbab03915f..3789c7363d1 100644 --- a/lib/coin-selection/lib/Cardano/CoinSelection/UTxOIndex/Gen.hs +++ b/lib/coin-selection/lib/Cardano/CoinSelection/UTxOIndex/Gen.hs @@ -10,19 +10,33 @@ module Cardano.CoinSelection.UTxOIndex.Gen import Prelude import Cardano.CoinSelection.UTxOIndex - ( UTxOIndex ) + ( UTxOIndex + ) import Cardano.Wallet.Primitive.Types.TokenBundle - ( TokenBundle ) + ( TokenBundle + ) import Cardano.Wallet.Primitive.Types.TokenBundle.Gen - ( genTokenBundleSmallRangePositive, shrinkTokenBundleSmallRangePositive ) + ( genTokenBundleSmallRangePositive + , shrinkTokenBundleSmallRangePositive + ) import Control.Monad - ( replicateM ) + ( replicateM + ) import Generics.SOP - ( NP (..) ) + ( NP (..) + ) import Test.QuickCheck - ( Gen, choose, listOf, shrinkList, shrinkMapBy ) + ( Gen + , choose + , listOf + , shrinkList + , shrinkMapBy + ) import Test.QuickCheck.Extra - ( genericRoundRobinShrink, (<:>), (<@>) ) + ( genericRoundRobinShrink + , (<:>) + , (<@>) + ) import qualified Cardano.CoinSelection.UTxOIndex as UTxOIndex diff --git a/lib/coin-selection/lib/Cardano/CoinSelection/UTxOIndex/Internal.hs b/lib/coin-selection/lib/Cardano/CoinSelection/UTxOIndex/Internal.hs index a4cb53d0001..fe0c09fffcc 100644 --- a/lib/coin-selection/lib/Cardano/CoinSelection/UTxOIndex/Internal.hs +++ b/lib/coin-selection/lib/Cardano/CoinSelection/UTxOIndex/Internal.hs @@ -103,39 +103,56 @@ module Cardano.CoinSelection.UTxOIndex.Internal ) where import Prelude hiding - ( filter, lookup, null ) + ( filter + , lookup + , null + ) import Control.DeepSeq - ( NFData ) + ( NFData + ) import Control.Monad.Extra - ( firstJustM ) + ( firstJustM + ) import Control.Monad.Random.Class - ( MonadRandom (..) ) + ( MonadRandom (..) + ) import Data.Bifunctor - ( bimap ) + ( bimap + ) import Data.Function - ( (&) ) + ( (&) + ) import Data.List.NonEmpty - ( NonEmpty ) + ( NonEmpty + ) import Data.Map.Strict - ( Map ) + ( Map + ) import Data.Maybe - ( isJust ) + ( isJust + ) import Data.Monoid.Monus - ( Monus ((<\>)) ) + ( Monus ((<\>)) + ) import Data.MonoidMap - ( MonoidMap ) + ( MonoidMap + ) import Data.Set - ( Set ) + ( Set + ) import GHC.Generics - ( Generic ) + ( Generic + ) import qualified Cardano.Wallet.Primitive.Types.TokenBundle as W.TokenBundle import qualified Cardano.Wallet.Primitive.Types.TokenBundle as W - ( TokenBundle ) + ( TokenBundle + ) import qualified Cardano.Wallet.Primitive.Types.TokenMap as W.TokenMap import qualified Cardano.Wallet.Primitive.Types.TokenMap as W - ( AssetId ) + ( AssetId + ) import qualified Data.Foldable as F import qualified Data.List as L import qualified Data.List.NonEmpty as NE diff --git a/lib/coin-selection/lib/Cardano/CoinSelection/UTxOSelection.hs b/lib/coin-selection/lib/Cardano/CoinSelection/UTxOSelection.hs index 6b7005dfaef..d6215006de1 100644 --- a/lib/coin-selection/lib/Cardano/CoinSelection/UTxOSelection.hs +++ b/lib/coin-selection/lib/Cardano/CoinSelection/UTxOSelection.hs @@ -87,29 +87,41 @@ module Cardano.CoinSelection.UTxOSelection import Prelude import Cardano.CoinSelection.UTxOIndex - ( UTxOIndex ) + ( UTxOIndex + ) import Cardano.Wallet.Primitive.Types.TokenBundle - ( TokenBundle ) + ( TokenBundle + ) import Control.Monad - ( ap, (<=<) ) + ( ap + , (<=<) + ) import Data.Bool - ( bool ) + ( bool + ) import Data.Function - ( (&) ) + ( (&) + ) import Data.Generics.Internal.VL.Lens - ( over ) + ( over + ) import Data.Generics.Labels () import Data.List.NonEmpty - ( NonEmpty ) + ( NonEmpty + ) import Data.Map.Strict - ( Map ) + ( Map + ) import Data.Maybe - ( fromMaybe ) + ( fromMaybe + ) import Data.Tuple - ( swap ) + ( swap + ) import GHC.Generics - ( Generic ) + ( Generic + ) import qualified Cardano.CoinSelection.UTxOIndex as UTxOIndex import qualified Data.Foldable as F diff --git a/lib/coin-selection/lib/Cardano/CoinSelection/UTxOSelection/Gen.hs b/lib/coin-selection/lib/Cardano/CoinSelection/UTxOSelection/Gen.hs index f885350924a..5164d1871b2 100644 --- a/lib/coin-selection/lib/Cardano/CoinSelection/UTxOSelection/Gen.hs +++ b/lib/coin-selection/lib/Cardano/CoinSelection/UTxOSelection/Gen.hs @@ -12,15 +12,27 @@ module Cardano.CoinSelection.UTxOSelection.Gen import Prelude import Cardano.CoinSelection.UTxOIndex.Gen - ( genUTxOIndex, shrinkUTxOIndex ) + ( genUTxOIndex + , shrinkUTxOIndex + ) import Cardano.CoinSelection.UTxOSelection - ( UTxOSelection, UTxOSelectionNonEmpty ) + ( UTxOSelection + , UTxOSelectionNonEmpty + ) import Data.Maybe - ( mapMaybe ) + ( mapMaybe + ) import Test.QuickCheck - ( Gen, arbitrary, coarbitrary, liftShrink2, shrinkMapBy, suchThatMap ) + ( Gen + , arbitrary + , coarbitrary + , liftShrink2 + , shrinkMapBy + , suchThatMap + ) import Test.QuickCheck.Extra - ( genFunction ) + ( genFunction + ) import qualified Cardano.CoinSelection.UTxOSelection as UTxOSelection diff --git a/lib/coin-selection/test/spec/Cardano/CoinSelection/BalanceSpec.hs b/lib/coin-selection/test/spec/Cardano/CoinSelection/BalanceSpec.hs index c98e9878c15..fa55c33ce3c 100644 --- a/lib/coin-selection/test/spec/Cardano/CoinSelection/BalanceSpec.hs +++ b/lib/coin-selection/test/spec/Cardano/CoinSelection/BalanceSpec.hs @@ -44,7 +44,8 @@ module Cardano.CoinSelection.BalanceSpec import Prelude import Algebra.PartialOrd - ( PartialOrd (..) ) + ( PartialOrd (..) + ) import Cardano.CoinSelection.Balance ( AssetCount (..) , BalanceInsufficientError (..) @@ -97,34 +98,60 @@ import Cardano.CoinSelection.Balance , ungroupByKey ) import Cardano.CoinSelection.Balance.Gen - ( genSelectionStrategy, shrinkSelectionStrategy ) + ( genSelectionStrategy + , shrinkSelectionStrategy + ) import Cardano.CoinSelection.Size - ( TokenBundleSizeAssessment (..), TokenBundleSizeAssessor (..) ) + ( TokenBundleSizeAssessment (..) + , TokenBundleSizeAssessor (..) + ) import Cardano.CoinSelection.UTxOIndex - ( Asset (..), SelectionFilter (..), UTxOIndex ) + ( Asset (..) + , SelectionFilter (..) + , UTxOIndex + ) import Cardano.CoinSelection.UTxOIndex.Gen - ( genUTxOIndex, genUTxOIndexLarge, genUTxOIndexLargeN, shrinkUTxOIndex ) + ( genUTxOIndex + , genUTxOIndexLarge + , genUTxOIndexLargeN + , shrinkUTxOIndex + ) import Cardano.CoinSelection.UTxOSelection - ( UTxOSelection, UTxOSelectionNonEmpty ) + ( UTxOSelection + , UTxOSelectionNonEmpty + ) import Cardano.CoinSelection.UTxOSelection.Gen - ( genUTxOSelection, shrinkUTxOSelection ) + ( genUTxOSelection + , shrinkUTxOSelection + ) import Cardano.Numeric.Util - ( inAscendingPartialOrder ) + ( inAscendingPartialOrder + ) import Cardano.Wallet.Primitive.Types.Coin - ( Coin (..) ) + ( Coin (..) + ) import Cardano.Wallet.Primitive.Types.Coin.Gen - ( genCoin, genCoinPositive, shrinkCoin, shrinkCoinPositive ) + ( genCoin + , genCoinPositive + , shrinkCoin + , shrinkCoinPositive + ) import Cardano.Wallet.Primitive.Types.Hash - ( Hash (..) ) + ( Hash (..) + ) import Cardano.Wallet.Primitive.Types.TokenBundle - ( Flat (..), TokenBundle (..) ) + ( Flat (..) + , TokenBundle (..) + ) import Cardano.Wallet.Primitive.Types.TokenBundle.Gen ( genTokenBundleSmallRangePositive , shrinkTokenBundleSmallRange , shrinkTokenBundleSmallRangePositive ) import Cardano.Wallet.Primitive.Types.TokenMap - ( AssetId (..), TokenMap ) + ( AssetId (..) + , TokenMap + ) import Cardano.Wallet.Primitive.Types.TokenMap.Gen ( genAssetId , genAssetIdLargeRange @@ -133,59 +160,100 @@ import Cardano.Wallet.Primitive.Types.TokenMap.Gen , shrinkTokenMap ) import Cardano.Wallet.Primitive.Types.TokenPolicy - ( TokenName (..), TokenPolicyId (..) ) + ( TokenName (..) + , TokenPolicyId (..) + ) import Cardano.Wallet.Primitive.Types.TokenPolicy.Gen - ( genTokenName ) + ( genTokenName + ) import Cardano.Wallet.Primitive.Types.TokenQuantity - ( TokenQuantity (..) ) + ( TokenQuantity (..) + ) import Cardano.Wallet.Primitive.Types.TokenQuantity.Gen - ( genTokenQuantityPositive, shrinkTokenQuantityPositive ) + ( genTokenQuantityPositive + , shrinkTokenQuantityPositive + ) import Control.Monad - ( forM_, replicateM ) + ( forM_ + , replicateM + ) import Data.Bifunctor - ( bimap, second ) + ( bimap + , second + ) import Data.ByteString - ( ByteString ) + ( ByteString + ) import Data.Function - ( (&) ) + ( (&) + ) import Data.Functor - ( (<&>) ) + ( (<&>) + ) import Data.Functor.Identity - ( Identity (..) ) + ( Identity (..) + ) import Data.Generics.Internal.VL.Lens - ( view ) + ( view + ) import Data.Generics.Labels () import Data.IntCast - ( intCast ) + ( intCast + ) import Data.List.NonEmpty - ( NonEmpty (..) ) + ( NonEmpty (..) + ) import Data.Map.Strict - ( Map ) + ( Map + ) import Data.Maybe - ( fromMaybe, isJust, isNothing, listToMaybe ) + ( fromMaybe + , isJust + , isNothing + , listToMaybe + ) import Data.Monoid.Monus - ( Monus ((<\>)) ) + ( Monus ((<\>)) + ) import Data.Set - ( Set ) + ( Set + ) import Data.Tuple - ( swap ) + ( swap + ) import Data.Word - ( Word64, Word8 ) + ( Word64 + , Word8 + ) import Fmt - ( Buildable (..), blockListF, pretty ) + ( Buildable (..) + , blockListF + , pretty + ) import Generics.SOP - ( NP (..) ) + ( NP (..) + ) import GHC.Generics - ( Generic ) + ( Generic + ) import Numeric.Natural - ( Natural ) + ( Natural + ) import Safe - ( tailMay ) + ( tailMay + ) import Test.Hspec - ( Expectation, Spec, SpecWith, describe, it, shouldBe ) + ( Expectation + , Spec + , SpecWith + , describe + , it + , shouldBe + ) import Test.Hspec.Core.QuickCheck - ( modifyMaxSuccess ) + ( modifyMaxSuccess + ) import Test.QuickCheck ( Arbitrary (..) , Blind (..) @@ -221,17 +289,34 @@ import Test.QuickCheck , (==>) ) import Test.QuickCheck.Classes - ( eqLaws, ordLaws ) + ( eqLaws + , ordLaws + ) import Test.QuickCheck.Extra - ( genFunction, genericRoundRobinShrink, report, verify, (<:>), (<@>) ) + ( genFunction + , genericRoundRobinShrink + , report + , verify + , (<:>) + , (<@>) + ) import Test.QuickCheck.Monadic - ( PropertyM (..), assert, monadicIO, monitor, run ) + ( PropertyM (..) + , assert + , monadicIO + , monitor + , run + ) import Test.QuickCheck.Quid - ( Hexadecimal (..), Quid ) + ( Hexadecimal (..) + , Quid + ) import Test.Utils.Laws - ( testLawsMany ) + ( testLawsMany + ) import Test.Utils.Pretty - ( Pretty (..) ) + ( Pretty (..) + ) import qualified Cardano.CoinSelection.Context as SC import qualified Cardano.CoinSelection.UTxOIndex as UTxOIndex diff --git a/lib/coin-selection/test/spec/Cardano/CoinSelection/CollateralSpec.hs b/lib/coin-selection/test/spec/Cardano/CoinSelection/CollateralSpec.hs index 2cf8e5327a1..7f3e8637e34 100644 --- a/lib/coin-selection/test/spec/Cardano/CoinSelection/CollateralSpec.hs +++ b/lib/coin-selection/test/spec/Cardano/CoinSelection/CollateralSpec.hs @@ -24,7 +24,8 @@ module Cardano.CoinSelection.CollateralSpec where import Prelude hiding - ( sequence ) + ( sequence + ) import Cardano.CoinSelection.Collateral ( PerformSelection @@ -46,33 +47,50 @@ import Cardano.CoinSelection.Collateral , takeUntil ) import Cardano.Wallet.Primitive.Types.Coin - ( Coin (..) ) + ( Coin (..) + ) import Cardano.Wallet.Primitive.Types.Coin.Gen - ( genCoinPositive, shrinkCoinPositive ) + ( genCoinPositive + , shrinkCoinPositive + ) import Control.Monad - ( forM_ ) + ( forM_ + ) import Data.Either - ( isLeft, isRight ) + ( isLeft + , isRight + ) import Data.Generics.Internal.VL.Lens - ( view ) + ( view + ) import Data.Generics.Labels () import Data.IntCast - ( intCast ) + ( intCast + ) import Data.List.NonEmpty - ( NonEmpty (..) ) + ( NonEmpty (..) + ) import Data.Map.Strict - ( Map ) + ( Map + ) import Data.Set - ( Set ) + ( Set + ) import Data.Word - ( Word64 ) + ( Word64 + ) import GHC.Generics - ( Generic ) + ( Generic + ) import Numeric.Natural - ( Natural ) + ( Natural + ) import Test.Hspec - ( Spec, describe, it ) + ( Spec + , describe + , it + ) import Test.QuickCheck ( Arbitrary (..) , Gen @@ -96,9 +114,12 @@ import Test.QuickCheck , (===) ) import Test.QuickCheck.Quid - ( Hexadecimal (..), Quid ) + ( Hexadecimal (..) + , Quid + ) import Text.Pretty.Simple - ( pShow ) + ( pShow + ) import qualified Data.Bits as Bits import qualified Data.Foldable as F diff --git a/lib/coin-selection/test/spec/Cardano/CoinSelection/UTxOIndexSpec.hs b/lib/coin-selection/test/spec/Cardano/CoinSelection/UTxOIndexSpec.hs index 59709e17571..34292ef81c0 100644 --- a/lib/coin-selection/test/spec/Cardano/CoinSelection/UTxOIndexSpec.hs +++ b/lib/coin-selection/test/spec/Cardano/CoinSelection/UTxOIndexSpec.hs @@ -18,7 +18,9 @@ module Cardano.CoinSelection.UTxOIndexSpec import Prelude import Cardano.CoinSelection.UTxOIndex.Gen - ( genUTxOIndex, shrinkUTxOIndex ) + ( genUTxOIndex + , shrinkUTxOIndex + ) import Cardano.CoinSelection.UTxOIndex.Internal ( Asset (..) , BundleCategory (..) @@ -29,31 +31,49 @@ import Cardano.CoinSelection.UTxOIndex.Internal , checkInvariant ) import Cardano.Wallet.Primitive.Types.TokenBundle - ( TokenBundle ) + ( TokenBundle + ) import Cardano.Wallet.Primitive.Types.TokenBundle.Gen - ( genTokenBundleSmallRangePositive, shrinkTokenBundleSmallRangePositive ) + ( genTokenBundleSmallRangePositive + , shrinkTokenBundleSmallRangePositive + ) import Cardano.Wallet.Primitive.Types.TokenMap - ( AssetId ) + ( AssetId + ) import Cardano.Wallet.Primitive.Types.TokenMap.Gen - ( genAssetId, shrinkAssetId ) + ( genAssetId + , shrinkAssetId + ) import Control.Monad - ( void ) + ( void + ) import Control.Monad.Random.Class - ( MonadRandom (..) ) + ( MonadRandom (..) + ) import Data.Function - ( (&) ) + ( (&) + ) import Data.Map.Strict - ( Map ) + ( Map + ) import Data.Maybe - ( isJust, isNothing ) + ( isJust + , isNothing + ) import Data.Monoid.Monus - ( Monus ((<\>)) ) + ( Monus ((<\>)) + ) import Data.Ratio - ( (%) ) + ( (%) + ) import Data.Word - ( Word8 ) + ( Word8 + ) import Test.Hspec - ( Spec, describe, it ) + ( Spec + , describe + , it + ) import Test.QuickCheck ( Arbitrary (..) , CoArbitrary (..) @@ -75,13 +95,22 @@ import Test.QuickCheck , (===) ) import Test.QuickCheck.Classes - ( eqLaws ) + ( eqLaws + ) import Test.QuickCheck.Monadic - ( assert, monadicIO, monitor, run ) + ( assert + , monadicIO + , monitor + , run + ) import Test.QuickCheck.Quid - ( Hexadecimal (..), Quid, Size (..) ) + ( Hexadecimal (..) + , Quid + , Size (..) + ) import Test.Utils.Laws - ( testLawsMany ) + ( testLawsMany + ) import qualified Cardano.CoinSelection.UTxOIndex.Internal as UTxOIndex import qualified Data.Foldable as F diff --git a/lib/coin-selection/test/spec/Cardano/CoinSelection/UTxOSelectionSpec.hs b/lib/coin-selection/test/spec/Cardano/CoinSelection/UTxOSelectionSpec.hs index 6082935a25a..713b04254bb 100644 --- a/lib/coin-selection/test/spec/Cardano/CoinSelection/UTxOSelectionSpec.hs +++ b/lib/coin-selection/test/spec/Cardano/CoinSelection/UTxOSelectionSpec.hs @@ -15,11 +15,17 @@ module Cardano.CoinSelection.UTxOSelectionSpec import Prelude import Cardano.CoinSelection.UTxOIndex - ( UTxOIndex ) + ( UTxOIndex + ) import Cardano.CoinSelection.UTxOIndex.Gen - ( genUTxOIndex, shrinkUTxOIndex ) + ( genUTxOIndex + , shrinkUTxOIndex + ) import Cardano.CoinSelection.UTxOSelection - ( IsUTxOSelection, UTxOSelection, UTxOSelectionNonEmpty ) + ( IsUTxOSelection + , UTxOSelection + , UTxOSelectionNonEmpty + ) import Cardano.CoinSelection.UTxOSelection.Gen ( genUTxOSelection , genUTxOSelectionNonEmpty @@ -27,7 +33,10 @@ import Cardano.CoinSelection.UTxOSelection.Gen , shrinkUTxOSelectionNonEmpty ) import Test.Hspec - ( Spec, describe, it ) + ( Spec + , describe + , it + ) import Test.QuickCheck ( Arbitrary (..) , CoArbitrary (..) @@ -41,7 +50,10 @@ import Test.QuickCheck , (===) ) import Test.QuickCheck.Quid - ( Hexadecimal (..), Quid, Size (..) ) + ( Hexadecimal (..) + , Quid + , Size (..) + ) import qualified Cardano.CoinSelection.UTxOIndex as UTxOIndex import qualified Cardano.CoinSelection.UTxOSelection as UTxOSelection diff --git a/lib/coin-selection/test/spec/Cardano/CoinSelectionSpec.hs b/lib/coin-selection/test/spec/Cardano/CoinSelectionSpec.hs index ff4ffab08ec..b64c9d95b60 100644 --- a/lib/coin-selection/test/spec/Cardano/CoinSelectionSpec.hs +++ b/lib/coin-selection/test/spec/Cardano/CoinSelectionSpec.hs @@ -35,7 +35,8 @@ import Cardano.CoinSelection , verifySelectionError ) import Cardano.CoinSelection.Balance - ( SelectionSkeleton ) + ( SelectionSkeleton + ) import Cardano.CoinSelection.Balance.Gen ( genSelectionSkeleton , genSelectionStrategy @@ -60,47 +61,79 @@ import Cardano.CoinSelection.BalanceSpec , unMockComputeMinimumCost ) import Cardano.CoinSelection.UTxOSelection - ( UTxOSelection ) + ( UTxOSelection + ) import Cardano.CoinSelection.UTxOSelection.Gen - ( genUTxOSelection, shrinkUTxOSelection ) + ( genUTxOSelection + , shrinkUTxOSelection + ) import Cardano.Wallet.Primitive.Types.Coin - ( Coin (..) ) + ( Coin (..) + ) import Cardano.Wallet.Primitive.Types.Coin.Gen - ( genCoin, genCoinPositive, shrinkCoin, shrinkCoinPositive ) + ( genCoin + , genCoinPositive + , shrinkCoin + , shrinkCoinPositive + ) import Cardano.Wallet.Primitive.Types.TokenBundle - ( TokenBundle (..) ) + ( TokenBundle (..) + ) import Cardano.Wallet.Primitive.Types.TokenBundle.Gen - ( genTokenBundleSmallRange, shrinkTokenBundleSmallRange ) + ( genTokenBundleSmallRange + , shrinkTokenBundleSmallRange + ) import Cardano.Wallet.Primitive.Types.TokenMap - ( TokenMap ) + ( TokenMap + ) import Cardano.Wallet.Primitive.Types.TokenMap.Gen - ( genAssetId, genTokenMap, shrinkTokenMap ) + ( genAssetId + , genTokenMap + , shrinkTokenMap + ) import Cardano.Wallet.Primitive.Types.TokenQuantity - ( TokenQuantity (..) ) + ( TokenQuantity (..) + ) import Control.Monad - ( forM_ ) + ( forM_ + ) import Control.Monad.Trans.Except - ( runExceptT ) + ( runExceptT + ) import Data.Either - ( isRight ) + ( isRight + ) import Data.Function - ( (&) ) + ( (&) + ) import Data.Generics.Internal.VL.Lens - ( over, view, (^.) ) + ( over + , view + , (^.) + ) import Data.IntCast - ( intCast ) + ( intCast + ) import Data.Map.Strict - ( Map ) + ( Map + ) import Data.Word - ( Word64 ) + ( Word64 + ) import Generics.SOP - ( NP (..) ) + ( NP (..) + ) import GHC.Generics - ( Generic ) + ( Generic + ) import Numeric.Natural - ( Natural ) + ( Natural + ) import Test.Hspec - ( Spec, describe, it ) + ( Spec + , describe + , it + ) import Test.QuickCheck ( Arbitrary (..) , Gen @@ -135,7 +168,9 @@ import Test.QuickCheck.Extra , (<@>) ) import Test.QuickCheck.Monadic - ( monadicIO, run ) + ( monadicIO + , run + ) import qualified Cardano.CoinSelection.Balance as Balance import qualified Cardano.CoinSelection.UTxOSelection as UTxOSelection diff --git a/lib/coin-selection/test/spec/run-test-suite.hs b/lib/coin-selection/test/spec/run-test-suite.hs index 349e4b80090..66edcab2e95 100644 --- a/lib/coin-selection/test/spec/run-test-suite.hs +++ b/lib/coin-selection/test/spec/run-test-suite.hs @@ -3,9 +3,11 @@ module Main where import Prelude import Main.Utf8 - ( withUtf8 ) + ( withUtf8 + ) import Test.Hspec.Extra - ( hspecMain ) + ( hspecMain + ) import qualified Spec diff --git a/lib/conversions/lib/Cardano/Wallet/Shelley/Compatibility/Ledger.hs b/lib/conversions/lib/Cardano/Wallet/Shelley/Compatibility/Ledger.hs index ef99c759abe..a21edb8e893 100644 --- a/lib/conversions/lib/Cardano/Wallet/Shelley/Compatibility/Ledger.hs +++ b/lib/conversions/lib/Cardano/Wallet/Shelley/Compatibility/Ledger.hs @@ -51,47 +51,73 @@ module Cardano.Wallet.Shelley.Compatibility.Ledger import Prelude import Cardano.Address.Script - ( KeyHash (..), KeyRole (..), Script (..) ) + ( KeyHash (..) + , KeyRole (..) + , Script (..) + ) import Cardano.Crypto.Hash - ( hashFromBytes, hashToBytes ) + ( hashFromBytes + , hashToBytes + ) import Cardano.Slotting.Slot - ( SlotNo (..) ) + ( SlotNo (..) + ) import Cardano.Wallet.Primitive.Types.Address - ( Address (..) ) + ( Address (..) + ) import Cardano.Wallet.Primitive.Types.Coin - ( Coin (..) ) + ( Coin (..) + ) import Cardano.Wallet.Primitive.Types.Hash - ( Hash (..) ) + ( Hash (..) + ) import Cardano.Wallet.Primitive.Types.TokenBundle - ( TokenBundle (..) ) + ( TokenBundle (..) + ) import Cardano.Wallet.Primitive.Types.TokenPolicy - ( TokenName (..), TokenPolicyId (..) ) + ( TokenName (..) + , TokenPolicyId (..) + ) import Cardano.Wallet.Primitive.Types.TokenQuantity - ( TokenQuantity (..) ) + ( TokenQuantity (..) + ) import Cardano.Wallet.Primitive.Types.Tx.TxIn - ( TxIn (..) ) + ( TxIn (..) + ) import Cardano.Wallet.Primitive.Types.Tx.TxOut - ( TxOut (..) ) + ( TxOut (..) + ) import Data.ByteString.Short - ( fromShort, toShort ) + ( fromShort + , toShort + ) import Data.Foldable - ( toList ) + ( toList + ) import Data.Function - ( (&) ) + ( (&) + ) import Data.Generics.Internal.VL.Lens - ( view ) + ( view + ) import Data.Generics.Labels () import Data.IntCast - ( intCast, intCastMaybe ) + ( intCast + , intCastMaybe + ) import Data.Maybe - ( fromMaybe ) + ( fromMaybe + ) import Fmt - ( pretty ) + ( pretty + ) import GHC.Stack - ( HasCallStack ) + ( HasCallStack + ) import Numeric.Natural - ( Natural ) + ( Natural + ) import Ouroboros.Consensus.Shelley.Eras ( StandardAllegra , StandardAlonzo diff --git a/lib/conversions/test/spec/Cardano/Wallet/Shelley/Compatibility/LedgerSpec.hs b/lib/conversions/test/spec/Cardano/Wallet/Shelley/Compatibility/LedgerSpec.hs index e66053e55fe..28c2fb4089d 100644 --- a/lib/conversions/test/spec/Cardano/Wallet/Shelley/Compatibility/LedgerSpec.hs +++ b/lib/conversions/test/spec/Cardano/Wallet/Shelley/Compatibility/LedgerSpec.hs @@ -10,41 +10,71 @@ module Cardano.Wallet.Shelley.Compatibility.LedgerSpec import Prelude import Cardano.Address.Script - ( KeyHash (..), KeyRole (..), Script (..) ) + ( KeyHash (..) + , KeyRole (..) + , Script (..) + ) import Cardano.Wallet.Primitive.Types.Coin - ( Coin (..) ) + ( Coin (..) + ) import Cardano.Wallet.Primitive.Types.TokenBundle - ( TokenBundle ) + ( TokenBundle + ) import Cardano.Wallet.Primitive.Types.TokenBundle.Gen - ( genTokenBundleSmallRange, shrinkTokenBundleSmallRange ) + ( genTokenBundleSmallRange + , shrinkTokenBundleSmallRange + ) import Cardano.Wallet.Primitive.Types.TokenPolicy - ( TokenName, TokenPolicyId ) + ( TokenName + , TokenPolicyId + ) import Cardano.Wallet.Primitive.Types.TokenPolicy.Gen - ( genTokenNameLargeRange, genTokenPolicyIdLargeRange ) + ( genTokenNameLargeRange + , genTokenPolicyIdLargeRange + ) import Cardano.Wallet.Primitive.Types.TokenQuantity - ( TokenQuantity (..) ) + ( TokenQuantity (..) + ) import Cardano.Wallet.Primitive.Types.TokenQuantity.Gen - ( genTokenQuantityFullRange, shrinkTokenQuantityFullRange ) + ( genTokenQuantityFullRange + , shrinkTokenQuantityFullRange + ) import Cardano.Wallet.Primitive.Types.Tx.TxIn - ( TxIn (..) ) + ( TxIn (..) + ) import Cardano.Wallet.Primitive.Types.Tx.TxIn.Gen - ( genTxIn, shrinkTxIn ) + ( genTxIn + , shrinkTxIn + ) import Cardano.Wallet.Primitive.Types.Tx.TxOut.Gen - ( genTxOutCoin, shrinkTxOutCoin ) + ( genTxOutCoin + , shrinkTxOutCoin + ) import Cardano.Wallet.Shelley.Compatibility.Ledger - ( Convert (..), toLedgerTimelockScript, toWalletScript ) + ( Convert (..) + , toLedgerTimelockScript + , toWalletScript + ) import Data.Proxy - ( Proxy (..) ) + ( Proxy (..) + ) import Data.Typeable - ( Typeable, typeRep ) + ( Typeable + , typeRep + ) import Ouroboros.Consensus.Shelley.Eras - ( StandardBabbage ) + ( StandardBabbage + ) import Test.Cardano.Ledger.Allegra.Arbitrary () import Test.Hspec - ( Spec, describe, it ) + ( Spec + , describe + , it + ) import Test.Hspec.Core.QuickCheck - ( modifyMaxSuccess ) + ( modifyMaxSuccess + ) import Test.QuickCheck ( Arbitrary (..) , Gen diff --git a/lib/conversions/test/spec/run-test-suite.hs b/lib/conversions/test/spec/run-test-suite.hs index 349e4b80090..66edcab2e95 100644 --- a/lib/conversions/test/spec/run-test-suite.hs +++ b/lib/conversions/test/spec/run-test-suite.hs @@ -3,9 +3,11 @@ module Main where import Prelude import Main.Utf8 - ( withUtf8 ) + ( withUtf8 + ) import Test.Hspec.Extra - ( hspecMain ) + ( hspecMain + ) import qualified Spec diff --git a/lib/crypto-hash-extra/src/Crypto/Hash/Extra.hs b/lib/crypto-hash-extra/src/Crypto/Hash/Extra.hs index c61bfb7f915..64c745c421e 100644 --- a/lib/crypto-hash-extra/src/Crypto/Hash/Extra.hs +++ b/lib/crypto-hash-extra/src/Crypto/Hash/Extra.hs @@ -8,13 +8,18 @@ module Crypto.Hash.Extra import Prelude import Crypto.Hash - ( hash ) + ( hash + ) import Crypto.Hash.Algorithms - ( Blake2b_224, Blake2b_256 ) + ( Blake2b_224 + , Blake2b_256 + ) import Data.ByteArray - ( ByteArrayAccess ) + ( ByteArrayAccess + ) import Data.ByteString - ( ByteString ) + ( ByteString + ) import qualified Data.ByteArray as BA diff --git a/lib/customer-deposit-wallet/src/Cardano/Wallet/Deposit/IO.hs b/lib/customer-deposit-wallet/src/Cardano/Wallet/Deposit/IO.hs index ebf8441a7a4..f63a87b3783 100644 --- a/lib/customer-deposit-wallet/src/Cardano/Wallet/Deposit/IO.hs +++ b/lib/customer-deposit-wallet/src/Cardano/Wallet/Deposit/IO.hs @@ -26,15 +26,22 @@ module Cardano.Wallet.Deposit.IO import Prelude import Cardano.Wallet.Deposit.Pure - ( Customer, WalletState ) + ( Customer + , WalletState + ) import Cardano.Wallet.Deposit.Read - ( Address ) + ( Address + ) import Control.Tracer - ( Tracer, contramap ) + ( Tracer + , contramap + ) import Data.Bifunctor - ( first ) + ( first + ) import Data.List.NonEmpty - ( NonEmpty ) + ( NonEmpty + ) import qualified Cardano.Wallet.Deposit.IO.DB as DB import qualified Cardano.Wallet.Deposit.IO.Network.Type as Network @@ -44,7 +51,8 @@ import qualified Cardano.Wallet.Deposit.Write as Write import qualified Control.Concurrent.Async as Async import qualified Data.DBVar as DBVar import qualified Data.Delta as Delta - ( Replace (..) ) + ( Replace (..) + ) import qualified Data.Delta.Update as Delta import qualified Data.Store as Store diff --git a/lib/customer-deposit-wallet/src/Cardano/Wallet/Deposit/IO/DB.hs b/lib/customer-deposit-wallet/src/Cardano/Wallet/Deposit/IO/DB.hs index b3d34284068..2fde257174c 100644 --- a/lib/customer-deposit-wallet/src/Cardano/Wallet/Deposit/IO/DB.hs +++ b/lib/customer-deposit-wallet/src/Cardano/Wallet/Deposit/IO/DB.hs @@ -11,15 +11,24 @@ module Cardano.Wallet.Deposit.IO.DB import Prelude import Cardano.BM.Extra - ( bracketTracer ) + ( bracketTracer + ) import Cardano.DB.Sqlite - ( DBLog (..), dbBackend, withDBHandle ) + ( DBLog (..) + , dbBackend + , withDBHandle + ) import Control.Concurrent.MVar - ( newMVar, withMVar ) + ( newMVar + , withMVar + ) import Control.Tracer - ( Tracer, contramap ) + ( Tracer + , contramap + ) import Data.Time.Clock - ( NominalDiffTime ) + ( NominalDiffTime + ) import qualified Database.Persist.Sql as Persistent diff --git a/lib/customer-deposit-wallet/src/Cardano/Wallet/Deposit/IO/Network/Type.hs b/lib/customer-deposit-wallet/src/Cardano/Wallet/Deposit/IO/Network/Type.hs index 3171dedd6b3..8203ff75168 100644 --- a/lib/customer-deposit-wallet/src/Cardano/Wallet/Deposit/IO/Network/Type.hs +++ b/lib/customer-deposit-wallet/src/Cardano/Wallet/Deposit/IO/Network/Type.hs @@ -7,17 +7,23 @@ module Cardano.Wallet.Deposit.IO.Network.Type import Prelude import Cardano.Wallet.Network - ( ChainFollower (..) ) + ( ChainFollower (..) + ) import Control.Tracer - ( Tracer ) + ( Tracer + ) import Data.List.NonEmpty - ( NonEmpty ) + ( NonEmpty + ) import Data.Text - ( Text ) + ( Text + ) import Data.Void - ( Void ) + ( Void + ) import GHC.Generics - ( Generic ) + ( Generic + ) import qualified Cardano.Wallet.Deposit.Read as Read diff --git a/lib/customer-deposit-wallet/src/Cardano/Wallet/Deposit/Pure.hs b/lib/customer-deposit-wallet/src/Cardano/Wallet/Deposit/Pure.hs index f1cfee048c0..5ac6917360f 100644 --- a/lib/customer-deposit-wallet/src/Cardano/Wallet/Deposit/Pure.hs +++ b/lib/customer-deposit-wallet/src/Cardano/Wallet/Deposit/Pure.hs @@ -39,19 +39,26 @@ module Cardano.Wallet.Deposit.Pure import Prelude import Cardano.Wallet.Deposit.Pure.UTxOHistory - ( UTxOHistory ) + ( UTxOHistory + ) import Cardano.Wallet.Deposit.Read - ( Address ) + ( Address + ) import Data.Foldable - ( foldl' ) + ( foldl' + ) import Data.List.NonEmpty - ( NonEmpty ) + ( NonEmpty + ) import Data.Maybe - ( isJust ) + ( isJust + ) import Data.Set - ( Set ) + ( Set + ) import Numeric.Natural - ( Natural ) + ( Natural + ) import qualified Cardano.Wallet.Deposit.Pure.Balance as Balance import qualified Cardano.Wallet.Deposit.Pure.Submissions as Sbm diff --git a/lib/customer-deposit-wallet/src/Cardano/Wallet/Deposit/Pure/Balance.hs b/lib/customer-deposit-wallet/src/Cardano/Wallet/Deposit/Pure/Balance.hs index 1b55dfa5afe..4d854216546 100644 --- a/lib/customer-deposit-wallet/src/Cardano/Wallet/Deposit/Pure/Balance.hs +++ b/lib/customer-deposit-wallet/src/Cardano/Wallet/Deposit/Pure/Balance.hs @@ -9,13 +9,20 @@ module Cardano.Wallet.Deposit.Pure.Balance import Prelude import Cardano.Wallet.Deposit.Pure.UTxO - ( DeltaUTxO, UTxO, balance, excluding ) + ( DeltaUTxO + , UTxO + , balance + , excluding + ) import Cardano.Wallet.Primitive.Model - ( utxoFromTx ) + ( utxoFromTx + ) import Data.Foldable - ( foldMap' ) + ( foldMap' + ) import Data.Set - ( Set ) + ( Set + ) import qualified Cardano.Wallet.Deposit.Pure.UTxO as UTxO import qualified Cardano.Wallet.Deposit.Read as Read diff --git a/lib/customer-deposit-wallet/src/Cardano/Wallet/Deposit/Pure/Submissions.hs b/lib/customer-deposit-wallet/src/Cardano/Wallet/Deposit/Pure/Submissions.hs index 3e3e3d9d1fe..8ec2b4be660 100644 --- a/lib/customer-deposit-wallet/src/Cardano/Wallet/Deposit/Pure/Submissions.hs +++ b/lib/customer-deposit-wallet/src/Cardano/Wallet/Deposit/Pure/Submissions.hs @@ -18,7 +18,8 @@ module Cardano.Wallet.Deposit.Pure.Submissions import Prelude import Data.Set - ( Set ) + ( Set + ) import qualified Cardano.Wallet.Deposit.Read as Read import qualified Cardano.Wallet.Submissions.Operations as Sbm diff --git a/lib/customer-deposit-wallet/src/Cardano/Wallet/Deposit/Read.hs b/lib/customer-deposit-wallet/src/Cardano/Wallet/Deposit/Read.hs index b6da260553c..7eab8c9be86 100644 --- a/lib/customer-deposit-wallet/src/Cardano/Wallet/Deposit/Read.hs +++ b/lib/customer-deposit-wallet/src/Cardano/Wallet/Deposit/Read.hs @@ -44,9 +44,11 @@ module Cardano.Wallet.Deposit.Read import Prelude import Data.ByteString - ( ByteString ) + ( ByteString + ) import Numeric.Natural - ( Natural ) + ( Natural + ) import qualified Cardano.Chain.Genesis as Byron import qualified Cardano.Wallet.Primitive.Types as W diff --git a/lib/customer-deposit-wallet/src/Cardano/Wallet/Deposit/Write.hs b/lib/customer-deposit-wallet/src/Cardano/Wallet/Deposit/Write.hs index 3c394c362ed..045596d15e0 100644 --- a/lib/customer-deposit-wallet/src/Cardano/Wallet/Deposit/Write.hs +++ b/lib/customer-deposit-wallet/src/Cardano/Wallet/Deposit/Write.hs @@ -17,12 +17,16 @@ module Cardano.Wallet.Deposit.Write import Prelude import Data.Map - ( Map ) + ( Map + ) import Data.Set - ( Set ) + ( Set + ) import Cardano.Wallet.Deposit.Read hiding - ( Tx, TxBody ) + ( Tx + , TxBody + ) {----------------------------------------------------------------------------- Type definitions diff --git a/lib/customer-deposit-wallet/test/unit/Cardano/Wallet/Deposit/PureSpec.hs b/lib/customer-deposit-wallet/test/unit/Cardano/Wallet/Deposit/PureSpec.hs index d1a6b5fe98d..6f5998b576a 100644 --- a/lib/customer-deposit-wallet/test/unit/Cardano/Wallet/Deposit/PureSpec.hs +++ b/lib/customer-deposit-wallet/test/unit/Cardano/Wallet/Deposit/PureSpec.hs @@ -5,17 +5,31 @@ module Cardano.Wallet.Deposit.PureSpec import Prelude import Cardano.Wallet.Primitive.Types.Tx.TxSeq - ( toTxList ) + ( toTxList + ) import Cardano.Wallet.Primitive.Types.Tx.TxSeq.Gen - ( genTxSeq, getTxSeq ) + ( genTxSeq + , getTxSeq + ) import Cardano.Wallet.Primitive.Types.UTxO.Gen - ( genUTxO ) + ( genUTxO + ) import Data.Maybe - ( isJust ) + ( isJust + ) import Test.Hspec - ( Spec, describe, it ) + ( Spec + , describe + , it + ) import Test.QuickCheck - ( Gen, Property, cover, forAll, property, suchThat ) + ( Gen + , Property + , cover + , forAll + , property + , suchThat + ) import qualified Cardano.Wallet.Deposit.Pure as Wallet import qualified Cardano.Wallet.Deposit.Read as Read diff --git a/lib/customer-deposit-wallet/test/unit/test-suite-unit.hs b/lib/customer-deposit-wallet/test/unit/test-suite-unit.hs index 349e4b80090..66edcab2e95 100644 --- a/lib/customer-deposit-wallet/test/unit/test-suite-unit.hs +++ b/lib/customer-deposit-wallet/test/unit/test-suite-unit.hs @@ -3,9 +3,11 @@ module Main where import Prelude import Main.Utf8 - ( withUtf8 ) + ( withUtf8 + ) import Test.Hspec.Extra - ( hspecMain ) + ( hspecMain + ) import qualified Spec diff --git a/lib/delta-store/src/Data/DBVar.hs b/lib/delta-store/src/Data/DBVar.hs index 4c4235a5687..0669d812036 100644 --- a/lib/delta-store/src/Data/DBVar.hs +++ b/lib/delta-store/src/Data/DBVar.hs @@ -27,13 +27,30 @@ module Data.DBVar ( import Prelude import Control.Concurrent.Class.MonadSTM - ( MonadSTM, atomically, newTVarIO, readTVar, readTVarIO, retry, writeTVar ) + ( MonadSTM + , atomically + , newTVarIO + , readTVar + , readTVarIO + , retry + , writeTVar + ) import Control.Monad.Class.MonadThrow - ( MonadEvaluate, MonadMask, MonadThrow, bracket, evaluate, mask, throwIO ) + ( MonadEvaluate + , MonadMask + , MonadThrow + , bracket + , evaluate + , mask + , throwIO + ) import Data.Delta - ( Delta (..) ) + ( Delta (..) + ) import Data.Store - ( Store (..), UpdateStore ) + ( Store (..) + , UpdateStore + ) {------------------------------------------------------------------------------- DBVar diff --git a/lib/delta-store/src/Data/Delta/Update.hs b/lib/delta-store/src/Data/Delta/Update.hs index 59f368c0d3f..64de9b8ab5c 100644 --- a/lib/delta-store/src/Data/Delta/Update.hs +++ b/lib/delta-store/src/Data/Delta/Update.hs @@ -31,9 +31,12 @@ module Data.Delta.Update ( import Prelude import Data.DBVar - ( DBVar, modifyDBMaybe ) + ( DBVar + , modifyDBMaybe + ) import Data.Delta - ( Delta (..) ) + ( Delta (..) + ) {------------------------------------------------------------------------------- Update diff --git a/lib/delta-store/src/Data/Store.hs b/lib/delta-store/src/Data/Store.hs index 174a23f66f8..c9381ffa4b6 100644 --- a/lib/delta-store/src/Data/Store.hs +++ b/lib/delta-store/src/Data/Store.hs @@ -74,7 +74,8 @@ module Data.Store ( import Prelude import Control.Applicative - ( liftA2 ) + ( liftA2 + ) import Control.Concurrent.Class.MonadSTM ( MonadSTM , atomically @@ -86,11 +87,23 @@ import Control.Concurrent.Class.MonadSTM , writeTVar ) import Control.Exception - ( Exception, SomeException (..), toException ) + ( Exception + , SomeException (..) + , toException + ) import Control.Monad - ( foldM_, join ) + ( foldM_ + , join + ) import Control.Monad.Class.MonadThrow - ( MonadEvaluate, MonadMask, MonadThrow, evaluate, finally, mask, throwIO ) + ( MonadEvaluate + , MonadMask + , MonadThrow + , evaluate + , finally + , mask + , throwIO + ) import Data.Delta ( Delta (..) , Embedding @@ -101,9 +114,11 @@ import Data.Delta , project ) import Data.Kind - ( Type ) + ( Type + ) import GHC.Generics - ( (:+:) (..) ) + ( (:+:) (..) + ) {------------------------------------------------------------------------------- Store diff --git a/lib/delta-store/src/Test/Store.hs b/lib/delta-store/src/Test/Store.hs index 72cd062fa4b..f7963cfc2bf 100644 --- a/lib/delta-store/src/Test/Store.hs +++ b/lib/delta-store/src/Test/Store.hs @@ -29,11 +29,16 @@ module Test.Store import Prelude import Control.Exception - ( throwIO ) + ( throwIO + ) import Control.Monad - ( forM_ ) + ( forM_ + ) import Control.Monad.RWS - ( RWST, evalRWST, lift ) + ( RWST + , evalRWST + , lift + ) import Control.Monad.RWS.Class ( MonadReader (ask) , MonadState (get, put) @@ -41,13 +46,19 @@ import Control.Monad.RWS.Class , censor ) import Data.Delta - ( Delta (..) ) + ( Delta (..) + ) import Data.Either - ( isRight ) + ( isRight + ) import Data.Store - ( Store (loadS, updateS, writeS) ) + ( Store (loadS, updateS, writeS) + ) import Fmt - ( Buildable, listF, pretty ) + ( Buildable + , listF + , pretty + ) import Test.QuickCheck ( Gen , Property @@ -59,7 +70,11 @@ import Test.QuickCheck , (===) ) import Test.QuickCheck.Monadic - ( assert, monadicIO, monitor, run ) + ( assert + , monadicIO + , monitor + , run + ) {----------------------------------------------------------------------------- Store laws diff --git a/lib/delta-store/test/unit/Data/StoreSpec.hs b/lib/delta-store/test/unit/Data/StoreSpec.hs index ee314dc9572..d2d71466c4f 100644 --- a/lib/delta-store/test/unit/Data/StoreSpec.hs +++ b/lib/delta-store/test/unit/Data/StoreSpec.hs @@ -10,21 +10,39 @@ module Data.StoreSpec import Prelude import Data.Delta - ( Delta (..) ) + ( Delta (..) + ) import Data.Store - ( Store (..), UpdateStore, newCachedStore, newStore ) + ( Store (..) + , UpdateStore + , newCachedStore + , newStore + ) import Fmt - ( Buildable (..) ) + ( Buildable (..) + ) import Test.Hspec - ( Spec, describe, it, parallel ) + ( Spec + , describe + , it + , parallel + ) import Test.QuickCheck - ( elements, generate, (===) ) + ( elements + , generate + , (===) + ) import Test.QuickCheck.Gen - ( Gen, listOf ) + ( Gen + , listOf + ) import Test.QuickCheck.Monadic - ( monadicIO, run ) + ( monadicIO + , run + ) import Test.Store - ( prop_StoreUpdate ) + ( prop_StoreUpdate + ) spec :: Spec spec = do diff --git a/lib/delta-table/src/Data/Chain.hs b/lib/delta-table/src/Data/Chain.hs index 917ea4ed133..634d7d37a64 100644 --- a/lib/delta-table/src/Data/Chain.hs +++ b/lib/delta-table/src/Data/Chain.hs @@ -26,24 +26,42 @@ module Data.Chain ( ) where import Prelude hiding - ( lookup ) + ( lookup + ) import Control.Exception - ( Exception, toException ) + ( Exception + , toException + ) import Control.Monad - ( guard, join, (<=<) ) + ( guard + , join + , (<=<) + ) import Data.Bifunctor - ( first ) + ( first + ) import Data.Delta - ( Delta (..), Embedding, Embedding' (..), liftUpdates, mkEmbedding ) + ( Delta (..) + , Embedding + , Embedding' (..) + , liftUpdates + , mkEmbedding + ) import Data.List - ( unfoldr ) + ( unfoldr + ) import Data.Map.Strict - ( Map ) + ( Map + ) import Data.Semigroupoid - ( o ) + ( o + ) import Data.Table - ( DeltaTable (..), Pile (..), Table ) + ( DeltaTable (..) + , Pile (..) + , Table + ) import qualified Data.Map.Strict as Map import qualified Data.Table as Table diff --git a/lib/delta-table/src/Data/Table.hs b/lib/delta-table/src/Data/Table.hs index a398949fc31..d86b6de364c 100644 --- a/lib/delta-table/src/Data/Table.hs +++ b/lib/delta-table/src/Data/Table.hs @@ -35,9 +35,12 @@ module Data.Table ( import Prelude import Control.Monad - ( forM ) + ( forM + ) import Control.Monad.Trans.State.Strict - ( evalState, state ) + ( evalState + , state + ) import Data.Delta ( Delta (..) , DeltaList (..) @@ -48,13 +51,18 @@ import Data.Delta , mkEmbedding ) import Data.IntMap.Strict - ( IntMap ) + ( IntMap + ) import Data.List - ( sort, sortOn ) + ( sort + , sortOn + ) import Data.Ord - ( Down (..) ) + ( Down (..) + ) import Data.Set - ( Set ) + ( Set + ) import qualified Data.Delta as Delta import qualified Data.IntMap.Strict as Map diff --git a/lib/delta-table/src/Database/Persist/Delta.hs b/lib/delta-table/src/Database/Persist/Delta.hs index c0e78024765..fea6b5e62bb 100644 --- a/lib/delta-table/src/Database/Persist/Delta.hs +++ b/lib/delta-table/src/Database/Persist/Delta.hs @@ -16,39 +16,74 @@ module Database.Persist.Delta ( ) where import Prelude hiding - ( all ) + ( all + ) import Control.Monad - ( forM_, void, when ) + ( forM_ + , void + , when + ) import Control.Monad.IO.Class - ( MonadIO, liftIO ) + ( MonadIO + , liftIO + ) import Data.Bifunctor - ( first ) + ( first + ) import Data.Delta - ( Delta (..) ) + ( Delta (..) + ) import Data.Proxy - ( Proxy (..) ) + ( Proxy (..) + ) import Data.Store - ( UpdateStore, mkUpdateStore, updateLoad ) + ( UpdateStore + , mkUpdateStore + , updateLoad + ) import Data.Table - ( DeltaDB (..), Pile (..), Table (..) ) + ( DeltaDB (..) + , Pile (..) + , Table (..) + ) import Database.Persist - ( Filter, Key, PersistRecordBackend, ToBackendKey ) + ( Filter + , Key + , PersistRecordBackend + , ToBackendKey + ) import Database.Persist.Sql - ( SqlBackend, SqlPersistM, fromSqlKey, toSqlKey ) + ( SqlBackend + , SqlPersistM + , fromSqlKey + , toSqlKey + ) import Database.Schema - ( (:.) (..), Col (..), IsRow, Primary (..) ) + ( (:.) (..) + , Col (..) + , IsRow + , Primary (..) + ) import Say - ( say, sayShow ) + ( say + , sayShow + ) -- FIXME: Replace with IOSim stuff later. import Conduit - ( ResourceT ) + ( ResourceT + ) import Control.Monad.Class.MonadThrow - ( MonadThrow ) + ( MonadThrow + ) import Control.Monad.Logger - ( NoLoggingT (..) ) + ( NoLoggingT (..) + ) import Data.IORef - ( newIORef, readIORef, writeIORef ) + ( newIORef + , readIORef + , writeIORef + ) import qualified Data.Table as Table import qualified Database.Persist as Persist diff --git a/lib/delta-table/src/Database/Schema.hs b/lib/delta-table/src/Database/Schema.hs index 87baff79cfd..c20a1011de2 100644 --- a/lib/delta-table/src/Database/Schema.hs +++ b/lib/delta-table/src/Database/Schema.hs @@ -34,17 +34,29 @@ module Database.Schema ( import Prelude import Control.Monad.IO.Class - ( MonadIO ) + ( MonadIO + ) import Data.Proxy - ( Proxy (..) ) + ( Proxy (..) + ) import Data.Text - ( Text ) + ( Text + ) import Database.Persist - ( PersistField (..), PersistValue ) + ( PersistField (..) + , PersistValue + ) import Database.Persist.Sql - ( PersistFieldSql (..), RawSql (..), SqlPersistT, SqlType (..) ) + ( PersistFieldSql (..) + , RawSql (..) + , SqlPersistT + , SqlType (..) + ) import GHC.TypeLits - ( KnownSymbol, Symbol, symbolVal ) + ( KnownSymbol + , Symbol + , symbolVal + ) import qualified Data.Text as T import qualified Database.Persist.Sql as Persist diff --git a/lib/delta-table/src/Demo/Database.hs b/lib/delta-table/src/Demo/Database.hs index f8b086e5542..cba51341970 100644 --- a/lib/delta-table/src/Demo/Database.hs +++ b/lib/delta-table/src/Demo/Database.hs @@ -26,13 +26,17 @@ module Demo.Database where import Prelude import Conduit - ( ResourceT ) + ( ResourceT + ) import Control.Applicative - ( Alternative ) + ( Alternative + ) import Control.Monad - ( MonadPlus ) + ( MonadPlus + ) import Control.Monad.Class.MonadSTM.Internal - ( MonadSTM (..) ) + ( MonadSTM (..) + ) import Control.Monad.Class.MonadThrow ( ExitCase (..) , MonadCatch (..) @@ -41,27 +45,45 @@ import Control.Monad.Class.MonadThrow , MonadThrow (..) ) import Control.Monad.IO.Class - ( MonadIO (..) ) + ( MonadIO (..) + ) import Control.Monad.Logger - ( NoLoggingT ) + ( NoLoggingT + ) import Data.Chain - ( DeltaChain (..), Edge (..), chainIntoTable ) + ( DeltaChain (..) + , Edge (..) + , chainIntoTable + ) import Data.Function - ( on ) + ( on + ) import Data.Generics.Internal.VL - ( Iso', iso, withIso ) + ( Iso' + , iso + , withIso + ) import Data.Proxy - ( Proxy (..) ) + ( Proxy (..) + ) import Data.Table - ( DeltaDB (..), Pile (..), tableIntoDatabase ) + ( DeltaDB (..) + , Pile (..) + , tableIntoDatabase + ) import Data.Text - ( Text ) + ( Text + ) import Data.Word - ( Word32 ) + ( Word32 + ) import Database.Persist.Delta - ( newEntityStore, newSqlStore ) + ( newEntityStore + , newSqlStore + ) import Database.Persist.Sql - ( SqlPersistM ) + ( SqlPersistM + ) import Database.Persist.TH ( mkMigrate , mkPersist @@ -71,11 +93,17 @@ import Database.Persist.TH , sqlSettings ) import Database.Schema - ( (:.) (..), Col (..), Primary, Table (..) ) + ( (:.) (..) + , Col (..) + , Primary + , Table (..) + ) import GHC.Generics - ( Generic ) + ( Generic + ) import Say - ( sayShow ) + ( sayShow + ) import qualified Control.Monad.Catch as ResourceT import qualified Control.Monad.STM as STM diff --git a/lib/delta-types/src/Data/Delta.hs b/lib/delta-types/src/Data/Delta.hs index e6dda1493a9..88829a539db 100644 --- a/lib/delta-types/src/Data/Delta.hs +++ b/lib/delta-types/src/Data/Delta.hs @@ -35,17 +35,23 @@ module Data.Delta ( import Prelude import Control.Exception - ( SomeException ) + ( SomeException + ) import Data.Either - ( fromRight ) + ( fromRight + ) import Data.Kind - ( Type ) + ( Type + ) import Data.List.NonEmpty - ( NonEmpty ) + ( NonEmpty + ) import Data.Semigroupoid - ( Semigroupoid (..) ) + ( Semigroupoid (..) + ) import Data.Set - ( Set ) + ( Set + ) import qualified Data.Set as Set diff --git a/lib/delta-types/src/Data/DeltaMap.hs b/lib/delta-types/src/Data/DeltaMap.hs index 28e6c4b99fa..494a7a52a7a 100644 --- a/lib/delta-types/src/Data/DeltaMap.hs +++ b/lib/delta-types/src/Data/DeltaMap.hs @@ -10,11 +10,14 @@ module Data.DeltaMap import Prelude import Data.Delta - ( Delta (..) ) + ( Delta (..) + ) import Data.Map.Strict - ( Map ) + ( Map + ) import Fmt - ( Buildable (..) ) + ( Buildable (..) + ) import qualified Data.Map.Strict as Map diff --git a/lib/delta-types/test/unit/Data/DeltaSpec.hs b/lib/delta-types/test/unit/Data/DeltaSpec.hs index d29cece9510..dc0cd7e4421 100644 --- a/lib/delta-types/test/unit/Data/DeltaSpec.hs +++ b/lib/delta-types/test/unit/Data/DeltaSpec.hs @@ -7,7 +7,11 @@ module Data.DeltaSpec import Prelude import Test.Hspec - ( Spec, describe, it, parallel ) + ( Spec + , describe + , it + , parallel + ) spec :: Spec spec = do diff --git a/lib/iohk-monitoring-extra/src/Cardano/BM/Extra.hs b/lib/iohk-monitoring-extra/src/Cardano/BM/Extra.hs index 3a76e13924d..031974274ba 100644 --- a/lib/iohk-monitoring-extra/src/Cardano/BM/Extra.hs +++ b/lib/iohk-monitoring-extra/src/Cardano/BM/Extra.hs @@ -47,28 +47,45 @@ module Cardano.BM.Extra import Prelude import Cardano.BM.Data.LogItem - ( LOContent (..), LogObject (..), LoggerName, mkLOMeta ) + ( LOContent (..) + , LogObject (..) + , LoggerName + , mkLOMeta + ) import Cardano.BM.Data.Severity - ( Severity (..) ) + ( Severity (..) + ) import Cardano.BM.Data.Tracer ( HasPrivacyAnnotation (..) , HasSeverityAnnotation (..) , Transformable (..) ) import Cardano.BM.Trace - ( Trace ) + ( Trace + ) import Control.DeepSeq - ( NFData (..) ) + ( NFData (..) + ) import Control.Monad - ( when ) + ( when + ) import Control.Monad.Catch - ( MonadMask ) + ( MonadMask + ) import Control.Monad.IO.Unlift - ( MonadIO (..), MonadUnliftIO ) + ( MonadIO (..) + , MonadUnliftIO + ) import Control.Monad.Trans.Except - ( ExceptT (..), runExceptT ) + ( ExceptT (..) + , runExceptT + ) import Control.Tracer - ( Tracer (..), contramap, nullTracer, traceWith ) + ( Tracer (..) + , contramap + , nullTracer + , traceWith + ) import Control.Tracer.Transformers.ObserveOutcome ( Outcome (..) , OutcomeFidelity (..) @@ -76,27 +93,47 @@ import Control.Tracer.Transformers.ObserveOutcome , mkOutcomeExtractor ) import Data.Aeson - ( ToJSON (..), Value (Null), object, (.=) ) + ( ToJSON (..) + , Value (Null) + , object + , (.=) + ) import Data.Foldable - ( forM_ ) + ( forM_ + ) import Data.Functor - ( ($>) ) + ( ($>) + ) import Data.Text - ( Text ) + ( Text + ) import Data.Text.Class - ( ToText (..) ) + ( ToText (..) + ) import Data.Time.Clock - ( DiffTime ) + ( DiffTime + ) import Data.Time.Clock.System - ( getSystemTime, systemToTAITime ) + ( getSystemTime + , systemToTAITime + ) import Data.Time.Clock.TAI - ( AbsoluteTime, diffAbsoluteTime ) + ( AbsoluteTime + , diffAbsoluteTime + ) import Fmt - ( Buildable (..), Builder, blockListF, blockMapF, nameF ) + ( Buildable (..) + , Builder + , blockListF + , blockMapF + , nameF + ) import GHC.Exts - ( IsList (..) ) + ( IsList (..) + ) import GHC.Generics - ( Generic ) + ( Generic + ) import UnliftIO.Exception ( Exception (..) , SomeException (..) diff --git a/lib/launcher/src/Cardano/Launcher.hs b/lib/launcher/src/Cardano/Launcher.hs index 695281c1ecc..cf5216fff5d 100644 --- a/lib/launcher/src/Cardano/Launcher.hs +++ b/lib/launcher/src/Cardano/Launcher.hs @@ -28,27 +28,42 @@ module Cardano.Launcher import Prelude import Cardano.BM.Data.Severity - ( Severity (..) ) + ( Severity (..) + ) import Cardano.BM.Data.Tracer - ( HasPrivacyAnnotation (..), HasSeverityAnnotation (..) ) + ( HasPrivacyAnnotation (..) + , HasSeverityAnnotation (..) + ) import Cardano.Startup - ( killProcess ) + ( killProcess + ) import Control.Monad - ( join, void ) + ( join + , void + ) import Control.Monad.IO.Class - ( liftIO ) + ( liftIO + ) import Control.Monad.IO.Unlift - ( MonadUnliftIO (..) ) + ( MonadUnliftIO (..) + ) import Control.Tracer - ( Tracer, contramap, traceWith ) + ( Tracer + , contramap + , traceWith + ) import Data.Either.Combinators - ( leftToMaybe ) + ( leftToMaybe + ) import Data.List - ( isPrefixOf ) + ( isPrefixOf + ) import Data.Text - ( Text ) + ( Text + ) import Data.Text.Class - ( ToText (..) ) + ( ToText (..) + ) import Fmt ( Buildable (..) , Builder @@ -61,17 +76,27 @@ import Fmt , (||+) ) import GHC.Generics - ( Generic ) + ( Generic + ) import System.Exit - ( ExitCode (..) ) + ( ExitCode (..) + ) import System.IO - ( Handle ) + ( Handle + ) import System.Process - ( cleanupProcess, getPid ) + ( cleanupProcess + , getPid + ) import UnliftIO.Async - ( race ) + ( race + ) import UnliftIO.Concurrent - ( forkIO, forkIOWithUnmask, killThread, threadDelay ) + ( forkIO + , forkIOWithUnmask + , killThread + , threadDelay + ) import UnliftIO.Exception ( Exception , IOException @@ -82,7 +107,10 @@ import UnliftIO.Exception , tryJust ) import UnliftIO.MVar - ( newEmptyMVar, putMVar, readMVar ) + ( newEmptyMVar + , putMVar + , readMVar + ) import UnliftIO.Process ( CmdSpec (..) , CreateProcess (..) diff --git a/lib/launcher/src/Cardano/Launcher/Node.hs b/lib/launcher/src/Cardano/Launcher/Node.hs index 14d9ecd9fa0..1f491aad448 100644 --- a/lib/launcher/src/Cardano/Launcher/Node.hs +++ b/lib/launcher/src/Cardano/Launcher/Node.hs @@ -25,25 +25,43 @@ module Cardano.Launcher.Node import Prelude import Cardano.Launcher - ( LauncherLog, ProcessHasExited, withBackendCreateProcess ) + ( LauncherLog + , ProcessHasExited + , withBackendCreateProcess + ) import Control.Tracer - ( Tracer (..) ) + ( Tracer (..) + ) import Data.Bifunctor - ( first ) + ( first + ) import Data.List - ( isPrefixOf ) + ( isPrefixOf + ) import Data.Maybe - ( fromMaybe, maybeToList ) + ( fromMaybe + , maybeToList + ) import Data.Text.Class - ( FromText (..), TextDecodingError (..), ToText (..) ) + ( FromText (..) + , TextDecodingError (..) + , ToText (..) + ) import System.Environment - ( getEnvironment ) + ( getEnvironment + ) import System.FilePath - ( isValid, takeFileName, () ) + ( isValid + , takeFileName + , () + ) import System.Info - ( os ) + ( os + ) import UnliftIO.Process - ( CreateProcess (..), proc ) + ( CreateProcess (..) + , proc + ) import qualified Data.Text as T diff --git a/lib/launcher/src/Cardano/Launcher/Wallet.hs b/lib/launcher/src/Cardano/Launcher/Wallet.hs index 8f51cd086fa..fcae534aacd 100644 --- a/lib/launcher/src/Cardano/Launcher/Wallet.hs +++ b/lib/launcher/src/Cardano/Launcher/Wallet.hs @@ -19,19 +19,31 @@ module Cardano.Launcher.Wallet import Prelude import Cardano.Launcher - ( LauncherLog, ProcessHasExited, withBackendCreateProcess ) + ( LauncherLog + , ProcessHasExited + , withBackendCreateProcess + ) import Cardano.Launcher.Node - ( CardanoNodeConn, nodeSocketFile ) + ( CardanoNodeConn + , nodeSocketFile + ) import Control.Tracer - ( Tracer (..) ) + ( Tracer (..) + ) import Data.Maybe - ( fromMaybe ) + ( fromMaybe + ) import Data.Text.Class - ( FromText (..), ToText (..) ) + ( FromText (..) + , ToText (..) + ) import Network.Socket - ( PortNumber ) + ( PortNumber + ) import UnliftIO.Process - ( CreateProcess (..), proc ) + ( CreateProcess (..) + , proc + ) {----------------------------------------------------------------------------- Launching a `cardano-wallet` process diff --git a/lib/launcher/src/Cardano/Startup.hs b/lib/launcher/src/Cardano/Startup.hs index b0bbda63c20..535416bfc43 100644 --- a/lib/launcher/src/Cardano/Startup.hs +++ b/lib/launcher/src/Cardano/Startup.hs @@ -28,25 +28,45 @@ module Cardano.Startup import Prelude import Cardano.BM.Data.Severity - ( Severity (..) ) + ( Severity (..) + ) import Cardano.BM.Data.Tracer - ( HasPrivacyAnnotation (..), HasSeverityAnnotation (..) ) + ( HasPrivacyAnnotation (..) + , HasSeverityAnnotation (..) + ) import Control.Tracer - ( Tracer, traceWith ) + ( Tracer + , traceWith + ) import Data.Either.Extra - ( eitherToMaybe ) + ( eitherToMaybe + ) import Data.Text.Class - ( ToText (..) ) + ( ToText (..) + ) import System.IO - ( Handle, hIsOpen, stdin ) + ( Handle + , hIsOpen + , stdin + ) import UnliftIO.Async - ( race ) + ( race + ) import UnliftIO.Concurrent - ( forkIO ) + ( forkIO + ) import UnliftIO.Exception - ( IOException, catch, handle, throwIO ) + ( IOException + , catch + , handle + , throwIO + ) import UnliftIO.MVar - ( MVar, newEmptyMVar, putMVar, takeMVar ) + ( MVar + , newEmptyMVar + , putMVar + , takeMVar + ) #ifdef WINDOWS import Cardano.Startup.Windows diff --git a/lib/launcher/src/Cardano/Startup/POSIX.hs b/lib/launcher/src/Cardano/Startup/POSIX.hs index ef041208936..3a99d8c39eb 100644 --- a/lib/launcher/src/Cardano/Startup/POSIX.hs +++ b/lib/launcher/src/Cardano/Startup/POSIX.hs @@ -14,11 +14,18 @@ module Cardano.Startup.POSIX import Prelude import Control.Monad - ( void ) + ( void + ) import Data.Bits - ( (.|.) ) + ( (.|.) + ) import System.Posix.Files - ( groupModes, otherModes, ownerReadMode, setFileCreationMask, setFileMode ) + ( groupModes + , otherModes + , ownerReadMode + , setFileCreationMask + , setFileMode + ) import System.Posix.Signals ( Handler (..) , installHandler @@ -29,7 +36,8 @@ import System.Posix.Signals , softwareTermination ) import System.Process - ( Pid ) + ( Pid + ) -- | Convert any SIGTERM received to SIGINT, for which the runtime system has -- handlers that will correctly clean up sub-processes. diff --git a/lib/launcher/src/Cardano/Startup/Windows.hs b/lib/launcher/src/Cardano/Startup/Windows.hs index 8829e645a5b..b43ddf29ed7 100644 --- a/lib/launcher/src/Cardano/Startup/Windows.hs +++ b/lib/launcher/src/Cardano/Startup/Windows.hs @@ -14,7 +14,8 @@ module Cardano.Startup.Windows import Prelude import System.Process - ( Pid ) + ( Pid + ) -- | Stub function for windows. installSignalHandlers :: IO () -> IO () diff --git a/lib/launcher/test/unit/Cardano/LauncherSpec.hs b/lib/launcher/test/unit/Cardano/LauncherSpec.hs index 0e0b3982d46..a2d1c76fac7 100644 --- a/lib/launcher/test/unit/Cardano/LauncherSpec.hs +++ b/lib/launcher/test/unit/Cardano/LauncherSpec.hs @@ -10,19 +10,31 @@ module Cardano.LauncherSpec import Prelude import Cardano.BM.Configuration.Model - ( setMinSeverity ) + ( setMinSeverity + ) import Cardano.BM.Configuration.Static - ( defaultConfigStdout ) + ( defaultConfigStdout + ) import Cardano.BM.Data.LogItem - ( LOContent (LogMessage), LogObject (..), LoggerName, mkLOMeta ) + ( LOContent (LogMessage) + , LogObject (..) + , LoggerName + , mkLOMeta + ) import Cardano.BM.Data.Severity - ( Severity (..) ) + ( Severity (..) + ) import Cardano.BM.Data.Tracer - ( HasPrivacyAnnotation (..), HasSeverityAnnotation (..) ) + ( HasPrivacyAnnotation (..) + , HasSeverityAnnotation (..) + ) import Cardano.BM.Setup - ( setupTrace_, shutdown ) + ( setupTrace_ + , shutdown + ) import Cardano.BM.Trace - ( logDebug ) + ( logDebug + ) import Cardano.Launcher ( Command (..) , LauncherLog @@ -31,27 +43,43 @@ import Cardano.Launcher , withBackendProcess ) import Control.Monad - ( forever ) + ( forever + ) import Control.Monad.IO.Class - ( MonadIO (..) ) + ( MonadIO (..) + ) import Control.Retry - ( constantDelay, limitRetriesByCumulativeDelay, recoverAll ) + ( constantDelay + , limitRetriesByCumulativeDelay + , recoverAll + ) import Control.Tracer - ( Tracer (..), nullTracer, traceWith ) + ( Tracer (..) + , nullTracer + , traceWith + ) import Data.Maybe - ( isJust ) + ( isJust + ) import Data.Text - ( Text ) + ( Text + ) import Data.Text.Class - ( ToText (..) ) + ( ToText (..) + ) import Data.Time.Clock - ( diffUTCTime, getCurrentTime ) + ( diffUTCTime + , getCurrentTime + ) import Fmt - ( pretty ) + ( pretty + ) import System.Exit - ( ExitCode (..) ) + ( ExitCode (..) + ) import System.Info - ( os ) + ( os + ) import Test.Hspec ( Spec , beforeAll @@ -62,13 +90,21 @@ import Test.Hspec , shouldSatisfy ) import Test.Utils.Platform - ( isWindows, pendingOnWine, skipOnWindows ) + ( isWindows + , pendingOnWine + , skipOnWindows + ) import UnliftIO.Async - ( async, race_, waitAnyCancel ) + ( async + , race_ + , waitAnyCancel + ) import UnliftIO.Concurrent - ( threadDelay ) + ( threadDelay + ) import UnliftIO.Exception - ( bracket ) + ( bracket + ) import UnliftIO.MVar ( modifyMVar_ , newEmptyMVar @@ -79,7 +115,9 @@ import UnliftIO.MVar , tryReadMVar ) import UnliftIO.Process - ( ProcessHandle, getProcessExitCode ) + ( ProcessHandle + , getProcessExitCode + ) {- HLINT ignore spec "Use head" -} diff --git a/lib/launcher/test/unit/Cardano/StartupSpec.hs b/lib/launcher/test/unit/Cardano/StartupSpec.hs index c46d253b2fd..0921f189b51 100644 --- a/lib/launcher/test/unit/Cardano/StartupSpec.hs +++ b/lib/launcher/test/unit/Cardano/StartupSpec.hs @@ -15,39 +15,76 @@ module Cardano.StartupSpec import Prelude import Cardano.Startup - ( ShutdownHandlerLog (..), withShutdownHandler' ) + ( ShutdownHandlerLog (..) + , withShutdownHandler' + ) import Control.Monad - ( unless ) + ( unless + ) import Control.Tracer - ( Tracer, nullTracer ) + ( Tracer + , nullTracer + ) import System.IO - ( Handle, IOMode (..), hClose, hWaitForInput, stdin, withFile ) + ( Handle + , IOMode (..) + , hClose + , hWaitForInput + , stdin + , withFile + ) import System.IO.Error - ( isUserError ) + ( isUserError + ) import Test.Hspec - ( Spec, describe, it, shouldBe, shouldContain, shouldReturn, shouldThrow ) + ( Spec + , describe + , it + , shouldBe + , shouldContain + , shouldReturn + , shouldThrow + ) import Test.Hspec.Core.Spec - ( ResultStatus (..) ) + ( ResultStatus (..) + ) import Test.Hspec.Expectations - ( Expectation, HasCallStack ) + ( Expectation + , HasCallStack + ) import Test.Utils.Platform - ( nullFileName, pendingOnWindows ) + ( nullFileName + , pendingOnWindows + ) import Test.Utils.Trace - ( captureLogging ) + ( captureLogging + ) import UnliftIO.Async - ( race ) + ( race + ) import UnliftIO.Concurrent - ( threadDelay ) + ( threadDelay + ) import UnliftIO.Exception - ( IOException, bracket, catch, throwIO ) + ( IOException + , bracket + , catch + , throwIO + ) import UnliftIO.Process - ( createPipe ) + ( createPipe + ) #if defined(WINDOWS) import UnliftIO.Concurrent - ( forkIO ) + ( forkIO + ) import UnliftIO.MVar - ( MVar, newEmptyMVar, putMVar, takeMVar ) + ( MVar + , newEmptyMVar + , putMVar + , takeMVar + ) #endif import qualified Data.ByteString as BS diff --git a/lib/local-cluster/lib/Cardano/Node/Cli/Launcher.hs b/lib/local-cluster/lib/Cardano/Node/Cli/Launcher.hs index b8e93fe603e..1e867ebf44d 100644 --- a/lib/local-cluster/lib/Cardano/Node/Cli/Launcher.hs +++ b/lib/local-cluster/lib/Cardano/Node/Cli/Launcher.hs @@ -6,9 +6,18 @@ module Cardano.Node.Cli.Launcher where import Prelude import Path - ( Abs, Dir, File, Path, relfile, toFilePath, () ) + ( Abs + , Dir + , File + , Path + , relfile + , toFilePath + , () + ) import System.IO - ( IOMode (AppendMode), openFile ) + ( IOMode (AppendMode) + , openFile + ) import System.Process.Typed ( Process , proc diff --git a/lib/local-cluster/lib/Cardano/Wallet/Cli/Launcher.hs b/lib/local-cluster/lib/Cardano/Wallet/Cli/Launcher.hs index bc7fb7ea8ca..4684b57d69f 100644 --- a/lib/local-cluster/lib/Cardano/Wallet/Cli/Launcher.hs +++ b/lib/local-cluster/lib/Cardano/Wallet/Cli/Launcher.hs @@ -14,15 +14,28 @@ import Prelude import qualified Data.Text as T import Cardano.Node.Cli.Launcher - ( NodeApi, nodeApiSocket ) + ( NodeApi + , nodeApiSocket + ) import Data.Maybe - ( fromMaybe ) + ( fromMaybe + ) import Data.Text - ( Text ) + ( Text + ) import Path - ( Abs, Dir, File, Path, relfile, toFilePath, () ) + ( Abs + , Dir + , File + , Path + , relfile + , toFilePath + , () + ) import System.IO - ( IOMode (AppendMode), openFile ) + ( IOMode (AppendMode) + , openFile + ) import System.Process.Typed ( Process , proc diff --git a/lib/local-cluster/lib/Cardano/Wallet/Faucet.hs b/lib/local-cluster/lib/Cardano/Wallet/Faucet.hs index 15c231ee67a..c571680dc38 100644 --- a/lib/local-cluster/lib/Cardano/Wallet/Faucet.hs +++ b/lib/local-cluster/lib/Cardano/Wallet/Faucet.hs @@ -44,10 +44,14 @@ module Cardano.Wallet.Faucet ) where import Prelude hiding - ( appendFile ) + ( appendFile + ) import Cardano.Address - ( Address, base58, unAddress ) + ( Address + , base58 + , unAddress + ) import Cardano.Address.Derivation ( AccountIndexDerivationType , AddressIndexDerivationType @@ -64,11 +68,14 @@ import Cardano.Address.Derivation , toXPub ) import Cardano.Address.Style.Byron - ( Byron ) + ( Byron + ) import Cardano.Address.Style.Icarus - ( Icarus ) + ( Icarus + ) import Cardano.Address.Style.Shelley - ( Shelley ) + ( Shelley + ) import Cardano.Mnemonic ( EntropySize , Mnemonic @@ -82,33 +89,56 @@ import Cardano.Mnemonic , mnemonicToText ) import Cardano.Wallet.Primitive.Types.Coin - ( Coin (..) ) + ( Coin (..) + ) import Cardano.Wallet.Primitive.Types.TokenBundle - ( TokenBundle ) + ( TokenBundle + ) import Cardano.Wallet.Primitive.Types.TokenPolicy - ( TokenName (..), TokenPolicyId, nullTokenName ) + ( TokenName (..) + , TokenPolicyId + , nullTokenName + ) import Cardano.Wallet.Primitive.Types.TokenQuantity - ( TokenQuantity (..) ) + ( TokenQuantity (..) + ) import Cardano.Wallet.Unsafe - ( unsafeFromText, unsafeMkMnemonic ) + ( unsafeFromText + , unsafeMkMnemonic + ) import Control.Monad - ( forM, forM_, replicateM ) + ( forM + , forM_ + , replicateM + ) import Data.Bifunctor - ( first ) + ( first + ) import Data.ByteArray.Encoding - ( Base (..), convertToBase ) + ( Base (..) + , convertToBase + ) import Data.ByteString - ( ByteString ) + ( ByteString + ) import Data.List - ( unfoldr ) + ( unfoldr + ) import Data.Text - ( Text ) + ( Text + ) import Data.Tuple.Extra - ( dupe ) + ( dupe + ) import GHC.TypeLits - ( KnownNat, Nat, Symbol ) + ( KnownNat + , Nat + , Symbol + ) import UnliftIO.MVar - ( MVar, modifyMVar ) + ( MVar + , modifyMVar + ) import qualified Cardano.Address as CA import qualified Cardano.Address.Style.Byron as Byron diff --git a/lib/local-cluster/lib/Cardano/Wallet/Faucet/Mnemonics.hs b/lib/local-cluster/lib/Cardano/Wallet/Faucet/Mnemonics.hs index 97d24f06596..cedeafaf84d 100644 --- a/lib/local-cluster/lib/Cardano/Wallet/Faucet/Mnemonics.hs +++ b/lib/local-cluster/lib/Cardano/Wallet/Faucet/Mnemonics.hs @@ -5,9 +5,12 @@ module Cardano.Wallet.Faucet.Mnemonics where import Prelude import Cardano.Mnemonic - ( Mnemonic, SomeMnemonic (..) ) + ( Mnemonic + , SomeMnemonic (..) + ) import Cardano.Wallet.Unsafe - ( unsafeMkMnemonic ) + ( unsafeMkMnemonic + ) sequential :: [Mnemonic 15] sequential = diff --git a/lib/local-cluster/lib/Cardano/Wallet/Faucet/Shelley.hs b/lib/local-cluster/lib/Cardano/Wallet/Faucet/Shelley.hs index 21432524b65..2106a409450 100644 --- a/lib/local-cluster/lib/Cardano/Wallet/Faucet/Shelley.hs +++ b/lib/local-cluster/lib/Cardano/Wallet/Faucet/Shelley.hs @@ -8,9 +8,11 @@ module Cardano.Wallet.Faucet.Shelley import Prelude import Cardano.Wallet.Faucet - ( Faucet (..) ) + ( Faucet (..) + ) import UnliftIO.MVar - ( newMVar ) + ( newMVar + ) import qualified Cardano.Wallet.Faucet.Mnemonics as Mnemonics diff --git a/lib/local-cluster/lib/Cardano/Wallet/Launch/Cluster.hs b/lib/local-cluster/lib/Cardano/Wallet/Launch/Cluster.hs index 992b6ce8c37..f5fc663651b 100644 --- a/lib/local-cluster/lib/Cardano/Wallet/Launch/Cluster.hs +++ b/lib/local-cluster/lib/Cardano/Wallet/Launch/Cluster.hs @@ -66,9 +66,12 @@ module Cardano.Wallet.Launch.Cluster import Prelude import Cardano.Address - ( Address (..) ) + ( Address (..) + ) import Cardano.Address.Derivation - ( XPub, xpubPublicKey ) + ( XPub + , xpubPublicKey + ) import Cardano.Api ( AsType (AsStakeKey, AsStakePoolKey) , File (..) @@ -76,9 +79,11 @@ import Cardano.Api , serialiseToCBOR ) import Cardano.Api.Shelley - ( AsType (AsVrfKey) ) + ( AsType (AsVrfKey) + ) import Cardano.Binary - ( fromCBOR ) + ( fromCBOR + ) import Cardano.BM.Data.Output ( ScribeDefinition (..) , ScribeFormat (..) @@ -86,15 +91,24 @@ import Cardano.BM.Data.Output , ScribePrivacy (..) ) import Cardano.BM.Data.Severity - ( Severity (..) ) + ( Severity (..) + ) import Cardano.BM.Data.Tracer - ( HasPrivacyAnnotation (..), HasSeverityAnnotation (..) ) + ( HasPrivacyAnnotation (..) + , HasSeverityAnnotation (..) + ) import Cardano.BM.Extra - ( BracketLog, bracketTracer ) + ( BracketLog + , bracketTracer + ) import Cardano.CLI.Shelley.Key - ( VerificationKeyOrFile (..), readVerificationKeyOrFile ) + ( VerificationKeyOrFile (..) + , readVerificationKeyOrFile + ) import Cardano.Launcher - ( LauncherLog, ProcessHasExited (..) ) + ( LauncherLog + , ProcessHasExited (..) + ) import Cardano.Launcher.Node ( CardanoNodeConfig (..) , CardanoNodeConn @@ -133,81 +147,150 @@ import Cardano.Ledger.BaseTypes , textToUrl ) import Cardano.Ledger.Shelley.API - ( ShelleyGenesis (..), ShelleyGenesisStaking (sgsPools) ) + ( ShelleyGenesis (..) + , ShelleyGenesisStaking (sgsPools) + ) import Cardano.Startup - ( restrictFileMode ) + ( restrictFileMode + ) import Cardano.Wallet.Network.Ports - ( randomUnusedTCPPorts ) + ( randomUnusedTCPPorts + ) import Cardano.Wallet.Primitive.Types.Coin - ( Coin (..) ) + ( Coin (..) + ) import Cardano.Wallet.Primitive.Types.TokenBundle - ( AssetId (..), TokenBundle (..) ) + ( AssetId (..) + , TokenBundle (..) + ) import Cardano.Wallet.Primitive.Types.TokenPolicy - ( TokenName (..) ) + ( TokenName (..) + ) import Cardano.Wallet.Primitive.Types.TokenQuantity - ( TokenQuantity (..) ) + ( TokenQuantity (..) + ) import Cardano.Wallet.Unsafe - ( unsafeFromHex ) + ( unsafeFromHex + ) import Cardano.Wallet.Util - ( HasCallStack ) + ( HasCallStack + ) import Control.Lens - ( over, set, (&), (.~), (<&>) ) + ( over + , set + , (&) + , (.~) + , (<&>) + ) import Control.Monad - ( forM, forM_, liftM2, replicateM, replicateM_, void, when, (>=>) ) + ( forM + , forM_ + , liftM2 + , replicateM + , replicateM_ + , void + , when + , (>=>) + ) import Control.Retry - ( constantDelay, limitRetriesByCumulativeDelay, retrying ) + ( constantDelay + , limitRetriesByCumulativeDelay + , retrying + ) import Control.Tracer - ( Tracer (..), contramap, traceWith ) + ( Tracer (..) + , contramap + , traceWith + ) import Crypto.Hash.Extra - ( blake2b256 ) + ( blake2b256 + ) import Data.Aeson - ( object, toJSON, (.:), (.=) ) + ( object + , toJSON + , (.:) + , (.=) + ) import Data.Aeson.QQ - ( aesonQQ ) + ( aesonQQ + ) import Data.ByteArray.Encoding - ( Base (..), convertToBase ) + ( Base (..) + , convertToBase + ) import Data.ByteString - ( ByteString ) + ( ByteString + ) import Data.ByteString.Base58 - ( bitcoinAlphabet, decodeBase58 ) + ( bitcoinAlphabet + , decodeBase58 + ) import Data.Char - ( toLower ) + ( toLower + ) import Data.Either - ( fromRight, isLeft, isRight ) + ( fromRight + , isLeft + , isRight + ) import Data.Foldable - ( traverse_ ) + ( traverse_ + ) import Data.Generics.Labels () import Data.IntCast - ( intCast ) + ( intCast + ) import Data.List - ( intercalate, isSuffixOf, nub, permutations, sort ) + ( intercalate + , isSuffixOf + , nub + , permutations + , sort + ) import Data.List.NonEmpty - ( NonEmpty ((:|)) ) + ( NonEmpty ((:|)) + ) import Data.Maybe - ( catMaybes, fromMaybe ) + ( catMaybes + , fromMaybe + ) import Data.Tagged - ( Tagged (..), retag, untag ) + ( Tagged (..) + , retag + , untag + ) import Data.Text - ( Text ) + ( Text + ) import Data.Text.Class - ( ToText (..) ) + ( ToText (..) + ) import Data.Text.Encoding - ( decodeUtf8 ) + ( decodeUtf8 + ) import Data.Time.Clock - ( addUTCTime, getCurrentTime ) + ( addUTCTime + , getCurrentTime + ) import Data.Time.Clock.POSIX - ( utcTimeToPOSIXSeconds ) + ( utcTimeToPOSIXSeconds + ) import Data.Word.Odd - ( Word31 ) + ( Word31 + ) import GHC.Generics - ( Generic ) + ( Generic + ) import Numeric.Natural - ( Natural ) + ( Natural + ) import Ouroboros.Network.Magic - ( NetworkMagic (..) ) + ( NetworkMagic (..) + ) import Ouroboros.Network.NodeToClient - ( NodeToClientVersionData (..) ) + ( NodeToClientVersionData (..) + ) import System.Directory ( copyFile , createDirectory @@ -216,31 +299,61 @@ import System.Directory , makeAbsolute ) import System.Environment - ( getEnvironment ) + ( getEnvironment + ) import System.Environment.Extended - ( lookupEnvNonEmpty ) + ( lookupEnvNonEmpty + ) import System.Exit - ( ExitCode (..), die ) + ( ExitCode (..) + , die + ) import System.FilePath - ( (<.>), () ) + ( (<.>) + , () + ) import System.IO.Temp - ( emptyTempFile ) + ( emptyTempFile + ) import System.IO.Temp.Extra - ( TempDirLog ) + ( TempDirLog + ) import System.IO.Unsafe - ( unsafePerformIO ) + ( unsafePerformIO + ) import System.Process.Typed - ( ProcessConfig, proc, readProcess, setEnv, setEnvInherit ) + ( ProcessConfig + , proc + , readProcess + , setEnv + , setEnvInherit + ) import Test.Utils.StaticServer - ( withStaticServer ) + ( withStaticServer + ) import UnliftIO.Async - ( async, link, wait ) + ( async + , link + , wait + ) import UnliftIO.Chan - ( newChan, readChan, writeChan ) + ( newChan + , readChan + , writeChan + ) import UnliftIO.Exception - ( SomeException, finally, handle, throwIO, throwString ) + ( SomeException + , finally + , handle + , throwIO + , throwString + ) import UnliftIO.MVar - ( MVar, modifyMVar, newMVar, swapMVar ) + ( MVar + , modifyMVar + , newMVar + , swapMVar + ) import qualified Cardano.Address as Address import qualified Cardano.Address as CA diff --git a/lib/local-cluster/lib/Service.hs b/lib/local-cluster/lib/Service.hs index b7e24d2d856..5e7762ab298 100644 --- a/lib/local-cluster/lib/Service.hs +++ b/lib/local-cluster/lib/Service.hs @@ -15,15 +15,21 @@ module Service where import Prelude import Cardano.Address.Style.Shelley - ( shelleyTestnet ) + ( shelleyTestnet + ) import Cardano.BM.Extra - ( stdoutTextTracer ) + ( stdoutTextTracer + ) import Cardano.Launcher.Node - ( nodeSocketFile ) + ( nodeSocketFile + ) import Cardano.Mnemonic - ( SomeMnemonic (..) ) + ( SomeMnemonic (..) + ) import Cardano.Startup - ( installSignalHandlers, setDefaultFilePermissions ) + ( installSignalHandlers + , setDefaultFilePermissions + ) import Cardano.Wallet.Faucet ( byronIntegrationTestFunds , deriveShelleyRewardAccount @@ -31,27 +37,41 @@ import Cardano.Wallet.Faucet , shelleyIntegrationTestFunds ) import Cardano.Wallet.Launch.Cluster - ( FaucetFunds (..) ) + ( FaucetFunds (..) + ) import Cardano.Wallet.Primitive.Types.Coin - ( Coin (..) ) + ( Coin (..) + ) import Control.Monad.Trans.Resource - ( allocate, runResourceT ) + ( allocate + , runResourceT + ) import Data.Functor - ( (<&>) ) + ( (<&>) + ) import Data.Tagged - ( Tagged (..) ) + ( Tagged (..) + ) import Main.Utf8 - ( withUtf8 ) + ( withUtf8 + ) import System.Environment.Extended - ( isEnvSet, lookupEnvNonEmpty ) + ( isEnvSet + , lookupEnvNonEmpty + ) import System.FilePath - ( () ) + ( () + ) import System.IO.Temp.Extra - ( SkipCleanup (..), withSystemTempDir ) + ( SkipCleanup (..) + , withSystemTempDir + ) import Test.Utils.Paths - ( getTestData ) + ( getTestData + ) import UnliftIO.Concurrent - ( threadDelay ) + ( threadDelay + ) import qualified Cardano.Address.Style.Shelley as Shelley import qualified Cardano.Node.Cli.Launcher as NC diff --git a/lib/numeric/src/Cardano/Numeric/Util.hs b/lib/numeric/src/Cardano/Numeric/Util.hs index a8b55da7e01..e9feb0cff9f 100644 --- a/lib/numeric/src/Cardano/Numeric/Util.hs +++ b/lib/numeric/src/Cardano/Numeric/Util.hs @@ -21,28 +21,40 @@ module Cardano.Numeric.Util ) where import Prelude hiding - ( round ) + ( round + ) import Algebra.PartialOrd - ( PartialOrd (..) ) + ( PartialOrd (..) + ) import Control.Arrow - ( (&&&) ) + ( (&&&) + ) import Data.Function - ( (&) ) + ( (&) + ) import Data.List.NonEmpty - ( NonEmpty (..) ) + ( NonEmpty (..) + ) import Data.Maybe - ( fromMaybe ) + ( fromMaybe + ) import Data.Ord - ( Down (..), comparing ) + ( Down (..) + , comparing + ) import Data.Ratio - ( (%) ) + ( (%) + ) import GHC.Stack - ( HasCallStack ) + ( HasCallStack + ) import Numeric.Natural - ( Natural ) + ( Natural + ) import Safe - ( tailMay ) + ( tailMay + ) import qualified Data.Foldable as F import qualified Data.List.NonEmpty as NE diff --git a/lib/numeric/test/unit/Cardano/Numeric/UtilSpec.hs b/lib/numeric/test/unit/Cardano/Numeric/UtilSpec.hs index 7e79d41ebfe..d50638713c5 100644 --- a/lib/numeric/test/unit/Cardano/Numeric/UtilSpec.hs +++ b/lib/numeric/test/unit/Cardano/Numeric/UtilSpec.hs @@ -8,19 +8,32 @@ module Cardano.Numeric.UtilSpec import Prelude import Cardano.Numeric.Util - ( equipartitionNatural, padCoalesce, partitionNatural, power ) + ( equipartitionNatural + , padCoalesce + , partitionNatural + , power + ) import Data.List.NonEmpty - ( NonEmpty (..) ) + ( NonEmpty (..) + ) import Data.Maybe - ( mapMaybe ) + ( mapMaybe + ) import Data.Monoid - ( Sum (..) ) + ( Sum (..) + ) import Data.Ratio - ( (%) ) + ( (%) + ) import Numeric.Natural - ( Natural ) + ( Natural + ) import Test.Hspec - ( Spec, describe, it, shouldBe ) + ( Spec + , describe + , it + , shouldBe + ) import Test.QuickCheck ( Arbitrary (..) , Property diff --git a/lib/primitive/lib/Cardano/Wallet/Orphans.hs b/lib/primitive/lib/Cardano/Wallet/Orphans.hs index 1652956a236..01429075898 100644 --- a/lib/primitive/lib/Cardano/Wallet/Orphans.hs +++ b/lib/primitive/lib/Cardano/Wallet/Orphans.hs @@ -13,19 +13,31 @@ module Cardano.Wallet.Orphans where import Prelude import Cardano.Api - ( TxMetadata (..), TxMetadataValue (..) ) + ( TxMetadata (..) + , TxMetadataValue (..) + ) import Cardano.Slotting.Slot - ( SlotNo (..) ) + ( SlotNo (..) + ) import Control.DeepSeq - ( NFData (..) ) + ( NFData (..) + ) import Data.Ord - ( comparing ) + ( comparing + ) import Fmt - ( Buildable (..), blockListF, hexF, nameF, unlinesF ) + ( Buildable (..) + , blockListF + , hexF + , nameF + , unlinesF + ) import Ouroboros.Consensus.HardFork.History.Qry - ( PastHorizonException ) + ( PastHorizonException + ) import UnliftIO.Exception - ( displayException ) + ( displayException + ) import qualified Data.Map as Map diff --git a/lib/primitive/lib/Cardano/Wallet/Primitive/Collateral.hs b/lib/primitive/lib/Cardano/Wallet/Primitive/Collateral.hs index 28b9edfd83a..85624751604 100644 --- a/lib/primitive/lib/Cardano/Wallet/Primitive/Collateral.hs +++ b/lib/primitive/lib/Cardano/Wallet/Primitive/Collateral.hs @@ -36,15 +36,20 @@ module Cardano.Wallet.Primitive.Collateral import Prelude import Cardano.Wallet.Primitive.Types.Address - ( Address (..) ) + ( Address (..) + ) import Cardano.Wallet.Primitive.Types.Coin - ( Coin ) + ( Coin + ) import Cardano.Wallet.Primitive.Types.Tx.TxOut - ( TxOut (..) ) + ( TxOut (..) + ) import Data.Word - ( Word8 ) + ( Word8 + ) import Data.Word.Odd - ( Word4 ) + ( Word4 + ) import qualified Cardano.Wallet.Primitive.Types.TokenBundle as TokenBundle import qualified Data.Binary.Get as B diff --git a/lib/primitive/lib/Cardano/Wallet/Primitive/NetworkId.hs b/lib/primitive/lib/Cardano/Wallet/Primitive/NetworkId.hs index 1b4e7f0c59b..50fc7a6b7a4 100644 --- a/lib/primitive/lib/Cardano/Wallet/Primitive/NetworkId.hs +++ b/lib/primitive/lib/Cardano/Wallet/Primitive/NetworkId.hs @@ -29,17 +29,27 @@ module Cardano.Wallet.Primitive.NetworkId import Prelude import Data.Proxy - ( Proxy (..) ) + ( Proxy (..) + ) import Data.Text - ( Text ) + ( Text + ) import Data.Typeable - ( Typeable ) + ( Typeable + ) import Data.Word - ( Word8 ) + ( Word8 + ) import GHC.Natural - ( Natural ) + ( Natural + ) import GHC.TypeNats - ( KnownNat, Nat, SomeNat (..), natVal, someNatVal ) + ( KnownNat + , Nat + , SomeNat (..) + , natVal + , someNatVal + ) import qualified Cardano.Api as Cardano import qualified Data.Text as T diff --git a/lib/primitive/lib/Cardano/Wallet/Primitive/Types/Address.hs b/lib/primitive/lib/Cardano/Wallet/Primitive/Types/Address.hs index c733e56f7bb..f939169ce74 100644 --- a/lib/primitive/lib/Cardano/Wallet/Primitive/Types/Address.hs +++ b/lib/primitive/lib/Cardano/Wallet/Primitive/Types/Address.hs @@ -16,15 +16,22 @@ module Cardano.Wallet.Primitive.Types.Address import Prelude import Control.DeepSeq - ( NFData (..) ) + ( NFData (..) + ) import Data.Bifunctor - ( bimap ) + ( bimap + ) import Data.ByteArray.Encoding - ( Base (Base16), convertFromBase, convertToBase ) + ( Base (Base16) + , convertFromBase + , convertToBase + ) import Data.ByteString - ( ByteString ) + ( ByteString + ) import Data.Hashable - ( Hashable ) + ( Hashable + ) import Data.Text.Class ( CaseStyle (..) , FromText (..) @@ -34,11 +41,16 @@ import Data.Text.Class , toTextFromBoundedEnum ) import Fmt - ( Buildable (..), prefixF, suffixF ) + ( Buildable (..) + , prefixF + , suffixF + ) import GHC.Generics - ( Generic ) + ( Generic + ) import Quiet - ( Quiet (..) ) + ( Quiet (..) + ) import qualified Data.Text.Encoding as T diff --git a/lib/primitive/lib/Cardano/Wallet/Primitive/Types/Address/Gen.hs b/lib/primitive/lib/Cardano/Wallet/Primitive/Types/Address/Gen.hs index 7eba26d17c5..aa53600021d 100644 --- a/lib/primitive/lib/Cardano/Wallet/Primitive/Types/Address/Gen.hs +++ b/lib/primitive/lib/Cardano/Wallet/Primitive/Types/Address/Gen.hs @@ -13,9 +13,13 @@ module Cardano.Wallet.Primitive.Types.Address.Gen import Prelude import Cardano.Wallet.Primitive.Types.Address - ( Address (..) ) + ( Address (..) + ) import Test.QuickCheck - ( Gen, elements, sized ) + ( Gen + , elements + , sized + ) import qualified Data.Bits as Bits import qualified Data.ByteString as BS diff --git a/lib/primitive/lib/Cardano/Wallet/Primitive/Types/Coin.hs b/lib/primitive/lib/Cardano/Wallet/Primitive/Types/Coin.hs index 61b53998e0d..db1215facdf 100644 --- a/lib/primitive/lib/Cardano/Wallet/Primitive/Types/Coin.hs +++ b/lib/primitive/lib/Cardano/Wallet/Primitive/Types/Coin.hs @@ -47,50 +47,84 @@ module Cardano.Wallet.Primitive.Types.Coin ) where import Prelude hiding - ( fromIntegral, subtract, toInteger ) + ( fromIntegral + , subtract + , toInteger + ) import Cardano.Numeric.Util - ( equipartitionNatural, partitionNatural ) + ( equipartitionNatural + , partitionNatural + ) import Control.DeepSeq - ( NFData (..) ) + ( NFData (..) + ) import Data.Bits - ( Bits ) + ( Bits + ) import Data.Hashable - ( Hashable ) + ( Hashable + ) import Data.IntCast - ( IsIntSubType, intCast, intCastMaybe ) + ( IsIntSubType + , intCast + , intCastMaybe + ) import Data.List.NonEmpty - ( NonEmpty (..) ) + ( NonEmpty (..) + ) import Data.Maybe - ( fromMaybe ) + ( fromMaybe + ) import Data.Monoid - ( Sum (..) ) + ( Sum (..) + ) import Data.Monoid.Cancellative - ( LeftReductive, Reductive (()), RightReductive ) + ( LeftReductive + , Reductive (()) + , RightReductive + ) import Data.Monoid.GCD - ( GCDMonoid, LeftGCDMonoid, RightGCDMonoid ) + ( GCDMonoid + , LeftGCDMonoid + , RightGCDMonoid + ) import Data.Monoid.Monus - ( Monus ((<\>)), OverlappingGCDMonoid ) + ( Monus ((<\>)) + , OverlappingGCDMonoid + ) import Data.Monoid.Null - ( MonoidNull ) + ( MonoidNull + ) import Data.Quantity - ( Quantity (..) ) + ( Quantity (..) + ) import Data.Semigroup.Commutative - ( Commutative ) + ( Commutative + ) import Data.Text.Class - ( FromText (..), ToText (..) ) + ( FromText (..) + , ToText (..) + ) import Data.Word - ( Word64 ) + ( Word64 + ) import Fmt - ( Buildable (..), fixedF ) + ( Buildable (..) + , fixedF + ) import GHC.Generics - ( Generic ) + ( Generic + ) import GHC.Stack - ( HasCallStack ) + ( HasCallStack + ) import Numeric.Natural - ( Natural ) + ( Natural + ) import Quiet - ( Quiet (..) ) + ( Quiet (..) + ) import qualified Data.Text as T import qualified Prelude diff --git a/lib/primitive/lib/Cardano/Wallet/Primitive/Types/Coin/Gen.hs b/lib/primitive/lib/Cardano/Wallet/Primitive/Types/Coin/Gen.hs index ed06f7269bf..44a7145daa6 100644 --- a/lib/primitive/lib/Cardano/Wallet/Primitive/Types/Coin/Gen.hs +++ b/lib/primitive/lib/Cardano/Wallet/Primitive/Types/Coin/Gen.hs @@ -10,17 +10,26 @@ module Cardano.Wallet.Primitive.Types.Coin.Gen import Prelude import Cardano.Wallet.Primitive.Types.Coin - ( Coin (..) ) + ( Coin (..) + ) import Control.Monad - ( replicateM ) + ( replicateM + ) import Data.Coerce - ( coerce ) + ( coerce + ) import Data.List.NonEmpty - ( NonEmpty ) + ( NonEmpty + ) import Test.QuickCheck - ( Gen, choose, sized ) + ( Gen + , choose + , sized + ) import Test.QuickCheck.Extra - ( chooseNatural, shrinkNatural ) + ( chooseNatural + , shrinkNatural + ) import qualified Cardano.Wallet.Primitive.Types.Coin as Coin import qualified Data.List.NonEmpty as NE diff --git a/lib/primitive/lib/Cardano/Wallet/Primitive/Types/Hash.hs b/lib/primitive/lib/Cardano/Wallet/Primitive/Types/Hash.hs index 3db0dc7998b..27f3251ec1e 100644 --- a/lib/primitive/lib/Cardano/Wallet/Primitive/Types/Hash.hs +++ b/lib/primitive/lib/Cardano/Wallet/Primitive/Types/Hash.hs @@ -24,35 +24,59 @@ module Cardano.Wallet.Primitive.Types.Hash import Prelude import Cardano.Wallet.Util - ( mapFirst ) + ( mapFirst + ) import Control.DeepSeq - ( NFData (..) ) + ( NFData (..) + ) import Crypto.Hash - ( Blake2b_224, Blake2b_256, hash ) + ( Blake2b_224 + , Blake2b_256 + , hash + ) import Data.ByteArray - ( ByteArrayAccess ) + ( ByteArrayAccess + ) import Data.ByteArray.Encoding - ( Base (Base16), convertFromBase, convertToBase ) + ( Base (Base16) + , convertFromBase + , convertToBase + ) import Data.ByteString - ( ByteString ) + ( ByteString + ) import Data.Hashable - ( Hashable ) + ( Hashable + ) import Data.Proxy - ( Proxy (..) ) + ( Proxy (..) + ) import Data.Text - ( Text ) + ( Text + ) import Data.Text.Class - ( FromText (..), TextDecodingError (..), ToText (..) ) + ( FromText (..) + , TextDecodingError (..) + , ToText (..) + ) import Fmt - ( Buildable (..), prefixF ) + ( Buildable (..) + , prefixF + ) import GHC.Generics - ( Generic ) + ( Generic + ) import GHC.TypeLits - ( KnownSymbol, Symbol, symbolVal ) + ( KnownSymbol + , Symbol + , symbolVal + ) import NoThunks.Class - ( NoThunks (..) ) + ( NoThunks (..) + ) import Quiet - ( Quiet (..) ) + ( Quiet (..) + ) import qualified Data.ByteArray as BA import qualified Data.ByteString as BS diff --git a/lib/primitive/lib/Cardano/Wallet/Primitive/Types/ProtocolMagic.hs b/lib/primitive/lib/Cardano/Wallet/Primitive/Types/ProtocolMagic.hs index f5a1ad501b4..fb4932c4b8d 100644 --- a/lib/primitive/lib/Cardano/Wallet/Primitive/Types/ProtocolMagic.hs +++ b/lib/primitive/lib/Cardano/Wallet/Primitive/Types/ProtocolMagic.hs @@ -22,23 +22,36 @@ module Cardano.Wallet.Primitive.Types.ProtocolMagic import Prelude import Cardano.Wallet.Primitive.NetworkId - ( SNetworkId (..), fromSNat ) + ( SNetworkId (..) + , fromSNat + ) import Control.DeepSeq - ( NFData (..) ) + ( NFData (..) + ) import Data.Aeson - ( FromJSON (..), ToJSON (..) ) + ( FromJSON (..) + , ToJSON (..) + ) import Data.Int - ( Int32 ) + ( Int32 + ) import Data.Proxy - ( Proxy (..) ) + ( Proxy (..) + ) import Data.Text.Class - ( FromText (..), ToText (..) ) + ( FromText (..) + , ToText (..) + ) import GHC.Generics - ( Generic ) + ( Generic + ) import GHC.TypeLits - ( KnownNat, natVal ) + ( KnownNat + , natVal + ) import Numeric.Natural - ( Natural ) + ( Natural + ) import qualified Data.Text as T diff --git a/lib/primitive/lib/Cardano/Wallet/Primitive/Types/RewardAccount.hs b/lib/primitive/lib/Cardano/Wallet/Primitive/Types/RewardAccount.hs index 06aa49280a8..8e39bbe750b 100644 --- a/lib/primitive/lib/Cardano/Wallet/Primitive/Types/RewardAccount.hs +++ b/lib/primitive/lib/Cardano/Wallet/Primitive/Types/RewardAccount.hs @@ -16,23 +16,35 @@ module Cardano.Wallet.Primitive.Types.RewardAccount import Prelude import Cardano.Wallet.Primitive.Types.Hash - ( Hash (..) ) + ( Hash (..) + ) import Control.DeepSeq - ( NFData (..) ) + ( NFData (..) + ) import Data.Aeson - ( FromJSON (..), ToJSON (..), Value (String) ) + ( FromJSON (..) + , ToJSON (..) + , Value (String) + ) import Data.Aeson.Extra - ( aesonFromText ) + ( aesonFromText + ) import Data.ByteString - ( ByteString ) + ( ByteString + ) import Data.Text.Class - ( FromText (..), ToText (..) ) + ( FromText (..) + , ToText (..) + ) import Fmt - ( Buildable (..) ) + ( Buildable (..) + ) import GHC.Generics - ( Generic ) + ( Generic + ) import Quiet - ( Quiet (..) ) + ( Quiet (..) + ) import Data.Text as T diff --git a/lib/primitive/lib/Cardano/Wallet/Primitive/Types/RewardAccount/Gen.hs b/lib/primitive/lib/Cardano/Wallet/Primitive/Types/RewardAccount/Gen.hs index d38160690d8..6900271b395 100644 --- a/lib/primitive/lib/Cardano/Wallet/Primitive/Types/RewardAccount/Gen.hs +++ b/lib/primitive/lib/Cardano/Wallet/Primitive/Types/RewardAccount/Gen.hs @@ -7,11 +7,17 @@ module Cardano.Wallet.Primitive.Types.RewardAccount.Gen import Prelude import Cardano.Wallet.Primitive.Types.Hash - ( Hash (..), mockHashRewardAccount ) + ( Hash (..) + , mockHashRewardAccount + ) import Cardano.Wallet.Primitive.Types.RewardAccount - ( RewardAccount (..) ) + ( RewardAccount (..) + ) import Test.QuickCheck - ( Gen, elements, sized ) + ( Gen + , elements + , sized + ) import qualified Data.ByteString.Char8 as B8 diff --git a/lib/primitive/lib/Cardano/Wallet/Primitive/Types/TokenBundle.hs b/lib/primitive/lib/Cardano/Wallet/Primitive/Types/TokenBundle.hs index 4788dd85629..434d3251298 100644 --- a/lib/primitive/lib/Cardano/Wallet/Primitive/Types/TokenBundle.hs +++ b/lib/primitive/lib/Cardano/Wallet/Primitive/Types/TokenBundle.hs @@ -71,28 +71,46 @@ module Cardano.Wallet.Primitive.Types.TokenBundle ) where import Prelude hiding - ( gcd, null, subtract ) + ( gcd + , null + , subtract + ) import Algebra.PartialOrd - ( PartialOrd (..) ) + ( PartialOrd (..) + ) import Cardano.Wallet.Primitive.Types.Coin - ( Coin (..) ) + ( Coin (..) + ) import Cardano.Wallet.Primitive.Types.TokenMap - ( AssetId (..), Flat (..), Lexicographic (..), Nested (..), TokenMap ) + ( AssetId (..) + , Flat (..) + , Lexicographic (..) + , Nested (..) + , TokenMap + ) import Cardano.Wallet.Primitive.Types.TokenPolicy - ( TokenName, TokenPolicyId ) + ( TokenName + , TokenPolicyId + ) import Cardano.Wallet.Primitive.Types.TokenQuantity - ( TokenQuantity (..) ) + ( TokenQuantity (..) + ) import Control.DeepSeq - ( NFData ) + ( NFData + ) import Data.Bifunctor - ( first ) + ( first + ) import Data.Hashable - ( Hashable ) + ( Hashable + ) import Data.List.NonEmpty - ( NonEmpty (..) ) + ( NonEmpty (..) + ) import Data.Map.Strict - ( Map ) + ( Map + ) import Data.Monoid.Cancellative ( GCDMonoid (..) , LeftGCDMonoid (..) @@ -103,23 +121,35 @@ import Data.Monoid.Cancellative , RightReductive (..) ) import Data.Monoid.Monus - ( Monus ((<\>)) ) + ( Monus ((<\>)) + ) import Data.Monoid.Null - ( MonoidNull (..) ) + ( MonoidNull (..) + ) import Data.Ord - ( comparing ) + ( comparing + ) import Data.Semigroup.Commutative - ( Commutative ) + ( Commutative + ) import Data.Set - ( Set ) + ( Set + ) import Fmt - ( Buildable (..), Builder, blockMapF ) + ( Buildable (..) + , Builder + , blockMapF + ) import GHC.Generics - ( Generic ) + ( Generic + ) import GHC.TypeLits - ( ErrorMessage (..), TypeError ) + ( ErrorMessage (..) + , TypeError + ) import Safe - ( fromJustNote ) + ( fromJustNote + ) import qualified Cardano.Wallet.Primitive.Types.Coin as Coin import qualified Cardano.Wallet.Primitive.Types.TokenMap as TokenMap diff --git a/lib/primitive/lib/Cardano/Wallet/Primitive/Types/TokenBundle/Gen.hs b/lib/primitive/lib/Cardano/Wallet/Primitive/Types/TokenBundle/Gen.hs index 457f328d5e0..b2caa4e2835 100644 --- a/lib/primitive/lib/Cardano/Wallet/Primitive/Types/TokenBundle/Gen.hs +++ b/lib/primitive/lib/Cardano/Wallet/Primitive/Types/TokenBundle/Gen.hs @@ -19,7 +19,8 @@ import Cardano.Wallet.Primitive.Types.Coin.Gen , shrinkCoinPositive ) import Cardano.Wallet.Primitive.Types.TokenBundle - ( TokenBundle (..) ) + ( TokenBundle (..) + ) import Cardano.Wallet.Primitive.Types.TokenMap.Gen ( genTokenMap , genTokenMapPartition @@ -27,11 +28,14 @@ import Cardano.Wallet.Primitive.Types.TokenMap.Gen , shrinkTokenMap ) import Data.List.NonEmpty - ( NonEmpty ) + ( NonEmpty + ) import Test.QuickCheck - ( Gen ) + ( Gen + ) import Test.QuickCheck.Extra - ( shrinkInterleaved ) + ( shrinkInterleaved + ) import qualified Data.Foldable as F import qualified Data.List.NonEmpty as NE diff --git a/lib/primitive/lib/Cardano/Wallet/Primitive/Types/TokenMap.hs b/lib/primitive/lib/Cardano/Wallet/Primitive/Types/TokenMap.hs index 7b114162787..c4cacb532e7 100644 --- a/lib/primitive/lib/Cardano/Wallet/Primitive/Types/TokenMap.hs +++ b/lib/primitive/lib/Cardano/Wallet/Primitive/Types/TokenMap.hs @@ -84,68 +84,117 @@ module Cardano.Wallet.Primitive.Types.TokenMap ) where import Prelude hiding - ( filter, subtract ) + ( filter + , subtract + ) import Algebra.PartialOrd - ( PartialOrd (..) ) + ( PartialOrd (..) + ) import Cardano.Numeric.Util - ( equipartitionNatural ) + ( equipartitionNatural + ) import Cardano.Wallet.Primitive.Types.TokenPolicy - ( TokenName, TokenPolicyId ) + ( TokenName + , TokenPolicyId + ) import Cardano.Wallet.Primitive.Types.TokenQuantity - ( TokenQuantity (..) ) + ( TokenQuantity (..) + ) import Control.DeepSeq - ( NFData ) + ( NFData + ) import Control.Monad - ( when, (<=<) ) + ( when + , (<=<) + ) import Data.Aeson - ( FromJSON (..), ToJSON (..), camelTo2, genericParseJSON, genericToJSON ) + ( FromJSON (..) + , ToJSON (..) + , camelTo2 + , genericParseJSON + , genericToJSON + ) import Data.Aeson.Types - ( Options (..), Parser ) + ( Options (..) + , Parser + ) import Data.Bifunctor - ( first ) + ( first + ) import Data.Function - ( on ) + ( on + ) import Data.Hashable - ( Hashable (..), hashUsing ) + ( Hashable (..) + , hashUsing + ) import Data.List.NonEmpty - ( NonEmpty (..) ) + ( NonEmpty (..) + ) import Data.Map.Strict - ( Map ) + ( Map + ) import Data.Maybe - ( mapMaybe ) + ( mapMaybe + ) import Data.Monoid.Cancellative - ( LeftReductive, Reductive (()), RightReductive ) + ( LeftReductive + , Reductive (()) + , RightReductive + ) import Data.Monoid.GCD - ( GCDMonoid, LeftGCDMonoid, RightGCDMonoid ) + ( GCDMonoid + , LeftGCDMonoid + , RightGCDMonoid + ) import Data.Monoid.Monus - ( Monus ((<\>)), OverlappingGCDMonoid ) + ( Monus ((<\>)) + , OverlappingGCDMonoid + ) import Data.Monoid.Null - ( MonoidNull ) + ( MonoidNull + ) import Data.MonoidMap - ( MonoidMap ) + ( MonoidMap + ) import Data.Ord - ( comparing ) + ( comparing + ) import Data.Ratio - ( (%) ) + ( (%) + ) import Data.Semigroup.Commutative - ( Commutative ) + ( Commutative + ) import Data.Set - ( Set ) + ( Set + ) import Data.Text.Class - ( toText ) + ( toText + ) import Fmt - ( Buildable (..), Builder, blockListF', blockMapF ) + ( Buildable (..) + , Builder + , blockListF' + , blockMapF + ) import GHC.Generics - ( Generic ) + ( Generic + ) import GHC.TypeLits - ( ErrorMessage (..), TypeError ) + ( ErrorMessage (..) + , TypeError + ) import Numeric.Natural - ( Natural ) + ( Natural + ) import Quiet - ( Quiet (..) ) + ( Quiet (..) + ) import Safe - ( fromJustNote ) + ( fromJustNote + ) import qualified Cardano.Wallet.Primitive.Types.TokenQuantity as TokenQuantity import qualified Data.Aeson as Aeson diff --git a/lib/primitive/lib/Cardano/Wallet/Primitive/Types/TokenMap/Gen.hs b/lib/primitive/lib/Cardano/Wallet/Primitive/Types/TokenMap/Gen.hs index 411de8c5237..2a7613d992a 100644 --- a/lib/primitive/lib/Cardano/Wallet/Primitive/Types/TokenMap/Gen.hs +++ b/lib/primitive/lib/Cardano/Wallet/Primitive/Types/TokenMap/Gen.hs @@ -16,7 +16,9 @@ module Cardano.Wallet.Primitive.Types.TokenMap.Gen import Prelude import Cardano.Wallet.Primitive.Types.TokenMap - ( AssetId (..), TokenMap ) + ( AssetId (..) + , TokenMap + ) import Cardano.Wallet.Primitive.Types.TokenPolicy.Gen ( genTokenName , genTokenNameLargeRange @@ -28,21 +30,32 @@ import Cardano.Wallet.Primitive.Types.TokenPolicy.Gen , testTokenPolicyIds ) import Cardano.Wallet.Primitive.Types.TokenQuantity - ( TokenQuantity (..) ) + ( TokenQuantity (..) + ) import Cardano.Wallet.Primitive.Types.TokenQuantity.Gen - ( genTokenQuantity, genTokenQuantityPartition, shrinkTokenQuantity ) + ( genTokenQuantity + , genTokenQuantityPartition + , shrinkTokenQuantity + ) import Control.Monad - ( replicateM ) + ( replicateM + ) import Data.List - ( elemIndex, transpose ) + ( elemIndex + , transpose + ) import Data.List.NonEmpty - ( NonEmpty ) + ( NonEmpty + ) import Data.Maybe - ( fromMaybe ) + ( fromMaybe + ) import GHC.Generics - ( Generic ) + ( Generic + ) import Safe - ( fromJustNote ) + ( fromJustNote + ) import Test.QuickCheck ( CoArbitrary (..) , Function (..) @@ -55,7 +68,9 @@ import Test.QuickCheck , variant ) import Test.QuickCheck.Extra - ( genSized2With, shrinkInterleaved ) + ( genSized2With + , shrinkInterleaved + ) import qualified Cardano.Wallet.Primitive.Types.TokenMap as TokenMap import qualified Data.Foldable as F diff --git a/lib/primitive/lib/Cardano/Wallet/Primitive/Types/TokenPolicy.hs b/lib/primitive/lib/Cardano/Wallet/Primitive/Types/TokenPolicy.hs index cc8cc305854..4f29027c62b 100644 --- a/lib/primitive/lib/Cardano/Wallet/Primitive/Types/TokenPolicy.hs +++ b/lib/primitive/lib/Cardano/Wallet/Primitive/Types/TokenPolicy.hs @@ -39,43 +39,69 @@ module Cardano.Wallet.Primitive.Types.TokenPolicy import Prelude import Cardano.Wallet.Primitive.Types.Hash - ( Hash (..) ) + ( Hash (..) + ) import Codec.Binary.Bech32.TH - ( humanReadablePart ) + ( humanReadablePart + ) import Control.DeepSeq - ( NFData ) + ( NFData + ) import Control.Monad - ( (>=>) ) + ( (>=>) + ) import Crypto.Hash - ( hash ) + ( hash + ) import Crypto.Hash.Algorithms - ( Blake2b_160 ) + ( Blake2b_160 + ) import Data.Aeson - ( FromJSON (..), ToJSON (..) ) + ( FromJSON (..) + , ToJSON (..) + ) import Data.Bifunctor - ( first ) + ( first + ) import Data.ByteArray - ( convert ) + ( convert + ) import Data.ByteArray.Encoding - ( Base (Base16), convertFromBase, convertToBase ) + ( Base (Base16) + , convertFromBase + , convertToBase + ) import Data.ByteString - ( ByteString ) + ( ByteString + ) import Data.Function - ( (&) ) + ( (&) + ) import Data.Hashable - ( Hashable ) + ( Hashable + ) import Data.Text - ( Text ) + ( Text + ) import Data.Text.Class - ( FromText (..), TextDecodingError (..), ToText (..) ) + ( FromText (..) + , TextDecodingError (..) + , ToText (..) + ) import Fmt - ( Buildable (..) ) + ( Buildable (..) + ) import GHC.Generics - ( Generic ) + ( Generic + ) import Network.URI - ( URI, parseAbsoluteURI, uriScheme ) + ( URI + , parseAbsoluteURI + , uriScheme + ) import Quiet - ( Quiet (..) ) + ( Quiet (..) + ) import qualified Codec.Binary.Bech32 as Bech32 import qualified Data.ByteString as BS diff --git a/lib/primitive/lib/Cardano/Wallet/Primitive/Types/TokenPolicy/Gen.hs b/lib/primitive/lib/Cardano/Wallet/Primitive/Types/TokenPolicy/Gen.hs index 7160a3fd018..e8ba278dc1d 100644 --- a/lib/primitive/lib/Cardano/Wallet/Primitive/Types/TokenPolicy/Gen.hs +++ b/lib/primitive/lib/Cardano/Wallet/Primitive/Types/TokenPolicy/Gen.hs @@ -21,15 +21,24 @@ module Cardano.Wallet.Primitive.Types.TokenPolicy.Gen import Prelude import Cardano.Wallet.Primitive.Types.Hash - ( Hash (..) ) + ( Hash (..) + ) import Cardano.Wallet.Primitive.Types.TokenPolicy - ( TokenName (..), TokenPolicyId (..) ) + ( TokenName (..) + , TokenPolicyId (..) + ) import Data.Either - ( fromRight ) + ( fromRight + ) import Data.Text.Class - ( FromText (..) ) + ( FromText (..) + ) import Test.QuickCheck - ( Gen, elements, sized, vector ) + ( Gen + , elements + , sized + , vector + ) import qualified Data.ByteString as BS import qualified Data.ByteString.Char8 as B8 diff --git a/lib/primitive/lib/Cardano/Wallet/Primitive/Types/TokenQuantity.hs b/lib/primitive/lib/Cardano/Wallet/Primitive/Types/TokenQuantity.hs index e15372d1338..b6fc762fadd 100644 --- a/lib/primitive/lib/Cardano/Wallet/Primitive/Types/TokenQuantity.hs +++ b/lib/primitive/lib/Cardano/Wallet/Primitive/Types/TokenQuantity.hs @@ -31,42 +31,70 @@ module Cardano.Wallet.Primitive.Types.TokenQuantity ) where import Prelude hiding - ( pred, subtract, succ ) + ( pred + , subtract + , succ + ) import Cardano.Numeric.Util - ( equipartitionNatural, partitionNatural ) + ( equipartitionNatural + , partitionNatural + ) import Control.DeepSeq - ( NFData (..) ) + ( NFData (..) + ) import Data.Aeson - ( FromJSON (..), ToJSON (..) ) + ( FromJSON (..) + , ToJSON (..) + ) import Data.Hashable - ( Hashable ) + ( Hashable + ) import Data.List.NonEmpty - ( NonEmpty (..) ) + ( NonEmpty (..) + ) import Data.Maybe - ( fromMaybe ) + ( fromMaybe + ) import Data.Monoid - ( Sum (..) ) + ( Sum (..) + ) import Data.Monoid.Cancellative - ( LeftReductive, Reductive (()), RightReductive ) + ( LeftReductive + , Reductive (()) + , RightReductive + ) import Data.Monoid.GCD - ( GCDMonoid, LeftGCDMonoid, RightGCDMonoid ) + ( GCDMonoid + , LeftGCDMonoid + , RightGCDMonoid + ) import Data.Monoid.Monus - ( Monus ((<\>)), OverlappingGCDMonoid ) + ( Monus ((<\>)) + , OverlappingGCDMonoid + ) import Data.Monoid.Null - ( MonoidNull ) + ( MonoidNull + ) import Data.Semigroup.Commutative - ( Commutative ) + ( Commutative + ) import Data.Text.Class - ( FromText (..), ToText (..) ) + ( FromText (..) + , ToText (..) + ) import Fmt - ( Buildable (..) ) + ( Buildable (..) + ) import GHC.Generics - ( Generic ) + ( Generic + ) import Numeric.Natural - ( Natural ) + ( Natural + ) import Quiet - ( Quiet (..) ) + ( Quiet (..) + ) -------------------------------------------------------------------------------- -- Type diff --git a/lib/primitive/lib/Cardano/Wallet/Primitive/Types/TokenQuantity/Gen.hs b/lib/primitive/lib/Cardano/Wallet/Primitive/Types/TokenQuantity/Gen.hs index 48d58c340c8..128a2e8f9a6 100644 --- a/lib/primitive/lib/Cardano/Wallet/Primitive/Types/TokenQuantity/Gen.hs +++ b/lib/primitive/lib/Cardano/Wallet/Primitive/Types/TokenQuantity/Gen.hs @@ -14,19 +14,30 @@ module Cardano.Wallet.Primitive.Types.TokenQuantity.Gen import Prelude import Cardano.Wallet.Primitive.Types.TokenQuantity - ( TokenQuantity (..) ) + ( TokenQuantity (..) + ) import Control.Monad - ( replicateM ) + ( replicateM + ) import Data.Coerce - ( coerce ) + ( coerce + ) import Data.List.NonEmpty - ( NonEmpty ) + ( NonEmpty + ) import Data.Word - ( Word64 ) + ( Word64 + ) import Test.QuickCheck - ( Gen, choose, frequency, shrink, sized ) + ( Gen + , choose + , frequency + , shrink + , sized + ) import Test.QuickCheck.Extra - ( chooseNatural ) + ( chooseNatural + ) import qualified Cardano.Wallet.Primitive.Types.TokenQuantity as TokenQuantity import qualified Data.List.NonEmpty as NE diff --git a/lib/primitive/lib/Cardano/Wallet/Primitive/Types/Tx.hs b/lib/primitive/lib/Cardano/Wallet/Primitive/Types/Tx.hs index c5b356ccdbd..e6bc7e4dab5 100644 --- a/lib/primitive/lib/Cardano/Wallet/Primitive/Types/Tx.hs +++ b/lib/primitive/lib/Cardano/Wallet/Primitive/Types/Tx.hs @@ -69,17 +69,24 @@ module Cardano.Wallet.Primitive.Types.Tx import Prelude import Cardano.Slotting.Slot - ( SlotNo (..) ) + ( SlotNo (..) + ) import Cardano.Wallet.Primitive.Types.Address - ( Address ) + ( Address + ) import Cardano.Wallet.Primitive.Types.Coin - ( Coin (..) ) + ( Coin (..) + ) import Cardano.Wallet.Primitive.Types.Hash - ( Hash ) + ( Hash + ) import Cardano.Wallet.Primitive.Types.TokenMap - ( TokenMap ) + ( TokenMap + ) import Cardano.Wallet.Primitive.Types.Tx.Constraints - ( txOutMaxCoin, txOutMinCoin ) + ( txOutMaxCoin + , txOutMinCoin + ) import Cardano.Wallet.Primitive.Types.Tx.SealedTx ( SealedTx (..) , SerialisedTx (..) @@ -115,11 +122,14 @@ import Cardano.Wallet.Primitive.Types.Tx.Tx , txScriptInvalid ) import Data.Word - ( Word64 ) + ( Word64 + ) import GHC.Generics - ( Generic ) + ( Generic + ) import GHC.Stack - ( HasCallStack ) + ( HasCallStack + ) import qualified Cardano.Wallet.Primitive.Types.Coin as Coin diff --git a/lib/primitive/lib/Cardano/Wallet/Primitive/Types/Tx/Constraints.hs b/lib/primitive/lib/Cardano/Wallet/Primitive/Types/Tx/Constraints.hs index c59563ab609..f1d853f937b 100644 --- a/lib/primitive/lib/Cardano/Wallet/Primitive/Types/Tx/Constraints.hs +++ b/lib/primitive/lib/Cardano/Wallet/Primitive/Types/Tx/Constraints.hs @@ -33,39 +33,61 @@ module Cardano.Wallet.Primitive.Types.Tx.Constraints import Prelude import Cardano.Wallet.Primitive.Types.Address - ( Address (..) ) + ( Address (..) + ) import Cardano.Wallet.Primitive.Types.Coin - ( Coin (..) ) + ( Coin (..) + ) import Cardano.Wallet.Primitive.Types.TokenBundle - ( TokenBundle (..) ) + ( TokenBundle (..) + ) import Cardano.Wallet.Primitive.Types.TokenMap - ( TokenMap ) + ( TokenMap + ) import Cardano.Wallet.Primitive.Types.TokenQuantity - ( TokenQuantity (..) ) + ( TokenQuantity (..) + ) import Control.DeepSeq - ( NFData (..) ) + ( NFData (..) + ) import Data.Int - ( Int64 ) + ( Int64 + ) import Data.Monoid - ( Sum (..) ) + ( Sum (..) + ) import Data.Monoid.Cancellative - ( LeftReductive, Reductive, RightReductive ) + ( LeftReductive + , Reductive + , RightReductive + ) import Data.Monoid.GCD - ( GCDMonoid, LeftGCDMonoid, RightGCDMonoid ) + ( GCDMonoid + , LeftGCDMonoid + , RightGCDMonoid + ) import Data.Monoid.Monus - ( Monus, OverlappingGCDMonoid ) + ( Monus + , OverlappingGCDMonoid + ) import Data.Monoid.Null - ( MonoidNull ) + ( MonoidNull + ) import Data.Semigroup.Commutative - ( Commutative ) + ( Commutative + ) import Data.Word - ( Word64 ) + ( Word64 + ) import GHC.Generics - ( Generic ) + ( Generic + ) import Numeric.Natural - ( Natural ) + ( Natural + ) import Quiet - ( Quiet (..) ) + ( Quiet (..) + ) import qualified Cardano.Wallet.Primitive.Types.TokenBundle as TokenBundle import qualified Cardano.Wallet.Primitive.Types.TokenMap as TokenMap diff --git a/lib/primitive/lib/Cardano/Wallet/Primitive/Types/Tx/Gen.hs b/lib/primitive/lib/Cardano/Wallet/Primitive/Types/Tx/Gen.hs index 00f2a5661ef..336946c15b1 100644 --- a/lib/primitive/lib/Cardano/Wallet/Primitive/Types/Tx/Gen.hs +++ b/lib/primitive/lib/Cardano/Wallet/Primitive/Types/Tx/Gen.hs @@ -18,33 +18,54 @@ module Cardano.Wallet.Primitive.Types.Tx.Gen import Prelude import Cardano.Wallet.Primitive.Types.Coin - ( Coin (..) ) + ( Coin (..) + ) import Cardano.Wallet.Primitive.Types.Coin.Gen - ( genCoinPositive, shrinkCoinPositive ) + ( genCoinPositive + , shrinkCoinPositive + ) import Cardano.Wallet.Primitive.Types.Hash - ( mockHash ) + ( mockHash + ) import Cardano.Wallet.Primitive.Types.RewardAccount - ( RewardAccount (..) ) + ( RewardAccount (..) + ) import Cardano.Wallet.Primitive.Types.RewardAccount.Gen - ( genRewardAccount, shrinkRewardAccount ) + ( genRewardAccount + , shrinkRewardAccount + ) import Cardano.Wallet.Primitive.Types.Tx - ( Tx (..), TxMetadata (..), TxScriptValidity (..) ) + ( Tx (..) + , TxMetadata (..) + , TxScriptValidity (..) + ) import Cardano.Wallet.Primitive.Types.Tx.Metadata.Gen - ( genNestedTxMetadata, shrinkTxMetadata ) + ( genNestedTxMetadata + , shrinkTxMetadata + ) import Cardano.Wallet.Primitive.Types.Tx.TxIn - ( TxIn (..) ) + ( TxIn (..) + ) import Cardano.Wallet.Primitive.Types.Tx.TxIn.Gen - ( genTxIn, shrinkTxIn ) + ( genTxIn + , shrinkTxIn + ) import Cardano.Wallet.Primitive.Types.Tx.TxOut - ( TxOut (..) ) + ( TxOut (..) + ) import Cardano.Wallet.Primitive.Types.Tx.TxOut.Gen - ( genTxOut, shrinkTxOut ) + ( genTxOut + , shrinkTxOut + ) import Data.Map.Strict - ( Map ) + ( Map + ) import Generics.SOP - ( NP (..) ) + ( NP (..) + ) import GHC.Generics - ( Generic ) + ( Generic + ) import Test.QuickCheck ( Gen , liftArbitrary @@ -57,9 +78,16 @@ import Test.QuickCheck , shrinkMapBy ) import Test.QuickCheck.Arbitrary.Generic - ( genericArbitrary, genericShrink ) + ( genericArbitrary + , genericShrink + ) import Test.QuickCheck.Extra - ( genMapWith, genericRoundRobinShrink, shrinkMapWith, (<:>), (<@>) ) + ( genMapWith + , genericRoundRobinShrink + , shrinkMapWith + , (<:>) + , (<@>) + ) -------------------------------------------------------------------------------- -- Transactions generated according to the size parameter diff --git a/lib/primitive/lib/Cardano/Wallet/Primitive/Types/Tx/Metadata/Gen.hs b/lib/primitive/lib/Cardano/Wallet/Primitive/Types/Tx/Metadata/Gen.hs index 636b0831cc5..7c52a4a474f 100644 --- a/lib/primitive/lib/Cardano/Wallet/Primitive/Types/Tx/Metadata/Gen.hs +++ b/lib/primitive/lib/Cardano/Wallet/Primitive/Types/Tx/Metadata/Gen.hs @@ -24,15 +24,21 @@ import Cardano.Api , metadataFromJson ) import Data.Aeson - ( ToJSON (..) ) + ( ToJSON (..) + ) import Data.ByteArray.Encoding - ( Base (..), convertToBase ) + ( Base (..) + , convertToBase + ) import Data.List - ( sortOn ) + ( sortOn + ) import Data.List.Extra - ( nubOrdOn ) + ( nubOrdOn + ) import Data.Text - ( Text ) + ( Text + ) import Test.QuickCheck ( Arbitrary (..) , Gen diff --git a/lib/primitive/lib/Cardano/Wallet/Primitive/Types/Tx/SealedTx.hs b/lib/primitive/lib/Cardano/Wallet/Primitive/Types/Tx/SealedTx.hs index 75485f23e34..475c644e6fc 100644 --- a/lib/primitive/lib/Cardano/Wallet/Primitive/Types/Tx/SealedTx.hs +++ b/lib/primitive/lib/Cardano/Wallet/Primitive/Types/Tx/SealedTx.hs @@ -47,35 +47,58 @@ import Cardano.Api , deserialiseFromCBOR ) import Cardano.Binary - ( DecoderError ) + ( DecoderError + ) import Cardano.Wallet.Util - ( HasCallStack, internalError ) + ( HasCallStack + , internalError + ) import Control.DeepSeq - ( NFData (..), deepseq ) + ( NFData (..) + , deepseq + ) import Data.Bifunctor - ( first ) + ( first + ) import Data.ByteArray - ( ByteArray, ByteArrayAccess ) + ( ByteArray + , ByteArrayAccess + ) import Data.ByteString - ( ByteString ) + ( ByteString + ) import Data.Data - ( Proxy (..) ) + ( Proxy (..) + ) import Data.Either - ( partitionEithers ) + ( partitionEithers + ) import Data.Either.Extra - ( eitherToMaybe ) + ( eitherToMaybe + ) import Data.Function - ( on ) + ( on + ) import Data.Text - ( Text ) + ( Text + ) import Data.Type.Equality - ( (:~:) (..), testEquality ) + ( (:~:) (..) + , testEquality + ) import Fmt - ( Buildable (..), Builder, hexF, (+||), (||+) ) + ( Buildable (..) + , Builder + , hexF + , (+||) + , (||+) + ) import GHC.Generics - ( Generic ) + ( Generic + ) import Text.Pretty.Simple - ( pShowNoColor ) + ( pShowNoColor + ) import qualified Cardano.Api as Cardano import qualified Data.ByteString.Char8 as B8 diff --git a/lib/primitive/lib/Cardano/Wallet/Primitive/Types/Tx/Tx.hs b/lib/primitive/lib/Cardano/Wallet/Primitive/Types/Tx/Tx.hs index 7c054d49b9a..c2605b1a3e6 100644 --- a/lib/primitive/lib/Cardano/Wallet/Primitive/Types/Tx/Tx.hs +++ b/lib/primitive/lib/Cardano/Wallet/Primitive/Types/Tx/Tx.hs @@ -43,41 +43,63 @@ module Cardano.Wallet.Primitive.Types.Tx.Tx import Prelude import Cardano.Api - ( ScriptWitnessIndex (..), TxMetadata (..), TxMetadataValue (..) ) + ( ScriptWitnessIndex (..) + , TxMetadata (..) + , TxMetadataValue (..) + ) import Cardano.Wallet.Orphans () import Cardano.Wallet.Primitive.Types.Coin - ( Coin (..) ) + ( Coin (..) + ) import Cardano.Wallet.Primitive.Types.Hash - ( Hash (..) ) + ( Hash (..) + ) import Cardano.Wallet.Primitive.Types.RewardAccount - ( RewardAccount (..) ) + ( RewardAccount (..) + ) import Cardano.Wallet.Primitive.Types.TokenMap - ( AssetId ) + ( AssetId + ) import Cardano.Wallet.Primitive.Types.Tx.TxIn - ( TxIn (..) ) + ( TxIn (..) + ) import Cardano.Wallet.Primitive.Types.Tx.TxOut - ( TxOut (..) ) + ( TxOut (..) + ) import Cardano.Wallet.Read.Tx.CBOR - ( TxCBOR ) + ( TxCBOR + ) import Control.DeepSeq - ( NFData (..) ) + ( NFData (..) + ) import Data.Bifunctor - ( first ) + ( first + ) import Data.Function - ( (&) ) + ( (&) + ) import Data.Generics.Internal.VL.Lens - ( over, view ) + ( over + , view + ) import Data.Generics.Labels () import Data.Map.Strict - ( Map ) + ( Map + ) import Data.Set - ( Set ) + ( Set + ) import Fmt - ( Buildable (..), blockListF', nameF, tupleF ) + ( Buildable (..) + , blockListF' + , nameF + , tupleF + ) import GHC.Generics - ( Generic ) + ( Generic + ) import qualified Cardano.Wallet.Primitive.Types.Tx.TxOut as TxOut import qualified Data.Foldable as F diff --git a/lib/primitive/lib/Cardano/Wallet/Primitive/Types/Tx/TxIn.hs b/lib/primitive/lib/Cardano/Wallet/Primitive/Types/Tx/TxIn.hs index d5b614d4951..1d401348bb4 100644 --- a/lib/primitive/lib/Cardano/Wallet/Primitive/Types/Tx/TxIn.hs +++ b/lib/primitive/lib/Cardano/Wallet/Primitive/Types/Tx/TxIn.hs @@ -14,15 +14,21 @@ module Cardano.Wallet.Primitive.Types.Tx.TxIn import Prelude import Cardano.Wallet.Primitive.Types.Hash - ( Hash (..) ) + ( Hash (..) + ) import Control.DeepSeq - ( NFData (..) ) + ( NFData (..) + ) import Data.Word - ( Word32 ) + ( Word32 + ) import Fmt - ( Buildable (..), ordinalF ) + ( Buildable (..) + , ordinalF + ) import GHC.Generics - ( Generic ) + ( Generic + ) data TxIn = TxIn { inputId diff --git a/lib/primitive/lib/Cardano/Wallet/Primitive/Types/Tx/TxIn/Gen.hs b/lib/primitive/lib/Cardano/Wallet/Primitive/Types/Tx/TxIn/Gen.hs index 3e2a443f164..9c4c5e09f01 100644 --- a/lib/primitive/lib/Cardano/Wallet/Primitive/Types/Tx/TxIn/Gen.hs +++ b/lib/primitive/lib/Cardano/Wallet/Primitive/Types/Tx/TxIn/Gen.hs @@ -19,21 +19,36 @@ module Cardano.Wallet.Primitive.Types.Tx.TxIn.Gen import Prelude import Cardano.Wallet.Primitive.Types.Hash - ( Hash (..) ) + ( Hash (..) + ) import Cardano.Wallet.Primitive.Types.Tx.TxIn - ( TxIn (..) ) + ( TxIn (..) + ) import Control.Monad - ( replicateM ) + ( replicateM + ) import Data.Either - ( fromRight ) + ( fromRight + ) import Data.Text.Class - ( FromText (..) ) + ( FromText (..) + ) import Data.Word - ( Word16, Word32 ) + ( Word16 + , Word32 + ) import Test.QuickCheck - ( Gen, arbitrary, coarbitrary, elements, sized ) + ( Gen + , arbitrary + , coarbitrary + , elements + , sized + ) import Test.QuickCheck.Extra - ( genFunction, genSized2With, shrinkInterleaved ) + ( genFunction + , genSized2With + , shrinkInterleaved + ) import qualified Data.ByteString.Char8 as B8 import qualified Data.Text as T diff --git a/lib/primitive/lib/Cardano/Wallet/Primitive/Types/Tx/TxOut.hs b/lib/primitive/lib/Cardano/Wallet/Primitive/Types/Tx/TxOut.hs index 6ff11c20bd9..4438d38f938 100644 --- a/lib/primitive/lib/Cardano/Wallet/Primitive/Types/Tx/TxOut.hs +++ b/lib/primitive/lib/Cardano/Wallet/Primitive/Types/Tx/TxOut.hs @@ -30,29 +30,45 @@ module Cardano.Wallet.Primitive.Types.Tx.TxOut import Prelude import Cardano.Wallet.Primitive.Types.Address - ( Address (..) ) + ( Address (..) + ) import Cardano.Wallet.Primitive.Types.Coin - ( Coin (..) ) + ( Coin (..) + ) import Cardano.Wallet.Primitive.Types.TokenBundle - ( TokenBundle ) + ( TokenBundle + ) import Cardano.Wallet.Primitive.Types.TokenMap - ( AssetId, Lexicographic (..) ) + ( AssetId + , Lexicographic (..) + ) import Control.DeepSeq - ( NFData (..) ) + ( NFData (..) + ) import Data.Bifunctor - ( first ) + ( first + ) import Data.Generics.Internal.VL.Lens - ( over, view ) + ( over + , view + ) import Data.Generics.Labels () import Data.Ord - ( comparing ) + ( comparing + ) import Data.Set - ( Set ) + ( Set + ) import Fmt - ( Buildable (..), blockMapF, prefixF, suffixF ) + ( Buildable (..) + , blockMapF + , prefixF + , suffixF + ) import GHC.Generics - ( Generic ) + ( Generic + ) import qualified Cardano.Wallet.Primitive.Types.Coin as Coin import qualified Cardano.Wallet.Primitive.Types.TokenBundle as TokenBundle diff --git a/lib/primitive/lib/Cardano/Wallet/Primitive/Types/Tx/TxOut/Gen.hs b/lib/primitive/lib/Cardano/Wallet/Primitive/Types/Tx/TxOut/Gen.hs index 696b40fe041..d179abab972 100644 --- a/lib/primitive/lib/Cardano/Wallet/Primitive/Types/Tx/TxOut/Gen.hs +++ b/lib/primitive/lib/Cardano/Wallet/Primitive/Types/Tx/TxOut/Gen.hs @@ -15,17 +15,25 @@ module Cardano.Wallet.Primitive.Types.Tx.TxOut.Gen import Prelude import Cardano.Wallet.Primitive.Types.Address.Gen - ( genAddress, shrinkAddress ) + ( genAddress + , shrinkAddress + ) import Cardano.Wallet.Primitive.Types.Coin - ( Coin (..) ) + ( Coin (..) + ) import Cardano.Wallet.Primitive.Types.TokenBundle - ( TokenBundle ) + ( TokenBundle + ) import Cardano.Wallet.Primitive.Types.TokenBundle.Gen - ( genTokenBundleSmallRange, shrinkTokenBundleSmallRange ) + ( genTokenBundleSmallRange + , shrinkTokenBundleSmallRange + ) import Cardano.Wallet.Primitive.Types.TokenMap.Gen - ( genAssetIdLargeRange ) + ( genAssetIdLargeRange + ) import Cardano.Wallet.Primitive.Types.TokenQuantity - ( TokenQuantity (..) ) + ( TokenQuantity (..) + ) import Cardano.Wallet.Primitive.Types.Tx.Constraints ( coinIsValidForTxOut , txOutMaxCoin @@ -34,13 +42,24 @@ import Cardano.Wallet.Primitive.Types.Tx.Constraints , txOutMinTokenQuantity ) import Cardano.Wallet.Primitive.Types.Tx.TxOut - ( TxOut (..) ) + ( TxOut (..) + ) import Control.Monad - ( replicateM ) + ( replicateM + ) import Test.QuickCheck - ( Gen, choose, frequency, oneof, shrinkMapBy, suchThat ) + ( Gen + , choose + , frequency + , oneof + , shrinkMapBy + , suchThat + ) import Test.QuickCheck.Extra - ( chooseNatural, shrinkInterleaved, shrinkNatural ) + ( chooseNatural + , shrinkInterleaved + , shrinkNatural + ) import qualified Cardano.Wallet.Primitive.Types.Coin as Coin import qualified Cardano.Wallet.Primitive.Types.TokenBundle as TokenBundle diff --git a/lib/primitive/lib/Cardano/Wallet/Primitive/Types/UTxO.hs b/lib/primitive/lib/Cardano/Wallet/Primitive/Types/UTxO.hs index 899179d07bf..eb0dfb6f20d 100644 --- a/lib/primitive/lib/Cardano/Wallet/Primitive/Types/UTxO.hs +++ b/lib/primitive/lib/Cardano/Wallet/Primitive/Types/UTxO.hs @@ -58,38 +58,60 @@ module Cardano.Wallet.Primitive.Types.UTxO ) where import Prelude hiding - ( filter, lookup, null ) + ( filter + , lookup + , null + ) import Cardano.Wallet.Primitive.Types.Address - ( Address ) + ( Address + ) import Cardano.Wallet.Primitive.Types.Hash - ( Hash ) + ( Hash + ) import Cardano.Wallet.Primitive.Types.TokenBundle - ( TokenBundle ) + ( TokenBundle + ) import Cardano.Wallet.Primitive.Types.TokenMap - ( AssetId ) + ( AssetId + ) import Cardano.Wallet.Primitive.Types.Tx.TxIn - ( TxIn ) + ( TxIn + ) import Cardano.Wallet.Primitive.Types.Tx.TxOut - ( TxOut (..) ) + ( TxOut (..) + ) import Control.DeepSeq - ( NFData (..) ) + ( NFData (..) + ) import Data.Bifunctor - ( bimap, first ) + ( bimap + , first + ) import Data.Delta - ( Delta (..) ) + ( Delta (..) + ) import Data.Functor.Identity - ( runIdentity ) + ( runIdentity + ) import Data.Generics.Internal.VL.Lens - ( over, view ) + ( over + , view + ) import Data.Map.Strict - ( Map ) + ( Map + ) import Data.Set - ( Set ) + ( Set + ) import Fmt - ( Buildable (..), blockListF', blockMapF ) + ( Buildable (..) + , blockListF' + , blockMapF + ) import GHC.Generics - ( Generic ) + ( Generic + ) import qualified Cardano.Wallet.Primitive.Types.TokenBundle as TB import qualified Cardano.Wallet.Primitive.Types.Tx.TxOut as TxOut diff --git a/lib/primitive/lib/Cardano/Wallet/Primitive/Types/UTxO/Gen.hs b/lib/primitive/lib/Cardano/Wallet/Primitive/Types/UTxO/Gen.hs index d08eae4df77..730900cfcc7 100644 --- a/lib/primitive/lib/Cardano/Wallet/Primitive/Types/UTxO/Gen.hs +++ b/lib/primitive/lib/Cardano/Wallet/Primitive/Types/UTxO/Gen.hs @@ -9,21 +9,36 @@ module Cardano.Wallet.Primitive.Types.UTxO.Gen import Prelude import Cardano.Wallet.Primitive.Types.Tx.TxIn - ( TxIn ) + ( TxIn + ) import Cardano.Wallet.Primitive.Types.Tx.TxIn.Gen - ( genTxIn, genTxInLargeRange, shrinkTxIn ) + ( genTxIn + , genTxInLargeRange + , shrinkTxIn + ) import Cardano.Wallet.Primitive.Types.Tx.TxOut - ( TxOut ) + ( TxOut + ) import Cardano.Wallet.Primitive.Types.Tx.TxOut.Gen - ( genTxOut, shrinkTxOut ) + ( genTxOut + , shrinkTxOut + ) import Cardano.Wallet.Primitive.Types.UTxO - ( UTxO (..) ) + ( UTxO (..) + ) import Control.Monad - ( replicateM ) + ( replicateM + ) import Test.QuickCheck - ( Gen, choose, shrinkList, sized ) + ( Gen + , choose + , shrinkList + , sized + ) import Test.QuickCheck.Extra - ( selectMapEntries, shrinkInterleaved ) + ( selectMapEntries + , shrinkInterleaved + ) import qualified Data.Map.Strict as Map diff --git a/lib/primitive/lib/Cardano/Wallet/Unsafe.hs b/lib/primitive/lib/Cardano/Wallet/Unsafe.hs index 448738e3b85..678e513729d 100644 --- a/lib/primitive/lib/Cardano/Wallet/Unsafe.hs +++ b/lib/primitive/lib/Cardano/Wallet/Unsafe.hs @@ -43,7 +43,9 @@ module Cardano.Wallet.Unsafe import Prelude import Cardano.Crypto.Wallet - ( XPrv, XPub ) + ( XPrv + , XPub + ) import Cardano.Mnemonic ( ConsistentEntropy , Entropy @@ -59,39 +61,66 @@ import Cardano.Mnemonic , mkMnemonic ) import Cardano.Wallet.Util - ( internalError ) + ( internalError + ) import Control.Monad - ( (>=>) ) + ( (>=>) + ) import Control.Monad.Trans.Except - ( ExceptT (..), runExceptT ) + ( ExceptT (..) + , runExceptT + ) import Data.Binary.Get - ( Get, runGet ) + ( Get + , runGet + ) import Data.ByteArray - ( ByteArray ) + ( ByteArray + ) import Data.ByteArray.Encoding - ( Base (..), convertFromBase ) + ( Base (..) + , convertFromBase + ) import Data.ByteString - ( ByteString ) + ( ByteString + ) import Data.Char - ( isHexDigit ) + ( isHexDigit + ) import Data.Either - ( fromRight ) + ( fromRight + ) import Data.Proxy - ( Proxy (..) ) + ( Proxy (..) + ) import Data.Quantity - ( Percentage, mkPercentage ) + ( Percentage + , mkPercentage + ) import Data.Text - ( Text ) + ( Text + ) import Data.Text.Class - ( FromText (..) ) + ( FromText (..) + ) import Data.Typeable - ( Typeable, typeRep ) + ( Typeable + , typeRep + ) import Fmt - ( Buildable, Builder, build, (+||), (|+), (||+) ) + ( Buildable + , Builder + , build + , (+||) + , (|+) + , (||+) + ) import GHC.Stack - ( HasCallStack ) + ( HasCallStack + ) import GHC.TypeLits - ( natVal ) + ( natVal + ) import qualified Cardano.Crypto.Wallet as CC import qualified Codec.Binary.Bech32 as Bech32 diff --git a/lib/primitive/lib/Cardano/Wallet/Util.hs b/lib/primitive/lib/Cardano/Wallet/Util.hs index bd13c98fa13..226114e5580 100644 --- a/lib/primitive/lib/Cardano/Wallet/Util.hs +++ b/lib/primitive/lib/Cardano/Wallet/Util.hs @@ -34,41 +34,72 @@ module Cardano.Wallet.Util import Prelude import Control.DeepSeq - ( NFData (..) ) + ( NFData (..) + ) import Control.Error.Util - ( (??) ) + ( (??) + ) import Control.Exception - ( ErrorCall, displayException ) + ( ErrorCall + , displayException + ) import Control.Monad.IO.Unlift - ( MonadUnliftIO ) + ( MonadUnliftIO + ) import Control.Monad.Trans.Class - ( lift ) + ( lift + ) import Control.Monad.Trans.Except - ( runExceptT, throwE ) + ( runExceptT + , throwE + ) import Control.Monad.Trans.State.Strict - ( StateT, get, put ) + ( StateT + , get + , put + ) import Data.Foldable - ( asum ) + ( asum + ) import Data.Functor.Identity - ( runIdentity ) + ( runIdentity + ) import Data.List - ( isPrefixOf ) + ( isPrefixOf + ) import Data.Maybe - ( fromMaybe, isNothing ) + ( fromMaybe + , isNothing + ) import Data.Text - ( Text ) + ( Text + ) import Data.Text.Class - ( TextDecodingError (..) ) + ( TextDecodingError (..) + ) import Fmt - ( Buildable (..), Builder, fmt, (+|) ) + ( Buildable (..) + , Builder + , fmt + , (+|) + ) import GHC.Generics - ( Generic ) + ( Generic + ) import GHC.Stack - ( HasCallStack ) + ( HasCallStack + ) import Network.URI - ( URI (..), parseAbsoluteURI, uriQuery, uriScheme, uriToString ) + ( URI (..) + , parseAbsoluteURI + , uriQuery + , uriScheme + , uriToString + ) import UnliftIO.Exception - ( evaluate, tryJust ) + ( evaluate + , tryJust + ) import qualified Data.Text as T diff --git a/lib/primitive/lib/Control/Monad/Random/NonRandom.hs b/lib/primitive/lib/Control/Monad/Random/NonRandom.hs index f7b2b9a1fb2..90667ccd3b8 100644 --- a/lib/primitive/lib/Control/Monad/Random/NonRandom.hs +++ b/lib/primitive/lib/Control/Monad/Random/NonRandom.hs @@ -19,15 +19,21 @@ module Control.Monad.Random.NonRandom import Prelude import Control.Applicative - ( Applicative (..) ) + ( Applicative (..) + ) import Control.Monad.Random.Class - ( MonadRandom (..) ) + ( MonadRandom (..) + ) import Data.Coerce - ( coerce ) + ( coerce + ) import GHC.Generics - ( Generic ) + ( Generic + ) import System.Random - ( Random (..), RandomGen (..) ) + ( Random (..) + , RandomGen (..) + ) -- | Provides a stateless context for computations that must be non-random. -- diff --git a/lib/primitive/lib/Data/Aeson/Extra.hs b/lib/primitive/lib/Data/Aeson/Extra.hs index 375b2bc84ba..1f5f9a61fe8 100644 --- a/lib/primitive/lib/Data/Aeson/Extra.hs +++ b/lib/primitive/lib/Data/Aeson/Extra.hs @@ -18,11 +18,15 @@ module Data.Aeson.Extra import Prelude import Data.Aeson - ( Value (Number, Object), withText ) + ( Value (Number, Object) + , withText + ) import Data.Aeson.Types - ( Parser ) + ( Parser + ) import Data.Text.Class - ( FromText (fromText) ) + ( FromText (fromText) + ) import qualified Data.Scientific as Scientific diff --git a/lib/primitive/lib/Data/Quantity.hs b/lib/primitive/lib/Data/Quantity.hs index fc72be28d38..ba79c1dd238 100644 --- a/lib/primitive/lib/Data/Quantity.hs +++ b/lib/primitive/lib/Data/Quantity.hs @@ -34,11 +34,14 @@ module Data.Quantity import Prelude import Control.Arrow - ( left ) + ( left + ) import Control.DeepSeq - ( NFData ) + ( NFData + ) import Control.Monad - ( unless ) + ( unless + ) import Data.Aeson ( FromJSON (..) , ToJSON (..) @@ -50,29 +53,48 @@ import Data.Aeson , (.=) ) import Data.Aeson.Types - ( Parser ) + ( Parser + ) import Data.Data - ( Data ) + ( Data + ) import Data.Hashable - ( Hashable ) + ( Hashable + ) import Data.Proxy - ( Proxy (..) ) + ( Proxy (..) + ) import Data.Scientific - ( FPFormat (Fixed), Scientific (..), formatScientific ) + ( FPFormat (Fixed) + , Scientific (..) + , formatScientific + ) import Data.Text.Class - ( FromText (..), TextDecodingError (..), ToText (..) ) + ( FromText (..) + , TextDecodingError (..) + , ToText (..) + ) import Data.Text.Read - ( rational ) + ( rational + ) import Fmt - ( Buildable (..), fmt ) + ( Buildable (..) + , fmt + ) import GHC.Generics - ( Generic ) + ( Generic + ) import GHC.TypeLits - ( KnownSymbol, Symbol, symbolVal ) + ( KnownSymbol + , Symbol + , symbolVal + ) import NoThunks.Class - ( NoThunks (..) ) + ( NoThunks (..) + ) import Quiet - ( Quiet (..) ) + ( Quiet (..) + ) import qualified Data.Text as T diff --git a/lib/primitive/test/spec/Cardano/Wallet/Primitive/CollateralSpec.hs b/lib/primitive/test/spec/Cardano/Wallet/Primitive/CollateralSpec.hs index 2ce9e51a156..e0ecd4a87e6 100644 --- a/lib/primitive/test/spec/Cardano/Wallet/Primitive/CollateralSpec.hs +++ b/lib/primitive/test/spec/Cardano/Wallet/Primitive/CollateralSpec.hs @@ -19,31 +19,52 @@ import Cardano.Wallet.Primitive.Collateral , putAddressType ) import Cardano.Wallet.Primitive.Types.Address - ( Address (..) ) + ( Address (..) + ) import Cardano.Wallet.Primitive.Types.TokenBundle - ( TokenBundle ) + ( TokenBundle + ) import Cardano.Wallet.Primitive.Types.TokenBundle.Gen - ( genTokenBundleSmallRangePositive, shrinkTokenBundleSmallRangePositive ) + ( genTokenBundleSmallRangePositive + , shrinkTokenBundleSmallRangePositive + ) import Cardano.Wallet.Primitive.Types.Tx.TxOut - ( TxOut (..) ) + ( TxOut (..) + ) import Cardano.Wallet.Unsafe - ( unsafeBech32Decode ) + ( unsafeBech32Decode + ) import Control.Monad - ( guard, replicateM_ ) + ( guard + , replicateM_ + ) import Data.ByteString - ( ByteString ) + ( ByteString + ) import Data.ByteString.Base58 - ( bitcoinAlphabet, decodeBase58 ) + ( bitcoinAlphabet + , decodeBase58 + ) import Data.Function - ( (&) ) + ( (&) + ) import Data.Maybe - ( fromJust, isJust, isNothing ) + ( fromJust + , isJust + , isNothing + ) import Numeric - ( showHex ) + ( showHex + ) import Test.Cardano.Ledger.Core.Arbitrary () import Test.Hspec - ( Expectation, Spec, describe, it, shouldBe ) + ( Expectation + , Spec + , describe + , it + , shouldBe + ) import Test.QuickCheck ( Arbitrary (..) , Gen diff --git a/lib/primitive/test/spec/Cardano/Wallet/Primitive/Types/AddressSpec.hs b/lib/primitive/test/spec/Cardano/Wallet/Primitive/Types/AddressSpec.hs index 8f872642fb2..51da541c7e4 100644 --- a/lib/primitive/test/spec/Cardano/Wallet/Primitive/Types/AddressSpec.hs +++ b/lib/primitive/test/spec/Cardano/Wallet/Primitive/Types/AddressSpec.hs @@ -5,11 +5,22 @@ module Cardano.Wallet.Primitive.Types.AddressSpec import Prelude import Cardano.Wallet.Primitive.Types.Address.Gen - ( Parity (..), addressParity, genAddress ) + ( Parity (..) + , addressParity + , genAddress + ) import Test.Hspec - ( Spec, describe, it ) + ( Spec + , describe + , it + ) import Test.QuickCheck - ( Property, checkCoverage, cover, forAll, property ) + ( Property + , checkCoverage + , cover + , forAll + , property + ) spec :: Spec spec = diff --git a/lib/primitive/test/spec/Cardano/Wallet/Primitive/Types/CoinSpec.hs b/lib/primitive/test/spec/Cardano/Wallet/Primitive/Types/CoinSpec.hs index c0a806d7bec..d49cbaa8cc9 100644 --- a/lib/primitive/test/spec/Cardano/Wallet/Primitive/Types/CoinSpec.hs +++ b/lib/primitive/test/spec/Cardano/Wallet/Primitive/Types/CoinSpec.hs @@ -7,7 +7,8 @@ module Cardano.Wallet.Primitive.Types.CoinSpec import Prelude import Cardano.Wallet.Primitive.Types.Coin - ( Coin (..) ) + ( Coin (..) + ) import Cardano.Wallet.Primitive.Types.Coin.Gen ( genCoin , genCoinPartition @@ -16,11 +17,16 @@ import Cardano.Wallet.Primitive.Types.Coin.Gen , shrinkCoinPositive ) import Data.Function - ( (&) ) + ( (&) + ) import Data.List.NonEmpty - ( NonEmpty ) + ( NonEmpty + ) import Test.Hspec - ( Spec, describe, it ) + ( Spec + , describe + , it + ) import Test.QuickCheck ( Arbitrary (..) , Property @@ -33,7 +39,9 @@ import Test.QuickCheck , (===) ) import Test.QuickCheck.Extra - ( genNonEmpty, shrinkNonEmpty ) + ( genNonEmpty + , shrinkNonEmpty + ) import qualified Cardano.Wallet.Primitive.Types.Coin as Coin import qualified Data.Foldable as F diff --git a/lib/primitive/test/spec/Cardano/Wallet/Primitive/Types/HashSpec.hs b/lib/primitive/test/spec/Cardano/Wallet/Primitive/Types/HashSpec.hs index 76b35e9069c..c70bc68fbfd 100644 --- a/lib/primitive/test/spec/Cardano/Wallet/Primitive/Types/HashSpec.hs +++ b/lib/primitive/test/spec/Cardano/Wallet/Primitive/Types/HashSpec.hs @@ -13,19 +13,32 @@ module Cardano.Wallet.Primitive.Types.HashSpec import Prelude import Cardano.Wallet.Primitive.Types.Hash - ( Hash (..) ) + ( Hash (..) + ) import Cardano.Wallet.Unsafe - ( unsafeFromHex ) + ( unsafeFromHex + ) import Data.Proxy - ( Proxy (..) ) + ( Proxy (..) + ) import Data.Text.Class - ( TextDecodingError (..), fromText ) + ( TextDecodingError (..) + , fromText + ) import Test.Hspec - ( Spec, describe, it ) + ( Spec + , describe + , it + ) import Test.QuickCheck - ( Arbitrary (..), elements, vector, (===) ) + ( Arbitrary (..) + , elements + , vector + , (===) + ) import Test.Text.Roundtrip - ( textRoundtrip ) + ( textRoundtrip + ) import qualified Data.ByteString as BS diff --git a/lib/primitive/test/spec/Cardano/Wallet/Primitive/Types/TokenBundleSpec.hs b/lib/primitive/test/spec/Cardano/Wallet/Primitive/Types/TokenBundleSpec.hs index 807235dfa0f..696bba607e7 100644 --- a/lib/primitive/test/spec/Cardano/Wallet/Primitive/Types/TokenBundleSpec.hs +++ b/lib/primitive/test/spec/Cardano/Wallet/Primitive/Types/TokenBundleSpec.hs @@ -10,29 +10,42 @@ module Cardano.Wallet.Primitive.Types.TokenBundleSpec ) where import Prelude hiding - ( subtract ) + ( subtract + ) import Cardano.Numeric.Util - ( inAscendingPartialOrder ) + ( inAscendingPartialOrder + ) import Cardano.Wallet.Primitive.Types.TokenBundle - ( Lexicographic (..), TokenBundle (..) ) + ( Lexicographic (..) + , TokenBundle (..) + ) import Cardano.Wallet.Primitive.Types.TokenBundle.Gen ( genTokenBundlePartition , genTokenBundleSmallRange , shrinkTokenBundleSmallRange ) import Cardano.Wallet.Primitive.Types.TokenQuantity - ( TokenQuantity (..) ) + ( TokenQuantity (..) + ) import Cardano.Wallet.Primitive.Types.TokenQuantity.Gen - ( genTokenQuantityPositive, shrinkTokenQuantityPositive ) + ( genTokenQuantityPositive + , shrinkTokenQuantityPositive + ) import Data.Function - ( (&) ) + ( (&) + ) import Data.Ratio - ( (%) ) + ( (%) + ) import Test.Hspec - ( Spec, describe, it ) + ( Spec + , describe + , it + ) import Test.Hspec.Core.QuickCheck - ( modifyMaxSuccess ) + ( modifyMaxSuccess + ) import Test.QuickCheck ( Arbitrary (..) , Property @@ -44,7 +57,12 @@ import Test.QuickCheck , (==>) ) import Test.QuickCheck.Classes - ( eqLaws, monoidLaws, ordLaws, semigroupLaws, semigroupMonoidLaws ) + ( eqLaws + , monoidLaws + , ordLaws + , semigroupLaws + , semigroupMonoidLaws + ) import Test.QuickCheck.Classes.Monoid.GCD ( gcdMonoidLaws , leftGCDMonoidLaws @@ -52,15 +70,23 @@ import Test.QuickCheck.Classes.Monoid.GCD , rightGCDMonoidLaws ) import Test.QuickCheck.Classes.Monoid.Monus - ( monusLaws ) + ( monusLaws + ) import Test.QuickCheck.Classes.Monoid.Null - ( monoidNullLaws ) + ( monoidNullLaws + ) import Test.QuickCheck.Classes.Semigroup.Cancellative - ( commutativeLaws, leftReductiveLaws, reductiveLaws, rightReductiveLaws ) + ( commutativeLaws + , leftReductiveLaws + , reductiveLaws + , rightReductiveLaws + ) import Test.Utils.Laws - ( testLawsMany ) + ( testLawsMany + ) import Test.Utils.Laws.PartialOrd - ( partialOrdLaws ) + ( partialOrdLaws + ) import qualified Cardano.Wallet.Primitive.Types.TokenBundle as TokenBundle import qualified Cardano.Wallet.Primitive.Types.TokenMap as TokenMap diff --git a/lib/primitive/test/spec/Cardano/Wallet/Primitive/Types/TokenMapSpec.hs b/lib/primitive/test/spec/Cardano/Wallet/Primitive/Types/TokenMapSpec.hs index fdf766c3a1c..eccfa3cd96d 100644 --- a/lib/primitive/test/spec/Cardano/Wallet/Primitive/Types/TokenMapSpec.hs +++ b/lib/primitive/test/spec/Cardano/Wallet/Primitive/Types/TokenMapSpec.hs @@ -20,11 +20,18 @@ module Cardano.Wallet.Primitive.Types.TokenMapSpec import Prelude import Cardano.Numeric.Util - ( inAscendingPartialOrder ) + ( inAscendingPartialOrder + ) import Cardano.Wallet.Primitive.Types.Hash - ( Hash (..) ) + ( Hash (..) + ) import Cardano.Wallet.Primitive.Types.TokenMap - ( AssetId (..), Flat (..), Lexicographic (..), Nested (..), TokenMap ) + ( AssetId (..) + , Flat (..) + , Lexicographic (..) + , Nested (..) + , TokenMap + ) import Cardano.Wallet.Primitive.Types.TokenMap.Gen ( AssetIdF (..) , genAssetId @@ -35,11 +42,19 @@ import Cardano.Wallet.Primitive.Types.TokenMap.Gen , shrinkTokenMap ) import Cardano.Wallet.Primitive.Types.TokenPolicy - ( TokenName, TokenPolicyId, mkTokenName ) + ( TokenName + , TokenPolicyId + , mkTokenName + ) import Cardano.Wallet.Primitive.Types.TokenPolicy.Gen - ( genTokenName, genTokenPolicyId, shrinkTokenName, shrinkTokenPolicyId ) + ( genTokenName + , genTokenPolicyId + , shrinkTokenName + , shrinkTokenPolicyId + ) import Cardano.Wallet.Primitive.Types.TokenQuantity - ( TokenQuantity (..) ) + ( TokenQuantity (..) + ) import Cardano.Wallet.Primitive.Types.TokenQuantity.Gen ( genTokenQuantity , genTokenQuantityPositive @@ -47,45 +62,73 @@ import Cardano.Wallet.Primitive.Types.TokenQuantity.Gen , shrinkTokenQuantityPositive ) import Control.Monad - ( replicateM ) + ( replicateM + ) import Data.Aeson - ( FromJSON (..), ToJSON (..) ) + ( FromJSON (..) + , ToJSON (..) + ) import Data.Aeson.QQ - ( aesonQQ ) + ( aesonQQ + ) import Data.Bifunctor - ( bimap, first, second ) + ( bimap + , first + , second + ) import Data.ByteString - ( ByteString ) + ( ByteString + ) import Data.Either - ( fromRight ) + ( fromRight + ) import Data.Function - ( (&) ) + ( (&) + ) import Data.List.NonEmpty - ( NonEmpty (..) ) + ( NonEmpty (..) + ) import Data.Maybe - ( mapMaybe ) + ( mapMaybe + ) import Data.Proxy - ( Proxy (..) ) + ( Proxy (..) + ) import Data.Ratio - ( (%) ) + ( (%) + ) import Data.String.QQ - ( s ) + ( s + ) import Data.Text - ( Text ) + ( Text + ) import Data.Text.Class - ( fromText, toText ) + ( fromText + , toText + ) import Data.Typeable - ( Typeable ) + ( Typeable + ) import Fmt - ( pretty ) + ( pretty + ) import Numeric.Natural - ( Natural ) + ( Natural + ) import System.FilePath - ( () ) + ( () + ) import Test.Hspec - ( Expectation, Spec, describe, it, shouldBe ) + ( Expectation + , Spec + , describe + , it + , shouldBe + ) import Test.Hspec.Core.QuickCheck - ( modifyMaxSuccess ) + ( modifyMaxSuccess + ) import Test.QuickCheck ( Arbitrary (..) , Blind (..) @@ -105,7 +148,12 @@ import Test.QuickCheck , (===) ) import Test.QuickCheck.Classes - ( eqLaws, monoidLaws, ordLaws, semigroupLaws, semigroupMonoidLaws ) + ( eqLaws + , monoidLaws + , ordLaws + , semigroupLaws + , semigroupMonoidLaws + ) import Test.QuickCheck.Classes.Monoid.GCD ( gcdMonoidLaws , leftGCDMonoidLaws @@ -113,19 +161,28 @@ import Test.QuickCheck.Classes.Monoid.GCD , rightGCDMonoidLaws ) import Test.QuickCheck.Classes.Monoid.Monus - ( monusLaws ) + ( monusLaws + ) import Test.QuickCheck.Classes.Monoid.Null - ( monoidNullLaws ) + ( monoidNullLaws + ) import Test.QuickCheck.Classes.Semigroup.Cancellative - ( commutativeLaws, leftReductiveLaws, reductiveLaws, rightReductiveLaws ) + ( commutativeLaws + , leftReductiveLaws + , reductiveLaws + , rightReductiveLaws + ) import Test.QuickCheck.Instances.ByteString () import Test.Utils.Laws - ( testLawsMany ) + ( testLawsMany + ) import Test.Utils.Laws.PartialOrd - ( partialOrdLaws ) + ( partialOrdLaws + ) import Test.Utils.Paths - ( getTestData ) + ( getTestData + ) import qualified Cardano.Wallet.Primitive.Types.TokenMap as TokenMap import qualified Cardano.Wallet.Primitive.Types.TokenQuantity as TokenQuantity diff --git a/lib/primitive/test/spec/Cardano/Wallet/Primitive/Types/TokenPolicySpec.hs b/lib/primitive/test/spec/Cardano/Wallet/Primitive/Types/TokenPolicySpec.hs index 467c657e923..4ad42a95c88 100644 --- a/lib/primitive/test/spec/Cardano/Wallet/Primitive/Types/TokenPolicySpec.hs +++ b/lib/primitive/test/spec/Cardano/Wallet/Primitive/Types/TokenPolicySpec.hs @@ -6,7 +6,8 @@ module Cardano.Wallet.Primitive.Types.TokenPolicySpec import Prelude import Cardano.Wallet.Primitive.Types.Hash - ( Hash (..) ) + ( Hash (..) + ) import Cardano.Wallet.Primitive.Types.TokenPolicy ( TokenFingerprint (..) , TokenName (..) @@ -14,13 +15,21 @@ import Cardano.Wallet.Primitive.Types.TokenPolicy , mkTokenFingerprint ) import Cardano.Wallet.Unsafe - ( unsafeFromHex ) + ( unsafeFromHex + ) import Data.ByteString - ( ByteString ) + ( ByteString + ) import Data.Text - ( Text ) + ( Text + ) import Test.Hspec - ( Spec, SpecWith, describe, it, shouldBe ) + ( Spec + , SpecWith + , describe + , it + , shouldBe + ) import qualified Data.Text as T diff --git a/lib/primitive/test/spec/Cardano/Wallet/Primitive/Types/TokenQuantitySpec.hs b/lib/primitive/test/spec/Cardano/Wallet/Primitive/Types/TokenQuantitySpec.hs index e6d90b41ee3..56deb8b480b 100644 --- a/lib/primitive/test/spec/Cardano/Wallet/Primitive/Types/TokenQuantitySpec.hs +++ b/lib/primitive/test/spec/Cardano/Wallet/Primitive/Types/TokenQuantitySpec.hs @@ -13,30 +13,43 @@ module Cardano.Wallet.Primitive.Types.TokenQuantitySpec import Prelude import Cardano.Wallet.Primitive.Types.TokenQuantity - ( TokenQuantity (..) ) + ( TokenQuantity (..) + ) import Cardano.Wallet.Primitive.Types.TokenQuantity.Gen ( genTokenQuantityFullRange , genTokenQuantityPartition , shrinkTokenQuantityFullRange ) import Data.Aeson - ( FromJSON (..), ToJSON (..) ) + ( FromJSON (..) + , ToJSON (..) + ) import Data.Function - ( (&) ) + ( (&) + ) import Data.List.NonEmpty - ( NonEmpty ) + ( NonEmpty + ) import Data.Proxy - ( Proxy (..) ) + ( Proxy (..) + ) import Data.Text.Class - ( ToText (..) ) + ( ToText (..) + ) import Data.Typeable - ( Typeable ) + ( Typeable + ) import System.FilePath - ( () ) + ( () + ) import Test.Hspec - ( Spec, describe, it ) + ( Spec + , describe + , it + ) import Test.Hspec.Core.QuickCheck - ( modifyMaxSuccess ) + ( modifyMaxSuccess + ) import Test.QuickCheck ( Arbitrary (..) , Property @@ -56,13 +69,18 @@ import Test.QuickCheck.Classes , showReadLaws ) import Test.QuickCheck.Extra - ( genNonEmpty, shrinkNonEmpty ) + ( genNonEmpty + , shrinkNonEmpty + ) import Test.Text.Roundtrip - ( textRoundtrip ) + ( textRoundtrip + ) import Test.Utils.Laws - ( testLawsMany ) + ( testLawsMany + ) import Test.Utils.Paths - ( getTestData ) + ( getTestData + ) import qualified Cardano.Wallet.Primitive.Types.TokenQuantity as TokenQuantity import qualified Data.Char as Char diff --git a/lib/primitive/test/spec/Cardano/Wallet/Primitive/Types/TxSpec.hs b/lib/primitive/test/spec/Cardano/Wallet/Primitive/Types/TxSpec.hs index 8069d767601..b9600e08b0c 100644 --- a/lib/primitive/test/spec/Cardano/Wallet/Primitive/Types/TxSpec.hs +++ b/lib/primitive/test/spec/Cardano/Wallet/Primitive/Types/TxSpec.hs @@ -18,13 +18,19 @@ module Cardano.Wallet.Primitive.Types.TxSpec import Prelude import Cardano.Wallet.Primitive.Types.Hash - ( Hash (..) ) + ( Hash (..) + ) import Cardano.Wallet.Primitive.Types.TokenMap - ( AssetId (..) ) + ( AssetId (..) + ) import Cardano.Wallet.Primitive.Types.TokenMap.Gen - ( genAssetId, shrinkAssetId ) + ( genAssetId + , shrinkAssetId + ) import Cardano.Wallet.Primitive.Types.TokenPolicy - ( TokenName (..), TokenPolicyId (..) ) + ( TokenName (..) + , TokenPolicyId (..) + ) import Cardano.Wallet.Primitive.Types.Tx ( SealedTx (..) , Tx (..) @@ -36,23 +42,37 @@ import Cardano.Wallet.Primitive.Types.Tx , txRemoveAssetId ) import Cardano.Wallet.Primitive.Types.Tx.Gen - ( genTx, shrinkTx ) + ( genTx + , shrinkTx + ) import Cardano.Wallet.Primitive.Types.Tx.TxOut - ( TxOut (..) ) + ( TxOut (..) + ) import Cardano.Wallet.Primitive.Types.Tx.TxOut.Gen - ( genTxOut, shrinkTxOut ) + ( genTxOut + , shrinkTxOut + ) import Data.ByteString - ( ByteString, pack ) + ( ByteString + , pack + ) import Data.Either - ( isLeft ) + ( isLeft + ) import Data.Function - ( (&) ) + ( (&) + ) import Data.Maybe - ( listToMaybe ) + ( listToMaybe + ) import Test.Hspec - ( Spec, describe, it ) + ( Spec + , describe + , it + ) import Test.Hspec.QuickCheck - ( prop ) + ( prop + ) import Test.QuickCheck ( Arbitrary (..) , CoArbitrary (..) diff --git a/lib/primitive/test/spec/Cardano/Wallet/Primitive/Types/UTxOSpec.hs b/lib/primitive/test/spec/Cardano/Wallet/Primitive/Types/UTxOSpec.hs index 2dc8a2974d8..077a45a0f1a 100644 --- a/lib/primitive/test/spec/Cardano/Wallet/Primitive/Types/UTxOSpec.hs +++ b/lib/primitive/test/spec/Cardano/Wallet/Primitive/Types/UTxOSpec.hs @@ -16,23 +16,36 @@ module Cardano.Wallet.Primitive.Types.UTxOSpec import Prelude import Cardano.Wallet.Primitive.Types.Address - ( Address (..) ) + ( Address (..) + ) import Cardano.Wallet.Primitive.Types.Address.Gen - ( Parity (..), addressParity ) + ( Parity (..) + , addressParity + ) import Cardano.Wallet.Primitive.Types.Hash - ( Hash (..), mockHash ) + ( Hash (..) + , mockHash + ) import Cardano.Wallet.Primitive.Types.TokenMap - ( AssetId (..) ) + ( AssetId (..) + ) import Cardano.Wallet.Primitive.Types.TokenMap.Gen - ( genAssetId, shrinkAssetId ) + ( genAssetId + , shrinkAssetId + ) import Cardano.Wallet.Primitive.Types.TokenPolicy - ( TokenName (..), TokenPolicyId (..) ) + ( TokenName (..) + , TokenPolicyId (..) + ) import Cardano.Wallet.Primitive.Types.Tx.TxIn - ( TxIn (..) ) + ( TxIn (..) + ) import Cardano.Wallet.Primitive.Types.Tx.TxIn.Gen - ( coarbitraryTxIn ) + ( coarbitraryTxIn + ) import Cardano.Wallet.Primitive.Types.Tx.TxOut - ( TxOut (..) ) + ( TxOut (..) + ) import Cardano.Wallet.Primitive.Types.UTxO ( UTxO (..) , dom @@ -43,19 +56,29 @@ import Cardano.Wallet.Primitive.Types.UTxO , receiveD ) import Cardano.Wallet.Primitive.Types.UTxO.Gen - ( genUTxO, shrinkUTxO ) + ( genUTxO + , shrinkUTxO + ) import Data.Delta - ( apply ) + ( apply + ) import Data.Function - ( (&) ) + ( (&) + ) import Data.Functor.Identity - ( runIdentity ) + ( runIdentity + ) import Data.Generics.Internal.VL.Lens - ( view ) + ( view + ) import Data.Maybe - ( listToMaybe ) + ( listToMaybe + ) import Test.Hspec - ( Spec, describe, it ) + ( Spec + , describe + , it + ) import Test.QuickCheck ( Arbitrary (..) , CoArbitrary (..) diff --git a/lib/primitive/test/spec/Data/QuantitySpec.hs b/lib/primitive/test/spec/Data/QuantitySpec.hs index d2d430fbeeb..1df6170d0b7 100644 --- a/lib/primitive/test/spec/Data/QuantitySpec.hs +++ b/lib/primitive/test/spec/Data/QuantitySpec.hs @@ -11,13 +11,17 @@ module Data.QuantitySpec import Prelude import Cardano.Wallet.Unsafe - ( unsafeMkPercentage ) + ( unsafeMkPercentage + ) import Control.Monad - ( forM_ ) + ( forM_ + ) import Data.Either - ( isRight ) + ( isRight + ) import Data.Proxy - ( Proxy (..) ) + ( Proxy (..) + ) import Data.Quantity ( MkPercentageError (..) , Percentage (..) @@ -26,15 +30,31 @@ import Data.Quantity , percentageToDouble ) import Data.Ratio - ( (%) ) + ( (%) + ) import Data.Text.Class - ( FromText (..), TextDecodingError (..), ToText (..) ) + ( FromText (..) + , TextDecodingError (..) + , ToText (..) + ) import Test.Hspec - ( Spec, describe, it, shouldBe, shouldSatisfy ) + ( Spec + , describe + , it + , shouldBe + , shouldSatisfy + ) import Test.QuickCheck - ( Arbitrary (..), checkCoverage, choose, cover, property, (===) ) + ( Arbitrary (..) + , checkCoverage + , choose + , cover + , property + , (===) + ) import Test.Text.Roundtrip - ( textRoundtrip ) + ( textRoundtrip + ) import qualified Data.Aeson as Aeson import qualified Data.ByteString.Char8 as B8 diff --git a/lib/primitive/test/spec/run-test-suite.hs b/lib/primitive/test/spec/run-test-suite.hs index 349e4b80090..66edcab2e95 100644 --- a/lib/primitive/test/spec/run-test-suite.hs +++ b/lib/primitive/test/spec/run-test-suite.hs @@ -3,9 +3,11 @@ module Main where import Prelude import Main.Utf8 - ( withUtf8 ) + ( withUtf8 + ) import Test.Hspec.Extra - ( hspecMain ) + ( hspecMain + ) import qualified Spec diff --git a/lib/read/lib/Cardano/Wallet/Read/Eras.hs b/lib/read/lib/Cardano/Wallet/Read/Eras.hs index 3f8483fafd8..43c8dab492b 100644 --- a/lib/read/lib/Cardano/Wallet/Read/Eras.hs +++ b/lib/read/lib/Cardano/Wallet/Read/Eras.hs @@ -46,7 +46,11 @@ module Cardano.Wallet.Read.Eras where import Cardano.Wallet.Read.Eras.EraFun - ( EraFun (..), applyEraFun, (*&&&*), (*.**) ) + ( EraFun (..) + , applyEraFun + , (*&&&*) + , (*.**) + ) import Cardano.Wallet.Read.Eras.EraValue ( EraValue , MkEraValue (..) @@ -64,10 +68,17 @@ import Cardano.Wallet.Read.Eras.EraValue , shelley ) import Cardano.Wallet.Read.Eras.InAnyCardanoEra - ( isoInAnyCardanoEra ) + ( isoInAnyCardanoEra + ) import Cardano.Wallet.Read.Eras.KnownEras - ( KnownEras, knownEraIndices ) + ( KnownEras + , knownEraIndices + ) import Generics.SOP - ( (:.:) (..), K (..), unK ) + ( (:.:) (..) + , K (..) + , unK + ) import GHC.Generics - ( (:*:) (..) ) + ( (:*:) (..) + ) diff --git a/lib/read/lib/Cardano/Wallet/Read/Eras/EraFun.hs b/lib/read/lib/Cardano/Wallet/Read/Eras/EraFun.hs index d4a450c697b..d7fd50330d0 100644 --- a/lib/read/lib/Cardano/Wallet/Read/Eras/EraFun.hs +++ b/lib/read/lib/Cardano/Wallet/Read/Eras/EraFun.hs @@ -40,7 +40,9 @@ module Cardano.Wallet.Read.Eras.EraFun where import Prelude hiding - ( id, (.) ) + ( id + , (.) + ) import Cardano.Api ( AllegraEra @@ -52,11 +54,14 @@ import Cardano.Api , ShelleyEra ) import Cardano.Wallet.Read.Eras.EraValue - ( EraValue (..) ) + ( EraValue (..) + ) import Cardano.Wallet.Read.Eras.KnownEras - ( KnownEras ) + ( KnownEras + ) import Control.Category - ( Category (..) ) + ( Category (..) + ) import Generics.SOP ( (:.:) (..) , I (..) @@ -70,13 +75,20 @@ import Generics.SOP ) import Generics.SOP.Classes import Generics.SOP.NP - ( map_NP, pure_NP, trans_NP, zipWith_NP ) + ( map_NP + , pure_NP + , trans_NP + , zipWith_NP + ) import Generics.SOP.NS - ( ap_NS ) + ( ap_NS + ) import Generics.SOP.TH - ( deriveGeneric ) + ( deriveGeneric + ) import GHC.Generics - ( (:*:) (..) ) + ( (:*:) (..) + ) -- | A record of functions indexed by all known eras. This is the natural way -- of defining the vector. diff --git a/lib/read/lib/Cardano/Wallet/Read/Eras/EraValue.hs b/lib/read/lib/Cardano/Wallet/Read/Eras/EraValue.hs index 636a27b9fb1..3fb0f4ef56e 100644 --- a/lib/read/lib/Cardano/Wallet/Read/Eras/EraValue.hs +++ b/lib/read/lib/Cardano/Wallet/Read/Eras/EraValue.hs @@ -60,13 +60,20 @@ import Cardano.Api , ShelleyEra ) import Cardano.Wallet.Read.Eras.KnownEras - ( KnownEras ) + ( KnownEras + ) import Control.DeepSeq - ( NFData ) + ( NFData + ) import Data.Either.Extra - ( eitherToMaybe ) + ( eitherToMaybe + ) import Data.Generics.Internal.VL - ( Prism', build, match, prism ) + ( Prism' + , build + , match + , prism + ) import Generics.SOP ( (:.:) , All @@ -82,9 +89,16 @@ import Generics.SOP ) import Generics.SOP.Classes import Generics.SOP.NP - ( cmap_NP, pure_NP, zipWith_NP ) + ( cmap_NP + , pure_NP + , zipWith_NP + ) import Generics.SOP.NS - ( ap_NS, collapse_NS, index_NS, sequence'_NS ) + ( ap_NS + , collapse_NS + , index_NS + , sequence'_NS + ) import qualified GHC.Generics as GHC diff --git a/lib/read/lib/Cardano/Wallet/Read/Eras/InAnyCardanoEra.hs b/lib/read/lib/Cardano/Wallet/Read/Eras/InAnyCardanoEra.hs index 02fa1494f97..47b56a2ec95 100644 --- a/lib/read/lib/Cardano/Wallet/Read/Eras/InAnyCardanoEra.hs +++ b/lib/read/lib/Cardano/Wallet/Read/Eras/InAnyCardanoEra.hs @@ -17,7 +17,10 @@ module Cardano.Wallet.Read.Eras.InAnyCardanoEra import Prelude import Cardano.Api - ( CardanoEra (..), InAnyCardanoEra (InAnyCardanoEra), IsCardanoEra ) + ( CardanoEra (..) + , InAnyCardanoEra (InAnyCardanoEra) + , IsCardanoEra + ) import Cardano.Wallet.Read.Eras.EraValue ( EraValue (..) , MkEraValue (..) @@ -31,16 +34,26 @@ import Cardano.Wallet.Read.Eras.EraValue , shelley ) import Cardano.Wallet.Read.Eras.KnownEras - ( KnownEras ) + ( KnownEras + ) import Data.Generics.Internal.VL - ( Iso', build, iso ) + ( Iso' + , build + , iso + ) import Generics.SOP - ( K (..), NP, Proxy (Proxy) ) + ( K (..) + , NP + , Proxy (Proxy) + ) import Generics.SOP.Classes import Generics.SOP.NP - ( NP (..), cmap_NP ) + ( NP (..) + , cmap_NP + ) import Generics.SOP.NS - ( ap_NS ) + ( ap_NS + ) toInAnyCardanoEra :: EraValue f -> InAnyCardanoEra f toInAnyCardanoEra (EraValue f) = diff --git a/lib/read/lib/Cardano/Wallet/Read/Eras/KnownEras.hs b/lib/read/lib/Cardano/Wallet/Read/Eras/KnownEras.hs index f7ade62b109..d9582eb67aa 100644 --- a/lib/read/lib/Cardano/Wallet/Read/Eras/KnownEras.hs +++ b/lib/read/lib/Cardano/Wallet/Read/Eras/KnownEras.hs @@ -28,7 +28,9 @@ import Cardano.Api , ShelleyEra ) import Generics.SOP - ( Proxy (..), lengthSList ) + ( Proxy (..) + , lengthSList + ) -- | Known eras, for simplicity we reuse the types from 'Cardano.API'. type KnownEras = diff --git a/lib/read/lib/Cardano/Wallet/Read/Tx.hs b/lib/read/lib/Cardano/Wallet/Read/Tx.hs index f2d4183ff9b..64f03819526 100644 --- a/lib/read/lib/Cardano/Wallet/Read/Tx.hs +++ b/lib/read/lib/Cardano/Wallet/Read/Tx.hs @@ -31,11 +31,14 @@ import Cardano.Api , ShelleyEra ) import Cardano.Ledger.Alonzo.Tx - ( AlonzoTx ) + ( AlonzoTx + ) import Cardano.Ledger.Api - ( StandardCrypto ) + ( StandardCrypto + ) import Cardano.Ledger.Shelley.Tx - ( ShelleyTx ) + ( ShelleyTx + ) import qualified Cardano.Chain.UTxO as Byron import qualified Cardano.Ledger.Api as Ledger diff --git a/lib/read/lib/Cardano/Wallet/Read/Tx/CBOR.hs b/lib/read/lib/Cardano/Wallet/Read/Tx/CBOR.hs index 9f0095c9568..730eee42f7d 100644 --- a/lib/read/lib/Cardano/Wallet/Read/Tx/CBOR.hs +++ b/lib/read/lib/Cardano/Wallet/Read/Tx/CBOR.hs @@ -27,9 +27,11 @@ module Cardano.Wallet.Read.Tx.CBOR import Prelude import Cardano.Ledger.Api - ( eraProtVerLow ) + ( eraProtVerLow + ) import Cardano.Ledger.Binary - ( EncCBOR ) + ( EncCBOR + ) import Cardano.Ledger.Binary.Decoding ( DecCBOR (decCBOR) , DecoderError @@ -48,17 +50,25 @@ import Cardano.Wallet.Read.Eras , sequenceEraValue ) import Cardano.Wallet.Read.Tx - ( Tx (..), TxT ) + ( Tx (..) + , TxT + ) import Data.ByteArray.Encoding - ( Base (Base16), convertToBase ) + ( Base (Base16) + , convertToBase + ) import Data.ByteString.Lazy - ( toStrict ) + ( toStrict + ) import Data.Text.Class - ( ToText ) + ( ToText + ) import Data.Text.Encoding - ( decodeUtf8 ) + ( decodeUtf8 + ) import Fmt - ( Buildable (..) ) + ( Buildable (..) + ) import Ouroboros.Consensus.Shelley.Eras ( StandardAllegra , StandardAlonzo diff --git a/lib/read/lib/Cardano/Wallet/Read/Tx/Cardano.hs b/lib/read/lib/Cardano/Wallet/Read/Tx/Cardano.hs index 73795076ccd..64bfedbc1b0 100644 --- a/lib/read/lib/Cardano/Wallet/Read/Tx/Cardano.hs +++ b/lib/read/lib/Cardano/Wallet/Read/Tx/Cardano.hs @@ -24,9 +24,11 @@ import Cardano.Wallet.Read.Eras.EraValue , shelley ) import Cardano.Wallet.Read.Tx - ( Tx (..) ) + ( Tx (..) + ) import Control.Monad - ( void ) + ( void + ) import qualified Cardano.Api as Cardano import qualified Cardano.Api.Byron as Cardano diff --git a/lib/read/lib/Cardano/Wallet/Read/Tx/Certificates.hs b/lib/read/lib/Cardano/Wallet/Read/Tx/Certificates.hs index 06a7c2cd977..c387b1288df 100644 --- a/lib/read/lib/Cardano/Wallet/Read/Tx/Certificates.hs +++ b/lib/read/lib/Cardano/Wallet/Read/Tx/Certificates.hs @@ -32,25 +32,36 @@ import Cardano.Api , ShelleyEra ) import Cardano.Ledger.Conway.Core - ( conwayCertsTxBodyL ) + ( conwayCertsTxBodyL + ) import Cardano.Ledger.Conway.Delegation.Certificates - ( ConwayDCert ) + ( ConwayDCert + ) import Cardano.Ledger.Core - ( bodyTxL ) + ( bodyTxL + ) import Cardano.Ledger.Crypto - ( StandardCrypto ) + ( StandardCrypto + ) import Cardano.Ledger.Shelley.TxBody - ( DCert, certsTxBodyL ) + ( DCert + , certsTxBodyL + ) import Cardano.Wallet.Read.Eras.EraFun - ( EraFun (..) ) + ( EraFun (..) + ) import Cardano.Wallet.Read.Tx - ( Tx (..) ) + ( Tx (..) + ) import Cardano.Wallet.Read.Tx.Eras - ( onTx ) + ( onTx + ) import Control.Lens - ( view ) + ( view + ) import Data.Sequence.Strict - ( StrictSeq ) + ( StrictSeq + ) type family CertificatesType era where CertificatesType ByronEra = () diff --git a/lib/read/lib/Cardano/Wallet/Read/Tx/CollateralInputs.hs b/lib/read/lib/Cardano/Wallet/Read/Tx/CollateralInputs.hs index 4a6b089649a..f56988207c2 100644 --- a/lib/read/lib/Cardano/Wallet/Read/Tx/CollateralInputs.hs +++ b/lib/read/lib/Cardano/Wallet/Read/Tx/CollateralInputs.hs @@ -31,21 +31,29 @@ import Cardano.Api , ShelleyEra ) import Cardano.Ledger.Babbage.TxBody - ( collateralInputsTxBodyL ) + ( collateralInputsTxBodyL + ) import Cardano.Ledger.Core - ( bodyTxL ) + ( bodyTxL + ) import Cardano.Ledger.Crypto - ( StandardCrypto ) + ( StandardCrypto + ) import Cardano.Wallet.Read.Eras - ( EraFun (..) ) + ( EraFun (..) + ) import Cardano.Wallet.Read.Tx - ( Tx (..) ) + ( Tx (..) + ) import Cardano.Wallet.Read.Tx.Eras - ( onTx ) + ( onTx + ) import Control.Lens - ( (^.) ) + ( (^.) + ) import Data.Set - ( Set ) + ( Set + ) import qualified Cardano.Ledger.Shelley.API as SH diff --git a/lib/read/lib/Cardano/Wallet/Read/Tx/CollateralOutputs.hs b/lib/read/lib/Cardano/Wallet/Read/Tx/CollateralOutputs.hs index 5008a0b79de..ab0b898df81 100644 --- a/lib/read/lib/Cardano/Wallet/Read/Tx/CollateralOutputs.hs +++ b/lib/read/lib/Cardano/Wallet/Read/Tx/CollateralOutputs.hs @@ -37,21 +37,30 @@ import Cardano.Ledger.Babbage.Rules import Cardano.Ledger.Babbage.Tx () import Cardano.Ledger.Babbage.TxBody - ( BabbageTxOut (..), collateralReturnTxBodyL ) + ( BabbageTxOut (..) + , collateralReturnTxBodyL + ) import Cardano.Ledger.Core - ( bodyTxL ) + ( bodyTxL + ) import Cardano.Ledger.Crypto - ( StandardCrypto ) + ( StandardCrypto + ) import Cardano.Wallet.Read.Eras - ( EraFun (..) ) + ( EraFun (..) + ) import Cardano.Wallet.Read.Tx - ( Tx (..) ) + ( Tx (..) + ) import Cardano.Wallet.Read.Tx.Eras - ( onTx ) + ( onTx + ) import Control.Lens - ( (^.) ) + ( (^.) + ) import Data.Maybe.Strict - ( StrictMaybe ) + ( StrictMaybe + ) import qualified Cardano.Ledger.Babbage as BA import qualified Cardano.Ledger.Conway as Conway diff --git a/lib/read/lib/Cardano/Wallet/Read/Tx/Eras.hs b/lib/read/lib/Cardano/Wallet/Read/Tx/Eras.hs index 98bddaf84aa..ffc5a4cb026 100644 --- a/lib/read/lib/Cardano/Wallet/Read/Tx/Eras.hs +++ b/lib/read/lib/Cardano/Wallet/Read/Tx/Eras.hs @@ -11,7 +11,9 @@ module Cardano.Wallet.Read.Tx.Eras where import Cardano.Wallet.Read.Tx - ( Tx (..), TxT ) + ( Tx (..) + , TxT + ) -- | Act upon the 'TxT' type value of a 'Tx' onTx :: (TxT era -> t) -> Tx era -> t diff --git a/lib/read/lib/Cardano/Wallet/Read/Tx/ExtraSigs.hs b/lib/read/lib/Cardano/Wallet/Read/Tx/ExtraSigs.hs index 6378dfc39ca..81dd202f094 100644 --- a/lib/read/lib/Cardano/Wallet/Read/Tx/ExtraSigs.hs +++ b/lib/read/lib/Cardano/Wallet/Read/Tx/ExtraSigs.hs @@ -26,23 +26,33 @@ import Cardano.Api , ShelleyEra ) import Cardano.Ledger.Alonzo.TxBody - ( reqSignerHashesTxBodyL ) + ( reqSignerHashesTxBodyL + ) import Cardano.Ledger.Core - ( bodyTxL ) + ( bodyTxL + ) import Cardano.Ledger.Crypto - ( StandardCrypto ) + ( StandardCrypto + ) import Cardano.Ledger.Keys - ( KeyHash, KeyRole (..) ) + ( KeyHash + , KeyRole (..) + ) import Cardano.Wallet.Read.Eras - ( EraFun (..) ) + ( EraFun (..) + ) import Cardano.Wallet.Read.Tx - ( Tx (..) ) + ( Tx (..) + ) import Cardano.Wallet.Read.Tx.Eras - ( onTx ) + ( onTx + ) import Control.Lens - ( (^.) ) + ( (^.) + ) import Data.Set - ( Set ) + ( Set + ) type family ExtraSigsType era where ExtraSigsType ByronEra = () diff --git a/lib/read/lib/Cardano/Wallet/Read/Tx/Fee.hs b/lib/read/lib/Cardano/Wallet/Read/Tx/Fee.hs index c96f6f339a0..e3336863e10 100644 --- a/lib/read/lib/Cardano/Wallet/Read/Tx/Fee.hs +++ b/lib/read/lib/Cardano/Wallet/Read/Tx/Fee.hs @@ -31,17 +31,24 @@ import Cardano.Api , ShelleyEra ) import Cardano.Ledger.Coin - ( Coin ) + ( Coin + ) import Cardano.Ledger.Core - ( bodyTxL, feeTxBodyL ) + ( bodyTxL + , feeTxBodyL + ) import Cardano.Wallet.Read.Eras - ( EraFun (..) ) + ( EraFun (..) + ) import Cardano.Wallet.Read.Tx - ( Tx (..) ) + ( Tx (..) + ) import Cardano.Wallet.Read.Tx.Eras - ( onTx ) + ( onTx + ) import Control.Lens - ( (^.) ) + ( (^.) + ) type family FeeType era where FeeType ByronEra = () diff --git a/lib/read/lib/Cardano/Wallet/Read/Tx/Hash.hs b/lib/read/lib/Cardano/Wallet/Read/Tx/Hash.hs index 229d5090e5c..20d813ffb3e 100644 --- a/lib/read/lib/Cardano/Wallet/Read/Tx/Hash.hs +++ b/lib/read/lib/Cardano/Wallet/Read/Tx/Hash.hs @@ -23,23 +23,34 @@ module Cardano.Wallet.Read.Tx.Hash import Prelude import Cardano.Chain.UTxO - ( ATxAux, taTx ) + ( ATxAux + , taTx + ) import Cardano.Crypto - ( serializeCborHash ) + ( serializeCborHash + ) import Cardano.Ledger.Block - ( txid ) + ( txid + ) import Cardano.Ledger.Core - ( bodyTxL ) + ( bodyTxL + ) import Cardano.Ledger.TxIn - ( TxId (..) ) + ( TxId (..) + ) import Cardano.Wallet.Read - ( Tx ) + ( Tx + ) import Cardano.Wallet.Read.Eras - ( EraFun (..), K (..) ) + ( EraFun (..) + , K (..) + ) import Cardano.Wallet.Read.Tx.Eras - ( onTx ) + ( onTx + ) import Control.Lens - ( (^.) ) + ( (^.) + ) import qualified Cardano.Crypto as CryptoC import qualified Cardano.Crypto.Hash as Crypto diff --git a/lib/read/lib/Cardano/Wallet/Read/Tx/Inputs.hs b/lib/read/lib/Cardano/Wallet/Read/Tx/Inputs.hs index da989bd03d7..5ae48967abf 100644 --- a/lib/read/lib/Cardano/Wallet/Read/Tx/Inputs.hs +++ b/lib/read/lib/Cardano/Wallet/Read/Tx/Inputs.hs @@ -31,21 +31,30 @@ import Cardano.Api , ShelleyEra ) import Cardano.Ledger.Core - ( bodyTxL, inputsTxBodyL ) + ( bodyTxL + , inputsTxBodyL + ) import Cardano.Ledger.Crypto - ( StandardCrypto ) + ( StandardCrypto + ) import Cardano.Wallet.Read.Eras - ( EraFun (..) ) + ( EraFun (..) + ) import Cardano.Wallet.Read.Tx - ( Tx (..) ) + ( Tx (..) + ) import Cardano.Wallet.Read.Tx.Eras - ( onTx ) + ( onTx + ) import Control.Lens - ( (^.) ) + ( (^.) + ) import Data.List.NonEmpty - ( NonEmpty ) + ( NonEmpty + ) import Data.Set - ( Set ) + ( Set + ) import qualified Cardano.Chain.UTxO as BY import qualified Cardano.Ledger.Shelley.API as SH diff --git a/lib/read/lib/Cardano/Wallet/Read/Tx/Integrity.hs b/lib/read/lib/Cardano/Wallet/Read/Tx/Integrity.hs index 8a4cbe5f078..eca2765b7bf 100644 --- a/lib/read/lib/Cardano/Wallet/Read/Tx/Integrity.hs +++ b/lib/read/lib/Cardano/Wallet/Read/Tx/Integrity.hs @@ -28,23 +28,32 @@ import Cardano.Api , ShelleyEra ) import Cardano.Ledger.Alonzo.Tx - ( ScriptIntegrityHash ) + ( ScriptIntegrityHash + ) import Cardano.Ledger.Alonzo.TxBody - ( scriptIntegrityHashTxBodyL ) + ( scriptIntegrityHashTxBodyL + ) import Cardano.Ledger.Core - ( bodyTxL ) + ( bodyTxL + ) import Cardano.Ledger.Crypto - ( StandardCrypto ) + ( StandardCrypto + ) import Cardano.Wallet.Read.Eras - ( EraFun (..) ) + ( EraFun (..) + ) import Cardano.Wallet.Read.Tx - ( Tx (..) ) + ( Tx (..) + ) import Cardano.Wallet.Read.Tx.Eras - ( onTx ) + ( onTx + ) import Control.Lens - ( (^.) ) + ( (^.) + ) import Data.Maybe.Strict - ( StrictMaybe ) + ( StrictMaybe + ) type family IntegrityType era where IntegrityType ByronEra = () diff --git a/lib/read/lib/Cardano/Wallet/Read/Tx/Metadata.hs b/lib/read/lib/Cardano/Wallet/Read/Tx/Metadata.hs index 0c451ae3b97..3538477e429 100644 --- a/lib/read/lib/Cardano/Wallet/Read/Tx/Metadata.hs +++ b/lib/read/lib/Cardano/Wallet/Read/Tx/Metadata.hs @@ -30,23 +30,32 @@ import Cardano.Api , ShelleyEra ) import Cardano.Ledger.Allegra.TxAuxData - ( AllegraTxAuxData ) + ( AllegraTxAuxData + ) import Cardano.Ledger.Alonzo.TxAuxData - ( AlonzoTxAuxData ) + ( AlonzoTxAuxData + ) import Cardano.Ledger.Core - ( auxDataTxL ) + ( auxDataTxL + ) import Cardano.Ledger.Shelley.TxAuxData - ( ShelleyTxAuxData ) + ( ShelleyTxAuxData + ) import Cardano.Wallet.Read.Eras.EraFun - ( EraFun (..) ) + ( EraFun (..) + ) import Cardano.Wallet.Read.Tx - ( Tx (..) ) + ( Tx (..) + ) import Cardano.Wallet.Read.Tx.Eras - ( onTx ) + ( onTx + ) import Control.Lens - ( view ) + ( view + ) import Data.Maybe.Strict - ( StrictMaybe ) + ( StrictMaybe + ) import Ouroboros.Consensus.Shelley.Eras ( StandardAllegra , StandardAlonzo diff --git a/lib/read/lib/Cardano/Wallet/Read/Tx/Mint.hs b/lib/read/lib/Cardano/Wallet/Read/Tx/Mint.hs index 87616d32e92..fb3ac47bf20 100644 --- a/lib/read/lib/Cardano/Wallet/Read/Tx/Mint.hs +++ b/lib/read/lib/Cardano/Wallet/Read/Tx/Mint.hs @@ -32,21 +32,29 @@ import Cardano.Api , ShelleyEra ) import Cardano.Ledger.Core - ( bodyTxL ) + ( bodyTxL + ) import Cardano.Ledger.Crypto - ( StandardCrypto ) + ( StandardCrypto + ) import Cardano.Ledger.Mary.Core - ( mintTxBodyL ) + ( mintTxBodyL + ) import Cardano.Ledger.Mary.Value - ( MultiAsset ) + ( MultiAsset + ) import Cardano.Wallet.Read.Eras.EraFun - ( EraFun (..) ) + ( EraFun (..) + ) import Cardano.Wallet.Read.Tx - ( Tx (..) ) + ( Tx (..) + ) import Cardano.Wallet.Read.Tx.Eras - ( onTx ) + ( onTx + ) import Control.Lens - ( view ) + ( view + ) type family MintType era where MintType ByronEra = () diff --git a/lib/read/lib/Cardano/Wallet/Read/Tx/Outputs.hs b/lib/read/lib/Cardano/Wallet/Read/Tx/Outputs.hs index 9a7bbb0490f..be476a52cd8 100644 --- a/lib/read/lib/Cardano/Wallet/Read/Tx/Outputs.hs +++ b/lib/read/lib/Cardano/Wallet/Read/Tx/Outputs.hs @@ -31,25 +31,36 @@ import Cardano.Api , ShelleyEra ) import Cardano.Ledger.Alonzo.TxOut - ( AlonzoTxOut ) + ( AlonzoTxOut + ) import Cardano.Ledger.Babbage.TxOut - ( BabbageTxOut ) + ( BabbageTxOut + ) import Cardano.Ledger.Core - ( bodyTxL, outputsTxBodyL ) + ( bodyTxL + , outputsTxBodyL + ) import Cardano.Ledger.Shelley.TxOut - ( ShelleyTxOut ) + ( ShelleyTxOut + ) import Cardano.Wallet.Read.Eras.EraFun - ( EraFun (..) ) + ( EraFun (..) + ) import Cardano.Wallet.Read.Tx - ( Tx (..) ) + ( Tx (..) + ) import Cardano.Wallet.Read.Tx.Eras - ( onTx ) + ( onTx + ) import Control.Lens - ( view ) + ( view + ) import Data.List.NonEmpty - ( NonEmpty ) + ( NonEmpty + ) import Data.Sequence.Strict - ( StrictSeq ) + ( StrictSeq + ) import Ouroboros.Consensus.Cardano.Block ( StandardAllegra , StandardAlonzo diff --git a/lib/read/lib/Cardano/Wallet/Read/Tx/ReferenceInputs.hs b/lib/read/lib/Cardano/Wallet/Read/Tx/ReferenceInputs.hs index 7fff4f898fb..29b35c7d198 100644 --- a/lib/read/lib/Cardano/Wallet/Read/Tx/ReferenceInputs.hs +++ b/lib/read/lib/Cardano/Wallet/Read/Tx/ReferenceInputs.hs @@ -31,21 +31,29 @@ import Cardano.Api , ShelleyEra ) import Cardano.Ledger.Babbage.TxBody - ( referenceInputsTxBodyL ) + ( referenceInputsTxBodyL + ) import Cardano.Ledger.Core - ( bodyTxL ) + ( bodyTxL + ) import Cardano.Ledger.Crypto - ( StandardCrypto ) + ( StandardCrypto + ) import Cardano.Wallet.Read.Eras - ( EraFun (..) ) + ( EraFun (..) + ) import Cardano.Wallet.Read.Tx - ( Tx (..) ) + ( Tx (..) + ) import Cardano.Wallet.Read.Tx.Eras - ( onTx ) + ( onTx + ) import Control.Lens - ( (^.) ) + ( (^.) + ) import Data.Set - ( Set ) + ( Set + ) import qualified Cardano.Ledger.Shelley.API as SH diff --git a/lib/read/lib/Cardano/Wallet/Read/Tx/ScriptValidity.hs b/lib/read/lib/Cardano/Wallet/Read/Tx/ScriptValidity.hs index ca6562a52a8..f846dec8cf5 100644 --- a/lib/read/lib/Cardano/Wallet/Read/Tx/ScriptValidity.hs +++ b/lib/read/lib/Cardano/Wallet/Read/Tx/ScriptValidity.hs @@ -30,15 +30,21 @@ import Cardano.Api , ShelleyEra ) import Cardano.Ledger.Alonzo.Tx - ( IsValid, isValidTxL ) + ( IsValid + , isValidTxL + ) import Cardano.Wallet.Read.Eras - ( EraFun (..) ) + ( EraFun (..) + ) import Cardano.Wallet.Read.Tx - ( Tx (..) ) + ( Tx (..) + ) import Cardano.Wallet.Read.Tx.Eras - ( onTx ) + ( onTx + ) import Control.Lens - ( (^.) ) + ( (^.) + ) type family ScriptValidityType era where ScriptValidityType ByronEra = () diff --git a/lib/read/lib/Cardano/Wallet/Read/Tx/Validity.hs b/lib/read/lib/Cardano/Wallet/Read/Tx/Validity.hs index a51c0449eef..5579fe3a3f2 100644 --- a/lib/read/lib/Cardano/Wallet/Read/Tx/Validity.hs +++ b/lib/read/lib/Cardano/Wallet/Read/Tx/Validity.hs @@ -31,23 +31,32 @@ import Cardano.Api , ShelleyEra ) import Cardano.Ledger.Allegra.Scripts - ( ValidityInterval ) + ( ValidityInterval + ) import Cardano.Ledger.Allegra.TxBody - ( vldtTxBodyL ) + ( vldtTxBodyL + ) import Cardano.Ledger.Core - ( bodyTxL ) + ( bodyTxL + ) import Cardano.Ledger.Shelley.TxBody - ( ttlTxBodyL ) + ( ttlTxBodyL + ) import Cardano.Ledger.Slot - ( SlotNo ) + ( SlotNo + ) import Cardano.Wallet.Read.Eras - ( EraFun (..) ) + ( EraFun (..) + ) import Cardano.Wallet.Read.Tx - ( Tx (..) ) + ( Tx (..) + ) import Cardano.Wallet.Read.Tx.Eras - ( onTx ) + ( onTx + ) import Control.Lens - ( (^.) ) + ( (^.) + ) type family ValidityType era where ValidityType ByronEra = () diff --git a/lib/read/lib/Cardano/Wallet/Read/Tx/Withdrawals.hs b/lib/read/lib/Cardano/Wallet/Read/Tx/Withdrawals.hs index e8b92771ecf..af4697d6042 100644 --- a/lib/read/lib/Cardano/Wallet/Read/Tx/Withdrawals.hs +++ b/lib/read/lib/Cardano/Wallet/Read/Tx/Withdrawals.hs @@ -32,23 +32,34 @@ import Cardano.Api , ShelleyEra ) import Cardano.Ledger.Address - ( RewardAcnt, unWithdrawals ) + ( RewardAcnt + , unWithdrawals + ) import Cardano.Ledger.Coin - ( Coin ) + ( Coin + ) import Cardano.Ledger.Core - ( bodyTxL, withdrawalsTxBodyL ) + ( bodyTxL + , withdrawalsTxBodyL + ) import Cardano.Ledger.Crypto - ( StandardCrypto ) + ( StandardCrypto + ) import Cardano.Wallet.Read.Eras.EraFun - ( EraFun (..) ) + ( EraFun (..) + ) import Cardano.Wallet.Read.Tx - ( Tx (..) ) + ( Tx (..) + ) import Cardano.Wallet.Read.Tx.Eras - ( onTx ) + ( onTx + ) import Control.Lens - ( view ) + ( view + ) import Data.Map - ( Map ) + ( Map + ) import qualified Cardano.Ledger.Api as Ledger diff --git a/lib/read/lib/Cardano/Wallet/Read/Tx/Witnesses.hs b/lib/read/lib/Cardano/Wallet/Read/Tx/Witnesses.hs index 7e7200c8919..aae1cda854a 100644 --- a/lib/read/lib/Cardano/Wallet/Read/Tx/Witnesses.hs +++ b/lib/read/lib/Cardano/Wallet/Read/Tx/Witnesses.hs @@ -30,19 +30,26 @@ import Cardano.Api , ShelleyEra ) import Cardano.Ledger.Alonzo.TxWits - ( AlonzoTxWits ) + ( AlonzoTxWits + ) import Cardano.Ledger.Core - ( witsTxL ) + ( witsTxL + ) import Cardano.Ledger.Shelley.TxWits - ( ShelleyTxWits ) + ( ShelleyTxWits + ) import Cardano.Wallet.Read.Eras.EraFun - ( EraFun (..) ) + ( EraFun (..) + ) import Cardano.Wallet.Read.Tx - ( Tx (..) ) + ( Tx (..) + ) import Cardano.Wallet.Read.Tx.Eras - ( onTx ) + ( onTx + ) import Control.Lens - ( view ) + ( view + ) import Ouroboros.Consensus.Shelley.Eras ( StandardAllegra , StandardAlonzo diff --git a/lib/read/test/Cardano/Wallet/Read/Tx/CBORSpec.hs b/lib/read/test/Cardano/Wallet/Read/Tx/CBORSpec.hs index 382d219cda9..884533053bf 100644 --- a/lib/read/test/Cardano/Wallet/Read/Tx/CBORSpec.hs +++ b/lib/read/test/Cardano/Wallet/Read/Tx/CBORSpec.hs @@ -8,17 +8,31 @@ module Cardano.Wallet.Read.Tx.CBORSpec import Prelude import Cardano.Wallet.Read.Tx.CBOR - ( TxCBOR, parseTxFromCBOR, serializeTx ) + ( TxCBOR + , parseTxFromCBOR + , serializeTx + ) import Data.ByteArray.Encoding - ( Base (..), convertFromBase ) + ( Base (..) + , convertFromBase + ) import Data.ByteString - ( ByteString ) + ( ByteString + ) import Data.ByteString.Lazy - ( fromStrict ) + ( fromStrict + ) import Test.Hspec - ( Spec, describe, it, pendingWith ) + ( Spec + , describe + , it + , pendingWith + ) import Test.QuickCheck - ( Property, property, (===) ) + ( Property + , property + , (===) + ) import Cardano.Wallet.Read.Eras ( EraValue diff --git a/lib/read/test/main.hs b/lib/read/test/main.hs index 349e4b80090..66edcab2e95 100644 --- a/lib/read/test/main.hs +++ b/lib/read/test/main.hs @@ -3,9 +3,11 @@ module Main where import Prelude import Main.Utf8 - ( withUtf8 ) + ( withUtf8 + ) import Test.Hspec.Extra - ( hspecMain ) + ( hspecMain + ) import qualified Spec diff --git a/lib/std-gen-seed/src/System/Random/StdGenSeed.hs b/lib/std-gen-seed/src/System/Random/StdGenSeed.hs index 9d8d80b5b39..28306e4bb9c 100644 --- a/lib/std-gen-seed/src/System/Random/StdGenSeed.hs +++ b/lib/std-gen-seed/src/System/Random/StdGenSeed.hs @@ -23,21 +23,31 @@ module System.Random.StdGenSeed import Prelude import Control.Monad.Random.Class - ( MonadRandom (..) ) + ( MonadRandom (..) + ) import Data.Bits - ( (.|.) ) + ( (.|.) + ) import Data.Word - ( Word64 ) + ( Word64 + ) import Data.Word.Odd - ( Lit, OddWord ) + ( Lit + , OddWord + ) import GHC.Generics - ( Generic ) + ( Generic + ) import Quiet - ( Quiet (..) ) + ( Quiet (..) + ) import System.Random.Internal - ( StdGen (..) ) + ( StdGen (..) + ) import System.Random.SplitMix - ( seedSMGen', unseedSMGen ) + ( seedSMGen' + , unseedSMGen + ) import qualified Data.Bits as Bits diff --git a/lib/std-gen-seed/test/unit/System/Random/StdGenSeedSpec.hs b/lib/std-gen-seed/test/unit/System/Random/StdGenSeedSpec.hs index bd7823cca2b..54700f83d3c 100644 --- a/lib/std-gen-seed/test/unit/System/Random/StdGenSeedSpec.hs +++ b/lib/std-gen-seed/test/unit/System/Random/StdGenSeedSpec.hs @@ -8,11 +8,18 @@ module System.Random.StdGenSeedSpec import Prelude import System.Random - ( mkStdGen ) + ( mkStdGen + ) import System.Random.StdGenSeed - ( StdGenSeed (..), stdGenFromSeed, stdGenToSeed ) + ( StdGenSeed (..) + , stdGenFromSeed + , stdGenToSeed + ) import Test.Hspec - ( Spec, describe, it ) + ( Spec + , describe + , it + ) import Test.QuickCheck ( Arbitrary (..) , Gen diff --git a/lib/temporary-extra/src/System/IO/Temp/Extra.hs b/lib/temporary-extra/src/System/IO/Temp/Extra.hs index 50ee312cc83..af223cf4258 100644 --- a/lib/temporary-extra/src/System/IO/Temp/Extra.hs +++ b/lib/temporary-extra/src/System/IO/Temp/Extra.hs @@ -15,22 +15,33 @@ import qualified Data.Text as T import Prelude import Cardano.BM.Extra - ( BracketLog, BracketLog' (BracketStart), bracketTracer ) + ( BracketLog + , BracketLog' (BracketStart) + , bracketTracer + ) import Cardano.BM.Tracer - ( Tracer ) + ( Tracer + ) import Cardano.BM.Tracing ( HasPrivacyAnnotation , HasSeverityAnnotation (..) , Severity (Debug, Notice) ) import Data.Functor.Contravariant - ( (>$<) ) + ( (>$<) + ) import Data.Text.Class - ( ToText (..) ) + ( ToText (..) + ) import System.IO.Temp - ( createTempDirectory, getCanonicalTemporaryDirectory ) + ( createTempDirectory + , getCanonicalTemporaryDirectory + ) import UnliftIO - ( MonadIO (liftIO), MonadUnliftIO, withTempDirectory ) + ( MonadIO (liftIO) + , MonadUnliftIO + , withTempDirectory + ) newtype SkipCleanup = SkipCleanup Bool deriving stock (Show, Eq) diff --git a/lib/test-utils/src/Test/Hspec/Extra.hs b/lib/test-utils/src/Test/Hspec/Extra.hs index 132d455c0d6..83174632306 100644 --- a/lib/test-utils/src/Test/Hspec/Extra.hs +++ b/lib/test-utils/src/Test/Hspec/Extra.hs @@ -33,13 +33,18 @@ module Test.Hspec.Extra import Prelude import Control.Monad - ( void, (<=<) ) + ( void + , (<=<) + ) import Control.Monad.IO.Class - ( MonadIO ) + ( MonadIO + ) import Control.Monad.IO.Unlift - ( MonadUnliftIO ) + ( MonadUnliftIO + ) import Data.List - ( elemIndex ) + ( elemIndex + ) -- See ADP-1910 import "optparse-applicative" Options.Applicative ( Parser @@ -59,9 +64,12 @@ import "optparse-applicative" Options.Applicative , strArgument ) import Say - ( sayString ) + ( sayString + ) import System.Environment - ( lookupEnv, withArgs ) + ( lookupEnv + , withArgs + ) import Test.Hspec ( ActionWith , HasCallStack @@ -73,7 +81,12 @@ import Test.Hspec , specify ) import Test.Hspec.Core.Runner - ( Config (..), Summary, defaultConfig, evaluateSummary, hspecWithResult ) + ( Config (..) + , Summary + , defaultConfig + , evaluateSummary + , hspecWithResult + ) import Test.HUnit.Lang ( FailureReason (..) , HUnitFailure (..) @@ -81,21 +94,32 @@ import Test.HUnit.Lang , formatFailureReason ) import Test.Utils.Env - ( withAddedEnv ) + ( withAddedEnv + ) import Test.Utils.Platform - ( isWindows ) + ( isWindows + ) import Test.Utils.Resource - ( unBracket ) + ( unBracket + ) import Test.Utils.Startup - ( withLineBuffering ) + ( withLineBuffering + ) import UnliftIO.Async - ( race ) + ( race + ) import UnliftIO.Concurrent - ( threadDelay ) + ( threadDelay + ) import UnliftIO.Exception - ( catch, throwIO ) + ( catch + , throwIO + ) import UnliftIO.MVar - ( newEmptyMVar, tryPutMVar, tryTakeMVar ) + ( newEmptyMVar + , tryPutMVar + , tryTakeMVar + ) import qualified Test.Hspec as Hspec diff --git a/lib/test-utils/src/Test/Hspec/Goldens.hs b/lib/test-utils/src/Test/Hspec/Goldens.hs index 5376fa4941a..52a57c58ff8 100644 --- a/lib/test-utils/src/Test/Hspec/Goldens.hs +++ b/lib/test-utils/src/Test/Hspec/Goldens.hs @@ -26,23 +26,43 @@ module Test.Hspec.Goldens import Prelude import Data.Either.Combinators - ( rightToMaybe ) + ( rightToMaybe + ) import Data.Text - ( Text ) + ( Text + ) import Fmt - ( Builder, fmt, (+|), (+||), (|+), (||+) ) + ( Builder + , fmt + , (+|) + , (+||) + , (|+) + , (||+) + ) import System.Environment - ( lookupEnv ) + ( lookupEnv + ) import System.FilePath - ( (<.>), () ) + ( (<.>) + , () + ) import System.IO.Error - ( ioeGetErrorType, isDoesNotExistErrorType ) + ( ioeGetErrorType + , isDoesNotExistErrorType + ) import Test.Hspec - ( Expectation, expectationFailure, shouldBe ) + ( Expectation + , expectationFailure + , shouldBe + ) import Test.Utils.Platform - ( isWindows ) + ( isWindows + ) import UnliftIO.Exception - ( IOException, try, tryJust ) + ( IOException + , try + , tryJust + ) import qualified Data.Text as T import qualified Data.Text.IO as TIO diff --git a/lib/test-utils/src/Test/QuickCheck/Extra.hs b/lib/test-utils/src/Test/QuickCheck/Extra.hs index 4421a02e34f..021dd9f995a 100644 --- a/lib/test-utils/src/Test/QuickCheck/Extra.hs +++ b/lib/test-utils/src/Test/QuickCheck/Extra.hs @@ -89,24 +89,41 @@ module Test.QuickCheck.Extra import Prelude import Control.Monad - ( foldM, liftM2 ) + ( foldM + , liftM2 + ) import Data.IntCast - ( intCast, intCastMaybe ) + ( intCast + , intCastMaybe + ) import Data.List.NonEmpty - ( NonEmpty (..) ) + ( NonEmpty (..) + ) import Data.Map.Strict - ( Map ) + ( Map + ) import Data.Maybe - ( listToMaybe, mapMaybe ) + ( listToMaybe + , mapMaybe + ) import Data.Set - ( Set ) + ( Set + ) import Fmt - ( indentF, (+|), (|+) ) + ( indentF + , (+|) + , (|+) + ) import Generics.SOP import GHC.TypeNats - ( type (<=), KnownNat, Nat, natVal ) + ( type (<=) + , KnownNat + , Nat + , natVal + ) import Numeric.Natural - ( Natural ) + ( Natural + ) import Test.QuickCheck ( Arbitrary (..) , Gen @@ -130,15 +147,20 @@ import Test.QuickCheck , (.&&.) ) import Test.QuickCheck.Gen - ( Gen (MkGen) ) + ( Gen (MkGen) + ) import Test.QuickCheck.Gen.Unsafe - ( promote ) + ( promote + ) import Test.QuickCheck.Random - ( mkQCGen ) + ( mkQCGen + ) import Test.Utils.Pretty - ( pShowBuilder ) + ( pShowBuilder + ) import Text.Pretty.Simple - ( pShow ) + ( pShow + ) import qualified Data.List as L import qualified Data.List.NonEmpty as NE diff --git a/lib/test-utils/src/Test/Utils/Env.hs b/lib/test-utils/src/Test/Utils/Env.hs index 4dbce544636..8d4bc661025 100644 --- a/lib/test-utils/src/Test/Utils/Env.hs +++ b/lib/test-utils/src/Test/Utils/Env.hs @@ -11,11 +11,17 @@ module Test.Utils.Env import Prelude import Control.Monad.IO.Unlift - ( MonadIO, MonadUnliftIO (..) ) + ( MonadIO + , MonadUnliftIO (..) + ) import UnliftIO.Environment - ( getEnvironment, setEnv, unsetEnv ) + ( getEnvironment + , setEnv + , unsetEnv + ) import UnliftIO.Exception - ( bracket ) + ( bracket + ) -- | Runs an IO action with exactly the given environment variables. -- After the action finishes, the original environment variables are restored. diff --git a/lib/test-utils/src/Test/Utils/FilePath.hs b/lib/test-utils/src/Test/Utils/FilePath.hs index 6c983f7ea13..760b6f8781f 100644 --- a/lib/test-utils/src/Test/Utils/FilePath.hs +++ b/lib/test-utils/src/Test/Utils/FilePath.hs @@ -11,11 +11,17 @@ module Test.Utils.FilePath import Prelude import System.FilePath.Windows - ( makeValid ) + ( makeValid + ) import Test.QuickCheck - ( Arbitrary (..), elements, listOf1, scale ) + ( Arbitrary (..) + , elements + , listOf1 + , scale + ) import Test.Utils.Platform - ( isWindows ) + ( isWindows + ) -- | A file or directory name. The 'Arbitrary' instance will generate values -- which are valid on Windows and POSIX. diff --git a/lib/test-utils/src/Test/Utils/Laws.hs b/lib/test-utils/src/Test/Utils/Laws.hs index 6ff28205a0c..47db8eb96a2 100644 --- a/lib/test-utils/src/Test/Utils/Laws.hs +++ b/lib/test-utils/src/Test/Utils/Laws.hs @@ -16,15 +16,24 @@ module Test.Utils.Laws import Prelude import Control.Monad - ( forM_ ) + ( forM_ + ) import Data.Proxy - ( Proxy (..) ) + ( Proxy (..) + ) import Data.Typeable - ( Typeable, typeRep ) + ( Typeable + , typeRep + ) import Test.Hspec - ( Spec, describe, it, parallel ) + ( Spec + , describe + , it + , parallel + ) import Test.QuickCheck.Classes - ( Laws (..) ) + ( Laws (..) + ) -- | Constructs a test to check that the given type class instance obeys the -- given set of laws. diff --git a/lib/test-utils/src/Test/Utils/Laws/PartialOrd.hs b/lib/test-utils/src/Test/Utils/Laws/PartialOrd.hs index e529bd4dbab..a2dc144a274 100644 --- a/lib/test-utils/src/Test/Utils/Laws/PartialOrd.hs +++ b/lib/test-utils/src/Test/Utils/Laws/PartialOrd.hs @@ -13,13 +13,19 @@ module Test.Utils.Laws.PartialOrd import Prelude import Algebra.PartialOrd - ( PartialOrd (..) ) + ( PartialOrd (..) + ) import Data.Proxy - ( Proxy ) + ( Proxy + ) import Test.QuickCheck - ( Arbitrary, Property, property ) + ( Arbitrary + , Property + , property + ) import Test.QuickCheck.Classes - ( Laws (..) ) + ( Laws (..) + ) partialOrdLaws :: (PartialOrd a, Arbitrary a, Show a) => Proxy a -> Laws partialOrdLaws p = Laws "PartialOrd" diff --git a/lib/test-utils/src/Test/Utils/Paths.hs b/lib/test-utils/src/Test/Utils/Paths.hs index 4f030d21638..ffbc3a322ee 100644 --- a/lib/test-utils/src/Test/Utils/Paths.hs +++ b/lib/test-utils/src/Test/Utils/Paths.hs @@ -13,15 +13,22 @@ module Test.Utils.Paths import Prelude import Control.Monad.IO.Class - ( liftIO ) + ( liftIO + ) import Data.FileEmbed - ( makeRelativeToProject ) + ( makeRelativeToProject + ) import Language.Haskell.TH.Syntax - ( Exp, Q, liftData ) + ( Exp + , Q + , liftData + ) import System.Environment - ( lookupEnv ) + ( lookupEnv + ) import System.FilePath - ( () ) + ( () + ) -- | A TH function to get the test data directory. -- diff --git a/lib/test-utils/src/Test/Utils/Platform.hs b/lib/test-utils/src/Test/Utils/Platform.hs index 869b0f5a224..ef245109696 100644 --- a/lib/test-utils/src/Test/Utils/Platform.hs +++ b/lib/test-utils/src/Test/Utils/Platform.hs @@ -28,19 +28,30 @@ module Test.Utils.Platform import Prelude import Control.Monad - ( when ) + ( when + ) import System.Exit - ( ExitCode (..) ) + ( ExitCode (..) + ) import System.Info - ( os ) + ( os + ) import Test.Hspec.Core.Spec - ( ResultStatus (..), pendingWith ) + ( ResultStatus (..) + , pendingWith + ) import Test.Hspec.Expectations - ( Expectation, HasCallStack ) + ( Expectation + , HasCallStack + ) import UnliftIO.Exception - ( IOException, handle, throwIO ) + ( IOException + , handle + , throwIO + ) import UnliftIO.Process - ( readProcessWithExitCode ) + ( readProcessWithExitCode + ) skipOnWindows :: HasCallStack => String -> Expectation skipOnWindows _reason = whenWindows $ throwIO Success diff --git a/lib/test-utils/src/Test/Utils/Pretty.hs b/lib/test-utils/src/Test/Utils/Pretty.hs index c444916a862..c25bd0f8da1 100644 --- a/lib/test-utils/src/Test/Utils/Pretty.hs +++ b/lib/test-utils/src/Test/Utils/Pretty.hs @@ -9,15 +9,23 @@ module Test.Utils.Pretty import Prelude import Data.Text.Class - ( ToText (..) ) + ( ToText (..) + ) import Data.Text.Lazy.Builder - ( Builder, fromLazyText ) + ( Builder + , fromLazyText + ) import Formatting.Buildable - ( Buildable (..) ) + ( Buildable (..) + ) import Test.QuickCheck - ( Arbitrary (..), Property, (===) ) + ( Arbitrary (..) + , Property + , (===) + ) import Text.Pretty.Simple - ( pShow ) + ( pShow + ) import qualified Data.Text.Lazy as TL diff --git a/lib/test-utils/src/Test/Utils/Resource.hs b/lib/test-utils/src/Test/Utils/Resource.hs index 0783f1e4946..18d636425ea 100644 --- a/lib/test-utils/src/Test/Utils/Resource.hs +++ b/lib/test-utils/src/Test/Utils/Resource.hs @@ -15,17 +15,31 @@ module Test.Utils.Resource import Prelude import Control.Monad.IO.Unlift - ( MonadUnliftIO ) + ( MonadUnliftIO + ) import GHC.Stack - ( HasCallStack ) + ( HasCallStack + ) import UnliftIO.Async - ( async, race, waitCatch ) + ( async + , race + , waitCatch + ) import UnliftIO.Exception - ( finally, throwIO, throwString ) + ( finally + , throwIO + , throwString + ) import UnliftIO.Memoize - ( memoizeMVar, runMemoized ) + ( memoizeMVar + , runMemoized + ) import UnliftIO.MVar - ( MVar, newEmptyMVar, putMVar, takeMVar ) + ( MVar + , newEmptyMVar + , putMVar + , takeMVar + ) -- | Decompose a bracket pattern resource acquisition function into two separate -- functions: "allocate" and "release". diff --git a/lib/test-utils/src/Test/Utils/Roundtrip.hs b/lib/test-utils/src/Test/Utils/Roundtrip.hs index 109981bf5ff..fddb1d2fbdb 100644 --- a/lib/test-utils/src/Test/Utils/Roundtrip.hs +++ b/lib/test-utils/src/Test/Utils/Roundtrip.hs @@ -9,17 +9,27 @@ module Test.Utils.Roundtrip import Prelude import Data.Aeson - ( FromJSON (..), ToJSON (..) ) + ( FromJSON (..) + , ToJSON (..) + ) import Data.Char - ( isAlphaNum ) + ( isAlphaNum + ) import Data.Maybe - ( fromMaybe ) + ( fromMaybe + ) import Data.Proxy - ( Proxy (..) ) + ( Proxy (..) + ) import Data.Typeable - ( Typeable, splitTyConApp, tyConName, typeRep ) + ( Typeable + , splitTyConApp + , tyConName + , typeRep + ) import System.Environment - ( lookupEnv ) + ( lookupEnv + ) import Test.Aeson.GenericSpecs ( GoldenDirectoryOption (CustomDirectoryName) , Settings @@ -30,9 +40,11 @@ import Test.Aeson.GenericSpecs , useModuleNameAsSubDirectory ) import Test.Aeson.Internal.GoldenSpecs - ( goldenSpecsWithNotePlain ) + ( goldenSpecsWithNotePlain + ) import Test.Aeson.Internal.RoundtripSpecs - ( roundtripSpecs ) + ( roundtripSpecs + ) import Test.Aeson.Internal.Utils ( RandomMismatchOption (RandomMismatchError) , TypeName (..) @@ -40,13 +52,22 @@ import Test.Aeson.Internal.Utils , mkTypeNameInfo ) import Test.Hspec - ( Spec, it, runIO, shouldBe ) + ( Spec + , it + , runIO + , shouldBe + ) import Test.QuickCheck - ( Arbitrary (..), property ) + ( Arbitrary (..) + , property + ) import Text.Read - ( readMaybe ) + ( readMaybe + ) import Web.HttpApiData - ( FromHttpApiData (..), ToHttpApiData (..) ) + ( FromHttpApiData (..) + , ToHttpApiData (..) + ) -- Golden tests files are generated automatically on first run. On later runs -- we check that the format stays the same. The golden files should be tracked diff --git a/lib/test-utils/src/Test/Utils/Startup.hs b/lib/test-utils/src/Test/Utils/Startup.hs index 4050f776652..708a2985c81 100644 --- a/lib/test-utils/src/Test/Utils/Startup.hs +++ b/lib/test-utils/src/Test/Utils/Startup.hs @@ -6,13 +6,23 @@ module Test.Utils.Startup import Prelude import Control.Monad - ( void ) + ( void + ) import Control.Monad.IO.Unlift - ( MonadUnliftIO ) + ( MonadUnliftIO + ) import UnliftIO.Exception - ( IOException, bracket, tryJust ) + ( IOException + , bracket + , tryJust + ) import UnliftIO.IO - ( BufferMode (..), hGetBuffering, hSetBuffering, stderr, stdout ) + ( BufferMode (..) + , hGetBuffering + , hSetBuffering + , stderr + , stdout + ) withLineBuffering, withNoBuffering :: MonadUnliftIO m => m a -> m a withLineBuffering = withBuffering LineBuffering diff --git a/lib/test-utils/src/Test/Utils/StaticServer.hs b/lib/test-utils/src/Test/Utils/StaticServer.hs index 1ffc57e6507..17b864d1552 100644 --- a/lib/test-utils/src/Test/Utils/StaticServer.hs +++ b/lib/test-utils/src/Test/Utils/StaticServer.hs @@ -12,9 +12,12 @@ module Test.Utils.StaticServer import Prelude import Network.Wai.Application.Static - ( defaultFileServerSettings, staticApp ) + ( defaultFileServerSettings + , staticApp + ) import Network.Wai.Handler.Warp - ( withApplication ) + ( withApplication + ) -- | Run a localhost HTTP file server on any free port, while executing the -- given action. diff --git a/lib/test-utils/src/Test/Utils/Time.hs b/lib/test-utils/src/Test/Utils/Time.hs index 30f08f527d2..b534f128210 100644 --- a/lib/test-utils/src/Test/Utils/Time.hs +++ b/lib/test-utils/src/Test/Utils/Time.hs @@ -23,7 +23,12 @@ import Data.Time , toModifiedJulianDay ) import Test.QuickCheck - ( Arbitrary, Gen, arbitrary, choose, oneof ) + ( Arbitrary + , Gen + , arbitrary + , choose + , oneof + ) -- | A wrapper for 'UTCTime' whose 'Arbitrary' instance spans a uniform range -- of dates and a mixture of time precisions. diff --git a/lib/test-utils/src/Test/Utils/Trace.hs b/lib/test-utils/src/Test/Utils/Trace.hs index 0fde2aa1076..7766ac4a583 100644 --- a/lib/test-utils/src/Test/Utils/Trace.hs +++ b/lib/test-utils/src/Test/Utils/Trace.hs @@ -22,21 +22,35 @@ import Prelude import Cardano.BM.Trace - ( traceInTVarIO ) + ( traceInTVarIO + ) import Control.Monad.IO.Unlift - ( MonadIO (..), MonadUnliftIO (..) ) + ( MonadIO (..) + , MonadUnliftIO (..) + ) import Control.Tracer - ( Tracer, natTracer ) + ( Tracer + , natTracer + ) import Data.Text.Class - ( ToText (..) ) + ( ToText (..) + ) import Say - ( say ) + ( say + ) import Test.Hspec - ( HasCallStack, Spec, SpecWith, around ) + ( HasCallStack + , Spec + , SpecWith + , around + ) import UnliftIO.Exception - ( onException ) + ( onException + ) import UnliftIO.STM - ( newTVarIO, readTVarIO ) + ( newTVarIO + , readTVarIO + ) -- | Run an action with a logging 'Trace' object, and a function to get all -- messages that have been traced. diff --git a/lib/test-utils/test/Test/Hspec/ExtraSpec.hs b/lib/test-utils/test/Test/Hspec/ExtraSpec.hs index d1238d2488a..3c1ce5313a1 100644 --- a/lib/test-utils/test/Test/Hspec/ExtraSpec.hs +++ b/lib/test-utils/test/Test/Hspec/ExtraSpec.hs @@ -6,27 +6,49 @@ module Test.Hspec.ExtraSpec (spec) where import Prelude import Control.Monad - ( forM_, unless ) + ( forM_ + , unless + ) import Control.Monad.IO.Unlift - ( MonadUnliftIO (..) ) + ( MonadUnliftIO (..) + ) import Data.Bifunctor - ( first ) + ( first + ) import Data.Function - ( on ) + ( on + ) import Data.IORef - ( IORef, newIORef, readIORef, writeIORef ) + ( IORef + , newIORef + , readIORef + , writeIORef + ) import Data.List - ( isPrefixOf, nubBy ) + ( isPrefixOf + , nubBy + ) import Data.Maybe - ( fromMaybe ) + ( fromMaybe + ) import Fmt - ( (+|), (+||), (|+), (||+) ) + ( (+|) + , (+||) + , (|+) + , (||+) + ) import System.Exit - ( ExitCode (..) ) + ( ExitCode (..) + ) import System.IO - ( stderr, stdout ) + ( stderr + , stdout + ) import System.IO.Silently - ( capture_, hCapture, silence ) + ( capture_ + , hCapture + , silence + ) import Test.Hspec ( ActionWith , Expectation @@ -41,15 +63,24 @@ import Test.Hspec , shouldContain ) import Test.Hspec.Core.Runner - ( Summary (..), defaultConfig, runSpec ) + ( Summary (..) + , defaultConfig + , runSpec + ) import Test.Hspec.Core.Spec - ( runIO, sequential ) + ( runIO + , sequential + ) import Test.Hspec.Expectations.Lifted - ( shouldReturn ) + ( shouldReturn + ) import Test.Hspec.Extra - ( aroundAll, hspecMain ) + ( aroundAll + , hspecMain + ) import Test.Hspec.QuickCheck - ( prop ) + ( prop + ) import Test.QuickCheck ( Arbitrary (..) , Gen @@ -61,17 +92,36 @@ import Test.QuickCheck , oneof ) import Test.QuickCheck.Monadic - ( assert, monadicIO, monitor, run ) + ( assert + , monadicIO + , monitor + , run + ) import Test.Utils.Env - ( withEnv ) + ( withEnv + ) import UnliftIO.Concurrent - ( threadDelay ) + ( threadDelay + ) import UnliftIO.Environment - ( lookupEnv, setEnv, withArgs ) + ( lookupEnv + , setEnv + , withArgs + ) import UnliftIO.Exception - ( bracket, throwString, tryAny, tryDeep ) + ( bracket + , throwString + , tryAny + , tryDeep + ) import UnliftIO.MVar - ( MVar, newEmptyMVar, newMVar, putMVar, tryReadMVar, tryTakeMVar ) + ( MVar + , newEmptyMVar + , newMVar + , putMVar + , tryReadMVar + , tryTakeMVar + ) import qualified Test.Hspec.Extra as Extra diff --git a/lib/test-utils/test/Test/QuickCheck/ExtraSpec.hs b/lib/test-utils/test/Test/QuickCheck/ExtraSpec.hs index a7c5df1020a..4577ce62c40 100644 --- a/lib/test-utils/test/Test/QuickCheck/ExtraSpec.hs +++ b/lib/test-utils/test/Test/QuickCheck/ExtraSpec.hs @@ -14,35 +14,52 @@ module Test.QuickCheck.ExtraSpec import Prelude import Algebra.PartialOrd - ( PartialOrd (..) ) + ( PartialOrd (..) + ) import Control.Monad - ( forM_ ) + ( forM_ + ) import Data.Bifunctor - ( first ) + ( first + ) import Data.Function - ( (&) ) + ( (&) + ) import Data.Generics.Internal.VL.Lens - ( view ) + ( view + ) import Data.Generics.Labels () import Data.List.Extra - ( dropEnd ) + ( dropEnd + ) import Data.List.NonEmpty - ( NonEmpty (..) ) + ( NonEmpty (..) + ) import Data.Map.Strict - ( Map ) + ( Map + ) import Data.Maybe - ( isJust, isNothing ) + ( isJust + , isNothing + ) import Data.Set - ( Set ) + ( Set + ) import Generics.SOP - ( NP (Nil) ) + ( NP (Nil) + ) import GHC.Generics - ( Generic ) + ( Generic + ) import Safe - ( tailMay ) + ( tailMay + ) import Test.Hspec - ( Spec, describe, it ) + ( Spec + , describe + , it + ) import Test.QuickCheck ( Arbitrary (..) , Fun (..) diff --git a/lib/text-class/src/Data/Text/Class.hs b/lib/text-class/src/Data/Text/Class.hs index 13a03216101..bd08e865ba6 100644 --- a/lib/text-class/src/Data/Text/Class.hs +++ b/lib/text-class/src/Data/Text/Class.hs @@ -35,35 +35,55 @@ module Data.Text.Class import Prelude import Control.Monad - ( unless, (<=<) ) + ( unless + , (<=<) + ) import Data.Bifunctor - ( bimap, first ) + ( bimap + , first + ) import Data.List - ( find ) + ( find + ) import Data.List.Extra - ( enumerate ) + ( enumerate + ) import Data.Maybe - ( listToMaybe ) + ( listToMaybe + ) import Data.Text - ( Text ) + ( Text + ) import Data.Text.Read - ( decimal, signed ) + ( decimal + , signed + ) import Data.Time.Clock - ( NominalDiffTime ) + ( NominalDiffTime + ) import Data.Word - ( Word32, Word64 ) + ( Word32 + , Word64 + ) import Data.Word.Odd - ( Word31 ) + ( Word31 + ) import Formatting - ( builder, sformat ) + ( builder + , sformat + ) import Formatting.Buildable - ( Buildable (..) ) + ( Buildable (..) + ) import GHC.Generics - ( Generic ) + ( Generic + ) import Numeric.Natural - ( Natural ) + ( Natural + ) import Text.Read - ( readEither ) + ( readEither + ) import qualified Data.Char as C import qualified Data.Text as T diff --git a/lib/text-class/src/Test/Text/Roundtrip.hs b/lib/text-class/src/Test/Text/Roundtrip.hs index e4edc14b3d2..49d2fc3a019 100644 --- a/lib/text-class/src/Test/Text/Roundtrip.hs +++ b/lib/text-class/src/Test/Text/Roundtrip.hs @@ -8,15 +8,25 @@ module Test.Text.Roundtrip import Prelude import Data.Proxy - ( Proxy ) + ( Proxy + ) import Data.Text.Class - ( FromText (..), ToText (..) ) + ( FromText (..) + , ToText (..) + ) import Data.Typeable - ( Typeable, typeRep ) + ( Typeable + , typeRep + ) import Test.Hspec - ( Spec, it ) + ( Spec + , it + ) import Test.QuickCheck - ( Arbitrary (..), property, (===) ) + ( Arbitrary (..) + , property + , (===) + ) -- | Constructs a test to check that roundtrip textual encoding and decoding -- is possible for values of the given type. diff --git a/lib/text-class/test/unit/Data/Text/ClassSpec.hs b/lib/text-class/test/unit/Data/Text/ClassSpec.hs index ce514b03454..9d366200078 100644 --- a/lib/text-class/test/unit/Data/Text/ClassSpec.hs +++ b/lib/text-class/test/unit/Data/Text/ClassSpec.hs @@ -10,15 +10,20 @@ module Data.Text.ClassSpec import Prelude import Data.Either - ( isLeft ) + ( isLeft + ) import Data.Foldable - ( toList ) + ( toList + ) import Data.Maybe - ( isNothing ) + ( isNothing + ) import Data.Proxy - ( Proxy (..) ) + ( Proxy (..) + ) import Data.Text - ( Text ) + ( Text + ) import Data.Text.Class ( CaseStyle (..) , FromText (..) @@ -29,15 +34,23 @@ import Data.Text.Class , toTextFromBoundedEnum ) import Data.Time.Clock - ( NominalDiffTime ) + ( NominalDiffTime + ) import Data.Word - ( Word32 ) + ( Word32 + ) import GHC.Generics - ( Generic ) + ( Generic + ) import Numeric.Natural - ( Natural ) + ( Natural + ) import Test.Hspec - ( Spec, describe, it, shouldSatisfy ) + ( Spec + , describe + , it + , shouldSatisfy + ) import Test.QuickCheck ( Arbitrary (..) , UnicodeString (..) @@ -54,7 +67,8 @@ import Test.QuickCheck , (==>) ) import Test.Text.Roundtrip - ( textRoundtrip ) + ( textRoundtrip + ) import qualified Data.Text as T diff --git a/lib/wai-middleware-logging/src/Network/Wai/Middleware/Logging.hs b/lib/wai-middleware-logging/src/Network/Wai/Middleware/Logging.hs index b3d53e6829c..9158c32ea8e 100644 --- a/lib/wai-middleware-logging/src/Network/Wai/Middleware/Logging.hs +++ b/lib/wai-middleware-logging/src/Network/Wai/Middleware/Logging.hs @@ -28,43 +28,80 @@ module Network.Wai.Middleware.Logging import Prelude import Cardano.BM.Data.LogItem - ( PrivacyAnnotation (..) ) + ( PrivacyAnnotation (..) + ) import Cardano.BM.Data.Severity - ( Severity (..) ) + ( Severity (..) + ) import Cardano.BM.Data.Tracer - ( HasPrivacyAnnotation (..), HasSeverityAnnotation (..) ) + ( HasPrivacyAnnotation (..) + , HasSeverityAnnotation (..) + ) import Cardano.BM.Tracing - ( ToObject ) + ( ToObject + ) import Control.Applicative - ( (<|>) ) + ( (<|>) + ) import Control.Arrow - ( second ) + ( second + ) import Control.Tracer - ( Tracer, contramap, traceWith ) + ( Tracer + , contramap + , traceWith + ) import Data.Aeson - ( FromJSON (..), ToJSON (..), Value (..) ) + ( FromJSON (..) + , ToJSON (..) + , Value (..) + ) import Data.ByteString - ( ByteString ) + ( ByteString + ) import Data.ByteString.Builder - ( Builder ) + ( Builder + ) import Data.IORef - ( IORef, atomicModifyIORef, modifyIORef, newIORef, readIORef ) + ( IORef + , atomicModifyIORef + , modifyIORef + , newIORef + , readIORef + ) import Data.Text - ( Text ) + ( Text + ) import Data.Text.Class - ( ToText (..) ) + ( ToText (..) + ) import Data.Time.Clock - ( NominalDiffTime, diffUTCTime, getCurrentTime ) + ( NominalDiffTime + , diffUTCTime + , getCurrentTime + ) import GHC.Generics - ( Generic ) + ( Generic + ) import Network.HTTP.Types.Status - ( Status (..) ) + ( Status (..) + ) import Network.Wai - ( Middleware, Request (..), rawPathInfo, rawQueryString, requestMethod ) + ( Middleware + , Request (..) + , rawPathInfo + , rawQueryString + , requestMethod + ) import Network.Wai.Internal - ( Response (..), getRequestBodyChunk ) + ( Response (..) + , getRequestBodyChunk + ) import UnliftIO.MVar - ( MVar, modifyMVar, newMVar ) + ( MVar + , modifyMVar + , newMVar + ) import qualified Data.Aeson as Aeson import qualified Data.Aeson.Key as Aeson diff --git a/lib/wai-middleware-logging/src/Network/Wai/Middleware/ServerError.hs b/lib/wai-middleware-logging/src/Network/Wai/Middleware/ServerError.hs index 5a7783c2745..cab2cd5bd8f 100644 --- a/lib/wai-middleware-logging/src/Network/Wai/Middleware/ServerError.hs +++ b/lib/wai-middleware-logging/src/Network/Wai/Middleware/ServerError.hs @@ -14,17 +14,28 @@ module Network.Wai.Middleware.ServerError import Prelude import Control.Monad - ( guard ) + ( guard + ) import Data.ByteString.Lazy - ( ByteString ) + ( ByteString + ) import Network.HTTP.Types.Status - ( statusCode, statusMessage ) + ( statusCode + , statusMessage + ) import Network.Wai - ( Middleware, responseHeaders, responseStatus ) + ( Middleware + , responseHeaders + , responseStatus + ) import Network.Wai.Internal - ( Request, Response (..) ) + ( Request + , Response (..) + ) import Servant.Server.Internal.ServerError - ( ServerError (..), responseServerError ) + ( ServerError (..) + , responseServerError + ) import qualified Data.Binary.Builder as Binary import qualified Data.ByteString.Char8 as B8 diff --git a/lib/wai-middleware-logging/test/Main.hs b/lib/wai-middleware-logging/test/Main.hs index 21bc27cea85..ad3f8ad907a 100644 --- a/lib/wai-middleware-logging/test/Main.hs +++ b/lib/wai-middleware-logging/test/Main.hs @@ -3,9 +3,11 @@ module Main where import Prelude import Main.Utf8 - ( withUtf8 ) + ( withUtf8 + ) import Test.Hspec.Extra - ( hspecMain ) + ( hspecMain + ) import qualified Network.Wai.Middleware.LoggingSpec as LoggingSpec diff --git a/lib/wai-middleware-logging/test/Network/Wai/Middleware/LoggingSpec.hs b/lib/wai-middleware-logging/test/Network/Wai/Middleware/LoggingSpec.hs index 5465901d88b..076cf1f6339 100644 --- a/lib/wai-middleware-logging/test/Network/Wai/Middleware/LoggingSpec.hs +++ b/lib/wai-middleware-logging/test/Network/Wai/Middleware/LoggingSpec.hs @@ -12,37 +12,59 @@ module Network.Wai.Middleware.LoggingSpec (spec) where import Prelude import Cardano.BM.Data.Severity - ( Severity (..) ) + ( Severity (..) + ) import Cardano.BM.Data.Tracer - ( HasSeverityAnnotation (..) ) + ( HasSeverityAnnotation (..) + ) import Cardano.BM.Trace - ( traceInTVarIO ) + ( traceInTVarIO + ) import Control.Monad - ( forM_, void, when ) + ( forM_ + , void + , when + ) import Control.Monad.IO.Class - ( liftIO ) + ( liftIO + ) import Control.Tracer - ( Tracer ) + ( Tracer + ) import Data.Aeson - ( FromJSON (..), ToJSON (..) ) + ( FromJSON (..) + , ToJSON (..) + ) import Data.ByteString - ( ByteString ) + ( ByteString + ) import Data.Function - ( (&) ) + ( (&) + ) import Data.Functor - ( ($>), (<&>) ) + ( ($>) + , (<&>) + ) import Data.List - ( isInfixOf ) + ( isInfixOf + ) import Data.Proxy - ( Proxy (..) ) + ( Proxy (..) + ) import Data.Streaming.Network - ( HostPreference, bindPortTCP, bindRandomPortTCP ) + ( HostPreference + , bindPortTCP + , bindRandomPortTCP + ) import Data.Text - ( Text ) + ( Text + ) import Data.Text.Class - ( toText ) + ( toText + ) import GHC.Generics - ( Generic ) + ( Generic + ) import Network.HTTP.Client ( Manager , Request @@ -56,11 +78,17 @@ import Network.HTTP.Client , requestHeaders ) import Network.HTTP.Types.Header - ( hContentType ) + ( hContentType + ) import Network.Socket - ( Socket, close ) + ( Socket + , close + ) import Network.Wai.Handler.Warp - ( Port, runSettingsSocket, setBeforeMainLoop ) + ( Port + , runSettingsSocket + , setBeforeMainLoop + ) import Network.Wai.Middleware.Logging ( ApiLog (..) , ApiLoggerSettings @@ -88,7 +116,8 @@ import Servant , throwError ) import Servant.Server - ( Handler ) + ( Handler + ) import System.IO.Error ( ioeGetErrorType , isAlreadyInUseError @@ -97,21 +126,46 @@ import System.IO.Error , isUserError ) import Test.Hspec - ( Spec, after, before, describe, it, shouldBe, shouldContain ) + ( Spec + , after + , before + , describe + , it + , shouldBe + , shouldContain + ) import Test.QuickCheck - ( Arbitrary (..), choose ) + ( Arbitrary (..) + , choose + ) import UnliftIO - ( IOException, bracket, tryJust ) + ( IOException + , bracket + , tryJust + ) import UnliftIO.Async - ( Async, async, cancel ) + ( Async + , async + , cancel + ) import UnliftIO.Concurrent - ( threadDelay ) + ( threadDelay + ) import UnliftIO.Exception - ( onException, throwString ) + ( onException + , throwString + ) import UnliftIO.MVar - ( newEmptyMVar, putMVar, readMVar, tryPutMVar ) + ( newEmptyMVar + , putMVar + , readMVar + , tryPutMVar + ) import UnliftIO.STM - ( TVar, newTVarIO, readTVarIO ) + ( TVar + , newTVarIO + , readTVarIO + ) import qualified Data.Aeson as Aeson import qualified Data.Text as T diff --git a/lib/wallet-benchmarks/bench/memory-benchmark.hs b/lib/wallet-benchmarks/bench/memory-benchmark.hs index edf79e55a0f..08c6c0549f2 100644 --- a/lib/wallet-benchmarks/bench/memory-benchmark.hs +++ b/lib/wallet-benchmarks/bench/memory-benchmark.hs @@ -5,31 +5,50 @@ import Prelude import Cardano.BM.Data.Tracer - ( HasPrivacyAnnotation (..), HasSeverityAnnotation (..) ) + ( HasPrivacyAnnotation (..) + , HasSeverityAnnotation (..) + ) import Cardano.Startup - ( installSignalHandlers ) + ( installSignalHandlers + ) import Control.Concurrent - ( threadDelay ) + ( threadDelay + ) import Control.Monad - ( unless, void, when ) + ( unless + , void + , when + ) import Control.Tracer - ( Tracer (..), contramap, traceWith ) + ( Tracer (..) + , contramap + , traceWith + ) import Data.List - ( intersperse ) + ( intersperse + ) import Data.Maybe - ( fromMaybe ) + ( fromMaybe + ) import Data.Text - ( Text ) + ( Text + ) import Data.Text.Class - ( ToText (..) ) + ( ToText (..) + ) import Main.Utf8 - ( withUtf8 ) + ( withUtf8 + ) import System.FilePath - ( takeBaseName, () ) + ( takeBaseName + , () + ) import System.IO.Temp - ( withSystemTempDirectory ) + ( withSystemTempDirectory + ) import Text.Read - ( readMaybe ) + ( readMaybe + ) import qualified Cardano.BM.Configuration.Model as Log import qualified Cardano.BM.Configuration.Static as Log diff --git a/lib/wallet-e2e/exe/Main.hs b/lib/wallet-e2e/exe/Main.hs index acee5b88543..1ecd374c59f 100644 --- a/lib/wallet-e2e/exe/Main.hs +++ b/lib/wallet-e2e/exe/Main.hs @@ -4,9 +4,13 @@ import qualified Options.Applicative as OptParse import qualified Test.Syd.OptParse as SydTest import Cardano.Wallet.Spec - ( TestNetworkConfig (..), effectsSpec, walletSpec ) + ( TestNetworkConfig (..) + , effectsSpec + , walletSpec + ) import Main.Utf8 - ( withUtf8 ) + ( withUtf8 + ) import Options.Applicative ( Parser , eitherReader @@ -22,11 +26,16 @@ import Options.Applicative , short ) import Path - ( Dir, SomeBase (..), parseSomeDir ) + ( Dir + , SomeBase (..) + , parseSomeDir + ) import Path.IO - ( AnyPath (makeAbsolute) ) + ( AnyPath (makeAbsolute) + ) import Test.Syd - ( sydTestWith ) + ( sydTestWith + ) main :: IO () main = withUtf8 do diff --git a/lib/wallet-e2e/src/Cardano/Wallet/Spec.hs b/lib/wallet-e2e/src/Cardano/Wallet/Spec.hs index dfcb1182078..f268d9d2f64 100644 --- a/lib/wallet-e2e/src/Cardano/Wallet/Spec.hs +++ b/lib/wallet-e2e/src/Cardano/Wallet/Spec.hs @@ -9,17 +9,30 @@ import qualified Cardano.Wallet.Spec.Network.Manual as Manual import qualified Cardano.Wallet.Spec.Network.Preprod as Preprod import Cardano.Wallet.Spec.Interpreters.Effectfully - ( story ) + ( story + ) import Cardano.Wallet.Spec.Network.Config - ( NetworkConfig ) + ( NetworkConfig + ) import Cardano.Wallet.Spec.Stories.Wallet - ( createdWalletHasZeroAda, createdWalletListed, createdWalletRetrievable ) + ( createdWalletHasZeroAda + , createdWalletListed + , createdWalletRetrievable + ) import Cardano.Wallet.Spec.TimeoutSpec - ( timeoutSpec ) + ( timeoutSpec + ) import Path - ( Abs, Dir, Path ) + ( Abs + , Dir + , Path + ) import Test.Syd - ( Spec, aroundAll, describe, sequential ) + ( Spec + , aroundAll + , describe + , sequential + ) walletSpec :: TestNetworkConfig -> Spec walletSpec networkConfig = diff --git a/lib/wallet-e2e/src/Cardano/Wallet/Spec/Data/Mnemonic.hs b/lib/wallet-e2e/src/Cardano/Wallet/Spec/Data/Mnemonic.hs index 9d36dcf36dc..99c48a6e0b9 100644 --- a/lib/wallet-e2e/src/Cardano/Wallet/Spec/Data/Mnemonic.hs +++ b/lib/wallet-e2e/src/Cardano/Wallet/Spec/Data/Mnemonic.hs @@ -10,7 +10,8 @@ import qualified Data.List.NonEmpty as NE import qualified Data.Text as T import Prelude hiding - ( toText ) + ( toText + ) newtype Mnemonic = Mnemonic (NonEmpty Text) deriving stock (Show) diff --git a/lib/wallet-e2e/src/Cardano/Wallet/Spec/Data/Network/Info.hs b/lib/wallet-e2e/src/Cardano/Wallet/Spec/Data/Network/Info.hs index c4dec887e1f..aa35761ff78 100644 --- a/lib/wallet-e2e/src/Cardano/Wallet/Spec/Data/Network/Info.hs +++ b/lib/wallet-e2e/src/Cardano/Wallet/Spec/Data/Network/Info.hs @@ -1,7 +1,8 @@ module Cardano.Wallet.Spec.Data.Network.Info where import Cardano.Wallet.Spec.Data.Network.NodeStatus - ( NodeStatus ) + ( NodeStatus + ) newtype NetworkInfo = NetworkInfo { nodeStatus :: NodeStatus diff --git a/lib/wallet-e2e/src/Cardano/Wallet/Spec/Data/Wallet.hs b/lib/wallet-e2e/src/Cardano/Wallet/Spec/Data/Wallet.hs index e864ad883ca..a6ce2b1fe54 100644 --- a/lib/wallet-e2e/src/Cardano/Wallet/Spec/Data/Wallet.hs +++ b/lib/wallet-e2e/src/Cardano/Wallet/Spec/Data/Wallet.hs @@ -1,11 +1,14 @@ module Cardano.Wallet.Spec.Data.Wallet where import Cardano.Wallet.Spec.Data.AdaBalance - ( AdaBalance ) + ( AdaBalance + ) import Cardano.Wallet.Spec.Data.WalletId - ( WalletId ) + ( WalletId + ) import Cardano.Wallet.Spec.Data.WalletName - ( WalletName ) + ( WalletName + ) data Wallet = Wallet { walletId :: WalletId diff --git a/lib/wallet-e2e/src/Cardano/Wallet/Spec/Data/WalletName.hs b/lib/wallet-e2e/src/Cardano/Wallet/Spec/Data/WalletName.hs index 0ed4a5b17b3..ccd9c32a4fa 100644 --- a/lib/wallet-e2e/src/Cardano/Wallet/Spec/Data/WalletName.hs +++ b/lib/wallet-e2e/src/Cardano/Wallet/Spec/Data/WalletName.hs @@ -5,7 +5,8 @@ module Cardano.Wallet.Spec.Data.WalletName ) where import Prelude hiding - ( toText ) + ( toText + ) newtype WalletName = WalletName Text deriving stock (Show, Eq, Ord) diff --git a/lib/wallet-e2e/src/Cardano/Wallet/Spec/Effect/Assert.hs b/lib/wallet-e2e/src/Cardano/Wallet/Spec/Effect/Assert.hs index 36203e3b6d6..4686ed7c7a2 100644 --- a/lib/wallet-e2e/src/Cardano/Wallet/Spec/Effect/Assert.hs +++ b/lib/wallet-e2e/src/Cardano/Wallet/Spec/Effect/Assert.hs @@ -12,17 +12,26 @@ module Cardano.Wallet.Spec.Effect.Assert ) where import Cardano.Wallet.Spec.Effect.Trace - ( FxTrace, trace ) + ( FxTrace + , trace + ) import Effectful - ( (:>), Eff, Effect ) + ( (:>) + , Eff + , Effect + ) import Effectful.Dispatch.Dynamic - ( interpret ) + ( interpret + ) import Effectful.Fail - ( Fail ) + ( Fail + ) import Effectful.TH - ( makeEffect ) + ( makeEffect + ) import Prelude hiding - ( trace ) + ( trace + ) data FxAssert :: Effect where Assert :: Text -> Bool -> FxAssert m () diff --git a/lib/wallet-e2e/src/Cardano/Wallet/Spec/Effect/Http.hs b/lib/wallet-e2e/src/Cardano/Wallet/Spec/Effect/Http.hs index 1669bda2eaa..fb8c30ca445 100644 --- a/lib/wallet-e2e/src/Cardano/Wallet/Spec/Effect/Http.hs +++ b/lib/wallet-e2e/src/Cardano/Wallet/Spec/Effect/Http.hs @@ -7,23 +7,40 @@ module Cardano.Wallet.Spec.Effect.Http where import qualified Network.HTTP.Client as HC import Cardano.Wallet.Spec.Effect.Trace - ( FxTrace, trace ) + ( FxTrace + , trace + ) import Control.Exception - ( try ) + ( try + ) import Effectful - ( (:>), Eff, Effect, IOE ) + ( (:>) + , Eff + , Effect + , IOE + ) import Effectful.Dispatch.Dynamic - ( interpret ) + ( interpret + ) import Effectful.Fail - ( Fail ) + ( Fail + ) import Effectful.TH - ( makeEffect ) + ( makeEffect + ) import Prelude hiding - ( evalState, get, gets, modify, trace ) + ( evalState + , get + , gets + , modify + , trace + ) import Wallet - ( MonadHTTP ) + ( MonadHTTP + ) import Wallet.Common - ( MonadHTTP (..) ) + ( MonadHTTP (..) + ) data FxHttp :: Effect where HttpQuery :: HC.Request -> FxHttp m (HC.Response ByteString) diff --git a/lib/wallet-e2e/src/Cardano/Wallet/Spec/Effect/Query.hs b/lib/wallet-e2e/src/Cardano/Wallet/Spec/Effect/Query.hs index ae9957336d4..11e4e389b02 100644 --- a/lib/wallet-e2e/src/Cardano/Wallet/Spec/Effect/Query.hs +++ b/lib/wallet-e2e/src/Cardano/Wallet/Spec/Effect/Query.hs @@ -18,47 +18,84 @@ import qualified Wallet.Operations.ListWallets as LW import qualified Wallet.Operations.PostWallet as PW import Cardano.Wallet.Cli.Launcher - ( walletInstanceApiUrl ) + ( walletInstanceApiUrl + ) import Cardano.Wallet.Spec.Data.AdaBalance - ( AdaBalance (..) ) + ( AdaBalance (..) + ) import Cardano.Wallet.Spec.Data.Mnemonic - ( Mnemonic ) + ( Mnemonic + ) import Cardano.Wallet.Spec.Data.Network.Info - ( NetworkInfo (..) ) + ( NetworkInfo (..) + ) import Cardano.Wallet.Spec.Data.Network.NodeStatus - ( NodeStatus (..) ) + ( NodeStatus (..) + ) import Cardano.Wallet.Spec.Data.Wallet - ( Wallet (..) ) + ( Wallet (..) + ) import Cardano.Wallet.Spec.Data.WalletId - ( WalletId (..) ) + ( WalletId (..) + ) import Cardano.Wallet.Spec.Data.WalletName - ( WalletName ) + ( WalletName + ) import Cardano.Wallet.Spec.Effect.Assert - ( FxAssert, assert, assertEq ) + ( FxAssert + , assert + , assertEq + ) import Cardano.Wallet.Spec.Effect.Http - ( FxHttp ) + ( FxHttp + ) import Cardano.Wallet.Spec.Effect.Trace - ( FxTrace, trace ) + ( FxTrace + , trace + ) import Cardano.Wallet.Spec.Network.Config - ( NetworkConfig (..) ) + ( NetworkConfig (..) + ) import Effectful - ( (:>), Eff, Effect ) + ( (:>) + , Eff + , Effect + ) import Effectful.Dispatch.Dynamic - ( interpret, reinterpret ) + ( interpret + , reinterpret + ) import Effectful.Error.Static - ( runErrorNoCallStack ) + ( runErrorNoCallStack + ) import Effectful.Fail - ( Fail ) + ( Fail + ) import Effectful.State.Static.Local - ( evalState, get, gets, modify ) + ( evalState + , get + , gets + , modify + ) import Effectful.TH - ( makeEffect ) + ( makeEffect + ) import Network.HTTP.Client - ( responseBody, responseStatus ) + ( responseBody + , responseStatus + ) import Network.HTTP.Types - ( created201, noContent204, ok200 ) + ( created201 + , noContent204 + , ok200 + ) import Prelude hiding - ( evalState, get, gets, modify, trace ) + ( evalState + , get + , gets + , modify + , trace + ) data FxQuery :: Effect where ListKnownWallets :: FxQuery m (Set Wallet) diff --git a/lib/wallet-e2e/src/Cardano/Wallet/Spec/Effect/Random.hs b/lib/wallet-e2e/src/Cardano/Wallet/Spec/Effect/Random.hs index a8d01bef703..9cb565a08b2 100644 --- a/lib/wallet-e2e/src/Cardano/Wallet/Spec/Effect/Random.hs +++ b/lib/wallet-e2e/src/Cardano/Wallet/Spec/Effect/Random.hs @@ -12,31 +12,53 @@ import qualified Data.Text as T import qualified Effectful.State.Static.Local as State import Cardano.Wallet.Spec.Data.Mnemonic - ( Mnemonic ) + ( Mnemonic + ) import Cardano.Wallet.Spec.Data.WalletName - ( WalletName ) + ( WalletName + ) import Cardano.Wallet.Spec.Effect.Trace - ( FxTrace, trace ) + ( FxTrace + , trace + ) import Crypto.Encoding.BIP39 - ( toEntropy ) + ( toEntropy + ) import Data.Tagged - ( Tagged (..) ) + ( Tagged (..) + ) import Effectful - ( (:>), Eff, Effect ) + ( (:>) + , Eff + , Effect + ) import Effectful.Dispatch.Dynamic - ( interpret, reinterpret ) + ( interpret + , reinterpret + ) import Effectful.Fail - ( Fail ) + ( Fail + ) import Effectful.State.Static.Local - ( State, evalState ) + ( State + , evalState + ) import Effectful.TH - ( makeEffect ) + ( makeEffect + ) import Prelude hiding - ( State, evalState, get, trace ) + ( State + , evalState + , get + , trace + ) import System.Random - ( StdGen ) + ( StdGen + ) import System.Random.Stateful - ( StateGenM (..), uniformByteStringM ) + ( StateGenM (..) + , uniformByteStringM + ) data FxRandom :: Effect where RandomMnemonic :: FxRandom m Mnemonic diff --git a/lib/wallet-e2e/src/Cardano/Wallet/Spec/Effect/Timeout.hs b/lib/wallet-e2e/src/Cardano/Wallet/Spec/Effect/Timeout.hs index ae9879d6a65..944097f868a 100644 --- a/lib/wallet-e2e/src/Cardano/Wallet/Spec/Effect/Timeout.hs +++ b/lib/wallet-e2e/src/Cardano/Wallet/Spec/Effect/Timeout.hs @@ -10,19 +10,33 @@ module Cardano.Wallet.Spec.Effect.Timeout ) where import Cardano.Wallet.Spec.Effect.Assert - ( FxAssert, assertFail ) + ( FxAssert + , assertFail + ) import Control.Exception - ( catch ) + ( catch + ) import Data.Time.TimeSpan - ( TimeSpan, timeoutTS ) + ( TimeSpan + , timeoutTS + ) import Effectful - ( (:>), Eff, Effect, IOE ) + ( (:>) + , Eff + , Effect + , IOE + ) import Effectful.Dispatch.Dynamic - ( interpret, localSeqLift, localSeqUnliftIO ) + ( interpret + , localSeqLift + , localSeqUnliftIO + ) import Effectful.TH - ( makeEffect ) + ( makeEffect + ) import System.Timeout - ( Timeout ) + ( Timeout + ) -- | An effect for timing out computations. data FxTimeout :: Effect where diff --git a/lib/wallet-e2e/src/Cardano/Wallet/Spec/Effect/Trace.hs b/lib/wallet-e2e/src/Cardano/Wallet/Spec/Effect/Trace.hs index f1ae14cbdcc..b4d5c0a72cd 100644 --- a/lib/wallet-e2e/src/Cardano/Wallet/Spec/Effect/Trace.hs +++ b/lib/wallet-e2e/src/Cardano/Wallet/Spec/Effect/Trace.hs @@ -6,21 +6,36 @@ module Cardano.Wallet.Spec.Effect.Trace where import qualified Data.Sequence as Seq import Data.Sequence - ( (|>) ) + ( (|>) + ) import Effectful - ( Eff, Effect ) + ( Eff + , Effect + ) import Effectful.Dispatch.Dynamic - ( reinterpret ) + ( reinterpret + ) import Effectful.State.Static.Local - ( modify, runState ) + ( modify + , runState + ) import Effectful.TH - ( makeEffect ) + ( makeEffect + ) import Path - ( parseRelFile, reldir, toFilePath, () ) + ( parseRelFile + , reldir + , toFilePath + , () + ) import Path.IO - ( ensureDir, getCurrentDir ) + ( ensureDir + , getCurrentDir + ) import Prelude hiding - ( modify, runState ) + ( modify + , runState + ) data FxTrace :: Effect where Trace :: Text -> FxTrace m () diff --git a/lib/wallet-e2e/src/Cardano/Wallet/Spec/Interpreters/Effectfully.hs b/lib/wallet-e2e/src/Cardano/Wallet/Spec/Interpreters/Effectfully.hs index ed43e4b8ee1..e0d9942e9df 100644 --- a/lib/wallet-e2e/src/Cardano/Wallet/Spec/Interpreters/Effectfully.hs +++ b/lib/wallet-e2e/src/Cardano/Wallet/Spec/Interpreters/Effectfully.hs @@ -6,31 +6,59 @@ module Cardano.Wallet.Spec.Interpreters.Effectfully import qualified Network.HTTP.Client as Http import Cardano.Wallet.Spec.Effect.Assert - ( FxAssert, runAssertFailsFast ) + ( FxAssert + , runAssertFailsFast + ) import Cardano.Wallet.Spec.Effect.Http - ( FxHttp, runHttpClient ) + ( FxHttp + , runHttpClient + ) import Cardano.Wallet.Spec.Effect.Query - ( FxQuery, runQuery ) + ( FxQuery + , runQuery + ) import Cardano.Wallet.Spec.Effect.Random - ( FxRandom, runRandom ) + ( FxRandom + , runRandom + ) import Cardano.Wallet.Spec.Effect.Timeout - ( FxTimeout, runTimeout ) + ( FxTimeout + , runTimeout + ) import Cardano.Wallet.Spec.Effect.Trace - ( FxTrace, recordTraceLog, runTracePure ) + ( FxTrace + , recordTraceLog + , runTracePure + ) import Cardano.Wallet.Spec.Network.Config - ( NetworkConfig ) + ( NetworkConfig + ) import Effectful - ( Eff, IOE, runEff ) + ( Eff + , IOE + , runEff + ) import Effectful.Fail - ( Fail, runFail ) + ( Fail + , runFail + ) import Network.HTTP.Client - ( ManagerSettings (managerResponseTimeout) ) + ( ManagerSettings (managerResponseTimeout) + ) import Prelude hiding - ( Show, State, evalState, show ) + ( Show + , State + , evalState + , show + ) import System.Random - ( initStdGen ) + ( initStdGen + ) import Test.Syd - ( TestDefM, expectationFailure, itWithOuter ) + ( TestDefM + , expectationFailure + , itWithOuter + ) type Story a = Eff diff --git a/lib/wallet-e2e/src/Cardano/Wallet/Spec/Interpreters/Pure.hs b/lib/wallet-e2e/src/Cardano/Wallet/Spec/Interpreters/Pure.hs index 7771850b656..5d8bb1c8815 100644 --- a/lib/wallet-e2e/src/Cardano/Wallet/Spec/Interpreters/Pure.hs +++ b/lib/wallet-e2e/src/Cardano/Wallet/Spec/Interpreters/Pure.hs @@ -8,19 +8,35 @@ import qualified Data.Set as Set import qualified Effectful.Error.Static as E import Cardano.Wallet.Spec.Effect.Assert - ( FxAssert, runAssertFailsFast ) + ( FxAssert + , runAssertFailsFast + ) import Cardano.Wallet.Spec.Effect.Query - ( FxQuery, runQueryMock ) + ( FxQuery + , runQueryMock + ) import Cardano.Wallet.Spec.Effect.Random - ( FxRandom, runRandomMock ) + ( FxRandom + , runRandomMock + ) import Cardano.Wallet.Spec.Effect.Trace - ( FxTrace, recordTraceLog, runTracePure ) + ( FxTrace + , recordTraceLog + , runTracePure + ) import Effectful - ( Eff, runPureEff ) + ( Eff + , runPureEff + ) import Effectful.Fail - ( Fail, runFail ) + ( Fail + , runFail + ) import Test.Syd - ( TestDefM, expectationFailure, it ) + ( TestDefM + , expectationFailure + , it + ) type PureStory a = Eff diff --git a/lib/wallet-e2e/src/Cardano/Wallet/Spec/Network/Config.hs b/lib/wallet-e2e/src/Cardano/Wallet/Spec/Network/Config.hs index 306186cc90a..f536328af41 100644 --- a/lib/wallet-e2e/src/Cardano/Wallet/Spec/Network/Config.hs +++ b/lib/wallet-e2e/src/Cardano/Wallet/Spec/Network/Config.hs @@ -1,6 +1,7 @@ module Cardano.Wallet.Spec.Network.Config where import Cardano.Wallet.Cli.Launcher - ( WalletApi ) + ( WalletApi + ) newtype NetworkConfig = NetworkConfig {networkConfigWallet :: WalletApi} diff --git a/lib/wallet-e2e/src/Cardano/Wallet/Spec/Network/Local.hs b/lib/wallet-e2e/src/Cardano/Wallet/Spec/Network/Local.hs index 233efbc6528..64d2e77165b 100644 --- a/lib/wallet-e2e/src/Cardano/Wallet/Spec/Network/Local.hs +++ b/lib/wallet-e2e/src/Cardano/Wallet/Spec/Network/Local.hs @@ -3,9 +3,13 @@ module Cardano.Wallet.Spec.Network.Local ) where import Cardano.Wallet.Spec.Network.Config - ( NetworkConfig (..) ) + ( NetworkConfig (..) + ) import Path - ( Abs, Dir, Path ) + ( Abs + , Dir + , Path + ) nodeWalletSetup :: Path Abs Dir -> (NetworkConfig -> IO ()) -> IO () nodeWalletSetup _stateDir withNetworkConfig = do diff --git a/lib/wallet-e2e/src/Cardano/Wallet/Spec/Network/Manual.hs b/lib/wallet-e2e/src/Cardano/Wallet/Spec/Network/Manual.hs index e47b820b919..b11d7cd17d0 100644 --- a/lib/wallet-e2e/src/Cardano/Wallet/Spec/Network/Manual.hs +++ b/lib/wallet-e2e/src/Cardano/Wallet/Spec/Network/Manual.hs @@ -1,9 +1,11 @@ module Cardano.Wallet.Spec.Network.Manual where import Cardano.Wallet.Cli.Launcher - ( WalletApi (..) ) + ( WalletApi (..) + ) import Cardano.Wallet.Spec.Network.Config - ( NetworkConfig (..) ) + ( NetworkConfig (..) + ) nodeWalletSetup :: (NetworkConfig -> IO ()) -> IO () nodeWalletSetup withNetworkConfig = do diff --git a/lib/wallet-e2e/src/Cardano/Wallet/Spec/Network/Node/Cli.hs b/lib/wallet-e2e/src/Cardano/Wallet/Spec/Network/Node/Cli.hs index 961b88a49fa..4c97b276d0c 100644 --- a/lib/wallet-e2e/src/Cardano/Wallet/Spec/Network/Node/Cli.hs +++ b/lib/wallet-e2e/src/Cardano/Wallet/Spec/Network/Node/Cli.hs @@ -6,15 +6,25 @@ import qualified Data.Aeson.Types as Aeson import qualified Data.String as String import Cardano.Node.Cli.Launcher - ( NodeApi, nodeApiSocket ) + ( NodeApi + , nodeApiSocket + ) import Data.Aeson - ( withObject, (.:) ) + ( withObject + , (.:) + ) import Path - ( toFilePath ) + ( toFilePath + ) import Prelude hiding - ( stderr, stdout ) + ( stderr + , stdout + ) import System.Process.Typed - ( ExitCode (..), readProcess, shell ) + ( ExitCode (..) + , readProcess + , shell + ) data NodeTip = NodeTip { block :: Natural diff --git a/lib/wallet-e2e/src/Cardano/Wallet/Spec/Network/Preprod.hs b/lib/wallet-e2e/src/Cardano/Wallet/Spec/Network/Preprod.hs index dd9f95546eb..95b607f019e 100644 --- a/lib/wallet-e2e/src/Cardano/Wallet/Spec/Network/Preprod.hs +++ b/lib/wallet-e2e/src/Cardano/Wallet/Spec/Network/Preprod.hs @@ -11,23 +11,44 @@ import qualified Cardano.Wallet.Spec.Network.Node.Cli as NodeCli import qualified Cardano.Wallet.Spec.Network.Wallet.Cli as WalletCli import Cardano.Node.Cli.Launcher - ( NodeApi, NodeProcessConfig (..) ) + ( NodeApi + , NodeProcessConfig (..) + ) import Cardano.Wallet.Cli.Launcher - ( WalletApi, WalletProcessConfig (..) ) + ( WalletApi + , WalletProcessConfig (..) + ) import Cardano.Wallet.Spec.Data.Network.NodeStatus - ( NodeStatus (..) ) + ( NodeStatus (..) + ) import Cardano.Wallet.Spec.Network.Config - ( NetworkConfig (..) ) + ( NetworkConfig (..) + ) import Cardano.Wallet.Spec.Network.Node.Cli - ( CliError, NodeTip ) + ( CliError + , NodeTip + ) import Cardano.Wallet.Spec.Network.Wallet.Cli - ( NetworkInformation ) + ( NetworkInformation + ) import Control.Monad.Trans.Resource - ( allocate, runResourceT ) + ( allocate + , runResourceT + ) import Control.Retry - ( RetryStatus, capDelay, fibonacciBackoff, retrying ) + ( RetryStatus + , capDelay + , fibonacciBackoff + , retrying + ) import Path - ( Abs, Dir, Path, reldir, relfile, () ) + ( Abs + , Dir + , Path + , reldir + , relfile + , () + ) nodeWalletSetup :: Path Abs Dir diff --git a/lib/wallet-e2e/src/Cardano/Wallet/Spec/Network/Wallet/Cli.hs b/lib/wallet-e2e/src/Cardano/Wallet/Spec/Network/Wallet/Cli.hs index 4b299535d80..4bf0fbecad9 100644 --- a/lib/wallet-e2e/src/Cardano/Wallet/Spec/Network/Wallet/Cli.hs +++ b/lib/wallet-e2e/src/Cardano/Wallet/Spec/Network/Wallet/Cli.hs @@ -7,19 +7,30 @@ import qualified Data.Aeson.Types as Aeson import qualified Data.String as String import Cardano.Wallet.Cli.Launcher - ( WalletApi (..) ) + ( WalletApi (..) + ) import Cardano.Wallet.Spec.Data.Network.NodeStatus - ( NodeStatus ) + ( NodeStatus + ) import Data.Aeson - ( withObject, (.:) ) + ( withObject + , (.:) + ) import Data.Aeson.Types - ( explicitParseField ) + ( explicitParseField + ) import Data.Time - ( UTCTime ) + ( UTCTime + ) import Prelude hiding - ( stderr, stdout ) + ( stderr + , stdout + ) import System.Process.Typed - ( ExitCode (..), readProcess, shell ) + ( ExitCode (..) + , readProcess + , shell + ) data Error = CliErrorDecode (Aeson.JSONPath, String) LByteString diff --git a/lib/wallet-e2e/src/Cardano/Wallet/Spec/Stories/Language.hs b/lib/wallet-e2e/src/Cardano/Wallet/Spec/Stories/Language.hs index 037027f02e2..0d63b5dc107 100644 --- a/lib/wallet-e2e/src/Cardano/Wallet/Spec/Stories/Language.hs +++ b/lib/wallet-e2e/src/Cardano/Wallet/Spec/Stories/Language.hs @@ -1,7 +1,9 @@ module Cardano.Wallet.Spec.Stories.Language (FxStory) where import Effectful - ( (:>), Eff ) + ( (:>) + , Eff + ) type FxStory otherEffects knownEffects a = Fxs otherEffects knownEffects => Eff otherEffects a diff --git a/lib/wallet-e2e/src/Cardano/Wallet/Spec/Stories/Wallet.hs b/lib/wallet-e2e/src/Cardano/Wallet/Spec/Stories/Wallet.hs index 2b7a5ec3f0f..8bacc798a2e 100644 --- a/lib/wallet-e2e/src/Cardano/Wallet/Spec/Stories/Wallet.hs +++ b/lib/wallet-e2e/src/Cardano/Wallet/Spec/Stories/Wallet.hs @@ -6,15 +6,23 @@ module Cardano.Wallet.Spec.Stories.Wallet ) where import Cardano.Wallet.Spec.Data.AdaBalance - ( zeroAdaBalance ) + ( zeroAdaBalance + ) import Cardano.Wallet.Spec.Data.Network.Info - ( NetworkInfo (..) ) + ( NetworkInfo (..) + ) import Cardano.Wallet.Spec.Data.Network.NodeStatus - ( NodeStatus (..) ) + ( NodeStatus (..) + ) import Cardano.Wallet.Spec.Data.Wallet - ( Wallet (..), walletId ) + ( Wallet (..) + , walletId + ) import Cardano.Wallet.Spec.Effect.Assert - ( FxAssert, assert, assertEq ) + ( FxAssert + , assert + , assertEq + ) import Cardano.Wallet.Spec.Effect.Query ( FxQuery , createWalletFromMnemonic @@ -24,15 +32,24 @@ import Cardano.Wallet.Spec.Effect.Query , queryNetworkInfo ) import Cardano.Wallet.Spec.Effect.Random - ( FxRandom, randomMnemonic, randomWalletName ) + ( FxRandom + , randomMnemonic + , randomWalletName + ) import Cardano.Wallet.Spec.Effect.Timeout - ( FxTimeout, within ) + ( FxTimeout + , within + ) import Cardano.Wallet.Spec.Stories.Language - ( FxStory ) + ( FxStory + ) import Data.Set - ( member, notMember ) + ( member + , notMember + ) import Data.Time.TimeSpan - ( minutes ) + ( minutes + ) testEnvironmentIsReady :: FxStory fxs '[FxQuery, FxRandom, FxAssert] () testEnvironmentIsReady = do diff --git a/lib/wallet-e2e/src/Cardano/Wallet/Spec/TimeoutSpec.hs b/lib/wallet-e2e/src/Cardano/Wallet/Spec/TimeoutSpec.hs index 7dc952a4ede..b8a737b6969 100644 --- a/lib/wallet-e2e/src/Cardano/Wallet/Spec/TimeoutSpec.hs +++ b/lib/wallet-e2e/src/Cardano/Wallet/Spec/TimeoutSpec.hs @@ -3,25 +3,50 @@ module Cardano.Wallet.Spec.TimeoutSpec ) where import Cardano.Wallet.Spec.Effect.Assert - ( FxAssert, runAssertFailsFast ) + ( FxAssert + , runAssertFailsFast + ) import Cardano.Wallet.Spec.Effect.Timeout - ( FxTimeout, runTimeout, within ) + ( FxTimeout + , runTimeout + , within + ) import Cardano.Wallet.Spec.Effect.Trace - ( FxTrace, runTracePure ) + ( FxTrace + , runTracePure + ) import Cardano.Wallet.Spec.Stories.Language - ( FxStory ) + ( FxStory + ) import Control.Concurrent - ( threadDelay ) + ( threadDelay + ) import Data.Time.TimeSpan - ( milliseconds, seconds, toMicroseconds ) + ( milliseconds + , seconds + , toMicroseconds + ) import Effectful - ( Eff, IOE, runEff ) + ( Eff + , IOE + , runEff + ) import Effectful.Fail - ( Fail, runFail ) + ( Fail + , runFail + ) import Prelude hiding - ( State, evalState, get, modify ) + ( State + , evalState + , get + , modify + ) import Test.Syd - ( Spec, describe, expectationFailure, it ) + ( Spec + , describe + , expectationFailure + , it + ) -- | This story will not timeout as it takes less than 1 second. noTimeout :: FxStory fxs '[FxTimeout, IOE] () diff --git a/lib/wallet/api/http/Cardano/CLI.hs b/lib/wallet/api/http/Cardano/CLI.hs index 426f13f3ecd..4e2b07a2cb9 100644 --- a/lib/wallet/api/http/Cardano/CLI.hs +++ b/lib/wallet/api/http/Cardano/CLI.hs @@ -101,20 +101,31 @@ module Cardano.CLI ) where import Prelude hiding - ( getLine ) + ( getLine + ) import Cardano.BM.Backend.Switchboard - ( Switchboard ) + ( Switchboard + ) import Cardano.BM.Configuration.Static - ( defaultConfigStdout ) + ( defaultConfigStdout + ) import Cardano.BM.Counters - ( readCounters ) + ( readCounters + ) import Cardano.BM.Data.Configuration - ( Endpoint (..) ) + ( Endpoint (..) + ) import Cardano.BM.Data.Counter - ( Counter (..), nameCounter ) + ( Counter (..) + , nameCounter + ) import Cardano.BM.Data.LogItem - ( LOContent (..), LoggerName, PrivacyAnnotation (..), mkLOMeta ) + ( LOContent (..) + , LoggerName + , PrivacyAnnotation (..) + , mkLOMeta + ) import Cardano.BM.Data.Output ( ScribeDefinition (..) , ScribeFormat (..) @@ -123,19 +134,34 @@ import Cardano.BM.Data.Output , ScribePrivacy (..) ) import Cardano.BM.Data.Severity - ( Severity (..) ) + ( Severity (..) + ) import Cardano.BM.Data.SubTrace - ( SubTrace (..) ) + ( SubTrace (..) + ) import Cardano.BM.Setup - ( setupTrace_, shutdown ) + ( setupTrace_ + , shutdown + ) import Cardano.BM.Trace - ( Trace, appendName, logDebug, traceNamedObject ) + ( Trace + , appendName + , logDebug + , traceNamedObject + ) import Cardano.Mnemonic - ( MkSomeMnemonic (..), SomeMnemonic (..) ) + ( MkSomeMnemonic (..) + , SomeMnemonic (..) + ) import Cardano.Wallet.Address.Derivation - ( Depth (..), DerivationType (..), Index (..) ) + ( Depth (..) + , DerivationType (..) + , Index (..) + ) import Cardano.Wallet.Address.Discovery.Sequential - ( AddressPoolGap, defaultAddressPoolGap ) + ( AddressPoolGap + , defaultAddressPoolGap + ) import Cardano.Wallet.Api.Client ( AddressClient (..) , NetworkClient (..) @@ -144,7 +170,10 @@ import Cardano.Wallet.Api.Client , WalletClient (..) ) import Cardano.Wallet.Api.Http.Shelley.Server - ( HostPreference, Listen (..), TlsConfiguration (..) ) + ( HostPreference + , Listen (..) + , TlsConfiguration (..) + ) import Cardano.Wallet.Api.Types ( AccountPostData (..) , AddressAmount @@ -172,13 +201,19 @@ import Cardano.Wallet.Api.Types , fmtAllowedWords ) import Cardano.Wallet.Api.Types.SchemaMetadata - ( TxMetadataSchema (..), TxMetadataWithSchema ) + ( TxMetadataSchema (..) + , TxMetadataWithSchema + ) import Cardano.Wallet.Orphans () import Cardano.Wallet.Primitive.Passphrase.Types - ( Passphrase (..), PassphraseMaxLength, PassphraseMinLength ) + ( Passphrase (..) + , PassphraseMaxLength + , PassphraseMinLength + ) import Cardano.Wallet.Primitive.SyncProgress - ( SyncTolerance (..) ) + ( SyncTolerance (..) + ) import Cardano.Wallet.Primitive.Types ( PoolMetadataSource (..) , SortOrder @@ -187,55 +222,97 @@ import Cardano.Wallet.Primitive.Types , WalletName ) import Cardano.Wallet.Primitive.Types.Address - ( AddressState ) + ( AddressState + ) import Cardano.Wallet.Primitive.Types.Coin - ( Coin (..) ) + ( Coin (..) + ) import Cardano.Wallet.Primitive.Types.Hash - ( Hash (..) ) + ( Hash (..) + ) import Cardano.Wallet.Primitive.Types.Tx.SealedTx - ( SerialisedTx (..) ) + ( SerialisedTx (..) + ) import Cardano.Wallet.Version - ( gitRevision, showFullVersion, version ) + ( gitRevision + , showFullVersion + , version + ) import Control.Applicative - ( optional, some, (<|>) ) + ( optional + , some + , (<|>) + ) import Control.Arrow - ( first, left ) + ( first + , left + ) import Control.Monad - ( forM_, forever, join, unless, void, when ) + ( forM_ + , forever + , join + , unless + , void + , when + ) import Control.Monad.IO.Class - ( MonadIO ) + ( MonadIO + ) import Data.Aeson - ( ToJSON (..), (.:), (.=) ) + ( ToJSON (..) + , (.:) + , (.=) + ) import Data.Bifunctor - ( bimap ) + ( bimap + ) import Data.Char - ( toLower ) + ( toLower + ) import Data.Coerce - ( coerce ) + ( coerce + ) import Data.List.NonEmpty - ( NonEmpty (..) ) + ( NonEmpty (..) + ) import Data.Maybe - ( fromMaybe, isJust ) + ( fromMaybe + , isJust + ) import Data.Quantity - ( Quantity (..) ) + ( Quantity (..) + ) import Data.String - ( IsString ) + ( IsString + ) import Data.Text - ( Text ) + ( Text + ) import Data.Text.Class - ( FromText (..), TextDecodingError (..), ToText (..), showT ) + ( FromText (..) + , TextDecodingError (..) + , ToText (..) + , showT + ) import Data.Text.Read - ( decimal ) + ( decimal + ) import Data.Time.Clock - ( NominalDiffTime ) + ( NominalDiffTime + ) import Data.Void - ( Void ) + ( Void + ) import Fmt - ( Buildable, pretty ) + ( Buildable + , pretty + ) import GHC.Generics - ( Generic ) + ( Generic + ) import GHC.TypeLits - ( Symbol ) + ( Symbol + ) import Network.HTTP.Client ( defaultManagerSettings , managerResponseTimeout @@ -244,9 +321,11 @@ import Network.HTTP.Client ) -- See ADP-1910 import Cardano.Wallet.Api.Types.Transaction - ( ApiLimit (..) ) + ( ApiLimit (..) + ) import GHC.Num - ( Natural ) + ( Natural + ) import "optparse-applicative" Options.Applicative ( ArgumentFields , CommandFields @@ -283,13 +362,23 @@ import "optparse-applicative" Options.Applicative , value ) import "optparse-applicative" Options.Applicative.Types - ( ReadM (..), readerAsk ) + ( ReadM (..) + , readerAsk + ) import Prettyprinter - ( vsep ) + ( vsep + ) import Servant.Client - ( BaseUrl (..), ClientM, Scheme (..), mkClientEnv, runClientM ) + ( BaseUrl (..) + , ClientM + , Scheme (..) + , mkClientEnv + , runClientM + ) import Servant.Client.Core - ( ClientError (..), responseBody ) + ( ClientError (..) + , responseBody + ) import System.Console.ANSI ( Color (..) , ColorIntensity (..) @@ -307,13 +396,18 @@ import System.Directory , getXdgDirectory ) import System.Environment - ( lookupEnv ) + ( lookupEnv + ) import System.Exit - ( exitFailure, exitSuccess ) + ( exitFailure + , exitSuccess + ) import System.FilePath - ( () ) + ( () + ) import System.Info - ( os ) + ( os + ) import System.IO ( BufferMode (..) , Handle @@ -329,9 +423,11 @@ import System.IO , stdout ) import UnliftIO.Concurrent - ( threadDelay ) + ( threadDelay + ) import UnliftIO.Exception - ( bracket ) + ( bracket + ) import qualified Cardano.BM.Configuration.Model as CM import qualified Cardano.BM.Data.BackendKind as CM diff --git a/lib/wallet/api/http/Cardano/Wallet/Api.hs b/lib/wallet/api/http/Cardano/Wallet/Api.hs index d7e382404df..943a31edfb0 100644 --- a/lib/wallet/api/http/Cardano/Wallet/Api.hs +++ b/lib/wallet/api/http/Cardano/Wallet/Api.hs @@ -175,9 +175,14 @@ module Cardano.Wallet.Api import Prelude import Cardano.Wallet - ( TxSubmitLog, WalletLayer (..), WalletWorkerLog ) + ( TxSubmitLog + , WalletLayer (..) + , WalletWorkerLog + ) import Cardano.Wallet.Address.Derivation - ( DerivationIndex, Role ) + ( DerivationIndex + , Role + ) import Cardano.Wallet.Api.Types ( AnyAddress , ApiAccountKey @@ -243,17 +248,25 @@ import Cardano.Wallet.Api.Types , WalletPutPassphraseData ) import Cardano.Wallet.Api.Types.BlockHeader - ( ApiBlockHeader ) + ( ApiBlockHeader + ) import Cardano.Wallet.Api.Types.Transaction - ( ApiLimit ) + ( ApiLimit + ) import Cardano.Wallet.DB - ( DBFactory, DBLayer ) + ( DBFactory + , DBLayer + ) import Cardano.Wallet.Flavor - ( CredFromOf, KeyOf ) + ( CredFromOf + , KeyOf + ) import Cardano.Wallet.Network - ( NetworkLayer ) + ( NetworkLayer + ) import Cardano.Wallet.Pools - ( StakePool ) + ( StakePool + ) import Cardano.Wallet.Primitive.Types ( Block , NetworkParameters @@ -262,37 +275,57 @@ import Cardano.Wallet.Primitive.Types , WalletId (..) ) import Cardano.Wallet.Primitive.Types.Address - ( AddressState ) + ( AddressState + ) import Cardano.Wallet.Primitive.Types.Coin - ( Coin (..) ) + ( Coin (..) + ) import Cardano.Wallet.Primitive.Types.TokenPolicy - ( TokenName, TokenPolicyId ) + ( TokenName + , TokenPolicyId + ) import Cardano.Wallet.Primitive.Types.Tx - ( SealedTx ) + ( SealedTx + ) import Cardano.Wallet.Registry - ( HasWorkerCtx (..), WorkerLog, WorkerRegistry ) + ( HasWorkerCtx (..) + , WorkerLog + , WorkerRegistry + ) import Cardano.Wallet.TokenMetadata - ( TokenMetadataClient ) + ( TokenMetadataClient + ) import Cardano.Wallet.Transaction - ( TransactionLayer ) + ( TransactionLayer + ) import Control.Concurrent.Concierge - ( Concierge ) + ( Concierge + ) import Control.Tracer - ( Tracer, contramap ) + ( Tracer + , contramap + ) import Data.ByteString - ( ByteString ) + ( ByteString + ) import Data.Generics.Internal.VL.Lens - ( Lens' ) + ( Lens' + ) import Data.Generics.Labels () import Data.Generics.Product.Typed - ( HasType, typed ) + ( HasType + , typed + ) import Data.Kind - ( Type ) + ( Type + ) import Data.List.NonEmpty - ( NonEmpty ) + ( NonEmpty + ) import GHC.Generics - ( Generic ) + ( Generic + ) import Servant.API ( (:<|>) , (:>) diff --git a/lib/wallet/api/http/Cardano/Wallet/Api/Aeson.hs b/lib/wallet/api/http/Cardano/Wallet/Api/Aeson.hs index c8cbb5a3be7..d116ddd719b 100644 --- a/lib/wallet/api/http/Cardano/Wallet/Api/Aeson.hs +++ b/lib/wallet/api/http/Cardano/Wallet/Api/Aeson.hs @@ -10,13 +10,20 @@ module Cardano.Wallet.Api.Aeson import Prelude import Cardano.Wallet.Util - ( ShowFmt (..) ) + ( ShowFmt (..) + ) import Data.Aeson - ( ToJSON (..), Value, withText ) + ( ToJSON (..) + , Value + , withText + ) import Data.Bifunctor - ( Bifunctor (..) ) + ( Bifunctor (..) + ) import Data.Text.Class - ( FromText (..), ToText (toText) ) + ( FromText (..) + , ToText (toText) + ) import qualified Data.Aeson.Types as Aeson diff --git a/lib/wallet/api/http/Cardano/Wallet/Api/Aeson/Variant.hs b/lib/wallet/api/http/Cardano/Wallet/Api/Aeson/Variant.hs index 48a78f6b505..58d5fc9ed11 100644 --- a/lib/wallet/api/http/Cardano/Wallet/Api/Aeson/Variant.hs +++ b/lib/wallet/api/http/Cardano/Wallet/Api/Aeson/Variant.hs @@ -15,7 +15,12 @@ module Cardano.Wallet.Api.Aeson.Variant import Prelude import Data.Aeson.Types - ( Object, Parser, Value, modifyFailure, withObject ) + ( Object + , Parser + , Value + , modifyFailure + , withObject + ) -- | Specification of a JSON parser suitable for 'variants'. data Variant a = Variant diff --git a/lib/wallet/api/http/Cardano/Wallet/Api/Client.hs b/lib/wallet/api/http/Cardano/Wallet/Api/Client.hs index 032c09e74a8..5bd2f14f026 100644 --- a/lib/wallet/api/http/Cardano/Wallet/Api/Client.hs +++ b/lib/wallet/api/http/Cardano/Wallet/Api/Client.hs @@ -96,35 +96,56 @@ import Cardano.Wallet.Api.Types , WalletPutPassphraseData (..) ) import Cardano.Wallet.Api.Types.SchemaMetadata - ( TxMetadataSchema, toSimpleMetadataFlag ) + ( TxMetadataSchema + , toSimpleMetadataFlag + ) import Cardano.Wallet.Api.Types.Transaction - ( ApiLimit ) + ( ApiLimit + ) import Cardano.Wallet.Pools - ( StakePool ) + ( StakePool + ) import Cardano.Wallet.Primitive.Types - ( SortOrder, WalletId ) + ( SortOrder + , WalletId + ) import Cardano.Wallet.Primitive.Types.Address - ( AddressState ) + ( AddressState + ) import Cardano.Wallet.Primitive.Types.Coin - ( Coin (..) ) + ( Coin (..) + ) import Cardano.Wallet.Primitive.Types.Tx - ( SealedTx, SerialisedTx (..), unsafeSealedTxFromBytes ) + ( SealedTx + , SerialisedTx (..) + , unsafeSealedTxFromBytes + ) import Control.Monad - ( void ) + ( void + ) import Data.Generics.Internal.VL.Lens - ( view ) + ( view + ) import Data.Generics.Labels () import Data.Proxy - ( Proxy (..) ) + ( Proxy (..) + ) import Data.Text - ( Text ) + ( Text + ) import Servant - ( (:<|>) (..), (:>), NoContent ) + ( (:<|>) (..) + , (:>) + , NoContent + ) import Servant.Client - ( ClientM, client ) + ( ClientM + , client + ) import UnliftIO.Exception - ( throwString ) + ( throwString + ) import qualified Data.Aeson as Aeson diff --git a/lib/wallet/api/http/Cardano/Wallet/Api/Hex.hs b/lib/wallet/api/http/Cardano/Wallet/Api/Hex.hs index a0089c72356..fbcbf2d1c81 100644 --- a/lib/wallet/api/http/Cardano/Wallet/Api/Hex.hs +++ b/lib/wallet/api/http/Cardano/Wallet/Api/Hex.hs @@ -9,11 +9,15 @@ module Cardano.Wallet.Api.Hex import Prelude import Cardano.Wallet.Address.Derivation - ( fromHex, hex ) + ( fromHex + , hex + ) import Data.ByteString - ( ByteString ) + ( ByteString + ) import Data.Text - ( Text ) + ( Text + ) import qualified Data.Text.Encoding as T diff --git a/lib/wallet/api/http/Cardano/Wallet/Api/Http/Logging.hs b/lib/wallet/api/http/Cardano/Wallet/Api/Http/Logging.hs index 95c1a6fd620..4290ebd8b7e 100644 --- a/lib/wallet/api/http/Cardano/Wallet/Api/Http/Logging.hs +++ b/lib/wallet/api/http/Cardano/Wallet/Api/Http/Logging.hs @@ -16,21 +16,32 @@ module Cardano.Wallet.Api.Http.Logging import Prelude import Cardano.BM.Data.Tracer - ( getSeverityAnnotation ) + ( getSeverityAnnotation + ) import Cardano.BM.Tracing - ( HasPrivacyAnnotation, HasSeverityAnnotation, Severity (..) ) + ( HasPrivacyAnnotation + , HasSeverityAnnotation + , Severity (..) + ) import Cardano.Launcher.Node - ( CardanoNodeConn ) + ( CardanoNodeConn + ) import Cardano.Wallet.Api.Http.Shelley.Server - ( ListenError (..) ) + ( ListenError (..) + ) import Data.Text - ( Text ) + ( Text + ) import Data.Text.Class - ( ToText (..) ) + ( ToText (..) + ) import GHC.Generics - ( Generic ) + ( Generic + ) import Network.URI - ( URI, uriToString ) + ( URI + , uriToString + ) import qualified Data.Text as T diff --git a/lib/wallet/api/http/Cardano/Wallet/Api/Http/Server.hs b/lib/wallet/api/http/Cardano/Wallet/Api/Http/Server.hs index 377917eb5d7..19cee07d03f 100644 --- a/lib/wallet/api/http/Cardano/Wallet/Api/Http/Server.hs +++ b/lib/wallet/api/http/Cardano/Wallet/Api/Http/Server.hs @@ -20,11 +20,15 @@ module Cardano.Wallet.Api.Http.Server import Prelude import Cardano.Address - ( unAddress ) + ( unAddress + ) import Cardano.Address.Script - ( prettyErrValidateScript, validateScript ) + ( prettyErrValidateScript + , validateScript + ) import Cardano.Api - ( NetworkId ) + ( NetworkId + ) import Cardano.Pool.Metadata ( HealthCheckSMASH (NoSmashConfigured) , defaultManagerSettings @@ -42,23 +46,35 @@ import Cardano.Wallet , utxoAssumptionsForWallet ) import Cardano.Wallet.Address.Derivation - ( Role (..), delegationAddressS, paymentAddressS ) + ( Role (..) + , delegationAddressS + , paymentAddressS + ) import Cardano.Wallet.Address.Derivation.Icarus - ( IcarusKey (..) ) + ( IcarusKey (..) + ) import Cardano.Wallet.Address.Derivation.Shared - ( SharedKey (..) ) + ( SharedKey (..) + ) import Cardano.Wallet.Address.Derivation.SharedKey - ( constructAddressFromIx ) + ( constructAddressFromIx + ) import Cardano.Wallet.Address.Derivation.Shelley - ( ShelleyKey (..) ) + ( ShelleyKey (..) + ) import Cardano.Wallet.Address.Discovery.Random - ( RndState ) + ( RndState + ) import Cardano.Wallet.Address.Discovery.Sequential - ( SeqState ) + ( SeqState + ) import Cardano.Wallet.Address.Discovery.Shared - ( CredentialType (..), SharedState ) + ( CredentialType (..) + , SharedState + ) import Cardano.Wallet.Address.Encoding - ( inspectAddress ) + ( inspectAddress + ) import Cardano.Wallet.Api ( Addresses , Api @@ -183,49 +199,80 @@ import Cardano.Wallet.Api.Types , SomeByronWalletPostData (..) ) import Cardano.Wallet.Api.Types.BlockHeader - ( ApiBlockHeader ) + ( ApiBlockHeader + ) import Cardano.Wallet.Api.Types.Error - ( ApiErrorInfo (..) ) + ( ApiErrorInfo (..) + ) import Cardano.Wallet.Api.Types.SchemaMetadata - ( TxMetadataSchema (..), parseSimpleMetadataFlag ) + ( TxMetadataSchema (..) + , parseSimpleMetadataFlag + ) import Cardano.Wallet.Flavor - ( WalletFlavorS (..) ) + ( WalletFlavorS (..) + ) import Cardano.Wallet.Pools - ( StakePoolLayer (..) ) + ( StakePoolLayer (..) + ) import Cardano.Wallet.Primitive.NetworkId - ( HasSNetworkId (..), networkIdVal ) + ( HasSNetworkId (..) + , networkIdVal + ) import Cardano.Wallet.Primitive.Types - ( PoolMetadataSource (..), SmashServer (..), poolMetadataSource ) + ( PoolMetadataSource (..) + , SmashServer (..) + , poolMetadataSource + ) import Cardano.Wallet.Shelley.BlockchainSource - ( BlockchainSource (..) ) + ( BlockchainSource (..) + ) import Cardano.Wallet.Shelley.Compatibility - ( rewardAccountFromAddress ) + ( rewardAccountFromAddress + ) import Control.Applicative - ( liftA2 ) + ( liftA2 + ) import Control.Monad - ( when ) + ( when + ) import Control.Monad.IO.Class - ( liftIO ) + ( liftIO + ) import Control.Monad.Trans.Except - ( except, throwE, withExceptT ) + ( except + , throwE + , withExceptT + ) import Data.Coerce - ( coerce ) + ( coerce + ) import Data.Generics.Internal.VL.Lens - ( (^.) ) + ( (^.) + ) import Data.Generics.Labels () import Data.List - ( sortOn ) + ( sortOn + ) import Data.Maybe - ( fromJust ) + ( fromJust + ) import Data.Text.Class - ( TextDecodingError (..) ) + ( TextDecodingError (..) + ) import Network.Ntp - ( NtpClient ) + ( NtpClient + ) import Servant - ( (:<|>) (..), Handler (..), NoContent (..), Server, err400 ) + ( (:<|>) (..) + , Handler (..) + , NoContent (..) + , Server + , err400 + ) import Servant.Server - ( ServerError (..) ) + ( ServerError (..) + ) import qualified Cardano.Address.Derivation as CA import qualified Cardano.Address.Script as CA diff --git a/lib/wallet/api/http/Cardano/Wallet/Api/Http/Server/Error.hs b/lib/wallet/api/http/Cardano/Wallet/Api/Http/Server/Error.hs index 2080cc7bfcf..1377d9f7e2c 100644 --- a/lib/wallet/api/http/Cardano/Wallet/Api/Http/Server/Error.hs +++ b/lib/wallet/api/http/Cardano/Wallet/Api/Http/Server/Error.hs @@ -27,9 +27,11 @@ module Cardano.Wallet.Api.Http.Server.Error import Prelude import Cardano.Address.Script - ( Cosigner (..) ) + ( Cosigner (..) + ) import Cardano.Ledger.Alonzo.TxInfo - ( TranslationError (..) ) + ( TranslationError (..) + ) import Cardano.Wallet ( ErrAddCosignerKey (..) , ErrCannotJoin (..) @@ -74,11 +76,16 @@ import Cardano.Wallet , WalletException (..) ) import Cardano.Wallet.Address.Derivation - ( DerivationType (Hardened, Soft), Index (Index) ) + ( DerivationType (Hardened, Soft) + , Index (Index) + ) import Cardano.Wallet.Address.Discovery.Shared - ( ErrAddCosigner (..), ErrScriptTemplate (..) ) + ( ErrAddCosigner (..) + , ErrScriptTemplate (..) + ) import Cardano.Wallet.Api.Hex - ( hexText ) + ( hexText + ) import Cardano.Wallet.Api.Types ( ApiCosignerIndex (..) , ApiCredentialType (..) @@ -95,15 +102,23 @@ import Cardano.Wallet.Api.Types.Error , ApiErrorTxOutputLovelaceInsufficient (..) ) import Cardano.Wallet.Primitive.Slotting - ( PastHorizonException ) + ( PastHorizonException + ) import Cardano.Wallet.Primitive.Types.TokenMap - ( Flat (..) ) + ( Flat (..) + ) import Cardano.Wallet.Primitive.Types.Tx.SealedTx - ( serialisedTx ) + ( serialisedTx + ) import Cardano.Wallet.Shelley.Compatibility.Ledger - ( Convert (toWallet), toWalletAddress, toWalletCoin, toWalletTokenBundle ) + ( Convert (toWallet) + , toWalletAddress + , toWalletCoin + , toWalletTokenBundle + ) import Cardano.Wallet.Transaction - ( ErrSignTx (..) ) + ( ErrSignTx (..) + ) import Cardano.Write.Tx ( ErrAssignRedeemers (..) , ErrBalanceTx (..) @@ -116,37 +131,65 @@ import Cardano.Write.Tx , ErrUpdateSealedTx (..) ) import Control.Monad.Except - ( ExceptT, lift, withExceptT ) + ( ExceptT + , lift + , withExceptT + ) import Control.Monad.Trans.Except - ( throwE ) + ( throwE + ) import Data.Generics.Internal.VL - ( view, (^.) ) + ( view + , (^.) + ) import Data.IntCast - ( intCast, intCastMaybe ) + ( intCast + , intCastMaybe + ) import Data.List - ( isInfixOf, isPrefixOf, isSubsequenceOf ) + ( isInfixOf + , isPrefixOf + , isSubsequenceOf + ) import Data.Maybe - ( isJust ) + ( isJust + ) import Data.Text - ( Text ) + ( Text + ) import Data.Text.Class - ( ToText (..) ) + ( ToText (..) + ) import Data.Word - ( Word32 ) + ( Word32 + ) import Fmt - ( blockListF', build, fmt, listF, pretty ) + ( blockListF' + , build + , fmt + , listF + , pretty + ) import Internal.Cardano.Write.Tx.Sign - ( KeyWitnessCount (..) ) + ( KeyWitnessCount (..) + ) import Network.HTTP.Media - ( renderHeader ) + ( renderHeader + ) import Network.HTTP.Types - ( hContentType ) + ( hContentType + ) import Network.Wai - ( Request (pathInfo) ) + ( Request (pathInfo) + ) import Safe - ( fromJustNote ) + ( fromJustNote + ) import Servant - ( Accept (contentType), JSON, Proxy (Proxy) ) + ( Accept (contentType) + , JSON + , Proxy (Proxy) + ) import Servant.Server ( Handler (Handler) , ServerError (..) diff --git a/lib/wallet/api/http/Cardano/Wallet/Api/Http/Server/Handlers/MintBurn.hs b/lib/wallet/api/http/Cardano/Wallet/Api/Http/Server/Handlers/MintBurn.hs index 8c36ada695f..0301154933e 100644 --- a/lib/wallet/api/http/Cardano/Wallet/Api/Http/Server/Handlers/MintBurn.hs +++ b/lib/wallet/api/http/Cardano/Wallet/Api/Http/Server/Handlers/MintBurn.hs @@ -12,30 +12,47 @@ module Cardano.Wallet.Api.Http.Server.Handlers.MintBurn where import Prelude hiding - ( (.) ) + ( (.) + ) import Cardano.Wallet - ( WalletLayer, readPolicyPublicKey ) + ( WalletLayer + , readPolicyPublicKey + ) import Cardano.Wallet.Api.Http.Server.Handlers.TxCBOR - ( ParsedTxCBOR (..) ) + ( ParsedTxCBOR (..) + ) import Cardano.Wallet.Api.Types.Key - ( ApiPolicyKey (ApiPolicyKey), computeKeyPayload ) + ( ApiPolicyKey (ApiPolicyKey) + , computeKeyPayload + ) import Cardano.Wallet.Api.Types.MintBurn - ( ApiAssetMintBurn (..), includePolicyKeyInfo, policyIx, toApiTokens ) + ( ApiAssetMintBurn (..) + , includePolicyKeyInfo + , policyIx + , toApiTokens + ) import Cardano.Wallet.Flavor - ( WalletFlavor ) + ( WalletFlavor + ) import Cardano.Wallet.Transaction - ( TokenMapWithScripts (..) ) + ( TokenMapWithScripts (..) + ) import Control.Category - ( (.) ) + ( (.) + ) import Control.Monad.IO.Class - ( MonadIO (liftIO) ) + ( MonadIO (liftIO) + ) import Control.Monad.Trans.Except - ( runExceptT ) + ( runExceptT + ) import Data.Either.Extra - ( eitherToMaybe ) + ( eitherToMaybe + ) import Servant - ( Handler ) + ( Handler + ) -- | Promote mint and burn to their API type. convertApiAssetMintBurn diff --git a/lib/wallet/api/http/Cardano/Wallet/Api/Http/Server/Handlers/TxCBOR.hs b/lib/wallet/api/http/Cardano/Wallet/Api/Http/Server/Handlers/TxCBOR.hs index 950489644f2..d1da7a9b044 100644 --- a/lib/wallet/api/http/Cardano/Wallet/Api/Http/Server/Handlers/TxCBOR.hs +++ b/lib/wallet/api/http/Cardano/Wallet/Api/Http/Server/Handlers/TxCBOR.hs @@ -16,17 +16,26 @@ module Cardano.Wallet.Api.Http.Server.Handlers.TxCBOR import Prelude import Cardano.Binary - ( DecoderError ) + ( DecoderError + ) import Cardano.Wallet.Api.Http.Server.Error - ( IsServerError (..), apiError, liftE, showT ) + ( IsServerError (..) + , apiError + , liftE + , showT + ) import Cardano.Wallet.Api.Types.Error - ( ApiErrorInfo (UnexpectedError) ) + ( ApiErrorInfo (UnexpectedError) + ) import Cardano.Wallet.Primitive.Types - ( Certificate ) + ( Certificate + ) import Cardano.Wallet.Primitive.Types.Hash - ( Hash ) + ( Hash + ) import Cardano.Wallet.Read - ( Tx (..) ) + ( Tx (..) + ) import Cardano.Wallet.Read.Eras ( (:.:) , EraFun (..) @@ -38,31 +47,47 @@ import Cardano.Wallet.Read.Eras , (*.**) ) import Cardano.Wallet.Read.Eras.EraFun - ( EraFunK (..) ) + ( EraFunK (..) + ) import Cardano.Wallet.Read.Tx.CBOR - ( TxCBOR, deserializeTx ) + ( TxCBOR + , deserializeTx + ) import Cardano.Wallet.Read.Tx.Certificates - ( getEraCertificates ) + ( getEraCertificates + ) import Cardano.Wallet.Read.Tx.ExtraSigs - ( getEraExtraSigs ) + ( getEraExtraSigs + ) import Cardano.Wallet.Read.Tx.Integrity - ( getEraIntegrity ) + ( getEraIntegrity + ) import Cardano.Wallet.Read.Tx.Mint - ( getEraMint ) + ( getEraMint + ) import Cardano.Wallet.Read.Tx.ReferenceInputs - ( getEraReferenceInputs ) + ( getEraReferenceInputs + ) import Cardano.Wallet.Read.Tx.Validity - ( getEraValidity ) + ( getEraValidity + ) import Cardano.Wallet.Read.Tx.Witnesses - ( getEraWitnesses ) + ( getEraWitnesses + ) import Cardano.Wallet.Transaction - ( TokenMapWithScripts, ValidityIntervalExplicit ) + ( TokenMapWithScripts + , ValidityIntervalExplicit + ) import Control.Category - ( (<<<) ) + ( (<<<) + ) import GHC.Generics - ( Generic ) + ( Generic + ) import Servant.Server - ( Handler, err500 ) + ( Handler + , err500 + ) import qualified Cardano.Wallet.Read.Primitive.Tx.Features.Certificates as Feature import qualified Cardano.Wallet.Read.Primitive.Tx.Features.ExtraSigs as Feature diff --git a/lib/wallet/api/http/Cardano/Wallet/Api/Http/Server/Tls.hs b/lib/wallet/api/http/Cardano/Wallet/Api/Http/Server/Tls.hs index 1859264adb8..a8c16e96df1 100644 --- a/lib/wallet/api/http/Cardano/Wallet/Api/Http/Server/Tls.hs +++ b/lib/wallet/api/http/Cardano/Wallet/Api/Http/Server/Tls.hs @@ -15,17 +15,28 @@ module Cardano.Wallet.Api.Http.Server.Tls import Prelude import Data.Default - ( Default (..) ) + ( Default (..) + ) import Data.X509 - ( ExtKeyUsagePurpose (..), HashALG (..) ) + ( ExtKeyUsagePurpose (..) + , HashALG (..) + ) import Data.X509.CertificateStore - ( readCertificateStore ) + ( readCertificateStore + ) import Data.X509.Validation - ( ValidationChecks (..), ValidationHooks (..) ) + ( ValidationChecks (..) + , ValidationHooks (..) + ) import Network.TLS - ( CertificateRejectReason (..), CertificateUsage (..), ServerHooks (..) ) + ( CertificateRejectReason (..) + , CertificateUsage (..) + , ServerHooks (..) + ) import Network.Wai.Handler.WarpTLS - ( TLSSettings (..), tlsSettingsChain ) + ( TLSSettings (..) + , tlsSettingsChain + ) import qualified Data.X509.Validation as X509 diff --git a/lib/wallet/api/http/Cardano/Wallet/Api/Http/Shelley/Server.hs b/lib/wallet/api/http/Cardano/Wallet/Api/Http/Shelley/Server.hs index 12b13131cfa..3a76ac91108 100644 --- a/lib/wallet/api/http/Cardano/Wallet/Api/Http/Shelley/Server.hs +++ b/lib/wallet/api/http/Cardano/Wallet/Api/Http/Shelley/Server.hs @@ -139,7 +139,11 @@ module Cardano.Wallet.Api.Http.Shelley.Server import Prelude import Cardano.Address.Derivation - ( XPrv, XPub, xpubPublicKey, xpubToBytes ) + ( XPrv + , XPub + , xpubPublicKey + , xpubToBytes + ) import Cardano.Address.Script ( Cosigner (..) , KeyHash (KeyHash) @@ -151,13 +155,21 @@ import Cardano.Address.Script , validateScriptOfTemplate ) import Cardano.Api - ( NetworkId, SerialiseAsCBOR (..), toNetworkMagic, unNetworkMagic ) + ( NetworkId + , SerialiseAsCBOR (..) + , toNetworkMagic + , unNetworkMagic + ) import Cardano.BM.Tracing - ( HasPrivacyAnnotation (..), HasSeverityAnnotation (..) ) + ( HasPrivacyAnnotation (..) + , HasSeverityAnnotation (..) + ) import Cardano.Mnemonic - ( SomeMnemonic ) + ( SomeMnemonic + ) import Cardano.Pool.Types - ( PoolId ) + ( PoolId + ) import Cardano.Wallet ( BuiltTx (..) , DelegationFee (feePercentiles) @@ -194,7 +206,8 @@ import Cardano.Wallet , utxoAssumptionsForWallet ) import Cardano.Wallet.Address.Book - ( AddressBookIso ) + ( AddressBookIso + ) import Cardano.Wallet.Address.Derivation ( AccountIxForStaking (..) , DelegationAddress (..) @@ -212,15 +225,23 @@ import Cardano.Wallet.Address.Derivation , stakeDerivationPath ) import Cardano.Wallet.Address.Derivation.Byron - ( ByronKey, mkByronKeyFromMasterKey ) + ( ByronKey + , mkByronKeyFromMasterKey + ) import Cardano.Wallet.Address.Derivation.Icarus - ( IcarusKey ) + ( IcarusKey + ) import Cardano.Wallet.Address.Derivation.MintBurn - ( scriptSlotIntervals, withinSlotInterval ) + ( scriptSlotIntervals + , withinSlotInterval + ) import Cardano.Wallet.Address.Derivation.SharedKey - ( SharedKey (..), replaceCosignersWithVerKeys ) + ( SharedKey (..) + , replaceCosignersWithVerKeys + ) import Cardano.Wallet.Address.Derivation.Shelley - ( ShelleyKey ) + ( ShelleyKey + ) import Cardano.Wallet.Address.Discovery ( CompareDiscovery , GenChange (ArgGenChange) @@ -230,7 +251,9 @@ import Cardano.Wallet.Address.Discovery , KnownAddresses ) import Cardano.Wallet.Address.Discovery.Random - ( RndState, mkRndState ) + ( RndState + , mkRndState + ) import Cardano.Wallet.Address.Discovery.Sequential ( DerivationPrefix (..) , SeqState (..) @@ -240,13 +263,20 @@ import Cardano.Wallet.Address.Discovery.Sequential , purposeCIP1852 ) import Cardano.Wallet.Address.Discovery.Shared - ( CredentialType (..), SharedState (..) ) + ( CredentialType (..) + , SharedState (..) + ) import Cardano.Wallet.Address.HasDelegation - ( HasDelegation (..) ) + ( HasDelegation (..) + ) import Cardano.Wallet.Address.Keys.MintBurn - ( replaceCosigner, toTokenMapAndScript, toTokenPolicyId ) + ( replaceCosigner + , toTokenMapAndScript + , toTokenPolicyId + ) import Cardano.Wallet.Address.Keys.SequentialAny - ( mkSeqStateFromRootXPrv ) + ( mkSeqStateFromRootXPrv + ) import Cardano.Wallet.Address.Keys.Shared ( mkSharedStateFromAccountXPub , mkSharedStateFromRootXPrv @@ -254,13 +284,20 @@ import Cardano.Wallet.Address.Keys.Shared , validateScriptTemplates ) import Cardano.Wallet.Address.Keys.WalletKey - ( AfterByron, digest, getRawKey, publicKey ) + ( AfterByron + , digest + , getRawKey + , publicKey + ) import Cardano.Wallet.Address.Keys.WitnessCount - ( toWitnessCountCtx ) + ( toWitnessCountCtx + ) import Cardano.Wallet.Address.MaybeLight - ( MaybeLight (..) ) + ( MaybeLight (..) + ) import Cardano.Wallet.Address.States.IsOwned - ( isOwned ) + ( isOwned + ) import Cardano.Wallet.Api ( ApiLayer (..) , HasDBFactory @@ -273,13 +310,24 @@ import Cardano.Wallet.Api , workerRegistry ) import Cardano.Wallet.Api.Http.Server.Error - ( IsServerError (..), apiError, handler, liftE, liftHandler ) + ( IsServerError (..) + , apiError + , handler + , liftE + , liftHandler + ) import Cardano.Wallet.Api.Http.Server.Handlers.MintBurn - ( convertApiAssetMintBurn, getTxApiAssetMintBurn ) + ( convertApiAssetMintBurn + , getTxApiAssetMintBurn + ) import Cardano.Wallet.Api.Http.Server.Handlers.TxCBOR - ( ParsedTxCBOR (..), parseTxCBOR ) + ( ParsedTxCBOR (..) + , parseTxCBOR + ) import Cardano.Wallet.Api.Http.Server.Tls - ( TlsConfiguration (..), requireClientAuth ) + ( TlsConfiguration (..) + , requireClientAuth + ) import Cardano.Wallet.Api.Types ( AccountPostData (..) , AddressAmount (..) @@ -405,17 +453,26 @@ import Cardano.Wallet.Api.Types , toApiUtxoStatistics ) import Cardano.Wallet.Api.Types.BlockHeader - ( ApiBlockHeader, mkApiBlockHeader ) + ( ApiBlockHeader + , mkApiBlockHeader + ) import Cardano.Wallet.Api.Types.Certificate - ( ApiRewardAccount (..), mkApiAnyCertificate ) + ( ApiRewardAccount (..) + , mkApiAnyCertificate + ) import Cardano.Wallet.Api.Types.Error - ( ApiErrorInfo (..) ) + ( ApiErrorInfo (..) + ) import Cardano.Wallet.Api.Types.Key - ( computeKeyPayload ) + ( computeKeyPayload + ) import Cardano.Wallet.Api.Types.MintBurn - ( noApiAsset ) + ( noApiAsset + ) import Cardano.Wallet.Api.Types.SchemaMetadata - ( TxMetadataSchema (..), TxMetadataWithSchema (TxMetadataWithSchema) ) + ( TxMetadataSchema (..) + , TxMetadataWithSchema (TxMetadataWithSchema) + ) import Cardano.Wallet.Api.Types.Transaction ( ApiAddress (..) , ApiLimit @@ -424,11 +481,17 @@ import Cardano.Wallet.Api.Types.Transaction , mkApiWitnessCount ) import Cardano.Wallet.Balance.Migration - ( MigrationPlan (..) ) + ( MigrationPlan (..) + ) import Cardano.Wallet.Compat - ( (^?) ) + ( (^?) + ) import Cardano.Wallet.DB - ( DBFactory (..), DBFresh, DBLayer, loadDBLayer ) + ( DBFactory (..) + , DBFresh + , DBLayer + , loadDBLayer + ) import Cardano.Wallet.Flavor ( CredFromOf , Excluding @@ -442,11 +505,17 @@ import Cardano.Wallet.Flavor , shelleyOrShared ) import Cardano.Wallet.Network - ( NetworkLayer (..), fetchRewardAccountBalances, timeInterpreter ) + ( NetworkLayer (..) + , fetchRewardAccountBalances + , timeInterpreter + ) import Cardano.Wallet.Pools - ( EpochInfo (..), toEpochInfo ) + ( EpochInfo (..) + , toEpochInfo + ) import Cardano.Wallet.Primitive.Delegation.UTxO - ( stakeKeyCoinDistr ) + ( stakeKeyCoinDistr + ) import Cardano.Wallet.Primitive.Model ( Wallet , availableBalance @@ -457,7 +526,9 @@ import Cardano.Wallet.Primitive.Model , totalUTxO ) import Cardano.Wallet.Primitive.NetworkId - ( HasSNetworkId (..), NetworkDiscriminantCheck ) + ( HasSNetworkId (..) + , NetworkDiscriminantCheck + ) import Cardano.Wallet.Primitive.Passphrase ( Passphrase (..) , PassphraseScheme (..) @@ -482,7 +553,8 @@ import Cardano.Wallet.Primitive.Slotting , unsafeExtendSafeZone ) import Cardano.Wallet.Primitive.SyncProgress - ( SyncProgress (..) ) + ( SyncProgress (..) + ) import Cardano.Wallet.Primitive.Types ( Block , BlockHeader (..) @@ -497,21 +569,35 @@ import Cardano.Wallet.Primitive.Types , WalletMetadata (..) ) import Cardano.Wallet.Primitive.Types.Address - ( Address (..), AddressState (..) ) + ( Address (..) + , AddressState (..) + ) import Cardano.Wallet.Primitive.Types.Coin - ( Coin (..) ) + ( Coin (..) + ) import Cardano.Wallet.Primitive.Types.Credentials - ( ClearCredentials, RootCredentials (..) ) + ( ClearCredentials + , RootCredentials (..) + ) import Cardano.Wallet.Primitive.Types.Hash - ( Hash (..) ) + ( Hash (..) + ) import Cardano.Wallet.Primitive.Types.TokenBundle - ( TokenBundle (..) ) + ( TokenBundle (..) + ) import Cardano.Wallet.Primitive.Types.TokenMap - ( AssetId (..), fromFlatList ) + ( AssetId (..) + , fromFlatList + ) import Cardano.Wallet.Primitive.Types.TokenPolicy - ( TokenName (..), TokenPolicyId (..), nullTokenName, tokenNameMaxLength ) + ( TokenName (..) + , TokenPolicyId (..) + , nullTokenName + , tokenNameMaxLength + ) import Cardano.Wallet.Primitive.Types.TokenQuantity - ( TokenQuantity (..) ) + ( TokenQuantity (..) + ) import Cardano.Wallet.Primitive.Types.Tx ( Tx (..) , TxChange (..) @@ -521,17 +607,23 @@ import Cardano.Wallet.Primitive.Types.Tx , sealedTxFromCardanoBody ) import Cardano.Wallet.Primitive.Types.Tx.Constraints - ( txMintBurnMaxTokenQuantity ) + ( txMintBurnMaxTokenQuantity + ) import Cardano.Wallet.Primitive.Types.Tx.TransactionInfo - ( TransactionInfo ) + ( TransactionInfo + ) import Cardano.Wallet.Primitive.Types.Tx.TxIn - ( TxIn (..) ) + ( TxIn (..) + ) import Cardano.Wallet.Primitive.Types.Tx.TxMeta - ( TxStatus (..) ) + ( TxStatus (..) + ) import Cardano.Wallet.Primitive.Types.Tx.TxOut - ( TxOut (..) ) + ( TxOut (..) + ) import Cardano.Wallet.Read.Tx.CBOR - ( TxCBOR ) + ( TxCBOR + ) import Cardano.Wallet.Registry ( HasWorkerCtx (..) , MkWorker (..) @@ -540,11 +632,15 @@ import Cardano.Wallet.Registry , workerResource ) import Cardano.Wallet.Shelley.Compatibility.Ledger - ( toLedger ) + ( toLedger + ) import Cardano.Wallet.Shelley.Transaction - ( TxWitnessTag ) + ( TxWitnessTag + ) import Cardano.Wallet.TokenMetadata - ( TokenMetadataClient, fillMetadata ) + ( TokenMetadataClient + , fillMetadata + ) import Cardano.Wallet.Transaction ( AnyExplicitScript (..) , DelegationAction (..) @@ -558,57 +654,102 @@ import Cardano.Wallet.Transaction , defaultTransactionCtx ) import Cardano.Wallet.Unsafe - ( unsafeRunExceptT ) + ( unsafeRunExceptT + ) import Control.Arrow - ( second, (&&&) ) + ( second + , (&&&) + ) import Control.DeepSeq - ( NFData ) + ( NFData + ) import Control.Error.Util - ( failWith ) + ( failWith + ) import Control.Monad - ( forM, forever, join, void, when, (>=>) ) + ( forM + , forever + , join + , void + , when + , (>=>) + ) import Control.Monad.Error.Class - ( throwError ) + ( throwError + ) import Control.Monad.IO.Class - ( MonadIO, liftIO ) + ( MonadIO + , liftIO + ) import Control.Monad.Trans.Class - ( lift ) + ( lift + ) import Control.Monad.Trans.Except - ( ExceptT (..), except, runExceptT, throwE, withExceptT ) + ( ExceptT (..) + , except + , runExceptT + , throwE + , withExceptT + ) import Control.Monad.Trans.Maybe - ( MaybeT (..), exceptToMaybeT ) + ( MaybeT (..) + , exceptToMaybeT + ) import Control.Tracer - ( Tracer, contramap ) + ( Tracer + , contramap + ) import Data.Bifunctor - ( first ) + ( first + ) import Data.ByteString - ( ByteString ) + ( ByteString + ) import Data.Coerce - ( coerce ) + ( coerce + ) import Data.Either - ( isLeft, isRight ) + ( isLeft + , isRight + ) import Data.Either.Extra - ( eitherToMaybe ) + ( eitherToMaybe + ) import Data.Function - ( (&) ) + ( (&) + ) import Data.Functor - ( (<&>) ) + ( (<&>) + ) import Data.Functor.Contravariant - ( (>$<) ) + ( (>$<) + ) import Data.Functor.Identity - ( Identity (..) ) + ( Identity (..) + ) import Data.Generics.Internal.VL.Lens - ( Lens', set, view, (.~), (^.) ) + ( Lens' + , set + , view + , (.~) + , (^.) + ) import Data.Generics.Labels () import Data.Generics.Product - ( typed ) + ( typed + ) import Data.List - ( isInfixOf, sortOn, (\\) ) + ( isInfixOf + , sortOn + , (\\) + ) import Data.List.NonEmpty - ( NonEmpty (..) ) + ( NonEmpty (..) + ) import Data.Map.Strict - ( Map ) + ( Map + ) import Data.Maybe ( catMaybes , fromJust @@ -619,51 +760,89 @@ import Data.Maybe , maybeToList ) import Data.Proxy - ( Proxy (..) ) + ( Proxy (..) + ) import Data.Quantity - ( Quantity (..) ) + ( Quantity (..) + ) import Data.Set - ( Set ) + ( Set + ) import Data.Streaming.Network - ( HostPreference, bindPortTCP, bindRandomPortTCP ) + ( HostPreference + , bindPortTCP + , bindRandomPortTCP + ) import Data.Text - ( Text ) + ( Text + ) import Data.Text.Class - ( FromText (..), ToText (..) ) + ( FromText (..) + , ToText (..) + ) import Data.Time - ( UTCTime ) + ( UTCTime + ) import Data.Traversable - ( for ) + ( for + ) import Data.Word - ( Word32 ) + ( Word32 + ) import Fmt - ( pretty ) + ( pretty + ) import GHC.Generics - ( Generic ) + ( Generic + ) import GHC.Stack - ( HasCallStack ) + ( HasCallStack + ) import Internal.Cardano.Write.Tx - ( AnyRecentEra (..) ) + ( AnyRecentEra (..) + ) import Internal.Cardano.Write.Tx.Balance - ( Redeemer (..), UTxOAssumptions (..) ) + ( Redeemer (..) + , UTxOAssumptions (..) + ) import Network.Ntp - ( NtpClient, getNtpStatus ) + ( NtpClient + , getNtpStatus + ) import Network.Socket - ( Socket, close ) + ( Socket + , close + ) import Network.Wai.Handler.Warp - ( Port ) + ( Port + ) import Network.Wai.Middleware.Logging - ( ApiLog (..), newApiLoggerSettings, obfuscateKeys, withApiLogger ) + ( ApiLog (..) + , newApiLoggerSettings + , obfuscateKeys + , withApiLogger + ) import Network.Wai.Middleware.ServerError - ( handleRawError ) + ( handleRawError + ) import Numeric.Natural - ( Natural ) + ( Natural + ) import Servant - ( Application, NoContent (..), err400, err404, err500, serve ) + ( Application + , NoContent (..) + , err400 + , err404 + , err500 + , serve + ) import Servant.Server - ( Handler (..), runHandler ) + ( Handler (..) + , runHandler + ) import System.Exit - ( die ) + ( die + ) import System.IO.Error ( ioeGetErrorType , isAlreadyInUseError @@ -672,13 +851,22 @@ import System.IO.Error , isUserError ) import System.Random - ( getStdRandom, random ) + ( getStdRandom + , random + ) import UnliftIO.Async - ( race_ ) + ( race_ + ) import UnliftIO.Concurrent - ( threadDelay ) + ( threadDelay + ) import UnliftIO.Exception - ( IOException, bracket, throwIO, tryAnyDeep, tryJust ) + ( IOException + , bracket + , throwIO + , tryAnyDeep + , tryJust + ) import qualified Cardano.Address.Script as CA import qualified Cardano.Address.Style.Shelley as CA @@ -696,11 +884,17 @@ import qualified Cardano.Wallet.Primitive.Types as W import qualified Cardano.Wallet.Primitive.Types.Coin as Coin import qualified Cardano.Wallet.Primitive.Types.TokenBundle as TokenBundle import qualified Cardano.Wallet.Primitive.Types.Tx.SealedTx as W - ( SealedTx, sealedTxFromCardano ) + ( SealedTx + , sealedTxFromCardano + ) import qualified Cardano.Wallet.Primitive.Types.Tx.Tx as W - ( TxMetadata, TxScriptValidity ) + ( TxMetadata + , TxScriptValidity + ) import qualified Cardano.Wallet.Primitive.Types.Tx.TxMeta as W - ( Direction (Incoming, Outgoing), TxMeta ) + ( Direction (Incoming, Outgoing) + , TxMeta + ) import qualified Cardano.Wallet.Primitive.Types.Tx.TxOut as TxOut import qualified Cardano.Wallet.Primitive.Types.UTxO as UTxO import qualified Cardano.Wallet.Read as Read diff --git a/lib/wallet/api/http/Cardano/Wallet/Api/Lib/ApiAsArray.hs b/lib/wallet/api/http/Cardano/Wallet/Api/Lib/ApiAsArray.hs index 37c8ea99628..6a32f9ab9c3 100644 --- a/lib/wallet/api/http/Cardano/Wallet/Api/Lib/ApiAsArray.hs +++ b/lib/wallet/api/http/Cardano/Wallet/Api/Lib/ApiAsArray.hs @@ -18,19 +18,29 @@ module Cardano.Wallet.Api.Lib.ApiAsArray (ApiAsArray (..)) where import Prelude import Control.DeepSeq - ( NFData ) + ( NFData + ) import Data.Aeson - ( FromJSON (..), ToJSON (..) ) + ( FromJSON (..) + , ToJSON (..) + ) import Data.Maybe - ( maybeToList ) + ( maybeToList + ) import Data.Typeable - ( Proxy (..), Typeable ) + ( Proxy (..) + , Typeable + ) import GHC.Base - ( Symbol ) + ( Symbol + ) import GHC.Generics - ( Generic ) + ( Generic + ) import GHC.TypeLits - ( KnownSymbol, symbolVal ) + ( KnownSymbol + , symbolVal + ) -- | A wrapper that allows any type to be serialized as a JSON array. -- diff --git a/lib/wallet/api/http/Cardano/Wallet/Api/Lib/ApiT.hs b/lib/wallet/api/http/Cardano/Wallet/Api/Lib/ApiT.hs index ed02499bdf2..0f957dfaccc 100644 --- a/lib/wallet/api/http/Cardano/Wallet/Api/Lib/ApiT.hs +++ b/lib/wallet/api/http/Cardano/Wallet/Api/Lib/ApiT.hs @@ -20,21 +20,31 @@ module Cardano.Wallet.Api.Lib.ApiT import Prelude import Cardano.Wallet.Api.Aeson - ( fromTextJSON, toTextJSON ) + ( fromTextJSON + , toTextJSON + ) import Control.DeepSeq - ( NFData ) + ( NFData + ) import Data.Aeson - ( Value ) + ( Value + ) import Data.Aeson.Types - ( Parser ) + ( Parser + ) import Data.Hashable - ( Hashable ) + ( Hashable + ) import Data.Text.Class - ( FromText, ToText ) + ( FromText + , ToText + ) import GHC.Generics - ( Generic ) + ( Generic + ) import Quiet - ( Quiet (Quiet) ) + ( Quiet (Quiet) + ) -- | Polymorphic wrapper type to put around primitive types and, 3rd party lib -- types to avoid defining orphan instances and/or, undesirable instances on diff --git a/lib/wallet/api/http/Cardano/Wallet/Api/Lib/ExtendedObject.hs b/lib/wallet/api/http/Cardano/Wallet/Api/Lib/ExtendedObject.hs index 740ef21eb55..d30ece2b4ab 100644 --- a/lib/wallet/api/http/Cardano/Wallet/Api/Lib/ExtendedObject.hs +++ b/lib/wallet/api/http/Cardano/Wallet/Api/Lib/ExtendedObject.hs @@ -13,13 +13,22 @@ module Cardano.Wallet.Api.Lib.ExtendedObject import Prelude import Cardano.Wallet.Api.Lib.Options - ( defaultRecordTypeOptions ) + ( defaultRecordTypeOptions + ) import Data.Aeson.Types - ( Parser, Value (..), genericParseJSON, genericToJSON, object, withObject ) + ( Parser + , Value (..) + , genericParseJSON + , genericToJSON + , object + , withObject + ) import Data.Text - ( Text ) + ( Text + ) import GHC.Generics - ( Generic (..) ) + ( Generic (..) + ) import qualified Data.Aeson.Key as Aeson import qualified Data.Aeson.KeyMap as Aeson diff --git a/lib/wallet/api/http/Cardano/Wallet/Api/Lib/Options.hs b/lib/wallet/api/http/Cardano/Wallet/Api/Lib/Options.hs index 996f1399c43..ab0f2bd92af 100644 --- a/lib/wallet/api/http/Cardano/Wallet/Api/Lib/Options.hs +++ b/lib/wallet/api/http/Cardano/Wallet/Api/Lib/Options.hs @@ -35,7 +35,9 @@ import Data.Aeson , genericToJSON ) import GHC.Generics - ( Generic, Rep ) + ( Generic + , Rep + ) import qualified Data.Aeson as Aeson diff --git a/lib/wallet/api/http/Cardano/Wallet/Api/Link.hs b/lib/wallet/api/http/Cardano/Wallet/Api/Link.hs index ace5cc31b27..a35f33c888b 100644 --- a/lib/wallet/api/http/Cardano/Wallet/Api/Link.hs +++ b/lib/wallet/api/http/Cardano/Wallet/Api/Link.hs @@ -124,9 +124,12 @@ module Cardano.Wallet.Api.Link import Prelude import Cardano.Wallet.Address.Derivation - ( DerivationIndex, Role ) + ( DerivationIndex + , Role + ) import Cardano.Wallet.Address.Discovery.Shared - ( CredentialType (..) ) + ( CredentialType (..) + ) import Cardano.Wallet.Api.Types ( ApiAddress (..) , ApiAddressInspectData (..) @@ -139,39 +142,63 @@ import Cardano.Wallet.Api.Types , WalletStyle (..) ) import Cardano.Wallet.Api.Types.SchemaMetadata - ( TxMetadataSchema (..), toSimpleMetadataFlag ) + ( TxMetadataSchema (..) + , toSimpleMetadataFlag + ) import Cardano.Wallet.Api.Types.Transaction - ( ApiLimit ) + ( ApiLimit + ) import Cardano.Wallet.Primitive.NetworkId - ( NetworkDiscriminant (..) ) + ( NetworkDiscriminant (..) + ) import Cardano.Wallet.Primitive.Types - ( SmashServer, SortOrder, WalletId (..) ) + ( SmashServer + , SortOrder + , WalletId (..) + ) import Cardano.Wallet.Primitive.Types.Address - ( Address, AddressState ) + ( Address + , AddressState + ) import Cardano.Wallet.Primitive.Types.Coin - ( Coin (..) ) + ( Coin (..) + ) import Cardano.Wallet.Primitive.Types.Hash - ( Hash ) + ( Hash + ) import Cardano.Wallet.Primitive.Types.TokenPolicy - ( TokenName, TokenPolicyId, nullTokenName ) + ( TokenName + , TokenPolicyId + , nullTokenName + ) import Data.Function - ( (&) ) + ( (&) + ) import Data.Generics.Internal.VL.Lens - ( (^.) ) + ( (^.) + ) import Data.Generics.Product.Typed - ( HasType, typed ) + ( HasType + , typed + ) import Data.Proxy - ( Proxy (..) ) + ( Proxy (..) + ) import Data.Text - ( Text ) + ( Text + ) import GHC.Stack - ( HasCallStack ) + ( HasCallStack + ) import GHC.TypeLits - ( Symbol ) + ( Symbol + ) import Network.HTTP.Types.Method - ( Method ) + ( Method + ) import Numeric.Natural - ( Natural ) + ( Natural + ) import Servant.API ( (:>) , Capture' @@ -185,9 +212,12 @@ import Servant.API , Verb ) import Servant.Links - ( HasLink (..), safeLink' ) + ( HasLink (..) + , safeLink' + ) import Web.HttpApiData - ( ToHttpApiData (..) ) + ( ToHttpApiData (..) + ) import qualified Cardano.Wallet.Api as Api diff --git a/lib/wallet/api/http/Cardano/Wallet/Api/Types.hs b/lib/wallet/api/http/Cardano/Wallet/Api/Types.hs index c2eb4bc22fc..fd0b09efc98 100644 --- a/lib/wallet/api/http/Cardano/Wallet/Api/Types.hs +++ b/lib/wallet/api/http/Cardano/Wallet/Api/Types.hs @@ -252,7 +252,11 @@ module Cardano.Wallet.Api.Types import Prelude import Cardano.Address.Derivation - ( XPrv, XPub, xpubFromBytes, xpubToBytes ) + ( XPrv + , XPub + , xpubFromBytes + , xpubToBytes + ) import Cardano.Address.Script ( Cosigner (..) , KeyHash (..) @@ -277,31 +281,58 @@ import Cardano.Mnemonic , natVals ) import Cardano.Pool.Metadata - ( HealthCheckSMASH, HealthStatusSMASH (..), SMASHPoolId (..) ) + ( HealthCheckSMASH + , HealthStatusSMASH (..) + , SMASHPoolId (..) + ) import Cardano.Pool.Metadata.Types - ( PoolMetadataGCStatus (..), StakePoolMetadata (..) ) + ( PoolMetadataGCStatus (..) + , StakePoolMetadata (..) + ) import Cardano.Pool.Types - ( PoolId (..), decodePoolIdBech32, encodePoolIdBech32 ) + ( PoolId (..) + , decodePoolIdBech32 + , encodePoolIdBech32 + ) import Cardano.Wallet.Address.Derivation - ( Depth (..), DerivationIndex (..), Index (..) ) + ( Depth (..) + , DerivationIndex (..) + , Index (..) + ) import Cardano.Wallet.Address.Discovery.Random - ( RndState ) + ( RndState + ) import Cardano.Wallet.Address.Discovery.Sequential - ( AddressPoolGap, SeqState, getAddressPoolGap ) + ( AddressPoolGap + , SeqState + , getAddressPoolGap + ) import Cardano.Wallet.Address.Discovery.Shared - ( CredentialType (..) ) + ( CredentialType (..) + ) import Cardano.Wallet.Address.Encoding - ( decodeAddress, encodeAddress ) + ( decodeAddress + , encodeAddress + ) import Cardano.Wallet.Api.Aeson - ( eitherToParser ) + ( eitherToParser + ) import Cardano.Wallet.Api.Aeson.Variant - ( variant, variants ) + ( variant + , variants + ) import Cardano.Wallet.Api.Hex - ( fromHexText, hexText ) + ( fromHexText + , hexText + ) import Cardano.Wallet.Api.Lib.ApiAsArray - ( ApiAsArray (..) ) + ( ApiAsArray (..) + ) import Cardano.Wallet.Api.Lib.ApiT - ( ApiT (..), fromTextApiT, toTextApiT ) + ( ApiT (..) + , fromTextApiT + , toTextApiT + ) import Cardano.Wallet.Api.Lib.Options ( DefaultRecord (..) , DefaultSum (..) @@ -330,9 +361,13 @@ import Cardano.Wallet.Api.Types.Key , VerificationKeyHashing (..) ) import Cardano.Wallet.Api.Types.MintBurn - ( ApiAssetMintBurn (..), ApiTokenAmountFingerprint (..), ApiTokens (..) ) + ( ApiAssetMintBurn (..) + , ApiTokenAmountFingerprint (..) + , ApiTokens (..) + ) import Cardano.Wallet.Api.Types.SchemaMetadata - ( TxMetadataWithSchema ) + ( TxMetadataWithSchema + ) import Cardano.Wallet.Api.Types.Transaction ( AddressAmount (..) , ApiAddress (..) @@ -350,13 +385,22 @@ import Cardano.Wallet.Api.Types.Transaction , ResourceContext (..) ) import Cardano.Wallet.Pools - ( EpochInfo, StakePool (..), StakePoolFlag, StakePoolMetrics ) + ( EpochInfo + , StakePool (..) + , StakePoolFlag + , StakePoolMetrics + ) import Cardano.Wallet.Primitive.NetworkId - ( HasSNetworkId (..), NetworkDiscriminant ) + ( HasSNetworkId (..) + , NetworkDiscriminant + ) import Cardano.Wallet.Primitive.Passphrase.Types - ( Passphrase (..), PassphraseHash (..) ) + ( Passphrase (..) + , PassphraseHash (..) + ) import Cardano.Wallet.Primitive.SyncProgress - ( SyncProgress (..) ) + ( SyncProgress (..) + ) import Cardano.Wallet.Primitive.Types ( ActiveSlotCoefficient (..) , EpochLength (..) @@ -376,11 +420,16 @@ import Cardano.Wallet.Primitive.Types , unsafeEpochNo ) import Cardano.Wallet.Primitive.Types.Address - ( Address (..), AddressState (..) ) + ( Address (..) + , AddressState (..) + ) import Cardano.Wallet.Primitive.Types.Hash - ( Hash (..) ) + ( Hash (..) + ) import Cardano.Wallet.Primitive.Types.TokenMap - ( AssetId (..), TokenMap ) + ( AssetId (..) + , TokenMap + ) import Cardano.Wallet.Primitive.Types.Tx ( SealedTx (..) , SerialisedTx (..) @@ -389,27 +438,47 @@ import Cardano.Wallet.Primitive.Types.Tx , sealedTxFromBytes ) import Cardano.Wallet.Primitive.Types.Tx.TxIn - ( TxIn (..) ) + ( TxIn (..) + ) import Cardano.Wallet.Primitive.Types.Tx.TxMeta - ( Direction, TxStatus ) + ( Direction + , TxStatus + ) import Cardano.Wallet.Primitive.Types.UTxOStatistics - ( BoundType, HistogramBar (..), UTxOStatistics (..) ) + ( BoundType + , HistogramBar (..) + , UTxOStatistics (..) + ) import Cardano.Wallet.TokenMetadata - ( TokenMetadataError (..) ) + ( TokenMetadataError (..) + ) import Cardano.Wallet.Transaction - ( ReferenceInput ) + ( ReferenceInput + ) import Cardano.Wallet.Util - ( ShowFmt (..) ) + ( ShowFmt (..) + ) import "cardano-addresses" Codec.Binary.Encoding - ( AbstractEncoding (..), detectEncoding, encode ) + ( AbstractEncoding (..) + , detectEncoding + , encode + ) import Control.Applicative - ( optional, (<|>) ) + ( optional + , (<|>) + ) import Control.Arrow - ( left ) + ( left + ) import Control.DeepSeq - ( NFData (..) ) + ( NFData (..) + ) import Control.Monad - ( guard, when, (<=<), (>=>) ) + ( guard + , when + , (<=<) + , (>=>) + ) import Data.Aeson.Types ( FromJSON (..) , Parser @@ -432,43 +501,70 @@ import Data.Aeson.Types , (.=) ) import Data.Bifunctor - ( bimap, first ) + ( bimap + , first + ) import Data.ByteArray - ( ByteArray, ByteArrayAccess ) + ( ByteArray + , ByteArrayAccess + ) import Data.ByteArray.Encoding - ( Base (..), convertFromBase, convertToBase ) + ( Base (..) + , convertFromBase + , convertToBase + ) import Data.ByteString - ( ByteString ) + ( ByteString + ) import Data.Char - ( toLower ) + ( toLower + ) import Data.Data - ( Data ) + ( Data + ) import Data.Either.Combinators - ( maybeToRight ) + ( maybeToRight + ) import Data.Either.Extra - ( eitherToMaybe, maybeToEither ) + ( eitherToMaybe + , maybeToEither + ) import Data.Function - ( (&) ) + ( (&) + ) import Data.Generics.Internal.VL.Lens - ( view, (^.) ) + ( view + , (^.) + ) import Data.Hashable - ( Hashable ) + ( Hashable + ) import Data.Kind - ( Type ) + ( Type + ) import Data.List - ( intercalate ) + ( intercalate + ) import Data.List.NonEmpty - ( NonEmpty (..) ) + ( NonEmpty (..) + ) import Data.Map.Strict - ( Map ) + ( Map + ) import Data.Proxy - ( Proxy (..) ) + ( Proxy (..) + ) import Data.Quantity - ( Percentage, Quantity (..) ) + ( Percentage + , Quantity (..) + ) import Data.String - ( IsString ) + ( IsString + ) import Data.Text - ( Text, split ) + ( Text + , split + ) import Data.Text.Class ( CaseStyle (..) , FromText (..) @@ -478,35 +574,64 @@ import Data.Text.Class , toTextFromBoundedEnum ) import Data.Time.Clock - ( NominalDiffTime, UTCTime ) + ( NominalDiffTime + , UTCTime + ) import Data.Time.Clock.POSIX - ( posixSecondsToUTCTime, utcTimeToPOSIXSeconds ) + ( posixSecondsToUTCTime + , utcTimeToPOSIXSeconds + ) import Data.Time.Text - ( iso8601, iso8601ExtendedUtc, utcTimeFromText, utcTimeToText ) + ( iso8601 + , iso8601ExtendedUtc + , utcTimeFromText + , utcTimeToText + ) import Data.Traversable - ( for ) + ( for + ) import Data.Typeable - ( Typeable, typeRep ) + ( Typeable + , typeRep + ) import Data.Word - ( Word16, Word32, Word64, Word8 ) + ( Word16 + , Word32 + , Word64 + , Word8 + ) import Data.Word.Odd - ( Word31 ) + ( Word31 + ) import Fmt - ( pretty ) + ( pretty + ) import GHC.Generics - ( Generic ) + ( Generic + ) import GHC.TypeLits - ( Nat, Symbol ) + ( Nat + , Symbol + ) import Network.Ntp - ( NtpStatusWithOffset, NtpSyncingStatus (..) ) + ( NtpStatusWithOffset + , NtpSyncingStatus (..) + ) import Numeric.Natural - ( Natural ) + ( Natural + ) import Quiet - ( Quiet (..) ) + ( Quiet (..) + ) import Servant.API - ( MimeRender (..), MimeUnrender (..), OctetStream ) + ( MimeRender (..) + , MimeUnrender (..) + , OctetStream + ) import Web.HttpApiData - ( FromHttpApiData (..), ToHttpApiData (..) ) + ( FromHttpApiData (..) + , ToHttpApiData (..) + ) import qualified Cardano.Address.Script as CA import qualified Cardano.Crypto.Wallet as CC diff --git a/lib/wallet/api/http/Cardano/Wallet/Api/Types/BlockHeader.hs b/lib/wallet/api/http/Cardano/Wallet/Api/Types/BlockHeader.hs index 639e6164373..f5fe5eaabdb 100644 --- a/lib/wallet/api/http/Cardano/Wallet/Api/Types/BlockHeader.hs +++ b/lib/wallet/api/http/Cardano/Wallet/Api/Types/BlockHeader.hs @@ -16,19 +16,32 @@ module Cardano.Wallet.Api.Types.BlockHeader import Prelude import Cardano.Wallet.Api.Aeson - ( fromTextJSON, toTextJSON ) + ( fromTextJSON + , toTextJSON + ) import Cardano.Wallet.Primitive.Types - ( BlockHeader (..), SlotNo (..) ) + ( BlockHeader (..) + , SlotNo (..) + ) import Cardano.Wallet.Primitive.Types.Hash - ( Hash ) + ( Hash + ) import Data.Aeson - ( FromJSON (parseJSON), ToJSON (toJSON), (.:), (.=) ) + ( FromJSON (parseJSON) + , ToJSON (toJSON) + , (.:) + , (.=) + ) import Data.Binary - ( Word32, Word64 ) + ( Word32 + , Word64 + ) import Data.Quantity - ( Quantity (Quantity) ) + ( Quantity (Quantity) + ) import GHC.Generics - ( Generic ) + ( Generic + ) import qualified Data.Aeson as Aeson diff --git a/lib/wallet/api/http/Cardano/Wallet/Api/Types/Certificate.hs b/lib/wallet/api/http/Cardano/Wallet/Api/Types/Certificate.hs index b27ce2d1c29..225b9f253e0 100644 --- a/lib/wallet/api/http/Cardano/Wallet/Api/Types/Certificate.hs +++ b/lib/wallet/api/http/Cardano/Wallet/Api/Types/Certificate.hs @@ -29,31 +29,48 @@ module Cardano.Wallet.Api.Types.Certificate import Prelude import Cardano.Pool.Metadata.Types - ( StakePoolMetadataHash, StakePoolMetadataUrl ) + ( StakePoolMetadataHash + , StakePoolMetadataUrl + ) import Cardano.Pool.Types - ( PoolId (..), PoolOwner ) + ( PoolId (..) + , PoolOwner + ) import Cardano.Wallet.Address.Derivation - ( DerivationIndex (..) ) + ( DerivationIndex (..) + ) import Cardano.Wallet.Address.Encoding - ( decodeStakeAddress, encodeStakeAddress ) + ( decodeStakeAddress + , encodeStakeAddress + ) import Cardano.Wallet.Api.Aeson - ( eitherToParser ) + ( eitherToParser + ) import Cardano.Wallet.Api.Lib.ApiT - ( ApiT (..) ) + ( ApiT (..) + ) import Cardano.Wallet.Api.Lib.ExtendedObject - ( extendAesonObject, parseExtendedAesonObject ) + ( extendAesonObject + , parseExtendedAesonObject + ) import Cardano.Wallet.Api.Types.Primitive () import Cardano.Wallet.Primitive.NetworkId - ( HasSNetworkId (sNetworkId), NetworkDiscriminant ) + ( HasSNetworkId (sNetworkId) + , NetworkDiscriminant + ) import Cardano.Wallet.Primitive.Types - ( NonWalletCertificate ) + ( NonWalletCertificate + ) import Cardano.Wallet.Primitive.Types.Coin - ( unCoin ) + ( unCoin + ) import Cardano.Wallet.Util - ( ShowFmt (..) ) + ( ShowFmt (..) + ) import Control.DeepSeq - ( NFData ) + ( NFData + ) import Data.Aeson.Types ( FromJSON (parseJSON) , KeyValue ((.=)) @@ -69,15 +86,21 @@ import Data.Aeson.Types , (.:) ) import Data.Bifunctor - ( bimap ) + ( bimap + ) import Data.List.NonEmpty - ( NonEmpty ) + ( NonEmpty + ) import Data.Quantity - ( Percentage, Quantity (..) ) + ( Percentage + , Quantity (..) + ) import GHC.Generics - ( Generic ) + ( Generic + ) import Numeric.Natural - ( Natural ) + ( Natural + ) import qualified Cardano.Wallet.Primitive.Types as W import qualified Cardano.Wallet.Primitive.Types.RewardAccount as W diff --git a/lib/wallet/api/http/Cardano/Wallet/Api/Types/Error.hs b/lib/wallet/api/http/Cardano/Wallet/Api/Types/Error.hs index 60066eb49a7..d3981f7f603 100644 --- a/lib/wallet/api/http/Cardano/Wallet/Api/Types/Error.hs +++ b/lib/wallet/api/http/Cardano/Wallet/Api/Types/Error.hs @@ -31,33 +31,54 @@ module Cardano.Wallet.Api.Types.Error import Prelude import Cardano.Wallet.Api.Lib.Options - ( DefaultRecord (..), defaultSumTypeOptions ) + ( DefaultRecord (..) + , defaultSumTypeOptions + ) import Cardano.Wallet.Api.Types - ( ApiCosignerIndex (..), ApiCredentialType (..), ApiEra ) + ( ApiCosignerIndex (..) + , ApiCredentialType (..) + , ApiEra + ) import Control.DeepSeq - ( NFData (..) ) + ( NFData (..) + ) import Data.Aeson - ( genericParseJSON, genericToJSON ) + ( genericParseJSON + , genericToJSON + ) import Data.Aeson.Extra - ( objectUnion ) + ( objectUnion + ) import Data.Aeson.Types - ( FromJSON (..), Options (..), SumEncoding (..), ToJSON (..) ) + ( FromJSON (..) + , Options (..) + , SumEncoding (..) + , ToJSON (..) + ) import Data.Data - ( Data ) + ( Data + ) import Data.Maybe - ( fromMaybe ) + ( fromMaybe + ) import Data.Quantity - ( Quantity ) + ( Quantity + ) import Data.Text - ( Text ) + ( Text + ) import Data.Typeable - ( Typeable ) + ( Typeable + ) import Data.Word - ( Word32 ) + ( Word32 + ) import GHC.Generics - ( Generic ) + ( Generic + ) import Numeric.Natural - ( Natural ) + ( Natural + ) data ApiError = ApiError { info :: !ApiErrorInfo diff --git a/lib/wallet/api/http/Cardano/Wallet/Api/Types/Key.hs b/lib/wallet/api/http/Cardano/Wallet/Api/Types/Key.hs index 05b4f8ce7fd..6e8f2d54346 100644 --- a/lib/wallet/api/http/Cardano/Wallet/Api/Types/Key.hs +++ b/lib/wallet/api/http/Cardano/Wallet/Api/Types/Key.hs @@ -31,39 +31,64 @@ module Cardano.Wallet.Api.Types.Key import Prelude import Cardano.Address.Derivation - ( XPub, xpubPublicKey ) + ( XPub + , xpubPublicKey + ) import Cardano.Wallet.Address.Derivation - ( Depth (..), DerivationType (..), Index (..), Role (..) ) + ( Depth (..) + , DerivationType (..) + , Index (..) + , Role (..) + ) import Cardano.Wallet.Address.Derivation.SharedKey - ( purposeCIP1854 ) + ( purposeCIP1854 + ) import Cardano.Wallet.Address.Discovery.Sequential - ( purposeCIP1852 ) + ( purposeCIP1852 + ) import Cardano.Wallet.Api.Lib.Options - ( DefaultSum (..) ) + ( DefaultSum (..) + ) import Codec.Binary.Bech32 - ( dataPartFromBytes, dataPartToBytes ) + ( dataPartFromBytes + , dataPartToBytes + ) import Codec.Binary.Bech32.TH - ( humanReadablePart ) + ( humanReadablePart + ) import Control.DeepSeq - ( NFData ) + ( NFData + ) import Crypto.Hash.Extra - ( blake2b224 ) + ( blake2b224 + ) import Data.Aeson.Types - ( FromJSON (..), ToJSON (..) ) + ( FromJSON (..) + , ToJSON (..) + ) import Data.ByteString - ( ByteString ) + ( ByteString + ) import Data.String - ( IsString ) + ( IsString + ) import Data.Text - ( Text ) + ( Text + ) import Data.Text.Class - ( FromText (..), TextDecodingError (TextDecodingError), ToText (..) ) + ( FromText (..) + , TextDecodingError (TextDecodingError) + , ToText (..) + ) import GHC.Generics - ( Generic ) + ( Generic + ) import Servant.API - ( ToHttpApiData ) + ( ToHttpApiData + ) import Web.Internal.HttpApiData - ( ToHttpApiData (..) ) + ( ToHttpApiData (..) + ) import qualified Codec.Binary.Bech32 as Bech32 import qualified Data.Aeson.Types as Aeson diff --git a/lib/wallet/api/http/Cardano/Wallet/Api/Types/MintBurn.hs b/lib/wallet/api/http/Cardano/Wallet/Api/Types/MintBurn.hs index dc97d6b240b..01aa8af61e1 100644 --- a/lib/wallet/api/http/Cardano/Wallet/Api/Types/MintBurn.hs +++ b/lib/wallet/api/http/Cardano/Wallet/Api/Types/MintBurn.hs @@ -22,35 +22,57 @@ module Cardano.Wallet.Api.Types.MintBurn import Prelude import Cardano.Wallet.Address.Derivation - ( Depth (..), DerivationIndex (..), DerivationType (..), Index, getIndex ) + ( Depth (..) + , DerivationIndex (..) + , DerivationType (..) + , Index + , getIndex + ) import Cardano.Wallet.Api.Lib.ApiT - ( ApiT (..) ) + ( ApiT (..) + ) import Cardano.Wallet.Api.Lib.Options - ( DefaultRecord (DefaultRecord) ) + ( DefaultRecord (DefaultRecord) + ) import Cardano.Wallet.Api.Types.Key - ( ApiPolicyKey ) + ( ApiPolicyKey + ) import Cardano.Wallet.Api.Types.Primitive () import Cardano.Wallet.Primitive.Types.TokenMap - ( toNestedList ) + ( toNestedList + ) import Cardano.Wallet.Primitive.Types.TokenPolicy - ( TokenName, TokenPolicyId, mkTokenFingerprint ) + ( TokenName + , TokenPolicyId + , mkTokenFingerprint + ) import Cardano.Wallet.Primitive.Types.TokenQuantity - ( TokenQuantity (unTokenQuantity) ) + ( TokenQuantity (unTokenQuantity) + ) import Cardano.Wallet.Transaction - ( AnyScript, TokenMapWithScripts (..) ) + ( AnyScript + , TokenMapWithScripts (..) + ) import Control.DeepSeq - ( NFData ) + ( NFData + ) import Data.Aeson.Types - ( FromJSON, ToJSON ) + ( FromJSON + , ToJSON + ) import Data.List.NonEmpty - ( NonEmpty ) + ( NonEmpty + ) import Data.Map.Strict - ( Map ) + ( Map + ) import GHC.Generics - ( Generic ) + ( Generic + ) import Numeric.Natural - ( Natural ) + ( Natural + ) import qualified Cardano.Wallet.Primitive.Types.TokenMap as TokenMap import qualified Cardano.Wallet.Primitive.Types.TokenPolicy as W diff --git a/lib/wallet/api/http/Cardano/Wallet/Api/Types/Primitive.hs b/lib/wallet/api/http/Cardano/Wallet/Api/Types/Primitive.hs index 5396a7051b8..41fd2d355a0 100644 --- a/lib/wallet/api/http/Cardano/Wallet/Api/Types/Primitive.hs +++ b/lib/wallet/api/http/Cardano/Wallet/Api/Types/Primitive.hs @@ -17,7 +17,8 @@ module Cardano.Wallet.Api.Types.Primitive () where import Prelude import Cardano.Address.Script - ( ScriptHash (..) ) + ( ScriptHash (..) + ) import Cardano.Api ( TxMetadataJsonSchema (..) , displayError @@ -25,21 +26,38 @@ import Cardano.Api , metadataToJson ) import Cardano.Pool.Metadata.Types - ( StakePoolMetadataHash, StakePoolMetadataUrl ) + ( StakePoolMetadataHash + , StakePoolMetadataUrl + ) import Cardano.Pool.Types - ( PoolId, PoolOwner, decodePoolIdBech32, encodePoolIdBech32 ) + ( PoolId + , PoolOwner + , decodePoolIdBech32 + , encodePoolIdBech32 + ) import Cardano.Wallet.Address.Derivation - ( DerivationIndex ) + ( DerivationIndex + ) import Cardano.Wallet.Api.Aeson - ( eitherToParser ) + ( eitherToParser + ) import Cardano.Wallet.Api.Hex - ( fromHexText, hexText ) + ( fromHexText + , hexText + ) import Cardano.Wallet.Api.Lib.ApiT - ( ApiT (..), fromTextApiT, toTextApiT ) + ( ApiT (..) + , fromTextApiT + , toTextApiT + ) import Cardano.Wallet.Api.Types.Key - ( parseBech32 ) + ( parseBech32 + ) import Cardano.Wallet.Primitive.Passphrase.Types - ( Passphrase (..), PassphraseMaxLength (..), PassphraseMinLength (..) ) + ( Passphrase (..) + , PassphraseMaxLength (..) + , PassphraseMinLength (..) + ) import Cardano.Wallet.Primitive.Types ( EpochNo (..) , NonWalletCertificate (..) @@ -48,15 +66,22 @@ import Cardano.Wallet.Primitive.Types , unsafeEpochNo ) import Cardano.Wallet.Primitive.Types.Coin - ( Coin (..) ) + ( Coin (..) + ) import Cardano.Wallet.Primitive.Types.Hash - ( Hash (..) ) + ( Hash (..) + ) import Cardano.Wallet.Primitive.Types.Tx.Constraints - ( coinIsValidForTxOut, txOutMaxCoin ) + ( coinIsValidForTxOut + , txOutMaxCoin + ) import Cardano.Wallet.Primitive.Types.Tx.Tx - ( TxMetadata (..), TxScriptValidity ) + ( TxMetadata (..) + , TxScriptValidity + ) import Cardano.Wallet.Primitive.Types.Tx.TxIn - ( TxIn (..) ) + ( TxIn (..) + ) import Cardano.Wallet.Transaction ( AnyExplicitScript (..) , AnyScript (..) @@ -65,13 +90,18 @@ import Cardano.Wallet.Transaction , ScriptReference (..) ) import Cardano.Wallet.Util - ( ShowFmt (..) ) + ( ShowFmt (..) + ) import Codec.Binary.Bech32 - ( dataPartFromBytes ) + ( dataPartFromBytes + ) import Codec.Binary.Bech32.TH - ( humanReadablePart ) + ( humanReadablePart + ) import Control.Monad - ( when, (>=>) ) + ( when + , (>=>) + ) import Data.Aeson ( FromJSON (parseJSON) , KeyValue (..) @@ -90,19 +120,29 @@ import Data.Aeson , (.=) ) import Data.Aeson.Types - ( prependFailure ) + ( prependFailure + ) import Data.Bifunctor - ( Bifunctor (..) ) + ( Bifunctor (..) + ) import Data.Quantity - ( Quantity (..) ) + ( Quantity (..) + ) import Data.Text.Class - ( FromText (..), TextDecodingError (..), ToText (..) ) + ( FromText (..) + , TextDecodingError (..) + , ToText (..) + ) import Data.Word - ( Word32, Word64 ) + ( Word32 + , Word64 + ) import Data.Word.Odd - ( Word31 ) + ( Word31 + ) import Numeric.Natural - ( Natural ) + ( Natural + ) import qualified Cardano.Wallet.Primitive.Types as W import qualified Cardano.Wallet.Primitive.Types.Coin as Coin diff --git a/lib/wallet/api/http/Cardano/Wallet/Api/Types/SchemaMetadata.hs b/lib/wallet/api/http/Cardano/Wallet/Api/Types/SchemaMetadata.hs index 19ca44e6e45..edd3b5c6a32 100644 --- a/lib/wallet/api/http/Cardano/Wallet/Api/Types/SchemaMetadata.hs +++ b/lib/wallet/api/http/Cardano/Wallet/Api/Types/SchemaMetadata.hs @@ -23,15 +23,22 @@ import Cardano.Api , metadataToJson ) import Cardano.Wallet.Primitive.Types.Tx - ( TxMetadata ) + ( TxMetadata + ) import Control.Applicative - ( liftA2, (<|>) ) + ( liftA2 + , (<|>) + ) import Control.DeepSeq - ( NFData ) + ( NFData + ) import Data.Aeson - ( FromJSON (parseJSON), ToJSON (toJSON) ) + ( FromJSON (parseJSON) + , ToJSON (toJSON) + ) import GHC.Generics - ( Generic ) + ( Generic + ) import Prelude -- | A tag to select the json codec diff --git a/lib/wallet/api/http/Cardano/Wallet/Api/Types/Transaction.hs b/lib/wallet/api/http/Cardano/Wallet/Api/Types/Transaction.hs index 7667ed0da64..f6fc10880b7 100644 --- a/lib/wallet/api/http/Cardano/Wallet/Api/Types/Transaction.hs +++ b/lib/wallet/api/http/Cardano/Wallet/Api/Types/Transaction.hs @@ -39,48 +39,72 @@ module Cardano.Wallet.Api.Types.Transaction import Prelude import Cardano.Wallet.Address.Derivation - ( DerivationIndex (..) ) + ( DerivationIndex (..) + ) import Cardano.Wallet.Address.Encoding - ( decodeAddress, encodeAddress ) + ( decodeAddress + , encodeAddress + ) import Cardano.Wallet.Api.Aeson - ( eitherToParser ) + ( eitherToParser + ) import Cardano.Wallet.Api.Lib.ApiAsArray - ( ApiAsArray ) + ( ApiAsArray + ) import Cardano.Wallet.Api.Lib.ApiT - ( ApiT (ApiT) ) + ( ApiT (ApiT) + ) import Cardano.Wallet.Api.Lib.Options - ( DefaultRecord (..) ) + ( DefaultRecord (..) + ) import Cardano.Wallet.Api.Types.Certificate - ( ApiAnyCertificate, ApiRewardAccount ) + ( ApiAnyCertificate + , ApiRewardAccount + ) import Cardano.Wallet.Api.Types.MintBurn - ( ApiAssetMintBurn ) + ( ApiAssetMintBurn + ) import Cardano.Wallet.Api.Types.Primitive () import Cardano.Wallet.Primitive.NetworkId - ( HasSNetworkId (..), NetworkDiscriminant ) + ( HasSNetworkId (..) + , NetworkDiscriminant + ) import Cardano.Wallet.Primitive.Passphrase.Types - ( Passphrase (..) ) + ( Passphrase (..) + ) import Cardano.Wallet.Primitive.Types.Address - ( Address (..) ) + ( Address (..) + ) import Cardano.Wallet.Primitive.Types.Coin - ( Coin (unCoin) ) + ( Coin (unCoin) + ) import Cardano.Wallet.Primitive.Types.Hash - ( Hash (..) ) + ( Hash (..) + ) import Cardano.Wallet.Primitive.Types.Tx.Constraints - ( coinIsValidForTxOut, txOutMaxCoin ) + ( coinIsValidForTxOut + , txOutMaxCoin + ) import Cardano.Wallet.Primitive.Types.Tx.Tx - ( TxMetadata (..), TxScriptValidity, txMetadataIsNull ) + ( TxMetadata (..) + , TxScriptValidity + , txMetadataIsNull + ) import Cardano.Wallet.Primitive.Types.Tx.TxIn - ( TxIn (..) ) + ( TxIn (..) + ) import Cardano.Wallet.Transaction ( AnyExplicitScript (..) , ValidityIntervalExplicit (..) , WitnessCount (..) ) import Cardano.Wallet.Util - ( ShowFmt (..) ) + ( ShowFmt (..) + ) import Control.DeepSeq - ( NFData ) + ( NFData + ) import Data.Aeson.Types ( FromJSON (..) , KeyValue (..) @@ -94,29 +118,43 @@ import Data.Aeson.Types , (.:?) ) import Data.Bifunctor - ( first ) + ( first + ) import Data.Hashable - ( Hashable ) + ( Hashable + ) import Data.List.NonEmpty - ( NonEmpty ) + ( NonEmpty + ) import Data.Quantity - ( Quantity (..) ) + ( Quantity (..) + ) import Data.Text - ( Text ) + ( Text + ) import Data.Text.Class - ( toText ) + ( toText + ) import Data.Typeable - ( Typeable ) + ( Typeable + ) import Data.Word - ( Word32, Word8 ) + ( Word32 + , Word8 + ) import GHC.Generics - ( Generic ) + ( Generic + ) import Numeric.Natural - ( Natural ) + ( Natural + ) import Quiet - ( Quiet (Quiet) ) + ( Quiet (Quiet) + ) import Servant - ( FromHttpApiData (..), ToHttpApiData (..) ) + ( FromHttpApiData (..) + , ToHttpApiData (..) + ) import qualified Cardano.Wallet.Primitive.Types.Coin as Coin import qualified Cardano.Wallet.Primitive.Types.TokenMap as W diff --git a/lib/wallet/api/http/Cardano/Wallet/Shelley.hs b/lib/wallet/api/http/Cardano/Wallet/Shelley.hs index cd52814c379..336c3aa436d 100644 --- a/lib/wallet/api/http/Cardano/Wallet/Shelley.hs +++ b/lib/wallet/api/http/Cardano/Wallet/Shelley.hs @@ -28,29 +28,42 @@ module Cardano.Wallet.Shelley import Prelude import Cardano.Wallet - ( WalletException ) + ( WalletException + ) import Cardano.Wallet.Address.Derivation.Icarus - ( IcarusKey ) + ( IcarusKey + ) import Cardano.Wallet.Address.Derivation.SharedKey - ( SharedKey ) + ( SharedKey + ) import Cardano.Wallet.Address.Derivation.Shelley - ( ShelleyKey ) + ( ShelleyKey + ) import Cardano.Wallet.Address.Discovery - ( IsOurs ) + ( IsOurs + ) import Cardano.Wallet.Address.Discovery.Random - ( RndState ) + ( RndState + ) import Cardano.Wallet.Address.Discovery.Sequential - ( SeqState ) + ( SeqState + ) import Cardano.Wallet.Address.Discovery.Shared - ( SharedState ) + ( SharedState + ) import Cardano.Wallet.Address.MaybeLight - ( MaybeLight ) + ( MaybeLight + ) import Cardano.Wallet.Api - ( ApiLayer, ApiV2 ) + ( ApiLayer + , ApiV2 + ) import Cardano.Wallet.Api.Http.Logging - ( ApplicationLog (..) ) + ( ApplicationLog (..) + ) import Cardano.Wallet.Api.Http.Server - ( server ) + ( server + ) import Cardano.Wallet.Api.Http.Shelley.Server ( HostPreference , Listen (..) @@ -59,15 +72,25 @@ import Cardano.Wallet.Api.Http.Shelley.Server , toServerError ) import Cardano.Wallet.DB.Layer - ( PersistAddressBook ) + ( PersistAddressBook + ) import Cardano.Wallet.DB.Sqlite.Migration.Old - ( DefaultFieldValues (..) ) + ( DefaultFieldValues (..) + ) import Cardano.Wallet.Flavor - ( CredFromOf, KeyFlavorS (..), KeyOf, WalletFlavor (..) ) + ( CredFromOf + , KeyFlavorS (..) + , KeyOf + , WalletFlavor (..) + ) import Cardano.Wallet.Network - ( NetworkLayer (..) ) + ( NetworkLayer (..) + ) import Cardano.Wallet.Pools - ( StakePoolLayer (..), withNodeStakePoolLayer, withStakePoolDbLayer ) + ( StakePoolLayer (..) + , withNodeStakePoolLayer + , withStakePoolDbLayer + ) import Cardano.Wallet.Primitive.NetworkId ( HasSNetworkId , NetworkId @@ -77,7 +100,8 @@ import Cardano.Wallet.Primitive.NetworkId , withSNetworkId ) import Cardano.Wallet.Primitive.Slotting - ( neverFails ) + ( neverFails + ) import Cardano.Wallet.Primitive.Types ( Block , NetworkParameters (..) @@ -89,25 +113,36 @@ import Cardano.Wallet.Primitive.Types , WalletId ) import Cardano.Wallet.Primitive.Types.Address - ( Address ) + ( Address + ) import Cardano.Wallet.Primitive.Types.Coin - ( Coin (..) ) + ( Coin (..) + ) import Cardano.Wallet.Primitive.Types.RewardAccount - ( RewardAccount ) + ( RewardAccount + ) import Cardano.Wallet.Primitive.Types.Tx.SealedTx - ( SealedTx ) + ( SealedTx + ) import Cardano.Wallet.Registry - ( HasWorkerCtx (..) ) + ( HasWorkerCtx (..) + ) import Cardano.Wallet.Shelley.BlockchainSource - ( BlockchainSource (..) ) + ( BlockchainSource (..) + ) import Cardano.Wallet.Shelley.Compatibility - ( CardanoBlock, StandardCrypto ) + ( CardanoBlock + , StandardCrypto + ) import Cardano.Wallet.Shelley.Network - ( withNetworkLayer ) + ( withNetworkLayer + ) import Cardano.Wallet.Shelley.Transaction - ( newTransactionLayer ) + ( newTransactionLayer + ) import Cardano.Wallet.TokenMetadata - ( newMetadataClient ) + ( newMetadataClient + ) import Cardano.Wallet.Tracers as Tracers ( TracerSeverities , Tracers @@ -119,43 +154,68 @@ import Cardano.Wallet.Tracers as Tracers , tracerSeverities ) import Cardano.Wallet.Transaction - ( TransactionLayer ) + ( TransactionLayer + ) import Control.Exception.Extra - ( handle ) + ( handle + ) import Control.Monad.Trans.Class - ( lift ) + ( lift + ) import Control.Monad.Trans.Cont - ( ContT (ContT), evalContT ) + ( ContT (ContT) + , evalContT + ) import Control.Monad.Trans.Except - ( ExceptT (ExceptT) ) + ( ExceptT (ExceptT) + ) import Control.Tracer - ( Tracer, traceWith ) + ( Tracer + , traceWith + ) import Data.Function - ( (&) ) + ( (&) + ) import Data.Generics.Internal.VL - ( view ) + ( view + ) import Data.Generics.Product - ( typed ) + ( typed + ) import Data.Maybe - ( fromJust ) + ( fromJust + ) import Data.Proxy - ( Proxy (..) ) + ( Proxy (..) + ) import Data.Typeable - ( Typeable ) + ( Typeable + ) import Network.Ntp - ( NtpClient (..), NtpTrace, withWalletNtpClient ) + ( NtpClient (..) + , NtpTrace + , withWalletNtpClient + ) import Network.Socket - ( Socket, getSocketName ) + ( Socket + , getSocketName + ) import Network.URI - ( URI (..), parseURI ) + ( URI (..) + , parseURI + ) import Network.Wai.Handler.Warp - ( setBeforeMainLoop ) + ( setBeforeMainLoop + ) import Ouroboros.Network.Client.Wallet - ( PipeliningStrategy ) + ( PipeliningStrategy + ) import System.Exit - ( ExitCode (..) ) + ( ExitCode (..) + ) import System.IOManager - ( withIOManager ) + ( withIOManager + ) import qualified Cardano.Pool.DB.Sqlite as Pool import qualified Cardano.Wallet.Api.Http.Shelley.Server as Server diff --git a/lib/wallet/api/http/Cardano/Wallet/Tracers.hs b/lib/wallet/api/http/Cardano/Wallet/Tracers.hs index 9d2b6287c38..f469b22746b 100644 --- a/lib/wallet/api/http/Cardano/Wallet/Tracers.hs +++ b/lib/wallet/api/http/Cardano/Wallet/Tracers.hs @@ -22,35 +22,56 @@ module Cardano.Wallet.Tracers import Prelude import Cardano.BM.Data.Tracer - ( HasPrivacyAnnotation, HasSeverityAnnotation, filterSeverity ) + ( HasPrivacyAnnotation + , HasSeverityAnnotation + , filterSeverity + ) import Cardano.BM.Extra - ( trMessageText ) + ( trMessageText + ) import Cardano.BM.Tracing - ( Severity (..), Trace, Tracer, appendName, nullTracer ) + ( Severity (..) + , Trace + , Tracer + , appendName + , nullTracer + ) import Cardano.Pool.DB.Log - ( PoolDbLog ) + ( PoolDbLog + ) import Cardano.Wallet.Api.Http.Logging - ( ApplicationLog ) + ( ApplicationLog + ) import Cardano.Wallet.Api.Http.Shelley.Server - ( WalletEngineLog ) + ( WalletEngineLog + ) import Cardano.Wallet.DB.Layer - ( DBFactoryLog ) + ( DBFactoryLog + ) import Cardano.Wallet.Pools - ( StakePoolLog ) + ( StakePoolLog + ) import Cardano.Wallet.Shelley.Network - ( NetworkLayerLog ) + ( NetworkLayerLog + ) import Cardano.Wallet.TokenMetadata - ( TokenMetadataLog ) + ( TokenMetadataLog + ) import Control.Applicative - ( Const (..) ) + ( Const (..) + ) import Data.Text - ( Text ) + ( Text + ) import Data.Text.Class - ( ToText ) + ( ToText + ) import Network.NTP.Client - ( NtpTrace ) + ( NtpTrace + ) import Network.Wai.Middleware.Logging - ( ApiLog ) + ( ApiLog + ) import qualified Data.Text as T diff --git a/lib/wallet/bench/api-bench.hs b/lib/wallet/bench/api-bench.hs index 212cc68049a..c52346ac6e6 100644 --- a/lib/wallet/bench/api-bench.hs +++ b/lib/wallet/bench/api-bench.hs @@ -41,31 +41,50 @@ module Main where import Prelude import Cardano.BM.Data.Severity - ( Severity (..) ) + ( Severity (..) + ) import Cardano.BM.Extra - ( trMessageText ) + ( trMessageText + ) import Cardano.BM.Trace - ( Trace ) + ( Trace + ) import Cardano.Wallet - ( WalletLayer (..), readWalletMeta ) + ( WalletLayer (..) + , readWalletMeta + ) import Cardano.Wallet.Address.Derivation - ( DelegationAddress (..), Depth (..), delegationAddressS ) + ( DelegationAddress (..) + , Depth (..) + , delegationAddressS + ) import Cardano.Wallet.Address.Derivation.Shared - ( SharedKey ) + ( SharedKey + ) import Cardano.Wallet.Address.Derivation.Shelley - ( ShelleyKey ) + ( ShelleyKey + ) import Cardano.Wallet.Address.Discovery.Random - ( RndState (..) ) + ( RndState (..) + ) import Cardano.Wallet.Address.Discovery.Sequential - ( SeqState (..) ) + ( SeqState (..) + ) import Cardano.Wallet.Address.Discovery.Shared - ( SharedState (..) ) + ( SharedState (..) + ) import Cardano.Wallet.BenchShared - ( Time, bench, initBenchmarkLogging, runBenchmarks ) + ( Time + , bench + , initBenchmarkLogging + , runBenchmarks + ) import Cardano.Wallet.DB - ( DBFresh (..) ) + ( DBFresh (..) + ) import Cardano.Wallet.DB.Layer - ( PersistAddressBook ) + ( PersistAddressBook + ) import Cardano.Wallet.DummyTarget.Primitive.Types ( dummyNetworkLayer , dummyProtocolParameters @@ -73,11 +92,17 @@ import Cardano.Wallet.DummyTarget.Primitive.Types , dummyTimeInterpreter ) import Cardano.Wallet.Flavor - ( KeyFlavor, KeyOf, WalletFlavor (..), keyFlavor ) + ( KeyFlavor + , KeyOf + , WalletFlavor (..) + , keyFlavor + ) import Cardano.Wallet.Network - ( NetworkLayer (..) ) + ( NetworkLayer (..) + ) import Cardano.Wallet.Primitive.Model - ( totalUTxO ) + ( totalUTxO + ) import Cardano.Wallet.Primitive.NetworkId ( HasSNetworkId (..) , NetworkDiscriminant (..) @@ -87,37 +112,65 @@ import Cardano.Wallet.Primitive.NetworkId , withSNetworkId ) import Cardano.Wallet.Primitive.Slotting - ( TimeInterpreter, hoistTimeInterpreter ) + ( TimeInterpreter + , hoistTimeInterpreter + ) import Cardano.Wallet.Primitive.Types - ( SortOrder (..), WalletId, WalletMetadata (..) ) + ( SortOrder (..) + , WalletId + , WalletMetadata (..) + ) import Cardano.Wallet.Primitive.Types.Coin - ( Coin (..) ) + ( Coin (..) + ) import Cardano.Wallet.Primitive.Types.UTxOStatistics - ( HistogramBar (..), UTxOStatistics (..) ) + ( HistogramBar (..) + , UTxOStatistics (..) + ) import Cardano.Wallet.Shelley.Transaction - ( newTransactionLayer ) + ( newTransactionLayer + ) import Cardano.Wallet.Unsafe - ( unsafeRunExceptT ) + ( unsafeRunExceptT + ) import Control.Monad - ( forM ) + ( forM + ) import Control.Monad.IO.Class - ( liftIO ) + ( liftIO + ) import Data.Aeson - ( ToJSON (..), genericToJSON, (.=) ) + ( ToJSON (..) + , genericToJSON + , (.=) + ) import Data.Quantity - ( Quantity (..) ) + ( Quantity (..) + ) import Data.Text - ( Text ) + ( Text + ) import Fmt - ( Buildable, Builder, blockListF', build, genericF, nameF, pretty ) + ( Buildable + , Builder + , blockListF' + , build + , genericF + , nameF + , pretty + ) import GHC.Generics - ( Generic ) + ( Generic + ) import Main.Utf8 - ( withUtf8 ) + ( withUtf8 + ) import Numeric.Natural - ( Natural ) + ( Natural + ) import Say - ( sayErr ) + ( sayErr + ) import qualified Cardano.Api as Cardano import qualified Cardano.Wallet as W diff --git a/lib/wallet/bench/db-bench.hs b/lib/wallet/bench/db-bench.hs index 2f01066859b..901796adb79 100644 --- a/lib/wallet/bench/db-bench.hs +++ b/lib/wallet/bench/db-bench.hs @@ -49,33 +49,59 @@ module Main where import Prelude import Cardano.Address.Derivation - ( XPub, xpubFromBytes ) + ( XPub + , xpubFromBytes + ) import Cardano.BM.Configuration.Static - ( defaultConfigStdout ) + ( defaultConfigStdout + ) import Cardano.BM.Data.Severity - ( Severity (..) ) + ( Severity (..) + ) import Cardano.BM.Data.Trace - ( Trace ) + ( Trace + ) import Cardano.BM.Data.Tracer - ( Tracer, filterSeverity ) + ( Tracer + , filterSeverity + ) import Cardano.BM.Extra - ( trMessageText ) + ( trMessageText + ) import Cardano.BM.Setup - ( setupTrace_, shutdown ) + ( setupTrace_ + , shutdown + ) import Cardano.DB.Sqlite - ( SqliteContext (..) ) + ( SqliteContext (..) + ) import Cardano.Mnemonic - ( EntropySize, SomeMnemonic (..), entropyToMnemonic, genEntropy ) + ( EntropySize + , SomeMnemonic (..) + , entropyToMnemonic + , genEntropy + ) import Cardano.Wallet - ( putWalletCheckpoints ) + ( putWalletCheckpoints + ) import Cardano.Wallet.Address.Derivation - ( DelegationAddress (..), Depth (..), Index (..), PaymentAddress (..) ) + ( DelegationAddress (..) + , Depth (..) + , Index (..) + , PaymentAddress (..) + ) import Cardano.Wallet.Address.Derivation.Byron - ( ByronKey (..) ) + ( ByronKey (..) + ) import Cardano.Wallet.Address.Derivation.Shelley - ( ShelleyKey (..), generateKeyFromSeed, unsafeGenerateKeyFromSeed ) + ( ShelleyKey (..) + , generateKeyFromSeed + , unsafeGenerateKeyFromSeed + ) import Cardano.Wallet.Address.Discovery.Random - ( RndState (..), mkRndState ) + ( RndState (..) + , mkRndState + ) import Cardano.Wallet.Address.Discovery.Sequential ( DerivationPrefix (..) , SeqAddressPool (..) @@ -86,13 +112,19 @@ import Cardano.Wallet.Address.Discovery.Sequential , purposeCIP1852 ) import Cardano.Wallet.Address.Keys.SequentialAny - ( mkSeqStateFromRootXPrv ) + ( mkSeqStateFromRootXPrv + ) import Cardano.Wallet.Address.Keys.WalletKey - ( publicKey ) + ( publicKey + ) import Cardano.Wallet.BenchShared - ( withTempSqliteFile ) + ( withTempSqliteFile + ) import Cardano.Wallet.DB - ( DBFresh (..), DBLayer (..), DBLayerParams (..) ) + ( DBFresh (..) + , DBLayer (..) + , DBLayerParams (..) + ) import Cardano.Wallet.DB.Layer ( DefaultFieldValues (..) , PersistAddressBook @@ -100,17 +132,31 @@ import Cardano.Wallet.DB.Layer , withDBFresh ) import Cardano.Wallet.DummyTarget.Primitive.Types - ( block0, dummyGenesisParameters, mkTxId ) + ( block0 + , dummyGenesisParameters + , mkTxId + ) import Cardano.Wallet.Flavor - ( KeyFlavorS (..), WalletFlavor (..) ) + ( KeyFlavorS (..) + , WalletFlavor (..) + ) import Cardano.Wallet.Primitive.Model - ( Wallet, initWallet, unsafeInitWallet ) + ( Wallet + , initWallet + , unsafeInitWallet + ) import Cardano.Wallet.Primitive.NetworkId - ( NetworkDiscriminant (..), SNetworkId (..) ) + ( NetworkDiscriminant (..) + , SNetworkId (..) + ) import Cardano.Wallet.Primitive.Passphrase - ( Passphrase (..) ) + ( Passphrase (..) + ) import Cardano.Wallet.Primitive.Slotting - ( TimeInterpreter, hoistTimeInterpreter, mkSingleEraInterpreter ) + ( TimeInterpreter + , hoistTimeInterpreter + , mkSingleEraInterpreter + ) import Cardano.Wallet.Primitive.Types ( ActiveSlotCoefficient (..) , Block (..) @@ -127,35 +173,55 @@ import Cardano.Wallet.Primitive.Types , WalletName (..) ) import Cardano.Wallet.Primitive.Types.Address - ( Address (..), AddressState (..) ) + ( Address (..) + , AddressState (..) + ) import Cardano.Wallet.Primitive.Types.Coin - ( Coin (..) ) + ( Coin (..) + ) import Cardano.Wallet.Primitive.Types.Credentials - ( RootCredentials (..) ) + ( RootCredentials (..) + ) import Cardano.Wallet.Primitive.Types.Hash - ( Hash (..) ) + ( Hash (..) + ) import Cardano.Wallet.Primitive.Types.TokenPolicy - ( TokenName (..) ) + ( TokenName (..) + ) import Cardano.Wallet.Primitive.Types.TokenQuantity - ( TokenQuantity (..) ) + ( TokenQuantity (..) + ) import Cardano.Wallet.Primitive.Types.Tx - ( Tx (..) ) + ( Tx (..) + ) import Cardano.Wallet.Primitive.Types.Tx.TransactionInfo - ( TransactionInfo ) + ( TransactionInfo + ) import Cardano.Wallet.Primitive.Types.Tx.TxIn - ( TxIn (..) ) + ( TxIn (..) + ) import Cardano.Wallet.Primitive.Types.Tx.TxMeta - ( Direction (..), TxMeta (..), TxStatus (..) ) + ( Direction (..) + , TxMeta (..) + , TxStatus (..) + ) import Cardano.Wallet.Primitive.Types.Tx.TxOut - ( TxOut (..) ) + ( TxOut (..) + ) import Cardano.Wallet.Primitive.Types.UTxO - ( UTxO (..) ) + ( UTxO (..) + ) import Cardano.Wallet.Unsafe - ( someDummyMnemonic, unsafeRunExceptT ) + ( someDummyMnemonic + , unsafeRunExceptT + ) import Control.DeepSeq - ( NFData (..), force ) + ( NFData (..) + , force + ) import Control.Monad - ( join ) + ( join + ) import Criterion.Main ( Benchmark , Benchmarkable @@ -165,51 +231,82 @@ import Criterion.Main , perRunEnvWithCleanup ) import Crypto.Hash - ( hash ) + ( hash + ) import Data.ByteString - ( ByteString ) + ( ByteString + ) import Data.Either - ( fromRight ) + ( fromRight + ) import Data.Functor - ( (<&>) ) + ( (<&>) + ) import Data.Functor.Identity - ( Identity (..) ) + ( Identity (..) + ) import Data.List - ( foldl' ) + ( foldl' + ) import Data.Maybe - ( fromMaybe ) + ( fromMaybe + ) import Data.Proxy - ( Proxy (..) ) + ( Proxy (..) + ) import Data.Quantity - ( Quantity (..) ) + ( Quantity (..) + ) import Data.Text - ( Text ) + ( Text + ) import Data.Text.Class - ( fromText ) + ( fromText + ) import Data.Time.Clock.POSIX - ( posixSecondsToUTCTime ) + ( posixSecondsToUTCTime + ) import Data.Time.Clock.System - ( SystemTime (..), systemToUTCTime ) + ( SystemTime (..) + , systemToUTCTime + ) import Data.Word - ( Word64 ) + ( Word64 + ) import Fmt - ( build, padLeftF, padRightF, pretty, (+|), (|+) ) + ( build + , padLeftF + , padRightF + , pretty + , (+|) + , (|+) + ) import GHC.Num - ( Natural ) + ( Natural + ) import Main.Utf8 - ( withUtf8 ) + ( withUtf8 + ) import System.Directory - ( doesFileExist, getFileSize ) + ( doesFileExist + , getFileSize + ) import System.FilePath - ( takeFileName ) + ( takeFileName + ) import System.IO.Unsafe - ( unsafePerformIO ) + ( unsafePerformIO + ) import System.Random - ( mkStdGen, randoms ) + ( mkStdGen + , randoms + ) import Test.Utils.Resource - ( unBracket ) + ( unBracket + ) import UnliftIO.Exception - ( bracket ) + ( bracket + ) import qualified Cardano.BM.Configuration.Model as CM import qualified Cardano.BM.Data.BackendKind as CM diff --git a/lib/wallet/bench/latency-bench.hs b/lib/wallet/bench/latency-bench.hs index 65aee4244cb..5900e210099 100644 --- a/lib/wallet/bench/latency-bench.hs +++ b/lib/wallet/bench/latency-bench.hs @@ -15,23 +15,35 @@ module Main where import Prelude import Cardano.Address - ( Address ) + ( Address + ) import Cardano.BM.Data.LogItem - ( LogObject ) + ( LogObject + ) import Cardano.BM.Data.Severity - ( Severity (..) ) + ( Severity (..) + ) import Cardano.BM.Data.Tracer - ( contramap, nullTracer ) + ( contramap + , nullTracer + ) import Cardano.BM.Extra - ( trMessage ) + ( trMessage + ) import Cardano.BM.Trace - ( traceInTVarIO ) + ( traceInTVarIO + ) import Cardano.CLI - ( Port (..) ) + ( Port (..) + ) import Cardano.Mnemonic - ( Mnemonic, SomeMnemonic (..), mnemonicToText ) + ( Mnemonic + , SomeMnemonic (..) + , mnemonicToText + ) import Cardano.Wallet.Api.Http.Shelley.Server - ( Listen (ListenOnRandomPort) ) + ( Listen (ListenOnRandomPort) + ) import Cardano.Wallet.Api.Types ( ApiAddressWithPath , ApiAsset (..) @@ -53,9 +65,15 @@ import Cardano.Wallet.Faucet , shelleyIntegrationTestFunds ) import Cardano.Wallet.Faucet.Shelley - ( initFaucet ) + ( initFaucet + ) import Cardano.Wallet.LatencyBenchShared - ( LogCaptureFunc, fmtResult, fmtTitle, measureApiLogs, withLatencyLogging ) + ( LogCaptureFunc + , fmtResult + , fmtTitle + , measureApiLogs + , withLatencyLogging + ) import Cardano.Wallet.Launch.Cluster ( FaucetFunds (..) , LogFileConfig (..) @@ -64,41 +82,65 @@ import Cardano.Wallet.Launch.Cluster , withCluster ) import Cardano.Wallet.Network.Ports - ( portFromURL ) + ( portFromURL + ) import Cardano.Wallet.Pools - ( StakePool ) + ( StakePool + ) import Cardano.Wallet.Primitive.NetworkId - ( NetworkDiscriminant (..), NetworkId (..) ) + ( NetworkDiscriminant (..) + , NetworkId (..) + ) import Cardano.Wallet.Primitive.SyncProgress - ( SyncTolerance (..) ) + ( SyncTolerance (..) + ) import Cardano.Wallet.Primitive.Types.Coin - ( Coin (..) ) + ( Coin (..) + ) import Cardano.Wallet.Shelley - ( Tracers, Tracers' (..), nullTracers, serveWallet ) + ( Tracers + , Tracers' (..) + , nullTracers + , serveWallet + ) import Cardano.Wallet.Shelley.BlockchainSource - ( BlockchainSource (..) ) + ( BlockchainSource (..) + ) import Cardano.Wallet.Shelley.Compatibility - ( fromGenesisData ) + ( fromGenesisData + ) import Cardano.Wallet.Unsafe - ( unsafeFromText, unsafeMkMnemonic ) + ( unsafeFromText + , unsafeMkMnemonic + ) import Control.Monad - ( replicateM, replicateM_ ) + ( replicateM + , replicateM_ + ) import Control.Monad.IO.Class - ( liftIO ) + ( liftIO + ) import Data.Aeson - ( Value ) + ( Value + ) import Data.Bifunctor - ( bimap ) + ( bimap + ) import Data.Generics.Internal.VL.Lens - ( (^.) ) + ( (^.) + ) import Data.List.NonEmpty - ( NonEmpty ((:|)) ) + ( NonEmpty ((:|)) + ) import Data.Tagged - ( Tagged (..) ) + ( Tagged (..) + ) import Fmt - ( build ) + ( build + ) import Main.Utf8 - ( withUtf8 ) + ( withUtf8 + ) import Network.HTTP.Client ( defaultManagerSettings , managerResponseTimeout @@ -106,21 +148,30 @@ import Network.HTTP.Client , responseTimeoutMicro ) import Network.Wai.Middleware.Logging - ( ApiLog (..) ) + ( ApiLog (..) + ) import Numeric.Natural - ( Natural ) + ( Natural + ) import Ouroboros.Network.Client.Wallet - ( tunedForMainnetPipeliningStrategy ) + ( tunedForMainnetPipeliningStrategy + ) import System.Directory - ( createDirectory ) + ( createDirectory + ) import System.Environment.Extended - ( isEnvSet ) + ( isEnvSet + ) import System.FilePath - ( () ) + ( () + ) import System.IO.Temp.Extra - ( SkipCleanup (..), withSystemTempDir ) + ( SkipCleanup (..) + , withSystemTempDir + ) import Test.Hspec - ( shouldBe ) + ( shouldBe + ) import Test.Integration.Framework.DSL ( Context (..) , Headers (..) @@ -147,11 +198,16 @@ import Test.Integration.Framework.DSL , verify ) import UnliftIO.Async - ( race_ ) + ( race_ + ) import UnliftIO.MVar - ( newEmptyMVar, putMVar, takeMVar ) + ( newEmptyMVar + , putMVar + , takeMVar + ) import UnliftIO.STM - ( TVar ) + ( TVar + ) import qualified Cardano.Address as CA import qualified Cardano.Wallet.Api.Link as Link diff --git a/lib/wallet/bench/restore-bench.hs b/lib/wallet/bench/restore-bench.hs index 124ff1f46f1..bc5ddc357fa 100644 --- a/lib/wallet/bench/restore-bench.hs +++ b/lib/wallet/bench/restore-bench.hs @@ -43,47 +43,78 @@ module Main where import Prelude import Cardano.Address.Derivation - ( XPrv ) + ( XPrv + ) import Cardano.BM.Data.Severity - ( Severity (..) ) + ( Severity (..) + ) import Cardano.BM.Data.Tracer - ( HasPrivacyAnnotation (..), HasSeverityAnnotation (..) ) + ( HasPrivacyAnnotation (..) + , HasSeverityAnnotation (..) + ) import Cardano.BM.Extra - ( trMessageText ) + ( trMessageText + ) import Cardano.BM.Trace - ( Trace, nullTracer ) + ( Trace + , nullTracer + ) import Cardano.Launcher.Node - ( CardanoNodeConn ) + ( CardanoNodeConn + ) import Cardano.Mnemonic - ( SomeMnemonic (..), entropyToMnemonic ) + ( SomeMnemonic (..) + , entropyToMnemonic + ) import Cardano.Wallet - ( WalletLayer (..), WalletWorkerLog (..), dummyChangeAddressGen ) + ( WalletLayer (..) + , WalletWorkerLog (..) + , dummyChangeAddressGen + ) import Cardano.Wallet.Address.Book - ( AddressBookIso ) + ( AddressBookIso + ) import Cardano.Wallet.Address.Derivation - ( Depth (..) ) + ( Depth (..) + ) import Cardano.Wallet.Address.Derivation.Byron - ( ByronKey ) + ( ByronKey + ) import Cardano.Wallet.Address.Derivation.Shared - ( SharedKey ) + ( SharedKey + ) import Cardano.Wallet.Address.Derivation.Shelley - ( ShelleyKey ) + ( ShelleyKey + ) import Cardano.Wallet.Address.Discovery - ( GenChange (..), IsOurs ) + ( GenChange (..) + , IsOurs + ) import Cardano.Wallet.Address.Discovery.RandomAny - ( RndAnyState, mkRndAnyState ) + ( RndAnyState + , mkRndAnyState + ) import Cardano.Wallet.Address.Discovery.Sequential - ( AddressPoolGap, mkAddressPoolGap, purposeCIP1852 ) + ( AddressPoolGap + , mkAddressPoolGap + , purposeCIP1852 + ) import Cardano.Wallet.Address.Discovery.SequentialAny - ( SeqAnyState ) + ( SeqAnyState + ) import Cardano.Wallet.Address.Keys.SequentialAny - ( mkSeqAnyState ) + ( mkSeqAnyState + ) import Cardano.Wallet.Address.Keys.WalletKey - ( digest, publicKey ) + ( digest + , publicKey + ) import Cardano.Wallet.Address.MaybeLight - ( MaybeLight ) + ( MaybeLight + ) import Cardano.Wallet.Api.Types - ( toApiUtxoStatistics ) + ( toApiUtxoStatistics + ) import Cardano.Wallet.BenchShared ( RestoreBenchArgs (..) , Time @@ -95,9 +126,12 @@ import Cardano.Wallet.BenchShared , withTempSqliteFile ) import Cardano.Wallet.DB - ( DBFresh ) + ( DBFresh + ) import Cardano.Wallet.DB.Layer - ( PersistAddressBook, withDBFresh ) + ( PersistAddressBook + , withDBFresh + ) import Cardano.Wallet.Flavor ( CredFromOf , Excluding @@ -113,9 +147,16 @@ import Cardano.Wallet.Network , NetworkLayer (..) ) import Cardano.Wallet.Network.Config - ( NetworkConfiguration (..), parseGenesisData ) + ( NetworkConfiguration (..) + , parseGenesisData + ) import Cardano.Wallet.Primitive.Model - ( Wallet, availableUTxO, currentTip, getState, totalUTxO ) + ( Wallet + , availableUTxO + , currentTip + , getState + , totalUTxO + ) import Cardano.Wallet.Primitive.NetworkId ( HasSNetworkId (sNetworkId) , NetworkDiscriminant (..) @@ -125,9 +166,14 @@ import Cardano.Wallet.Primitive.NetworkId , withSNetworkId ) import Cardano.Wallet.Primitive.Slotting - ( TimeInterpreter, neverFails ) + ( TimeInterpreter + , neverFails + ) import Cardano.Wallet.Primitive.SyncProgress - ( SyncProgress (..), SyncTolerance, mkSyncTolerance ) + ( SyncProgress (..) + , SyncTolerance + , mkSyncTolerance + ) import Cardano.Wallet.Primitive.Types ( Block (..) , BlockHeader (..) @@ -140,19 +186,27 @@ import Cardano.Wallet.Primitive.Types , chainPointFromBlockHeader ) import Cardano.Wallet.Primitive.Types.Address - ( Address (..) ) + ( Address (..) + ) import Cardano.Wallet.Primitive.Types.Coin - ( Coin (..) ) + ( Coin (..) + ) import Cardano.Wallet.Primitive.Types.Credentials - ( ClearCredentials, RootCredentials (..) ) + ( ClearCredentials + , RootCredentials (..) + ) import Cardano.Wallet.Primitive.Types.RewardAccount - ( RewardAccount ) + ( RewardAccount + ) import Cardano.Wallet.Primitive.Types.Tx.Tx - ( Tx ) + ( Tx + ) import Cardano.Wallet.Primitive.Types.Tx.TxOut - ( TxOut (..) ) + ( TxOut (..) + ) import Cardano.Wallet.Primitive.Types.UTxOStatistics - ( UTxOStatistics (..) ) + ( UTxOStatistics (..) + ) import Cardano.Wallet.Shelley.Compatibility ( AnyCardanoEra (..) , CardanoBlock @@ -163,49 +217,83 @@ import Cardano.Wallet.Shelley.Compatibility , numberOfTransactionsInBlock ) import Cardano.Wallet.Shelley.Network.Node - ( withNetworkLayer ) + ( withNetworkLayer + ) import Cardano.Wallet.Shelley.Transaction - ( newTransactionLayer ) + ( newTransactionLayer + ) import Cardano.Wallet.Transaction - ( PreSelection (..), defaultTransactionCtx ) + ( PreSelection (..) + , defaultTransactionCtx + ) import Cardano.Wallet.Unsafe - ( unsafeMkEntropy, unsafeMkPercentage, unsafeRunExceptT ) + ( unsafeMkEntropy + , unsafeMkPercentage + , unsafeRunExceptT + ) import Control.Arrow - ( first ) + ( first + ) import Control.Exception - ( throwIO ) + ( throwIO + ) import Control.Monad - ( unless, void ) + ( unless + , void + ) import Control.Monad.IO.Class - ( MonadIO (..) ) + ( MonadIO (..) + ) import Control.Monad.Trans.Except - ( runExceptT, withExceptT ) + ( runExceptT + , withExceptT + ) import Control.Tracer - ( Tracer (..), traceWith ) + ( Tracer (..) + , traceWith + ) import Crypto.Hash.Extra - ( blake2b256 ) + ( blake2b256 + ) import Data.Aeson - ( ToJSON (..), genericToJSON, (.=) ) + ( ToJSON (..) + , genericToJSON + , (.=) + ) import Data.Functor.Contravariant - ( contramap ) + ( contramap + ) import Data.List - ( foldl' ) + ( foldl' + ) import Data.Proxy - ( Proxy (..) ) + ( Proxy (..) + ) import Data.Quantity - ( Percentage (..), Quantity (..) ) + ( Percentage (..) + , Quantity (..) + ) import Data.Set - ( Set ) + ( Set + ) import Data.Text - ( Text ) + ( Text + ) import Data.Text.Class - ( ToText (..) ) + ( ToText (..) + ) import Data.Time - ( UTCTime, diffUTCTime ) + ( UTCTime + , diffUTCTime + ) import Data.Time.Clock.POSIX - ( POSIXTime, getCurrentTime, utcTimeToPOSIXSeconds ) + ( POSIXTime + , getCurrentTime + , utcTimeToPOSIXSeconds + ) import Data.Word - ( Word32 ) + ( Word32 + ) import Fmt ( Buildable , blockListF' @@ -219,31 +307,59 @@ import Fmt , (||+) ) import GHC.Conc - ( retry ) + ( retry + ) import GHC.Generics - ( Generic ) + ( Generic + ) import GHC.TypeLits - ( KnownNat, Nat, natVal ) + ( KnownNat + , Nat + , natVal + ) import Internal.Cardano.Write.Tx - ( AnyRecentEra (..) ) + ( AnyRecentEra (..) + ) import Numeric - ( fromRat, showFFloat ) + ( fromRat + , showFFloat + ) import Ouroboros.Network.Client.Wallet - ( PipeliningStrategy, tunedForMainnetPipeliningStrategy ) + ( PipeliningStrategy + , tunedForMainnetPipeliningStrategy + ) import Say - ( sayErr, sayShow ) + ( sayErr + , sayShow + ) import System.Exit - ( exitWith ) + ( exitWith + ) import System.FilePath - ( () ) + ( () + ) import System.IO - ( IOMode (..), hFlush, withFile ) + ( IOMode (..) + , hFlush + , withFile + ) import UnliftIO - ( async, atomically, cancel, newTVarIO, readTVar, readTVarIO, writeTVar ) + ( async + , atomically + , cancel + , newTVarIO + , readTVar + , readTVarIO + , writeTVar + ) import UnliftIO.Concurrent - ( forkIO, threadDelay ) + ( forkIO + , threadDelay + ) import UnliftIO.Exception - ( evaluate, throwString ) + ( evaluate + , throwString + ) import qualified Cardano.Wallet as W import qualified Cardano.Wallet.Address.Derivation.Byron as Byron diff --git a/lib/wallet/bench/src/Cardano/Wallet/BenchShared.hs b/lib/wallet/bench/src/Cardano/Wallet/BenchShared.hs index f0309dc6f19..5b45a404207 100644 --- a/lib/wallet/bench/src/Cardano/Wallet/BenchShared.hs +++ b/lib/wallet/bench/src/Cardano/Wallet/BenchShared.hs @@ -31,15 +31,21 @@ module Cardano.Wallet.BenchShared import Prelude import Cardano.BM.Configuration.Static - ( defaultConfigStdout ) + ( defaultConfigStdout + ) import Cardano.BM.Data.Severity - ( Severity (..) ) + ( Severity (..) + ) import Cardano.BM.Extra - ( trMessageText ) + ( trMessageText + ) import Cardano.BM.Setup - ( setupTrace_ ) + ( setupTrace_ + ) import Cardano.BM.Trace - ( Trace, nullTracer ) + ( Trace + , nullTracer + ) import Cardano.Launcher.Node ( CardanoNodeConfig (..) , CardanoNodeConn @@ -48,29 +54,46 @@ import Cardano.Launcher.Node , withCardanoNode ) import Cardano.Startup - ( installSignalHandlers ) + ( installSignalHandlers + ) import Cardano.Wallet.Network.Ports - ( getRandomPort ) + ( getRandomPort + ) import Control.DeepSeq - ( NFData, rnf ) + ( NFData + , rnf + ) import Control.Monad - ( forM ) + ( forM + ) import Criterion.Measurement - ( getTime, initializeTime, secs ) + ( getTime + , initializeTime + , secs + ) import Data.Aeson - ( ToJSON (..) ) + ( ToJSON (..) + ) import Data.Functor - ( (<&>) ) + ( (<&>) + ) import Data.Maybe - ( fromMaybe ) + ( fromMaybe + ) import Data.Text - ( Text ) + ( Text + ) import Data.Text.Class - ( ToText (..) ) + ( ToText (..) + ) import Fmt - ( Buildable (..), nameF, pretty ) + ( Buildable (..) + , nameF + , pretty + ) import GHC.Generics - ( Generic ) + ( Generic + ) -- See ADP-1910 import "optparse-applicative" Options.Applicative ( HasValue @@ -93,23 +116,33 @@ import "optparse-applicative" Options.Applicative , value ) import Say - ( sayErr ) + ( sayErr + ) import System.Directory - ( createDirectoryIfMissing ) + ( createDirectoryIfMissing + ) import System.Environment - ( lookupEnv ) + ( lookupEnv + ) import System.Exit - ( ExitCode (..), die ) + ( ExitCode (..) + , die + ) import System.FilePath - ( () ) + ( () + ) import Test.Utils.Startup - ( withNoBuffering ) + ( withNoBuffering + ) import UnliftIO.Concurrent - ( threadDelay ) + ( threadDelay + ) import UnliftIO.Exception - ( evaluate ) + ( evaluate + ) import UnliftIO.Temporary - ( withSystemTempDirectory ) + ( withSystemTempDirectory + ) import qualified Cardano.BM.Configuration.Model as CM import qualified Cardano.BM.Data.BackendKind as CM diff --git a/lib/wallet/bench/src/Cardano/Wallet/LatencyBenchShared.hs b/lib/wallet/bench/src/Cardano/Wallet/LatencyBenchShared.hs index 57882103d4e..f0a7080c90a 100644 --- a/lib/wallet/bench/src/Cardano/Wallet/LatencyBenchShared.hs +++ b/lib/wallet/bench/src/Cardano/Wallet/LatencyBenchShared.hs @@ -18,31 +18,61 @@ module Cardano.Wallet.LatencyBenchShared import Prelude import Cardano.BM.Backend.Switchboard - ( effectuate ) + ( effectuate + ) import Cardano.BM.Configuration.Static - ( defaultConfigStdout ) + ( defaultConfigStdout + ) import Cardano.BM.Data.LogItem - ( LOContent (..), LOMeta (..), LogObject (..) ) + ( LOContent (..) + , LOMeta (..) + , LogObject (..) + ) import Cardano.BM.Data.Severity - ( Severity (..) ) + ( Severity (..) + ) import Cardano.BM.Setup - ( setupTrace_, shutdown ) + ( setupTrace_ + , shutdown + ) import Control.Monad - ( replicateM_ ) + ( replicateM_ + ) import Data.Maybe - ( mapMaybe ) + ( mapMaybe + ) import Data.Time - ( NominalDiffTime ) + ( NominalDiffTime + ) import Data.Time.Clock - ( diffUTCTime ) + ( diffUTCTime + ) import Fmt - ( Builder, build, fixedF, fmt, fmtLn, indentF, padLeftF, (+|), (|+) ) + ( Builder + , build + , fixedF + , fmt + , fmtLn + , indentF + , padLeftF + , (+|) + , (|+) + ) import Network.Wai.Middleware.Logging - ( ApiLog (..), HandlerLog (..) ) + ( ApiLog (..) + , HandlerLog (..) + ) import UnliftIO.Exception - ( bracket, onException ) + ( bracket + , onException + ) import UnliftIO.STM - ( TVar, atomically, newTVarIO, readTVarIO, writeTVar ) + ( TVar + , atomically + , newTVarIO + , readTVarIO + , writeTVar + ) import qualified Cardano.BM.Configuration.Model as CM diff --git a/lib/wallet/exe/cardano-wallet.hs b/lib/wallet/exe/cardano-wallet.hs index 2e5b0d92691..9ec589d2f4a 100644 --- a/lib/wallet/exe/cardano-wallet.hs +++ b/lib/wallet/exe/cardano-wallet.hs @@ -26,13 +26,23 @@ module Main where import Prelude import Cardano.BM.Data.Severity - ( Severity (..) ) + ( Severity (..) + ) import Cardano.BM.Extra - ( trMessage, transformTextTrace ) + ( trMessage + , transformTextTrace + ) import Cardano.BM.Plugin - ( loadPlugin ) + ( loadPlugin + ) import Cardano.BM.Trace - ( Trace, appendName, logDebug, logError, logInfo, logNotice ) + ( Trace + , appendName + , logDebug + , logError + , logInfo + , logNotice + ) import Cardano.CLI ( LogOutput (..) , LoggingOptions @@ -67,9 +77,13 @@ import Cardano.CLI , withLogging ) import Cardano.Launcher.Node - ( CardanoNodeConn ) + ( CardanoNodeConn + ) import Cardano.Startup - ( ShutdownHandlerLog, installSignalHandlers, withShutdownHandler ) + ( ShutdownHandlerLog + , installSignalHandlers + , withShutdownHandler + ) import Cardano.Wallet.Api.Client ( addressClient , networkClient @@ -78,13 +92,23 @@ import Cardano.Wallet.Api.Client , walletClient ) import Cardano.Wallet.Api.Http.Shelley.Server - ( HostPreference, Listen (..), TlsConfiguration ) + ( HostPreference + , Listen (..) + , TlsConfiguration + ) import Cardano.Wallet.CLI - ( networkConfigurationOption, nodeSocketOption ) + ( networkConfigurationOption + , nodeSocketOption + ) import Cardano.Wallet.Network.Config - ( NetworkConfiguration (..), parseGenesisData ) + ( NetworkConfiguration (..) + , parseGenesisData + ) import Cardano.Wallet.Primitive.Types - ( PoolMetadataSource (..), Settings (..), TokenMetadataServer (..) ) + ( PoolMetadataSource (..) + , Settings (..) + , TokenMetadataServer (..) + ) import Cardano.Wallet.Shelley ( TracerSeverities , Tracers @@ -95,31 +119,48 @@ import Cardano.Wallet.Shelley , tracerLabels ) import Cardano.Wallet.Shelley.BlockchainSource - ( BlockchainSource (..) ) + ( BlockchainSource (..) + ) import Cardano.Wallet.Version - ( GitRevision, Version, showFullVersion ) + ( GitRevision + , Version + , showFullVersion + ) import Control.Applicative - ( Const (..), optional ) + ( Const (..) + , optional + ) import Control.Exception.Base - ( AsyncException (..) ) + ( AsyncException (..) + ) import Control.Monad - ( void, when ) + ( void + , when + ) import Control.Monad.Trans.Except - ( runExceptT ) + ( runExceptT + ) import Control.Tracer - ( contramap ) + ( contramap + ) import Data.Bifunctor - ( second ) + ( second + ) import Data.Foldable - ( forM_ ) + ( forM_ + ) import Data.Text - ( Text ) + ( Text + ) import Data.Text.Class - ( ToText (..) ) + ( ToText (..) + ) import Main.Utf8 - ( withUtf8 ) + ( withUtf8 + ) import Network.URI - ( URI ) + ( URI + ) import "optparse-applicative" Options.Applicative ( CommandFields , Mod @@ -135,13 +176,19 @@ import "optparse-applicative" Options.Applicative , value ) import Ouroboros.Network.Client.Wallet - ( tunedForMainnetPipeliningStrategy ) + ( tunedForMainnetPipeliningStrategy + ) import System.Environment - ( getArgs, getExecutablePath ) + ( getArgs + , getExecutablePath + ) import System.Exit - ( ExitCode (..), exitWith ) + ( ExitCode (..) + , exitWith + ) import UnliftIO.Exception - ( withException ) + ( withException + ) import qualified Cardano.BM.Backend.EKGView as EKG import qualified Cardano.Wallet.Version as V diff --git a/lib/wallet/exe/mock-token-metadata-server.hs b/lib/wallet/exe/mock-token-metadata-server.hs index 2cd402a3a6f..bab9af7eef0 100644 --- a/lib/wallet/exe/mock-token-metadata-server.hs +++ b/lib/wallet/exe/mock-token-metadata-server.hs @@ -6,15 +6,21 @@ module Main where import Prelude import Cardano.Wallet.Primitive.Types - ( TokenMetadataServer (..) ) + ( TokenMetadataServer (..) + ) import Cardano.Wallet.TokenMetadata.MockServer - ( queryServerReloading, withMetadataServerOptions ) + ( queryServerReloading + , withMetadataServerOptions + ) import Control.Concurrent - ( threadDelay ) + ( threadDelay + ) import Control.Monad - ( forever ) + ( forever + ) import Network.Wai.Middleware.RequestLogger - ( logStdoutDev ) + ( logStdoutDev + ) -- See ADP-1910 import "optparse-applicative" Options.Applicative ( ParserInfo @@ -36,7 +42,13 @@ import "optparse-applicative" Options.Applicative , str ) import Prettyprinter - ( Doc, Pretty (..), hang, indent, line, softline ) + ( Doc + , Pretty (..) + , hang + , indent + , line + , softline + ) data MetadataServerArgs = MetadataServerArgs diff --git a/lib/wallet/extra/Plutus/CurrencyContract.hs b/lib/wallet/extra/Plutus/CurrencyContract.hs index fbdaa2c1ca4..f550953e163 100644 --- a/lib/wallet/extra/Plutus/CurrencyContract.hs +++ b/lib/wallet/extra/Plutus/CurrencyContract.hs @@ -19,11 +19,18 @@ module CurrencyContract where import Prelude import Codec.Serialise - ( serialise ) + ( serialise + ) import Ledger - ( MintingPolicy (..), Script, TxId (..), TxOutRef (..) ) + ( MintingPolicy (..) + , Script + , TxId (..) + , TxOutRef (..) + ) import Plutus.Contracts.Currency as Example - ( OneShotCurrency (..), curPolicy ) + ( OneShotCurrency (..) + , curPolicy + ) import PlutusTx.Builtins.Class import qualified Data.ByteString as BS diff --git a/lib/wallet/extra/Plutus/FlatInteger.hs b/lib/wallet/extra/Plutus/FlatInteger.hs index 56bbf71cd1a..bfa918abd24 100644 --- a/lib/wallet/extra/Plutus/FlatInteger.hs +++ b/lib/wallet/extra/Plutus/FlatInteger.hs @@ -8,11 +8,15 @@ module FlatInteger where import Prelude import Data.Bits - ( (.&.), (.|.) ) + ( (.&.) + , (.|.) + ) import Data.Word - ( Word8 ) + ( Word8 + ) import Numeric.Natural - ( Natural ) + ( Natural + ) import qualified Data.Bits as Bits diff --git a/lib/wallet/integration/src/Test/Integration/Framework/Context.hs b/lib/wallet/integration/src/Test/Integration/Framework/Context.hs index 88e615b8dd2..6de40266095 100644 --- a/lib/wallet/integration/src/Test/Integration/Framework/Context.hs +++ b/lib/wallet/integration/src/Test/Integration/Framework/Context.hs @@ -10,33 +10,49 @@ module Test.Integration.Framework.Context import Prelude import Cardano.Address - ( Address ) + ( Address + ) import Cardano.CLI - ( Port (..) ) + ( Port (..) + ) import Cardano.Wallet.Api.Types - ( ApiEra ) + ( ApiEra + ) import Cardano.Wallet.Faucet - ( Faucet ) + ( Faucet + ) import Cardano.Wallet.Launch.Cluster - ( TestnetMagic ) + ( TestnetMagic + ) import Cardano.Wallet.Primitive.Types - ( EpochNo, NetworkParameters, PoolRetirementCertificate ) + ( EpochNo + , NetworkParameters + , PoolRetirementCertificate + ) import Cardano.Wallet.Primitive.Types.Coin - ( Coin (..) ) + ( Coin (..) + ) import Cardano.Wallet.Transaction - ( DelegationAction ) + ( DelegationAction + ) import Data.ByteString - ( ByteString ) + ( ByteString + ) import Data.IORef - ( IORef ) + ( IORef + ) import Data.Text - ( Text ) + ( Text + ) import GHC.Generics - ( Generic ) + ( Generic + ) import Network.HTTP.Client - ( Manager ) + ( Manager + ) import Network.URI - ( URI ) + ( URI + ) -- | Context for integration tests. -- diff --git a/lib/wallet/integration/src/Test/Integration/Framework/DSL.hs b/lib/wallet/integration/src/Test/Integration/Framework/DSL.hs index a1a5c7db175..98a07a59bbc 100644 --- a/lib/wallet/integration/src/Test/Integration/Framework/DSL.hs +++ b/lib/wallet/integration/src/Test/Integration/Framework/DSL.hs @@ -237,9 +237,13 @@ module Test.Integration.Framework.DSL import Prelude import Cardano.Address.Derivation - ( XPub, xpubFromBytes, xpubToBytes ) + ( XPub + , xpubFromBytes + , xpubToBytes + ) import Cardano.CLI - ( Port (..) ) + ( Port (..) + ) import Cardano.Mnemonic ( ConsistentEntropy , EntropySize @@ -252,9 +256,11 @@ import Cardano.Mnemonic , mnemonicToText ) import Cardano.Pool.Metadata.Types - ( PoolMetadataGCStatus (..) ) + ( PoolMetadataGCStatus (..) + ) import Cardano.Pool.Types - ( PoolId (..) ) + ( PoolId (..) + ) import Cardano.Wallet.Address.Derivation ( Depth (..) , DerivationIndex (..) @@ -268,15 +274,22 @@ import Cardano.Wallet.Address.Derivation , paymentAddressS ) import Cardano.Wallet.Address.Derivation.Byron - ( ByronKey (..) ) + ( ByronKey (..) + ) import Cardano.Wallet.Address.Discovery.Sequential - ( coinTypeAda ) + ( coinTypeAda + ) import Cardano.Wallet.Address.Discovery.Shared - ( CredentialType (..) ) + ( CredentialType (..) + ) import Cardano.Wallet.Address.Encoding - ( decodeAddress, encodeAddress ) + ( decodeAddress + , encodeAddress + ) import Cardano.Wallet.Address.Keys.WalletKey - ( getRawKey, publicKey ) + ( getRawKey + , publicKey + ) import Cardano.Wallet.Api.Types ( AddressAmount , ApiAccountKeyShared @@ -311,27 +324,43 @@ import Cardano.Wallet.Api.Types , insertedAt ) import Cardano.Wallet.Api.Types.Error - ( ApiErrorInfo (..) ) + ( ApiErrorInfo (..) + ) import Cardano.Wallet.Api.Types.SchemaMetadata - ( TxMetadataSchema, toSimpleMetadataFlag ) + ( TxMetadataSchema + , toSimpleMetadataFlag + ) import Cardano.Wallet.Api.Types.Transaction - ( ApiAddress (..), ApiLimit (..) ) + ( ApiAddress (..) + , ApiLimit (..) + ) import Cardano.Wallet.Compat - ( (^?) ) + ( (^?) + ) import Cardano.Wallet.Faucet - ( NextWallet, nextWallet ) + ( NextWallet + , nextWallet + ) import Cardano.Wallet.Flavor - ( KeyFlavorS (..) ) + ( KeyFlavorS (..) + ) import Cardano.Wallet.Pools - ( EpochInfo, StakePool ) + ( EpochInfo + , StakePool + ) import Cardano.Wallet.Primitive.NetworkId - ( HasSNetworkId (..) ) + ( HasSNetworkId (..) + ) import Cardano.Wallet.Primitive.Passphrase - ( Passphrase (..), preparePassphrase ) + ( Passphrase (..) + , preparePassphrase + ) import Cardano.Wallet.Primitive.Passphrase.Legacy - ( encryptPassphraseTestingOnly ) + ( encryptPassphraseTestingOnly + ) import Cardano.Wallet.Primitive.SyncProgress - ( SyncProgress (..) ) + ( SyncProgress (..) + ) import Cardano.Wallet.Primitive.Types ( ActiveSlotCoefficient (..) , EpochLength (..) @@ -347,121 +376,226 @@ import Cardano.Wallet.Primitive.Types , unSlotInEpoch ) import Cardano.Wallet.Primitive.Types.Address - ( Address (..) ) + ( Address (..) + ) import Cardano.Wallet.Primitive.Types.Coin - ( Coin (..) ) + ( Coin (..) + ) import Cardano.Wallet.Primitive.Types.Hash - ( Hash (..) ) + ( Hash (..) + ) import Cardano.Wallet.Primitive.Types.Tx - ( SealedTx (..) ) + ( SealedTx (..) + ) import Cardano.Wallet.Primitive.Types.Tx.Constraints - ( txOutMaxCoin, txOutMinCoin ) + ( txOutMaxCoin + , txOutMinCoin + ) import Cardano.Wallet.Primitive.Types.Tx.TxIn - ( TxIn (..) ) + ( TxIn (..) + ) import Cardano.Wallet.Primitive.Types.Tx.TxMeta - ( TxStatus (..) ) + ( TxStatus (..) + ) import Cardano.Wallet.Primitive.Types.Tx.TxOut - ( TxOut (..) ) + ( TxOut (..) + ) import Cardano.Wallet.Primitive.Types.UTxO - ( UTxO (..) ) + ( UTxO (..) + ) import Cardano.Wallet.Primitive.Types.UTxOStatistics - ( HistogramBar (..), UTxOStatistics (..) ) + ( HistogramBar (..) + , UTxOStatistics (..) + ) import "cardano-addresses" Codec.Binary.Encoding - ( AbstractEncoding (..), encode ) + ( AbstractEncoding (..) + , encode + ) import Control.Arrow - ( second ) + ( second + ) import Control.Monad - ( forM_, join, replicateM, unless, void, (>=>) ) + ( forM_ + , join + , replicateM + , unless + , void + , (>=>) + ) import Control.Monad.IO.Unlift - ( MonadIO, MonadUnliftIO (..), liftIO ) + ( MonadIO + , MonadUnliftIO (..) + , liftIO + ) import Control.Monad.Loops - ( iterateUntilM ) + ( iterateUntilM + ) import Control.Monad.Trans.Resource - ( ResourceT, allocate, runResourceT ) + ( ResourceT + , allocate + , runResourceT + ) import Control.Retry - ( capDelay, constantDelay, retrying ) + ( capDelay + , constantDelay + , retrying + ) import Crypto.Hash - ( Blake2b_160, Digest, digestFromByteString ) + ( Blake2b_160 + , Digest + , digestFromByteString + ) import Crypto.Hash.Extra - ( blake2b224 ) + ( blake2b224 + ) import Data.Aeson - ( FromJSON, ToJSON, Value, (.=) ) + ( FromJSON + , ToJSON + , Value + , (.=) + ) import Data.Aeson.QQ - ( aesonQQ ) + ( aesonQQ + ) import Data.ByteString - ( ByteString ) + ( ByteString + ) import Data.Either.Combinators - ( swapEither ) + ( swapEither + ) import Data.Either.Extra - ( eitherToMaybe ) + ( eitherToMaybe + ) import Data.Foldable - ( toList ) + ( toList + ) import Data.Function - ( (&) ) + ( (&) + ) import Data.Functor.Identity - ( Identity (..) ) + ( Identity (..) + ) import Data.Generics.Internal.VL.Lens - ( Lens', lens, set, view, (^.) ) + ( Lens' + , lens + , set + , view + , (^.) + ) import Data.Generics.Internal.VL.Traversal - ( Traversal' ) + ( Traversal' + ) import Data.Generics.Labels () import Data.Generics.Product.Typed - ( HasType, typed ) + ( HasType + , typed + ) import Data.IORef - ( newIORef, readIORef, writeIORef ) + ( newIORef + , readIORef + , writeIORef + ) import Data.List - ( isPrefixOf ) + ( isPrefixOf + ) import Data.List.NonEmpty - ( NonEmpty ) + ( NonEmpty + ) import Data.List.NonEmpty.Extra - ( (!?) ) + ( (!?) + ) import Data.Maybe - ( catMaybes, fromJust, fromMaybe ) + ( catMaybes + , fromJust + , fromMaybe + ) import Data.Monoid - ( Sum (..) ) + ( Sum (..) + ) import Data.Proxy - ( Proxy (..) ) + ( Proxy (..) + ) import Data.Quantity - ( Quantity (..) ) + ( Quantity (..) + ) import Data.Set - ( Set ) + ( Set + ) import Data.Text - ( Text ) + ( Text + ) import Data.Text.Class - ( FromText (..), ToText (..) ) + ( FromText (..) + , ToText (..) + ) import Data.Time - ( NominalDiffTime, UTCTime ) + ( NominalDiffTime + , UTCTime + ) import Data.Time.Text - ( iso8601ExtendedUtc, utcTimeToText ) + ( iso8601ExtendedUtc + , utcTimeToText + ) import Data.Word - ( Word16, Word32 ) + ( Word16 + , Word32 + ) import Fmt - ( indentF, (+|), (|+) ) + ( indentF + , (+|) + , (|+) + ) import Language.Haskell.TH.Quote - ( QuasiQuoter ) + ( QuasiQuoter + ) import Network.HTTP.Types.Method - ( Method ) + ( Method + ) import Numeric.Natural - ( Natural ) + ( Natural + ) import System.Command - ( CmdOption (..), CmdResult, Exit (..), Stderr, Stdout (..), command ) + ( CmdOption (..) + , CmdResult + , Exit (..) + , Stderr + , Stdout (..) + , command + ) import System.Directory - ( doesPathExist ) + ( doesPathExist + ) import System.Exit - ( ExitCode (..) ) + ( ExitCode (..) + ) import System.IO - ( hClose, hFlush, hPutStr ) + ( hClose + , hFlush + , hPutStr + ) import Test.Hspec - ( Expectation, HasCallStack ) + ( Expectation + , HasCallStack + ) import Test.Hspec.Expectations.Lifted - ( expectationFailure, shouldBe, shouldContain, shouldNotBe, shouldSatisfy ) + ( expectationFailure + , shouldBe + , shouldContain + , shouldNotBe + , shouldSatisfy + ) import Test.Hspec.Extra - ( appendFailureReason, counterexample ) + ( appendFailureReason + , counterexample + ) import Test.HUnit.Lang - ( HUnitFailure (..) ) + ( HUnitFailure (..) + ) import Test.Integration.Framework.Context - ( Context (..), TxDescription (..) ) + ( Context (..) + , TxDescription (..) + ) import Test.Integration.Framework.Request ( Headers (..) , Payload (..) @@ -471,13 +605,25 @@ import Test.Integration.Framework.Request , unsafeRequest ) import Test.Utils.Pretty - ( Pretty (..), pShowBuilder ) + ( Pretty (..) + , pShowBuilder + ) import UnliftIO.Async - ( async, race, wait ) + ( async + , race + , wait + ) import UnliftIO.Concurrent - ( threadDelay ) + ( threadDelay + ) import UnliftIO.Exception - ( Exception (..), SomeException (..), catch, throwIO, throwString, try ) + ( Exception (..) + , SomeException (..) + , catch + , throwIO + , throwString + , try + ) import UnliftIO.Process ( CreateProcess (..) , StdStream (..) @@ -486,7 +632,8 @@ import UnliftIO.Process , withCreateProcess ) import Web.HttpApiData - ( ToHttpApiData (..) ) + ( ToHttpApiData (..) + ) import qualified Cardano.Wallet.Address.Derivation.Byron as Byron import qualified Cardano.Wallet.Address.Derivation.Icarus as Icarus diff --git a/lib/wallet/integration/src/Test/Integration/Framework/Request.hs b/lib/wallet/integration/src/Test/Integration/Framework/Request.hs index 88cff01ae18..f5582a6ccf1 100644 --- a/lib/wallet/integration/src/Test/Integration/Framework/Request.hs +++ b/lib/wallet/integration/src/Test/Integration/Framework/Request.hs @@ -21,21 +21,33 @@ module Test.Integration.Framework.Request import Prelude import Control.Monad.IO.Class - ( liftIO ) + ( liftIO + ) import Control.Monad.IO.Unlift - ( MonadUnliftIO (..) ) + ( MonadUnliftIO (..) + ) import Data.Aeson - ( FromJSON, Value, eitherDecode, encode ) + ( FromJSON + , Value + , eitherDecode + , encode + ) import Data.Bifunctor - ( first ) + ( first + ) import Data.ByteString.Lazy - ( ByteString ) + ( ByteString + ) import Data.Generics.Internal.VL.Lens - ( (^.) ) + ( (^.) + ) import Data.Generics.Product.Typed - ( HasType, typed ) + ( HasType + , typed + ) import Data.Text - ( Text ) + ( Text + ) import Network.HTTP.Client ( HttpException (..) , HttpExceptionContent @@ -50,17 +62,28 @@ import Network.HTTP.Client , responseStatus ) import Network.HTTP.Types.Header - ( RequestHeaders ) + ( RequestHeaders + ) import Network.HTTP.Types.Method - ( Method ) + ( Method + ) import Network.HTTP.Types.Status - ( status400, status500, statusIsSuccessful ) + ( status400 + , status500 + , statusIsSuccessful + ) import Network.URI - ( URI ) + ( URI + ) import Test.Integration.Framework.Context - ( Context ) + ( Context + ) import UnliftIO.Exception - ( Exception (..), fromEither, handle, throwIO ) + ( Exception (..) + , fromEither + , handle + , throwIO + ) import qualified Data.Text as T import qualified Network.HTTP.Client as HTTP diff --git a/lib/wallet/integration/src/Test/Integration/Framework/TestData.hs b/lib/wallet/integration/src/Test/Integration/Framework/TestData.hs index d01f080da64..be708f3c79e 100644 --- a/lib/wallet/integration/src/Test/Integration/Framework/TestData.hs +++ b/lib/wallet/integration/src/Test/Integration/Framework/TestData.hs @@ -114,27 +114,47 @@ module Test.Integration.Framework.TestData import Prelude import Cardano.Wallet.Api.Types - ( ApiAssetMetadata (ApiAssetMetadata), ApiT (..) ) + ( ApiAssetMetadata (ApiAssetMetadata) + , ApiT (..) + ) import Cardano.Wallet.Primitive.Types.Address - ( Address ) + ( Address + ) import Cardano.Wallet.Primitive.Types.TokenPolicy - ( TokenName, TokenPolicyId ) + ( TokenName + , TokenPolicyId + ) import Cardano.Wallet.Primitive.Types.TokenQuantity - ( TokenQuantity ) + ( TokenQuantity + ) import Cardano.Wallet.Primitive.Types.Tx - ( TxMetadata (..), TxMetadataValue (..) ) + ( TxMetadata (..) + , TxMetadataValue (..) + ) import Cardano.Wallet.Unsafe - ( unsafeFromText ) + ( unsafeFromText + ) import Cardano.Wallet.Version - ( gitRevision, showFullVersion, version ) + ( gitRevision + , showFullVersion + , version + ) import Data.Text - ( Text, pack, unpack ) + ( Text + , pack + , unpack + ) import Data.Word - ( Word32 ) + ( Word32 + ) import Fmt - ( pretty ) + ( pretty + ) import Test.Integration.Framework.DSL - ( Payload (..), fixturePassphrase, json ) + ( Payload (..) + , fixturePassphrase + , json + ) import qualified Cardano.Wallet.Primitive.Types.TokenPolicy as W import qualified Data.Map as Map diff --git a/lib/wallet/integration/src/Test/Integration/Plutus.hs b/lib/wallet/integration/src/Test/Integration/Plutus.hs index 193fd2d6d50..35aa3a36585 100644 --- a/lib/wallet/integration/src/Test/Integration/Plutus.hs +++ b/lib/wallet/integration/src/Test/Integration/Plutus.hs @@ -34,36 +34,54 @@ module Test.Integration.Plutus {- HLINT ignore "Avoid restricted qualification" -} import Prelude hiding - ( id ) + ( id + ) import Cardano.Wallet.Api.Types - ( ApiT (..), ApiWalletInput (..) ) + ( ApiT (..) + , ApiWalletInput (..) + ) import Cardano.Wallet.Primitive.NetworkId - ( HasSNetworkId ) + ( HasSNetworkId + ) import Cardano.Wallet.Primitive.Types.Hash - ( Hash (..) ) + ( Hash (..) + ) import Cardano.Wallet.Unsafe - ( unsafeFromHexText, unsafeRight ) + ( unsafeFromHexText + , unsafeRight + ) import Codec.Binary.Bech32.TH - ( humanReadablePart ) + ( humanReadablePart + ) import Codec.Serialise - ( serialise ) + ( serialise + ) import Control.Arrow - ( left ) + ( left + ) import Crypto.Hash.Extra - ( blake2b224 ) + ( blake2b224 + ) import Data.Aeson - ( (.=) ) + ( (.=) + ) import Data.Aeson.QQ - ( aesonQQ ) + ( aesonQQ + ) import Data.Generics.Internal.VL.Lens - ( view ) + ( view + ) import Data.String.Interpolate - ( i ) + ( i + ) import Data.Text - ( Text ) + ( Text + ) import Text.Microstache - ( compileMustacheText, renderMustache ) + ( compileMustacheText + , renderMustache + ) import qualified Codec.Binary.Bech32 as Bech32 import qualified Codec.CBOR.Term as CBOR diff --git a/lib/wallet/integration/src/Test/Integration/Scenario/API/Blocks.hs b/lib/wallet/integration/src/Test/Integration/Scenario/API/Blocks.hs index 085ffa07fef..12c8337d4fa 100644 --- a/lib/wallet/integration/src/Test/Integration/Scenario/API/Blocks.hs +++ b/lib/wallet/integration/src/Test/Integration/Scenario/API/Blocks.hs @@ -10,11 +10,15 @@ module Test.Integration.Scenario.API.Blocks import Prelude import Cardano.Wallet.Api.Types.BlockHeader - ( ApiBlockHeader ) + ( ApiBlockHeader + ) import Test.Hspec - ( SpecWith, describe ) + ( SpecWith + , describe + ) import Test.Hspec.Extra - ( it ) + ( it + ) import Test.Integration.Framework.DSL ( Context (..) , Headers (..) diff --git a/lib/wallet/integration/src/Test/Integration/Scenario/API/Byron/Addresses.hs b/lib/wallet/integration/src/Test/Integration/Scenario/API/Byron/Addresses.hs index 847f4dbdf7e..0d6ea33909b 100644 --- a/lib/wallet/integration/src/Test/Integration/Scenario/API/Byron/Addresses.hs +++ b/lib/wallet/integration/src/Test/Integration/Scenario/API/Byron/Addresses.hs @@ -18,11 +18,14 @@ module Test.Integration.Scenario.API.Byron.Addresses import Prelude import Cardano.Mnemonic - ( Mnemonic ) + ( Mnemonic + ) import Cardano.Wallet.Address.Discovery.Sequential - ( purposeBIP44 ) + ( purposeBIP44 + ) import Cardano.Wallet.Address.Encoding - ( encodeAddress ) + ( encodeAddress + ) import Cardano.Wallet.Api.Types ( ApiAddress (..) , ApiAddressWithPath @@ -32,19 +35,30 @@ import Cardano.Wallet.Api.Types , WalletStyle (..) ) import Cardano.Wallet.Primitive.NetworkId - ( HasSNetworkId (..) ) + ( HasSNetworkId (..) + ) import Cardano.Wallet.Primitive.Types.Address - ( AddressState (..) ) + ( AddressState (..) + ) import Control.Monad - ( forM_ ) + ( forM_ + ) import Control.Monad.Trans.Resource - ( ResourceT, runResourceT ) + ( ResourceT + , runResourceT + ) import Data.Generics.Internal.VL.Lens - ( (^.) ) + ( (^.) + ) import Test.Hspec - ( SpecWith, describe, shouldBe, shouldSatisfy ) + ( SpecWith + , describe + , shouldBe + , shouldSatisfy + ) import Test.Hspec.Extra - ( it ) + ( it + ) import Test.Integration.Framework.DSL ( Context , Headers (..) @@ -79,7 +93,8 @@ import Test.Integration.Framework.TestData , errMsg404NoWallet ) import Web.HttpApiData - ( ToHttpApiData (..) ) + ( ToHttpApiData (..) + ) import qualified Cardano.Wallet.Api.Link as Link import qualified Network.HTTP.Types.Status as HTTP diff --git a/lib/wallet/integration/src/Test/Integration/Scenario/API/Byron/CoinSelections.hs b/lib/wallet/integration/src/Test/Integration/Scenario/API/Byron/CoinSelections.hs index 99e834ba199..69a775a6b1d 100644 --- a/lib/wallet/integration/src/Test/Integration/Scenario/API/Byron/CoinSelections.hs +++ b/lib/wallet/integration/src/Test/Integration/Scenario/API/Byron/CoinSelections.hs @@ -14,7 +14,8 @@ module Test.Integration.Scenario.API.Byron.CoinSelections import Prelude import Cardano.Wallet.Address.Discovery.Sequential - ( purposeBIP44 ) + ( purposeBIP44 + ) import Cardano.Wallet.Api.Types ( AddressAmount (..) , ApiByronWallet @@ -22,19 +23,29 @@ import Cardano.Wallet.Api.Types , WalletStyle (..) ) import Cardano.Wallet.Primitive.NetworkId - ( HasSNetworkId ) + ( HasSNetworkId + ) import Data.Generics.Internal.VL.Lens - ( view, (^.) ) + ( view + , (^.) + ) import Data.List.NonEmpty - ( NonEmpty ((:|)) ) + ( NonEmpty ((:|)) + ) import Data.Quantity - ( Quantity (..) ) + ( Quantity (..) + ) import Test.Hspec - ( SpecWith, describe, shouldSatisfy ) + ( SpecWith + , describe + , shouldSatisfy + ) import Test.Hspec.Expectations.Lifted - ( shouldBe ) + ( shouldBe + ) import Test.Hspec.Extra - ( it ) + ( it + ) import Test.Integration.Framework.DSL ( Context (..) , Headers (..) @@ -56,7 +67,9 @@ import Test.Integration.Framework.DSL , walletId ) import Test.Integration.Framework.TestData - ( errMsg403NotAnIcarusWallet, errMsg404NoWallet ) + ( errMsg403NotAnIcarusWallet + , errMsg404NoWallet + ) import qualified Cardano.Wallet.Api.Link as Link import qualified Data.HashSet as Set diff --git a/lib/wallet/integration/src/Test/Integration/Scenario/API/Byron/HWWallets.hs b/lib/wallet/integration/src/Test/Integration/Scenario/API/Byron/HWWallets.hs index f3598cf4914..5314c4fd205 100644 --- a/lib/wallet/integration/src/Test/Integration/Scenario/API/Byron/HWWallets.hs +++ b/lib/wallet/integration/src/Test/Integration/Scenario/API/Byron/HWWallets.hs @@ -24,13 +24,19 @@ import Cardano.Mnemonic , mnemonicToText ) import Cardano.Wallet.Address.Derivation - ( HardDerivation (..), PersistPublicKey (..) ) + ( HardDerivation (..) + , PersistPublicKey (..) + ) import Cardano.Wallet.Address.Discovery.Sequential - ( defaultAddressPoolGap, getAddressPoolGap ) + ( defaultAddressPoolGap + , getAddressPoolGap + ) import Cardano.Wallet.Address.Encoding - ( encodeAddress ) + ( encodeAddress + ) import Cardano.Wallet.Address.Keys.WalletKey - ( publicKey ) + ( publicKey + ) import Cardano.Wallet.Api.Types ( AddressAmount (..) , ApiAddress (..) @@ -43,27 +49,42 @@ import Cardano.Wallet.Api.Types , WalletStyle (..) ) import Cardano.Wallet.Flavor - ( KeyFlavorS (IcarusKeyS) ) + ( KeyFlavorS (IcarusKeyS) + ) import Cardano.Wallet.Primitive.NetworkId - ( HasSNetworkId (..) ) + ( HasSNetworkId (..) + ) import Cardano.Wallet.Primitive.Types.Address - ( AddressState (..) ) + ( AddressState (..) + ) import Control.Monad - ( forM_ ) + ( forM_ + ) import Control.Monad.IO.Class - ( liftIO ) + ( liftIO + ) import Control.Monad.Trans.Resource - ( runResourceT ) + ( runResourceT + ) import Data.Generics.Internal.VL.Lens - ( (^.) ) + ( (^.) + ) import Data.Quantity - ( Quantity (..) ) + ( Quantity (..) + ) import Data.Text - ( Text ) + ( Text + ) import Test.Hspec - ( SpecWith, describe, pendingWith, shouldBe, shouldSatisfy ) + ( SpecWith + , describe + , pendingWith + , shouldBe + , shouldSatisfy + ) import Test.Hspec.Extra - ( it ) + ( it + ) import Test.Integration.Framework.DSL ( Context (..) , Headers (..) @@ -90,7 +111,10 @@ import Test.Integration.Framework.DSL , walletId ) import Test.Integration.Framework.TestData - ( errMsg403NoRootKey, updateNamePayload, updatePassPayload ) + ( errMsg403NoRootKey + , updateNamePayload + , updatePassPayload + ) import qualified Cardano.Wallet.Address.Derivation.Icarus as Icarus import qualified Cardano.Wallet.Api.Link as Link diff --git a/lib/wallet/integration/src/Test/Integration/Scenario/API/Byron/Migrations.hs b/lib/wallet/integration/src/Test/Integration/Scenario/API/Byron/Migrations.hs index 84334a03372..dd592083325 100644 --- a/lib/wallet/integration/src/Test/Integration/Scenario/API/Byron/Migrations.hs +++ b/lib/wallet/integration/src/Test/Integration/Scenario/API/Byron/Migrations.hs @@ -17,9 +17,12 @@ module Test.Integration.Scenario.API.Byron.Migrations import Prelude import Cardano.Mnemonic - ( entropyToMnemonic, genEntropy ) + ( entropyToMnemonic + , genEntropy + ) import Cardano.Wallet.Address.Encoding - ( encodeAddress ) + ( encodeAddress + ) import Cardano.Wallet.Api.Types ( ApiAddress , ApiByronWallet @@ -33,31 +36,50 @@ import Cardano.Wallet.Api.Types , WalletStyle (..) ) import Cardano.Wallet.Primitive.NetworkId - ( HasSNetworkId (..) ) + ( HasSNetworkId (..) + ) import Cardano.Wallet.Primitive.Types.Tx.TxMeta - ( TxStatus (..) ) + ( TxStatus (..) + ) import Control.Monad - ( forM_, void, when ) + ( forM_ + , void + , when + ) import Control.Monad.IO.Class - ( liftIO ) + ( liftIO + ) import Control.Monad.Trans.Resource - ( runResourceT ) + ( runResourceT + ) import Data.Functor - ( (<&>) ) + ( (<&>) + ) import Data.Generics.Internal.VL.Lens - ( view, (^.) ) + ( view + , (^.) + ) import Data.Maybe - ( mapMaybe ) + ( mapMaybe + ) import Data.Quantity - ( Quantity (..) ) + ( Quantity (..) + ) import Data.Text - ( Text ) + ( Text + ) import Data.Word - ( Word64 ) + ( Word64 + ) import Test.Hspec - ( SpecWith, describe, shouldBe, shouldSatisfy ) + ( SpecWith + , describe + , shouldBe + , shouldSatisfy + ) import Test.Hspec.Extra - ( it ) + ( it + ) import Test.Integration.Framework.DSL ( Context (..) , Headers (..) diff --git a/lib/wallet/integration/src/Test/Integration/Scenario/API/Byron/Network.hs b/lib/wallet/integration/src/Test/Integration/Scenario/API/Byron/Network.hs index 491a2e410a9..7086d44eae4 100644 --- a/lib/wallet/integration/src/Test/Integration/Scenario/API/Byron/Network.hs +++ b/lib/wallet/integration/src/Test/Integration/Scenario/API/Byron/Network.hs @@ -12,13 +12,21 @@ module Test.Integration.Scenario.API.Byron.Network import Prelude import Cardano.Wallet.Api.Types - ( ApiNetworkParameters (..) ) + ( ApiNetworkParameters (..) + ) import Data.Quantity - ( Quantity (..), mkPercentage ) + ( Quantity (..) + , mkPercentage + ) import Data.Ratio - ( (%) ) + ( (%) + ) import Test.Hspec - ( SpecWith, describe, it, shouldBe ) + ( SpecWith + , describe + , it + , shouldBe + ) import Test.Integration.Framework.DSL ( Context (..) , Headers (..) diff --git a/lib/wallet/integration/src/Test/Integration/Scenario/API/Byron/Transactions.hs b/lib/wallet/integration/src/Test/Integration/Scenario/API/Byron/Transactions.hs index 165bc91f26d..9348c148921 100644 --- a/lib/wallet/integration/src/Test/Integration/Scenario/API/Byron/Transactions.hs +++ b/lib/wallet/integration/src/Test/Integration/Scenario/API/Byron/Transactions.hs @@ -29,39 +29,59 @@ import Cardano.Wallet.Api.Types , WalletStyle (..) ) import Cardano.Wallet.Api.Types.Transaction - ( ApiLimit (..) ) + ( ApiLimit (..) + ) import Cardano.Wallet.Primitive.NetworkId - ( HasSNetworkId ) + ( HasSNetworkId + ) import Cardano.Wallet.Primitive.Types.Hash - ( Hash (..) ) + ( Hash (..) + ) import Cardano.Wallet.Primitive.Types.TokenPolicy - ( mkTokenFingerprint ) + ( mkTokenFingerprint + ) import Cardano.Wallet.Primitive.Types.Tx.TxMeta - ( Direction (..), TxStatus (..) ) + ( Direction (..) + , TxStatus (..) + ) import Cardano.Wallet.Unsafe - ( unsafeFromText ) + ( unsafeFromText + ) import Control.Monad - ( forM_ ) + ( forM_ + ) import Control.Monad.IO.Class - ( liftIO ) + ( liftIO + ) import Control.Monad.Trans.Resource - ( runResourceT ) + ( runResourceT + ) import Data.Bifunctor - ( bimap ) + ( bimap + ) import Data.Generics.Internal.VL.Lens - ( (^.) ) + ( (^.) + ) import Data.Quantity - ( Quantity (..) ) + ( Quantity (..) + ) import Data.Text.Class - ( fromText ) + ( fromText + ) import Numeric.Natural - ( Natural ) + ( Natural + ) import Test.Hspec - ( SpecWith, describe ) + ( SpecWith + , describe + ) import Test.Hspec.Expectations.Lifted - ( shouldBe, shouldNotBe ) + ( shouldBe + , shouldNotBe + ) import Test.Hspec.Extra - ( it ) + ( it + ) import Test.Integration.Framework.DSL ( Context (..) , Headers (..) @@ -100,7 +120,8 @@ import Test.Integration.Framework.DSL , (.>=) ) import Test.Integration.Framework.Request - ( RequestException ) + ( RequestException + ) import Test.Integration.Framework.TestData ( errMsg400StartTimeLaterThanEndTime , errMsg403MinUTxOValue diff --git a/lib/wallet/integration/src/Test/Integration/Scenario/API/Byron/Wallets.hs b/lib/wallet/integration/src/Test/Integration/Scenario/API/Byron/Wallets.hs index 2f39c11b599..78941f9f1b0 100644 --- a/lib/wallet/integration/src/Test/Integration/Scenario/API/Byron/Wallets.hs +++ b/lib/wallet/integration/src/Test/Integration/Scenario/API/Byron/Wallets.hs @@ -23,31 +23,51 @@ import Cardano.Wallet.Api.Types , WalletStyle (..) ) import Cardano.Wallet.Primitive.NetworkId - ( HasSNetworkId ) + ( HasSNetworkId + ) import Cardano.Wallet.Primitive.Passphrase - ( PassphraseMaxLength (..), PassphraseMinLength (..) ) + ( PassphraseMaxLength (..) + , PassphraseMinLength (..) + ) import Cardano.Wallet.Primitive.SyncProgress - ( SyncProgress (..) ) + ( SyncProgress (..) + ) import Control.Monad - ( forM_ ) + ( forM_ + ) import Control.Monad.IO.Class - ( liftIO ) + ( liftIO + ) import Control.Monad.Trans.Resource - ( runResourceT ) + ( runResourceT + ) import Data.Generics.Internal.VL.Lens - ( view, (^.) ) + ( view + , (^.) + ) import Data.Maybe - ( isJust, isNothing ) + ( isJust + , isNothing + ) import Data.Proxy - ( Proxy (..) ) + ( Proxy (..) + ) import Data.Quantity - ( Quantity (..) ) + ( Quantity (..) + ) import Test.Hspec - ( SpecWith, describe, runIO ) + ( SpecWith + , describe + , runIO + ) import Test.Hspec.Expectations.Lifted - ( shouldBe, shouldNotBe, shouldSatisfy ) + ( shouldBe + , shouldNotBe + , shouldSatisfy + ) import Test.Hspec.Extra - ( it ) + ( it + ) import Test.Integration.Framework.DSL ( Context (..) , Headers (..) diff --git a/lib/wallet/integration/src/Test/Integration/Scenario/API/Network.hs b/lib/wallet/integration/src/Test/Integration/Scenario/API/Network.hs index 3138389b112..a417df96ad9 100644 --- a/lib/wallet/integration/src/Test/Integration/Scenario/API/Network.hs +++ b/lib/wallet/integration/src/Test/Integration/Scenario/API/Network.hs @@ -21,25 +21,40 @@ import Cardano.Wallet.Api.Types , nextEpoch ) import Cardano.Wallet.Launch.Cluster - ( TestnetMagic (testnetMagicToNatural) ) + ( TestnetMagic (testnetMagicToNatural) + ) import Cardano.Wallet.Pools - ( EpochInfo (..) ) + ( EpochInfo (..) + ) import Cardano.Wallet.Primitive.SyncProgress - ( SyncProgress (..) ) + ( SyncProgress (..) + ) import Control.Monad - ( when ) + ( when + ) import Control.Monad.IO.Class - ( liftIO ) + ( liftIO + ) import Control.Monad.Trans.Resource - ( runResourceT ) + ( runResourceT + ) import Data.Generics.Internal.VL.Lens - ( view, (^.) ) + ( view + , (^.) + ) import Data.Time.Clock - ( getCurrentTime ) + ( getCurrentTime + ) import Test.Hspec - ( SpecWith, describe, pendingWith, shouldBe, shouldNotBe ) + ( SpecWith + , describe + , pendingWith + , shouldBe + , shouldNotBe + ) import Test.Hspec.Extra - ( it ) + ( it + ) import Test.Integration.Framework.DSL ( Context (..) , Headers (..) @@ -56,7 +71,8 @@ import Test.Integration.Framework.DSL , (.>) ) import Test.Utils.Paths - ( inNixBuild ) + ( inNixBuild + ) import qualified Cardano.Wallet.Api.Link as Link import qualified Network.HTTP.Types.Status as HTTP diff --git a/lib/wallet/integration/src/Test/Integration/Scenario/API/Shared/Addresses.hs b/lib/wallet/integration/src/Test/Integration/Scenario/API/Shared/Addresses.hs index 0c1dae3c285..59053dad21e 100644 --- a/lib/wallet/integration/src/Test/Integration/Scenario/API/Shared/Addresses.hs +++ b/lib/wallet/integration/src/Test/Integration/Scenario/API/Shared/Addresses.hs @@ -21,27 +21,44 @@ module Test.Integration.Scenario.API.Shared.Addresses import Prelude import Cardano.Wallet.Address.Derivation.SharedKey - ( purposeCIP1854 ) + ( purposeCIP1854 + ) import Cardano.Wallet.Address.Discovery.Sequential - ( defaultAddressPoolGap, getAddressPoolGap ) + ( defaultAddressPoolGap + , getAddressPoolGap + ) import Cardano.Wallet.Api.Types - ( ApiAddressWithPath, ApiSharedWallet (..), WalletStyle (..) ) + ( ApiAddressWithPath + , ApiSharedWallet (..) + , WalletStyle (..) + ) import Cardano.Wallet.Primitive.NetworkId - ( HasSNetworkId ) + ( HasSNetworkId + ) import Cardano.Wallet.Primitive.Types.Address - ( AddressState (..) ) + ( AddressState (..) + ) import Control.Monad - ( forM_ ) + ( forM_ + ) import Control.Monad.IO.Class - ( liftIO ) + ( liftIO + ) import Control.Monad.Trans.Resource - ( runResourceT ) + ( runResourceT + ) import Data.Text - ( Text ) + ( Text + ) import Test.Hspec - ( SpecWith, describe, shouldBe, shouldSatisfy ) + ( SpecWith + , describe + , shouldBe + , shouldSatisfy + ) import Test.Hspec.Extra - ( it ) + ( it + ) import Test.Integration.Framework.DSL ( Context (..) , Headers (..) diff --git a/lib/wallet/integration/src/Test/Integration/Scenario/API/Shared/Transactions.hs b/lib/wallet/integration/src/Test/Integration/Scenario/API/Shared/Transactions.hs index 14000c81a7c..36e0be3fd84 100644 --- a/lib/wallet/integration/src/Test/Integration/Scenario/API/Shared/Transactions.hs +++ b/lib/wallet/integration/src/Test/Integration/Scenario/API/Shared/Transactions.hs @@ -22,13 +22,18 @@ module Test.Integration.Scenario.API.Shared.Transactions import Prelude import Cardano.Mnemonic - ( MkSomeMnemonic (..) ) + ( MkSomeMnemonic (..) + ) import Cardano.Wallet.Address.Derivation - ( DerivationIndex (..), Index (..) ) + ( DerivationIndex (..) + , Index (..) + ) import Cardano.Wallet.Address.Derivation.SharedKey - ( replaceCosignersWithVerKeys ) + ( replaceCosignersWithVerKeys + ) import Cardano.Wallet.Address.Discovery.Shared - ( CredentialType (..) ) + ( CredentialType (..) + ) import Cardano.Wallet.Api.Types ( ApiAddress (..) , ApiAddressWithPath (..) @@ -54,19 +59,26 @@ import Cardano.Wallet.Api.Types , insertedAt ) import Cardano.Wallet.Api.Types.Error - ( ApiErrorInfo (..) ) + ( ApiErrorInfo (..) + ) import Cardano.Wallet.Api.Types.Transaction - ( mkApiWitnessCount ) + ( mkApiWitnessCount + ) import Cardano.Wallet.Pools - ( StakePool ) + ( StakePool + ) import Cardano.Wallet.Primitive.NetworkId - ( HasSNetworkId ) + ( HasSNetworkId + ) import Cardano.Wallet.Primitive.Passphrase - ( Passphrase (..) ) + ( Passphrase (..) + ) import Cardano.Wallet.Primitive.Types - ( SortOrder (..) ) + ( SortOrder (..) + ) import Cardano.Wallet.Primitive.Types.Hash - ( Hash (..) ) + ( Hash (..) + ) import Cardano.Wallet.Primitive.Types.Tx ( TxMetadata (..) , TxMetadataValue (..) @@ -74,7 +86,9 @@ import Cardano.Wallet.Primitive.Types.Tx , cardanoTxIdeallyNoLaterThan ) import Cardano.Wallet.Primitive.Types.Tx.TxMeta - ( Direction (..), TxStatus (..) ) + ( Direction (..) + , TxStatus (..) + ) import Cardano.Wallet.Transaction ( AnyExplicitScript (..) , ScriptReference (..) @@ -82,39 +96,66 @@ import Cardano.Wallet.Transaction , changeRoleInAnyExplicitScript ) import Control.Monad - ( forM_ ) + ( forM_ + ) import Control.Monad.IO.Unlift - ( MonadUnliftIO (..), liftIO ) + ( MonadUnliftIO (..) + , liftIO + ) import Control.Monad.Trans.Resource - ( runResourceT ) + ( runResourceT + ) import Data.Aeson - ( toJSON ) + ( toJSON + ) import Data.Either.Combinators - ( swapEither ) + ( swapEither + ) import Data.Function - ( (&) ) + ( (&) + ) import Data.Generics.Internal.VL.Lens - ( view, (^.) ) + ( view + , (^.) + ) import Data.Generics.Wrapped - ( _Unwrapped ) + ( _Unwrapped + ) import Data.Maybe - ( isJust ) + ( isJust + ) import Data.Quantity - ( Quantity (..) ) + ( Quantity (..) + ) import Data.Text.Class - ( FromText (..), ToText (..) ) + ( FromText (..) + , ToText (..) + ) import Data.Time.Clock - ( UTCTime, addUTCTime ) + ( UTCTime + , addUTCTime + ) import Data.Time.Utils - ( utcTimePred, utcTimeSucc ) + ( utcTimePred + , utcTimeSucc + ) import Numeric.Natural - ( Natural ) + ( Natural + ) import Test.Hspec - ( SpecWith, describe, pendingWith ) + ( SpecWith + , describe + , pendingWith + ) import Test.Hspec.Expectations.Lifted - ( shouldBe, shouldContain, shouldNotContain, shouldSatisfy ) + ( shouldBe + , shouldContain + , shouldNotContain + , shouldSatisfy + ) import Test.Hspec.Extra - ( it ) + ( it + ) import Test.Integration.Framework.DSL ( Context (..) , Headers (..) @@ -166,7 +207,8 @@ import Test.Integration.Framework.DSL , (.>) ) import Test.Integration.Framework.Request - ( RequestException ) + ( RequestException + ) import Test.Integration.Framework.TestData ( errMsg400MinWithdrawalWrong , errMsg400StartTimeLaterThanEndTime diff --git a/lib/wallet/integration/src/Test/Integration/Scenario/API/Shared/Wallets.hs b/lib/wallet/integration/src/Test/Integration/Scenario/API/Shared/Wallets.hs index 1cbe12dd794..c53c94066fd 100644 --- a/lib/wallet/integration/src/Test/Integration/Scenario/API/Shared/Wallets.hs +++ b/lib/wallet/integration/src/Test/Integration/Scenario/API/Shared/Wallets.hs @@ -21,15 +21,23 @@ module Test.Integration.Scenario.API.Shared.Wallets import Prelude import Cardano.Address.Script - ( Cosigner (..), ScriptTemplate (..) ) + ( Cosigner (..) + , ScriptTemplate (..) + ) import Cardano.Mnemonic - ( MkSomeMnemonic (..) ) + ( MkSomeMnemonic (..) + ) import Cardano.Wallet.Address.Derivation - ( DerivationIndex (..), Role (..) ) + ( DerivationIndex (..) + , Role (..) + ) import Cardano.Wallet.Address.Discovery.Sequential - ( defaultAddressPoolGap, getAddressPoolGap ) + ( defaultAddressPoolGap + , getAddressPoolGap + ) import Cardano.Wallet.Address.Discovery.Shared - ( CredentialType (..) ) + ( CredentialType (..) + ) import Cardano.Wallet.Api.Types ( ApiAccountKeyShared (..) , ApiActiveSharedWallet @@ -48,43 +56,68 @@ import Cardano.Wallet.Api.Types , WalletStyle (..) ) import Cardano.Wallet.Api.Types.Error - ( ApiErrorInfo (..), ApiErrorSharedWalletNoSuchCosigner (..) ) + ( ApiErrorInfo (..) + , ApiErrorSharedWalletNoSuchCosigner (..) + ) import Cardano.Wallet.Compat - ( (^?) ) + ( (^?) + ) import Cardano.Wallet.Primitive.NetworkId - ( HasSNetworkId ) + ( HasSNetworkId + ) import Cardano.Wallet.Primitive.Passphrase - ( Passphrase (..) ) + ( Passphrase (..) + ) import Cardano.Wallet.Primitive.SyncProgress - ( SyncProgress (..) ) + ( SyncProgress (..) + ) import Cardano.Wallet.Primitive.Types.Address - ( AddressState (..) ) + ( AddressState (..) + ) import Control.Monad - ( forM, forM_ ) + ( forM + , forM_ + ) import Control.Monad.IO.Class - ( liftIO ) + ( liftIO + ) import Control.Monad.Trans.Resource - ( runResourceT ) + ( runResourceT + ) import Data.Aeson - ( ToJSON (..), Value (String) ) + ( ToJSON (..) + , Value (String) + ) import Data.Either.Combinators - ( swapEither ) + ( swapEither + ) import Data.Generics.Internal.VL.Lens - ( view, (^.) ) + ( view + , (^.) + ) import Data.Quantity - ( Quantity (..) ) + ( Quantity (..) + ) import Data.Text - ( Text ) + ( Text + ) import Data.Text.Class - ( ToText (..) ) + ( ToText (..) + ) import Numeric.Natural - ( Natural ) + ( Natural + ) import Test.Hspec - ( SpecWith, describe ) + ( SpecWith + , describe + ) import Test.Hspec.Expectations.Lifted - ( shouldBe, shouldNotBe ) + ( shouldBe + , shouldNotBe + ) import Test.Hspec.Extra - ( it ) + ( it + ) import Test.Integration.Framework.DSL ( Context (..) , Headers (..) diff --git a/lib/wallet/integration/src/Test/Integration/Scenario/API/Shelley/Addresses.hs b/lib/wallet/integration/src/Test/Integration/Scenario/API/Shelley/Addresses.hs index ccbfb051821..91bc73ff186 100644 --- a/lib/wallet/integration/src/Test/Integration/Scenario/API/Shelley/Addresses.hs +++ b/lib/wallet/integration/src/Test/Integration/Scenario/API/Shelley/Addresses.hs @@ -17,9 +17,14 @@ module Test.Integration.Scenario.API.Shelley.Addresses import Prelude import Cardano.Wallet.Address.Derivation - ( DerivationIndex (..), Role (..) ) + ( DerivationIndex (..) + , Role (..) + ) import Cardano.Wallet.Address.Discovery.Sequential - ( defaultAddressPoolGap, getAddressPoolGap, purposeCIP1852 ) + ( defaultAddressPoolGap + , getAddressPoolGap + , purposeCIP1852 + ) import Cardano.Wallet.Api.Types ( AnyAddress , ApiAccountKey @@ -31,31 +36,51 @@ import Cardano.Wallet.Api.Types , WalletStyle (..) ) import Cardano.Wallet.Primitive.NetworkId - ( HasSNetworkId ) + ( HasSNetworkId + ) import Cardano.Wallet.Primitive.Types.Address - ( AddressState (..) ) + ( AddressState (..) + ) import Cardano.Wallet.Primitive.Types.Tx.TxMeta - ( TxStatus (..) ) + ( TxStatus (..) + ) import Control.Monad - ( forM, forM_ ) + ( forM + , forM_ + ) import Control.Monad.IO.Class - ( liftIO ) + ( liftIO + ) import Control.Monad.Trans.Resource - ( runResourceT ) + ( runResourceT + ) import Data.Aeson - ( ToJSON (..), object, (.=) ) + ( ToJSON (..) + , object + , (.=) + ) import Data.Generics.Internal.VL.Lens - ( view, (^.) ) + ( view + , (^.) + ) import Data.Quantity - ( Quantity (..) ) + ( Quantity (..) + ) import Data.Text - ( Text ) + ( Text + ) import Test.Hspec - ( SpecWith, describe ) + ( SpecWith + , describe + ) import Test.Hspec.Expectations.Lifted - ( shouldBe, shouldNotBe, shouldSatisfy ) + ( shouldBe + , shouldNotBe + , shouldSatisfy + ) import Test.Hspec.Extra - ( it ) + ( it + ) import Test.Integration.Framework.DSL ( Context (..) , Headers (..) diff --git a/lib/wallet/integration/src/Test/Integration/Scenario/API/Shelley/CoinSelections.hs b/lib/wallet/integration/src/Test/Integration/Scenario/API/Shelley/CoinSelections.hs index 7cb8000d2b7..711fbc4ca46 100644 --- a/lib/wallet/integration/src/Test/Integration/Scenario/API/Shelley/CoinSelections.hs +++ b/lib/wallet/integration/src/Test/Integration/Scenario/API/Shelley/CoinSelections.hs @@ -21,9 +21,11 @@ module Test.Integration.Scenario.API.Shelley.CoinSelections import Prelude import Cardano.Mnemonic - ( mnemonicToText ) + ( mnemonicToText + ) import Cardano.Wallet.Address.Discovery.Sequential - ( purposeCIP1852 ) + ( purposeCIP1852 + ) import Cardano.Wallet.Api.Types ( AddressAmount (..) , ApiCoinSelection @@ -34,33 +36,52 @@ import Cardano.Wallet.Api.Types , apiAddress ) import Cardano.Wallet.Primitive.NetworkId - ( HasSNetworkId ) + ( HasSNetworkId + ) import Cardano.Wallet.Primitive.Types.Hash - ( Hash (..) ) + ( Hash (..) + ) import Cardano.Wallet.Primitive.Types.TokenMap - ( AssetId (..) ) + ( AssetId (..) + ) import Cardano.Wallet.Primitive.Types.TokenPolicy - ( TokenName (..), TokenPolicyId (..) ) + ( TokenName (..) + , TokenPolicyId (..) + ) import Cardano.Wallet.Primitive.Types.TokenQuantity - ( TokenQuantity (..) ) + ( TokenQuantity (..) + ) import Cardano.Wallet.Primitive.Types.Tx.Constraints - ( txOutMaxTokenQuantity ) + ( txOutMaxTokenQuantity + ) import Control.Monad - ( forM_ ) + ( forM_ + ) import Data.Generics.Internal.VL.Lens - ( view, (^.) ) + ( view + , (^.) + ) import Data.List.NonEmpty - ( NonEmpty ((:|)) ) + ( NonEmpty ((:|)) + ) import Data.Maybe - ( isJust ) + ( isJust + ) import Data.Quantity - ( Quantity (..) ) + ( Quantity (..) + ) import Data.Text.Class - ( toText ) + ( toText + ) import Test.Hspec - ( SpecWith, describe, shouldBe, shouldSatisfy ) + ( SpecWith + , describe + , shouldBe + , shouldSatisfy + ) import Test.Hspec.Extra - ( it ) + ( it + ) import Test.Integration.Framework.DSL ( Context (..) , Headers (..) diff --git a/lib/wallet/integration/src/Test/Integration/Scenario/API/Shelley/HWWallets.hs b/lib/wallet/integration/src/Test/Integration/Scenario/API/Shelley/HWWallets.hs index 06ecd9d17d7..b5d744c3ef6 100644 --- a/lib/wallet/integration/src/Test/Integration/Scenario/API/Shelley/HWWallets.hs +++ b/lib/wallet/integration/src/Test/Integration/Scenario/API/Shelley/HWWallets.hs @@ -15,9 +15,14 @@ module Test.Integration.Scenario.API.Shelley.HWWallets import Prelude import Cardano.Mnemonic - ( entropyToMnemonic, genEntropy, mnemonicToText ) + ( entropyToMnemonic + , genEntropy + , mnemonicToText + ) import Cardano.Wallet.Address.Discovery.Sequential - ( defaultAddressPoolGap, getAddressPoolGap ) + ( defaultAddressPoolGap + , getAddressPoolGap + ) import Cardano.Wallet.Api.Types ( ApiAddressWithPath , ApiFee @@ -27,29 +32,44 @@ import Cardano.Wallet.Api.Types , WalletStyle (..) ) import Cardano.Wallet.Primitive.NetworkId - ( HasSNetworkId ) + ( HasSNetworkId + ) import Cardano.Wallet.Primitive.Types.Address - ( AddressState (..) ) + ( AddressState (..) + ) import Control.Monad - ( forM_ ) + ( forM_ + ) import Control.Monad.IO.Class - ( liftIO ) + ( liftIO + ) import Control.Monad.Trans.Resource - ( runResourceT ) + ( runResourceT + ) import Data.Generics.Internal.VL.Lens - ( view, (^.) ) + ( view + , (^.) + ) import Data.Proxy - ( Proxy (..) ) + ( Proxy (..) + ) import Data.Quantity - ( Quantity (..) ) + ( Quantity (..) + ) import Data.Text - ( Text ) + ( Text + ) import Test.Hspec - ( SpecWith, describe ) + ( SpecWith + , describe + ) import Test.Hspec.Expectations.Lifted - ( shouldBe, shouldContain ) + ( shouldBe + , shouldContain + ) import Test.Hspec.Extra - ( it ) + ( it + ) import Test.Integration.Framework.DSL ( Context (..) , Headers (..) @@ -78,7 +98,11 @@ import Test.Integration.Framework.DSL , walletId ) import Test.Integration.Framework.TestData - ( errMsg403NoRootKey, payloadWith, updateNamePayload, updatePassPayload ) + ( errMsg403NoRootKey + , payloadWith + , updateNamePayload + , updatePassPayload + ) import qualified Cardano.Wallet.Api.Link as Link import qualified Network.HTTP.Types.Status as HTTP diff --git a/lib/wallet/integration/src/Test/Integration/Scenario/API/Shelley/Migrations.hs b/lib/wallet/integration/src/Test/Integration/Scenario/API/Shelley/Migrations.hs index 57d83317d16..0f4a463cbce 100644 --- a/lib/wallet/integration/src/Test/Integration/Scenario/API/Shelley/Migrations.hs +++ b/lib/wallet/integration/src/Test/Integration/Scenario/API/Shelley/Migrations.hs @@ -17,9 +17,13 @@ module Test.Integration.Scenario.API.Shelley.Migrations import Prelude import Cardano.Mnemonic - ( entropyToMnemonic, genEntropy, mnemonicToText ) + ( entropyToMnemonic + , genEntropy + , mnemonicToText + ) import Cardano.Wallet.Address.Encoding - ( encodeAddress ) + ( encodeAddress + ) import Cardano.Wallet.Api.Types ( ApiAddress , ApiEra (..) @@ -32,39 +36,63 @@ import Cardano.Wallet.Api.Types , apiAddress ) import Cardano.Wallet.Faucet - ( bigDustWallet, onlyDustWallet ) + ( bigDustWallet + , onlyDustWallet + ) import Cardano.Wallet.Primitive.NetworkId - ( HasSNetworkId (..) ) + ( HasSNetworkId (..) + ) import Cardano.Wallet.Primitive.Types.Address - ( unAddress ) + ( unAddress + ) import Cardano.Wallet.Primitive.Types.Coin - ( Coin (..) ) + ( Coin (..) + ) import Cardano.Wallet.Primitive.Types.TokenBundle - ( TokenBundle (..) ) + ( TokenBundle (..) + ) import Cardano.Wallet.Primitive.Types.Tx.TxMeta - ( TxStatus (..) ) + ( TxStatus (..) + ) import Control.Monad - ( forM_, replicateM_, void, when ) + ( forM_ + , replicateM_ + , void + , when + ) import Control.Monad.IO.Class - ( liftIO ) + ( liftIO + ) import Control.Monad.Trans.Resource - ( runResourceT ) + ( runResourceT + ) import Data.Function - ( (&) ) + ( (&) + ) import Data.Functor - ( (<&>) ) + ( (<&>) + ) import Data.Generics.Internal.VL.Lens - ( view, (^.) ) + ( view + , (^.) + ) import Data.Quantity - ( Quantity (..) ) + ( Quantity (..) + ) import Numeric.Natural - ( Natural ) + ( Natural + ) import Test.Hspec - ( SpecWith, describe ) + ( SpecWith + , describe + ) import Test.Hspec.Expectations.Lifted - ( shouldBe, shouldSatisfy ) + ( shouldBe + , shouldSatisfy + ) import Test.Hspec.Extra - ( it ) + ( it + ) import Test.Integration.Framework.DSL ( Context (..) , Headers (..) diff --git a/lib/wallet/integration/src/Test/Integration/Scenario/API/Shelley/Network.hs b/lib/wallet/integration/src/Test/Integration/Scenario/API/Shelley/Network.hs index 799ccc67a78..7a51f7fc13c 100644 --- a/lib/wallet/integration/src/Test/Integration/Scenario/API/Shelley/Network.hs +++ b/lib/wallet/integration/src/Test/Integration/Scenario/API/Shelley/Network.hs @@ -13,21 +13,36 @@ module Test.Integration.Scenario.API.Shelley.Network import Prelude import Cardano.Wallet.Api.Types - ( ApiEra (..), ApiNetworkParameters (..) ) + ( ApiEra (..) + , ApiNetworkParameters (..) + ) import Cardano.Wallet.Pools - ( EpochInfo (..) ) + ( EpochInfo (..) + ) import Cardano.Wallet.Primitive.Types - ( ExecutionUnitPrices (..) ) + ( ExecutionUnitPrices (..) + ) import Data.List - ( (\\) ) + ( (\\) + ) import Data.Quantity - ( Quantity (..), mkPercentage ) + ( Quantity (..) + , mkPercentage + ) import Data.Ratio - ( (%) ) + ( (%) + ) import Test.Hspec - ( Expectation, SpecWith, describe, shouldBe, shouldNotBe, shouldSatisfy ) + ( Expectation + , SpecWith + , describe + , shouldBe + , shouldNotBe + , shouldSatisfy + ) import Test.Hspec.Extra - ( it ) + ( it + ) import Test.Integration.Framework.DSL ( Context (..) , Headers (..) diff --git a/lib/wallet/integration/src/Test/Integration/Scenario/API/Shelley/Settings.hs b/lib/wallet/integration/src/Test/Integration/Scenario/API/Shelley/Settings.hs index 35fda8a757c..c64a89641a9 100644 --- a/lib/wallet/integration/src/Test/Integration/Scenario/API/Shelley/Settings.hs +++ b/lib/wallet/integration/src/Test/Integration/Scenario/API/Shelley/Settings.hs @@ -14,25 +14,40 @@ module Test.Integration.Scenario.API.Shelley.Settings import Prelude import Cardano.Wallet.Api.Lib.ApiT - ( ApiT (..) ) + ( ApiT (..) + ) import Cardano.Wallet.Pools - ( StakePool ) + ( StakePool + ) import Cardano.Wallet.Primitive.Types - ( PoolMetadataSource (..), Settings ) + ( PoolMetadataSource (..) + , Settings + ) import Cardano.Wallet.Primitive.Types.Coin - ( Coin (..) ) + ( Coin (..) + ) import Data.Either - ( fromRight ) + ( fromRight + ) import Data.Generics.Internal.VL.Lens - ( view ) + ( view + ) import Data.Maybe - ( isJust, isNothing ) + ( isJust + , isNothing + ) import Data.Text.Class - ( fromText ) + ( fromText + ) import Test.Hspec - ( SpecWith, describe, shouldBe, shouldSatisfy ) + ( SpecWith + , describe + , shouldBe + , shouldSatisfy + ) import Test.Hspec.Extra - ( it ) + ( it + ) import Test.Integration.Framework.DSL ( Context (..) , Headers (..) diff --git a/lib/wallet/integration/src/Test/Integration/Scenario/API/Shelley/StakePools.hs b/lib/wallet/integration/src/Test/Integration/Scenario/API/Shelley/StakePools.hs index 8d0eb3367c8..714543c5d78 100644 --- a/lib/wallet/integration/src/Test/Integration/Scenario/API/Shelley/StakePools.hs +++ b/lib/wallet/integration/src/Test/Integration/Scenario/API/Shelley/StakePools.hs @@ -13,18 +13,24 @@ module Test.Integration.Scenario.API.Shelley.StakePools (spec) where import Prelude hiding - ( id ) + ( id + ) import Cardano.Mnemonic - ( mnemonicToText ) + ( mnemonicToText + ) import Cardano.Pool.Metadata - ( HealthCheckSMASH (..) ) + ( HealthCheckSMASH (..) + ) import Cardano.Pool.Metadata.Types ( PoolMetadataGCStatus (NotApplicable) , StakePoolMetadata (StakePoolMetadata, description, homepage, name, ticker) ) import Cardano.Pool.Types - ( PoolId (PoolId), StakePoolTicker (StakePoolTicker), decodePoolIdBech32 ) + ( PoolId (PoolId) + , StakePoolTicker (StakePoolTicker) + , decodePoolIdBech32 + ) import Cardano.Wallet.Api.Types ( ApiCertificate (JoinPool, QuitPool, RegisterRewardAccount) , ApiEra (..) @@ -41,57 +47,100 @@ import Cardano.Wallet.Api.Types , WalletStyle (..) ) import Cardano.Wallet.Faucet - ( preregKeyWallet ) + ( preregKeyWallet + ) import Cardano.Wallet.Pools - ( StakePool (..), StakePoolFlag (Delisted) ) + ( StakePool (..) + , StakePoolFlag (Delisted) + ) import Cardano.Wallet.Primitive.NetworkId - ( HasSNetworkId ) + ( HasSNetworkId + ) import Cardano.Wallet.Primitive.Types - ( FeePolicy (..), LinearFunction (..), PoolMetadataSource (..) ) + ( FeePolicy (..) + , LinearFunction (..) + , PoolMetadataSource (..) + ) import Cardano.Wallet.Primitive.Types.Coin - ( Coin (..) ) + ( Coin (..) + ) import Cardano.Wallet.Primitive.Types.Tx.Constraints - ( TxSize (..) ) + ( TxSize (..) + ) import Cardano.Wallet.Primitive.Types.Tx.TxMeta - ( Direction (..), TxStatus (..) ) + ( Direction (..) + , TxStatus (..) + ) import Cardano.Wallet.Unsafe - ( unsafeFromHex, unsafeMkPercentage ) + ( unsafeFromHex + , unsafeMkPercentage + ) import Control.Monad - ( forM_ ) + ( forM_ + ) import Control.Monad.IO.Class - ( liftIO ) + ( liftIO + ) import Control.Monad.Trans.Resource - ( runResourceT ) + ( runResourceT + ) import Data.Function - ( (&) ) + ( (&) + ) import Data.Generics.Internal.VL.Lens - ( view, (^.) ) + ( view + , (^.) + ) import Data.IORef - ( readIORef ) + ( readIORef + ) import Data.List - ( find, sortOn ) + ( find + , sortOn + ) import Data.List.NonEmpty - ( NonEmpty (..) ) + ( NonEmpty (..) + ) import Data.Maybe - ( fromMaybe, isJust, isNothing, listToMaybe, mapMaybe ) + ( fromMaybe + , isJust + , isNothing + , listToMaybe + , mapMaybe + ) import Data.Ord - ( Down (..) ) + ( Down (..) + ) import Data.Quantity - ( Quantity (..) ) + ( Quantity (..) + ) import Data.Set - ( Set ) + ( Set + ) import Data.Text.Class - ( showT, toText ) + ( showT + , toText + ) import Numeric.Natural - ( Natural ) + ( Natural + ) import Test.Hspec - ( SpecWith, describe, pendingWith ) + ( SpecWith + , describe + , pendingWith + ) import Test.Hspec.Expectations.Lifted - ( expectationFailure, shouldBe, shouldSatisfy ) + ( expectationFailure + , shouldBe + , shouldSatisfy + ) import Test.Hspec.Extra - ( it ) + ( it + ) import Test.Integration.Framework.Context - ( Context (..), PoolGarbageCollectionEvent (..) ) + ( Context (..) + , PoolGarbageCollectionEvent (..) + ) import Test.Integration.Framework.DSL ( Headers (..) , Payload (..) diff --git a/lib/wallet/integration/src/Test/Integration/Scenario/API/Shelley/Transactions.hs b/lib/wallet/integration/src/Test/Integration/Scenario/API/Shelley/Transactions.hs index fb0c8450f86..a8fa517d61e 100644 --- a/lib/wallet/integration/src/Test/Integration/Scenario/API/Shelley/Transactions.hs +++ b/lib/wallet/integration/src/Test/Integration/Scenario/API/Shelley/Transactions.hs @@ -24,9 +24,13 @@ module Test.Integration.Scenario.API.Shelley.Transactions import Prelude import Cardano.Mnemonic - ( entropyToMnemonic, genEntropy, mnemonicToText ) + ( entropyToMnemonic + , genEntropy + , mnemonicToText + ) import Cardano.Wallet.Address.Encoding - ( encodeAddress ) + ( encodeAddress + ) import Cardano.Wallet.Api.Types ( AddressAmount (..) , ApiAddress @@ -45,63 +49,113 @@ import Cardano.Wallet.Api.Types , pendingSince ) import Cardano.Wallet.Api.Types.Error - ( ApiErrorInfo (..) ) + ( ApiErrorInfo (..) + ) import Cardano.Wallet.Api.Types.SchemaMetadata - ( detailedMetadata ) + ( detailedMetadata + ) import Cardano.Wallet.Faucet - ( seaHorsePolicyId, seaHorseTokenName ) + ( seaHorsePolicyId + , seaHorseTokenName + ) import Cardano.Wallet.Primitive.NetworkId - ( HasSNetworkId (..) ) + ( HasSNetworkId (..) + ) import Cardano.Wallet.Primitive.Types - ( SortOrder (..), WalletId ) + ( SortOrder (..) + , WalletId + ) import Cardano.Wallet.Primitive.Types.Address - ( unAddress ) + ( unAddress + ) import Cardano.Wallet.Primitive.Types.Coin - ( Coin (..) ) + ( Coin (..) + ) import Cardano.Wallet.Primitive.Types.Hash - ( Hash (..) ) + ( Hash (..) + ) import Cardano.Wallet.Primitive.Types.TokenPolicy - ( mkTokenFingerprint ) + ( mkTokenFingerprint + ) import Cardano.Wallet.Primitive.Types.Tx - ( TxMetadata (..), TxMetadataValue (..) ) + ( TxMetadata (..) + , TxMetadataValue (..) + ) import Cardano.Wallet.Primitive.Types.Tx.TxMeta - ( Direction (..), TxStatus (..) ) + ( Direction (..) + , TxStatus (..) + ) import Cardano.Wallet.Unsafe - ( unsafeFromText ) + ( unsafeFromText + ) import Control.Monad - ( forM, forM_, when ) + ( forM + , forM_ + , when + ) import Control.Monad.IO.Unlift - ( MonadIO (..), MonadUnliftIO (..), liftIO ) + ( MonadIO (..) + , MonadUnliftIO (..) + , liftIO + ) import Control.Monad.Trans.Resource - ( ResourceT, runResourceT ) + ( ResourceT + , runResourceT + ) import Data.Aeson - ( (.=) ) + ( (.=) + ) import Data.Bifunctor - ( bimap ) + ( bimap + ) import Data.Generics.Internal.VL.Lens - ( view, (^.) ) + ( view + , (^.) + ) import Data.Generics.Product.Typed - ( HasType ) + ( HasType + ) import Data.Maybe - ( isJust, isNothing ) + ( isJust + , isNothing + ) import Data.Quantity - ( Quantity (..) ) + ( Quantity (..) + ) import Data.Text - ( Text ) + ( Text + ) import Data.Text.Class - ( FromText (..), ToText (..) ) + ( FromText (..) + , ToText (..) + ) import Data.Time.Clock - ( NominalDiffTime, UTCTime, addUTCTime, getCurrentTime ) + ( NominalDiffTime + , UTCTime + , addUTCTime + , getCurrentTime + ) import Data.Time.Utils - ( utcTimePred, utcTimeSucc ) + ( utcTimePred + , utcTimeSucc + ) import Numeric.Natural - ( Natural ) + ( Natural + ) import Test.Hspec - ( SpecWith, describe, pendingWith ) + ( SpecWith + , describe + , pendingWith + ) import Test.Hspec.Expectations.Lifted - ( expectationFailure, shouldBe, shouldNotBe, shouldSatisfy ) + ( expectationFailure + , shouldBe + , shouldNotBe + , shouldSatisfy + ) import Test.Hspec.Extra - ( it ) + ( it + ) import Test.Integration.Framework.DSL ( Context (_mainEra, _mintSeaHorseAssets) , Headers (..) @@ -155,7 +209,8 @@ import Test.Integration.Framework.DSL , (.>=) ) import Test.Integration.Framework.Request - ( RequestException ) + ( RequestException + ) import Test.Integration.Framework.TestData ( errMsg400MinWithdrawalWrong , errMsg400StartTimeLaterThanEndTime @@ -174,7 +229,8 @@ import Test.Integration.Framework.TestData , txMetadata_ADP_1005 ) import Web.HttpApiData - ( ToHttpApiData (..) ) + ( ToHttpApiData (..) + ) import qualified Cardano.Address as CA import qualified Cardano.Wallet.Api.Link as Link diff --git a/lib/wallet/integration/src/Test/Integration/Scenario/API/Shelley/TransactionsNew.hs b/lib/wallet/integration/src/Test/Integration/Scenario/API/Shelley/TransactionsNew.hs index 10a50347934..c601605f518 100644 --- a/lib/wallet/integration/src/Test/Integration/Scenario/API/Shelley/TransactionsNew.hs +++ b/lib/wallet/integration/src/Test/Integration/Scenario/API/Shelley/TransactionsNew.hs @@ -19,7 +19,9 @@ module Test.Integration.Scenario.API.Shelley.TransactionsNew (spec) where import Prelude import Cardano.Address.Derivation - ( XPub, xpubPublicKey ) + ( XPub + , xpubPublicKey + ) import Cardano.Address.Script ( KeyHash , KeyRole (..) @@ -29,25 +31,44 @@ import Cardano.Address.Script , toScriptHash ) import Cardano.Api - ( CardanoEra (..), InAnyCardanoEra (..) ) + ( CardanoEra (..) + , InAnyCardanoEra (..) + ) import Cardano.Crypto.DSIGN.Class - ( rawDeserialiseVerKeyDSIGN ) + ( rawDeserialiseVerKeyDSIGN + ) import Cardano.Ledger.Alonzo.Core - ( reqSignerHashesTxBodyL ) + ( reqSignerHashesTxBodyL + ) import Cardano.Ledger.Crypto - ( StandardCrypto ) + ( StandardCrypto + ) import Cardano.Mnemonic - ( SomeMnemonic (..) ) + ( SomeMnemonic (..) + ) import Cardano.Pool.Metadata.Types - ( StakePoolMetadataHash (..), StakePoolMetadataUrl (..) ) + ( StakePoolMetadataHash (..) + , StakePoolMetadataUrl (..) + ) import Cardano.Pool.Types - ( PoolId (..), PoolOwner (..), decodePoolIdBech32, encodePoolIdBech32 ) + ( PoolId (..) + , PoolOwner (..) + , decodePoolIdBech32 + , encodePoolIdBech32 + ) import Cardano.Wallet.Address.Derivation - ( DerivationIndex (..), HardDerivation (..), Role (..), hex ) + ( DerivationIndex (..) + , HardDerivation (..) + , Role (..) + , hex + ) import Cardano.Wallet.Address.Keys.WalletKey - ( getRawKey, publicKey ) + ( getRawKey + , publicKey + ) import Cardano.Wallet.Api.Hex - ( fromHexText ) + ( fromHexText + ) import Cardano.Wallet.Api.Types ( AddressAmount (..) , ApiAddressWithPath (..) @@ -82,29 +103,48 @@ import Cardano.Wallet.Api.Types , fromApiEra ) import Cardano.Wallet.Api.Types.Certificate - ( ApiRewardAccount (..) ) + ( ApiRewardAccount (..) + ) import Cardano.Wallet.Api.Types.Transaction - ( ApiAddress (..), ApiValidityIntervalExplicit (..), mkApiWitnessCount ) + ( ApiAddress (..) + , ApiValidityIntervalExplicit (..) + , mkApiWitnessCount + ) import Cardano.Wallet.Flavor - ( KeyFlavorS (..) ) + ( KeyFlavorS (..) + ) import Cardano.Wallet.Pools - ( StakePool ) + ( StakePool + ) import Cardano.Wallet.Primitive.NetworkId - ( HasSNetworkId ) + ( HasSNetworkId + ) import Cardano.Wallet.Primitive.Types - ( EpochNo (..), NonWalletCertificate (..), SlotNo (..) ) + ( EpochNo (..) + , NonWalletCertificate (..) + , SlotNo (..) + ) import Cardano.Wallet.Primitive.Types.Coin - ( Coin (..) ) + ( Coin (..) + ) import Cardano.Wallet.Primitive.Types.Hash - ( Hash (..) ) + ( Hash (..) + ) import Cardano.Wallet.Primitive.Types.RewardAccount - ( RewardAccount (..) ) + ( RewardAccount (..) + ) import Cardano.Wallet.Primitive.Types.TokenBundle - ( AssetId (..) ) + ( AssetId (..) + ) import Cardano.Wallet.Primitive.Types.TokenPolicy - ( TokenName (..), TokenPolicyId (..), mkTokenFingerprint, mkTokenName ) + ( TokenName (..) + , TokenPolicyId (..) + , mkTokenFingerprint + , mkTokenName + ) import Cardano.Wallet.Primitive.Types.TokenQuantity - ( TokenQuantity (..) ) + ( TokenQuantity (..) + ) import Cardano.Wallet.Primitive.Types.Tx ( SealedTx (..) , TxMetadata (..) @@ -113,9 +153,12 @@ import Cardano.Wallet.Primitive.Types.Tx , cardanoTxIdeallyNoLaterThan ) import Cardano.Wallet.Primitive.Types.Tx.TxIn - ( TxIn (..) ) + ( TxIn (..) + ) import Cardano.Wallet.Primitive.Types.Tx.TxMeta - ( Direction (..), TxStatus (..) ) + ( Direction (..) + , TxStatus (..) + ) import Cardano.Wallet.Transaction ( AnyExplicitScript (..) , AnyScript (..) @@ -128,39 +171,64 @@ import Cardano.Wallet.Transaction , changeRoleInAnyExplicitScript ) import Cardano.Wallet.Unsafe - ( unsafeFromHex, unsafeMkMnemonic ) + ( unsafeFromHex + , unsafeMkMnemonic + ) import Control.Arrow - ( second ) + ( second + ) import Control.Monad - ( foldM_, forM_ ) + ( foldM_ + , forM_ + ) import Control.Monad.IO.Unlift - ( MonadIO (..), MonadUnliftIO (..), liftIO ) + ( MonadIO (..) + , MonadUnliftIO (..) + , liftIO + ) import Control.Monad.Trans.Resource - ( runResourceT ) + ( runResourceT + ) import Data.Aeson - ( toJSON, (.=) ) + ( toJSON + , (.=) + ) import Data.Function - ( (&) ) + ( (&) + ) import Data.Functor - ( (<&>) ) + ( (<&>) + ) import Data.Generics.Internal.VL.Lens - ( view, (^.) ) + ( view + , (^.) + ) import Data.Generics.Wrapped - ( _Unwrapped ) + ( _Unwrapped + ) import Data.Maybe - ( fromJust, isJust ) + ( fromJust + , isJust + ) import Data.Proxy - ( Proxy (..) ) + ( Proxy (..) + ) import Data.Quantity - ( Quantity (..), mkPercentage ) + ( Quantity (..) + , mkPercentage + ) import Data.Ratio - ( (%) ) + ( (%) + ) import Data.Text - ( Text ) + ( Text + ) import Data.Text.Class - ( toText ) + ( toText + ) import Numeric.Natural - ( Natural ) + ( Natural + ) import Test.Hspec ( SpecWith , describe @@ -170,9 +238,15 @@ import Test.Hspec , xdescribe ) import Test.Hspec.Expectations.Lifted - ( shouldBe, shouldNotBe, shouldNotSatisfy, shouldSatisfy ) + ( shouldBe + , shouldNotBe + , shouldNotSatisfy + , shouldSatisfy + ) import Test.Hspec.Extra - ( it, xit ) + ( it + , xit + ) import Test.Integration.Framework.DSL ( Context (..) , Headers (..) @@ -238,7 +312,8 @@ import Test.Integration.Framework.TestData , errMsg404NoWallet ) import UnliftIO.Exception - ( fromEither ) + ( fromEither + ) import qualified Cardano.Address.Script as CA import qualified Cardano.Api as Cardano diff --git a/lib/wallet/integration/src/Test/Integration/Scenario/API/Shelley/Wallets.hs b/lib/wallet/integration/src/Test/Integration/Scenario/API/Shelley/Wallets.hs index 195e150f525..73b3e6accd4 100644 --- a/lib/wallet/integration/src/Test/Integration/Scenario/API/Shelley/Wallets.hs +++ b/lib/wallet/integration/src/Test/Integration/Scenario/API/Shelley/Wallets.hs @@ -17,11 +17,17 @@ module Test.Integration.Scenario.API.Shelley.Wallets import Prelude import Cardano.Mnemonic - ( entropyToMnemonic, genEntropy, mnemonicToText ) + ( entropyToMnemonic + , genEntropy + , mnemonicToText + ) import Cardano.Wallet.Address.Derivation - ( DerivationIndex (..), Role (..) ) + ( DerivationIndex (..) + , Role (..) + ) import Cardano.Wallet.Address.Discovery.Sequential - ( AddressPoolGap (..) ) + ( AddressPoolGap (..) + ) import Cardano.Wallet.Api.Types ( ApiAddressWithPath , ApiByronWallet @@ -34,45 +40,73 @@ import Cardano.Wallet.Api.Types , WalletStyle (..) ) import Cardano.Wallet.Primitive.NetworkId - ( HasSNetworkId ) + ( HasSNetworkId + ) import Cardano.Wallet.Primitive.Passphrase - ( PassphraseMaxLength (..), PassphraseMinLength (..) ) + ( PassphraseMaxLength (..) + , PassphraseMinLength (..) + ) import Cardano.Wallet.Primitive.SyncProgress - ( SyncProgress (..) ) + ( SyncProgress (..) + ) import Cardano.Wallet.Primitive.Types - ( walletNameMaxLength, walletNameMinLength ) + ( walletNameMaxLength + , walletNameMinLength + ) import Cardano.Wallet.Unsafe - ( unsafeFromHexText, unsafeXPub ) + ( unsafeFromHexText + , unsafeXPub + ) import Control.Monad - ( forM, forM_ ) + ( forM + , forM_ + ) import Control.Monad.IO.Class - ( liftIO ) + ( liftIO + ) import Control.Monad.Trans.Resource - ( runResourceT ) + ( runResourceT + ) import Data.Aeson - ( ToJSON (..) ) + ( ToJSON (..) + ) import Data.ByteArray.Encoding - ( Base (Base16), convertToBase ) + ( Base (Base16) + , convertToBase + ) import Data.ByteString - ( ByteString ) + ( ByteString + ) import Data.Generics.Internal.VL.Lens - ( view, (^.) ) + ( view + , (^.) + ) import Data.Proxy - ( Proxy (..) ) + ( Proxy (..) + ) import Data.Quantity - ( Quantity (..) ) + ( Quantity (..) + ) import Data.Text - ( Text ) + ( Text + ) import Data.Word - ( Word32 ) + ( Word32 + ) import Numeric.Natural - ( Natural ) + ( Natural + ) import Test.Hspec - ( SpecWith, describe ) + ( SpecWith + , describe + ) import Test.Hspec.Expectations.Lifted - ( shouldBe, shouldNotBe ) + ( shouldBe + , shouldNotBe + ) import Test.Hspec.Extra - ( it ) + ( it + ) import Test.Integration.Framework.DSL ( Context (..) , Headers (..) diff --git a/lib/wallet/integration/src/Test/Integration/Scenario/CLI/Byron/Addresses.hs b/lib/wallet/integration/src/Test/Integration/Scenario/CLI/Byron/Addresses.hs index 3bc5f54e447..fabbb4fb1cb 100644 --- a/lib/wallet/integration/src/Test/Integration/Scenario/CLI/Byron/Addresses.hs +++ b/lib/wallet/integration/src/Test/Integration/Scenario/CLI/Byron/Addresses.hs @@ -14,29 +14,49 @@ module Test.Integration.Scenario.CLI.Byron.Addresses import Prelude import Cardano.Wallet.Address.Encoding - ( encodeAddress ) + ( encodeAddress + ) import Cardano.Wallet.Api.Types - ( ApiAddressWithPath, ApiByronWallet, ApiT (..) ) + ( ApiAddressWithPath + , ApiByronWallet + , ApiT (..) + ) import Cardano.Wallet.Primitive.NetworkId - ( HasSNetworkId (..) ) + ( HasSNetworkId (..) + ) import Cardano.Wallet.Primitive.Types.Address - ( AddressState (..) ) + ( AddressState (..) + ) import Control.Monad - ( forM_ ) + ( forM_ + ) import Control.Monad.Trans.Resource - ( ResourceT, runResourceT ) + ( ResourceT + , runResourceT + ) import Data.Generics.Internal.VL.Lens - ( (^.) ) + ( (^.) + ) import Data.Proxy - ( Proxy (..) ) + ( Proxy (..) + ) import System.Command - ( Exit (..), Stderr (..), Stdout (..) ) + ( Exit (..) + , Stderr (..) + , Stdout (..) + ) import System.Exit - ( ExitCode (..) ) + ( ExitCode (..) + ) import Test.Hspec - ( SpecWith, describe, it ) + ( SpecWith + , describe + , it + ) import Test.Hspec.Expectations.Lifted - ( shouldBe, shouldContain ) + ( shouldBe + , shouldContain + ) import Test.Integration.Framework.DSL ( Context , createAddressViaCLI @@ -59,7 +79,11 @@ import Test.Integration.Framework.DSL , walletId ) import Test.Integration.Framework.TestData - ( cmdOk, errMsg403NotAByronWallet, errMsg403WrongPass, errMsg404NoWallet ) + ( cmdOk + , errMsg403NotAByronWallet + , errMsg403WrongPass + , errMsg404NoWallet + ) import qualified Data.Text as T diff --git a/lib/wallet/integration/src/Test/Integration/Scenario/CLI/Byron/Wallets.hs b/lib/wallet/integration/src/Test/Integration/Scenario/CLI/Byron/Wallets.hs index 6b744004013..3b1360743fa 100644 --- a/lib/wallet/integration/src/Test/Integration/Scenario/CLI/Byron/Wallets.hs +++ b/lib/wallet/integration/src/Test/Integration/Scenario/CLI/Byron/Wallets.hs @@ -14,33 +14,58 @@ module Test.Integration.Scenario.CLI.Byron.Wallets import Prelude import Cardano.Wallet.Api.Types - ( ApiByronWallet, ApiUtxoStatistics ) + ( ApiByronWallet + , ApiUtxoStatistics + ) import Cardano.Wallet.Primitive.Passphrase - ( PassphraseMaxLength (..), PassphraseMinLength (..) ) + ( PassphraseMaxLength (..) + , PassphraseMinLength (..) + ) import Cardano.Wallet.Primitive.SyncProgress - ( SyncProgress (..) ) + ( SyncProgress (..) + ) import Control.Monad - ( forM_ ) + ( forM_ + ) import Control.Monad.IO.Class - ( liftIO ) + ( liftIO + ) import Control.Monad.Trans.Resource - ( runResourceT ) + ( runResourceT + ) import Data.Generics.Internal.VL.Lens - ( view, (^.) ) + ( view + , (^.) + ) import Data.Maybe - ( isJust ) + ( isJust + ) import Data.Proxy - ( Proxy (..) ) + ( Proxy (..) + ) import Data.Quantity - ( Quantity (..) ) + ( Quantity (..) + ) import System.Command - ( Exit (..), Stderr (..), Stdout (..) ) + ( Exit (..) + , Stderr (..) + , Stdout (..) + ) import System.Exit - ( ExitCode (..) ) + ( ExitCode (..) + ) import Test.Hspec - ( SpecWith, describe, it, runIO ) + ( SpecWith + , describe + , it + , runIO + ) import Test.Hspec.Expectations.Lifted - ( shouldBe, shouldContain, shouldNotBe, shouldSatisfy ) + ( shouldBe + , shouldContain + , shouldNotBe + , shouldSatisfy + ) import Test.Integration.Framework.DSL ( Context (..) , MnemonicLength (..) diff --git a/lib/wallet/integration/src/Test/Integration/Scenario/CLI/Miscellaneous.hs b/lib/wallet/integration/src/Test/Integration/Scenario/CLI/Miscellaneous.hs index bda6a6d687f..92072b524df 100644 --- a/lib/wallet/integration/src/Test/Integration/Scenario/CLI/Miscellaneous.hs +++ b/lib/wallet/integration/src/Test/Integration/Scenario/CLI/Miscellaneous.hs @@ -10,19 +10,32 @@ module Test.Integration.Scenario.CLI.Miscellaneous import Prelude import Cardano.Wallet.Version - ( showVersionAsDate, version ) + ( showVersionAsDate + , version + ) import Control.Monad - ( forM_ ) + ( forM_ + ) import System.Command - ( Exit (..), Stderr (..), Stdout (..) ) + ( Exit (..) + , Stderr (..) + , Stdout (..) + ) import System.Exit - ( ExitCode (..) ) + ( ExitCode (..) + ) import Test.Hspec - ( SpecWith, describe, it ) + ( SpecWith + , describe + , it + ) import Test.Hspec.Expectations.Lifted - ( shouldBe, shouldContain ) + ( shouldBe + , shouldContain + ) import Test.Integration.Framework.DSL - ( cardanoWalletCLI ) + ( cardanoWalletCLI + ) import qualified Data.List as L diff --git a/lib/wallet/integration/src/Test/Integration/Scenario/CLI/Network.hs b/lib/wallet/integration/src/Test/Integration/Scenario/CLI/Network.hs index 6c51f685a41..ae06999b02c 100644 --- a/lib/wallet/integration/src/Test/Integration/Scenario/CLI/Network.hs +++ b/lib/wallet/integration/src/Test/Integration/Scenario/CLI/Network.hs @@ -11,7 +11,8 @@ module Test.Integration.Scenario.CLI.Network import Prelude import Cardano.CLI - ( Port (..) ) + ( Port (..) + ) import Cardano.Wallet.Api.Types ( ApiNetworkClock (..) , ApiNetworkInformation (..) @@ -19,27 +20,43 @@ import Cardano.Wallet.Api.Types , NtpSyncingStatus (..) ) import Cardano.Wallet.Primitive.Types - ( EpochNo (..) ) + ( EpochNo (..) + ) import Control.Monad - ( when ) + ( when + ) import Data.Generics.Internal.VL.Lens - ( (^.) ) + ( (^.) + ) import Data.Generics.Product.Typed - ( typed ) + ( typed + ) import Data.Maybe - ( fromJust ) + ( fromJust + ) import Data.Proxy - ( Proxy (..) ) + ( Proxy (..) + ) import System.Command - ( Exit (..), Stderr (..), Stdout (..) ) + ( Exit (..) + , Stderr (..) + , Stdout (..) + ) import System.Exit - ( ExitCode (..) ) + ( ExitCode (..) + ) import Test.Hspec - ( SpecWith, describe, pendingWith ) + ( SpecWith + , describe + , pendingWith + ) import Test.Hspec.Expectations.Lifted - ( shouldBe, shouldContain ) + ( shouldBe + , shouldContain + ) import Test.Hspec.Extra - ( it ) + ( it + ) import Test.Integration.Framework.DSL ( Context (..) , cardanoWalletCLI @@ -48,9 +65,11 @@ import Test.Integration.Framework.DSL , expectValidJSON ) import Test.Integration.Framework.TestData - ( cmdOk ) + ( cmdOk + ) import Test.Utils.Paths - ( inNixBuild ) + ( inNixBuild + ) spec :: SpecWith Context spec = describe "COMMON_CLI_NETWORK" $ do diff --git a/lib/wallet/integration/src/Test/Integration/Scenario/CLI/Port.hs b/lib/wallet/integration/src/Test/Integration/Scenario/CLI/Port.hs index f088d347308..28cc1ece947 100644 --- a/lib/wallet/integration/src/Test/Integration/Scenario/CLI/Port.hs +++ b/lib/wallet/integration/src/Test/Integration/Scenario/CLI/Port.hs @@ -13,25 +13,43 @@ module Test.Integration.Scenario.CLI.Port import Prelude import Cardano.CLI - ( Port (..), getPort ) + ( Port (..) + , getPort + ) import Control.Monad - ( forM_, void ) + ( forM_ + , void + ) import Data.Generics.Internal.VL.Lens - ( over ) + ( over + ) import Data.Generics.Product.Typed - ( HasType, typed ) + ( HasType + , typed + ) import System.Command - ( Stderr (..), Stdout (..) ) + ( Stderr (..) + , Stdout (..) + ) import System.Exit - ( ExitCode (..) ) + ( ExitCode (..) + ) import System.IO - ( hClose, hFlush, hPutStr ) + ( hClose + , hFlush + , hPutStr + ) import Test.Hspec - ( SpecWith, describe ) + ( SpecWith + , describe + ) import Test.Hspec.Expectations.Lifted - ( shouldBe, shouldContain ) + ( shouldBe + , shouldContain + ) import Test.Hspec.Extra - ( it ) + ( it + ) import Test.Integration.Framework.DSL ( cardanoWalletCLI , commandName @@ -47,7 +65,9 @@ import Test.Integration.Framework.DSL , updateWalletNameViaCLI ) import UnliftIO.Process - ( waitForProcess, withCreateProcess ) + ( waitForProcess + , withCreateProcess + ) import qualified Data.Text as T import qualified Data.Text.IO as TIO diff --git a/lib/wallet/integration/src/Test/Integration/Scenario/CLI/Shelley/Addresses.hs b/lib/wallet/integration/src/Test/Integration/Scenario/CLI/Shelley/Addresses.hs index 8730fb38222..fe8c9e99f35 100644 --- a/lib/wallet/integration/src/Test/Integration/Scenario/CLI/Shelley/Addresses.hs +++ b/lib/wallet/integration/src/Test/Integration/Scenario/CLI/Shelley/Addresses.hs @@ -12,37 +12,62 @@ module Test.Integration.Scenario.CLI.Shelley.Addresses import Prelude import Cardano.Wallet.Address.Discovery.Sequential - ( defaultAddressPoolGap, getAddressPoolGap ) + ( defaultAddressPoolGap + , getAddressPoolGap + ) import Cardano.Wallet.Address.Encoding - ( encodeAddress ) + ( encodeAddress + ) import Cardano.Wallet.Api.Types - ( ApiAddressWithPath, ApiWallet, apiAddress ) + ( ApiAddressWithPath + , ApiWallet + , apiAddress + ) import Cardano.Wallet.Primitive.NetworkId - ( HasSNetworkId (..) ) + ( HasSNetworkId (..) + ) import Cardano.Wallet.Primitive.Types.Address - ( AddressState (..) ) + ( AddressState (..) + ) import Control.Monad - ( forM_ ) + ( forM_ + ) import Control.Monad.Trans.Resource - ( ResourceT, runResourceT ) + ( ResourceT + , runResourceT + ) import Data.Generics.Internal.VL.Lens - ( view, (^.) ) + ( view + , (^.) + ) import Data.Proxy - ( Proxy (..) ) + ( Proxy (..) + ) import Data.Quantity - ( Quantity (..) ) + ( Quantity (..) + ) import Data.Text - ( Text ) + ( Text + ) import System.Command - ( Exit (..), Stderr (..), Stdout (..) ) + ( Exit (..) + , Stderr (..) + , Stdout (..) + ) import System.Exit - ( ExitCode (..) ) + ( ExitCode (..) + ) import Test.Hspec - ( SpecWith, describe ) + ( SpecWith + , describe + ) import Test.Hspec.Expectations.Lifted - ( shouldBe, shouldContain ) + ( shouldBe + , shouldContain + ) import Test.Hspec.Extra - ( it ) + ( it + ) import Test.Integration.Framework.DSL ( Context (..) , deleteWalletViaCLI @@ -61,7 +86,9 @@ import Test.Integration.Framework.DSL , walletId ) import Test.Integration.Framework.TestData - ( errMsg404NoWallet, falseWalletIds ) + ( errMsg404NoWallet + , falseWalletIds + ) import qualified Data.Text as T diff --git a/lib/wallet/integration/src/Test/Integration/Scenario/CLI/Shelley/HWWallets.hs b/lib/wallet/integration/src/Test/Integration/Scenario/CLI/Shelley/HWWallets.hs index 15c42599916..5f4c099caa6 100644 --- a/lib/wallet/integration/src/Test/Integration/Scenario/CLI/Shelley/HWWallets.hs +++ b/lib/wallet/integration/src/Test/Integration/Scenario/CLI/Shelley/HWWallets.hs @@ -12,9 +12,12 @@ module Test.Integration.Scenario.CLI.Shelley.HWWallets import Prelude import Cardano.Wallet.Address.Discovery.Sequential - ( defaultAddressPoolGap, getAddressPoolGap ) + ( defaultAddressPoolGap + , getAddressPoolGap + ) import Cardano.Wallet.Address.Encoding - ( encodeAddress ) + ( encodeAddress + ) import Cardano.Wallet.Api.Types ( ApiAddressWithPath , ApiFee @@ -24,33 +27,53 @@ import Cardano.Wallet.Api.Types , apiAddress ) import Cardano.Wallet.Api.Types.SchemaMetadata - ( TxMetadataSchema (..) ) + ( TxMetadataSchema (..) + ) import Cardano.Wallet.Primitive.NetworkId - ( HasSNetworkId (..) ) + ( HasSNetworkId (..) + ) import Cardano.Wallet.Primitive.Types.Address - ( AddressState (..) ) + ( AddressState (..) + ) import Control.Monad - ( forM_ ) + ( forM_ + ) import Control.Monad.Trans.Resource - ( ResourceT, runResourceT ) + ( ResourceT + , runResourceT + ) import Data.Generics.Internal.VL.Lens - ( view, (^.) ) + ( view + , (^.) + ) import Data.Proxy - ( Proxy (..) ) + ( Proxy (..) + ) import Data.Quantity - ( Quantity (..) ) + ( Quantity (..) + ) import Data.Text.Class - ( ToText (..) ) + ( ToText (..) + ) import System.Command - ( Exit (..), Stderr (..), Stdout (..) ) + ( Exit (..) + , Stderr (..) + , Stdout (..) + ) import System.Exit - ( ExitCode (..) ) + ( ExitCode (..) + ) import Test.Hspec - ( SpecWith, describe ) + ( SpecWith + , describe + ) import Test.Hspec.Expectations.Lifted - ( shouldBe, shouldContain ) + ( shouldBe + , shouldContain + ) import Test.Hspec.Extra - ( it ) + ( it + ) import Test.Integration.Framework.DSL ( Context (..) , createWalletFromPublicKeyViaCLI @@ -84,9 +107,13 @@ import Test.Integration.Framework.DSL , (.>) ) import Test.Integration.Framework.TestData - ( cmdOk, errMsg403NoRootKey ) + ( cmdOk + , errMsg403NoRootKey + ) import Test.Integration.Scenario.CLI.Shelley.Wallets - ( walletNames, walletNamesInvalid ) + ( walletNames + , walletNamesInvalid + ) import qualified Data.Text as T diff --git a/lib/wallet/integration/src/Test/Integration/Scenario/CLI/Shelley/Transactions.hs b/lib/wallet/integration/src/Test/Integration/Scenario/CLI/Shelley/Transactions.hs index 41273667467..c40d3f8c920 100644 --- a/lib/wallet/integration/src/Test/Integration/Scenario/CLI/Shelley/Transactions.hs +++ b/lib/wallet/integration/src/Test/Integration/Scenario/CLI/Shelley/Transactions.hs @@ -14,59 +14,102 @@ module Test.Integration.Scenario.CLI.Shelley.Transactions import Prelude import Cardano.CLI - ( Port ) + ( Port + ) import Cardano.Wallet.Address.Encoding - ( encodeAddress ) + ( encodeAddress + ) import Cardano.Wallet.Api.Types - ( ApiFee (..), ApiTransaction, ApiWallet, apiAddress ) + ( ApiFee (..) + , ApiTransaction + , ApiWallet + , apiAddress + ) import Cardano.Wallet.Api.Types.SchemaMetadata - ( TxMetadataSchema (..), detailedMetadata, noSchemaMetadata ) + ( TxMetadataSchema (..) + , detailedMetadata + , noSchemaMetadata + ) import Cardano.Wallet.Primitive.NetworkId - ( HasSNetworkId (..) ) + ( HasSNetworkId (..) + ) import Cardano.Wallet.Primitive.Types - ( SortOrder (..) ) + ( SortOrder (..) + ) import Cardano.Wallet.Primitive.Types.Tx - ( TxMetadata (..), TxMetadataValue (..) ) + ( TxMetadata (..) + , TxMetadataValue (..) + ) import Cardano.Wallet.Primitive.Types.Tx.TxMeta - ( Direction (..), TxStatus (..) ) + ( Direction (..) + , TxStatus (..) + ) import Control.Monad - ( forM_, join ) + ( forM_ + , join + ) import Control.Monad.IO.Class - ( MonadIO ) + ( MonadIO + ) import Control.Monad.IO.Unlift - ( MonadUnliftIO (..) ) + ( MonadUnliftIO (..) + ) import Control.Monad.Trans.Resource - ( ResourceT, runResourceT ) + ( ResourceT + , runResourceT + ) import Data.Generics.Internal.VL.Lens - ( view, (^.) ) + ( view + , (^.) + ) import Data.Generics.Product.Typed - ( typed ) + ( typed + ) import Data.List.Extra - ( enumerate ) + ( enumerate + ) import Data.Proxy - ( Proxy (..) ) + ( Proxy (..) + ) import Data.Quantity - ( Quantity (..) ) + ( Quantity (..) + ) import Data.Text - ( Text ) + ( Text + ) import Data.Text.Class - ( showT ) + ( showT + ) import Data.Time.Utils - ( utcTimePred, utcTimeSucc ) + ( utcTimePred + , utcTimeSucc + ) import GHC.Stack - ( HasCallStack ) + ( HasCallStack + ) import Numeric.Natural - ( Natural ) + ( Natural + ) import System.Command - ( Exit (..), Stderr (..), Stdout (..) ) + ( Exit (..) + , Stderr (..) + , Stdout (..) + ) import System.Exit - ( ExitCode (..) ) + ( ExitCode (..) + ) import Test.Hspec - ( SpecWith, describe ) + ( SpecWith + , describe + ) import Test.Hspec.Expectations.Lifted - ( shouldBe, shouldContain, shouldSatisfy ) + ( shouldBe + , shouldContain + , shouldSatisfy + ) import Test.Hspec.Extra - ( it ) + ( it + ) import Test.Integration.Framework.DSL ( Context (..) , between @@ -111,7 +154,8 @@ import Test.Integration.Framework.TestData , wildcardsWalletName ) import UnliftIO.Exception - ( throwString ) + ( throwString + ) import qualified Data.Map as Map import qualified Data.Text as T diff --git a/lib/wallet/integration/src/Test/Integration/Scenario/CLI/Shelley/Wallets.hs b/lib/wallet/integration/src/Test/Integration/Scenario/CLI/Shelley/Wallets.hs index f4374b2fd56..33211e9a6b0 100644 --- a/lib/wallet/integration/src/Test/Integration/Scenario/CLI/Shelley/Wallets.hs +++ b/lib/wallet/integration/src/Test/Integration/Scenario/CLI/Shelley/Wallets.hs @@ -15,11 +15,14 @@ module Test.Integration.Scenario.CLI.Shelley.Wallets import Prelude import Cardano.CLI - ( Port ) + ( Port + ) import Cardano.Wallet.Address.Discovery.Sequential - ( AddressPoolGap (..) ) + ( AddressPoolGap (..) + ) import Cardano.Wallet.Address.Encoding - ( encodeAddress ) + ( encodeAddress + ) import Cardano.Wallet.Api.Types ( ApiTransaction , ApiUtxoStatistics @@ -29,43 +32,73 @@ import Cardano.Wallet.Api.Types , getApiT ) import Cardano.Wallet.Primitive.NetworkId - ( HasSNetworkId (..) ) + ( HasSNetworkId (..) + ) import Cardano.Wallet.Primitive.Passphrase - ( PassphraseMaxLength (..), PassphraseMinLength (..) ) + ( PassphraseMaxLength (..) + , PassphraseMinLength (..) + ) import Cardano.Wallet.Primitive.SyncProgress - ( SyncProgress (..) ) + ( SyncProgress (..) + ) import Cardano.Wallet.Primitive.Types - ( getWalletName, walletNameMaxLength, walletNameMinLength ) + ( getWalletName + , walletNameMaxLength + , walletNameMinLength + ) import Control.Monad - ( forM_ ) + ( forM_ + ) import Control.Monad.IO.Unlift - ( MonadUnliftIO (..) ) + ( MonadUnliftIO (..) + ) import Control.Monad.Trans.Resource - ( ResourceT, runResourceT ) + ( ResourceT + , runResourceT + ) import Data.Generics.Internal.VL.Lens - ( view, (^.) ) + ( view + , (^.) + ) import Data.Generics.Product.Typed - ( typed ) + ( typed + ) import Data.Proxy - ( Proxy (..) ) + ( Proxy (..) + ) import Data.Quantity - ( Quantity (..) ) + ( Quantity (..) + ) import Data.Text - ( Text ) + ( Text + ) import Data.Word - ( Word32 ) + ( Word32 + ) import Numeric.Natural - ( Natural ) + ( Natural + ) import System.Command - ( Exit (..), Stderr (..), Stdout (..) ) + ( Exit (..) + , Stderr (..) + , Stdout (..) + ) import System.Exit - ( ExitCode (..) ) + ( ExitCode (..) + ) import Test.Hspec - ( SpecWith, describe ) + ( SpecWith + , describe + ) import Test.Hspec.Expectations.Lifted - ( shouldBe, shouldContain, shouldNotBe, shouldNotContain ) + ( shouldBe + , shouldContain + , shouldNotBe + , shouldNotContain + ) import Test.Hspec.Extra - ( it ) + ( it + ) import Test.Integration.Framework.DSL ( Context (..) , cardanoWalletCLI diff --git a/lib/wallet/mock-token-metadata/src/Cardano/Wallet/TokenMetadata/MockServer.hs b/lib/wallet/mock-token-metadata/src/Cardano/Wallet/TokenMetadata/MockServer.hs index 4be84e04bf3..7260e304dcb 100644 --- a/lib/wallet/mock-token-metadata/src/Cardano/Wallet/TokenMetadata/MockServer.hs +++ b/lib/wallet/mock-token-metadata/src/Cardano/Wallet/TokenMetadata/MockServer.hs @@ -29,11 +29,14 @@ module Cardano.Wallet.TokenMetadata.MockServer import Prelude import Cardano.Wallet.Primitive.Types - ( TokenMetadataServer (..) ) + ( TokenMetadataServer (..) + ) import Cardano.Wallet.Primitive.Types.Hash - ( Hash (..) ) + ( Hash (..) + ) import Cardano.Wallet.Primitive.Types.TokenMap - ( AssetId (..) ) + ( AssetId (..) + ) import Cardano.Wallet.Primitive.Types.TokenPolicy ( AssetDecimals (..) , AssetLogo (..) @@ -53,9 +56,11 @@ import Cardano.Wallet.TokenMetadata , propertyName ) import Cardano.Wallet.Unsafe - ( unsafeFromHex ) + ( unsafeFromHex + ) import Control.Monad.IO.Class - ( liftIO ) + ( liftIO + ) import Data.Aeson ( FromJSON (..) , ToJSON (..) @@ -65,23 +70,33 @@ import Data.Aeson , (.=) ) import Data.ByteArray.Encoding - ( Base (Base16, Base64), convertToBase ) + ( Base (Base16, Base64) + , convertToBase + ) import Data.Function - ( (&) ) + ( (&) + ) import Data.Generics.Internal.VL.Lens - ( view ) + ( view + ) import Data.HashSet - ( HashSet ) + ( HashSet + ) import Data.Maybe - ( fromMaybe ) + ( fromMaybe + ) import Data.Proxy - ( Proxy (..) ) + ( Proxy (..) + ) import GHC.TypeLits - ( KnownSymbol ) + ( KnownSymbol + ) import Network.URI - ( parseURI ) + ( parseURI + ) import Network.Wai - ( Middleware ) + ( Middleware + ) import Network.Wai.Handler.Warp ( Port , defaultSettings @@ -91,15 +106,27 @@ import Network.Wai.Handler.Warp , withApplication ) import Servant.API - ( (:>), JSON, Post, ReqBody ) + ( (:>) + , JSON + , Post + , ReqBody + ) import Servant.Server - ( Handler (..), Server, serve ) + ( Handler (..) + , Server + , serve + ) import UnliftIO.Async - ( race ) + ( race + ) import UnliftIO.Exception - ( throwString ) + ( throwString + ) import UnliftIO.MVar - ( newEmptyMVar, putMVar, takeMVar ) + ( newEmptyMVar + , putMVar + , takeMVar + ) import qualified Data.ByteString as BS import qualified Data.ByteString.Char8 as B8 diff --git a/lib/wallet/src/Cardano/Api/Extra.hs b/lib/wallet/src/Cardano/Api/Extra.hs index 48c9c05b7f6..17a2dbf07f2 100644 --- a/lib/wallet/src/Cardano/Api/Extra.hs +++ b/lib/wallet/src/Cardano/Api/Extra.hs @@ -20,7 +20,8 @@ import Cardano.Api , Tx ) import Cardano.Api.Shelley - ( ShelleyLedgerEra ) + ( ShelleyLedgerEra + ) import qualified Cardano.Ledger.Core as Ledger diff --git a/lib/wallet/src/Cardano/DB/Sqlite.hs b/lib/wallet/src/Cardano/DB/Sqlite.hs index e4d2b12c32e..dbf800f8d51 100644 --- a/lib/wallet/src/Cardano/DB/Sqlite.hs +++ b/lib/wallet/src/Cardano/DB/Sqlite.hs @@ -61,25 +61,41 @@ module Cardano.DB.Sqlite import Prelude import Cardano.BM.Data.Severity - ( Severity (..) ) + ( Severity (..) + ) import Cardano.BM.Data.Tracer - ( HasPrivacyAnnotation (..), HasSeverityAnnotation (..) ) + ( HasPrivacyAnnotation (..) + , HasSeverityAnnotation (..) + ) import Cardano.BM.Extra - ( BracketLog, bracketTracer ) + ( BracketLog + , bracketTracer + ) import Cardano.Wallet.DB.Migration - ( ErrWrongVersion (..) ) + ( ErrWrongVersion (..) + ) import Control.Lens - ( strict, view ) + ( strict + , view + ) import Control.Monad - ( join, void, when ) + ( join + , void + , when + ) import Control.Monad.IO.Unlift - ( MonadUnliftIO (..) ) + ( MonadUnliftIO (..) + ) import Control.Monad.Logger - ( LogLevel (..) ) + ( LogLevel (..) + ) import Control.Monad.Reader - ( ReaderT ) + ( ReaderT + ) import Control.Monad.Trans.Except - ( ExceptT (..), runExceptT ) + ( ExceptT (..) + , runExceptT + ) import Control.Retry ( RetryStatus (..) , constantDelay @@ -88,31 +104,49 @@ import Control.Retry , recovering ) import Control.Tracer - ( Tracer, contramap, traceWith ) + ( Tracer + , contramap + , traceWith + ) import Data.Aeson - ( ToJSON (..) ) + ( ToJSON (..) + ) import Data.Function - ( (&) ) + ( (&) + ) import Data.Functor - ( ($>), (<&>) ) + ( ($>) + , (<&>) + ) import Data.List - ( isInfixOf ) + ( isInfixOf + ) import Data.List.Split - ( chunksOf ) + ( chunksOf + ) import Data.Proxy - ( Proxy (..) ) + ( Proxy (..) + ) import Data.Text - ( Text ) + ( Text + ) import Data.Text.Class - ( ToText (..) ) + ( ToText (..) + ) import Data.Text.Lazy.Builder - ( toLazyText ) + ( toLazyText + ) import Data.Time.Clock - ( NominalDiffTime ) + ( NominalDiffTime + ) import Database.Persist.EntityDef - ( getEntityDBName, getEntityFields ) + ( getEntityDBName + , getEntityFields + ) import Database.Persist.Names - ( EntityNameDB (..), unFieldNameDB ) + ( EntityNameDB (..) + , unFieldNameDB + ) import Database.Persist.Sql ( EntityField , LogFunc @@ -128,23 +162,46 @@ import Database.Persist.Sql , runSqlConn ) import Database.Persist.Sqlite - ( SqlBackend, wrapConnection ) + ( SqlBackend + , wrapConnection + ) import Database.Sqlite - ( Error (ErrorConstraint), SqliteException (SqliteException) ) + ( Error (ErrorConstraint) + , SqliteException (SqliteException) + ) import Fmt - ( Buildable (..), fmt, ordinalF, (+|), (+||), (|+), (||+) ) + ( Buildable (..) + , fmt + , ordinalF + , (+|) + , (+||) + , (|+) + , (||+) + ) import GHC.Generics - ( Generic ) + ( Generic + ) import System.Environment - ( lookupEnv ) + ( lookupEnv + ) import System.Log.FastLogger - ( fromLogStr ) + ( fromLogStr + ) import UnliftIO.Compat - ( handleIf ) + ( handleIf + ) import UnliftIO.Exception - ( Exception, bracket, bracket_, handleJust, tryJust ) + ( Exception + , bracket + , bracket_ + , handleJust + , tryJust + ) import UnliftIO.MVar - ( newMVar, withMVar, withMVarMasked ) + ( newMVar + , withMVar + , withMVarMasked + ) import qualified Data.Aeson as Aeson import qualified Data.ByteString.Char8 as B8 diff --git a/lib/wallet/src/Cardano/DB/Sqlite/Delete.hs b/lib/wallet/src/Cardano/DB/Sqlite/Delete.hs index fb74f2b40e1..0ef6d1bb8e0 100644 --- a/lib/wallet/src/Cardano/DB/Sqlite/Delete.hs +++ b/lib/wallet/src/Cardano/DB/Sqlite/Delete.hs @@ -31,9 +31,12 @@ module Cardano.DB.Sqlite.Delete import Prelude import Cardano.BM.Data.Severity - ( Severity (..) ) + ( Severity (..) + ) import Cardano.BM.Data.Tracer - ( HasPrivacyAnnotation (..), HasSeverityAnnotation (..) ) + ( HasPrivacyAnnotation (..) + , HasSeverityAnnotation (..) + ) import Control.Retry ( RetryPolicy , RetryStatus (..) @@ -45,31 +48,50 @@ import Control.Retry , retrying ) import Control.Tracer - ( Tracer, traceWith ) + ( Tracer + , traceWith + ) import Data.Aeson - ( ToJSON ) + ( ToJSON + ) import Data.Function - ( (&) ) + ( (&) + ) import Data.Map.Strict - ( Map ) + ( Map + ) import Data.Maybe - ( fromMaybe, isJust ) + ( fromMaybe + , isJust + ) import Data.Text.Class - ( ToText (..) ) + ( ToText (..) + ) import GHC.Generics - ( Generic ) + ( Generic + ) import System.Directory - ( removePathForcibly ) + ( removePathForcibly + ) import UnliftIO.Exception - ( bracket_ ) + ( bracket_ + ) import UnliftIO.MVar - ( MVar, modifyMVar, modifyMVar_, newMVar, readMVar ) + ( MVar + , modifyMVar + , modifyMVar_ + , newMVar + , readMVar + ) #if defined(mingw32_HOST_OS) import Control.Retry - ( logRetries, recovering ) + ( logRetries + , recovering + ) import System.IO.Error - ( isPermissionError ) + ( isPermissionError + ) #else #endif diff --git a/lib/wallet/src/Cardano/Pool/DB.hs b/lib/wallet/src/Cardano/Pool/DB.hs index ceaef16ab2e..271dedf39b2 100644 --- a/lib/wallet/src/Cardano/Pool/DB.hs +++ b/lib/wallet/src/Cardano/Pool/DB.hs @@ -24,9 +24,13 @@ module Cardano.Pool.DB import Prelude import Cardano.Pool.Metadata.Types - ( StakePoolMetadata, StakePoolMetadataHash, StakePoolMetadataUrl ) + ( StakePoolMetadata + , StakePoolMetadataHash + , StakePoolMetadataUrl + ) import Cardano.Pool.Types - ( PoolId ) + ( PoolId + ) import Cardano.Wallet.Primitive.Types ( BlockHeader , CertificatePublicationTime (..) @@ -38,21 +42,29 @@ import Cardano.Wallet.Primitive.Types , SlotNo (..) ) import Control.Monad.IO.Class - ( MonadIO ) + ( MonadIO + ) import Control.Monad.Trans.Except - ( ExceptT ) + ( ExceptT + ) import Data.Generics.Internal.VL.Lens - ( view ) + ( view + ) import Data.Map.Strict - ( Map ) + ( Map + ) import Data.Quantity - ( Quantity (..) ) + ( Quantity (..) + ) import Data.Time.Clock.POSIX - ( POSIXTime ) + ( POSIXTime + ) import Data.Word - ( Word64 ) + ( Word64 + ) import System.Random - ( StdGen ) + ( StdGen + ) -- | A Database interface for storing pool production in DB. -- diff --git a/lib/wallet/src/Cardano/Pool/DB/Log.hs b/lib/wallet/src/Cardano/Pool/DB/Log.hs index 06cfd1b12cb..d8177a694b7 100644 --- a/lib/wallet/src/Cardano/Pool/DB/Log.hs +++ b/lib/wallet/src/Cardano/Pool/DB/Log.hs @@ -14,23 +14,35 @@ module Cardano.Pool.DB.Log import Prelude import Cardano.BM.Data.Severity - ( Severity (..) ) + ( Severity (..) + ) import Cardano.BM.Data.Tracer - ( HasPrivacyAnnotation (..), HasSeverityAnnotation (..) ) + ( HasPrivacyAnnotation (..) + , HasSeverityAnnotation (..) + ) import Cardano.BM.Extra - ( BracketLog ) + ( BracketLog + ) import Cardano.DB.Sqlite - ( DBLog (..) ) + ( DBLog (..) + ) import Cardano.Pool.Types - ( PoolId ) + ( PoolId + ) import Cardano.Wallet.Primitive.Types - ( EpochNo, PoolRetirementCertificate ) + ( EpochNo + , PoolRetirementCertificate + ) import Data.Text - ( Text ) + ( Text + ) import Data.Text.Class - ( ToText (..), toText ) + ( ToText (..) + , toText + ) import Fmt - ( pretty ) + ( pretty + ) import qualified Data.Text as T diff --git a/lib/wallet/src/Cardano/Pool/DB/MVar.hs b/lib/wallet/src/Cardano/Pool/DB/MVar.hs index 84c9a3660ed..acefbfee312 100644 --- a/lib/wallet/src/Cardano/Pool/DB/MVar.hs +++ b/lib/wallet/src/Cardano/Pool/DB/MVar.hs @@ -18,7 +18,9 @@ module Cardano.Pool.DB.MVar import Prelude import Cardano.Pool.DB - ( DBLayer (..), ErrPointAlreadyExists (..) ) + ( DBLayer (..) + , ErrPointAlreadyExists (..) + ) import Cardano.Pool.DB.Model ( ModelOp , PoolDatabase @@ -58,25 +60,38 @@ import Cardano.Pool.DB.Model , mUnfetchedPoolMetadataRefs ) import Cardano.Wallet.Primitive.Slotting - ( TimeInterpreter ) + ( TimeInterpreter + ) import Control.DeepSeq - ( deepseq ) + ( deepseq + ) import Control.Monad - ( void ) + ( void + ) import Control.Monad.Trans.Except - ( ExceptT (..) ) + ( ExceptT (..) + ) import Control.Monad.Trans.State.Strict - ( runStateT ) + ( runStateT + ) import Data.Either - ( fromRight ) + ( fromRight + ) import Data.Functor.Identity - ( Identity ) + ( Identity + ) import Data.Tuple - ( swap ) + ( swap + ) import UnliftIO.Exception - ( Exception, throwIO ) + ( Exception + , throwIO + ) import UnliftIO.MVar - ( MVar, modifyMVar, newMVar ) + ( MVar + , modifyMVar + , newMVar + ) -- | Instantiate a new in-memory "database" layer that simply stores data in -- a local MVar. Data vanishes if the software is shut down. diff --git a/lib/wallet/src/Cardano/Pool/DB/Model.hs b/lib/wallet/src/Cardano/Pool/DB/Model.hs index 07b9ff03a1a..435eba0fb21 100644 --- a/lib/wallet/src/Cardano/Pool/DB/Model.hs +++ b/lib/wallet/src/Cardano/Pool/DB/Model.hs @@ -73,11 +73,17 @@ module Cardano.Pool.DB.Model import Prelude import Cardano.Pool.DB - ( determinePoolLifeCycleStatus ) + ( determinePoolLifeCycleStatus + ) import Cardano.Pool.Types - ( PoolId, PoolOwner ) + ( PoolId + , PoolOwner + ) import Cardano.Wallet.Primitive.Slotting - ( TimeInterpreter, epochOf, interpretQuery ) + ( TimeInterpreter + , epochOf + , interpretQuery + ) import Cardano.Wallet.Primitive.Types ( BlockHeader (..) , CertificatePublicationTime @@ -92,40 +98,61 @@ import Cardano.Wallet.Primitive.Types , defaultSettings ) import Control.Monad.Trans.Class - ( lift ) + ( lift + ) import Control.Monad.Trans.State.Strict - ( StateT ) + ( StateT + ) import Data.Bifunctor - ( first ) + ( first + ) import Data.Foldable - ( fold ) + ( fold + ) import Data.Function - ( (&) ) + ( (&) + ) import Data.Functor.Const - ( Const (..) ) + ( Const (..) + ) import Data.Functor.Identity - ( Identity (..) ) + ( Identity (..) + ) import Data.Generics.Internal.VL.Lens - ( over, view ) + ( over + , view + ) import Data.Map.Strict - ( Map ) + ( Map + ) import Data.Ord - ( Down (..) ) + ( Down (..) + ) import Data.Quantity - ( Quantity (..) ) + ( Quantity (..) + ) import Data.Set - ( Set ) + ( Set + ) import Data.Time.Clock.POSIX - ( POSIXTime ) + ( POSIXTime + ) import Data.Word - ( Word64 ) + ( Word64 + ) import GHC.Generics - ( Generic ) + ( Generic + ) import System.Random - ( StdGen, newStdGen ) + ( StdGen + , newStdGen + ) import Cardano.Pool.Metadata.Types - ( StakePoolMetadata, StakePoolMetadataHash, StakePoolMetadataUrl ) + ( StakePoolMetadata + , StakePoolMetadataHash + , StakePoolMetadataUrl + ) import qualified Control.Monad.Trans.State.Strict as State import qualified Data.List as L import qualified Data.Map.Strict as Map diff --git a/lib/wallet/src/Cardano/Pool/DB/Sqlite.hs b/lib/wallet/src/Cardano/Pool/DB/Sqlite.hs index 80ec2388e2e..a544c577a52 100644 --- a/lib/wallet/src/Cardano/Pool/DB/Sqlite.hs +++ b/lib/wallet/src/Cardano/Pool/DB/Sqlite.hs @@ -35,7 +35,8 @@ module Cardano.Pool.DB.Sqlite import Prelude import Cardano.BM.Extra - ( bracketTracer ) + ( bracketTracer + ) import Cardano.DB.Sqlite ( DBField (..) , DBLog (..) @@ -51,19 +52,36 @@ import Cardano.DB.Sqlite , withSqliteContextFile ) import Cardano.Pool.DB - ( DBLayer (..), ErrPointAlreadyExists (..), determinePoolLifeCycleStatus ) + ( DBLayer (..) + , ErrPointAlreadyExists (..) + , determinePoolLifeCycleStatus + ) import Cardano.Pool.DB.Log - ( ParseFailure (..), PoolDbLog (..) ) + ( ParseFailure (..) + , PoolDbLog (..) + ) import Cardano.Pool.DB.Sqlite.TH hiding - ( BlockHeader, blockHeight ) + ( BlockHeader + , blockHeight + ) import Cardano.Pool.Metadata.Types - ( StakePoolMetadata (..), StakePoolMetadataHash ) + ( StakePoolMetadata (..) + , StakePoolMetadataHash + ) import Cardano.Pool.Types - ( PoolId (..) ) + ( PoolId (..) + ) import Cardano.Wallet.DB.Sqlite.Types - ( BlockId (..), fromMaybeHash, toMaybeHash ) + ( BlockId (..) + , fromMaybeHash + , toMaybeHash + ) import Cardano.Wallet.Primitive.Slotting - ( TimeInterpreter, epochOf, firstSlotInEpoch, interpretQuery ) + ( TimeInterpreter + , epochOf + , firstSlotInEpoch + , interpretQuery + ) import Cardano.Wallet.Primitive.Types ( BlockHeader (..) , CertificatePublicationTime (..) @@ -74,39 +92,67 @@ import Cardano.Wallet.Primitive.Types , defaultSettings ) import Cardano.Wallet.Unsafe - ( unsafeMkPercentage ) + ( unsafeMkPercentage + ) import Control.Monad - ( forM, forM_ ) + ( forM + , forM_ + ) import Control.Monad.IO.Class - ( liftIO ) + ( liftIO + ) import Control.Monad.Trans.Except - ( ExceptT (..) ) + ( ExceptT (..) + ) import Control.Tracer - ( Tracer (..), contramap, natTracer, traceWith ) + ( Tracer (..) + , contramap + , natTracer + , traceWith + ) import Data.Either - ( partitionEithers, rights ) + ( partitionEithers + , rights + ) import Data.Function - ( (&) ) + ( (&) + ) import Data.Functor - ( (<&>) ) + ( (<&>) + ) import Data.Generics.Internal.VL.Lens - ( view ) + ( view + ) import Data.List - ( foldl' ) + ( foldl' + ) import Data.Map.Strict - ( Map ) + ( Map + ) import Data.Quantity - ( Percentage (..), Quantity (..) ) + ( Percentage (..) + , Quantity (..) + ) import Data.Ratio - ( denominator, numerator, (%) ) + ( denominator + , numerator + , (%) + ) import Data.String.Interpolate - ( i ) + ( i + ) import Data.Text - ( Text ) + ( Text + ) import Data.Time.Clock - ( UTCTime, addUTCTime, getCurrentTime ) + ( UTCTime + , addUTCTime + , getCurrentTime + ) import Data.Word - ( Word64, Word8 ) + ( Word64 + , Word8 + ) import Database.Persist.Sql ( Entity (..) , Filter @@ -131,15 +177,22 @@ import Database.Persist.Sql , (>=.) ) import Database.Persist.Sqlite - ( SqlPersistT ) + ( SqlPersistT + ) import System.Directory - ( removeFile ) + ( removeFile + ) import System.FilePath - ( () ) + ( () + ) import System.Random - ( newStdGen ) + ( newStdGen + ) import UnliftIO.Exception - ( bracket, catch, throwIO ) + ( bracket + , catch + , throwIO + ) import qualified Cardano.Pool.DB.Sqlite.TH as TH import qualified Cardano.Wallet.Primitive.Types as W diff --git a/lib/wallet/src/Cardano/Pool/DB/Sqlite/TH.hs b/lib/wallet/src/Cardano/Pool/DB/Sqlite/TH.hs index 7e55c3a15e7..8e0b4b511c4 100644 --- a/lib/wallet/src/Cardano/Pool/DB/Sqlite/TH.hs +++ b/lib/wallet/src/Cardano/Pool/DB/Sqlite/TH.hs @@ -25,29 +25,47 @@ module Cardano.Pool.DB.Sqlite.TH where import Prelude import Cardano.Pool.Metadata.Types - ( StakePoolMetadataHash (..), StakePoolMetadataUrl (..) ) + ( StakePoolMetadataHash (..) + , StakePoolMetadataUrl (..) + ) import Cardano.Pool.Types - ( PoolId (..), StakePoolTicker ) + ( PoolId (..) + , StakePoolTicker + ) import Cardano.Slotting.Slot - ( SlotNo ) + ( SlotNo + ) import Cardano.Wallet.DB.Sqlite.Types - ( sqlSettings' ) + ( sqlSettings' + ) import Cardano.Wallet.Primitive.Types () import Data.Text - ( Text ) + ( Text + ) import Data.Time.Clock - ( UTCTime ) + ( UTCTime + ) import Data.Time.Clock.POSIX - ( POSIXTime ) + ( POSIXTime + ) import Data.Word - ( Word32, Word64, Word8 ) + ( Word32 + , Word64 + , Word8 + ) import Database.Persist.TH - ( mkMigrate, mkPersist, persistLowerCase, share ) + ( mkMigrate + , mkPersist + , persistLowerCase + , share + ) import GHC.Generics - ( Generic (..) ) + ( Generic (..) + ) import System.Random - ( StdGen ) + ( StdGen + ) import qualified Cardano.Pool.Types as P import qualified Cardano.Wallet.DB.Sqlite.Types as W diff --git a/lib/wallet/src/Cardano/Pool/Metadata.hs b/lib/wallet/src/Cardano/Pool/Metadata.hs index 1248d77a4f0..dc1d8153a8e 100644 --- a/lib/wallet/src/Cardano/Pool/Metadata.hs +++ b/lib/wallet/src/Cardano/Pool/Metadata.hs @@ -43,9 +43,12 @@ module Cardano.Pool.Metadata import Prelude import Cardano.BM.Data.Severity - ( Severity (..) ) + ( Severity (..) + ) import Cardano.BM.Data.Tracer - ( HasPrivacyAnnotation (..), HasSeverityAnnotation (..) ) + ( HasPrivacyAnnotation (..) + , HasSeverityAnnotation (..) + ) import Cardano.Pool.Metadata.Types ( StakePoolMetadata , StakePoolMetadataHash (..) @@ -53,21 +56,36 @@ import Cardano.Pool.Metadata.Types , UrlBuilder ) import Cardano.Pool.Types - ( PoolId, decodePoolIdBech32 ) + ( PoolId + , decodePoolIdBech32 + ) import Cardano.Wallet.Address.Derivation - ( hex ) + ( hex + ) import Control.Error - ( note ) + ( note + ) import Control.Monad - ( forM, when ) + ( forM + , when + ) import Control.Monad.IO.Class - ( MonadIO (..) ) + ( MonadIO (..) + ) import Control.Monad.Trans.Except - ( ExceptT (..), except, runExceptT, throwE, withExceptT ) + ( ExceptT (..) + , except + , runExceptT + , throwE + , withExceptT + ) import Control.Tracer - ( Tracer, traceWith ) + ( Tracer + , traceWith + ) import Crypto.Hash.Extra - ( blake2b256 ) + ( blake2b256 + ) import Data.Aeson ( FromJSON , Options (..) @@ -77,23 +95,35 @@ import Data.Aeson , parseJSON ) import Data.Bifunctor - ( first ) + ( first + ) import Data.ByteArray.Encoding - ( Base (..), convertToBase ) + ( Base (..) + , convertToBase + ) import Data.ByteString - ( ByteString ) + ( ByteString + ) import Data.Coerce - ( coerce ) + ( coerce + ) import Data.List - ( intercalate ) + ( intercalate + ) import Data.Text - ( Text ) + ( Text + ) import Data.Text.Class - ( TextDecodingError (..), ToText (..), fromText ) + ( TextDecodingError (..) + , ToText (..) + , fromText + ) import Fmt - ( pretty ) + ( pretty + ) import GHC.Generics - ( Generic ) + ( Generic + ) import Network.HTTP.Client ( HttpException (..) , Manager @@ -108,11 +138,18 @@ import Network.HTTP.Client , withResponse ) import Network.HTTP.Types.Status - ( status200, status404 ) + ( status200 + , status404 + ) import Network.URI - ( URI (..), parseURI ) + ( URI (..) + , parseURI + ) import UnliftIO.Exception - ( Exception (displayException), IOException, handle ) + ( Exception (displayException) + , IOException + , handle + ) import qualified Data.Aeson as Aeson import qualified Data.ByteString as BS diff --git a/lib/wallet/src/Cardano/Pool/Metadata/Types.hs b/lib/wallet/src/Cardano/Pool/Metadata/Types.hs index c5044472584..9f463fd0316 100644 --- a/lib/wallet/src/Cardano/Pool/Metadata/Types.hs +++ b/lib/wallet/src/Cardano/Pool/Metadata/Types.hs @@ -8,45 +8,76 @@ module Cardano.Pool.Metadata.Types where import Prelude import Cardano.Pool.Types - ( PoolId, StakePoolTicker (unStakePoolTicker) ) + ( PoolId + , StakePoolTicker (unStakePoolTicker) + ) import Cardano.Wallet.Primitive.Types.Hash - ( Hash (..), hashFromText ) + ( Hash (..) + , hashFromText + ) import Control.DeepSeq - ( NFData ) + ( NFData + ) import Control.Monad - ( when ) + ( when + ) import Data.Aeson - ( FromJSON (parseJSON), withObject, (.:), (.:?) ) + ( FromJSON (parseJSON) + , withObject + , (.:) + , (.:?) + ) import Data.Aeson.Extra - ( aesonFromText ) + ( aesonFromText + ) import Data.Aeson.Types - ( ToJSON (toJSON), Value (String) ) + ( ToJSON (toJSON) + , Value (String) + ) import Data.ByteString - ( ByteString ) + ( ByteString + ) import Data.Proxy - ( Proxy (Proxy) ) + ( Proxy (Proxy) + ) import Data.Text - ( Text ) + ( Text + ) import Data.Text.Class.Extended - ( FromText (fromText), ToText (toText), fromText', fromTextMaybe ) + ( FromText (fromText) + , ToText (toText) + , fromText' + , fromTextMaybe + ) import Data.Time.Clock.POSIX - ( POSIXTime ) + ( POSIXTime + ) import Database.Persist.PersistValue.Extended - ( fromPersistValueFromText ) + ( fromPersistValueFromText + ) import Database.Persist.Sql - ( PersistField (..), PersistFieldSql (..) ) + ( PersistField (..) + , PersistFieldSql (..) + ) import Fmt - ( Buildable (build) ) + ( Buildable (build) + ) import GHC.Generics - ( Generic ) + ( Generic + ) import Network.HTTP.Client - ( HttpException ) + ( HttpException + ) import Network.URI - ( URI ) + ( URI + ) import Web.HttpApiData - ( FromHttpApiData (parseUrlPiece), ToHttpApiData (toUrlPiece) ) + ( FromHttpApiData (parseUrlPiece) + , ToHttpApiData (toUrlPiece) + ) import Web.PathPieces - ( PathPiece (..) ) + ( PathPiece (..) + ) import qualified Data.Text as T diff --git a/lib/wallet/src/Cardano/Pool/Rank.hs b/lib/wallet/src/Cardano/Pool/Rank.hs index 5c19eaaf689..33ce5a5d328 100644 --- a/lib/wallet/src/Cardano/Pool/Rank.hs +++ b/lib/wallet/src/Cardano/Pool/Rank.hs @@ -34,19 +34,30 @@ module Cardano.Pool.Rank import Prelude import Cardano.Pool.Types - ( PoolId ) + ( PoolId + ) import Cardano.Wallet.Primitive.Types - ( EpochNo ) + ( EpochNo + ) import Cardano.Wallet.Primitive.Types.Coin - ( Coin (..) ) + ( Coin (..) + ) import Data.Map - ( Map ) + ( Map + ) import Data.Ord - ( Down (..) ) + ( Down (..) + ) import Data.Quantity - ( Percentage (..), clipToPercentage ) + ( Percentage (..) + , clipToPercentage + ) import Fmt - ( Buildable (..), blockListF', listF', mapF ) + ( Buildable (..) + , blockListF' + , listF' + , mapF + ) import qualified Cardano.Wallet.Primitive.Types.Coin as Coin import qualified Data.List as L diff --git a/lib/wallet/src/Cardano/Pool/Rank/Likelihood.hs b/lib/wallet/src/Cardano/Pool/Rank/Likelihood.hs index 1a2a8e66902..d1eafd87ee3 100644 --- a/lib/wallet/src/Cardano/Pool/Rank/Likelihood.hs +++ b/lib/wallet/src/Cardano/Pool/Rank/Likelihood.hs @@ -38,27 +38,38 @@ import Cardano.Wallet.Primitive.Types , getFederationPercentage ) import Control.DeepSeq - ( NFData ) + ( NFData + ) import Data.Foldable - ( find ) + ( find + ) import Data.Function - ( on ) + ( on + ) import Data.List - ( foldl' ) + ( foldl' + ) import Data.Maybe - ( fromMaybe ) + ( fromMaybe + ) import Data.Quantity - ( Percentage (..) ) + ( Percentage (..) + ) import Data.Sequence - ( Seq ) + ( Seq + ) import Data.Sequence.Strict - ( StrictSeq ) + ( StrictSeq + ) import GHC.Generics - ( Generic ) + ( Generic + ) import NoThunks.Class - ( NoThunks (..) ) + ( NoThunks (..) + ) import Numeric.Natural - ( Natural ) + ( Natural + ) import Quiet import qualified Data.Sequence as Seq diff --git a/lib/wallet/src/Cardano/Pool/Types.hs b/lib/wallet/src/Cardano/Pool/Types.hs index 5bc2f8b5731..e47bc5e1187 100644 --- a/lib/wallet/src/Cardano/Pool/Types.hs +++ b/lib/wallet/src/Cardano/Pool/Types.hs @@ -19,43 +19,72 @@ module Cardano.Pool.Types import Prelude import Cardano.Wallet.Primitive.Types.Coin - ( Coin (..) ) + ( Coin (..) + ) import Cardano.Wallet.Util - ( ShowFmt (..) ) + ( ShowFmt (..) + ) import Control.DeepSeq - ( NFData ) + ( NFData + ) import Control.Monad - ( (>=>) ) + ( (>=>) + ) import Data.Aeson - ( FromJSON (parseJSON), ToJSON (toJSON) ) + ( FromJSON (parseJSON) + , ToJSON (toJSON) + ) import Data.ByteArray.Encoding - ( Base (Base16), convertFromBase, convertToBase ) + ( Base (Base16) + , convertFromBase + , convertToBase + ) import Data.ByteString - ( ByteString ) + ( ByteString + ) import Data.List - ( intercalate ) + ( intercalate + ) import Data.Map - ( Map ) + ( Map + ) import Data.Proxy - ( Proxy (..) ) + ( Proxy (..) + ) import Data.Quantity - ( Percentage ) + ( Percentage + ) import Data.Text - ( Text ) + ( Text + ) import Data.Text.Class - ( FromText (..), TextDecodingError (TextDecodingError), ToText (..) ) + ( FromText (..) + , TextDecodingError (TextDecodingError) + , ToText (..) + ) import Data.Text.Encoding - ( decodeUtf8, encodeUtf8 ) + ( decodeUtf8 + , encodeUtf8 + ) import Database.Persist.Class.PersistField - ( PersistField (..) ) + ( PersistField (..) + ) import Database.Persist.PersistValue.Extended - ( fromPersistValueFromText ) + ( fromPersistValueFromText + ) import Database.Persist.Sqlite - ( PersistFieldSql (..) ) + ( PersistFieldSql (..) + ) import Fmt - ( Buildable (..), listF', mapF, prefixF, pretty ) + ( Buildable (..) + , listF' + , mapF + , prefixF + , pretty + ) import GHC.Generics - ( Generic ) + ( Generic + ) import qualified Codec.Binary.Bech32 as Bech32 import qualified Codec.Binary.Bech32.TH as Bech32 diff --git a/lib/wallet/src/Cardano/Wallet.hs b/lib/wallet/src/Cardano/Wallet.hs index c024d0dbcdc..61454382cdd 100644 --- a/lib/wallet/src/Cardano/Wallet.hs +++ b/lib/wallet/src/Cardano/Wallet.hs @@ -231,20 +231,30 @@ module Cardano.Wallet ) where import Prelude hiding - ( log ) + ( log + ) import Cardano.Address.Derivation - ( XPrv, XPub ) + ( XPrv + , XPub + ) import Cardano.Address.Script - ( Cosigner (..), KeyHash ) + ( Cosigner (..) + , KeyHash + ) import Cardano.Api - ( serialiseToCBOR ) + ( serialiseToCBOR + ) import Cardano.Api.Extra - ( inAnyCardanoEra ) + ( inAnyCardanoEra + ) import Cardano.BM.Data.Severity - ( Severity (..) ) + ( Severity (..) + ) import Cardano.BM.Data.Tracer - ( HasPrivacyAnnotation (..), HasSeverityAnnotation (..) ) + ( HasPrivacyAnnotation (..) + , HasSeverityAnnotation (..) + ) import Cardano.BM.Extra ( BracketLog , BracketLog' (..) @@ -254,13 +264,20 @@ import Cardano.BM.Extra , traceResult ) import Cardano.Crypto.Wallet - ( toXPub ) + ( toXPub + ) import Cardano.Mnemonic - ( SomeMnemonic ) + ( SomeMnemonic + ) import Cardano.Slotting.Slot - ( SlotNo (..) ) + ( SlotNo (..) + ) import Cardano.Wallet.Address.Book - ( AddressBookIso, Prologue (..), getDiscoveries, getPrologue ) + ( AddressBookIso + , Prologue (..) + , getDiscoveries + , getPrologue + ) import Cardano.Wallet.Address.Derivation ( DelegationAddress (..) , Depth (..) @@ -280,15 +297,23 @@ import Cardano.Wallet.Address.Derivation , stakeDerivationPath ) import Cardano.Wallet.Address.Derivation.Byron - ( ByronKey ) + ( ByronKey + ) import Cardano.Wallet.Address.Derivation.Icarus - ( IcarusKey ) + ( IcarusKey + ) import Cardano.Wallet.Address.Derivation.MintBurn - ( derivePolicyPrivateKey, policyDerivationPath ) + ( derivePolicyPrivateKey + , policyDerivationPath + ) import Cardano.Wallet.Address.Derivation.SharedKey - ( SharedKey (..), replaceCosignersWithVerKeys ) + ( SharedKey (..) + , replaceCosignersWithVerKeys + ) import Cardano.Wallet.Address.Derivation.Shelley - ( ShelleyKey (..), deriveAccountPrivateKeyShelley ) + ( ShelleyKey (..) + , deriveAccountPrivateKeyShelley + ) import Cardano.Wallet.Address.Discovery ( CompareDiscovery (..) , GenChange (..) @@ -298,9 +323,14 @@ import Cardano.Wallet.Address.Discovery , KnownAddresses (..) ) import Cardano.Wallet.Address.Discovery.Random - ( ErrImportAddress (..), RndStateLike ) + ( ErrImportAddress (..) + , RndStateLike + ) import Cardano.Wallet.Address.Discovery.Sequential - ( SeqState (..), defaultAddressPoolGap, purposeBIP44 ) + ( SeqState (..) + , defaultAddressPoolGap + , purposeBIP44 + ) import Cardano.Wallet.Address.Discovery.Shared ( CredentialType (..) , ErrAddCosigner (..) @@ -309,11 +339,14 @@ import Cardano.Wallet.Address.Discovery.Shared , isShared ) import Cardano.Wallet.Address.Keys.BoundedAddressLength - ( maxLengthAddressFor ) + ( maxLengthAddressFor + ) import Cardano.Wallet.Address.Keys.SequentialAny - ( mkSeqStateFromRootXPrv ) + ( mkSeqStateFromRootXPrv + ) import Cardano.Wallet.Address.Keys.Shared - ( addCosignerAccXPub ) + ( addCosignerAccXPub + ) import Cardano.Wallet.Address.Keys.WalletKey ( AfterByron , afterByron @@ -323,13 +356,19 @@ import Cardano.Wallet.Address.Keys.WalletKey , liftRawKey ) import Cardano.Wallet.Address.MaybeLight - ( MaybeLight (maybeDiscover) ) + ( MaybeLight (maybeDiscover) + ) import Cardano.Wallet.Address.States.IsOwned - ( isOwned ) + ( isOwned + ) import Cardano.Wallet.Balance.Migration - ( MigrationPlan (..) ) + ( MigrationPlan (..) + ) import Cardano.Wallet.Checkpoints - ( DeltaCheckpoints (..), extendCheckpoints, pruneCheckpoints ) + ( DeltaCheckpoints (..) + , extendCheckpoints + , pruneCheckpoints + ) import Cardano.Wallet.DB ( DBFresh (..) , DBLayer (..) @@ -340,15 +379,22 @@ import Cardano.Wallet.DB , ErrWalletNotInitialized (..) ) import Cardano.Wallet.DB.Errors - ( ErrNoSuchWallet (..) ) + ( ErrNoSuchWallet (..) + ) import Cardano.Wallet.DB.Store.Delegations.Layer - ( CurrentEpochSlotting, mkCurrentEpochSlotting ) + ( CurrentEpochSlotting + , mkCurrentEpochSlotting + ) import Cardano.Wallet.DB.Store.Info.Store - ( DeltaWalletInfo (..), WalletInfo (..) ) + ( DeltaWalletInfo (..) + , WalletInfo (..) + ) import Cardano.Wallet.DB.Store.Submissions.Layer - ( mkLocalTxSubmission ) + ( mkLocalTxSubmission + ) import Cardano.Wallet.DB.Store.Submissions.Operations - ( TxSubmissionsStatus ) + ( TxSubmissionsStatus + ) import Cardano.Wallet.DB.WalletState ( DeltaWalletState , DeltaWalletState1 (..) @@ -379,7 +425,8 @@ import Cardano.Wallet.Network , NetworkLayer (..) ) import Cardano.Wallet.Primitive.BlockSummary - ( ChainEvents ) + ( ChainEvents + ) import Cardano.Wallet.Primitive.Model ( BlockData (..) , Wallet @@ -393,7 +440,8 @@ import Cardano.Wallet.Primitive.Model , totalUTxO ) import Cardano.Wallet.Primitive.NetworkId - ( HasSNetworkId (..) ) + ( HasSNetworkId (..) + ) import Cardano.Wallet.Primitive.Passphrase ( ErrWrongPassphrase (..) , Passphrase @@ -419,7 +467,8 @@ import Cardano.Wallet.Primitive.Slotting , unsafeExtendSafeZone ) import Cardano.Wallet.Primitive.SyncProgress - ( SyncProgress ) + ( SyncProgress + ) import Cardano.Wallet.Primitive.Types ( ActiveSlotCoefficient (..) , Block (..) @@ -445,17 +494,25 @@ import Cardano.Wallet.Primitive.Types , wholeRange ) import Cardano.Wallet.Primitive.Types.Address - ( Address (..), AddressState (..) ) + ( Address (..) + , AddressState (..) + ) import Cardano.Wallet.Primitive.Types.Coin - ( Coin (..) ) + ( Coin (..) + ) import Cardano.Wallet.Primitive.Types.Credentials - ( ClearCredentials, RootCredentials (..) ) + ( ClearCredentials + , RootCredentials (..) + ) import Cardano.Wallet.Primitive.Types.Hash - ( Hash (..) ) + ( Hash (..) + ) import Cardano.Wallet.Primitive.Types.RewardAccount - ( RewardAccount (..) ) + ( RewardAccount (..) + ) import Cardano.Wallet.Primitive.Types.TokenBundle - ( TokenBundle (..) ) + ( TokenBundle (..) + ) import Cardano.Wallet.Primitive.Types.Tx ( LocalTxSubmissionStatus , SealedTx @@ -466,19 +523,29 @@ import Cardano.Wallet.Primitive.Types.Tx , sealedTxFromCardano ) import Cardano.Wallet.Primitive.Types.Tx.TransactionInfo - ( TransactionInfo (..), fromTransactionInfo ) + ( TransactionInfo (..) + , fromTransactionInfo + ) import Cardano.Wallet.Primitive.Types.Tx.TxIn - ( TxIn (..) ) + ( TxIn (..) + ) import Cardano.Wallet.Primitive.Types.Tx.TxMeta - ( Direction (..), TxMeta (..), TxStatus (..) ) + ( Direction (..) + , TxMeta (..) + , TxStatus (..) + ) import Cardano.Wallet.Primitive.Types.Tx.TxOut - ( TxOut (..) ) + ( TxOut (..) + ) import Cardano.Wallet.Primitive.Types.UTxO - ( UTxO (..) ) + ( UTxO (..) + ) import Cardano.Wallet.Primitive.Types.UTxOStatistics - ( UTxOStatistics ) + ( UTxOStatistics + ) import Cardano.Wallet.Read.Tx.CBOR - ( TxCBOR ) + ( TxCBOR + ) import Cardano.Wallet.Shelley.Compatibility ( fromCardanoBlock , fromCardanoLovelace @@ -487,9 +554,15 @@ import Cardano.Wallet.Shelley.Compatibility , fromCardanoWdrls ) import Cardano.Wallet.Shelley.Compatibility.Ledger - ( toLedgerAddress, toWallet, toWalletCoin ) + ( toLedgerAddress + , toWallet + , toWalletCoin + ) import Cardano.Wallet.Shelley.Transaction - ( txConstraints, txWitnessTagForKey, _txRewardWithdrawalCost ) + ( txConstraints + , txWitnessTagForKey + , _txRewardWithdrawalCost + ) import Cardano.Wallet.Transaction ( DelegationAction (..) , ErrCannotJoin (..) @@ -507,7 +580,8 @@ import Cardano.Wallet.Transaction , withdrawalToCoin ) import Cardano.Wallet.Transaction.Built - ( BuiltTx (..) ) + ( BuiltTx (..) + ) import Cardano.Write.Tx ( ErrBalanceTx (..) , ErrBalanceTxInternalError (..) @@ -515,21 +589,39 @@ import Cardano.Write.Tx , balanceTransaction ) import Control.Arrow - ( (>>>) ) + ( (>>>) + ) import Control.DeepSeq - ( NFData ) + ( NFData + ) import Control.Monad - ( forM, forM_, join, replicateM, unless, when, (<=<) ) + ( forM + , forM_ + , join + , replicateM + , unless + , when + , (<=<) + ) import Control.Monad.Class.MonadTime - ( MonadTime (..) ) + ( MonadTime (..) + ) import Control.Monad.IO.Unlift - ( MonadIO (..), MonadUnliftIO ) + ( MonadIO (..) + , MonadUnliftIO + ) import Control.Monad.Random.Strict - ( Rand, StdGen, evalRand, initStdGen ) + ( Rand + , StdGen + , evalRand + , initStdGen + ) import Control.Monad.State.Class - ( MonadState (get, put) ) + ( MonadState (get, put) + ) import Control.Monad.Trans.Class - ( lift ) + ( lift + ) import Control.Monad.Trans.Except ( ExceptT (..) , catchE @@ -540,59 +632,104 @@ import Control.Monad.Trans.Except , withExceptT ) import Control.Monad.Trans.State - ( StateT, evalState, runStateT, state ) + ( StateT + , evalState + , runStateT + , state + ) import Control.Tracer - ( Tracer, contramap, traceWith ) + ( Tracer + , contramap + , traceWith + ) import Crypto.Hash - ( Blake2b_256, hash ) + ( Blake2b_256 + , hash + ) import Data.Bifunctor - ( first ) + ( first + ) import Data.ByteString - ( ByteString ) + ( ByteString + ) import Data.DBVar - ( DBVar, readDBVar ) + ( DBVar + , readDBVar + ) import Data.Delta - ( Replace (..) ) + ( Replace (..) + ) import Data.Delta.Update - ( onDBVar, update ) + ( onDBVar + , update + ) import Data.Either - ( partitionEithers ) + ( partitionEithers + ) import Data.Either.Extra - ( eitherToMaybe ) + ( eitherToMaybe + ) import Data.Function - ( (&) ) + ( (&) + ) import Data.Functor - ( ($>), (<&>) ) + ( ($>) + , (<&>) + ) import Data.Functor.Contravariant - ( (>$<) ) + ( (>$<) + ) import Data.Generics.Internal.VL.Lens - ( Lens', view, (.~), (^.) ) + ( Lens' + , view + , (.~) + , (^.) + ) import Data.Generics.Labels () import Data.Generics.Product.Typed - ( HasType, typed ) + ( HasType + , typed + ) import Data.IntCast - ( intCast ) + ( intCast + ) import Data.List - ( foldl' ) + ( foldl' + ) import Data.List.NonEmpty - ( NonEmpty (..) ) + ( NonEmpty (..) + ) import Data.Maybe - ( fromJust, fromMaybe, isJust, mapMaybe, maybeToList ) + ( fromJust + , fromMaybe + , isJust + , mapMaybe + , maybeToList + ) import Data.Quantity - ( Quantity (..) ) + ( Quantity (..) + ) import Data.Set - ( Set ) + ( Set + ) import Data.Text - ( Text ) + ( Text + ) import Data.Text.Class - ( ToText (..) ) + ( ToText (..) + ) import Data.Time.Clock - ( DiffTime, NominalDiffTime, UTCTime ) + ( DiffTime + , NominalDiffTime + , UTCTime + ) import Data.Void - ( Void ) + ( Void + ) import Data.Word - ( Word64 ) + ( Word64 + ) import Fmt ( Buildable , blockListF @@ -607,13 +744,17 @@ import Fmt , (||+) ) import GHC.Generics - ( Generic ) + ( Generic + ) import GHC.Num - ( Natural ) + ( Natural + ) import GHC.TypeNats - ( Nat ) + ( Nat + ) import Internal.Cardano.Write.Tx - ( recentEra ) + ( recentEra + ) import Internal.Cardano.Write.Tx.Balance ( ChangeAddressGen (..) , PartialTx (..) @@ -621,17 +762,32 @@ import Internal.Cardano.Write.Tx.Balance , constructUTxOIndex ) import Internal.Cardano.Write.Tx.SizeEstimation - ( TxWitnessTag (..) ) + ( TxWitnessTag (..) + ) import Internal.Cardano.Write.Tx.TimeTranslation - ( TimeTranslation ) + ( TimeTranslation + ) import Ouroboros.Consensus.Util.IOLike - ( MonadMonotonicTime, Time, diffTime, getMonotonicTime ) + ( MonadMonotonicTime + , Time + , diffTime + , getMonotonicTime + ) import Statistics.Quantile - ( medianUnbiased, quantiles ) + ( medianUnbiased + , quantiles + ) import UnliftIO.Exception - ( Exception, catch, evaluate, throwIO, try ) + ( Exception + , catch + , evaluate + , throwIO + , try + ) import UnliftIO.MVar - ( modifyMVar_, newMVar ) + ( modifyMVar_ + , newMVar + ) import qualified Cardano.Address.Script as CA import qualified Cardano.Address.Style.Shelley as CAShelley diff --git a/lib/wallet/src/Cardano/Wallet/Address/Discovery/RandomAny.hs b/lib/wallet/src/Cardano/Wallet/Address/Discovery/RandomAny.hs index b5e9715ed5e..442592d7a6c 100644 --- a/lib/wallet/src/Cardano/Wallet/Address/Discovery/RandomAny.hs +++ b/lib/wallet/src/Cardano/Wallet/Address/Discovery/RandomAny.hs @@ -31,13 +31,17 @@ module Cardano.Wallet.Address.Discovery.RandomAny import Prelude import Cardano.Address.Derivation - ( XPrv ) + ( XPrv + ) import Cardano.Wallet.Address.Book - ( AddressBookIso (..) ) + ( AddressBookIso (..) + ) import Cardano.Wallet.Address.Derivation - ( Depth (..) ) + ( Depth (..) + ) import Cardano.Wallet.Address.Derivation.Byron - ( ByronKey (..) ) + ( ByronKey (..) + ) import Cardano.Wallet.Address.Discovery ( CompareDiscovery (..) , GenChange (..) @@ -52,33 +56,54 @@ import Cardano.Wallet.Address.Discovery.Random , toDerivationIndexes ) import Cardano.Wallet.Address.States.Families - ( CredFromOf, KeyOf, NetworkOf ) + ( CredFromOf + , KeyOf + , NetworkOf + ) import Cardano.Wallet.Primitive.NetworkId - ( HasSNetworkId, NetworkDiscriminant ) + ( HasSNetworkId + , NetworkDiscriminant + ) import Cardano.Wallet.Primitive.Types.Address - ( Address (..), AddressState (..) ) + ( Address (..) + , AddressState (..) + ) import Cardano.Wallet.Primitive.Types.RewardAccount - ( RewardAccount ) + ( RewardAccount + ) import Cardano.Wallet.Shelley.Compatibility.Ledger - ( toLedger ) + ( toLedger + ) import Control.Arrow - ( second ) + ( second + ) import Control.DeepSeq - ( NFData (..) ) + ( NFData (..) + ) import Control.Lens - ( iso, withIso ) + ( iso + , withIso + ) import Data.Digest.CRC32 - ( crc32 ) + ( crc32 + ) import Data.Proxy - ( Proxy (..) ) + ( Proxy (..) + ) import Data.Word - ( Word32 ) + ( Word32 + ) import GHC.Generics - ( Generic ) + ( Generic + ) import GHC.TypeLits - ( KnownNat, Nat, natVal ) + ( KnownNat + , Nat + , natVal + ) import System.Random - ( mkStdGen ) + ( mkStdGen + ) import qualified Cardano.Wallet.Address.Discovery.Random as Rnd import qualified Internal.Cardano.Write.UTxOAssumptions as UTxOAssumptions diff --git a/lib/wallet/src/Cardano/Wallet/Address/Discovery/SequentialAny.hs b/lib/wallet/src/Cardano/Wallet/Address/Discovery/SequentialAny.hs index 9a70b00d0b1..088abc7852b 100644 --- a/lib/wallet/src/Cardano/Wallet/Address/Discovery/SequentialAny.hs +++ b/lib/wallet/src/Cardano/Wallet/Address/Discovery/SequentialAny.hs @@ -44,9 +44,11 @@ module Cardano.Wallet.Address.Discovery.SequentialAny import Prelude import Cardano.Crypto.Wallet - ( XPub ) + ( XPub + ) import Cardano.Wallet.Address.Book - ( AddressBookIso (..) ) + ( AddressBookIso (..) + ) import Cardano.Wallet.Address.Derivation ( Depth (..) , DerivationIndex (..) @@ -57,39 +59,67 @@ import Cardano.Wallet.Address.Derivation , SoftDerivation (..) ) import Cardano.Wallet.Address.Derivation.Shared - ( SharedKey ) + ( SharedKey + ) import Cardano.Wallet.Address.Discovery - ( CompareDiscovery (..), GenChange (..), IsOurs (..), KnownAddresses (..) ) + ( CompareDiscovery (..) + , GenChange (..) + , IsOurs (..) + , KnownAddresses (..) + ) import Cardano.Wallet.Address.Discovery.Sequential - ( SeqAddressPool (..), SeqState (..), SupportsDiscovery ) + ( SeqAddressPool (..) + , SeqState (..) + , SupportsDiscovery + ) import Cardano.Wallet.Address.States.Families - ( CredFromOf, KeyOf, NetworkOf ) + ( CredFromOf + , KeyOf + , NetworkOf + ) import Cardano.Wallet.Primitive.NetworkId - ( HasSNetworkId (..), NetworkDiscriminant ) + ( HasSNetworkId (..) + , NetworkDiscriminant + ) import Cardano.Wallet.Primitive.Types.Address - ( Address (..) ) + ( Address (..) + ) import Cardano.Wallet.Primitive.Types.RewardAccount - ( RewardAccount ) + ( RewardAccount + ) import Cardano.Wallet.Shelley.Compatibility.Ledger - ( toLedger ) + ( toLedger + ) import Control.DeepSeq - ( NFData (..) ) + ( NFData (..) + ) import Control.Lens - ( iso, withIso ) + ( iso + , withIso + ) import Data.Digest.CRC32 - ( crc32 ) + ( crc32 + ) import Data.List.NonEmpty - ( NonEmpty (..) ) + ( NonEmpty (..) + ) import Data.Proxy - ( Proxy (..) ) + ( Proxy (..) + ) import Data.Type.Equality - ( type (==) ) + ( type (==) + ) import Data.Word - ( Word32 ) + ( Word32 + ) import GHC.Generics - ( Generic ) + ( Generic + ) import GHC.TypeLits - ( KnownNat, Nat, natVal ) + ( KnownNat + , Nat + , natVal + ) import qualified Cardano.Wallet.Address.Discovery.Sequential as Seq import qualified Cardano.Wallet.Address.Pool as AddressPool diff --git a/lib/wallet/src/Cardano/Wallet/Address/Keys/BoundedAddressLength.hs b/lib/wallet/src/Cardano/Wallet/Address/Keys/BoundedAddressLength.hs index 14a37b49f7d..a01f2b485e2 100644 --- a/lib/wallet/src/Cardano/Wallet/Address/Keys/BoundedAddressLength.hs +++ b/lib/wallet/src/Cardano/Wallet/Address/Keys/BoundedAddressLength.hs @@ -9,13 +9,17 @@ module Cardano.Wallet.Address.Keys.BoundedAddressLength import Prelude import Cardano.Wallet.Flavor - ( KeyFlavorS (..) ) + ( KeyFlavorS (..) + ) import Cardano.Wallet.Primitive.Passphrase.Types - ( Passphrase (..) ) + ( Passphrase (..) + ) import Cardano.Wallet.Primitive.Types.Address - ( Address (Address) ) + ( Address (Address) + ) import Cardano.Wallet.Primitive.Types.ProtocolMagic - ( ProtocolMagic (ProtocolMagic) ) + ( ProtocolMagic (ProtocolMagic) + ) import qualified Cardano.Byron.Codec.Cbor as CBOR import qualified Cardano.Crypto.Wallet as CC diff --git a/lib/wallet/src/Cardano/Wallet/Address/Keys/MintBurn.hs b/lib/wallet/src/Cardano/Wallet/Address/Keys/MintBurn.hs index 9bae8e75a65..ea1f07d6041 100644 --- a/lib/wallet/src/Cardano/Wallet/Address/Keys/MintBurn.hs +++ b/lib/wallet/src/Cardano/Wallet/Address/Keys/MintBurn.hs @@ -13,33 +13,59 @@ module Cardano.Wallet.Address.Keys.MintBurn import Prelude import Cardano.Address.Derivation - ( XPrv, XPub ) + ( XPrv + , XPub + ) import Cardano.Address.Script - ( Cosigner, KeyHash, Script (..), ScriptHash (unScriptHash), toScriptHash ) + ( Cosigner + , KeyHash + , Script (..) + , ScriptHash (unScriptHash) + , toScriptHash + ) import Cardano.Wallet.Address.Derivation - ( Depth (..), DerivationType (..), Index ) + ( Depth (..) + , DerivationType (..) + , Index + ) import Cardano.Wallet.Address.Derivation.MintBurn - ( derivePolicyPrivateKey ) + ( derivePolicyPrivateKey + ) import Cardano.Wallet.Address.Keys.WalletKey - ( AfterByron, getRawKey, hashVerificationKey, liftRawKey, publicKey ) + ( AfterByron + , getRawKey + , hashVerificationKey + , liftRawKey + , publicKey + ) import Cardano.Wallet.Flavor - ( KeyFlavorS ) + ( KeyFlavorS + ) import Cardano.Wallet.Primitive.Passphrase - ( Passphrase (..) ) + ( Passphrase (..) + ) import Cardano.Wallet.Primitive.Types.Hash - ( Hash (..) ) + ( Hash (..) + ) import Cardano.Wallet.Primitive.Types.TokenMap - ( AssetId (..) ) + ( AssetId (..) + ) import Cardano.Wallet.Primitive.Types.TokenPolicy - ( TokenName, TokenPolicyId (..) ) + ( TokenName + , TokenPolicyId (..) + ) import Cardano.Wallet.Primitive.Types.TokenQuantity - ( TokenQuantity (..) ) + ( TokenQuantity (..) + ) import Data.Map - ( Map ) + ( Map + ) import GHC.Natural - ( Natural ) + ( Natural + ) import GHC.Stack - ( HasCallStack ) + ( HasCallStack + ) import qualified Cardano.Address.Script as CA import qualified Data.Map as Map diff --git a/lib/wallet/src/Cardano/Wallet/Address/Keys/PersistPrivateKey.hs b/lib/wallet/src/Cardano/Wallet/Address/Keys/PersistPrivateKey.hs index 458e4ffa2b3..d7916a2a33c 100644 --- a/lib/wallet/src/Cardano/Wallet/Address/Keys/PersistPrivateKey.hs +++ b/lib/wallet/src/Cardano/Wallet/Address/Keys/PersistPrivateKey.hs @@ -13,27 +13,42 @@ module Cardano.Wallet.Address.Keys.PersistPrivateKey import Prelude import Cardano.Address.Derivation - ( XPrv ) + ( XPrv + ) import Cardano.Crypto.Wallet - ( unXPrv, xprv ) + ( unXPrv + , xprv + ) import Cardano.Wallet.Address.Derivation - ( Depth (RootK), fromHex, hex ) + ( Depth (RootK) + , fromHex + , hex + ) import Cardano.Wallet.Address.Derivation.Byron - ( ByronKey (..) ) + ( ByronKey (..) + ) import Cardano.Wallet.Address.Derivation.Icarus - ( IcarusKey (..) ) + ( IcarusKey (..) + ) import Cardano.Wallet.Address.Derivation.SharedKey - ( SharedKey (..) ) + ( SharedKey (..) + ) import Cardano.Wallet.Address.Derivation.Shelley - ( ShelleyKey (..) ) + ( ShelleyKey (..) + ) import Cardano.Wallet.Flavor - ( KeyFlavorS (..) ) + ( KeyFlavorS (..) + ) import Cardano.Wallet.Primitive.Passphrase.Types - ( Passphrase (..), PassphraseHash (..) ) + ( Passphrase (..) + , PassphraseHash (..) + ) import Control.Monad - ( (<=<) ) + ( (<=<) + ) import Data.ByteString - ( ByteString ) + ( ByteString + ) import qualified Cardano.Crypto.Wallet as CC import qualified Cardano.Wallet.Address.Derivation.Icarus as Icarus diff --git a/lib/wallet/src/Cardano/Wallet/Address/Keys/SequentialAny.hs b/lib/wallet/src/Cardano/Wallet/Address/Keys/SequentialAny.hs index be34ac02849..4db169b4ff5 100644 --- a/lib/wallet/src/Cardano/Wallet/Address/Keys/SequentialAny.hs +++ b/lib/wallet/src/Cardano/Wallet/Address/Keys/SequentialAny.hs @@ -13,26 +13,46 @@ where import Prelude import Cardano.Wallet.Address.Derivation - ( Depth (..), DerivationType (..), HardDerivation (..), Index (..) ) + ( Depth (..) + , DerivationType (..) + , HardDerivation (..) + , Index (..) + ) import Cardano.Wallet.Address.Derivation.MintBurn - ( derivePolicyPrivateKey ) + ( derivePolicyPrivateKey + ) import Cardano.Wallet.Address.Derivation.SharedKey - ( SharedKey (..) ) + ( SharedKey (..) + ) import Cardano.Wallet.Address.Discovery.Sequential - ( AddressPoolGap, SeqState, SupportsDiscovery, mkSeqStateFromAccountXPub ) + ( AddressPoolGap + , SeqState + , SupportsDiscovery + , mkSeqStateFromAccountXPub + ) import Cardano.Wallet.Flavor - ( Excluding, KeyFlavorS ) + ( Excluding + , KeyFlavorS + ) import GHC.TypeLits - ( Nat ) + ( Nat + ) import Cardano.Wallet.Address.Derivation.Byron - ( ByronKey (..) ) + ( ByronKey (..) + ) import Cardano.Wallet.Address.Discovery.SequentialAny - ( SeqAnyState (..) ) + ( SeqAnyState (..) + ) import Cardano.Wallet.Address.Keys.WalletKey - ( getRawKey, liftRawKey, publicKey ) + ( getRawKey + , liftRawKey + , publicKey + ) import Cardano.Wallet.Primitive.Types.Credentials - ( ClearCredentials, RootCredentials (..) ) + ( ClearCredentials + , RootCredentials (..) + ) diff --git a/lib/wallet/src/Cardano/Wallet/Address/Keys/Shared.hs b/lib/wallet/src/Cardano/Wallet/Address/Keys/Shared.hs index fcb60a1f0eb..5e0e92fb124 100644 --- a/lib/wallet/src/Cardano/Wallet/Address/Keys/Shared.hs +++ b/lib/wallet/src/Cardano/Wallet/Address/Keys/Shared.hs @@ -40,7 +40,9 @@ import Cardano.Address.Script , validateScriptTemplate ) import Cardano.Crypto.Wallet - ( XPub, unXPub ) + ( XPub + , unXPub + ) import Cardano.Wallet.Address.Derivation ( Depth (..) , DerivationPrefix (..) @@ -49,11 +51,17 @@ import Cardano.Wallet.Address.Derivation , Index (..) ) import Cardano.Wallet.Address.Derivation.SharedKey - ( SharedKey (..), purposeCIP1854, replaceCosignersWithVerKeys ) + ( SharedKey (..) + , purposeCIP1854 + , replaceCosignersWithVerKeys + ) import Cardano.Wallet.Address.Discovery - ( coinTypeAda, emptyPendingIxs ) + ( coinTypeAda + , emptyPendingIxs + ) import Cardano.Wallet.Address.Discovery.Sequential - ( AddressPoolGap (..) ) + ( AddressPoolGap (..) + ) import Cardano.Wallet.Address.Discovery.Shared ( CredentialType (..) , ErrAddCosigner (..) @@ -66,25 +74,38 @@ import Cardano.Wallet.Address.Discovery.Shared , retrieveAllCosigners ) import Cardano.Wallet.Address.Keys.WalletKey - ( getRawKey, publicKey ) + ( getRawKey + , publicKey + ) import Cardano.Wallet.Flavor - ( KeyFlavorS ) + ( KeyFlavorS + ) import Cardano.Wallet.Primitive.Types.RewardAccount - ( RewardAccount (..) ) + ( RewardAccount (..) + ) import Control.Monad - ( unless ) + ( unless + ) import Crypto.Hash - ( Blake2b_160, Digest, hash ) + ( Blake2b_160 + , Digest + , hash + ) import Data.Either - ( isRight ) + ( isRight + ) import Data.Either.Combinators - ( mapLeft ) + ( mapLeft + ) import Cardano.Address.Script.Parser - ( scriptToText ) + ( scriptToText + ) import qualified Cardano.Address.Style.Shelley as CA import Cardano.Wallet.Primitive.Types.Credentials - ( ClearCredentials, RootCredentials (..) ) + ( ClearCredentials + , RootCredentials (..) + ) import qualified Data.Foldable as F import qualified Data.Map.Strict as Map import qualified Data.Text.Encoding as T diff --git a/lib/wallet/src/Cardano/Wallet/Address/Keys/WalletKey.hs b/lib/wallet/src/Cardano/Wallet/Address/Keys/WalletKey.hs index f75081408cf..b7152c70283 100644 --- a/lib/wallet/src/Cardano/Wallet/Address/Keys/WalletKey.hs +++ b/lib/wallet/src/Cardano/Wallet/Address/Keys/WalletKey.hs @@ -26,31 +26,59 @@ module Cardano.Wallet.Address.Keys.WalletKey import Prelude import Cardano.Address.Derivation - ( XPrv, xpubPublicKey ) + ( XPrv + , xpubPublicKey + ) import Cardano.Address.Script - ( KeyHash (KeyHash), KeyRole ) + ( KeyHash (KeyHash) + , KeyRole + ) import Cardano.Crypto.Wallet - ( XPub, toXPub, unXPub ) + ( XPub + , toXPub + , unXPub + ) import Cardano.Wallet.Address.Derivation.Byron - ( ByronKey (..), byronKey, hdPassphrase ) + ( ByronKey (..) + , byronKey + , hdPassphrase + ) import Cardano.Wallet.Address.Derivation.Icarus - ( IcarusKey (..), icarusKey ) + ( IcarusKey (..) + , icarusKey + ) import Cardano.Wallet.Address.Derivation.SharedKey - ( SharedKey (..), sharedKey ) + ( SharedKey (..) + , sharedKey + ) import Cardano.Wallet.Address.Derivation.Shelley - ( ShelleyKey (..), shelleyKey ) + ( ShelleyKey (..) + , shelleyKey + ) import Cardano.Wallet.Flavor - ( Excluding, KeyFlavorS (..) ) + ( Excluding + , KeyFlavorS (..) + ) import Cardano.Wallet.Primitive.Passphrase - ( PassphraseScheme, changePassphraseXPrv ) + ( PassphraseScheme + , changePassphraseXPrv + ) import Cardano.Wallet.Primitive.Passphrase.Types - ( Passphrase (..) ) + ( Passphrase (..) + ) import Control.Lens - ( over, view, (^.) ) + ( over + , view + , (^.) + ) import Crypto.Hash - ( Digest, HashAlgorithm, hash ) + ( Digest + , HashAlgorithm + , hash + ) import Crypto.Hash.Extra - ( blake2b224 ) + ( blake2b224 + ) -- | Re-encrypt a private key using a different passphrase. -- diff --git a/lib/wallet/src/Cardano/Wallet/Address/Keys/WitnessCount.hs b/lib/wallet/src/Cardano/Wallet/Address/Keys/WitnessCount.hs index 576d8867d27..a4e21fd656a 100644 --- a/lib/wallet/src/Cardano/Wallet/Address/Keys/WitnessCount.hs +++ b/lib/wallet/src/Cardano/Wallet/Address/Keys/WitnessCount.hs @@ -15,19 +15,31 @@ module Cardano.Wallet.Address.Keys.WitnessCount import Prelude import Cardano.Address.Derivation - ( xpubToBytes ) + ( xpubToBytes + ) import Cardano.Address.Script - ( KeyHash (..), KeyRole (..), ScriptTemplate (..) ) + ( KeyHash (..) + , KeyRole (..) + , ScriptTemplate (..) + ) import Cardano.Wallet.Address.Derivation - ( Role (MutableAccount), deriveAddressPublicKey ) + ( Role (MutableAccount) + , deriveAddressPublicKey + ) import Cardano.Wallet.Address.Derivation.Shared - ( SharedKey (..) ) + ( SharedKey (..) + ) import Cardano.Wallet.Address.Discovery.Sequential - ( SeqState, policyXPub ) + ( SeqState + , policyXPub + ) import Cardano.Wallet.Address.Discovery.Shared - ( delegationTemplate ) + ( delegationTemplate + ) import Cardano.Wallet.Address.Keys.WalletKey - ( getRawKey, hashVerificationKey ) + ( getRawKey + , hashVerificationKey + ) import Cardano.Wallet.Flavor ( FlavorOf , IncludingStates @@ -38,7 +50,8 @@ import Cardano.Wallet.Flavor , keyFlavorFromState ) import Cardano.Wallet.Transaction - ( WitnessCountCtx (..) ) + ( WitnessCountCtx (..) + ) import qualified Cardano.Address.Script as CA import qualified Data.Map as Map diff --git a/lib/wallet/src/Cardano/Wallet/Address/MaybeLight.hs b/lib/wallet/src/Cardano/Wallet/Address/MaybeLight.hs index bd2dc0d5cc6..5bfd35289d2 100644 --- a/lib/wallet/src/Cardano/Wallet/Address/MaybeLight.hs +++ b/lib/wallet/src/Cardano/Wallet/Address/MaybeLight.hs @@ -23,31 +23,45 @@ import Cardano.Wallet.Address.Derivation , liftPaymentAddressS ) import Cardano.Wallet.Address.Derivation.Icarus - ( IcarusKey ) + ( IcarusKey + ) import Cardano.Wallet.Address.Derivation.Shelley - ( ShelleyKey ) + ( ShelleyKey + ) import Cardano.Wallet.Address.Discovery - ( dropLowerPendingIxs ) + ( dropLowerPendingIxs + ) import Cardano.Wallet.Address.Discovery.Random - ( RndState ) + ( RndState + ) import Cardano.Wallet.Address.Discovery.RandomAny - ( RndAnyState ) + ( RndAnyState + ) import Cardano.Wallet.Address.Discovery.Sequential - ( SeqAddressPool (..), SeqState (..) ) + ( SeqAddressPool (..) + , SeqState (..) + ) import Cardano.Wallet.Address.Discovery.SequentialAny - ( SeqAnyState ) + ( SeqAnyState + ) import Cardano.Wallet.Address.Discovery.Shared - ( SharedState ) + ( SharedState + ) import Cardano.Wallet.Primitive.BlockSummary - ( ChainEvents ) + ( ChainEvents + ) import Cardano.Wallet.Primitive.NetworkId - ( HasSNetworkId ) + ( HasSNetworkId + ) import Cardano.Wallet.Primitive.Types.Address - ( Address ) + ( Address + ) import Cardano.Wallet.Primitive.Types.RewardAccount - ( RewardAccount ) + ( RewardAccount + ) import Data.Bifunctor - ( second ) + ( second + ) import qualified Cardano.Wallet.Address.Pool as AddressPool diff --git a/lib/wallet/src/Cardano/Wallet/Address/States/IsOwned.hs b/lib/wallet/src/Cardano/Wallet/Address/States/IsOwned.hs index 1bc8d47f029..4c1363e048b 100644 --- a/lib/wallet/src/Cardano/Wallet/Address/States/IsOwned.hs +++ b/lib/wallet/src/Cardano/Wallet/Address/States/IsOwned.hs @@ -12,23 +12,33 @@ module Cardano.Wallet.Address.States.IsOwned import Prelude import Cardano.Crypto.Wallet - ( XPrv ) + ( XPrv + ) import Cardano.Wallet.Address.Derivation - ( Depth (..) ) + ( Depth (..) + ) import Cardano.Wallet.Address.Derivation.Shared () import Cardano.Wallet.Address.States.Families - ( CredFromOf, KeyOf, NetworkOf ) + ( CredFromOf + , KeyOf + , NetworkOf + ) import Cardano.Wallet.Address.States.Features - ( TestFeatures (isOwnedTest) ) + ( TestFeatures (isOwnedTest) + ) import Cardano.Wallet.Flavor - ( WalletFlavorS (..) ) + ( WalletFlavorS (..) + ) import Cardano.Wallet.Primitive.NetworkId - ( HasSNetworkId ) + ( HasSNetworkId + ) import Cardano.Wallet.Primitive.Passphrase.Types - ( Passphrase (..) ) + ( Passphrase (..) + ) import Cardano.Wallet.Primitive.Types.Address - ( Address (..) ) + ( Address (..) + ) import qualified Cardano.Wallet.Address.Discovery.Random as Rnd import qualified Cardano.Wallet.Address.Discovery.Sequential as Seq diff --git a/lib/wallet/src/Cardano/Wallet/Balance/Migration.hs b/lib/wallet/src/Cardano/Wallet/Balance/Migration.hs index ff047d5bff4..5ca58456d32 100644 --- a/lib/wallet/src/Cardano/Wallet/Balance/Migration.hs +++ b/lib/wallet/src/Cardano/Wallet/Balance/Migration.hs @@ -24,25 +24,35 @@ module Cardano.Wallet.Balance.Migration import Prelude import Cardano.Wallet.Balance.Migration.Selection - ( RewardWithdrawal (..), Selection (..) ) + ( RewardWithdrawal (..) + , Selection (..) + ) import Cardano.Wallet.Primitive.Types.Coin - ( Coin ) + ( Coin + ) import Cardano.Wallet.Primitive.Types.Tx.Constraints - ( TxConstraints (..) ) + ( TxConstraints (..) + ) import Cardano.Wallet.Primitive.Types.Tx.TxIn - ( TxIn ) + ( TxIn + ) import Cardano.Wallet.Primitive.Types.Tx.TxOut - ( TxOut ) + ( TxOut + ) import Cardano.Wallet.Primitive.Types.UTxO - ( UTxO ) + ( UTxO + ) import Control.DeepSeq - ( NFData ) + ( NFData + ) import Data.Generics.Internal.VL.Lens - ( view ) + ( view + ) import Data.Generics.Labels () import GHC.Generics - ( Generic ) + ( Generic + ) import qualified Cardano.Wallet.Balance.Migration.Planning as Planning diff --git a/lib/wallet/src/Cardano/Wallet/Balance/Migration/Planning.hs b/lib/wallet/src/Cardano/Wallet/Balance/Migration/Planning.hs index fa61d9dd5ea..20d3d452a60 100644 --- a/lib/wallet/src/Cardano/Wallet/Balance/Migration/Planning.hs +++ b/lib/wallet/src/Cardano/Wallet/Balance/Migration/Planning.hs @@ -40,29 +40,42 @@ module Cardano.Wallet.Balance.Migration.Planning import Prelude import Cardano.Wallet.Balance.Migration.Selection - ( RewardWithdrawal (..), Selection (..), SelectionError (..) ) + ( RewardWithdrawal (..) + , Selection (..) + , SelectionError (..) + ) import Cardano.Wallet.Primitive.Types.Coin - ( Coin (..) ) + ( Coin (..) + ) import Cardano.Wallet.Primitive.Types.TokenBundle - ( TokenBundle (..) ) + ( TokenBundle (..) + ) import Cardano.Wallet.Primitive.Types.Tx.Constraints - ( TxConstraints (..) ) + ( TxConstraints (..) + ) import Cardano.Wallet.Primitive.Types.Tx.TxIn - ( TxIn ) + ( TxIn + ) import Cardano.Wallet.Primitive.Types.Tx.TxOut - ( TxOut ) + ( TxOut + ) import Cardano.Wallet.Primitive.Types.UTxO - ( UTxO (..) ) + ( UTxO (..) + ) import Data.Either - ( isRight ) + ( isRight + ) import Data.Functor - ( (<&>) ) + ( (<&>) + ) import Data.Generics.Internal.VL.Lens - ( view ) + ( view + ) import Data.Generics.Labels () import GHC.Generics - ( Generic ) + ( Generic + ) import qualified Cardano.Wallet.Balance.Migration.Selection as Selection import qualified Cardano.Wallet.Primitive.Types.TokenBundle as TokenBundle diff --git a/lib/wallet/src/Cardano/Wallet/Balance/Migration/Selection.hs b/lib/wallet/src/Cardano/Wallet/Balance/Migration/Selection.hs index 0b93ad936a6..8f4876dc085 100644 --- a/lib/wallet/src/Cardano/Wallet/Balance/Migration/Selection.hs +++ b/lib/wallet/src/Cardano/Wallet/Balance/Migration/Selection.hs @@ -57,13 +57,17 @@ module Cardano.Wallet.Balance.Migration.Selection import Prelude import Cardano.Wallet.Primitive.Types.Address.Constants - ( maxLengthAddress ) + ( maxLengthAddress + ) import Cardano.Wallet.Primitive.Types.Coin - ( Coin (..) ) + ( Coin (..) + ) import Cardano.Wallet.Primitive.Types.TokenBundle - ( TokenBundle (..) ) + ( TokenBundle (..) + ) import Cardano.Wallet.Primitive.Types.TokenMap - ( TokenMap ) + ( TokenMap + ) import Cardano.Wallet.Primitive.Types.Tx.Constraints ( TxConstraints (..) , TxSize @@ -73,23 +77,33 @@ import Cardano.Wallet.Primitive.Types.Tx.Constraints , txOutputHasValidTokenQuantities ) import Control.DeepSeq - ( NFData ) + ( NFData + ) import Control.Monad - ( (>=>) ) + ( (>=>) + ) import Data.Bifunctor - ( first ) + ( first + ) import Data.Either.Extra - ( eitherToMaybe, maybeToEither ) + ( eitherToMaybe + , maybeToEither + ) import Data.Generics.Internal.VL.Lens - ( view ) + ( view + ) import Data.Generics.Labels () import Data.List.NonEmpty - ( NonEmpty (..) ) + ( NonEmpty (..) + ) import Data.Maybe - ( catMaybes, listToMaybe ) + ( catMaybes + , listToMaybe + ) import GHC.Generics - ( Generic ) + ( Generic + ) import qualified Cardano.Wallet.Primitive.Types.Coin as Coin import qualified Cardano.Wallet.Primitive.Types.TokenBundle as TokenBundle diff --git a/lib/wallet/src/Cardano/Wallet/Byron/Compatibility.hs b/lib/wallet/src/Cardano/Wallet/Byron/Compatibility.hs index d416be6206a..a855b96c757 100644 --- a/lib/wallet/src/Cardano/Wallet/Byron/Compatibility.hs +++ b/lib/wallet/src/Cardano/Wallet/Byron/Compatibility.hs @@ -42,7 +42,9 @@ module Cardano.Wallet.Byron.Compatibility import Prelude import Cardano.Chain.Block - ( ABlockOrBoundary (..), blockTxPayload ) + ( ABlockOrBoundary (..) + , blockTxPayload + ) import Cardano.Chain.Common ( BlockCount (..) , Lovelace @@ -51,45 +53,73 @@ import Cardano.Chain.Common , unsafeGetLovelace ) import Cardano.Chain.Genesis - ( GenesisData (..), GenesisHash (..), GenesisNonAvvmBalances (..) ) + ( GenesisData (..) + , GenesisHash (..) + , GenesisNonAvvmBalances (..) + ) import Cardano.Chain.Slotting - ( EpochSlots (..) ) + ( EpochSlots (..) + ) import Cardano.Chain.Update - ( ProtocolParameters (..) ) + ( ProtocolParameters (..) + ) import Cardano.Chain.UTxO - ( TxOut (..), unTxPayload ) + ( TxOut (..) + , unTxPayload + ) import Cardano.Crypto.ProtocolMagic - ( ProtocolMagicId, unProtocolMagicId ) + ( ProtocolMagicId + , unProtocolMagicId + ) import Cardano.Wallet.Read.Primitive.Tx.Byron - ( fromTxAux ) + ( fromTxAux + ) import Cardano.Wallet.Read.Primitive.Tx.Features.Inputs - ( fromByronTxIn ) + ( fromByronTxIn + ) import Cardano.Wallet.Read.Primitive.Tx.Features.Outputs - ( fromByronTxOut ) + ( fromByronTxOut + ) import Cardano.Wallet.Unsafe - ( unsafeFromHex ) + ( unsafeFromHex + ) import Crypto.Hash.Extra - ( blake2b256 ) + ( blake2b256 + ) import Data.Coerce - ( coerce ) + ( coerce + ) import Data.Quantity - ( Quantity (..) ) + ( Quantity (..) + ) import Data.Time.Clock.POSIX - ( posixSecondsToUTCTime ) + ( posixSecondsToUTCTime + ) import Data.Word - ( Word16, Word32 ) + ( Word16 + , Word32 + ) import Numeric.Natural - ( Natural ) + ( Natural + ) import Ouroboros.Consensus.Block.Abstract - ( headerPrevHash ) + ( headerPrevHash + ) import Ouroboros.Consensus.Byron.Ledger - ( ByronBlock (..), ByronHash (..) ) + ( ByronBlock (..) + , ByronHash (..) + ) import Ouroboros.Consensus.Byron.Ledger.Config - ( CodecConfig (..) ) + ( CodecConfig (..) + ) import Ouroboros.Consensus.HardFork.History.Summary - ( Bound (..) ) + ( Bound (..) + ) import Ouroboros.Network.Block - ( BlockNo (..), ChainHash, SlotNo (..) ) + ( BlockNo (..) + , ChainHash + , SlotNo (..) + ) import qualified Cardano.Chain.Update as Update import qualified Cardano.Chain.Update.Validation.Interface as Update @@ -102,7 +132,8 @@ import qualified Cardano.Wallet.Primitive.Types.ProtocolMagic as W import qualified Cardano.Wallet.Primitive.Types.Tx as W import qualified Cardano.Wallet.Primitive.Types.Tx.Constraints as W import qualified Cardano.Wallet.Primitive.Types.Tx.TxOut as W - ( TxOut (TxOut) ) + ( TxOut (TxOut) + ) import qualified Data.Map.Strict as Map import qualified Internal.Cardano.Write.Tx as Write import qualified Ouroboros.Consensus.Block as O diff --git a/lib/wallet/src/Cardano/Wallet/CLI.hs b/lib/wallet/src/Cardano/Wallet/CLI.hs index 725ee711107..e292e85de69 100644 --- a/lib/wallet/src/Cardano/Wallet/CLI.hs +++ b/lib/wallet/src/Cardano/Wallet/CLI.hs @@ -11,11 +11,15 @@ import "optparse-applicative" Options.Applicative import Prelude import Cardano.Wallet.Network.Config - ( NetworkConfiguration (..) ) + ( NetworkConfiguration (..) + ) import Data.Bifunctor - ( first ) + ( first + ) import Data.Text.Class - ( FromText (..), TextDecodingError (getTextDecodingError) ) + ( FromText (..) + , TextDecodingError (getTextDecodingError) + ) import qualified Data.Text as T diff --git a/lib/wallet/src/Cardano/Wallet/Checkpoints.hs b/lib/wallet/src/Cardano/Wallet/Checkpoints.hs index 1fe7fd6e05b..5db591dc83e 100644 --- a/lib/wallet/src/Cardano/Wallet/Checkpoints.hs +++ b/lib/wallet/src/Cardano/Wallet/Checkpoints.hs @@ -39,21 +39,32 @@ module Cardano.Wallet.Checkpoints import Prelude import Data.Delta - ( Delta (..) ) + ( Delta (..) + ) import Data.Generics.Internal.VL.Lens - ( over, view ) + ( over + , view + ) import Data.Map.Strict - ( Map ) + ( Map + ) import Data.Maybe - ( fromMaybe ) + ( fromMaybe + ) import Data.Quantity - ( Quantity (..) ) + ( Quantity (..) + ) import Data.Word - ( Word32, Word8 ) + ( Word32 + , Word8 + ) import Fmt - ( Buildable (..), listF ) + ( Buildable (..) + , listF + ) import GHC.Generics - ( Generic ) + ( Generic + ) import qualified Cardano.Wallet.Primitive.Types as W import qualified Data.List as L diff --git a/lib/wallet/src/Cardano/Wallet/Checkpoints/Policy.hs b/lib/wallet/src/Cardano/Wallet/Checkpoints/Policy.hs index c3a658e31ce..91717ebbe26 100644 --- a/lib/wallet/src/Cardano/Wallet/Checkpoints/Policy.hs +++ b/lib/wallet/src/Cardano/Wallet/Checkpoints/Policy.hs @@ -26,7 +26,8 @@ module Cardano.Wallet.Checkpoints.Policy import Prelude import Data.List - ( unfoldr ) + ( unfoldr + ) {------------------------------------------------------------------------------- CheckpointPolicy, abstract data type diff --git a/lib/wallet/src/Cardano/Wallet/Compat.hs b/lib/wallet/src/Cardano/Wallet/Compat.hs index ef8e160f911..7ecf8fddf2c 100644 --- a/lib/wallet/src/Cardano/Wallet/Compat.hs +++ b/lib/wallet/src/Cardano/Wallet/Compat.hs @@ -11,11 +11,14 @@ module Cardano.Wallet.Compat import Prelude import Control.Applicative - ( Const (..) ) + ( Const (..) + ) import Data.Monoid - ( First (..) ) + ( First (..) + ) import Data.Profunctor.Unsafe - ( ( #. ) ) + ( ( #. ) + ) infixl 8 ^? (^?) :: s -> ((a -> Const (First a) a) -> s -> Const (First a) s) -> Maybe a diff --git a/lib/wallet/src/Cardano/Wallet/DB.hs b/lib/wallet/src/Cardano/Wallet/DB.hs index fb96473d55a..a1993c64bd5 100644 --- a/lib/wallet/src/Cardano/Wallet/DB.hs +++ b/lib/wallet/src/Cardano/Wallet/DB.hs @@ -39,23 +39,39 @@ import Prelude import Cardano.Wallet.DB.Errors import Cardano.Wallet.DB.Store.Submissions.Layer - ( getInSubmissionTransaction, getInSubmissionTransactions ) + ( getInSubmissionTransaction + , getInSubmissionTransactions + ) import Cardano.Wallet.DB.Store.Submissions.Operations - ( SubmissionMeta (..), TxSubmissions, TxSubmissionsStatus ) + ( SubmissionMeta (..) + , TxSubmissions + , TxSubmissionsStatus + ) import Cardano.Wallet.DB.Store.Transactions.Decoration - ( TxInDecorator ) + ( TxInDecorator + ) import Cardano.Wallet.DB.Store.Transactions.TransactionInfo - ( mkTransactionInfoFromReadTx ) + ( mkTransactionInfoFromReadTx + ) import Cardano.Wallet.DB.Store.Wallets.Layer - ( QueryTxWalletsHistory ) + ( QueryTxWalletsHistory + ) import Cardano.Wallet.DB.Store.Wallets.Model - ( DeltaTxWalletsHistory ) + ( DeltaTxWalletsHistory + ) import Cardano.Wallet.DB.WalletState - ( DeltaWalletState, WalletState (submissions), updateSubmissions ) + ( DeltaWalletState + , WalletState (submissions) + , updateSubmissions + ) import Cardano.Wallet.Primitive.Model - ( Wallet, currentTip ) + ( Wallet + , currentTip + ) import Cardano.Wallet.Primitive.Slotting - ( TimeInterpreter, hoistTimeInterpreter ) + ( TimeInterpreter + , hoistTimeInterpreter + ) import Cardano.Wallet.Primitive.Types ( BlockHeader , ChainPoint @@ -68,49 +84,78 @@ import Cardano.Wallet.Primitive.Types , WalletMetadata (..) ) import Cardano.Wallet.Primitive.Types.Address - ( Address ) + ( Address + ) import Cardano.Wallet.Primitive.Types.Coin - ( Coin ) + ( Coin + ) import Cardano.Wallet.Primitive.Types.Hash - ( Hash ) + ( Hash + ) import Cardano.Wallet.Primitive.Types.Tx - ( SealedTx, Tx (..) ) + ( SealedTx + , Tx (..) + ) import Cardano.Wallet.Primitive.Types.Tx.TransactionInfo - ( TransactionInfo (..) ) + ( TransactionInfo (..) + ) import Cardano.Wallet.Primitive.Types.Tx.TxMeta - ( TxMeta (..), TxStatus ) + ( TxMeta (..) + , TxStatus + ) import Cardano.Wallet.Primitive.Types.Tx.TxOut - ( TxOut (..) ) + ( TxOut (..) + ) import Cardano.Wallet.Read.Eras - ( EraValue ) + ( EraValue + ) import Cardano.Wallet.Read.Primitive.Tx.Sealed - ( fromSealedTx ) + ( fromSealedTx + ) import Cardano.Wallet.Submissions.Submissions - ( TxStatusMeta (..), txStatus ) + ( TxStatusMeta (..) + , txStatus + ) import Cardano.Wallet.Submissions.TxStatus - ( _Expired, _InSubmission ) + ( _Expired + , _InSubmission + ) import Control.Lens - ( has ) + ( has + ) import Control.Monad - ( join ) + ( join + ) import Control.Monad.IO.Class - ( MonadIO, liftIO ) + ( MonadIO + , liftIO + ) import Control.Monad.Trans.Except - ( ExceptT (..), mapExceptT ) + ( ExceptT (..) + , mapExceptT + ) import Data.DBVar - ( DBVar, readDBVar ) + ( DBVar + , readDBVar + ) import Data.List - ( sortOn ) + ( sortOn + ) import Data.Maybe - ( catMaybes ) + ( catMaybes + ) import Data.Ord - ( Down (..) ) + ( Down (..) + ) import Data.Store - ( Store (..) ) + ( Store (..) + ) import Data.Traversable - ( for ) + ( for + ) import GHC.Num - ( Natural ) + ( Natural + ) import qualified Cardano.Wallet.DB.Store.Submissions.Layer as Sbms import qualified Cardano.Wallet.Primitive.Types.Tx.SealedTx as WST diff --git a/lib/wallet/src/Cardano/Wallet/DB/Errors.hs b/lib/wallet/src/Cardano/Wallet/DB/Errors.hs index 768bff32316..bfd702c615d 100644 --- a/lib/wallet/src/Cardano/Wallet/DB/Errors.hs +++ b/lib/wallet/src/Cardano/Wallet/DB/Errors.hs @@ -5,11 +5,15 @@ module Cardano.Wallet.DB.Errors where import Prelude import Cardano.Wallet.Primitive.Types - ( BlockHeader (..), WalletId (..) ) + ( BlockHeader (..) + , WalletId (..) + ) import Cardano.Wallet.Primitive.Types.Hash - ( Hash ) + ( Hash + ) import Control.Exception - ( Exception ) + ( Exception + ) -- | Can't read the database file because it's in a bad format -- (corrupted, too old, …) diff --git a/lib/wallet/src/Cardano/Wallet/DB/Layer.hs b/lib/wallet/src/Cardano/Wallet/DB/Layer.hs index e14bc6970a1..877dc5a0247 100644 --- a/lib/wallet/src/Cardano/Wallet/DB/Layer.hs +++ b/lib/wallet/src/Cardano/Wallet/DB/Layer.hs @@ -42,9 +42,12 @@ module Cardano.Wallet.DB.Layer import Prelude import Cardano.BM.Data.Severity - ( Severity (..) ) + ( Severity (..) + ) import Cardano.BM.Data.Tracer - ( HasPrivacyAnnotation (..), HasSeverityAnnotation (..) ) + ( HasPrivacyAnnotation (..) + , HasSeverityAnnotation (..) + ) import Cardano.DB.Sqlite ( DBLog (..) , ForeignKeysSetting (ForeignKeysEnabled) @@ -61,11 +64,14 @@ import Cardano.DB.Sqlite.Delete , withRef ) import Cardano.Slotting.Slot - ( WithOrigin (..) ) + ( WithOrigin (..) + ) import Cardano.Wallet.Address.Keys.WalletKey - ( keyTypeDescriptor ) + ( keyTypeDescriptor + ) import Cardano.Wallet.Checkpoints - ( DeltaCheckpoints (..) ) + ( DeltaCheckpoints (..) + ) import Cardano.Wallet.DB ( DBCheckpoints (..) , DBFactory (..) @@ -82,9 +88,12 @@ import Cardano.Wallet.DB , transactionsStore ) import Cardano.Wallet.DB.Sqlite.Migration.New - ( runNewStyleMigrations ) + ( runNewStyleMigrations + ) import Cardano.Wallet.DB.Sqlite.Migration.Old - ( DefaultFieldValues (..), migrateManually ) + ( DefaultFieldValues (..) + , migrateManually + ) import Cardano.Wallet.DB.Sqlite.Schema ( CBOR (..) , EntityField (..) @@ -95,35 +104,49 @@ import Cardano.Wallet.DB.Sqlite.Schema , unWalletKey ) import Cardano.Wallet.DB.Sqlite.Types - ( BlockId (..), TxId (..) ) + ( BlockId (..) + , TxId (..) + ) import Cardano.Wallet.DB.Store.Checkpoints.Store - ( PersistAddressBook (..), blockHeaderFromEntity ) + ( PersistAddressBook (..) + , blockHeaderFromEntity + ) import Cardano.Wallet.DB.Store.Info.Store - ( WalletInfo (..) ) + ( WalletInfo (..) + ) import Cardano.Wallet.DB.Store.Meta.Model - ( mkTxMetaFromEntity ) + ( mkTxMetaFromEntity + ) import Cardano.Wallet.DB.Store.Submissions.Layer - ( rollBackSubmissions ) + ( rollBackSubmissions + ) import Cardano.Wallet.DB.Store.Submissions.Operations - ( submissionMetaFromTxMeta ) + ( submissionMetaFromTxMeta + ) import Cardano.Wallet.DB.Store.Transactions.Decoration ( TxInDecorator , decorateTxInsForReadTxFromLookupTxOut , decorateTxInsForRelationFromLookupTxOut ) import Cardano.Wallet.DB.Store.Transactions.Model - ( TxRelation (..), txCBORPrism ) + ( TxRelation (..) + , txCBORPrism + ) import Cardano.Wallet.DB.Store.Transactions.TransactionInfo - ( mkTransactionInfoFromReadTx, mkTransactionInfoFromRelation ) + ( mkTransactionInfoFromReadTx + , mkTransactionInfoFromRelation + ) import Cardano.Wallet.DB.Store.Wallets.Layer ( QueryStoreTxWalletsHistory , QueryTxWalletsHistory (..) , newQueryStoreTxWalletsHistory ) import Cardano.Wallet.DB.Store.Wallets.Model - ( DeltaTxWalletsHistory (..) ) + ( DeltaTxWalletsHistory (..) + ) import Cardano.Wallet.DB.Store.WalletState.Store - ( mkStoreWallet ) + ( mkStoreWallet + ) import Cardano.Wallet.DB.WalletState ( DeltaWalletState , DeltaWalletState1 (..) @@ -132,45 +155,80 @@ import Cardano.Wallet.DB.WalletState , getLatest ) import Cardano.Wallet.Flavor - ( KeyFlavorS, WalletFlavorS, keyOfWallet ) + ( KeyFlavorS + , WalletFlavorS + , keyOfWallet + ) import Cardano.Wallet.Primitive.Slotting - ( TimeInterpreter, hoistTimeInterpreter ) + ( TimeInterpreter + , hoistTimeInterpreter + ) import Cardano.Wallet.Read.Eras.EraValue - ( EraValue ) + ( EraValue + ) import Cardano.Wallet.Read.Tx.CBOR - ( parseTxFromCBOR ) + ( parseTxFromCBOR + ) import Control.DeepSeq - ( force ) + ( force + ) import Control.Exception - ( evaluate, throw ) + ( evaluate + , throw + ) import Control.Monad - ( forM, unless, when ) + ( forM + , unless + , when + ) import Control.Monad.IO.Class - ( MonadIO (..) ) + ( MonadIO (..) + ) import Control.Monad.Trans - ( lift ) + ( lift + ) import Control.Monad.Trans.Except - ( mapExceptT, throwE ) + ( mapExceptT + , throwE + ) import Control.Tracer - ( Tracer, contramap, traceWith ) + ( Tracer + , contramap + , traceWith + ) import Data.Bifunctor - ( second ) + ( second + ) import Data.Coerce - ( coerce ) + ( coerce + ) import Data.DBVar - ( DBVar, initDBVar, loadDBVar, readDBVar ) + ( DBVar + , initDBVar + , loadDBVar + , readDBVar + ) import Data.Generics.Internal.VL.Lens - ( (^.) ) + ( (^.) + ) import Data.Maybe - ( catMaybes, fromMaybe ) + ( catMaybes + , fromMaybe + ) import Data.Store - ( Store (..), UpdateStore ) + ( Store (..) + , UpdateStore + ) import Data.Text - ( Text ) + ( Text + ) import Data.Text.Class - ( ToText (..), fromText ) + ( ToText (..) + , fromText + ) import Data.Word - ( Word32 ) + ( Word32 + ) import Database.Persist.Sql ( Entity (..) , SelectOpt (..) @@ -180,19 +238,34 @@ import Database.Persist.Sql , (==.) ) import Database.Persist.Sqlite - ( SqlPersistT ) + ( SqlPersistT + ) import Fmt - ( pretty, (+|), (|+) ) + ( pretty + , (+|) + , (|+) + ) import GHC.Generics - ( Generic ) + ( Generic + ) import System.Directory - ( doesFileExist, listDirectory ) + ( doesFileExist + , listDirectory + ) import System.FilePath - ( () ) + ( () + ) import UnliftIO.Exception - ( Exception, bracket, throwIO ) + ( Exception + , bracket + , throwIO + ) import UnliftIO.MVar - ( modifyMVar, modifyMVar_, newMVar, readMVar ) + ( modifyMVar + , modifyMVar_ + , newMVar + , readMVar + ) import qualified Cardano.Wallet.Delegation.Model as Dlgs import qualified Cardano.Wallet.Primitive.Model as W diff --git a/lib/wallet/src/Cardano/Wallet/DB/Migration.hs b/lib/wallet/src/Cardano/Wallet/DB/Migration.hs index 3bbea7a5114..b744823958c 100644 --- a/lib/wallet/src/Cardano/Wallet/DB/Migration.hs +++ b/lib/wallet/src/Cardano/Wallet/DB/Migration.hs @@ -30,26 +30,39 @@ module Cardano.Wallet.DB.Migration ) where import Prelude hiding - ( (.) ) + ( (.) + ) import Control.Category - ( Category (..) ) + ( Category (..) + ) import Control.Exception - ( Exception ) + ( Exception + ) import Control.Monad - ( forM_ ) + ( forM_ + ) import Control.Monad.Class.MonadThrow - ( MonadThrow (throwIO) ) + ( MonadThrow (throwIO) + ) import Control.Monad.Reader - ( ReaderT (runReaderT) ) + ( ReaderT (runReaderT) + ) import Data.Proxy - ( Proxy (..) ) + ( Proxy (..) + ) import Fmt - ( Buildable (..) ) + ( Buildable (..) + ) import GHC.Natural - ( Natural ) + ( Natural + ) import GHC.TypeNats - ( type (+), KnownNat, Nat, natVal ) + ( type (+) + , KnownNat + , Nat + , natVal + ) -------------------------------------------------------------------------------- ------- public ---------------------------------------------------------------- diff --git a/lib/wallet/src/Cardano/Wallet/DB/Pure/Implementation.hs b/lib/wallet/src/Cardano/Wallet/DB/Pure/Implementation.hs index dcb8671cce5..5226ba5a482 100644 --- a/lib/wallet/src/Cardano/Wallet/DB/Pure/Implementation.hs +++ b/lib/wallet/src/Cardano/Wallet/DB/Pure/Implementation.hs @@ -68,13 +68,20 @@ module Cardano.Wallet.DB.Pure.Implementation import Prelude import Cardano.Pool.Types - ( PoolId ) + ( PoolId + ) import Cardano.Wallet.DB - ( DBLayerParams (..) ) + ( DBLayerParams (..) + ) import Cardano.Wallet.Primitive.Model - ( Wallet, currentTip ) + ( Wallet + , currentTip + ) import Cardano.Wallet.Primitive.Slotting - ( TimeInterpreter, interpretQuery, slotToUTCTime ) + ( TimeInterpreter + , interpretQuery + , slotToUTCTime + ) import Cardano.Wallet.Primitive.Types ( BlockHeader (blockHeight, slotNo) , ChainPoint @@ -92,45 +99,68 @@ import Cardano.Wallet.Primitive.Types , toSlot ) import Cardano.Wallet.Primitive.Types.Address - ( Address ) + ( Address + ) import Cardano.Wallet.Primitive.Types.Coin - ( Coin (..) ) + ( Coin (..) + ) import Cardano.Wallet.Primitive.Types.Hash - ( Hash (..) ) + ( Hash (..) + ) import Cardano.Wallet.Primitive.Types.Tx - ( SealedTx (..), Tx (..) ) + ( SealedTx (..) + , Tx (..) + ) import Cardano.Wallet.Primitive.Types.Tx.TransactionInfo - ( TransactionInfo (..) ) + ( TransactionInfo (..) + ) import Cardano.Wallet.Primitive.Types.Tx.TxMeta ( TxMeta (TxMeta, blockHeight, expiry, slotNo, status) , TxStatus (Expired, Pending) ) import Cardano.Wallet.Primitive.Types.Tx.TxOut - ( TxOut (..) ) + ( TxOut (..) + ) import Control.DeepSeq - ( NFData ) + ( NFData + ) import Control.Monad - ( join ) + ( join + ) import Data.Bifunctor - ( first ) + ( first + ) import Data.Functor.Identity - ( Identity (..) ) + ( Identity (..) + ) import Data.Generics.Internal.VL.Lens - ( view, (^.) ) + ( view + , (^.) + ) import Data.List - ( sort, sortOn ) + ( sort + , sortOn + ) import Data.Map.Strict - ( Map ) + ( Map + ) import Data.Maybe - ( catMaybes, fromMaybe, mapMaybe ) + ( catMaybes + , fromMaybe + , mapMaybe + ) import Data.Ord - ( Down (..) ) + ( Down (..) + ) import Data.Quantity - ( Quantity (..) ) + ( Quantity (..) + ) import Data.Word - ( Word32 ) + ( Word32 + ) import GHC.Generics - ( Generic ) + ( Generic + ) import qualified Data.Map.Strict as Map diff --git a/lib/wallet/src/Cardano/Wallet/DB/Pure/Layer.hs b/lib/wallet/src/Cardano/Wallet/DB/Pure/Layer.hs index f0e979987df..5d5993dccff 100644 --- a/lib/wallet/src/Cardano/Wallet/DB/Pure/Layer.hs +++ b/lib/wallet/src/Cardano/Wallet/DB/Pure/Layer.hs @@ -36,25 +36,46 @@ import Cardano.Wallet.DB.Pure.Implementation , mRollbackTo ) import Cardano.Wallet.Primitive.Slotting - ( TimeInterpreter ) + ( TimeInterpreter + ) import Cardano.Wallet.Primitive.Types - ( SortOrder (..), WalletId, wholeRange ) + ( SortOrder (..) + , WalletId + , wholeRange + ) import Cardano.Wallet.Primitive.Types.Tx.TransactionInfo - ( TransactionInfo (..) ) + ( TransactionInfo (..) + ) import Control.Monad - ( join, unless ) + ( join + , unless + ) import Control.Monad.IO.Unlift - ( MonadIO (..), MonadUnliftIO (..) ) + ( MonadIO (..) + , MonadUnliftIO (..) + ) import Control.Monad.Trans.Except - ( throwE ) + ( throwE + ) import Data.Functor.Identity - ( Identity (..) ) + ( Identity (..) + ) import Data.Maybe - ( fromMaybe ) + ( fromMaybe + ) import UnliftIO.Exception - ( Exception, throwIO ) + ( Exception + , throwIO + ) import UnliftIO.MVar - ( MVar, isEmptyMVar, modifyMVar, newEmptyMVar, newMVar, putMVar, withMVar ) + ( MVar + , isEmptyMVar + , modifyMVar + , newEmptyMVar + , newMVar + , putMVar + , withMVar + ) -- | Instantiate a new in-memory "database" layer that simply stores data in -- a local MVar. Data vanishes if the software is shut down. diff --git a/lib/wallet/src/Cardano/Wallet/DB/Sqlite/Migration/New.hs b/lib/wallet/src/Cardano/Wallet/DB/Sqlite/Migration/New.hs index e16ec73092d..eebb22360c2 100644 --- a/lib/wallet/src/Cardano/Wallet/DB/Sqlite/Migration/New.hs +++ b/lib/wallet/src/Cardano/Wallet/DB/Sqlite/Migration/New.hs @@ -5,10 +5,16 @@ module Cardano.Wallet.DB.Sqlite.Migration.New ) where import Prelude hiding - ( id, (.) ) + ( id + , (.) + ) import Cardano.DB.Sqlite - ( DBHandle (..), DBLog, ReadDBHandle, withDBHandle ) + ( DBHandle (..) + , DBLog + , ReadDBHandle + , withDBHandle + ) import Cardano.Wallet.DB.Migration ( Migration , MigrationInterface (..) @@ -17,21 +23,31 @@ import Cardano.Wallet.DB.Migration , runMigrations ) import Cardano.Wallet.DB.Sqlite.Migration.Old - ( getSchemaVersion, putSchemaVersion ) + ( getSchemaVersion + , putSchemaVersion + ) import Cardano.Wallet.DB.Store.Delegations.Migration - ( migrateDelegations ) + ( migrateDelegations + ) import Control.Category - ( Category (id), (.) ) + ( Category (id) + , (.) + ) import Control.Monad.Reader - ( withReaderT ) + ( withReaderT + ) import Control.Tracer - ( Tracer ) + ( Tracer + ) import Database.Persist.Sqlite - ( SqlPersistT ) + ( SqlPersistT + ) import Database.Sqlite - ( Connection ) + ( Connection + ) import System.Directory - ( copyFile ) + ( copyFile + ) import qualified Cardano.Wallet.DB.Sqlite.Migration.Old as Old diff --git a/lib/wallet/src/Cardano/Wallet/DB/Sqlite/Migration/Old.hs b/lib/wallet/src/Cardano/Wallet/DB/Sqlite/Migration/Old.hs index d0c8d69dbe0..0eeeb3253ec 100644 --- a/lib/wallet/src/Cardano/Wallet/DB/Sqlite/Migration/Old.hs +++ b/lib/wallet/src/Cardano/Wallet/DB/Sqlite/Migration/Old.hs @@ -43,41 +43,68 @@ import Cardano.DB.Sqlite , tableName ) import Cardano.Wallet.DB.Sqlite.Schema - ( EntityField (..) ) + ( EntityField (..) + ) import Cardano.Wallet.Flavor - ( KeyFlavorS (..) ) + ( KeyFlavorS (..) + ) import Cardano.Wallet.Primitive.Passphrase.Types - ( PassphraseScheme (..) ) + ( PassphraseScheme (..) + ) import Control.Monad - ( forM_, guard, void, when ) + ( forM_ + , guard + , void + , when + ) import Control.Monad.Trans - ( lift ) + ( lift + ) import Control.Tracer - ( Tracer, traceWith ) + ( Tracer + , traceWith + ) import Data.Foldable - ( for_ ) + ( for_ + ) import Data.Functor - ( (<&>) ) + ( (<&>) + ) import Data.Maybe - ( mapMaybe ) + ( mapMaybe + ) import Data.String.Interpolate - ( i ) + ( i + ) import Data.Text - ( Text ) + ( Text + ) import Data.Text.Class - ( ToText (..), fromText ) + ( ToText (..) + , fromText + ) import Data.Word - ( Word16 ) + ( Word16 + ) import Database.Persist.Class - ( toPersistValue ) + ( toPersistValue + ) import Database.Persist.Types - ( PersistValue (..), fromPersistValueText ) + ( PersistValue (..) + , fromPersistValueText + ) import List.Transformer - ( runListT, select ) + ( runListT + , select + ) import Numeric.Natural - ( Natural ) + ( Natural + ) import UnliftIO.Exception - ( Exception, throwIO, throwString ) + ( Exception + , throwIO + , throwString + ) import qualified Cardano.Wallet.Address.Derivation as W import qualified Cardano.Wallet.Address.Discovery.Sequential as Seq diff --git a/lib/wallet/src/Cardano/Wallet/DB/Sqlite/Schema.hs b/lib/wallet/src/Cardano/Wallet/DB/Sqlite/Schema.hs index 450f92d7b4e..36186044a80 100644 --- a/lib/wallet/src/Cardano/Wallet/DB/Sqlite/Schema.hs +++ b/lib/wallet/src/Cardano/Wallet/DB/Sqlite/Schema.hs @@ -29,11 +29,15 @@ module Cardano.Wallet.DB.Sqlite.Schema where import Prelude import Cardano.Address.Script - ( Cosigner, Script ) + ( Cosigner + , Script + ) import Cardano.Slotting.Slot - ( SlotNo ) + ( SlotNo + ) import Cardano.Wallet.Address.Discovery.Shared - ( CredentialType ) + ( CredentialType + ) import Cardano.Wallet.DB.Sqlite.Types ( BlockHeight , BlockId @@ -43,23 +47,39 @@ import Cardano.Wallet.DB.Sqlite.Types , sqlSettings' ) import Cardano.Wallet.DB.Store.UTxOHistory.Model - ( Pruned, Spent ) + ( Pruned + , Spent + ) import Cardano.Wallet.Primitive.Types - ( Slot ) + ( Slot + ) import Data.Quantity - ( Percentage (..) ) + ( Percentage (..) + ) import Data.Text - ( Text ) + ( Text + ) import Data.Time.Clock - ( UTCTime ) + ( UTCTime + ) import Data.Word - ( Word16, Word32, Word64, Word8 ) + ( Word16 + , Word32 + , Word64 + , Word8 + ) import Database.Persist.TH - ( mkMigrate, mkPersist, persistLowerCase, share ) + ( mkMigrate + , mkPersist + , persistLowerCase + , share + ) import GHC.Generics - ( Generic (..) ) + ( Generic (..) + ) import System.Random - ( StdGen ) + ( StdGen + ) import qualified Cardano.Wallet.Address.Derivation as W import qualified Cardano.Wallet.Address.Discovery.Sequential as W diff --git a/lib/wallet/src/Cardano/Wallet/DB/Sqlite/Types.hs b/lib/wallet/src/Cardano/Wallet/DB/Sqlite/Types.hs index 8b57d36d609..90fea06858a 100644 --- a/lib/wallet/src/Cardano/Wallet/DB/Sqlite/Types.hs +++ b/lib/wallet/src/Cardano/Wallet/DB/Sqlite/Types.hs @@ -25,7 +25,10 @@ module Cardano.Wallet.DB.Sqlite.Types where import Prelude import Cardano.Address.Script - ( Cosigner, Script, ScriptHash (..) ) + ( Cosigner + , Script + , ScriptHash (..) + ) import Cardano.Api ( TxMetadataJsonSchema (..) , displayError @@ -33,11 +36,14 @@ import Cardano.Api , metadataToJson ) import Cardano.Pool.Types - ( PoolId ) + ( PoolId + ) import Cardano.Slotting.Slot - ( SlotNo (..) ) + ( SlotNo (..) + ) import Cardano.Wallet.Address.Derivation - ( Role (..) ) + ( Role (..) + ) import Cardano.Wallet.Address.Discovery.Sequential ( AddressPoolGap (..) , DerivationPrefix @@ -45,11 +51,16 @@ import Cardano.Wallet.Address.Discovery.Sequential , mkAddressPoolGap ) import Cardano.Wallet.Address.Discovery.Shared - ( CredentialType ) + ( CredentialType + ) import Cardano.Wallet.DB.Store.UTxOHistory.Model - ( Pruned (..), Spent (..) ) + ( Pruned (..) + , Spent (..) + ) import Cardano.Wallet.Primitive.Passphrase.Types - ( Passphrase (..), PassphraseScheme (..) ) + ( Passphrase (..) + , PassphraseScheme (..) + ) import Cardano.Wallet.Primitive.Types ( EpochNo (..) , FeePolicy @@ -62,49 +73,85 @@ import Cardano.Wallet.Primitive.Types , unsafeToPMS ) import Cardano.Wallet.Primitive.Types.Address - ( Address (..), AddressState (..) ) + ( Address (..) + , AddressState (..) + ) import Cardano.Wallet.Primitive.Types.Coin - ( Coin (..) ) + ( Coin (..) + ) import Cardano.Wallet.Primitive.Types.Hash - ( Hash (..) ) + ( Hash (..) + ) import Cardano.Wallet.Primitive.Types.RewardAccount - ( RewardAccount (..) ) + ( RewardAccount (..) + ) import Cardano.Wallet.Primitive.Types.TokenPolicy - ( TokenName, TokenPolicyId ) + ( TokenName + , TokenPolicyId + ) import Cardano.Wallet.Primitive.Types.TokenQuantity - ( TokenQuantity (..) ) + ( TokenQuantity (..) + ) import Cardano.Wallet.Primitive.Types.Tx.SealedTx - ( SealedTx (..), persistSealedTx, unPersistSealedTx ) + ( SealedTx (..) + , persistSealedTx + , unPersistSealedTx + ) import Cardano.Wallet.Primitive.Types.Tx.Tx - ( TxMetadata, TxScriptValidity (..) ) + ( TxMetadata + , TxScriptValidity (..) + ) import Cardano.Wallet.Primitive.Types.Tx.TxMeta - ( Direction (..), TxStatus (..) ) + ( Direction (..) + , TxStatus (..) + ) import Control.Arrow - ( left ) + ( left + ) import Control.Lens - ( (&) ) + ( (&) + ) import Control.Monad - ( (<=<), (>=>) ) + ( (<=<) + , (>=>) + ) import Control.Monad.Fail.Extended - ( ReportFailure (..) ) + ( ReportFailure (..) + ) import Data.Aeson - ( FromJSON (..), ToJSON (..), Value (..) ) + ( FromJSON (..) + , ToJSON (..) + , Value (..) + ) import Data.Aeson.Extra - ( aesonFromText ) + ( aesonFromText + ) import Data.Bifunctor - ( bimap, first ) + ( bimap + , first + ) import Data.ByteArray.Encoding - ( Base (..), convertFromBase, convertToBase ) + ( Base (..) + , convertFromBase + , convertToBase + ) import Data.ByteString - ( ByteString ) + ( ByteString + ) import Data.Maybe - ( fromMaybe, mapMaybe ) + ( fromMaybe + , mapMaybe + ) import Data.Proxy - ( Proxy (..) ) + ( Proxy (..) + ) import Data.Quantity - ( Percentage, Quantity (..) ) + ( Percentage + , Quantity (..) + ) import Data.Text - ( Text ) + ( Text + ) import Data.Text.Class.Extended ( FromText (..) , TextDecodingError (TextDecodingError) @@ -113,37 +160,64 @@ import Data.Text.Class.Extended , fromTextMaybe ) import Data.Text.Encoding - ( decodeUtf8, encodeUtf8 ) + ( decodeUtf8 + , encodeUtf8 + ) import Data.Time.Clock.POSIX - ( POSIXTime, posixSecondsToUTCTime, utcTimeToPOSIXSeconds ) + ( POSIXTime + , posixSecondsToUTCTime + , utcTimeToPOSIXSeconds + ) import Data.Time.Format - ( defaultTimeLocale, formatTime, parseTimeM ) + ( defaultTimeLocale + , formatTime + , parseTimeM + ) import Data.Word - ( Word32, Word64 ) + ( Word32 + , Word64 + ) import Data.Word.Odd - ( Word31 ) + ( Word31 + ) import Database.Persist.PersistValue.Extended - ( fromPersistValueFromText ) + ( fromPersistValueFromText + ) import Database.Persist.Sqlite - ( PersistField (..), PersistFieldSql (..), PersistValue (..) ) + ( PersistField (..) + , PersistFieldSql (..) + , PersistValue (..) + ) import Database.Persist.TH - ( MkPersistSettings (..), sqlSettings ) + ( MkPersistSettings (..) + , sqlSettings + ) import GHC.Generics - ( Generic ) + ( Generic + ) import GHC.Int - ( Int64 ) + ( Int64 + ) import Network.URI - ( parseAbsoluteURI ) + ( parseAbsoluteURI + ) import System.Random.Internal - ( StdGen (..) ) + ( StdGen (..) + ) import System.Random.SplitMix - ( seedSMGen, unseedSMGen ) + ( seedSMGen + , unseedSMGen + ) import Text.Read - ( readMaybe ) + ( readMaybe + ) import Web.HttpApiData - ( FromHttpApiData (..), ToHttpApiData (..) ) + ( FromHttpApiData (..) + , ToHttpApiData (..) + ) import Web.PathPieces - ( PathPiece (..) ) + ( PathPiece (..) + ) import qualified Cardano.Wallet.Primitive.Types.Coin as Coin import qualified Data.Aeson as Aeson diff --git a/lib/wallet/src/Cardano/Wallet/DB/Store/Checkpoints/Store.hs b/lib/wallet/src/Cardano/Wallet/DB/Store/Checkpoints/Store.hs index 2a1e4bcb633..ef8c8cd5525 100644 --- a/lib/wallet/src/Cardano/Wallet/DB/Store/Checkpoints/Store.hs +++ b/lib/wallet/src/Cardano/Wallet/DB/Store/Checkpoints/Store.hs @@ -29,11 +29,15 @@ module Cardano.Wallet.DB.Store.Checkpoints.Store import Prelude import Cardano.Address.Derivation - ( XPub ) + ( XPub + ) import Cardano.Address.Script - ( Cosigner (..), ScriptTemplate (..) ) + ( Cosigner (..) + , ScriptTemplate (..) + ) import Cardano.DB.Sqlite - ( dbChunked ) + ( dbChunked + ) import Cardano.Wallet.Address.Book ( AddressBookIso (..) , Discoveries (..) @@ -53,21 +57,36 @@ import Cardano.Wallet.Address.Derivation , unsafePaymentKeyFingerprint ) import Cardano.Wallet.Address.Derivation.SharedKey - ( SharedKey (..) ) + ( SharedKey (..) + ) import Cardano.Wallet.Address.Discovery - ( PendingIxs, pendingIxsFromList, pendingIxsToList ) + ( PendingIxs + , pendingIxsFromList + , pendingIxsToList + ) import Cardano.Wallet.Address.Discovery.RandomAny - ( Discoveries (..), Prologue (..) ) + ( Discoveries (..) + , Prologue (..) + ) import Cardano.Wallet.Address.Discovery.SequentialAny - ( Discoveries (..), Prologue (..) ) + ( Discoveries (..) + , Prologue (..) + ) import Cardano.Wallet.Address.Discovery.Shared - ( CredentialType (..) ) + ( CredentialType (..) + ) import Cardano.Wallet.Address.Keys.WalletKey - ( getRawKey, liftRawKey ) + ( getRawKey + , liftRawKey + ) import Cardano.Wallet.Checkpoints - ( DeltaCheckpoints (..), DeltasCheckpoints, loadCheckpoints ) + ( DeltaCheckpoints (..) + , DeltasCheckpoints + , loadCheckpoints + ) import Cardano.Wallet.DB.Errors - ( ErrBadFormat (..) ) + ( ErrBadFormat (..) + ) import Cardano.Wallet.DB.Sqlite.Schema ( Checkpoint (..) , CosignerKey (..) @@ -93,43 +112,72 @@ import Cardano.Wallet.DB.Sqlite.Types , toMaybeHash ) import Cardano.Wallet.DB.WalletState - ( WalletCheckpoint (..), getSlot ) + ( WalletCheckpoint (..) + , getSlot + ) import Cardano.Wallet.Flavor - ( KeyFlavorS (..) ) + ( KeyFlavorS (..) + ) import Cardano.Wallet.Primitive.NetworkId - ( HasSNetworkId (..), NetworkDiscriminantCheck ) + ( HasSNetworkId (..) + , NetworkDiscriminantCheck + ) import Cardano.Wallet.Primitive.Types.TokenBundle - ( TokenBundle ) + ( TokenBundle + ) import Cardano.Wallet.Primitive.Types.TokenMap - ( AssetId (..) ) + ( AssetId (..) + ) import Control.Monad - ( forM, forM_, unless, void, when ) + ( forM + , forM_ + , unless + , void + , when + ) import Control.Monad.Trans.Class - ( lift ) + ( lift + ) import Control.Monad.Trans.Maybe - ( MaybeT (..) ) + ( MaybeT (..) + ) import Data.Bifunctor - ( bimap, second ) + ( bimap + , second + ) import Data.Functor - ( (<&>) ) + ( (<&>) + ) import Data.Generics.Internal.VL.Lens - ( (^.) ) + ( (^.) + ) import Data.Kind - ( Type ) + ( Type + ) import Data.Map.Strict - ( Map ) + ( Map + ) import Data.Maybe - ( fromJust, isJust, isNothing ) + ( fromJust + , isJust + , isNothing + ) import Data.Proxy - ( Proxy (..) ) + ( Proxy (..) + ) import Data.Quantity - ( Quantity (..) ) + ( Quantity (..) + ) import Data.Store - ( UpdateStore, mkUpdateStore ) + ( UpdateStore + , mkUpdateStore + ) import Data.Type.Equality - ( type (==) ) + ( type (==) + ) import Data.Typeable - ( Typeable ) + ( Typeable + ) import Database.Persist.Sql ( Entity (..) , SelectOpt (..) @@ -145,9 +193,11 @@ import Database.Persist.Sql , (>.) ) import Database.Persist.Sqlite - ( SqlPersistT ) + ( SqlPersistT + ) import UnliftIO.Exception - ( toException ) + ( toException + ) import qualified Cardano.Wallet.Address.Derivation as W import qualified Cardano.Wallet.Address.Discovery.Random as Rnd @@ -160,9 +210,11 @@ import qualified Cardano.Wallet.Primitive.Types.Address as W import qualified Cardano.Wallet.Primitive.Types.Coin as W import qualified Cardano.Wallet.Primitive.Types.TokenBundle as TokenBundle import qualified Cardano.Wallet.Primitive.Types.Tx.TxIn as W - ( TxIn (TxIn) ) + ( TxIn (TxIn) + ) import qualified Cardano.Wallet.Primitive.Types.Tx.TxOut as W - ( TxOut (TxOut) ) + ( TxOut (TxOut) + ) import qualified Cardano.Wallet.Primitive.Types.Tx.TxOut as W.TxOut import qualified Cardano.Wallet.Primitive.Types.UTxO as W import qualified Data.Map.Merge.Strict as Map diff --git a/lib/wallet/src/Cardano/Wallet/DB/Store/Delegations/Layer.hs b/lib/wallet/src/Cardano/Wallet/DB/Store/Delegations/Layer.hs index 45dcfc38b9b..e3c7f983fe5 100644 --- a/lib/wallet/src/Cardano/Wallet/DB/Store/Delegations/Layer.hs +++ b/lib/wallet/src/Cardano/Wallet/DB/Store/Delegations/Layer.hs @@ -14,13 +14,21 @@ where import Prelude import Cardano.Pool.Types - ( PoolId ) + ( PoolId + ) import Cardano.Wallet.DB.Store.Delegations.Model - ( Delegations, DeltaDelegations ) + ( Delegations + , DeltaDelegations + ) import Cardano.Wallet.Delegation.Model - ( Operation (..), Status (..) ) + ( Operation (..) + , Status (..) + ) import Cardano.Wallet.Primitive.Slotting - ( TimeInterpreter, firstSlotInEpoch, interpretQuery ) + ( TimeInterpreter + , firstSlotInEpoch + , interpretQuery + ) import Cardano.Wallet.Primitive.Types ( DelegationCertificate (..) , EpochNo @@ -30,15 +38,21 @@ import Cardano.Wallet.Primitive.Types , WalletDelegationStatus (..) ) import Data.Foldable - ( find ) + ( find + ) import Data.Function - ( (&) ) + ( (&) + ) import Data.Map.Strict - ( lookupMax ) + ( lookupMax + ) import Data.Maybe - ( catMaybes, fromMaybe ) + ( catMaybes + , fromMaybe + ) import GHC.Generics - ( Generic ) + ( Generic + ) import qualified Data.Map.Strict as Map diff --git a/lib/wallet/src/Cardano/Wallet/DB/Store/Delegations/Migration.hs b/lib/wallet/src/Cardano/Wallet/DB/Store/Delegations/Migration.hs index 4b566ab65f5..55b82605b49 100644 --- a/lib/wallet/src/Cardano/Wallet/DB/Store/Delegations/Migration.hs +++ b/lib/wallet/src/Cardano/Wallet/DB/Store/Delegations/Migration.hs @@ -9,13 +9,22 @@ module Cardano.Wallet.DB.Store.Delegations.Migration import Prelude import Cardano.DB.Sqlite - ( DBField (..), ReadDBHandle, dbBackend, dbConn ) + ( DBField (..) + , ReadDBHandle + , dbBackend + , dbConn + ) import Cardano.Pool.Types - ( PoolId ) + ( PoolId + ) import Cardano.Wallet.DB.Migration - ( Migration, mkMigration ) + ( Migration + , mkMigration + ) import Cardano.Wallet.DB.Sqlite.Migration.Old - ( SqlColumnStatus (..), isFieldPresent ) + ( SqlColumnStatus (..) + , isFieldPresent + ) import Cardano.Wallet.DB.Store.Delegations.Migration.Schema ( DelegationCertificate (..) , EntityField (..) @@ -23,23 +32,39 @@ import Cardano.Wallet.DB.Store.Delegations.Migration.Schema , WStakeKeyCertificate (..) ) import Cardano.Wallet.DB.Store.Delegations.Store - ( mkStoreDelegations ) + ( mkStoreDelegations + ) import Cardano.Wallet.Delegation.Model - ( History, Operation (Delegate, Deregister, Register) ) + ( History + , Operation (Delegate, Deregister, Register) + ) import Cardano.Wallet.Primitive.Types - ( SlotNo ) + ( SlotNo + ) import Control.Monad.Reader - ( asks, liftIO, withReaderT ) + ( asks + , liftIO + , withReaderT + ) import Data.Delta - ( Delta (Base, apply) ) + ( Delta (Base, apply) + ) import Data.Map.Strict - ( Map ) + ( Map + ) import Data.Store - ( Store (..), UpdateStore ) + ( Store (..) + , UpdateStore + ) import Data.These - ( These (..) ) + ( These (..) + ) import Database.Persist.Sql - ( Entity (Entity), SqlPersistT, rawExecute, selectList ) + ( Entity (Entity) + , SqlPersistT + , rawExecute + , selectList + ) import qualified Data.Map as Map import qualified Data.Map.Merge.Strict as Map diff --git a/lib/wallet/src/Cardano/Wallet/DB/Store/Delegations/Migration/Schema.hs b/lib/wallet/src/Cardano/Wallet/DB/Store/Delegations/Migration/Schema.hs index 01536e79c72..522951a31d2 100644 --- a/lib/wallet/src/Cardano/Wallet/DB/Store/Delegations/Migration/Schema.hs +++ b/lib/wallet/src/Cardano/Wallet/DB/Store/Delegations/Migration/Schema.hs @@ -30,37 +30,64 @@ module Cardano.Wallet.DB.Store.Delegations.Migration.Schema where import Prelude import Cardano.Pool.Types - ( PoolId ) + ( PoolId + ) import Cardano.Slotting.Slot - ( SlotNo ) + ( SlotNo + ) import Cardano.Wallet.DB.Sqlite.Types - ( sqlSettings' ) + ( sqlSettings' + ) import Crypto.Hash - ( Blake2b_160, Digest, digestFromByteString ) + ( Blake2b_160 + , Digest + , digestFromByteString + ) import Data.Aeson - ( FromJSON (parseJSON), ToJSON (toJSON), Value (String) ) + ( FromJSON (parseJSON) + , ToJSON (toJSON) + , Value (String) + ) import Data.Aeson.Extra - ( aesonFromText ) + ( aesonFromText + ) import Data.ByteArray.Encoding - ( Base (..), convertFromBase, convertToBase ) + ( Base (..) + , convertFromBase + , convertToBase + ) import Data.ByteString - ( ByteString ) + ( ByteString + ) import Data.Data - ( Proxy (..) ) + ( Proxy (..) + ) import Data.Text - ( Text ) + ( Text + ) import Data.Text.Class - ( FromText (..), TextDecodingError (..), ToText (..) ) + ( FromText (..) + , TextDecodingError (..) + , ToText (..) + ) import Database.Persist.Class - ( PersistField (..) ) + ( PersistField (..) + ) import Database.Persist.PersistValue.Extended - ( fromPersistValueFromText, fromPersistValueRead ) + ( fromPersistValueFromText + , fromPersistValueRead + ) import Database.Persist.Sql - ( PersistFieldSql (..) ) + ( PersistFieldSql (..) + ) import Database.Persist.TH - ( mkPersist, persistLowerCase, share ) + ( mkPersist + , persistLowerCase + , share + ) import GHC.Generics - ( Generic (..) ) + ( Generic (..) + ) import qualified Data.Text.Encoding as T diff --git a/lib/wallet/src/Cardano/Wallet/DB/Store/Delegations/Model.hs b/lib/wallet/src/Cardano/Wallet/DB/Store/Delegations/Model.hs index 3b447dd122f..eafb0b49669 100644 --- a/lib/wallet/src/Cardano/Wallet/DB/Store/Delegations/Model.hs +++ b/lib/wallet/src/Cardano/Wallet/DB/Store/Delegations/Model.hs @@ -10,13 +10,19 @@ module Cardano.Wallet.DB.Store.Delegations.Model import Prelude import Cardano.Pool.Types - ( PoolId ) + ( PoolId + ) import Cardano.Wallet.Delegation.Model - ( History, Operation (..) ) + ( History + , Operation (..) + ) import Cardano.Wallet.Primitive.Types - ( SlotNo ) + ( SlotNo + ) import Fmt - ( Buildable (..), listF' ) + ( Buildable (..) + , listF' + ) -- | Wallet delegation history type Delegations = History SlotNo PoolId diff --git a/lib/wallet/src/Cardano/Wallet/DB/Store/Delegations/Schema.hs b/lib/wallet/src/Cardano/Wallet/DB/Store/Delegations/Schema.hs index 61d76d8d7fd..295a337c970 100644 --- a/lib/wallet/src/Cardano/Wallet/DB/Store/Delegations/Schema.hs +++ b/lib/wallet/src/Cardano/Wallet/DB/Store/Delegations/Schema.hs @@ -34,25 +34,41 @@ where import Prelude import Cardano.Pool.Types - ( PoolId ) + ( PoolId + ) import Cardano.Slotting.Slot - ( SlotNo ) + ( SlotNo + ) import Cardano.Wallet.DB.Sqlite.Types - ( DelegationStatusEnum (..), sqlSettings' ) + ( DelegationStatusEnum (..) + , sqlSettings' + ) import Control.Monad - ( void ) + ( void + ) import Control.Monad.IO.Class - ( MonadIO ) + ( MonadIO + ) import Data.Proxy - ( Proxy (..) ) + ( Proxy (..) + ) import Database.Persist - ( PersistEntity (EntityField, Key, entityDef) ) + ( PersistEntity (EntityField, Key, entityDef) + ) import Database.Persist.Sql - ( Migration, SqlPersistT, rawExecute, runMigrationUnsafeQuiet ) + ( Migration + , SqlPersistT + , rawExecute + , runMigrationUnsafeQuiet + ) import Database.Persist.TH - ( migrateModels, mkPersist, persistLowerCase ) + ( migrateModels + , mkPersist + , persistLowerCase + ) import GHC.Generics - ( Generic (..) ) + ( Generic (..) + ) import qualified Cardano.Wallet.Primitive.Types as W diff --git a/lib/wallet/src/Cardano/Wallet/DB/Store/Delegations/Store.hs b/lib/wallet/src/Cardano/Wallet/DB/Store/Delegations/Store.hs index 6f33473295e..a1f1307b45f 100644 --- a/lib/wallet/src/Cardano/Wallet/DB/Store/Delegations/Store.hs +++ b/lib/wallet/src/Cardano/Wallet/DB/Store/Delegations/Store.hs @@ -18,11 +18,14 @@ module Cardano.Wallet.DB.Store.Delegations.Store import Prelude import Cardano.Pool.Types - ( PoolId ) + ( PoolId + ) import Cardano.Slotting.Slot - ( SlotNo ) + ( SlotNo + ) import Cardano.Wallet.DB.Sqlite.Types - ( DelegationStatusEnum (..) ) + ( DelegationStatusEnum (..) + ) import Cardano.Wallet.DB.Store.Delegations.Schema ( Delegations (..) , EntityField (DelegationSlot) @@ -30,17 +33,29 @@ import Cardano.Wallet.DB.Store.Delegations.Schema , resetDelegationTable ) import Cardano.Wallet.Delegation.Model - ( History, Operation (..), Status (..), slotOf ) + ( History + , Operation (..) + , Status (..) + , slotOf + ) import Control.Exception - ( Exception, SomeException (SomeException) ) + ( Exception + , SomeException (SomeException) + ) import Control.Monad - ( when ) + ( when + ) import Control.Monad.Class.MonadThrow - ( throwIO ) + ( throwIO + ) import Data.Delta - ( Delta (apply) ) + ( Delta (apply) + ) import Data.Store - ( UpdateStore, mkUpdateStore, updateLoad ) + ( UpdateStore + , mkUpdateStore + , updateLoad + ) import Database.Persist ( Entity (..) , PersistQueryWrite (deleteWhere) @@ -50,7 +65,9 @@ import Database.Persist , (>.) ) import Database.Persist.Sql - ( SqlPersistT, insertMany_ ) + ( SqlPersistT + , insertMany_ + ) import qualified Data.Map.Strict as Map diff --git a/lib/wallet/src/Cardano/Wallet/DB/Store/Info/Store.hs b/lib/wallet/src/Cardano/Wallet/DB/Store/Info/Store.hs index 3a193687aac..874a9027314 100644 --- a/lib/wallet/src/Cardano/Wallet/DB/Store/Info/Store.hs +++ b/lib/wallet/src/Cardano/Wallet/DB/Store/Info/Store.hs @@ -20,11 +20,16 @@ module Cardano.Wallet.DB.Store.Info.Store import Prelude import Cardano.Wallet.DB.Errors - ( ErrWalletNotInitialized (ErrWalletNotInitialized) ) + ( ErrWalletNotInitialized (ErrWalletNotInitialized) + ) import Cardano.Wallet.DB.Sqlite.Schema - ( EntityField (..), Wallet (..) ) + ( EntityField (..) + , Wallet (..) + ) import Cardano.Wallet.DB.Sqlite.Types - ( BlockId (BlockId), getBlockId ) + ( BlockId (BlockId) + , getBlockId + ) import Cardano.Wallet.Primitive.Passphrase.Types ( WalletPassphraseInfo (WalletPassphraseInfo, lastUpdatedAt, passphraseScheme) ) @@ -37,17 +42,26 @@ import Cardano.Wallet.Primitive.Types , getWalletName ) import Cardano.Wallet.Primitive.Types.Hash - ( Hash (Hash) ) + ( Hash (Hash) + ) import Control.Exception - ( SomeException (..) ) + ( SomeException (..) + ) import Control.Lens - ( to, (^.) ) + ( to + , (^.) + ) import Control.Monad.Class.MonadThrow - ( throwIO ) + ( throwIO + ) import Data.Delta - ( Delta (..) ) + ( Delta (..) + ) import Data.Store - ( UpdateStore, mkUpdateStore, updateLoad ) + ( UpdateStore + , mkUpdateStore + , updateLoad + ) import Database.Persist ( Entity (entityVal) , Filter @@ -58,11 +72,15 @@ import Database.Persist , (=.) ) import Database.Persist.Sql - ( SqlPersistT, deleteWhere ) + ( SqlPersistT + , deleteWhere + ) import Fmt - ( Buildable (..) ) + ( Buildable (..) + ) import GHC.Generics - ( Generic ) + ( Generic + ) mkWalletMetadataUpdate :: WalletMetadata -> [Update Wallet] mkWalletMetadataUpdate meta = diff --git a/lib/wallet/src/Cardano/Wallet/DB/Store/Meta/Layer.hs b/lib/wallet/src/Cardano/Wallet/DB/Store/Meta/Layer.hs index 9641ca22e47..00d8c65ec5e 100644 --- a/lib/wallet/src/Cardano/Wallet/DB/Store/Meta/Layer.hs +++ b/lib/wallet/src/Cardano/Wallet/DB/Store/Meta/Layer.hs @@ -14,29 +14,46 @@ module Cardano.Wallet.DB.Store.Meta.Layer import Prelude import Cardano.Slotting.Slot - ( SlotNo ) + ( SlotNo + ) import Cardano.Wallet.DB.Sqlite.Schema - ( EntityField (..), TxMeta (..) ) + ( EntityField (..) + , TxMeta (..) + ) import Cardano.Wallet.DB.Sqlite.Types - ( TxId (..) ) + ( TxId (..) + ) import Cardano.Wallet.DB.Store.Meta.Model - ( DeltaTxMetaHistory, TxMetaHistory (..) ) + ( DeltaTxMetaHistory + , TxMetaHistory (..) + ) import Cardano.Wallet.DB.Store.Meta.Store - ( mkStoreMetaTransactions ) + ( mkStoreMetaTransactions + ) import Cardano.Wallet.Primitive.Types - ( Range (..), SortOrder (..) ) + ( Range (..) + , SortOrder (..) + ) import Data.Foldable - ( toList ) + ( toList + ) import Data.List - ( sortOn ) + ( sortOn + ) import Data.Maybe - ( catMaybes ) + ( catMaybes + ) import Data.Ord - ( Down (..) ) + ( Down (..) + ) import Data.Set - ( Set ) + ( Set + ) import Data.Store - ( Query (..), Store, mkQueryStore ) + ( Query (..) + , Store + , mkQueryStore + ) import Database.Persist.Sql ( Entity (entityVal) , Filter @@ -50,7 +67,8 @@ import Database.Persist.Sql , (>=.) ) import GHC.Natural - ( Natural ) + ( Natural + ) import qualified Cardano.Wallet.DB.Sqlite.Schema as DB import qualified Cardano.Wallet.Primitive.Types as W diff --git a/lib/wallet/src/Cardano/Wallet/DB/Store/Meta/Model.hs b/lib/wallet/src/Cardano/Wallet/DB/Store/Meta/Model.hs index f61348505b1..05ae71db35d 100644 --- a/lib/wallet/src/Cardano/Wallet/DB/Store/Meta/Model.hs +++ b/lib/wallet/src/Cardano/Wallet/DB/Store/Meta/Model.hs @@ -25,25 +25,35 @@ module Cardano.Wallet.DB.Store.Meta.Model import Prelude import Cardano.Wallet.DB.Sqlite.Schema - ( TxMeta (..) ) + ( TxMeta (..) + ) import Cardano.Wallet.DB.Sqlite.Types - ( TxId (..) ) + ( TxId (..) + ) import Data.Delta - ( Delta (..) ) + ( Delta (..) + ) import Data.Functor - ( (<&>) ) + ( (<&>) + ) import Data.Generics.Internal.VL - ( (^.) ) + ( (^.) + ) import Data.Map.Strict - ( Map ) + ( Map + ) import Data.Quantity - ( Quantity (..) ) + ( Quantity (..) + ) import Data.Set - ( Set ) + ( Set + ) import Fmt - ( Buildable (build) ) + ( Buildable (build) + ) import GHC.Generics - ( Generic ) + ( Generic + ) import qualified Cardano.Wallet.Primitive.Types as W import qualified Cardano.Wallet.Primitive.Types.Coin as W diff --git a/lib/wallet/src/Cardano/Wallet/DB/Store/Meta/Store.hs b/lib/wallet/src/Cardano/Wallet/DB/Store/Meta/Store.hs index 27b12874644..b1c046bf33e 100644 --- a/lib/wallet/src/Cardano/Wallet/DB/Store/Meta/Store.hs +++ b/lib/wallet/src/Cardano/Wallet/DB/Store/Meta/Store.hs @@ -15,21 +15,32 @@ module Cardano.Wallet.DB.Store.Meta.Store ( mkStoreMetaTransactions ) where import Prelude import Cardano.Wallet.DB.Sqlite.Schema - ( EntityField (..), TxMeta (..) ) + ( EntityField (..) + , TxMeta (..) + ) import Cardano.Wallet.DB.Store.Meta.Model - ( DeltaTxMetaHistory (..), TxMetaHistory (..) ) + ( DeltaTxMetaHistory (..) + , TxMetaHistory (..) + ) import Control.Arrow - ( (&&&) ) + ( (&&&) + ) import Control.Exception - ( SomeException ) + ( SomeException + ) import Data.Foldable - ( Foldable (toList) ) + ( Foldable (toList) + ) import Data.List.Split - ( chunksOf ) + ( chunksOf + ) import Data.Maybe - ( fromJust ) + ( fromJust + ) import Data.Store - ( UpdateStore, mkUpdateStore ) + ( UpdateStore + , mkUpdateStore + ) import Database.Persist.Sql ( Entity (entityVal) , PersistEntity (keyFromRecordM) diff --git a/lib/wallet/src/Cardano/Wallet/DB/Store/PrivateKey/Store.hs b/lib/wallet/src/Cardano/Wallet/DB/Store/PrivateKey/Store.hs index 000e7c345ac..cf09385400b 100644 --- a/lib/wallet/src/Cardano/Wallet/DB/Store/PrivateKey/Store.hs +++ b/lib/wallet/src/Cardano/Wallet/DB/Store/PrivateKey/Store.hs @@ -17,25 +17,42 @@ module Cardano.Wallet.DB.Store.PrivateKey.Store import Prelude import Cardano.Wallet.Address.Keys.PersistPrivateKey - ( serializeXPrv, unsafeDeserializeXPrv ) + ( serializeXPrv + , unsafeDeserializeXPrv + ) import Cardano.Wallet.Flavor - ( KeyFlavorS ) + ( KeyFlavorS + ) import Cardano.Wallet.Primitive.Types - ( WalletId ) + ( WalletId + ) import Cardano.Wallet.Primitive.Types.Credentials - ( HashedCredentials, RootCredentials (..) ) + ( HashedCredentials + , RootCredentials (..) + ) import Control.Exception - ( SomeException (..) ) + ( SomeException (..) + ) import Data.Delta - ( Replace ) + ( Replace + ) import Data.Functor - ( (<&>) ) + ( (<&>) + ) import Data.Store - ( SimpleStore, mkSimpleStore ) + ( SimpleStore + , mkSimpleStore + ) import Database.Persist - ( Entity (entityVal), Filter, PersistQueryRead (selectFirst), insert_ ) + ( Entity (entityVal) + , Filter + , PersistQueryRead (selectFirst) + , insert_ + ) import Database.Persist.Sql - ( SqlPersistT, deleteWhere ) + ( SqlPersistT + , deleteWhere + ) import qualified Cardano.Wallet.DB.Sqlite.Schema as Schema diff --git a/lib/wallet/src/Cardano/Wallet/DB/Store/Rewards/Store.hs b/lib/wallet/src/Cardano/Wallet/DB/Store/Rewards/Store.hs index b27e6fc2d73..aa9b2240d5c 100644 --- a/lib/wallet/src/Cardano/Wallet/DB/Store/Rewards/Store.hs +++ b/lib/wallet/src/Cardano/Wallet/DB/Store/Rewards/Store.hs @@ -15,15 +15,26 @@ module Cardano.Wallet.DB.Store.Rewards.Store ( import Prelude import Cardano.Wallet.DB.Sqlite.Schema - ( DelegationReward (..) ) + ( DelegationReward (..) + ) import Control.Exception - ( SomeException (SomeException) ) + ( SomeException (SomeException) + ) import Data.Delta - ( Replace ) + ( Replace + ) import Data.Store - ( UpdateStore, mkSimpleStore ) + ( UpdateStore + , mkSimpleStore + ) import Database.Persist.Sql - ( Entity (..), Filter, SqlPersistT, deleteWhere, insert_, selectList ) + ( Entity (..) + , Filter + , SqlPersistT + , deleteWhere + , insert_ + , selectList + ) import qualified Cardano.Wallet.Primitive.Types as W import qualified Cardano.Wallet.Primitive.Types.Coin as W diff --git a/lib/wallet/src/Cardano/Wallet/DB/Store/Submissions/Layer.hs b/lib/wallet/src/Cardano/Wallet/DB/Store/Submissions/Layer.hs index 9d13d90fd6f..f057feb1e6d 100644 --- a/lib/wallet/src/Cardano/Wallet/DB/Store/Submissions/Layer.hs +++ b/lib/wallet/src/Cardano/Wallet/DB/Store/Submissions/Layer.hs @@ -29,12 +29,16 @@ module Cardano.Wallet.DB.Store.Submissions.Layer where import Prelude hiding - ( (.) ) + ( (.) + ) import Cardano.Wallet.DB.Errors - ( ErrNoSuchTransaction (..), ErrRemoveTx (..) ) + ( ErrNoSuchTransaction (..) + , ErrRemoveTx (..) + ) import Cardano.Wallet.DB.Sqlite.Types - ( TxId (..) ) + ( TxId (..) + ) import Cardano.Wallet.DB.Store.Submissions.Operations ( DeltaTxSubmissions , SubmissionMeta (SubmissionMeta, submissionMetaResubmitted) @@ -43,27 +47,51 @@ import Cardano.Wallet.DB.Store.Submissions.Operations , submissionMetaFromTxMeta ) import Cardano.Wallet.Primitive.Types - ( SlotNo (SlotNo) ) + ( SlotNo (SlotNo) + ) import Cardano.Wallet.Primitive.Types.Hash - ( Hash (..) ) + ( Hash (..) + ) import Cardano.Wallet.Primitive.Types.Tx - ( LocalTxSubmissionStatus (LocalTxSubmissionStatus), SealedTx ) + ( LocalTxSubmissionStatus (LocalTxSubmissionStatus) + , SealedTx + ) import Cardano.Wallet.Submissions.Operations - ( Operation (..) ) + ( Operation (..) + ) import Cardano.Wallet.Submissions.Submissions - ( TxStatusMeta (..), mkEmpty, transactions, transactionsL, txStatus ) + ( TxStatusMeta (..) + , mkEmpty + , transactions + , transactionsL + , txStatus + ) import Cardano.Wallet.Submissions.TxStatus - ( TxStatus (..), expirySlot, getTx, status, _InSubmission ) + ( TxStatus (..) + , expirySlot + , getTx + , status + , _InSubmission + ) import Cardano.Wallet.Transaction.Built - ( BuiltTx (..) ) + ( BuiltTx (..) + ) import Control.Category - ( (.) ) + ( (.) + ) import Control.Lens - ( has, ix, (^.), (^..), (^?) ) + ( has + , ix + , (^.) + , (^..) + , (^?) + ) import Data.Bifunctor - ( second ) + ( second + ) import Data.Maybe - ( fromMaybe ) + ( fromMaybe + ) import qualified Data.Map.Strict as Map diff --git a/lib/wallet/src/Cardano/Wallet/DB/Store/Submissions/Operations.hs b/lib/wallet/src/Cardano/Wallet/DB/Store/Submissions/Operations.hs index 456765b3700..c2baf6661bb 100644 --- a/lib/wallet/src/Cardano/Wallet/DB/Store/Submissions/Operations.hs +++ b/lib/wallet/src/Cardano/Wallet/DB/Store/Submissions/Operations.hs @@ -33,37 +33,65 @@ import Cardano.Wallet.DB.Sqlite.Schema , SubmissionsSlots (SubmissionsSlots) ) import Cardano.Wallet.DB.Sqlite.Types - ( TxId, TxSubmissionStatusEnum (..) ) + ( TxId + , TxSubmissionStatusEnum (..) + ) import Cardano.Wallet.Primitive.Types - ( SlotNo (..), WalletId ) + ( SlotNo (..) + , WalletId + ) import Cardano.Wallet.Primitive.Types.Tx.TxMeta - ( TxMeta (..) ) + ( TxMeta (..) + ) import Cardano.Wallet.Submissions.Operations - ( applyOperations ) + ( applyOperations + ) import Cardano.Wallet.Submissions.Submissions - ( TxStatusMeta (..), finality, tip, transactions, transactionsL ) + ( TxStatusMeta (..) + , finality + , tip + , transactions + , transactionsL + ) import Control.Exception - ( Exception, SomeException (..) ) + ( Exception + , SomeException (..) + ) import Control.Lens - ( (^.) ) + ( (^.) + ) import Control.Monad - ( forM_ ) + ( forM_ + ) import Control.Monad.Class.MonadThrow - ( throwIO ) + ( throwIO + ) import Data.Delta - ( Delta (..) ) + ( Delta (..) + ) import Data.Map.Strict - ( Map ) + ( Map + ) import Data.Quantity - ( Quantity ) + ( Quantity + ) import Data.Store - ( UpdateStore, mkUpdateStore, updateLoad ) + ( UpdateStore + , mkUpdateStore + , updateLoad + ) import Data.Word - ( Word32 ) + ( Word32 + ) import Database.Persist - ( Entity (..), PersistStoreWrite (delete, repsert), selectList, (==.) ) + ( Entity (..) + , PersistStoreWrite (delete, repsert) + , selectList + , (==.) + ) import Database.Persist.Sql - ( SqlPersistT ) + ( SqlPersistT + ) import qualified Cardano.Wallet.Primitive.Types.Coin as W import qualified Cardano.Wallet.Primitive.Types.Tx as W diff --git a/lib/wallet/src/Cardano/Wallet/DB/Store/Transactions/Decoration.hs b/lib/wallet/src/Cardano/Wallet/DB/Store/Transactions/Decoration.hs index 18c25719432..8fc9618faea 100644 --- a/lib/wallet/src/Cardano/Wallet/DB/Store/Transactions/Decoration.hs +++ b/lib/wallet/src/Cardano/Wallet/DB/Store/Transactions/Decoration.hs @@ -30,43 +30,62 @@ module Cardano.Wallet.DB.Store.Transactions.Decoration ) where import Prelude hiding - ( (.) ) + ( (.) + ) import Cardano.Wallet.DB.Sqlite.Schema - ( TxCollateral (..), TxIn (..), TxOut (..) ) + ( TxCollateral (..) + , TxIn (..) + , TxOut (..) + ) import Cardano.Wallet.DB.Sqlite.Types - ( TxId (..) ) + ( TxId (..) + ) import Cardano.Wallet.DB.Store.Transactions.Model ( TxRelation (TxRelation, collateralIns, collateralOuts, ins, outs) , fromTxCollateralOut , fromTxOut ) import Cardano.Wallet.Read.Eras - ( EraValue, extractEraValue ) + ( EraValue + , extractEraValue + ) import Cardano.Wallet.Read.Eras.EraFun - ( applyEraFun ) + ( applyEraFun + ) import Cardano.Wallet.Read.Primitive.Tx.Features.CollateralInputs - ( getCollateralInputs ) + ( getCollateralInputs + ) import Cardano.Wallet.Read.Primitive.Tx.Features.Inputs - ( getInputs ) + ( getInputs + ) import Cardano.Wallet.Read.Tx.CollateralInputs - ( getEraCollateralInputs ) + ( getEraCollateralInputs + ) import Cardano.Wallet.Read.Tx.Inputs - ( getEraInputs ) + ( getEraInputs + ) import Control.Applicative - ( (<|>) ) + ( (<|>) + ) import Control.Category - ( (.) ) + ( (.) + ) import Control.Monad - ( guard ) + ( guard + ) import Data.List - ( find ) + ( find + ) import Data.Map.Strict - ( Map ) + ( Map + ) import Data.Maybe - ( catMaybes ) + ( catMaybes + ) import Data.Word - ( Word32 ) + ( Word32 + ) import qualified Cardano.Wallet.Primitive.Types.Tx.TxIn as W import qualified Cardano.Wallet.Primitive.Types.Tx.TxOut as W diff --git a/lib/wallet/src/Cardano/Wallet/DB/Store/Transactions/Layer.hs b/lib/wallet/src/Cardano/Wallet/DB/Store/Transactions/Layer.hs index 2afe9dc0733..0b9bde0776e 100644 --- a/lib/wallet/src/Cardano/Wallet/DB/Store/Transactions/Layer.hs +++ b/lib/wallet/src/Cardano/Wallet/DB/Store/Transactions/Layer.hs @@ -19,23 +19,38 @@ module Cardano.Wallet.DB.Store.Transactions.Layer import Prelude import Cardano.Wallet.DB.Sqlite.Schema - ( CBOR ) + ( CBOR + ) import Cardano.Wallet.DB.Sqlite.Types - ( TxId ) + ( TxId + ) import Cardano.Wallet.DB.Store.Transactions.Model - ( DeltaTxSet, TxRelation (..), TxSet (..), fromTxCollateralOut, fromTxOut ) + ( DeltaTxSet + , TxRelation (..) + , TxSet (..) + , fromTxCollateralOut + , fromTxOut + ) import Control.Applicative - ( (<|>) ) + ( (<|>) + ) import Data.Maybe - ( maybeToList ) + ( maybeToList + ) import Data.Store - ( Query (..), Store, mkQueryStore ) + ( Query (..) + , Store + , mkQueryStore + ) import Data.Word - ( Word32 ) + ( Word32 + ) import Database.Persist.Sql - ( SqlPersistT ) + ( SqlPersistT + ) import Safe - ( atMay ) + ( atMay + ) import qualified Cardano.Wallet.DB.Store.Transactions.Store as TxSet import qualified Cardano.Wallet.Primitive.Types.Tx.TxOut as W diff --git a/lib/wallet/src/Cardano/Wallet/DB/Store/Transactions/Model.hs b/lib/wallet/src/Cardano/Wallet/DB/Store/Transactions/Model.hs index c4b424aad84..571f8294e34 100644 --- a/lib/wallet/src/Cardano/Wallet/DB/Store/Transactions/Model.hs +++ b/lib/wallet/src/Cardano/Wallet/DB/Store/Transactions/Model.hs @@ -48,57 +48,91 @@ import Cardano.Wallet.DB.Sqlite.Schema , TxWithdrawal (..) ) import Cardano.Wallet.DB.Sqlite.Types - ( TxId (..) ) + ( TxId (..) + ) import Cardano.Wallet.Primitive.Types.RewardAccount - ( RewardAccount ) + ( RewardAccount + ) import Cardano.Wallet.Primitive.Types.TokenMap - ( AssetId (AssetId) ) + ( AssetId (AssetId) + ) import Cardano.Wallet.Primitive.Types.TokenPolicy - ( TokenName, TokenPolicyId ) + ( TokenName + , TokenPolicyId + ) import Cardano.Wallet.Primitive.Types.TokenQuantity - ( TokenQuantity ) + ( TokenQuantity + ) import Cardano.Wallet.Primitive.Types.Tx.Tx - ( Tx (txCBOR) ) + ( Tx (txCBOR) + ) import Cardano.Wallet.Read.Eras.EraValue - ( eraValueSerialize ) + ( eraValueSerialize + ) import Cardano.Wallet.Read.Tx.CBOR - ( TxCBOR ) + ( TxCBOR + ) import Control.Arrow - ( (&&&), (***) ) + ( (&&&) + , (***) + ) import Data.Bifunctor - ( bimap ) + ( bimap + ) import Data.ByteString - ( ByteString ) + ( ByteString + ) import Data.ByteString.Lazy.Char8 - ( fromStrict, toStrict ) + ( fromStrict + , toStrict + ) import Data.Delta - ( Delta (..) ) + ( Delta (..) + ) import Data.Foldable - ( fold ) + ( fold + ) import Data.Generics.Internal.VL - ( Iso', Prism, fromIso, iso, match, prism, view, (^.) ) + ( Iso' + , Prism + , fromIso + , iso + , match + , prism + , view + , (^.) + ) import Data.List - ( sortOn ) + ( sortOn + ) import Data.Map.Strict - ( Map ) + ( Map + ) import Data.Word - ( Word16, Word32 ) + ( Word16 + , Word32 + ) import Fmt - ( Buildable (..) ) + ( Buildable (..) + ) import GHC.Generics - ( Generic ) + ( Generic + ) import qualified Cardano.Wallet.Primitive.Types as W import qualified Cardano.Wallet.Primitive.Types.Coin as W import qualified Cardano.Wallet.Primitive.Types.TokenBundle as TokenBundle import qualified Cardano.Wallet.Primitive.Types.Tx.Tx as W - ( Tx ) + ( Tx + ) import qualified Cardano.Wallet.Primitive.Types.Tx.Tx as W.Tx import qualified Cardano.Wallet.Primitive.Types.Tx.TxIn as W - ( TxIn ) + ( TxIn + ) import qualified Cardano.Wallet.Primitive.Types.Tx.TxIn as W.TxIn import qualified Cardano.Wallet.Primitive.Types.Tx.TxOut as W - ( TxOut (TxOut) ) + ( TxOut (TxOut) + ) import qualified Cardano.Wallet.Primitive.Types.Tx.TxOut as W.TxOut import qualified Data.ByteString.Lazy as BL import qualified Data.Generics.Internal.VL as L diff --git a/lib/wallet/src/Cardano/Wallet/DB/Store/Transactions/Store.hs b/lib/wallet/src/Cardano/Wallet/DB/Store/Transactions/Store.hs index 95665505b78..81b5995b991 100644 --- a/lib/wallet/src/Cardano/Wallet/DB/Store/Transactions/Store.hs +++ b/lib/wallet/src/Cardano/Wallet/DB/Store/Transactions/Store.hs @@ -38,7 +38,8 @@ import Cardano.Wallet.DB.Sqlite.Schema , TxWithdrawal (..) ) import Cardano.Wallet.DB.Sqlite.Types - ( TxId ) + ( TxId + ) import Cardano.Wallet.DB.Store.Transactions.Model ( DeltaTxSet (..) , TxRelation (..) @@ -47,27 +48,43 @@ import Cardano.Wallet.DB.Store.Transactions.Model , tokenOutOrd ) import Control.Arrow - ( Arrow ((&&&)) ) + ( Arrow ((&&&)) + ) import Control.Monad.Reader - ( MonadIO, ReaderT ) + ( MonadIO + , ReaderT + ) import Data.Foldable - ( fold, toList ) + ( fold + , toList + ) import Data.Functor - ( (<&>) ) + ( (<&>) + ) import Data.List - ( sortOn ) + ( sortOn + ) import Data.List.Split - ( chunksOf ) + ( chunksOf + ) import Data.Map.Strict - ( Map ) + ( Map + ) import Data.Maybe - ( listToMaybe, maybeToList ) + ( listToMaybe + , maybeToList + ) import Data.Monoid - ( First (..), getFirst ) + ( First (..) + , getFirst + ) import Data.Store - ( UpdateStore, mkUpdateStore ) + ( UpdateStore + , mkUpdateStore + ) import Data.Word - ( Word32 ) + ( Word32 + ) import Database.Persist.Sql ( BaseBackend , Entity diff --git a/lib/wallet/src/Cardano/Wallet/DB/Store/Transactions/TransactionInfo.hs b/lib/wallet/src/Cardano/Wallet/DB/Store/Transactions/TransactionInfo.hs index dcedc80a43e..92fb98d1caf 100644 --- a/lib/wallet/src/Cardano/Wallet/DB/Store/Transactions/TransactionInfo.hs +++ b/lib/wallet/src/Cardano/Wallet/DB/Store/Transactions/TransactionInfo.hs @@ -9,78 +9,131 @@ module Cardano.Wallet.DB.Store.Transactions.TransactionInfo ) where import Prelude hiding - ( (.) ) + ( (.) + ) import Cardano.Slotting.Slot - ( SlotNo (..) ) + ( SlotNo (..) + ) import Cardano.Wallet.DB.Sqlite.Schema - ( TxCollateral (..), TxIn (..), TxMeta (..), TxWithdrawal (..) ) + ( TxCollateral (..) + , TxIn (..) + , TxMeta (..) + , TxWithdrawal (..) + ) import Cardano.Wallet.DB.Sqlite.Types - ( TxId (..) ) + ( TxId (..) + ) import Cardano.Wallet.DB.Store.Meta.Model - ( mkTxMetaFromEntity ) + ( mkTxMetaFromEntity + ) import Cardano.Wallet.DB.Store.Submissions.Operations - ( SubmissionMeta (..) ) + ( SubmissionMeta (..) + ) import Cardano.Wallet.DB.Store.Transactions.Decoration - ( DecoratedTxIns, TxOutKey, lookupTxOut, mkTxOutKey, mkTxOutKeyCollateral ) + ( DecoratedTxIns + , TxOutKey + , lookupTxOut + , mkTxOutKey + , mkTxOutKeyCollateral + ) import Cardano.Wallet.DB.Store.Transactions.Model - ( TxRelation (..), fromTxCollateralOut, fromTxOut, txCBORPrism ) + ( TxRelation (..) + , fromTxCollateralOut + , fromTxOut + , txCBORPrism + ) import Cardano.Wallet.Primitive.Slotting - ( TimeInterpreter, interpretQuery, slotToUTCTime ) + ( TimeInterpreter + , interpretQuery + , slotToUTCTime + ) import Cardano.Wallet.Read.Eras - ( EraFun, EraValue, K, applyEraFun, extractEraValue ) + ( EraFun + , EraValue + , K + , applyEraFun + , extractEraValue + ) import Cardano.Wallet.Read.Primitive.Tx.Features.CollateralInputs - ( getCollateralInputs ) + ( getCollateralInputs + ) import Cardano.Wallet.Read.Primitive.Tx.Features.CollateralOutputs - ( getCollateralOutputs ) + ( getCollateralOutputs + ) import Cardano.Wallet.Read.Primitive.Tx.Features.Fee - ( getFee ) + ( getFee + ) import Cardano.Wallet.Read.Primitive.Tx.Features.Inputs - ( getInputs ) + ( getInputs + ) import Cardano.Wallet.Read.Primitive.Tx.Features.Metadata - ( getMetadata ) + ( getMetadata + ) import Cardano.Wallet.Read.Primitive.Tx.Features.Outputs - ( getOutputs ) + ( getOutputs + ) import Cardano.Wallet.Read.Primitive.Tx.Features.ScriptValidity - ( getScriptValidity ) + ( getScriptValidity + ) import Cardano.Wallet.Read.Primitive.Tx.Features.Validity - ( getValidity ) + ( getValidity + ) import Cardano.Wallet.Read.Primitive.Tx.Features.Withdrawals - ( getWithdrawals ) + ( getWithdrawals + ) import Cardano.Wallet.Read.Tx.CBOR - ( TxCBOR, renderTxToCBOR ) + ( TxCBOR + , renderTxToCBOR + ) import Cardano.Wallet.Read.Tx.CollateralInputs - ( getEraCollateralInputs ) + ( getEraCollateralInputs + ) import Cardano.Wallet.Read.Tx.CollateralOutputs - ( getEraCollateralOutputs ) + ( getEraCollateralOutputs + ) import Cardano.Wallet.Read.Tx.Fee - ( getEraFee ) + ( getEraFee + ) import Cardano.Wallet.Read.Tx.Hash - ( getEraTxHash ) + ( getEraTxHash + ) import Cardano.Wallet.Read.Tx.Inputs - ( getEraInputs ) + ( getEraInputs + ) import Cardano.Wallet.Read.Tx.Metadata - ( getEraMetadata ) + ( getEraMetadata + ) import Cardano.Wallet.Read.Tx.Outputs - ( getEraOutputs ) + ( getEraOutputs + ) import Cardano.Wallet.Read.Tx.ScriptValidity - ( getEraScriptValidity ) + ( getEraScriptValidity + ) import Cardano.Wallet.Read.Tx.Validity - ( getEraValidity ) + ( getEraValidity + ) import Cardano.Wallet.Read.Tx.Withdrawals - ( getEraWithdrawals ) + ( getEraWithdrawals + ) import Cardano.Wallet.Transaction - ( ValidityIntervalExplicit (invalidHereafter) ) + ( ValidityIntervalExplicit (invalidHereafter) + ) import Control.Category - ( (.) ) + ( (.) + ) import Data.Foldable - ( fold ) + ( fold + ) import Data.Functor - ( (<&>) ) + ( (<&>) + ) import Data.Generics.Internal.VL - ( (^.) ) + ( (^.) + ) import Data.Quantity - ( Quantity (..) ) + ( Quantity (..) + ) import qualified Cardano.Wallet.DB.Sqlite.Schema as DB import qualified Cardano.Wallet.Primitive.Types as W diff --git a/lib/wallet/src/Cardano/Wallet/DB/Store/UTxOHistory/Model.hs b/lib/wallet/src/Cardano/Wallet/DB/Store/UTxOHistory/Model.hs index 8d9eafce117..f5d9a9d971f 100644 --- a/lib/wallet/src/Cardano/Wallet/DB/Store/UTxOHistory/Model.hs +++ b/lib/wallet/src/Cardano/Wallet/DB/Store/UTxOHistory/Model.hs @@ -38,27 +38,44 @@ where import Prelude import Cardano.Slotting.Slot - ( SlotNo, WithOrigin (..) ) + ( SlotNo + , WithOrigin (..) + ) import Cardano.Wallet.DB.Store.UTxOHistory.Model.Internal - ( Pruned (..), UTxOHistory (..) ) + ( Pruned (..) + , UTxOHistory (..) + ) import Cardano.Wallet.Primitive.Types - ( Slot ) + ( Slot + ) import Cardano.Wallet.Primitive.Types.Tx.TxIn - ( TxIn ) + ( TxIn + ) import Cardano.Wallet.Primitive.Types.UTxO - ( DeltaUTxO (..), UTxO, dom, excluding ) + ( DeltaUTxO (..) + , UTxO + , dom + , excluding + ) import Control.Error - ( fromMaybe ) + ( fromMaybe + ) import Control.Monad - ( guard ) + ( guard + ) import Data.Delta - ( Delta (..) ) + ( Delta (..) + ) import Data.Foldable - ( fold, foldl' ) + ( fold + , foldl' + ) import Data.Map.Strict - ( Map ) + ( Map + ) import Data.Set - ( Set ) + ( Set + ) import qualified Data.Map.Strict as Map import qualified Data.Set as Set diff --git a/lib/wallet/src/Cardano/Wallet/DB/Store/UTxOHistory/Model/Internal.hs b/lib/wallet/src/Cardano/Wallet/DB/Store/UTxOHistory/Model/Internal.hs index fa10422334f..ae32938482b 100644 --- a/lib/wallet/src/Cardano/Wallet/DB/Store/UTxOHistory/Model/Internal.hs +++ b/lib/wallet/src/Cardano/Wallet/DB/Store/UTxOHistory/Model/Internal.hs @@ -12,15 +12,21 @@ where import Prelude import Cardano.Wallet.Primitive.Types - ( Slot, SlotNo ) + ( Slot + , SlotNo + ) import Cardano.Wallet.Primitive.Types.Tx.TxIn - ( TxIn ) + ( TxIn + ) import Cardano.Wallet.Primitive.Types.UTxO - ( UTxO ) + ( UTxO + ) import Data.Map.Strict - ( Map ) + ( Map + ) import Data.Set - ( Set ) + ( Set + ) -- | The finality of the UTxO history. data Pruned = PrunedUpTo SlotNo | NotPruned diff --git a/lib/wallet/src/Cardano/Wallet/DB/Store/UTxOHistory/Store.hs b/lib/wallet/src/Cardano/Wallet/DB/Store/UTxOHistory/Store.hs index f8603449316..a595a5500d7 100644 --- a/lib/wallet/src/Cardano/Wallet/DB/Store/UTxOHistory/Store.hs +++ b/lib/wallet/src/Cardano/Wallet/DB/Store/UTxOHistory/Store.hs @@ -10,9 +10,15 @@ module Cardano.Wallet.DB.Store.UTxOHistory.Store import Prelude import Cardano.Wallet.DB.Sqlite.Schema - ( DeltaUTxOSlots (..), DeltaUTxOValue (..), EntityField (..), Key (..) ) + ( DeltaUTxOSlots (..) + , DeltaUTxOValue (..) + , EntityField (..) + , Key (..) + ) import Cardano.Wallet.DB.Sqlite.Types - ( TxId (..), getTxId ) + ( TxId (..) + , getTxId + ) import Cardano.Wallet.DB.Store.UTxOHistory.Model ( DeltaUTxOHistory (..) , Pruned (..) @@ -24,30 +30,51 @@ import Cardano.Wallet.DB.Store.UTxOHistory.Model , reverseMapOfSets ) import Cardano.Wallet.DB.Store.UTxOHistory.Model.Internal - ( UTxOHistory (..) ) + ( UTxOHistory (..) + ) import Cardano.Wallet.DB.Store.UTxOHistory.TxOutCBOR - ( deserializeTxOut, serializeTxOut ) + ( deserializeTxOut + , serializeTxOut + ) import Cardano.Wallet.Primitive.Types - ( WalletId, WithOrigin (..) ) + ( WalletId + , WithOrigin (..) + ) import Cardano.Wallet.Primitive.Types.Tx.TxIn - ( TxIn (..) ) + ( TxIn (..) + ) import Cardano.Wallet.Primitive.Types.Tx.TxOut - ( TxOut ) + ( TxOut + ) import Cardano.Wallet.Primitive.Types.UTxO - ( DeltaUTxO (..), UTxO (..) ) + ( DeltaUTxO (..) + , UTxO (..) + ) import Control.Lens - ( lazy, strict, view, (<&>) ) + ( lazy + , strict + , view + , (<&>) + ) import Control.Monad.Class.MonadThrow - ( throwIO ) + ( throwIO + ) import Data.ByteString - ( ByteString ) + ( ByteString + ) import Data.Either.Extra import Data.Foldable - ( foldl', forM_ ) + ( foldl' + , forM_ + ) import Data.Maybe - ( maybeToList ) + ( maybeToList + ) import Data.Store - ( UpdateStore, mkUpdateStore, updateLoad ) + ( UpdateStore + , mkUpdateStore + , updateLoad + ) import Database.Persist.Sql ( PersistQueryWrite (deleteWhere) , SqlPersistT @@ -64,9 +91,12 @@ import Database.Persist.Sql , (>.) ) import GHC.Exception - ( Exception, SomeException ) + ( Exception + , SomeException + ) import GHC.Exception.Type - ( toException ) + ( toException + ) import qualified Data.Map.Strict as Map import qualified Data.Set as Set diff --git a/lib/wallet/src/Cardano/Wallet/DB/Store/UTxOHistory/TxOutCBOR.hs b/lib/wallet/src/Cardano/Wallet/DB/Store/UTxOHistory/TxOutCBOR.hs index 66bc95114a7..b7d0c2389d8 100644 --- a/lib/wallet/src/Cardano/Wallet/DB/Store/UTxOHistory/TxOutCBOR.hs +++ b/lib/wallet/src/Cardano/Wallet/DB/Store/UTxOHistory/TxOutCBOR.hs @@ -7,37 +7,62 @@ where import Prelude import Cardano.Wallet.Primitive.Types.Address - ( Address (..) ) + ( Address (..) + ) import Cardano.Wallet.Primitive.Types.Coin - ( Coin (..) ) + ( Coin (..) + ) import Cardano.Wallet.Primitive.Types.Hash - ( Hash (..) ) + ( Hash (..) + ) import Cardano.Wallet.Primitive.Types.TokenBundle - ( TokenBundle (TokenBundle) ) + ( TokenBundle (TokenBundle) + ) import Cardano.Wallet.Primitive.Types.TokenMap - ( AssetId (AssetId), fromFlatList, toFlatList ) + ( AssetId (AssetId) + , fromFlatList + , toFlatList + ) import Cardano.Wallet.Primitive.Types.TokenPolicy - ( TokenName (UnsafeTokenName), TokenPolicyId (UnsafeTokenPolicyId) ) + ( TokenName (UnsafeTokenName) + , TokenPolicyId (UnsafeTokenPolicyId) + ) import Cardano.Wallet.Primitive.Types.TokenQuantity - ( TokenQuantity (TokenQuantity) ) + ( TokenQuantity (TokenQuantity) + ) import Cardano.Wallet.Primitive.Types.Tx.TxOut - ( TxOut (TxOut) ) + ( TxOut (TxOut) + ) import Codec.CBOR.Decoding - ( Decoder, decodeBytes, decodeInteger, decodeListLen ) + ( Decoder + , decodeBytes + , decodeInteger + , decodeListLen + ) import Codec.CBOR.Encoding - ( Encoding, encodeBytes, encodeInteger, encodeListLen ) + ( Encoding + , encodeBytes + , encodeInteger + , encodeListLen + ) import Codec.CBOR.Read - ( deserialiseFromBytes ) + ( deserialiseFromBytes + ) import Codec.CBOR.Write - ( toLazyByteString ) + ( toLazyByteString + ) import Codec.Serialise - ( DeserialiseFailure ) + ( DeserialiseFailure + ) import Control.Exception - ( Exception ) + ( Exception + ) import Control.Monad - ( replicateM ) + ( replicateM + ) import Data.ByteString.Lazy - ( ByteString ) + ( ByteString + ) -- | Signal a failure to decode a 'TxOut' from a ByteString. data FailedDecodingDeltaUTxO diff --git a/lib/wallet/src/Cardano/Wallet/DB/Store/WalletState/Store.hs b/lib/wallet/src/Cardano/Wallet/DB/Store/WalletState/Store.hs index d73ba140e5e..e5494493860 100644 --- a/lib/wallet/src/Cardano/Wallet/DB/Store/WalletState/Store.hs +++ b/lib/wallet/src/Cardano/Wallet/DB/Store/WalletState/Store.hs @@ -14,33 +14,55 @@ module Cardano.Wallet.DB.Store.WalletState.Store import Prelude import Cardano.Wallet.DB.Errors - ( ErrBadFormat (..) ) + ( ErrBadFormat (..) + ) import Cardano.Wallet.DB.Store.Checkpoints.Store - ( PersistAddressBook (..), mkStoreCheckpoints ) + ( PersistAddressBook (..) + , mkStoreCheckpoints + ) import Cardano.Wallet.DB.Store.Delegations.Store - ( mkStoreDelegations ) + ( mkStoreDelegations + ) import Cardano.Wallet.DB.Store.Info.Store - ( mkStoreInfo ) + ( mkStoreInfo + ) import Cardano.Wallet.DB.Store.PrivateKey.Store - ( mkStorePrivateKey ) + ( mkStorePrivateKey + ) import Cardano.Wallet.DB.Store.Rewards.Store - ( mkStoreRewards ) + ( mkStoreRewards + ) import Cardano.Wallet.DB.Store.Submissions.Operations - ( mkStoreSubmissions ) + ( mkStoreSubmissions + ) import Cardano.Wallet.DB.WalletState - ( DeltaWalletState, DeltaWalletState1 (..), WalletState (..) ) + ( DeltaWalletState + , DeltaWalletState1 (..) + , WalletState (..) + ) import Cardano.Wallet.Flavor - ( WalletFlavorS, keyOfWallet ) + ( WalletFlavorS + , keyOfWallet + ) import Control.Monad.Class.MonadThrow - ( throwIO ) + ( throwIO + ) import Data.Generics.Internal.VL.Lens - ( (^.) ) + ( (^.) + ) import Data.Store - ( Store (..), UpdateStore, mkUpdateStore, updateLoad, updateSequence ) + ( Store (..) + , UpdateStore + , mkUpdateStore + , updateLoad + , updateSequence + ) import Database.Persist.Sqlite - ( SqlPersistT ) + ( SqlPersistT + ) import UnliftIO.Exception - ( toException ) + ( toException + ) import qualified Cardano.Wallet.Primitive.Types as W diff --git a/lib/wallet/src/Cardano/Wallet/DB/Store/Wallets/Layer.hs b/lib/wallet/src/Cardano/Wallet/DB/Store/Wallets/Layer.hs index fff5c6c81ca..89e53ec122e 100644 --- a/lib/wallet/src/Cardano/Wallet/DB/Store/Wallets/Layer.hs +++ b/lib/wallet/src/Cardano/Wallet/DB/Store/Wallets/Layer.hs @@ -19,31 +19,50 @@ module Cardano.Wallet.DB.Store.Wallets.Layer import Prelude import Cardano.Slotting.Slot - ( SlotNo ) + ( SlotNo + ) import Cardano.Wallet.DB.Sqlite.Schema - ( CBOR, TxMeta (..) ) + ( CBOR + , TxMeta (..) + ) import Cardano.Wallet.DB.Sqlite.Types - ( TxId (..) ) + ( TxId (..) + ) import Cardano.Wallet.DB.Store.Meta.Layer - ( QueryTxMeta (..), mkQueryStoreTxMeta ) + ( QueryTxMeta (..) + , mkQueryStoreTxMeta + ) import Cardano.Wallet.DB.Store.Transactions.Layer - ( mkQueryStoreTxSet ) + ( mkQueryStoreTxSet + ) import Cardano.Wallet.DB.Store.Transactions.Model - ( TxRelation ) + ( TxRelation + ) import Cardano.Wallet.DB.Store.Wallets.Model - ( DeltaTxWalletsHistory (..), TxWalletsHistory ) + ( DeltaTxWalletsHistory (..) + , TxWalletsHistory + ) import Cardano.Wallet.DB.Store.Wallets.Store - ( mkStoreTxWalletsHistory ) + ( mkStoreTxWalletsHistory + ) import Cardano.Wallet.Primitive.Types - ( Range (..), SortOrder ) + ( Range (..) + , SortOrder + ) import Data.Store - ( Query (..), Store (..), mkQueryStore ) + ( Query (..) + , Store (..) + , mkQueryStore + ) import Data.Word - ( Word32 ) + ( Word32 + ) import Database.Persist.Sql - ( SqlPersistT ) + ( SqlPersistT + ) import GHC.Natural - ( Natural ) + ( Natural + ) import qualified Cardano.Wallet.DB.Store.Transactions.Layer as TxSet import qualified Cardano.Wallet.Primitive.Types.Tx.TxOut as W diff --git a/lib/wallet/src/Cardano/Wallet/DB/Store/Wallets/Model.hs b/lib/wallet/src/Cardano/Wallet/DB/Store/Wallets/Model.hs index 0bbc0072090..cf14182e526 100644 --- a/lib/wallet/src/Cardano/Wallet/DB/Store/Wallets/Model.hs +++ b/lib/wallet/src/Cardano/Wallet/DB/Store/Wallets/Model.hs @@ -19,13 +19,20 @@ module Cardano.Wallet.DB.Store.Wallets.Model import Prelude import Cardano.Wallet.DB.Store.Meta.Model - ( TxMetaHistory, mkTxMetaHistory ) + ( TxMetaHistory + , mkTxMetaHistory + ) import Cardano.Wallet.DB.Store.Transactions.Model - ( TxSet (..), mkTxSet ) + ( TxSet (..) + , mkTxSet + ) import Data.Delta - ( Delta (..) ) + ( Delta (..) + ) import Fmt - ( Buildable, build ) + ( Buildable + , build + ) import qualified Cardano.Wallet.DB.Store.Meta.Model as TxMetaStore import qualified Cardano.Wallet.DB.Store.Transactions.Model as TxStore diff --git a/lib/wallet/src/Cardano/Wallet/DB/Store/Wallets/Store.hs b/lib/wallet/src/Cardano/Wallet/DB/Store/Wallets/Store.hs index ab2e891410c..9d0b28cefc6 100644 --- a/lib/wallet/src/Cardano/Wallet/DB/Store/Wallets/Store.hs +++ b/lib/wallet/src/Cardano/Wallet/DB/Store/Wallets/Store.hs @@ -20,19 +20,30 @@ module Cardano.Wallet.DB.Store.Wallets.Store import Prelude import Cardano.Wallet.DB.Store.Meta.Layer - ( QueryTxMeta (..) ) + ( QueryTxMeta (..) + ) import Cardano.Wallet.DB.Store.Meta.Model - ( DeltaTxMetaHistory, mkTxMetaHistory ) + ( DeltaTxMetaHistory + , mkTxMetaHistory + ) import Cardano.Wallet.DB.Store.Transactions.Model - ( DeltaTxSet (..), mkTxSet ) + ( DeltaTxSet (..) + , mkTxSet + ) import Cardano.Wallet.DB.Store.Wallets.Model - ( DeltaTxWalletsHistory (..) ) + ( DeltaTxWalletsHistory (..) + ) import Control.Applicative - ( liftA2 ) + ( liftA2 + ) import Data.Store - ( Store (..), UpdateStore, mkUpdateStore ) + ( Store (..) + , UpdateStore + , mkUpdateStore + ) import Database.Persist.Sql - ( SqlPersistT ) + ( SqlPersistT + ) import qualified Cardano.Wallet.DB.Store.Meta.Model as TxMetaStore diff --git a/lib/wallet/src/Cardano/Wallet/DB/WalletState.hs b/lib/wallet/src/Cardano/Wallet/DB/WalletState.hs index 9104f683ff0..ec403eace6a 100644 --- a/lib/wallet/src/Cardano/Wallet/DB/WalletState.hs +++ b/lib/wallet/src/Cardano/Wallet/DB/WalletState.hs @@ -45,47 +45,78 @@ module Cardano.Wallet.DB.WalletState import Prelude import Cardano.Address.Derivation - ( XPrv ) + ( XPrv + ) import Cardano.Wallet.Address.Book - ( AddressBookIso (..), Discoveries, Prologue ) + ( AddressBookIso (..) + , Discoveries + , Prologue + ) import Cardano.Wallet.Address.Derivation - ( Depth (RootK) ) + ( Depth (RootK) + ) import Cardano.Wallet.Checkpoints - ( Checkpoints ) + ( Checkpoints + ) import Cardano.Wallet.DB.Store.Delegations.Model - ( Delegations, DeltaDelegations ) + ( Delegations + , DeltaDelegations + ) import Cardano.Wallet.DB.Store.Info.Store - ( DeltaWalletInfo, WalletInfo (..) ) + ( DeltaWalletInfo + , WalletInfo (..) + ) import Cardano.Wallet.DB.Store.PrivateKey.Store - ( DeltaPrivateKey ) + ( DeltaPrivateKey + ) import Cardano.Wallet.DB.Store.Submissions.Layer - ( emptyTxSubmissions ) + ( emptyTxSubmissions + ) import Cardano.Wallet.DB.Store.Submissions.Operations - ( DeltaTxSubmissions, TxSubmissions ) + ( DeltaTxSubmissions + , TxSubmissions + ) import Cardano.Wallet.Flavor - ( KeyOf ) + ( KeyOf + ) import Cardano.Wallet.Primitive.Types - ( BlockHeader ) + ( BlockHeader + ) import Cardano.Wallet.Primitive.Types.Coin - ( Coin ) + ( Coin + ) import Cardano.Wallet.Primitive.Types.Credentials - ( HashedCredentials ) + ( HashedCredentials + ) import Cardano.Wallet.Primitive.Types.UTxO - ( UTxO ) + ( UTxO + ) import Data.Delta - ( Delta (..), Replace (..) ) + ( Delta (..) + , Replace (..) + ) import Data.Delta.Update - ( Update, updateField ) + ( Update + , updateField + ) import Data.Generics.Internal.VL - ( withIso ) + ( withIso + ) import Data.Generics.Internal.VL.Lens - ( over, view, (^.) ) + ( over + , view + , (^.) + ) import Data.Word - ( Word32 ) + ( Word32 + ) import Fmt - ( Buildable (..), pretty ) + ( Buildable (..) + , pretty + ) import GHC.Generics - ( Generic ) + ( Generic + ) import qualified Cardano.Wallet.Checkpoints as CPS import qualified Cardano.Wallet.Primitive.Model as W diff --git a/lib/wallet/src/Cardano/Wallet/Delegation.hs b/lib/wallet/src/Cardano/Wallet/Delegation.hs index ab44fc4bc20..0ab08ab4846 100644 --- a/lib/wallet/src/Cardano/Wallet/Delegation.hs +++ b/lib/wallet/src/Cardano/Wallet/Delegation.hs @@ -25,7 +25,8 @@ import qualified Cardano.Wallet.Transaction as Tx import qualified Data.Set as Set import Cardano.Pool.Types - ( PoolId (..) ) + ( PoolId (..) + ) import Cardano.Wallet ( ErrCannotQuit (..) , ErrStakePoolDelegation (..) @@ -40,21 +41,32 @@ import Cardano.Wallet , transactionExpirySlot ) import Cardano.Wallet.Address.Derivation.Shelley - ( ShelleyKey (..) ) + ( ShelleyKey (..) + ) import Cardano.Wallet.Address.Discovery.Sequential - ( SeqState (..) ) + ( SeqState (..) + ) import Cardano.Wallet.DB - ( DBLayer (..) ) + ( DBLayer (..) + ) import Cardano.Wallet.DB.Store.Delegations.Layer - ( CurrentEpochSlotting ) + ( CurrentEpochSlotting + ) import Cardano.Wallet.Network - ( NetworkLayer (..) ) + ( NetworkLayer (..) + ) import Cardano.Wallet.Primitive.Slotting - ( PastHorizonException, TimeInterpreter ) + ( PastHorizonException + , TimeInterpreter + ) import Cardano.Wallet.Primitive.Types - ( IsDelegatingTo (..), PoolLifeCycleStatus, WalletDelegation (..) ) + ( IsDelegatingTo (..) + , PoolLifeCycleStatus + , WalletDelegation (..) + ) import Cardano.Wallet.Primitive.Types.Coin - ( Coin (..) ) + ( Coin (..) + ) import Cardano.Wallet.Transaction ( ErrCannotJoin (..) , TransactionCtx @@ -65,23 +77,38 @@ import Cardano.Wallet.Transaction , txWithdrawal ) import Control.Error - ( lastMay ) + ( lastMay + ) import Control.Exception - ( throwIO ) + ( throwIO + ) import Control.Monad - ( forM_, unless, when, (>=>) ) + ( forM_ + , unless + , when + , (>=>) + ) import Control.Monad.Except - ( ExceptT, runExceptT ) + ( ExceptT + , runExceptT + ) import Control.Monad.IO.Class - ( MonadIO (..) ) + ( MonadIO (..) + ) import Control.Monad.Trans.Except - ( except ) + ( except + ) import Control.Tracer - ( Tracer, traceWith ) + ( Tracer + , traceWith + ) import Data.Generics.Internal.VL.Lens - ( view, (^.) ) + ( view + , (^.) + ) import Data.Set - ( Set ) + ( Set + ) -- | The data type that represents client's delegation request. -- Stake key registration is made implicit by design: diff --git a/lib/wallet/src/Cardano/Wallet/Delegation/Model.hs b/lib/wallet/src/Cardano/Wallet/Delegation/Model.hs index cc348f05752..e287ec63eed 100644 --- a/lib/wallet/src/Cardano/Wallet/Delegation/Model.hs +++ b/lib/wallet/src/Cardano/Wallet/Delegation/Model.hs @@ -16,11 +16,14 @@ module Cardano.Wallet.Delegation.Model import Prelude import Data.Delta - ( Delta (..) ) + ( Delta (..) + ) import Data.Function - ( (&) ) + ( (&) + ) import Data.Map.Strict - ( Map ) + ( Map + ) import qualified Data.Map.Strict as Map diff --git a/lib/wallet/src/Cardano/Wallet/Delegation/Properties.hs b/lib/wallet/src/Cardano/Wallet/Delegation/Properties.hs index 42ad9f7b9fc..d2999b35349 100644 --- a/lib/wallet/src/Cardano/Wallet/Delegation/Properties.hs +++ b/lib/wallet/src/Cardano/Wallet/Delegation/Properties.hs @@ -17,9 +17,19 @@ where import Prelude import Cardano.Wallet.Delegation.Model - ( History, Operation (..), Status (..), slotOf, status ) + ( History + , Operation (..) + , Status (..) + , slotOf + , status + ) import Test.QuickCheck - ( Gen, Property, counterexample, forAll, (===) ) + ( Gen + , Property + , counterexample + , forAll + , (===) + ) -- | A step of the history, with both states and the change to compute -- new from old. diff --git a/lib/wallet/src/Cardano/Wallet/Flavor.hs b/lib/wallet/src/Cardano/Wallet/Flavor.hs index fb05cfd3ac7..5ee7a1d2117 100644 --- a/lib/wallet/src/Cardano/Wallet/Flavor.hs +++ b/lib/wallet/src/Cardano/Wallet/Flavor.hs @@ -41,31 +41,47 @@ where import Prelude import Cardano.Wallet.Address.Derivation.Byron - ( ByronKey ) + ( ByronKey + ) import Cardano.Wallet.Address.Derivation.Icarus - ( IcarusKey (..) ) + ( IcarusKey (..) + ) import Cardano.Wallet.Address.Derivation.SharedKey - ( SharedKey ) + ( SharedKey + ) import Cardano.Wallet.Address.Derivation.Shelley - ( ShelleyKey ) + ( ShelleyKey + ) import Cardano.Wallet.Address.Discovery.Random - ( RndState (..) ) + ( RndState (..) + ) import Cardano.Wallet.Address.Discovery.RandomAny - ( RndAnyState ) + ( RndAnyState + ) import Cardano.Wallet.Address.Discovery.Sequential - ( SeqState ) + ( SeqState + ) import Cardano.Wallet.Address.Discovery.SequentialAny - ( SeqAnyState ) + ( SeqAnyState + ) import Cardano.Wallet.Address.Discovery.Shared - ( SharedState (..) ) + ( SharedState (..) + ) import Cardano.Wallet.Address.States.Families - ( CredFromOf, KeyOf, NetworkOf ) + ( CredFromOf + , KeyOf + , NetworkOf + ) import Cardano.Wallet.Address.States.Features - ( TestFeatures ) + ( TestFeatures + ) import Cardano.Wallet.Address.States.Test.State - ( TestState ) + ( TestState + ) import Cardano.Wallet.TypeLevel - ( Excluding, Including ) + ( Excluding + , Including + ) -- | A singleton type to capture the flavor of a state. data WalletFlavorS s where diff --git a/lib/wallet/src/Cardano/Wallet/Gen.hs b/lib/wallet/src/Cardano/Wallet/Gen.hs index 05d1720187d..37f1d852998 100644 --- a/lib/wallet/src/Cardano/Wallet/Gen.hs +++ b/lib/wallet/src/Cardano/Wallet/Gen.hs @@ -30,13 +30,23 @@ module Cardano.Wallet.Gen import Prelude import Cardano.Address.Derivation - ( XPub, xpubFromBytes ) + ( XPub + , xpubFromBytes + ) import Cardano.Address.Script - ( Cosigner (..), Script (..), ScriptTemplate (..) ) + ( Cosigner (..) + , Script (..) + , ScriptTemplate (..) + ) import Cardano.Mnemonic - ( ConsistentEntropy, EntropySize, Mnemonic, entropyToMnemonic ) + ( ConsistentEntropy + , EntropySize + , Mnemonic + , entropyToMnemonic + ) import Cardano.Wallet.Address.Discovery.Shared - ( retrieveAllCosigners ) + ( retrieveAllCosigners + ) import Cardano.Wallet.Primitive.Types ( ActiveSlotCoefficient (..) , BlockHeader (..) @@ -47,31 +57,49 @@ import Cardano.Wallet.Primitive.Types , WithOrigin (..) ) import Cardano.Wallet.Primitive.Types.Address - ( Address (..) ) + ( Address (..) + ) import Cardano.Wallet.Primitive.Types.Hash - ( Hash (..) ) + ( Hash (..) + ) import Cardano.Wallet.Primitive.Types.ProtocolMagic - ( ProtocolMagic (..) ) + ( ProtocolMagic (..) + ) import Cardano.Wallet.Unsafe - ( unsafeFromHex, unsafeMkEntropy, unsafeMkPercentage ) + ( unsafeFromHex + , unsafeMkEntropy + , unsafeMkPercentage + ) import Control.Monad - ( replicateM ) + ( replicateM + ) import Crypto.Hash - ( hash ) + ( hash + ) import Data.Maybe - ( fromMaybe ) + ( fromMaybe + ) import Data.Proxy - ( Proxy (..) ) + ( Proxy (..) + ) import Data.Quantity - ( Percentage (..), Quantity (..) ) + ( Percentage (..) + , Quantity (..) + ) import Data.Ratio - ( denominator, numerator, (%) ) + ( denominator + , numerator + , (%) + ) import Data.Word - ( Word32 ) + ( Word32 + ) import GHC.TypeLits - ( natVal ) + ( natVal + ) import Numeric.Natural - ( Natural ) + ( Natural + ) import Test.QuickCheck ( Arbitrary (..) , Gen diff --git a/lib/wallet/src/Cardano/Wallet/Network.hs b/lib/wallet/src/Cardano/Wallet/Network.hs index 93ba18b3ced..ab126c37760 100644 --- a/lib/wallet/src/Cardano/Wallet/Network.hs +++ b/lib/wallet/src/Cardano/Wallet/Network.hs @@ -38,21 +38,31 @@ module Cardano.Wallet.Network import Prelude import Cardano.Api - ( AnyCardanoEra ) + ( AnyCardanoEra + ) import Cardano.BM.Data.Severity - ( Severity (..) ) + ( Severity (..) + ) import Cardano.BM.Data.Tracer - ( HasPrivacyAnnotation (..), HasSeverityAnnotation (..) ) + ( HasPrivacyAnnotation (..) + , HasSeverityAnnotation (..) + ) import Cardano.Pool.Types - ( StakePoolsSummary ) + ( StakePoolsSummary + ) import Cardano.Wallet.Checkpoints.Policy - ( CheckpointPolicy ) + ( CheckpointPolicy + ) import Cardano.Wallet.Primitive.BlockSummary - ( LightSummary ) + ( LightSummary + ) import Cardano.Wallet.Primitive.Slotting - ( PastHorizonException, TimeInterpreter ) + ( PastHorizonException + , TimeInterpreter + ) import Cardano.Wallet.Primitive.SyncProgress - ( SyncProgress (..) ) + ( SyncProgress (..) + ) import Cardano.Wallet.Primitive.Types ( Block , BlockHeader (..) @@ -62,45 +72,73 @@ import Cardano.Wallet.Primitive.Types , SlottingParameters (..) ) import Cardano.Wallet.Primitive.Types.Coin - ( Coin ) + ( Coin + ) import Cardano.Wallet.Primitive.Types.RewardAccount - ( RewardAccount (..) ) + ( RewardAccount (..) + ) import Cardano.Wallet.Primitive.Types.Tx.SealedTx - ( SealedTx ) + ( SealedTx + ) import Control.Concurrent.Class.MonadSTM - ( atomically ) + ( atomically + ) import Control.Concurrent.Class.MonadSTM.Strict - ( StrictTMVar, newTMVarIO, putTMVar, takeTMVar ) + ( StrictTMVar + , newTMVarIO + , putTMVar + , takeTMVar + ) import Control.Monad.Trans.Except - ( ExceptT (..) ) + ( ExceptT (..) + ) import Control.Tracer - ( Tracer, contramapM, traceWith ) + ( Tracer + , contramapM + , traceWith + ) import Data.List.NonEmpty - ( NonEmpty (..) ) + ( NonEmpty (..) + ) import Data.Map - ( Map ) + ( Map + ) import Data.Set - ( Set ) + ( Set + ) import Data.Text - ( Text ) + ( Text + ) import Data.Text.Class - ( ToText (..) ) + ( ToText (..) + ) import Data.Time.Clock - ( UTCTime, diffUTCTime, getCurrentTime ) + ( UTCTime + , diffUTCTime + , getCurrentTime + ) import Fmt - ( pretty ) + ( pretty + ) import GHC.Generics - ( Generic ) + ( Generic + ) import NoThunks.Class - ( AllowThunksIn (..), NoThunks (..) ) + ( AllowThunksIn (..) + , NoThunks (..) + ) import Numeric.Natural - ( Natural ) + ( Natural + ) import Safe - ( headMay ) + ( headMay + ) import UnliftIO.Async - ( race_ ) + ( race_ + ) import UnliftIO.Concurrent - ( threadDelay ) + ( threadDelay + ) import qualified Data.List.NonEmpty as NE diff --git a/lib/wallet/src/Cardano/Wallet/Network/Config.hs b/lib/wallet/src/Cardano/Wallet/Network/Config.hs index c987e4c8595..ef854ae2c9c 100644 --- a/lib/wallet/src/Cardano/Wallet/Network/Config.hs +++ b/lib/wallet/src/Cardano/Wallet/Network/Config.hs @@ -23,17 +23,26 @@ module Cardano.Wallet.Network.Config import Prelude import Cardano.Chain.Genesis - ( GenesisData (..), readGenesisData ) + ( GenesisData (..) + , readGenesisData + ) import Cardano.Wallet.Primitive.NetworkId - ( NetworkId (..) ) + ( NetworkId (..) + ) import Cardano.Wallet.Primitive.Types - ( Block (..), NetworkParameters (..) ) + ( Block (..) + , NetworkParameters (..) + ) import Control.Monad.Trans.Except - ( ExceptT (..), withExceptT ) + ( ExceptT (..) + , withExceptT + ) import Ouroboros.Network.Magic - ( NetworkMagic (..) ) + ( NetworkMagic (..) + ) import Ouroboros.Network.NodeToClient - ( NodeToClientVersionData (..) ) + ( NodeToClientVersionData (..) + ) import qualified Cardano.Wallet.Byron.Compatibility as Byron import qualified Cardano.Wallet.Primitive.Types.ProtocolMagic as W diff --git a/lib/wallet/src/Cardano/Wallet/Network/Light.hs b/lib/wallet/src/Cardano/Wallet/Network/Light.hs index 3eeeb489f6d..1238a44d168 100644 --- a/lib/wallet/src/Cardano/Wallet/Network/Light.hs +++ b/lib/wallet/src/Cardano/Wallet/Network/Light.hs @@ -20,13 +20,18 @@ module Cardano.Wallet.Network.Light import Prelude import Cardano.BM.Data.Severity - ( Severity (..) ) + ( Severity (..) + ) import Cardano.BM.Data.Tracer - ( HasPrivacyAnnotation (..), HasSeverityAnnotation (..) ) + ( HasPrivacyAnnotation (..) + , HasSeverityAnnotation (..) + ) import Cardano.Wallet.Network - ( ChainFollower (..) ) + ( ChainFollower (..) + ) import Cardano.Wallet.Primitive.BlockSummary - ( BlockSummary (..) ) + ( BlockSummary (..) + ) import Cardano.Wallet.Primitive.Types ( BlockHeader (..) , ChainPoint (..) @@ -34,23 +39,35 @@ import Cardano.Wallet.Primitive.Types , compareSlot ) import Control.Monad.Class.MonadTimer - ( MonadDelay (..) ) + ( MonadDelay (..) + ) import Control.Tracer - ( Tracer, traceWith ) + ( Tracer + , traceWith + ) import Data.Functor - ( ($>) ) + ( ($>) + ) import Data.List - ( maximumBy, sortBy ) + ( maximumBy + , sortBy + ) import Data.List.NonEmpty - ( NonEmpty (..) ) + ( NonEmpty (..) + ) import Data.Text.Class - ( ToText (..) ) + ( ToText (..) + ) import Data.Void - ( Void ) + ( Void + ) import Fmt - ( Buildable (build), pretty ) + ( Buildable (build) + , pretty + ) import GHC.Generics - ( Generic ) + ( Generic + ) import qualified Data.Text as T diff --git a/lib/wallet/src/Cardano/Wallet/Pools.hs b/lib/wallet/src/Cardano/Wallet/Pools.hs index b3d704d319a..4b27a590bbc 100644 --- a/lib/wallet/src/Cardano/Wallet/Pools.hs +++ b/lib/wallet/src/Cardano/Wallet/Pools.hs @@ -43,13 +43,20 @@ module Cardano.Wallet.Pools import Prelude import Cardano.BM.Data.Severity - ( Severity (..) ) + ( Severity (..) + ) import Cardano.BM.Data.Tracer - ( HasPrivacyAnnotation (..), HasSeverityAnnotation (..) ) + ( HasPrivacyAnnotation (..) + , HasSeverityAnnotation (..) + ) import Cardano.Pool.DB - ( DBLayer (..), ErrPointAlreadyExists (..), readPoolLifeCycleStatus ) + ( DBLayer (..) + , ErrPointAlreadyExists (..) + , readPoolLifeCycleStatus + ) import Cardano.Pool.DB.Log - ( PoolDbLog ) + ( PoolDbLog + ) import Cardano.Pool.Metadata ( HealthCheckSMASH (..) , StakePoolMetadataFetchLog @@ -62,13 +69,22 @@ import Cardano.Pool.Metadata , toHealthCheckSMASH ) import Cardano.Pool.Metadata.Types - ( PoolMetadataGCStatus (..), StakePoolMetadata, StakePoolMetadataHash ) + ( PoolMetadataGCStatus (..) + , StakePoolMetadata + , StakePoolMetadataHash + ) import Cardano.Pool.Types - ( PoolId (..), StakePoolsSummary (..) ) + ( PoolId (..) + , StakePoolsSummary (..) + ) import Cardano.Wallet.Byron.Compatibility - ( toByronBlockHeader ) + ( toByronBlockHeader + ) import Cardano.Wallet.Network - ( ChainFollowLog (..), ChainFollower (..), NetworkLayer (..) ) + ( ChainFollowLog (..) + , ChainFollower (..) + , NetworkLayer (..) + ) import Cardano.Wallet.Primitive.Slotting ( PastHorizonException (..) , Qry @@ -101,9 +117,12 @@ import Cardano.Wallet.Primitive.Types , unSmashServer ) import Cardano.Wallet.Primitive.Types.Coin - ( Coin (..) ) + ( Coin (..) + ) import Cardano.Wallet.Registry - ( AfterThreadLog, traceAfterThread ) + ( AfterThreadLog + , traceAfterThread + ) import Cardano.Wallet.Shelley.Compatibility ( StandardCrypto , fromAllegraBlock @@ -120,83 +139,151 @@ import Cardano.Wallet.Shelley.Compatibility , toShelleyBlockHeader ) import Cardano.Wallet.Unsafe - ( unsafeMkPercentage ) + ( unsafeMkPercentage + ) import Control.DeepSeq - ( NFData ) + ( NFData + ) import Control.Monad - ( forM, forM_, forever, void, when, (>=>) ) + ( forM + , forM_ + , forever + , void + , when + , (>=>) + ) import Control.Monad.Cont - ( ContT (ContT) ) + ( ContT (ContT) + ) import Control.Monad.IO.Class - ( liftIO ) + ( liftIO + ) import Control.Monad.Trans.Class - ( lift ) + ( lift + ) import Control.Monad.Trans.Except - ( ExceptT (..), runExceptT ) + ( ExceptT (..) + , runExceptT + ) import Control.Monad.Trans.State - ( State, evalState, state ) + ( State + , evalState + , state + ) import Control.Retry - ( RetryStatus (..), constantDelay, retrying ) + ( RetryStatus (..) + , constantDelay + , retrying + ) import Control.Tracer - ( Tracer, contramap, traceWith ) + ( Tracer + , contramap + , traceWith + ) import Data.Bifunctor - ( first ) + ( first + ) import Data.Function - ( (&) ) + ( (&) + ) import Data.Generics.Internal.VL.Lens - ( view ) + ( view + ) import Data.List - ( nub, (\\) ) + ( nub + , (\\) + ) import Data.List.NonEmpty - ( NonEmpty (..) ) + ( NonEmpty (..) + ) import Data.Map - ( Map ) + ( Map + ) import Data.Map.Merge.Strict - ( dropMissing, traverseMissing, zipWithAMatched, zipWithMatched ) + ( dropMissing + , traverseMissing + , zipWithAMatched + , zipWithMatched + ) import Data.Maybe - ( fromMaybe, mapMaybe ) + ( fromMaybe + , mapMaybe + ) import Data.Ord - ( Down (..) ) + ( Down (..) + ) import Data.Quantity - ( Percentage (..), Quantity (..) ) + ( Percentage (..) + , Quantity (..) + ) import Data.Set - ( Set ) + ( Set + ) import Data.Text.Class - ( ToText (..) ) + ( ToText (..) + ) import Data.Time - ( UTCTime ) + ( UTCTime + ) import Data.Time.Clock.POSIX - ( getPOSIXTime, posixDayLength ) + ( getPOSIXTime + , posixDayLength + ) import Data.Tuple.Extra - ( dupe ) + ( dupe + ) import Data.Void - ( Void ) + ( Void + ) import Data.Word - ( Word64 ) + ( Word64 + ) import Fmt - ( fixedF, pretty ) + ( fixedF + , pretty + ) import GHC.Generics - ( Generic ) + ( Generic + ) import Network.HTTP.Client - ( Manager ) + ( Manager + ) import Network.HTTP.Client.TLS - ( newTlsManager ) + ( newTlsManager + ) import Numeric.Natural - ( Natural ) + ( Natural + ) import Ouroboros.Consensus.Cardano.Block - ( CardanoBlock, HardForkBlock (..) ) + ( CardanoBlock + , HardForkBlock (..) + ) import System.Exit - ( ExitCode ) + ( ExitCode + ) import System.Random - ( RandomGen, random ) + ( RandomGen + , random + ) import UnliftIO.Concurrent - ( forkFinally, forkIOWithUnmask, killThread, threadDelay ) + ( forkFinally + , forkIOWithUnmask + , killThread + , threadDelay + ) import UnliftIO.Exception - ( finally ) + ( finally + ) import UnliftIO.IORef - ( IORef, newIORef, readIORef, writeIORef ) + ( IORef + , newIORef + , readIORef + , writeIORef + ) import UnliftIO.MVar - ( modifyMVar_, newMVar ) + ( modifyMVar_ + , newMVar + ) import UnliftIO.STM ( TBQueue , TVar diff --git a/lib/wallet/src/Cardano/Wallet/Primitive/BlockSummary.hs b/lib/wallet/src/Cardano/Wallet/Primitive/BlockSummary.hs index e918b49e1b2..19694ecd2c7 100644 --- a/lib/wallet/src/Cardano/Wallet/Primitive/BlockSummary.hs +++ b/lib/wallet/src/Cardano/Wallet/Primitive/BlockSummary.hs @@ -49,29 +49,41 @@ import Cardano.Wallet.Primitive.Types , toSlot ) import Cardano.Wallet.Primitive.Types.Address - ( Address ) + ( Address + ) import Cardano.Wallet.Primitive.Types.RewardAccount - ( RewardAccount ) + ( RewardAccount + ) import Cardano.Wallet.Primitive.Types.Tx - ( Tx (..) ) + ( Tx (..) + ) import Cardano.Wallet.Primitive.Types.Tx.TxOut - ( TxOut (..) ) + ( TxOut (..) + ) import Data.Foldable - ( Foldable (toList) ) + ( Foldable (toList) + ) import Data.Functor.Identity - ( Identity (..) ) + ( Identity (..) + ) import Data.List.NonEmpty - ( NonEmpty (..) ) + ( NonEmpty (..) + ) import Data.Map - ( Map ) + ( Map + ) import Data.Quantity - ( Quantity ) + ( Quantity + ) import Data.Word - ( Word32 ) + ( Word32 + ) import GHC.Generics - ( Generic ) + ( Generic + ) import Numeric.Natural - ( Natural ) + ( Natural + ) import qualified Cardano.Wallet.Primitive.Types as Block import qualified Data.List.NonEmpty as NE diff --git a/lib/wallet/src/Cardano/Wallet/Primitive/Delegation/State.hs b/lib/wallet/src/Cardano/Wallet/Primitive/Delegation/State.hs index ae5230c4978..f230c1d5ef0 100644 --- a/lib/wallet/src/Cardano/Wallet/Primitive/Delegation/State.hs +++ b/lib/wallet/src/Cardano/Wallet/Primitive/Delegation/State.hs @@ -39,7 +39,8 @@ module Cardano.Wallet.Primitive.Delegation.State import Prelude import Cardano.Crypto.Wallet - ( XPub ) + ( XPub + ) import Cardano.Wallet.Address.Derivation ( Depth (..) , DerivationType (..) @@ -51,25 +52,35 @@ import Cardano.Wallet.Address.Derivation , ToRewardAccount (..) ) import Cardano.Wallet.Primitive.Types.Address - ( Address ) + ( Address + ) import Cardano.Wallet.Primitive.Types.Coin - ( Coin (..) ) + ( Coin (..) + ) import Cardano.Wallet.Primitive.Types.Hash - ( Hash (..) ) + ( Hash (..) + ) import Cardano.Wallet.Primitive.Types.RewardAccount - ( RewardAccount ) + ( RewardAccount + ) import Cardano.Wallet.Primitive.Types.Tx.TxIn - ( TxIn (..) ) + ( TxIn (..) + ) import Cardano.Wallet.Primitive.Types.Tx.TxOut - ( TxOut (..) ) + ( TxOut (..) + ) import Control.DeepSeq - ( NFData ) + ( NFData + ) import Data.Maybe - ( maybeToList ) + ( maybeToList + ) import GHC.Generics - ( Generic ) + ( Generic + ) import Quiet - ( Quiet (..) ) + ( Quiet (..) + ) import qualified Cardano.Wallet.Primitive.Types.TokenBundle as TB diff --git a/lib/wallet/src/Cardano/Wallet/Primitive/Delegation/UTxO.hs b/lib/wallet/src/Cardano/Wallet/Primitive/Delegation/UTxO.hs index 5c2e73c7b04..108aee98d37 100644 --- a/lib/wallet/src/Cardano/Wallet/Primitive/Delegation/UTxO.hs +++ b/lib/wallet/src/Cardano/Wallet/Primitive/Delegation/UTxO.hs @@ -5,17 +5,23 @@ module Cardano.Wallet.Primitive.Delegation.UTxO import Prelude import Cardano.Wallet.Primitive.Types.Address - ( Address (..) ) + ( Address (..) + ) import Cardano.Wallet.Primitive.Types.Coin - ( Coin ) + ( Coin + ) import Cardano.Wallet.Primitive.Types.RewardAccount - ( RewardAccount (..) ) + ( RewardAccount (..) + ) import Cardano.Wallet.Primitive.Types.Tx.TxOut - ( TxOut (..) ) + ( TxOut (..) + ) import Cardano.Wallet.Primitive.Types.UTxO - ( UTxO (..) ) + ( UTxO (..) + ) import Data.Map - ( Map ) + ( Map + ) import qualified Cardano.Wallet.Primitive.Types.TokenBundle as TokenBundle import qualified Data.Map as Map diff --git a/lib/wallet/src/Cardano/Wallet/Primitive/Model.hs b/lib/wallet/src/Cardano/Wallet/Primitive/Model.hs index f24663f8972..e35ea34cf81 100644 --- a/lib/wallet/src/Cardano/Wallet/Primitive/Model.hs +++ b/lib/wallet/src/Cardano/Wallet/Primitive/Model.hs @@ -73,7 +73,8 @@ module Cardano.Wallet.Primitive.Model import Prelude import Cardano.Wallet.Address.Discovery - ( IsOurs (..) ) + ( IsOurs (..) + ) import Cardano.Wallet.Primitive.BlockSummary ( BlockEvents (..) , BlockSummary (..) @@ -93,54 +94,94 @@ import Cardano.Wallet.Primitive.Types , toSlot ) import Cardano.Wallet.Primitive.Types.Address - ( Address (..) ) + ( Address (..) + ) import Cardano.Wallet.Primitive.Types.Coin - ( Coin (..), distance ) + ( Coin (..) + , distance + ) import Cardano.Wallet.Primitive.Types.RewardAccount - ( RewardAccount (..) ) + ( RewardAccount (..) + ) import Cardano.Wallet.Primitive.Types.TokenBundle - ( TokenBundle ) + ( TokenBundle + ) import Cardano.Wallet.Primitive.Types.Tx - ( Tx (..), collateralInputs, inputs, txScriptInvalid ) + ( Tx (..) + , collateralInputs + , inputs + , txScriptInvalid + ) import Cardano.Wallet.Primitive.Types.Tx.TxIn - ( TxIn (..) ) + ( TxIn (..) + ) import Cardano.Wallet.Primitive.Types.Tx.TxMeta - ( Direction (..), TxMeta (..), TxStatus (..) ) + ( Direction (..) + , TxMeta (..) + , TxStatus (..) + ) import Cardano.Wallet.Primitive.Types.UTxO - ( DeltaUTxO, UTxO (..), balance, excluding, excludingD, receiveD ) + ( DeltaUTxO + , UTxO (..) + , balance + , excluding + , excludingD + , receiveD + ) import Control.Applicative - ( (<|>) ) + ( (<|>) + ) import Control.DeepSeq - ( NFData (..), deepseq ) + ( NFData (..) + , deepseq + ) import Control.Monad.Trans.State.Strict - ( State, evalState, state ) + ( State + , evalState + , state + ) import Data.Bifunctor - ( first ) + ( first + ) import Data.Delta - ( Delta (..) ) + ( Delta (..) + ) import Data.Foldable - ( Foldable (toList) ) + ( Foldable (toList) + ) import Data.Functor.Identity - ( Identity (..) ) + ( Identity (..) + ) import Data.Generics.Internal.VL.Lens - ( (^.) ) + ( (^.) + ) import Data.List.NonEmpty - ( NonEmpty (..) ) + ( NonEmpty (..) + ) import Data.Maybe - ( fromMaybe, isJust ) + ( fromMaybe + , isJust + ) import Data.Quantity - ( Quantity ) + ( Quantity + ) import Data.Set - ( Set ) + ( Set + ) import Data.Word - ( Word32 ) + ( Word32 + ) import Fmt - ( Buildable (..), indentF ) + ( Buildable (..) + , indentF + ) import GHC.Generics - ( Generic ) + ( Generic + ) import Cardano.Wallet.Address.MaybeLight - ( DiscoverTxs (discoverTxs) ) + ( DiscoverTxs (discoverTxs) + ) import qualified Cardano.Wallet.Primitive.Types.TokenBundle as TB import qualified Cardano.Wallet.Primitive.Types.Tx.TxOut as TxOut import qualified Cardano.Wallet.Primitive.Types.UTxO as UTxO diff --git a/lib/wallet/src/Cardano/Wallet/Primitive/Slotting.hs b/lib/wallet/src/Cardano/Wallet/Primitive/Slotting.hs index 3a7116f96ba..a2689621489 100644 --- a/lib/wallet/src/Cardano/Wallet/Primitive/Slotting.hs +++ b/lib/wallet/src/Cardano/Wallet/Primitive/Slotting.hs @@ -72,11 +72,15 @@ module Cardano.Wallet.Primitive.Slotting import Prelude import Cardano.BM.Data.Severity - ( Severity (..) ) + ( Severity (..) + ) import Cardano.BM.Data.Tracer - ( HasSeverityAnnotation (..) ) + ( HasSeverityAnnotation (..) + ) import Cardano.Slotting.EpochInfo.API - ( EpochInfo, hoistEpochInfo ) + ( EpochInfo + , hoistEpochInfo + ) import Cardano.Wallet.Orphans () import Cardano.Wallet.Primitive.Types @@ -91,43 +95,85 @@ import Cardano.Wallet.Primitive.Types , StartTime (..) ) import Control.Monad - ( ap, join, liftM, (>=>) ) + ( ap + , join + , liftM + , (>=>) + ) import Control.Monad.IO.Class - ( MonadIO, liftIO ) + ( MonadIO + , liftIO + ) import Control.Monad.Trans.Class - ( lift ) + ( lift + ) import Control.Monad.Trans.Except - ( ExceptT (..), runExcept, runExceptT ) + ( ExceptT (..) + , runExcept + , runExceptT + ) import Control.Tracer - ( Tracer, contramap, natTracer, nullTracer, traceWith ) + ( Tracer + , contramap + , natTracer + , nullTracer + , traceWith + ) import Data.Coerce - ( coerce ) + ( coerce + ) import Data.Functor.Identity - ( Identity ) + ( Identity + ) import Data.Generics.Internal.VL.Lens - ( (^.) ) + ( (^.) + ) import Data.Kind - ( Type ) + ( Type + ) import Data.Maybe - ( fromMaybe ) + ( fromMaybe + ) import Data.Text - ( Text ) + ( Text + ) import Data.Text.Class - ( ToText (..) ) + ( ToText (..) + ) import Data.Time.Clock - ( NominalDiffTime, UTCTime, addUTCTime, getCurrentTime ) + ( NominalDiffTime + , UTCTime + , addUTCTime + , getCurrentTime + ) import Data.Word - ( Word32, Word64 ) + ( Word32 + , Word64 + ) import Fmt - ( blockListF', build, fmt, indentF ) + ( blockListF' + , build + , fmt + , indentF + ) import GHC.Stack - ( CallStack, HasCallStack, getCallStack, prettySrcLoc ) + ( CallStack + , HasCallStack + , getCallStack + , prettySrcLoc + ) import Internal.Cardano.Write.Tx.TimeTranslation - ( TimeTranslation, timeTranslationFromEpochInfo ) + ( TimeTranslation + , timeTranslationFromEpochInfo + ) import Ouroboros.Consensus.BlockchainTime.WallClock.Types - ( RelativeTime (..), SystemStart (SystemStart), addRelTime ) + ( RelativeTime (..) + , SystemStart (SystemStart) + , addRelTime + ) import Ouroboros.Consensus.HardFork.History.EpochInfo - ( interpreterToEpochInfo ) + ( interpreterToEpochInfo + ) import Ouroboros.Consensus.HardFork.History.Qry ( Expr (..) , Interpreter @@ -140,9 +186,11 @@ import Ouroboros.Consensus.HardFork.History.Qry , wallclockToSlot ) import Ouroboros.Consensus.HardFork.History.Summary - ( neverForksSummary ) + ( neverForksSummary + ) import UnliftIO.Exception - ( throwIO ) + ( throwIO + ) import qualified Cardano.Slotting.Slot as Cardano import qualified Data.Text as T diff --git a/lib/wallet/src/Cardano/Wallet/Primitive/SyncProgress.hs b/lib/wallet/src/Cardano/Wallet/Primitive/SyncProgress.hs index 164bc316369..e514f8aa455 100644 --- a/lib/wallet/src/Cardano/Wallet/Primitive/SyncProgress.hs +++ b/lib/wallet/src/Cardano/Wallet/Primitive/SyncProgress.hs @@ -20,33 +20,55 @@ module Cardano.Wallet.Primitive.SyncProgress import Prelude import Cardano.Wallet.Primitive.Slotting - ( TimeInterpreter, interpretQuery, slotToRelTime ) + ( TimeInterpreter + , interpretQuery + , slotToRelTime + ) import Cardano.Wallet.Primitive.Types - ( SlotNo (..) ) + ( SlotNo (..) + ) import Control.DeepSeq - ( NFData (..) ) + ( NFData (..) + ) import Data.Bifunctor - ( bimap ) + ( bimap + ) import Data.Either - ( fromRight ) + ( fromRight + ) import Data.Quantity - ( Percentage (..), Quantity (..), mkPercentage ) + ( Percentage (..) + , Quantity (..) + , mkPercentage + ) import Data.Ratio - ( (%) ) + ( (%) + ) import Data.Text.Class - ( FromText (..), TextDecodingError (..), ToText (..) ) + ( FromText (..) + , TextDecodingError (..) + , ToText (..) + ) import Data.Time.Clock - ( NominalDiffTime ) + ( NominalDiffTime + ) import Fmt - ( Buildable, build ) + ( Buildable + , build + ) import GHC.Generics - ( Generic ) + ( Generic + ) import GHC.Stack - ( HasCallStack ) + ( HasCallStack + ) import NoThunks.Class - ( NoThunks (..) ) + ( NoThunks (..) + ) import Ouroboros.Consensus.BlockchainTime.WallClock.Types - ( RelativeTime (..), diffRelTime ) + ( RelativeTime (..) + , diffRelTime + ) data SyncProgress = Ready diff --git a/lib/wallet/src/Cardano/Wallet/Primitive/Types.hs b/lib/wallet/src/Cardano/Wallet/Primitive/Types.hs index 233c17d0294..c6d54574846 100644 --- a/lib/wallet/src/Cardano/Wallet/Primitive/Types.hs +++ b/lib/wallet/src/Cardano/Wallet/Primitive/Types.hs @@ -152,61 +152,109 @@ module Cardano.Wallet.Primitive.Types import Prelude import Cardano.Pool.Metadata.Types - ( StakePoolMetadataHash, StakePoolMetadataUrl ) + ( StakePoolMetadataHash + , StakePoolMetadataUrl + ) import Cardano.Pool.Types - ( PoolId, PoolOwner ) + ( PoolId + , PoolOwner + ) import Cardano.Slotting.Slot - ( SlotNo (..), WithOrigin (..) ) + ( SlotNo (..) + , WithOrigin (..) + ) import Cardano.Wallet.Orphans () import Cardano.Wallet.Primitive.Passphrase.Types - ( WalletPassphraseInfo (..) ) + ( WalletPassphraseInfo (..) + ) import Cardano.Wallet.Primitive.Types.Coin - ( Coin (..) ) + ( Coin (..) + ) import Cardano.Wallet.Primitive.Types.Hash - ( Hash (..) ) + ( Hash (..) + ) import Cardano.Wallet.Primitive.Types.RewardAccount - ( RewardAccount (..) ) + ( RewardAccount (..) + ) import Cardano.Wallet.Primitive.Types.Tx.Constraints - ( TxSize (..) ) + ( TxSize (..) + ) import Cardano.Wallet.Primitive.Types.Tx.Tx - ( Tx (..) ) + ( Tx (..) + ) import Cardano.Wallet.Util - ( ShowFmt (..), parseURI, uriToText ) + ( ShowFmt (..) + , parseURI + , uriToText + ) import Control.Arrow - ( left, right ) + ( left + , right + ) import Control.DeepSeq - ( NFData (..) ) + ( NFData (..) + ) import Control.Monad - ( (<=<), (>=>) ) + ( (<=<) + , (>=>) + ) import Crypto.Hash - ( Blake2b_160, Digest, digestFromByteString ) + ( Blake2b_160 + , Digest + , digestFromByteString + ) import Data.Aeson - ( FromJSON (..), ToJSON (..), Value, object, withObject, (.:), (.=) ) + ( FromJSON (..) + , ToJSON (..) + , Value + , object + , withObject + , (.:) + , (.=) + ) import Data.ByteArray - ( ByteArrayAccess ) + ( ByteArrayAccess + ) import Data.ByteArray.Encoding - ( Base (Base16), convertFromBase, convertToBase ) + ( Base (Base16) + , convertFromBase + , convertToBase + ) import Data.ByteString - ( ByteString ) + ( ByteString + ) import Data.Data - ( Proxy (..) ) + ( Proxy (..) + ) import Data.Generics.Internal.VL.Lens - ( set, view, (^.) ) + ( set + , view + , (^.) + ) import Data.Generics.Labels () import Data.Kind - ( Type ) + ( Type + ) import Data.Maybe - ( isJust, isNothing ) + ( isJust + , isNothing + ) import Data.Quantity - ( Percentage (..), Quantity (..), complementPercentage ) + ( Percentage (..) + , Quantity (..) + , complementPercentage + ) import Data.Scientific - ( fromRationalRepetendLimited ) + ( fromRationalRepetendLimited + ) import Data.String - ( fromString ) + ( fromString + ) import Data.Text - ( Text ) + ( Text + ) import Data.Text.Class ( CaseStyle (..) , FromText (..) @@ -216,21 +264,33 @@ import Data.Text.Class , toTextFromBoundedEnum ) import Data.Time.Clock - ( NominalDiffTime, UTCTime ) + ( NominalDiffTime + , UTCTime + ) import Data.Time.Clock.POSIX - ( POSIXTime ) + ( POSIXTime + ) import Data.Time.Format - ( defaultTimeLocale, formatTime ) + ( defaultTimeLocale + , formatTime + ) import Data.Word - ( Word16, Word32, Word64 ) + ( Word16 + , Word32 + , Word64 + ) import Data.Word.Odd - ( Word31 ) + ( Word31 + ) import Database.Persist.Class.PersistField - ( PersistField (fromPersistValue, toPersistValue) ) + ( PersistField (fromPersistValue, toPersistValue) + ) import Database.Persist.PersistValue.Extended - ( fromPersistValueRead ) + ( fromPersistValueRead + ) import Database.Persist.Sql - ( PersistFieldSql (sqlType) ) + ( PersistFieldSql (sqlType) + ) import Fmt ( Buildable (..) , blockListF @@ -242,19 +302,28 @@ import Fmt , suffixF ) import GHC.Generics - ( Generic ) + ( Generic + ) import GHC.Stack - ( HasCallStack ) + ( HasCallStack + ) import Internal.Cardano.Write.Tx - ( MaybeInRecentEra ) + ( MaybeInRecentEra + ) import Network.URI - ( URI (..), uriToString ) + ( URI (..) + , uriToString + ) import NoThunks.Class - ( NoThunks ) + ( NoThunks + ) import Numeric.Natural - ( Natural ) + ( Natural + ) import Test.QuickCheck - ( Arbitrary (..), oneof ) + ( Arbitrary (..) + , oneof + ) import qualified Data.Text as T import qualified Data.Text.Encoding as T diff --git a/lib/wallet/src/Cardano/Wallet/Primitive/Types/Address/Constants.hs b/lib/wallet/src/Cardano/Wallet/Primitive/Types/Address/Constants.hs index 74b0677096b..ec405c06795 100644 --- a/lib/wallet/src/Cardano/Wallet/Primitive/Types/Address/Constants.hs +++ b/lib/wallet/src/Cardano/Wallet/Primitive/Types/Address/Constants.hs @@ -14,13 +14,17 @@ module Cardano.Wallet.Primitive.Types.Address.Constants import Prelude import Cardano.Wallet.Address.Keys.BoundedAddressLength - ( maxLengthAddressFor ) + ( maxLengthAddressFor + ) import Cardano.Wallet.Flavor - ( KeyFlavorS (..) ) + ( KeyFlavorS (..) + ) import Cardano.Wallet.Primitive.Types.Address - ( Address (..) ) + ( Address (..) + ) import Data.Function - ( on ) + ( on + ) import qualified Data.ByteString as BS import qualified Data.List as L diff --git a/lib/wallet/src/Cardano/Wallet/Primitive/Types/Credentials.hs b/lib/wallet/src/Cardano/Wallet/Primitive/Types/Credentials.hs index ae883ce91f9..55e43857600 100644 --- a/lib/wallet/src/Cardano/Wallet/Primitive/Types/Credentials.hs +++ b/lib/wallet/src/Cardano/Wallet/Primitive/Types/Credentials.hs @@ -12,11 +12,15 @@ import Prelude import Cardano.Address.Derivation - ( XPrv ) + ( XPrv + ) import Cardano.Wallet.Address.Derivation - ( Depth (RootK) ) + ( Depth (RootK) + ) import Cardano.Wallet.Primitive.Passphrase.Types - ( Passphrase, PassphraseHash ) + ( Passphrase + , PassphraseHash + ) -- | A 'PrivateKey' for a given 'KeyFlavor'. data RootCredentials k pw = RootCredentials diff --git a/lib/wallet/src/Cardano/Wallet/Primitive/Types/StateDeltaSeq.hs b/lib/wallet/src/Cardano/Wallet/Primitive/Types/StateDeltaSeq.hs index 8221726ab6e..399c79f2336 100644 --- a/lib/wallet/src/Cardano/Wallet/Primitive/Types/StateDeltaSeq.hs +++ b/lib/wallet/src/Cardano/Wallet/Primitive/Types/StateDeltaSeq.hs @@ -97,30 +97,45 @@ module Cardano.Wallet.Primitive.Types.StateDeltaSeq ) where import Prelude hiding - ( head, iterate, seq, tail ) + ( head + , iterate + , seq + , tail + ) import Control.Applicative - ( ZipList (..) ) + ( ZipList (..) + ) import Control.Monad - ( foldM ) + ( foldM + ) import Control.Monad.Extra - ( allM ) + ( allM + ) import Control.Monad.Identity - ( Identity (..) ) + ( Identity (..) + ) import Data.Bifoldable - ( Bifoldable (..) ) + ( Bifoldable (..) + ) import Data.Bifunctor - ( Bifunctor (..) ) + ( Bifunctor (..) + ) import Data.Coerce - ( coerce ) + ( coerce + ) import Data.Function - ( on ) + ( on + ) import Data.Functor - ( (<&>) ) + ( (<&>) + ) import Data.List.NonEmpty - ( NonEmpty (..) ) + ( NonEmpty (..) + ) import Data.Sequence - ( Seq ((:<|), (:|>), Empty) ) + ( Seq ((:<|), (:|>), Empty) + ) import qualified Data.Foldable as F import qualified Data.List as L diff --git a/lib/wallet/src/Cardano/Wallet/Primitive/Types/Tx/TransactionInfo.hs b/lib/wallet/src/Cardano/Wallet/Primitive/Types/Tx/TransactionInfo.hs index 8fd857d5e02..2d4ad8dcbe4 100644 --- a/lib/wallet/src/Cardano/Wallet/Primitive/Types/Tx/TransactionInfo.hs +++ b/lib/wallet/src/Cardano/Wallet/Primitive/Types/Tx/TransactionInfo.hs @@ -25,33 +25,51 @@ module Cardano.Wallet.Primitive.Types.Tx.TransactionInfo import Prelude import Cardano.Wallet.Primitive.Types.Coin - ( Coin (..) ) + ( Coin (..) + ) import Cardano.Wallet.Primitive.Types.Hash - ( Hash (..) ) + ( Hash (..) + ) import Cardano.Wallet.Primitive.Types.RewardAccount - ( RewardAccount (..) ) + ( RewardAccount (..) + ) import Cardano.Wallet.Primitive.Types.Tx.Tx - ( Tx (..), TxMetadata, TxScriptValidity ) + ( Tx (..) + , TxMetadata + , TxScriptValidity + ) import Cardano.Wallet.Primitive.Types.Tx.TxIn - ( TxIn ) + ( TxIn + ) import Cardano.Wallet.Primitive.Types.Tx.TxMeta - ( TxMeta, TxStatus, status ) + ( TxMeta + , TxStatus + , status + ) import Cardano.Wallet.Primitive.Types.Tx.TxOut - ( TxOut ) + ( TxOut + ) import Cardano.Wallet.Read.Tx.CBOR - ( TxCBOR ) + ( TxCBOR + ) import Control.DeepSeq - ( NFData (..) ) + ( NFData (..) + ) import Data.Map.Strict - ( Map ) + ( Map + ) import Data.Quantity - ( Quantity (..) ) + ( Quantity (..) + ) import Data.Time.Clock - ( UTCTime ) + ( UTCTime + ) import GHC.Generics - ( Generic ) + ( Generic + ) import Numeric.Natural - ( Natural ) + ( Natural + ) -- | Full expanded and resolved information about a transaction, suitable for -- presentation to the user. diff --git a/lib/wallet/src/Cardano/Wallet/Primitive/Types/Tx/TxMeta.hs b/lib/wallet/src/Cardano/Wallet/Primitive/Types/Tx/TxMeta.hs index 888aefdb5fc..7adbd46529c 100644 --- a/lib/wallet/src/Cardano/Wallet/Primitive/Types/Tx/TxMeta.hs +++ b/lib/wallet/src/Cardano/Wallet/Primitive/Types/Tx/TxMeta.hs @@ -25,15 +25,19 @@ module Cardano.Wallet.Primitive.Types.Tx.TxMeta import Prelude import Cardano.Slotting.Slot - ( SlotNo (..) ) + ( SlotNo (..) + ) import Cardano.Wallet.Orphans () import Cardano.Wallet.Primitive.Types.Coin - ( Coin (..) ) + ( Coin (..) + ) import Control.DeepSeq - ( NFData (..) ) + ( NFData (..) + ) import Data.Quantity - ( Quantity (..) ) + ( Quantity (..) + ) import Data.Text.Class ( CaseStyle (..) , FromText (..) @@ -42,11 +46,14 @@ import Data.Text.Class , toTextFromBoundedEnum ) import Data.Word - ( Word32 ) + ( Word32 + ) import Fmt - ( Buildable (..) ) + ( Buildable (..) + ) import GHC.Generics - ( Generic ) + ( Generic + ) import qualified Data.Text.Lazy.Builder as Builder diff --git a/lib/wallet/src/Cardano/Wallet/Primitive/Types/Tx/TxSeq.hs b/lib/wallet/src/Cardano/Wallet/Primitive/Types/Tx/TxSeq.hs index c50c197ca1d..c018b947b4a 100644 --- a/lib/wallet/src/Cardano/Wallet/Primitive/Types/Tx/TxSeq.hs +++ b/lib/wallet/src/Cardano/Wallet/Primitive/Types/Tx/TxSeq.hs @@ -106,44 +106,72 @@ module Cardano.Wallet.Primitive.Types.Tx.TxSeq ) where import Prelude hiding - ( length, seq ) + ( length + , seq + ) import Cardano.Wallet.Primitive.Model - ( applyTxToUTxO ) + ( applyTxToUTxO + ) import Cardano.Wallet.Primitive.Types.Coin - ( Coin (..) ) + ( Coin (..) + ) import Cardano.Wallet.Primitive.Types.Hash - ( Hash (..) ) + ( Hash (..) + ) import Cardano.Wallet.Primitive.Types.StateDeltaSeq - ( StateDeltaSeq ) + ( StateDeltaSeq + ) import Cardano.Wallet.Primitive.Types.TokenMap - ( AssetId (..) ) + ( AssetId (..) + ) import Cardano.Wallet.Primitive.Types.TokenPolicy - ( TokenName (..), TokenPolicyId (..) ) + ( TokenName (..) + , TokenPolicyId (..) + ) import Cardano.Wallet.Primitive.Types.Tx - ( Tx (..), txAssetIds, txMapAssetIds, txMapTxIds, txRemoveAssetId ) + ( Tx (..) + , txAssetIds + , txMapAssetIds + , txMapTxIds + , txRemoveAssetId + ) import Cardano.Wallet.Primitive.Types.Tx.TxIn - ( TxIn ) + ( TxIn + ) import Cardano.Wallet.Primitive.Types.Tx.TxOut - ( TxOut ) + ( TxOut + ) import Cardano.Wallet.Primitive.Types.UTxO - ( UTxO ) + ( UTxO + ) import Data.Bifoldable - ( Bifoldable (..) ) + ( Bifoldable (..) + ) import Data.Bifunctor - ( bimap ) + ( bimap + ) import Data.Either - ( isLeft, isRight, lefts, rights ) + ( isLeft + , isRight + , lefts + , rights + ) import Data.Function - ( (&) ) + ( (&) + ) import Data.List.NonEmpty - ( NonEmpty (..) ) + ( NonEmpty (..) + ) import Data.Map.Strict - ( Map ) + ( Map + ) import Data.Maybe - ( mapMaybe ) + ( mapMaybe + ) import Data.Set - ( Set ) + ( Set + ) import qualified Cardano.Wallet.Primitive.Types.StateDeltaSeq as Seq import qualified Cardano.Wallet.Primitive.Types.Tx as Tx diff --git a/lib/wallet/src/Cardano/Wallet/Primitive/Types/Tx/TxSeq/Gen.hs b/lib/wallet/src/Cardano/Wallet/Primitive/Types/Tx/TxSeq/Gen.hs index 314e2d369c4..4f3483f2fce 100644 --- a/lib/wallet/src/Cardano/Wallet/Primitive/Types/Tx/TxSeq/Gen.hs +++ b/lib/wallet/src/Cardano/Wallet/Primitive/Types/Tx/TxSeq/Gen.hs @@ -35,39 +35,66 @@ module Cardano.Wallet.Primitive.Types.Tx.TxSeq.Gen import Prelude import Cardano.Wallet.Primitive.Types.Address - ( Address ) + ( Address + ) import Cardano.Wallet.Primitive.Types.Coin - ( Coin (..) ) + ( Coin (..) + ) import Cardano.Wallet.Primitive.Types.Coin.Gen - ( chooseCoin, genCoinPositive ) + ( chooseCoin + , genCoinPositive + ) import Cardano.Wallet.Primitive.Types.RewardAccount.Gen - ( genRewardAccount ) + ( genRewardAccount + ) import Cardano.Wallet.Primitive.Types.TokenBundle.Gen - ( genTokenBundlePartitionNonNull ) + ( genTokenBundlePartitionNonNull + ) import Cardano.Wallet.Primitive.Types.TokenMap - ( AssetId ) + ( AssetId + ) import Cardano.Wallet.Primitive.Types.Tx - ( Tx (..), TxScriptValidity (..) ) + ( Tx (..) + , TxScriptValidity (..) + ) import Cardano.Wallet.Primitive.Types.Tx.Gen - ( TxWithoutId (..), txWithoutIdToTx ) + ( TxWithoutId (..) + , txWithoutIdToTx + ) import Cardano.Wallet.Primitive.Types.Tx.TxOut - ( TxOut (..) ) + ( TxOut (..) + ) import Cardano.Wallet.Primitive.Types.Tx.TxSeq - ( TxSeq ) + ( TxSeq + ) import Cardano.Wallet.Primitive.Types.UTxO - ( UTxO (..) ) + ( UTxO (..) + ) import Cardano.Wallet.Primitive.Types.UTxO.Gen - ( selectUTxOEntries ) + ( selectUTxOEntries + ) import Control.Monad.Util - ( applyNM ) + ( applyNM + ) import Data.Function - ( on ) + ( on + ) import Data.Maybe - ( fromMaybe, listToMaybe, mapMaybe ) + ( fromMaybe + , listToMaybe + , mapMaybe + ) import Test.QuickCheck - ( Gen, chooseInt, elements, frequency, sized, vectorOf ) + ( Gen + , chooseInt + , elements + , frequency + , sized + , vectorOf + ) import Test.QuickCheck.Extra - ( genMapWith ) + ( genMapWith + ) import qualified Cardano.Wallet.Primitive.Types.TokenBundle as TokenBundle import qualified Cardano.Wallet.Primitive.Types.Tx.TxSeq as TxSeq diff --git a/lib/wallet/src/Cardano/Wallet/Primitive/Types/UTxOStatistics.hs b/lib/wallet/src/Cardano/Wallet/Primitive/Types/UTxOStatistics.hs index 4b37d98cff0..4dc67eb85c1 100644 --- a/lib/wallet/src/Cardano/Wallet/Primitive/Types/UTxOStatistics.hs +++ b/lib/wallet/src/Cardano/Wallet/Primitive/Types/UTxOStatistics.hs @@ -18,19 +18,29 @@ module Cardano.Wallet.Primitive.Types.UTxOStatistics import Prelude import Cardano.Wallet.Primitive.Types.UTxO - ( UTxO (..) ) + ( UTxO (..) + ) import Control.DeepSeq - ( NFData (..) ) + ( NFData (..) + ) import Data.List.NonEmpty - ( NonEmpty (..) ) + ( NonEmpty (..) + ) import Data.Map.Strict - ( Map ) + ( Map + ) import Data.Word - ( Word64 ) + ( Word64 + ) import Fmt - ( Buildable (..), blockListF', padRightF, tupleF ) + ( Buildable (..) + , blockListF' + , padRightF + , tupleF + ) import GHC.Generics - ( Generic ) + ( Generic + ) import qualified Cardano.Wallet.Primitive.Types.Coin as Coin import qualified Cardano.Wallet.Primitive.Types.Tx.TxOut as TxOut diff --git a/lib/wallet/src/Cardano/Wallet/Read/Primitive/Tx.hs b/lib/wallet/src/Cardano/Wallet/Read/Primitive/Tx.hs index 45d262075ef..d64b9cb49be 100644 --- a/lib/wallet/src/Cardano/Wallet/Read/Primitive/Tx.hs +++ b/lib/wallet/src/Cardano/Wallet/Read/Primitive/Tx.hs @@ -14,19 +14,26 @@ module Cardano.Wallet.Read.Primitive.Tx import Prelude import Cardano.Wallet.Read.Primitive.Tx.Allegra - ( fromAllegraTx ) + ( fromAllegraTx + ) import Cardano.Wallet.Read.Primitive.Tx.Alonzo - ( fromAlonzoTx ) + ( fromAlonzoTx + ) import Cardano.Wallet.Read.Primitive.Tx.Babbage - ( fromBabbageTx ) + ( fromBabbageTx + ) import Cardano.Wallet.Read.Primitive.Tx.Byron - ( fromTxAux ) + ( fromTxAux + ) import Cardano.Wallet.Read.Primitive.Tx.Conway - ( fromConwayTx ) + ( fromConwayTx + ) import Cardano.Wallet.Read.Primitive.Tx.Mary - ( fromMaryTx ) + ( fromMaryTx + ) import Cardano.Wallet.Read.Primitive.Tx.Shelley - ( fromShelleyTx ) + ( fromShelleyTx + ) import Cardano.Wallet.Transaction ( TokenMapWithScripts (..) , ValidityIntervalExplicit (..) @@ -38,7 +45,8 @@ import Cardano.Wallet.Transaction import qualified Cardano.Api as Cardano import qualified Cardano.Api.Byron as Cardano - ( Tx (ByronTx) ) + ( Tx (ByronTx) + ) import qualified Cardano.Api.Shelley as Cardano import qualified Cardano.Wallet.Primitive.Types as W import qualified Cardano.Wallet.Primitive.Types.Tx as W diff --git a/lib/wallet/src/Cardano/Wallet/Read/Primitive/Tx/Allegra.hs b/lib/wallet/src/Cardano/Wallet/Read/Primitive/Tx/Allegra.hs index 63ed6dc5633..d9bdb5a3f4f 100644 --- a/lib/wallet/src/Cardano/Wallet/Read/Primitive/Tx/Allegra.hs +++ b/lib/wallet/src/Cardano/Wallet/Read/Primitive/Tx/Allegra.hs @@ -24,9 +24,11 @@ module Cardano.Wallet.Read.Primitive.Tx.Allegra import Prelude import Cardano.Address.Script - ( KeyRole (..) ) + ( KeyRole (..) + ) import Cardano.Api - ( AllegraEra ) + ( AllegraEra + ) import Cardano.Ledger.Api ( addrTxWitsL , auxDataTxL @@ -43,31 +45,45 @@ import Cardano.Ledger.Api import Cardano.Ledger.Core () import Cardano.Ledger.Shelley.Tx - ( ShelleyTx ) + ( ShelleyTx + ) import Cardano.Wallet.Read.Eras - ( allegra, inject ) + ( allegra + , inject + ) import Cardano.Wallet.Read.Primitive.Tx.Features.Certificates - ( anyEraCerts ) + ( anyEraCerts + ) import Cardano.Wallet.Read.Primitive.Tx.Features.Inputs - ( fromShelleyTxIn ) + ( fromShelleyTxIn + ) import Cardano.Wallet.Read.Primitive.Tx.Features.Metadata - ( fromAllegraMetadata ) + ( fromAllegraMetadata + ) import Cardano.Wallet.Read.Primitive.Tx.Features.Outputs - ( fromAllegraTxOut ) + ( fromAllegraTxOut + ) import Cardano.Wallet.Read.Primitive.Tx.Features.Validity - ( afterShelleyValidityInterval ) + ( afterShelleyValidityInterval + ) import Cardano.Wallet.Read.Primitive.Tx.Features.Withdrawals - ( fromLedgerWithdrawals ) + ( fromLedgerWithdrawals + ) import Cardano.Wallet.Read.Tx - ( Tx (..) ) + ( Tx (..) + ) import Cardano.Wallet.Read.Tx.CBOR - ( renderTxToCBOR ) + ( renderTxToCBOR + ) import Cardano.Wallet.Read.Tx.Hash - ( shelleyTxHash ) + ( shelleyTxHash + ) import Cardano.Wallet.Read.Tx.Withdrawals - ( shelleyWithdrawals ) + ( shelleyWithdrawals + ) import Cardano.Wallet.Shelley.Compatibility.Ledger - ( toWalletScript ) + ( toWalletScript + ) import Cardano.Wallet.Transaction ( AnyExplicitScript (..) , ScriptReference (..) @@ -77,9 +93,13 @@ import Cardano.Wallet.Transaction , emptyTokenMapWithScripts ) import Control.Lens - ( folded, (^.), (^..) ) + ( folded + , (^.) + , (^..) + ) import Data.Foldable - ( toList ) + ( toList + ) import qualified Cardano.Api.Shelley as Cardano import qualified Cardano.Ledger.BaseTypes as SL diff --git a/lib/wallet/src/Cardano/Wallet/Read/Primitive/Tx/Alonzo.hs b/lib/wallet/src/Cardano/Wallet/Read/Primitive/Tx/Alonzo.hs index 17d51579c34..6a6fd493182 100644 --- a/lib/wallet/src/Cardano/Wallet/Read/Primitive/Tx/Alonzo.hs +++ b/lib/wallet/src/Cardano/Wallet/Read/Primitive/Tx/Alonzo.hs @@ -19,7 +19,8 @@ module Cardano.Wallet.Read.Primitive.Tx.Alonzo import Prelude import Cardano.Api - ( AlonzoEra ) + ( AlonzoEra + ) import Cardano.Ledger.Api ( addrTxWitsL , auxDataTxL @@ -37,31 +38,46 @@ import Cardano.Ledger.Api , witsTxL ) import Cardano.Wallet.Read.Eras - ( alonzo, inject ) + ( alonzo + , inject + ) import Cardano.Wallet.Read.Primitive.Tx.Features.Certificates - ( anyEraCerts ) + ( anyEraCerts + ) import Cardano.Wallet.Read.Primitive.Tx.Features.Inputs - ( fromShelleyTxIn ) + ( fromShelleyTxIn + ) import Cardano.Wallet.Read.Primitive.Tx.Features.Metadata - ( fromAlonzoMetadata ) + ( fromAlonzoMetadata + ) import Cardano.Wallet.Read.Primitive.Tx.Features.Mint - ( alonzoMint, fromLedgerScriptHash ) + ( alonzoMint + , fromLedgerScriptHash + ) import Cardano.Wallet.Read.Primitive.Tx.Features.Outputs - ( fromAlonzoTxOut ) + ( fromAlonzoTxOut + ) import Cardano.Wallet.Read.Primitive.Tx.Features.Validity - ( afterShelleyValidityInterval ) + ( afterShelleyValidityInterval + ) import Cardano.Wallet.Read.Primitive.Tx.Features.Withdrawals - ( fromLedgerWithdrawals ) + ( fromLedgerWithdrawals + ) import Cardano.Wallet.Read.Tx - ( Tx (..) ) + ( Tx (..) + ) import Cardano.Wallet.Read.Tx.CBOR - ( renderTxToCBOR ) + ( renderTxToCBOR + ) import Cardano.Wallet.Read.Tx.Hash - ( shelleyTxHash ) + ( shelleyTxHash + ) import Cardano.Wallet.Read.Tx.Withdrawals - ( shelleyWithdrawals ) + ( shelleyWithdrawals + ) import Cardano.Wallet.Shelley.Compatibility.Ledger - ( toWalletScript ) + ( toWalletScript + ) import Cardano.Wallet.Transaction ( AnyExplicitScript (..) , PlutusScriptInfo (..) @@ -74,7 +90,10 @@ import Cardano.Wallet.Transaction , toKeyRole ) import Control.Lens - ( folded, (^.), (^..) ) + ( folded + , (^.) + , (^..) + ) import qualified Cardano.Api.Shelley as Cardano import qualified Cardano.Ledger.Alonzo.Scripts as Alonzo diff --git a/lib/wallet/src/Cardano/Wallet/Read/Primitive/Tx/Babbage.hs b/lib/wallet/src/Cardano/Wallet/Read/Primitive/Tx/Babbage.hs index 845d77f30d5..28e3556dbff 100644 --- a/lib/wallet/src/Cardano/Wallet/Read/Primitive/Tx/Babbage.hs +++ b/lib/wallet/src/Cardano/Wallet/Read/Primitive/Tx/Babbage.hs @@ -19,9 +19,11 @@ module Cardano.Wallet.Read.Primitive.Tx.Babbage import Prelude import Cardano.Api - ( BabbageEra ) + ( BabbageEra + ) import Cardano.Ledger.Alonzo - ( AlonzoScript ) + ( AlonzoScript + ) import Cardano.Ledger.Api ( StandardCrypto , addrTxWitsL @@ -42,35 +44,53 @@ import Cardano.Ledger.Api , witsTxL ) import Cardano.Wallet.Primitive.Types.TokenPolicy - ( TokenPolicyId ) + ( TokenPolicyId + ) import Cardano.Wallet.Primitive.Types.Tx.TxIn - ( TxIn (..) ) + ( TxIn (..) + ) import Cardano.Wallet.Read.Eras - ( babbage, inject ) + ( babbage + , inject + ) import Cardano.Wallet.Read.Primitive.Tx.Features.Certificates - ( anyEraCerts ) + ( anyEraCerts + ) import Cardano.Wallet.Read.Primitive.Tx.Features.Inputs - ( fromShelleyTxIn ) + ( fromShelleyTxIn + ) import Cardano.Wallet.Read.Primitive.Tx.Features.Metadata - ( fromBabbageMetadata ) + ( fromBabbageMetadata + ) import Cardano.Wallet.Read.Primitive.Tx.Features.Mint - ( babbageMint, fromLedgerScriptHash ) + ( babbageMint + , fromLedgerScriptHash + ) import Cardano.Wallet.Read.Primitive.Tx.Features.Outputs - ( fromBabbageTxOut ) + ( fromBabbageTxOut + ) import Cardano.Wallet.Read.Primitive.Tx.Features.Validity - ( afterShelleyValidityInterval ) + ( afterShelleyValidityInterval + ) import Cardano.Wallet.Read.Primitive.Tx.Features.Withdrawals - ( fromLedgerWithdrawals ) + ( fromLedgerWithdrawals + ) import Cardano.Wallet.Read.Tx - ( Tx (..) ) + ( Tx (..) + ) import Cardano.Wallet.Read.Tx.CBOR - ( renderTxToCBOR ) + ( renderTxToCBOR + ) import Cardano.Wallet.Read.Tx.Hash - ( shelleyTxHash ) + ( shelleyTxHash + ) import Cardano.Wallet.Read.Tx.Withdrawals - ( shelleyWithdrawals ) + ( shelleyWithdrawals + ) import Cardano.Wallet.Shelley.Compatibility.Ledger - ( toWalletScript, toWalletTokenPolicyId ) + ( toWalletScript + , toWalletTokenPolicyId + ) import Cardano.Wallet.Transaction ( AnyExplicitScript (..) , PlutusScriptInfo (..) @@ -84,15 +104,24 @@ import Cardano.Wallet.Transaction , toKeyRole ) import Control.Lens - ( folded, (<&>), (^.), (^..) ) + ( folded + , (<&>) + , (^.) + , (^..) + ) import Data.Map - ( Map ) + ( Map + ) import Data.Maybe.Strict - ( strictMaybeToMaybe ) + ( strictMaybeToMaybe + ) import Data.Word - ( Word32 ) + ( Word32 + ) import Internal.Cardano.Write.Tx - ( BabbageTxOut, StandardBabbage ) + ( BabbageTxOut + , StandardBabbage + ) import qualified Cardano.Api.Shelley as Cardano import qualified Cardano.Ledger.Alonzo.Scripts as Alonzo diff --git a/lib/wallet/src/Cardano/Wallet/Read/Primitive/Tx/Byron.hs b/lib/wallet/src/Cardano/Wallet/Read/Primitive/Tx/Byron.hs index c2c91e3bf3e..a167f5f11d5 100644 --- a/lib/wallet/src/Cardano/Wallet/Read/Primitive/Tx/Byron.hs +++ b/lib/wallet/src/Cardano/Wallet/Read/Primitive/Tx/Byron.hs @@ -14,21 +14,32 @@ module Cardano.Wallet.Read.Primitive.Tx.Byron import Prelude import Cardano.Chain.UTxO - ( ATxAux (..), Tx (..), taTx ) + ( ATxAux (..) + , Tx (..) + , taTx + ) import Cardano.Wallet.Read.Eras - ( byron, inject ) + ( byron + , inject + ) import Cardano.Wallet.Read.Primitive.Tx.Features.Inputs - ( fromByronTxIn ) + ( fromByronTxIn + ) import Cardano.Wallet.Read.Primitive.Tx.Features.Outputs - ( fromByronTxOut ) + ( fromByronTxOut + ) import Cardano.Wallet.Read.Tx - ( Tx (..) ) + ( Tx (..) + ) import Cardano.Wallet.Read.Tx.CBOR - ( renderTxToCBOR ) + ( renderTxToCBOR + ) import Cardano.Wallet.Read.Tx.Hash - ( byronTxHash ) + ( byronTxHash + ) import Control.Monad - ( void ) + ( void + ) import qualified Cardano.Wallet.Primitive.Types.Hash as W import qualified Cardano.Wallet.Primitive.Types.Tx as W diff --git a/lib/wallet/src/Cardano/Wallet/Read/Primitive/Tx/Conway.hs b/lib/wallet/src/Cardano/Wallet/Read/Primitive/Tx/Conway.hs index b8259134507..0c8fb600b62 100644 --- a/lib/wallet/src/Cardano/Wallet/Read/Primitive/Tx/Conway.hs +++ b/lib/wallet/src/Cardano/Wallet/Read/Primitive/Tx/Conway.hs @@ -19,9 +19,11 @@ module Cardano.Wallet.Read.Primitive.Tx.Conway import Prelude import Cardano.Api - ( ConwayEra ) + ( ConwayEra + ) import Cardano.Ledger.Alonzo.Scripts - ( AlonzoScript ) + ( AlonzoScript + ) import Cardano.Ledger.Api ( StandardCrypto , addrTxWitsL @@ -42,37 +44,56 @@ import Cardano.Ledger.Api , witsTxL ) import Cardano.Ledger.Babbage - ( BabbageTxOut ) + ( BabbageTxOut + ) import Cardano.Wallet.Primitive.Types.TokenPolicy - ( TokenPolicyId (..) ) + ( TokenPolicyId (..) + ) import Cardano.Wallet.Primitive.Types.Tx.TxIn - ( TxIn (..) ) + ( TxIn (..) + ) import Cardano.Wallet.Read.Eras - ( conway, inject ) + ( conway + , inject + ) import Cardano.Wallet.Read.Primitive.Tx.Features.Certificates - ( fromConwayCerts ) + ( fromConwayCerts + ) import Cardano.Wallet.Read.Primitive.Tx.Features.Inputs - ( fromShelleyTxIn ) + ( fromShelleyTxIn + ) import Cardano.Wallet.Read.Primitive.Tx.Features.Metadata - ( fromConwayMetadata ) + ( fromConwayMetadata + ) import Cardano.Wallet.Read.Primitive.Tx.Features.Mint - ( conwayMint, fromLedgerScriptHash ) + ( conwayMint + , fromLedgerScriptHash + ) import Cardano.Wallet.Read.Primitive.Tx.Features.Outputs - ( fromConwayTxOut ) + ( fromConwayTxOut + ) import Cardano.Wallet.Read.Primitive.Tx.Features.Validity - ( afterShelleyValidityInterval ) + ( afterShelleyValidityInterval + ) import Cardano.Wallet.Read.Primitive.Tx.Features.Withdrawals - ( fromLedgerWithdrawals ) + ( fromLedgerWithdrawals + ) import Cardano.Wallet.Read.Tx - ( Tx (..) ) + ( Tx (..) + ) import Cardano.Wallet.Read.Tx.CBOR - ( renderTxToCBOR ) + ( renderTxToCBOR + ) import Cardano.Wallet.Read.Tx.Hash - ( shelleyTxHash ) + ( shelleyTxHash + ) import Cardano.Wallet.Read.Tx.Withdrawals - ( shelleyWithdrawals ) + ( shelleyWithdrawals + ) import Cardano.Wallet.Shelley.Compatibility.Ledger - ( toWalletScript, toWalletTokenPolicyId ) + ( toWalletScript + , toWalletTokenPolicyId + ) import Cardano.Wallet.Transaction ( AnyExplicitScript (..) , PlutusScriptInfo (..) @@ -86,17 +107,26 @@ import Cardano.Wallet.Transaction , toKeyRole ) import Control.Lens - ( folded, (<&>), (^.), (^..) ) + ( folded + , (<&>) + , (^.) + , (^..) + ) import Data.Foldable - ( toList ) + ( toList + ) import Data.Map - ( Map ) + ( Map + ) import Data.Maybe.Strict - ( strictMaybeToMaybe ) + ( strictMaybeToMaybe + ) import Data.Word - ( Word32 ) + ( Word32 + ) import Ouroboros.Consensus.Cardano.Block - ( StandardConway ) + ( StandardConway + ) import qualified Cardano.Api.Shelley as Cardano import qualified Cardano.Ledger.Alonzo.Scripts as Alonzo diff --git a/lib/wallet/src/Cardano/Wallet/Read/Primitive/Tx/Features/Certificates.hs b/lib/wallet/src/Cardano/Wallet/Read/Primitive/Tx/Features/Certificates.hs index 22c756e5029..63e62bdc395 100644 --- a/lib/wallet/src/Cardano/Wallet/Read/Primitive/Tx/Features/Certificates.hs +++ b/lib/wallet/src/Cardano/Wallet/Read/Primitive/Tx/Features/Certificates.hs @@ -19,44 +19,71 @@ module Cardano.Wallet.Read.Primitive.Tx.Features.Certificates import Prelude import Cardano.Api - ( ConwayEra ) + ( ConwayEra + ) import Cardano.Crypto.Hash.Class - ( hashToBytes ) + ( hashToBytes + ) import Cardano.Ledger.Api - ( StandardCrypto ) + ( StandardCrypto + ) import Cardano.Ledger.BaseTypes - ( strictMaybeToMaybe, urlToText ) + ( strictMaybeToMaybe + , urlToText + ) import Cardano.Ledger.Conway.Delegation.Certificates - ( ConwayDCert (..), ConwayDelegCert (..) ) + ( ConwayDCert (..) + , ConwayDelegCert (..) + ) import Cardano.Ledger.Shelley.API - ( PoolCert (..), PoolMetadata (..), PoolParams (..) ) + ( PoolCert (..) + , PoolMetadata (..) + , PoolParams (..) + ) import Cardano.Ledger.Shelley.TxBody - ( DCert ) + ( DCert + ) import Cardano.Pool.Metadata.Types - ( StakePoolMetadataHash (..), StakePoolMetadataUrl (..) ) + ( StakePoolMetadataHash (..) + , StakePoolMetadataUrl (..) + ) import Cardano.Pool.Types - ( PoolId (PoolId), PoolOwner (PoolOwner) ) + ( PoolId (PoolId) + , PoolOwner (PoolOwner) + ) import Cardano.Slotting.Slot - ( EpochNo (..) ) + ( EpochNo (..) + ) import Cardano.Wallet.Primitive.Types ( PoolCertificate (..) , PoolRegistrationCertificate (..) , PoolRetirementCertificate (..) ) import Cardano.Wallet.Read.Eras - ( EraFun (..), K (..) ) + ( EraFun (..) + , K (..) + ) import Cardano.Wallet.Read.Tx.Certificates - ( Certificates (..), CertificatesType ) + ( Certificates (..) + , CertificatesType + ) import Cardano.Wallet.Util - ( internalError ) + ( internalError + ) import Data.Foldable - ( toList ) + ( toList + ) import Data.Quantity - ( Percentage, mkPercentage ) + ( Percentage + , mkPercentage + ) import Fmt - ( (+||), (||+) ) + ( (+||) + , (||+) + ) import GHC.Stack - ( HasCallStack ) + ( HasCallStack + ) import qualified Cardano.Ledger.BaseTypes as SL import qualified Cardano.Ledger.Credential as SL diff --git a/lib/wallet/src/Cardano/Wallet/Read/Primitive/Tx/Features/CollateralInputs.hs b/lib/wallet/src/Cardano/Wallet/Read/Primitive/Tx/Features/CollateralInputs.hs index 0ced3ae9ec3..2db2e957519 100644 --- a/lib/wallet/src/Cardano/Wallet/Read/Primitive/Tx/Features/CollateralInputs.hs +++ b/lib/wallet/src/Cardano/Wallet/Read/Primitive/Tx/Features/CollateralInputs.hs @@ -8,11 +8,16 @@ module Cardano.Wallet.Read.Primitive.Tx.Features.CollateralInputs import Prelude import Cardano.Wallet.Read.Eras - ( EraFun (..), K (..) ) + ( EraFun (..) + , K (..) + ) import Cardano.Wallet.Read.Primitive.Tx.Features.Inputs - ( fromShelleyTxIns ) + ( fromShelleyTxIns + ) import Cardano.Wallet.Read.Tx.CollateralInputs - ( CollateralInputs (..), CollateralInputsType ) + ( CollateralInputs (..) + , CollateralInputsType + ) import qualified Cardano.Ledger.Shelley.API as SH import qualified Cardano.Wallet.Primitive.Types.Tx.TxIn as W diff --git a/lib/wallet/src/Cardano/Wallet/Read/Primitive/Tx/Features/CollateralOutputs.hs b/lib/wallet/src/Cardano/Wallet/Read/Primitive/Tx/Features/CollateralOutputs.hs index c9743c534a8..8fe8068a4fd 100644 --- a/lib/wallet/src/Cardano/Wallet/Read/Primitive/Tx/Features/CollateralOutputs.hs +++ b/lib/wallet/src/Cardano/Wallet/Read/Primitive/Tx/Features/CollateralOutputs.hs @@ -8,17 +8,25 @@ module Cardano.Wallet.Read.Primitive.Tx.Features.CollateralOutputs import Prelude import Cardano.Wallet.Read.Eras - ( EraFun (..), K (..) ) + ( EraFun (..) + , K (..) + ) import Cardano.Wallet.Read.Primitive.Tx.Features.Outputs - ( fromShelleyAddress ) + ( fromShelleyAddress + ) import Cardano.Wallet.Read.Tx.CollateralOutputs - ( CollateralOutputs (..) ) + ( CollateralOutputs (..) + ) import Cardano.Wallet.Shelley.Compatibility.Ledger - ( toWalletTokenBundle ) + ( toWalletTokenBundle + ) import Data.Maybe.Strict - ( strictMaybeToMaybe ) + ( strictMaybeToMaybe + ) import Ouroboros.Consensus.Shelley.Eras - ( StandardBabbage, StandardConway ) + ( StandardBabbage + , StandardConway + ) import qualified Cardano.Ledger.Babbage as Babbage import qualified Cardano.Ledger.Babbage.TxBody as Babbage diff --git a/lib/wallet/src/Cardano/Wallet/Read/Primitive/Tx/Features/ExtraSigs.hs b/lib/wallet/src/Cardano/Wallet/Read/Primitive/Tx/Features/ExtraSigs.hs index cd4331f7ae7..6f52e4dbdf5 100644 --- a/lib/wallet/src/Cardano/Wallet/Read/Primitive/Tx/Features/ExtraSigs.hs +++ b/lib/wallet/src/Cardano/Wallet/Read/Primitive/Tx/Features/ExtraSigs.hs @@ -16,23 +16,34 @@ module Cardano.Wallet.Read.Primitive.Tx.Features.ExtraSigs import Prelude import Cardano.Crypto.Hash - ( Hash (..) ) + ( Hash (..) + ) import Cardano.Ledger.Crypto - ( StandardCrypto ) + ( StandardCrypto + ) import Cardano.Ledger.Keys - ( KeyHash (..), KeyRole (..) ) + ( KeyHash (..) + , KeyRole (..) + ) import Cardano.Wallet.Read.Eras - ( EraFun (..), K (..) ) + ( EraFun (..) + , K (..) + ) import Cardano.Wallet.Read.Tx.ExtraSigs - ( ExtraSigs (..) ) + ( ExtraSigs (..) + ) import Data.ByteString.Short - ( fromShort ) + ( fromShort + ) import Data.Foldable - ( toList ) + ( toList + ) import Data.Functor - ( (<&>) ) + ( (<&>) + ) import Data.Set - ( Set ) + ( Set + ) import qualified Cardano.Wallet.Primitive.Types.Hash as W diff --git a/lib/wallet/src/Cardano/Wallet/Read/Primitive/Tx/Features/Fee.hs b/lib/wallet/src/Cardano/Wallet/Read/Primitive/Tx/Features/Fee.hs index ac1a1d61ccf..53f41e0a888 100644 --- a/lib/wallet/src/Cardano/Wallet/Read/Primitive/Tx/Features/Fee.hs +++ b/lib/wallet/src/Cardano/Wallet/Read/Primitive/Tx/Features/Fee.hs @@ -7,11 +7,16 @@ module Cardano.Wallet.Read.Primitive.Tx.Features.Fee import Prelude import Cardano.Ledger.Coin - ( Coin ) + ( Coin + ) import Cardano.Wallet.Read.Eras - ( EraFun (..), K (..) ) + ( EraFun (..) + , K (..) + ) import Cardano.Wallet.Read.Tx.Fee - ( Fee (..), FeeType ) + ( Fee (..) + , FeeType + ) import qualified Cardano.Wallet.Primitive.Types.Coin as W import qualified Cardano.Wallet.Shelley.Compatibility.Ledger as Ledger diff --git a/lib/wallet/src/Cardano/Wallet/Read/Primitive/Tx/Features/Inputs.hs b/lib/wallet/src/Cardano/Wallet/Read/Primitive/Tx/Features/Inputs.hs index 5768e1dc296..048ada2debf 100644 --- a/lib/wallet/src/Cardano/Wallet/Read/Primitive/Tx/Features/Inputs.hs +++ b/lib/wallet/src/Cardano/Wallet/Read/Primitive/Tx/Features/Inputs.hs @@ -11,17 +11,27 @@ module Cardano.Wallet.Read.Primitive.Tx.Features.Inputs import Prelude import Cardano.Wallet.Primitive.Types.Tx.TxIn - ( TxIn (..) ) + ( TxIn (..) + ) import Cardano.Wallet.Read.Eras - ( EraFun (..), K (..) ) + ( EraFun (..) + , K (..) + ) import Cardano.Wallet.Read.Tx.Hash - ( fromShelleyTxId ) + ( fromShelleyTxId + ) import Cardano.Wallet.Read.Tx.Inputs - ( Inputs (..), InputsType ) + ( Inputs (..) + , InputsType + ) import Data.Foldable - ( toList ) + ( toList + ) import Data.Word - ( Word16, Word32, Word64 ) + ( Word16 + , Word32 + , Word64 + ) import qualified Cardano.Chain.UTxO as BY import qualified Cardano.Crypto.Hashing as CC diff --git a/lib/wallet/src/Cardano/Wallet/Read/Primitive/Tx/Features/Integrity.hs b/lib/wallet/src/Cardano/Wallet/Read/Primitive/Tx/Features/Integrity.hs index e6dd20f3b94..a384f33ebbd 100644 --- a/lib/wallet/src/Cardano/Wallet/Read/Primitive/Tx/Features/Integrity.hs +++ b/lib/wallet/src/Cardano/Wallet/Read/Primitive/Tx/Features/Integrity.hs @@ -15,24 +15,39 @@ module Cardano.Wallet.Read.Primitive.Tx.Features.Integrity where import Prelude hiding - ( (.) ) + ( (.) + ) import Cardano.Ledger.Alonzo.Tx - ( ScriptIntegrityHash ) + ( ScriptIntegrityHash + ) import Cardano.Ledger.Crypto - ( StandardCrypto ) + ( StandardCrypto + ) import Cardano.Ledger.SafeHash - ( SafeToHash (originalBytes) ) + ( SafeToHash (originalBytes) + ) import Cardano.Wallet.Read.Eras - ( EraFun (..), EraValue, K (..), applyEraFun, extractEraValue ) + ( EraFun (..) + , EraValue + , K (..) + , applyEraFun + , extractEraValue + ) import Cardano.Wallet.Read.Tx - ( Tx ) + ( Tx + ) import Cardano.Wallet.Read.Tx.Integrity - ( Integrity (..), getEraIntegrity ) + ( Integrity (..) + , getEraIntegrity + ) import Control.Category - ( (.) ) + ( (.) + ) import Data.Maybe.Strict - ( StrictMaybe, strictMaybeToMaybe ) + ( StrictMaybe + , strictMaybeToMaybe + ) import qualified Cardano.Wallet.Primitive.Types.Hash as W diff --git a/lib/wallet/src/Cardano/Wallet/Read/Primitive/Tx/Features/Metadata.hs b/lib/wallet/src/Cardano/Wallet/Read/Primitive/Tx/Features/Metadata.hs index a37cdb626df..2b7582a472d 100644 --- a/lib/wallet/src/Cardano/Wallet/Read/Primitive/Tx/Features/Metadata.hs +++ b/lib/wallet/src/Cardano/Wallet/Read/Primitive/Tx/Features/Metadata.hs @@ -22,21 +22,31 @@ module Cardano.Wallet.Read.Primitive.Tx.Features.Metadata import Prelude import Cardano.Ledger.Allegra.TxAuxData - ( AllegraTxAuxData (..) ) + ( AllegraTxAuxData (..) + ) import Cardano.Ledger.Alonzo.TxAuxData - ( AlonzoTxAuxData (..) ) + ( AlonzoTxAuxData (..) + ) import Cardano.Ledger.BaseTypes - ( strictMaybeToMaybe ) + ( strictMaybeToMaybe + ) import Cardano.Ledger.Shelley.TxAuxData - ( Metadatum, ShelleyTxAuxData (..) ) + ( Metadatum + , ShelleyTxAuxData (..) + ) import Cardano.Wallet.Read.Eras - ( EraFun (..), K (..) ) + ( EraFun (..) + , K (..) + ) import Cardano.Wallet.Read.Tx.Metadata - ( Metadata (..) ) + ( Metadata (..) + ) import Data.Map - ( Map ) + ( Map + ) import Data.Word - ( Word64 ) + ( Word64 + ) import Ouroboros.Consensus.Shelley.Eras ( StandardAllegra , StandardAlonzo diff --git a/lib/wallet/src/Cardano/Wallet/Read/Primitive/Tx/Features/Mint.hs b/lib/wallet/src/Cardano/Wallet/Read/Primitive/Tx/Features/Mint.hs index da3188c1c9a..622524ce939 100644 --- a/lib/wallet/src/Cardano/Wallet/Read/Primitive/Tx/Features/Mint.hs +++ b/lib/wallet/src/Cardano/Wallet/Read/Primitive/Tx/Features/Mint.hs @@ -24,31 +24,51 @@ module Cardano.Wallet.Read.Primitive.Tx.Features.Mint import Prelude import Cardano.Address.Script - ( KeyRole (..), ScriptHash (..) ) + ( KeyRole (..) + , ScriptHash (..) + ) import Cardano.Crypto.Hash - ( hashToBytes ) + ( hashToBytes + ) import Cardano.Ledger.Alonzo.TxWits - ( AlonzoTxWits, txscripts' ) + ( AlonzoTxWits + , txscripts' + ) import Cardano.Ledger.Mary.Value - ( MultiAsset (..) ) + ( MultiAsset (..) + ) import Cardano.Ledger.Shelley.TxWits - ( ShelleyTxWits, scriptWits ) + ( ShelleyTxWits + , scriptWits + ) import Cardano.Wallet.Primitive.Types.Hash - ( Hash (..) ) + ( Hash (..) + ) import Cardano.Wallet.Primitive.Types.TokenMap - ( TokenMap, toNestedList, toNestedMap ) + ( TokenMap + , toNestedList + , toNestedMap + ) import Cardano.Wallet.Primitive.Types.TokenPolicy - ( TokenPolicyId (..) ) + ( TokenPolicyId (..) + ) import Cardano.Wallet.Read.Eras - ( (:*:) (..), EraFun (..), K (..) ) + ( (:*:) (..) + , EraFun (..) + , K (..) + ) import Cardano.Wallet.Read.Primitive.Tx.Features.Inputs - ( fromShelleyTxIn ) + ( fromShelleyTxIn + ) import Cardano.Wallet.Read.Tx.Mint - ( Mint (..) ) + ( Mint (..) + ) import Cardano.Wallet.Read.Tx.ReferenceInputs - ( ReferenceInputs (..) ) + ( ReferenceInputs (..) + ) import Cardano.Wallet.Read.Tx.Witnesses - ( Witnesses (..) ) + ( Witnesses (..) + ) import Cardano.Wallet.Shelley.Compatibility.Ledger ( toWalletScript , toWalletTokenName @@ -65,15 +85,20 @@ import Cardano.Wallet.Transaction , emptyTokenMapWithScripts ) import Data.Foldable - ( toList ) + ( toList + ) import Data.Function - ( (&) ) + ( (&) + ) import Data.Map.Strict - ( Map ) + ( Map + ) import Data.Maybe - ( mapMaybe ) + ( mapMaybe + ) import Data.Set - ( Set ) + ( Set + ) import Ouroboros.Consensus.Shelley.Eras ( StandardAlonzo , StandardBabbage diff --git a/lib/wallet/src/Cardano/Wallet/Read/Primitive/Tx/Features/Outputs.hs b/lib/wallet/src/Cardano/Wallet/Read/Primitive/Tx/Features/Outputs.hs index 32e0222dd83..5e755b9e9a5 100644 --- a/lib/wallet/src/Cardano/Wallet/Read/Primitive/Tx/Features/Outputs.hs +++ b/lib/wallet/src/Cardano/Wallet/Read/Primitive/Tx/Features/Outputs.hs @@ -17,25 +17,36 @@ module Cardano.Wallet.Read.Primitive.Tx.Features.Outputs import Prelude import Cardano.Binary - ( serialize' ) + ( serialize' + ) import Cardano.Chain.Common - ( unsafeGetLovelace ) + ( unsafeGetLovelace + ) import Cardano.Ledger.Alonzo - ( AlonzoScript ) + ( AlonzoScript + ) import Cardano.Ledger.Shelley.API - ( StrictMaybe (SJust, SNothing) ) + ( StrictMaybe (SJust, SNothing) + ) import Cardano.Wallet.Read.Eras - ( EraFun (..), K (..) ) + ( EraFun (..) + , K (..) + ) import Cardano.Wallet.Read.Tx.Outputs - ( Outputs (..) ) + ( Outputs (..) + ) import Cardano.Wallet.Shelley.Compatibility.Ledger - ( toWalletTokenBundle ) + ( toWalletTokenBundle + ) import Cardano.Wallet.Util - ( internalError ) + ( internalError + ) import Data.Foldable - ( toList ) + ( toList + ) import GHC.Stack - ( HasCallStack ) + ( HasCallStack + ) import Ouroboros.Consensus.Shelley.Eras ( StandardAllegra , StandardAlonzo diff --git a/lib/wallet/src/Cardano/Wallet/Read/Primitive/Tx/Features/ScriptValidity.hs b/lib/wallet/src/Cardano/Wallet/Read/Primitive/Tx/Features/ScriptValidity.hs index c0ed4925b34..f99e52490d4 100644 --- a/lib/wallet/src/Cardano/Wallet/Read/Primitive/Tx/Features/ScriptValidity.hs +++ b/lib/wallet/src/Cardano/Wallet/Read/Primitive/Tx/Features/ScriptValidity.hs @@ -16,11 +16,15 @@ module Cardano.Wallet.Read.Primitive.Tx.Features.ScriptValidity import Prelude import Cardano.Ledger.Alonzo.Tx - ( IsValid (..) ) + ( IsValid (..) + ) import Cardano.Wallet.Read.Eras - ( EraFun (..), K (..) ) + ( EraFun (..) + , K (..) + ) import Cardano.Wallet.Read.Tx.ScriptValidity - ( ScriptValidity (..) ) + ( ScriptValidity (..) + ) import qualified Cardano.Wallet.Primitive.Types.Tx.Tx as W diff --git a/lib/wallet/src/Cardano/Wallet/Read/Primitive/Tx/Features/Validity.hs b/lib/wallet/src/Cardano/Wallet/Read/Primitive/Tx/Features/Validity.hs index c0a38e6b8e9..ed21ae22844 100644 --- a/lib/wallet/src/Cardano/Wallet/Read/Primitive/Tx/Features/Validity.hs +++ b/lib/wallet/src/Cardano/Wallet/Read/Primitive/Tx/Features/Validity.hs @@ -18,17 +18,24 @@ module Cardano.Wallet.Read.Primitive.Tx.Features.Validity import Prelude import Cardano.Ledger.Api - ( ValidityInterval (..) ) + ( ValidityInterval (..) + ) import Cardano.Wallet.Read.Eras - ( EraFun (..), K (..) ) + ( EraFun (..) + , K (..) + ) import Cardano.Wallet.Read.Tx.Validity - ( Validity (..) ) + ( Validity (..) + ) import Cardano.Wallet.Transaction - ( ValidityIntervalExplicit (ValidityIntervalExplicit) ) + ( ValidityIntervalExplicit (ValidityIntervalExplicit) + ) import Data.Maybe.Strict - ( StrictMaybe (..) ) + ( StrictMaybe (..) + ) import Data.Quantity - ( Quantity (..) ) + ( Quantity (..) + ) import qualified Ouroboros.Network.Block as O diff --git a/lib/wallet/src/Cardano/Wallet/Read/Primitive/Tx/Features/Withdrawals.hs b/lib/wallet/src/Cardano/Wallet/Read/Primitive/Tx/Features/Withdrawals.hs index a44f0aa6e6e..81b8f84f696 100644 --- a/lib/wallet/src/Cardano/Wallet/Read/Primitive/Tx/Features/Withdrawals.hs +++ b/lib/wallet/src/Cardano/Wallet/Read/Primitive/Tx/Features/Withdrawals.hs @@ -16,15 +16,21 @@ module Cardano.Wallet.Read.Primitive.Tx.Features.Withdrawals import Prelude import Cardano.Wallet.Primitive.Types.Coin - ( Coin ) + ( Coin + ) import Cardano.Wallet.Primitive.Types.RewardAccount - ( RewardAccount ) + ( RewardAccount + ) import Cardano.Wallet.Read.Eras - ( EraFun (..), K (..) ) + ( EraFun (..) + , K (..) + ) import Cardano.Wallet.Read.Tx.Withdrawals - ( Withdrawals (..) ) + ( Withdrawals (..) + ) import Data.Map.Strict - ( Map ) + ( Map + ) import qualified Cardano.Ledger.Api as Ledger import qualified Cardano.Ledger.Coin as Ledger diff --git a/lib/wallet/src/Cardano/Wallet/Read/Primitive/Tx/Mary.hs b/lib/wallet/src/Cardano/Wallet/Read/Primitive/Tx/Mary.hs index 1a260386d76..e8c857bd134 100644 --- a/lib/wallet/src/Cardano/Wallet/Read/Primitive/Tx/Mary.hs +++ b/lib/wallet/src/Cardano/Wallet/Read/Primitive/Tx/Mary.hs @@ -16,7 +16,8 @@ module Cardano.Wallet.Read.Primitive.Tx.Mary import Prelude import Cardano.Api - ( MaryEra ) + ( MaryEra + ) import Cardano.Ledger.Api ( addrTxWitsL , auxDataTxL @@ -32,31 +33,45 @@ import Cardano.Ledger.Api , witsTxL ) import Cardano.Wallet.Read.Eras - ( inject, mary ) + ( inject + , mary + ) import Cardano.Wallet.Read.Primitive.Tx.Features.Certificates - ( anyEraCerts ) + ( anyEraCerts + ) import Cardano.Wallet.Read.Primitive.Tx.Features.Inputs - ( fromShelleyTxIn ) + ( fromShelleyTxIn + ) import Cardano.Wallet.Read.Primitive.Tx.Features.Metadata - ( fromMaryMetadata ) + ( fromMaryMetadata + ) import Cardano.Wallet.Read.Primitive.Tx.Features.Mint - ( maryMint ) + ( maryMint + ) import Cardano.Wallet.Read.Primitive.Tx.Features.Outputs - ( fromMaryTxOut ) + ( fromMaryTxOut + ) import Cardano.Wallet.Read.Primitive.Tx.Features.Validity - ( afterShelleyValidityInterval ) + ( afterShelleyValidityInterval + ) import Cardano.Wallet.Read.Primitive.Tx.Features.Withdrawals - ( fromLedgerWithdrawals ) + ( fromLedgerWithdrawals + ) import Cardano.Wallet.Read.Tx - ( Tx (Tx) ) + ( Tx (Tx) + ) import Cardano.Wallet.Read.Tx.CBOR - ( renderTxToCBOR ) + ( renderTxToCBOR + ) import Cardano.Wallet.Read.Tx.Hash - ( shelleyTxHash ) + ( shelleyTxHash + ) import Cardano.Wallet.Read.Tx.Withdrawals - ( shelleyWithdrawals ) + ( shelleyWithdrawals + ) import Cardano.Wallet.Shelley.Compatibility.Ledger - ( toWalletScript ) + ( toWalletScript + ) import Cardano.Wallet.Transaction ( AnyExplicitScript (..) , ScriptReference (..) @@ -67,7 +82,10 @@ import Cardano.Wallet.Transaction , toKeyRole ) import Control.Lens - ( folded, (^.), (^..) ) + ( folded + , (^.) + , (^..) + ) import qualified Cardano.Api.Shelley as Cardano import qualified Cardano.Ledger.BaseTypes as SL diff --git a/lib/wallet/src/Cardano/Wallet/Read/Primitive/Tx/Sealed.hs b/lib/wallet/src/Cardano/Wallet/Read/Primitive/Tx/Sealed.hs index 0ee343485c2..6371bcca85a 100644 --- a/lib/wallet/src/Cardano/Wallet/Read/Primitive/Tx/Sealed.hs +++ b/lib/wallet/src/Cardano/Wallet/Read/Primitive/Tx/Sealed.hs @@ -14,19 +14,28 @@ module Cardano.Wallet.Read.Primitive.Tx.Sealed import Prelude import Cardano.Api - ( InAnyCardanoEra (..) ) + ( InAnyCardanoEra (..) + ) import Cardano.Wallet.Primitive.Types.Tx.SealedTx - ( SealedTx (unsafeCardanoTx) ) + ( SealedTx (unsafeCardanoTx) + ) import Cardano.Wallet.Read.Eras - ( EraValue, K (..) ) + ( EraValue + , K (..) + ) import Cardano.Wallet.Read.Eras.EraFun - ( EraFun, applyEraFun ) + ( EraFun + , applyEraFun + ) import Cardano.Wallet.Read.Eras.EraValue - ( extractEraValue ) + ( extractEraValue + ) import Cardano.Wallet.Read.Tx - ( Tx (..) ) + ( Tx (..) + ) import Cardano.Wallet.Read.Tx.Cardano - ( fromCardanoApiTx ) + ( fromCardanoApiTx + ) import qualified Cardano.Wallet.Primitive.Types.Tx.SealedTx as W diff --git a/lib/wallet/src/Cardano/Wallet/Read/Primitive/Tx/Shelley.hs b/lib/wallet/src/Cardano/Wallet/Read/Primitive/Tx/Shelley.hs index 3d0edfae480..da4a97008eb 100644 --- a/lib/wallet/src/Cardano/Wallet/Read/Primitive/Tx/Shelley.hs +++ b/lib/wallet/src/Cardano/Wallet/Read/Primitive/Tx/Shelley.hs @@ -17,9 +17,11 @@ module Cardano.Wallet.Read.Primitive.Tx.Shelley import Prelude import Cardano.Address.Script - ( KeyRole (..) ) + ( KeyRole (..) + ) import Cardano.Api - ( ShelleyEra ) + ( ShelleyEra + ) import Cardano.Ledger.Core ( addrTxWitsL , auxDataTxL @@ -32,31 +34,47 @@ import Cardano.Ledger.Core , witsTxL ) import Cardano.Ledger.Shelley - ( ShelleyTx ) + ( ShelleyTx + ) import Cardano.Ledger.Shelley.TxBody - ( certsTxBodyL, ttlTxBodyL ) + ( certsTxBodyL + , ttlTxBodyL + ) import Cardano.Wallet.Read.Eras - ( inject, shelley ) + ( inject + , shelley + ) import Cardano.Wallet.Read.Primitive.Tx.Features.Certificates - ( anyEraCerts ) + ( anyEraCerts + ) import Cardano.Wallet.Read.Primitive.Tx.Features.Metadata - ( fromShelleyMetadata ) + ( fromShelleyMetadata + ) import Cardano.Wallet.Read.Primitive.Tx.Features.Outputs - ( fromShelleyTxOut ) + ( fromShelleyTxOut + ) import Cardano.Wallet.Read.Primitive.Tx.Features.Validity - ( shelleyValidityInterval ) + ( shelleyValidityInterval + ) import Cardano.Wallet.Read.Primitive.Tx.Features.Withdrawals - ( fromLedgerWithdrawals ) + ( fromLedgerWithdrawals + ) import Cardano.Wallet.Read.Tx - ( Tx (..) ) + ( Tx (..) + ) import Cardano.Wallet.Read.Tx.CBOR - ( renderTxToCBOR ) + ( renderTxToCBOR + ) import Cardano.Wallet.Read.Tx.Hash - ( fromShelleyTxId, shelleyTxHash ) + ( fromShelleyTxId + , shelleyTxHash + ) import Cardano.Wallet.Read.Tx.Withdrawals - ( shelleyWithdrawals ) + ( shelleyWithdrawals + ) import Cardano.Wallet.Shelley.Compatibility.Ledger - ( toWalletScriptFromShelley ) + ( toWalletScriptFromShelley + ) import Cardano.Wallet.Transaction ( AnyExplicitScript (..) , ScriptReference (..) @@ -66,9 +84,15 @@ import Cardano.Wallet.Transaction , emptyTokenMapWithScripts ) import Control.Lens - ( folded, (^.), (^..) ) + ( folded + , (^.) + , (^..) + ) import Data.Word - ( Word16, Word32, Word64 ) + ( Word16 + , Word32 + , Word64 + ) import qualified Cardano.Api.Shelley as Cardano import qualified Cardano.Ledger.BaseTypes as SL @@ -77,7 +101,8 @@ import qualified Cardano.Wallet.Primitive.Types as W import qualified Cardano.Wallet.Primitive.Types.Hash as W import qualified Cardano.Wallet.Primitive.Types.Tx as W import qualified Cardano.Wallet.Primitive.Types.Tx.TxIn as W - ( TxIn (TxIn) ) + ( TxIn (TxIn) + ) import qualified Cardano.Wallet.Shelley.Compatibility.Ledger as Ledger import qualified Data.Set as Set diff --git a/lib/wallet/src/Cardano/Wallet/Registry.hs b/lib/wallet/src/Cardano/Wallet/Registry.hs index e9b362b6d91..c3ee0673167 100644 --- a/lib/wallet/src/Cardano/Wallet/Registry.hs +++ b/lib/wallet/src/Cardano/Wallet/Registry.hs @@ -34,44 +34,71 @@ module Cardano.Wallet.Registry ) where import Prelude hiding - ( log, lookup ) + ( log + , lookup + ) import Cardano.BM.Data.Severity - ( Severity (..) ) + ( Severity (..) + ) import Cardano.BM.Data.Tracer - ( HasPrivacyAnnotation (..), HasSeverityAnnotation (..) ) + ( HasPrivacyAnnotation (..) + , HasSeverityAnnotation (..) + ) import Cardano.BM.Extra - ( LoggedException (..) ) + ( LoggedException (..) + ) import Cardano.Wallet - ( HasLogger, logger ) + ( HasLogger + , logger + ) import Control.Monad - ( void ) + ( void + ) import Control.Monad.IO.Class - ( MonadIO, liftIO ) + ( MonadIO + , liftIO + ) import Control.Tracer - ( Tracer, contramap, traceWith ) + ( Tracer + , contramap + , traceWith + ) import Data.Foldable - ( traverse_ ) + ( traverse_ + ) import Data.Generics.Internal.VL.Lens - ( (^.) ) + ( (^.) + ) import Data.Generics.Labels () import Data.Generics.Product.Typed - ( HasType ) + ( HasType + ) import Data.Kind - ( Type ) + ( Type + ) import Data.Map.Strict - ( Map ) + ( Map + ) import qualified Data.Map.Strict as Map import qualified Data.Text as T import Data.Text.Class - ( ToText (..) ) + ( ToText (..) + ) import GHC.Generics - ( Generic ) + ( Generic + ) import UnliftIO.Concurrent - ( ThreadId, forkFinally, killThread ) + ( ThreadId + , forkFinally + , killThread + ) import UnliftIO.Exception - ( SomeException, isSyncException, withException ) + ( SomeException + , isSyncException + , withException + ) import UnliftIO.MVar ( MVar , modifyMVar_ diff --git a/lib/wallet/src/Cardano/Wallet/Shelley/BlockchainSource.hs b/lib/wallet/src/Cardano/Wallet/Shelley/BlockchainSource.hs index 21ae1d8bea1..f321aa8a382 100644 --- a/lib/wallet/src/Cardano/Wallet/Shelley/BlockchainSource.hs +++ b/lib/wallet/src/Cardano/Wallet/Shelley/BlockchainSource.hs @@ -9,11 +9,14 @@ module Cardano.Wallet.Shelley.BlockchainSource ) where import Cardano.Launcher.Node - ( CardanoNodeConn ) + ( CardanoNodeConn + ) import Cardano.Wallet.Primitive.SyncProgress - ( SyncTolerance ) + ( SyncTolerance + ) import Cardano.Wallet.Shelley.Compatibility - ( NodeToClientVersionData ) + ( NodeToClientVersionData + ) data BlockchainSource diff --git a/lib/wallet/src/Cardano/Wallet/Shelley/Compatibility.hs b/lib/wallet/src/Cardano/Wallet/Shelley/Compatibility.hs index a47e6dfa501..303666adb3b 100644 --- a/lib/wallet/src/Cardano/Wallet/Shelley/Compatibility.hs +++ b/lib/wallet/src/Cardano/Wallet/Shelley/Compatibility.hs @@ -139,9 +139,14 @@ module Cardano.Wallet.Shelley.Compatibility import Prelude import Cardano.Address.Derivation - ( XPub, xpubPublicKey ) + ( XPub + , xpubPublicKey + ) import Cardano.Address.Script - ( KeyHash (..), KeyRole (..), Script (..) ) + ( KeyHash (..) + , KeyRole (..) + , Script (..) + ) import Cardano.Api ( AllegraEra , AlonzoEra @@ -171,13 +176,20 @@ import Cardano.Api.Shelley , ShelleyGenesis (..) ) import Cardano.Chain.Block - ( ABlockOrBoundary (ABOBBlock, ABOBBoundary), blockTxPayload ) + ( ABlockOrBoundary (ABOBBlock, ABOBBoundary) + , blockTxPayload + ) import Cardano.Chain.UTxO - ( unTxPayload ) + ( unTxPayload + ) import Cardano.Crypto.Hash.Class - ( Hash (UnsafeHash), hashToBytes ) + ( Hash (UnsafeHash) + , hashToBytes + ) import Cardano.Launcher.Node - ( CardanoNodeConn, nodeSocketFile ) + ( CardanoNodeConn + , nodeSocketFile + ) import Cardano.Ledger.Api ( ppCollateralPercentageL , ppDL @@ -192,27 +204,47 @@ import Cardano.Ledger.Api , ppPricesL ) import Cardano.Ledger.BaseTypes - ( strictMaybeToMaybe, urlToText ) + ( strictMaybeToMaybe + , urlToText + ) import Cardano.Ledger.Binary - ( EncCBORGroup ) + ( EncCBORGroup + ) import Cardano.Ledger.Era - ( Era (..), TxSeq ) + ( Era (..) + , TxSeq + ) import Cardano.Ledger.PoolParams - ( PoolMetadata (..), PoolParams (..) ) + ( PoolMetadata (..) + , PoolParams (..) + ) import Cardano.Ledger.Shelley.Genesis - ( fromNominalDiffTimeMicro ) + ( fromNominalDiffTimeMicro + ) import Cardano.Pool.Metadata.Types - ( StakePoolMetadataHash (..), StakePoolMetadataUrl (..) ) + ( StakePoolMetadataHash (..) + , StakePoolMetadataUrl (..) + ) import Cardano.Pool.Types - ( PoolId (..), PoolOwner (..) ) + ( PoolId (..) + , PoolOwner (..) + ) import Cardano.Slotting.Slot - ( EpochNo (..), EpochSize (..) ) + ( EpochNo (..) + , EpochSize (..) + ) import Cardano.Slotting.Time - ( SystemStart (..) ) + ( SystemStart (..) + ) import Cardano.Wallet.Address.Encoding - ( fromStakeCredential ) + ( fromStakeCredential + ) import Cardano.Wallet.Byron.Compatibility - ( fromByronBlock, fromTxAux, maryTokenBundleMaxSize, toByronBlockHeader ) + ( fromByronBlock + , fromTxAux + , maryTokenBundleMaxSize + , toByronBlockHeader + ) import Cardano.Wallet.Primitive.Types ( ChainPoint (..) , PoolCertificate @@ -221,71 +253,122 @@ import Cardano.Wallet.Primitive.Types , TxParameters (getTokenBundleMaxSize) ) import Cardano.Wallet.Read.Primitive.Tx.Allegra - ( fromAllegraTx ) + ( fromAllegraTx + ) import Cardano.Wallet.Read.Primitive.Tx.Alonzo - ( fromAlonzoTx ) + ( fromAlonzoTx + ) import Cardano.Wallet.Read.Primitive.Tx.Babbage - ( fromBabbageTx ) + ( fromBabbageTx + ) import Cardano.Wallet.Read.Primitive.Tx.Conway - ( fromConwayTx ) + ( fromConwayTx + ) import Cardano.Wallet.Read.Primitive.Tx.Features.Inputs - ( fromShelleyTxIn ) + ( fromShelleyTxIn + ) import Cardano.Wallet.Read.Primitive.Tx.Features.Outputs - ( fromCardanoValue, fromShelleyAddress, fromShelleyTxOut ) + ( fromCardanoValue + , fromShelleyAddress + , fromShelleyTxOut + ) import Cardano.Wallet.Read.Primitive.Tx.Mary - ( fromMaryTx ) + ( fromMaryTx + ) import Cardano.Wallet.Read.Primitive.Tx.Shelley - ( fromShelleyTx ) + ( fromShelleyTx + ) import Cardano.Wallet.Read.Tx.Hash - ( fromShelleyTxId ) + ( fromShelleyTxId + ) import Cardano.Wallet.Transaction - ( WitnessCountCtx (..) ) + ( WitnessCountCtx (..) + ) import Cardano.Wallet.Unsafe - ( unsafeIntToWord, unsafeMkPercentage ) + ( unsafeIntToWord + , unsafeMkPercentage + ) import Cardano.Wallet.Util - ( internalError, tina ) + ( internalError + , tina + ) import Control.Applicative - ( Const (..) ) + ( Const (..) + ) import Control.Lens - ( view, (&), (^.) ) + ( view + , (&) + , (^.) + ) import Crypto.Hash.Extra - ( blake2b224 ) + ( blake2b224 + ) import Data.Array - ( Array ) + ( Array + ) import Data.Bifunctor - ( bimap ) + ( bimap + ) import Data.ByteString - ( ByteString ) + ( ByteString + ) import Data.ByteString.Short - ( fromShort, toShort ) + ( fromShort + , toShort + ) import Data.Coerce - ( coerce ) + ( coerce + ) import Data.Either.Extra - ( eitherToMaybe ) + ( eitherToMaybe + ) import Data.Foldable - ( toList ) + ( toList + ) import Data.IntCast - ( intCast, intCastMaybe ) + ( intCast + , intCastMaybe + ) import Data.List - ( unzip6 ) + ( unzip6 + ) import Data.Map.Strict - ( Map ) + ( Map + ) import Data.Maybe - ( fromMaybe, mapMaybe ) + ( fromMaybe + , mapMaybe + ) import Data.Quantity - ( Percentage, Quantity (..), clipToPercentage, mkPercentage ) + ( Percentage + , Quantity (..) + , clipToPercentage + , mkPercentage + ) import Data.Type.Equality - ( (:~:) (..), testEquality ) + ( (:~:) (..) + , testEquality + ) import Data.Word - ( Word16, Word32 ) + ( Word16 + , Word32 + ) import Fmt - ( Buildable (..), Builder, (+|), (+||), (||+) ) + ( Buildable (..) + , Builder + , (+|) + , (+||) + , (||+) + ) import GHC.Stack - ( HasCallStack ) + ( HasCallStack + ) import Numeric.Natural - ( Natural ) + ( Natural + ) import Ouroboros.Consensus.Byron.Ledger - ( byronBlockRaw ) + ( byronBlockRaw + ) import Ouroboros.Consensus.Cardano.Block ( CardanoBlock , CardanoEras @@ -298,17 +381,28 @@ import Ouroboros.Consensus.Cardano.Block , StandardShelley ) import Ouroboros.Consensus.HardFork.Combinator.AcrossEras - ( OneEraHash (..) ) + ( OneEraHash (..) + ) import Ouroboros.Consensus.HardFork.History.Summary - ( Bound (..) ) + ( Bound (..) + ) import Ouroboros.Consensus.Shelley.Eras - ( StandardCrypto ) + ( StandardCrypto + ) import Ouroboros.Consensus.Shelley.Ledger - ( ShelleyCompatible, ShelleyHash (..) ) + ( ShelleyCompatible + , ShelleyHash (..) + ) import Ouroboros.Consensus.Shelley.Ledger.Block - ( ShelleyBlock (..) ) + ( ShelleyBlock (..) + ) import Ouroboros.Network.Block - ( BlockNo (..), ChainHash, Point (..), Tip (..), getTipPoint ) + ( BlockNo (..) + , ChainHash + , Point (..) + , Tip (..) + , getTipPoint + ) import Ouroboros.Network.NodeToClient ( ConnectionId (..) , LocalAddress (..) @@ -316,7 +410,8 @@ import Ouroboros.Network.NodeToClient , NodeToClientVersionData ) import Ouroboros.Network.Point - ( WithOrigin (..) ) + ( WithOrigin (..) + ) import qualified Cardano.Api as Cardano import qualified Cardano.Api.Shelley as Cardano @@ -352,13 +447,18 @@ import qualified Cardano.Wallet.Primitive.Types.TokenPolicy as W import qualified Cardano.Wallet.Primitive.Types.TokenQuantity as W import qualified Cardano.Wallet.Primitive.Types.Tx.Constraints as W import qualified Cardano.Wallet.Primitive.Types.Tx.SealedTx as W - ( SealedTx, cardanoTxIdeallyNoLaterThan ) + ( SealedTx + , cardanoTxIdeallyNoLaterThan + ) import qualified Cardano.Wallet.Primitive.Types.Tx.Tx as W - ( Tx (..) ) + ( Tx (..) + ) import qualified Cardano.Wallet.Primitive.Types.Tx.TxIn as W - ( TxIn (TxIn) ) + ( TxIn (TxIn) + ) import qualified Cardano.Wallet.Primitive.Types.Tx.TxOut as W - ( TxOut (TxOut) ) + ( TxOut (TxOut) + ) import qualified Cardano.Wallet.Primitive.Types.UTxO as W import qualified Cardano.Wallet.Shelley.Compatibility.Ledger as Ledger import qualified Data.Array as Array diff --git a/lib/wallet/src/Cardano/Wallet/Shelley/Network.hs b/lib/wallet/src/Cardano/Wallet/Shelley/Network.hs index b4c8b09871d..cc71e807bbb 100644 --- a/lib/wallet/src/Cardano/Wallet/Shelley/Network.hs +++ b/lib/wallet/src/Cardano/Wallet/Shelley/Network.hs @@ -17,27 +17,41 @@ import Prelude import qualified Cardano.Wallet.Shelley.Network.Node as Node import Cardano.BM.Tracing - ( HasPrivacyAnnotation, HasSeverityAnnotation (..), Tracer ) + ( HasPrivacyAnnotation + , HasSeverityAnnotation (..) + , Tracer + ) import Cardano.Wallet.Network - ( NetworkLayer ) + ( NetworkLayer + ) import Cardano.Wallet.Primitive.NetworkId - ( NetworkId ) + ( NetworkId + ) import Cardano.Wallet.Primitive.Types - ( NetworkParameters ) + ( NetworkParameters + ) import Cardano.Wallet.Shelley.BlockchainSource - ( BlockchainSource (..) ) + ( BlockchainSource (..) + ) import Cardano.Wallet.Shelley.Compatibility - ( CardanoBlock, StandardCrypto ) + ( CardanoBlock + , StandardCrypto + ) import Control.Monad.Trans.Cont - ( ContT (ContT) ) + ( ContT (ContT) + ) import Data.Functor.Contravariant - ( (>$<) ) + ( (>$<) + ) import Data.Text.Class - ( ToText (toText) ) + ( ToText (toText) + ) import GHC.Stack - ( HasCallStack ) + ( HasCallStack + ) import Ouroboros.Network.Client.Wallet - ( PipeliningStrategy ) + ( PipeliningStrategy + ) newtype NetworkLayerLog = NodeNetworkLog Node.Log diff --git a/lib/wallet/src/Cardano/Wallet/Shelley/Network/Node.hs b/lib/wallet/src/Cardano/Wallet/Shelley/Network/Node.hs index 5bb9add90ea..57e8748d046 100644 --- a/lib/wallet/src/Cardano/Wallet/Shelley/Network/Node.hs +++ b/lib/wallet/src/Cardano/Wallet/Shelley/Network/Node.hs @@ -39,19 +39,32 @@ import Cardano.Api , SlotNo (..) ) import Cardano.Api.Shelley - ( toConsensusGenTx ) + ( toConsensusGenTx + ) import Cardano.BM.Data.Severity - ( Severity (..) ) + ( Severity (..) + ) import Cardano.BM.Data.Tracer - ( HasPrivacyAnnotation (..), HasSeverityAnnotation (..) ) + ( HasPrivacyAnnotation (..) + , HasSeverityAnnotation (..) + ) import Cardano.BM.Extra - ( BracketLog, bracketTracer, produceTimings ) + ( BracketLog + , bracketTracer + , produceTimings + ) import Cardano.Launcher.Node - ( CardanoNodeConn, nodeSocketFile ) + ( CardanoNodeConn + , nodeSocketFile + ) import Cardano.Pool.Types - ( PoolId, StakePoolsSummary (..) ) + ( PoolId + , StakePoolsSummary (..) + ) import Cardano.Wallet.Byron.Compatibility - ( byronCodecConfig, protocolParametersFromUpdateState ) + ( byronCodecConfig + , protocolParametersFromUpdateState + ) import Cardano.Wallet.Network ( ChainFollowLog (..) , ChainFollower @@ -69,11 +82,15 @@ import Cardano.Wallet.Primitive.Slotting , mkTimeInterpreter ) import Cardano.Wallet.Primitive.SyncProgress - ( SyncProgress (..), SyncTolerance ) + ( SyncProgress (..) + , SyncTolerance + ) import Cardano.Wallet.Primitive.Types - ( GenesisParameters (..) ) + ( GenesisParameters (..) + ) import Cardano.Wallet.Primitive.Types.Tx - ( SealedTx (..) ) + ( SealedTx (..) + ) import Cardano.Wallet.Shelley.Compatibility ( StandardCrypto , fromAllegraPParams @@ -99,7 +116,8 @@ import Cardano.Wallet.Shelley.Compatibility , unsealShelleyTx ) import Control.Applicative - ( liftA3 ) + ( liftA3 + ) import Control.Concurrent.Class.MonadSTM ( MonadSTM , STM @@ -124,21 +142,36 @@ import Control.Concurrent.Class.MonadSTM , writeTVar ) import Control.Monad - ( forever, unless, void, when ) + ( forever + , unless + , void + , when + ) import Control.Monad.Class.MonadAsync - ( MonadAsync ) + ( MonadAsync + ) import Control.Monad.Class.MonadST - ( MonadST ) + ( MonadST + ) import Control.Monad.Class.MonadThrow - ( MonadThrow ) + ( MonadThrow + ) import Control.Monad.Class.MonadTimer - ( MonadTimer, threadDelay ) + ( MonadTimer + , threadDelay + ) import Control.Monad.Except - ( runExcept ) + ( runExcept + ) import Control.Monad.IO.Unlift - ( MonadIO, MonadUnliftIO, liftIO ) + ( MonadIO + , MonadUnliftIO + , liftIO + ) import Control.Monad.Trans.Except - ( ExceptT (..), throwE ) + ( ExceptT (..) + , throwE + ) import Control.Retry ( RetryAction (..) , RetryPolicyM @@ -148,45 +181,78 @@ import Control.Retry , recoveringDynamic ) import Control.Tracer - ( Tracer (..), contramap, nullTracer, traceWith ) + ( Tracer (..) + , contramap + , nullTracer + , traceWith + ) import Data.ByteString.Lazy - ( ByteString ) + ( ByteString + ) import Data.Either - ( fromRight ) + ( fromRight + ) import Data.Function - ( (&) ) + ( (&) + ) import Data.Functor - ( ($>) ) + ( ($>) + ) import Data.Functor.Contravariant - ( (>$<) ) + ( (>$<) + ) import Data.List - ( isInfixOf ) + ( isInfixOf + ) import Data.List.NonEmpty - ( NonEmpty ) + ( NonEmpty + ) import Data.Map - ( Map, (!) ) + ( Map + , (!) + ) import Data.Maybe - ( fromMaybe ) + ( fromMaybe + ) import Data.Proxy - ( Proxy (..) ) + ( Proxy (..) + ) import Data.Quantity - ( Percentage ) + ( Percentage + ) import Data.Set - ( Set ) + ( Set + ) import Data.Text.Class - ( ToText (..) ) + ( ToText (..) + ) import Data.Time.Clock - ( DiffTime ) + ( DiffTime + ) import Data.Void - ( Void ) + ( Void + ) import Fmt - ( Buildable (..), fmt, hexF, listF, mapF, pretty, (+|), (|+) ) + ( Buildable (..) + , fmt + , hexF + , listF + , mapF + , pretty + , (+|) + , (|+) + ) import GHC.Stack - ( HasCallStack ) + ( HasCallStack + ) import Network.Mux - ( MuxError (..), MuxErrorType (..), WithMuxBearer (..) ) + ( MuxError (..) + , MuxErrorType (..) + , WithMuxBearer (..) + ) import Ouroboros.Consensus.Cardano - ( CardanoBlock ) + ( CardanoBlock + ) import Ouroboros.Consensus.Cardano.Block ( BlockQuery (..) , CardanoEras @@ -200,29 +266,52 @@ import Ouroboros.Consensus.Cardano.Block , StandardShelley ) import Ouroboros.Consensus.HardFork.Combinator - ( EraIndex (..), QueryAnytime (..), QueryHardFork (..), eraIndexToInt ) + ( EraIndex (..) + , QueryAnytime (..) + , QueryHardFork (..) + , eraIndexToInt + ) import Ouroboros.Consensus.HardFork.Combinator.AcrossEras - ( MismatchEraInfo ) + ( MismatchEraInfo + ) import Ouroboros.Consensus.HardFork.History.Qry - ( Interpreter, PastHorizonException (..) ) + ( Interpreter + , PastHorizonException (..) + ) import Ouroboros.Consensus.Ledger.Query - ( Query (..) ) + ( Query (..) + ) import Ouroboros.Consensus.Ledger.SupportsMempool - ( ApplyTxErr ) + ( ApplyTxErr + ) import Ouroboros.Consensus.Network.NodeToClient - ( ClientCodecs, Codecs' (..), DefaultCodecs, clientCodecs, defaultCodecs ) + ( ClientCodecs + , Codecs' (..) + , DefaultCodecs + , clientCodecs + , defaultCodecs + ) import Ouroboros.Consensus.Node.NetworkProtocolVersion - ( HasNetworkProtocolVersion (..), SupportedNetworkProtocolVersion (..) ) + ( HasNetworkProtocolVersion (..) + , SupportedNetworkProtocolVersion (..) + ) import Ouroboros.Consensus.Protocol.Praos - ( Praos ) + ( Praos + ) import Ouroboros.Consensus.Protocol.TPraos - ( TPraos ) + ( TPraos + ) import Ouroboros.Consensus.Shelley.Eras - ( StandardConway ) + ( StandardConway + ) import Ouroboros.Consensus.Shelley.Ledger.Config - ( CodecConfig (..), getCompactGenesis ) + ( CodecConfig (..) + , getCompactGenesis + ) import Ouroboros.Network.Block - ( Point, Tip (..) ) + ( Point + , Tip (..) + ) import Ouroboros.Network.Client.Wallet ( LSQ (..) , LocalStateQueryCmd (..) @@ -235,7 +324,10 @@ import Ouroboros.Network.Client.Wallet , send ) import Ouroboros.Network.Driver.Simple - ( TraceSendRecv, runPeer, runPipelinedPeer ) + ( TraceSendRecv + , runPeer + , runPipelinedPeer + ) import Ouroboros.Network.Mux ( MuxMode (..) , MuxPeer (..) @@ -255,29 +347,46 @@ import Ouroboros.Network.NodeToClient , withIOManager ) import Ouroboros.Network.Protocol.ChainSync.Client - ( chainSyncClientPeer ) + ( chainSyncClientPeer + ) import Ouroboros.Network.Protocol.ChainSync.ClientPipelined - ( chainSyncClientPeerPipelined ) + ( chainSyncClientPeerPipelined + ) import Ouroboros.Network.Protocol.Handshake.Version - ( combineVersions, simpleSingletonVersions ) + ( combineVersions + , simpleSingletonVersions + ) import Ouroboros.Network.Protocol.LocalStateQuery.Client - ( localStateQueryClientPeer ) + ( localStateQueryClientPeer + ) import Ouroboros.Network.Protocol.LocalStateQuery.Type - ( LocalStateQuery ) + ( LocalStateQuery + ) import Ouroboros.Network.Protocol.LocalTxSubmission.Client - ( localTxSubmissionClientPeer ) + ( localTxSubmissionClientPeer + ) import Ouroboros.Network.Protocol.LocalTxSubmission.Type - ( LocalTxSubmission (..), SubmitResult (..) ) + ( LocalTxSubmission (..) + , SubmitResult (..) + ) import System.IO.Error - ( isDoesNotExistError, isResourceVanishedError ) + ( isDoesNotExistError + , isResourceVanishedError + ) import UnliftIO.Async - ( async, link ) + ( async + , link + ) import UnliftIO.Compat - ( coerceHandlers ) + ( coerceHandlers + ) import UnliftIO.Concurrent - ( ThreadId ) + ( ThreadId + ) import UnliftIO.Exception - ( Handler (..), IOException ) + ( Handler (..) + , IOException + ) import qualified Cardano.Crypto.Hash as Crypto import qualified Cardano.Ledger.Credential as SL diff --git a/lib/wallet/src/Cardano/Wallet/Shelley/Transaction.hs b/lib/wallet/src/Cardano/Wallet/Shelley/Transaction.hs index 51ebd602ba9..d64a008f6f5 100644 --- a/lib/wallet/src/Cardano/Wallet/Shelley/Transaction.hs +++ b/lib/wallet/src/Cardano/Wallet/Shelley/Transaction.hs @@ -53,7 +53,9 @@ module Cardano.Wallet.Shelley.Transaction import Prelude import Cardano.Address.Derivation - ( XPrv, toXPub ) + ( XPrv + , toXPub + ) import Cardano.Address.Script ( KeyHash (..) , KeyRole (..) @@ -73,41 +75,61 @@ import Cardano.Api , ToCBOR ) import Cardano.Binary - ( serialize' ) + ( serialize' + ) import Cardano.Crypto.Wallet - ( XPub ) + ( XPub + ) import Cardano.Ledger.Allegra.Core - ( inputsTxBodyL ) + ( inputsTxBodyL + ) import Cardano.Ledger.Crypto - ( DSIGN ) + ( DSIGN + ) import Cardano.Wallet.Address.Derivation - ( Depth (..), RewardAccount (..) ) + ( Depth (..) + , RewardAccount (..) + ) import Cardano.Wallet.Address.Derivation.SharedKey - ( replaceCosignersWithVerKeys ) + ( replaceCosignersWithVerKeys + ) import Cardano.Wallet.Address.Derivation.Shelley - ( toRewardAccountRaw ) + ( toRewardAccountRaw + ) import Cardano.Wallet.Address.Encoding - ( toHDPayloadAddress ) + ( toHDPayloadAddress + ) import Cardano.Wallet.Address.Keys.WalletKey - ( getRawKey ) + ( getRawKey + ) import Cardano.Wallet.Flavor - ( KeyFlavorS (..) ) + ( KeyFlavorS (..) + ) import Cardano.Wallet.Primitive.Passphrase - ( Passphrase (..) ) + ( Passphrase (..) + ) import Cardano.Wallet.Primitive.Types - ( Certificate ) + ( Certificate + ) import Cardano.Wallet.Primitive.Types.Address - ( Address (..) ) + ( Address (..) + ) import Cardano.Wallet.Primitive.Types.Coin - ( Coin (..) ) + ( Coin (..) + ) import Cardano.Wallet.Primitive.Types.Hash - ( Hash (..) ) + ( Hash (..) + ) import Cardano.Wallet.Primitive.Types.TokenBundle - ( TokenBundle (..) ) + ( TokenBundle (..) + ) import Cardano.Wallet.Primitive.Types.TokenMap - ( AssetId (..), TokenMap ) + ( AssetId (..) + , TokenMap + ) import Cardano.Wallet.Primitive.Types.TokenQuantity - ( TokenQuantity (TokenQuantity) ) + ( TokenQuantity (TokenQuantity) + ) import Cardano.Wallet.Primitive.Types.Tx ( SealedTx (..) , Tx (..) @@ -115,13 +137,20 @@ import Cardano.Wallet.Primitive.Types.Tx , sealedTxFromCardano' ) import Cardano.Wallet.Primitive.Types.Tx.Constraints - ( TxConstraints (..), TxSize (..), txOutMaxCoin, txOutMaxTokenQuantity ) + ( TxConstraints (..) + , TxSize (..) + , txOutMaxCoin + , txOutMaxTokenQuantity + ) import Cardano.Wallet.Primitive.Types.Tx.TxIn - ( TxIn (..) ) + ( TxIn (..) + ) import Cardano.Wallet.Primitive.Types.Tx.TxOut - ( TxOut (..) ) + ( TxOut (..) + ) import Cardano.Wallet.Read.Primitive.Tx - ( fromCardanoTx ) + ( fromCardanoTx + ) import Cardano.Wallet.Shelley.Compatibility ( cardanoCertKeysForWitnesses , fromCardanoAddress @@ -138,7 +167,8 @@ import Cardano.Wallet.Shelley.Compatibility , toStakePoolDlgCert ) import Cardano.Wallet.Shelley.Compatibility.Ledger - ( Convert (toLedger) ) + ( Convert (toLedger) + ) import Cardano.Wallet.Transaction ( AnyExplicitScript (..) , AnyScript (..) @@ -159,39 +189,64 @@ import Cardano.Wallet.Transaction , selectionDelta ) import Cardano.Wallet.Util - ( HasCallStack, internalError ) + ( HasCallStack + , internalError + ) import Control.Arrow - ( left, second ) + ( left + , second + ) import Control.Lens - ( over ) + ( over + ) import Control.Monad - ( forM_, guard, when ) + ( forM_ + , guard + , when + ) import Data.Bifunctor - ( bimap ) + ( bimap + ) import Data.Function - ( (&) ) + ( (&) + ) import Data.Functor - ( ($>) ) + ( ($>) + ) import Data.Generics.Internal.VL.Lens - ( view, (^.) ) + ( view + , (^.) + ) import Data.Generics.Labels () import Data.Map.Strict - ( Map ) + ( Map + ) import Data.Maybe - ( mapMaybe ) + ( mapMaybe + ) import Data.Monoid.Monus - ( Monus ((<\>)) ) + ( Monus ((<\>)) + ) import Data.Type.Equality - ( type (==) ) + ( type (==) + ) import Data.Word - ( Word64, Word8 ) + ( Word64 + , Word8 + ) import Internal.Cardano.Write.ProtocolParameters - ( ProtocolParameters (..) ) + ( ProtocolParameters (..) + ) import Internal.Cardano.Write.Tx.SizeEstimation - ( TxSkeleton (..), TxWitnessTag (..), estimateTxCost, estimateTxSize ) + ( TxSkeleton (..) + , TxWitnessTag (..) + , estimateTxCost + , estimateTxSize + ) import Ouroboros.Network.Block - ( SlotNo ) + ( SlotNo + ) import qualified Cardano.Address.Script as CA import qualified Cardano.Address.Style.Shelley as CA diff --git a/lib/wallet/src/Cardano/Wallet/Submissions/Operations.hs b/lib/wallet/src/Cardano/Wallet/Submissions/Operations.hs index decbbf711cb..0faa6cb5908 100644 --- a/lib/wallet/src/Cardano/Wallet/Submissions/Operations.hs +++ b/lib/wallet/src/Cardano/Wallet/Submissions/Operations.hs @@ -22,15 +22,21 @@ module Cardano.Wallet.Submissions.Operations import Prelude import Cardano.Wallet.Submissions.Primitives - ( Primitive (MoveFinality, MoveTip), applyPrimitive ) + ( Primitive (MoveFinality, MoveTip) + , applyPrimitive + ) import Cardano.Wallet.Submissions.Submissions - ( Submissions ) + ( Submissions + ) import Cardano.Wallet.Submissions.TxStatus - ( HasTxId (..) ) + ( HasTxId (..) + ) import Data.Foldable - ( Foldable (..) ) + ( Foldable (..) + ) import Fmt - ( Buildable (..) ) + ( Buildable (..) + ) import qualified Cardano.Wallet.Submissions.Primitives as DP diff --git a/lib/wallet/src/Cardano/Wallet/Submissions/Primitives.hs b/lib/wallet/src/Cardano/Wallet/Submissions/Primitives.hs index 9b2f186048a..40d180084c1 100644 --- a/lib/wallet/src/Cardano/Wallet/Submissions/Primitives.hs +++ b/lib/wallet/src/Cardano/Wallet/Submissions/Primitives.hs @@ -37,11 +37,18 @@ import Cardano.Wallet.Submissions.Submissions , txStatus ) import Cardano.Wallet.Submissions.TxStatus - ( HasTxId (..), TxStatus (Expired, InLedger, InSubmission) ) + ( HasTxId (..) + , TxStatus (Expired, InLedger, InSubmission) + ) import Control.Lens - ( ix, (%~), (&), (.~) ) + ( ix + , (%~) + , (&) + , (.~) + ) import Data.Foldable - ( Foldable (..) ) + ( Foldable (..) + ) import qualified Data.Map.Strict as Map diff --git a/lib/wallet/src/Cardano/Wallet/Submissions/Properties/Common.hs b/lib/wallet/src/Cardano/Wallet/Submissions/Properties/Common.hs index d52a74a375c..bc3e1a850dd 100644 --- a/lib/wallet/src/Cardano/Wallet/Submissions/Properties/Common.hs +++ b/lib/wallet/src/Cardano/Wallet/Submissions/Properties/Common.hs @@ -12,19 +12,31 @@ module Cardano.Wallet.Submissions.Properties.Common import Prelude import Cardano.Wallet.Submissions.Submissions - ( Submissions ) + ( Submissions + ) import Cardano.Wallet.Submissions.TxStatus - ( HasTxId ) + ( HasTxId + ) import Control.Lens - ( makeLenses ) + ( makeLenses + ) import Control.Monad.Trans.Writer - ( Writer, execWriter, tell ) + ( Writer + , execWriter + , tell + ) import Data.Foldable - ( toList ) + ( toList + ) import Data.Set - ( Set ) + ( Set + ) import Test.QuickCheck - ( Property, Testable (..), conjoin, counterexample ) + ( Property + , Testable (..) + , conjoin + , counterexample + ) forAllIn :: Show a diff --git a/lib/wallet/src/Cardano/Wallet/Submissions/Properties/Operations.hs b/lib/wallet/src/Cardano/Wallet/Submissions/Properties/Operations.hs index d56b554cb8d..6dea22af7f7 100644 --- a/lib/wallet/src/Cardano/Wallet/Submissions/Properties/Operations.hs +++ b/lib/wallet/src/Cardano/Wallet/Submissions/Properties/Operations.hs @@ -7,19 +7,37 @@ module Cardano.Wallet.Submissions.Properties.Operations import Prelude import Cardano.Wallet.Submissions.Operations - ( Operation (..) ) + ( Operation (..) + ) import Cardano.Wallet.Submissions.Properties.Common - ( Step (Step), forAllIn, that, verify ) + ( Step (Step) + , forAllIn + , that + , verify + ) import Cardano.Wallet.Submissions.Properties.Primitives - ( txIds ) + ( txIds + ) import Cardano.Wallet.Submissions.Submissions - ( Submissions, finality, tip, transactions ) + ( Submissions + , finality + , tip + , transactions + ) import Cardano.Wallet.Submissions.TxStatus - ( HasTxId (TxId), TxStatus (Expired, InLedger, InSubmission), status ) + ( HasTxId (TxId) + , TxStatus (Expired, InLedger, InSubmission) + , status + ) import Data.Function - ( (&) ) + ( (&) + ) import Test.QuickCheck - ( Property, counterexample, property, (.&.) ) + ( Property + , counterexample + , property + , (.&.) + ) status' :: Ord (TxId tx) => TxId tx -> Submissions meta slot tx -> TxStatus slot tx status' x = status x . transactions diff --git a/lib/wallet/src/Cardano/Wallet/Submissions/Properties/Primitives.hs b/lib/wallet/src/Cardano/Wallet/Submissions/Properties/Primitives.hs index 51698551967..eaa8884f20c 100644 --- a/lib/wallet/src/Cardano/Wallet/Submissions/Properties/Primitives.hs +++ b/lib/wallet/src/Cardano/Wallet/Submissions/Properties/Primitives.hs @@ -10,22 +10,39 @@ module Cardano.Wallet.Submissions.Properties.Primitives import Prelude import Cardano.Wallet.Submissions.Primitives - ( Primitive (..) ) + ( Primitive (..) + ) import Cardano.Wallet.Submissions.Properties.Common - ( Step (Step), forAllIn, that, verify ) + ( Step (Step) + , forAllIn + , that + , verify + ) import Cardano.Wallet.Submissions.Submissions - ( Submissions, finality, tip, transactions ) + ( Submissions + , finality + , tip + , transactions + ) import Cardano.Wallet.Submissions.TxStatus ( HasTxId (..) , TxStatus (Expired, InLedger, InSubmission, Unknown) , status ) import Data.Function - ( (&) ) + ( (&) + ) import Data.Set - ( Set, singleton ) + ( Set + , singleton + ) import Test.QuickCheck - ( Property, counterexample, (.&&.), (.&.), (===) ) + ( Property + , counterexample + , (.&&.) + , (.&.) + , (===) + ) import qualified Data.Map.Strict as Map diff --git a/lib/wallet/src/Cardano/Wallet/Submissions/Submissions.hs b/lib/wallet/src/Cardano/Wallet/Submissions/Submissions.hs index 9b2ddc1d62c..1f3b9a49de6 100644 --- a/lib/wallet/src/Cardano/Wallet/Submissions/Submissions.hs +++ b/lib/wallet/src/Cardano/Wallet/Submissions/Submissions.hs @@ -31,11 +31,17 @@ module Cardano.Wallet.Submissions.Submissions import Prelude import Cardano.Wallet.Submissions.TxStatus - ( HasTxId (TxId), TxStatus, TxStatuses ) + ( HasTxId (TxId) + , TxStatus + , TxStatuses + ) import Control.Lens - ( makeLenses, view ) + ( makeLenses + , view + ) import Data.Map.Strict - ( Map ) + ( Map + ) import qualified Data.Map as Map diff --git a/lib/wallet/src/Cardano/Wallet/Submissions/TxStatus.hs b/lib/wallet/src/Cardano/Wallet/Submissions/TxStatus.hs index d18ad4fad86..b0aa8d047b2 100644 --- a/lib/wallet/src/Cardano/Wallet/Submissions/TxStatus.hs +++ b/lib/wallet/src/Cardano/Wallet/Submissions/TxStatus.hs @@ -30,11 +30,14 @@ module Cardano.Wallet.Submissions.TxStatus import Prelude import Control.Lens - ( makePrisms ) + ( makePrisms + ) import Data.Map.Strict - ( Map ) + ( Map + ) import Data.Maybe - ( fromMaybe ) + ( fromMaybe + ) import qualified Data.Map.Strict as Map diff --git a/lib/wallet/src/Cardano/Wallet/TokenMetadata.hs b/lib/wallet/src/Cardano/Wallet/TokenMetadata.hs index d601d00c0c3..60f7039206a 100644 --- a/lib/wallet/src/Cardano/Wallet/TokenMetadata.hs +++ b/lib/wallet/src/Cardano/Wallet/TokenMetadata.hs @@ -74,9 +74,12 @@ module Cardano.Wallet.TokenMetadata import Prelude import Cardano.BM.Data.Severity - ( Severity (..) ) + ( Severity (..) + ) import Cardano.BM.Data.Tracer - ( HasPrivacyAnnotation, HasSeverityAnnotation (..) ) + ( HasPrivacyAnnotation + , HasSeverityAnnotation (..) + ) import Cardano.BM.Extra ( BracketLog , BracketLog' (..) @@ -85,11 +88,14 @@ import Cardano.BM.Extra , produceTimings ) import Cardano.Wallet.Primitive.Types - ( TokenMetadataServer (..) ) + ( TokenMetadataServer (..) + ) import Cardano.Wallet.Primitive.Types.Hash - ( Hash (..) ) + ( Hash (..) + ) import Cardano.Wallet.Primitive.Types.TokenMap - ( AssetId (..) ) + ( AssetId (..) + ) import Cardano.Wallet.Primitive.Types.TokenPolicy ( AssetDecimals (..) , AssetLogo (..) @@ -105,13 +111,20 @@ import Cardano.Wallet.Primitive.Types.TokenPolicy , validateMetadataURL ) import Control.Applicative - ( (<|>) ) + ( (<|>) + ) import Control.DeepSeq - ( NFData (..) ) + ( NFData (..) + ) import Control.Monad - ( when, (>=>) ) + ( when + , (>=>) + ) import Control.Tracer - ( Tracer, contramap, traceWith ) + ( Tracer + , contramap + , traceWith + ) import Data.Aeson ( FromJSON (..) , Object @@ -126,37 +139,59 @@ import Data.Aeson , (.:?) ) import Data.Aeson.Types - ( Parser, fromJSON ) + ( Parser + , fromJSON + ) import Data.Bifunctor - ( first ) + ( first + ) import Data.ByteArray.Encoding - ( Base (Base16, Base64), convertFromBase, convertToBase ) + ( Base (Base16, Base64) + , convertFromBase + , convertToBase + ) import Data.ByteString - ( ByteString ) + ( ByteString + ) import Data.Foldable - ( toList ) + ( toList + ) import Data.Functor - ( ($>) ) + ( ($>) + ) import Data.Hashable - ( Hashable ) + ( Hashable + ) import Data.Kind - ( Type ) + ( Type + ) import Data.Maybe - ( catMaybes, mapMaybe ) + ( catMaybes + , mapMaybe + ) import Data.Proxy - ( Proxy (..) ) + ( Proxy (..) + ) import Data.String - ( IsString (..) ) + ( IsString (..) + ) import Data.Text - ( Text ) + ( Text + ) import Data.Text.Class - ( ToText (..) ) + ( ToText (..) + ) import Data.Time.Clock - ( DiffTime ) + ( DiffTime + ) import GHC.Generics - ( Generic ) + ( Generic + ) import GHC.TypeLits - ( KnownSymbol, Symbol, symbolVal ) + ( KnownSymbol + , Symbol + , symbolVal + ) import Network.HTTP.Client ( HttpException , Manager @@ -169,13 +204,20 @@ import Network.HTTP.Client , withResponse ) import Network.HTTP.Client.TLS - ( newTlsManager ) + ( newTlsManager + ) import Network.URI - ( URI, relativeTo ) + ( URI + , relativeTo + ) import Network.URI.Static - ( relativeReference ) + ( relativeReference + ) import UnliftIO.Exception - ( SomeException, handle, handleAny ) + ( SomeException + , handle + , handleAny + ) import qualified Data.Aeson.Types as Aeson import qualified Data.ByteString.Char8 as B8 diff --git a/lib/wallet/src/Cardano/Wallet/Transaction.hs b/lib/wallet/src/Cardano/Wallet/Transaction.hs index 66401c02920..c474bb4b3f5 100644 --- a/lib/wallet/src/Cardano/Wallet/Transaction.hs +++ b/lib/wallet/src/Cardano/Wallet/Transaction.hs @@ -60,65 +60,108 @@ module Cardano.Wallet.Transaction import Prelude import Cardano.Address.Derivation - ( XPrv, XPub ) + ( XPrv + , XPub + ) import Cardano.Address.Script - ( KeyHash (..), KeyRole (..), Script (..), ScriptHash, ScriptTemplate ) + ( KeyHash (..) + , KeyRole (..) + , Script (..) + , ScriptHash + , ScriptTemplate + ) import Cardano.Api - ( AnyCardanoEra ) + ( AnyCardanoEra + ) import Cardano.Api.Extra () import Cardano.Pool.Types - ( PoolId ) + ( PoolId + ) import Cardano.Wallet.Address.Derivation - ( Depth (..), DerivationIndex ) + ( Depth (..) + , DerivationIndex + ) import Cardano.Wallet.Primitive.Passphrase.Types - ( Passphrase ) + ( Passphrase + ) import Cardano.Wallet.Primitive.Slotting - ( PastHorizonException ) + ( PastHorizonException + ) import Cardano.Wallet.Primitive.Types - ( Certificate, ProtocolParameters, SlotNo (..) ) + ( Certificate + , ProtocolParameters + , SlotNo (..) + ) import Cardano.Wallet.Primitive.Types.Address - ( Address (..) ) + ( Address (..) + ) import Cardano.Wallet.Primitive.Types.Coin - ( Coin (..) ) + ( Coin (..) + ) import Cardano.Wallet.Primitive.Types.Hash - ( Hash (..) ) + ( Hash (..) + ) import Cardano.Wallet.Primitive.Types.RewardAccount - ( RewardAccount ) + ( RewardAccount + ) import Cardano.Wallet.Primitive.Types.TokenMap - ( AssetId, TokenMap ) + ( AssetId + , TokenMap + ) import Cardano.Wallet.Primitive.Types.TokenPolicy - ( TokenPolicyId ) + ( TokenPolicyId + ) import Cardano.Wallet.Primitive.Types.TokenQuantity - ( TokenQuantity ) + ( TokenQuantity + ) import Cardano.Wallet.Primitive.Types.Tx.Tx - ( Tx (..), TxMetadata ) + ( Tx (..) + , TxMetadata + ) import Cardano.Wallet.Primitive.Types.Tx.TxIn - ( TxIn (..) ) + ( TxIn (..) + ) import Cardano.Wallet.Primitive.Types.Tx.TxOut - ( TxOut (..) ) + ( TxOut (..) + ) import Control.DeepSeq - ( NFData (..) ) + ( NFData (..) + ) import Data.List.NonEmpty - ( NonEmpty ) + ( NonEmpty + ) import Data.Map.Strict - ( Map ) + ( Map + ) import Data.Monoid.Monus - ( (<\>) ) + ( (<\>) + ) import Data.Quantity - ( Quantity (..) ) + ( Quantity (..) + ) import Data.Text - ( Text ) + ( Text + ) import Data.Text.Class - ( FromText (..), TextDecodingError (..), ToText (..) ) + ( FromText (..) + , TextDecodingError (..) + , ToText (..) + ) import Data.Word - ( Word64, Word8 ) + ( Word64 + , Word8 + ) import Fmt - ( Buildable (..), genericF ) + ( Buildable (..) + , genericF + ) import GHC.Generics - ( Generic ) + ( Generic + ) import Internal.Cardano.Write.Tx.SizeEstimation - ( TxWitnessTag ) + ( TxWitnessTag + ) import qualified Cardano.Api as Cardano import qualified Cardano.Wallet.Primitive.Types.TokenMap as TokenMap diff --git a/lib/wallet/src/Cardano/Wallet/Transaction/Built.hs b/lib/wallet/src/Cardano/Wallet/Transaction/Built.hs index 39894e0e381..2126849f034 100644 --- a/lib/wallet/src/Cardano/Wallet/Transaction/Built.hs +++ b/lib/wallet/src/Cardano/Wallet/Transaction/Built.hs @@ -5,9 +5,12 @@ module Cardano.Wallet.Transaction.Built import Prelude import Cardano.Wallet.Primitive.Types.Tx - ( SealedTx, Tx ) + ( SealedTx + , Tx + ) import Cardano.Wallet.Primitive.Types.Tx.TxMeta - ( TxMeta ) + ( TxMeta + ) data BuiltTx = BuiltTx { builtTx :: Tx diff --git a/lib/wallet/src/Cardano/Wallet/TypeLevel.hs b/lib/wallet/src/Cardano/Wallet/TypeLevel.hs index ed824628bcb..f50f6559cbd 100644 --- a/lib/wallet/src/Cardano/Wallet/TypeLevel.hs +++ b/lib/wallet/src/Cardano/Wallet/TypeLevel.hs @@ -15,9 +15,11 @@ module Cardano.Wallet.TypeLevel import Prelude import Data.Kind - ( Constraint ) + ( Constraint + ) import Data.Type.Equality - ( type (==) ) + ( type (==) + ) type family Excluding xs x :: Constraint where Excluding '[] _ = () diff --git a/lib/wallet/src/Cardano/Wallet/Version.hs b/lib/wallet/src/Cardano/Wallet/Version.hs index 2c0eec55e2d..eaace3252fa 100644 --- a/lib/wallet/src/Cardano/Wallet/Version.hs +++ b/lib/wallet/src/Cardano/Wallet/Version.hs @@ -30,21 +30,32 @@ module Cardano.Wallet.Version import Prelude import Cardano.Wallet.Version.TH - ( gitRevFromGit ) + ( gitRevFromGit + ) import Data.FileEmbed - ( dummySpaceWith ) + ( dummySpaceWith + ) import Data.String - ( fromString ) + ( fromString + ) import Data.Text - ( Text ) + ( Text + ) import Data.Text.Encoding - ( decodeLatin1 ) + ( decodeLatin1 + ) import Data.Version - ( Version (..), showVersion ) + ( Version (..) + , showVersion + ) import Fmt - ( build, fmt, padLeftF ) + ( build + , fmt + , padLeftF + ) import Paths_cardano_wallet - ( version ) + ( version + ) import qualified Data.Text as T diff --git a/lib/wallet/src/Cardano/Wallet/Version/TH.hs b/lib/wallet/src/Cardano/Wallet/Version/TH.hs index 311953a8edc..cb020875a17 100644 --- a/lib/wallet/src/Cardano/Wallet/Version/TH.hs +++ b/lib/wallet/src/Cardano/Wallet/Version/TH.hs @@ -14,19 +14,34 @@ module Cardano.Wallet.Version.TH import Prelude import Fmt - ( fmt, (+|), (+||), (|+), (||+) ) + ( fmt + , (+|) + , (+||) + , (|+) + , (||+) + ) import Language.Haskell.TH - ( Exp (..), Lit (..), Q, runIO ) + ( Exp (..) + , Lit (..) + , Q + , runIO + ) import System.Exit - ( ExitCode (..) ) + ( ExitCode (..) + ) import System.IO - ( hPutStrLn, stderr ) + ( hPutStrLn + , stderr + ) import System.IO.Error - ( isDoesNotExistError ) + ( isDoesNotExistError + ) import UnliftIO.Exception - ( handle ) + ( handle + ) import UnliftIO.Process - ( readProcessWithExitCode ) + ( readProcessWithExitCode + ) -- | Git revision found by running @git rev-parse@. If @git@ could not be -- executed, then this will be an empty string. diff --git a/lib/wallet/src/Control/Concurrent/Concierge.hs b/lib/wallet/src/Control/Concurrent/Concierge.hs index 86baa6087db..bf65821f85b 100644 --- a/lib/wallet/src/Control/Concurrent/Concierge.hs +++ b/lib/wallet/src/Control/Concurrent/Concierge.hs @@ -30,13 +30,21 @@ import Control.Concurrent.Class.MonadSTM , writeTVar ) import Control.Monad.Class.MonadFork - ( MonadThread, ThreadId, myThreadId ) + ( MonadThread + , ThreadId + , myThreadId + ) import Control.Monad.Class.MonadThrow - ( MonadThrow, bracket ) + ( MonadThrow + , bracket + ) import Control.Monad.IO.Class - ( MonadIO, liftIO ) + ( MonadIO + , liftIO + ) import Data.Map.Strict - ( Map ) + ( Map + ) import qualified Data.Map.Strict as Map diff --git a/lib/wallet/src/Control/Monad/Exception/Unchecked.hs b/lib/wallet/src/Control/Monad/Exception/Unchecked.hs index 1ffc1e0a538..2f57364f2be 100644 --- a/lib/wallet/src/Control/Monad/Exception/Unchecked.hs +++ b/lib/wallet/src/Control/Monad/Exception/Unchecked.hs @@ -15,13 +15,20 @@ module Control.Monad.Exception.Unchecked import Prelude import Control.Exception - ( throw ) + ( throw + ) import Control.Monad.Catch - ( Exception, MonadCatch (catch), SomeException (SomeException) ) + ( Exception + , MonadCatch (catch) + , SomeException (SomeException) + ) import Control.Monad.Except - ( ExceptT (..), runExceptT ) + ( ExceptT (..) + , runExceptT + ) import Data.Typeable - ( Typeable ) + ( Typeable + ) -- | The type @Unchecked e@ any 'Typeable' type @e@ into -- an instance of the 'Exception' class. diff --git a/lib/wallet/src/Data/Function/Utils.hs b/lib/wallet/src/Data/Function/Utils.hs index 5f7b0460cc6..595db5b7f36 100644 --- a/lib/wallet/src/Data/Function/Utils.hs +++ b/lib/wallet/src/Data/Function/Utils.hs @@ -8,7 +8,8 @@ module Data.Function.Utils import Prelude import Data.Set - ( Set ) + ( Set + ) import qualified Data.Set as Set diff --git a/lib/wallet/src/Data/Text/Class/Extended.hs b/lib/wallet/src/Data/Text/Class/Extended.hs index 5f7a96c3849..e9dfc71ac92 100644 --- a/lib/wallet/src/Data/Text/Class/Extended.hs +++ b/lib/wallet/src/Data/Text/Class/Extended.hs @@ -7,9 +7,11 @@ import Data.Text.Class import Prelude import Data.Bifunctor - ( first ) + ( first + ) import Data.Text - ( Text ) + ( Text + ) import qualified Data.Text as T diff --git a/lib/wallet/src/Data/Time/Text.hs b/lib/wallet/src/Data/Time/Text.hs index 9cd90e83fcf..d3c5fe4438a 100644 --- a/lib/wallet/src/Data/Time/Text.hs +++ b/lib/wallet/src/Data/Time/Text.hs @@ -29,15 +29,22 @@ module Data.Time.Text import Prelude import Control.Applicative - ( (<|>) ) + ( (<|>) + ) import Control.Monad - ( join ) + ( join + ) import Data.Text - ( Text ) + ( Text + ) import Data.Time.Clock - ( UTCTime ) + ( UTCTime + ) import Data.Time.Format - ( defaultTimeLocale, formatTime, parseTimeM ) + ( defaultTimeLocale + , formatTime + , parseTimeM + ) import qualified Data.Text as T diff --git a/lib/wallet/src/Data/Time/Utils.hs b/lib/wallet/src/Data/Time/Utils.hs index 9b65f1e6eeb..5d8624038f6 100644 --- a/lib/wallet/src/Data/Time/Utils.hs +++ b/lib/wallet/src/Data/Time/Utils.hs @@ -12,7 +12,9 @@ module Data.Time.Utils import Prelude import Data.Time - ( UTCTime, addUTCTime ) + ( UTCTime + , addUTCTime + ) -- | For a given time 't0', get the closest representable time 't1' to 't0' -- for which 't0 < t1'. diff --git a/lib/wallet/src/Data/Vector/Shuffle.hs b/lib/wallet/src/Data/Vector/Shuffle.hs index 982480f0187..e3ff2a44855 100644 --- a/lib/wallet/src/Data/Vector/Shuffle.hs +++ b/lib/wallet/src/Data/Vector/Shuffle.hs @@ -13,23 +13,35 @@ module Data.Vector.Shuffle import Prelude import Control.Monad - ( forM_ ) + ( forM_ + ) import Control.Monad.Trans.Class - ( lift ) + ( lift + ) import Control.Monad.Trans.State.Strict - ( evalStateT, state ) + ( evalStateT + , state + ) import Crypto.Hash - ( hash ) + ( hash + ) import Crypto.Hash.Algorithms - ( MD5 ) + ( MD5 + ) import Data.Text - ( Text ) + ( Text + ) import Data.Vector.Mutable - ( IOVector ) + ( IOVector + ) import Data.Word - ( Word8 ) + ( Word8 + ) import System.Random - ( RandomGen, newStdGen, randomR ) + ( RandomGen + , newStdGen + , randomR + ) import qualified Data.ByteArray as BA import qualified Data.ByteString as BS diff --git a/lib/wallet/src/Database/Persist/PersistValue/Extended.hs b/lib/wallet/src/Database/Persist/PersistValue/Extended.hs index 4e35ce447a4..fe0a4436687 100644 --- a/lib/wallet/src/Database/Persist/PersistValue/Extended.hs +++ b/lib/wallet/src/Database/Persist/PersistValue/Extended.hs @@ -8,17 +8,24 @@ import Database.Persist.PersistValue import Prelude import Control.Monad - ( (>=>) ) + ( (>=>) + ) import Data.Bifunctor - ( first ) + ( first + ) import Data.Text - ( Text ) + ( Text + ) import Data.Text.Class.Extended - ( FromText, fromText' ) + ( FromText + , fromText' + ) import Database.Persist - ( fromPersistValue ) + ( fromPersistValue + ) import Text.Read - ( readMaybe ) + ( readMaybe + ) import qualified Data.Text as T diff --git a/lib/wallet/src/Network/Ntp.hs b/lib/wallet/src/Network/Ntp.hs index bc73c6fd58a..365a578e5ba 100644 --- a/lib/wallet/src/Network/Ntp.hs +++ b/lib/wallet/src/Network/Ntp.hs @@ -30,21 +30,30 @@ module Network.Ntp import Prelude import Cardano.BM.Data.Severity - ( Severity (..) ) + ( Severity (..) + ) import Cardano.BM.Data.Tracer - ( HasPrivacyAnnotation (..), HasSeverityAnnotation (..) ) + ( HasPrivacyAnnotation (..) + , HasSeverityAnnotation (..) + ) import Control.DeepSeq - ( NFData ) + ( NFData + ) import Control.Tracer - ( Tracer ) + ( Tracer + ) import Data.Quantity - ( Quantity (..) ) + ( Quantity (..) + ) import Data.Text - ( Text ) + ( Text + ) import Data.Text.Class - ( ToText (..) ) + ( ToText (..) + ) import GHC.Generics - ( Generic ) + ( Generic + ) import Network.NTP.Client ( IPVersion (..) , NtpClient (..) @@ -55,9 +64,12 @@ import Network.NTP.Client , withNtpClient ) import System.IOManager - ( IOManager ) + ( IOManager + ) import UnliftIO.STM - ( atomically, checkSTM ) + ( atomically + , checkSTM + ) import qualified Data.Text as T diff --git a/lib/wallet/src/Ouroboros/Network/Client/Wallet.hs b/lib/wallet/src/Ouroboros/Network/Client/Wallet.hs index 0d94bbf2007..2e2de6a0850 100644 --- a/lib/wallet/src/Ouroboros/Network/Client/Wallet.hs +++ b/lib/wallet/src/Ouroboros/Network/Client/Wallet.hs @@ -48,11 +48,16 @@ module Ouroboros.Network.Client.Wallet import Prelude import Cardano.BM.Data.Tracer - ( Tracer, traceWith ) + ( Tracer + , traceWith + ) import Cardano.Slotting.Slot - ( WithOrigin (..) ) + ( WithOrigin (..) + ) import Cardano.Wallet.Network - ( ChainFollower (..), ChainSyncLog (..) ) + ( ChainFollower (..) + , ChainSyncLog (..) + ) import Control.Concurrent.Class.MonadSTM ( MonadSTM , TQueue @@ -66,33 +71,52 @@ import Control.Concurrent.Class.MonadSTM , writeTQueue ) import Control.Monad - ( ap, liftM ) + ( ap + , liftM + ) import Control.Monad.Class.MonadThrow - ( Exception, MonadThrow, throwIO ) + ( Exception + , MonadThrow + , throwIO + ) import Control.Monad.IO.Class - ( MonadIO ) + ( MonadIO + ) import Data.Functor - ( (<&>) ) + ( (<&>) + ) import Data.Kind - ( Type ) + ( Type + ) import Data.List - ( sortBy ) + ( sortBy + ) import Data.List.NonEmpty - ( NonEmpty (..) ) + ( NonEmpty (..) + ) import Data.Ord - ( comparing ) + ( comparing + ) import Data.Text - ( Text ) + ( Text + ) import Data.Void - ( Void ) + ( Void + ) import Network.TypedProtocol.Pipelined - ( N (..), Nat (..), natToInt ) + ( N (..) + , Nat (..) + , natToInt + ) import Numeric.Natural - ( Natural ) + ( Natural + ) import Ouroboros.Consensus.HardFork.Combinator.Ledger.Query - ( BlockQuery ) + ( BlockQuery + ) import Ouroboros.Consensus.Ledger.Query - ( Query (..) ) + ( Query (..) + ) import Ouroboros.Network.Block ( BlockNo (..) , HasHeader (..) @@ -106,7 +130,8 @@ import Ouroboros.Network.Block , pointSlot ) import Ouroboros.Network.Point - ( blockPointSlot ) + ( blockPointSlot + ) import Ouroboros.Network.Protocol.ChainSync.Client ( ChainSyncClient (..) , ClientStIdle (..) @@ -114,13 +139,19 @@ import Ouroboros.Network.Protocol.ChainSync.Client , ClientStNext (..) ) import Ouroboros.Network.Protocol.ChainSync.ClientPipelined - ( ChainSyncClientPipelined (..) ) + ( ChainSyncClientPipelined (..) + ) import Ouroboros.Network.Protocol.LocalStateQuery.Client - ( ClientStAcquiring (..), LocalStateQueryClient (..) ) + ( ClientStAcquiring (..) + , LocalStateQueryClient (..) + ) import Ouroboros.Network.Protocol.LocalTxSubmission.Client - ( LocalTxClientStIdle (..), LocalTxSubmissionClient (..) ) + ( LocalTxClientStIdle (..) + , LocalTxSubmissionClient (..) + ) import Ouroboros.Network.Protocol.LocalTxSubmission.Type - ( SubmitResult (..) ) + ( SubmitResult (..) + ) import qualified Data.List.NonEmpty as NE import qualified Data.Text as T diff --git a/lib/wallet/src/UnliftIO/Compat.hs b/lib/wallet/src/UnliftIO/Compat.hs index 24c65441e66..5a89f36448b 100644 --- a/lib/wallet/src/UnliftIO/Compat.hs +++ b/lib/wallet/src/UnliftIO/Compat.hs @@ -23,11 +23,14 @@ module UnliftIO.Compat import Prelude import Control.Concurrent.Async - ( AsyncCancelled (..) ) + ( AsyncCancelled (..) + ) import Control.Exception.Base - ( Exception ) + ( Exception + ) import Control.Monad.IO.Unlift - ( MonadUnliftIO (..) ) + ( MonadUnliftIO (..) + ) import qualified Control.Monad.Catch as Exceptions import qualified UnliftIO.Exception as UnliftIO diff --git a/lib/wallet/test-common/Cardano/Wallet/DummyTarget/Primitive/Types.hs b/lib/wallet/test-common/Cardano/Wallet/DummyTarget/Primitive/Types.hs index ceb6cc5b5e3..2bf476791ba 100644 --- a/lib/wallet/test-common/Cardano/Wallet/DummyTarget/Primitive/Types.hs +++ b/lib/wallet/test-common/Cardano/Wallet/DummyTarget/Primitive/Types.hs @@ -26,9 +26,13 @@ module Cardano.Wallet.DummyTarget.Primitive.Types import Prelude import Cardano.Wallet.Network - ( NetworkLayer (..) ) + ( NetworkLayer (..) + ) import Cardano.Wallet.Primitive.Slotting - ( TimeInterpreter, hoistTimeInterpreter, mkSingleEraInterpreter ) + ( TimeInterpreter + , hoistTimeInterpreter + , mkSingleEraInterpreter + ) import Cardano.Wallet.Primitive.Types ( ActiveSlotCoefficient (..) , Block (..) @@ -50,29 +54,44 @@ import Cardano.Wallet.Primitive.Types , emptyEraInfo ) import Cardano.Wallet.Primitive.Types.Coin - ( Coin (..) ) + ( Coin (..) + ) import Cardano.Wallet.Primitive.Types.Hash - ( Hash (..), mockHash ) + ( Hash (..) + , mockHash + ) import Cardano.Wallet.Primitive.Types.RewardAccount - ( RewardAccount (..) ) + ( RewardAccount (..) + ) import Cardano.Wallet.Primitive.Types.Tx - ( Tx (..), TxMetadata (..), TxScriptValidity (..) ) + ( Tx (..) + , TxMetadata (..) + , TxScriptValidity (..) + ) import Cardano.Wallet.Primitive.Types.Tx.Constraints - ( TxSize (..) ) + ( TxSize (..) + ) import Cardano.Wallet.Primitive.Types.Tx.TxIn - ( TxIn (..) ) + ( TxIn (..) + ) import Cardano.Wallet.Primitive.Types.Tx.TxOut - ( TxOut (..) ) + ( TxOut (..) + ) import Cardano.Wallet.Read.Tx.CBOR - ( TxCBOR ) + ( TxCBOR + ) import Data.Functor.Identity - ( Identity (..) ) + ( Identity (..) + ) import Data.Map.Strict - ( Map ) + ( Map + ) import Data.Quantity - ( Quantity (..) ) + ( Quantity (..) + ) import Data.Time.Clock.POSIX - ( posixSecondsToUTCTime ) + ( posixSecondsToUTCTime + ) import qualified Cardano.Api.Shelley as C import qualified Data.ByteString.Char8 as B8 diff --git a/lib/wallet/test/integration/shelley-integration-test.hs b/lib/wallet/test/integration/shelley-integration-test.hs index f18992381a1..386d958ccd0 100644 --- a/lib/wallet/test/integration/shelley-integration-test.hs +++ b/lib/wallet/test/integration/shelley-integration-test.hs @@ -17,15 +17,24 @@ module Main where import Prelude import Cardano.BM.Data.Severity - ( Severity (..) ) + ( Severity (..) + ) import Cardano.BM.Data.Tracer - ( HasPrivacyAnnotation (..), HasSeverityAnnotation (..) ) + ( HasPrivacyAnnotation (..) + , HasSeverityAnnotation (..) + ) import Cardano.BM.Extra - ( BracketLog, bracketTracer, stdoutTextTracer, trMessageText ) + ( BracketLog + , bracketTracer + , stdoutTextTracer + , trMessageText + ) import Cardano.BM.Plugin - ( loadPlugin ) + ( loadPlugin + ) import Cardano.BM.Trace - ( appendName ) + ( appendName + ) import Cardano.CLI ( LogOutput (..) , Port (..) @@ -35,17 +44,24 @@ import Cardano.CLI , withLogging ) import Cardano.Launcher - ( ProcessHasExited (..) ) + ( ProcessHasExited (..) + ) import Cardano.Ledger.Shelley.Genesis - ( sgNetworkMagic ) + ( sgNetworkMagic + ) import Cardano.Mnemonic - ( SomeMnemonic (..) ) + ( SomeMnemonic (..) + ) import Cardano.Startup - ( installSignalHandlersNoLogging, setDefaultFilePermissions ) + ( installSignalHandlersNoLogging + , setDefaultFilePermissions + ) import Cardano.Wallet.Api.Http.Shelley.Server - ( walletListenFromEnv ) + ( walletListenFromEnv + ) import Cardano.Wallet.Api.Types - ( ApiEra (..) ) + ( ApiEra (..) + ) import Cardano.Wallet.Faucet ( byronIntegrationTestFunds , deriveShelleyRewardAccount @@ -55,7 +71,8 @@ import Cardano.Wallet.Faucet , shelleyIntegrationTestFunds ) import Cardano.Wallet.Faucet.Shelley - ( initFaucet ) + ( initFaucet + ) import Cardano.Wallet.Launch.Cluster ( ClusterEra (..) , ClusterLog @@ -75,47 +92,77 @@ import Cardano.Wallet.Launch.Cluster , withSMASH ) import Cardano.Wallet.Network.Ports - ( portFromURL ) + ( portFromURL + ) import Cardano.Wallet.Primitive.NetworkId - ( NetworkDiscriminant (..), NetworkId (..) ) + ( NetworkDiscriminant (..) + , NetworkId (..) + ) import Cardano.Wallet.Primitive.SyncProgress - ( SyncTolerance (..) ) + ( SyncTolerance (..) + ) import Cardano.Wallet.Primitive.Types.Coin - ( Coin (..) ) + ( Coin (..) + ) import Cardano.Wallet.Shelley - ( Tracers, serveWallet, setupTracers, tracerSeverities ) + ( Tracers + , serveWallet + , setupTracers + , tracerSeverities + ) import Cardano.Wallet.Shelley.BlockchainSource - ( BlockchainSource (..) ) + ( BlockchainSource (..) + ) import Cardano.Wallet.Shelley.Compatibility - ( fromGenesisData ) + ( fromGenesisData + ) import Cardano.Wallet.TokenMetadata.MockServer - ( queryServerStatic, withMetadataServer ) + ( queryServerStatic + , withMetadataServer + ) import Control.Monad - ( when ) + ( when + ) import Control.Monad.IO.Class - ( liftIO ) + ( liftIO + ) import Control.Tracer - ( Tracer (..), contramap, traceWith ) + ( Tracer (..) + , contramap + , traceWith + ) import Data.Either.Combinators - ( whenLeft ) + ( whenLeft + ) import Data.Functor - ( (<&>) ) + ( (<&>) + ) import Data.IORef - ( IORef, atomicModifyIORef', newIORef ) + ( IORef + , atomicModifyIORef' + , newIORef + ) import Data.Maybe - ( fromMaybe ) + ( fromMaybe + ) import Data.Tagged - ( Tagged (..) ) + ( Tagged (..) + ) import Data.Text - ( Text ) + ( Text + ) import Data.Text.Class - ( ToText (..) ) + ( ToText (..) + ) import Data.Typeable - ( Proxy (..) ) + ( Proxy (..) + ) import GHC.TypeNats - ( natVal ) + ( natVal + ) import Main.Utf8 - ( withUtf8 ) + ( withUtf8 + ) import Network.HTTP.Client ( defaultManagerSettings , managerResponseTimeout @@ -123,33 +170,64 @@ import Network.HTTP.Client , responseTimeoutMicro ) import Network.URI - ( URI ) + ( URI + ) import Ouroboros.Network.Client.Wallet - ( tunedForMainnetPipeliningStrategy ) + ( tunedForMainnetPipeliningStrategy + ) import System.Directory - ( createDirectory ) + ( createDirectory + ) import System.Environment - ( setEnv ) + ( setEnv + ) import System.Environment.Extended - ( envFromText, isEnvSet, lookupEnvNonEmpty ) + ( envFromText + , isEnvSet + , lookupEnvNonEmpty + ) import System.FilePath - ( () ) + ( () + ) import System.IO.Temp.Extra - ( SkipCleanup (..), withSystemTempDir ) + ( SkipCleanup (..) + , withSystemTempDir + ) import Test.Hspec.Core.Spec - ( Spec, SpecWith, describe, parallel, sequential ) + ( Spec + , SpecWith + , describe + , parallel + , sequential + ) import Test.Hspec.Extra - ( aroundAll, hspecMain ) + ( aroundAll + , hspecMain + ) import Test.Integration.Framework.Context - ( Context (..), PoolGarbageCollectionEvent (..) ) + ( Context (..) + , PoolGarbageCollectionEvent (..) + ) import Test.Utils.Paths - ( getTestData, inNixBuild ) + ( getTestData + , inNixBuild + ) import UnliftIO.Async - ( race ) + ( race + ) import UnliftIO.Exception - ( SomeException, isAsyncException, throwIO, withException ) + ( SomeException + , isAsyncException + , throwIO + , withException + ) import UnliftIO.MVar - ( newEmptyMVar, newMVar, putMVar, takeMVar, withMVar ) + ( newEmptyMVar + , newMVar + , putMVar + , takeMVar + , withMVar + ) import qualified Cardano.Address as CA import qualified Cardano.Address.Style.Shelley as Shelley diff --git a/lib/wallet/test/unit/Cardano/Byron/Codec/CborSpec.hs b/lib/wallet/test/unit/Cardano/Byron/Codec/CborSpec.hs index 2d3c760037f..604a2269608 100644 --- a/lib/wallet/test/unit/Cardano/Byron/Codec/CborSpec.hs +++ b/lib/wallet/test/unit/Cardano/Byron/Codec/CborSpec.hs @@ -26,33 +26,56 @@ import Cardano.Byron.Codec.Cbor , encodeTx ) import Cardano.Mnemonic - ( MkSomeMnemonic (..) ) + ( MkSomeMnemonic (..) + ) import Cardano.Wallet.Address.Derivation - ( Depth (..), DerivationType (..), Index (..) ) + ( Depth (..) + , DerivationType (..) + , Index (..) + ) import Cardano.Wallet.Address.Derivation.Byron - ( ByronKey (..), generateKeyFromSeed ) + ( ByronKey (..) + , generateKeyFromSeed + ) import Cardano.Wallet.Primitive.Passphrase.Types - ( Passphrase (..) ) + ( Passphrase (..) + ) import Cardano.Wallet.Primitive.Types.Address - ( Address (..) ) + ( Address (..) + ) import Cardano.Wallet.Primitive.Types.Hash - ( Hash (..) ) + ( Hash (..) + ) import Cardano.Wallet.Primitive.Types.TokenBundle - ( TokenBundle ) + ( TokenBundle + ) import Cardano.Wallet.Primitive.Types.Tx.TxIn - ( TxIn (..) ) + ( TxIn (..) + ) import Cardano.Wallet.Primitive.Types.Tx.TxOut - ( TxOut (..) ) + ( TxOut (..) + ) import Cardano.Wallet.Unsafe - ( unsafeDeserialiseCbor, unsafeFromHex ) + ( unsafeDeserialiseCbor + , unsafeFromHex + ) import Data.ByteString - ( ByteString ) + ( ByteString + ) import Data.Text - ( Text ) + ( Text + ) import Data.Word - ( Word32, Word64 ) + ( Word32 + , Word64 + ) import Test.Hspec - ( Expectation, Spec, describe, it, shouldBe ) + ( Expectation + , Spec + , describe + , it + , shouldBe + ) import Test.QuickCheck ( Arbitrary (..) , Property diff --git a/lib/wallet/test/unit/Cardano/CLISpec.hs b/lib/wallet/test/unit/Cardano/CLISpec.hs index bfc7f251ce5..6b2b5644d9c 100644 --- a/lib/wallet/test/unit/Cardano/CLISpec.hs +++ b/lib/wallet/test/unit/Cardano/CLISpec.hs @@ -42,19 +42,30 @@ import Cardano.Wallet.Api.Client , walletClient ) import Cardano.Wallet.Api.Types.SchemaMetadata - ( detailedMetadata, noSchemaMetadata ) + ( detailedMetadata + , noSchemaMetadata + ) import Cardano.Wallet.Primitive.Types - ( PoolMetadataSource ) + ( PoolMetadataSource + ) import Cardano.Wallet.Primitive.Types.Tx - ( TxMetadata (..), TxMetadataValue (..) ) + ( TxMetadata (..) + , TxMetadataValue (..) + ) import Data.Proxy - ( Proxy (..) ) + ( Proxy (..) + ) import Data.Quantity - ( Quantity (..) ) + ( Quantity (..) + ) import Data.Text - ( Text ) + ( Text + ) import Data.Text.Class - ( FromText (..), TextDecodingError (..), toText ) + ( FromText (..) + , TextDecodingError (..) + , toText + ) -- See ADP-1910 import "optparse-applicative" Options.Applicative ( ParserInfo @@ -67,11 +78,17 @@ import "optparse-applicative" Options.Applicative , renderFailure ) import System.Environment - ( getProgName ) + ( getProgName + ) import System.FilePath - ( () ) + ( () + ) import System.IO - ( Handle, IOMode (..), hClose, openFile ) + ( Handle + , IOMode (..) + , hClose + , openFile + ) import Test.Hspec ( HasCallStack , Spec @@ -82,7 +99,9 @@ import Test.Hspec , shouldSatisfy ) import Test.Hspec.Goldens - ( Settings (..), textGolden ) + ( Settings (..) + , textGolden + ) import Test.QuickCheck ( Arbitrary (..) , Large (..) @@ -92,15 +111,22 @@ import Test.QuickCheck , (===) ) import Test.Text.Roundtrip - ( textRoundtrip ) + ( textRoundtrip + ) import Test.Utils.Paths - ( getTestData ) + ( getTestData + ) import UnliftIO.Concurrent - ( forkFinally ) + ( forkFinally + ) import UnliftIO.MVar - ( newEmptyMVar, putMVar, takeMVar ) + ( newEmptyMVar + , putMVar + , takeMVar + ) import UnliftIO.Temporary - ( withSystemTempDirectory ) + ( withSystemTempDirectory + ) import qualified Data.Map as Map import qualified Data.Text as T diff --git a/lib/wallet/test/unit/Cardano/DB/Sqlite/DeleteSpec.hs b/lib/wallet/test/unit/Cardano/DB/Sqlite/DeleteSpec.hs index 6bbecfe8b1a..6cf4d4258bc 100644 --- a/lib/wallet/test/unit/Cardano/DB/Sqlite/DeleteSpec.hs +++ b/lib/wallet/test/unit/Cardano/DB/Sqlite/DeleteSpec.hs @@ -9,19 +9,36 @@ module Cardano.DB.Sqlite.DeleteSpec (spec) where import Prelude import Cardano.DB.Sqlite.Delete - ( newRefCount, waitForFree', withRef ) + ( newRefCount + , waitForFree' + , withRef + ) import Control.Retry - ( RetryPolicy, constantDelay, limitRetries ) + ( RetryPolicy + , constantDelay + , limitRetries + ) import Control.Tracer - ( nullTracer ) + ( nullTracer + ) import Test.Hspec - ( Spec, describe, it, shouldBe, shouldReturn ) + ( Spec + , describe + , it + , shouldBe + , shouldReturn + ) import UnliftIO.Async - ( concurrently ) + ( concurrently + ) import UnliftIO.Concurrent - ( threadDelay ) + ( threadDelay + ) import UnliftIO.MVar - ( isEmptyMVar, newEmptyMVar, putMVar ) + ( isEmptyMVar + , newEmptyMVar + , putMVar + ) spec :: Spec spec = describe "RefCount" $ do diff --git a/lib/wallet/test/unit/Cardano/Pool/DB/Arbitrary.hs b/lib/wallet/test/unit/Cardano/Pool/DB/Arbitrary.hs index 981ae11a1b8..b873c3aff7b 100644 --- a/lib/wallet/test/unit/Cardano/Pool/DB/Arbitrary.hs +++ b/lib/wallet/test/unit/Cardano/Pool/DB/Arbitrary.hs @@ -32,9 +32,15 @@ import Cardano.Pool.Metadata.Types , StakePoolMetadataUrl (..) ) import Cardano.Pool.Types - ( PoolId (..), PoolOwner (..), StakePoolTicker (..) ) + ( PoolId (..) + , PoolOwner (..) + , StakePoolTicker (..) + ) import Cardano.Wallet.Gen - ( genPercentage, genSlotNo, shrinkSlotNo ) + ( genPercentage + , genSlotNo + , shrinkSlotNo + ) import Cardano.Wallet.Primitive.Types ( BlockHeader (..) , CertificatePublicationTime (..) @@ -52,35 +58,55 @@ import Cardano.Wallet.Primitive.Types , unsafeEpochNo ) import Cardano.Wallet.Primitive.Types.Coin - ( Coin (..) ) + ( Coin (..) + ) import Cardano.Wallet.Primitive.Types.Hash - ( Hash (..) ) + ( Hash (..) + ) import Cardano.Wallet.Primitive.Types.Tx.TxOut.Gen - ( genTxOutCoin, shrinkTxOutCoin ) + ( genTxOutCoin + , shrinkTxOutCoin + ) import Control.Arrow - ( second ) + ( second + ) import Control.Monad - ( foldM, replicateM ) + ( foldM + , replicateM + ) import Data.Function - ( (&) ) + ( (&) + ) import Data.Generics.Internal.VL.Lens - ( view, (^.) ) + ( view + , (^.) + ) import Data.Maybe - ( fromJust ) + ( fromJust + ) import Data.Ord - ( Down (..) ) + ( Down (..) + ) import Data.Quantity - ( Quantity (..) ) + ( Quantity (..) + ) import Data.Text - ( Text ) + ( Text + ) import Data.Word - ( Word32, Word64 ) + ( Word32 + , Word64 + ) import Data.Word.Odd - ( Word31 ) + ( Word31 + ) import GHC.Generics - ( Generic ) + ( Generic + ) import Network.URI - ( URI, parseURI ) + ( URI + , parseURI + ) import Test.QuickCheck ( Arbitrary (..) , Gen @@ -98,9 +124,12 @@ import Test.QuickCheck , vectorOf ) import Test.QuickCheck.Arbitrary.Generic - ( genericArbitrary, genericShrink ) + ( genericArbitrary + , genericShrink + ) import Test.QuickCheck.Extra - ( reasonablySized ) + ( reasonablySized + ) import qualified Data.ByteString as BS import qualified Data.ByteString.Char8 as B8 diff --git a/lib/wallet/test/unit/Cardano/Pool/DB/MVarSpec.hs b/lib/wallet/test/unit/Cardano/Pool/DB/MVarSpec.hs index 4f5f7c6683e..dea1bee75ce 100644 --- a/lib/wallet/test/unit/Cardano/Pool/DB/MVarSpec.hs +++ b/lib/wallet/test/unit/Cardano/Pool/DB/MVarSpec.hs @@ -11,11 +11,16 @@ module Cardano.Pool.DB.MVarSpec import Prelude import Cardano.Pool.DB.Properties - ( properties ) + ( properties + ) import Cardano.Wallet.DummyTarget.Primitive.Types - ( dummyTimeInterpreter ) + ( dummyTimeInterpreter + ) import Test.Hspec - ( Spec, before, describe ) + ( Spec + , before + , describe + ) import qualified Cardano.Pool.DB.MVar as MVar diff --git a/lib/wallet/test/unit/Cardano/Pool/DB/Properties.hs b/lib/wallet/test/unit/Cardano/Pool/DB/Properties.hs index 8497760b16d..0bd12f089a6 100644 --- a/lib/wallet/test/unit/Cardano/Pool/DB/Properties.hs +++ b/lib/wallet/test/unit/Cardano/Pool/DB/Properties.hs @@ -32,15 +32,23 @@ import Cardano.Pool.DB.Arbitrary , isValidSinglePoolCertificateSequence ) import Cardano.Pool.Metadata.Types - ( StakePoolMetadata (..) ) + ( StakePoolMetadata (..) + ) import Cardano.Pool.Types - ( PoolId (..), StakePoolTicker (..) ) + ( PoolId (..) + , StakePoolTicker (..) + ) import Cardano.Wallet.DummyTarget.Primitive.Types - ( dummyTimeInterpreter ) + ( dummyTimeInterpreter + ) import Cardano.Wallet.Gen - ( genBlockHeader, genSlotNo ) + ( genBlockHeader + , genSlotNo + ) import Cardano.Wallet.Primitive.Slotting - ( epochOf, interpretQuery ) + ( epochOf + , interpretQuery + ) import Cardano.Wallet.Primitive.Types ( BlockHeader (..) , CertificatePublicationTime (..) @@ -56,41 +64,71 @@ import Cardano.Wallet.Primitive.Types , getPoolRetirementCertificate ) import Cardano.Wallet.Unsafe - ( unsafeRunExceptT ) + ( unsafeRunExceptT + ) import Control.Arrow - ( second ) + ( second + ) import Control.Monad - ( forM, forM_, replicateM, unless, void ) + ( forM + , forM_ + , replicateM + , unless + , void + ) import Control.Monad.IO.Class - ( liftIO ) + ( liftIO + ) import Control.Monad.Trans.Except - ( runExceptT ) + ( runExceptT + ) import Data.Bifunctor - ( bimap ) + ( bimap + ) import Data.Function - ( on, (&) ) + ( on + , (&) + ) import Data.Functor.Identity - ( runIdentity ) + ( runIdentity + ) import Data.Generics.Internal.VL.Lens - ( set, view ) + ( set + , view + ) import Data.List.Extra - ( nubOrd, nubSortOn ) + ( nubOrd + , nubSortOn + ) import Data.Map.Strict - ( Map ) + ( Map + ) import Data.Maybe - ( catMaybes, fromMaybe, isJust, isNothing, listToMaybe, mapMaybe ) + ( catMaybes + , fromMaybe + , isJust + , isNothing + , listToMaybe + , mapMaybe + ) import Data.Ord - ( Down (..) ) + ( Down (..) + ) import Data.Quantity - ( Quantity (..) ) + ( Quantity (..) + ) import Data.Text.Class - ( toText ) + ( toText + ) import Data.Time.Clock.POSIX - ( POSIXTime ) + ( POSIXTime + ) import Data.Word - ( Word64 ) + ( Word64 + ) import Fmt - ( pretty ) + ( pretty + ) import Test.Hspec ( Expectation , SpecWith @@ -118,9 +156,16 @@ import Test.QuickCheck , (==>) ) import Test.QuickCheck.Monadic - ( PropertyM, assert, monadicIO, monitor, pick, run ) + ( PropertyM + , assert + , monadicIO + , monitor + , pick + , run + ) import UnliftIO.Exception - ( evaluate ) + ( evaluate + ) import qualified Cardano.Pool.DB.MVar as MVar import qualified Data.List as L diff --git a/lib/wallet/test/unit/Cardano/Pool/DB/SqliteSpec.hs b/lib/wallet/test/unit/Cardano/Pool/DB/SqliteSpec.hs index dd6a282c558..665c145694f 100644 --- a/lib/wallet/test/unit/Cardano/Pool/DB/SqliteSpec.hs +++ b/lib/wallet/test/unit/Cardano/Pool/DB/SqliteSpec.hs @@ -14,31 +14,48 @@ module Cardano.Pool.DB.SqliteSpec import Prelude import Cardano.BM.Trace - ( nullTracer ) + ( nullTracer + ) import Cardano.DB.Sqlite - ( DBLog (..) ) + ( DBLog (..) + ) import Cardano.Pool.DB - ( DBLayer (..) ) + ( DBLayer (..) + ) import Cardano.Pool.DB.Log - ( PoolDbLog (..) ) + ( PoolDbLog (..) + ) import Cardano.Pool.DB.Properties - ( properties ) + ( properties + ) import Cardano.Pool.DB.Sqlite - ( withDBLayer ) + ( withDBLayer + ) import Cardano.Wallet.DummyTarget.Primitive.Types - ( dummyTimeInterpreter ) + ( dummyTimeInterpreter + ) import System.Directory - ( copyFile ) + ( copyFile + ) import System.FilePath - ( () ) + ( () + ) import Test.Hspec - ( Spec, around, describe, it, shouldBe ) + ( Spec + , around + , describe + , it + , shouldBe + ) import Test.Utils.Paths - ( getTestData ) + ( getTestData + ) import Test.Utils.Trace - ( captureLogging ) + ( captureLogging + ) import UnliftIO.Temporary - ( withSystemTempDirectory ) + ( withSystemTempDirectory + ) withMemoryDBLayer :: (DBLayer IO -> IO a) diff --git a/lib/wallet/test/unit/Cardano/Pool/RankSpec.hs b/lib/wallet/test/unit/Cardano/Pool/RankSpec.hs index a039ec2bb1f..d28b5c878a9 100644 --- a/lib/wallet/test/unit/Cardano/Pool/RankSpec.hs +++ b/lib/wallet/test/unit/Cardano/Pool/RankSpec.hs @@ -17,19 +17,29 @@ import Cardano.Pool.Rank , redelegationWarning ) import Cardano.Wallet.Gen - ( genPercentage ) + ( genPercentage + ) import Cardano.Wallet.Primitive.Types - ( EpochNo (..) ) + ( EpochNo (..) + ) import Cardano.Wallet.Primitive.Types.Coin - ( Coin (..) ) + ( Coin (..) + ) import Cardano.Wallet.Primitive.Types.Coin.Gen - ( genCoin ) + ( genCoin + ) import Data.ByteArray.Encoding - ( Base (Base16), convertToBase ) + ( Base (Base16) + , convertToBase + ) import Data.Quantity - ( clipToPercentage ) + ( clipToPercentage + ) import Test.Hspec - ( Spec, describe, it ) + ( Spec + , describe + , it + ) import Test.QuickCheck ( Arbitrary (..) , Gen @@ -47,7 +57,8 @@ import Test.QuickCheck ) import Cardano.Pool.Types - ( PoolId (..) ) + ( PoolId (..) + ) import qualified Data.ByteString as BS import Data.Map.Strict as Map diff --git a/lib/wallet/test/unit/Cardano/Wallet/Address/Derivation/ByronSpec.hs b/lib/wallet/test/unit/Cardano/Wallet/Address/Derivation/ByronSpec.hs index 328ec6d9ecb..98daaf365d0 100644 --- a/lib/wallet/test/unit/Cardano/Wallet/Address/Derivation/ByronSpec.hs +++ b/lib/wallet/test/unit/Cardano/Wallet/Address/Derivation/ByronSpec.hs @@ -15,11 +15,16 @@ module Cardano.Wallet.Address.Derivation.ByronSpec import Prelude import Cardano.Address.Derivation - ( XPrv ) + ( XPrv + ) import Cardano.Mnemonic - ( SomeMnemonic (..) ) + ( SomeMnemonic (..) + ) import Cardano.Wallet.Address.Derivation - ( Depth (..), DerivationType (..), Index (..) ) + ( Depth (..) + , DerivationType (..) + , Index (..) + ) import Cardano.Wallet.Address.Derivation.Byron ( ByronKey (..) , generateKeyFromSeed @@ -30,21 +35,39 @@ import Cardano.Wallet.Address.Derivation.Byron import Cardano.Wallet.Address.DerivationSpec () import Cardano.Wallet.Primitive.Passphrase.Types - ( Passphrase (..) ) + ( Passphrase (..) + ) import Cardano.Wallet.Unsafe - ( unsafeMkMnemonic, unsafeXPrv ) + ( unsafeMkMnemonic + , unsafeXPrv + ) import Control.Monad - ( (<=<) ) + ( (<=<) + ) import Data.ByteArray.Encoding - ( Base (Base16), convertFromBase ) + ( Base (Base16) + , convertFromBase + ) import Data.ByteString - ( ByteString ) + ( ByteString + ) import Data.Text - ( Text ) + ( Text + ) import Test.Hspec - ( Expectation, Spec, describe, it, shouldBe ) + ( Expectation + , Spec + , describe + , it + , shouldBe + ) import Test.QuickCheck - ( Arbitrary (..), Property, choose, property, vector ) + ( Arbitrary (..) + , Property + , choose + , property + , vector + ) import qualified Cardano.Crypto.Wallet as CC import qualified Data.ByteArray as BA diff --git a/lib/wallet/test/unit/Cardano/Wallet/Address/Derivation/IcarusSpec.hs b/lib/wallet/test/unit/Cardano/Wallet/Address/Derivation/IcarusSpec.hs index ecbf6cb15ff..4bd68f61c74 100644 --- a/lib/wallet/test/unit/Cardano/Wallet/Address/Derivation/IcarusSpec.hs +++ b/lib/wallet/test/unit/Cardano/Wallet/Address/Derivation/IcarusSpec.hs @@ -15,9 +15,11 @@ module Cardano.Wallet.Address.Derivation.IcarusSpec import Prelude import Cardano.Address.Derivation - ( XPrv ) + ( XPrv + ) import Cardano.Mnemonic - ( SomeMnemonic (..) ) + ( SomeMnemonic (..) + ) import Cardano.Wallet.Address.Derivation ( Depth (..) , DerivationType (..) @@ -37,19 +39,28 @@ import Cardano.Wallet.Address.Derivation.Icarus import Cardano.Wallet.Address.DerivationSpec () import Cardano.Wallet.Address.Keys.WalletKey - ( publicKey ) + ( publicKey + ) import Cardano.Wallet.Flavor - ( KeyFlavorS (IcarusKeyS) ) + ( KeyFlavorS (IcarusKeyS) + ) import Cardano.Wallet.Gen - ( genLegacyAddress ) + ( genLegacyAddress + ) import Cardano.Wallet.Primitive.NetworkId - ( SNetworkId (..) ) + ( SNetworkId (..) + ) import Cardano.Wallet.Primitive.Passphrase.Types - ( Passphrase (..) ) + ( Passphrase (..) + ) import Cardano.Wallet.Primitive.Types.Address - ( Address ) + ( Address + ) import Test.Hspec - ( Spec, describe, it ) + ( Spec + , describe + , it + ) import Test.QuickCheck ( Arbitrary (..) , Property diff --git a/lib/wallet/test/unit/Cardano/Wallet/Address/Derivation/MintBurnSpec.hs b/lib/wallet/test/unit/Cardano/Wallet/Address/Derivation/MintBurnSpec.hs index c1bd0b7f7cd..df3fdf50076 100644 --- a/lib/wallet/test/unit/Cardano/Wallet/Address/Derivation/MintBurnSpec.hs +++ b/lib/wallet/test/unit/Cardano/Wallet/Address/Derivation/MintBurnSpec.hs @@ -11,53 +11,103 @@ module Cardano.Wallet.Address.Derivation.MintBurnSpec import Prelude import Cardano.Address.Derivation - ( XPrv, XPub, xprvToBytes ) + ( XPrv + , XPub + , xprvToBytes + ) import Cardano.Address.Script - ( KeyHash, KeyRole (..), Script (..), keyHashFromBytes ) + ( KeyHash + , KeyRole (..) + , Script (..) + , keyHashFromBytes + ) import Cardano.Mnemonic - ( Mnemonic, SomeMnemonic (..) ) + ( Mnemonic + , SomeMnemonic (..) + ) import Cardano.Wallet.Address.Derivation - ( Depth (..), DerivationType (..), Index (..) ) + ( Depth (..) + , DerivationType (..) + , Index (..) + ) import Cardano.Wallet.Address.Derivation.MintBurn - ( derivePolicyPrivateKey, scriptSlotIntervals, withinSlotInterval ) + ( derivePolicyPrivateKey + , scriptSlotIntervals + , withinSlotInterval + ) import Cardano.Wallet.Address.Derivation.Shelley - ( ShelleyKey ) + ( ShelleyKey + ) import Cardano.Wallet.Address.DerivationSpec () import Cardano.Wallet.Address.Keys.MintBurn - ( derivePolicyKeyAndHash ) + ( derivePolicyKeyAndHash + ) import Cardano.Wallet.Address.Keys.WalletKey - ( getRawKey, hashVerificationKey, liftRawKey, publicKey ) + ( getRawKey + , hashVerificationKey + , liftRawKey + , publicKey + ) import Cardano.Wallet.Flavor - ( KeyFlavorS (..) ) + ( KeyFlavorS (..) + ) import Cardano.Wallet.Primitive.Passphrase - ( Passphrase ) + ( Passphrase + ) import Cardano.Wallet.Primitive.Types - ( SlotNo (..) ) + ( SlotNo (..) + ) import Cardano.Wallet.Unsafe - ( unsafeBech32Decode, unsafeFromHex, unsafeMkMnemonic, unsafeXPrv ) + ( unsafeBech32Decode + , unsafeFromHex + , unsafeMkMnemonic + , unsafeXPrv + ) import Codec.Binary.Encoding - ( fromBase16 ) + ( fromBase16 + ) import Data.Function - ( (&) ) + ( (&) + ) import Data.IntCast - ( intCast ) + ( intCast + ) import Data.Interval - ( Interval, empty, (<=..<=) ) + ( Interval + , empty + , (<=..<=) + ) import Data.Text - ( Text ) + ( Text + ) import Data.Word - ( Word64 ) + ( Word64 + ) import GHC.TypeNats - ( KnownNat ) + ( KnownNat + ) import Numeric.Natural - ( Natural ) + ( Natural + ) import Test.Hspec - ( Expectation, Spec, describe, it, shouldBe ) + ( Expectation + , Spec + , describe + , it + , shouldBe + ) import Test.QuickCheck - ( Arbitrary (..), Property, property, vector, (=/=), (===) ) + ( Arbitrary (..) + , Property + , property + , vector + , (=/=) + , (===) + ) import Test.QuickCheck.Arbitrary - ( arbitraryBoundedEnum ) + ( arbitraryBoundedEnum + ) import qualified Cardano.Address.Script as CA import qualified Cardano.Wallet.Address.Derivation.Shelley as Shelley diff --git a/lib/wallet/test/unit/Cardano/Wallet/Address/DerivationSpec.hs b/lib/wallet/test/unit/Cardano/Wallet/Address/DerivationSpec.hs index 58ae4c31fe7..594fff430d1 100644 --- a/lib/wallet/test/unit/Cardano/Wallet/Address/DerivationSpec.hs +++ b/lib/wallet/test/unit/Cardano/Wallet/Address/DerivationSpec.hs @@ -16,9 +16,14 @@ module Cardano.Wallet.Address.DerivationSpec import Prelude import Cardano.Address.Derivation - ( XPrv, XPub ) + ( XPrv + , XPub + ) import Cardano.Mnemonic - ( MkSomeMnemonic (..), MkSomeMnemonicError (..), SomeMnemonic (..) ) + ( MkSomeMnemonic (..) + , MkSomeMnemonicError (..) + , SomeMnemonic (..) + ) import Cardano.Wallet.Address.Derivation ( Depth (..) , DerivationIndex (..) @@ -28,21 +33,32 @@ import Cardano.Wallet.Address.Derivation , getIndex ) import Cardano.Wallet.Address.Derivation.Byron - ( ByronKey (..) ) + ( ByronKey (..) + ) import Cardano.Wallet.Address.Derivation.Icarus - ( IcarusKey (..) ) + ( IcarusKey (..) + ) import Cardano.Wallet.Address.Derivation.Shelley - ( ShelleyKey (..) ) + ( ShelleyKey (..) + ) import Cardano.Wallet.Address.Keys.PersistPrivateKey - ( serializeXPrv, unsafeDeserializeXPrv ) + ( serializeXPrv + , unsafeDeserializeXPrv + ) import Cardano.Wallet.Address.Keys.WalletKey - ( getRawKey, publicKey ) + ( getRawKey + , publicKey + ) import Cardano.Wallet.Flavor - ( KeyFlavorS (..) ) + ( KeyFlavorS (..) + ) import Cardano.Wallet.Gen - ( genMnemonic ) + ( genMnemonic + ) import Cardano.Wallet.Primitive.Passphrase - ( PassphraseHash (..), preparePassphrase ) + ( PassphraseHash (..) + , preparePassphrase + ) import Cardano.Wallet.Primitive.Passphrase.Types ( Passphrase (..) , PassphraseMaxLength (..) @@ -50,13 +66,21 @@ import Cardano.Wallet.Primitive.Passphrase.Types , PassphraseScheme (..) ) import Control.Monad - ( replicateM ) + ( replicateM + ) import Data.Either - ( isRight ) + ( isRight + ) import Data.Proxy - ( Proxy (..) ) + ( Proxy (..) + ) import Test.Hspec - ( Spec, describe, it, shouldBe, shouldSatisfy ) + ( Spec + , describe + , it + , shouldBe + , shouldSatisfy + ) import Test.QuickCheck ( Arbitrary (..) , Gen @@ -74,9 +98,11 @@ import Test.QuickCheck , (===) ) import Test.QuickCheck.Arbitrary.Generic - ( genericArbitrary ) + ( genericArbitrary + ) import Test.Text.Roundtrip - ( textRoundtrip ) + ( textRoundtrip + ) import qualified Cardano.Crypto.Wallet as CC import qualified Cardano.Wallet.Address.Derivation.Byron as Byron diff --git a/lib/wallet/test/unit/Cardano/Wallet/Address/Discovery/RandomSpec.hs b/lib/wallet/test/unit/Cardano/Wallet/Address/Discovery/RandomSpec.hs index fcc5a599f53..11f49775575 100644 --- a/lib/wallet/test/unit/Cardano/Wallet/Address/Discovery/RandomSpec.hs +++ b/lib/wallet/test/unit/Cardano/Wallet/Address/Discovery/RandomSpec.hs @@ -17,9 +17,12 @@ module Cardano.Wallet.Address.Discovery.RandomSpec import Prelude import Cardano.Address.Derivation - ( XPrv ) + ( XPrv + ) import Cardano.Mnemonic - ( MkSomeMnemonic (..), SomeMnemonic (..) ) + ( MkSomeMnemonic (..) + , SomeMnemonic (..) + ) import Cardano.Wallet.Address.Derivation ( Depth (..) , DerivationType (..) @@ -36,41 +39,72 @@ import Cardano.Wallet.Address.Derivation.Byron import Cardano.Wallet.Address.DerivationSpec () import Cardano.Wallet.Address.Discovery - ( GenChange (..), IsOurs (..), KnownAddresses (..) ) + ( GenChange (..) + , IsOurs (..) + , KnownAddresses (..) + ) import Cardano.Wallet.Address.Discovery.Random - ( RndState (..), findUnusedPath, mkRndState ) + ( RndState (..) + , findUnusedPath + , mkRndState + ) import Cardano.Wallet.Address.Keys.WalletKey - ( publicKey ) + ( publicKey + ) import Cardano.Wallet.Address.States.IsOwned - ( isOwned ) + ( isOwned + ) import Cardano.Wallet.Flavor - ( KeyFlavorS (ByronKeyS), WalletFlavorS (ByronWallet) ) + ( KeyFlavorS (ByronKeyS) + , WalletFlavorS (ByronWallet) + ) import Cardano.Wallet.Gen - ( genMnemonic ) + ( genMnemonic + ) import Cardano.Wallet.Primitive.NetworkId - ( NetworkDiscriminant (..), SNetworkId (..) ) + ( NetworkDiscriminant (..) + , SNetworkId (..) + ) import Cardano.Wallet.Primitive.Passphrase - ( Passphrase (..) ) + ( Passphrase (..) + ) import Cardano.Wallet.Primitive.Types.Address - ( Address (..), AddressState (..) ) + ( Address (..) + , AddressState (..) + ) import Control.Monad - ( forM_ ) + ( forM_ + ) import Data.ByteArray.Encoding - ( Base (..), convertFromBase ) + ( Base (..) + , convertFromBase + ) import Data.ByteString - ( ByteString ) + ( ByteString + ) import Data.Function - ( (&) ) + ( (&) + ) import Data.List - ( find ) + ( find + ) import Data.Maybe - ( isJust, isNothing ) + ( isJust + , isNothing + ) import Data.Word - ( Word32 ) + ( Word32 + ) import System.Random - ( mkStdGen ) + ( mkStdGen + ) import Test.Hspec - ( Expectation, Spec, describe, it, shouldBe ) + ( Expectation + , Spec + , describe + , it + , shouldBe + ) import Test.QuickCheck ( Arbitrary (..) , Gen diff --git a/lib/wallet/test/unit/Cardano/Wallet/Address/Discovery/SequentialSpec.hs b/lib/wallet/test/unit/Cardano/Wallet/Address/Discovery/SequentialSpec.hs index e64d820b421..666b78c7e0e 100644 --- a/lib/wallet/test/unit/Cardano/Wallet/Address/Discovery/SequentialSpec.hs +++ b/lib/wallet/test/unit/Cardano/Wallet/Address/Discovery/SequentialSpec.hs @@ -27,7 +27,8 @@ module Cardano.Wallet.Address.Discovery.SequentialSpec import Prelude import Cardano.Address.Derivation - ( XPub ) + ( XPub + ) import Cardano.Wallet.Address.Derivation ( DelegationAddress (..) , Depth (..) @@ -41,11 +42,14 @@ import Cardano.Wallet.Address.Derivation , SoftDerivation (..) ) import Cardano.Wallet.Address.Derivation.Icarus - ( IcarusKey (..) ) + ( IcarusKey (..) + ) import Cardano.Wallet.Address.Derivation.SharedKey - ( SharedKey (..) ) + ( SharedKey (..) + ) import Cardano.Wallet.Address.Derivation.Shelley - ( ShelleyKey (..) ) + ( ShelleyKey (..) + ) import Cardano.Wallet.Address.Discovery ( CompareDiscovery (..) , GenChange (..) @@ -71,49 +75,81 @@ import Cardano.Wallet.Address.Discovery.Sequential , purposeCIP1852 ) import Cardano.Wallet.Address.Keys.SequentialAny - ( mkSeqStateFromRootXPrv ) + ( mkSeqStateFromRootXPrv + ) import Cardano.Wallet.Address.Keys.WalletKey - ( publicKey ) + ( publicKey + ) import Cardano.Wallet.Address.PoolSpec - ( genPool, shrinkPool ) + ( genPool + , shrinkPool + ) import Cardano.Wallet.Address.States.IsOwned - ( isOwned ) + ( isOwned + ) import Cardano.Wallet.Flavor - ( KeyFlavorS (..), WalletFlavorS (ShelleyWallet) ) + ( KeyFlavorS (..) + , WalletFlavorS (ShelleyWallet) + ) import Cardano.Wallet.Primitive.NetworkId - ( NetworkDiscriminant (..), SNetworkId (..) ) + ( NetworkDiscriminant (..) + , SNetworkId (..) + ) import Cardano.Wallet.Primitive.Types.Address - ( Address (..), AddressState (..) ) + ( Address (..) + , AddressState (..) + ) import Cardano.Wallet.Primitive.Types.Credentials - ( RootCredentials (..) ) + ( RootCredentials (..) + ) import Cardano.Wallet.Unsafe - ( someDummyMnemonic ) + ( someDummyMnemonic + ) import Cardano.Wallet.Util - ( ShowFmt (..) ) + ( ShowFmt (..) + ) import Control.Arrow - ( first ) + ( first + ) import Control.Monad - ( unless ) + ( unless + ) import Control.Monad.IO.Class - ( liftIO ) + ( liftIO + ) import Data.Function - ( (&) ) + ( (&) + ) import Data.List.NonEmpty - ( NonEmpty ) + ( NonEmpty + ) import Data.Maybe - ( isJust, isNothing ) + ( isJust + , isNothing + ) import Data.Proxy - ( Proxy (..) ) + ( Proxy (..) + ) import Data.Text.Class - ( TextDecodingError (..), fromText ) + ( TextDecodingError (..) + , fromText + ) import Data.Type.Equality - ( type (==) ) + ( type (==) + ) import Data.Typeable - ( Typeable, typeRep ) + ( Typeable + , typeRep + ) import Data.Word - ( Word8 ) + ( Word8 + ) import Test.Hspec - ( Spec, describe, expectationFailure, it ) + ( Spec + , describe + , expectationFailure + , it + ) import Test.QuickCheck ( Arbitrary (..) , Property @@ -135,11 +171,14 @@ import Test.QuickCheck , (==>) ) import Test.QuickCheck.Arbitrary.Generic - ( genericArbitrary ) + ( genericArbitrary + ) import Test.QuickCheck.Monadic - ( monadicIO ) + ( monadicIO + ) import Test.Text.Roundtrip - ( textRoundtrip ) + ( textRoundtrip + ) import qualified Cardano.Wallet.Address.Derivation.Icarus as Icarus import qualified Cardano.Wallet.Address.Derivation.Shelley as Shelley diff --git a/lib/wallet/test/unit/Cardano/Wallet/Address/Discovery/SharedSpec.hs b/lib/wallet/test/unit/Cardano/Wallet/Address/Discovery/SharedSpec.hs index 7ad05bd750b..88e3f558c83 100644 --- a/lib/wallet/test/unit/Cardano/Wallet/Address/Discovery/SharedSpec.hs +++ b/lib/wallet/test/unit/Cardano/Wallet/Address/Discovery/SharedSpec.hs @@ -18,7 +18,9 @@ module Cardano.Wallet.Address.Discovery.SharedSpec import Prelude import Cardano.Address.Derivation - ( XPrv, XPub ) + ( XPrv + , XPub + ) import Cardano.Address.Script ( Cosigner (..) , Script (..) @@ -35,13 +37,21 @@ import Cardano.Wallet.Address.Derivation , Role (..) ) import Cardano.Wallet.Address.Derivation.Shared - ( unsafeGenerateKeyFromSeed ) + ( unsafeGenerateKeyFromSeed + ) import Cardano.Wallet.Address.Derivation.SharedKey - ( SharedKey (..), constructAddressFromIx ) + ( SharedKey (..) + , constructAddressFromIx + ) import Cardano.Wallet.Address.Discovery - ( IsOurs (..), KnownAddresses (..) ) + ( IsOurs (..) + , KnownAddresses (..) + ) import Cardano.Wallet.Address.Discovery.Sequential - ( AddressPoolGap (..), defaultAddressPoolGap, mkUnboundedAddressPoolGap ) + ( AddressPoolGap (..) + , defaultAddressPoolGap + , mkUnboundedAddressPoolGap + ) import Cardano.Wallet.Address.Discovery.Shared ( Readiness (..) , SharedAddressPool (..) @@ -51,35 +61,59 @@ import Cardano.Wallet.Address.Discovery.Shared , liftPaymentAddress ) import Cardano.Wallet.Address.Keys.Shared - ( mkSharedStateFromAccountXPub, mkSharedStateFromRootXPrv ) + ( mkSharedStateFromAccountXPub + , mkSharedStateFromRootXPrv + ) import Cardano.Wallet.Address.Keys.WalletKey - ( getRawKey, publicKey ) + ( getRawKey + , publicKey + ) import Cardano.Wallet.Flavor - ( KeyFlavorS (SharedKeyS) ) + ( KeyFlavorS (SharedKeyS) + ) import Cardano.Wallet.Gen - ( genNatural, genScript, genScriptTemplate ) + ( genNatural + , genScript + , genScriptTemplate + ) import Cardano.Wallet.Primitive.NetworkId - ( HasSNetworkId, NetworkDiscriminant (..) ) + ( HasSNetworkId + , NetworkDiscriminant (..) + ) import Cardano.Wallet.Primitive.Passphrase.Gen - ( genEncryptionPassphrase ) + ( genEncryptionPassphrase + ) import Cardano.Wallet.Primitive.Types.Address - ( Address (..), AddressState (..) ) + ( Address (..) + , AddressState (..) + ) import Cardano.Wallet.Primitive.Types.Credentials - ( RootCredentials (..) ) + ( RootCredentials (..) + ) import Cardano.Wallet.Unsafe - ( someDummyMnemonic ) + ( someDummyMnemonic + ) import Control.Arrow - ( first ) + ( first + ) import Data.Either - ( isRight ) + ( isRight + ) import Data.Maybe - ( isJust ) + ( isJust + ) import Data.Proxy - ( Proxy (..) ) + ( Proxy (..) + ) import Data.Word - ( Word32, Word8 ) + ( Word32 + , Word8 + ) import Test.Hspec - ( Spec, describe, it ) + ( Spec + , describe + , it + ) import Test.QuickCheck ( Arbitrary (..) , Gen diff --git a/lib/wallet/test/unit/Cardano/Wallet/Address/DiscoverySpec.hs b/lib/wallet/test/unit/Cardano/Wallet/Address/DiscoverySpec.hs index b5703914aac..4e11b130cb8 100644 --- a/lib/wallet/test/unit/Cardano/Wallet/Address/DiscoverySpec.hs +++ b/lib/wallet/test/unit/Cardano/Wallet/Address/DiscoverySpec.hs @@ -14,9 +14,11 @@ module Cardano.Wallet.Address.DiscoverySpec import Prelude import Cardano.Address.Derivation - ( XPrv ) + ( XPrv + ) import Cardano.Mnemonic - ( SomeMnemonic (..) ) + ( SomeMnemonic (..) + ) import Cardano.Wallet.Address.Derivation ( Depth (AccountK, CredFromKeyK, RootK) , DerivationType (..) @@ -24,19 +26,30 @@ import Cardano.Wallet.Address.Derivation , paymentAddressS ) import Cardano.Wallet.Address.Derivation.Byron - ( ByronKey, generateKeyFromSeed, unsafeGenerateKeyFromSeed ) + ( ByronKey + , generateKeyFromSeed + , unsafeGenerateKeyFromSeed + ) import Cardano.Wallet.Address.Discovery - ( IsOurs (..), knownAddresses ) + ( IsOurs (..) + , knownAddresses + ) import Cardano.Wallet.Address.Discovery.Random - ( mkRndState ) + ( mkRndState + ) import Cardano.Wallet.Address.Keys.WalletKey - ( publicKey ) + ( publicKey + ) import Cardano.Wallet.Flavor - ( KeyFlavorS (ByronKeyS) ) + ( KeyFlavorS (ByronKeyS) + ) import Cardano.Wallet.Gen - ( genMnemonic ) + ( genMnemonic + ) import Cardano.Wallet.Primitive.NetworkId - ( HasSNetworkId, NetworkDiscriminant (..) ) + ( HasSNetworkId + , NetworkDiscriminant (..) + ) import Cardano.Wallet.Primitive.Passphrase ( Passphrase (..) , PassphraseScheme (EncryptWithPBKDF2) @@ -45,13 +58,20 @@ import Cardano.Wallet.Primitive.Passphrase , preparePassphrase ) import Control.Monad - ( replicateM ) + ( replicateM + ) import Data.Maybe - ( isJust, isNothing ) + ( isJust + , isNothing + ) import Data.Proxy - ( Proxy (..) ) + ( Proxy (..) + ) import Test.Hspec - ( Spec, describe, it ) + ( Spec + , describe + , it + ) import Test.QuickCheck ( Arbitrary (..) , Gen diff --git a/lib/wallet/test/unit/Cardano/Wallet/Address/PoolSpec.hs b/lib/wallet/test/unit/Cardano/Wallet/Address/PoolSpec.hs index 0dd749a96db..2fdb5c1000b 100644 --- a/lib/wallet/test/unit/Cardano/Wallet/Address/PoolSpec.hs +++ b/lib/wallet/test/unit/Cardano/Wallet/Address/PoolSpec.hs @@ -7,25 +7,43 @@ module Cardano.Wallet.Address.PoolSpec import Prelude import Cardano.Wallet.Address.Pool - ( Pool, addressFromIx, addresses, prop_consistent, prop_fresh, prop_gap ) + ( Pool + , addressFromIx + , addresses + , prop_consistent + , prop_fresh + , prop_gap + ) import Cardano.Wallet.Primitive.Types.Address - ( AddressState (..) ) + ( AddressState (..) + ) import Data.Bifunctor - ( second ) + ( second + ) import Data.Foldable - ( fold ) + ( fold + ) import Data.Functor.Identity - ( Identity (..) ) + ( Identity (..) + ) import Data.List - ( foldl', sortOn ) + ( foldl' + , sortOn + ) import Data.Map - ( Map ) + ( Map + ) import Data.Maybe - ( fromMaybe ) + ( fromMaybe + ) import Data.Set - ( Set ) + ( Set + ) import Test.Hspec - ( Spec, describe, it ) + ( Spec + , describe + , it + ) import Test.QuickCheck ( Gen , Property diff --git a/lib/wallet/test/unit/Cardano/Wallet/Api/Malformed.hs b/lib/wallet/test/unit/Cardano/Wallet/Api/Malformed.hs index 1a611b35146..2d7f445bb35 100644 --- a/lib/wallet/test/unit/Cardano/Wallet/Api/Malformed.hs +++ b/lib/wallet/test/unit/Cardano/Wallet/Api/Malformed.hs @@ -52,7 +52,9 @@ module Cardano.Wallet.Api.Malformed import Prelude import Cardano.Wallet.Address.Derivation - ( DerivationIndex (..), Role (..) ) + ( DerivationIndex (..) + , Role (..) + ) import Cardano.Wallet.Api.Types ( ApiAddress , ApiAddressData @@ -91,29 +93,45 @@ import Cardano.Wallet.Api.Types , WalletPutPassphraseData ) import Cardano.Wallet.Primitive.NetworkId - ( NetworkDiscriminant (..) ) + ( NetworkDiscriminant (..) + ) import Cardano.Wallet.Primitive.Types - ( WalletId, walletNameMaxLength ) + ( WalletId + , walletNameMaxLength + ) import Cardano.Wallet.Primitive.Types.TokenPolicy - ( TokenName, TokenPolicyId ) + ( TokenName + , TokenPolicyId + ) import Cardano.Wallet.Primitive.Types.Tx - ( SealedTx, SerialisedTx ) + ( SealedTx + , SerialisedTx + ) import Control.Arrow - ( first ) + ( first + ) import Data.Aeson.QQ - ( aesonQQ ) + ( aesonQQ + ) import Data.ByteString.Lazy - ( ByteString ) + ( ByteString + ) import Data.String - ( IsString ) + ( IsString + ) import Data.Text - ( Text ) + ( Text + ) import Data.Typeable - ( Typeable ) + ( Typeable + ) import GHC.TypeLits - ( Symbol ) + ( Symbol + ) import Servant - ( JSON, OctetStream ) + ( JSON + , OctetStream + ) import qualified Data.Aeson as Aeson import qualified Data.ByteString as BS diff --git a/lib/wallet/test/unit/Cardano/Wallet/Api/Server/TlsSpec.hs b/lib/wallet/test/unit/Cardano/Wallet/Api/Server/TlsSpec.hs index 8c343436eec..ff98034b14b 100644 --- a/lib/wallet/test/unit/Cardano/Wallet/Api/Server/TlsSpec.hs +++ b/lib/wallet/test/unit/Cardano/Wallet/Api/Server/TlsSpec.hs @@ -11,7 +11,10 @@ module Cardano.Wallet.Api.Server.TlsSpec import Prelude import Cardano.Wallet.Api.Http.Shelley.Server - ( Listen (..), TlsConfiguration (..), withListeningSocket ) + ( Listen (..) + , TlsConfiguration (..) + , withListeningSocket + ) import Cardano.X509.Configuration ( CertDescription (..) , ConfigurationKey (..) @@ -21,25 +24,37 @@ import Cardano.X509.Configuration , genCertificate ) import Control.Monad - ( unless ) + ( unless + ) import Control.Tracer - ( nullTracer ) + ( nullTracer + ) import Data.ByteString.Lazy - ( ByteString ) + ( ByteString + ) import Data.Default - ( def ) + ( def + ) import Data.Function - ( (&) ) + ( (&) + ) import Data.X509 - ( CertificateChain (..) ) + ( CertificateChain (..) + ) import Data.X509.CertificateStore - ( makeCertificateStore ) + ( makeCertificateStore + ) import Data.X509.Extra - ( encodePEM, genRSA256KeyPair ) + ( encodePEM + , genRSA256KeyPair + ) import Data.X509.File - ( readKeyFile, readSignedObject ) + ( readKeyFile + , readSignedObject + ) import Network.Connection - ( TLSSettings (..) ) + ( TLSSettings (..) + ) import Network.HTTP.Client ( HttpException (..) , HttpExceptionContent (..) @@ -52,9 +67,11 @@ import Network.HTTP.Client , responseStatus ) import Network.HTTP.Client.TLS - ( mkManagerSettings ) + ( mkManagerSettings + ) import Network.HTTP.Types.Status - ( Status (..) ) + ( Status (..) + ) import Network.TLS ( AlertDescription (..) , ClientHooks (..) @@ -67,25 +84,44 @@ import Network.TLS , noSessionManager ) import Network.TLS.Extra.Cipher - ( ciphersuite_default ) + ( ciphersuite_default + ) import Network.Wai - ( responseLBS ) + ( responseLBS + ) import System.Directory - ( createDirectoryIfMissing, doesDirectoryExist ) + ( createDirectoryIfMissing + , doesDirectoryExist + ) import System.FilePath - ( takeFileName, (<.>), () ) + ( takeFileName + , (<.>) + , () + ) import System.IO - ( hPutStrLn, stderr ) + ( hPutStrLn + , stderr + ) import Test.Hspec - ( Spec, describe, it, shouldBe, shouldThrow ) + ( Spec + , describe + , it + , shouldBe + , shouldThrow + ) import Test.Utils.Paths - ( getTestData ) + ( getTestData + ) import Test.Utils.Platform - ( pendingOnWine ) + ( pendingOnWine + ) import UnliftIO.Async - ( async, link ) + ( async + , link + ) import UnliftIO.Exception - ( fromException ) + ( fromException + ) import qualified Cardano.Wallet.Api.Http.Shelley.Server as Server import qualified Data.ByteString as BS diff --git a/lib/wallet/test/unit/Cardano/Wallet/Api/ServerSpec.hs b/lib/wallet/test/unit/Cardano/Wallet/Api/ServerSpec.hs index c440d6b0be2..2fe59153b26 100644 --- a/lib/wallet/test/unit/Cardano/Wallet/Api/ServerSpec.hs +++ b/lib/wallet/test/unit/Cardano/Wallet/Api/ServerSpec.hs @@ -12,11 +12,17 @@ module Cardano.Wallet.Api.ServerSpec (spec) where import Prelude import Cardano.Api - ( AnyCardanoEra (..), CardanoEra (..), NetworkId (..), NetworkMagic (..) ) + ( AnyCardanoEra (..) + , CardanoEra (..) + , NetworkId (..) + , NetworkMagic (..) + ) import Cardano.BM.Trace - ( nullTracer ) + ( nullTracer + ) import Cardano.Slotting.Slot - ( EpochNo (..) ) + ( EpochNo (..) + ) import Cardano.Wallet.Api.Http.Shelley.Server ( IsServerError (..) , Listen (..) @@ -27,13 +33,18 @@ import Cardano.Wallet.Api.Http.Shelley.Server , withListeningSocket ) import Cardano.Wallet.Api.Types - ( ApiNetworkInformation (..), ApiWalletMode (..) ) + ( ApiNetworkInformation (..) + , ApiWalletMode (..) + ) import Cardano.Wallet.DB.Errors - ( ErrNoSuchWallet (..) ) + ( ErrNoSuchWallet (..) + ) import Cardano.Wallet.DummyTarget.Primitive.Types - ( dummyNetworkLayer ) + ( dummyNetworkLayer + ) import Cardano.Wallet.Network - ( NetworkLayer (..) ) + ( NetworkLayer (..) + ) import Cardano.Wallet.Primitive.Slotting ( PastHorizonException , TimeInterpreter @@ -42,27 +53,44 @@ import Cardano.Wallet.Primitive.Slotting , neverFails ) import Cardano.Wallet.Primitive.SyncProgress - ( SyncTolerance (..) ) + ( SyncTolerance (..) + ) import Cardano.Wallet.Primitive.Types - ( Block (..), BlockHeader (..), SlotNo (..), StartTime (..) ) + ( Block (..) + , BlockHeader (..) + , SlotNo (..) + , StartTime (..) + ) import Cardano.Wallet.Primitive.Types.Hash - ( Hash (..) ) + ( Hash (..) + ) import Cardano.Wallet.Unsafe - ( unsafeFromText ) + ( unsafeFromText + ) import Control.Monad - ( void ) + ( void + ) import Control.Monad.Trans.Except - ( ExceptT (..), throwE ) + ( ExceptT (..) + , throwE + ) import Data.Either - ( isLeft ) + ( isLeft + ) import Data.Maybe - ( isJust, isNothing ) + ( isJust + , isNothing + ) import Data.Quantity - ( Quantity (..) ) + ( Quantity (..) + ) import Data.SOP.Counting - ( exactlyOne ) + ( exactlyOne + ) import Data.Time.Clock - ( addUTCTime, getCurrentTime ) + ( addUTCTime + , getCurrentTime + ) import Network.Socket ( Family (..) , SockAddr (..) @@ -75,25 +103,49 @@ import Network.Socket , tupleToHostAddress ) import Ouroboros.Consensus.BlockchainTime.WallClock.Types - ( RelativeTime (..), mkSlotLength ) + ( RelativeTime (..) + , mkSlotLength + ) import Ouroboros.Consensus.Config.SecurityParam - ( SecurityParam (..) ) + ( SecurityParam (..) + ) import Servant.Server - ( ServerError (..), runHandler ) + ( ServerError (..) + , runHandler + ) import Test.Hspec - ( Spec, describe, it, pendingWith, shouldBe, shouldReturn, shouldSatisfy ) + ( Spec + , describe + , it + , pendingWith + , shouldBe + , shouldReturn + , shouldSatisfy + ) import Test.QuickCheck.Modifiers - ( NonNegative (..) ) + ( NonNegative (..) + ) import Test.QuickCheck.Monadic - ( PropertyM, assert, monadicIO, monitor, run ) + ( PropertyM + , assert + , monadicIO + , monitor + , run + ) import Test.QuickCheck.Property - ( counterexample, property ) + ( counterexample + , property + ) import Test.Utils.Platform - ( skipOnWindows ) + ( skipOnWindows + ) import UnliftIO.Async - ( concurrently_, race_ ) + ( concurrently_ + , race_ + ) import UnliftIO.Concurrent - ( threadDelay ) + ( threadDelay + ) import qualified Cardano.Wallet.Primitive.SyncProgress as S import qualified Data.ByteString.Char8 as B8 diff --git a/lib/wallet/test/unit/Cardano/Wallet/Api/TypesSpec.hs b/lib/wallet/test/unit/Cardano/Wallet/Api/TypesSpec.hs index 3d99d069bd1..2d6ada50409 100644 --- a/lib/wallet/test/unit/Cardano/Wallet/Api/TypesSpec.hs +++ b/lib/wallet/test/unit/Cardano/Wallet/Api/TypesSpec.hs @@ -36,7 +36,8 @@ module Cardano.Wallet.Api.TypesSpec (spec) where import Prelude hiding - ( id ) + ( id + ) import Cardano.Address.Script ( Cosigner (..) @@ -48,9 +49,13 @@ import Cardano.Address.Script , ValidationLevel (..) ) import Cardano.Api - ( StakeAddress, deserialiseFromRawBytes, proxyToAsType ) + ( StakeAddress + , deserialiseFromRawBytes + , proxyToAsType + ) import Cardano.Api.Gen - ( genAddressAnyWithNetworkId ) + ( genAddressAnyWithNetworkId + ) import Cardano.Mnemonic ( CheckSumBits , ConsistentEntropy @@ -64,10 +69,14 @@ import Cardano.Mnemonic , mkEntropy ) import Cardano.Pool.Metadata - ( HealthCheckSMASH ) + ( HealthCheckSMASH + ) import Cardano.Pool.Metadata.Types import Cardano.Pool.Types - ( PoolId (..), PoolOwner (..), StakePoolTicker (..) ) + ( PoolId (..) + , PoolOwner (..) + , StakePoolTicker (..) + ) import Cardano.Wallet.Address.Derivation ( Depth (..) , DerivationIndex (..) @@ -78,19 +87,28 @@ import Cardano.Wallet.Address.Derivation , fromHex ) import Cardano.Wallet.Address.Derivation.SharedKey - ( purposeCIP1854 ) + ( purposeCIP1854 + ) import Cardano.Wallet.Address.Derivation.Shelley - ( ShelleyKey (..), generateKeyFromSeed ) + ( ShelleyKey (..) + , generateKeyFromSeed + ) import Cardano.Wallet.Address.DerivationSpec () import Cardano.Wallet.Address.Discovery.Sequential - ( AddressPoolGap, getAddressPoolGap, purposeCIP1852 ) + ( AddressPoolGap + , getAddressPoolGap + , purposeCIP1852 + ) import Cardano.Wallet.Address.Discovery.Shared - ( retrieveAllCosigners ) + ( retrieveAllCosigners + ) import Cardano.Wallet.Address.Keys.WalletKey - ( publicKey ) + ( publicKey + ) import Cardano.Wallet.Api - ( Api ) + ( Api + ) import Cardano.Wallet.Api.Types ( AccountPostData (..) , AddressAmount (..) @@ -242,9 +260,11 @@ import Cardano.Wallet.Api.Types , toApiAsset ) import Cardano.Wallet.Api.Types.BlockHeader - ( ApiBlockHeader ) + ( ApiBlockHeader + ) import Cardano.Wallet.Api.Types.Certificate - ( ApiRewardAccount (..) ) + ( ApiRewardAccount (..) + ) import Cardano.Wallet.Api.Types.Error ( ApiError (..) , ApiErrorBalanceTxUnderestimatedFee (..) @@ -255,7 +275,9 @@ import Cardano.Wallet.Api.Types.Error , ApiErrorTxOutputLovelaceInsufficient (..) ) import Cardano.Wallet.Api.Types.SchemaMetadata - ( TxMetadataSchema (..), TxMetadataWithSchema (..) ) + ( TxMetadataSchema (..) + , TxMetadataWithSchema (..) + ) import Cardano.Wallet.Api.Types.Transaction ( ApiAddress (..) , ApiValidityIntervalExplicit (..) @@ -263,7 +285,8 @@ import Cardano.Wallet.Api.Types.Transaction , mkApiWitnessCount ) import Cardano.Wallet.Flavor - ( KeyFlavorS (ShelleyKeyS) ) + ( KeyFlavorS (ShelleyKeyS) + ) import Cardano.Wallet.Gen ( genMnemonic , genMockXPub @@ -280,7 +303,10 @@ import Cardano.Wallet.Pools , StakePoolMetrics (StakePoolMetrics) ) import Cardano.Wallet.Primitive.NetworkId - ( HasSNetworkId (..), NetworkDiscriminant (..), networkIdVal ) + ( HasSNetworkId (..) + , NetworkDiscriminant (..) + , networkIdVal + ) import Cardano.Wallet.Primitive.Passphrase.Types ( Passphrase (..) , PassphraseHash (PassphraseHash) @@ -290,7 +316,8 @@ import Cardano.Wallet.Primitive.Passphrase.Types , passphraseMinLength ) import Cardano.Wallet.Primitive.SyncProgress - ( SyncProgress (..) ) + ( SyncProgress (..) + ) import Cardano.Wallet.Primitive.Types ( EpochNo (..) , ExecutionUnitPrices (..) @@ -310,23 +337,37 @@ import Cardano.Wallet.Primitive.Types , walletNameMinLength ) import Cardano.Wallet.Primitive.Types.Address - ( Address (..), AddressState (..) ) + ( Address (..) + , AddressState (..) + ) import Cardano.Wallet.Primitive.Types.Coin - ( Coin (..) ) + ( Coin (..) + ) import Cardano.Wallet.Primitive.Types.Coin.Gen - ( genCoinPositive ) + ( genCoinPositive + ) import Cardano.Wallet.Primitive.Types.Hash - ( Hash (..) ) + ( Hash (..) + ) import Cardano.Wallet.Primitive.Types.RewardAccount - ( RewardAccount (..) ) + ( RewardAccount (..) + ) import Cardano.Wallet.Primitive.Types.TokenBundle - ( AssetId (..), TokenBundle ) + ( AssetId (..) + , TokenBundle + ) import Cardano.Wallet.Primitive.Types.TokenBundle.Gen - ( genTokenBundleSmallRange, shrinkTokenBundleSmallRange ) + ( genTokenBundleSmallRange + , shrinkTokenBundleSmallRange + ) import Cardano.Wallet.Primitive.Types.TokenMap - ( TokenMap ) + ( TokenMap + ) import Cardano.Wallet.Primitive.Types.TokenMap.Gen - ( genAssetId, genTokenMapSmallRange, shrinkTokenMap ) + ( genAssetId + , genTokenMapSmallRange + , shrinkTokenMap + ) import Cardano.Wallet.Primitive.Types.TokenPolicy ( AssetDecimals (..) , AssetLogo (..) @@ -338,7 +379,8 @@ import Cardano.Wallet.Primitive.Types.TokenPolicy , mkTokenFingerprint ) import Cardano.Wallet.Primitive.Types.TokenPolicy.Gen - ( genTokenName ) + ( genTokenName + ) import Cardano.Wallet.Primitive.Types.Tx ( SealedTx (..) , SerialisedTx (..) @@ -347,25 +389,39 @@ import Cardano.Wallet.Primitive.Types.Tx , unsafeSealedTxFromBytes ) import Cardano.Wallet.Primitive.Types.Tx.Constraints - ( txOutMaxCoin ) + ( txOutMaxCoin + ) import Cardano.Wallet.Primitive.Types.Tx.Gen - ( genTxScriptValidity, shrinkTxScriptValidity ) + ( genTxScriptValidity + , shrinkTxScriptValidity + ) import Cardano.Wallet.Primitive.Types.Tx.Metadata.Gen - ( genNestedTxMetadata, shrinkTxMetadata ) + ( genNestedTxMetadata + , shrinkTxMetadata + ) import Cardano.Wallet.Primitive.Types.Tx.TxIn - ( TxIn (..) ) + ( TxIn (..) + ) import Cardano.Wallet.Primitive.Types.Tx.TxMeta - ( Direction, TxStatus (..) ) + ( Direction + , TxStatus (..) + ) import Cardano.Wallet.Primitive.Types.Tx.TxOut - ( TxOut (..) ) + ( TxOut (..) + ) import Cardano.Wallet.Primitive.Types.Tx.TxOut.Gen - ( genTxOutCoin ) + ( genTxOutCoin + ) import Cardano.Wallet.Primitive.Types.UTxO - ( UTxO (..) ) + ( UTxO (..) + ) import Cardano.Wallet.Primitive.Types.UTxOStatistics - ( HistogramBar (..), UTxOStatistics (..) ) + ( HistogramBar (..) + , UTxOStatistics (..) + ) import Cardano.Wallet.TokenMetadata - ( TokenMetadataError (..) ) + ( TokenMetadataError (..) + ) import Cardano.Wallet.Transaction ( AnyExplicitScript (..) , AnyScript (..) @@ -377,15 +433,24 @@ import Cardano.Wallet.Transaction , WitnessCount (..) ) import Cardano.Wallet.Unsafe - ( unsafeFromText, unsafeXPrv ) + ( unsafeFromText + , unsafeXPrv + ) import Control.Lens - ( at, (?~) ) + ( at + , (?~) + ) import Control.Monad - ( forM, forM_, replicateM ) + ( forM + , forM_ + , replicateM + ) import Control.Monad.IO.Class - ( liftIO ) + ( liftIO + ) import Crypto.Hash - ( hash ) + ( hash + ) import Data.Aeson ( FromJSON (..) , Result (..) @@ -396,59 +461,103 @@ import Data.Aeson , (.=) ) import Data.Aeson.KeyMap - ( keys ) + ( keys + ) import Data.Aeson.QQ - ( aesonQQ ) + ( aesonQQ + ) import Data.Bifunctor - ( Bifunctor (..) ) + ( Bifunctor (..) + ) import Data.ByteString - ( ByteString ) + ( ByteString + ) import Data.Data - ( dataTypeConstrs, dataTypeOf, showConstr ) + ( dataTypeConstrs + , dataTypeOf + , showConstr + ) import Data.Either - ( lefts ) + ( lefts + ) import Data.Either.Combinators - ( fromRight' ) + ( fromRight' + ) import Data.FileEmbed - ( embedFile, makeRelativeToProject ) + ( embedFile + , makeRelativeToProject + ) import Data.Function - ( (&) ) + ( (&) + ) import Data.List - ( foldl', intercalate ) + ( foldl' + , intercalate + ) import Data.List.NonEmpty - ( NonEmpty (..) ) + ( NonEmpty (..) + ) import Data.Maybe - ( fromJust, fromMaybe ) + ( fromJust + , fromMaybe + ) import Data.OpenApi - ( Definitions, NamedSchema (..), Schema, ToSchema (..) ) + ( Definitions + , NamedSchema (..) + , Schema + , ToSchema (..) + ) import Data.OpenApi.Declare - ( Declare, declare, look ) + ( Declare + , declare + , look + ) import Data.Proxy - ( Proxy (..) ) + ( Proxy (..) + ) import Data.Quantity - ( Percentage, Quantity (..) ) + ( Percentage + , Quantity (..) + ) import Data.Text - ( Text ) + ( Text + ) import Data.Text.Class - ( FromText (..), TextDecodingError (..) ) + ( FromText (..) + , TextDecodingError (..) + ) import Data.Time.Clock - ( NominalDiffTime ) + ( NominalDiffTime + ) import Data.Typeable - ( Typeable ) + ( Typeable + ) import Data.Word - ( Word32, Word64, Word8 ) + ( Word32 + , Word64 + , Word8 + ) import Data.Word.Odd - ( Word31 ) + ( Word31 + ) import GHC.TypeLits - ( KnownSymbol, natVal, symbolVal ) + ( KnownSymbol + , natVal + , symbolVal + ) import Internal.Cardano.Write.Tx.Gen - ( genDatumHash ) + ( genDatumHash + ) import Network.Ntp - ( NtpStatusWithOffset (..) ) + ( NtpStatusWithOffset (..) + ) import Network.URI - ( URI, parseURI ) + ( URI + , parseURI + ) import Numeric.Natural - ( Natural ) + ( Natural + ) import Servant ( (:<|>) , (:>) @@ -463,15 +572,25 @@ import Servant , Verb ) import Servant.API.Verbs - ( NoContentVerb ) + ( NoContentVerb + ) import Servant.OpenApi.Test - ( validateEveryToJSON, validateEveryToJSONWithPatternChecker ) + ( validateEveryToJSON + , validateEveryToJSONWithPatternChecker + ) import System.Environment - ( lookupEnv ) + ( lookupEnv + ) import System.FilePath - ( () ) + ( () + ) import Test.Hspec - ( Spec, SpecWith, describe, it, shouldBe ) + ( Spec + , SpecWith + , describe + , it + , shouldBe + ) import Test.QuickCheck ( Arbitrary (..) , Arbitrary1 (..) @@ -502,27 +621,41 @@ import Test.QuickCheck , (===) ) import Test.QuickCheck.Arbitrary.Generic - ( genericArbitrary, genericShrink ) + ( genericArbitrary + , genericShrink + ) import Test.QuickCheck.Extra - ( reasonablySized ) + ( reasonablySized + ) import Test.QuickCheck.Gen - ( sublistOf ) + ( sublistOf + ) import Test.QuickCheck.Instances () import Test.QuickCheck.Modifiers - ( NonNegative (..) ) + ( NonNegative (..) + ) import Test.Text.Roundtrip - ( textRoundtrip ) + ( textRoundtrip + ) import Test.Utils.Paths - ( getTestData ) + ( getTestData + ) import Test.Utils.Roundtrip - ( httpApiDataRoundtrip ) + ( httpApiDataRoundtrip + ) import Test.Utils.Time - ( genUniformTime ) + ( genUniformTime + ) import Text.Regex.PCRE - ( compBlank, execBlank, makeRegexOpts, matchTest ) + ( compBlank + , execBlank + , makeRegexOpts + , matchTest + ) import Web.HttpApiData - ( FromHttpApiData (..) ) + ( FromHttpApiData (..) + ) import qualified Cardano.Api as Cardano import qualified Cardano.Wallet.Api.Types as Api diff --git a/lib/wallet/test/unit/Cardano/Wallet/ApiSpec.hs b/lib/wallet/test/unit/Cardano/Wallet/ApiSpec.hs index 65e65bb5bb1..292afb17fc4 100644 --- a/lib/wallet/test/unit/Cardano/Wallet/ApiSpec.hs +++ b/lib/wallet/test/unit/Cardano/Wallet/ApiSpec.hs @@ -39,9 +39,11 @@ module Cardano.Wallet.ApiSpec import Prelude import Cardano.Wallet.Api - ( Api ) + ( Api + ) import Cardano.Wallet.Api.Http.Shelley.Server - ( IsServerError (..) ) + ( IsServerError (..) + ) import Cardano.Wallet.Api.Malformed ( BodyParam (..) , ExpectedError (..) @@ -53,43 +55,70 @@ import Cardano.Wallet.Api.Malformed , wellformed ) import Cardano.Wallet.Primitive.NetworkId - ( NetworkDiscriminant (..) ) + ( NetworkDiscriminant (..) + ) import Control.Monad - ( forM_ ) + ( forM_ + ) import Data.Aeson.QQ - ( aesonQQ ) + ( aesonQQ + ) import Data.Bifunctor - ( first ) + ( first + ) import Data.Function - ( (&) ) + ( (&) + ) import Data.IORef - ( atomicModifyIORef, newIORef ) + ( atomicModifyIORef + , newIORef + ) import Data.List - ( delete, (\\) ) + ( delete + , (\\) + ) import Data.Map.Strict - ( Map ) + ( Map + ) import Data.Maybe - ( mapMaybe ) + ( mapMaybe + ) import Data.Proxy - ( Proxy (..) ) + ( Proxy (..) + ) import Data.Text - ( Text ) + ( Text + ) import Data.Tuple - ( swap ) + ( swap + ) import Data.Type.Equality - ( (:~:) (..), testEquality ) + ( (:~:) (..) + , testEquality + ) import Data.Typeable - ( Typeable, typeRep ) + ( Typeable + , typeRep + ) import Data.Void - ( Void ) + ( Void + ) import GHC.TypeLits - ( KnownSymbol, symbolVal ) + ( KnownSymbol + , symbolVal + ) import Network.HTTP.Media.RenderHeader - ( renderHeader ) + ( renderHeader + ) import Network.HTTP.Types.Header - ( hAccept, hContentType ) + ( hAccept + , hContentType + ) import Network.HTTP.Types.Method - ( Method, methodHead, renderStdMethod ) + ( Method + , methodHead + , renderStdMethod + ) import Network.Wai ( Request , RequestBodyLength (..) @@ -101,7 +130,8 @@ import Network.Wai , requestMethod ) import Network.Wai.Middleware.ServerError - ( handleRawError ) + ( handleRawError + ) import Network.Wai.Test ( SResponse , Session @@ -112,15 +142,35 @@ import Network.Wai.Test , runSession ) import Servant - ( Accept (..), Application, ReqBody, Server, StdMethod (..), Verb, serve ) + ( Accept (..) + , Application + , ReqBody + , Server + , StdMethod (..) + , Verb + , serve + ) import Servant.API - ( (:<|>) (..), (:>), Capture, OctetStream ) + ( (:<|>) (..) + , (:>) + , Capture + , OctetStream + ) import Servant.API.Verbs - ( NoContentVerb, ReflectMethod (..) ) + ( NoContentVerb + , ReflectMethod (..) + ) import Test.Hspec - ( HasCallStack, Spec, describe, it, runIO, xdescribe ) + ( HasCallStack + , Spec + , describe + , it + , runIO + , xdescribe + ) import Type.Reflection - ( typeOf ) + ( typeOf + ) import qualified Data.Aeson as Aeson import qualified Data.ByteString.Char8 as B8 diff --git a/lib/wallet/test/unit/Cardano/Wallet/Balance/Migration/PlanningSpec.hs b/lib/wallet/test/unit/Cardano/Wallet/Balance/Migration/PlanningSpec.hs index fbde9fa5db2..16718ae2e35 100644 --- a/lib/wallet/test/unit/Cardano/Wallet/Balance/Migration/PlanningSpec.hs +++ b/lib/wallet/test/unit/Cardano/Wallet/Balance/Migration/PlanningSpec.hs @@ -20,7 +20,9 @@ import Cardano.Wallet.Balance.Migration.Planning , uncategorizeUTxOEntries ) import Cardano.Wallet.Balance.Migration.Selection - ( RewardWithdrawal (..), Selection (..) ) + ( RewardWithdrawal (..) + , Selection (..) + ) import Cardano.Wallet.Balance.Migration.SelectionSpec ( MockInputId , MockTxConstraints (..) @@ -32,27 +34,41 @@ import Cardano.Wallet.Balance.Migration.SelectionSpec , unMockTxConstraints ) import Cardano.Wallet.Primitive.Types.Coin - ( Coin (..) ) + ( Coin (..) + ) import Cardano.Wallet.Primitive.Types.TokenBundle - ( TokenBundle (..) ) + ( TokenBundle (..) + ) import Cardano.Wallet.Primitive.Types.TokenMap - ( TokenMap ) + ( TokenMap + ) import Control.Monad - ( replicateM ) + ( replicateM + ) import Data.Either - ( isLeft, isRight ) + ( isLeft + , isRight + ) import Data.Generics.Internal.VL.Lens - ( view ) + ( view + ) import Data.Generics.Labels () import Data.Set - ( Set ) + ( Set + ) import Fmt - ( padLeftF, pretty ) + ( padLeftF + , pretty + ) import Test.Hspec - ( Spec, describe, it ) + ( Spec + , describe + , it + ) import Test.Hspec.Core.QuickCheck - ( modifyMaxSuccess ) + ( modifyMaxSuccess + ) import Test.QuickCheck ( Blind (..) , Gen @@ -69,9 +85,12 @@ import Test.QuickCheck , (===) ) import Test.QuickCheck.Extra - ( report, verify ) + ( report + , verify + ) import Test.Utils.Pretty - ( Pretty (..) ) + ( Pretty (..) + ) import qualified Cardano.Wallet.Balance.Migration.Selection as Selection import qualified Cardano.Wallet.Primitive.Types.Coin as Coin diff --git a/lib/wallet/test/unit/Cardano/Wallet/Balance/Migration/SelectionSpec.hs b/lib/wallet/test/unit/Cardano/Wallet/Balance/Migration/SelectionSpec.hs index 8b36268222c..6383f804556 100644 --- a/lib/wallet/test/unit/Cardano/Wallet/Balance/Migration/SelectionSpec.hs +++ b/lib/wallet/test/unit/Cardano/Wallet/Balance/Migration/SelectionSpec.hs @@ -27,21 +27,32 @@ import Cardano.Wallet.Balance.Migration.Selection , minimizeFeeStep ) import Cardano.Wallet.Primitive.Types.Address - ( Address ) + ( Address + ) import Cardano.Wallet.Primitive.Types.Coin - ( Coin (..) ) + ( Coin (..) + ) import Cardano.Wallet.Primitive.Types.Coin.Gen - ( chooseCoin ) + ( chooseCoin + ) import Cardano.Wallet.Primitive.Types.Hash - ( Hash (..) ) + ( Hash (..) + ) import Cardano.Wallet.Primitive.Types.TokenBundle - ( Flat (..), TokenBundle (..) ) + ( Flat (..) + , TokenBundle (..) + ) import Cardano.Wallet.Primitive.Types.TokenMap - ( AssetId (..), TokenMap ) + ( AssetId (..) + , TokenMap + ) import Cardano.Wallet.Primitive.Types.TokenPolicy - ( TokenName (..), TokenPolicyId (..) ) + ( TokenName (..) + , TokenPolicyId (..) + ) import Cardano.Wallet.Primitive.Types.TokenQuantity - ( TokenQuantity (..) ) + ( TokenQuantity (..) + ) import Cardano.Wallet.Primitive.Types.Tx.Constraints ( TxConstraints (..) , TxSize (..) @@ -52,37 +63,56 @@ import Cardano.Wallet.Primitive.Types.Tx.Constraints , txOutputHasValidTokenQuantities ) import Control.Monad - ( replicateM ) + ( replicateM + ) import Data.ByteArray.Encoding - ( Base (Base16), convertToBase ) + ( Base (Base16) + , convertToBase + ) import Data.ByteString - ( ByteString ) + ( ByteString + ) import Data.Either - ( isRight ) + ( isRight + ) import Data.Either.Extra - ( eitherToMaybe ) + ( eitherToMaybe + ) import Data.Functor - ( (<&>) ) + ( (<&>) + ) import Data.Generics.Internal.VL.Lens - ( view ) + ( view + ) import Data.Generics.Labels () import Data.List.NonEmpty - ( NonEmpty (..) ) + ( NonEmpty (..) + ) import Data.Monoid.Monus - ( Monus ((<\>)) ) + ( Monus ((<\>)) + ) import Data.Semigroup - ( mtimesDefault, stimes ) + ( mtimesDefault + , stimes + ) import Data.Word - ( Word8 ) + ( Word8 + ) import Fmt - ( pretty ) + ( pretty + ) import Numeric.Natural - ( Natural ) + ( Natural + ) import Test.Hspec - ( Spec, describe, it ) + ( Spec + , describe + , it + ) import Test.Hspec.Core.QuickCheck - ( modifyMaxSuccess ) + ( modifyMaxSuccess + ) import Test.QuickCheck ( Arbitrary (..) , Blind (..) @@ -103,7 +133,9 @@ import Test.QuickCheck , withMaxSuccess ) import Test.QuickCheck.Extra - ( report, verify ) + ( report + , verify + ) import qualified Cardano.Wallet.Balance.Migration.Selection as Selection import qualified Cardano.Wallet.Primitive.Types.Coin as Coin diff --git a/lib/wallet/test/unit/Cardano/Wallet/Balance/MigrationSpec.hs b/lib/wallet/test/unit/Cardano/Wallet/Balance/MigrationSpec.hs index 407ab736d55..963309be023 100644 --- a/lib/wallet/test/unit/Cardano/Wallet/Balance/MigrationSpec.hs +++ b/lib/wallet/test/unit/Cardano/Wallet/Balance/MigrationSpec.hs @@ -7,9 +7,13 @@ module Cardano.Wallet.Balance.MigrationSpec import Prelude import Cardano.Wallet.Balance.Migration - ( RewardWithdrawal (..), createPlan ) + ( RewardWithdrawal (..) + , createPlan + ) import Cardano.Wallet.Balance.Migration.Planning - ( categorizeUTxO, uncategorizeUTxO ) + ( categorizeUTxO + , uncategorizeUTxO + ) import Cardano.Wallet.Balance.Migration.SelectionSpec ( MockTxConstraints , genRewardWithdrawal @@ -18,29 +22,47 @@ import Cardano.Wallet.Balance.Migration.SelectionSpec , unMockTxConstraints ) import Cardano.Wallet.Primitive.Types.Address.Gen - ( genAddress ) + ( genAddress + ) import Cardano.Wallet.Primitive.Types.Tx.TxIn - ( TxIn (..) ) + ( TxIn (..) + ) import Cardano.Wallet.Primitive.Types.Tx.TxIn.Gen - ( genTxInLargeRange ) + ( genTxInLargeRange + ) import Cardano.Wallet.Primitive.Types.Tx.TxOut - ( TxOut (..) ) + ( TxOut (..) + ) import Cardano.Wallet.Primitive.Types.UTxO - ( UTxO (..) ) + ( UTxO (..) + ) import Control.Monad - ( replicateM ) + ( replicateM + ) import Data.Function - ( (&) ) + ( (&) + ) import Data.Generics.Internal.VL.Lens - ( view ) + ( view + ) import Data.Generics.Labels () import Test.Hspec - ( Spec, describe, it ) + ( Spec + , describe + , it + ) import Test.QuickCheck - ( Blind (..), Gen, Property, choose, forAllBlind, property ) + ( Blind (..) + , Gen + , Property + , choose + , forAllBlind + , property + ) import Test.QuickCheck.Extra - ( verify ) + ( verify + ) import qualified Cardano.Wallet.Balance.Migration.Planning as Planning import qualified Data.List.NonEmpty as NE diff --git a/lib/wallet/test/unit/Cardano/Wallet/Checkpoints/PolicySpec.hs b/lib/wallet/test/unit/Cardano/Wallet/Checkpoints/PolicySpec.hs index 34ba2ac911f..798c21e6784 100644 --- a/lib/wallet/test/unit/Cardano/Wallet/Checkpoints/PolicySpec.hs +++ b/lib/wallet/test/unit/Cardano/Wallet/Checkpoints/PolicySpec.hs @@ -6,9 +6,16 @@ module Cardano.Wallet.Checkpoints.PolicySpec import Prelude import Cardano.Wallet.Checkpoints.Policy - ( BlockHeight, CheckpointPolicy, nextCheckpoint, toListAtTip ) + ( BlockHeight + , CheckpointPolicy + , nextCheckpoint + , toListAtTip + ) import Test.Hspec - ( Spec, describe, it ) + ( Spec + , describe + , it + ) import Test.QuickCheck ( Arbitrary (..) , Gen diff --git a/lib/wallet/test/unit/Cardano/Wallet/CheckpointsSpec.hs b/lib/wallet/test/unit/Cardano/Wallet/CheckpointsSpec.hs index 147d7e12ef0..08a9d798258 100644 --- a/lib/wallet/test/unit/Cardano/Wallet/CheckpointsSpec.hs +++ b/lib/wallet/test/unit/Cardano/Wallet/CheckpointsSpec.hs @@ -6,15 +6,25 @@ module Cardano.Wallet.CheckpointsSpec import Prelude import Cardano.Wallet.Checkpoints - ( SparseCheckpointsConfig (..), gapSize, sparseCheckpoints ) + ( SparseCheckpointsConfig (..) + , gapSize + , sparseCheckpoints + ) import Data.Function - ( (&) ) + ( (&) + ) import Data.Quantity - ( Quantity (..) ) + ( Quantity (..) + ) import Data.Word - ( Word32 ) + ( Word32 + ) import Test.Hspec - ( Spec, describe, it, shouldBe ) + ( Spec + , describe + , it + , shouldBe + ) import Test.QuickCheck ( Arbitrary (..) , Gen diff --git a/lib/wallet/test/unit/Cardano/Wallet/DB/Arbitrary.hs b/lib/wallet/test/unit/Cardano/Wallet/DB/Arbitrary.hs index e00013ffc94..b92886efe2c 100644 --- a/lib/wallet/test/unit/Cardano/Wallet/DB/Arbitrary.hs +++ b/lib/wallet/test/unit/Cardano/Wallet/DB/Arbitrary.hs @@ -32,31 +32,52 @@ module Cardano.Wallet.DB.Arbitrary import Prelude import Cardano.Address.Derivation - ( XPrv, XPub ) + ( XPrv + , XPub + ) import Cardano.Address.Script - ( Cosigner (..), Script (..), ScriptTemplate (..) ) + ( Cosigner (..) + , Script (..) + , ScriptTemplate (..) + ) import Cardano.Crypto.Wallet - ( unXPrv ) + ( unXPrv + ) import Cardano.Mnemonic - ( SomeMnemonic (..) ) + ( SomeMnemonic (..) + ) import Cardano.Pool.Types - ( PoolId (..) ) + ( PoolId (..) + ) import Cardano.Wallet.Address.Book - ( AddressBookIso (..) ) + ( AddressBookIso (..) + ) import Cardano.Wallet.Address.Derivation - ( Depth (..), DerivationType (..), Index (..), Role (..) ) + ( Depth (..) + , DerivationType (..) + , Index (..) + , Role (..) + ) import Cardano.Wallet.Address.Derivation.Byron - ( ByronKey (..) ) + ( ByronKey (..) + ) import Cardano.Wallet.Address.Derivation.Shared () import Cardano.Wallet.Address.Derivation.SharedKey - ( SharedKey, purposeCIP1854 ) + ( SharedKey + , purposeCIP1854 + ) import Cardano.Wallet.Address.Derivation.Shelley - ( ShelleyKey (..) ) + ( ShelleyKey (..) + ) import Cardano.Wallet.Address.Discovery - ( IsOurs, PendingIxs, emptyPendingIxs ) + ( IsOurs + , PendingIxs + , emptyPendingIxs + ) import Cardano.Wallet.Address.Discovery.Random - ( RndState (..) ) + ( RndState (..) + ) import Cardano.Wallet.Address.Discovery.Sequential ( DerivationPrefix (..) , SeqState (..) @@ -65,21 +86,39 @@ import Cardano.Wallet.Address.Discovery.Sequential , purposeCIP1852 ) import Cardano.Wallet.Address.Discovery.Shared - ( SharedAddressPools (..), SharedState (..) ) + ( SharedAddressPools (..) + , SharedState (..) + ) import Cardano.Wallet.Address.Keys.WalletKey - ( getRawKey, liftRawKey, publicKey ) + ( getRawKey + , liftRawKey + , publicKey + ) import Cardano.Wallet.DB.Pure.Implementation - ( TxHistory, filterTxHistory ) + ( TxHistory + , filterTxHistory + ) import Cardano.Wallet.DummyTarget.Primitive.Types as DummyTarget - ( block0, mkTx ) + ( block0 + , mkTx + ) import Cardano.Wallet.Flavor - ( KeyFlavorS (SharedKeyS, ShelleyKeyS) ) + ( KeyFlavorS (SharedKeyS, ShelleyKeyS) + ) import Cardano.Wallet.Gen - ( genMnemonic, shrinkSlotNo ) + ( genMnemonic + , shrinkSlotNo + ) import Cardano.Wallet.Primitive.Model - ( Wallet, currentTip, getState, unsafeInitWallet, utxo ) + ( Wallet + , currentTip + , getState + , unsafeInitWallet + , utxo + ) import Cardano.Wallet.Primitive.NetworkId - ( NetworkDiscriminant (..) ) + ( NetworkDiscriminant (..) + ) import Cardano.Wallet.Primitive.Passphrase.Types ( Passphrase (..) , PassphraseHash (..) @@ -114,89 +153,149 @@ import Cardano.Wallet.Primitive.Types , wholeRange ) import Cardano.Wallet.Primitive.Types.Address - ( Address (..), AddressState (..) ) + ( Address (..) + , AddressState (..) + ) import Cardano.Wallet.Primitive.Types.Coin - ( Coin (..) ) + ( Coin (..) + ) import Cardano.Wallet.Primitive.Types.Hash - ( Hash (..), mockHash ) + ( Hash (..) + , mockHash + ) import Cardano.Wallet.Primitive.Types.RewardAccount - ( RewardAccount (..) ) + ( RewardAccount (..) + ) import Cardano.Wallet.Primitive.Types.TokenBundle.Gen - ( genTokenBundleSmallRange ) + ( genTokenBundleSmallRange + ) import Cardano.Wallet.Primitive.Types.TokenMap - ( TokenMap ) + ( TokenMap + ) import Cardano.Wallet.Primitive.Types.TokenMap.Gen - ( genTokenMap, shrinkTokenMap ) + ( genTokenMap + , shrinkTokenMap + ) import Cardano.Wallet.Primitive.Types.Tx.Gen - ( genTxScriptValidity, shrinkTxScriptValidity ) + ( genTxScriptValidity + , shrinkTxScriptValidity + ) import Cardano.Wallet.Primitive.Types.Tx.Metadata.Gen - ( genSimpleTxMetadata, shrinkTxMetadata ) + ( genSimpleTxMetadata + , shrinkTxMetadata + ) import Cardano.Wallet.Primitive.Types.Tx.Tx - ( Tx (..), TxMetadata, TxScriptValidity (..) ) + ( Tx (..) + , TxMetadata + , TxScriptValidity (..) + ) import Cardano.Wallet.Primitive.Types.Tx.TxIn - ( TxIn (..) ) + ( TxIn (..) + ) import Cardano.Wallet.Primitive.Types.Tx.TxMeta - ( Direction (..), TxMeta (..), TxStatus (..), isInLedger ) + ( Direction (..) + , TxMeta (..) + , TxStatus (..) + , isInLedger + ) import Cardano.Wallet.Primitive.Types.Tx.TxOut - ( TxOut (..) ) + ( TxOut (..) + ) import Cardano.Wallet.Primitive.Types.Tx.TxOut.Gen - ( genTxOutCoin ) + ( genTxOutCoin + ) import Cardano.Wallet.Primitive.Types.UTxO - ( UTxO (..) ) + ( UTxO (..) + ) import Cardano.Wallet.Read.Eras.EraValue - ( eraValueSerialize ) + ( eraValueSerialize + ) import Cardano.Wallet.Read.Eras.KnownEras - ( knownEraIndices ) + ( knownEraIndices + ) import Cardano.Wallet.Read.Tx.CBOR - ( TxCBOR ) + ( TxCBOR + ) import Cardano.Wallet.Unsafe - ( someDummyMnemonic, unsafeMkPercentage ) + ( someDummyMnemonic + , unsafeMkPercentage + ) import Cardano.Wallet.Util - ( ShowFmt (..) ) + ( ShowFmt (..) + ) import Control.DeepSeq - ( NFData ) + ( NFData + ) import Crypto.Hash - ( hash ) + ( hash + ) import Data.ByteArray.Encoding - ( Base (Base16), convertToBase ) + ( Base (Base16) + , convertToBase + ) import Data.Either.Extra - ( fromRight' ) + ( fromRight' + ) import Data.Functor.Identity - ( Identity (..) ) + ( Identity (..) + ) import Data.Generics.Internal.VL - ( match ) + ( match + ) import Data.Generics.Internal.VL.Lens - ( (^.) ) + ( (^.) + ) import Data.Generics.Labels () import Data.List - ( unfoldr ) + ( unfoldr + ) import Data.Proxy - ( Proxy (..) ) + ( Proxy (..) + ) import Data.Quantity - ( Percentage (..), Quantity (..) ) + ( Percentage (..) + , Quantity (..) + ) import Data.Ratio - ( (%) ) + ( (%) + ) import Data.Text.Class - ( toText ) + ( toText + ) import Data.Typeable - ( Typeable ) + ( Typeable + ) import Data.Word - ( Word16, Word32 ) + ( Word16 + , Word32 + ) import Data.Word.Odd - ( Word31 ) + ( Word31 + ) import Fmt - ( Buildable (..), Builder, blockListF', prefixF, suffixF, tupleF ) + ( Buildable (..) + , Builder + , blockListF' + , prefixF + , suffixF + , tupleF + ) import Generics.SOP - ( NP (..) ) + ( NP (..) + ) import GHC.Generics - ( Generic ) + ( Generic + ) import Numeric.Natural - ( Natural ) + ( Natural + ) import System.IO.Unsafe - ( unsafePerformIO ) + ( unsafePerformIO + ) import System.Random - ( mkStdGen ) + ( mkStdGen + ) import Test.QuickCheck ( Arbitrary (..) , Gen @@ -219,11 +318,16 @@ import Test.QuickCheck , vectorOf ) import Test.QuickCheck.Arbitrary.Generic - ( genericArbitrary ) + ( genericArbitrary + ) import Test.QuickCheck.Extra - ( genericRoundRobinShrink, (<:>), (<@>) ) + ( genericRoundRobinShrink + , (<:>) + , (<@>) + ) import Test.Utils.Time - ( genUniformTime ) + ( genUniformTime + ) import qualified Cardano.Wallet.Address.Derivation.Byron as Byron import qualified Cardano.Wallet.Address.Derivation.MintBurn as MintBurn diff --git a/lib/wallet/test/unit/Cardano/Wallet/DB/Fixtures.hs b/lib/wallet/test/unit/Cardano/Wallet/DB/Fixtures.hs index 89858659af1..f3abd182f4c 100644 --- a/lib/wallet/test/unit/Cardano/Wallet/DB/Fixtures.hs +++ b/lib/wallet/test/unit/Cardano/Wallet/DB/Fixtures.hs @@ -35,33 +35,52 @@ import Cardano.DB.Sqlite , runQuery ) import Cardano.Wallet.DB.Sqlite.Schema - ( Wallet (..), migrateAll ) + ( Wallet (..) + , migrateAll + ) import Cardano.Wallet.DB.Sqlite.Types - ( BlockId (..) ) + ( BlockId (..) + ) import Cardano.Wallet.Primitive.Types - ( WalletId (..) ) + ( WalletId (..) + ) import Cardano.Wallet.Primitive.Types.Hash - ( Hash (..) ) + ( Hash (..) + ) import Cardano.Wallet.Unsafe - ( unsafeFromHex ) + ( unsafeFromHex + ) import Control.Tracer - ( nullTracer ) + ( nullTracer + ) import Data.Bifunctor - ( second ) + ( second + ) import Data.Delta - ( Delta (Base) ) + ( Delta (Base) + ) import Data.Either - ( fromRight ) + ( fromRight + ) import Data.Store - ( Query (..), Store (..), World ) + ( Query (..) + , Store (..) + , World + ) import Data.Time.Clock - ( UTCTime ) + ( UTCTime + ) import Data.Time.Clock.POSIX - ( posixSecondsToUTCTime ) + ( posixSecondsToUTCTime + ) import Database.Persist.Sql - ( deleteWhere, insert_ ) + ( deleteWhere + , insert_ + ) import Database.Persist.Sqlite - ( SqlPersistT, (==.) ) + ( SqlPersistT + , (==.) + ) import Test.QuickCheck ( Arbitrary , Gen @@ -76,9 +95,15 @@ import Test.QuickCheck , suchThat ) import Test.QuickCheck.Monadic - ( PropertyM, assert, monadicIO, monitor, run ) + ( PropertyM + , assert + , monadicIO + , monitor + , run + ) import UnliftIO.Exception - ( bracket ) + ( bracket + ) import qualified Cardano.Wallet.DB.Sqlite.Schema as TH diff --git a/lib/wallet/test/unit/Cardano/Wallet/DB/LayerSpec.hs b/lib/wallet/test/unit/Cardano/Wallet/DB/LayerSpec.hs index f919661aec7..27b83a98126 100644 --- a/lib/wallet/test/unit/Cardano/Wallet/DB/LayerSpec.hs +++ b/lib/wallet/test/unit/Cardano/Wallet/DB/LayerSpec.hs @@ -39,37 +39,60 @@ module Cardano.Wallet.DB.LayerSpec import Prelude import Cardano.BM.Configuration.Static - ( defaultConfigTesting ) + ( defaultConfigTesting + ) import Cardano.BM.Data.Tracer - ( nullTracer ) + ( nullTracer + ) import Cardano.BM.Extra - ( trMessageText ) + ( trMessageText + ) import Cardano.BM.Setup - ( setupTrace ) + ( setupTrace + ) import Cardano.BM.Trace - ( traceInTVarIO ) + ( traceInTVarIO + ) import Cardano.Crypto.Wallet - ( XPrv ) + ( XPrv + ) import Cardano.DB.Sqlite - ( DBField, DBLog (..), fieldName ) + ( DBField + , DBLog (..) + , fieldName + ) import Cardano.Mnemonic - ( SomeMnemonic (..) ) + ( SomeMnemonic (..) + ) import Cardano.Wallet - ( putPrivateKey, readPrivateKey, readWalletMeta ) + ( putPrivateKey + , readPrivateKey + , readWalletMeta + ) import Cardano.Wallet.Address.Derivation - ( Depth (..), DerivationType (..), Index, PaymentAddress (..) ) + ( Depth (..) + , DerivationType (..) + , Index + , PaymentAddress (..) + ) import Cardano.Wallet.Address.Derivation.Icarus - ( IcarusKey ) + ( IcarusKey + ) import Cardano.Wallet.Address.Derivation.Shared () import Cardano.Wallet.Address.Derivation.SharedKey - ( SharedKey ) + ( SharedKey + ) import Cardano.Wallet.Address.Derivation.Shelley - ( ShelleyKey (..), generateKeyFromSeed ) + ( ShelleyKey (..) + , generateKeyFromSeed + ) import Cardano.Wallet.Address.Discovery - ( KnownAddresses (..) ) + ( KnownAddresses (..) + ) import Cardano.Wallet.Address.Discovery.Random - ( RndState (..) ) + ( RndState (..) + ) import Cardano.Wallet.Address.Discovery.Sequential ( DerivationPrefix (..) , SeqState (..) @@ -79,11 +102,17 @@ import Cardano.Wallet.Address.Discovery.Sequential , purposeCIP1852 ) import Cardano.Wallet.Address.Discovery.Shared - ( SharedState ) + ( SharedState + ) import Cardano.Wallet.Address.Keys.SequentialAny - ( mkSeqStateFromRootXPrv ) + ( mkSeqStateFromRootXPrv + ) import Cardano.Wallet.DB - ( DBFactory (..), DBFresh (..), DBLayer (..), DBLayerParams (..) ) + ( DBFactory (..) + , DBFresh (..) + , DBLayer (..) + , DBLayerParams (..) + ) import Cardano.Wallet.DB.Layer ( DefaultFieldValues (..) , PersistAddressBook @@ -97,15 +126,27 @@ import Cardano.Wallet.DB.Layer , withDBOpenFromFile ) import Cardano.Wallet.DB.Properties - ( properties ) + ( properties + ) import Cardano.Wallet.DB.StateMachine - ( TestConstraints, prop_sequential, validateGenerators ) + ( TestConstraints + , prop_sequential + , validateGenerators + ) import Cardano.Wallet.DummyTarget.Primitive.Types - ( block0, dummyGenesisParameters, dummyTimeInterpreter ) + ( block0 + , dummyGenesisParameters + , dummyTimeInterpreter + ) import Cardano.Wallet.Flavor - ( KeyFlavorS (..), KeyOf, WalletFlavor (..), WalletFlavorS (..) ) + ( KeyFlavorS (..) + , KeyOf + , WalletFlavor (..) + , WalletFlavorS (..) + ) import Cardano.Wallet.Gen - ( genMnemonic ) + ( genMnemonic + ) import Cardano.Wallet.Primitive.Model ( FilteredBlock (..) , Wallet @@ -116,9 +157,12 @@ import Cardano.Wallet.Primitive.Model , initWallet ) import Cardano.Wallet.Primitive.NetworkId - ( NetworkDiscriminant (..) ) + ( NetworkDiscriminant (..) + ) import Cardano.Wallet.Primitive.Passphrase - ( encryptPassphrase, preparePassphrase ) + ( encryptPassphrase + , preparePassphrase + ) import Cardano.Wallet.Primitive.Passphrase.Types ( Passphrase (..) , PassphraseHash (..) @@ -141,85 +185,147 @@ import Cardano.Wallet.Primitive.Types , wholeRange ) import Cardano.Wallet.Primitive.Types.Address - ( Address (..) ) + ( Address (..) + ) import Cardano.Wallet.Primitive.Types.Coin - ( Coin (..) ) + ( Coin (..) + ) import Cardano.Wallet.Primitive.Types.Credentials - ( RootCredentials (..) ) + ( RootCredentials (..) + ) import Cardano.Wallet.Primitive.Types.Hash - ( Hash (..), mockHash ) + ( Hash (..) + , mockHash + ) import Cardano.Wallet.Primitive.Types.TokenBundle - ( TokenBundle ) + ( TokenBundle + ) import Cardano.Wallet.Primitive.Types.Tx - ( Tx (..), TxScriptValidity (..) ) + ( Tx (..) + , TxScriptValidity (..) + ) import Cardano.Wallet.Primitive.Types.Tx.TransactionInfo - ( TransactionInfo (..), toTxHistory ) + ( TransactionInfo (..) + , toTxHistory + ) import Cardano.Wallet.Primitive.Types.Tx.TxIn - ( TxIn (..) ) + ( TxIn (..) + ) import Cardano.Wallet.Primitive.Types.Tx.TxMeta - ( Direction (..), TxMeta (..), TxStatus (..) ) + ( Direction (..) + , TxMeta (..) + , TxStatus (..) + ) import Cardano.Wallet.Primitive.Types.Tx.TxOut - ( TxOut (..) ) + ( TxOut (..) + ) import Cardano.Wallet.Unsafe - ( unsafeFromHex, unsafeRunExceptT ) + ( unsafeFromHex + , unsafeRunExceptT + ) import Control.Monad - ( forM_, forever, replicateM_, unless, void ) + ( forM_ + , forever + , replicateM_ + , unless + , void + ) import Control.Monad.IO.Class - ( MonadIO, liftIO ) + ( MonadIO + , liftIO + ) import Control.Tracer - ( Tracer ) + ( Tracer + ) import Crypto.Hash - ( hash ) + ( hash + ) import Data.ByteString - ( ByteString ) + ( ByteString + ) import Data.Coerce - ( coerce ) + ( coerce + ) import Data.Generics.Internal.VL.Lens - ( over, view, (^.) ) + ( over + , view + , (^.) + ) import Data.Generics.Labels () import Data.Kind - ( Type ) + ( Type + ) import Data.Maybe - ( isJust, isNothing, mapMaybe ) + ( isJust + , isNothing + , mapMaybe + ) import Data.Quantity - ( Quantity (..) ) + ( Quantity (..) + ) import Data.String.Interpolate - ( i ) + ( i + ) import Data.Text - ( Text ) + ( Text + ) import Data.Text.Class - ( toText ) + ( toText + ) import Data.Time.Clock - ( getCurrentTime ) + ( getCurrentTime + ) import Data.Time.Clock.POSIX - ( posixSecondsToUTCTime ) + ( posixSecondsToUTCTime + ) import Data.Typeable - ( Typeable, typeOf ) + ( Typeable + , typeOf + ) import Data.Word - ( Word64 ) + ( Word64 + ) import Database.Persist.Sql - ( FieldNameDB (..), PersistEntity (..), fieldDB ) + ( FieldNameDB (..) + , PersistEntity (..) + , fieldDB + ) import Database.Persist.Sqlite - ( Single (..) ) + ( Single (..) + ) import Numeric.Natural - ( Natural ) + ( Natural + ) import Safe - ( headMay ) + ( headMay + ) import System.Directory - ( copyFile, doesFileExist, listDirectory, removeFile ) + ( copyFile + , doesFileExist + , listDirectory + , removeFile + ) import System.FilePath - ( () ) + ( () + ) import System.IO - ( IOMode (..), hClose, withFile ) + ( IOMode (..) + , hClose + , withFile + ) import System.IO.Error - ( isUserError ) + ( isUserError + ) import System.IO.Temp - ( emptySystemTempFile ) + ( emptySystemTempFile + ) import System.IO.Unsafe - ( unsafePerformIO ) + ( unsafePerformIO + ) import System.Random - ( randomRIO ) + ( randomRIO + ) import Test.Hspec ( Expectation , Spec @@ -237,25 +343,49 @@ import Test.Hspec , shouldThrow ) import Test.QuickCheck - ( Property, generate, property, (==>) ) + ( Property + , generate + , property + , (==>) + ) import Test.QuickCheck.Monadic - ( monadicIO ) + ( monadicIO + ) import Test.Utils.Paths - ( getTestData ) + ( getTestData + ) import Test.Utils.Trace - ( captureLogging ) + ( captureLogging + ) import UnliftIO.Async - ( concurrently, concurrently_ ) + ( concurrently + , concurrently_ + ) import UnliftIO.Concurrent - ( forkIO, killThread, threadDelay ) + ( forkIO + , killThread + , threadDelay + ) import UnliftIO.Exception - ( SomeException, handle, throwIO ) + ( SomeException + , handle + , throwIO + ) import UnliftIO.MVar - ( isEmptyMVar, newEmptyMVar, putMVar, takeMVar ) + ( isEmptyMVar + , newEmptyMVar + , putMVar + , takeMVar + ) import UnliftIO.STM - ( newTVarIO, readTVarIO, writeTVar ) + ( newTVarIO + , readTVarIO + , writeTVar + ) import UnliftIO.Temporary - ( withSystemTempDirectory, withSystemTempFile ) + ( withSystemTempDirectory + , withSystemTempFile + ) import qualified Cardano.Wallet.Address.Derivation.Shelley as Seq import qualified Cardano.Wallet.Checkpoints as Checkpoints diff --git a/lib/wallet/test/unit/Cardano/Wallet/DB/MigrationSpec.hs b/lib/wallet/test/unit/Cardano/Wallet/DB/MigrationSpec.hs index 3acfffcc5a8..131a2c31124 100644 --- a/lib/wallet/test/unit/Cardano/Wallet/DB/MigrationSpec.hs +++ b/lib/wallet/test/unit/Cardano/Wallet/DB/MigrationSpec.hs @@ -9,7 +9,8 @@ module Cardano.Wallet.DB.MigrationSpec where import Prelude hiding - ( (.) ) + ( (.) + ) import Cardano.Wallet.DB.Migration ( ErrWrongVersion (ErrWrongVersion) @@ -20,23 +21,42 @@ import Cardano.Wallet.DB.Migration , runMigrations ) import Control.Category - ( (.) ) + ( (.) + ) import Control.Monad.Class.MonadThrow - ( MonadThrow (..), SomeException, toException ) + ( MonadThrow (..) + , SomeException + , toException + ) import Control.Monad.Trans.Class - ( lift ) + ( lift + ) import Control.Monad.Trans.Except - ( ExceptT (..), runExceptT ) + ( ExceptT (..) + , runExceptT + ) import Control.Monad.Trans.Reader - ( ReaderT ) + ( ReaderT + ) import Control.Monad.Trans.State - ( State, get, modify, runState ) + ( State + , get + , modify + , runState + ) import GHC.Natural - ( Natural ) + ( Natural + ) import GHC.TypeNats - ( KnownNat ) + ( KnownNat + ) import Test.Hspec - ( Spec, describe, it, shouldReturn, shouldThrow ) + ( Spec + , describe + , it + , shouldReturn + , shouldThrow + ) data Database = Database { version :: Version diff --git a/lib/wallet/test/unit/Cardano/Wallet/DB/Properties.hs b/lib/wallet/test/unit/Cardano/Wallet/DB/Properties.hs index 750bf149475..511062392e8 100644 --- a/lib/wallet/test/unit/Cardano/Wallet/DB/Properties.hs +++ b/lib/wallet/test/unit/Cardano/Wallet/DB/Properties.hs @@ -32,11 +32,16 @@ import Cardano.Wallet.DB , ErrWalletNotInitialized ) import Cardano.Wallet.DB.Arbitrary - ( GenState, GenTxHistory (..), InitialCheckpoint (..) ) + ( GenState + , GenTxHistory (..) + , InitialCheckpoint (..) + ) import Cardano.Wallet.DB.Pure.Implementation - ( filterTxHistory ) + ( filterTxHistory + ) import Cardano.Wallet.DummyTarget.Primitive.Types - ( dummyGenesisParameters ) + ( dummyGenesisParameters + ) import Cardano.Wallet.Primitive.Types ( ChainPoint (..) , GenesisParameters @@ -48,43 +53,69 @@ import Cardano.Wallet.Primitive.Types , wholeRange ) import Cardano.Wallet.Primitive.Types.Hash - ( Hash (..) ) + ( Hash (..) + ) import Cardano.Wallet.Primitive.Types.Tx - ( Tx (..) ) + ( Tx (..) + ) import Cardano.Wallet.Primitive.Types.Tx.TransactionInfo - ( TransactionInfo (..), toTxHistory ) + ( TransactionInfo (..) + , toTxHistory + ) import Cardano.Wallet.Primitive.Types.Tx.TxMeta - ( TxMeta (slotNo) ) + ( TxMeta (slotNo) + ) import Cardano.Wallet.Unsafe - ( unsafeRunExceptT ) + ( unsafeRunExceptT + ) import Cardano.Wallet.Util - ( ShowFmt (..) ) + ( ShowFmt (..) + ) import Control.Monad - ( forM_, void ) + ( forM_ + , void + ) import Control.Monad.IO.Class - ( liftIO ) + ( liftIO + ) import Control.Monad.Trans - ( lift ) + ( lift + ) import Control.Monad.Trans.Except - ( ExceptT, runExceptT ) + ( ExceptT + , runExceptT + ) import Crypto.Hash - ( hash ) + ( hash + ) import Data.ByteString - ( ByteString ) + ( ByteString + ) import Data.Foldable - ( fold ) + ( fold + ) import Data.Functor.Identity - ( Identity (..) ) + ( Identity (..) + ) import Data.Generics.Internal.VL.Lens - ( (^.) ) + ( (^.) + ) import Data.Generics.Labels () import Data.Maybe - ( isNothing, mapMaybe ) + ( isNothing + , mapMaybe + ) import Fmt - ( Buildable, pretty ) + ( Buildable + , pretty + ) import Test.Hspec - ( SpecWith, describe, it, shouldReturn ) + ( SpecWith + , describe + , it + , shouldReturn + ) import Test.QuickCheck ( Arbitrary (..) , Gen @@ -96,7 +127,13 @@ import Test.QuickCheck , property ) import Test.QuickCheck.Monadic - ( PropertyM, assert, monadicIO, monitor, pick, run ) + ( PropertyM + , assert + , monadicIO + , monitor + , pick + , run + ) import qualified Data.List as L diff --git a/lib/wallet/test/unit/Cardano/Wallet/DB/Pure/ImplementationSpec.hs b/lib/wallet/test/unit/Cardano/Wallet/DB/Pure/ImplementationSpec.hs index 8a8c74c2fdb..f67a4333a75 100644 --- a/lib/wallet/test/unit/Cardano/Wallet/DB/Pure/ImplementationSpec.hs +++ b/lib/wallet/test/unit/Cardano/Wallet/DB/Pure/ImplementationSpec.hs @@ -16,29 +16,43 @@ module Cardano.Wallet.DB.Pure.ImplementationSpec import Prelude import Cardano.Wallet.Address.Derivation.Shelley - ( ShelleyKey ) + ( ShelleyKey + ) import Cardano.Wallet.Address.Discovery - ( IsOurs (..) ) + ( IsOurs (..) + ) import Cardano.Wallet.Address.Discovery.Sequential - ( SeqState (..) ) + ( SeqState (..) + ) import Cardano.Wallet.DB.Properties - ( properties ) + ( properties + ) import Cardano.Wallet.DummyTarget.Primitive.Types - ( dummyTimeInterpreter ) + ( dummyTimeInterpreter + ) import Cardano.Wallet.Primitive.NetworkId - ( NetworkDiscriminant (..) ) + ( NetworkDiscriminant (..) + ) import Cardano.Wallet.Primitive.Types.Address - ( Address ) + ( Address + ) import Control.DeepSeq - ( NFData ) + ( NFData + ) import Control.Monad.IO.Class - ( liftIO ) + ( liftIO + ) import Test.Hspec - ( Spec, before, describe ) + ( Spec + , before + , describe + ) import Test.QuickCheck - ( Arbitrary (..) ) + ( Arbitrary (..) + ) import Test.Utils.Platform - ( pendingOnMacOS ) + ( pendingOnMacOS + ) import qualified Cardano.Wallet.DB.Pure.Layer as PureLayer diff --git a/lib/wallet/test/unit/Cardano/Wallet/DB/Sqlite/Migration/NewSpec.hs b/lib/wallet/test/unit/Cardano/Wallet/DB/Sqlite/Migration/NewSpec.hs index 5f40222dfb4..9d4c9421f57 100644 --- a/lib/wallet/test/unit/Cardano/Wallet/DB/Sqlite/Migration/NewSpec.hs +++ b/lib/wallet/test/unit/Cardano/Wallet/DB/Sqlite/Migration/NewSpec.hs @@ -10,27 +10,42 @@ module Cardano.Wallet.DB.Sqlite.Migration.NewSpec ) where import Cardano.DB.Sqlite - ( DBHandle (dbBackend) ) + ( DBHandle (dbBackend) + ) import Cardano.Wallet.DB.Migration - ( MigrationInterface (..), Version (..) ) + ( MigrationInterface (..) + , Version (..) + ) import Cardano.Wallet.DB.Sqlite.Migration.New - ( newMigrationInterface ) + ( newMigrationInterface + ) import Control.Tracer - ( nullTracer ) + ( nullTracer + ) import Data.List - ( sort ) + ( sort + ) import Data.Text - ( Text ) + ( Text + ) import Prelude hiding - ( (.) ) + ( (.) + ) import System.Directory - ( listDirectory ) + ( listDirectory + ) import System.IO.Temp - ( withSystemTempDirectory ) + ( withSystemTempDirectory + ) import Test.Hspec - ( Spec, describe, it, shouldReturn ) + ( Spec + , describe + , it + , shouldReturn + ) import UnliftIO - ( MonadUnliftIO ) + ( MonadUnliftIO + ) import qualified Database.Persist.Sqlite as Sqlite diff --git a/lib/wallet/test/unit/Cardano/Wallet/DB/Sqlite/TypesSpec.hs b/lib/wallet/test/unit/Cardano/Wallet/DB/Sqlite/TypesSpec.hs index 4df53df26aa..4fc0163a457 100644 --- a/lib/wallet/test/unit/Cardano/Wallet/DB/Sqlite/TypesSpec.hs +++ b/lib/wallet/test/unit/Cardano/Wallet/DB/Sqlite/TypesSpec.hs @@ -12,43 +12,76 @@ module Cardano.Wallet.DB.Sqlite.TypesSpec import Prelude import Cardano.Wallet.DB.Sqlite.Types - ( stdGenFromString ) + ( stdGenFromString + ) import Cardano.Wallet.Gen - ( genSlotNo, shrinkSlotNo ) + ( genSlotNo + , shrinkSlotNo + ) import Cardano.Wallet.Primitive.Types - ( EpochNo (..), SlotInEpoch (..), SlotNo ) + ( EpochNo (..) + , SlotInEpoch (..) + , SlotNo + ) import Cardano.Wallet.Primitive.Types.TokenQuantity - ( TokenQuantity (..) ) + ( TokenQuantity (..) + ) import Cardano.Wallet.Primitive.Types.TokenQuantity.Gen - ( genTokenQuantityFullRange, shrinkTokenQuantityFullRange ) + ( genTokenQuantityFullRange + , shrinkTokenQuantityFullRange + ) import Cardano.Wallet.Primitive.Types.Tx - ( TxMetadata, TxScriptValidity ) + ( TxMetadata + , TxScriptValidity + ) import Cardano.Wallet.Primitive.Types.Tx.Gen - ( genTxScriptValidity, shrinkTxScriptValidity ) + ( genTxScriptValidity + , shrinkTxScriptValidity + ) import Cardano.Wallet.Primitive.Types.Tx.Metadata.Gen - ( genNestedTxMetadata, genSimpleTxMetadata, shrinkTxMetadata ) + ( genNestedTxMetadata + , genSimpleTxMetadata + , shrinkTxMetadata + ) import Data.Either - ( isLeft ) + ( isLeft + ) import Data.Proxy - ( Proxy (..) ) + ( Proxy (..) + ) import Data.Time.Clock.POSIX - ( POSIXTime ) + ( POSIXTime + ) import Data.Typeable - ( Typeable, typeRep ) + ( Typeable + , typeRep + ) import Data.Word - ( Word64 ) + ( Word64 + ) import Data.Word.Odd - ( Word31 ) + ( Word31 + ) import Database.Persist.Class - ( PersistField (..) ) + ( PersistField (..) + ) import System.Random - ( StdGen, mkStdGen ) + ( StdGen + , mkStdGen + ) import System.Random.Internal - ( StdGen (..) ) + ( StdGen (..) + ) import System.Random.SplitMix - ( seedSMGen ) + ( seedSMGen + ) import Test.Hspec - ( Spec, describe, it, shouldBe, shouldSatisfy ) + ( Spec + , describe + , it + , shouldBe + , shouldSatisfy + ) import Test.QuickCheck ( Arbitrary (..) , NonNegative (..) diff --git a/lib/wallet/test/unit/Cardano/Wallet/DB/StateMachine.hs b/lib/wallet/test/unit/Cardano/Wallet/DB/StateMachine.hs index bb5ea04d7d2..796367a7507 100644 --- a/lib/wallet/test/unit/Cardano/Wallet/DB/StateMachine.hs +++ b/lib/wallet/test/unit/Cardano/Wallet/DB/StateMachine.hs @@ -52,25 +52,40 @@ module Cardano.Wallet.DB.StateMachine import Prelude import Cardano.Address.Script - ( ScriptTemplate (..) ) + ( ScriptTemplate (..) + ) import Cardano.Pool.Types - ( PoolId (..) ) + ( PoolId (..) + ) import Cardano.Wallet.Address.Book - ( AddressBookIso ) + ( AddressBookIso + ) import Cardano.Wallet.Address.Derivation - ( Depth (..), DerivationPrefix, Index, KeyFingerprint, Role (..) ) + ( Depth (..) + , DerivationPrefix + , Index + , KeyFingerprint + , Role (..) + ) import Cardano.Wallet.Address.Derivation.Shared () import Cardano.Wallet.Address.Derivation.SharedKey - ( SharedKey ) + ( SharedKey + ) import Cardano.Wallet.Address.Derivation.Shelley - ( ShelleyKey ) + ( ShelleyKey + ) import Cardano.Wallet.Address.Discovery - ( IsOurs, PendingIxs ) + ( IsOurs + , PendingIxs + ) import Cardano.Wallet.Address.Discovery.Random - ( RndState ) + ( RndState + ) import Cardano.Wallet.Address.Discovery.Sequential - ( AddressPoolGap, SeqState (..) ) + ( AddressPoolGap + , SeqState (..) + ) import Cardano.Wallet.Address.Discovery.Shared ( Readiness , SharedAddressPool (..) @@ -78,9 +93,14 @@ import Cardano.Wallet.Address.Discovery.Shared , SharedState (..) ) import Cardano.Wallet.DB - ( DBLayer (..), DBLayerParams (..) ) + ( DBLayer (..) + , DBLayerParams (..) + ) import Cardano.Wallet.DB.Arbitrary - ( GenState, GenTxHistory (..), InitialCheckpoint (..) ) + ( GenState + , GenTxHistory (..) + , InitialCheckpoint (..) + ) import Cardano.Wallet.DB.Pure.Implementation ( Database (..) , Err (..) @@ -95,11 +115,15 @@ import Cardano.Wallet.DB.Pure.Implementation , mRollbackTo ) import Cardano.Wallet.DummyTarget.Primitive.Types - ( dummyGenesisParameters, dummyTimeInterpreter ) + ( dummyGenesisParameters + , dummyTimeInterpreter + ) import Cardano.Wallet.Primitive.Model - ( Wallet ) + ( Wallet + ) import Cardano.Wallet.Primitive.NetworkId - ( NetworkDiscriminant (..) ) + ( NetworkDiscriminant (..) + ) import Cardano.Wallet.Primitive.Types ( BlockHeader (..) , ChainPoint @@ -120,21 +144,31 @@ import Cardano.Wallet.Primitive.Types , WalletMetadata (..) ) import Cardano.Wallet.Primitive.Types.Address - ( Address, AddressState ) + ( Address + , AddressState + ) import Cardano.Wallet.Primitive.Types.Coin - ( Coin (..) ) + ( Coin (..) + ) import Cardano.Wallet.Primitive.Types.Hash - ( Hash (..) ) + ( Hash (..) + ) import Cardano.Wallet.Primitive.Types.RewardAccount - ( RewardAccount (..) ) + ( RewardAccount (..) + ) import Cardano.Wallet.Primitive.Types.TokenBundle - ( TokenBundle ) + ( TokenBundle + ) import Cardano.Wallet.Primitive.Types.TokenMap - ( TokenMap ) + ( TokenMap + ) import Cardano.Wallet.Primitive.Types.TokenPolicy - ( TokenName, TokenPolicyId ) + ( TokenName + , TokenPolicyId + ) import Cardano.Wallet.Primitive.Types.TokenQuantity - ( TokenQuantity ) + ( TokenQuantity + ) import Cardano.Wallet.Primitive.Types.Tx ( LocalTxSubmissionStatus (..) , SealedTx @@ -145,61 +179,110 @@ import Cardano.Wallet.Primitive.Types.Tx , outputs ) import Cardano.Wallet.Primitive.Types.Tx.Constraints - ( TxSize (..) ) + ( TxSize (..) + ) import Cardano.Wallet.Primitive.Types.Tx.TransactionInfo - ( TransactionInfo ) + ( TransactionInfo + ) import Cardano.Wallet.Primitive.Types.Tx.TxIn - ( TxIn (..) ) + ( TxIn (..) + ) import Cardano.Wallet.Primitive.Types.Tx.TxMeta - ( Direction, TxMeta, TxStatus ) + ( Direction + , TxMeta + , TxStatus + ) import Cardano.Wallet.Primitive.Types.Tx.TxOut - ( TxOut (..) ) + ( TxOut (..) + ) import Cardano.Wallet.Primitive.Types.UTxO - ( UTxO (..) ) + ( UTxO (..) + ) import Cardano.Wallet.Read.Eras.EraValue - ( eraValueSerialize ) + ( eraValueSerialize + ) import Cardano.Wallet.Read.Tx.CBOR - ( TxCBOR ) + ( TxCBOR + ) import Control.DeepSeq - ( NFData ) + ( NFData + ) import Control.Foldl - ( Fold (..) ) + ( Fold (..) + ) import Control.Monad - ( forM_, replicateM, void, when ) + ( forM_ + , replicateM + , void + , when + ) import Control.Monad.IO.Unlift - ( MonadIO ) + ( MonadIO + ) import Crypto.Hash - ( Blake2b_160, Digest, digestFromByteString, hash ) + ( Blake2b_160 + , Digest + , digestFromByteString + , hash + ) import Data.Bifunctor - ( first ) + ( first + ) import Data.Foldable - ( foldl', toList ) + ( foldl' + , toList + ) import Data.Functor.Classes - ( Eq1, Show1 ) + ( Eq1 + , Show1 + ) import Data.Generics.Internal.VL - ( build ) + ( build + ) import Data.List.Extra - ( enumerate ) + ( enumerate + ) import Data.Map - ( Map ) + ( Map + ) import Data.Maybe - ( catMaybes, fromJust ) + ( catMaybes + , fromJust + ) import Data.Quantity - ( Percentage (..), Quantity (..) ) + ( Percentage (..) + , Quantity (..) + ) import Data.Set - ( Set ) + ( Set + ) import Data.Time.Clock - ( NominalDiffTime, diffUTCTime, getCurrentTime ) + ( NominalDiffTime + , diffUTCTime + , getCurrentTime + ) import Data.TreeDiff - ( ToExpr (..), defaultExprViaShow, genericToExpr ) + ( ToExpr (..) + , defaultExprViaShow + , genericToExpr + ) import Fmt - ( Buildable ) + ( Buildable + ) import GHC.Generics - ( Generic, Generic1 ) + ( Generic + , Generic1 + ) import GHC.Stack - ( HasCallStack, callStack ) + ( HasCallStack + , callStack + ) import Test.Hspec - ( SpecWith, describe, expectationFailure, it ) + ( SpecWith + , describe + , expectationFailure + , it + ) import Test.QuickCheck ( Arbitrary (..) , Gen @@ -212,7 +295,9 @@ import Test.QuickCheck , (===) ) import Test.QuickCheck.Monadic - ( monadicIO, run ) + ( monadicIO + , run + ) import Test.StateMachine ( CommandNames (..) , Concrete @@ -230,13 +315,17 @@ import Test.StateMachine , (.==) ) import Test.StateMachine.Types - ( Commands (..) ) + ( Commands (..) + ) import UnliftIO.Async - ( race_ ) + ( race_ + ) import UnliftIO.Concurrent - ( threadDelay ) + ( threadDelay + ) import UnliftIO.Exception - ( evaluate ) + ( evaluate + ) import qualified Cardano.Crypto.Wallet as CC import qualified Cardano.Wallet.Address.Pool as AddressPool diff --git a/lib/wallet/test/unit/Cardano/Wallet/DB/Store/Checkpoints/StoreSpec.hs b/lib/wallet/test/unit/Cardano/Wallet/DB/Store/Checkpoints/StoreSpec.hs index 1aae3b133fa..e83c80e0dfe 100644 --- a/lib/wallet/test/unit/Cardano/Wallet/DB/Store/Checkpoints/StoreSpec.hs +++ b/lib/wallet/test/unit/Cardano/Wallet/DB/Store/Checkpoints/StoreSpec.hs @@ -11,35 +11,64 @@ module Cardano.Wallet.DB.Store.Checkpoints.StoreSpec import Prelude import Cardano.DB.Sqlite - ( ForeignKeysSetting (..), SqliteContext, runQuery ) + ( ForeignKeysSetting (..) + , SqliteContext + , runQuery + ) import Cardano.Wallet.Address.Book - ( AddressBookIso (..), Prologue, getPrologue ) + ( AddressBookIso (..) + , Prologue + , getPrologue + ) import Cardano.Wallet.Address.Derivation.Shared - ( SharedKey ) + ( SharedKey + ) import Cardano.Wallet.Address.Derivation.Shelley - ( ShelleyKey ) + ( ShelleyKey + ) import Cardano.Wallet.Address.Discovery.Random - ( RndState ) + ( RndState + ) import Cardano.Wallet.Address.Discovery.Sequential - ( SeqState ) + ( SeqState + ) import Cardano.Wallet.Address.Discovery.Shared - ( Readiness (Pending), SharedState (..) ) + ( Readiness (Pending) + , SharedState (..) + ) import Cardano.Wallet.Checkpoints - ( Checkpoints, DeltaCheckpoints (..), checkpoints, getLatest ) + ( Checkpoints + , DeltaCheckpoints (..) + , checkpoints + , getLatest + ) import Cardano.Wallet.DB.Arbitrary () import Cardano.Wallet.DB.Fixtures - ( initializeWalletTable, withDBInMemory ) + ( initializeWalletTable + , withDBInMemory + ) import Cardano.Wallet.DB.Store.Checkpoints.Store - ( PersistAddressBook (..) ) + ( PersistAddressBook (..) + ) import Cardano.Wallet.Primitive.NetworkId - ( NetworkDiscriminant (..) ) + ( NetworkDiscriminant (..) + ) import Cardano.Wallet.Primitive.Types - ( SlotNo (..), WalletId, WithOrigin (..) ) + ( SlotNo (..) + , WalletId + , WithOrigin (..) + ) import Fmt - ( Buildable (..), pretty ) + ( Buildable (..) + , pretty + ) import Test.Hspec - ( Spec, around, describe, it ) + ( Spec + , around + , describe + , it + ) import Test.QuickCheck ( Gen , Property @@ -51,7 +80,12 @@ import Test.QuickCheck , vectorOf ) import Test.QuickCheck.Monadic - ( PropertyM, assert, monadicIO, monitor, run ) + ( PropertyM + , assert + , monadicIO + , monitor + , run + ) import qualified Data.Map.Strict as Map diff --git a/lib/wallet/test/unit/Cardano/Wallet/DB/Store/Delegations/MigrationSpec.hs b/lib/wallet/test/unit/Cardano/Wallet/DB/Store/Delegations/MigrationSpec.hs index 2132e0b19c7..b4def4dafd9 100644 --- a/lib/wallet/test/unit/Cardano/Wallet/DB/Store/Delegations/MigrationSpec.hs +++ b/lib/wallet/test/unit/Cardano/Wallet/DB/Store/Delegations/MigrationSpec.hs @@ -6,23 +6,35 @@ module Cardano.Wallet.DB.Store.Delegations.MigrationSpec where import Prelude import Cardano.Wallet.DB.LayerSpec - ( withinCopiedFile ) + ( withinCopiedFile + ) import Cardano.Wallet.DB.Migration - ( runMigrations ) + ( runMigrations + ) import Cardano.Wallet.DB.Sqlite.Migration.New - ( newMigrationInterface ) + ( newMigrationInterface + ) import Cardano.Wallet.DB.Store.Delegations.Migration - ( migrateDelegations ) + ( migrateDelegations + ) import Control.Tracer - ( nullTracer ) + ( nullTracer + ) import Data.String.Interpolate - ( i ) + ( i + ) import Data.Text - ( Text ) + ( Text + ) import Database.Persist.Sql - ( Single (Single) ) + ( Single (Single) + ) import Test.Hspec - ( Spec, describe, it, shouldBe ) + ( Spec + , describe + , it + , shouldBe + ) import qualified Data.Text as T import qualified Database.Persist.Sqlite as Sqlite diff --git a/lib/wallet/test/unit/Cardano/Wallet/DB/Store/Delegations/StoreSpec.hs b/lib/wallet/test/unit/Cardano/Wallet/DB/Store/Delegations/StoreSpec.hs index 532a9c1b73f..0d378977fdb 100644 --- a/lib/wallet/test/unit/Cardano/Wallet/DB/Store/Delegations/StoreSpec.hs +++ b/lib/wallet/test/unit/Cardano/Wallet/DB/Store/Delegations/StoreSpec.hs @@ -17,29 +17,50 @@ where import Prelude import Cardano.DB.Sqlite - ( ForeignKeysSetting (..), runQuery ) + ( ForeignKeysSetting (..) + , runQuery + ) import Cardano.Pool.Types - ( PoolId (..) ) + ( PoolId (..) + ) import Cardano.Slotting.Slot - ( SlotNo (..) ) + ( SlotNo (..) + ) import Cardano.Wallet.DB.Arbitrary () import Cardano.Wallet.DB.Fixtures - ( WalletProperty, logScale, withDBInMemory, withInitializedWalletProp ) + ( WalletProperty + , logScale + , withDBInMemory + , withInitializedWalletProp + ) import Cardano.Wallet.DB.Store.Delegations.Store - ( mkStoreDelegations ) + ( mkStoreDelegations + ) import Cardano.Wallet.Delegation.Model - ( Operation (..), Status (..), status ) + ( Operation (..) + , Status (..) + , status + ) import Cardano.Wallet.Delegation.ModelSpec - ( Config (..), genDelta ) + ( Config (..) + , genDelta + ) import Control.Monad.IO.Class - ( liftIO ) + ( liftIO + ) import Data.List - ( nub ) + ( nub + ) import Fmt - ( Buildable (..) ) + ( Buildable (..) + ) import Test.Hspec - ( Spec, around, describe, it ) + ( Spec + , around + , describe + , it + ) import Test.QuickCheck ( Arbitrary (..) , choose diff --git a/lib/wallet/test/unit/Cardano/Wallet/DB/Store/Info/StoreSpec.hs b/lib/wallet/test/unit/Cardano/Wallet/DB/Store/Info/StoreSpec.hs index 87451a4f419..8ef14388af7 100644 --- a/lib/wallet/test/unit/Cardano/Wallet/DB/Store/Info/StoreSpec.hs +++ b/lib/wallet/test/unit/Cardano/Wallet/DB/Store/Info/StoreSpec.hs @@ -3,21 +3,38 @@ module Cardano.Wallet.DB.Store.Info.StoreSpec (spec) where import Prelude import Cardano.DB.Sqlite - ( ForeignKeysSetting (..), runQuery ) + ( ForeignKeysSetting (..) + , runQuery + ) import Cardano.Wallet.DB.Arbitrary () import Cardano.Wallet.DB.Fixtures - ( WalletProperty, logScale, withDBInMemory ) + ( WalletProperty + , logScale + , withDBInMemory + ) import Cardano.Wallet.DB.Store.Info.Store - ( DeltaWalletInfo (..), WalletInfo (..), mkStoreInfo ) + ( DeltaWalletInfo (..) + , WalletInfo (..) + , mkStoreInfo + ) import Cardano.Wallet.DummyTarget.Primitive.Types - ( dummyGenesisParameters ) + ( dummyGenesisParameters + ) import Test.Hspec - ( Spec, around, describe, it ) + ( Spec + , around + , describe + , it + ) import Test.QuickCheck - ( Arbitrary (..), Gen, property ) + ( Arbitrary (..) + , Gen + , property + ) import Test.Store - ( prop_StoreUpdate ) + ( prop_StoreUpdate + ) spec :: Spec spec = do diff --git a/lib/wallet/test/unit/Cardano/Wallet/DB/Store/Meta/ModelSpec.hs b/lib/wallet/test/unit/Cardano/Wallet/DB/Store/Meta/ModelSpec.hs index 64911b58533..74c9e5814f8 100644 --- a/lib/wallet/test/unit/Cardano/Wallet/DB/Store/Meta/ModelSpec.hs +++ b/lib/wallet/test/unit/Cardano/Wallet/DB/Store/Meta/ModelSpec.hs @@ -15,35 +15,60 @@ import Prelude import Cardano.Wallet.DB.Arbitrary () import Cardano.Wallet.DB.Fixtures - ( elementsOrArbitrary, logScale ) + ( elementsOrArbitrary + , logScale + ) import Cardano.Wallet.DB.Sqlite.Schema - ( TxMeta (..) ) + ( TxMeta (..) + ) import Cardano.Wallet.DB.Sqlite.Types - ( TxId ) + ( TxId + ) import Cardano.Wallet.DB.Store.Meta.Model - ( DeltaTxMetaHistory (..), TxMetaHistory (..), mkTxMetaHistory ) + ( DeltaTxMetaHistory (..) + , TxMetaHistory (..) + , mkTxMetaHistory + ) import Cardano.Wallet.Primitive.Types - ( WalletId ) + ( WalletId + ) import Cardano.Wallet.Primitive.Types.Tx.TxMeta - ( Direction (Incoming, Outgoing) ) + ( Direction (Incoming, Outgoing) + ) import Control.Arrow - ( (***) ) + ( (***) + ) import Data.Delta - ( Delta (..) ) + ( Delta (..) + ) import Data.Foldable - ( toList ) + ( toList + ) import Data.Map.Strict - ( Map ) + ( Map + ) import Data.Set - ( Set ) + ( Set + ) import Test.Hspec - ( Spec, describe, it ) + ( Spec + , describe + , it + ) import Test.QuickCheck - ( Gen, Property, arbitrary, cover, elements, listOf1, property ) + ( Gen + , Property + , arbitrary + , cover + , elements + , listOf1 + , property + ) import qualified Cardano.Wallet.Primitive.Types as W import qualified Cardano.Wallet.Primitive.Types.Tx.Tx as W - ( Tx ) + ( Tx + ) import qualified Cardano.Wallet.Primitive.Types.Tx.TxMeta as W import qualified Data.Map.Strict as Map import qualified Data.Set as Set diff --git a/lib/wallet/test/unit/Cardano/Wallet/DB/Store/Meta/StoreSpec.hs b/lib/wallet/test/unit/Cardano/Wallet/DB/Store/Meta/StoreSpec.hs index 6acc711b388..9e8c0f4b125 100644 --- a/lib/wallet/test/unit/Cardano/Wallet/DB/Store/Meta/StoreSpec.hs +++ b/lib/wallet/test/unit/Cardano/Wallet/DB/Store/Meta/StoreSpec.hs @@ -10,9 +10,12 @@ where import Prelude import Cardano.DB.Sqlite - ( ForeignKeysSetting (..), runQuery ) + ( ForeignKeysSetting (..) + , runQuery + ) import Cardano.Slotting.Slot - ( SlotNo ) + ( SlotNo + ) import Cardano.Wallet.DB.Arbitrary () import Cardano.Wallet.DB.Fixtures @@ -25,35 +28,64 @@ import Cardano.Wallet.DB.Fixtures , withInitializedWalletProp ) import Cardano.Wallet.DB.Sqlite.Schema - ( TxMeta (..) ) + ( TxMeta (..) + ) import Cardano.Wallet.DB.Sqlite.Types - ( TxId (TxId) ) + ( TxId (TxId) + ) import Cardano.Wallet.DB.Store.Meta.Layer - ( QueryTxMeta (..), mkQueryStoreTxMeta ) + ( QueryTxMeta (..) + , mkQueryStoreTxMeta + ) import Cardano.Wallet.DB.Store.Meta.Model - ( DeltaTxMetaHistory (..), TxMetaHistory (..) ) + ( DeltaTxMetaHistory (..) + , TxMetaHistory (..) + ) import Cardano.Wallet.DB.Store.Meta.ModelSpec - ( genExpand, genRollback ) + ( genExpand + , genRollback + ) import Cardano.Wallet.DB.Store.Meta.Store - ( mkStoreMetaTransactions ) + ( mkStoreMetaTransactions + ) import Cardano.Wallet.Primitive.Types - ( Range (..), SortOrder (Ascending, Descending), WalletId ) + ( Range (..) + , SortOrder (Ascending, Descending) + , WalletId + ) import Control.Monad - ( forM_, (<=<) ) + ( forM_ + , (<=<) + ) import Data.Foldable - ( toList ) + ( toList + ) import Data.Store - ( Store (..) ) + ( Store (..) + ) import GHC.Natural - ( Natural ) + ( Natural + ) import Test.Hspec - ( Spec, around, describe, it ) + ( Spec + , around + , describe + , it + ) import Test.QuickCheck - ( Gen, arbitrary, elements, frequency, property ) + ( Gen + , arbitrary + , elements + , frequency + , property + ) import Test.QuickCheck.Monadic - ( forAllM, pick ) + ( forAllM + , pick + ) import Test.Store - ( prop_StoreUpdate ) + ( prop_StoreUpdate + ) import qualified Data.Map.Strict as Map diff --git a/lib/wallet/test/unit/Cardano/Wallet/DB/Store/PrivateKey/StoreSpec.hs b/lib/wallet/test/unit/Cardano/Wallet/DB/Store/PrivateKey/StoreSpec.hs index f06e7e48464..8e26cb59b14 100644 --- a/lib/wallet/test/unit/Cardano/Wallet/DB/Store/PrivateKey/StoreSpec.hs +++ b/lib/wallet/test/unit/Cardano/Wallet/DB/Store/PrivateKey/StoreSpec.hs @@ -19,31 +19,54 @@ where import Prelude import Cardano.Address.Derivation - ( XPrv ) + ( XPrv + ) import Cardano.DB.Sqlite - ( ForeignKeysSetting (..), runQuery ) + ( ForeignKeysSetting (..) + , runQuery + ) import Cardano.Wallet.Address.Derivation - ( Depth (RootK) ) + ( Depth (RootK) + ) import Cardano.Wallet.DB.Arbitrary () import Cardano.Wallet.DB.Fixtures - ( WalletProperty, logScale, withDBInMemory ) + ( WalletProperty + , logScale + , withDBInMemory + ) import Cardano.Wallet.DB.Store.PrivateKey.Store - ( DeltaPrivateKey, mkStorePrivateKey ) + ( DeltaPrivateKey + , mkStorePrivateKey + ) import Cardano.Wallet.Flavor - ( KeyFlavorS (..) ) + ( KeyFlavorS (..) + ) import Cardano.Wallet.Primitive.Types.Credentials - ( HashedCredentials, RootCredentials (RootCredentials) ) + ( HashedCredentials + , RootCredentials (RootCredentials) + ) import Data.Delta - ( Replace (..) ) + ( Replace (..) + ) import Fmt - ( Buildable (..) ) + ( Buildable (..) + ) import Test.Hspec - ( Spec, around, describe, it ) + ( Spec + , around + , describe + , it + ) import Test.QuickCheck - ( Arbitrary, Gen, arbitrary, property ) + ( Arbitrary + , Gen + , arbitrary + , property + ) import Test.Store - ( prop_StoreUpdate ) + ( prop_StoreUpdate + ) spec :: Spec spec = diff --git a/lib/wallet/test/unit/Cardano/Wallet/DB/Store/Rewards/StoreSpec.hs b/lib/wallet/test/unit/Cardano/Wallet/DB/Store/Rewards/StoreSpec.hs index 1b6f4296e67..0b71e6b3d3a 100644 --- a/lib/wallet/test/unit/Cardano/Wallet/DB/Store/Rewards/StoreSpec.hs +++ b/lib/wallet/test/unit/Cardano/Wallet/DB/Store/Rewards/StoreSpec.hs @@ -16,21 +16,37 @@ module Cardano.Wallet.DB.Store.Rewards.StoreSpec ( import Prelude import Cardano.DB.Sqlite - ( ForeignKeysSetting (..), SqliteContext, runQuery ) + ( ForeignKeysSetting (..) + , SqliteContext + , runQuery + ) import Cardano.Wallet.DB.Arbitrary () import Cardano.Wallet.DB.Fixtures - ( logScale, withDBInMemory ) + ( logScale + , withDBInMemory + ) import Cardano.Wallet.DB.Store.Rewards.Store - ( mkStoreRewards ) + ( mkStoreRewards + ) import Data.Delta - ( Replace (..) ) + ( Replace (..) + ) import Test.Hspec - ( Spec, around, describe, it ) + ( Spec + , around + , describe + , it + ) import Test.QuickCheck - ( Gen, Property, arbitrary, property ) + ( Gen + , Property + , arbitrary + , property + ) import Test.Store - ( prop_StoreUpdate ) + ( prop_StoreUpdate + ) import qualified Cardano.Wallet.Primitive.Types as W import qualified Cardano.Wallet.Primitive.Types.Coin as W diff --git a/lib/wallet/test/unit/Cardano/Wallet/DB/Store/Submissions/StoreSpec.hs b/lib/wallet/test/unit/Cardano/Wallet/DB/Store/Submissions/StoreSpec.hs index b0bbd805987..3d0d75898df 100644 --- a/lib/wallet/test/unit/Cardano/Wallet/DB/Store/Submissions/StoreSpec.hs +++ b/lib/wallet/test/unit/Cardano/Wallet/DB/Store/Submissions/StoreSpec.hs @@ -10,39 +10,65 @@ module Cardano.Wallet.DB.Store.Submissions.StoreSpec ( spec ) where import Prelude import Cardano.DB.Sqlite - ( ForeignKeysSetting (..), runQuery ) + ( ForeignKeysSetting (..) + , runQuery + ) import Cardano.Wallet.DB.Arbitrary () import Cardano.Wallet.DB.Fixtures - ( WalletProperty, initializeWalletTable, logScale, withDBInMemory ) + ( WalletProperty + , initializeWalletTable + , logScale + , withDBInMemory + ) import Cardano.Wallet.DB.Sqlite.Types - ( TxId (..) ) + ( TxId (..) + ) import Cardano.Wallet.DB.Store.Submissions.Operations - ( SubmissionMeta (..), mkStoreSubmissions ) + ( SubmissionMeta (..) + , mkStoreSubmissions + ) import Cardano.Wallet.Primitive.Types - ( SlotNo (..) ) + ( SlotNo (..) + ) import Cardano.Wallet.Primitive.Types.Coin - ( Coin (Coin) ) + ( Coin (Coin) + ) import Cardano.Wallet.Primitive.Types.Tx - ( SealedTx (..), mockSealedTx ) + ( SealedTx (..) + , mockSealedTx + ) import Cardano.Wallet.Primitive.Types.Tx.TxMeta - ( Direction (Outgoing) ) + ( Direction (Outgoing) + ) import Cardano.Wallet.Submissions.OperationsSpec - ( genOperationsDelta ) + ( genOperationsDelta + ) import Cardano.Wallet.Submissions.Submissions - ( Submissions (..) ) + ( Submissions (..) + ) import Control.Monad - ( replicateM ) + ( replicateM + ) import Data.Quantity - ( Quantity (..) ) + ( Quantity (..) + ) import System.Random - ( Random ) + ( Random + ) import Test.Hspec - ( Spec, around, describe, it ) + ( Spec + , around + , describe + , it + ) import Test.QuickCheck - ( Arbitrary (..), property ) + ( Arbitrary (..) + , property + ) import Test.Store - ( prop_StoreUpdate ) + ( prop_StoreUpdate + ) import qualified Data.ByteString as BS diff --git a/lib/wallet/test/unit/Cardano/Wallet/DB/Store/Transactions/StoreSpec.hs b/lib/wallet/test/unit/Cardano/Wallet/DB/Store/Transactions/StoreSpec.hs index 239f010a4c0..cca0d12e604 100644 --- a/lib/wallet/test/unit/Cardano/Wallet/DB/Store/Transactions/StoreSpec.hs +++ b/lib/wallet/test/unit/Cardano/Wallet/DB/Store/Transactions/StoreSpec.hs @@ -18,9 +18,12 @@ module Cardano.Wallet.DB.Store.Transactions.StoreSpec import Prelude import Cardano.DB.Sqlite - ( ForeignKeysSetting (..), runQuery ) + ( ForeignKeysSetting (..) + , runQuery + ) import Cardano.Wallet.DB - ( DBOpen (..) ) + ( DBOpen (..) + ) import Cardano.Wallet.DB.Arbitrary () import Cardano.Wallet.DB.Fixtures @@ -32,9 +35,12 @@ import Cardano.Wallet.DB.Fixtures , withStoreProp ) import Cardano.Wallet.DB.Layer - ( DefaultFieldValues (..), withDBOpenFromFile ) + ( DefaultFieldValues (..) + , withDBOpenFromFile + ) import Cardano.Wallet.DB.Sqlite.Types - ( TxId (TxId) ) + ( TxId (TxId) + ) import Cardano.Wallet.DB.Store.Transactions.Decoration ( DecoratedTxIns , decorateTxInsForRelation @@ -51,43 +57,70 @@ import Cardano.Wallet.DB.Store.Transactions.Model , mkTxSet ) import Cardano.Wallet.DB.Store.Transactions.Store - ( mkStoreTransactions, selectTx ) + ( mkStoreTransactions + , selectTx + ) import Cardano.Wallet.DB.Store.Transactions.TransactionInfo - ( mkTxCBOR ) + ( mkTxCBOR + ) import Cardano.Wallet.Flavor - ( Flavored (..), WalletFlavorS (..) ) + ( Flavored (..) + , WalletFlavorS (..) + ) import Cardano.Wallet.Primitive.Types - ( ActiveSlotCoefficient (..) ) + ( ActiveSlotCoefficient (..) + ) import Cardano.Wallet.Primitive.Types.Coin - ( Coin (..) ) + ( Coin (..) + ) import Cardano.Wallet.Primitive.Types.Tx - ( Tx (..) ) + ( Tx (..) + ) import Cardano.Wallet.Read.Tx.CBOR - ( roundTripTxCBor ) + ( roundTripTxCBor + ) import Control.Monad - ( forM_, (<=<), (>=>) ) + ( forM_ + , (<=<) + , (>=>) + ) import Control.Tracer - ( nullTracer ) + ( nullTracer + ) import Data.Delta - ( Delta (..) ) + ( Delta (..) + ) import Data.Foldable - ( toList ) + ( toList + ) import Data.Functor.Identity - ( Identity (..) ) + ( Identity (..) + ) import Data.Generics.Internal.VL - ( set ) + ( set + ) import Data.Maybe - ( mapMaybe ) + ( mapMaybe + ) import Data.Store - ( Store (..) ) + ( Store (..) + ) import System.Directory - ( copyFile ) + ( copyFile + ) import System.FilePath - ( () ) + ( () + ) import System.IO.Temp - ( withSystemTempDirectory ) + ( withSystemTempDirectory + ) import Test.Hspec - ( Spec, around, describe, it, shouldBe ) + ( Spec + , around + , describe + , it + , shouldBe + ) import Test.QuickCheck ( Gen , Property @@ -101,11 +134,16 @@ import Test.QuickCheck , (===) ) import Test.QuickCheck.Monadic - ( forAllM, pick ) + ( forAllM + , pick + ) import Test.Store - ( GenDelta, prop_StoreUpdate ) + ( GenDelta + , prop_StoreUpdate + ) import Test.Utils.Paths - ( getTestData ) + ( getTestData + ) import qualified Cardano.Wallet.DB.Store.Transactions.Layer as TxSet import qualified Cardano.Wallet.Primitive.Types.Tx as W diff --git a/lib/wallet/test/unit/Cardano/Wallet/DB/Store/UTxOHistory/ModelSpec.hs b/lib/wallet/test/unit/Cardano/Wallet/DB/Store/UTxOHistory/ModelSpec.hs index ef694ce2036..b4529aa9415 100644 --- a/lib/wallet/test/unit/Cardano/Wallet/DB/Store/UTxOHistory/ModelSpec.hs +++ b/lib/wallet/test/unit/Cardano/Wallet/DB/Store/UTxOHistory/ModelSpec.hs @@ -12,7 +12,9 @@ module Cardano.Wallet.DB.Store.UTxOHistory.ModelSpec import Prelude import Cardano.Slotting.Slot - ( SlotNo (..), WithOrigin (..) ) + ( SlotNo (..) + , WithOrigin (..) + ) import Cardano.Wallet.DB.Store.UTxOHistory.Model ( DeltaUTxOHistory (..) , Pruned (..) @@ -24,21 +26,36 @@ import Cardano.Wallet.DB.Store.UTxOHistory.Model , getUTxO ) import Cardano.Wallet.Primitive.Types - ( Slot ) + ( Slot + ) import Cardano.Wallet.Primitive.Types.Address.Gen - ( genAddress ) + ( genAddress + ) import Cardano.Wallet.Primitive.Types.Hash - ( Hash (..) ) + ( Hash (..) + ) import Cardano.Wallet.Primitive.Types.Tx.TxIn - ( TxIn (..) ) + ( TxIn (..) + ) import Cardano.Wallet.Primitive.Types.Tx.TxOut - ( TxOut (..) ) + ( TxOut (..) + ) import Cardano.Wallet.Primitive.Types.UTxO - ( DeltaUTxO (..), UTxO (..), dom, excludingD, receiveD, size ) + ( DeltaUTxO (..) + , UTxO (..) + , dom + , excludingD + , receiveD + , size + ) import Data.Delta - ( Delta (apply) ) + ( Delta (apply) + ) import Test.Hspec - ( Spec, describe, it ) + ( Spec + , describe + , it + ) import Test.QuickCheck ( Gen , Property diff --git a/lib/wallet/test/unit/Cardano/Wallet/DB/Store/UTxOHistory/StoreSpec.hs b/lib/wallet/test/unit/Cardano/Wallet/DB/Store/UTxOHistory/StoreSpec.hs index eac27851309..d553be56dc0 100644 --- a/lib/wallet/test/unit/Cardano/Wallet/DB/Store/UTxOHistory/StoreSpec.hs +++ b/lib/wallet/test/unit/Cardano/Wallet/DB/Store/UTxOHistory/StoreSpec.hs @@ -10,25 +10,48 @@ module Cardano.Wallet.DB.Store.UTxOHistory.StoreSpec (spec) where import Prelude import Cardano.DB.Sqlite - ( ForeignKeysSetting (..), runQuery ) + ( ForeignKeysSetting (..) + , runQuery + ) import Cardano.Wallet.DB.Arbitrary () import Cardano.Wallet.DB.Fixtures - ( WalletProperty, initializeWalletTable, logScale, withDBInMemory ) + ( WalletProperty + , initializeWalletTable + , logScale + , withDBInMemory + ) import Cardano.Wallet.DB.Store.UTxOHistory.Model - ( DeltaUTxOHistory (AppendBlock, Prune, Rollback), UTxOHistory, empty ) + ( DeltaUTxOHistory (AppendBlock, Prune, Rollback) + , UTxOHistory + , empty + ) import Cardano.Wallet.DB.Store.UTxOHistory.ModelSpec - ( genDelta, genSlot, genSlotNo, genUTxO ) + ( genDelta + , genSlot + , genSlotNo + , genUTxO + ) import Cardano.Wallet.DB.Store.UTxOHistory.Store - ( mkStoreUTxOHistory ) + ( mkStoreUTxOHistory + ) import Fmt - ( Buildable (..) ) + ( Buildable (..) + ) import Test.Hspec - ( Spec, around, describe, it ) + ( Spec + , around + , describe + , it + ) import Test.QuickCheck - ( Gen, frequency, property ) + ( Gen + , frequency + , property + ) import Test.Store - ( prop_StoreUpdate ) + ( prop_StoreUpdate + ) spec :: Spec spec = around (withDBInMemory ForeignKeysEnabled) $ do diff --git a/lib/wallet/test/unit/Cardano/Wallet/DB/Store/UTxOHistory/TxOutCBORSpec.hs b/lib/wallet/test/unit/Cardano/Wallet/DB/Store/UTxOHistory/TxOutCBORSpec.hs index ef8373f3fc1..17adf09650d 100644 --- a/lib/wallet/test/unit/Cardano/Wallet/DB/Store/UTxOHistory/TxOutCBORSpec.hs +++ b/lib/wallet/test/unit/Cardano/Wallet/DB/Store/UTxOHistory/TxOutCBORSpec.hs @@ -9,11 +9,18 @@ import Prelude import Cardano.Wallet.DB.Arbitrary () import Cardano.Wallet.DB.Store.UTxOHistory.TxOutCBOR - ( deserializeTxOut, serializeTxOut ) + ( deserializeTxOut + , serializeTxOut + ) import Test.Hspec - ( Spec, describe, it ) + ( Spec + , describe + , it + ) import Test.QuickCheck - ( Testable (property), (===) ) + ( Testable (property) + , (===) + ) spec :: Spec spec = do diff --git a/lib/wallet/test/unit/Cardano/Wallet/DB/Store/WalletState/StoreSpec.hs b/lib/wallet/test/unit/Cardano/Wallet/DB/Store/WalletState/StoreSpec.hs index 554b7dfe497..3bfaae517c9 100644 --- a/lib/wallet/test/unit/Cardano/Wallet/DB/Store/WalletState/StoreSpec.hs +++ b/lib/wallet/test/unit/Cardano/Wallet/DB/Store/WalletState/StoreSpec.hs @@ -12,23 +12,36 @@ module Cardano.Wallet.DB.Store.WalletState.StoreSpec import Prelude import Cardano.Address.Derivation - ( XPrv ) + ( XPrv + ) import Cardano.DB.Sqlite - ( ForeignKeysSetting (..), SqliteContext, runQuery ) + ( ForeignKeysSetting (..) + , SqliteContext + , runQuery + ) import Cardano.Wallet.Address.Derivation - ( Depth (..) ) + ( Depth (..) + ) import Cardano.Wallet.DB.Arbitrary - ( GenState, InitialCheckpoint (..) ) + ( GenState + , InitialCheckpoint (..) + ) import Cardano.Wallet.DB.Fixtures - ( initializeWalletTable, withDBInMemory ) + ( initializeWalletTable + , withDBInMemory + ) import Cardano.Wallet.DB.Store.Checkpoints.Store - ( PersistAddressBook (..) ) + ( PersistAddressBook (..) + ) import Cardano.Wallet.DB.Store.Checkpoints.StoreSpec - ( genDeltaCheckpoints ) + ( genDeltaCheckpoints + ) import Cardano.Wallet.DB.Store.Info.Store - ( WalletInfo (WalletInfo) ) + ( WalletInfo (WalletInfo) + ) import Cardano.Wallet.DB.Store.WalletState.Store - ( mkStoreWallet ) + ( mkStoreWallet + ) import Cardano.Wallet.DB.WalletState ( DeltaWalletState , DeltaWalletState1 (..) @@ -37,23 +50,40 @@ import Cardano.Wallet.DB.WalletState , fromWallet ) import Cardano.Wallet.DummyTarget.Primitive.Types - ( dummyGenesisParameters ) + ( dummyGenesisParameters + ) import Cardano.Wallet.Flavor - ( KeyOf, WalletFlavorS (ShelleyWallet) ) + ( KeyOf + , WalletFlavorS (ShelleyWallet) + ) import Cardano.Wallet.Primitive.NetworkId - ( NetworkDiscriminant (..) ) + ( NetworkDiscriminant (..) + ) import Cardano.Wallet.Primitive.Types - ( WalletId (..) ) + ( WalletId (..) + ) import Data.Generics.Internal.VL.Lens - ( over, (^.) ) + ( over + , (^.) + ) import Data.Maybe - ( fromJust ) + ( fromJust + ) import Test.Hspec - ( Spec, around, describe, it ) + ( Spec + , around + , describe + , it + ) import Test.QuickCheck - ( Arbitrary (..), Property, property ) + ( Arbitrary (..) + , Property + , property + ) import Test.Store - ( GenDelta, prop_StoreUpdate ) + ( GenDelta + , prop_StoreUpdate + ) spec :: Spec spec = do diff --git a/lib/wallet/test/unit/Cardano/Wallet/DB/Store/Wallets/LayerSpec.hs b/lib/wallet/test/unit/Cardano/Wallet/DB/Store/Wallets/LayerSpec.hs index bd252eea009..c23da7e4ed0 100644 --- a/lib/wallet/test/unit/Cardano/Wallet/DB/Store/Wallets/LayerSpec.hs +++ b/lib/wallet/test/unit/Cardano/Wallet/DB/Store/Wallets/LayerSpec.hs @@ -10,19 +10,32 @@ module Cardano.Wallet.DB.Store.Wallets.LayerSpec import Prelude import Cardano.DB.Sqlite - ( ForeignKeysSetting (..), runQuery ) + ( ForeignKeysSetting (..) + , runQuery + ) import Cardano.Wallet.DB.Fixtures - ( WalletProperty, logScale, withDBInMemory ) + ( WalletProperty + , logScale + , withDBInMemory + ) import Cardano.Wallet.DB.Store.Wallets.Layer - ( newQueryStoreTxWalletsHistory ) + ( newQueryStoreTxWalletsHistory + ) import Cardano.Wallet.DB.Store.Wallets.StoreSpec - ( genDeltaTxWallets ) + ( genDeltaTxWallets + ) import Test.Hspec - ( Spec, around, describe, it ) + ( Spec + , around + , describe + , it + ) import Test.QuickCheck - ( property ) + ( property + ) import Test.Store - ( prop_StoreUpdate ) + ( prop_StoreUpdate + ) spec :: Spec spec = do diff --git a/lib/wallet/test/unit/Cardano/Wallet/DB/Store/Wallets/StoreSpec.hs b/lib/wallet/test/unit/Cardano/Wallet/DB/Store/Wallets/StoreSpec.hs index 645c877af2c..94faa4e6ad7 100644 --- a/lib/wallet/test/unit/Cardano/Wallet/DB/Store/Wallets/StoreSpec.hs +++ b/lib/wallet/test/unit/Cardano/Wallet/DB/Store/Wallets/StoreSpec.hs @@ -11,35 +11,63 @@ module Cardano.Wallet.DB.Store.Wallets.StoreSpec import Prelude import Cardano.DB.Sqlite - ( ForeignKeysSetting (..), runQuery ) + ( ForeignKeysSetting (..) + , runQuery + ) import Cardano.Wallet.DB.Arbitrary () import Cardano.Wallet.DB.Fixtures - ( WalletProperty, initializeWalletTable, logScale, withDBInMemory ) + ( WalletProperty + , initializeWalletTable + , logScale + , withDBInMemory + ) import Cardano.Wallet.DB.Sqlite.Schema - ( TxMeta (..) ) + ( TxMeta (..) + ) import Cardano.Wallet.DB.Store.Meta.Layer - ( mkQueryStoreTxMeta ) + ( mkQueryStoreTxMeta + ) import Cardano.Wallet.DB.Store.Meta.Model - ( TxMetaHistory (..) ) + ( TxMetaHistory (..) + ) import Cardano.Wallet.DB.Store.Wallets.Model - ( DeltaTxWalletsHistory (..) ) + ( DeltaTxWalletsHistory (..) + ) import Cardano.Wallet.DB.Store.Wallets.Store - ( mkStoreTxWalletsHistory ) + ( mkStoreTxWalletsHistory + ) import Control.Concurrent.Class.MonadSTM - ( MonadSTM ) + ( MonadSTM + ) import Control.Monad.Class.MonadThrow - ( MonadThrow ) + ( MonadThrow + ) import Data.Delta - ( Delta ) + ( Delta + ) import Data.Store - ( UpdateStore, newStore ) + ( UpdateStore + , newStore + ) import Test.Hspec - ( Spec, around, describe, it ) + ( Spec + , around + , describe + , it + ) import Test.QuickCheck - ( Gen, NonEmptyList (..), arbitrary, choose, frequency, property ) + ( Gen + , NonEmptyList (..) + , arbitrary + , choose + , frequency + , property + ) import Test.Store - ( GenDelta, prop_StoreUpdate ) + ( GenDelta + , prop_StoreUpdate + ) import qualified Cardano.Wallet.Primitive.Types as W import qualified Data.Map.Strict as Map diff --git a/lib/wallet/test/unit/Cardano/Wallet/Delegation/ModelSpec.hs b/lib/wallet/test/unit/Cardano/Wallet/Delegation/ModelSpec.hs index b852d720934..e2db0f2f2d6 100644 --- a/lib/wallet/test/unit/Cardano/Wallet/Delegation/ModelSpec.hs +++ b/lib/wallet/test/unit/Cardano/Wallet/Delegation/ModelSpec.hs @@ -19,23 +19,47 @@ where import Prelude import Cardano.Wallet.Delegation.Model - ( History, Operation (..), Status (Active) ) + ( History + , Operation (..) + , Status (Active) + ) import Cardano.Wallet.Delegation.Properties - ( Step (Step), properties ) + ( Step (Step) + , properties + ) import Control.Arrow - ( (&&&) ) + ( (&&&) + ) import Data.Delta - ( Delta (..) ) + ( Delta (..) + ) import Data.Foldable - ( toList ) + ( toList + ) import Test.Hspec - ( Spec, describe, it ) + ( Spec + , describe + , it + ) import Test.QuickCheck - ( Arbitrary (..), Gen, choose, elements, frequency, getSize, suchThat ) + ( Arbitrary (..) + , Gen + , choose + , elements + , frequency + , getSize + , suchThat + ) import Test.QuickCheck.Property - ( Property, Testable (property), conjoin, forAllShrinkShow, mapSize ) + ( Property + , Testable (property) + , conjoin + , forAllShrinkShow + , mapSize + ) import Text.Pretty.Simple - ( pShow ) + ( pShow + ) import qualified Data.Map.Strict as Map import qualified Data.Text.Lazy as T diff --git a/lib/wallet/test/unit/Cardano/Wallet/DelegationSpec.hs b/lib/wallet/test/unit/Cardano/Wallet/DelegationSpec.hs index f9554efda5b..c61cdf79b67 100644 --- a/lib/wallet/test/unit/Cardano/Wallet/DelegationSpec.hs +++ b/lib/wallet/test/unit/Cardano/Wallet/DelegationSpec.hs @@ -12,11 +12,16 @@ module Cardano.Wallet.DelegationSpec import Prelude import Cardano.Address.Derivation - ( XPrv, xprvFromBytes, xprvToBytes ) + ( XPrv + , xprvFromBytes + , xprvToBytes + ) import Cardano.Pool.Types - ( PoolId (..) ) + ( PoolId (..) + ) import Cardano.Wallet.Address.Derivation - ( DerivationIndex (..) ) + ( DerivationIndex (..) + ) import Cardano.Wallet.Primitive.Types ( EpochNo (..) , WalletDelegation (..) @@ -24,27 +29,42 @@ import Cardano.Wallet.Primitive.Types , WalletDelegationStatus (..) ) import Cardano.Wallet.Primitive.Types.Coin - ( Coin (..) ) + ( Coin (..) + ) import Cardano.Wallet.Primitive.Types.Coin.Gen - ( genCoinPositive ) + ( genCoinPositive + ) import Cardano.Wallet.Primitive.Types.RewardAccount - ( RewardAccount (..) ) + ( RewardAccount (..) + ) import Cardano.Wallet.Transaction - ( Withdrawal (..) ) + ( Withdrawal (..) + ) import Data.Function - ( on ) + ( on + ) import Data.List.NonEmpty - ( NonEmpty (..) ) + ( NonEmpty (..) + ) import Data.Maybe - ( fromJust, isNothing ) + ( fromJust + , isNothing + ) import Data.Word - ( Word64 ) + ( Word64 + ) import Data.Word.Odd - ( Word31 ) + ( Word31 + ) import Hedgehog.Corpus - ( metasyntactic ) + ( metasyntactic + ) import Test.Hspec - ( Spec, describe, it, shouldBe ) + ( Spec + , describe + , it + , shouldBe + ) import Test.QuickCheck ( Arbitrary (..) , NonEmptyList (..) @@ -64,7 +84,9 @@ import Test.QuickCheck , (===) ) import Test.QuickCheck.Arbitrary.Generic - ( genericArbitrary, genericShrink ) + ( genericArbitrary + , genericShrink + ) import qualified Cardano.Wallet as W import qualified Cardano.Wallet.Delegation as WD diff --git a/lib/wallet/test/unit/Cardano/Wallet/Network/LightSpec.hs b/lib/wallet/test/unit/Cardano/Wallet/Network/LightSpec.hs index fada406b739..753e29c01fb 100644 --- a/lib/wallet/test/unit/Cardano/Wallet/Network/LightSpec.hs +++ b/lib/wallet/test/unit/Cardano/Wallet/Network/LightSpec.hs @@ -13,7 +13,8 @@ module Cardano.Wallet.Network.LightSpec where import Prelude import Cardano.Wallet.Network - ( ChainFollower (..) ) + ( ChainFollower (..) + ) import Cardano.Wallet.Network.Light ( Consensual (Consensual, NotConsensual) , LightBlocks @@ -22,7 +23,8 @@ import Cardano.Wallet.Network.Light , lightSync ) import Cardano.Wallet.Primitive.BlockSummary - ( BlockSummary (..) ) + ( BlockSummary (..) + ) import Cardano.Wallet.Primitive.Types ( BlockHeader (..) , ChainPoint (..) @@ -30,31 +32,51 @@ import Cardano.Wallet.Primitive.Types , isGenesisBlockHeader ) import Cardano.Wallet.Primitive.Types.Hash - ( Hash (..) ) + ( Hash (..) + ) import Control.Monad - ( ap, forever, void ) + ( ap + , forever + , void + ) import Control.Monad.Class.MonadTimer - ( MonadDelay (..) ) + ( MonadDelay (..) + ) import Control.Monad.Trans.State.Strict - ( State, get, modify, runState ) + ( State + , get + , modify + , runState + ) import Control.Tracer - ( nullTracer ) + ( nullTracer + ) import Data.Bifunctor - ( bimap ) + ( bimap + ) import Data.Foldable - ( find ) + ( find + ) import Data.List.NonEmpty - ( NonEmpty (..) ) + ( NonEmpty (..) + ) import Data.Maybe - ( listToMaybe ) + ( listToMaybe + ) import Data.Quantity - ( Quantity (..) ) + ( Quantity (..) + ) import Data.Text.Encoding - ( decodeUtf8 ) + ( decodeUtf8 + ) import Data.Void - ( Void ) + ( Void + ) import Test.Hspec - ( Spec, describe, it ) + ( Spec + , describe + , it + ) import Test.QuickCheck ( Arbitrary (..) , Gen diff --git a/lib/wallet/test/unit/Cardano/Wallet/Network/PortsSpec.hs b/lib/wallet/test/unit/Cardano/Wallet/Network/PortsSpec.hs index 2d6511b714d..e490b5191e6 100644 --- a/lib/wallet/test/unit/Cardano/Wallet/Network/PortsSpec.hs +++ b/lib/wallet/test/unit/Cardano/Wallet/Network/PortsSpec.hs @@ -5,15 +5,25 @@ module Cardano.Wallet.Network.PortsSpec import Prelude import Cardano.Wallet.Network.Ports - ( getRandomPort, isPortOpen, simpleSockAddr ) + ( getRandomPort + , isPortOpen + , simpleSockAddr + ) import Network.HTTP.Types - ( status200 ) + ( status200 + ) import Network.Wai - ( responseLBS ) + ( responseLBS + ) import Network.Wai.Handler.Warp - ( withApplication ) + ( withApplication + ) import Test.Hspec - ( Spec, describe, it, shouldReturn ) + ( Spec + , describe + , it + , shouldReturn + ) spec :: Spec spec = describe "Cardano.Wallet.Network.Ports" $ do diff --git a/lib/wallet/test/unit/Cardano/Wallet/NetworkSpec.hs b/lib/wallet/test/unit/Cardano/Wallet/NetworkSpec.hs index 7c2dbe9599a..2afd65b8395 100644 --- a/lib/wallet/test/unit/Cardano/Wallet/NetworkSpec.hs +++ b/lib/wallet/test/unit/Cardano/Wallet/NetworkSpec.hs @@ -9,19 +9,38 @@ module Cardano.Wallet.NetworkSpec import Prelude import Cardano.Wallet.Gen - ( genBlockHeader, genChainPoint, genSlotNo ) + ( genBlockHeader + , genChainPoint + , genSlotNo + ) import Cardano.Wallet.Network - ( ChainSyncLog (..), ErrPostTx (..), emptyStats, updateStats ) + ( ChainSyncLog (..) + , ErrPostTx (..) + , emptyStats + , updateStats + ) import Cardano.Wallet.Primitive.Types - ( BlockHeader (..), ChainPoint (..) ) + ( BlockHeader (..) + , ChainPoint (..) + ) import Data.Time.Clock - ( getCurrentTime ) + ( getCurrentTime + ) import NoThunks.Class - ( wNoThunks ) + ( wNoThunks + ) import Test.Hspec - ( Spec, describe, expectationFailure, it ) + ( Spec + , describe + , expectationFailure + , it + ) import Test.QuickCheck - ( Arbitrary (..), getNonEmpty, oneof, property ) + ( Arbitrary (..) + , getNonEmpty + , oneof + , property + ) import qualified Data.List.NonEmpty as NE diff --git a/lib/wallet/test/unit/Cardano/Wallet/Primitive/BlockSummarySpec.hs b/lib/wallet/test/unit/Cardano/Wallet/Primitive/BlockSummarySpec.hs index beb1f5e40ff..58e76b1dc2e 100644 --- a/lib/wallet/test/unit/Cardano/Wallet/Primitive/BlockSummarySpec.hs +++ b/lib/wallet/test/unit/Cardano/Wallet/Primitive/BlockSummarySpec.hs @@ -9,7 +9,10 @@ module Cardano.Wallet.Primitive.BlockSummarySpec import Prelude import Cardano.Wallet.Gen - ( genBlockHeader, genSlot, genSlotNo ) + ( genBlockHeader + , genSlot + , genSlotNo + ) import Cardano.Wallet.Primitive.BlockSummary ( BlockEvents (BlockEvents, slot) , ChainEvents @@ -22,13 +25,21 @@ import Cardano.Wallet.Primitive.BlockSummary , wholeList ) import Cardano.Wallet.Primitive.Types - ( BlockHeader (..), Slot, WithOrigin (..) ) + ( BlockHeader (..) + , Slot + , WithOrigin (..) + ) import Cardano.Wallet.Primitive.Types.Tx.Gen - ( genTx ) + ( genTx + ) import Data.Foldable - ( toList ) + ( toList + ) import Test.Hspec - ( Spec, describe, it ) + ( Spec + , describe + , it + ) import Test.QuickCheck ( Arbitrary (..) , Gen diff --git a/lib/wallet/test/unit/Cardano/Wallet/Primitive/Delegation/StateSpec.hs b/lib/wallet/test/unit/Cardano/Wallet/Primitive/Delegation/StateSpec.hs index e1357c54da3..c79227952c0 100644 --- a/lib/wallet/test/unit/Cardano/Wallet/Primitive/Delegation/StateSpec.hs +++ b/lib/wallet/test/unit/Cardano/Wallet/Primitive/Delegation/StateSpec.hs @@ -17,7 +17,8 @@ module Cardano.Wallet.Primitive.Delegation.StateSpec where import Prelude import Cardano.Address.Derivation - ( XPub ) + ( XPub + ) import Cardano.Wallet.Address.Derivation ( Depth (..) , DerivationType (..) @@ -45,25 +46,35 @@ import Cardano.Wallet.Primitive.Delegation.State , usableKeys ) import Cardano.Wallet.Primitive.NetworkId - ( SNetworkId (..) ) + ( SNetworkId (..) + ) import Cardano.Wallet.Primitive.Types.Address - ( Address (..) ) + ( Address (..) + ) import Cardano.Wallet.Primitive.Types.Coin - ( Coin (..) ) + ( Coin (..) + ) import Cardano.Wallet.Primitive.Types.Hash - ( Hash (..) ) + ( Hash (..) + ) import Cardano.Wallet.Primitive.Types.Tx.TxIn - ( TxIn (..) ) + ( TxIn (..) + ) import Cardano.Wallet.Primitive.Types.Tx.TxOut - ( TxOut (..) ) + ( TxOut (..) + ) import Control.Arrow - ( first ) + ( first + ) import Crypto.Hash.Extra - ( blake2b224 ) + ( blake2b224 + ) import Data.Map - ( Map ) + ( Map + ) import Data.Set - ( Set ) + ( Set + ) import Fmt ( Buildable (..) , Builder @@ -77,9 +88,14 @@ import Fmt , pretty ) import GHC.Generics - ( Generic ) + ( Generic + ) import Test.Hspec - ( Spec, describe, it, shouldBe ) + ( Spec + , describe + , it + , shouldBe + ) import Test.QuickCheck ( Arbitrary (..) , NonNegative (..) @@ -96,7 +112,8 @@ import Test.QuickCheck , (===) ) import Test.QuickCheck.Arbitrary.Generic - ( genericArbitrary ) + ( genericArbitrary + ) import qualified Cardano.Wallet.Primitive.Types.TokenBundle as TB import qualified Data.ByteString as BS diff --git a/lib/wallet/test/unit/Cardano/Wallet/Primitive/ModelSpec.hs b/lib/wallet/test/unit/Cardano/Wallet/Primitive/ModelSpec.hs index 17dba9a9279..350283263c0 100644 --- a/lib/wallet/test/unit/Cardano/Wallet/Primitive/ModelSpec.hs +++ b/lib/wallet/test/unit/Cardano/Wallet/Primitive/ModelSpec.hs @@ -24,19 +24,28 @@ module Cardano.Wallet.Primitive.ModelSpec import Prelude import Algebra.PartialOrd - ( PartialOrd (..) ) + ( PartialOrd (..) + ) import Cardano.Wallet.Address.Derivation - ( DerivationIndex (..) ) + ( DerivationIndex (..) + ) import Cardano.Wallet.Address.Discovery - ( IsOurs (..) ) + ( IsOurs (..) + ) import Cardano.Wallet.Address.MaybeLight - ( DiscoverTxs (..), MaybeLight (..) ) + ( DiscoverTxs (..) + , MaybeLight (..) + ) import Cardano.Wallet.DummyTarget.Primitive.Types - ( block0 ) + ( block0 + ) import Cardano.Wallet.Gen - ( genSlot ) + ( genSlot + ) import Cardano.Wallet.Primitive.BlockSummary - ( ChainEvents, summarizeOnTxOut ) + ( ChainEvents + , summarizeOnTxOut + ) import Cardano.Wallet.Primitive.Model ( BlockData (..) , DeltaWallet @@ -66,7 +75,8 @@ import Cardano.Wallet.Primitive.Model , utxoFromTxOutputs ) import Cardano.Wallet.Primitive.Slotting.Legacy - ( flatSlot ) + ( flatSlot + ) import Cardano.Wallet.Primitive.Types ( Block (..) , BlockHeader (..) @@ -76,19 +86,29 @@ import Cardano.Wallet.Primitive.Types , SlotNo (..) ) import Cardano.Wallet.Primitive.Types.Address - ( Address (..) ) + ( Address (..) + ) import Cardano.Wallet.Primitive.Types.Address.Gen - ( Parity (..), addressParity, genAddress ) + ( Parity (..) + , addressParity + , genAddress + ) import Cardano.Wallet.Primitive.Types.Coin - ( Coin (..) ) + ( Coin (..) + ) import Cardano.Wallet.Primitive.Types.Coin.Gen - ( genCoin, shrinkCoin ) + ( genCoin + , shrinkCoin + ) import Cardano.Wallet.Primitive.Types.Hash - ( Hash (..) ) + ( Hash (..) + ) import Cardano.Wallet.Primitive.Types.RewardAccount - ( RewardAccount (..) ) + ( RewardAccount (..) + ) import Cardano.Wallet.Primitive.Types.TokenBundle - ( TokenBundle ) + ( TokenBundle + ) import Cardano.Wallet.Primitive.Types.Tx ( Tx (..) , TxScriptValidity (..) @@ -98,69 +118,130 @@ import Cardano.Wallet.Primitive.Types.Tx , txScriptInvalid ) import Cardano.Wallet.Primitive.Types.Tx.Gen - ( genTx, genTxScriptValidity, shrinkTx ) + ( genTx + , genTxScriptValidity + , shrinkTx + ) import Cardano.Wallet.Primitive.Types.Tx.TxIn - ( TxIn (..) ) + ( TxIn (..) + ) import Cardano.Wallet.Primitive.Types.Tx.TxIn.Gen - ( genTxIn, shrinkTxIn ) + ( genTxIn + , shrinkTxIn + ) import Cardano.Wallet.Primitive.Types.Tx.TxMeta - ( Direction (Incoming), direction ) + ( Direction (Incoming) + , direction + ) import Cardano.Wallet.Primitive.Types.Tx.TxOut - ( TxOut (..) ) + ( TxOut (..) + ) import Cardano.Wallet.Primitive.Types.Tx.TxOut.Gen - ( genTxOut, shrinkTxOut ) + ( genTxOut + , shrinkTxOut + ) import Cardano.Wallet.Primitive.Types.Tx.TxSeq - ( TxSeq ) + ( TxSeq + ) import Cardano.Wallet.Primitive.Types.Tx.TxSeq.Gen - ( ShrinkableTxSeq, genTxSeq, getTxSeq, shrinkTxSeq ) + ( ShrinkableTxSeq + , genTxSeq + , getTxSeq + , shrinkTxSeq + ) import Cardano.Wallet.Primitive.Types.UTxO - ( UTxO (..), balance, dom, excluding, filterByAddress, restrictedTo ) + ( UTxO (..) + , balance + , dom + , excluding + , filterByAddress + , restrictedTo + ) import Cardano.Wallet.Primitive.Types.UTxO.Gen - ( genUTxO, shrinkUTxO ) + ( genUTxO + , shrinkUTxO + ) import Cardano.Wallet.Util - ( ShowFmt (..) ) + ( ShowFmt (..) + ) import Control.Applicative - ( ZipList (..) ) + ( ZipList (..) + ) import Control.DeepSeq - ( NFData (..) ) + ( NFData (..) + ) import Control.Monad - ( filterM, foldM, guard ) + ( filterM + , foldM + , guard + ) import Control.Monad.Trans.State.Strict - ( State, evalState, execState, runState, state ) + ( State + , evalState + , execState + , runState + , state + ) import Data.Delta - ( apply ) + ( apply + ) import Data.Function - ( (&) ) + ( (&) + ) import Data.Functor - ( ($>) ) + ( ($>) + ) import Data.Functor.Identity - ( Identity (..) ) + ( Identity (..) + ) import Data.Generics.Internal.VL.Lens - ( over, view, (^.) ) + ( over + , view + , (^.) + ) import Data.Generics.Labels () import Data.List - ( elemIndex ) + ( elemIndex + ) import Data.List.NonEmpty - ( NonEmpty (..) ) + ( NonEmpty (..) + ) import Data.Maybe - ( catMaybes, isJust ) + ( catMaybes + , isJust + ) import Data.Quantity - ( Quantity (..) ) + ( Quantity (..) + ) import Data.Set - ( Set, (\\) ) + ( Set + , (\\) + ) import Data.Traversable - ( for ) + ( for + ) import Data.Word - ( Word32, Word64 ) + ( Word32 + , Word64 + ) import Fmt - ( Buildable, blockListF, pretty ) + ( Buildable + , blockListF + , pretty + ) import Generics.SOP - ( NP (..) ) + ( NP (..) + ) import GHC.Generics - ( Generic ) + ( Generic + ) import Test.Hspec - ( Spec, describe, it, shouldSatisfy ) + ( Spec + , describe + , it + , shouldSatisfy + ) import Test.QuickCheck ( Arbitrary (..) , CoArbitrary (..) @@ -211,7 +292,8 @@ import Test.QuickCheck.Extra import Test.QuickCheck.Instances.ByteString () import Test.Utils.Pretty - ( (====) ) + ( (====) + ) import qualified Cardano.Wallet.Primitive.Types.Coin as Coin import qualified Cardano.Wallet.Primitive.Types.TokenBundle as TokenBundle diff --git a/lib/wallet/test/unit/Cardano/Wallet/Primitive/Passphrase/LegacySpec.hs b/lib/wallet/test/unit/Cardano/Wallet/Primitive/Passphrase/LegacySpec.hs index bc9d845b47f..806fa2e9249 100644 --- a/lib/wallet/test/unit/Cardano/Wallet/Primitive/Passphrase/LegacySpec.hs +++ b/lib/wallet/test/unit/Cardano/Wallet/Primitive/Passphrase/LegacySpec.hs @@ -31,25 +31,45 @@ import Cardano.Wallet.Primitive.Passphrase.Legacy , preparePassphrase ) import Cardano.Wallet.Primitive.Passphrase.Types - ( Passphrase (..), PassphraseHash (..) ) + ( Passphrase (..) + , PassphraseHash (..) + ) import Cardano.Wallet.Unsafe - ( unsafeFromHex ) + ( unsafeFromHex + ) import Control.Monad.IO.Class - ( liftIO ) + ( liftIO + ) import Data.ByteArray - ( ByteArray ) + ( ByteArray + ) import Data.ByteArray.Encoding - ( Base (..), convertToBase ) + ( Base (..) + , convertToBase + ) import Data.ByteString - ( ByteString ) + ( ByteString + ) import GHC.Stack - ( HasCallStack ) + ( HasCallStack + ) import Test.Hspec - ( Spec, before_, describe, it, pendingWith, shouldBe ) + ( Spec + , before_ + , describe + , it + , pendingWith + , shouldBe + ) import Test.QuickCheck - ( Arbitrary (..), Property, property, (==>) ) + ( Arbitrary (..) + , Property + , property + , (==>) + ) import Test.QuickCheck.Monadic - ( monadicIO ) + ( monadicIO + ) spec :: Spec spec = do diff --git a/lib/wallet/test/unit/Cardano/Wallet/Primitive/PassphraseSpec.hs b/lib/wallet/test/unit/Cardano/Wallet/Primitive/PassphraseSpec.hs index 2d80db77547..ac7eca781be 100644 --- a/lib/wallet/test/unit/Cardano/Wallet/Primitive/PassphraseSpec.hs +++ b/lib/wallet/test/unit/Cardano/Wallet/Primitive/PassphraseSpec.hs @@ -30,23 +30,42 @@ import Cardano.Wallet.Primitive.Passphrase.Gen , shrinkUserPassphrase ) import Cardano.Wallet.Primitive.Passphrase.Legacy - ( haveScrypt ) + ( haveScrypt + ) import Cardano.Wallet.Unsafe - ( unsafeFromHex ) + ( unsafeFromHex + ) import Control.Monad.IO.Class - ( liftIO ) + ( liftIO + ) import Data.ByteString - ( ByteString ) + ( ByteString + ) import Data.Proxy - ( Proxy (..) ) + ( Proxy (..) + ) import Test.Hspec - ( Spec, describe, it, shouldBe ) + ( Spec + , describe + , it + , shouldBe + ) import Test.QuickCheck - ( Arbitrary (..), Property, counterexample, property, (===), (==>) ) + ( Arbitrary (..) + , Property + , counterexample + , property + , (===) + , (==>) + ) import Test.QuickCheck.Monadic - ( assert, monadicIO, run ) + ( assert + , monadicIO + , run + ) import Test.Text.Roundtrip - ( textRoundtrip ) + ( textRoundtrip + ) import qualified Data.ByteArray as BA diff --git a/lib/wallet/test/unit/Cardano/Wallet/Primitive/Slotting/Legacy.hs b/lib/wallet/test/unit/Cardano/Wallet/Primitive/Slotting/Legacy.hs index 8ccf67b6a97..8af0f738e2b 100644 --- a/lib/wallet/test/unit/Cardano/Wallet/Primitive/Slotting/Legacy.hs +++ b/lib/wallet/test/unit/Cardano/Wallet/Primitive/Slotting/Legacy.hs @@ -39,21 +39,31 @@ import Cardano.Wallet.Primitive.Types , StartTime (..) ) import Data.Generics.Internal.VL.Lens - ( (^.) ) + ( (^.) + ) import Data.Maybe - ( fromMaybe ) + ( fromMaybe + ) import Data.Quantity - ( Quantity (..) ) + ( Quantity (..) + ) import Data.Time - ( UTCTime ) + ( UTCTime + ) import Data.Time.Clock - ( NominalDiffTime, addUTCTime, diffUTCTime ) + ( NominalDiffTime + , addUTCTime + , diffUTCTime + ) import Data.Word - ( Word64 ) + ( Word64 + ) import GHC.Generics - ( Generic ) + ( Generic + ) import Numeric.Natural - ( Natural ) + ( Natural + ) {------------------------------------------------------------------------------- Legacy slotting functions: diff --git a/lib/wallet/test/unit/Cardano/Wallet/Primitive/SlottingSpec.hs b/lib/wallet/test/unit/Cardano/Wallet/Primitive/SlottingSpec.hs index 29f25946e3f..b00456b7d79 100644 --- a/lib/wallet/test/unit/Cardano/Wallet/Primitive/SlottingSpec.hs +++ b/lib/wallet/test/unit/Cardano/Wallet/Primitive/SlottingSpec.hs @@ -12,13 +12,19 @@ module Cardano.Wallet.Primitive.SlottingSpec import Prelude import Cardano.BM.Data.Severity - ( Severity (..) ) + ( Severity (..) + ) import Cardano.BM.Data.Tracer - ( HasSeverityAnnotation (..), nullTracer ) + ( HasSeverityAnnotation (..) + , nullTracer + ) import Cardano.Slotting.Slot - ( SlotNo (..) ) + ( SlotNo (..) + ) import Cardano.Wallet.Gen - ( genActiveSlotCoefficient, shrinkActiveSlotCoefficient ) + ( genActiveSlotCoefficient + , shrinkActiveSlotCoefficient + ) import Cardano.Wallet.Primitive.Slotting ( PastHorizonException , Qry @@ -54,41 +60,73 @@ import Cardano.Wallet.Primitive.Types , StartTime (..) ) import Cardano.Wallet.Primitive.Types.Hash - ( Hash (..) ) + ( Hash (..) + ) import Control.Monad.Trans.Except - ( runExceptT ) + ( runExceptT + ) import Data.Either - ( isLeft, isRight ) + ( isLeft + , isRight + ) import Data.Functor.Identity - ( runIdentity ) + ( runIdentity + ) import Data.Generics.Internal.VL.Lens - ( (^.) ) + ( (^.) + ) import Data.Quantity - ( Quantity (..) ) + ( Quantity (..) + ) import Data.SOP.Counting - ( exactlyTwo ) + ( exactlyTwo + ) import Data.Time - ( UTCTime ) + ( UTCTime + ) import Data.Time.Clock - ( getCurrentTime ) + ( getCurrentTime + ) import Data.Word - ( Word32 ) + ( Word32 + ) import Ouroboros.Consensus.BlockchainTime.WallClock.Types - ( RelativeTime (..), mkSlotLength ) + ( RelativeTime (..) + , mkSlotLength + ) import Ouroboros.Consensus.Config.SecurityParam - ( SecurityParam (..) ) + ( SecurityParam (..) + ) import Test.Hspec - ( Spec, describe, it, runIO, shouldBe, shouldReturn, shouldSatisfy ) + ( Spec + , describe + , it + , runIO + , shouldBe + , shouldReturn + , shouldSatisfy + ) import Test.QuickCheck - ( Arbitrary (..), Property, choose, property, withMaxSuccess, (===) ) + ( Arbitrary (..) + , Property + , choose + , property + , withMaxSuccess + , (===) + ) import Test.QuickCheck.Arbitrary.Generic - ( genericArbitrary, genericShrink ) + ( genericArbitrary + , genericShrink + ) import Test.Utils.Time - ( genUniformTime ) + ( genUniformTime + ) import Test.Utils.Trace - ( captureLogging ) + ( captureLogging + ) import UnliftIO.Exception - ( try ) + ( try + ) import qualified Cardano.Slotting.Slot as Cardano import qualified Ouroboros.Consensus.HardFork.History.EraParams as HF diff --git a/lib/wallet/test/unit/Cardano/Wallet/Primitive/SyncProgressSpec.hs b/lib/wallet/test/unit/Cardano/Wallet/Primitive/SyncProgressSpec.hs index 97a964d38f1..f9283d434df 100644 --- a/lib/wallet/test/unit/Cardano/Wallet/Primitive/SyncProgressSpec.hs +++ b/lib/wallet/test/unit/Cardano/Wallet/Primitive/SyncProgressSpec.hs @@ -17,9 +17,16 @@ import Cardano.Wallet.Gen , shrinkSlotNo ) import Cardano.Wallet.Primitive.Slotting - ( TimeInterpreter, interpretQuery, mkSingleEraInterpreter, slotToRelTime ) + ( TimeInterpreter + , interpretQuery + , mkSingleEraInterpreter + , slotToRelTime + ) import Cardano.Wallet.Primitive.SyncProgress - ( SyncProgress (..), SyncTolerance (..), syncProgress ) + ( SyncProgress (..) + , SyncTolerance (..) + , syncProgress + ) import Cardano.Wallet.Primitive.Types ( ActiveSlotCoefficient (..) , BlockHeader (..) @@ -30,27 +37,49 @@ import Cardano.Wallet.Primitive.Types , StartTime (..) ) import Cardano.Wallet.Unsafe - ( unsafeMkPercentage ) + ( unsafeMkPercentage + ) import Control.DeepSeq - ( deepseq ) + ( deepseq + ) import Control.Monad - ( forM_ ) + ( forM_ + ) import Data.Either - ( isRight ) + ( isRight + ) import Data.Functor.Identity - ( Identity (..) ) + ( Identity (..) + ) import Data.Quantity - ( Quantity (..) ) + ( Quantity (..) + ) import Ouroboros.Consensus.BlockchainTime.WallClock.Types - ( RelativeTime (..) ) + ( RelativeTime (..) + ) import Test.Hspec - ( Spec, describe, it, shouldBe ) + ( Spec + , describe + , it + , shouldBe + ) import Test.QuickCheck - ( Arbitrary (..), counterexample, property, withMaxSuccess ) + ( Arbitrary (..) + , counterexample + , property + , withMaxSuccess + ) import Test.QuickCheck.Monadic - ( assert, monadicIO, monitor, run ) + ( assert + , monadicIO + , monitor + , run + ) import UnliftIO.Exception - ( SomeException (..), evaluate, try ) + ( SomeException (..) + , evaluate + , try + ) spec :: Spec spec = do diff --git a/lib/wallet/test/unit/Cardano/Wallet/Primitive/Types/StateDeltaSeqSpec.hs b/lib/wallet/test/unit/Cardano/Wallet/Primitive/Types/StateDeltaSeqSpec.hs index c7f4ba0f23c..f14d906fee3 100644 --- a/lib/wallet/test/unit/Cardano/Wallet/Primitive/Types/StateDeltaSeqSpec.hs +++ b/lib/wallet/test/unit/Cardano/Wallet/Primitive/Types/StateDeltaSeqSpec.hs @@ -15,18 +15,26 @@ module Cardano.Wallet.Primitive.Types.StateDeltaSeqSpec ) where import Prelude hiding - ( seq ) + ( seq + ) import Cardano.Wallet.Primitive.Types.StateDeltaSeq - ( StateDeltaSeq ) + ( StateDeltaSeq + ) import Data.Function - ( (&) ) + ( (&) + ) import GHC.Generics - ( Generic ) + ( Generic + ) import Safe - ( tailMay ) + ( tailMay + ) import Test.Hspec - ( Spec, describe, it ) + ( Spec + , describe + , it + ) import Test.QuickCheck ( Arbitrary (..) , CoArbitrary @@ -54,7 +62,8 @@ import Test.QuickCheck.Classes , showLaws ) import Test.Utils.Laws - ( testLawsMany ) + ( testLawsMany + ) import qualified Cardano.Wallet.Primitive.Types.StateDeltaSeq as Seq import qualified Data.Foldable as F diff --git a/lib/wallet/test/unit/Cardano/Wallet/Primitive/Types/Tx/TxSeqSpec.hs b/lib/wallet/test/unit/Cardano/Wallet/Primitive/Types/Tx/TxSeqSpec.hs index f78e80bb168..ff230ae7471 100644 --- a/lib/wallet/test/unit/Cardano/Wallet/Primitive/Types/Tx/TxSeqSpec.hs +++ b/lib/wallet/test/unit/Cardano/Wallet/Primitive/Types/Tx/TxSeqSpec.hs @@ -15,27 +15,47 @@ module Cardano.Wallet.Primitive.Types.Tx.TxSeqSpec import Prelude import Cardano.Wallet.Primitive.Types.Address.Gen - ( genAddress ) + ( genAddress + ) import Cardano.Wallet.Primitive.Types.Hash - ( Hash (..) ) + ( Hash (..) + ) import Cardano.Wallet.Primitive.Types.TokenMap - ( AssetId ) + ( AssetId + ) import Cardano.Wallet.Primitive.Types.TokenMap.Gen - ( genAssetId, shrinkAssetId ) + ( genAssetId + , shrinkAssetId + ) import Cardano.Wallet.Primitive.Types.TokenPolicy - ( TokenName (..), TokenPolicyId (..) ) + ( TokenName (..) + , TokenPolicyId (..) + ) import Cardano.Wallet.Primitive.Types.Tx.TxSeq.Gen - ( ShrinkableTxSeq, genTxSeq, getShrinkPhase, getTxSeq, shrinkTxSeq ) + ( ShrinkableTxSeq + , genTxSeq + , getShrinkPhase + , getTxSeq + , shrinkTxSeq + ) import Cardano.Wallet.Primitive.Types.UTxO.Gen - ( genUTxO ) + ( genUTxO + ) import Data.Function - ( (&) ) + ( (&) + ) import Data.Function.Utils - ( isInjectiveOver ) + ( isInjectiveOver + ) import Data.Maybe - ( fromMaybe, mapMaybe ) + ( fromMaybe + , mapMaybe + ) import Test.Hspec - ( Spec, describe, it ) + ( Spec + , describe + , it + ) import Test.QuickCheck ( Arbitrary (..) , CoArbitrary (..) @@ -54,7 +74,11 @@ import Test.QuickCheck , (==>) ) import Test.QuickCheck.Extra - ( ScaleDiv (..), genShrinkSequence, labelInterval, shrinkWhile ) + ( ScaleDiv (..) + , genShrinkSequence + , labelInterval + , shrinkWhile + ) import Test.QuickCheck.Instances.ByteString () diff --git a/lib/wallet/test/unit/Cardano/Wallet/Primitive/TypesSpec.hs b/lib/wallet/test/unit/Cardano/Wallet/Primitive/TypesSpec.hs index 7f99b2e076c..3d5daf5c3fc 100644 --- a/lib/wallet/test/unit/Cardano/Wallet/Primitive/TypesSpec.hs +++ b/lib/wallet/test/unit/Cardano/Wallet/Primitive/TypesSpec.hs @@ -18,17 +18,28 @@ module Cardano.Wallet.Primitive.TypesSpec import Prelude import Cardano.Address.Derivation - ( XPrv ) + ( XPrv + ) import Cardano.Pool.Types - ( PoolId (..), PoolOwner (..), decodePoolIdBech32, encodePoolIdBech32 ) + ( PoolId (..) + , PoolOwner (..) + , decodePoolIdBech32 + , encodePoolIdBech32 + ) import Cardano.Wallet.Address.Derivation - ( Depth (..) ) + ( Depth (..) + ) import Cardano.Wallet.Address.Derivation.Shelley - ( ShelleyKey, generateKeyFromSeed ) + ( ShelleyKey + , generateKeyFromSeed + ) import Cardano.Wallet.Address.Keys.WalletKey - ( digest, publicKey ) + ( digest + , publicKey + ) import Cardano.Wallet.Flavor - ( KeyFlavorS (ShelleyKeyS) ) + ( KeyFlavorS (ShelleyKeyS) + ) import Cardano.Wallet.Gen ( genActiveSlotCoefficient , genBlockHeader @@ -52,7 +63,9 @@ import Cardano.Wallet.Primitive.Slotting.Legacy , slotSucc ) import Cardano.Wallet.Primitive.SyncProgress - ( SyncTolerance (..), mkSyncTolerance ) + ( SyncTolerance (..) + , mkSyncTolerance + ) import Cardano.Wallet.Primitive.Types ( ActiveSlotCoefficient (..) , Block (..) @@ -89,27 +102,45 @@ import Cardano.Wallet.Primitive.Types , wholeRange ) import Cardano.Wallet.Primitive.Types.Address - ( Address (..), AddressState (..) ) + ( Address (..) + , AddressState (..) + ) import Cardano.Wallet.Primitive.Types.Coin - ( Coin (..) ) + ( Coin (..) + ) import Cardano.Wallet.Primitive.Types.Coin.Gen - ( genCoin ) + ( genCoin + ) import Cardano.Wallet.Primitive.Types.Hash - ( Hash (..) ) + ( Hash (..) + ) import Cardano.Wallet.Primitive.Types.RewardAccount - ( RewardAccount (..) ) + ( RewardAccount (..) + ) import Cardano.Wallet.Primitive.Types.Tx.Gen - ( genTx, shrinkTx ) + ( genTx + , shrinkTx + ) import Cardano.Wallet.Primitive.Types.Tx.Metadata.Gen - ( genNestedTxMetadata, shrinkTxMetadata ) + ( genNestedTxMetadata + , shrinkTxMetadata + ) import Cardano.Wallet.Primitive.Types.Tx.Tx - ( Tx (..), TxMetadata (..), TxMetadataValue (..) ) + ( Tx (..) + , TxMetadata (..) + , TxMetadataValue (..) + ) import Cardano.Wallet.Primitive.Types.Tx.TxIn - ( TxIn (..) ) + ( TxIn (..) + ) import Cardano.Wallet.Primitive.Types.Tx.TxMeta - ( Direction (..), TxMeta (..), TxStatus (..) ) + ( Direction (..) + , TxMeta (..) + , TxStatus (..) + ) import Cardano.Wallet.Primitive.Types.Tx.TxOut - ( TxOut (..) ) + ( TxOut (..) + ) import Cardano.Wallet.Primitive.Types.UTxO ( UTxO (..) , balance @@ -120,45 +151,78 @@ import Cardano.Wallet.Primitive.Types.UTxO , restrictedTo ) import Cardano.Wallet.Primitive.Types.UTxOStatistics - ( HistogramBar (..), UTxOStatistics (..) ) + ( HistogramBar (..) + , UTxOStatistics (..) + ) import Cardano.Wallet.Unsafe - ( someDummyMnemonic, unsafeFromHex ) + ( someDummyMnemonic + , unsafeFromHex + ) import Cardano.Wallet.Util - ( ShowFmt (..) ) + ( ShowFmt (..) + ) import Control.Monad - ( forM_, replicateM ) + ( forM_ + , replicateM + ) import Crypto.Hash - ( hash ) + ( hash + ) import Data.Either - ( isRight ) + ( isRight + ) import Data.Function - ( (&) ) + ( (&) + ) import Data.Function.Utils - ( applyN ) + ( applyN + ) import Data.IntCast - ( intCast ) + ( intCast + ) import Data.Maybe - ( fromMaybe, isJust, isNothing, mapMaybe ) + ( fromMaybe + , isJust + , isNothing + , mapMaybe + ) import Data.Proxy - ( Proxy (..) ) + ( Proxy (..) + ) import Data.Quantity - ( Quantity (..) ) + ( Quantity (..) + ) import Data.Set - ( Set, (\\) ) + ( Set + , (\\) + ) import Data.Text - ( Text ) + ( Text + ) import Data.Text.Class - ( TextDecodingError (..), fromText, toText ) + ( TextDecodingError (..) + , fromText + , toText + ) import Data.Time - ( Day (ModifiedJulianDay), UTCTime, toModifiedJulianDay, utctDay ) + ( Day (ModifiedJulianDay) + , UTCTime + , toModifiedJulianDay + , utctDay + ) import Data.Time.Utils - ( utcTimePred, utcTimeSucc ) + ( utcTimePred + , utcTimeSucc + ) import Data.Word - ( Word32 ) + ( Word32 + ) import Data.Word.Odd - ( Word31 ) + ( Word31 + ) import Fmt - ( pretty ) + ( pretty + ) import Test.Hspec ( Spec , anyErrorCall @@ -198,19 +262,31 @@ import Test.QuickCheck , (==>) ) import Test.QuickCheck.Arbitrary.Generic - ( genericArbitrary, genericShrink ) + ( genericArbitrary + , genericShrink + ) import Test.QuickCheck.Classes - ( eqLaws, ordLaws ) + ( eqLaws + , ordLaws + ) import Test.QuickCheck.Monadic - ( monadicIO, run ) + ( monadicIO + , run + ) import Test.Text.Roundtrip - ( textRoundtrip ) + ( textRoundtrip + ) import Test.Utils.Laws - ( testLawsMany ) + ( testLawsMany + ) import Test.Utils.Time - ( genUniformTime, genUniformTimeWithinRange, getUniformTime ) + ( genUniformTime + , genUniformTimeWithinRange + , getUniformTime + ) import UnliftIO.Exception - ( evaluate ) + ( evaluate + ) import qualified Cardano.Wallet.Primitive.Types.Coin as Coin import qualified Cardano.Wallet.Primitive.Types.TokenBundle as TokenBundle diff --git a/lib/wallet/test/unit/Cardano/Wallet/RegistrySpec.hs b/lib/wallet/test/unit/Cardano/Wallet/RegistrySpec.hs index d02f69b5e7a..9d2865d865f 100644 --- a/lib/wallet/test/unit/Cardano/Wallet/RegistrySpec.hs +++ b/lib/wallet/test/unit/Cardano/Wallet/RegistrySpec.hs @@ -13,9 +13,11 @@ module Cardano.Wallet.RegistrySpec import Prelude import Cardano.BM.Trace - ( nullTracer ) + ( nullTracer + ) import Cardano.Wallet.Primitive.Types - ( WalletId (..) ) + ( WalletId (..) + ) import Cardano.Wallet.Registry ( HasWorkerCtx (..) , MkWorker (..) @@ -26,29 +28,54 @@ import Cardano.Wallet.Registry , workerThread ) import Control.Exception.Base - ( AsyncException (..), asyncExceptionFromException ) + ( AsyncException (..) + , asyncExceptionFromException + ) import Control.Monad - ( replicateM, void ) + ( replicateM + , void + ) import Control.Tracer - ( Tracer ) + ( Tracer + ) import Crypto.Hash - ( hash ) + ( hash + ) import Data.Text - ( Text ) + ( Text + ) import GHC.Generics - ( Generic ) + ( Generic + ) import Test.Hspec - ( Spec, describe, it, shouldBe, shouldReturn ) + ( Spec + , describe + , it + , shouldBe + , shouldReturn + ) import Test.QuickCheck - ( Arbitrary (..), Positive (..), Property, generate, property ) + ( Arbitrary (..) + , Positive (..) + , Property + , generate + , property + ) import Test.QuickCheck.Monadic - ( monadicIO, run ) + ( monadicIO + , run + ) import UnliftIO.Async - ( race ) + ( race + ) import UnliftIO.Concurrent - ( threadDelay, throwTo ) + ( threadDelay + , throwTo + ) import UnliftIO.Exception - ( SomeException (..), throwIO ) + ( SomeException (..) + , throwIO + ) import UnliftIO.MVar ( modifyMVar_ , newEmptyMVar diff --git a/lib/wallet/test/unit/Cardano/Wallet/Shelley/CompatibilitySpec.hs b/lib/wallet/test/unit/Cardano/Wallet/Shelley/CompatibilitySpec.hs index b1e41e8e9be..f0e756c0509 100644 --- a/lib/wallet/test/unit/Cardano/Wallet/Shelley/CompatibilitySpec.hs +++ b/lib/wallet/test/unit/Cardano/Wallet/Shelley/CompatibilitySpec.hs @@ -16,7 +16,9 @@ module Cardano.Wallet.Shelley.CompatibilitySpec import Prelude import Cardano.Address.Derivation - ( XPrv, XPub ) + ( XPrv + , XPub + ) import Cardano.Address.Script ( KeyHash , KeyRole (..) @@ -27,11 +29,15 @@ import Cardano.Address.Script , toScriptHash ) import Cardano.Crypto.Hash.Class - ( digest ) + ( digest + ) import Cardano.Ledger.Core - ( PParams, ppDL ) + ( PParams + , ppDL + ) import Cardano.Ledger.Crypto - ( Crypto (..) ) + ( Crypto (..) + ) import Cardano.Mnemonic ( ConsistentEntropy , EntropySize @@ -40,35 +46,62 @@ import Cardano.Mnemonic , entropyToMnemonic ) import Cardano.Wallet.Address.Derivation - ( Depth (..), Index (getIndex), PaymentAddress (..), delegationAddress ) + ( Depth (..) + , Index (getIndex) + , PaymentAddress (..) + , delegationAddress + ) import Cardano.Wallet.Address.Derivation.Byron - ( ByronKey (..) ) + ( ByronKey (..) + ) import Cardano.Wallet.Address.Derivation.Shelley - ( ShelleyKey (..) ) + ( ShelleyKey (..) + ) import Cardano.Wallet.Address.Encoding - ( decodeAddress, decodeStakeAddress, encodeStakeAddress, inspectAddress ) + ( decodeAddress + , decodeStakeAddress + , encodeStakeAddress + , inspectAddress + ) import Cardano.Wallet.Address.Keys.WalletKey - ( publicKey ) + ( publicKey + ) import Cardano.Wallet.Flavor - ( KeyFlavor, keyFlavor ) + ( KeyFlavor + , keyFlavor + ) import Cardano.Wallet.Primitive.NetworkId - ( NetworkId (..), SNetworkId (..), withSNetworkId ) + ( NetworkId (..) + , SNetworkId (..) + , withSNetworkId + ) import Cardano.Wallet.Primitive.Types - ( SlotId (..), getDecentralizationLevel ) + ( SlotId (..) + , getDecentralizationLevel + ) import Cardano.Wallet.Primitive.Types.Address - ( Address (..) ) + ( Address (..) + ) import Cardano.Wallet.Primitive.Types.Coin - ( Coin (..) ) + ( Coin (..) + ) import Cardano.Wallet.Primitive.Types.Hash - ( Hash (..) ) + ( Hash (..) + ) import Cardano.Wallet.Primitive.Types.RewardAccount - ( RewardAccount (..) ) + ( RewardAccount (..) + ) import Cardano.Wallet.Primitive.Types.TokenBundle - ( TokenBundle ) + ( TokenBundle + ) import Cardano.Wallet.Primitive.Types.TokenBundle.Gen - ( genTokenBundle, genTokenBundleSmallRange, shrinkTokenBundleSmallRange ) + ( genTokenBundle + , genTokenBundleSmallRange + , shrinkTokenBundleSmallRange + ) import Cardano.Wallet.Primitive.Types.Tx.TxOut.Gen - ( genTxOutTokenBundle ) + ( genTxOutTokenBundle + ) import Cardano.Wallet.Shelley.Compatibility ( CardanoBlock , StandardCrypto @@ -83,47 +116,80 @@ import Cardano.Wallet.Shelley.Compatibility , toTip ) import Cardano.Wallet.Unsafe - ( unsafeIntToWord, unsafeMkEntropy ) + ( unsafeIntToWord + , unsafeMkEntropy + ) import Cardano.Wallet.Util - ( tryInternalError ) + ( tryInternalError + ) import Codec.Binary.Bech32.TH - ( humanReadablePart ) + ( humanReadablePart + ) import Codec.Binary.Encoding - ( fromBase16 ) + ( fromBase16 + ) import Control.Lens - ( (.~) ) + ( (.~) + ) import Control.Monad - ( forM_ ) + ( forM_ + ) import Data.ByteString - ( ByteString ) + ( ByteString + ) import Data.ByteString.Base58 - ( bitcoinAlphabet, encodeBase58 ) + ( bitcoinAlphabet + , encodeBase58 + ) import Data.Either - ( isLeft, isRight ) + ( isLeft + , isRight + ) import Data.Function - ( (&) ) + ( (&) + ) import Data.Maybe - ( fromMaybe ) + ( fromMaybe + ) import Data.Proxy - ( Proxy (..) ) + ( Proxy (..) + ) import Data.Ratio - ( Ratio, (%) ) + ( Ratio + , (%) + ) import Data.Text - ( Text ) + ( Text + ) import Data.Text.Class - ( toText ) + ( toText + ) import Data.Word - ( Word16, Word32, Word64 ) + ( Word16 + , Word32 + , Word64 + ) import GHC.TypeLits - ( natVal ) + ( natVal + ) import Ouroboros.Network.Block - ( BlockNo (..), SlotNo (..), Tip (..) ) + ( BlockNo (..) + , SlotNo (..) + , Tip (..) + ) import Test.Hspec - ( Spec, describe, it, shouldBe, shouldSatisfy ) + ( Spec + , describe + , it + , shouldBe + , shouldSatisfy + ) import Test.Hspec.Core.Spec - ( SpecWith ) + ( SpecWith + ) import Test.Hspec.QuickCheck - ( prop ) + ( prop + ) import Test.QuickCheck ( Arbitrary (..) , Gen @@ -143,7 +209,11 @@ import Test.QuickCheck , (===) ) import Test.QuickCheck.Monadic - ( assert, monadicIO, monitor, run ) + ( assert + , monadicIO + , monitor + , run + ) import qualified Cardano.Api as Cardano import qualified Cardano.Ledger.Address as SL diff --git a/lib/wallet/test/unit/Cardano/Wallet/Shelley/LaunchSpec.hs b/lib/wallet/test/unit/Cardano/Wallet/Shelley/LaunchSpec.hs index a02635326b4..b32573e12ef 100644 --- a/lib/wallet/test/unit/Cardano/Wallet/Shelley/LaunchSpec.hs +++ b/lib/wallet/test/unit/Cardano/Wallet/Shelley/LaunchSpec.hs @@ -10,13 +10,23 @@ import Prelude -- See ADP-1910 import Cardano.Wallet.CLI - ( nodeSocketOption ) + ( nodeSocketOption + ) import "optparse-applicative" Options.Applicative - ( ParserResult (..), defaultPrefs, execParserPure, info ) + ( ParserResult (..) + , defaultPrefs + , execParserPure + , info + ) import Test.Hspec - ( Spec, describe, it, shouldSatisfy ) + ( Spec + , describe + , it + , shouldSatisfy + ) import Test.Utils.Platform - ( isWindows ) + ( isWindows + ) spec :: Spec spec = describe "Shelley CLI" $ diff --git a/lib/wallet/test/unit/Cardano/Wallet/Shelley/NetworkSpec.hs b/lib/wallet/test/unit/Cardano/Wallet/Shelley/NetworkSpec.hs index d48353ff5ca..db19519afef 100644 --- a/lib/wallet/test/unit/Cardano/Wallet/Shelley/NetworkSpec.hs +++ b/lib/wallet/test/unit/Cardano/Wallet/Shelley/NetworkSpec.hs @@ -7,11 +7,15 @@ module Cardano.Wallet.Shelley.NetworkSpec (spec) where import Prelude import Cardano.BM.Data.Severity - ( Severity (..) ) + ( Severity (..) + ) import Cardano.BM.Trace - ( nullTracer, traceInTVarIO ) + ( nullTracer + , traceInTVarIO + ) import Cardano.Launcher.Node - ( CardanoNodeConn ) + ( CardanoNodeConn + ) import Cardano.Wallet.Launch.Cluster ( ClusterEra (..) , ClusterLog (..) @@ -21,53 +25,104 @@ import Cardano.Wallet.Launch.Cluster , withCluster ) import Cardano.Wallet.Network - ( NetworkLayer (..) ) + ( NetworkLayer (..) + ) import Cardano.Wallet.Primitive.SyncProgress - ( SyncTolerance (..) ) + ( SyncTolerance (..) + ) import Cardano.Wallet.Primitive.Types - ( NetworkParameters (..) ) + ( NetworkParameters (..) + ) import Cardano.Wallet.Shelley.Compatibility - ( fromGenesisData ) + ( fromGenesisData + ) import Cardano.Wallet.Shelley.Network.Node - ( Observer (..), ObserverLog (..), newObserver, withNetworkLayer ) + ( Observer (..) + , ObserverLog (..) + , newObserver + , withNetworkLayer + ) import Control.Monad - ( replicateM, unless, void ) + ( replicateM + , unless + , void + ) import Control.Tracer - ( Tracer, contramap ) + ( Tracer + , contramap + ) import Data.Map - ( Map ) + ( Map + ) import Data.Set - ( Set ) + ( Set + ) import Data.Tagged - ( Tagged (..) ) + ( Tagged (..) + ) import Fmt - ( build, fmt, indentF ) + ( build + , fmt + , indentF + ) import Ouroboros.Network.Client.Wallet - ( tunedForMainnetPipeliningStrategy ) + ( tunedForMainnetPipeliningStrategy + ) import Ouroboros.Network.NodeToClient - ( NodeToClientVersionData ) + ( NodeToClientVersionData + ) import System.Environment - ( getEnv ) + ( getEnv + ) import System.Environment.Extended - ( isEnvSet ) + ( isEnvSet + ) import System.IO.Temp.Extra - ( SkipCleanup (..), withSystemTempDir ) + ( SkipCleanup (..) + , withSystemTempDir + ) import Test.Hspec - ( Spec, beforeAll, describe, it, shouldBe, shouldReturn ) + ( Spec + , beforeAll + , describe + , it + , shouldBe + , shouldReturn + ) import Test.Hspec.Core.Spec - ( sequential ) + ( sequential + ) import Test.QuickCheck - ( counterexample, property ) + ( counterexample + , property + ) import Test.QuickCheck.Monadic - ( PropertyM, assert, monadicIO, monitor, run ) + ( PropertyM + , assert + , monadicIO + , monitor + , run + ) import Test.Utils.Trace - ( traceSpec ) + ( traceSpec + ) import UnliftIO.Async - ( async, race_, waitAnyCancel ) + ( async + , race_ + , waitAnyCancel + ) import UnliftIO.MVar - ( newEmptyMVar, putMVar, takeMVar ) + ( newEmptyMVar + , putMVar + , takeMVar + ) import UnliftIO.STM - ( TVar, atomically, newTVarIO, readTVar, writeTVar ) + ( TVar + , atomically + , newTVarIO + , readTVar + , writeTVar + ) import qualified Cardano.Wallet.Launch.Cluster as Cluster import qualified Data.Map as Map diff --git a/lib/wallet/test/unit/Cardano/Wallet/Shelley/TransactionSpec.hs b/lib/wallet/test/unit/Cardano/Wallet/Shelley/TransactionSpec.hs index 3e6a3c6d01e..9118ad53a7e 100644 --- a/lib/wallet/test/unit/Cardano/Wallet/Shelley/TransactionSpec.hs +++ b/lib/wallet/test/unit/Cardano/Wallet/Shelley/TransactionSpec.hs @@ -30,9 +30,18 @@ module Cardano.Wallet.Shelley.TransactionSpec (spec) where import Prelude import Cardano.Address.Derivation - ( XPrv, XPub, toXPub, xprvFromBytes, xprvToBytes, xpubPublicKey ) + ( XPrv + , XPub + , toXPub + , xprvFromBytes + , xprvToBytes + , xpubPublicKey + ) import Cardano.Address.Script - ( KeyHash (..), KeyRole (Delegation, Payment), Script (..) ) + ( KeyHash (..) + , KeyRole (Delegation, Payment) + , Script (..) + ) import Cardano.Api ( AnyCardanoEra (..) , CardanoEra (..) @@ -43,23 +52,44 @@ import Cardano.Api , ShelleyBasedEra (..) ) import Cardano.Api.Gen - ( genTx, genTxBodyContent, genTxInEra, genWitnesses ) + ( genTx + , genTxBodyContent + , genTxInEra + , genWitnesses + ) import Cardano.Mnemonic - ( SomeMnemonic (SomeMnemonic) ) + ( SomeMnemonic (SomeMnemonic) + ) import Cardano.Wallet - ( Fee (..), Percentile (..), calculateFeePercentiles, signTransaction ) + ( Fee (..) + , Percentile (..) + , calculateFeePercentiles + , signTransaction + ) import Cardano.Wallet.Address.Derivation - ( Depth (..), deriveRewardAccount, hex, paymentAddress ) + ( Depth (..) + , deriveRewardAccount + , hex + , paymentAddress + ) import Cardano.Wallet.Address.Derivation.Shelley - ( ShelleyKey ) + ( ShelleyKey + ) import Cardano.Wallet.Address.Keys.WalletKey - ( getRawKey, liftRawKey, publicKey ) + ( getRawKey + , liftRawKey + , publicKey + ) import Cardano.Wallet.Flavor - ( KeyFlavorS (..) ) + ( KeyFlavorS (..) + ) import Cardano.Wallet.Gen - ( genMnemonic, genScript ) + ( genMnemonic + , genScript + ) import Cardano.Wallet.Primitive.NetworkId - ( SNetworkId (..) ) + ( SNetworkId (..) + ) import Cardano.Wallet.Primitive.Passphrase ( Passphrase (..) , PassphraseMaxLength (..) @@ -68,23 +98,38 @@ import Cardano.Wallet.Primitive.Passphrase , preparePassphrase ) import Cardano.Wallet.Primitive.Types.Address - ( Address (..) ) + ( Address (..) + ) import Cardano.Wallet.Primitive.Types.Coin - ( Coin (..) ) + ( Coin (..) + ) import Cardano.Wallet.Primitive.Types.Coin.Gen - ( genCoinPositive, shrinkCoinPositive ) + ( genCoinPositive + , shrinkCoinPositive + ) import Cardano.Wallet.Primitive.Types.Credentials - ( ClearCredentials, RootCredentials (..) ) + ( ClearCredentials + , RootCredentials (..) + ) import Cardano.Wallet.Primitive.Types.Hash - ( Hash (..) ) + ( Hash (..) + ) import Cardano.Wallet.Primitive.Types.TokenBundle - ( AssetId, TokenBundle ) + ( AssetId + , TokenBundle + ) import Cardano.Wallet.Primitive.Types.TokenBundle.Gen - ( genTokenBundleSmallRange, shrinkTokenBundleSmallRange ) + ( genTokenBundleSmallRange + , shrinkTokenBundleSmallRange + ) import Cardano.Wallet.Primitive.Types.TokenPolicy - ( TokenName (UnsafeTokenName), TokenPolicyId ) + ( TokenName (UnsafeTokenName) + , TokenPolicyId + ) import Cardano.Wallet.Primitive.Types.TokenPolicy.Gen - ( genTokenPolicyId, shrinkTokenPolicyId ) + ( genTokenPolicyId + , shrinkTokenPolicyId + ) import Cardano.Wallet.Primitive.Types.Tx ( SealedTx (..) , TxMetadata (..) @@ -98,23 +143,34 @@ import Cardano.Wallet.Primitive.Types.Tx , serialisedTx ) import Cardano.Wallet.Primitive.Types.Tx.Constraints - ( TxConstraints (..), TxSize (..) ) + ( TxConstraints (..) + , TxSize (..) + ) import Cardano.Wallet.Primitive.Types.Tx.TxIn - ( TxIn (..) ) + ( TxIn (..) + ) import Cardano.Wallet.Primitive.Types.Tx.TxIn.Gen - ( genTxIn ) + ( genTxIn + ) import Cardano.Wallet.Primitive.Types.Tx.TxOut - ( TxOut (..) ) + ( TxOut (..) + ) import Cardano.Wallet.Primitive.Types.Tx.TxOut.Gen - ( genTxOutTokenBundle ) + ( genTxOutTokenBundle + ) import Cardano.Wallet.Primitive.Types.UTxO - ( UTxO (..) ) + ( UTxO (..) + ) import Cardano.Wallet.Read.Primitive.Tx.Features.Integrity - ( txIntegrity ) + ( txIntegrity + ) import Cardano.Wallet.Read.Tx.Cardano - ( fromCardanoApiTx ) + ( fromCardanoApiTx + ) import Cardano.Wallet.Shelley.Compatibility - ( toCardanoLovelace, toCardanoTxIn ) + ( toCardanoLovelace + , toCardanoTxIn + ) import Cardano.Wallet.Shelley.Transaction ( EraConstraints , TxWitnessTag (..) @@ -131,49 +187,83 @@ import Cardano.Wallet.Transaction , selectionDelta ) import Cardano.Wallet.Unsafe - ( unsafeFromHex ) + ( unsafeFromHex + ) import Cardano.Write.Tx - ( ErrBalanceTx (..), ErrBalanceTxUnableToCreateChangeError (..) ) + ( ErrBalanceTx (..) + , ErrBalanceTxUnableToCreateChangeError (..) + ) import Control.Arrow - ( first ) + ( first + ) import Control.Monad - ( replicateM ) + ( replicateM + ) import Control.Monad.Random - ( MonadRandom (..), Random (randomR, randomRs), random, randoms ) + ( MonadRandom (..) + , Random (randomR, randomRs) + , random + , randoms + ) import Control.Monad.Trans.Except - ( except, runExceptT ) + ( except + , runExceptT + ) import Crypto.Hash.Extra - ( blake2b224 ) + ( blake2b224 + ) import Data.ByteString - ( ByteString ) + ( ByteString + ) import Data.Either - ( isRight ) + ( isRight + ) import Data.Function - ( on, (&) ) + ( on + , (&) + ) import Data.IntCast - ( intCast ) + ( intCast + ) import Data.List - ( nub ) + ( nub + ) import Data.List.NonEmpty - ( NonEmpty (..) ) + ( NonEmpty (..) + ) import Data.Map.Strict - ( Map ) + ( Map + ) import Data.Maybe - ( fromJust, isJust ) + ( fromJust + , isJust + ) import Data.Ord - ( comparing ) + ( comparing + ) import Data.Proxy - ( Proxy (..) ) + ( Proxy (..) + ) import Data.Quantity - ( Quantity (..) ) + ( Quantity (..) + ) import Data.Ratio - ( (%) ) + ( (%) + ) import Data.Semigroup - ( mtimesDefault ) + ( mtimesDefault + ) import Data.Word - ( Word16, Word64, Word8 ) + ( Word16 + , Word64 + , Word8 + ) import Fmt - ( Buildable (..), pretty, (+||), (||+) ) + ( Buildable (..) + , pretty + , (+||) + , (||+) + ) import Internal.Cardano.Write.Tx ( AnyRecentEra (..) , RecentEra (..) @@ -181,15 +271,26 @@ import Internal.Cardano.Write.Tx , shelleyBasedEraFromRecentEra ) import Internal.Cardano.Write.Tx.SizeEstimation - ( TxSkeleton (..), estimateTxSize ) + ( TxSkeleton (..) + , estimateTxSize + ) import Numeric.Natural - ( Natural ) + ( Natural + ) import Ouroboros.Network.Block - ( SlotNo (..) ) + ( SlotNo (..) + ) import Test.Hspec - ( Spec, describe, it, pendingWith, shouldBe, shouldSatisfy ) + ( Spec + , describe + , it + , pendingWith + , shouldBe + , shouldSatisfy + ) import Test.Hspec.QuickCheck - ( prop ) + ( prop + ) import Test.QuickCheck ( Arbitrary (..) , InfiniteList (..) @@ -217,13 +318,21 @@ import Test.QuickCheck , (===) ) import Test.QuickCheck.Extra - ( chooseNatural, genNonEmpty, shrinkNonEmpty ) + ( chooseNatural + , genNonEmpty + , shrinkNonEmpty + ) import Test.QuickCheck.Gen - ( Gen (..), listOf1 ) + ( Gen (..) + , listOf1 + ) import Test.QuickCheck.Random - ( QCGen ) + ( QCGen + ) import Test.Utils.Pretty - ( Pretty (..), (====) ) + ( Pretty (..) + , (====) + ) import qualified Cardano.Api as Cardano import qualified Cardano.Api.Shelley as Cardano diff --git a/lib/wallet/test/unit/Cardano/Wallet/Submissions/Gen.hs b/lib/wallet/test/unit/Cardano/Wallet/Submissions/Gen.hs index d2de958104e..a7296cafa5c 100644 --- a/lib/wallet/test/unit/Cardano/Wallet/Submissions/Gen.hs +++ b/lib/wallet/test/unit/Cardano/Wallet/Submissions/Gen.hs @@ -19,29 +19,61 @@ module Cardano.Wallet.Submissions.Gen import Prelude import Cardano.Wallet.Submissions.Properties.Common - ( Step (..), newState ) + ( Step (..) + , newState + ) import Cardano.Wallet.Submissions.Submissions - ( Submissions (..), transactionsL, txStatus ) + ( Submissions (..) + , transactionsL + , txStatus + ) import Cardano.Wallet.Submissions.TxStatus - ( HasTxId (..), getTx, _Expired, _InLedger, _InSubmission ) + ( HasTxId (..) + , getTx + , _Expired + , _InLedger + , _InSubmission + ) import Control.Arrow - ( (&&&) ) + ( (&&&) + ) import Control.Lens - ( lastOf, to, view, (&), _2 ) + ( lastOf + , to + , view + , (&) + , _2 + ) import Control.Lens.Extras - ( is ) + ( is + ) import Data.Foldable - ( toList ) + ( toList + ) import Data.Maybe - ( fromJust ) + ( fromJust + ) import System.Random - ( Random ) + ( Random + ) import Test.QuickCheck - ( Arbitrary (..), Gen, choose, elements, frequency, getSize ) + ( Arbitrary (..) + , Gen + , choose + , elements + , frequency + , getSize + ) import Test.QuickCheck.Property - ( Property, conjoin, cover, forAllShrinkShow, mapSize ) + ( Property + , conjoin + , cover + , forAllShrinkShow + , mapSize + ) import Text.Pretty.Simple - ( pShow ) + ( pShow + ) import qualified Data.Map.Strict as Map import qualified Data.Text.Lazy as T diff --git a/lib/wallet/test/unit/Cardano/Wallet/Submissions/OperationsSpec.hs b/lib/wallet/test/unit/Cardano/Wallet/Submissions/OperationsSpec.hs index 6640aa14172..de6cd8943ae 100644 --- a/lib/wallet/test/unit/Cardano/Wallet/Submissions/OperationsSpec.hs +++ b/lib/wallet/test/unit/Cardano/Wallet/Submissions/OperationsSpec.hs @@ -8,21 +8,40 @@ module Cardano.Wallet.Submissions.OperationsSpec import Prelude import Cardano.Wallet.Submissions.Gen - ( GenSubmissionsHistory (..), genSlot, genTx, prop_submissionHistory ) + ( GenSubmissionsHistory (..) + , genSlot + , genTx + , prop_submissionHistory + ) import Cardano.Wallet.Submissions.Operations - ( Operation (..), applyOperations ) + ( Operation (..) + , applyOperations + ) import Cardano.Wallet.Submissions.Properties.Operations - ( properties ) + ( properties + ) import Cardano.Wallet.Submissions.Submissions - ( Submissions ) + ( Submissions + ) import Cardano.Wallet.Submissions.TxStatus - ( HasTxId (..) ) + ( HasTxId (..) + ) import System.Random - ( Random ) + ( Random + ) import Test.Hspec - ( Spec, describe, it ) + ( Spec + , describe + , it + ) import Test.QuickCheck - ( Arbitrary, Gen, Testable (..), frequency, listOf, scale ) + ( Arbitrary + , Gen + , Testable (..) + , frequency + , listOf + , scale + ) spec :: Spec spec = do diff --git a/lib/wallet/test/unit/Cardano/Wallet/Submissions/PrimitivesSpec.hs b/lib/wallet/test/unit/Cardano/Wallet/Submissions/PrimitivesSpec.hs index 2ae34999ca4..73d5637cfff 100644 --- a/lib/wallet/test/unit/Cardano/Wallet/Submissions/PrimitivesSpec.hs +++ b/lib/wallet/test/unit/Cardano/Wallet/Submissions/PrimitivesSpec.hs @@ -9,21 +9,38 @@ module Cardano.Wallet.Submissions.PrimitivesSpec import Prelude import Cardano.Wallet.Submissions.Gen - ( GenSubmissionsHistory (..), genSlot, genTx, prop_submissionHistory ) + ( GenSubmissionsHistory (..) + , genSlot + , genTx + , prop_submissionHistory + ) import Cardano.Wallet.Submissions.Primitives - ( Primitive (..), applyPrimitive ) + ( Primitive (..) + , applyPrimitive + ) import Cardano.Wallet.Submissions.Properties.Primitives - ( properties ) + ( properties + ) import Cardano.Wallet.Submissions.Submissions - ( Submissions ) + ( Submissions + ) import Cardano.Wallet.Submissions.TxStatus - ( HasTxId (..) ) + ( HasTxId (..) + ) import System.Random - ( Random ) + ( Random + ) import Test.Hspec - ( Spec, describe, it ) + ( Spec + , describe + , it + ) import Test.QuickCheck - ( Arbitrary, Gen, Testable (..), frequency ) + ( Arbitrary + , Gen + , Testable (..) + , frequency + ) spec :: Spec spec = do diff --git a/lib/wallet/test/unit/Cardano/Wallet/TokenMetadataSpec.hs b/lib/wallet/test/unit/Cardano/Wallet/TokenMetadataSpec.hs index 6ec3d606d99..a71342ce43b 100644 --- a/lib/wallet/test/unit/Cardano/Wallet/TokenMetadataSpec.hs +++ b/lib/wallet/test/unit/Cardano/Wallet/TokenMetadataSpec.hs @@ -10,9 +10,11 @@ module Cardano.Wallet.TokenMetadataSpec import Prelude import Cardano.Wallet.Primitive.Types.Hash - ( Hash (..) ) + ( Hash (..) + ) import Cardano.Wallet.Primitive.Types.TokenMap - ( AssetId (..) ) + ( AssetId (..) + ) import Cardano.Wallet.Primitive.Types.TokenPolicy ( AssetDecimals (..) , AssetLogo (..) @@ -32,25 +34,46 @@ import Cardano.Wallet.TokenMetadata , newMetadataClient ) import Cardano.Wallet.TokenMetadata.MockServer - ( assetIdFromSubject, queryServerStatic, withMetadataServer ) + ( assetIdFromSubject + , queryServerStatic + , withMetadataServer + ) import Cardano.Wallet.Unsafe - ( unsafeFromBase64, unsafeFromHex, unsafeFromText ) + ( unsafeFromBase64 + , unsafeFromHex + , unsafeFromText + ) import Data.Aeson - ( Value (..), eitherDecodeFileStrict ) + ( Value (..) + , eitherDecodeFileStrict + ) import Data.Either - ( isRight ) + ( isRight + ) import Data.Maybe - ( isNothing ) + ( isNothing + ) import Network.URI - ( parseURI ) + ( parseURI + ) import System.FilePath - ( () ) + ( () + ) import Test.Hspec - ( Spec, describe, it, shouldBe, shouldNotBe, shouldReturn, shouldSatisfy ) + ( Spec + , describe + , it + , shouldBe + , shouldNotBe + , shouldReturn + , shouldSatisfy + ) import Test.Utils.Paths - ( getTestData ) + ( getTestData + ) import Test.Utils.Trace - ( traceSpec ) + ( traceSpec + ) spec :: Spec spec = do diff --git a/lib/wallet/test/unit/Cardano/WalletSpec.hs b/lib/wallet/test/unit/Cardano/WalletSpec.hs index 9c443bef545..db7b9e11422 100644 --- a/lib/wallet/test/unit/Cardano/WalletSpec.hs +++ b/lib/wallet/test/unit/Cardano/WalletSpec.hs @@ -25,11 +25,16 @@ module Cardano.WalletSpec import Prelude import Cardano.Address.Derivation - ( XPrv, xpubToBytes ) + ( XPrv + , xpubToBytes + ) import Cardano.Api - ( AnyCardanoEra (..), CardanoEra (..) ) + ( AnyCardanoEra (..) + , CardanoEra (..) + ) import Cardano.Mnemonic - ( SomeMnemonic (..) ) + ( SomeMnemonic (..) + ) import Cardano.Wallet ( ErrUpdatePassphrase (..) , ErrWithRootKey (..) @@ -50,25 +55,46 @@ import Cardano.Wallet.Address.Derivation , deriveAccountPrivateKey ) import Cardano.Wallet.Address.Derivation.Shelley - ( ShelleyKey (..), generateKeyFromSeed ) + ( ShelleyKey (..) + , generateKeyFromSeed + ) import Cardano.Wallet.Address.Discovery - ( CompareDiscovery (..), GenChange (..), IsOurs (..), KnownAddresses (..) ) + ( CompareDiscovery (..) + , GenChange (..) + , IsOurs (..) + , KnownAddresses (..) + ) import Cardano.Wallet.Address.Keys.WalletKey - ( publicKey ) + ( publicKey + ) import Cardano.Wallet.Address.States.Features - ( TestFeatures (..), defaultTestFeatures ) + ( TestFeatures (..) + , defaultTestFeatures + ) import Cardano.Wallet.Address.States.Test.State - ( TestState (..) ) + ( TestState (..) + ) import Cardano.Wallet.Balance.Migration.SelectionSpec - ( MockTxConstraints (..), genTokenBundleMixed, unMockTxConstraints ) + ( MockTxConstraints (..) + , genTokenBundleMixed + , unMockTxConstraints + ) import Cardano.Wallet.DB - ( DBFresh, DBLayer (..), hoistDBFresh, hoistDBLayer, putTxHistory ) + ( DBFresh + , DBLayer (..) + , hoistDBFresh + , hoistDBLayer + , putTxHistory + ) import Cardano.Wallet.DB.Fixtures - ( logScale' ) + ( logScale' + ) import Cardano.Wallet.DB.Layer - ( newDBFreshInMemory ) + ( newDBFreshInMemory + ) import Cardano.Wallet.DB.Store.Submissions.Operations - ( TxSubmissionsStatus ) + ( TxSubmissionsStatus + ) import Cardano.Wallet.DummyTarget.Primitive.Types ( block0 , dummyNetworkLayer @@ -78,17 +104,28 @@ import Cardano.Wallet.DummyTarget.Primitive.Types , mkTxId ) import Cardano.Wallet.Flavor - ( CredFromOf, KeyFlavorS (ShelleyKeyS), KeyOf, WalletFlavorS (TestStateS) ) + ( CredFromOf + , KeyFlavorS (ShelleyKeyS) + , KeyOf + , WalletFlavorS (TestStateS) + ) import Cardano.Wallet.Gen - ( genMnemonic, genSlotNo ) + ( genMnemonic + , genSlotNo + ) import Cardano.Wallet.Network - ( NetworkLayer (..) ) + ( NetworkLayer (..) + ) import Cardano.Wallet.Primitive.NetworkId - ( NetworkDiscriminant (Mainnet) ) + ( NetworkDiscriminant (Mainnet) + ) import Cardano.Wallet.Primitive.Passphrase - ( ErrWrongPassphrase (..), Passphrase (..) ) + ( ErrWrongPassphrase (..) + , Passphrase (..) + ) import Cardano.Wallet.Primitive.Passphrase.Current - ( preparePassphrase ) + ( preparePassphrase + ) import Cardano.Wallet.Primitive.Types ( ActiveSlotCoefficient (..) , BlockHeader (BlockHeader) @@ -101,41 +138,65 @@ import Cardano.Wallet.Primitive.Types , WalletName (..) ) import Cardano.Wallet.Primitive.Types.Address - ( Address (..) ) + ( Address (..) + ) import Cardano.Wallet.Primitive.Types.Address.Gen - ( genAddress ) + ( genAddress + ) import Cardano.Wallet.Primitive.Types.Coin - ( Coin (..) ) + ( Coin (..) + ) import Cardano.Wallet.Primitive.Types.Coin.Gen - ( genCoinPositive ) + ( genCoinPositive + ) import Cardano.Wallet.Primitive.Types.Hash - ( Hash (..) ) + ( Hash (..) + ) import Cardano.Wallet.Primitive.Types.RewardAccount - ( RewardAccount (..) ) + ( RewardAccount (..) + ) import Cardano.Wallet.Primitive.Types.TokenBundle - ( TokenBundle (TokenBundle), getAssets ) + ( TokenBundle (TokenBundle) + , getAssets + ) import Cardano.Wallet.Primitive.Types.TokenMap.Gen - ( genAssetIdLargeRange ) + ( genAssetIdLargeRange + ) import Cardano.Wallet.Primitive.Types.TokenQuantity.Gen - ( genTokenQuantityPositive ) + ( genTokenQuantityPositive + ) import Cardano.Wallet.Primitive.Types.Tx - ( SealedTx (..), Tx (..), mockSealedTx ) + ( SealedTx (..) + , Tx (..) + , mockSealedTx + ) import Cardano.Wallet.Primitive.Types.Tx.Constraints - ( txOutMaxCoin ) + ( txOutMaxCoin + ) import Cardano.Wallet.Primitive.Types.Tx.Gen - ( genTx, shrinkTx ) + ( genTx + , shrinkTx + ) import Cardano.Wallet.Primitive.Types.Tx.TransactionInfo - ( TransactionInfo (..) ) + ( TransactionInfo (..) + ) import Cardano.Wallet.Primitive.Types.Tx.TxIn - ( TxIn (..) ) + ( TxIn (..) + ) import Cardano.Wallet.Primitive.Types.Tx.TxIn.Gen - ( genTxInLargeRange ) + ( genTxInLargeRange + ) import Cardano.Wallet.Primitive.Types.Tx.TxMeta - ( Direction (..), TxMeta (..), TxStatus (..) ) + ( Direction (..) + , TxMeta (..) + , TxStatus (..) + ) import Cardano.Wallet.Primitive.Types.Tx.TxOut - ( TxOut (..) ) + ( TxOut (..) + ) import Cardano.Wallet.Primitive.Types.UTxO - ( UTxO (..) ) + ( UTxO (..) + ) import Cardano.Wallet.Transaction ( TransactionLayer (..) , Withdrawal (..) @@ -143,79 +204,151 @@ import Cardano.Wallet.Transaction , emptyWitnessCount ) import Cardano.Wallet.Transaction.Built - ( BuiltTx (..) ) + ( BuiltTx (..) + ) import Cardano.Wallet.Unsafe - ( unsafeRunExceptT ) + ( unsafeRunExceptT + ) import Cardano.Wallet.Util - ( HasCallStack ) + ( HasCallStack + ) import Cardano.Write.Tx - ( ErrBalanceTx (..), ErrBalanceTxAssetsInsufficientError (..) ) + ( ErrBalanceTx (..) + , ErrBalanceTxAssetsInsufficientError (..) + ) import Control.DeepSeq - ( NFData (..) ) + ( NFData (..) + ) import Control.Monad - ( forM_, guard, replicateM, void ) + ( forM_ + , guard + , replicateM + , void + ) import Control.Monad.Class.MonadTime - ( MonadMonotonicTimeNSec (..), MonadTime (..), UTCTime ) + ( MonadMonotonicTimeNSec (..) + , MonadTime (..) + , UTCTime + ) import Control.Monad.Class.MonadTime.SI - ( MonadMonotonicTime, Time (..), addTime, diffTime ) + ( MonadMonotonicTime + , Time (..) + , addTime + , diffTime + ) import Control.Monad.IO.Unlift - ( MonadIO (..), MonadUnliftIO (..), wrappedWithRunInIO ) + ( MonadIO (..) + , MonadUnliftIO (..) + , wrappedWithRunInIO + ) import Control.Monad.Trans.Class - ( lift ) + ( lift + ) import Control.Monad.Trans.Except - ( ExceptT (..), except, runExceptT ) + ( ExceptT (..) + , except + , runExceptT + ) import Control.Monad.Trans.Maybe - ( MaybeT (..) ) + ( MaybeT (..) + ) import Control.Monad.Trans.Reader - ( ReaderT (..), ask ) + ( ReaderT (..) + , ask + ) import Control.Monad.Trans.State.Strict - ( State, StateT (..), evalState, get, put, state ) + ( State + , StateT (..) + , evalState + , get + , put + , state + ) import Control.Tracer - ( natTracer, nullTracer ) + ( natTracer + , nullTracer + ) import Crypto.Hash - ( hash ) + ( hash + ) import Data.Bifunctor - ( second ) + ( second + ) import Data.ByteString - ( ByteString ) + ( ByteString + ) import Data.Coerce - ( coerce ) + ( coerce + ) import Data.Either - ( isLeft ) + ( isLeft + ) import Data.Function - ( on ) + ( on + ) import Data.Functor.Identity - ( Identity (..) ) + ( Identity (..) + ) import Data.Generics.Internal.VL - ( iso, view, (^.) ) + ( iso + , view + , (^.) + ) import Data.List - ( nubBy, sort, sortOn ) + ( nubBy + , sort + , sortOn + ) import Data.List.NonEmpty - ( NonEmpty (..) ) + ( NonEmpty (..) + ) import Data.Map - ( Map ) + ( Map + ) import Data.Maybe - ( catMaybes, fromMaybe, isJust, isNothing, mapMaybe ) + ( catMaybes + , fromMaybe + , isJust + , isNothing + , mapMaybe + ) import Data.Ord - ( Down (..) ) + ( Down (..) + ) import Data.Quantity - ( Quantity (..) ) + ( Quantity (..) + ) import Data.Text.Class - ( ToText (..) ) + ( ToText (..) + ) import Data.Time.Clock - ( DiffTime, diffTimeToPicoseconds, picosecondsToDiffTime ) + ( DiffTime + , diffTimeToPicoseconds + , picosecondsToDiffTime + ) import Data.Time.Clock.POSIX - ( posixSecondsToUTCTime ) + ( posixSecondsToUTCTime + ) import Data.Word - ( Word64 ) + ( Word64 + ) import GHC.Generics - ( Generic ) + ( Generic + ) import Internal.Cardano.Write.Tx.SizeEstimation - ( TxWitnessTag (..) ) + ( TxWitnessTag (..) + ) import System.Random - ( Random ) + ( Random + ) import Test.Hspec - ( Spec, describe, it, shouldBe, shouldSatisfy, xit ) + ( Spec + , describe + , it + , shouldBe + , shouldSatisfy + , xit + ) import Test.QuickCheck ( Arbitrary (..) , Blind (..) @@ -247,13 +380,21 @@ import Test.QuickCheck , (==>) ) import Test.QuickCheck.Extra - ( report ) + ( report + ) import Test.QuickCheck.Monadic - ( PropertyM, assert, monadicIO, monitor, run ) + ( PropertyM + , assert + , monadicIO + , monitor + , run + ) import Test.Utils.Time - ( UniformTime ) + ( UniformTime + ) import Test.Utils.Trace - ( captureLogging' ) + ( captureLogging' + ) import UnliftIO.Concurrent ( MVar , modifyMVar diff --git a/lib/wallet/test/unit/Control/Concurrent/ConciergeSpec.hs b/lib/wallet/test/unit/Control/Concurrent/ConciergeSpec.hs index b9eb2601ba7..e276eaf651b 100644 --- a/lib/wallet/test/unit/Control/Concurrent/ConciergeSpec.hs +++ b/lib/wallet/test/unit/Control/Concurrent/ConciergeSpec.hs @@ -10,21 +10,36 @@ module Control.Concurrent.ConciergeSpec import Prelude import Control.Concurrent.Concierge - ( atomicallyWithLifted, newConcierge ) + ( atomicallyWithLifted + , newConcierge + ) import Control.Monad.Class.MonadFork - ( forkIO ) + ( forkIO + ) import Control.Monad.Class.MonadSay - ( say ) + ( say + ) import Control.Monad.Class.MonadThrow - ( throwIO, try ) + ( throwIO + , try + ) import Control.Monad.Class.MonadTimer - ( threadDelay ) + ( threadDelay + ) import Control.Monad.IOSim - ( IOSim, runSimTrace, selectTraceEventsSay ) + ( IOSim + , runSimTrace + , selectTraceEventsSay + ) import Test.Hspec - ( Spec, describe, it ) + ( Spec + , describe + , it + ) import Test.QuickCheck - ( Property, (===) ) + ( Property + , (===) + ) spec :: Spec spec = diff --git a/lib/wallet/test/unit/Control/Monad/UtilSpec.hs b/lib/wallet/test/unit/Control/Monad/UtilSpec.hs index 0510d3e8b6a..a9dae12a455 100644 --- a/lib/wallet/test/unit/Control/Monad/UtilSpec.hs +++ b/lib/wallet/test/unit/Control/Monad/UtilSpec.hs @@ -14,17 +14,25 @@ module Control.Monad.UtilSpec import Prelude import Control.Monad - ( (<=<) ) + ( (<=<) + ) import Control.Monad.Identity - ( Identity (..) ) + ( Identity (..) + ) import Control.Monad.Util - ( applyNM ) + ( applyNM + ) import Data.Function - ( (&) ) + ( (&) + ) import Data.Function.Utils - ( applyN ) + ( applyN + ) import Test.Hspec - ( Spec, describe, it ) + ( Spec + , describe + , it + ) import Test.QuickCheck ( Fun (..) , NonNegative (..) diff --git a/lib/wallet/test/unit/Data/Function/UtilsSpec.hs b/lib/wallet/test/unit/Data/Function/UtilsSpec.hs index 91ab86ce8b0..5e92599ee78 100644 --- a/lib/wallet/test/unit/Data/Function/UtilsSpec.hs +++ b/lib/wallet/test/unit/Data/Function/UtilsSpec.hs @@ -7,11 +7,19 @@ module Data.Function.UtilsSpec import Prelude import Data.Function.Utils - ( applyN ) + ( applyN + ) import Test.Hspec - ( Spec, describe, it ) + ( Spec + , describe + , it + ) import Test.QuickCheck - ( NonNegative (..), property, withMaxSuccess, (===) ) + ( NonNegative (..) + , property + , withMaxSuccess + , (===) + ) spec :: Spec spec = describe "Function utilities" $ do diff --git a/lib/wallet/test/unit/Data/Time/TextSpec.hs b/lib/wallet/test/unit/Data/Time/TextSpec.hs index 7015208bf96..73a769dc2a1 100644 --- a/lib/wallet/test/unit/Data/Time/TextSpec.hs +++ b/lib/wallet/test/unit/Data/Time/TextSpec.hs @@ -5,13 +5,18 @@ module Data.Time.TextSpec import Prelude import Control.Monad - ( forM_ ) + ( forM_ + ) import Data.List - ( (\\) ) + ( (\\) + ) import Data.Maybe - ( isJust, maybeToList ) + ( isJust + , maybeToList + ) import Data.Text - ( Text ) + ( Text + ) import Data.Time.Text ( TimeFormat (..) , iso8601 @@ -23,11 +28,20 @@ import Data.Time.Text , utcTimeToText ) import Test.Hspec - ( Spec, describe, it, shouldBe, shouldSatisfy ) + ( Spec + , describe + , it + , shouldBe + , shouldSatisfy + ) import Test.QuickCheck - ( property, (.&&.), (===) ) + ( property + , (.&&.) + , (===) + ) import Test.Utils.Time - ( getUniformTime ) + ( getUniformTime + ) import qualified Data.Text as T diff --git a/lib/wallet/test/unit/Data/Time/UtilsSpec.hs b/lib/wallet/test/unit/Data/Time/UtilsSpec.hs index eef7a3a2149..bd6c454dcef 100644 --- a/lib/wallet/test/unit/Data/Time/UtilsSpec.hs +++ b/lib/wallet/test/unit/Data/Time/UtilsSpec.hs @@ -5,13 +5,22 @@ module Data.Time.UtilsSpec import Prelude import Data.Time.Utils - ( utcTimePred, utcTimeSucc ) + ( utcTimePred + , utcTimeSucc + ) import Test.Hspec - ( Spec, describe, it ) + ( Spec + , describe + , it + ) import Test.QuickCheck - ( property, withMaxSuccess, (===) ) + ( property + , withMaxSuccess + , (===) + ) import Test.Utils.Time - ( getUniformTime ) + ( getUniformTime + ) spec :: Spec spec = describe "Manipulation of time values." $ do diff --git a/lib/wallet/test/unit/Data/Vector/ShuffleSpec.hs b/lib/wallet/test/unit/Data/Vector/ShuffleSpec.hs index a388701342c..32d41097c1d 100644 --- a/lib/wallet/test/unit/Data/Vector/ShuffleSpec.hs +++ b/lib/wallet/test/unit/Data/Vector/ShuffleSpec.hs @@ -7,11 +7,18 @@ module Data.Vector.ShuffleSpec import Prelude import Data.Vector.Shuffle - ( mkSeed, shuffle, shuffleWith ) + ( mkSeed + , shuffle + , shuffleWith + ) import System.Random - ( mkStdGen ) + ( mkStdGen + ) import Test.Hspec - ( Spec, describe, it ) + ( Spec + , describe + , it + ) import Test.QuickCheck ( Confidence (..) , NonEmptyList (..) @@ -26,7 +33,12 @@ import Test.QuickCheck , (==>) ) import Test.QuickCheck.Monadic - ( assert, monadicIO, monitor, pick, run ) + ( assert + , monadicIO + , monitor + , pick + , run + ) import qualified Data.List as L import qualified Data.Text as T diff --git a/lib/wallet/test/unit/Internal/Cardano/Write/Tx/BalanceSpec.hs b/lib/wallet/test/unit/Internal/Cardano/Write/Tx/BalanceSpec.hs index 1f2df86d680..87e2ae3ecb8 100644 --- a/lib/wallet/test/unit/Internal/Cardano/Write/Tx/BalanceSpec.hs +++ b/lib/wallet/test/unit/Internal/Cardano/Write/Tx/BalanceSpec.hs @@ -33,9 +33,14 @@ module Internal.Cardano.Write.Tx.BalanceSpec import Prelude import Cardano.Address.Script - ( KeyHash (..), KeyRole (Policy) ) + ( KeyHash (..) + , KeyRole (Policy) + ) import Cardano.Api - ( CardanoEra (..), InAnyCardanoEra (..), IsCardanoEra (..) ) + ( CardanoEra (..) + , InAnyCardanoEra (..) + , IsCardanoEra (..) + ) import Cardano.Api.Gen ( genAddressByron , genAddressInEra @@ -51,11 +56,16 @@ import Cardano.Api.Gen , genValueForTxOut ) import Cardano.Api.Shelley - ( fromShelleyLovelace ) + ( fromShelleyLovelace + ) import Cardano.Binary - ( ToCBOR, serialize', unsafeDeserialize' ) + ( ToCBOR + , serialize' + , unsafeDeserialize' + ) import Cardano.Ledger.Alonzo.TxInfo - ( TranslationError (..) ) + ( TranslationError (..) + ) import Cardano.Ledger.Api ( AllegraEraTxBody (..) , AlonzoEraTxBody (..) @@ -73,19 +83,29 @@ import Cardano.Ledger.Api , serialiseAddr ) import Cardano.Ledger.Era - ( Era ) + ( Era + ) import Cardano.Ledger.Language - ( Language (..) ) + ( Language (..) + ) import Cardano.Ledger.Shelley.API - ( StrictMaybe (SJust, SNothing), Withdrawals (..) ) + ( StrictMaybe (SJust, SNothing) + , Withdrawals (..) + ) import Cardano.Mnemonic - ( SomeMnemonic (SomeMnemonic), entropyToMnemonic, mkEntropy ) + ( SomeMnemonic (SomeMnemonic) + , entropyToMnemonic + , mkEntropy + ) import Cardano.Numeric.Util - ( power ) + ( power + ) import Cardano.Pool.Types - ( PoolId (..) ) + ( PoolId (..) + ) import Cardano.Wallet - ( defaultChangeAddressGen ) + ( defaultChangeAddressGen + ) import Cardano.Wallet.Address.Derivation ( DelegationAddress (delegationAddress) , Depth (..) @@ -96,19 +116,32 @@ import Cardano.Wallet.Address.Derivation , paymentAddress ) import Cardano.Wallet.Address.Derivation.Shelley - ( ShelleyKey ) + ( ShelleyKey + ) import Cardano.Wallet.Address.Discovery.Random - ( RndState, mkRndState ) + ( RndState + , mkRndState + ) import Cardano.Wallet.Address.Discovery.Sequential - ( SeqState, defaultAddressPoolGap, purposeBIP44, purposeCIP1852 ) + ( SeqState + , defaultAddressPoolGap + , purposeBIP44 + , purposeCIP1852 + ) import Cardano.Wallet.Address.Keys.SequentialAny - ( mkSeqStateFromRootXPrv ) + ( mkSeqStateFromRootXPrv + ) import Cardano.Wallet.Address.Keys.WalletKey - ( getRawKey, publicKey ) + ( getRawKey + , publicKey + ) import Cardano.Wallet.Flavor - ( KeyFlavorS (..) ) + ( KeyFlavorS (..) + ) import Cardano.Wallet.Primitive.Model - ( Wallet (..), unsafeInitWallet ) + ( Wallet (..) + , unsafeInitWallet + ) import Cardano.Wallet.Primitive.NetworkId ( NetworkDiscriminant (..) , NetworkId (..) @@ -116,11 +149,14 @@ import Cardano.Wallet.Primitive.NetworkId , withSNetworkId ) import Cardano.Wallet.Primitive.Passphrase - ( Passphrase (..) ) + ( Passphrase (..) + ) import Cardano.Wallet.Primitive.Slotting - ( PastHorizonException ) + ( PastHorizonException + ) import Cardano.Wallet.Primitive.Types.Credentials - ( RootCredentials (..) ) + ( RootCredentials (..) + ) import Cardano.Wallet.Primitive.Types.Tx ( SealedTx (..) , cardanoTxIdeallyNoLaterThan @@ -130,65 +166,116 @@ import Cardano.Wallet.Primitive.Types.Tx , serialisedTx ) import Cardano.Wallet.Primitive.Types.Tx.Constraints - ( TxSize (..) ) + ( TxSize (..) + ) import Cardano.Wallet.Shelley.Transaction - ( mkByronWitness, mkDelegationCertificates, _decodeSealedTx ) + ( mkByronWitness + , mkDelegationCertificates + , _decodeSealedTx + ) import Cardano.Wallet.Transaction - ( DelegationAction (..), WitnessCountCtx (..) ) + ( DelegationAction (..) + , WitnessCountCtx (..) + ) import Cardano.Wallet.Unsafe - ( unsafeFromHex ) + ( unsafeFromHex + ) import Control.Lens - ( set, (%~), (.~), (^.) ) + ( set + , (%~) + , (.~) + , (^.) + ) import Control.Monad - ( forM, forM_, replicateM ) + ( forM + , forM_ + , replicateM + ) import Control.Monad.Random - ( evalRand ) + ( evalRand + ) import Control.Monad.Trans.Except - ( runExcept, runExceptT ) + ( runExcept + , runExceptT + ) import Control.Monad.Trans.State.Strict - ( evalState, state ) + ( evalState + , state + ) import Data.ByteArray.Encoding - ( Base (Base16), convertToBase ) + ( Base (Base16) + , convertToBase + ) import Data.ByteString - ( ByteString ) + ( ByteString + ) import Data.Char - ( isDigit ) + ( isDigit + ) import Data.Default - ( Default (..) ) + ( Default (..) + ) import Data.Either - ( isLeft, isRight ) + ( isLeft + , isRight + ) import Data.Function - ( (&) ) + ( (&) + ) import Data.Functor.Identity - ( Identity ) + ( Identity + ) import Data.Generics.Internal.VL.Lens - ( over, view ) + ( over + , view + ) import Data.IntCast - ( intCast ) + ( intCast + ) import Data.List - ( isSuffixOf, sortOn ) + ( isSuffixOf + , sortOn + ) import Data.List.NonEmpty - ( NonEmpty (..) ) + ( NonEmpty (..) + ) import Data.Maybe - ( catMaybes, fromJust, fromMaybe ) + ( catMaybes + , fromJust + , fromMaybe + ) import Data.Monoid.Monus - ( Monus ((<\>)) ) + ( Monus ((<\>)) + ) import Data.Ratio - ( (%) ) + ( (%) + ) import Data.Set - ( Set ) + ( Set + ) import Data.SOP.Counting - ( exactlyOne ) + ( exactlyOne + ) import Data.Text - ( Text ) + ( Text + ) import Data.Time.Clock.POSIX - ( posixSecondsToUTCTime ) + ( posixSecondsToUTCTime + ) import Data.Word - ( Word8 ) + ( Word8 + ) import Fmt - ( Buildable (..), blockListF, blockListF', fmt, nameF, pretty ) + ( Buildable (..) + , blockListF + , blockListF' + , fmt + , nameF + , pretty + ) import GHC.Stack - ( HasCallStack ) + ( HasCallStack + ) import Internal.Cardano.Write.Tx ( AnyRecentEra (..) , Datum (..) @@ -239,35 +326,62 @@ import Internal.Cardano.Write.Tx.Balance , updateTx ) import Internal.Cardano.Write.Tx.Sign - ( KeyWitnessCount (..), estimateKeyWitnessCount, estimateSignedTxSize ) + ( KeyWitnessCount (..) + , estimateKeyWitnessCount + , estimateSignedTxSize + ) import Internal.Cardano.Write.Tx.SizeEstimation - ( sizeOf_BootstrapWitnesses ) + ( sizeOf_BootstrapWitnesses + ) import Internal.Cardano.Write.Tx.TimeTranslation - ( TimeTranslation, timeTranslationFromEpochInfo ) + ( TimeTranslation + , timeTranslationFromEpochInfo + ) import Numeric.Natural - ( Natural ) + ( Natural + ) import Ouroboros.Consensus.BlockchainTime.WallClock.Types - ( RelativeTime (..), mkSlotLength ) + ( RelativeTime (..) + , mkSlotLength + ) import Ouroboros.Consensus.Config - ( SecurityParam (..) ) + ( SecurityParam (..) + ) import Ouroboros.Consensus.Shelley.Eras - ( StandardBabbage ) + ( StandardBabbage + ) import Ouroboros.Network.Block - ( SlotNo (..) ) + ( SlotNo (..) + ) import System.Directory - ( listDirectory ) + ( listDirectory + ) import System.FilePath - ( takeExtension, () ) + ( takeExtension + , () + ) import System.Random.StdGenSeed - ( StdGenSeed (..), stdGenFromSeed ) + ( StdGenSeed (..) + , stdGenFromSeed + ) import Test.Hspec - ( Spec, describe, expectationFailure, it, pendingWith, runIO, shouldBe ) + ( Spec + , describe + , expectationFailure + , it + , pendingWith + , runIO + , shouldBe + ) import Test.Hspec.Core.Spec - ( SpecM ) + ( SpecM + ) import Test.Hspec.Golden - ( Golden (..) ) + ( Golden (..) + ) import Test.Hspec.QuickCheck - ( prop ) + ( prop + ) import Test.QuickCheck ( Arbitrary (..) , Arbitrary2 (liftShrink2) @@ -298,15 +412,22 @@ import Test.QuickCheck , (==>) ) import Test.QuickCheck.Extra - ( report, shrinkNatural, (.>=.) ) + ( report + , shrinkNatural + , (.>=.) + ) import Test.QuickCheck.Gen - ( Gen (..) ) + ( Gen (..) + ) import Test.Utils.Paths - ( getTestData ) + ( getTestData + ) import Test.Utils.Pretty - ( Pretty (..) ) + ( Pretty (..) + ) import Text.Read - ( readMaybe ) + ( readMaybe + ) import qualified Cardano.Api as Cardano import qualified Cardano.Api.Shelley as Cardano @@ -325,26 +446,35 @@ import qualified Cardano.Slotting.Time as Slotting import qualified Cardano.Wallet.Address.Derivation.Byron as Byron import qualified Cardano.Wallet.Address.Derivation.Shelley as Shelley import qualified Cardano.Wallet.Primitive.Types as W - ( Block (..), BlockHeader (..) ) + ( Block (..) + , BlockHeader (..) + ) import qualified Cardano.Wallet.Primitive.Types as W.Block - ( header ) + ( header + ) import qualified Cardano.Wallet.Primitive.Types.Address as W - ( Address (..) ) + ( Address (..) + ) import qualified Cardano.Wallet.Primitive.Types.Coin as W.Coin import qualified Cardano.Wallet.Primitive.Types.Coin as W - ( Coin (..) ) + ( Coin (..) + ) import qualified Cardano.Wallet.Primitive.Types.Coin.Gen as W import qualified Cardano.Wallet.Primitive.Types.Hash as W - ( Hash (..), mockHash ) + ( Hash (..) + , mockHash + ) import qualified Cardano.Wallet.Primitive.Types.TokenBundle as W.TokenBundle import qualified Cardano.Wallet.Primitive.Types.TokenBundle as W - ( TokenBundle ) + ( TokenBundle + ) import qualified Cardano.Wallet.Primitive.Types.TokenBundle.Gen as W import qualified Cardano.Wallet.Primitive.Types.Tx.TxIn as W import qualified Cardano.Wallet.Primitive.Types.Tx.TxIn.Gen as W import qualified Cardano.Wallet.Primitive.Types.Tx.TxOut as W.TxOut import qualified Cardano.Wallet.Primitive.Types.Tx.TxOut as W - ( TxOut (..) ) + ( TxOut (..) + ) import qualified Cardano.Wallet.Primitive.Types.Tx.TxOut.Gen as TxOutGen import qualified Cardano.Wallet.Primitive.Types.UTxO as W import qualified Cardano.Wallet.Shelley.Compatibility.Ledger as Convert @@ -356,7 +486,8 @@ import qualified Data.Foldable as F import qualified Data.List.NonEmpty as NE import qualified Data.Map.Strict as Map import qualified Data.Quantity as W - ( Quantity (..) ) + ( Quantity (..) + ) import qualified Data.Sequence.Strict as StrictSeq import qualified Data.Set as Set import qualified Data.Text as T diff --git a/lib/wallet/test/unit/core-unit-test.hs b/lib/wallet/test/unit/core-unit-test.hs index 349e4b80090..66edcab2e95 100644 --- a/lib/wallet/test/unit/core-unit-test.hs +++ b/lib/wallet/test/unit/core-unit-test.hs @@ -3,9 +3,11 @@ module Main where import Prelude import Main.Utf8 - ( withUtf8 ) + ( withUtf8 + ) import Test.Hspec.Extra - ( hspecMain ) + ( hspecMain + ) import qualified Spec diff --git a/prototypes/light-mode-test/src/Demo.hs b/prototypes/light-mode-test/src/Demo.hs index 4d7cae2d96e..1c1c53d8cfc 100644 --- a/prototypes/light-mode-test/src/Demo.hs +++ b/prototypes/light-mode-test/src/Demo.hs @@ -2,20 +2,27 @@ module Demo where import Control.Monad - ( forM_ ) + ( forM_ + ) import Control.Monad.IO.Class - ( MonadIO (..) ) + ( MonadIO (..) + ) import Data.List - ( nub ) + ( nub + ) import Data.Set - ( Set ) + ( Set + ) import Data.Text - ( Text ) + ( Text + ) import Data.Time.Clock import Light.ReadBlocks import Light.Types import Say - ( say, sayString ) + ( say + , sayString + ) import qualified Data.Set as Set import qualified Data.Text as T diff --git a/prototypes/light-mode-test/src/Light.hs b/prototypes/light-mode-test/src/Light.hs index b73ebe87847..af5f2689617 100644 --- a/prototypes/light-mode-test/src/Light.hs +++ b/prototypes/light-mode-test/src/Light.hs @@ -41,7 +41,8 @@ module Light ( ) where import Control.Monad - ( void ) + ( void + ) import Light.ReadBlocks import Light.StakePools diff --git a/prototypes/light-mode-test/src/Light/ReadBlocks.hs b/prototypes/light-mode-test/src/Light/ReadBlocks.hs index c75a6291ba5..f0c39203222 100644 --- a/prototypes/light-mode-test/src/Light/ReadBlocks.hs +++ b/prototypes/light-mode-test/src/Light/ReadBlocks.hs @@ -4,22 +4,33 @@ module Light.ReadBlocks where import Control.Concurrent - ( threadDelay ) + ( threadDelay + ) import Control.Monad - ( forM ) + ( forM + ) import Control.Monad.IO.Class - ( MonadIO, liftIO ) + ( MonadIO + , liftIO + ) import Control.Monad.Trans.Except import Data.Map - ( Map ) + ( Map + ) import Data.Maybe - ( fromJust, fromMaybe, listToMaybe ) + ( fromJust + , fromMaybe + , listToMaybe + ) import Data.Set - ( Set ) + ( Set + ) import Say - ( sayString ) + ( sayString + ) import System.Random - ( randomRIO ) + ( randomRIO + ) import qualified Data.Map.Strict as Map import qualified Data.Set as Set diff --git a/prototypes/light-mode-test/src/Light/StakePools.hs b/prototypes/light-mode-test/src/Light/StakePools.hs index 00984d7f4ec..c6a0c11b189 100644 --- a/prototypes/light-mode-test/src/Light/StakePools.hs +++ b/prototypes/light-mode-test/src/Light/StakePools.hs @@ -1,7 +1,8 @@ module Light.StakePools where import Data.Map - ( Map ) + ( Map + ) import Light.Types -- | Summary of stake distribution and stake pools obtained from network diff --git a/prototypes/light-mode-test/src/Light/Types.hs b/prototypes/light-mode-test/src/Light/Types.hs index 27439c72da1..6fde59c511e 100644 --- a/prototypes/light-mode-test/src/Light/Types.hs +++ b/prototypes/light-mode-test/src/Light/Types.hs @@ -2,11 +2,14 @@ module Light.Types where import Blockfrost.Client import Data.Foldable - ( maximumBy ) + ( maximumBy + ) import Data.Ord - ( comparing ) + ( comparing + ) import Data.Text - ( Text ) + ( Text + ) type Blocks = [Block] type Coin = Lovelaces