Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop unused {to,from}CardanoApiUTxO helpers #4811

Merged
merged 1 commit into from
Oct 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 0 additions & 27 deletions lib/balance-tx/lib/internal/Internal/Cardano/Write/Tx.hs
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ module Internal.Cardano.Write.Tx

-- ** Helpers for cardano-api compatibility
, fromCardanoApiTx
, toCardanoApiUTxO
, fromCardanoApiUTxO
, toCardanoApiTx

-- ** Misc
Expand Down Expand Up @@ -506,31 +504,6 @@ toCardanoApiTx =
CardanoApi.ShelleyTx
$ shelleyBasedEraFromRecentEra (recentEra :: RecentEra era)

toCardanoApiUTxO
:: forall era. IsRecentEra era
=> Shelley.UTxO era
-> CardanoApi.UTxO (CardanoApiEra era)
toCardanoApiUTxO =
CardanoApi.UTxO
. Map.mapKeys CardanoApi.fromShelleyTxIn
. Map.map (CardanoApi.fromShelleyTxOut shelleyBasedEra)
. unUTxO
where
shelleyBasedEra = shelleyBasedEraFromRecentEra (recentEra :: RecentEra era)

fromCardanoApiUTxO
:: forall era. IsRecentEra era
=> CardanoApi.UTxO (CardanoApiEra era)
-> Shelley.UTxO era
fromCardanoApiUTxO =
Shelley.UTxO
. Map.mapKeys CardanoApi.toShelleyTxIn
. Map.map
(CardanoApi.toShelleyTxOut shelleyBasedEra)
. CardanoApi.unUTxO
where
shelleyBasedEra = shelleyBasedEraFromRecentEra (recentEra :: RecentEra era)

--------------------------------------------------------------------------------
-- PParams
--------------------------------------------------------------------------------
Expand Down
27 changes: 0 additions & 27 deletions lib/balance-tx/test/spec/Internal/Cardano/Write/TxSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@ module Internal.Cardano.Write.TxSpec where

import Prelude

import Cardano.Api.Gen
( genTxIn
, genTxOut
)
import Cardano.Ledger.Api
( PParams
, coinTxOutL
Expand All @@ -35,9 +31,7 @@ import Internal.Cardano.Write.Tx
( computeMinimumCoinForTxOut
, datumHashFromBytes
, datumHashToBytes
, fromCardanoApiUTxO
, isBelowMinimumCoinForTxOut
, toCardanoApiUTxO
)
import Test.Cardano.Ledger.Alonzo.Serialisation.Generators
()
Expand All @@ -54,7 +48,6 @@ import Test.Hspec
)
import Test.QuickCheck
( Arbitrary (..)
, Arbitrary1 (liftArbitrary)
, Property
, arbitraryBoundedEnum
, conjoin
Expand All @@ -72,9 +65,7 @@ import Test.Utils.Laws
( testLawsMany
)

import qualified Cardano.Api as CardanoApi
import qualified Data.ByteString as BS
import qualified Data.Map as Map

spec :: Spec
spec = do
Expand Down Expand Up @@ -125,17 +116,6 @@ spec = do
(out & coinTxOutL .~ c)
=== False

describe "UTxO" $ do
it "is isomorphic to CardanoApi.UTxO" $ do
testIsomorphism
(NamedFun
(toCardanoApiUTxO @Babbage)
"toCardanoApiUTxO")
(NamedFun
(fromCardanoApiUTxO @Babbage)
"fromCardanoApiUTxO")
id

--------------------------------------------------------------------------------
-- Arbitrary instances
--------------------------------------------------------------------------------
Expand All @@ -144,13 +124,6 @@ instance Arbitrary AnyRecentEra where
arbitrary = arbitraryBoundedEnum
shrink = shrinkBoundedEnum

instance Arbitrary (CardanoApi.UTxO CardanoApi.BabbageEra) where
arbitrary = CardanoApi.UTxO . Map.fromList <$> liftArbitrary genTxInOutEntry
where
genTxInOutEntry = (,)
<$> genTxIn
<*> genTxOut CardanoApi.BabbageEra

--------------------------------------------------------------------------------
-- Helpers
--------------------------------------------------------------------------------
Expand Down
Loading