pub struct ConfigFile {Show 19 fields
pub settings: Settings,
pub endpoints: Vec<EndpointConfig>,
pub disabled_endpoints: DisabledEndpoints,
pub proxy: Option<ProxyFileConfig>,
pub etherscan_api_key: Option<SecretString>,
pub tenderly: Option<TenderlyConfig>,
pub alchemy: Option<AlchemyConfig>,
pub coingecko: Option<GeckoConfig>,
pub defillama: Option<LlamaConfig>,
pub moralis: Option<MoralisConfig>,
pub dune: Option<DuneConfig>,
pub dune_sim: Option<DuneSimConfig>,
pub chainlink: Option<ChainlinkConfig>,
pub zerox: Option<ZeroxConfig>,
pub oneinch: Option<OneInchConfig>,
pub enso: Option<EnsoConfig>,
pub thegraph: Option<TheGraphConfig>,
pub solodit: Option<SoloditConfig>,
pub debug_rpc_urls: Vec<String>,
}Expand description
Configuration file structure
Fields§
§settings: SettingsGlobal settings
endpoints: Vec<EndpointConfig>Custom endpoints
disabled_endpoints: DisabledEndpointsDisabled endpoints
proxy: Option<ProxyFileConfig>Proxy configuration
etherscan_api_key: Option<SecretString>Etherscan API key
tenderly: Option<TenderlyConfig>Tenderly configuration
alchemy: Option<AlchemyConfig>Alchemy configuration
coingecko: Option<GeckoConfig>CoinGecko configuration
defillama: Option<LlamaConfig>DefiLlama configuration
moralis: Option<MoralisConfig>Moralis configuration
dune: Option<DuneConfig>Dune configuration
dune_sim: Option<DuneSimConfig>Dune SIM configuration (separate from Dune Analytics)
chainlink: Option<ChainlinkConfig>Chainlink Data Streams configuration
zerox: Option<ZeroxConfig>0x API configuration
oneinch: Option<OneInchConfig>1inch API configuration
enso: Option<EnsoConfig>Enso Finance API configuration
thegraph: Option<TheGraphConfig>The Graph API configuration (for Uniswap subgraphs)
solodit: Option<SoloditConfig>Solodit API configuration
debug_rpc_urls: Vec<String>Debug-capable RPC endpoints (for debug_traceCall, etc.)
Implementations§
Source§impl ConfigFile
impl ConfigFile
Sourcepub fn default_path() -> PathBuf
pub fn default_path() -> PathBuf
Get the default config file path
Can be overridden by setting the ETHCLI_CONFIG_DIR environment variable.
Sourcepub fn load_default() -> Result<Option<Self>>
pub fn load_default() -> Result<Option<Self>>
Load from default path
Sourcepub fn load(path: &Path) -> Result<Self>
pub fn load(path: &Path) -> Result<Self>
Load from a specific path
MED-003 fix: Uses shared file lock to coordinate with concurrent writers.
Sourcepub fn save(&self, path: &Path) -> Result<()>
pub fn save(&self, path: &Path) -> Result<()>
Save to a specific path
MED-003/HIGH-001 fix: Uses file-level locking with atomic write pattern to prevent TOCTOU race conditions and data loss when multiple CLI instances run simultaneously.
Uses write-to-temp-and-rename pattern for atomic writes:
- Write to a unique temporary file with exclusive lock
- Set restrictive permissions (before rename to avoid race)
- Sync to disk
- Rename atomically to target path
Sourcepub fn save_default(&self) -> Result<()>
pub fn save_default(&self) -> Result<()>
Save to default path
Sourcepub fn is_endpoint_disabled(&self, url: &str) -> bool
pub fn is_endpoint_disabled(&self, url: &str) -> bool
Check if an endpoint URL is disabled
Sourcepub fn proxy_config(&self) -> Option<ProxyConfig>
pub fn proxy_config(&self) -> Option<ProxyConfig>
Convert proxy config to runtime ProxyConfig
Sourcepub fn proxy_for_source(&self, source: &str) -> Option<String>
pub fn proxy_for_source(&self, source: &str) -> Option<String>
Get proxy URL for a specific source (respects enabled, sources, exclude_sources)
Sourcepub fn set_etherscan_key(&mut self, key: String) -> Result<()>
pub fn set_etherscan_key(&mut self, key: String) -> Result<()>
Set the Etherscan API key and save
Sourcepub fn set_tenderly(
&mut self,
access_key: String,
account: String,
project: String,
) -> Result<()>
pub fn set_tenderly( &mut self, access_key: String, account: String, project: String, ) -> Result<()>
Set Tenderly credentials and save
Sourcepub fn add_debug_rpc(&mut self, url: String) -> Result<()>
pub fn add_debug_rpc(&mut self, url: String) -> Result<()>
Add a debug RPC URL and save
Sourcepub fn remove_debug_rpc(&mut self, url: &str) -> Result<()>
pub fn remove_debug_rpc(&mut self, url: &str) -> Result<()>
Remove a debug RPC URL and save
Sourcepub fn update_endpoint_block_range(
&mut self,
url: &str,
max_block_range: u64,
) -> Result<bool>
pub fn update_endpoint_block_range( &mut self, url: &str, max_block_range: u64, ) -> Result<bool>
Update an endpoint’s max_block_range (runtime learning)
Sourcepub fn update_endpoint_max_logs(
&mut self,
url: &str,
max_logs: usize,
) -> Result<bool>
pub fn update_endpoint_max_logs( &mut self, url: &str, max_logs: usize, ) -> Result<bool>
Update an endpoint’s max_logs (runtime learning)
Sourcepub fn disable_endpoint(&mut self, url: &str) -> Result<bool>
pub fn disable_endpoint(&mut self, url: &str) -> Result<bool>
Disable an endpoint (runtime learning - endpoint is broken)
Trait Implementations§
Source§impl Clone for ConfigFile
impl Clone for ConfigFile
Source§fn clone(&self) -> ConfigFile
fn clone(&self) -> ConfigFile
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ConfigFile
impl Debug for ConfigFile
Source§impl Default for ConfigFile
impl Default for ConfigFile
Source§fn default() -> ConfigFile
fn default() -> ConfigFile
Source§impl<'de> Deserialize<'de> for ConfigFile
impl<'de> Deserialize<'de> for ConfigFile
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for ConfigFile
impl RefUnwindSafe for ConfigFile
impl Send for ConfigFile
impl Sync for ConfigFile
impl Unpin for ConfigFile
impl UnwindSafe for ConfigFile
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more