mirror of
https://github.com/floor-licker/polyfill-rs.git
synced 2026-08-26 02:48:07 +00:00
fix: satisfy ci clippy and audit
This commit is contained in:
Generated
+2
-2
@@ -3408,9 +3408,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rustls-webpki"
|
name = "rustls-webpki"
|
||||||
version = "0.103.8"
|
version = "0.103.13"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "2ffdfa2f5286e2247234e03f680868ac2815974dc39e00ea15adc445d0aafe52"
|
checksum = "61c429a8649f110dddef65e2a5ad240f747e85f7758a6bccc7e5777bd33f756e"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ring",
|
"ring",
|
||||||
"rustls-pki-types",
|
"rustls-pki-types",
|
||||||
|
|||||||
+26
-18
@@ -91,16 +91,21 @@ pub struct ClobClient {
|
|||||||
buffer_pool: std::sync::Arc<crate::buffer_pool::BufferPool>,
|
buffer_pool: std::sync::Arc<crate::buffer_pool::BufferPool>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Default)]
|
||||||
|
struct ClientAuthConfig {
|
||||||
|
signer: Option<PrivateKeySigner>,
|
||||||
|
api_creds: Option<ApiCreds>,
|
||||||
|
builder_code: Option<String>,
|
||||||
|
sig_type: Option<crate::orders::SigType>,
|
||||||
|
funder: Option<Address>,
|
||||||
|
}
|
||||||
|
|
||||||
impl ClobClient {
|
impl ClobClient {
|
||||||
fn build_client(
|
fn build_client(
|
||||||
host: &str,
|
host: &str,
|
||||||
chain_id: u64,
|
chain_id: u64,
|
||||||
http_client: Client,
|
http_client: Client,
|
||||||
signer: Option<PrivateKeySigner>,
|
auth: ClientAuthConfig,
|
||||||
api_creds: Option<ApiCreds>,
|
|
||||||
builder_code: Option<String>,
|
|
||||||
sig_type: Option<crate::orders::SigType>,
|
|
||||||
funder: Option<Address>,
|
|
||||||
) -> Self {
|
) -> Self {
|
||||||
let dns_cache = tokio::runtime::Handle::try_current().ok().and_then(|_| {
|
let dns_cache = tokio::runtime::Handle::try_current().ok().and_then(|_| {
|
||||||
tokio::task::block_in_place(|| {
|
tokio::task::block_in_place(|| {
|
||||||
@@ -132,17 +137,18 @@ impl ClobClient {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
let order_builder = signer
|
let order_builder = auth
|
||||||
|
.signer
|
||||||
.clone()
|
.clone()
|
||||||
.map(|signer| crate::orders::OrderBuilder::new(signer, sig_type, funder));
|
.map(|signer| crate::orders::OrderBuilder::new(signer, auth.sig_type, auth.funder));
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
http_client,
|
http_client,
|
||||||
base_url: host.to_string(),
|
base_url: host.to_string(),
|
||||||
chain_id,
|
chain_id,
|
||||||
signer,
|
signer: auth.signer,
|
||||||
api_creds,
|
api_creds: auth.api_creds,
|
||||||
builder_code,
|
builder_code: auth.builder_code,
|
||||||
order_builder,
|
order_builder,
|
||||||
dns_cache,
|
dns_cache,
|
||||||
connection_manager,
|
connection_manager,
|
||||||
@@ -154,7 +160,7 @@ impl ClobClient {
|
|||||||
/// Now includes DNS caching, connection management, and buffer pooling
|
/// Now includes DNS caching, connection management, and buffer pooling
|
||||||
pub fn new(host: &str) -> Self {
|
pub fn new(host: &str) -> Self {
|
||||||
let http_client = build_http_client(host, None, None);
|
let http_client = build_http_client(host, None, None);
|
||||||
Self::build_client(host, 137, http_client, None, None, None, None, None)
|
Self::build_client(host, 137, http_client, ClientAuthConfig::default())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Create a V2-native client from config.
|
/// Create a V2-native client from config.
|
||||||
@@ -195,11 +201,13 @@ impl ClobClient {
|
|||||||
&config.base_url,
|
&config.base_url,
|
||||||
config.chain,
|
config.chain,
|
||||||
http_client,
|
http_client,
|
||||||
signer,
|
ClientAuthConfig {
|
||||||
config.api_credentials,
|
signer,
|
||||||
config.builder_code,
|
api_creds: config.api_credentials,
|
||||||
sig_type,
|
builder_code: config.builder_code,
|
||||||
funder,
|
sig_type,
|
||||||
|
funder,
|
||||||
|
},
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -211,7 +219,7 @@ impl ClobClient {
|
|||||||
.build()
|
.build()
|
||||||
.expect("Failed to build reqwest client")
|
.expect("Failed to build reqwest client")
|
||||||
});
|
});
|
||||||
Self::build_client(host, 137, http_client, None, None, None, None, None)
|
Self::build_client(host, 137, http_client, ClientAuthConfig::default())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Create a client optimized for internet connections
|
/// Create a client optimized for internet connections
|
||||||
@@ -222,7 +230,7 @@ impl ClobClient {
|
|||||||
.build()
|
.build()
|
||||||
.expect("Failed to build reqwest client")
|
.expect("Failed to build reqwest client")
|
||||||
});
|
});
|
||||||
Self::build_client(host, 137, http_client, None, None, None, None, None)
|
Self::build_client(host, 137, http_client, ClientAuthConfig::default())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Create a client with L1 headers (for authentication)
|
/// Create a client with L1 headers (for authentication)
|
||||||
|
|||||||
Reference in New Issue
Block a user