canton_api_client/models/js_transaction.rs
1/*
2 * JSON Ledger API HTTP endpoints
3 *
4 * This specification version fixes the API inconsistencies where certain fields marked as required in the spec are in fact optional. If you use code generation tool based on this file, you might need to adjust the existing application code to handle those fields as optional. If you do not want to change your client code, continue using the OpenAPI specification from the previous Canton 3.4 patch release. MINIMUM_CANTON_VERSION=3.4.12
5 *
6 * The version of the OpenAPI document: 3.4.12-SNAPSHOT
7 *
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14/// JsTransaction : Filtered view of an on-ledger transaction's create and archive events.
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct JsTransaction {
17 /// Assigned by the server. Useful for correlating logs. Must be a valid LedgerString (as described in ``value.proto``). Required
18 #[serde(rename = "updateId")]
19 pub update_id: String,
20 /// The ID of the command which resulted in this transaction. Missing for everyone except the submitting party. Must be a valid LedgerString (as described in ``value.proto``). Optional
21 #[serde(rename = "commandId", skip_serializing_if = "Option::is_none")]
22 pub command_id: Option<String>,
23 /// The workflow ID used in command submission. Must be a valid LedgerString (as described in ``value.proto``). Optional
24 #[serde(rename = "workflowId", skip_serializing_if = "Option::is_none")]
25 pub workflow_id: Option<String>,
26 /// Ledger effective time. Required
27 #[serde(rename = "effectiveAt")]
28 pub effective_at: String,
29 /// The collection of events. Contains: - ``CreatedEvent`` or ``ArchivedEvent`` in case of ACS_DELTA transaction shape - ``CreatedEvent`` or ``ExercisedEvent`` in case of LEDGER_EFFECTS transaction shape Required: must be non-empty
30 #[serde(rename = "events")]
31 pub events: Vec<models::Event>,
32 /// The absolute offset. The details of this field are described in ``community/ledger-api/README.md``. It is a valid absolute offset (positive integer). Required
33 #[serde(rename = "offset")]
34 pub offset: i64,
35 /// A valid synchronizer id. Identifies the synchronizer that synchronized the transaction. Required
36 #[serde(rename = "synchronizerId")]
37 pub synchronizer_id: String,
38 #[serde(rename = "traceContext", skip_serializing_if = "Option::is_none")]
39 pub trace_context: Option<Box<models::TraceContext>>,
40 /// The time at which the transaction was recorded. The record time refers to the synchronizer which synchronized the transaction. Required
41 #[serde(rename = "recordTime")]
42 pub record_time: String,
43 /// For transaction externally signed, contains the external transaction hash signed by the external party. Can be used to correlate an external submission with a committed transaction. Optional: can be empty
44 #[serde(rename = "externalTransactionHash", skip_serializing_if = "Option::is_none")]
45 pub external_transaction_hash: Option<String>,
46 /// The traffic cost that this participant node paid for the confirmation request for this transaction. Not set for transactions that were - initiated by another participant - initiated offline via the repair service - processed before the participant started serving traffic cost on the Ledger API - returned as part of a query filtering for a non submitting party Optional: can be empty
47 #[serde(rename = "paidTrafficCost", skip_serializing_if = "Option::is_none")]
48 pub paid_traffic_cost: Option<i64>,
49}
50
51impl JsTransaction {
52 /// Filtered view of an on-ledger transaction's create and archive events.
53 pub fn new(update_id: String, effective_at: String, events: Vec<models::Event>, offset: i64, synchronizer_id: String, record_time: String) -> JsTransaction {
54 JsTransaction {
55 update_id,
56 command_id: None,
57 workflow_id: None,
58 effective_at,
59 events,
60 offset,
61 synchronizer_id,
62 trace_context: None,
63 record_time,
64 external_transaction_hash: None,
65 paid_traffic_cost: None,
66 }
67 }
68}
69