Skip to content

Commit

Permalink
Adapt to cardano-api breaking changes
Browse files Browse the repository at this point in the history
  • Loading branch information
uhbif19 committed Mar 12, 2024
1 parent dbdaae5 commit 06d15f4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
3 changes: 2 additions & 1 deletion cem-script.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ common common-offchain
, retry
, cardano-api
-- , cardano-cli
, ouroboros-network-protocols
, cardano-ledger-core
, cardano-ledger-babbage
, cardano-ledger-alonzo
Expand Down Expand Up @@ -174,13 +175,13 @@ library
Cardano.CEM.Examples.Voting
Cardano.CEM.Monads
Cardano.CEM.Monads.L1
Cardano.CEM.Monads.CLB
Cardano.CEM.OnChain
build-depends:
cem-script:data-spine,
cem-script:cardano-extras,
dependent-map,
singletons-th,
-- plutarch,

test-suite cem-sdk-test
import:
Expand Down
15 changes: 5 additions & 10 deletions src/Cardano/CEM/Monads/L1.hs
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,12 @@ import Data.Set qualified as Set
import Unsafe.Coerce (unsafeCoerce)

import Data.Aeson
import Data.Aeson.KeyMap ((!?))

-- Cardano imports
-- import Cardano.Ledger.Chain (PredicateFailure)
-- import Cardano.Ledger.Shelley.API ()
-- import Ouroboros.Consensus.Shelley.Ledger (ApplyTxError (..))
-- import Cardano.Ledger.Alonzo.TxInfo (ExtendedUTxO, TranslationError)
import Cardano.Api hiding (queryUtxo)
import Cardano.Api.Shelley (LedgerProtocolParameters (..))
import Cardano.Api.Shelley (LedgerProtocolParameters (..), )
import Ouroboros.Network.Protocol.LocalStateQuery.Type (Target (..))

-- CEM imports

Expand Down Expand Up @@ -73,7 +71,7 @@ queryCardanoNode ::
QueryInShelleyBasedEra Era b -> L1Runner b
queryCardanoNode query = do
node <- localNode <$> ask
result <- liftIO $ queryNodeLocalState node Nothing cardanoQuery
result <- liftIO $ queryNodeLocalState node VolatileTip cardanoQuery
return $ case result of
-- TODO: better handling of wrong-era exceptions
Right (Right x) -> x
Expand Down Expand Up @@ -142,9 +140,6 @@ instance MonadSubmitTx L1Runner where
mainAddress <- fromPlutusAddressInMonad mainAddress'
utxo <- queryUtxo $ ByTxIns $ map fst txIns

-- liftIO $ pPrint preBody
-- liftIO $ pPrint utxo

body <-
either (\x -> fail $ "Autobalance error: " <> show x) return
=<< callBodyAutoBalance
Expand Down Expand Up @@ -190,7 +185,7 @@ callBodyAutoBalance ::
TxBodyContent BuildTx Era ->
UTxO Era ->
AddressInEra Era ->
m (Either TxBodyErrorAutoBalance (TxBody Era))
m (Either (TxBodyErrorAutoBalance Era) (TxBody Era))
callBodyAutoBalance
preBody
utxo
Expand Down

0 comments on commit 06d15f4

Please sign in to comment.