Extension(index): Extension<Arc<Index>>,
Path(height): Path<u32>,
) -> ServerResult<String> {
Ok(
index
.block_hash(Some(height))?
.ok_or_not_found(|| "blockhash")?
.to_string(),
)
}
async fn block_hash_from_height_json(
Extension(index): Extension<Arc<Index>>,
Path(height): Path<u32>,
) -> ServerResult<Json<String>> {
Ok(Json(
index
.block_hash(Some(height))?
.ok_or_not_found(|| "blockhash")?
.to_string(),
))
}
async fn block_time(Extension(index): Extension<Arc<Index>>) -> ServerResult<String> {
Ok(
index
.block_time(index.block_height()?.ok_or_not_found(|| "blocktime")?)?
.unix_timestamp()
.to_string(),
)
}
async fn input(
Extension(page_config): Extension<Arc<PageConfig>>,
Extension(index): Extension<Arc<Index>>,
Path(path): Path<(u32, usize, usize)>,
) -> Result<PageHtml<InputHtml>, ServerError> {
let not_found = || format!("input /{}/{}/{}", path.0, path.1, path.2);