From b0e0e3b1095b6badf1b89f3e6f5cbee9c02e5c0c Mon Sep 17 00:00:00 2001 From: keyvan Date: Wed, 8 Jan 2025 19:01:51 -0800 Subject: [PATCH] feat(lazer-protocol): refactor + add reduce price request --- lazer/sdk/rust/protocol/src/api.rs | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/lazer/sdk/rust/protocol/src/api.rs b/lazer/sdk/rust/protocol/src/api.rs index c1488b3877..082a02391f 100644 --- a/lazer/sdk/rust/protocol/src/api.rs +++ b/lazer/sdk/rust/protocol/src/api.rs @@ -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, } #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct LatestPriceRequest { +pub struct ReducePriceRequest { + pub payload: JsonUpdate, pub price_feed_ids: Vec, } @@ -22,6 +24,12 @@ pub struct LatestPriceResponse { pub latest_prices: Vec, } +#[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 {