Skip to content

Commit a7108f7

Browse files
committed
Add a subset of v3 goldens
1 parent f6d2a45 commit a7108f7

File tree

3 files changed

+70
-1
lines changed

3 files changed

+70
-1
lines changed

plutus-ledger-api/src/goldens/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
//! Golden test data
22
pub mod v1;
33
pub mod v2;
4+
pub mod v3;

plutus-ledger-api/src/goldens/v2.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
//! Golden test data or Plutus V2 types
2+
3+
use num_bigint::BigInt;
4+
25
pub use super::v1::{
36
sample_address, sample_asset_class, sample_chain_pointer, sample_credential,
47
sample_currency_symbol, sample_datum, sample_datum_hash, sample_dcert,
@@ -14,7 +17,6 @@ use crate::v2::{
1417
script::ScriptHash,
1518
transaction::{ScriptContext, TransactionInfo, TransactionOutput, TxInInfo},
1619
};
17-
use num_bigint::BigInt;
1820

1921
pub fn sample_output_datum() -> OutputDatum {
2022
OutputDatum::InlineDatum(super::v1::sample_datum())

plutus-ledger-api/src/goldens/v3.rs

+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
//! Golden test data or Plutus V3 types (incomplete)
2+
use num_bigint::BigInt;
3+
4+
pub 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+
};
12+
use crate::v3::{
13+
crypto::LedgerBytes,
14+
transaction::{
15+
ColdCommitteeCredential, DRepCredential, HotCommitteeCredential, TransactionHash,
16+
TransactionInput, TxInInfo,
17+
},
18+
};
19+
20+
pub fn sample_transaction_hash() -> TransactionHash {
21+
TransactionHash(LedgerBytes([0].repeat(32).to_vec()))
22+
}
23+
24+
pub fn sample_transaction_input() -> TransactionInput {
25+
TransactionInput {
26+
transaction_id: sample_transaction_hash(),
27+
index: BigInt::from(3),
28+
}
29+
}
30+
31+
pub fn sample_tx_in_info() -> TxInInfo {
32+
TxInInfo {
33+
reference: sample_transaction_input(),
34+
output: sample_transaction_output(),
35+
}
36+
}
37+
38+
pub fn sample_cold_committee_credential() -> ColdCommitteeCredential {
39+
ColdCommitteeCredential(sample_credential())
40+
}
41+
42+
pub fn sample_hot_committee_credential() -> HotCommitteeCredential {
43+
HotCommitteeCredential(sample_credential())
44+
}
45+
46+
pub 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

0 commit comments

Comments
 (0)