Skip to content

refactor: extract magic numbers into constants - #212

Closed
ZacLou wants to merge 1 commit into
TricklePay:mainfrom
ZacLou:refactor/issue-156
Closed

refactor: extract magic numbers into constants#212
ZacLou wants to merge 1 commit into
TricklePay:mainfrom
ZacLou:refactor/issue-156

Conversation

@ZacLou

@ZacLou ZacLou commented Sep 1, 2026

Copy link
Copy Markdown

Closes #156

Replaces repeated numeric literals with named constants from lib/constants.ts so values and their meaning live together and the tuning surface is obvious:

  • MS_PER_SECOND for Unix/JavaScript timestamp conversions
  • SECONDS_PER_MINUTE / SECONDS_PER_HOUR / SECONDS_PER_DAY for duration math
  • STREAM_LIST_REFRESH_INTERVAL_MS for the background stream-list refresh
  • MAX_CONFIRMATION_ATTEMPTS, CONFIRMATION_POLL_INTERVAL_MS, and TRANSACTION_BUILDER_TIMEOUT_SECONDS for on-chain transaction polling

No behavioural changes.

Verification

px vitest run lib/format.test.ts lib/validation.test.ts lib/timezone.test.ts lib/amount.test.ts — 72 tests pass

pm run typecheck — only pre-existing errors in components/skeleton.test.tsx`n-
pm run lint — only pre-existing errors in test files

Replaces repeated numeric literals with named constants from lib/constants:
- MS_PER_SECOND for Unix/JS timestamp conversions
- SECONDS_PER_MINUTE / HOUR / DAY for duration math
- STREAM_LIST_REFRESH_INTERVAL_MS for the 15s background refresh
- MAX_CONFIRMATION_ATTEMPTS / CONFIRMATION_POLL_INTERVAL_MS / TRANSACTION_BUILDER_TIMEOUT_SECONDS for on-chain polling

Closes TricklePay#156
@Glittersup Glittersup closed this Sep 3, 2026
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.

Extract magic numbers into named constants

2 participants