hypercall_types/
observability.rs1use serde::{Deserialize, Serialize};
2use std::collections::HashMap;
3
4#[derive(Debug, Clone, Copy)]
7pub enum AuthFailureReason {
8 SignatureRecovery,
9 PlaceOrderSignature,
10 CancelOrderSignature,
11 CancelOrderCloidSignature,
12 MarginModeSignature,
13 SettlementPayoutSeenSignature,
14}
15
16impl AuthFailureReason {
17 pub fn as_str(&self) -> &'static str {
18 match self {
19 Self::SignatureRecovery => "signature_recovery",
20 Self::PlaceOrderSignature => "place_order_signature",
21 Self::CancelOrderSignature => "cancel_order_signature",
22 Self::CancelOrderCloidSignature => "cancel_order_cloid_signature",
23 Self::MarginModeSignature => "margin_mode_signature",
24 Self::SettlementPayoutSeenSignature => "settlement_payout_seen_signature",
25 }
26 }
27}
28
29#[derive(Debug, Clone, Serialize, Deserialize, Default)]
33pub struct EngineStateDigest {
34 pub next_order_id: u64,
36 pub next_trade_id: u64,
38 pub l2_seq: i64,
40 pub symbols: HashMap<String, SymbolSummary>,
42}
43
44impl EngineStateDigest {
45 pub fn is_equal_to(&self, other: &EngineStateDigest) -> bool {
47 self.next_order_id == other.next_order_id
48 && self.next_trade_id == other.next_trade_id
49 && self.l2_seq == other.l2_seq
50 && self.symbols == other.symbols
51 }
52}
53
54#[derive(Debug, Clone, Serialize, Deserialize, Default, PartialEq, Eq)]
56pub struct SymbolSummary {
57 pub best_bid: Option<String>,
59 pub best_ask: Option<String>,
61 pub total_orders: usize,
63}