Skip to content

[Frontend] Duplicated duration-unit-to-seconds constants (ScheduleStep vs lib/soroban) #580

Description

@ogazboiz

Telegram: https://t.me/+DOylgFv1jyJlNzM0

Why this matters

The seconds-per-unit mapping for stream durations is defined twice with magic numbers:

  • frontend/src/lib/soroban.tsSECONDS_PER_UNIT (BigInt: minutes 60, hours 3600, days 86400, weeks 604800, months 2592000)
  • frontend/src/components/stream-creation/ScheduleStep.tsx — an inline switch repeating the same * 60 / * 3600 / * 86400 / * 604800 / * 2592000 literals

If one is changed (e.g. "months" definition), the preview rate in the wizard and the actual submitted duration can silently diverge.

Acceptance criteria

  • Export a single shared seconds-per-unit map (or a toDurationSeconds-style helper) and use it in both places
  • Wizard rate preview and submitted duration stay consistent

Files to touch

  • frontend/src/lib/soroban.ts
  • frontend/src/components/stream-creation/ScheduleStep.tsx

Out of scope

  • Other amount helpers.

Metadata

Metadata

Labels

Stellar WaveIssues in the Stellar wave programfrontendFrontend related tasksgood first issueGood for newcomersrefactorRefactoring existing code

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions