-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
139 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
use std::{net::SocketAddr, time::Duration}; | ||
|
||
use jsonrpsee::{ | ||
http_client::{HttpClient, HttpClientBuilder}, | ||
ws_client::{PingConfig, WsClient, WsClientBuilder}, | ||
}; | ||
|
||
pub const MAX_FEE_PER_GAS: u128 = 1000000001; | ||
|
||
pub struct BridgeBackendClient { | ||
http_client: HttpClient, | ||
ws_client: WsClient, | ||
pub rpc_addr: SocketAddr, | ||
} | ||
|
||
impl BridgeBackendClient { | ||
pub async fn new(rpc_addr: SocketAddr) -> anyhow::Result<Self> { | ||
let http_host = format!("http://localhost:{}", rpc_addr.port()); | ||
let ws_host = format!("ws://localhost:{}", rpc_addr.port()); | ||
|
||
let http_client = HttpClientBuilder::default() | ||
.request_timeout(Duration::from_secs(120)) | ||
.build(http_host)?; | ||
|
||
let ws_client = WsClientBuilder::default() | ||
.enable_ws_ping(PingConfig::default().inactive_limit(Duration::from_secs(10))) | ||
.build(ws_host) | ||
.await?; | ||
|
||
Ok(Self { | ||
ws_client, | ||
http_client, | ||
rpc_addr, | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
mod bitcoin; | ||
mod bridge_backend; | ||
pub mod bridge_backend_client; | ||
pub mod client; | ||
pub mod config; | ||
mod docker; | ||
|
Oops, something went wrong.