let block = index
.get_block_by_hash(hash)?
.ok_or_not_found(|| format!("block {hash}"))?;
(block, u32::try_from(info.height).unwrap())
}
};
Ok(if accept_json.0 {
let inscriptions = index.get_inscriptions_in_block(height)?;
Json(BlockJson::new(
block,
Height(height),
Self::index_height(&index)?,
inscriptions,
))
.into_response()
} else {
let (featured_inscriptions, total_num) =
index.get_highest_paying_inscriptions_in_block(height, 8)?;
BlockHtml::new(
block,
Height(height),
Self::index_height(&index)?,
total_num,
featured_inscriptions,
)
.page(page_config)
.into_response()
})
}
async fn transaction(
Extension(page_config): Extension<Arc<PageConfig>>,
Extension(index): Extension<Arc<Index>>,
Path(txid): Path<Txid>,
) -> ServerResult<PageHtml<TransactionHtml>> {
let inscription = index.get_inscription_by_id(InscriptionId { txid, index: 0 })?;