Skip to content

refactor(stellar): make confirmation polling budget configurable (#359)#501

Open
webthreejunkie-sudo wants to merge 1 commit into
Fluxora-Org:mainfrom
webthreejunkie-sudo:refactor/configurable-tx-retries
Open

refactor(stellar): make confirmation polling budget configurable (#359)#501
webthreejunkie-sudo wants to merge 1 commit into
Fluxora-Org:mainfrom
webthreejunkie-sudo:refactor/configurable-tx-retries

Conversation

@webthreejunkie-sudo

@webthreejunkie-sudo webthreejunkie-sudo commented Jun 27, 2026

Copy link
Copy Markdown

Summary

Fixes #359. waitForTransaction in src/lib/stellar/tx.ts previously hardcoded maxRetries = 15 and delayMs = 1500, causing false timeout failures on slow Testnet. Both values are now driven by transactionConfig so they can be tuned per environment without code edits.

Changes

src/lib/transactionConfig.ts

  • Added readFiniteNumber helper — unlike readPositiveNumber, it parses any finite number (including negative/zero) so downstream clamping works correctly.
  • Added confirmationMaxRetries (default 15, clamped [1, 300], env VITE_TX_CONFIRMATION_MAX_RETRIES).
  • Added confirmationDelayMs (default 1500 ms, clamped [100, 30000], env VITE_TX_CONFIRMATION_DELAY_MS).
  • Both fields carry TSDoc with the max-wait formula: confirmationMaxRetries × confirmationDelayMs.

src/lib/stellar/tx.ts

  • waitForTransaction signature defaults replaced: 15transactionConfig.confirmationMaxRetries ?? 15, 1500transactionConfig.confirmationDelayMs ?? 1500.
  • Fully backward-compatible — callers that pass explicit arguments are unaffected.

src/vite-env.d.ts

  • Declared VITE_TX_CONFIRMATION_MAX_RETRIES and VITE_TX_CONFIRMATION_DELAY_MS as optional string env vars.

.env.example / docs/environment.md

  • Full documentation for both new vars: purpose, clamping range, format, default, max-wait formula.

Tests

  • transactionConfig.test.ts: 20 new cases covering valid reads, decimal floor, clamp-to-min (0 and negative), clamp-to-max, boundary values, and non-numeric fallback for both new fields.
  • tx.test.ts: 4 new cases in waitForTransaction — configurable confirmation budget: custom retries, custom delay timing, early success within budget, default 15-retry behaviour.
Test Files  2 passed (2)
     Tests  53 passed (53)

Security

- Add confirmationMaxRetries (default 15, clamped [1,300]) and
  confirmationDelayMs (default 1500ms, clamped [100,30000]) to
  transactionConfig, driven by VITE_TX_CONFIRMATION_MAX_RETRIES
  and VITE_TX_CONFIRMATION_DELAY_MS env vars
- waitForTransaction reads from transactionConfig instead of
  hardcoded values; backward-compatible defaults preserved
- Add readFiniteNumber helper for correct clamp-on-negative behaviour
- Comprehensive tests: 20 config cases + 4 waitForTransaction cases
- Document both vars in .env.example and docs/environment.md

Closes Fluxora-Org#359
@drips-wave

drips-wave Bot commented Jun 27, 2026

Copy link
Copy Markdown

@webthreejunkie-sudo Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

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.

Make waitForTransaction maxRetries and delay configurable via transactionConfig

1 participant