coinbase_mesh/models/
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
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14/// Transaction : Transactions contain an array of Operations that are attributable to the same TransactionIdentifier. 
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct Transaction {
17    #[serde(rename = "transaction_identifier")]
18    pub transaction_identifier: Box<models::TransactionIdentifier>,
19    #[serde(rename = "operations")]
20    pub operations: Vec<models::Operation>,
21    #[serde(rename = "related_transactions", skip_serializing_if = "Option::is_none")]
22    pub related_transactions: Option<Vec<models::RelatedTransaction>>,
23    /// Transactions that are related to other transactions (like a cross-shard transaction) should include the tranaction_identifier of these transactions in the metadata. 
24    #[serde(rename = "metadata", skip_serializing_if = "Option::is_none")]
25    pub metadata: Option<serde_json::Value>,
26}
27
28impl Transaction {
29    /// Transactions contain an array of Operations that are attributable to the same TransactionIdentifier. 
30    pub fn new(transaction_identifier: models::TransactionIdentifier, operations: Vec<models::Operation>) -> Transaction {
31        Transaction {
32            transaction_identifier: Box::new(transaction_identifier),
33            operations,
34            related_transactions: None,
35            metadata: None,
36        }
37    }
38}
39