Stopped double-encoding the SignedOp

This commit is contained in:
Dave Hrycyszyn
2024-06-11 18:33:08 +01:00
parent 014462c187
commit f9c4fce398

View File

@@ -32,6 +32,9 @@ impl WebSocketClient {
#[async_trait] #[async_trait]
impl ezsockets::ClientExt for WebSocketClient { impl ezsockets::ClientExt for WebSocketClient {
// Right now we're only using the Call type for sending signed ops
// change this to an enum if we need to send other types of calls, and
// match on it.
type Call = String; type Call = String;
async fn on_text(&mut self, text: String) -> Result<(), ezsockets::Error> { async fn on_text(&mut self, text: String) -> Result<(), ezsockets::Error> {
@@ -47,9 +50,8 @@ impl ezsockets::ClientExt for WebSocketClient {
} }
async fn on_call(&mut self, call: Self::Call) -> Result<(), ezsockets::Error> { async fn on_call(&mut self, call: Self::Call) -> Result<(), ezsockets::Error> {
let to_send = serde_json::to_string(&call).unwrap(); tracing::info!("sending signed op: {call:?}");
tracing::info!("sending signed op: {to_send:?}"); self.handle.text(call)?;
self.handle.text(to_send)?;
Ok(()) Ok(())
} }
} }