Skip to content

Commit 04aac57

Browse files
feat(lazer-protocol): refactor + add reduce price request (#2232)
1 parent 89f424d commit 04aac57

File tree

1 file changed

+14
-6
lines changed
  • lazer/sdk/rust/protocol/src

1 file changed

+14
-6
lines changed

lazer/sdk/rust/protocol/src/api.rs

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
11
use serde::{Deserialize, Serialize};
22

3-
use crate::{payload::AggregatedPriceFeedData, router::PriceFeedId};
3+
use crate::{
4+
payload::AggregatedPriceFeedData,
5+
router::{JsonUpdate, PriceFeedId},
6+
};
47

5-
/// A request sent from the client to the server.
68
#[derive(Debug, Clone, Serialize, Deserialize)]
7-
#[serde(tag = "type")]
89
#[serde(rename_all = "camelCase")]
9-
pub enum ApiRequest {
10-
LatestPrice(LatestPriceRequest),
10+
pub struct LatestPriceRequest {
11+
pub price_feed_ids: Vec<PriceFeedId>,
1112
}
1213

1314
#[derive(Debug, Clone, Serialize, Deserialize)]
1415
#[serde(rename_all = "camelCase")]
15-
pub struct LatestPriceRequest {
16+
pub struct ReducePriceRequest {
17+
pub payload: JsonUpdate,
1618
pub price_feed_ids: Vec<PriceFeedId>,
1719
}
1820

@@ -22,6 +24,12 @@ pub struct LatestPriceResponse {
2224
pub latest_prices: Vec<LatestPrice>,
2325
}
2426

27+
#[derive(Debug, Clone, Serialize, Deserialize)]
28+
#[serde(rename_all = "camelCase")]
29+
pub struct ReducePriceResponse {
30+
pub payload: JsonUpdate,
31+
}
32+
2533
#[derive(Debug, Clone, Serialize, Deserialize)]
2634
#[serde(rename_all = "camelCase")]
2735
pub struct LatestPrice {

0 commit comments

Comments
 (0)