aptos_client_icp/models/user_transaction.rs
1/*
2 * Aptos Node API
3 *
4 * The Aptos Node API is a RESTful API for client applications to interact with the Aptos blockchain.
5 *
6 * The version of the OpenAPI document: 1.2.0
7 *
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14/// UserTransaction : A transaction submitted by a user to change the state of the blockchain
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct UserTransaction {
17 /// A string containing a 64-bit unsigned integer. We represent u64 values as a string to ensure compatibility with languages such as JavaScript that do not parse u64s in JSON natively.
18 #[serde(rename = "version")]
19 pub version: String,
20 #[serde(rename = "hash")]
21 pub hash: String,
22 #[serde(rename = "state_change_hash")]
23 pub state_change_hash: String,
24 #[serde(rename = "event_root_hash")]
25 pub event_root_hash: String,
26 #[serde(rename = "state_checkpoint_hash", skip_serializing_if = "Option::is_none")]
27 pub state_checkpoint_hash: Option<String>,
28 /// A string containing a 64-bit unsigned integer. We represent u64 values as a string to ensure compatibility with languages such as JavaScript that do not parse u64s in JSON natively.
29 #[serde(rename = "gas_used")]
30 pub gas_used: String,
31 /// Whether the transaction was successful
32 #[serde(rename = "success")]
33 pub success: bool,
34 /// The VM status of the transaction, can tell useful information in a failure
35 #[serde(rename = "vm_status")]
36 pub vm_status: String,
37 #[serde(rename = "accumulator_root_hash")]
38 pub accumulator_root_hash: String,
39 /// Final state of resources changed by the transaction
40 #[serde(rename = "changes")]
41 pub changes: Vec<models::WriteSetChange>,
42 /// A hex encoded 32 byte Aptos account address. This is represented in a string as a 64 character hex string, sometimes shortened by stripping leading 0s, and adding a 0x. For example, address 0x0000000000000000000000000000000000000000000000000000000000000001 is represented as 0x1.
43 #[serde(rename = "sender")]
44 pub sender: String,
45 /// A string containing a 64-bit unsigned integer. We represent u64 values as a string to ensure compatibility with languages such as JavaScript that do not parse u64s in JSON natively.
46 #[serde(rename = "sequence_number")]
47 pub sequence_number: String,
48 /// A string containing a 64-bit unsigned integer. We represent u64 values as a string to ensure compatibility with languages such as JavaScript that do not parse u64s in JSON natively.
49 #[serde(rename = "max_gas_amount")]
50 pub max_gas_amount: String,
51 /// A string containing a 64-bit unsigned integer. We represent u64 values as a string to ensure compatibility with languages such as JavaScript that do not parse u64s in JSON natively.
52 #[serde(rename = "gas_unit_price")]
53 pub gas_unit_price: String,
54 /// A string containing a 64-bit unsigned integer. We represent u64 values as a string to ensure compatibility with languages such as JavaScript that do not parse u64s in JSON natively.
55 #[serde(rename = "expiration_timestamp_secs")]
56 pub expiration_timestamp_secs: String,
57 #[serde(rename = "payload")]
58 pub payload: Box<models::TransactionPayload>,
59 #[serde(rename = "signature", skip_serializing_if = "Option::is_none")]
60 pub signature: Option<Box<models::TransactionSignature>>,
61 /// Events generated by the transaction
62 #[serde(rename = "events")]
63 pub events: Vec<models::Event>,
64 /// A string containing a 64-bit unsigned integer. We represent u64 values as a string to ensure compatibility with languages such as JavaScript that do not parse u64s in JSON natively.
65 #[serde(rename = "timestamp")]
66 pub timestamp: String,
67}
68
69impl UserTransaction {
70 /// A transaction submitted by a user to change the state of the blockchain
71 pub fn new(version: String, hash: String, state_change_hash: String, event_root_hash: String, gas_used: String, success: bool, vm_status: String, accumulator_root_hash: String, changes: Vec<models::WriteSetChange>, sender: String, sequence_number: String, max_gas_amount: String, gas_unit_price: String, expiration_timestamp_secs: String, payload: models::TransactionPayload, events: Vec<models::Event>, timestamp: String) -> UserTransaction {
72 UserTransaction {
73 version,
74 hash,
75 state_change_hash,
76 event_root_hash,
77 state_checkpoint_hash: None,
78 gas_used,
79 success,
80 vm_status,
81 accumulator_root_hash,
82 changes,
83 sender,
84 sequence_number,
85 max_gas_amount,
86 gas_unit_price,
87 expiration_timestamp_secs,
88 payload: Box::new(payload),
89 signature: None,
90 events,
91 timestamp,
92 }
93 }
94}
95