use std::collections::HashMap;
use alloy::primitives::Address;
use tycho_common::models::Chain;
#[derive(Debug, Clone)]
pub struct TraceConfig {
pub etherscan_api_key: Option<String>,
pub chain: Chain,
pub offline: bool,
pub labels: HashMap<Address, String>,
}
impl TraceConfig {
pub fn new(chain: Chain) -> Self {
Self { etherscan_api_key: None, chain, offline: false, labels: HashMap::new() }
}
pub fn with_etherscan_api_key(mut self, key: String) -> Self {
self.etherscan_api_key = Some(key);
self
}
pub fn with_offline(mut self, offline: bool) -> Self {
self.offline = offline;
self
}
pub fn can_use_etherscan(&self) -> bool {
!self.offline && self.etherscan_api_key.is_some()
}
}
impl Default for TraceConfig {
fn default() -> Self {
Self::new(Chain::Ethereum)
}
}