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
22 changes: 11 additions & 11 deletions 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/js/examples/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ await client.subscribe({
type: "subscribe",
subscriptionId: 2,
priceFeedIds: [1, 2, 3, 4, 5],
properties: ["price", "exponent", "publisherCount"],
properties: ["price", "exponent", "publisherCount", "confidence"],
chains: ["evm"],
deliveryFormat: "json",
channel: "fixed_rate@200ms",
Expand Down
2 changes: 1 addition & 1 deletion lazer/sdk/js/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pythnetwork/pyth-lazer-sdk",
"version": "0.3.2",
"version": "0.3.3",
"description": "Pyth Lazer SDK",
"publishConfig": {
"access": "public"
Expand Down
4 changes: 3 additions & 1 deletion lazer/sdk/js/src/protocol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ export type PriceFeedProperty =
| "bestBidPrice"
| "bestAskPrice"
| "exponent"
| "publisherCount";
| "publisherCount"
| "confidence";
export type Channel = "real_time" | "fixed_rate@50ms" | "fixed_rate@200ms";

export type Request =
Expand All @@ -33,6 +34,7 @@ export type ParsedFeedPayload = {
bestAskPrice?: string | undefined;
publisherCount?: number | undefined;
exponent?: number | undefined;
confidence?: string | undefined;
};

export type ParsedPayload = {
Expand Down
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.5.0"
version = "0.5.1"
edition = "2021"
description = "Pyth Lazer SDK - protocol types."
license = "Apache-2.0"
Expand Down
10 changes: 10 additions & 0 deletions lazer/sdk/rust/protocol/src/payload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ pub enum PayloadPropertyValue {
BestAskPrice(Option<Price>),
PublisherCount(Option<u16>),
Exponent(i16),
Confidence(Option<Price>),
}

#[derive(Debug, Clone, Default, Serialize, Deserialize)]
Expand Down Expand Up @@ -78,6 +79,9 @@ impl PayloadData {
PriceFeedProperty::Exponent => {
PayloadPropertyValue::Exponent(*exponent)
}
PriceFeedProperty::Confidence => {
PayloadPropertyValue::Confidence(feed.confidence)
}
})
.collect(),
})
Expand Down Expand Up @@ -115,6 +119,10 @@ impl PayloadData {
writer.write_u8(PriceFeedProperty::Exponent as u8)?;
writer.write_i16::<BO>(*exponent)?;
}
PayloadPropertyValue::Confidence(confidence) => {
writer.write_u8(PriceFeedProperty::Confidence as u8)?;
write_option_price::<BO>(&mut writer, *confidence)?;
}
}
}
}
Expand Down Expand Up @@ -157,6 +165,8 @@ impl PayloadData {
PayloadPropertyValue::PublisherCount(read_option_u16::<BO>(&mut reader)?)
} else if property == PriceFeedProperty::Exponent as u8 {
PayloadPropertyValue::Exponent(reader.read_i16::<BO>()?)
} else if property == PriceFeedProperty::Confidence as u8 {
PayloadPropertyValue::Confidence(read_option_price::<BO>(&mut reader)?)
} else {
bail!("unknown property");
};
Expand Down
9 changes: 9 additions & 0 deletions lazer/sdk/rust/protocol/src/router.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ pub enum PriceFeedProperty {
BestAskPrice,
PublisherCount,
Exponent,
Confidence,
// More fields may be added later.
}

Expand Down Expand Up @@ -409,6 +410,9 @@ pub struct ParsedFeedPayload {
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub exponent: Option<i16>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub confidence: Option<Price>,
// More fields may be added later.
}

Expand All @@ -426,6 +430,7 @@ impl ParsedFeedPayload {
best_ask_price: None,
publisher_count: None,
exponent: None,
confidence: None,
};
for &property in properties {
match property {
Expand All @@ -444,6 +449,9 @@ impl ParsedFeedPayload {
PriceFeedProperty::Exponent => {
output.exponent = exponent;
}
PriceFeedProperty::Confidence => {
output.confidence = data.confidence;
}
}
}
output
Expand All @@ -461,6 +469,7 @@ impl ParsedFeedPayload {
best_ask_price: data.best_ask_price,
publisher_count: data.publisher_count,
exponent,
confidence: data.confidence,
}
}
}
Loading