From 4fc00f96b34f7f76a87376269f53bb25eb9f2c81 Mon Sep 17 00:00:00 2001 From: Jonathan Knowles Date: Tue, 5 Dec 2023 05:34:53 +0000 Subject: [PATCH] Extract out new module `AssetId`. --- .../Internal/Cardano/Write/Tx/Balance.hs | 6 ++-- .../Cardano/Write/Tx/Balance/CoinSelection.hs | 6 ++-- .../Cardano/Write/Tx/SizeEstimation.hs | 6 ++-- lib/coin-selection/bench/UTxOIndexBench.hs | 6 ++-- .../lib/Cardano/CoinSelection.hs | 6 ++-- .../lib/Cardano/CoinSelection/Balance.hs | 6 ++-- .../CoinSelection/UTxOIndex/Internal.hs | 6 ++-- .../spec/Cardano/CoinSelection/BalanceSpec.hs | 6 ++-- .../Cardano/CoinSelection/UTxOIndexSpec.hs | 6 ++-- .../lib/Cardano/Wallet/Launch/Cluster.hs | 6 ++-- lib/primitive/cardano-wallet-primitive.cabal | 1 + .../Ledger/Read/Tx/Features/Outputs.hs | 3 +- .../Wallet/Primitive/Ledger/Shelley.hs | 3 +- .../Cardano/Wallet/Primitive/Types/AssetId.hs | 34 +++++++++++++++++++ .../Wallet/Primitive/Types/TokenBundle.hs | 9 ++--- .../Wallet/Primitive/Types/TokenMap.hs | 19 +++-------- .../Wallet/Primitive/Types/TokenMap/Gen.hs | 6 ++-- .../Cardano/Wallet/Primitive/Types/Tx/Tx.hs | 6 ++-- .../Wallet/Primitive/Types/Tx/TxOut.hs | 6 ++-- .../Cardano/Wallet/Primitive/Types/UTxO.hs | 6 ++-- .../Wallet/Primitive/Types/TokenMapSpec.hs | 6 ++-- .../Cardano/Wallet/Primitive/Types/TxSpec.hs | 6 ++-- .../Wallet/Primitive/Types/UTxOSpec.hs | 6 ++-- .../Cardano/Wallet/Api/Http/Shelley/Server.hs | 6 ++-- .../api/http/Cardano/Wallet/Api/Types.hs | 6 ++-- lib/wallet/bench/db-bench.hs | 5 ++- .../src/Test/Integration/Framework/DSL.hs | 5 ++- .../Scenario/API/Shelley/CoinSelections.hs | 6 ++-- .../Scenario/API/Shelley/TransactionsNew.hs | 6 ++-- .../Wallet/TokenMetadata/MockServer.hs | 6 ++-- lib/wallet/src/Cardano/Wallet.hs | 7 ++-- .../Cardano/Wallet/Address/Keys/MintBurn.hs | 6 ++-- .../Wallet/DB/Store/Checkpoints/Store.hs | 6 ++-- .../Wallet/DB/Store/Transactions/Model.hs | 6 ++-- .../Wallet/DB/Store/UTxOHistory/TxOutCBOR.hs | 6 ++-- .../Wallet/Primitive/Types/Tx/TxSeq.hs | 6 ++-- .../Wallet/Primitive/Types/Tx/TxSeq/Gen.hs | 6 ++-- .../src/Cardano/Wallet/Shelley/Transaction.hs | 9 +++-- .../src/Cardano/Wallet/TokenMetadata.hs | 6 ++-- lib/wallet/src/Cardano/Wallet/Transaction.hs | 6 ++-- .../test/unit/Cardano/Wallet/Api/TypesSpec.hs | 6 ++-- .../Wallet/Balance/Migration/SelectionSpec.hs | 6 ++-- .../Wallet/Primitive/Types/Tx/TxSeqSpec.hs | 6 ++-- .../Cardano/Wallet/Shelley/TransactionSpec.hs | 8 +++-- .../unit/Cardano/Wallet/TokenMetadataSpec.hs | 6 ++-- 45 files changed, 189 insertions(+), 118 deletions(-) create mode 100644 lib/primitive/lib/Cardano/Wallet/Primitive/Types/AssetId.hs 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 b2591a26710..a9e2cfe7181 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 @@ -284,6 +284,9 @@ import qualified Cardano.Wallet.Primitive.Ledger.Convert as Convert import qualified Cardano.Wallet.Primitive.Types.Address as W ( Address ) +import qualified Cardano.Wallet.Primitive.Types.AssetId as W + ( AssetId (..) + ) import qualified Cardano.Wallet.Primitive.Types.Coin as W.Coin import qualified Cardano.Wallet.Primitive.Types.Coin as W ( Coin (..) @@ -293,9 +296,6 @@ import qualified Cardano.Wallet.Primitive.Types.TokenBundle as W ( TokenBundle (..) ) import qualified Cardano.Wallet.Primitive.Types.TokenMap as W.TokenMap -import qualified Cardano.Wallet.Primitive.Types.TokenMap as W - ( AssetId (..) - ) import qualified Cardano.Wallet.Primitive.Types.TokenQuantity as W ( TokenQuantity (..) ) 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 b7fedbe8274..681b348dd5d 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 @@ -125,6 +125,9 @@ import qualified Cardano.CoinSelection.Context as SC import qualified Cardano.Wallet.Primitive.Types.Address as W ( Address (..) ) +import qualified Cardano.Wallet.Primitive.Types.AssetId as W + ( AssetId + ) import qualified Cardano.Wallet.Primitive.Types.Coin as W ( Coin ) @@ -133,8 +136,7 @@ import qualified Cardano.Wallet.Primitive.Types.TokenBundle as W ( TokenBundle (..) ) import qualified Cardano.Wallet.Primitive.Types.TokenMap as W - ( AssetId - , TokenMap + ( TokenMap ) import qualified Cardano.Wallet.Primitive.Types.Tx.Constraints as W ( txOutMaxCoin 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 aed9f723de2..b46202322d0 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 @@ -73,14 +73,14 @@ import qualified Cardano.Address.Script as CA import qualified Cardano.Wallet.Primitive.Types.Address as W ( Address (..) ) +import qualified Cardano.Wallet.Primitive.Types.AssetId as W + ( AssetId (..) + ) import qualified Cardano.Wallet.Primitive.Types.Coin as W ( Coin (..) ) import qualified Cardano.Wallet.Primitive.Types.Coin as W.Coin import qualified Cardano.Wallet.Primitive.Types.TokenBundle as W.TokenBundle -import qualified Cardano.Wallet.Primitive.Types.TokenMap as W - ( AssetId (..) - ) import qualified Cardano.Wallet.Primitive.Types.TokenName as W import qualified Cardano.Wallet.Primitive.Types.Tx.Constraints as W ( TxSize (..) diff --git a/lib/coin-selection/bench/UTxOIndexBench.hs b/lib/coin-selection/bench/UTxOIndexBench.hs index d51c2801b9d..44dbf717aa9 100644 --- a/lib/coin-selection/bench/UTxOIndexBench.hs +++ b/lib/coin-selection/bench/UTxOIndexBench.hs @@ -11,6 +11,9 @@ module Main where import Prelude +import Cardano.Wallet.Primitive.Types.AssetId + ( AssetId (..) + ) import Cardano.Wallet.Primitive.Types.Coin ( Coin (..) ) @@ -22,8 +25,7 @@ import Cardano.Wallet.Primitive.Types.TokenBundle ( TokenBundle (..) ) import Cardano.Wallet.Primitive.Types.TokenMap - ( AssetId (..) - , TokenMap + ( TokenMap ) import Cardano.Wallet.Primitive.Types.TokenName ( TokenName (..) diff --git a/lib/coin-selection/lib/Cardano/CoinSelection.hs b/lib/coin-selection/lib/Cardano/CoinSelection.hs index 623b48587d8..f76aa1ff925 100644 --- a/lib/coin-selection/lib/Cardano/CoinSelection.hs +++ b/lib/coin-selection/lib/Cardano/CoinSelection.hs @@ -75,6 +75,9 @@ import Cardano.CoinSelection.Size import Cardano.CoinSelection.UTxOSelection ( UTxOSelection ) +import Cardano.Wallet.Primitive.Types.AssetId + ( AssetId + ) import Cardano.Wallet.Primitive.Types.Coin ( Coin (..) ) @@ -82,8 +85,7 @@ import Cardano.Wallet.Primitive.Types.TokenBundle ( TokenBundle ) import Cardano.Wallet.Primitive.Types.TokenMap - ( AssetId - , TokenMap + ( TokenMap ) import Cardano.Wallet.Primitive.Types.TokenQuantity ( TokenQuantity diff --git a/lib/coin-selection/lib/Cardano/CoinSelection/Balance.hs b/lib/coin-selection/lib/Cardano/CoinSelection/Balance.hs index 2f5e6143b38..27195622c4e 100644 --- a/lib/coin-selection/lib/Cardano/CoinSelection/Balance.hs +++ b/lib/coin-selection/lib/Cardano/CoinSelection/Balance.hs @@ -139,6 +139,9 @@ import Cardano.CoinSelection.UTxOSelection import Cardano.Numeric.Util ( padCoalesce ) +import Cardano.Wallet.Primitive.Types.AssetId + ( AssetId + ) import Cardano.Wallet.Primitive.Types.Coin ( Coin (..) ) @@ -146,8 +149,7 @@ import Cardano.Wallet.Primitive.Types.TokenBundle ( TokenBundle (..) ) import Cardano.Wallet.Primitive.Types.TokenMap - ( AssetId - , Lexicographic (..) + ( Lexicographic (..) , TokenMap ) import Cardano.Wallet.Primitive.Types.TokenQuantity diff --git a/lib/coin-selection/lib/Cardano/CoinSelection/UTxOIndex/Internal.hs b/lib/coin-selection/lib/Cardano/CoinSelection/UTxOIndex/Internal.hs index fe0c09fffcc..5521d16e0c5 100644 --- a/lib/coin-selection/lib/Cardano/CoinSelection/UTxOIndex/Internal.hs +++ b/lib/coin-selection/lib/Cardano/CoinSelection/UTxOIndex/Internal.hs @@ -145,14 +145,14 @@ import GHC.Generics ( Generic ) +import qualified Cardano.Wallet.Primitive.Types.AssetId as W + ( AssetId + ) import qualified Cardano.Wallet.Primitive.Types.TokenBundle as W.TokenBundle import qualified Cardano.Wallet.Primitive.Types.TokenBundle as W ( TokenBundle ) import qualified Cardano.Wallet.Primitive.Types.TokenMap as W.TokenMap -import qualified Cardano.Wallet.Primitive.Types.TokenMap as W - ( 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/test/spec/Cardano/CoinSelection/BalanceSpec.hs b/lib/coin-selection/test/spec/Cardano/CoinSelection/BalanceSpec.hs index c7eff8368fa..bf099e79c17 100644 --- a/lib/coin-selection/test/spec/Cardano/CoinSelection/BalanceSpec.hs +++ b/lib/coin-selection/test/spec/Cardano/CoinSelection/BalanceSpec.hs @@ -127,6 +127,9 @@ import Cardano.CoinSelection.UTxOSelection.Gen import Cardano.Numeric.Util ( inAscendingPartialOrder ) +import Cardano.Wallet.Primitive.Types.AssetId + ( AssetId (..) + ) import Cardano.Wallet.Primitive.Types.Coin ( Coin (..) ) @@ -149,8 +152,7 @@ import Cardano.Wallet.Primitive.Types.TokenBundle.Gen , shrinkTokenBundleSmallRangePositive ) import Cardano.Wallet.Primitive.Types.TokenMap - ( AssetId (..) - , TokenMap + ( TokenMap ) import Cardano.Wallet.Primitive.Types.TokenMap.Gen ( genAssetId diff --git a/lib/coin-selection/test/spec/Cardano/CoinSelection/UTxOIndexSpec.hs b/lib/coin-selection/test/spec/Cardano/CoinSelection/UTxOIndexSpec.hs index 34292ef81c0..b8405129395 100644 --- a/lib/coin-selection/test/spec/Cardano/CoinSelection/UTxOIndexSpec.hs +++ b/lib/coin-selection/test/spec/Cardano/CoinSelection/UTxOIndexSpec.hs @@ -30,6 +30,9 @@ import Cardano.CoinSelection.UTxOIndex.Internal , categorizeTokenBundle , checkInvariant ) +import Cardano.Wallet.Primitive.Types.AssetId + ( AssetId + ) import Cardano.Wallet.Primitive.Types.TokenBundle ( TokenBundle ) @@ -37,9 +40,6 @@ import Cardano.Wallet.Primitive.Types.TokenBundle.Gen ( genTokenBundleSmallRangePositive , shrinkTokenBundleSmallRangePositive ) -import Cardano.Wallet.Primitive.Types.TokenMap - ( AssetId - ) import Cardano.Wallet.Primitive.Types.TokenMap.Gen ( genAssetId , shrinkAssetId diff --git a/lib/local-cluster/lib/Cardano/Wallet/Launch/Cluster.hs b/lib/local-cluster/lib/Cardano/Wallet/Launch/Cluster.hs index fa53293361c..063423fe8a2 100644 --- a/lib/local-cluster/lib/Cardano/Wallet/Launch/Cluster.hs +++ b/lib/local-cluster/lib/Cardano/Wallet/Launch/Cluster.hs @@ -158,12 +158,14 @@ import Cardano.Startup import Cardano.Wallet.Network.Ports ( randomUnusedTCPPorts ) +import Cardano.Wallet.Primitive.Types.AssetId + ( AssetId (..) + ) import Cardano.Wallet.Primitive.Types.Coin ( Coin (..) ) import Cardano.Wallet.Primitive.Types.TokenBundle - ( AssetId (..) - , TokenBundle (..) + ( TokenBundle (..) ) import Cardano.Wallet.Primitive.Types.TokenName ( TokenName (..) diff --git a/lib/primitive/cardano-wallet-primitive.cabal b/lib/primitive/cardano-wallet-primitive.cabal index 3d89af7dd2b..89155a6eaa4 100644 --- a/lib/primitive/cardano-wallet-primitive.cabal +++ b/lib/primitive/cardano-wallet-primitive.cabal @@ -151,6 +151,7 @@ library Cardano.Wallet.Primitive.Types.Address Cardano.Wallet.Primitive.Types.Address.Gen Cardano.Wallet.Primitive.Types.AnyExplicitScripts + Cardano.Wallet.Primitive.Types.AssetId Cardano.Wallet.Primitive.Types.Block Cardano.Wallet.Primitive.Types.Block.Gen Cardano.Wallet.Primitive.Types.BlockSummary diff --git a/lib/primitive/lib/Cardano/Wallet/Primitive/Ledger/Read/Tx/Features/Outputs.hs b/lib/primitive/lib/Cardano/Wallet/Primitive/Ledger/Read/Tx/Features/Outputs.hs index 722e3c8ac23..41c912eb9d6 100644 --- a/lib/primitive/lib/Cardano/Wallet/Primitive/Ledger/Read/Tx/Features/Outputs.hs +++ b/lib/primitive/lib/Cardano/Wallet/Primitive/Ledger/Read/Tx/Features/Outputs.hs @@ -68,6 +68,7 @@ import qualified Cardano.Ledger.Crypto as SL import qualified Cardano.Ledger.Shelley.API as SL import qualified Cardano.Wallet.Primitive.Ledger.Convert as Ledger import qualified Cardano.Wallet.Primitive.Types.Address as W +import qualified Cardano.Wallet.Primitive.Types.AssetId as W import qualified Cardano.Wallet.Primitive.Types.Coin as Coin import qualified Cardano.Wallet.Primitive.Types.Coin as W import qualified Cardano.Wallet.Primitive.Types.Hash as W @@ -156,7 +157,7 @@ fromCardanoValue = uncurry TokenBundle.fromFlatList . extract | otherwise = internalError "negative token quantity" mkBundle assets = - [ (TokenBundle.AssetId (mkPolicyId p) (mkTokenName n) , mkQuantity q) + [ (W.AssetId (mkPolicyId p) (mkTokenName n), mkQuantity q) | (Cardano.AssetId p n, Cardano.Quantity q) <- assets ] diff --git a/lib/primitive/lib/Cardano/Wallet/Primitive/Ledger/Shelley.hs b/lib/primitive/lib/Cardano/Wallet/Primitive/Ledger/Shelley.hs index d0e4d4f0603..846ceb6696b 100644 --- a/lib/primitive/lib/Cardano/Wallet/Primitive/Ledger/Shelley.hs +++ b/lib/primitive/lib/Cardano/Wallet/Primitive/Ledger/Shelley.hs @@ -389,6 +389,7 @@ import qualified Cardano.Slotting.Slot as Slotting import qualified Cardano.Wallet.Primitive.Ledger.Convert as Ledger import qualified Cardano.Wallet.Primitive.Slotting as W import qualified Cardano.Wallet.Primitive.Types.Address as W +import qualified Cardano.Wallet.Primitive.Types.AssetId as W import qualified Cardano.Wallet.Primitive.Types.Block as W import qualified Cardano.Wallet.Primitive.Types.Certificates as W import qualified Cardano.Wallet.Primitive.Types.Coin as Coin @@ -1253,7 +1254,7 @@ toCardanoValue tb = Cardano.valueFromList $ map (bimap toCardanoAssetId toQuantity) bundle where (coin, bundle) = TokenBundle.toFlatList tb - toCardanoAssetId (TokenBundle.AssetId pid name) = + toCardanoAssetId (W.AssetId pid name) = Cardano.AssetId (toCardanoPolicyId pid) (toCardanoAssetName name) toCardanoAssetName (W.UnsafeTokenName name) = diff --git a/lib/primitive/lib/Cardano/Wallet/Primitive/Types/AssetId.hs b/lib/primitive/lib/Cardano/Wallet/Primitive/Types/AssetId.hs new file mode 100644 index 00000000000..1bbc9e3544e --- /dev/null +++ b/lib/primitive/lib/Cardano/Wallet/Primitive/Types/AssetId.hs @@ -0,0 +1,34 @@ +{-# LANGUAGE DeriveGeneric #-} +{-# LANGUAGE DerivingStrategies #-} + +module Cardano.Wallet.Primitive.Types.AssetId + ( AssetId (..) + ) where + +import Prelude + +import Cardano.Wallet.Primitive.Types.TokenName + ( TokenName + ) +import Cardano.Wallet.Primitive.Types.TokenPolicyId + ( TokenPolicyId + ) +import Control.DeepSeq + ( NFData + ) +import GHC.Generics + ( Generic + ) + +-- | A combination of a token policy identifier and a token name that can be +-- used as a compound identifier. +-- +data AssetId = AssetId + { tokenPolicyId + :: !TokenPolicyId + , tokenName + :: !TokenName + } + deriving stock (Eq, Generic, Ord, Read, Show) + +instance NFData AssetId diff --git a/lib/primitive/lib/Cardano/Wallet/Primitive/Types/TokenBundle.hs b/lib/primitive/lib/Cardano/Wallet/Primitive/Types/TokenBundle.hs index b175393ac26..a29925e044e 100644 --- a/lib/primitive/lib/Cardano/Wallet/Primitive/Types/TokenBundle.hs +++ b/lib/primitive/lib/Cardano/Wallet/Primitive/Types/TokenBundle.hs @@ -17,9 +17,8 @@ -- module Cardano.Wallet.Primitive.Types.TokenBundle ( - -- * Types + -- * Type TokenBundle (..) - , AssetId (..) -- * Construction , empty @@ -79,12 +78,14 @@ import Prelude hiding import Algebra.PartialOrd ( PartialOrd (..) ) +import Cardano.Wallet.Primitive.Types.AssetId + ( AssetId + ) import Cardano.Wallet.Primitive.Types.Coin ( Coin (..) ) import Cardano.Wallet.Primitive.Types.TokenMap - ( AssetId (..) - , Flat (..) + ( Flat (..) , Lexicographic (..) , Nested (..) , TokenMap diff --git a/lib/primitive/lib/Cardano/Wallet/Primitive/Types/TokenMap.hs b/lib/primitive/lib/Cardano/Wallet/Primitive/Types/TokenMap.hs index bb62b1d5581..3760090ebe2 100644 --- a/lib/primitive/lib/Cardano/Wallet/Primitive/Types/TokenMap.hs +++ b/lib/primitive/lib/Cardano/Wallet/Primitive/Types/TokenMap.hs @@ -20,9 +20,8 @@ -- module Cardano.Wallet.Primitive.Types.TokenMap ( - -- * Types + -- * Type TokenMap - , AssetId (..) -- * Construction , empty @@ -94,6 +93,9 @@ import Algebra.PartialOrd import Cardano.Numeric.Util ( equipartitionNatural ) +import Cardano.Wallet.Primitive.Types.AssetId + ( AssetId (AssetId) + ) import Cardano.Wallet.Primitive.Types.TokenName ( TokenName ) @@ -244,19 +246,6 @@ instance NFData TokenMap instance Hashable TokenMap where hashWithSalt = hashUsing toNestedList --- | A combination of a token policy identifier and a token name that can be --- used as a compound identifier. --- -data AssetId = AssetId - { tokenPolicyId - :: !TokenPolicyId - , tokenName - :: !TokenName - } - deriving stock (Eq, Generic, Ord, Read, Show) - -instance NFData AssetId - -------------------------------------------------------------------------------- -- Ordering -------------------------------------------------------------------------------- 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 01a8d3e8c35..cb924bf8964 100644 --- a/lib/primitive/lib/Cardano/Wallet/Primitive/Types/TokenMap/Gen.hs +++ b/lib/primitive/lib/Cardano/Wallet/Primitive/Types/TokenMap/Gen.hs @@ -15,9 +15,11 @@ module Cardano.Wallet.Primitive.Types.TokenMap.Gen import Prelude -import Cardano.Wallet.Primitive.Types.TokenMap +import Cardano.Wallet.Primitive.Types.AssetId ( AssetId (..) - , TokenMap + ) +import Cardano.Wallet.Primitive.Types.TokenMap + ( TokenMap ) import Cardano.Wallet.Primitive.Types.TokenName.Gen ( genTokenName 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 c2605b1a3e6..bc6bd5b4ce7 100644 --- a/lib/primitive/lib/Cardano/Wallet/Primitive/Types/Tx/Tx.hs +++ b/lib/primitive/lib/Cardano/Wallet/Primitive/Types/Tx/Tx.hs @@ -49,6 +49,9 @@ import Cardano.Api ) import Cardano.Wallet.Orphans () +import Cardano.Wallet.Primitive.Types.AssetId + ( AssetId + ) import Cardano.Wallet.Primitive.Types.Coin ( Coin (..) ) @@ -58,9 +61,6 @@ import Cardano.Wallet.Primitive.Types.Hash import Cardano.Wallet.Primitive.Types.RewardAccount ( RewardAccount (..) ) -import Cardano.Wallet.Primitive.Types.TokenMap - ( AssetId - ) import Cardano.Wallet.Primitive.Types.Tx.TxIn ( TxIn (..) ) 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 ca706253683..85f8c77cb37 100644 --- a/lib/primitive/lib/Cardano/Wallet/Primitive/Types/Tx/TxOut.hs +++ b/lib/primitive/lib/Cardano/Wallet/Primitive/Types/Tx/TxOut.hs @@ -32,6 +32,9 @@ import Prelude import Cardano.Wallet.Primitive.Types.Address ( Address (..) ) +import Cardano.Wallet.Primitive.Types.AssetId + ( AssetId (..) + ) import Cardano.Wallet.Primitive.Types.Coin ( Coin (..) ) @@ -39,8 +42,7 @@ import Cardano.Wallet.Primitive.Types.TokenBundle ( TokenBundle ) import Cardano.Wallet.Primitive.Types.TokenMap - ( AssetId - , Lexicographic (..) + ( Lexicographic (..) ) import Control.DeepSeq ( NFData (..) diff --git a/lib/primitive/lib/Cardano/Wallet/Primitive/Types/UTxO.hs b/lib/primitive/lib/Cardano/Wallet/Primitive/Types/UTxO.hs index eb0dfb6f20d..8d78641bfc6 100644 --- a/lib/primitive/lib/Cardano/Wallet/Primitive/Types/UTxO.hs +++ b/lib/primitive/lib/Cardano/Wallet/Primitive/Types/UTxO.hs @@ -66,15 +66,15 @@ import Prelude hiding import Cardano.Wallet.Primitive.Types.Address ( Address ) +import Cardano.Wallet.Primitive.Types.AssetId + ( AssetId + ) import Cardano.Wallet.Primitive.Types.Hash ( Hash ) import Cardano.Wallet.Primitive.Types.TokenBundle ( TokenBundle ) -import Cardano.Wallet.Primitive.Types.TokenMap - ( AssetId - ) import Cardano.Wallet.Primitive.Types.Tx.TxIn ( TxIn ) 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 7c452613c65..12fcdbae645 100644 --- a/lib/primitive/test/spec/Cardano/Wallet/Primitive/Types/TokenMapSpec.hs +++ b/lib/primitive/test/spec/Cardano/Wallet/Primitive/Types/TokenMapSpec.hs @@ -22,12 +22,14 @@ import Prelude import Cardano.Numeric.Util ( inAscendingPartialOrder ) +import Cardano.Wallet.Primitive.Types.AssetId + ( AssetId (..) + ) import Cardano.Wallet.Primitive.Types.Hash ( Hash (..) ) import Cardano.Wallet.Primitive.Types.TokenMap - ( AssetId (..) - , Flat (..) + ( Flat (..) , Lexicographic (..) , Nested (..) , TokenMap 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 d910b92bdfb..b5d54cb1891 100644 --- a/lib/primitive/test/spec/Cardano/Wallet/Primitive/Types/TxSpec.hs +++ b/lib/primitive/test/spec/Cardano/Wallet/Primitive/Types/TxSpec.hs @@ -17,12 +17,12 @@ module Cardano.Wallet.Primitive.Types.TxSpec import Prelude +import Cardano.Wallet.Primitive.Types.AssetId + ( AssetId (..) + ) import Cardano.Wallet.Primitive.Types.Hash ( Hash (..) ) -import Cardano.Wallet.Primitive.Types.TokenMap - ( AssetId (..) - ) import Cardano.Wallet.Primitive.Types.TokenMap.Gen ( genAssetId , shrinkAssetId 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 413788d97da..556a9345a1c 100644 --- a/lib/primitive/test/spec/Cardano/Wallet/Primitive/Types/UTxOSpec.hs +++ b/lib/primitive/test/spec/Cardano/Wallet/Primitive/Types/UTxOSpec.hs @@ -22,13 +22,13 @@ import Cardano.Wallet.Primitive.Types.Address.Gen ( Parity (..) , addressParity ) +import Cardano.Wallet.Primitive.Types.AssetId + ( AssetId (..) + ) import Cardano.Wallet.Primitive.Types.Hash ( Hash (..) , mockHash ) -import Cardano.Wallet.Primitive.Types.TokenMap - ( AssetId (..) - ) import Cardano.Wallet.Primitive.Types.TokenMap.Gen ( genAssetId , shrinkAssetId 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 385f5253f55..6340dde5199 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 @@ -582,6 +582,9 @@ import Cardano.Wallet.Primitive.Types.Address ( Address (..) , AddressState (..) ) +import Cardano.Wallet.Primitive.Types.AssetId + ( AssetId (..) + ) import Cardano.Wallet.Primitive.Types.Coin ( Coin (..) ) @@ -596,8 +599,7 @@ import Cardano.Wallet.Primitive.Types.TokenBundle ( TokenBundle (..) ) import Cardano.Wallet.Primitive.Types.TokenMap - ( AssetId (..) - , TokenMap + ( TokenMap , fromFlatList ) import Cardano.Wallet.Primitive.Types.TokenName diff --git a/lib/wallet/api/http/Cardano/Wallet/Api/Types.hs b/lib/wallet/api/http/Cardano/Wallet/Api/Types.hs index 7da6b97af13..3d73a56c2e6 100644 --- a/lib/wallet/api/http/Cardano/Wallet/Api/Types.hs +++ b/lib/wallet/api/http/Cardano/Wallet/Api/Types.hs @@ -432,12 +432,14 @@ import Cardano.Wallet.Primitive.Types.Address ( Address (..) , AddressState (..) ) +import Cardano.Wallet.Primitive.Types.AssetId + ( AssetId (..) + ) import Cardano.Wallet.Primitive.Types.Hash ( Hash (..) ) import Cardano.Wallet.Primitive.Types.TokenMap - ( AssetId (..) - , TokenMap + ( TokenMap ) import Cardano.Wallet.Primitive.Types.Tx ( SealedTx (..) diff --git a/lib/wallet/bench/db-bench.hs b/lib/wallet/bench/db-bench.hs index 215bf160683..16c6cbc2f4f 100644 --- a/lib/wallet/bench/db-bench.hs +++ b/lib/wallet/bench/db-bench.hs @@ -181,6 +181,9 @@ import Cardano.Wallet.Primitive.Types.Address ( Address (..) , AddressState (..) ) +import Cardano.Wallet.Primitive.Types.AssetId + ( AssetId (..) + ) import Cardano.Wallet.Primitive.Types.Coin ( Coin (..) ) @@ -716,7 +719,7 @@ mkOutputs prefix nOuts nAssets = (mkAddress prefix i) (TokenBundle.TokenBundle (Coin 1) (TokenMap.fromFlatList tokens)) tokens = - [ ( TokenMap.AssetId (mkTokenPolicyId (ac `mod` 10)) (mkTokenName ac) + [ ( AssetId (mkTokenPolicyId (ac `mod` 10)) (mkTokenName ac) , TokenQuantity 42 ) | !ac <- [1 .. nAssets] diff --git a/lib/wallet/integration/src/Test/Integration/Framework/DSL.hs b/lib/wallet/integration/src/Test/Integration/Framework/DSL.hs index 606f2f9e291..62b32cccb6c 100644 --- a/lib/wallet/integration/src/Test/Integration/Framework/DSL.hs +++ b/lib/wallet/integration/src/Test/Integration/Framework/DSL.hs @@ -378,6 +378,9 @@ import Cardano.Wallet.Primitive.Types import Cardano.Wallet.Primitive.Types.Address ( Address (..) ) +import Cardano.Wallet.Primitive.Types.AssetId + ( AssetId (..) + ) import Cardano.Wallet.Primitive.Types.Coin ( Coin (..) ) @@ -1039,7 +1042,7 @@ isValidRandomDerivationPath path = pickAnAsset :: TokenMap.TokenMap -> ((Text, Text), Natural) pickAnAsset tm = case TokenMap.toFlatList tm of - (TokenBundle.AssetId pid an, TokenQuantity.TokenQuantity q):_ -> + (AssetId pid an, TokenQuantity.TokenQuantity q):_ -> ((toText pid, toText an), q) _ -> error "pickAnAsset: empty TokenMap" 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 97577f9741c..ad387604122 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 @@ -38,12 +38,12 @@ import Cardano.Wallet.Api.Types import Cardano.Wallet.Primitive.NetworkId ( HasSNetworkId ) +import Cardano.Wallet.Primitive.Types.AssetId + ( AssetId (..) + ) import Cardano.Wallet.Primitive.Types.Hash ( Hash (..) ) -import Cardano.Wallet.Primitive.Types.TokenMap - ( AssetId (..) - ) import Cardano.Wallet.Primitive.Types.TokenName ( TokenName (..) ) 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 a419291cee2..419930c3a59 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 @@ -125,6 +125,9 @@ import Cardano.Wallet.Primitive.Types , NonWalletCertificate (..) , SlotNo (..) ) +import Cardano.Wallet.Primitive.Types.AssetId + ( AssetId (..) + ) import Cardano.Wallet.Primitive.Types.Coin ( Coin (..) ) @@ -134,9 +137,6 @@ import Cardano.Wallet.Primitive.Types.Hash import Cardano.Wallet.Primitive.Types.RewardAccount ( RewardAccount (..) ) -import Cardano.Wallet.Primitive.Types.TokenBundle - ( AssetId (..) - ) import Cardano.Wallet.Primitive.Types.TokenFingerprint ( mkTokenFingerprint ) 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 2727de481b8..0a8166dbffe 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 @@ -31,12 +31,12 @@ import Prelude import Cardano.Wallet.Primitive.Types ( TokenMetadataServer (..) ) +import Cardano.Wallet.Primitive.Types.AssetId + ( AssetId (..) + ) import Cardano.Wallet.Primitive.Types.Hash ( Hash (..) ) -import Cardano.Wallet.Primitive.Types.TokenMap - ( AssetId (..) - ) import Cardano.Wallet.Primitive.Types.TokenMetadata ( AssetDecimals (..) , AssetLogo (..) diff --git a/lib/wallet/src/Cardano/Wallet.hs b/lib/wallet/src/Cardano/Wallet.hs index 7418a9e9ea3..a69c1b56de0 100644 --- a/lib/wallet/src/Cardano/Wallet.hs +++ b/lib/wallet/src/Cardano/Wallet.hs @@ -511,6 +511,9 @@ import Cardano.Wallet.Primitive.Types.Address ( Address (..) , AddressState (..) ) +import Cardano.Wallet.Primitive.Types.AssetId + ( AssetId + ) import Cardano.Wallet.Primitive.Types.BlockSummary ( ChainEvents ) @@ -2766,7 +2769,7 @@ listTransactions ctx mMinWithdrawal mStart mEnd order mLimit mAddress listAssets :: IsOurs s Address => WalletLayer IO s - -> IO (Set TokenMap.AssetId) + -> IO (Set AssetId) listAssets ctx = db & \DBLayer{..} -> do cp <- atomically readCheckpoint txs <- atomically $ @@ -2774,7 +2777,7 @@ listAssets ctx = db & \DBLayer{..} -> do allTxStatuses = Nothing in readTransactions noMinWithdrawal Ascending Range.everything allTxStatuses Nothing Nothing - let txAssets :: TransactionInfo -> Set TokenMap.AssetId + let txAssets :: TransactionInfo -> Set AssetId txAssets = Set.unions . map (TokenBundle.getAssets . view #tokens) . filter ourOut diff --git a/lib/wallet/src/Cardano/Wallet/Address/Keys/MintBurn.hs b/lib/wallet/src/Cardano/Wallet/Address/Keys/MintBurn.hs index c54e072de75..039a7c0539f 100644 --- a/lib/wallet/src/Cardano/Wallet/Address/Keys/MintBurn.hs +++ b/lib/wallet/src/Cardano/Wallet/Address/Keys/MintBurn.hs @@ -44,12 +44,12 @@ import Cardano.Wallet.Flavor import Cardano.Wallet.Primitive.Passphrase ( Passphrase (..) ) +import Cardano.Wallet.Primitive.Types.AssetId + ( AssetId (..) + ) import Cardano.Wallet.Primitive.Types.Hash ( Hash (..) ) -import Cardano.Wallet.Primitive.Types.TokenMap - ( AssetId (..) - ) import Cardano.Wallet.Primitive.Types.TokenName ( TokenName ) 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 2c1879464fd..360bf79accb 100644 --- a/lib/wallet/src/Cardano/Wallet/DB/Store/Checkpoints/Store.hs +++ b/lib/wallet/src/Cardano/Wallet/DB/Store/Checkpoints/Store.hs @@ -122,12 +122,12 @@ import Cardano.Wallet.Primitive.NetworkId ( HasSNetworkId (..) , NetworkDiscriminantCheck ) +import Cardano.Wallet.Primitive.Types.AssetId + ( AssetId (..) + ) import Cardano.Wallet.Primitive.Types.TokenBundle ( TokenBundle ) -import Cardano.Wallet.Primitive.Types.TokenMap - ( AssetId (..) - ) import Control.Monad ( forM , forM_ 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 895654c1cad..7920fcfbb3e 100644 --- a/lib/wallet/src/Cardano/Wallet/DB/Store/Transactions/Model.hs +++ b/lib/wallet/src/Cardano/Wallet/DB/Store/Transactions/Model.hs @@ -50,12 +50,12 @@ import Cardano.Wallet.DB.Sqlite.Schema import Cardano.Wallet.DB.Sqlite.Types ( TxId (..) ) +import Cardano.Wallet.Primitive.Types.AssetId + ( AssetId (AssetId) + ) import Cardano.Wallet.Primitive.Types.RewardAccount ( RewardAccount ) -import Cardano.Wallet.Primitive.Types.TokenMap - ( AssetId (AssetId) - ) import Cardano.Wallet.Primitive.Types.TokenName ( TokenName ) 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 da3db87aa95..c93f3b985a7 100644 --- a/lib/wallet/src/Cardano/Wallet/DB/Store/UTxOHistory/TxOutCBOR.hs +++ b/lib/wallet/src/Cardano/Wallet/DB/Store/UTxOHistory/TxOutCBOR.hs @@ -9,6 +9,9 @@ import Prelude import Cardano.Wallet.Primitive.Types.Address ( Address (..) ) +import Cardano.Wallet.Primitive.Types.AssetId + ( AssetId (AssetId) + ) import Cardano.Wallet.Primitive.Types.Coin ( Coin (..) ) @@ -19,8 +22,7 @@ import Cardano.Wallet.Primitive.Types.TokenBundle ( TokenBundle (TokenBundle) ) import Cardano.Wallet.Primitive.Types.TokenMap - ( AssetId (AssetId) - , fromFlatList + ( fromFlatList , toFlatList ) import Cardano.Wallet.Primitive.Types.TokenName 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 e8b738686f7..3b207d5a43b 100644 --- a/lib/wallet/src/Cardano/Wallet/Primitive/Types/Tx/TxSeq.hs +++ b/lib/wallet/src/Cardano/Wallet/Primitive/Types/Tx/TxSeq.hs @@ -113,6 +113,9 @@ import Prelude hiding import Cardano.Wallet.Primitive.Model ( applyTxToUTxO ) +import Cardano.Wallet.Primitive.Types.AssetId + ( AssetId (..) + ) import Cardano.Wallet.Primitive.Types.Coin ( Coin (..) ) @@ -122,9 +125,6 @@ import Cardano.Wallet.Primitive.Types.Hash import Cardano.Wallet.Primitive.Types.StateDeltaSeq ( StateDeltaSeq ) -import Cardano.Wallet.Primitive.Types.TokenMap - ( AssetId (..) - ) import Cardano.Wallet.Primitive.Types.TokenName ( TokenName (..) ) 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 4f3483f2fce..827332d26cb 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 @@ -37,6 +37,9 @@ import Prelude import Cardano.Wallet.Primitive.Types.Address ( Address ) +import Cardano.Wallet.Primitive.Types.AssetId + ( AssetId + ) import Cardano.Wallet.Primitive.Types.Coin ( Coin (..) ) @@ -50,9 +53,6 @@ import Cardano.Wallet.Primitive.Types.RewardAccount.Gen import Cardano.Wallet.Primitive.Types.TokenBundle.Gen ( genTokenBundlePartitionNonNull ) -import Cardano.Wallet.Primitive.Types.TokenMap - ( AssetId - ) import Cardano.Wallet.Primitive.Types.Tx ( Tx (..) , TxScriptValidity (..) diff --git a/lib/wallet/src/Cardano/Wallet/Shelley/Transaction.hs b/lib/wallet/src/Cardano/Wallet/Shelley/Transaction.hs index 5658eba22bf..e52ef7d7f90 100644 --- a/lib/wallet/src/Cardano/Wallet/Shelley/Transaction.hs +++ b/lib/wallet/src/Cardano/Wallet/Shelley/Transaction.hs @@ -128,6 +128,9 @@ import Cardano.Wallet.Primitive.Types import Cardano.Wallet.Primitive.Types.Address ( Address (..) ) +import Cardano.Wallet.Primitive.Types.AssetId + ( AssetId (..) + ) import Cardano.Wallet.Primitive.Types.Coin ( Coin (..) ) @@ -138,8 +141,7 @@ import Cardano.Wallet.Primitive.Types.TokenBundle ( TokenBundle (..) ) import Cardano.Wallet.Primitive.Types.TokenMap - ( AssetId (..) - , TokenMap + ( TokenMap ) import Cardano.Wallet.Primitive.Types.TokenQuantity ( TokenQuantity (TokenQuantity) @@ -252,6 +254,7 @@ import qualified Cardano.Ledger.Api as Ledger import qualified Cardano.Ledger.Keys.Bootstrap as SL import qualified Cardano.Wallet.Primitive.Ledger.Convert as Convert import qualified Cardano.Wallet.Primitive.Ledger.Shelley as Compatibility +import qualified Cardano.Wallet.Primitive.Types.AssetId as AssetId import qualified Cardano.Wallet.Primitive.Types.TokenMap as TokenMap import qualified Data.ByteString as BS import qualified Data.Foldable as F @@ -935,7 +938,7 @@ mkUnsignedTx witMap = Map.map toScriptWitnessGeneral $ Map.mapKeys - (toCardanoPolicyId . TokenMap.tokenPolicyId) + (toCardanoPolicyId . AssetId.tokenPolicyId) mintingSource ctx = Cardano.BuildTxWith witMap in Cardano.TxMintValue mintedEra (mintValue <> burnValue) ctx diff --git a/lib/wallet/src/Cardano/Wallet/TokenMetadata.hs b/lib/wallet/src/Cardano/Wallet/TokenMetadata.hs index 9bde51a285b..3e49391463e 100644 --- a/lib/wallet/src/Cardano/Wallet/TokenMetadata.hs +++ b/lib/wallet/src/Cardano/Wallet/TokenMetadata.hs @@ -90,12 +90,12 @@ import Cardano.BM.Extra import Cardano.Wallet.Primitive.Types ( TokenMetadataServer (..) ) +import Cardano.Wallet.Primitive.Types.AssetId + ( AssetId (..) + ) import Cardano.Wallet.Primitive.Types.Hash ( Hash (..) ) -import Cardano.Wallet.Primitive.Types.TokenMap - ( AssetId (..) - ) import Cardano.Wallet.Primitive.Types.TokenMetadata ( AssetDecimals (..) , AssetLogo (..) diff --git a/lib/wallet/src/Cardano/Wallet/Transaction.hs b/lib/wallet/src/Cardano/Wallet/Transaction.hs index 63398c2aac0..f9e7b287bca 100644 --- a/lib/wallet/src/Cardano/Wallet/Transaction.hs +++ b/lib/wallet/src/Cardano/Wallet/Transaction.hs @@ -92,6 +92,9 @@ import Cardano.Wallet.Primitive.Types.AnyExplicitScripts ( AnyExplicitScript (..) , changeRoleInAnyExplicitScript ) +import Cardano.Wallet.Primitive.Types.AssetId + ( AssetId + ) import Cardano.Wallet.Primitive.Types.Coin ( Coin (..) ) @@ -102,8 +105,7 @@ import Cardano.Wallet.Primitive.Types.RewardAccount ( RewardAccount ) import Cardano.Wallet.Primitive.Types.TokenMap - ( AssetId - , TokenMap + ( TokenMap ) import Cardano.Wallet.Primitive.Types.TokenMapWithScripts ( AnyScript (..) diff --git a/lib/wallet/test/unit/Cardano/Wallet/Api/TypesSpec.hs b/lib/wallet/test/unit/Cardano/Wallet/Api/TypesSpec.hs index fe477a37a09..f5c6d8b36c8 100644 --- a/lib/wallet/test/unit/Cardano/Wallet/Api/TypesSpec.hs +++ b/lib/wallet/test/unit/Cardano/Wallet/Api/TypesSpec.hs @@ -347,6 +347,9 @@ import Cardano.Wallet.Primitive.Types.Address ( Address (..) , AddressState (..) ) +import Cardano.Wallet.Primitive.Types.AssetId + ( AssetId (..) + ) import Cardano.Wallet.Primitive.Types.Coin ( Coin (..) ) @@ -360,8 +363,7 @@ import Cardano.Wallet.Primitive.Types.RewardAccount ( RewardAccount (..) ) import Cardano.Wallet.Primitive.Types.TokenBundle - ( AssetId (..) - , TokenBundle + ( TokenBundle ) import Cardano.Wallet.Primitive.Types.TokenBundle.Gen ( genTokenBundleSmallRange 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 d9a4764dcab..cf990b1b9ce 100644 --- a/lib/wallet/test/unit/Cardano/Wallet/Balance/Migration/SelectionSpec.hs +++ b/lib/wallet/test/unit/Cardano/Wallet/Balance/Migration/SelectionSpec.hs @@ -29,6 +29,9 @@ import Cardano.Wallet.Balance.Migration.Selection import Cardano.Wallet.Primitive.Types.Address ( Address ) +import Cardano.Wallet.Primitive.Types.AssetId + ( AssetId (..) + ) import Cardano.Wallet.Primitive.Types.Coin ( Coin (..) ) @@ -43,8 +46,7 @@ import Cardano.Wallet.Primitive.Types.TokenBundle , TokenBundle (..) ) import Cardano.Wallet.Primitive.Types.TokenMap - ( AssetId (..) - , TokenMap + ( TokenMap ) import Cardano.Wallet.Primitive.Types.TokenName ( TokenName (..) 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 2691ebc72ad..f70f862d95e 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 @@ -17,12 +17,12 @@ import Prelude import Cardano.Wallet.Primitive.Types.Address.Gen ( genAddress ) +import Cardano.Wallet.Primitive.Types.AssetId + ( AssetId + ) import Cardano.Wallet.Primitive.Types.Hash ( Hash (..) ) -import Cardano.Wallet.Primitive.Types.TokenMap - ( AssetId - ) import Cardano.Wallet.Primitive.Types.TokenMap.Gen ( genAssetId , shrinkAssetId diff --git a/lib/wallet/test/unit/Cardano/Wallet/Shelley/TransactionSpec.hs b/lib/wallet/test/unit/Cardano/Wallet/Shelley/TransactionSpec.hs index dc22dbbf448..67c3cea7c75 100644 --- a/lib/wallet/test/unit/Cardano/Wallet/Shelley/TransactionSpec.hs +++ b/lib/wallet/test/unit/Cardano/Wallet/Shelley/TransactionSpec.hs @@ -104,6 +104,9 @@ import Cardano.Wallet.Primitive.Passphrase import Cardano.Wallet.Primitive.Types.Address ( Address (..) ) +import Cardano.Wallet.Primitive.Types.AssetId + ( AssetId (..) + ) import Cardano.Wallet.Primitive.Types.Coin ( Coin (..) ) @@ -119,8 +122,7 @@ import Cardano.Wallet.Primitive.Types.Hash ( Hash (..) ) import Cardano.Wallet.Primitive.Types.TokenBundle - ( AssetId - , TokenBundle + ( TokenBundle ) import Cardano.Wallet.Primitive.Types.TokenBundle.Gen ( genTokenBundleSmallRange @@ -1618,7 +1620,7 @@ instance Arbitrary AnyRecentEra where instance Arbitrary AssetId where arbitrary = - TokenBundle.AssetId + AssetId <$> arbitrary -- In the calculation of the size of the Tx, the minting of assets -- increases the size of the Tx by both a constant factor per asset diff --git a/lib/wallet/test/unit/Cardano/Wallet/TokenMetadataSpec.hs b/lib/wallet/test/unit/Cardano/Wallet/TokenMetadataSpec.hs index af9750caffb..8300670c27d 100644 --- a/lib/wallet/test/unit/Cardano/Wallet/TokenMetadataSpec.hs +++ b/lib/wallet/test/unit/Cardano/Wallet/TokenMetadataSpec.hs @@ -9,12 +9,12 @@ module Cardano.Wallet.TokenMetadataSpec import Prelude +import Cardano.Wallet.Primitive.Types.AssetId + ( AssetId (..) + ) import Cardano.Wallet.Primitive.Types.Hash ( Hash (..) ) -import Cardano.Wallet.Primitive.Types.TokenMap - ( AssetId (..) - ) import Cardano.Wallet.Primitive.Types.TokenMetadata ( AssetDecimals (..) , AssetLogo (..)