rust_eigen_client/
config.rs1use ethereum_types::H160;
2use secrecy::{ExposeSecret, Secret};
3use std::str::FromStr;
4use url::Url;
5
6use crate::errors::{ConfigError, EigenClientError};
7
8#[derive(Debug, Clone)]
9pub struct SecretUrl {
11 inner: Secret<String>,
14}
15
16impl SecretUrl {
17 pub fn new(url: Url) -> Self {
19 Self {
20 inner: Secret::new(url.to_string()),
21 }
22 }
23}
24
25impl From<SecretUrl> for Url {
26 fn from(secret_url: SecretUrl) -> Self {
27 Url::parse(secret_url.inner.expose_secret()).unwrap() }
29}
30
31impl PartialEq for SecretUrl {
32 fn eq(&self, other: &Self) -> bool {
33 self.inner.expose_secret().eq(other.inner.expose_secret())
34 }
35}
36
37#[derive(Clone, Debug, PartialEq)]
38pub enum SrsPointsSource {
39 Path(String),
41 Url((String, String)),
43}
44
45#[derive(Clone, Debug, PartialEq)]
47pub struct EigenConfig {
48 pub disperser_rpc: String,
50 pub eth_rpc_url: Option<SecretUrl>,
52 pub settlement_layer_confirmation_depth: u32,
55 pub eigenda_svc_manager_address: H160,
57 pub wait_for_finalization: bool,
59 pub authenticated: bool,
61 pub srs_points_source: SrsPointsSource,
63}
64
65#[derive(Clone, Debug, PartialEq)]
67pub struct EigenSecrets {
68 pub private_key: PrivateKey,
69}
70
71#[derive(Debug, Clone)]
73pub struct PrivateKey(pub Secret<String>);
74
75impl PartialEq for PrivateKey {
76 fn eq(&self, other: &Self) -> bool {
77 self.0.expose_secret().eq(other.0.expose_secret())
78 }
79}
80
81impl FromStr for PrivateKey {
82 type Err = EigenClientError;
83
84 fn from_str(s: &str) -> Result<Self, Self::Err> {
85 Ok(PrivateKey(s.parse().map_err(|_| ConfigError::PrivateKey)?))
86 }
87}