@@ -144,7 +144,7 @@ where
144
144
145
145
import Cardano.Api hiding (txIns )
146
146
import qualified Cardano.Api as Api
147
- import qualified Cardano.Api.Experimental as Exp
147
+ import qualified Cardano.Api.Experimental as Exp
148
148
import Cardano.Api.Byron (KeyWitness (ByronKeyWitness ),
149
149
WitnessNetworkIdOrByronAddress (.. ))
150
150
import qualified Cardano.Api.Byron as Byron
@@ -965,11 +965,17 @@ genTxInsCollateral =
965
965
]
966
966
)
967
967
968
- genTxInsReference :: CardanoEra era -> Gen (TxInsReference era )
968
+ genTxInsReference
969
+ :: Applicative (BuildTxWith build )
970
+ => CardanoEra era
971
+ -> Gen (TxInsReference build era )
969
972
genTxInsReference =
970
973
caseByronToAlonzoOrBabbageEraOnwards
971
974
(const (pure TxInsReferenceNone ))
972
- (\ w -> TxInsReference w <$> Gen. list (Range. linear 0 10 ) genTxIn)
975
+ (\ w -> do
976
+ txIns <- Gen. list (Range. linear 0 10 ) genTxIn
977
+ pure $ TxInsReference w txIns mempty
978
+ )
973
979
974
980
genTxReturnCollateral :: ShelleyBasedEra era -> Gen (TxReturnCollateral CtxTx era )
975
981
genTxReturnCollateral era =
@@ -1022,7 +1028,7 @@ genWitnessesByron = Gen.list (Range.constant 1 10) genByronKeyWitness
1022
1028
1023
1029
-- | This generator validates generated 'TxBodyContent' and backtracks when the generated body
1024
1030
-- fails the validation. That also means that it is quite slow.
1025
- genValidTxBody :: Typeable era
1031
+ genValidTxBody :: Typeable era
1026
1032
=> ShelleyBasedEra era
1027
1033
-> Gen (TxBody era , TxBodyContent BuildTx era ) -- ^ validated 'TxBody' and 'TxBodyContent'
1028
1034
genValidTxBody sbe =
@@ -1036,7 +1042,7 @@ genValidTxBody sbe =
1036
1042
-- | Partial! This function will throw an error when the generated transaction is invalid.
1037
1043
genTxBody :: (HasCallStack , Typeable era ) => ShelleyBasedEra era -> Gen (TxBody era )
1038
1044
genTxBody era = do
1039
- res <- Api. createTransactionBody era <$> genTxBodyContent era
1045
+ res <- Api. createTransactionBody era mempty <$> genTxBodyContent era
1040
1046
case res of
1041
1047
Left err -> error (docToString (prettyError err))
1042
1048
Right txBody -> pure txBody
@@ -1135,7 +1141,7 @@ genShelleyBootstrapWitness sbe =
1135
1141
<*> (fst <$> genValidTxBody sbe)
1136
1142
<*> genSigningKey AsByronKey
1137
1143
1138
-
1144
+
1139
1145
genShelleyKeyWitness
1140
1146
:: ()
1141
1147
=> Typeable era
@@ -1385,39 +1391,39 @@ genTreasuryDonation :: ConwayEraOnwards era -> Gen L.Coin
1385
1391
genTreasuryDonation _era = Q. arbitrary
1386
1392
1387
1393
genWitnessable :: L. AlonzoEraScript era => Gen (Exp. Witnessable Exp. TxInItem era )
1388
- genWitnessable = Exp. WitTxIn <$> genTxIn
1394
+ genWitnessable = Exp. WitTxIn <$> genTxIn
1389
1395
1390
1396
genMintWitnessable :: L. AlonzoEraScript era => Gen (Exp. Witnessable Exp. MintItem era )
1391
- genMintWitnessable = Exp. WitMint <$> genPolicyId <*> genPolicyAssets
1397
+ genMintWitnessable = Exp. WitMint <$> genPolicyId <*> genPolicyAssets
1392
1398
1393
- genIndexedPlutusScriptWitness
1394
- :: L. AlonzoEraScript (ShelleyLedgerEra era )
1399
+ genIndexedPlutusScriptWitness
1400
+ :: L. AlonzoEraScript (ShelleyLedgerEra era )
1395
1401
=> Gen (Exp. IndexedPlutusScriptWitness Exp. TxInItem L. PlutusV3 Exp. SpendingScript (ShelleyLedgerEra era ))
1396
1402
genIndexedPlutusScriptWitness = do
1397
1403
index <- Gen. word32 $ Range. linear 1 10
1398
1404
witnessable <- genWitnessable
1399
- Exp. IndexedPlutusScriptWitness
1405
+ Exp. IndexedPlutusScriptWitness
1400
1406
<$> genWitnessable
1401
1407
<*> genPlutusPurpose index witnessable
1402
- <*> genPlutusScriptWitness
1408
+ <*> genPlutusScriptWitness
1403
1409
1404
- genPlutusPurpose
1405
- :: Word32
1406
- -> Exp. Witnessable thing (ShelleyLedgerEra era )
1410
+ genPlutusPurpose
1411
+ :: Word32
1412
+ -> Exp. Witnessable thing (ShelleyLedgerEra era )
1407
1413
-> Gen (L. PlutusPurpose L. AsIx (ShelleyLedgerEra era ))
1408
1414
genPlutusPurpose index wit = return $ Exp. toPlutusScriptPurpose index wit
1409
1415
1410
1416
genPlutusScriptWitness :: Gen (Exp. PlutusScriptWitness L. PlutusV3 purpose era )
1411
- genPlutusScriptWitness = do
1417
+ genPlutusScriptWitness = do
1412
1418
let l = Exp. toPlutusSLanguage PlutusScriptV3
1413
- Exp. PlutusScriptWitness l . Exp. PReferenceScript
1419
+ Exp. PlutusScriptWitness l . Exp. PReferenceScript
1414
1420
<$> genTxIn
1415
1421
<*> genPlutusScriptDatum
1416
1422
<*> genHashableScriptData
1417
- <*> genExecutionUnits
1423
+ <*> genExecutionUnits
1418
1424
1419
1425
genPlutusScriptDatum :: Gen (Exp. PlutusScriptDatum lang purpose )
1420
- genPlutusScriptDatum = return Exp. NoScriptDatum
1426
+ genPlutusScriptDatum = return Exp. NoScriptDatum
1421
1427
1422
1428
-- | This generator does not generate a valid witness - just a random one.
1423
1429
genScriptWitnessForStake :: ShelleyBasedEra era -> Gen (Api. ScriptWitness WitCtxStake era )
0 commit comments