Skip to main content

aptos_client_icp/models/
block.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/// Block : A Block with or without transactions  This contains the information about a transactions along with associated transactions if requested
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct Block {
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 = "block_height")]
19    pub block_height: String,
20    #[serde(rename = "block_hash")]
21    pub block_hash: String,
22    /// 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. 
23    #[serde(rename = "block_timestamp")]
24    pub block_timestamp: String,
25    /// 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. 
26    #[serde(rename = "first_version")]
27    pub first_version: 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 = "last_version")]
30    pub last_version: String,
31    /// The transactions in the block in sequential order
32    #[serde(rename = "transactions", skip_serializing_if = "Option::is_none")]
33    pub transactions: Option<Vec<models::Transaction>>,
34}
35
36impl Block {
37    /// A Block with or without transactions  This contains the information about a transactions along with associated transactions if requested
38    pub fn new(block_height: String, block_hash: String, block_timestamp: String, first_version: String, last_version: String) -> Block {
39        Block {
40            block_height,
41            block_hash,
42            block_timestamp,
43            first_version,
44            last_version,
45            transactions: None,
46        }
47    }
48}
49