diff --git a/relay_client/src/http.rs b/relay_client/src/http.rs index a4dbc23..c08d7c1 100644 --- a/relay_client/src/http.rs +++ b/relay_client/src/http.rs @@ -1,8 +1,7 @@ use { crate::{ error::{BoxError, ClientError, Error}, - ConnectionOptions, - MessageIdGenerator, + ConnectionOptions, MessageIdGenerator, }, http::{HeaderMap, StatusCode}, relay_rpc::{ @@ -125,7 +124,7 @@ impl Client { ttl_secs, tag, prompt, - tvf_data: None, + analytics: None, }) .await .map(|_| ()) diff --git a/relay_client/src/websocket.rs b/relay_client/src/websocket.rs index a515695..ac9b128 100644 --- a/relay_client/src/websocket.rs +++ b/relay_client/src/websocket.rs @@ -7,19 +7,9 @@ use { relay_rpc::{ domain::{MessageId, SubscriptionId, Topic}, rpc::{ - BatchFetchMessages, - BatchReceiveMessages, - BatchSubscribe, - BatchSubscribeBlocking, - BatchUnsubscribe, - FetchMessages, - Publish, - Receipt, - Subscribe, - SubscribeBlocking, - Subscription, - SubscriptionError, - Unsubscribe, + BatchFetchMessages, BatchReceiveMessages, BatchSubscribe, BatchSubscribeBlocking, + BatchUnsubscribe, FetchMessages, Publish, Receipt, Subscribe, SubscribeBlocking, + Subscription, SubscriptionError, Unsubscribe, }, }, std::{future::Future, sync::Arc, time::Duration}, @@ -29,10 +19,7 @@ use { }, }; pub use { - fetch::*, - inbound::*, - outbound::*, - stream::*, + fetch::*, inbound::*, outbound::*, stream::*, tokio_tungstenite::tungstenite::protocol::CloseFrame, }; @@ -168,7 +155,7 @@ impl Client { ttl_secs: ttl.as_secs() as u32, tag, prompt, - tvf_data: None, + analytics: None, }); self.request(request); diff --git a/relay_rpc/src/rpc.rs b/relay_rpc/src/rpc.rs index b0eca54..bd99469 100644 --- a/relay_rpc/src/rpc.rs +++ b/relay_rpc/src/rpc.rs @@ -528,7 +528,7 @@ impl ServiceRequest for BatchReceiveMessages { #[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct TvfData { +pub struct AnalyticsData { pub correlation_id: Option>, pub chain_id: Option>, pub rpc_methods: Option>>, @@ -563,7 +563,7 @@ pub struct Publish { pub prompt: bool, #[serde(default, flatten, skip_serializing_if = "is_default")] - pub tvf_data: Option, + pub analytics: Option, } impl Publish { @@ -882,7 +882,7 @@ impl Request { pub fn strip_analytics(&mut self) { if let Params::Publish(params) = &mut self.params { - params.tvf_data = None; + params.analytics = None; } } } diff --git a/relay_rpc/src/rpc/tests.rs b/relay_rpc/src/rpc/tests.rs index a50c3f4..affe696 100644 --- a/relay_rpc/src/rpc/tests.rs +++ b/relay_rpc/src/rpc/tests.rs @@ -11,7 +11,7 @@ fn request() { ttl_secs: 12, tag: 0, prompt: false, - tvf_data: Some(TvfData { + analytics: Some(AnalyticsData { correlation_id: Some("correlation_id".into()), chain_id: Some("chain_id".into()), rpc_methods: Some(vec!["rpc_method".into()]), @@ -75,12 +75,14 @@ fn response_result() { #[test] fn response_error() { - let payload: Payload = - Payload::Response(Response::Error(ErrorResponse::new(1.into(), ErrorData { + let payload: Payload = Payload::Response(Response::Error(ErrorResponse::new( + 1.into(), + ErrorData { code: 32, data: None, message: "some message".into(), - }))); + }, + ))); let serialized = serde_json::to_string(&payload).unwrap(); @@ -301,7 +303,7 @@ fn validation() { ttl_secs: 0, tag: 0, prompt: false, - tvf_data: None, + analytics: None, }), }; assert_eq!(request.validate(), Err(PayloadError::InvalidRequestId)); @@ -317,7 +319,7 @@ fn validation() { ttl_secs: 0, tag: 0, prompt: false, - tvf_data: None, + analytics: None, }), }; assert_eq!(request.validate(), Err(PayloadError::InvalidJsonRpcVersion)); @@ -333,7 +335,7 @@ fn validation() { ttl_secs: 0, tag: 0, prompt: false, - tvf_data: None, + analytics: None, }), }; assert_eq!(request.validate(), Ok(())); @@ -349,7 +351,7 @@ fn validation() { ttl_secs: 0, tag: 0, prompt: false, - tvf_data: None, + analytics: None, }), }; assert_eq!(request.validate(), Err(PayloadError::InvalidTopic));