rosetta_types/operation_identifier.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/// OperationIdentifier : The operation_identifier uniquely identifies an operation within a transaction.
12
13#[derive(Clone, Debug, PartialEq, Eq, Default, Serialize, Deserialize)]
14pub struct OperationIdentifier {
15 /// The operation index is used to ensure each operation has a unique identifier within a transaction. This index is only relative to the transaction and NOT GLOBAL. The operations in each transaction should start from index 0. To clarify, there may not be any notion of an operation index in the blockchain being described.
16 #[serde(rename = "index")]
17 pub index: i64,
18 /// Some blockchains specify an operation index that is essential for client use. For example, Bitcoin uses a network_index to identify which UTXO was used in a transaction. network_index should not be populated if there is no notion of an operation index in a blockchain (typically most account-based blockchains).
19 #[serde(rename = "network_index", skip_serializing_if = "Option::is_none")]
20 pub network_index: Option<i64>,
21}
22
23impl OperationIdentifier {
24 /// The operation_identifier uniquely identifies an operation within a transaction.
25 pub fn new(index: i64) -> OperationIdentifier {
26 OperationIdentifier {
27 index,
28 network_index: None,
29 }
30 }
31}