module Test.QuickCheck.ContractModel.Internal.Utils where import Test.QuickCheck.ContractModel.Internal.Common import Data.Map qualified as Map import Cardano.Api getTxOuts :: Tx Era -> [TxOut CtxTx Era] getTxOuts :: Tx Era -> [TxOut CtxTx Era] getTxOuts (Tx Era -> TxBody Era forall era. Tx era -> TxBody era getTxBody -> TxBody TxBodyContent ViewTx Era content) = TxBodyContent ViewTx Era -> [TxOut CtxTx Era] forall build era. TxBodyContent build era -> [TxOut CtxTx era] txOuts TxBodyContent ViewTx Era content getTxInputs :: Tx Era -> UTxO Era -> [TxOut CtxUTxO Era] getTxInputs :: Tx Era -> UTxO Era -> [TxOut CtxUTxO Era] getTxInputs (Tx Era -> TxBody Era forall era. Tx era -> TxBody era getTxBody -> TxBody TxBodyContent ViewTx Era content) (UTxO Map TxIn (TxOut CtxUTxO Era) utxo) = [ TxOut CtxUTxO Era txOut | (TxIn txIn, BuildTxWith ViewTx (Witness WitCtxTxIn Era) _) <- TxBodyContent ViewTx Era -> TxIns ViewTx Era forall build era. TxBodyContent build era -> TxIns build era txIns TxBodyContent ViewTx Era content , Just TxOut CtxUTxO Era txOut <- [TxIn -> Map TxIn (TxOut CtxUTxO Era) -> Maybe (TxOut CtxUTxO Era) forall k a. Ord k => k -> Map k a -> Maybe a Map.lookup TxIn txIn Map TxIn (TxOut CtxUTxO Era) utxo] ] bucket :: (Num a, Ord a, Show a, Integral a) => a -> a -> [String] bucket :: a -> a -> [String] bucket a _ a 0 = [String "0"] bucket a size a n | a n a -> a -> Bool forall a. Ord a => a -> a -> Bool < a size = [ String "<" String -> String -> String forall a. [a] -> [a] -> [a] ++ a -> String forall a. Show a => a -> String show a size ] | a size a -> a -> Bool forall a. Ord a => a -> a -> Bool <= a n, a n a -> a -> Bool forall a. Ord a => a -> a -> Bool < a sizea -> a -> a forall a. Num a => a -> a -> a *a 10 = [a -> a -> String forall a. (Integral a, Show a) => a -> a -> String bucketIn a size a n] | Bool otherwise = a -> a -> [String] forall a. (Num a, Ord a, Show a, Integral a) => a -> a -> [String] bucket (a sizea -> a -> a forall a. Num a => a -> a -> a *a 10) a n where bucketIn :: a -> a -> String bucketIn a size a n = let b :: a b = a n a -> a -> a forall a. Integral a => a -> a -> a `div` a size in a -> String forall a. Show a => a -> String show (a ba -> a -> a forall a. Num a => a -> a -> a *a size) String -> String -> String forall a. [a] -> [a] -> [a] ++ String "-" String -> String -> String forall a. [a] -> [a] -> [a] ++ a -> String forall a. Show a => a -> String show (a ba -> a -> a forall a. Num a => a -> a -> a *a sizea -> a -> a forall a. Num a => a -> a -> a +(a size a -> a -> a forall a. Num a => a -> a -> a - a 1))