瀏覽代碼

feat(pyth-lazer) Add more context to ParseError in JRPC protocol (#2843)

Bart Platak 4 月之前
父節點
當前提交
7bb548835a

+ 3 - 3
Cargo.lock

@@ -5569,7 +5569,7 @@ dependencies = [
  "futures-util",
  "hex",
  "libsecp256k1 0.7.2",
- "pyth-lazer-protocol 0.8.0",
+ "pyth-lazer-protocol 0.8.1",
  "serde",
  "serde_json",
  "tokio",
@@ -5597,7 +5597,7 @@ dependencies = [
 
 [[package]]
 name = "pyth-lazer-protocol"
-version = "0.8.0"
+version = "0.8.1"
 dependencies = [
  "alloy-primitives 0.8.25",
  "anyhow",
@@ -5625,7 +5625,7 @@ dependencies = [
  "humantime",
  "protobuf",
  "protobuf-codegen",
- "pyth-lazer-protocol 0.8.0",
+ "pyth-lazer-protocol 0.8.1",
  "serde-value",
  "tracing",
 ]

+ 1 - 1
lazer/contracts/solana/Cargo.lock

@@ -3204,7 +3204,7 @@ dependencies = [
 
 [[package]]
 name = "pyth-lazer-protocol"
-version = "0.8.0"
+version = "0.8.1"
 dependencies = [
  "anyhow",
  "byteorder",

+ 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.8.0" }
+pyth-lazer-protocol = { path = "../../../../sdk/rust/protocol", version = "0.8.1" }
 
 anchor-lang = "0.30.1"
 bytemuck = "1.20.0"

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

@@ -7,7 +7,7 @@ license = "Apache-2.0"
 repository = "https://github.com/pyth-network/pyth-crosschain"
 
 [dependencies]
-pyth-lazer-protocol = { version = "0.8.0", path = "../../sdk/rust/protocol" }
+pyth-lazer-protocol = { version = "0.8.1", path = "../../sdk/rust/protocol" }
 anyhow = "1.0.98"
 protobuf = "3.7.2"
 serde-value = "0.7.0"

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

@@ -6,7 +6,7 @@ description = "A Rust client for Pyth Lazer"
 license = "Apache-2.0"
 
 [dependencies]
-pyth-lazer-protocol = { path = "../protocol", version = "0.8.0" }
+pyth-lazer-protocol = { path = "../protocol", version = "0.8.1" }
 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.8.0"
+version = "0.8.1"
 edition = "2021"
 description = "Pyth Lazer SDK - protocol types."
 license = "Apache-2.0"

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

@@ -87,7 +87,7 @@ pub struct JrpcErrorObject {
 
 #[derive(Debug, Eq, PartialEq)]
 pub enum JrpcError {
-    ParseError,
+    ParseError(String),
     InternalError,
 }
 
@@ -95,10 +95,10 @@ pub enum JrpcError {
 impl From<JrpcError> for JrpcErrorObject {
     fn from(error: JrpcError) -> Self {
         match error {
-            JrpcError::ParseError => JrpcErrorObject {
+            JrpcError::ParseError(error_message) => JrpcErrorObject {
                 code: -32700,
                 message: "Parse error".to_string(),
-                data: None,
+                data: Some(error_message.into()),
             },
             JrpcError::InternalError => JrpcErrorObject {
                 code: -32603,