1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/*
 * Rosetta
 *
 * Build Once. Integrate Your Blockchain Everywhere.
 *
 * The version of the OpenAPI document: 1.4.13
 *
 * Generated by: https://openapi-generator.tech
 */

/// Transaction : Transactions contain an array of Operations that are attributable to the same TransactionIdentifier.

#[derive(Clone, Debug, PartialEq, Eq, Default, Serialize, Deserialize)]
pub struct Transaction {
    #[serde(rename = "transaction_identifier")]
    pub transaction_identifier: crate::TransactionIdentifier,
    #[serde(rename = "operations")]
    pub operations: Vec<crate::Operation>,
    #[serde(
        rename = "related_transactions",
        skip_serializing_if = "Option::is_none"
    )]
    pub related_transactions: Option<Vec<crate::RelatedTransaction>>,
    /// Transactions that are related to other transactions (like a cross-shard transaction) should include the tranaction_identifier of these transactions in the metadata.
    #[serde(rename = "metadata", skip_serializing_if = "Option::is_none")]
    pub metadata: Option<serde_json::Value>,
}

impl Transaction {
    /// Transactions contain an array of Operations that are attributable to the same TransactionIdentifier.
    pub fn new(
        transaction_identifier: crate::TransactionIdentifier,
        operations: Vec<crate::Operation>,
    ) -> Transaction {
        Transaction {
            transaction_identifier,
            operations,
            related_transactions: None,
            metadata: None,
        }
    }
}