neutron_sdk/bindings/marketmap/
query.rs

1use crate::bindings::marketmap::types::{Market, MarketMap, Params};
2use crate::bindings::oracle::types::CurrencyPair;
3use schemars::JsonSchema;
4use serde::{Deserialize, Serialize};
5
6#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
7#[serde(rename_all = "snake_case")]
8pub enum MarketMapQuery {
9    /// Parameters queries the parameters of the module.
10    Params {},
11    LastUpdated {},
12    MarketMap {},
13    Market {
14        currency_pair: CurrencyPair,
15    },
16}
17
18#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
19#[serde(rename_all = "snake_case")]
20pub struct ParamsResponse {
21    pub params: Params,
22}
23
24#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
25#[serde(rename_all = "snake_case")]
26pub struct LastUpdatedResponse {
27    pub last_updated: Option<u64>,
28}
29
30#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
31#[serde(rename_all = "snake_case")]
32pub struct MarketMapResponse {
33    /// **market_map** defines the global set of market configurations for all providers
34    /// and markets.
35    pub market_map: MarketMap,
36    /// **last_updated** is the last block height that the market map was updated.
37    /// This field can be used as an optimization for clients checking if there
38    /// is a new update to the map.
39    pub last_updated: Option<u64>,
40    /// **chain_id** is the chain identifier for the market map.
41    pub chain_id: String,
42}
43
44#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
45#[serde(rename_all = "snake_case")]
46pub struct MarketResponse {
47    pub market: Market,
48}