rust_eigenda_client/
config.rs1use ethereum_types::H160;
2use secrecy::{ExposeSecret, Secret};
3use url::Url;
4
5use crate::errors::ConfigError;
6
7#[derive(Debug, Clone)]
8pub struct SecretUrl {
10 inner: Secret<String>,
13}
14
15impl SecretUrl {
16 pub fn new(url: Url) -> Self {
18 Self {
19 inner: Secret::new(url.to_string()),
20 }
21 }
22}
23
24impl From<SecretUrl> for Url {
25 fn from(secret_url: SecretUrl) -> Self {
26 Url::parse(secret_url.inner.expose_secret()).unwrap() }
28}
29
30impl PartialEq for SecretUrl {
31 fn eq(&self, other: &Self) -> bool {
32 self.inner.expose_secret().eq(other.inner.expose_secret())
33 }
34}
35
36#[derive(Clone, Debug, PartialEq)]
37pub enum SrsPointsSource {
38 Path(String),
40 Url((String, String)),
42}
43
44#[derive(Clone, Debug, PartialEq)]
46pub struct EigenConfig {
47 pub disperser_rpc: String,
49 pub eth_rpc_url: SecretUrl,
51 pub settlement_layer_confirmation_depth: u32,
54 pub eigenda_svc_manager_address: H160,
56 pub wait_for_finalization: bool,
58 pub authenticated: bool,
60 pub srs_points_source: SrsPointsSource,
62 pub custom_quorum_numbers: Vec<u8>,
64}
65
66impl EigenConfig {
67 #[allow(clippy::too_many_arguments)]
69 pub fn new(
70 disperser_rpc: String,
71 eth_rpc_url: SecretUrl,
72 settlement_layer_confirmation_depth: u32,
73 eigenda_svc_manager_address: H160,
74 wait_for_finalization: bool,
75 authenticated: bool,
76 srs_points_source: SrsPointsSource,
77 custom_quorum_numbers: Vec<u8>,
78 ) -> Result<Self, ConfigError> {
79 Ok(Self {
80 disperser_rpc,
81 eth_rpc_url,
82 settlement_layer_confirmation_depth,
83 eigenda_svc_manager_address,
84 wait_for_finalization,
85 authenticated,
86 srs_points_source,
87 custom_quorum_numbers,
88 })
89 }
90}