@@ -5,9 +5,10 @@ module Test.Hydra.Cluster.FaucetSpec where
5
5
import Hydra.Prelude
6
6
import Test.Hydra.Prelude
7
7
8
+ import Cardano.Api.UTxO qualified as UTxO
8
9
import CardanoNode (withCardanoNodeDevnet )
9
10
import Control.Concurrent.Async (replicateConcurrently )
10
- import Hydra.Cardano.Api (Coin (.. ), selectLovelace , txOutValue )
11
+ import Hydra.Cardano.Api (Coin (.. ), selectLovelace )
11
12
import Hydra.Chain.Backend qualified as Backend
12
13
import Hydra.Chain.CardanoClient (QueryPoint (.. ))
13
14
import Hydra.Chain.Direct (DirectBackend (.. ))
36
37
vk <- generate genVerificationKey
37
38
seedFromFaucet backend vk 1_000_000 tracer
38
39
-- 10 unique outputs
39
- length (fold utxos) `shouldBe` 10
40
+ UTxO. size (fold utxos) `shouldBe` 10
40
41
41
42
describe " returnFundsToFaucet" $ do
42
43
it " does nothing if nothing to return" $ \ (tracer, backend) -> do
@@ -53,13 +54,13 @@ spec =
53
54
returnFundsToFaucet tracer backend actor
54
55
remaining <- Backend. queryUTxOFor backend QueryTip vk
55
56
finalFaucetFunds <- Backend. queryUTxOFor backend QueryTip faucetVk
56
- foldMap txOutValue remaining `shouldBe` mempty
57
+ UTxO. totalValue remaining `shouldBe` mempty
57
58
58
59
-- check the faucet has one utxo extra in the end
59
- length finalFaucetFunds `shouldBe` length initialFaucetFunds + 1
60
+ UTxO. size finalFaucetFunds `shouldBe` UTxO. size initialFaucetFunds + 1
60
61
61
- let initialFaucetValue = selectLovelace (foldMap txOutValue initialFaucetFunds)
62
- let finalFaucetValue = selectLovelace (foldMap txOutValue finalFaucetFunds)
62
+ let initialFaucetValue = selectLovelace (UTxO. totalValue initialFaucetFunds)
63
+ let finalFaucetValue = selectLovelace (UTxO. totalValue finalFaucetFunds)
63
64
let difference = initialFaucetValue - finalFaucetValue
64
65
-- difference between starting faucet amount and final one should
65
66
-- just be the amount of paid fees
77
78
-- it squashed the UTxO
78
79
utxoAfter <- Backend. queryUTxOFor backend QueryTip vk
79
80
80
- length utxoAfter `shouldBe` 1
81
+ UTxO. size utxoAfter `shouldBe` 1
0 commit comments