Skip to content

feat(explain): enrich transaction explanations with ledger timeline context#144

Merged
Tinna23 merged 1 commit intoStellarCommons:mainfrom
demilade18-git:feat/transaction-timeline-enrichment-86
Feb 26, 2026
Merged

feat(explain): enrich transaction explanations with ledger timeline context#144
Tinna23 merged 1 commit intoStellarCommons:mainfrom
demilade18-git:feat/transaction-timeline-enrichment-86

Conversation

@demilade18-git
Copy link
Contributor

Description

This PR addresses Issue #86, adding crucial temporal context to transaction explanations. Previously, users had no way of knowing when a transaction occurred or which ledger it was bundled into. By parsing and exposing the ledger close time and sequence number, explanations are now significantly richer and more practical for timeline debugging.

Changes Made

  • src/services/horizon.rs:
    • Added created_at (Option<String>) and ledger_sequence (Option<u32>) to the Horizon deserialization models.
  • src/explain/transaction.rs:
    • Added ledger_closed_at and ledger to the TransactionExplanation struct.
    • Introduced the format_ledger_time(iso_string: &str) -> String utility function to handle UTC display formatting.
    • Updated the summary generation logic to dynamically append: 'This transaction was confirmed on {date} at {time} UTC (ledger #{sequence})'.

Acceptance Criteria Met

  • TransactionExplanation includes ledger_closed_at and ledger fields
  • Summary includes a readable timestamp natively integrated into the explanation string
  • Time formatting utility tests implemented and passing

Test Coverage

All tests passing (150+ suite). Added specific coverage for format_ledger_time:

  • test_format_ledger_time_date_only
  • test_format_ledger_time_empty_string
  • test_format_ledger_time_end_of_day
  • test_format_ledger_time_invalid_returns_original
  • test_format_ledger_time_midnight
  • test_format_ledger_time_standard_utc
  • test_format_ledger_time_strips_seconds
  • test_format_ledger_time_with_positive_offset
  • test_format_ledger_time_with_whitespace

Dependencies

Depends on #4, #111

Linked Issues

Closes #86

@Tinna23 Tinna23 merged commit 1c834fb into StellarCommons:main Feb 26, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Issue #29 Add transaction timeline enrichment (ledger close time, ledger sequence)

2 participants