1use serde::{Deserialize, Serialize};
2use std::collections::HashMap;
3
4pub type AddressPrototype = String;
9pub type URLPrototype = String;
10pub type AnchorDataHashPrototype = String;
11pub type AssetNamePrototype = String;
12pub type AssetNamesPrototype = Vec<String>;
13pub type AuxiliaryDataHashPrototype = String;
14pub type BigIntPrototype = String;
15pub type BigNumPrototype = String;
16pub type VkeyPrototype = String;
17pub type DNSRecordAorAAAAPrototype = String;
18pub type DNSRecordSRVPrototype = String;
19pub type BlockHashPrototype = String;
20pub type DataHashPrototype = String;
21pub type Ed25519KeyHashPrototype = String;
22pub type Ed25519KeyHashesPrototype = Vec<String>;
23pub type Ed25519SignaturePrototype = String;
24pub type GenesisDelegateHashPrototype = String;
25pub type GenesisHashPrototype = String;
26pub type GenesisHashesPrototype = Vec<String>;
27pub type IntPrototype = String;
28pub type KESVKeyPrototype = String;
29pub type PoolMetadataHashPrototype = String;
30pub type PublicKeyPrototype = String;
31pub type RewardAddressPrototype = String;
32pub type RewardAddressesPrototype = Vec<String>;
33pub type ScriptDataHashPrototype = String;
34pub type ScriptHashPrototype = String;
35pub type ScriptHashesPrototype = Vec<String>;
36pub type TransactionHashPrototype = String;
37pub type PlutusScriptPrototype = String;
38pub type PlutusScriptsPrototype = Vec<String>;
39pub type CostModelPrototype = Vec<String>;
40
41pub type Ipv4Prototype = [u8; 4];
46pub type Ipv6Prototype = [u8; 16];
47
48pub type NonceHashPrototype = [u8; 32];
53
54#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
59pub struct AnchorPrototype {
60 pub anchor_data_hash: String,
61 pub anchor_url: URLPrototype,
62}
63
64pub type AssetsPrototype = HashMap<String, String>;
69pub type MultiAssetPrototype = HashMap<String, AssetsPrototype>;
70pub type MintPrototype = MultiAssetPrototype;
71
72#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
77#[serde(tag = "type")]
78pub enum NativeScriptPrototype {
79 #[serde(rename = "SCRIPT_PUBKEY")]
80 ScriptPubkey { value: ScriptPubkeyPrototype },
81 #[serde(rename = "SCRIPT_ALL")]
82 ScriptAll { value: ScriptAllPrototype },
83 #[serde(rename = "SCRIPT_ANY")]
84 ScriptAny { value: ScriptAnyPrototype },
85 #[serde(rename = "SCRIPT_N_OF_K")]
86 ScriptNOfK { value: ScriptNOfKPrototype },
87 #[serde(rename = "TIMELOCK_START")]
88 TimelockStart { value: TimelockStartPrototype },
89 #[serde(rename = "TIMELOCK_EXPIRY")]
90 TimelockExpiry { value: TimelockExpiryPrototype },
91}
92
93#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
94pub struct ScriptPubkeyPrototype {
95 pub addr_keyhash: String,
96}
97
98#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
99pub struct ScriptAllPrototype {
100 pub native_scripts: Vec<NativeScriptPrototype>,
101}
102
103#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
104pub struct ScriptAnyPrototype {
105 pub native_scripts: Vec<NativeScriptPrototype>,
106}
107
108#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
109pub struct ScriptNOfKPrototype {
110 pub n: u32,
111 pub native_scripts: Vec<NativeScriptPrototype>,
112}
113
114#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
115pub struct TimelockStartPrototype {
116 pub slot: String,
117}
118
119#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
120pub struct TimelockExpiryPrototype {
121 pub slot: String,
122}
123
124pub type NativeScriptsPrototype = Vec<NativeScriptPrototype>;
125
126#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
131#[serde(tag = "type")]
132pub enum CredTypePrototype {
133 #[serde(rename = "SCRIPT")]
134 Script { value: String },
135 #[serde(rename = "KEY")]
136 Key { value: String },
137}
138
139pub type CredentialPrototype = CredTypePrototype;
140pub type CredentialsPrototype = Vec<CredTypePrototype>;
141
142#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
147#[serde(tag = "type")]
148pub enum RelayPrototype {
149 #[serde(rename = "SINGLE_HOST_ADDR")]
150 SingleHostAddr { value: SingleHostAddrPrototype },
151 #[serde(rename = "SINGLE_HOST_NAME")]
152 SingleHostName { value: SingleHostNamePrototype },
153 #[serde(rename = "MULTI_HOST_NAME")]
154 MultiHostName { value: MultiHostNamePrototype },
155}
156
157#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
158pub struct SingleHostAddrPrototype {
159 pub ipv4: Option<Ipv4Prototype>,
160 pub ipv6: Option<Ipv6Prototype>,
161 pub port: Option<u16>,
162}
163
164#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
165pub struct SingleHostNamePrototype {
166 pub dns_name: DNSRecordAorAAAAPrototype,
167 pub port: Option<u16>,
168}
169
170#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
171pub struct MultiHostNamePrototype {
172 pub dns_name: DNSRecordSRVPrototype,
173}
174
175pub type RelaysPrototype = Vec<RelayPrototype>;
176
177#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
182pub struct UnitIntervalPrototype {
183 pub denominator: String,
184 pub numerator: String,
185}
186
187#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
192pub struct ProtocolVersionPrototype {
193 pub major: u32,
194 pub minor: u32,
195}
196
197#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
202pub struct PoolMetadataPrototype {
203 pub pool_metadata_hash: String,
204 pub url: URLPrototype,
205}
206
207#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
208pub struct PoolParamsPrototype {
209 pub cost: String,
210 pub margin: UnitIntervalPrototype,
211 pub operator: String,
212 pub pledge: String,
213 pub pool_metadata: Option<PoolMetadataPrototype>,
214 pub pool_owners: Vec<String>,
215 pub relays: RelaysPrototype,
216 pub reward_account: String,
217 pub vrf_keyhash: String,
218}
219
220#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
225#[serde(tag = "type")]
226pub enum MIRPotPrototype {
227 #[serde(rename = "RESERVES")]
228 Reserves,
229 #[serde(rename = "TREASURY")]
230 Treasury,
231}
232
233#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
234pub struct StakeToCoinPrototype {
235 pub amount: String,
236 pub stake_cred: CredTypePrototype,
237}
238
239#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
240#[serde(tag = "type")]
241pub enum MIREnumPrototype {
242 #[serde(rename = "TO_OTHER_POT")]
243 ToOtherPot { value: String },
244 #[serde(rename = "TO_STAKE_CREDENTIALS")]
245 ToStakeCredentials { value: Vec<StakeToCoinPrototype> },
246}
247
248#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
249pub struct MoveInstantaneousRewardPrototype {
250 pub pot: MIRPotPrototype,
251 pub variant: MIREnumPrototype,
252}
253
254pub type MIRToStakeCredentialsPrototype = Vec<StakeToCoinPrototype>;
255
256#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
261#[serde(tag = "type")]
262pub enum DRepPrototype {
263 #[serde(rename = "ALWAYS_ABSTAIN")]
264 AlwaysAbstain,
265 #[serde(rename = "ALWAYS_NO_CONFIDENCE")]
266 AlwaysNoConfidence,
267 #[serde(rename = "KEY_HASH")]
268 KeyHash { value: String },
269 #[serde(rename = "SCRIPT_HASH")]
270 ScriptHash { value: String },
271}
272
273#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
278pub struct StakeRegistrationPrototype {
279 pub coin: Option<String>,
280 pub stake_credential: CredTypePrototype,
281}
282
283#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
284pub struct StakeDeregistrationPrototype {
285 pub coin: Option<String>,
286 pub stake_credential: CredTypePrototype,
287}
288
289#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
290pub struct StakeDelegationPrototype {
291 pub pool_keyhash: String,
292 pub stake_credential: CredTypePrototype,
293}
294
295#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
296pub struct PoolRegistrationPrototype {
297 pub pool_params: PoolParamsPrototype,
298}
299
300#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
301pub struct PoolRetirementPrototype {
302 pub epoch: u32,
303 pub pool_keyhash: String,
304}
305
306#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
307pub struct GenesisKeyDelegationPrototype {
308 pub genesis_delegate_hash: String,
309 pub genesishash: String,
310 pub vrf_keyhash: String,
311}
312
313#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
314pub struct MoveInstantaneousRewardsCertPrototype {
315 pub move_instantaneous_reward: MoveInstantaneousRewardPrototype,
316}
317
318#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
319pub struct CommitteeHotAuthPrototype {
320 pub committee_cold_credential: CredTypePrototype,
321 pub committee_hot_credential: CredTypePrototype,
322}
323
324#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
325pub struct CommitteeColdResignPrototype {
326 pub anchor: Option<AnchorPrototype>,
327 pub committee_cold_credential: CredTypePrototype,
328}
329
330#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
331pub struct DRepDeregistrationPrototype {
332 pub coin: String,
333 pub voting_credential: CredTypePrototype,
334}
335
336#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
337pub struct DRepRegistrationPrototype {
338 pub anchor: Option<AnchorPrototype>,
339 pub coin: String,
340 pub voting_credential: CredTypePrototype,
341}
342
343#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
344pub struct DRepUpdatePrototype {
345 pub anchor: Option<AnchorPrototype>,
346 pub voting_credential: CredTypePrototype,
347}
348
349#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
350pub struct StakeAndVoteDelegationPrototype {
351 pub drep: DRepPrototype,
352 pub pool_keyhash: String,
353 pub stake_credential: CredTypePrototype,
354}
355
356#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
357pub struct StakeRegistrationAndDelegationPrototype {
358 pub coin: String,
359 pub pool_keyhash: String,
360 pub stake_credential: CredTypePrototype,
361}
362
363#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
364pub struct StakeVoteRegistrationAndDelegationPrototype {
365 pub coin: String,
366 pub drep: DRepPrototype,
367 pub pool_keyhash: String,
368 pub stake_credential: CredTypePrototype,
369}
370
371#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
372pub struct VoteDelegationPrototype {
373 pub drep: DRepPrototype,
374 pub stake_credential: CredTypePrototype,
375}
376
377#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
378pub struct VoteRegistrationAndDelegationPrototype {
379 pub coin: String,
380 pub drep: DRepPrototype,
381 pub stake_credential: CredTypePrototype,
382}
383
384#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
385#[serde(tag = "type")]
386pub enum CertificatePrototype {
387 #[serde(rename = "STAKE_REGISTRATION")]
388 StakeRegistration { value: StakeRegistrationPrototype },
389 #[serde(rename = "STAKE_DEREGISTRATION")]
390 StakeDeregistration { value: StakeDeregistrationPrototype },
391 #[serde(rename = "STAKE_DELEGATION")]
392 StakeDelegation { value: StakeDelegationPrototype },
393 #[serde(rename = "POOL_REGISTRATION")]
394 PoolRegistration { value: PoolRegistrationPrototype },
395 #[serde(rename = "POOL_RETIREMENT")]
396 PoolRetirement { value: PoolRetirementPrototype },
397 #[serde(rename = "GENESIS_KEY_DELEGATION")]
398 GenesisKeyDelegation {
399 value: GenesisKeyDelegationPrototype,
400 },
401 #[serde(rename = "MOVE_INSTANTANEOUS_REWARDS_CERT")]
402 MoveInstantaneousRewardsCert {
403 value: MoveInstantaneousRewardsCertPrototype,
404 },
405 #[serde(rename = "COMMITTEE_HOT_AUTH")]
406 CommitteeHotAuth { value: CommitteeHotAuthPrototype },
407 #[serde(rename = "COMMITTEE_COLD_RESIGN")]
408 CommitteeColdResign { value: CommitteeColdResignPrototype },
409 #[serde(rename = "DREP_DEREGISTRATION")]
410 DRepDeregistration { value: DRepDeregistrationPrototype },
411 #[serde(rename = "DREP_REGISTRATION")]
412 DRepRegistration { value: DRepRegistrationPrototype },
413 #[serde(rename = "DREP_UPDATE")]
414 DRepUpdate { value: DRepUpdatePrototype },
415 #[serde(rename = "STAKE_AND_VOTE_DELEGATION")]
416 StakeAndVoteDelegation {
417 value: StakeAndVoteDelegationPrototype,
418 },
419 #[serde(rename = "STAKE_REGISTRATION_AND_DELEGATION")]
420 StakeRegistrationAndDelegation {
421 value: StakeRegistrationAndDelegationPrototype,
422 },
423 #[serde(rename = "STAKE_VOTE_REGISTRATION_AND_DELEGATION")]
424 StakeVoteRegistrationAndDelegation {
425 value: StakeVoteRegistrationAndDelegationPrototype,
426 },
427 #[serde(rename = "VOTE_DELEGATION")]
428 VoteDelegation { value: VoteDelegationPrototype },
429 #[serde(rename = "VOTE_REGISTRATION_AND_DELEGATION")]
430 VoteRegistrationAndDelegation {
431 value: VoteRegistrationAndDelegationPrototype,
432 },
433}
434
435pub type CertificatesPrototype = Vec<CertificatePrototype>;
436
437#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
442#[serde(tag = "type")]
443pub enum PlutusDataVariant {
444 #[serde(rename = "CBOR")]
445 Cbor { hex: String },
446 #[serde(rename = "MANUAL")]
447 Manual { data: PlutusData },
448}
449
450#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
451#[serde(tag = "type")]
452pub enum PlutusData {
453 #[serde(rename = "INTEGER")]
454 Integer { value: i128 },
455 #[serde(rename = "BYTES")]
456 Bytes { value: String },
457 #[serde(rename = "LIST")]
458 List { value: Vec<PlutusData> },
459 #[serde(rename = "MAP")]
460 Map {
461 value: Vec<(PlutusData, PlutusData)>,
462 },
463 #[serde(rename = "CONSTR")]
464 Constr {
465 alternative: u64,
466 fields: Vec<PlutusData>,
467 },
468}
469
470#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
475#[serde(tag = "type")]
476pub enum DataOptionPrototype {
477 #[serde(rename = "DATA_HASH")]
478 DataHash { value: String },
479 #[serde(rename = "DATA")]
480 Data { value: PlutusDataVariant },
481}
482
483pub type ScriptRefPrototype = String;
489
490#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
495#[serde(tag = "type")]
496pub enum NetworkIdPrototype {
497 #[serde(rename = "TESTNET")]
498 Testnet,
499 #[serde(rename = "MAINNET")]
500 Mainnet,
501}
502
503#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
508pub struct ValuePrototype {
509 pub coin: String,
510 pub multiasset: Option<MultiAssetPrototype>,
511}
512
513#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
514pub struct TransactionOutputPrototype {
515 pub address: String,
516 pub amount: ValuePrototype,
517 pub plutus_data: Option<DataOptionPrototype>,
518 pub script_ref: Option<ScriptRefPrototype>,
519}
520
521pub type TransactionOutputsPrototype = Vec<TransactionOutputPrototype>;
522
523#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
528pub struct TransactionInputPrototype {
529 pub index: u32,
530 pub transaction_id: String,
531}
532
533pub type TransactionInputsPrototype = Vec<TransactionInputPrototype>;
534
535#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
540pub struct TransactionUnspentOutputPrototype {
541 pub input: TransactionInputPrototype,
542 pub output: TransactionOutputPrototype,
543}
544
545pub type TransactionUnspentOutputsPrototype = Vec<TransactionUnspentOutputPrototype>;
546
547pub type WithdrawalsPrototype = HashMap<String, String>;
552
553#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
558#[serde(tag = "type")]
559pub enum VoterPrototype {
560 #[serde(rename = "CONSTITUTIONAL_COMMITTEE_HOT_CRED")]
561 ConstitutionalCommitteeHotCred { value: CredTypePrototype },
562 #[serde(rename = "DREP")]
563 DRep { value: CredTypePrototype },
564 #[serde(rename = "STAKING_POOL")]
565 StakingPool { value: String },
566}
567
568pub type VotersPrototype = Vec<VoterPrototype>;
569
570#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
571#[serde(tag = "type")]
572pub enum VoteKindPrototype {
573 #[serde(rename = "NO")]
574 No,
575 #[serde(rename = "YES")]
576 Yes,
577 #[serde(rename = "ABSTAIN")]
578 Abstain,
579}
580
581#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
582pub struct GovernanceActionIdPrototype {
583 pub index: u32,
584 pub transaction_id: String,
585}
586
587pub type GovernanceActionIdsPrototype = Vec<GovernanceActionIdPrototype>;
588
589#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
590pub struct VotingProcedurePrototype {
591 pub anchor: Option<AnchorPrototype>,
592 pub vote: VoteKindPrototype,
593}
594
595#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
596pub struct VotePrototype {
597 pub action_id: GovernanceActionIdPrototype,
598 pub voting_procedure: VotingProcedurePrototype,
599}
600
601#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
602pub struct VoterVotesPrototype {
603 pub voter: VoterPrototype,
604 pub votes: Vec<VotePrototype>,
605}
606
607pub type VotingProceduresPrototype = Vec<VoterVotesPrototype>;
608
609#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
614pub struct ParameterChangeActionPrototype {
615 pub gov_action_id: Option<GovernanceActionIdPrototype>,
616 pub policy_hash: Option<String>,
617 pub protocol_param_updates: ProtocolParamUpdatePrototype,
618}
619
620#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
621pub struct HardForkInitiationActionPrototype {
622 pub gov_action_id: Option<GovernanceActionIdPrototype>,
623 pub protocol_version: ProtocolVersionPrototype,
624}
625
626pub type TreasuryWithdrawalsPrototype = HashMap<String, String>;
627
628#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
629pub struct TreasuryWithdrawalsActionPrototype {
630 pub policy_hash: Option<String>,
631 pub withdrawals: TreasuryWithdrawalsPrototype,
632}
633
634#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
635pub struct NoConfidenceActionPrototype {
636 pub gov_action_id: Option<GovernanceActionIdPrototype>,
637}
638
639#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
640pub struct CommitteeMemberPrototype {
641 pub stake_credential: CredTypePrototype,
642 pub term_limit: u32,
643}
644
645#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
646pub struct CommitteePrototype {
647 pub members: Vec<CommitteeMemberPrototype>,
648 pub quorum_threshold: UnitIntervalPrototype,
649}
650
651#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
652pub struct UpdateCommitteeActionPrototype {
653 pub committee: CommitteePrototype,
654 pub gov_action_id: Option<GovernanceActionIdPrototype>,
655 pub members_to_remove: Vec<CredTypePrototype>,
656}
657
658#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
659pub struct ConstitutionPrototype {
660 pub anchor: AnchorPrototype,
661 pub script_hash: Option<String>,
662}
663
664#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
665pub struct NewConstitutionActionPrototype {
666 pub constitution: ConstitutionPrototype,
667 pub gov_action_id: Option<GovernanceActionIdPrototype>,
668}
669
670pub type InfoActionPrototype = ();
671
672#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
673#[serde(tag = "type")]
674pub enum GovernanceActionPrototype {
675 #[serde(rename = "PARAMETER_CHANGE_ACTION")]
676 ParameterChangeAction {
677 value: ParameterChangeActionPrototype,
678 },
679 #[serde(rename = "HARD_FORK_INITIATION_ACTION")]
680 HardForkInitiationAction {
681 value: HardForkInitiationActionPrototype,
682 },
683 #[serde(rename = "TREASURY_WITHDRAWALS_ACTION")]
684 TreasuryWithdrawalsAction {
685 value: TreasuryWithdrawalsActionPrototype,
686 },
687 #[serde(rename = "NO_CONFIDENCE_ACTION")]
688 NoConfidenceAction { value: NoConfidenceActionPrototype },
689 #[serde(rename = "UPDATE_COMMITTEE_ACTION")]
690 UpdateCommitteeAction {
691 value: UpdateCommitteeActionPrototype,
692 },
693 #[serde(rename = "NEW_CONSTITUTION_ACTION")]
694 NewConstitutionAction {
695 value: NewConstitutionActionPrototype,
696 },
697 #[serde(rename = "INFO_ACTION")]
698 InfoAction,
699}
700
701#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
702pub struct VotingProposalPrototype {
703 pub anchor: AnchorPrototype,
704 pub deposit: String,
705 pub governance_action: GovernanceActionPrototype,
706 pub reward_account: String,
707}
708
709pub type VotingProposalsPrototype = Vec<VotingProposalPrototype>;
710
711pub type CostmdlsPrototype = HashMap<String, CostModelPrototype>;
716
717#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
718pub struct DRepVotingThresholdsPrototype {
719 pub committee_no_confidence: UnitIntervalPrototype,
720 pub committee_normal: UnitIntervalPrototype,
721 pub hard_fork_initiation: UnitIntervalPrototype,
722 pub motion_no_confidence: UnitIntervalPrototype,
723 pub pp_economic_group: UnitIntervalPrototype,
724 pub pp_governance_group: UnitIntervalPrototype,
725 pub pp_network_group: UnitIntervalPrototype,
726 pub pp_technical_group: UnitIntervalPrototype,
727 pub treasury_withdrawal: UnitIntervalPrototype,
728 pub update_constitution: UnitIntervalPrototype,
729}
730
731#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
732pub struct PoolVotingThresholdsPrototype {
733 pub committee_no_confidence: UnitIntervalPrototype,
734 pub committee_normal: UnitIntervalPrototype,
735 pub hard_fork_initiation: UnitIntervalPrototype,
736 pub motion_no_confidence: UnitIntervalPrototype,
737 pub security_relevant_threshold: UnitIntervalPrototype,
738}
739
740#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
741pub struct ExUnitPricesPrototype {
742 pub mem_price: UnitIntervalPrototype,
743 pub step_price: UnitIntervalPrototype,
744}
745
746#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
747pub struct NoncePrototype {
748 pub hash: Option<NonceHashPrototype>,
749}
750
751#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
752pub struct ExUnitsPrototype {
753 pub mem: String,
754 pub steps: String,
755}
756
757#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
758pub struct ProtocolParamUpdatePrototype {
759 pub ada_per_utxo_byte: Option<String>,
760 pub collateral_percentage: Option<u32>,
761 pub committee_term_limit: Option<u32>,
762 pub cost_models: Option<CostmdlsPrototype>,
763 pub d: Option<UnitIntervalPrototype>,
764 pub drep_deposit: Option<String>,
765 pub drep_inactivity_period: Option<u32>,
766 pub drep_voting_thresholds: Option<DRepVotingThresholdsPrototype>,
767 pub execution_costs: Option<ExUnitPricesPrototype>,
768 pub expansion_rate: Option<UnitIntervalPrototype>,
769 pub extra_entropy: Option<NoncePrototype>,
770 pub governance_action_deposit: Option<String>,
771 pub governance_action_validity_period: Option<u32>,
772 pub key_deposit: Option<String>,
773 pub max_block_body_size: Option<u32>,
774 pub max_block_ex_units: Option<ExUnitsPrototype>,
775 pub max_block_header_size: Option<u32>,
776 pub max_collateral_inputs: Option<u32>,
777 pub max_epoch: Option<u32>,
778 pub max_tx_ex_units: Option<ExUnitsPrototype>,
779 pub max_tx_size: Option<u32>,
780 pub max_value_size: Option<u32>,
781 pub min_committee_size: Option<u32>,
782 pub min_pool_cost: Option<String>,
783 pub minfee_a: Option<String>,
784 pub minfee_b: Option<String>,
785 pub n_opt: Option<u32>,
786 pub pool_deposit: Option<String>,
787 pub pool_pledge_influence: Option<UnitIntervalPrototype>,
788 pub pool_voting_thresholds: Option<PoolVotingThresholdsPrototype>,
789 pub protocol_version: Option<ProtocolVersionPrototype>,
790 pub ref_script_coins_per_byte: Option<UnitIntervalPrototype>,
791 pub treasury_growth_rate: Option<UnitIntervalPrototype>,
792}
793
794pub type ProposedProtocolParameterUpdatesPrototype = HashMap<String, ProtocolParamUpdatePrototype>;
795
796#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
801pub struct UpdatePrototype {
802 pub epoch: u32,
803 pub proposed_protocol_parameter_updates: ProposedProtocolParameterUpdatesPrototype,
804}
805
806#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
811#[serde(tag = "type")]
812pub enum RedeemerTagPrototype {
813 #[serde(rename = "SPEND")]
814 Spend,
815 #[serde(rename = "MINT")]
816 Mint,
817 #[serde(rename = "CERT")]
818 Cert,
819 #[serde(rename = "REWARD")]
820 Reward,
821 #[serde(rename = "VOTE")]
822 Vote,
823 #[serde(rename = "VOTING_PROPOSAL")]
824 VotingProposal,
825}
826
827#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
828pub struct RedeemerPrototype {
829 pub data: PlutusDataVariant,
830 pub ex_units: ExUnitsPrototype,
831 pub index: String,
832 pub tag: RedeemerTagPrototype,
833}
834
835pub type RedeemersPrototype = Vec<RedeemerPrototype>;
836
837#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
842#[serde(tag = "type")]
843pub enum LanguageKindPrototype {
844 #[serde(rename = "PLUTUS_V1")]
845 PlutusV1,
846 #[serde(rename = "PLUTUS_V2")]
847 PlutusV2,
848 #[serde(rename = "PLUTUS_V3")]
849 PlutusV3,
850}
851
852pub type LanguagePrototype = LanguageKindPrototype;
853pub type LanguagesPrototype = Vec<LanguagePrototype>;
854
855#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
860pub struct VkeywitnessPrototype {
861 pub signature: String,
862 pub vkey: VkeyPrototype,
863}
864
865pub type VkeywitnessesPrototype = Vec<VkeywitnessPrototype>;
866
867#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
868pub struct BootstrapWitnessPrototype {
869 pub attributes: Vec<u8>,
870 pub chain_code: Vec<u8>,
871 pub signature: String,
872 pub vkey: VkeyPrototype,
873}
874
875pub type BootstrapWitnessesPrototype = Vec<BootstrapWitnessPrototype>;
876
877#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
878pub struct PlutusListPrototype {
879 pub definite_encoding: Option<bool>,
880 pub elems: Vec<String>,
881}
882
883#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
884pub struct TransactionWitnessSetPrototype {
885 pub bootstraps: Option<Vec<BootstrapWitnessPrototype>>,
886 pub native_scripts: Option<Vec<NativeScriptPrototype>>,
887 pub plutus_data: Option<PlutusListPrototype>,
888 pub plutus_scripts: Option<Vec<String>>,
889 pub redeemers: Option<Vec<RedeemerPrototype>>,
890 pub vkeys: Option<Vec<VkeywitnessPrototype>>,
891}
892
893#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
898#[serde(tag = "type")]
899pub enum MetadatumPrototype {
900 #[serde(rename = "INT")]
901 Int { value: i128 },
902 #[serde(rename = "BYTES")]
903 Bytes { value: Vec<u8> },
904 #[serde(rename = "STRING")]
905 String { value: String },
906 #[serde(rename = "LIST")]
907 List { value: Vec<MetadatumPrototype> },
908 #[serde(rename = "MAP")]
909 Map {
910 value: Vec<(MetadatumPrototype, MetadatumPrototype)>,
911 },
912}
913
914pub type TxMetadataPrototype = HashMap<String, MetadatumPrototype>;
915
916#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
921pub struct AuxiliaryDataPrototype {
922 pub metadata: Option<TxMetadataPrototype>,
923 pub native_scripts: Option<Vec<NativeScriptPrototype>>,
924 pub plutus_scripts: Option<Vec<String>>,
925 pub prefer_alonzo_format: bool,
926}
927
928pub type AuxiliaryDataSetPrototype = HashMap<String, AuxiliaryDataPrototype>;
929
930#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
935pub struct TransactionBodyPrototype {
936 pub auxiliary_data_hash: Option<String>,
937 pub certs: Option<Vec<CertificatePrototype>>,
938 pub collateral: Option<Vec<TransactionInputPrototype>>,
939 pub collateral_return: Option<TransactionOutputPrototype>,
940 pub current_treasury_value: Option<String>,
941 pub donation: Option<String>,
942 pub fee: String,
943 pub inputs: Vec<TransactionInputPrototype>,
944 pub mint: Option<MintPrototype>,
945 pub network_id: Option<NetworkIdPrototype>,
946 pub outputs: TransactionOutputsPrototype,
947 pub reference_inputs: Option<Vec<TransactionInputPrototype>>,
948 pub required_signers: Option<Vec<String>>,
949 pub script_data_hash: Option<String>,
950 pub total_collateral: Option<String>,
951 pub ttl: Option<String>,
952 pub update: Option<UpdatePrototype>,
953 pub validity_start_interval: Option<String>,
954 pub voting_procedures: Option<Vec<VoterVotesPrototype>>,
955 pub voting_proposals: Option<Vec<VotingProposalPrototype>>,
956 pub withdrawals: Option<WithdrawalsPrototype>,
957}
958
959pub type TransactionBodiesPrototype = Vec<TransactionBodyPrototype>;
960
961#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
966pub struct TransactionPrototype {
967 pub auxiliary_data: Option<AuxiliaryDataPrototype>,
968 pub body: TransactionBodyPrototype,
969 pub is_valid: bool,
970 pub witness_set: TransactionWitnessSetPrototype,
971}
972
973impl TransactionPrototype {
978 pub fn from_json(json_str: &str) -> Result<Self, serde_json::Error> {
980 serde_json::from_str(json_str)
981 }
982
983 pub fn to_json(&self) -> Result<String, serde_json::Error> {
985 serde_json::to_string(self)
986 }
987
988 pub fn to_json_pretty(&self) -> Result<String, serde_json::Error> {
990 serde_json::to_string_pretty(self)
991 }
992}