diff --git a/explorer_service/src/pages/transaction_page.rs b/explorer_service/src/pages/transaction_page.rs
index 2752c47d..ed3d8aac 100644
--- a/explorer_service/src/pages/transaction_page.rs
+++ b/explorer_service/src/pages/transaction_page.rs
@@ -183,12 +183,6 @@ pub fn TransactionPage() -> impl IntoView {
signatures_and_public_keys: _,
proof,
} = witness_set;
- let validity_window_formatted = match validity_window.0 {
- (Some(start), Some(end)) => format!("Blocks {start} (included) – {end} (excluded)"),
- (Some(start), None) => format!("Block {start} onwards"),
- (None, Some(end)) => format!("Before block {end}"),
- (None, None) => "Unbounded".to_owned(),
- };
let proof_len = proof.map_or(0, |p| p.0.len());
view! {
@@ -221,7 +215,7 @@ pub fn TransactionPage() -> impl IntoView {
"Validity Window:"
- {validity_window_formatted}
+ {validity_window.to_string()}
diff --git a/indexer/service/protocol/src/lib.rs b/indexer/service/protocol/src/lib.rs
index a8f6da2c..25e49548 100644
--- a/indexer/service/protocol/src/lib.rs
+++ b/indexer/service/protocol/src/lib.rs
@@ -304,6 +304,17 @@ pub struct Nullifier(
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, Serialize, Deserialize, JsonSchema)]
pub struct ValidityWindow(pub (Option, Option));
+impl Display for ValidityWindow {
+ fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+ match self.0 {
+ (Some(start), Some(end)) => write!(f, "[{start}, {end})"),
+ (Some(start), None) => write!(f, "[{start}, ∞)"),
+ (None, Some(end)) => write!(f, "(-∞, {end})"),
+ (None, None) => write!(f, "(-∞, ∞)"),
+ }
+ }
+}
+
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, Serialize, Deserialize, JsonSchema)]
pub struct CommitmentSetDigest(
#[serde(with = "base64::arr")]