Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions lazer/sdk/rust/protocol/src/api.rs
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
use serde::{Deserialize, Serialize};

use crate::{payload::AggregatedPriceFeedData, router::PriceFeedId};
use crate::{
payload::AggregatedPriceFeedData,
router::{JsonUpdate, PriceFeedId},
};

/// A request sent from the client to the server.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(tag = "type")]
#[serde(rename_all = "camelCase")]
pub enum ApiRequest {
LatestPrice(LatestPriceRequest),
pub struct LatestPriceRequest {
pub price_feed_ids: Vec<PriceFeedId>,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct LatestPriceRequest {
pub struct ReducePriceRequest {
pub payload: JsonUpdate,
pub price_feed_ids: Vec<PriceFeedId>,
}

Expand All @@ -22,6 +24,12 @@ pub struct LatestPriceResponse {
pub latest_prices: Vec<LatestPrice>,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ReducePriceResponse {
pub payload: JsonUpdate,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct LatestPrice {
Expand Down
Loading