plutus_ledger_api/goldens/
v3.rs

1//! Golden test data or Plutus V3 types (incomplete)
2use num_bigint::BigInt;
3
4pub use super::v2::{
5    sample_address, sample_asset_class, sample_chain_pointer, sample_credential,
6    sample_currency_symbol, sample_datum, sample_datum_hash, sample_dcert,
7    sample_ed25519_pub_key_hash, sample_output_datum, sample_payment_pub_key_hash,
8    sample_plutus_data, sample_plutus_interval, sample_redeemer, sample_redeemer_hash,
9    sample_script_hash, sample_staking_credential, sample_token_name, sample_transaction_output,
10    sample_value,
11};
12use crate::v3::{
13    crypto::LedgerBytes,
14    transaction::{
15        ColdCommitteeCredential, DRepCredential, HotCommitteeCredential, TransactionHash,
16        TransactionInput, TxInInfo,
17    },
18};
19
20pub fn sample_transaction_hash() -> TransactionHash {
21    TransactionHash(LedgerBytes([0].repeat(32).to_vec()))
22}
23
24pub fn sample_transaction_input() -> TransactionInput {
25    TransactionInput {
26        transaction_id: sample_transaction_hash(),
27        index: BigInt::from(3),
28    }
29}
30
31pub fn sample_tx_in_info() -> TxInInfo {
32    TxInInfo {
33        reference: sample_transaction_input(),
34        output: sample_transaction_output(),
35    }
36}
37
38pub fn sample_cold_committee_credential() -> ColdCommitteeCredential {
39    ColdCommitteeCredential(sample_credential())
40}
41
42pub fn sample_hot_committee_credential() -> HotCommitteeCredential {
43    HotCommitteeCredential(sample_credential())
44}
45
46pub fn sample_drep_committee_credential() -> DRepCredential {
47    DRepCredential(sample_credential())
48}
49
50// TODO(szg251): Missing implementations
51// DRep
52// Delegatee
53// TxCert
54// Vote
55// Voter
56// GovernanceActionId
57// Committee
58// Constitution
59// ProtocolVersion
60// ChangedParameters
61// GovernanceAction
62// ProposalProcedure
63// ScriptPurpose
64// ScriptInfo
65// TransactionInfo
66// ScriptContext