@@ -14,7 +14,7 @@ use crate::{
14
14
primitive:: arb_integer,
15
15
v1:: {
16
16
arb_currency_symbol, arb_datum, arb_ed25519_pub_key_hash, arb_lovelace,
17
- arb_payment_pub_key_hash, arb_stake_pub_key_hash, arb_transaction_input ,
17
+ arb_payment_pub_key_hash, arb_stake_pub_key_hash,
18
18
} ,
19
19
} ,
20
20
v3:: {
@@ -23,21 +23,34 @@ use crate::{
23
23
ChangedParameters , ColdCommitteeCredential , Committee , Constitution , DRep ,
24
24
DRepCredential , Delegatee , GovernanceAction , GovernanceActionId ,
25
25
HotCommitteeCredential , ProposalProcedure , ProtocolVersion , ScriptContext , ScriptInfo ,
26
- ScriptPurpose , TransactionInfo , TxCert , Vote , Voter ,
26
+ ScriptPurpose , TransactionHash , TransactionInfo , TransactionInput , TxCert , TxInInfo ,
27
+ Vote , Voter ,
27
28
} ,
28
29
} ,
29
30
} ;
30
31
31
32
use super :: {
32
33
primitive:: arb_natural,
33
34
v1:: {
34
- arb_assoc_map, arb_credential, arb_datum_hash, arb_plutus_data,
35
- arb_plutus_interval_posix_time, arb_redeemer, arb_script_hash, arb_transaction_hash,
36
- arb_value,
35
+ arb_assoc_map, arb_credential, arb_datum_hash, arb_ledger_bytes, arb_plutus_data,
36
+ arb_plutus_interval_posix_time, arb_redeemer, arb_script_hash, arb_value,
37
37
} ,
38
- v2:: { arb_transaction_output, arb_tx_in_info } ,
38
+ v2:: arb_transaction_output,
39
39
} ;
40
40
41
+ /// Strategy to generate a transaction hash
42
+ pub fn arb_transaction_hash ( ) -> impl Strategy < Value = TransactionHash > {
43
+ arb_ledger_bytes ( 32 ) . prop_map ( TransactionHash )
44
+ }
45
+
46
+ /// Strategy to generate a transaction input
47
+ pub fn arb_transaction_input ( ) -> impl Strategy < Value = TransactionInput > {
48
+ ( arb_transaction_hash ( ) , arb_natural ( 1 ) ) . prop_map ( |( transaction_id, index) | TransactionInput {
49
+ transaction_id,
50
+ index,
51
+ } )
52
+ }
53
+
41
54
/// Strategy to generate cold committee credentials
42
55
pub fn arb_cold_committee_credential ( ) -> impl Strategy < Value = ColdCommitteeCredential > {
43
56
arb_credential ( ) . prop_map ( ColdCommitteeCredential )
@@ -280,6 +293,12 @@ pub fn arb_transaction_info() -> impl Strategy<Value = TransactionInfo> {
280
293
)
281
294
}
282
295
296
+ /// Strategy to generate a TxInInfo
297
+ pub fn arb_tx_in_info ( ) -> impl Strategy < Value = TxInInfo > {
298
+ ( arb_transaction_input ( ) , arb_transaction_output ( ) )
299
+ . prop_map ( |( reference, output) | TxInInfo { reference, output } )
300
+ }
301
+
283
302
/// Strategy to generate script contexts
284
303
pub fn arb_script_context ( ) -> impl Strategy < Value = ScriptContext > {
285
304
( arb_transaction_info ( ) , arb_redeemer ( ) , arb_script_info ( ) ) . prop_map (
0 commit comments