use super::*;
use crate::internal_prelude::*;
#[derive(Debug, Clone, Eq, PartialEq, ManifestSbor, ScryptoDescribe)]
pub struct SignedPartialTransactionV2 {
pub partial_transaction: PartialTransactionV2,
pub root_subintent_signatures: IntentSignaturesV2,
pub non_root_subintent_signatures: NonRootSubintentSignaturesV2,
}
impl SignedPartialTransactionV2 {
pub fn prepare_and_validate(
&self,
validator: &TransactionValidator,
) -> Result<ValidatedSignedPartialTransactionV2, TransactionValidationError> {
self.prepare(validator.preparation_settings())?
.validate(validator)
}
}
define_transaction_payload!(
SignedPartialTransactionV2,
RawSignedPartialTransaction,
PreparedSignedPartialTransactionV2 {
partial_transaction: PreparedPartialTransactionV2,
root_subintent_signatures: PreparedIntentSignaturesV2,
non_root_subintent_signatures: PreparedNonRootSubintentSignaturesV2,
},
TransactionDiscriminator::V2SignedPartialTransaction,
);
impl HasSubintentHash for PreparedSignedPartialTransactionV2 {
fn subintent_hash(&self) -> SubintentHash {
self.partial_transaction.subintent_hash()
}
}
impl PreparedSignedPartialTransactionV2 {
pub fn non_root_subintent_hashes(&self) -> impl Iterator<Item = SubintentHash> + '_ {
self.partial_transaction.non_root_subintent_hashes()
}
pub fn validate(
self,
validator: &TransactionValidator,
) -> Result<ValidatedSignedPartialTransactionV2, TransactionValidationError> {
validator.validate_signed_partial_transaction_v2(self)
}
}