radix_transactions/model/v2/
intent_signatures_v2.rs1use super::*;
2use crate::internal_prelude::*;
3
4#[derive(Debug, Clone, Eq, PartialEq, ManifestSbor, ScryptoDescribe)]
5#[sbor(transparent)]
6pub struct IntentSignaturesV2 {
7 pub signatures: Vec<IntentSignatureV1>,
8}
9
10impl IntentSignaturesV2 {
11 pub fn none() -> Self {
12 Self {
13 signatures: Vec::new(),
14 }
15 }
16
17 pub fn new(signatures: Vec<IntentSignatureV1>) -> Self {
18 Self { signatures }
19 }
20}
21
22impl TransactionPartialPrepare for IntentSignaturesV2 {
23 type Prepared = PreparedIntentSignaturesV2;
24}
25
26pub type PreparedIntentSignaturesV2 = SummarizedRawValueBody<IntentSignaturesV2>;
27
28#[derive(Debug, Clone, Eq, PartialEq, ManifestSbor, ScryptoDescribe)]
29#[sbor(transparent)]
30pub struct NonRootSubintentSignaturesV2 {
31 pub by_subintent: Vec<IntentSignaturesV2>,
32}
33
34#[derive(Debug, Clone, Eq, PartialEq)]
35pub struct PreparedNonRootSubintentSignaturesV2 {
36 pub by_subintent: Vec<PreparedIntentSignaturesV2>,
37 pub summary: Summary,
38}
39
40impl_has_summary!(PreparedNonRootSubintentSignaturesV2);
41
42impl TransactionPreparableFromValueBody for PreparedNonRootSubintentSignaturesV2 {
43 fn prepare_from_value_body(decoder: &mut TransactionDecoder) -> Result<Self, PrepareError> {
44 let max_subintents_per_transaction = decoder.settings().max_subintents_per_transaction;
45 let (by_subintent, summary) = ConcatenatedDigest::prepare_from_sbor_array_value_body::<
46 Vec<PreparedIntentSignaturesV2>,
47 >(
48 decoder,
49 ValueType::SubintentSignatureBatches,
50 max_subintents_per_transaction,
51 )?;
52
53 Ok(Self {
54 by_subintent,
55 summary,
56 })
57 }
58
59 fn value_kind() -> ManifestValueKind {
60 ManifestValueKind::Array
61 }
62}