Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion lazer/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lazer/sdk/rust/protocol/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "pyth-lazer-protocol"
version = "0.2.6"
version = "0.3.0"
edition = "2021"
description = "Pyth Lazer SDK - protocol types."
license = "Apache-2.0"
Expand Down
35 changes: 15 additions & 20 deletions lazer/sdk/rust/protocol/src/api.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
use serde::{Deserialize, Serialize};

use crate::{
payload::AggregatedPriceFeedData,
router::{JsonUpdate, PriceFeedId},
use crate::router::{
Chain, Channel, JsonBinaryEncoding, JsonUpdate, PriceFeedId, PriceFeedProperty,
};

#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct LatestPriceRequest {
pub price_feed_ids: Vec<PriceFeedId>,
pub properties: Vec<PriceFeedProperty>,
pub chains: Vec<Chain>,
#[serde(default)]
pub json_binary_encoding: JsonBinaryEncoding,
/// If `true`, the stream update will contain a JSON object containing
/// all data of the update.
#[serde(default = "default_parsed")]
pub parsed: bool,
pub channel: Channel,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
Expand All @@ -18,22 +26,9 @@ pub struct ReducePriceRequest {
pub price_feed_ids: Vec<PriceFeedId>,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct LatestPriceResponse {
pub latest_prices: Vec<LatestPrice>,
}

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

#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct LatestPrice {
pub id: PriceFeedId,
pub exponent: i16,
pub prices: AggregatedPriceFeedData,
pub fn default_parsed() -> bool {
true
}
Loading