#![doc = include_str!("../README.md")]
#![warn(
    missing_copy_implementations,
    missing_debug_implementations,
    missing_docs,
    unreachable_pub,
    clippy::missing_const_for_fn,
    rustdoc::all
)]
#![cfg_attr(not(test), warn(unused_crate_dependencies))]
#![deny(unused_must_use, rust_2018_idioms)]
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]

pub(crate) mod config;
pub use config::{
    BlockTags, ChainNotifier, StorageRpcConfig, StorageRpcConfigEnv, StorageRpcCtx, SyncStatus,
};

mod eth;
pub use eth::EthError;

mod interest;
pub use interest::{ChainEvent, NewBlockNotification, RemovedBlock, ReorgNotification};

mod debug;
pub use debug::DebugError;

mod trace;
pub use trace::TraceError;

mod signet;
pub use signet::error::SignetError;

mod net;
mod web3;

pub mod serve;
pub use serve::{RpcServerGuard, ServeConfig, ServeConfigEnv, ServeError};

/// Instantiate a combined router with `eth`, `debug`, `trace`, `signet`,
/// `web3`, and `net` namespaces.
pub fn router<H>() -> ajj::Router<StorageRpcCtx<H>>
where
    H: signet_hot::HotKv + Send + Sync + 'static,
    <H::RoTx as signet_hot::model::HotKvRead>::Error: trevm::revm::database::DBErrorMarker,
{
    ajj::Router::new()
        .nest("eth", eth::eth())
        .nest("debug", debug::debug())
        .nest("trace", trace::trace())
        .nest("signet", signet::signet())
        .nest("web3", web3::web3())
        .nest("net", net::net())
}
