Skip to content

Commit

Permalink
[ADP-3229] Merge conversions lib into primitive lib (#4262)
Browse files Browse the repository at this point in the history
- [x] integrate conversions lib into primitive as needed by read
conversions

ADP-3229
  • Loading branch information
paolino authored Nov 23, 2023
2 parents 447f428 + 7ce1aa3 commit 2705870
Show file tree
Hide file tree
Showing 34 changed files with 114 additions and 217 deletions.
1 change: 0 additions & 1 deletion cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ packages:
, lib/cardano-api-extra/
, lib/crypto-hash-extra/
, lib/coin-selection/
, lib/conversions/
, lib/customer-deposit-wallet/
, lib/delta-store/
, lib/delta-table
Expand Down
1 change: 0 additions & 1 deletion lib/balance-tx/cardano-balance-tx.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ library internal
, cardano-ledger-shelley
, cardano-slotting
, cardano-strict-containers
, cardano-wallet-conversions
, cardano-wallet-primitive
, cardano-wallet-test-utils
, cborg
Expand Down
2 changes: 1 addition & 1 deletion lib/balance-tx/lib/internal/Internal/Cardano/Write/Tx.hs
Original file line number Diff line number Diff line change
Expand Up @@ -282,10 +282,10 @@ import qualified Cardano.Ledger.Keys as Ledger
import qualified Cardano.Ledger.Shelley.API.Wallet as Shelley
import qualified Cardano.Ledger.Shelley.UTxO as Shelley
import qualified Cardano.Ledger.TxIn as Ledger
import qualified Cardano.Wallet.Primitive.Convert as Convert
import qualified Cardano.Wallet.Primitive.Types.Tx.Constraints as W
( txOutMaxCoin
)
import qualified Cardano.Wallet.Shelley.Compatibility.Ledger as Convert
import qualified Data.Map as Map

--------------------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ import qualified Cardano.Api.Shelley as CardanoApi
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.Convert as Convert
import qualified Cardano.Wallet.Primitive.Types.Address as W
( Address
)
Expand Down Expand Up @@ -325,7 +326,6 @@ import qualified Cardano.Wallet.Primitive.Types.UTxO as W.UTxO
import qualified Cardano.Wallet.Primitive.Types.UTxO as W
( UTxO (..)
)
import qualified Cardano.Wallet.Shelley.Compatibility.Ledger as Convert
import qualified Data.Foldable as F
import qualified Data.List as L
import qualified Data.Map as Map
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ import Internal.Cardano.Write.Tx
, Version
)

import qualified Cardano.Wallet.Primitive.Convert as Convert
import qualified Cardano.Wallet.Primitive.Types.TokenBundle as W
( TokenBundle
)
import qualified Cardano.Wallet.Primitive.Types.Tx.Constraints as W
( TxSize (..)
)
import qualified Cardano.Wallet.Shelley.Compatibility.Ledger as Convert
import qualified Data.ByteString.Lazy as BL

-- | Assesses a token bundle size in relation to the maximum size that can be
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,13 @@ import qualified Cardano.Api.Byron as CardanoApi
import qualified Cardano.Api.Shelley as CardanoApi
import qualified Cardano.Ledger.Alonzo.Scripts as Alonzo
import qualified Cardano.Ledger.Api as Ledger
import qualified Cardano.Wallet.Primitive.Convert as Convert
import qualified Cardano.Wallet.Primitive.Types.Coin as W
( Coin (..)
)
import qualified Cardano.Wallet.Primitive.Types.Tx.Constraints as W
( TxSize (..)
)
import qualified Cardano.Wallet.Shelley.Compatibility.Ledger as Convert
import qualified Data.Foldable as F
import qualified Data.List as L
import qualified Data.Map as Map
Expand Down
86 changes: 0 additions & 86 deletions lib/conversions/cardano-wallet-conversions.cabal

This file was deleted.

1 change: 0 additions & 1 deletion lib/conversions/test/spec/Spec.hs

This file was deleted.

10 changes: 0 additions & 10 deletions lib/conversions/test/spec/SpecHook.hs

This file was deleted.

15 changes: 0 additions & 15 deletions lib/conversions/test/spec/run-test-suite.hs

This file was deleted.

48 changes: 31 additions & 17 deletions lib/primitive/cardano-wallet-primitive.cabal
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
cabal-version: 3.0
name: cardano-wallet-primitive
version: 2023.7.18
synopsis: Selected primitive types for Cardano Wallet.
description: Please see README.md.
homepage: https://github.com/cardano-foundation/cardano-wallet
author: Cardano Foundation (High Assurance Lab)
maintainer: [email protected]
copyright: 2018-2022 IOHK, 2023 Cardano Foundation
license: Apache-2.0
category: Web
build-type: Simple
cabal-version: 3.0
name: cardano-wallet-primitive
version: 2023.7.18
synopsis: Selected primitive types for Cardano Wallet.
description: Please see README.md.
homepage: https://github.com/cardano-foundation/cardano-wallet
author: Cardano Foundation (High Assurance Lab)
maintainer: [email protected]
copyright: 2018-2022 IOHK, 2023 Cardano Foundation
license: Apache-2.0
category: Web
build-type: Simple

common language
default-language: Haskell2010
Expand Down Expand Up @@ -37,7 +37,6 @@ flag release
library
import: language, opts-lib
hs-source-dirs: lib

build-depends:
, aeson
, base
Expand All @@ -46,20 +45,28 @@ library
, binary
, bytestring
, cardano-addresses
, cardano-binary
, cardano-api
, cardano-binary
, cardano-crypto
, cardano-crypto-class
, cardano-ledger-allegra
, cardano-ledger-alonzo
, cardano-ledger-babbage
, cardano-ledger-core
, cardano-ledger-mary
, cardano-ledger-shelley
, cardano-numeric
, cardano-slotting
, cardano-strict-containers
, cardano-wallet-read
, cardano-wallet-test-utils
, cborg
, commutative-semigroups
, contra-tracer
, containers
, contra-tracer
, cryptonite
, delta-types
, deepseq
, delta-types
, errors
, extra
, fmt
Expand All @@ -79,6 +86,7 @@ library
, nothunks
, OddWord
, ouroboros-consensus
, ouroboros-consensus-cardano
, pretty-simple
, QuickCheck
, quiet
Expand All @@ -96,6 +104,7 @@ library
exposed-modules:
Cardano.Wallet.Orphans
Cardano.Wallet.Primitive.Collateral
Cardano.Wallet.Primitive.Convert
Cardano.Wallet.Primitive.NetworkId
Cardano.Wallet.Primitive.Slotting
Cardano.Wallet.Primitive.Slotting.Legacy
Expand Down Expand Up @@ -166,6 +175,8 @@ test-suite test
, base58-bytestring
, binary
, bytestring
, cardano-addresses
, cardano-ledger-allegra:{cardano-ledger-allegra, testlib}
, cardano-ledger-byron-test
, cardano-ledger-core:{cardano-ledger-core, testlib}
, cardano-ledger-shelley-test
Expand All @@ -174,9 +185,9 @@ test-suite test
, cardano-wallet-primitive
, cardano-wallet-test-utils
, containers
, deepseq
, delta-store
, delta-types
, deepseq
, filepath
, fmt
, generic-arbitrary
Expand All @@ -188,6 +199,7 @@ test-suite test
, lattices
, MonadRandom
, ouroboros-consensus
, ouroboros-consensus-cardano
, QuickCheck
, quickcheck-classes
, quickcheck-instances
Expand All @@ -201,9 +213,11 @@ test-suite test
, transformers
, unliftio
, with-utf8

build-tool-depends: hspec-discover:hspec-discover
other-modules:
Cardano.Wallet.Primitive.CollateralSpec
Cardano.Wallet.Primitive.ConvertSpec
Cardano.Wallet.Primitive.SlottingSpec
Cardano.Wallet.Primitive.SyncProgressSpec
Cardano.Wallet.Primitive.Types.AddressSpec
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
-- Exposes a wallet-friendly interface to types and functions exported by the
-- ledger specification.
--
module Cardano.Wallet.Shelley.Compatibility.Ledger
module Cardano.Wallet.Primitive.Convert
(
-- * Conversions from wallet types to ledger specification types
toLedgerAddress
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{-# LANGUAGE TypeApplications #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}

module Cardano.Wallet.Shelley.Compatibility.LedgerSpec
module Cardano.Wallet.Primitive.ConvertSpec
( spec
) where

Expand All @@ -14,6 +14,11 @@ import Cardano.Address.Script
, KeyRole (..)
, Script (..)
)
import Cardano.Wallet.Primitive.Convert
( Convert (..)
, toLedgerTimelockScript
, toWalletScript
)
import Cardano.Wallet.Primitive.Types.Coin
( Coin (..)
)
Expand Down Expand Up @@ -50,11 +55,6 @@ import Cardano.Wallet.Primitive.Types.Tx.TxOut.Gen
( genTxOutCoin
, shrinkTxOutCoin
)
import Cardano.Wallet.Shelley.Compatibility.Ledger
( Convert (..)
, toLedgerTimelockScript
, toWalletScript
)
import Data.Proxy
( Proxy (..)
)
Expand Down Expand Up @@ -93,7 +93,7 @@ import Test.QuickCheck
import qualified Data.ByteString as BS

spec :: Spec
spec = describe "Cardano.Wallet.Shelley.Compatibility.LedgerSpec" $
spec = describe "Cardano.Wallet.Primitive.ConvertSpec" $

modifyMaxSuccess (const 1000) $ do

Expand Down
12 changes: 6 additions & 6 deletions lib/wallet/api/http/Cardano/Wallet/Api/Http/Server/Error.hs
Original file line number Diff line number Diff line change
Expand Up @@ -101,18 +101,18 @@ import Cardano.Wallet.Api.Types.Error
, ApiErrorSharedWalletNoSuchCosigner (..)
, ApiErrorTxOutputLovelaceInsufficient (..)
)
import Cardano.Wallet.Primitive.Convert
( Convert (toWallet)
, toWalletAddress
, toWalletCoin
, toWalletTokenBundle
)
import Cardano.Wallet.Primitive.Slotting
( PastHorizonException
)
import Cardano.Wallet.Primitive.Types.TokenMap
( Flat (..)
)
import Cardano.Wallet.Shelley.Compatibility.Ledger
( Convert (toWallet)
, toWalletAddress
, toWalletCoin
, toWalletTokenBundle
)
import Cardano.Wallet.Transaction
( ErrSignTx (..)
)
Expand Down
Loading

0 comments on commit 2705870

Please sign in to comment.