Skip to main content

cinder/tui/state/
updates.rs

1//! Channel message types for async balance / market-list / market-stat updates.
2
3use std::collections::HashMap;
4
5use phoenix_rise::MarketStatsUpdate;
6
7use super::super::config::SplineConfig;
8use super::super::trading::{FullPositionInfo, PositionInfo};
9use super::market::MarketInfo;
10
11pub struct BalanceUpdate {
12    pub phoenix_collateral: f64,
13    pub position: Option<PositionInfo>,
14    pub all_positions: Vec<FullPositionInfo>,
15}
16
17pub struct MarketListUpdate {
18    pub markets: Vec<MarketInfo>,
19    pub configs: HashMap<String, SplineConfig>,
20}
21
22pub type MarketStatUpdate = MarketStatsUpdate;
23
24/// Snapshot of a spline collection account fetched once at market-switch time.
25///
26/// Solana's `accountSubscribe` only pushes when the account changes, so an
27/// idle market would leave the "Switching to … market…" modal stuck until
28/// the next on-chain spline write. This message carries the current account
29/// state (HTTP `getAccountInfo`) into the same handler the WSS path uses.
30pub struct SplineBootstrapMsg {
31    pub symbol: String,
32    pub slot: u64,
33    pub data: Vec<u8>,
34}