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
34impl TransactionPartialPrepare for NonRootSubintentSignaturesV2 {
35 type Prepared = PreparedNonRootSubintentSignaturesV2;
36}
37
38#[derive(Debug, Clone, Eq, PartialEq)]
39pub struct PreparedNonRootSubintentSignaturesV2 {
40 pub by_subintent: Vec<PreparedIntentSignaturesV2>,
41 pub summary: Summary,
42}
43
44impl_has_summary!(PreparedNonRootSubintentSignaturesV2);
45
46impl TransactionPreparableFromValueBody for PreparedNonRootSubintentSignaturesV2 {
47 fn prepare_from_value_body(decoder: &mut TransactionDecoder) -> Result<Self, PrepareError> {
48 let max_subintents_per_transaction = decoder.settings().max_subintents_per_transaction;
49 let (by_subintent, summary) = ConcatenatedDigest::prepare_from_sbor_array_value_body::<
50 Vec<PreparedIntentSignaturesV2>,
51 >(
52 decoder,
53 ValueType::SubintentSignatureBatches,
54 max_subintents_per_transaction,
55 )?;
56
57 Ok(Self {
58 by_subintent,
59 summary,
60 })
61 }
62
63 fn value_kind() -> ManifestValueKind {
64 ManifestValueKind::Array
65 }
66}