aptos_client_icp/models/block_metadata_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/// BlockMetadataTransaction : A block metadata transaction This signifies the beginning of a block, and contains information about the specific block
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct BlockMetadataTransaction {
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 #[serde(rename = "id")]
43 pub id: String,
44 /// 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.
45 #[serde(rename = "epoch")]
46 pub epoch: String,
47 /// 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.
48 #[serde(rename = "round")]
49 pub round: String,
50 /// The events emitted at the block creation
51 #[serde(rename = "events")]
52 pub events: Vec<models::Event>,
53 /// Previous block votes
54 #[serde(rename = "previous_block_votes_bitvec")]
55 pub previous_block_votes_bitvec: Vec<i32>,
56 /// 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.
57 #[serde(rename = "proposer")]
58 pub proposer: String,
59 /// The indices of the proposers who failed to propose
60 #[serde(rename = "failed_proposer_indices")]
61 pub failed_proposer_indices: Vec<i32>,
62 /// 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.
63 #[serde(rename = "timestamp")]
64 pub timestamp: String,
65 #[serde(rename = "block_metadata_extension", skip_serializing_if = "Option::is_none")]
66 pub block_metadata_extension: Option<Box<models::BlockMetadataTransactionBlockMetadataExtension>>,
67}
68
69impl BlockMetadataTransaction {
70 /// A block metadata transaction This signifies the beginning of a block, and contains information about the specific block
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>, id: String, epoch: String, round: String, events: Vec<models::Event>, previous_block_votes_bitvec: Vec<i32>, proposer: String, failed_proposer_indices: Vec<i32>, timestamp: String) -> BlockMetadataTransaction {
72 BlockMetadataTransaction {
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 id,
84 epoch,
85 round,
86 events,
87 previous_block_votes_bitvec,
88 proposer,
89 failed_proposer_indices,
90 timestamp,
91 block_metadata_extension: None,
92 }
93 }
94}
95