Skip to content

Commit 9619c93

Browse files
committed
Refactor sendRequest out
Signed-off-by: Sasha Bogicevic <[email protected]>
1 parent 8fef102 commit 9619c93

File tree

1 file changed

+1
-12
lines changed

1 file changed

+1
-12
lines changed

hydra-cluster/src/Hydra/Cluster/Scenarios.hs

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ import Data.Map qualified as Map
3636
import Data.Set qualified as Set
3737
import Data.Text qualified as T
3838
import Hydra.API.HTTPServer (
39-
DraftCommitTxRequest (..),
4039
DraftCommitTxResponse (..),
4140
TransactionSubmitted (..),
4241
)
@@ -1333,7 +1332,7 @@ canDepositPartially tracer workDir blockTime backend hydraScriptsTxId =
13331332
(walletVk, walletSk) <- generate genKeyPair
13341333
commitUTxO <- seedFromFaucet backend walletVk 5_000_000 (contramap FromFaucet tracer)
13351334
-- This one is expected to fail since there is 5 ADA at the wallet address but we specified 6 ADA to commit
1336-
sendRequest 2 commitUTxO (Just 6_000_000)
1335+
(requestCommitTx' n1 commitUTxO (Just 6_000_000) <&> toJSON)
13371336
`shouldThrow` expectErrorStatus 400 (Just "AmountTooLow")
13381337

13391338
commitUTxO2 <- seedFromFaucet backend walletVk 5_000_000 (contramap FromFaucet tracer)
@@ -1384,16 +1383,6 @@ canDepositPartially tracer workDir blockTime backend hydraScriptsTxId =
13841383
where
13851384
hydraTracer = contramap FromHydraNode tracer
13861385

1387-
sendRequest :: MonadIO m => Int -> UTxO.UTxO -> Maybe Coin -> m (JsonResponse Aeson.Value)
1388-
sendRequest hydraNodeId utxo amt =
1389-
runReq defaultHttpConfig $
1390-
req
1391-
POST
1392-
(http "127.0.0.1" /: "commit")
1393-
(ReqBodyJson $ SimpleCommitRequest @Tx utxo amt)
1394-
(Proxy :: Proxy (JsonResponse Aeson.Value))
1395-
(port $ 4000 + hydraNodeId)
1396-
13971386
rejectCommit :: ChainBackend backend => Tracer IO EndToEndLog -> FilePath -> NominalDiffTime -> backend -> [TxId] -> IO ()
13981387
rejectCommit tracer workDir blockTime backend hydraScriptsTxId =
13991388
(`finally` returnFundsToFaucet tracer backend Alice) $ do

0 commit comments

Comments
 (0)