Skip to content

Commit

Permalink
Remove transitive dependencies to cardano-ledger-api
Browse files Browse the repository at this point in the history
  • Loading branch information
palas committed Oct 18, 2024
1 parent ab96e16 commit c352284
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 14 deletions.
4 changes: 2 additions & 2 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ repository cardano-haskell-packages
source-repository-package
type: git
location: https://github.com/intersectmbo/cardano-api.git
tag: 13a468f2d9f0939cf795815683cc1bf65412ee35
tag: e584cc2a021f476ac60cac956164521fb88e55a7
subdir: cardano-api
--sha256: sha256-SQleaCv+MtUJXQfAMS4Ol71yDT8O/CPYNClUT6s5gxQ=
--sha256: sha256-kSugQ7yTiXW8muQCSrV2bffyaaXXNHfNFgEYrmoSd3g=

-- See CONTRIBUTING for information about these, including some Nix commands
-- you need to run if you change them
Expand Down
1 change: 0 additions & 1 deletion cardano-cli/cardano-cli.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,6 @@ library
cardano-crypto-wrapper ^>=1.5.1,
cardano-data >=1.1,
cardano-git-rev ^>=0.2.2,
cardano-ledger-api,
cardano-ping ^>=0.5,
cardano-prelude,
cardano-slotting ^>=0.2.0.0,
Expand Down
2 changes: 1 addition & 1 deletion cardano-cli/src/Cardano/CLI/Byron/Tx.hs
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ txSpendUTxOByronPBFT nId sk txIns outs = do
in makeSignedByronTransaction [bWit] txBody

fromByronWitness
:: Byron.SomeByronSigningKey -> NetworkId -> L.Annotated L.Tx ByteString -> KeyWitness ByronEra
:: Byron.SomeByronSigningKey -> NetworkId -> L.Annotated Byron.Tx ByteString -> KeyWitness ByronEra
fromByronWitness bw nId txBody =
case bw of
Byron.AByronSigningKeyLegacy sk -> makeByronKeyWitness nId txBody sk
Expand Down
1 change: 0 additions & 1 deletion cardano-cli/src/Cardano/CLI/EraBased/Run/Transaction.hs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ import Cardano.CLI.Types.Errors.TxCmdError
import Cardano.CLI.Types.Errors.TxValidationError
import Cardano.CLI.Types.Output (renderScriptCosts)
import Cardano.CLI.Types.TxFeature
import qualified Cardano.Ledger.Api.PParams as L
import qualified Ouroboros.Network.Protocol.LocalStateQuery.Type as Consensus
import qualified Ouroboros.Network.Protocol.LocalTxSubmission.Client as Net.Tx

Expand Down
2 changes: 1 addition & 1 deletion cardano-cli/src/Cardano/CLI/Helpers.hs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ validateCBOR cborObject bs =
void $ decodeCBOR bs (L.fromCBOR :: L.Decoder s Byron.Certificate)
Right "Valid Byron delegation certificate."
CBORTxByron -> do
void $ decodeCBOR bs (L.fromCBOR :: L.Decoder s L.Tx)
void $ decodeCBOR bs (L.fromCBOR :: L.Decoder s Byron.Tx)
Right "Valid Byron Tx."
CBORUpdateProposalByron -> do
void $ decodeCBOR bs (L.fromCBOR :: L.Decoder s Byron.Proposal)
Expand Down
10 changes: 4 additions & 6 deletions cardano-cli/src/Cardano/CLI/Json/Friendly.hs
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@ where

import Cardano.Api as Api
import Cardano.Api.Byron (KeyWitness (ByronKeyWitness))
import Cardano.Api.Ledger (ExUnits (..), extractHash, strictMaybeToMaybe, unData)
import Cardano.Api.Ledger (ExUnits (..), extractHash, strictMaybeToMaybe)
import qualified Cardano.Api.Ledger as L
import qualified Cardano.Api.Ledger as Ledger
import Cardano.Api.Shelley (Hash (..),
KeyWitness (ShelleyBootstrapWitness, ShelleyKeyWitness), Proposal (..),
ShelleyLedgerEra, StakeAddress (..), Tx (ShelleyTx),
Expand All @@ -54,9 +55,6 @@ import Cardano.CLI.Orphans ()
import Cardano.CLI.Types.Common (ViewOutputFormat (..))
import Cardano.CLI.Types.MonadWarning (MonadWarning, runWarningIO)
import Cardano.Crypto.Hash (hashToTextAsHex)
import qualified Cardano.Ledger.Api as Ledger
import Cardano.Ledger.Api.Tx.In (txIxToInt)
import qualified Cardano.Ledger.Api.Tx.In as Ledger

import Data.Aeson (Value (..), object, toJSON, (.=))
import qualified Data.Aeson as Aeson
Expand Down Expand Up @@ -357,7 +355,7 @@ getRedeemerDetails aeo tb =
friendlyRedeemer :: Ledger.Data (ShelleyLedgerEra era) -> ExUnits -> Aeson.Value
friendlyRedeemer scriptData ExUnits{exUnitsSteps = exSteps, exUnitsMem = exMemUnits} =
object
[ "data" .= Aeson.String (T.pack $ show $ unData scriptData)
[ "data" .= Aeson.String (T.pack $ show $ Ledger.unData scriptData)
, "execution units"
.= object
[ "steps" .= Aeson.Number (fromIntegral exSteps)
Expand Down Expand Up @@ -392,7 +390,7 @@ getRedeemerDetails aeo tb =
friendlyInput (Ledger.TxIn (Ledger.TxId txidHash) ix) =
Aeson.String $
T.pack $
T.unpack (hashToTextAsHex (extractHash txidHash)) ++ "#" ++ show (txIxToInt ix)
T.unpack (hashToTextAsHex (extractHash txidHash)) ++ "#" ++ show (Ledger.txIxToInt ix)

addLabelToPurpose :: ToJSON v => EraIndependentPlutusScriptPurpose -> v -> Aeson.Value
addLabelToPurpose Spending sp = Aeson.object ["spending script witnessed input" .= sp]
Expand Down
2 changes: 0 additions & 2 deletions cardano-cli/src/Cardano/CLI/Orphans.hs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import Cardano.Api
import qualified Cardano.Api.Ledger as L
import Cardano.Api.Shelley (scriptDataToJsonDetailedSchema)

import qualified Cardano.Ledger.Api as L

import Data.Aeson

-- TODO upstream this orphaned instance to the ledger
Expand Down

0 comments on commit c352284

Please sign in to comment.