Skip to content

Commit

Permalink
[ADP-3344] Split off Cardano.Write.Eras (#4809)
Browse files Browse the repository at this point in the history
This pull requests splits off a public module `Cardano.Write.Eras` for
working with the notion of "recent era".

First, we split off an internal module, then we create a public module
that re-exports the internal module.

### Comments

* In order to keep the scope of this pull request contained, I have not
attempted to shrink the exported interface of `Cardano.Write.Eras` yet.

### Issue Number

ADP-3344
  • Loading branch information
HeinrichApfelmus authored Oct 17, 2024
2 parents b8e8191 + b1110a5 commit f258291
Show file tree
Hide file tree
Showing 35 changed files with 555 additions and 405 deletions.
6 changes: 4 additions & 2 deletions lib/api/src/Cardano/Wallet/Api/Http/Server/Error.hs
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,9 @@ import qualified Cardano.Wallet.Api.Types.WalletAssets as ApiWalletAssets
import qualified Cardano.Wallet.Primitive.Types.TokenBundle as TokenBundle
import qualified Cardano.Wallet.Primitive.Types.TokenMap as TokenMap
import qualified Cardano.Wallet.Primitive.Types.UTxO as UTxO
import qualified Cardano.Write.Eras as Write
( IsRecentEra
)
import qualified Data.Aeson as Aeson
import qualified Data.ByteString as BS
import qualified Data.ByteString.Lazy as BL
Expand All @@ -222,8 +225,7 @@ import qualified Data.List as L
import qualified Data.Text as T
import qualified Data.Text.Encoding as T
import qualified Internal.Cardano.Write.Tx as Write
( IsRecentEra
, serializeTx
( serializeTx
)
import qualified Internal.Cardano.Write.Tx as WriteTx
import qualified Internal.Cardano.Write.Tx.Balance as Write
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ import Cardano.Wallet.Api.Http.Server.Error.IsServerError
import Cardano.Wallet.Api.Types.Error
( ApiErrorInfo (..)
)
import Cardano.Write.Eras
( IsRecentEra (..)
)
import Fmt
( pretty
)
import Internal.Cardano.Write.Tx
( IsRecentEra (..)
)
import Internal.Cardano.Write.Tx.Balance
( ErrAssignRedeemers (..)
)
Expand Down
16 changes: 9 additions & 7 deletions lib/api/src/Cardano/Wallet/Api/Http/Shelley/Server.hs
Original file line number Diff line number Diff line change
Expand Up @@ -668,6 +668,9 @@ import Cardano.Wallet.Transaction
import Cardano.Wallet.Unsafe
( unsafeRunExceptT
)
import Cardano.Write.Eras
( AnyRecentEra (..)
)
import Control.Arrow
( second
, (&&&)
Expand Down Expand Up @@ -799,9 +802,6 @@ import Fmt
import GHC.Generics
( Generic
)
import Internal.Cardano.Write.Tx
( AnyRecentEra (..)
)
import Internal.Cardano.Write.Tx.Balance
( PartialTx (..)
, Redeemer (..)
Expand Down Expand Up @@ -882,6 +882,12 @@ import qualified Cardano.Wallet.Primitive.Types.UTxO as UTxO
import qualified Cardano.Wallet.Read as Read
import qualified Cardano.Wallet.Read.Hash as Hash
import qualified Cardano.Wallet.Registry as Registry
import qualified Cardano.Write.Eras as Write
( IsRecentEra
, RecentEra
, cardanoEra
, cardanoEraFromRecentEra
)
import qualified Control.Concurrent.Concierge as Concierge
import qualified Data.ByteArray as BA
import qualified Data.ByteString as BS
Expand All @@ -893,14 +899,10 @@ import qualified Data.Set as Set
import qualified Data.Text as T
import qualified Internal.Cardano.Write.Tx as Write
( Datum (DatumHash, NoDatum)
, IsRecentEra
, PParamsInAnyRecentEra (PParamsInAnyRecentEra)
, RecentEra
, Tx
, TxIn
, TxOutInRecentEra (TxOutInRecentEra)
, cardanoEra
, cardanoEraFromRecentEra
, fromCardanoApiTx
, getFeePerByte
, pattern PolicyId
Expand Down
6 changes: 3 additions & 3 deletions lib/api/src/Cardano/Wallet/Api/Types/Era.hs
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,12 @@ import Text.Show
)

import qualified Cardano.Wallet.Read as Read
import qualified Data.Aeson as Aeson
import qualified Data.Set as Set
import qualified Internal.Cardano.Write.Tx as Write
import qualified Cardano.Write.Eras as Write
( allRecentEras
, toAnyCardanoEra
)
import qualified Data.Aeson as Aeson
import qualified Data.Set as Set

data ApiEra
= ApiByron
Expand Down
2 changes: 2 additions & 0 deletions lib/balance-tx/cardano-balance-tx.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ library
build-depends:
, cardano-balance-tx:internal
exposed-modules:
Cardano.Write.Eras
Cardano.Write.Tx

library internal
Expand Down Expand Up @@ -87,6 +88,7 @@ library internal
, text
, transformers
exposed-modules:
Internal.Cardano.Write.Eras
Internal.Cardano.Write.Tx
Internal.Cardano.Write.Tx.Balance
Internal.Cardano.Write.Tx.Balance.CoinSelection
Expand Down
Loading

0 comments on commit f258291

Please sign in to comment.