Skip to main content

df_hyperliquid_core/live/frame/
reply.rs

1//! A post's answer, by the id it was sent with: what `/info` or `/exchange` would have answered,
2//! or what HTTP would have said when the post was not taken.
3
4use crate::client::ExchangeResponse;
5
6/// The answer to a post, by the id it was sent with.
7#[derive(Debug, Clone, PartialEq, Eq)]
8pub struct Reply {
9    pub id: u64,
10    pub answer: Answer,
11}
12
13#[derive(Debug, Clone, PartialEq, Eq)]
14pub enum Answer {
15    /// What `/info` would have answered, as written (`null` for an unknown coin's book), for a
16    /// read's own type to deserialize.
17    Info { kind: String, data: String },
18    /// What `/exchange` would have answered.
19    Action(ExchangeResponse),
20    /// The post was not taken: what HTTP would have said.
21    Error(String),
22}
23
24#[cfg(test)]
25#[path = "tests/reply.rs"]
26mod tests;