Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
nhenin committed Mar 25, 2024
1 parent c761aef commit 5281d6d
Show file tree
Hide file tree
Showing 33 changed files with 430 additions and 302 deletions.
2 changes: 1 addition & 1 deletion marlowe-integration-tests/marlowe-integration-tests.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ executable marlowe-integration-tests
, marlowe-integration
, marlowe-object:{marlowe-object, gen}
, marlowe-protocols
, marlowe-runtime-web:{marlowe-runtime-web, server}
, marlowe-runtime-web
, marlowe-runtime:{marlowe-runtime, contract, contract-api, sync-api, tx-api}
, marlowe-test
, mtl
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import Language.Marlowe.Runtime.Integration.Common (
)
import Language.Marlowe.Runtime.Transaction.Api (WalletAddresses (..))

import Language.Marlowe.Runtime.Web.Adapter.Server.DTO (ToDTO (toDTO))
import Language.Marlowe.Runtime.Web.Client (
getContract,
getTransaction,
Expand All @@ -58,7 +59,6 @@ import qualified Language.Marlowe.Runtime.Web.Core.Base16 as Web
import qualified Language.Marlowe.Runtime.Web.Core.BlockHeader as Web
import qualified Language.Marlowe.Runtime.Web.Core.MarloweVersion as Web
import qualified Language.Marlowe.Runtime.Web.Core.Tx as Web
import Language.Marlowe.Runtime.Web.Server.DTO (ToDTO (toDTO))
import qualified Language.Marlowe.Runtime.Web.Tx.API as Web
import qualified Language.Marlowe.Runtime.Web.Withdrawal.API as Web
import qualified PlutusLedgerApi.V2 as PV2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import Data.Functor (void)
import qualified Language.Marlowe.Runtime.ChainSync.Api as Chain
import Language.Marlowe.Runtime.Integration.Common (Wallet, getGenesisWallet, runIntegrationTest, runWebClient)

import Language.Marlowe.Runtime.Web.Adapter.Server.DTO (ToDTO (toDTO))
import Language.Marlowe.Runtime.Web.Client (getContract)
import Language.Marlowe.Runtime.Web.Common (createCloseContract, waitUntilConfirmed)
import qualified Language.Marlowe.Runtime.Web.Contract.API as Web
import qualified Language.Marlowe.Runtime.Web.Core.Tx as Web
import Language.Marlowe.Runtime.Web.Server.DTO (ToDTO (toDTO))
import Network.HTTP.Types (Status (..))
import Servant.Client (ClientError (FailureResponse))
import Servant.Client.Streaming (ResponseF (Response, responseStatusCode))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import qualified Language.Marlowe.Runtime.ChainSync.Api as Chain
import Language.Marlowe.Runtime.Integration.Common (Wallet, getGenesisWallet, runIntegrationTest, runWebClient)

import qualified Data.Time as Time
import Language.Marlowe.Runtime.Web.Adapter.Server.DTO (ToDTO (toDTO))
import Language.Marlowe.Runtime.Web.Client (getContract, getContractNext)
import Language.Marlowe.Runtime.Web.Common (createCloseContract, waitUntilConfirmed)
import Language.Marlowe.Runtime.Web.Server.DTO (ToDTO (toDTO))
import Network.HTTP.Types (Status (..))
import Servant.Client (ClientError (FailureResponse))
import Servant.Client.Streaming (ResponseF (Response, responseStatusCode))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ import Language.Marlowe.Runtime.Integration.Common (
import Language.Marlowe.Runtime.Integration.StandardContract (standardContract)
import Language.Marlowe.Runtime.Plutus.V2.Api (toPlutusAddress)
import Language.Marlowe.Runtime.Transaction.Api (WalletAddresses (..))
import Language.Marlowe.Runtime.Web.Adapter.Server.DTO (FromDTO (..), ToDTO (toDTO))
import Language.Marlowe.Runtime.Web.Client (postContract)
import qualified Language.Marlowe.Runtime.Web.Core.Address as Web
import qualified Language.Marlowe.Runtime.Web.Core.MarloweVersion as Web
import Language.Marlowe.Runtime.Web.Server.DTO (FromDTO (..), ToDTO (toDTO))

import Language.Marlowe.Runtime.Web.Contract.API (ContractOrSourceId (..))
import qualified Language.Marlowe.Runtime.Web.Contract.API as Web
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ import Language.Marlowe.Runtime.Integration.Common (
import Language.Marlowe.Runtime.Integration.StandardContract (standardContract)
import Language.Marlowe.Runtime.Plutus.V2.Api (toPlutusAddress)
import Language.Marlowe.Runtime.Transaction.Api (WalletAddresses (..))
import Language.Marlowe.Runtime.Web.Adapter.Server.DTO (ToDTO (toDTO))
import Language.Marlowe.Runtime.Web.Client (postContract, putContract)
import Language.Marlowe.Runtime.Web.Common (signShelleyTransaction')
import qualified Language.Marlowe.Runtime.Web.Core.MarloweVersion as Web
import Language.Marlowe.Runtime.Web.Server.DTO (ToDTO (toDTO))

import Language.Marlowe.Runtime.Web.Contract.API (
ContractOrSourceId (ContractOrSourceId),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import Data.Proxy (Proxy (Proxy))
import qualified Language.Marlowe.Runtime.ChainSync.Api as Chain
import Language.Marlowe.Runtime.Integration.Common (Wallet, getGenesisWallet, runIntegrationTest, runWebClient)

import Language.Marlowe.Runtime.Web.Adapter.Server.DTO (ToDTO (toDTO))
import Language.Marlowe.Runtime.Web.Client (Page (..), getContracts)
import Language.Marlowe.Runtime.Web.Common (createCloseContract)
import qualified Language.Marlowe.Runtime.Web.Contract.API as Web
import qualified Language.Marlowe.Runtime.Web.Core.Tx as Web
import Language.Marlowe.Runtime.Web.Server.DTO (ToDTO (toDTO))
import Network.HTTP.Types (Status (..))
import Servant.Client (ClientError (FailureResponse))
import Servant.Client.Streaming (ResponseF (Response, responseStatusCode))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ import Data.Functor (void)
import Data.Proxy (Proxy (Proxy))
import qualified Language.Marlowe.Runtime.ChainSync.Api as Chain
import Language.Marlowe.Runtime.Integration.Common (Wallet, getGenesisWallet, runIntegrationTest, runWebClient)
import Language.Marlowe.Runtime.Web.Adapter.Server.DTO (ToDTO (toDTO))
import Language.Marlowe.Runtime.Web.Client (Page (..), getTransactions)
import Language.Marlowe.Runtime.Web.Common (applyCloseTransaction, createCloseContract)
import qualified Language.Marlowe.Runtime.Web.Core.Tx as Web
import Language.Marlowe.Runtime.Web.Server.DTO (ToDTO (toDTO))
import Language.Marlowe.Runtime.Web.StandardContract (createFullyExecutedStandardContract)
import qualified Language.Marlowe.Runtime.Web.Tx.API as Web
import Network.HTTP.Types (Status (..))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import Control.Exception (throw)
import Data.Functor (void)
import qualified Language.Marlowe.Runtime.ChainSync.Api as Chain
import Language.Marlowe.Runtime.Integration.Common (getGenesisWallet, runIntegrationTest, runWebClient)
import Language.Marlowe.Runtime.Web.Adapter.Server.DTO (ToDTO (toDTO))
import Language.Marlowe.Runtime.Web.Client (getTransaction)
import qualified Language.Marlowe.Runtime.Web.Core.Asset as Web
import qualified Language.Marlowe.Runtime.Web.Core.Tx as Web
import qualified Language.Marlowe.Runtime.Web.Payout.API as Web
import Language.Marlowe.Runtime.Web.Server.DTO (ToDTO (toDTO))
import Language.Marlowe.Runtime.Web.StandardContract (createFullyExecutedStandardContract)

import qualified Language.Marlowe.Runtime.Web.Tx.API as Web
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ import Language.Marlowe.Runtime.Integration.Common (
import Language.Marlowe.Runtime.Integration.StandardContract (standardContract)
import Language.Marlowe.Runtime.Plutus.V2.Api (toPlutusAddress)
import Language.Marlowe.Runtime.Transaction.Api (WalletAddresses (..))
import Language.Marlowe.Runtime.Web.Adapter.Server.DTO (ToDTO (toDTO))
import Language.Marlowe.Runtime.Web.Client (postContract, postTransaction)
import Language.Marlowe.Runtime.Web.Common (submitContract)
import qualified Language.Marlowe.Runtime.Web.Core.MarloweVersion as Web
import Language.Marlowe.Runtime.Web.Server.DTO (ToDTO (toDTO))

import Language.Marlowe.Runtime.Web.Contract.API (ContractOrSourceId (..))
import qualified Language.Marlowe.Runtime.Web.Contract.API as Web
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ import Language.Marlowe.Runtime.Integration.Common (
import Language.Marlowe.Runtime.Integration.StandardContract (standardContract)
import Language.Marlowe.Runtime.Plutus.V2.Api (toPlutusAddress)
import Language.Marlowe.Runtime.Transaction.Api (WalletAddresses (..))
import Language.Marlowe.Runtime.Web.Adapter.Server.DTO (ToDTO (toDTO))
import Language.Marlowe.Runtime.Web.Client (postContract, postTransaction, putTransaction)
import Language.Marlowe.Runtime.Web.Common (signShelleyTransaction', submitContract)
import qualified Language.Marlowe.Runtime.Web.Core.MarloweVersion as Web
import Language.Marlowe.Runtime.Web.Server.DTO (ToDTO (toDTO))

import Language.Marlowe.Runtime.Web.Contract.API (
ContractOrSourceId (ContractOrSourceId),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import Language.Marlowe.Runtime.Integration.StandardContract (standardContract)
import Language.Marlowe.Runtime.Plutus.V2.Api (toPlutusAddress)
import Language.Marlowe.Runtime.Transaction.Api (WalletAddresses (..))

import Language.Marlowe.Runtime.Web.Adapter.Server.DTO (ToDTO (toDTO))
import Language.Marlowe.Runtime.Web.Client (Page (..), getPayouts, postContract, postContractSource)
import Language.Marlowe.Runtime.Web.Common (
choose,
Expand All @@ -33,7 +34,6 @@ import Language.Marlowe.Runtime.Web.Common (
import qualified Language.Marlowe.Runtime.Web.Core.MarloweVersion as Web
import qualified Language.Marlowe.Runtime.Web.Core.Tx as Web
import Language.Marlowe.Runtime.Web.Payout.API (PayoutHeader (payoutId), PayoutStatus (..))
import Language.Marlowe.Runtime.Web.Server.DTO (ToDTO (toDTO))

import Language.Marlowe.Runtime.Web.Contract.API (ContractOrSourceId (..), PostContractSourceResponse (..))
import qualified Language.Marlowe.Runtime.Web.Contract.API as Web
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import Language.Marlowe.Runtime.Transaction.Api (WalletAddresses (..))

import Language.Marlowe.Runtime.Web.Client (Page (..), getPayouts, postWithdrawal)

import Language.Marlowe.Runtime.Web.Adapter.Server.DTO (ToDTO (toDTO))
import Language.Marlowe.Runtime.Web.Payout.API (PayoutHeader (..), PayoutStatus (..))
import Language.Marlowe.Runtime.Web.Server.DTO (ToDTO (toDTO))
import Language.Marlowe.Runtime.Web.StandardContract (
StandardContractChoiceMade (..),
StandardContractClosed (..),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import Language.Marlowe.Runtime.Web ()
import Language.Marlowe.Runtime.Web.Client (Page (..), getPayouts, postWithdrawal, putWithdrawal)
import Language.Marlowe.Runtime.Web.Common (signShelleyTransaction')

import Language.Marlowe.Runtime.Web.Adapter.Server.DTO (ToDTO (toDTO))
import Language.Marlowe.Runtime.Web.Payout.API (PayoutHeader (..), PayoutStatus (..))
import Language.Marlowe.Runtime.Web.Server.DTO (ToDTO (toDTO))
import Language.Marlowe.Runtime.Web.StandardContract (
StandardContractChoiceMade (..),
StandardContractClosed (..),
Expand Down
52 changes: 30 additions & 22 deletions marlowe-runtime-web/marlowe-runtime-web.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,22 @@ library
Language.Marlowe.Runtime.Web.Adapter.Links
Language.Marlowe.Runtime.Web.Adapter.Pagination
Language.Marlowe.Runtime.Web.Adapter.Servant
Language.Marlowe.Runtime.Web.Adapter.Server.ApiError
Language.Marlowe.Runtime.Web.Adapter.Server.ContractClient
Language.Marlowe.Runtime.Web.Adapter.Server.DTO
Language.Marlowe.Runtime.Web.Adapter.Server.Monad
Language.Marlowe.Runtime.Web.Adapter.Server.SyncClient
Language.Marlowe.Runtime.Web.Adapter.Server.TxClient
Language.Marlowe.Runtime.Web.Adapter.Server.Util
Language.Marlowe.Runtime.Web.Adapter.URI
Language.Marlowe.Runtime.Web.API
Language.Marlowe.Runtime.Web.Burn.API
Language.Marlowe.Runtime.Web.Client
Language.Marlowe.Runtime.Web.Contract.API
Language.Marlowe.Runtime.Web.Contract.Next.API
Language.Marlowe.Runtime.Web.Contract.Next.Client
Language.Marlowe.Runtime.Web.Contract.Next.Schema
Language.Marlowe.Runtime.Web.Contract.Next.Server
Language.Marlowe.Runtime.Web.Contract.Transaction.API
Language.Marlowe.Runtime.Web.Core.Address
Language.Marlowe.Runtime.Web.Core.Asset
Expand All @@ -89,16 +98,33 @@ library

build-depends:
, aeson ^>=2.2
, async >=2.2 && <3
, async-components ==0.1.1.0
, base >=4.9 && <5
, base16 ^>=0.3.2
, bytestring >=0.10.12 && <0.12
, cardano-api ^>=8.39.2.0
, cardano-ledger-alonzo ^>=1.6
, cardano-ledger-binary ^>=1.3
, cardano-ledger-core ^>=1.10
, co-log ^>=0.6
, containers ^>=0.6.5
, errors >=2.3 && <3
, eventuo11y >=0.9 && <0.11
, eventuo11y-extras ==0.1.1.0
, exceptions >=0.10 && <0.12
, http-media ^>=0.8
, lens >=5.2 && <6
, marlowe-cardano ==0.2.1.0
, marlowe-chain-sync ==0.0.6
, marlowe-client ==0.0.6
, marlowe-object ==0.2.0.1
, marlowe-protocols ==0.3.0.0
, marlowe-runtime:{marlowe-runtime, contract-api, proxy-api, sync-api, tx-api} ==0.0.6
, monad-control ^>=1
, mtl >=2.2 && <3
, network-uri >=2.6 && <3
, nonempty-containers ^>=0.3.4
, openapi3 >=3.2 && <4
, parsec ^>=3.1.14
, pipes ^>=4.3.16
Expand All @@ -110,8 +136,12 @@ library
, servant-pagination >=2.5 && <3
, servant-pipes ^>=0.16
, servant-server ^>=0.20
, stm ^>=2.5
, stm-delay ^>=0.1.1
, text ^>=2.0
, time >=1.9 && <2
, transformers-base ^>=0.4
, unliftio-core ^>=0.2
, wai >=3.2 && <4

library server
Expand All @@ -120,56 +150,38 @@ library server
visibility: public
exposed-modules:
Language.Marlowe.Runtime.Web.Server
Language.Marlowe.Runtime.Web.Server.DTO
Language.Marlowe.Runtime.Web.Server.Monad
Language.Marlowe.Runtime.Web.Server.OpenAPI
Language.Marlowe.Runtime.Web.Server.Util

other-modules:
Language.Marlowe.Runtime.Web.Server.ContractClient
Language.Marlowe.Runtime.Web.Server.REST
Language.Marlowe.Runtime.Web.Server.REST.ApiError
Language.Marlowe.Runtime.Web.Server.REST.Contracts
Language.Marlowe.Runtime.Web.Server.REST.Contracts.Next
Language.Marlowe.Runtime.Web.Server.REST.ContractSources
Language.Marlowe.Runtime.Web.Server.REST.Payouts
Language.Marlowe.Runtime.Web.Server.REST.Transactions
Language.Marlowe.Runtime.Web.Server.REST.Withdrawals
Language.Marlowe.Runtime.Web.Server.SyncClient
Language.Marlowe.Runtime.Web.Server.TxClient
Paths_marlowe_runtime_web

build-depends:
, aeson ^>=2.2
, async >=2.2 && <3
, async-components ==0.1.1.0
, base >=4.9 && <5
, bytestring >=0.10.12 && <0.12
, cardano-api ^>=8.39.2.0
, cardano-ledger-alonzo ^>=1.6
, cardano-ledger-binary ^>=1.3
, cardano-ledger-core ^>=1.10
, co-log ^>=0.6
, containers ^>=0.6.5
, errors >=2.3 && <3
, eventuo11y >=0.9 && <0.11
, eventuo11y-extras ==0.1.1.0
, exceptions >=0.10 && <0.12
, http-media ^>=0.8
, http-types
, insert-ordered-containers >=0.2.5 && <0.3
, lens >=5.2 && <6
, lens-aeson ^>=1.2
, marlowe-cardano ==0.2.1.0
, marlowe-chain-sync ==0.0.6
, marlowe-client ==0.0.6
, marlowe-object ==0.2.0.1
, marlowe-protocols ==0.3.0.0
, marlowe-runtime-web ==0.0.6
, marlowe-runtime:{marlowe-runtime, contract-api, proxy-api, sync-api, tx-api} ==0.0.6
, monad-control ^>=1
, mtl >=2.2 && <3
, nonempty-containers ^>=0.3.4
, openapi3 >=3.2 && <4
, pipes ^>=4.3.16
, plutus-ledger-api ^>=1.21
Expand All @@ -178,12 +190,8 @@ library server
, servant-pagination >=2.5 && <3
, servant-pipes ^>=0.16
, servant-server ^>=0.20
, stm ^>=2.5
, stm-delay ^>=0.1.1
, string-conversions ^>=0.4
, text ^>=2.0
, time >=1.9 && <2
, transformers-base ^>=0.4
, unliftio-core ^>=0.2
, wai >=3.2 && <4
, wai-cors ^>=0.2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,16 @@ import qualified Language.Marlowe.Runtime.Web.API as Web (
RuntimeAPI,
runtimeApi,
)
import Language.Marlowe.Runtime.Web.Server.ContractClient (
import Language.Marlowe.Runtime.Web.Adapter.Server.ContractClient (
ContractClient (..),
ContractClientDependencies (..),
GetContract,
ImportBundle,
contractClient,
)
import Language.Marlowe.Runtime.Web.Server.DTO (toDTO)
import Language.Marlowe.Runtime.Web.Server.Monad (AppEnv (..), ServerM (..))
import qualified Language.Marlowe.Runtime.Web.Server.OpenAPI as OpenAPI
import qualified Language.Marlowe.Runtime.Web.Server.REST as REST
import Language.Marlowe.Runtime.Web.Server.SyncClient (
import Language.Marlowe.Runtime.Web.Adapter.Server.DTO (toDTO)
import Language.Marlowe.Runtime.Web.Adapter.Server.Monad (AppEnv (..), ServerM (..))
import Language.Marlowe.Runtime.Web.Adapter.Server.SyncClient (
LoadContract,
LoadContractHeaders,
LoadPayout,
Expand All @@ -70,7 +68,7 @@ import Language.Marlowe.Runtime.Web.Server.SyncClient (
SyncClientDependencies (..),
syncClient,
)
import Language.Marlowe.Runtime.Web.Server.TxClient (
import Language.Marlowe.Runtime.Web.Adapter.Server.TxClient (
ApplyInputs,
CreateContract,
Submit,
Expand All @@ -79,6 +77,8 @@ import Language.Marlowe.Runtime.Web.Server.TxClient (
Withdraw,
txClient,
)
import qualified Language.Marlowe.Runtime.Web.Server.OpenAPI as OpenAPI
import qualified Language.Marlowe.Runtime.Web.Server.REST as REST

import Language.Marlowe.Runtime.Web.Core.Object.Schema ()
import Language.Marlowe.Runtime.Web.Status (RuntimeStatus)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
module Language.Marlowe.Runtime.Web.Server.REST (server) where

import Language.Marlowe.Runtime.Web.API (RuntimeAPI)
import Language.Marlowe.Runtime.Web.Server.Monad (ServerM)
import Language.Marlowe.Runtime.Web.Adapter.Server.Monad (ServerM)
import qualified Language.Marlowe.Runtime.Web.Server.REST.Contracts as Contracts
import qualified Language.Marlowe.Runtime.Web.Server.REST.Payouts as Payouts
import qualified Language.Marlowe.Runtime.Web.Server.REST.Withdrawals as Withdrawals
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,18 @@ import Language.Marlowe.Runtime.ChainSync.Api (DatumHash (..))
import Language.Marlowe.Runtime.Contract.Api (ContractWithAdjacency (..))

import Language.Marlowe.Runtime.Web.Adapter.Servant (ListObject (..))
import Language.Marlowe.Runtime.Web.Adapter.Server.ApiError (badRequest', badRequest'')
import Language.Marlowe.Runtime.Web.Adapter.Server.Monad (
ServerM,
getContract,
importBundle,
)
import Language.Marlowe.Runtime.Web.Contract.API (
ContractSourceAPI,
ContractSourceId (..),
ContractSourcesAPI,
PostContractSourceResponse (..),
)
import Language.Marlowe.Runtime.Web.Server.Monad (
ServerM,
getContract,
importBundle,
)
import Language.Marlowe.Runtime.Web.Server.REST.ApiError (badRequest', badRequest'')

import Pipes (MFunctor (..), Producer, liftIO, (>->))
import qualified Pipes.Prelude as Pipes
Expand Down
Loading

0 comments on commit 5281d6d

Please sign in to comment.