radix_transactions/model/v2/
non_root_subintents_v2.rs1use super::*;
2use crate::internal_prelude::*;
3
4#[derive(Debug, Clone, Eq, PartialEq, ManifestSbor, ScryptoDescribe)]
10#[sbor(transparent)]
11pub struct NonRootSubintentsV2(pub Vec<SubintentV2>);
12
13impl TransactionPartialPrepare for NonRootSubintentsV2 {
14 type Prepared = PreparedNonRootSubintentsV2;
15}
16
17#[derive(Debug, Clone, Eq, PartialEq)]
18pub struct PreparedNonRootSubintentsV2 {
19 pub subintents: Vec<PreparedSubintentV2>,
20 pub summary: Summary,
21}
22
23impl_has_summary!(PreparedNonRootSubintentsV2);
24
25impl HasNonRootSubintentHashes for PreparedNonRootSubintentsV2 {
26 fn non_root_subintent_hashes(&self) -> Vec<SubintentHash> {
27 self.subintents.iter().map(|s| s.subintent_hash()).collect()
30 }
31}
32
33impl TransactionPreparableFromValueBody for PreparedNonRootSubintentsV2 {
34 fn prepare_from_value_body(decoder: &mut TransactionDecoder) -> Result<Self, PrepareError> {
35 let max_subintents_per_transaction = decoder.settings().max_subintents_per_transaction;
36 let (subintents, summary) =
37 ConcatenatedDigest::prepare_from_sbor_array_value_body::<Vec<PreparedSubintentV2>>(
38 decoder,
39 ValueType::Subintent,
40 max_subintents_per_transaction,
41 )?;
42
43 Ok(Self {
44 subintents: subintents.into(),
45 summary,
46 })
47 }
48
49 fn value_kind() -> ManifestValueKind {
50 ManifestValueKind::Array
51 }
52}