coinbase_mesh/models/block_event.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
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14/// BlockEvent : BlockEvent represents the addition or removal of a BlockIdentifier from storage. Streaming BlockEvents allows lightweight clients to update their own state without needing to implement their own syncing logic.
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct BlockEvent {
17 /// sequence is the unique identifier of a BlockEvent within the context of a NetworkIdentifier.
18 #[serde(rename = "sequence")]
19 pub sequence: i64,
20 #[serde(rename = "block_identifier")]
21 pub block_identifier: Box<models::BlockIdentifier>,
22 #[serde(rename = "type")]
23 pub r#type: models::BlockEventType,
24}
25
26impl BlockEvent {
27 /// BlockEvent represents the addition or removal of a BlockIdentifier from storage. Streaming BlockEvents allows lightweight clients to update their own state without needing to implement their own syncing logic.
28 pub fn new(sequence: i64, block_identifier: models::BlockIdentifier, r#type: models::BlockEventType) -> BlockEvent {
29 BlockEvent {
30 sequence,
31 block_identifier: Box::new(block_identifier),
32 r#type,
33 }
34 }
35}
36