Skip to content

Commit

Permalink
save dev state
Browse files Browse the repository at this point in the history
Signed-off-by: onur-ozkan <work@onurozkan.dev>
  • Loading branch information
onur-ozkan committed Jan 25, 2024
1 parent 64986fc commit ba35834
Showing 1 changed file with 31 additions and 1 deletion.
32 changes: 31 additions & 1 deletion mm2src/coins/eth/web3_transport/websocket_transport.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
#![allow(unused)] // TODO: remove this

use crate::eth::web3_transport::Web3SendOut;
use crate::eth::RpcTransportEventHandlerShared;
use crate::{eth::web3_transport::Web3SendOut, rpc_command::lightning::nodes};
use common::log;
use futures::lock::Mutex as AsyncMutex;
use jsonrpc_core::Call;
use mm2_net::transport::GuiAuthValidationGenerator;
use std::sync::{atomic::{AtomicUsize, Ordering},
Arc};
use web3::error::Error;
use web3::{helpers::build_request, RequestId, Transport};

#[derive(Clone, Debug)]
Expand Down Expand Up @@ -42,6 +45,24 @@ impl WebsocketTransport {
request_id: Arc::new(AtomicUsize::new(0)),
}
}

async fn start_connection_loop(&self) {
for node in (*self.client.0.lock().await).nodes.clone() {
let mut wsocket = match tokio_tungstenite_wasm::connect(node.uri.to_string()).await {
Ok(ws) => ws,
Err(e) => {
log::error!("{e}");
continue;
},
};

// TODO
}
}

async fn stop_connection_loop(&self) { todo!() }

async fn rpc_send_and_receive(&self) { todo!() }
}

impl Transport for WebsocketTransport {
Expand All @@ -60,3 +81,12 @@ impl Transport for WebsocketTransport {
todo!()
}
}

async fn send_request(
request: Call,
client: Arc<WebsocketTransportRpcClient>,
event_handlers: Vec<RpcTransportEventHandlerShared>,
gui_auth_validation_generator: Option<GuiAuthValidationGenerator>,
) -> Result<serde_json::Value, Error> {
todo!()
}

0 comments on commit ba35834

Please sign in to comment.