Skip to content

Commit

Permalink
[ADP-3215] Move Cardano.Wallet.Read.Tx to Cardano.Read.Ledger.Tx (#…
Browse files Browse the repository at this point in the history
…4704)

This pull request moves most modules in the `Cardano.Wallet.Read.Tx`
namespace to the `Cardano.Read.Ledger.Tx` namespace. This is a pure
refactoring.

### Issue Number

ADP-3215
  • Loading branch information
HeinrichApfelmus authored Jul 29, 2024
2 parents 781901c + 5d240ec commit 4b711d4
Show file tree
Hide file tree
Showing 57 changed files with 310 additions and 320 deletions.
50 changes: 25 additions & 25 deletions lib/api/src/Cardano/Wallet/Api/Http/Server/Handlers/TxCBOR.hs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,31 @@ import Prelude
import Cardano.Binary
( DecoderError
)
import Cardano.Read.Ledger.Tx.CBOR
( TxCBOR
, deserializeTx
)
import Cardano.Read.Ledger.Tx.Certificates
( getEraCertificates
)
import Cardano.Read.Ledger.Tx.ExtraSigs
( getEraExtraSigs
)
import Cardano.Read.Ledger.Tx.Integrity
( getEraIntegrity
)
import Cardano.Read.Ledger.Tx.Mint
( getEraMint
)
import Cardano.Read.Ledger.Tx.ReferenceInputs
( getEraReferenceInputs
)
import Cardano.Read.Ledger.Tx.Validity
( getEraValidity
)
import Cardano.Read.Ledger.Tx.Witnesses
( getEraWitnesses
)
import Cardano.Wallet.Api.Http.Server.Error
( IsServerError (..)
, apiError
Expand Down Expand Up @@ -45,31 +70,6 @@ import Cardano.Wallet.Read.Eras
import Cardano.Wallet.Read.Eras.EraFun
( applyEraFun
)
import Cardano.Wallet.Read.Tx.CBOR
( TxCBOR
, deserializeTx
)
import Cardano.Wallet.Read.Tx.Certificates
( getEraCertificates
)
import Cardano.Wallet.Read.Tx.ExtraSigs
( getEraExtraSigs
)
import Cardano.Wallet.Read.Tx.Integrity
( getEraIntegrity
)
import Cardano.Wallet.Read.Tx.Mint
( getEraMint
)
import Cardano.Wallet.Read.Tx.ReferenceInputs
( getEraReferenceInputs
)
import Cardano.Wallet.Read.Tx.Validity
( getEraValidity
)
import Cardano.Wallet.Read.Tx.Witnesses
( getEraWitnesses
)
import Cardano.Wallet.Transaction
( TokenMapWithScripts
, ValidityIntervalExplicit
Expand Down
6 changes: 3 additions & 3 deletions lib/api/src/Cardano/Wallet/Api/Http/Shelley/Server.hs
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,9 @@ import Cardano.Mnemonic
import Cardano.Pool.Types
( PoolId
)
import Cardano.Read.Ledger.Tx.CBOR
( TxCBOR
)
import Cardano.Wallet
( BuiltTx (..)
, DelegationFee (feePercentiles)
Expand Down Expand Up @@ -653,9 +656,6 @@ import Cardano.Wallet.Primitive.Types.Tx.TxMeta
import Cardano.Wallet.Primitive.Types.Tx.TxOut
( TxOut (..)
)
import Cardano.Wallet.Read.Tx.CBOR
( TxCBOR
)
import Cardano.Wallet.Registry
( HasWorkerCtx (..)
, MkWorker (..)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ import Cardano.Ledger.Coin
import Cardano.Ledger.Mary.Value
( MaryValue (..)
)
import Cardano.Read.Ledger.Tx.Outputs
( Outputs (..)
, getEraOutputs
)
import Cardano.Wallet.Faucet.Gen.Address
( NetworkTag (..)
, genAddress
Expand Down Expand Up @@ -111,10 +115,6 @@ import Cardano.Wallet.Read
, extractEraValue
, (:*:) (..)
)
import Cardano.Wallet.Read.Tx.Outputs
( Outputs (..)
, getEraOutputs
)
import Control.Monad
( join
, replicateM
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ import Prelude hiding
, (.)
)

import Cardano.Read.Ledger.Tx.Certificates
( getEraCertificates
)
import Cardano.Wallet.Primitive.Ledger.Read.Block.Header
( primitiveBlockHeader
)
Expand All @@ -33,9 +36,6 @@ import Cardano.Wallet.Read.Block.Txs
import Cardano.Wallet.Read.Eras
( applyEraFun
)
import Cardano.Wallet.Read.Tx.Certificates
( getEraCertificates
)
import Control.Category
( Category (..)
)
Expand Down
54 changes: 27 additions & 27 deletions lib/primitive/lib/Cardano/Wallet/Primitive/Ledger/Read/Tx.hs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,36 @@ where

import Prelude

import Cardano.Read.Ledger.Tx.CBOR
( renderTxToCBOR
)
import Cardano.Read.Ledger.Tx.CollateralInputs
( getEraCollateralInputs
)
import Cardano.Read.Ledger.Tx.CollateralOutputs
( getEraCollateralOutputs
)
import Cardano.Read.Ledger.Tx.Fee
( getEraFee
)
import Cardano.Read.Ledger.Tx.Hash
( getEraTxHash
)
import Cardano.Read.Ledger.Tx.Inputs
( getEraInputs
)
import Cardano.Read.Ledger.Tx.Metadata
( getEraMetadata
)
import Cardano.Read.Ledger.Tx.Outputs
( getEraOutputs
)
import Cardano.Read.Ledger.Tx.ScriptValidity
( getEraScriptValidity
)
import Cardano.Read.Ledger.Tx.Withdrawals
( getEraWithdrawals
)
import Cardano.Wallet.Primitive.Ledger.Read.Tx.Features.CollateralInputs
( getCollateralInputs
)
Expand Down Expand Up @@ -47,33 +74,6 @@ import Cardano.Wallet.Read
import Cardano.Wallet.Read.Eras
( eraValue
)
import Cardano.Wallet.Read.Tx.CBOR
( renderTxToCBOR
)
import Cardano.Wallet.Read.Tx.CollateralInputs
( getEraCollateralInputs
)
import Cardano.Wallet.Read.Tx.CollateralOutputs
( getEraCollateralOutputs
)
import Cardano.Wallet.Read.Tx.Fee
( getEraFee
)
import Cardano.Wallet.Read.Tx.Hash
( getEraTxHash
)
import Cardano.Wallet.Read.Tx.Metadata
( getEraMetadata
)
import Cardano.Wallet.Read.Tx.Outputs
( getEraOutputs
)
import Cardano.Wallet.Read.Tx.ScriptValidity
( getEraScriptValidity
)
import Cardano.Wallet.Read.Tx.Withdrawals
( getEraWithdrawals
)
import Data.Foldable
( fold
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ import Cardano.Ledger.Shelley.API
import Cardano.Ledger.Shelley.TxCert
( ShelleyTxCert
)
import Cardano.Read.Ledger.Tx.Certificates
( Certificates (..)
, CertificatesType
)
import Cardano.Slotting.Slot
( EpochNo (..)
)
Expand Down Expand Up @@ -64,10 +68,6 @@ import Cardano.Wallet.Read.Eras
, IsEra
, theEra
)
import Cardano.Wallet.Read.Tx.Certificates
( Certificates (..)
, CertificatesType
)
import Cardano.Wallet.Util
( internalError
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ module Cardano.Wallet.Primitive.Ledger.Read.Tx.Features.CollateralInputs

import Prelude

import Cardano.Read.Ledger.Tx.CollateralInputs
( CollateralInputs (..)
, CollateralInputsType
)
import Cardano.Wallet.Primitive.Ledger.Read.Tx.Features.Inputs
( fromShelleyTxIns
)
import Cardano.Wallet.Read.Eras
( Era (..)
, IsEra (..)
)
import Cardano.Wallet.Read.Tx.CollateralInputs
( CollateralInputs (..)
, CollateralInputsType
)

import qualified Cardano.Ledger.Shelley.API as SH
import qualified Cardano.Wallet.Primitive.Types.Tx.TxIn as W
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ module Cardano.Wallet.Primitive.Ledger.Read.Tx.Features.CollateralOutputs

import Prelude

import Cardano.Read.Ledger.Tx.CollateralOutputs
( CollateralOutputs (..)
)
import Cardano.Wallet.Primitive.Ledger.Convert
( toWalletTokenBundle
)
Expand All @@ -19,9 +22,6 @@ import Cardano.Wallet.Read.Eras
( Era (..)
, IsEra (..)
)
import Cardano.Wallet.Read.Tx.CollateralOutputs
( CollateralOutputs (..)
)
import Data.Maybe.Strict
( strictMaybeToMaybe
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ import Cardano.Ledger.Keys
( KeyHash (..)
, KeyRole (..)
)
import Cardano.Read.Ledger.Tx.ExtraSigs
( ExtraSigs (..)
)
import Cardano.Wallet.Read.Eras
( Era (..)
, IsEra (..)
)
import Cardano.Wallet.Read.Tx.ExtraSigs
( ExtraSigs (..)
)
import Data.ByteString.Short
( fromShort
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@ import Prelude
import Cardano.Ledger.Coin
( Coin
)
import Cardano.Read.Ledger.Tx.Fee
( Fee (..)
, FeeType
)
import Cardano.Wallet.Read
( Era (..)
, theEra
)
import Cardano.Wallet.Read.Eras
( IsEra
)
import Cardano.Wallet.Read.Tx.Fee
( Fee (..)
, FeeType
)

import qualified Cardano.Wallet.Primitive.Ledger.Convert as Ledger
import qualified Cardano.Wallet.Primitive.Types.Coin as W
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ module Cardano.Wallet.Primitive.Ledger.Read.Tx.Features.Inputs

import Prelude

import Cardano.Read.Ledger.Tx.Hash
( fromShelleyTxId
)
import Cardano.Read.Ledger.Tx.Inputs
( Inputs (..)
, InputsType
Expand All @@ -24,9 +27,6 @@ import Cardano.Wallet.Read.Eras
( Era (..)
, IsEra (..)
)
import Cardano.Wallet.Read.Tx.Hash
( fromShelleyTxId
)
import Data.Foldable
( toList
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ import Cardano.Ledger.Crypto
import Cardano.Ledger.SafeHash
( SafeToHash (originalBytes)
)
import Cardano.Read.Ledger.Tx.Integrity
( Integrity (..)
, getEraIntegrity
)
import Cardano.Wallet.Read.Eras
( Era (..)
, EraValue
Expand All @@ -38,10 +42,6 @@ import Cardano.Wallet.Read.Eras
import Cardano.Wallet.Read.Tx
( Tx
)
import Cardano.Wallet.Read.Tx.Integrity
( Integrity (..)
, getEraIntegrity
)
import Control.Category
( (.)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ import Cardano.Ledger.Shelley.TxAuxData
( Metadatum
, ShelleyTxAuxData (..)
)
import Cardano.Read.Ledger.Tx.Metadata
( Metadata (..)
)
import Cardano.Wallet.Read.Eras
( Era (..)
, IsEra (..)
)
import Cardano.Wallet.Read.Tx.Metadata
( Metadata (..)
)
import Data.Map
( Map
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,15 @@ import Cardano.Ledger.Shelley.TxWits
( ShelleyTxWits
, scriptWits
)
import Cardano.Read.Ledger.Tx.Mint
( Mint (..)
)
import Cardano.Read.Ledger.Tx.ReferenceInputs
( ReferenceInputs (..)
)
import Cardano.Read.Ledger.Tx.Witnesses
( Witnesses (..)
)
import Cardano.Wallet.Primitive.Ledger.Convert
( toPlutusScriptInfo
, toWalletAssetName
Expand Down Expand Up @@ -76,15 +85,6 @@ import Cardano.Wallet.Read.Eras
, IsEra (..)
, (:*:) (..)
)
import Cardano.Wallet.Read.Tx.Mint
( Mint (..)
)
import Cardano.Wallet.Read.Tx.ReferenceInputs
( ReferenceInputs (..)
)
import Cardano.Wallet.Read.Tx.Witnesses
( Witnesses (..)
)
import Data.Foldable
( toList
)
Expand Down
Loading

0 comments on commit 4b711d4

Please sign in to comment.