1use serde::Deserialize;
2use std::collections::HashMap;
3
4#[derive(Debug, Deserialize)]
5pub struct RpcPriceFeed {
6 pub id: String,
7 pub price: RpcPrice,
8 pub ema_price: RpcPrice,
9 pub metadata: Option<RpcPriceFeedMetadata>,
10 pub vaa: Option<String>,
11}
12
13#[derive(Debug, Deserialize, Clone)]
14pub struct RpcPrice {
15 pub price: String,
16 pub conf: String,
17 pub expo: i32,
18 pub publish_time: i64,
19}
20
21#[derive(Debug, Deserialize, Clone)]
22pub struct RpcPriceFeedMetadata {
23 pub emitter_chain: Option<i32>,
24 pub prev_publish_time: Option<i64>,
25 pub price_service_receive_time: Option<i64>,
26 pub slot: Option<i64>,
27}
28
29#[derive(Debug, Deserialize)]
30pub struct PriceFeedMetadata {
31 pub id: String,
32 pub attributes: HashMap<String, String>,
33}
34
35#[derive(Debug, Deserialize)]
36pub struct PriceUpdate {
37 pub binary: BinaryUpdate,
38 pub parsed: Option<Vec<RpcPriceFeed>>,
39}
40
41#[derive(Debug, Deserialize)]
42pub struct BinaryUpdate {
43 pub encoding: String,
44 pub data: Vec<String>,
45}
46
47#[derive(Debug, Deserialize)]
48pub struct TwapsResponse {
49 pub binary: BinaryUpdate,
50 pub parsed: Option<Vec<ParsedPriceFeedTwap>>,
51}
52
53#[derive(Debug, Deserialize)]
54pub struct ParsedPriceFeedTwap {
55 pub id: String,
56 pub start_timestamp: i64,
57 pub end_timestamp: i64,
58 pub twap: RpcPrice,
59 pub down_slots_ratio: String,
60}
61
62#[derive(Debug, Deserialize)]
63pub struct LatestPublisherStakeCapsUpdateDataResponse {
64 pub binary: BinaryUpdate,
65 pub parsed: Option<Vec<ParsedPublisherStakeCapsUpdate>>,
66}
67
68#[derive(Debug, Deserialize)]
69pub struct ParsedPublisherStakeCapsUpdate {
70 pub publisher_stake_caps: Vec<ParsedPublisherStakeCap>,
71}
72
73#[derive(Debug, Deserialize)]
74pub struct ParsedPublisherStakeCap {
75 pub publisher: String,
76 pub cap: i64,
77}
78
79#[derive(Debug, Deserialize, Clone)]
80pub struct ParsedPriceUpdate {
81 pub id: String,
82 pub price: RpcPrice,
83 pub ema_price: RpcPrice,
84 pub metadata: RpcPriceFeedMetadata,
85}