Skip to main content

anvil/server/beacon/
mod.rs

1//! Beacon Node REST API implementation for Anvil.
2
3use axum::{Router, routing::get};
4
5use crate::eth::EthApi;
6use alloy_network::Network;
7
8mod error;
9mod handlers;
10mod utils;
11
12/// Configures an [`axum::Router`] that handles Beacon REST API calls.
13pub fn router<N: Network>(api: EthApi<N>) -> Router {
14    Router::new()
15        .route(
16            "/eth/v1/beacon/blob_sidecars/{block_id}",
17            get(handlers::handle_get_blob_sidecars::<N>),
18        )
19        .route("/eth/v1/beacon/blobs/{block_id}", get(handlers::handle_get_blobs::<N>))
20        .route("/eth/v1/beacon/genesis", get(handlers::handle_get_genesis::<N>))
21        .with_state(api)
22}