Skip to content

Add helper for converting a ledger sequence number to an estimated timestamp #446

Description

@Chucks1093

Summary

Several parts of the UI display event timestamps that come from the server as ledger sequence numbers. Converting a ledger sequence to an approximate UTC timestamp (using Stellar's ~5 second ledger time) should be a shared helper rather than being calculated inline in components.

Scope

  • Add ledgerToTimestamp(ledger: number, referenceLedger: number, referenceTimestamp: number): Date helper
  • Calculation: referenceTimestamp + (ledger - referenceLedger) * 5000 (5 seconds per ledger in ms)
  • Add unit tests for: ledger in the past, ledger in the future, ledger equal to reference

Acceptance Criteria

  • Helper returns correct estimated Date for past and future ledgers
  • Ledger equal to reference returns exactly the reference timestamp
  • Unit tests cover all three cases

ETA: 12 hours


Coordinate on Telegram

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave program

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions