Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
c194872
feat(lazer): add ignoreInvalidFeeds flag to SDK
devin-ai-integration[bot] Mar 27, 2025
7d7078f
feat(lazer): update protocol types for ignore_invalid_feeds
devin-ai-integration[bot] Mar 27, 2025
a8e1e90
fix: update example to include ignore_invalid_feeds field
devin-ai-integration[bot] Mar 27, 2025
2d4f5b7
refactor: rename ignore_invalid_feeds to ignore_invalid_feed_ids
devin-ai-integration[bot] Mar 27, 2025
6b736af
refactor: rename FailedFeedsDetails to InvalidFeedSubscriptionDetails
devin-ai-integration[bot] Mar 27, 2025
c436bff
refactor: rename comingSoon to unstable in InvalidFeedSubscriptionDet…
devin-ai-integration[bot] Mar 28, 2025
23b6f5d
refactor: change successful_feeds type from Vec<u64> to Vec<u32>
devin-ai-integration[bot] Mar 28, 2025
be328ab
refactor: add subscribedWithIgnoredFailures response type
devin-ai-integration[bot] Mar 28, 2025
545cfbb
refactor: rename subscribedWithIgnoredFailures to subscribedWithInval…
devin-ai-integration[bot] Mar 28, 2025
9b1d540
refactor: rename subscribedWithInvalidFeeds to subscribedWithIgnoredI…
devin-ai-integration[bot] Mar 28, 2025
ba506a5
refactor: rename response types to subscribedWithInvalidFeedIdsIgnored
devin-ai-integration[bot] Mar 28, 2025
8d96275
refactor: rename fields to subscribedFeedIds and ignoredInvalidFeedIds
devin-ai-integration[bot] Mar 28, 2025
2d89de1
refactor: rename enum variant to SubscribedWithInvalidFeedIdsIgnored
devin-ai-integration[bot] Mar 28, 2025
99b6bd1
refactor: move ignore_invalid_feed_ids to SubscriptionParamsRepr
devin-ai-integration[bot] Mar 28, 2025
ebd4a93
refactor: change ignore_invalid_feed_ids from Option<bool> to bool
devin-ai-integration[bot] Mar 28, 2025
62eeb1c
refactor: update InvalidFeedSubscriptionDetails to use proper types
devin-ai-integration[bot] Mar 31, 2025
82728e3
refactor: use local SymbolState instead of external dependency
devin-ai-integration[bot] Mar 31, 2025
e7e626e
fix: update protocol.ts formatting to fix CI
devin-ai-integration[bot] Mar 31, 2025
3f30ea2
Undo change ot returned ignored ids
darunrs Mar 31, 2025
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.

Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ no-log-ix-name = []
idl-build = ["anchor-lang/idl-build"]

[dependencies]
pyth-lazer-protocol = { path = "../../../../sdk/rust/protocol", version = "0.6.0" }
pyth-lazer-protocol = { path = "../../../../sdk/rust/protocol", version = "0.7.0" }

anchor-lang = "0.30.1"
bytemuck = "1.20.0"
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.4.0",
"version": "0.5.0",
"description": "Pyth Lazer SDK",
"publishConfig": {
"access": "public"
Expand Down
13 changes: 13 additions & 0 deletions lazer/sdk/js/src/protocol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export type Request =
deliveryFormat?: DeliveryFormat;
jsonBinaryEncoding?: JsonBinaryEncoding;
parsed?: boolean;
ignoreInvalidFeedIds?: boolean;
channel: Channel;
}
| {
Expand Down Expand Up @@ -47,6 +48,12 @@ export type JsonBinaryData = {
data: string;
};

export type InvalidFeedSubscriptionDetails = {
unknownIds: number[];
unsupportedChannels: number[];
unstable: number[];
};

export type Response =
| {
type: "error";
Expand All @@ -56,6 +63,12 @@ export type Response =
type: "subscribed";
subscriptionId: number;
}
| {
type: "subscribedWithInvalidFeedIdsIgnored";
subscriptionId: number;
subscribedFeedIds: number[];
ignoredInvalidFeedIds: InvalidFeedSubscriptionDetails;
}
| {
type: "unsubscribed";
subscriptionId: number;
Expand Down
2 changes: 1 addition & 1 deletion lazer/sdk/rust/client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ description = "A Rust client for Pyth Lazer"
license = "Apache-2.0"

[dependencies]
pyth-lazer-protocol = { path = "../protocol", version = "0.6.0" }
pyth-lazer-protocol = { path = "../protocol", version = "0.7.0" }
tokio = { version = "1", features = ["full"] }
tokio-tungstenite = { version = "0.20", features = ["native-tls"] }
futures-util = "0.3"
Expand Down
2 changes: 2 additions & 0 deletions lazer/sdk/rust/client/examples/subscribe_price_feeds.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ async fn main() -> anyhow::Result<()> {
channel: Channel::FixedRate(
FixedRate::from_ms(200).expect("unsupported update rate"),
),
ignore_invalid_feed_ids: false,
})
.expect("invalid subscription params"),
},
Expand All @@ -68,6 +69,7 @@ async fn main() -> anyhow::Result<()> {
channel: Channel::FixedRate(
FixedRate::from_ms(50).expect("unsupported update rate"),
),
ignore_invalid_feed_ids: false,
})
.expect("invalid subscription params"),
},
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.6.2"
version = "0.7.0"
edition = "2021"
description = "Pyth Lazer SDK - protocol types."
license = "Apache-2.0"
Expand Down
1 change: 1 addition & 0 deletions lazer/sdk/rust/protocol/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ pub mod router;
mod serde_price_as_i64;
mod serde_str;
pub mod subscription;
pub mod symbol_state;

#[test]
fn magics_in_big_endian() {
Expand Down
2 changes: 2 additions & 0 deletions lazer/sdk/rust/protocol/src/router.rs
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,8 @@ pub struct SubscriptionParamsRepr {
#[serde(default = "default_parsed")]
pub parsed: bool,
pub channel: Channel,
#[serde(default)]
pub ignore_invalid_feed_ids: bool,
}

#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize)]
Expand Down
19 changes: 18 additions & 1 deletion lazer/sdk/rust/protocol/src/subscription.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//! used across publishers, agents and routers.

use {
crate::router::{JsonUpdate, SubscriptionParams},
crate::router::{JsonUpdate, PriceFeedId, SubscriptionParams},
derive_more::From,
serde::{Deserialize, Serialize},
};
Expand Down Expand Up @@ -40,6 +40,7 @@ pub struct UnsubscribeRequest {
pub enum Response {
Error(ErrorResponse),
Subscribed(SubscribedResponse),
SubscribedWithInvalidFeedIdsIgnored(SubscribedWithInvalidFeedIdsIgnoredResponse),
Unsubscribed(UnsubscribedResponse),
SubscriptionError(SubscriptionErrorResponse),
StreamUpdated(StreamUpdatedResponse),
Expand All @@ -52,6 +53,22 @@ pub struct SubscribedResponse {
pub subscription_id: SubscriptionId,
}

#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct InvalidFeedSubscriptionDetails {
pub unknown_ids: Vec<PriceFeedId>,
pub unsupported_channels: Vec<PriceFeedId>,
pub unstable: Vec<PriceFeedId>,
}

#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct SubscribedWithInvalidFeedIdsIgnoredResponse {
pub subscription_id: SubscriptionId,
pub subscribed_feed_ids: Vec<PriceFeedId>,
pub ignored_invalid_feed_ids: InvalidFeedSubscriptionDetails,
}

#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct UnsubscribedResponse {
Expand Down
20 changes: 20 additions & 0 deletions lazer/sdk/rust/protocol/src/symbol_state.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
use {
serde::{Deserialize, Serialize},
std::fmt::Display,
};

#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum SymbolState {
Stable,
ComingSoon,
}

impl Display for SymbolState {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
SymbolState::Stable => write!(f, "stable"),
SymbolState::ComingSoon => write!(f, "coming_soon"),
}
}
}
Loading