瀏覽代碼

Add 1000ms channel to Lazer protocol

Mike Rolish 1 月之前
父節點
當前提交
e3688739a7

+ 12 - 12
Cargo.lock

@@ -5674,8 +5674,8 @@ dependencies = [
  "hyper 1.6.0",
  "hyper-util",
  "protobuf",
- "pyth-lazer-protocol 0.15.1",
- "pyth-lazer-publisher-sdk 0.12.1",
+ "pyth-lazer-protocol 0.15.2",
+ "pyth-lazer-publisher-sdk 0.12.2",
  "reqwest 0.12.23",
  "serde",
  "serde_json",
@@ -5693,7 +5693,7 @@ dependencies = [
 
 [[package]]
 name = "pyth-lazer-client"
-version = "8.1.1"
+version = "8.2.0"
 dependencies = [
  "alloy-primitives 0.8.25",
  "anyhow",
@@ -5711,7 +5711,7 @@ dependencies = [
  "hex",
  "humantime-serde",
  "libsecp256k1 0.7.2",
- "pyth-lazer-protocol 0.15.2",
+ "pyth-lazer-protocol 0.16.0",
  "reqwest 0.12.23",
  "serde",
  "serde_json",
@@ -5725,9 +5725,9 @@ dependencies = [
 
 [[package]]
 name = "pyth-lazer-protocol"
-version = "0.15.1"
+version = "0.15.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8d91dc5606c70529bf14769034738bc8773d359b4313be3c44449dd3b442096d"
+checksum = "2ca6d92d185fa8e16521b4ac044fdbd3c4cd492658ab0dc3b417e29e0989e035"
 dependencies = [
  "anyhow",
  "byteorder",
@@ -5746,7 +5746,7 @@ dependencies = [
 
 [[package]]
 name = "pyth-lazer-protocol"
-version = "0.15.2"
+version = "0.16.0"
 dependencies = [
  "alloy-primitives 0.8.25",
  "anyhow",
@@ -5772,27 +5772,27 @@ dependencies = [
 
 [[package]]
 name = "pyth-lazer-publisher-sdk"
-version = "0.12.1"
+version = "0.12.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "34b5f8284182d0acb4afa3c8289727511e36f59ab15b52d850aa2e32ffe0684f"
+checksum = "c6e6ce3b7384086c8738d79d22f46b29c7914ab870d3647da43497aea3534f04"
 dependencies = [
  "anyhow",
  "fs-err",
  "protobuf",
  "protobuf-codegen",
- "pyth-lazer-protocol 0.15.1",
+ "pyth-lazer-protocol 0.15.2",
  "serde_json",
 ]
 
 [[package]]
 name = "pyth-lazer-publisher-sdk"
-version = "0.12.2"
+version = "0.13.0"
 dependencies = [
  "anyhow",
  "fs-err",
  "protobuf",
  "protobuf-codegen",
- "pyth-lazer-protocol 0.15.2",
+ "pyth-lazer-protocol 0.16.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.15.2" }
+pyth-lazer-protocol = { path = "../../../../sdk/rust/protocol", version = "0.16.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.12.2"
+version = "0.13.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.15.2", path = "../../sdk/rust/protocol" }
+pyth-lazer-protocol = { version = "0.16.0", path = "../../sdk/rust/protocol" }
 anyhow = "1.0.98"
 protobuf = "3.7.2"
 serde_json = "1.0.140"

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

@@ -1,12 +1,12 @@
 [package]
 name = "pyth-lazer-client"
-version = "8.1.1"
+version = "8.2.0"
 edition = "2021"
 description = "A Rust client for Pyth Lazer"
 license = "Apache-2.0"
 
 [dependencies]
-pyth-lazer-protocol = { path = "../protocol", version = "0.15.2" }
+pyth-lazer-protocol = { path = "../protocol", version = "0.16.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.15.2"
+version = "0.16.0"
 edition = "2021"
 description = "Pyth Lazer SDK - protocol types."
 license = "Apache-2.0"

+ 1 - 0
lazer/sdk/rust/protocol/src/api.rs

@@ -237,6 +237,7 @@ impl Channel {
             Channel::FixedRate(fixed_rate) => match fixed_rate.duration().as_millis() {
                 50 => ChannelId::FIXED_RATE_50,
                 200 => ChannelId::FIXED_RATE_200,
+                1000 => ChannelId::FIXED_RATE_1000,
                 _ => panic!("unknown channel: {self:?}"),
             },
             Channel::RealTime => ChannelId::REAL_TIME,

+ 1 - 0
lazer/sdk/rust/protocol/src/lib.rs

@@ -52,6 +52,7 @@ impl ChannelId {
     pub const REAL_TIME: ChannelId = ChannelId(1);
     pub const FIXED_RATE_50: ChannelId = ChannelId(2);
     pub const FIXED_RATE_200: ChannelId = ChannelId(3);
+    pub const FIXED_RATE_1000: ChannelId = ChannelId(4);
 }
 
 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]

+ 4 - 1
lazer/sdk/rust/protocol/src/time.rs

@@ -499,12 +499,15 @@ impl FixedRate {
     pub const RATE_200_MS: Self = Self {
         rate: DurationUs::from_millis_u32(200),
     };
+    pub const RATE_1000_MS: Self = Self {
+        rate: DurationUs::from_millis_u32(1000),
+    };
 
     // Assumptions (tested below):
     // - Values are sorted.
     // - 1 second contains a whole number of each interval.
     // - all intervals are divisable by the smallest interval.
-    pub const ALL: [Self; 2] = [Self::RATE_50_MS, Self::RATE_200_MS];
+    pub const ALL: [Self; 3] = [Self::RATE_50_MS, Self::RATE_200_MS, Self::RATE_1000_MS];
     pub const MIN: Self = Self::ALL[0];
 
     pub fn from_millis(millis: u32) -> Option<Self> {