Explorar o código

feat(lazer) Make price optional in jrpc update message (#3161)

Mike Rolish hai 3 semanas
pai
achega
f2d74362af

+ 16 - 16
Cargo.lock

@@ -5674,7 +5674,7 @@ dependencies = [
  "hyper 1.6.0",
  "hyper-util",
  "protobuf",
- "pyth-lazer-protocol 0.19.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "pyth-lazer-protocol 0.19.0",
  "pyth-lazer-publisher-sdk 0.18.0",
  "reqwest 0.12.23",
  "serde",
@@ -5694,7 +5694,7 @@ dependencies = [
 
 [[package]]
 name = "pyth-lazer-client"
-version = "8.5.0"
+version = "8.6.0"
 dependencies = [
  "alloy-primitives 0.8.25",
  "anyhow",
@@ -5712,7 +5712,7 @@ dependencies = [
  "hex",
  "humantime-serde",
  "libsecp256k1 0.7.2",
- "pyth-lazer-protocol 0.19.0",
+ "pyth-lazer-protocol 0.20.0",
  "reqwest 0.12.23",
  "serde",
  "serde_json",
@@ -5727,22 +5727,17 @@ dependencies = [
 [[package]]
 name = "pyth-lazer-protocol"
 version = "0.19.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5b7d19a91e0d63e5003a409d51346abb4941bf55a3a9d52f65453c65057f0482"
 dependencies = [
- "alloy-primitives 0.8.25",
  "anyhow",
- "assert_float_eq",
- "bincode 1.3.3",
- "bs58",
  "byteorder",
  "chrono",
  "derive_more 1.0.0",
- "ed25519-dalek 2.1.1",
  "hex",
  "humantime",
  "humantime-serde",
  "itertools 0.13.0",
- "libsecp256k1 0.7.2",
- "mry",
  "protobuf",
  "rust_decimal",
  "serde",
@@ -5752,18 +5747,23 @@ dependencies = [
 
 [[package]]
 name = "pyth-lazer-protocol"
-version = "0.19.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5b7d19a91e0d63e5003a409d51346abb4941bf55a3a9d52f65453c65057f0482"
+version = "0.20.0"
 dependencies = [
+ "alloy-primitives 0.8.25",
  "anyhow",
+ "assert_float_eq",
+ "bincode 1.3.3",
+ "bs58",
  "byteorder",
  "chrono",
  "derive_more 1.0.0",
+ "ed25519-dalek 2.1.1",
  "hex",
  "humantime",
  "humantime-serde",
  "itertools 0.13.0",
+ "libsecp256k1 0.7.2",
+ "mry",
  "protobuf",
  "rust_decimal",
  "serde",
@@ -5781,19 +5781,19 @@ dependencies = [
  "fs-err",
  "protobuf",
  "protobuf-codegen",
- "pyth-lazer-protocol 0.19.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "pyth-lazer-protocol 0.19.0",
  "serde_json",
 ]
 
 [[package]]
 name = "pyth-lazer-publisher-sdk"
-version = "0.19.0"
+version = "0.20.0"
 dependencies = [
  "anyhow",
  "fs-err",
  "protobuf",
  "protobuf-codegen",
- "pyth-lazer-protocol 0.19.0",
+ "pyth-lazer-protocol 0.20.0",
  "serde_json",
 ]
 

+ 1 - 1
lazer/contracts/solana/programs/pyth-lazer-solana-contract/Cargo.toml

@@ -19,7 +19,7 @@ no-log-ix-name = []
 idl-build = ["anchor-lang/idl-build"]
 
 [dependencies]
-pyth-lazer-protocol = { path = "../../../../sdk/rust/protocol", version = "0.19.0" }
+pyth-lazer-protocol = { path = "../../../../sdk/rust/protocol", version = "0.20.0" }
 
 anchor-lang = "0.31.1"
 bytemuck = { version = "1.20.0", features = ["derive"] }

+ 2 - 2
lazer/publisher_sdk/rust/Cargo.toml

@@ -1,13 +1,13 @@
 [package]
 name = "pyth-lazer-publisher-sdk"
-version = "0.19.0"
+version = "0.20.0"
 edition = "2021"
 description = "Pyth Lazer Publisher SDK types."
 license = "Apache-2.0"
 repository = "https://github.com/pyth-network/pyth-crosschain"
 
 [dependencies]
-pyth-lazer-protocol = { version = "0.19.0", path = "../../sdk/rust/protocol" }
+pyth-lazer-protocol = { version = "0.20.0", path = "../../sdk/rust/protocol" }
 anyhow = "1.0.98"
 protobuf = "3.7.2"
 serde_json = "1.0.140"

+ 1 - 1
lazer/publisher_sdk/rust/src/lib.rs

@@ -56,7 +56,7 @@ impl From<UpdateParams> for Update {
                 best_bid_price,
                 best_ask_price,
             } => Update::PriceUpdate(PriceUpdate {
-                price: Some(price.mantissa_i64()),
+                price: price.map(|p| p.mantissa_i64()),
                 best_bid_price: best_bid_price.map(|p| p.mantissa_i64()),
                 best_ask_price: best_ask_price.map(|p| p.mantissa_i64()),
                 special_fields: Default::default(),

+ 2 - 2
lazer/sdk/rust/client/Cargo.toml

@@ -1,12 +1,12 @@
 [package]
 name = "pyth-lazer-client"
-version = "8.5.0"
+version = "8.6.0"
 edition = "2021"
 description = "A Rust client for Pyth Lazer"
 license = "Apache-2.0"
 
 [dependencies]
-pyth-lazer-protocol = { path = "../protocol", version = "0.19.0" }
+pyth-lazer-protocol = { path = "../protocol", version = "0.20.0" }
 tokio = { version = "1", features = ["full"] }
 tokio-tungstenite = { version = "0.20", features = ["native-tls"] }
 futures-util = "0.3"

+ 1 - 1
lazer/sdk/rust/protocol/Cargo.toml

@@ -1,6 +1,6 @@
 [package]
 name = "pyth-lazer-protocol"
-version = "0.19.0"
+version = "0.20.0"
 edition = "2021"
 description = "Pyth Lazer SDK - protocol types."
 license = "Apache-2.0"

+ 6 - 6
lazer/sdk/rust/protocol/src/jrpc.rs

@@ -45,7 +45,7 @@ pub struct FeedUpdateParams {
 pub enum UpdateParams {
     #[serde(rename = "price")]
     PriceUpdate {
-        price: Price,
+        price: Option<Price>,
         best_bid_price: Option<Price>,
         best_ask_price: Option<Price>,
     },
@@ -190,7 +190,7 @@ mod tests {
                 feed_id: PriceFeedId(1),
                 source_timestamp: TimestampUs::from_micros(124214124124),
                 update: UpdateParams::PriceUpdate {
-                    price: Price::from_integer(1234567890, 0).unwrap(),
+                    price: Some(Price::from_integer(1234567890, 0).unwrap()),
                     best_bid_price: Some(Price::from_integer(1234567891, 0).unwrap()),
                     best_ask_price: Some(Price::from_integer(1234567892, 0).unwrap()),
                 },
@@ -231,7 +231,7 @@ mod tests {
                 feed_id: PriceFeedId(1),
                 source_timestamp: TimestampUs::from_micros(124214124124),
                 update: UpdateParams::PriceUpdate {
-                    price: Price::from_integer(1234567890, 0).unwrap(),
+                    price: Some(Price::from_integer(1234567890, 0).unwrap()),
                     best_bid_price: Some(Price::from_integer(1234567891, 0).unwrap()),
                     best_ask_price: Some(Price::from_integer(1234567892, 0).unwrap()),
                 },
@@ -272,7 +272,7 @@ mod tests {
                 feed_id: PriceFeedId(1),
                 source_timestamp: TimestampUs::from_micros(124214124124),
                 update: UpdateParams::PriceUpdate {
-                    price: Price::from_integer(1234567890, 0).unwrap(),
+                    price: Some(Price::from_integer(1234567890, 0).unwrap()),
                     best_bid_price: Some(Price::from_integer(1234567891, 0).unwrap()),
                     best_ask_price: Some(Price::from_integer(1234567892, 0).unwrap()),
                 },
@@ -312,7 +312,7 @@ mod tests {
                 feed_id: PriceFeedId(1),
                 source_timestamp: TimestampUs::from_micros(745214124124),
                 update: UpdateParams::PriceUpdate {
-                    price: Price::from_integer(5432, 0).unwrap(),
+                    price: Some(Price::from_integer(5432, 0).unwrap()),
                     best_bid_price: Some(Price::from_integer(5432, 0).unwrap()),
                     best_ask_price: Some(Price::from_integer(5432, 0).unwrap()),
                 },
@@ -351,7 +351,7 @@ mod tests {
                 feed_id: PriceFeedId(1),
                 source_timestamp: TimestampUs::from_micros(124214124124),
                 update: UpdateParams::PriceUpdate {
-                    price: Price::from_integer(1234567890, 0).unwrap(),
+                    price: Some(Price::from_integer(1234567890, 0).unwrap()),
                     best_bid_price: None,
                     best_ask_price: None,
                 },