Skip to content

Commit

Permalink
Remove unused conversion functions from cardano-wallet-primitive. (#…
Browse files Browse the repository at this point in the history
…4294)

## Issue

None. Noticed while reviewing code.

## Description

This PR removes several conversion functions that are no longer used.
Conversion functions pertaining to recent eras are retained.
  • Loading branch information
jonathanknowles authored Dec 4, 2023
2 parents 1f8ed30 + 6e67546 commit 4451351
Showing 1 changed file with 3 additions and 41 deletions.
44 changes: 3 additions & 41 deletions lib/primitive/lib/Cardano/Wallet/Primitive/Ledger/Convert.hs
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,7 @@ module Cardano.Wallet.Primitive.Ledger.Convert
-- types
, Convert (..)

-- * Conversions for transaction outputs
, toShelleyTxOut
, toAllegraTxOut
, toMaryTxOut
, toAlonzoTxOut
-- * Conversions for transaction outputs in recent eras
, toBabbageTxOut
, toConwayTxOut
, fromBabbageTxOut
Expand Down Expand Up @@ -119,28 +115,21 @@ import Numeric.Natural
( Natural
)
import Ouroboros.Consensus.Shelley.Eras
( StandardAllegra
, StandardAlonzo
, StandardBabbage
( StandardBabbage
, StandardConway
, StandardCrypto
, StandardMary
, StandardShelley
)

import qualified Cardano.Crypto.Hash.Class as Crypto
import qualified Cardano.Ledger.Address as Ledger
import qualified Cardano.Ledger.Allegra.Scripts as Scripts
import qualified Cardano.Ledger.Alonzo as Alonzo
import qualified Cardano.Ledger.Alonzo.TxBody as Alonzo
import qualified Cardano.Ledger.Babbage as Babbage
import qualified Cardano.Ledger.Babbage.TxBody as Babbage
import qualified Cardano.Ledger.Core as LCore
import qualified Cardano.Ledger.Keys as Ledger
import qualified Cardano.Ledger.Mary.Value as Ledger
import qualified Cardano.Ledger.SafeHash as SafeHash
import qualified Cardano.Ledger.Shelley.API as Ledger
import qualified Cardano.Ledger.Shelley.TxBody as Shelley
import qualified Cardano.Wallet.Primitive.Types.Coin as Coin
import qualified Cardano.Wallet.Primitive.Types.TokenBundle as TokenBundle
import qualified Cardano.Wallet.Primitive.Types.TokenMap as TokenMap
Expand Down Expand Up @@ -332,36 +321,9 @@ toWalletAddress :: Ledger.Addr StandardCrypto -> Address
toWalletAddress = Address . Ledger.serialiseAddr

--------------------------------------------------------------------------------
-- Conversions for 'TxOut'
-- Conversions for 'TxOut' (in recent eras)
--------------------------------------------------------------------------------

toShelleyTxOut
:: TxOut
-> Shelley.ShelleyTxOut StandardShelley
toShelleyTxOut (TxOut addr bundle) =
Shelley.ShelleyTxOut (toLedger addr) (toLedger (TokenBundle.coin bundle))

toAllegraTxOut
:: TxOut
-> Shelley.ShelleyTxOut StandardAllegra
toAllegraTxOut (TxOut addr bundle) =
Shelley.ShelleyTxOut (toLedger addr) (toLedger (TokenBundle.coin bundle))

toMaryTxOut
:: TxOut
-> Shelley.ShelleyTxOut StandardMary
toMaryTxOut (TxOut addr bundle) =
Shelley.ShelleyTxOut (toLedger addr) (toLedger bundle)

toAlonzoTxOut
:: TxOut
-> Alonzo.AlonzoTxOut StandardAlonzo
toAlonzoTxOut (TxOut addr bundle) =
Alonzo.AlonzoTxOut
(toLedger addr)
(toLedger bundle)
Ledger.SNothing

toBabbageTxOut
:: HasCallStack
=> TxOut
Expand Down

0 comments on commit 4451351

Please sign in to comment.