rosetta_types/
transaction.rs

1/*
2 * Rosetta
3 *
4 * Build Once. Integrate Your Blockchain Everywhere.
5 *
6 * The version of the OpenAPI document: 1.4.13
7 *
8 * Generated by: https://openapi-generator.tech
9 */
10
11/// Transaction : Transactions contain an array of Operations that are attributable to the same TransactionIdentifier.
12
13#[derive(Clone, Debug, PartialEq, Eq, Default, Serialize, Deserialize)]
14pub struct Transaction {
15    #[serde(rename = "transaction_identifier")]
16    pub transaction_identifier: crate::TransactionIdentifier,
17    #[serde(rename = "operations")]
18    pub operations: Vec<crate::Operation>,
19    #[serde(
20        rename = "related_transactions",
21        skip_serializing_if = "Option::is_none"
22    )]
23    pub related_transactions: Option<Vec<crate::RelatedTransaction>>,
24    /// Transactions that are related to other transactions (like a cross-shard transaction) should include the tranaction_identifier of these transactions in the metadata.
25    #[serde(rename = "metadata", skip_serializing_if = "Option::is_none")]
26    pub metadata: Option<serde_json::Value>,
27}
28
29impl Transaction {
30    /// Transactions contain an array of Operations that are attributable to the same TransactionIdentifier.
31    pub fn new(
32        transaction_identifier: crate::TransactionIdentifier,
33        operations: Vec<crate::Operation>,
34    ) -> Transaction {
35        Transaction {
36            transaction_identifier,
37            operations,
38            related_transactions: None,
39            metadata: None,
40        }
41    }
42}