From 3cc2d7709c25f4fc79372629040cf5ba26366f7d Mon Sep 17 00:00:00 2001 From: Johannes Lund Date: Sat, 9 Sep 2023 03:17:48 +0200 Subject: [PATCH] Move `Write.Tx` modules to `cardano-balance-tx` --- cabal.project | 1 + lib/balance-tx/cardano-balance-tx.cabal | 37 +++++++++++ .../Wallet/Shelley/Compatibility/Ledger.hs | 11 ++-- .../Wallet/Write/ProtocolParameters.hs | 0 .../lib}/Cardano/Wallet/Write/Tx.hs | 0 .../lib}/Cardano/Wallet/Write/Tx/Balance.hs | 10 +-- .../Write/Tx/Balance/TokenBundleSize.hs | 0 .../lib}/Cardano/Wallet/Write/Tx/Fees.hs | 0 .../lib}/Cardano/Wallet/Write/Tx/Gen.hs | 0 .../lib}/Cardano/Wallet/Write/Tx/Redeemers.hs | 0 .../lib}/Cardano/Wallet/Write/Tx/Sign.hs | 0 .../Cardano/Wallet/Write/Tx/SizeEstimation.hs | 25 ++++++-- .../Wallet/Write/Tx/TimeTranslation.hs | 0 .../Cardano/Wallet/Write/UTxOAssumptions.hs | 9 --- .../src/System/Random/StdGenSeed.hs | 0 lib/std-gen-seed/std-gen-seed.cabal | 64 +++++++++++++++++++ .../test/unit/System/Random/StdGenSeedSpec.hs | 0 lib/wallet/cardano-wallet.cabal | 15 +---- lib/wallet/src/Cardano/Wallet.hs | 4 +- .../src/Cardano/Wallet/Shelley/Transaction.hs | 4 +- lib/wallet/src/Cardano/Wallet/Transaction.hs | 4 +- lib/wallet/src/Cardano/Wallet/TxWitnessTag.hs | 8 --- lib/wallet/test/unit/Cardano/WalletSpec.hs | 4 +- 23 files changed, 143 insertions(+), 53 deletions(-) rename lib/{wallet/src => balance-tx/lib}/Cardano/Wallet/Shelley/Compatibility/Ledger.hs (98%) rename lib/{wallet/src => balance-tx/lib}/Cardano/Wallet/Write/ProtocolParameters.hs (100%) rename lib/{wallet/src => balance-tx/lib}/Cardano/Wallet/Write/Tx.hs (100%) rename lib/{wallet/src => balance-tx/lib}/Cardano/Wallet/Write/Tx/Balance.hs (99%) rename lib/{wallet/src => balance-tx/lib}/Cardano/Wallet/Write/Tx/Balance/TokenBundleSize.hs (100%) rename lib/{wallet/src => balance-tx/lib}/Cardano/Wallet/Write/Tx/Fees.hs (100%) rename lib/{wallet/src => balance-tx/lib}/Cardano/Wallet/Write/Tx/Gen.hs (100%) rename lib/{wallet/src => balance-tx/lib}/Cardano/Wallet/Write/Tx/Redeemers.hs (100%) rename lib/{wallet/src => balance-tx/lib}/Cardano/Wallet/Write/Tx/Sign.hs (100%) rename lib/{wallet/src => balance-tx/lib}/Cardano/Wallet/Write/Tx/SizeEstimation.hs (97%) rename lib/{wallet/src => balance-tx/lib}/Cardano/Wallet/Write/Tx/TimeTranslation.hs (100%) rename lib/{wallet/src => balance-tx/lib}/Cardano/Wallet/Write/UTxOAssumptions.hs (84%) rename lib/{wallet => std-gen-seed}/src/System/Random/StdGenSeed.hs (100%) create mode 100644 lib/std-gen-seed/std-gen-seed.cabal rename lib/{wallet => std-gen-seed}/test/unit/System/Random/StdGenSeedSpec.hs (100%) delete mode 100644 lib/wallet/src/Cardano/Wallet/TxWitnessTag.hs diff --git a/cabal.project b/cabal.project index e71affafbf9..e135bdda04a 100644 --- a/cabal.project +++ b/cabal.project @@ -76,6 +76,7 @@ packages: , lib/wai-middleware-logging/ , lib/wallet-benchmarks/ , lib/wallet/ + , lib/std-gen-seed -- Using RDRAND instead of /dev/urandom as an entropy source for key -- generation is dubious. Set the flag so we use /dev/urandom by default. diff --git a/lib/balance-tx/cardano-balance-tx.cabal b/lib/balance-tx/cardano-balance-tx.cabal index 0cfe9227f2d..8db704c3a40 100644 --- a/lib/balance-tx/cardano-balance-tx.cabal +++ b/lib/balance-tx/cardano-balance-tx.cabal @@ -40,7 +40,33 @@ library build-depends: , base , cardano-coin-selection + , cardano-slotting + , ouroboros-consensus , cardano-wallet-primitive + , cardano-strict-containers + , cardano-ledger-shelley + , cardano-ledger-core + , cardano-api + , cardano-ledger-conway + , cardano-ledger-binary + , cardano-ledger-api + , text + , lens + , serialise + , cborg + , monoid-subclasses + , pretty-simple + , random + , std-gen-seed + , cardano-ledger-mary + , cardano-ledger-babbage + , cardano-ledger-alonzo + , cardano-ledger-allegra + , cardano-crypto-class + , ouroboros-consensus-cardano + , int-cast + , cardano-addresses + , bytestring , cardano-wallet-test-utils , containers , deepseq @@ -54,6 +80,17 @@ library Cardano.Tx.Balance Cardano.Tx.Balance.Internal.CoinSelection Cardano.Tx.Balance.Internal.CoinSelection.Gen + Cardano.Wallet.Write.ProtocolParameters + Cardano.Wallet.Write.Tx + Cardano.Wallet.Write.Tx.Balance + Cardano.Wallet.Write.Tx.Balance.TokenBundleSize + Cardano.Wallet.Write.Tx.Gen + Cardano.Wallet.Write.Tx.Redeemers + Cardano.Wallet.Write.Tx.Sign + Cardano.Wallet.Write.Tx.SizeEstimation + Cardano.Wallet.Write.Tx.TimeTranslation + Cardano.Wallet.Write.UTxOAssumptions + Cardano.Wallet.Shelley.Compatibility.Ledger test-suite test import: language, opts-exe diff --git a/lib/wallet/src/Cardano/Wallet/Shelley/Compatibility/Ledger.hs b/lib/balance-tx/lib/Cardano/Wallet/Shelley/Compatibility/Ledger.hs similarity index 98% rename from lib/wallet/src/Cardano/Wallet/Shelley/Compatibility/Ledger.hs rename to lib/balance-tx/lib/Cardano/Wallet/Shelley/Compatibility/Ledger.hs index 21153d9e384..21253a7fd28 100644 --- a/lib/wallet/src/Cardano/Wallet/Shelley/Compatibility/Ledger.hs +++ b/lib/balance-tx/lib/Cardano/Wallet/Shelley/Compatibility/Ledger.hs @@ -52,6 +52,8 @@ import Cardano.Address.Script ( KeyHash (..), KeyRole (..), Script (..) ) import Cardano.Crypto.Hash ( hashFromBytes, hashToBytes ) +import Cardano.Slotting.Slot + ( SlotNo (..) ) import Cardano.Wallet.Primitive.Types.Address ( Address (..) ) import Cardano.Wallet.Primitive.Types.Coin @@ -116,7 +118,6 @@ import qualified Cardano.Wallet.Primitive.Types.TokenBundle as TokenBundle import qualified Cardano.Wallet.Primitive.Types.TokenMap as TokenMap import qualified Data.Map.Strict as Map import qualified Data.Sequence.Strict as StrictSeq -import qualified Ouroboros.Network.Block as O -------------------------------------------------------------------------------- -- Roundtrip conversion between wallet types and ledger specification types @@ -378,9 +379,9 @@ toWalletScript tokeyrole = fromLedgerScript RequireAnyOf $ map fromLedgerScript $ toList contents fromLedgerScript (Scripts.RequireMOf num contents) = RequireSomeOf (fromIntegral num) $ fromLedgerScript <$> toList contents - fromLedgerScript (Scripts.RequireTimeExpire (O.SlotNo slot)) = + fromLedgerScript (Scripts.RequireTimeExpire (SlotNo slot)) = ActiveUntilSlot $ fromIntegral slot - fromLedgerScript (Scripts.RequireTimeStart (O.SlotNo slot)) = + fromLedgerScript (Scripts.RequireTimeStart (SlotNo slot)) = ActiveFromSlot $ fromIntegral slot toWalletScriptFromShelley @@ -427,8 +428,8 @@ toLedgerTimelockScript s = case s of Scripts.RequireTimeStart (convertSlotNo slot) where - convertSlotNo :: Natural -> O.SlotNo - convertSlotNo x = O.SlotNo $ fromMaybe err $ intCastMaybe x + convertSlotNo :: Natural -> SlotNo + convertSlotNo x = SlotNo $ fromMaybe err $ intCastMaybe x where err = error $ unwords [ "toLedgerTimelockScript:" diff --git a/lib/wallet/src/Cardano/Wallet/Write/ProtocolParameters.hs b/lib/balance-tx/lib/Cardano/Wallet/Write/ProtocolParameters.hs similarity index 100% rename from lib/wallet/src/Cardano/Wallet/Write/ProtocolParameters.hs rename to lib/balance-tx/lib/Cardano/Wallet/Write/ProtocolParameters.hs diff --git a/lib/wallet/src/Cardano/Wallet/Write/Tx.hs b/lib/balance-tx/lib/Cardano/Wallet/Write/Tx.hs similarity index 100% rename from lib/wallet/src/Cardano/Wallet/Write/Tx.hs rename to lib/balance-tx/lib/Cardano/Wallet/Write/Tx.hs diff --git a/lib/wallet/src/Cardano/Wallet/Write/Tx/Balance.hs b/lib/balance-tx/lib/Cardano/Wallet/Write/Tx/Balance.hs similarity index 99% rename from lib/wallet/src/Cardano/Wallet/Write/Tx/Balance.hs rename to lib/balance-tx/lib/Cardano/Wallet/Write/Tx/Balance.hs index 6dfa626fe9d..dbb488d7372 100644 --- a/lib/wallet/src/Cardano/Wallet/Write/Tx/Balance.hs +++ b/lib/balance-tx/lib/Cardano/Wallet/Write/Tx/Balance.hs @@ -118,8 +118,6 @@ import Cardano.Wallet.Primitive.Types.Tx ( SealedTx, sealedTxFromCardano ) import Cardano.Wallet.Primitive.Types.Tx.Constraints ( TxSize (..), txOutMaxCoin, txOutMaxTokenQuantity ) -import Cardano.Wallet.Read.Primitive.Tx.Features.Outputs - ( fromCardanoValue ) import Cardano.Wallet.Write.ProtocolParameters ( ProtocolParameters (..) ) import Cardano.Wallet.Write.Tx @@ -156,11 +154,11 @@ import Cardano.Wallet.Write.Tx.Redeemers import Cardano.Wallet.Write.Tx.Sign ( estimateKeyWitnessCount, estimateSignedTxSize ) import Cardano.Wallet.Write.Tx.SizeEstimation - ( TxSkeleton (..), estimateTxCost ) + ( TxSkeleton (..), assumedTxWitnessTag, estimateTxCost ) import Cardano.Wallet.Write.Tx.TimeTranslation ( TimeTranslation ) import Cardano.Wallet.Write.UTxOAssumptions - ( UTxOAssumptions (..), assumedInputScriptTemplate, assumedTxWitnessTag ) + ( UTxOAssumptions (..), assumedInputScriptTemplate ) import Control.Arrow ( left ) import Control.Monad @@ -211,6 +209,7 @@ import qualified Cardano.Api as Cardano import qualified Cardano.Api.Byron as Cardano import qualified Cardano.Api.Byron as Byron import qualified Cardano.Api.Shelley as Cardano +import qualified Cardano.Api.Shelley as Cardano import qualified Cardano.CoinSelection.UTxOIndex as UTxOIndex import qualified Cardano.CoinSelection.UTxOSelection as UTxOSelection import qualified Cardano.Ledger.Core as Core @@ -1606,3 +1605,6 @@ validateTxOutputAdaQuantity constraints output (constraints ^. #computeMinimumAdaQuantity) (fst output) (snd output ^. #tokens) + +fromCardanoValue :: Cardano.Value -> W.TokenBundle +fromCardanoValue = W.toWalletTokenBundle . Cardano.toMaryValue diff --git a/lib/wallet/src/Cardano/Wallet/Write/Tx/Balance/TokenBundleSize.hs b/lib/balance-tx/lib/Cardano/Wallet/Write/Tx/Balance/TokenBundleSize.hs similarity index 100% rename from lib/wallet/src/Cardano/Wallet/Write/Tx/Balance/TokenBundleSize.hs rename to lib/balance-tx/lib/Cardano/Wallet/Write/Tx/Balance/TokenBundleSize.hs diff --git a/lib/wallet/src/Cardano/Wallet/Write/Tx/Fees.hs b/lib/balance-tx/lib/Cardano/Wallet/Write/Tx/Fees.hs similarity index 100% rename from lib/wallet/src/Cardano/Wallet/Write/Tx/Fees.hs rename to lib/balance-tx/lib/Cardano/Wallet/Write/Tx/Fees.hs diff --git a/lib/wallet/src/Cardano/Wallet/Write/Tx/Gen.hs b/lib/balance-tx/lib/Cardano/Wallet/Write/Tx/Gen.hs similarity index 100% rename from lib/wallet/src/Cardano/Wallet/Write/Tx/Gen.hs rename to lib/balance-tx/lib/Cardano/Wallet/Write/Tx/Gen.hs diff --git a/lib/wallet/src/Cardano/Wallet/Write/Tx/Redeemers.hs b/lib/balance-tx/lib/Cardano/Wallet/Write/Tx/Redeemers.hs similarity index 100% rename from lib/wallet/src/Cardano/Wallet/Write/Tx/Redeemers.hs rename to lib/balance-tx/lib/Cardano/Wallet/Write/Tx/Redeemers.hs diff --git a/lib/wallet/src/Cardano/Wallet/Write/Tx/Sign.hs b/lib/balance-tx/lib/Cardano/Wallet/Write/Tx/Sign.hs similarity index 100% rename from lib/wallet/src/Cardano/Wallet/Write/Tx/Sign.hs rename to lib/balance-tx/lib/Cardano/Wallet/Write/Tx/Sign.hs diff --git a/lib/wallet/src/Cardano/Wallet/Write/Tx/SizeEstimation.hs b/lib/balance-tx/lib/Cardano/Wallet/Write/Tx/SizeEstimation.hs similarity index 97% rename from lib/wallet/src/Cardano/Wallet/Write/Tx/SizeEstimation.hs rename to lib/balance-tx/lib/Cardano/Wallet/Write/Tx/SizeEstimation.hs index 07ac241e3e4..604838a9b91 100644 --- a/lib/wallet/src/Cardano/Wallet/Write/Tx/SizeEstimation.hs +++ b/lib/balance-tx/lib/Cardano/Wallet/Write/Tx/SizeEstimation.hs @@ -31,13 +31,17 @@ module Cardano.Wallet.Write.Tx.SizeEstimation , estimateTxCost , TxSkeleton (..) - -- ** Needed for balance migration + -- ** TxWitnessTag + , TxWitnessTag (..) + , assumedTxWitnessTag + + -- * Needed for balance migration , txConstraints - -- ** Needed for estimateSignedTxSize + -- * Needed for estimateSignedTxSize , sizeOf_BootstrapWitnesses - -- ** For the wallet + -- * For the wallet , _txRewardWithdrawalCost ) @@ -65,8 +69,6 @@ import Cardano.Wallet.Primitive.Types.Tx.Constraints ( TxConstraints (..), TxSize (..), txOutMaxCoin ) import Cardano.Wallet.Shelley.Compatibility.Ledger ( Convert (..) ) -import Cardano.Wallet.TxWitnessTag - ( TxWitnessTag (..) ) import Cardano.Wallet.Write.ProtocolParameters ( ProtocolParameters (..) ) import Cardano.Wallet.Write.Tx @@ -82,6 +84,8 @@ import Cardano.Wallet.Write.Tx ) import Cardano.Wallet.Write.Tx.Sign ( estimateMaxWitnessRequiredPerInput ) +import Cardano.Wallet.Write.UTxOAssumptions + ( UTxOAssumptions (..) ) import Control.Lens ( (^.) ) import Data.Generics.Internal.VL.Lens @@ -697,3 +701,14 @@ mkLedgerTxOut txOutEra address bundle = RecentEraConway -> W.toConwayTxOut txOut where txOut = W.TxOut address bundle + +data TxWitnessTag + = TxWitnessByronUTxO + | TxWitnessShelleyUTxO + deriving (Show, Eq) + +assumedTxWitnessTag :: UTxOAssumptions -> TxWitnessTag +assumedTxWitnessTag = \case + AllKeyPaymentCredentials -> TxWitnessShelleyUTxO + AllByronKeyPaymentCredentials -> TxWitnessByronUTxO + AllScriptPaymentCredentialsFrom {} -> TxWitnessShelleyUTxO diff --git a/lib/wallet/src/Cardano/Wallet/Write/Tx/TimeTranslation.hs b/lib/balance-tx/lib/Cardano/Wallet/Write/Tx/TimeTranslation.hs similarity index 100% rename from lib/wallet/src/Cardano/Wallet/Write/Tx/TimeTranslation.hs rename to lib/balance-tx/lib/Cardano/Wallet/Write/Tx/TimeTranslation.hs diff --git a/lib/wallet/src/Cardano/Wallet/Write/UTxOAssumptions.hs b/lib/balance-tx/lib/Cardano/Wallet/Write/UTxOAssumptions.hs similarity index 84% rename from lib/wallet/src/Cardano/Wallet/Write/UTxOAssumptions.hs rename to lib/balance-tx/lib/Cardano/Wallet/Write/UTxOAssumptions.hs index ae1ac92ac80..3765b2ca32d 100644 --- a/lib/wallet/src/Cardano/Wallet/Write/UTxOAssumptions.hs +++ b/lib/balance-tx/lib/Cardano/Wallet/Write/UTxOAssumptions.hs @@ -10,7 +10,6 @@ module Cardano.Wallet.Write.UTxOAssumptions -- * UTxOAssumptions UTxOAssumptions (..) , assumedInputScriptTemplate - , assumedTxWitnessTag -- * Validation , validateAddress @@ -21,8 +20,6 @@ import Prelude import Cardano.Ledger.Shelley.API ( Addr (..), Credential (..) ) -import Cardano.Wallet.TxWitnessTag - ( TxWitnessTag (..) ) import Cardano.Wallet.Write.Tx ( Address ) @@ -50,12 +47,6 @@ assumedInputScriptTemplate = \case AllByronKeyPaymentCredentials -> Nothing AllScriptPaymentCredentialsFrom scriptTemplate _ -> Just scriptTemplate -assumedTxWitnessTag :: UTxOAssumptions -> TxWitnessTag -assumedTxWitnessTag = \case - AllKeyPaymentCredentials -> TxWitnessShelleyUTxO - AllByronKeyPaymentCredentials -> TxWitnessByronUTxO - AllScriptPaymentCredentialsFrom {} -> TxWitnessShelleyUTxO - validateAddress :: UTxOAssumptions -> Address -> Bool validateAddress = valid where diff --git a/lib/wallet/src/System/Random/StdGenSeed.hs b/lib/std-gen-seed/src/System/Random/StdGenSeed.hs similarity index 100% rename from lib/wallet/src/System/Random/StdGenSeed.hs rename to lib/std-gen-seed/src/System/Random/StdGenSeed.hs diff --git a/lib/std-gen-seed/std-gen-seed.cabal b/lib/std-gen-seed/std-gen-seed.cabal new file mode 100644 index 00000000000..3214116ea9a --- /dev/null +++ b/lib/std-gen-seed/std-gen-seed.cabal @@ -0,0 +1,64 @@ +cabal-version: 3.0 +name: std-gen-seed +version: 0.1.0.0 +synopsis: modules to support applications for the cardano wallet +license: Apache-2.0 +license-file: LICENSE +author: HAL, Cardano Foundation +maintainer: hal@cardanofoundation.org +build-type: Simple +extra-doc-files: CHANGELOG.md + +library + default-language: Haskell2010 + default-extensions: + NoImplicitPrelude + DerivingStrategies + OverloadedStrings + + ghc-options: + -O2 -Wall -Wincomplete-record-updates -Wincomplete-uni-patterns + -Wunused-foralls -Wunused-foralls -fprint-explicit-foralls + -fprint-explicit-kinds -Wcompat -Widentities + -Werror=incomplete-patterns -Wredundant-constraints + -Wpartial-fields -Wtabs -fhelpful-errors -fprint-expanded-synonyms + -fwarn-unused-do-bind -fwarn-incomplete-uni-patterns + -freverse-errors + + exposed-modules: + System.Random.StdGenSeed + + hs-source-dirs: src + build-depends: + , base + , random + , MonadRandom + , OddWord + , quiet + , splitmix + +test-suite unit + default-language: + Haskell2010 + default-extensions: + NoImplicitPrelude + OverloadedStrings + ghc-options: + -threaded -rtsopts + -Wall -O2 -Werror + build-depends: + base + , hspec + , QuickCheck + , std-gen-seed + build-tool-depends: + hspec-discover:hspec-discover + type: + exitcode-stdio-1.0 + hs-source-dirs: + test/unit + main-is: + std-gen-seed-unit-test.hs + other-modules: + System.Random.StdGenSeedSpec + diff --git a/lib/wallet/test/unit/System/Random/StdGenSeedSpec.hs b/lib/std-gen-seed/test/unit/System/Random/StdGenSeedSpec.hs similarity index 100% rename from lib/wallet/test/unit/System/Random/StdGenSeedSpec.hs rename to lib/std-gen-seed/test/unit/System/Random/StdGenSeedSpec.hs diff --git a/lib/wallet/cardano-wallet.cabal b/lib/wallet/cardano-wallet.cabal index 875c4695d84..e32c322a3b7 100644 --- a/lib/wallet/cardano-wallet.cabal +++ b/lib/wallet/cardano-wallet.cabal @@ -336,7 +336,6 @@ library Cardano.Wallet.Registry Cardano.Wallet.Shelley.BlockchainSource Cardano.Wallet.Shelley.Compatibility - Cardano.Wallet.Shelley.Compatibility.Ledger Cardano.Wallet.Shelley.Network Cardano.Wallet.Shelley.Network.Node Cardano.Wallet.Shelley.Transaction @@ -350,20 +349,9 @@ library Cardano.Wallet.TokenMetadata Cardano.Wallet.Transaction Cardano.Wallet.Transaction.Built - Cardano.Wallet.TxWitnessTag Cardano.Wallet.TypeLevel Cardano.Wallet.Version Cardano.Wallet.Version.TH - Cardano.Wallet.Write.ProtocolParameters - Cardano.Wallet.Write.Tx - Cardano.Wallet.Write.Tx.Balance - Cardano.Wallet.Write.Tx.Balance.TokenBundleSize - Cardano.Wallet.Write.Tx.Gen - Cardano.Wallet.Write.Tx.Redeemers - Cardano.Wallet.Write.Tx.Sign - Cardano.Wallet.Write.Tx.SizeEstimation - Cardano.Wallet.Write.Tx.TimeTranslation - Cardano.Wallet.Write.UTxOAssumptions Control.Concurrent.Concierge Control.Monad.Exception.Unchecked Control.Monad.Fail.Extended @@ -376,7 +364,6 @@ library Database.Persist.PersistValue.Extended Network.Ntp Ouroboros.Network.Client.Wallet - System.Random.StdGenSeed UnliftIO.Compat other-modules: Paths_cardano_wallet @@ -794,6 +781,7 @@ test-suite unit , mtl , network , network-uri + , std-gen-seed , nothunks , OddWord , openapi3 ==3.2.2 @@ -942,7 +930,6 @@ test-suite unit Data.Vector.ShuffleSpec Spec SpecHook - System.Random.StdGenSeedSpec test-suite integration import: language, opts-exe diff --git a/lib/wallet/src/Cardano/Wallet.hs b/lib/wallet/src/Cardano/Wallet.hs index eba2b49b5b8..b6f0bd8aa6d 100644 --- a/lib/wallet/src/Cardano/Wallet.hs +++ b/lib/wallet/src/Cardano/Wallet.hs @@ -508,8 +508,6 @@ import Cardano.Wallet.Transaction ) import Cardano.Wallet.Transaction.Built ( BuiltTx (..) ) -import Cardano.Wallet.TxWitnessTag - ( TxWitnessTag (..) ) import Cardano.Wallet.Write.Tx ( recentEra ) import Cardano.Wallet.Write.Tx.Balance @@ -522,6 +520,8 @@ import Cardano.Wallet.Write.Tx.Balance , balanceTransaction , constructUTxOIndex ) +import Cardano.Wallet.Write.Tx.SizeEstimation + ( TxWitnessTag (..) ) import Cardano.Wallet.Write.Tx.SizeEstimation ( _txRewardWithdrawalCost ) import Cardano.Wallet.Write.Tx.TimeTranslation diff --git a/lib/wallet/src/Cardano/Wallet/Shelley/Transaction.hs b/lib/wallet/src/Cardano/Wallet/Shelley/Transaction.hs index 9faa2694dff..414e233651a 100644 --- a/lib/wallet/src/Cardano/Wallet/Shelley/Transaction.hs +++ b/lib/wallet/src/Cardano/Wallet/Shelley/Transaction.hs @@ -151,10 +151,10 @@ import Cardano.Wallet.Transaction , WitnessCountCtx (..) , selectionDelta ) -import Cardano.Wallet.TxWitnessTag - ( TxWitnessTag (..) ) import Cardano.Wallet.Util ( HasCallStack, internalError ) +import Cardano.Wallet.Write.Tx.SizeEstimation + ( TxWitnessTag (..) ) import Control.Arrow ( left, second ) import Control.Lens diff --git a/lib/wallet/src/Cardano/Wallet/Transaction.hs b/lib/wallet/src/Cardano/Wallet/Transaction.hs index 72ffb95bae5..2cc228fca44 100644 --- a/lib/wallet/src/Cardano/Wallet/Transaction.hs +++ b/lib/wallet/src/Cardano/Wallet/Transaction.hs @@ -95,8 +95,6 @@ import Cardano.Wallet.Primitive.Types.Tx.TxIn ( TxIn (..) ) import Cardano.Wallet.Primitive.Types.Tx.TxOut ( TxOut (..) ) -import Cardano.Wallet.TxWitnessTag - ( TxWitnessTag ) import Control.DeepSeq ( NFData (..) ) import Data.List.NonEmpty @@ -122,6 +120,8 @@ import qualified Cardano.Api as Cardano import qualified Cardano.Wallet.Primitive.Types.TokenMap as TokenMap import qualified Cardano.Wallet.Primitive.Types.Tx.TxOut as TxOut import qualified Cardano.Wallet.Write.Tx as Write +import Cardano.Wallet.Write.Tx.SizeEstimation + ( TxWitnessTag ) import qualified Data.Foldable as F import qualified Data.List as L import qualified Data.Map.Strict as Map diff --git a/lib/wallet/src/Cardano/Wallet/TxWitnessTag.hs b/lib/wallet/src/Cardano/Wallet/TxWitnessTag.hs deleted file mode 100644 index c36c4c1f58c..00000000000 --- a/lib/wallet/src/Cardano/Wallet/TxWitnessTag.hs +++ /dev/null @@ -1,8 +0,0 @@ -module Cardano.Wallet.TxWitnessTag where - -import Prelude - -data TxWitnessTag - = TxWitnessByronUTxO - | TxWitnessShelleyUTxO - deriving (Show, Eq) diff --git a/lib/wallet/test/unit/Cardano/WalletSpec.hs b/lib/wallet/test/unit/Cardano/WalletSpec.hs index 54dd90caf07..3ef0cadabf6 100644 --- a/lib/wallet/test/unit/Cardano/WalletSpec.hs +++ b/lib/wallet/test/unit/Cardano/WalletSpec.hs @@ -144,14 +144,14 @@ import Cardano.Wallet.Transaction ) import Cardano.Wallet.Transaction.Built ( BuiltTx (..) ) -import Cardano.Wallet.TxWitnessTag - ( TxWitnessTag (TxWitnessShelleyUTxO) ) import Cardano.Wallet.Unsafe ( unsafeRunExceptT ) import Cardano.Wallet.Util ( HasCallStack ) import Cardano.Wallet.Write.Tx.Balance ( ErrBalanceTx (..), ErrBalanceTxAssetsInsufficientError (..) ) +import Cardano.Wallet.Write.Tx.SizeEstimation + ( TxWitnessTag (..) ) import Control.DeepSeq ( NFData (..) ) import Control.Monad