From 6f53e3c7b7788e17add982c53271239686476629 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jann=20M=C3=BCller?= Date: Mon, 13 Jan 2025 20:46:36 +0100 Subject: [PATCH] Fix build --- src/lib/Wst/Cli.hs | 10 +++------- src/lib/Wst/Orphans.hs | 5 +++++ src/lib/Wst/Server.hs | 1 - src/test/lib/Wst/Test/MockServer.hs | 9 ++++++--- src/test/unit/Wst/Test/UnitTest.hs | 4 +--- src/wst-poc.cabal | 3 +-- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/lib/Wst/Cli.hs b/src/lib/Wst/Cli.hs index ce26a7b..d96a69f 100644 --- a/src/lib/Wst/Cli.hs +++ b/src/lib/Wst/Cli.hs @@ -7,16 +7,13 @@ module Wst.Cli(runMain) where import Blammo.Logging.Simple (Message ((:#)), MonadLogger, logDebug, logError, logInfo, runLoggerLoggingT, (.=)) import Cardano.Api qualified as C -import Control.Monad.Except (ExceptT (..), MonadError, liftEither, throwError) +import Control.Monad.Except (MonadError, liftEither) import Control.Monad.IO.Class (MonadIO (..)) -import Control.Monad.Reader (MonadReader, ask, asks) -import Convex.Blockfrost (evalBlockfrostT, runBlockfrostT) -import Convex.Blockfrost.MonadBlockchain (sendTxBlockfrost) +import Control.Monad.Reader (MonadReader, asks) import Convex.Class (MonadBlockchain (sendTx), MonadUtxoQuery) import Convex.Wallet.Operator (Operator (Operator, oPaymentKey), OperatorConfigSigning, - PaymentExtendedKey (PESigningEx), - operatorPaymentCredential, signTxOperator, + PaymentExtendedKey (PESigningEx), signTxOperator, verificationKey) import Convex.Wallet.Operator qualified as Operator import Data.Functor.Identity (Identity) @@ -31,7 +28,6 @@ import Wst.AppError (AppError) import Wst.Cli.Command (Command (..), ManageCommand (StartServer, Status), parseCommand) import Wst.Offchain.Endpoints.Deployment qualified as Endpoints -import Wst.Offchain.Env (addOperatorEnv) import Wst.Offchain.Env qualified as Env import Wst.Server (ServerArgs (..)) import Wst.Server qualified as Server diff --git a/src/lib/Wst/Orphans.hs b/src/lib/Wst/Orphans.hs index 73ffbab..aac89a2 100644 --- a/src/lib/Wst/Orphans.hs +++ b/src/lib/Wst/Orphans.hs @@ -105,3 +105,8 @@ instance ToSchema C.Quantity where $ mempty & L.type_ ?~ OpenApiInteger +instance ToSchema C.TxId where + declareNamedSchema _ = pure + $ NamedSchema (Just "TxId") + $ mempty + & L.type_ ?~ OpenApiString diff --git a/src/lib/Wst/Server.hs b/src/lib/Wst/Server.hs index a7a9feb..3dd87a8 100644 --- a/src/lib/Wst/Server.hs +++ b/src/lib/Wst/Server.hs @@ -13,7 +13,6 @@ module Wst.Server( import Cardano.Api.Shelley qualified as C import Control.Lens qualified as L import Control.Monad.Error.Class (MonadError (throwError)) -import Control.Monad.Except (MonadError) import Control.Monad.Reader (MonadReader, asks) import Convex.CardanoApi.Lenses qualified as L import Convex.Class (MonadBlockchain (sendTx), MonadUtxoQuery) diff --git a/src/test/lib/Wst/Test/MockServer.hs b/src/test/lib/Wst/Test/MockServer.hs index 4115d82..12aaf10 100644 --- a/src/test/lib/Wst/Test/MockServer.hs +++ b/src/test/lib/Wst/Test/MockServer.hs @@ -10,9 +10,10 @@ import Control.Monad.IO.Class (MonadIO (..)) import Data.Proxy (Proxy (..)) import Network.Wai.Handler.Warp qualified as Warp import Network.Wai.Middleware.Cors -import Servant (Server) +import Servant (Server, throwError) import Servant.API (NoContent (..), (:<|>) (..)) import Servant.Server (serve) +import Servant.Server qualified as Server import Test.Gen.Cardano.Api.Typed qualified as Gen import Test.QuickCheck qualified as QC import Test.QuickCheck.Gen qualified as Gen @@ -39,10 +40,12 @@ genTx = liftIO $ fmap TextEnvelopeJSON $ QC.generate $ hedgehog $ Gen.genTx C.sh mockTxApi :: Server (BuildTxAPI C.ConwayEra) mockTxApi = - const genTx - :<|> const genTx + (const genTx :<|> const genTx :<|> const genTx + :<|> const genTx) + :<|> const (throwError Server.err501) + :<|> const (throwError Server.err501) -- | Start the mock server runMockServer :: IO () diff --git a/src/test/unit/Wst/Test/UnitTest.hs b/src/test/unit/Wst/Test/UnitTest.hs index 6404ef6..24a5c18 100644 --- a/src/test/unit/Wst/Test/UnitTest.hs +++ b/src/test/unit/Wst/Test/UnitTest.hs @@ -7,11 +7,9 @@ import Cardano.Api qualified as C import Cardano.Api.Shelley qualified as C import Cardano.Ledger.Api qualified as Ledger import Cardano.Ledger.Plutus.ExUnits (ExUnits (..)) -import Cardano.Ledger.Shelley.TxCert qualified as TxCert import Control.Lens ((%~), (&), (^.)) import Control.Monad (void) import Control.Monad.Reader (MonadReader (ask), ReaderT (runReaderT), asks) -import Convex.BuildTx (MonadBuildTx, addCertificate) import Convex.BuildTx qualified as BuildTx import Convex.Class (MonadBlockchain (queryProtocolParameters, sendTx), MonadMockchain, MonadUtxoQuery) @@ -265,7 +263,7 @@ registerAlwaysSucceedsStakingCert = failOnError $ do void (tryBalanceAndSubmit mempty Wallet.w1 txBody TrailingChange []) -- TODO: registration to be moved to the endpoints -registerTransferScripts :: (MonadFail m, MonadReader env m, Env.HasDirectoryEnv env, Env.HasTransferLogicEnv env, MonadMockchain C.ConwayEra m) => C.Hash C.PaymentKey -> m C.TxId +registerTransferScripts :: (MonadFail m, MonadReader env m, Env.HasTransferLogicEnv env, MonadMockchain C.ConwayEra m) => C.Hash C.PaymentKey -> m C.TxId registerTransferScripts pkh = failOnError $ do transferMintingScript <- asks (Env.tleMintingScript . Env.transferLogicEnv) transferSpendingScript <- asks (Env.tleTransferScript . Env.transferLogicEnv) diff --git a/src/wst-poc.cabal b/src/wst-poc.cabal index 7d31c18..f2ce639 100644 --- a/src/wst-poc.cabal +++ b/src/wst-poc.cabal @@ -182,11 +182,10 @@ test-suite wst-poc-test Wst.Test.UnitTest build-depends: - , base >=4.14.0 + , base >=4.14.0 , cardano-api , cardano-ledger-api , cardano-ledger-core - , cardano-ledger-shelley , convex-base , convex-coin-selection , convex-mockchain