use alloy::rpc::types::Log;
use thiserror::Error;
use crate::storage::codec::decoder::DecodedEventWithHeader;
pub mod backfill;
pub mod config;
pub(crate) mod cursor;
pub mod error_tracking;
pub mod events;
pub mod heads;
pub mod provider;
pub mod stream;
#[derive(Debug, Clone, Error)]
pub enum RpcError {
#[error("Connection Error: {0}")]
ConnectionError(String),
#[error("Subscription Error: {0}")]
SubscriptionError(String),
#[error("Log Fetch Error: {0}")]
LogFetchError(String),
#[error("Transport Error: {0}")]
TransportError(String),
#[error("All Providers Suspended: {0}")]
AllProvidersSuspended(String),
#[error(
"Cursor past tip: refusing to advance to block {to_block}; provider reports tip {reported_tip}"
)]
CursorPastTip { to_block: u64, reported_tip: u64 },
#[error("Other Error: {0}")]
Other(String),
}
pub type LogRange = (u64, u64, Vec<Log>);
pub type DecodedEventRange = (u64, u64, Vec<DecodedEventWithHeader>);