Skip to content

Commit

Permalink
SCB: Code formatting tweak.
Browse files Browse the repository at this point in the history
  • Loading branch information
Kris Jenkins authored and krisajenkins committed Aug 10, 2020
1 parent 25754b4 commit 7902a14
Showing 1 changed file with 15 additions and 16 deletions.
31 changes: 15 additions & 16 deletions plutus-scb/src/Plutus/SCB/Webserver/Handler.hs
Expand Up @@ -121,10 +121,8 @@ contractSchema ::
=> ContractInstanceId
-> Eff effs (ContractSignatureResponse t)
contractSchema contractId = do
ContractInstanceState {csContractDefinition} <-
getContractInstanceState @t contractId
ContractSignatureResponse csContractDefinition <$>
exportSchema csContractDefinition
ContractInstanceState {csContractDefinition} <- getContractInstanceState @t contractId
ContractSignatureResponse csContractDefinition <$> exportSchema csContractDefinition

activateContract ::
forall t effs.
Expand Down Expand Up @@ -181,7 +179,6 @@ parseContractId t =
Just uuid -> pure $ ContractInstanceId uuid
Nothing -> throwError $ InvalidUUIDError t


handler ::
forall effs.
( Member (EventLogEffect (ChainEvent ContractExe)) effs
Expand All @@ -196,17 +193,19 @@ handler ::
)
=> Eff effs ()
:<|> (Eff effs (FullReport ContractExe)
:<|> ((ContractExe -> Eff effs (ContractInstanceState ContractExe))
:<|> (ContractExe -> Eff effs (ContractInstanceState ContractExe))
:<|> (Text -> Eff effs (ContractSignatureResponse ContractExe)
:<|> (String -> JSON.Value -> Eff effs (ContractInstanceState ContractExe)))))
:<|> (String -> JSON.Value -> Eff effs (ContractInstanceState ContractExe))))
handler =
healthcheck :<|> getFullReport :<|>
(activateContract :<|>
(\rawInstanceId ->
(parseContractId rawInstanceId >>= contractSchema) :<|>
(\rawEndpointDescription payload ->
parseStringifiedJSON payload >>= \payload' ->
parseContractId rawInstanceId >>=
invokeEndpoint
(EndpointDescription rawEndpointDescription)
payload')))
(activateContract :<|> byContractInstanceId)
where
byContractInstanceId rawInstanceId = do
instanceId <- parseContractId rawInstanceId
contractSchema instanceId :<|> handleInvokeEndpoint instanceId
handleInvokeEndpoint instanceId rawEndpointDescription rawPayload = do
payload <- parseStringifiedJSON rawPayload
invokeEndpoint
(EndpointDescription rawEndpointDescription)
payload
instanceId

0 comments on commit 7902a14

Please sign in to comment.