@@ -273,7 +273,7 @@ isBalanced utxo originalTx balancedTx =
273273 let inp' = knownInputBalance utxo balancedTx
274274 out' = outputBalance balancedTx
275275 out = outputBalance originalTx
276- fee = ( view feeTxBodyL . body ) balancedTx
276+ fee = view (bodyTxL . feeTxBodyL ) balancedTx
277277 in coin (deltaValue out' inp') == fee
278278 & counterexample (" Fee: " <> show fee)
279279 & counterexample (" Delta value: " <> show (coin $ deltaValue out' inp'))
@@ -347,9 +347,9 @@ genTxsSpending utxo = scale (round @Double . sqrt . fromIntegral) $ do
347347
348348genUTxO :: Gen (Map TxIn TxOut )
349349genUTxO = do
350- tx <- arbitrary `suchThat` (Prelude. not . Prelude. null . view outputsTxBodyL . body )
350+ tx <- arbitrary `suchThat` (Prelude. not . Prelude. null . view (bodyTxL . outputsTxBodyL) )
351351 txIn <- toLedgerTxIn <$> genTxIn
352- let txOut = scaleAda $ Prelude. head $ toList $ body tx ^. outputsTxBodyL
352+ let txOut = scaleAda $ Prelude. head $ toList $ tx ^. (bodyTxL . outputsTxBodyL)
353353 pure $ Map. singleton txIn txOut
354354 where
355355 scaleAda :: TxOut -> TxOut
@@ -358,10 +358,10 @@ genUTxO = do
358358 in BabbageTxOut addr value' datum refScript
359359
360360genOutputsForInputs :: Tx LedgerEra -> Gen (Map TxIn TxOut )
361- genOutputsForInputs AlonzoTx {body} = do
362- let n = Set. size (view inputsTxBodyL body )
361+ genOutputsForInputs tx = do
362+ let n = Set. size (view (bodyTxL . inputsTxBodyL) tx )
363363 outs <- vectorOf n arbitrary
364- pure $ Map. fromList $ zip (toList (view inputsTxBodyL body )) outs
364+ pure $ Map. fromList $ zip (toList (view (bodyTxL . inputsTxBodyL) tx )) outs
365365
366366genLedgerTx :: Gen (Tx LedgerEra )
367367genLedgerTx = do
@@ -374,11 +374,11 @@ genLedgerTx = do
374374
375375allTxIns :: [Tx LedgerEra ] -> Set TxIn
376376allTxIns txs =
377- Set. unions (view inputsTxBodyL . body <$> txs)
377+ Set. unions (view (bodyTxL . inputsTxBodyL) <$> txs)
378378
379379allTxOuts :: [Tx LedgerEra ] -> [TxOut ]
380380allTxOuts txs =
381- toList $ mconcat (view outputsTxBodyL . body <$> txs)
381+ toList $ mconcat (view (bodyTxL . outputsTxBodyL) <$> txs)
382382
383383isOurs :: Map TxIn TxOut -> Address -> Bool
384384isOurs utxo addr =
@@ -406,12 +406,12 @@ deltaValue a b
406406
407407-- | NOTE: This does not account for withdrawals
408408knownInputBalance :: Map TxIn TxOut -> Tx LedgerEra -> Value LedgerEra
409- knownInputBalance utxo = foldMap resolve . toList . view inputsTxBodyL . body
409+ knownInputBalance utxo = foldMap resolve . toList . view (bodyTxL . inputsTxBodyL)
410410 where
411411 resolve :: TxIn -> Value LedgerEra
412412 resolve k = maybe zero getValue (Map. lookup k utxo)
413413
414414-- | NOTE: This does not account for deposits
415415outputBalance :: Tx LedgerEra -> Value LedgerEra
416416outputBalance =
417- foldMap getValue . view outputsTxBodyL . body
417+ foldMap getValue . view (bodyTxL . outputsTxBodyL)
0 commit comments