Skip to content

refactor: consolidate stream validation logic into a shared utility w… - #1421

Merged
K1NGD4VID merged 3 commits into
LabsCrypt:mainfrom
emarkees:fix/unify-stream-creation-validation
Sep 1, 2026
Merged

refactor: consolidate stream validation logic into a shared utility w…#1421
K1NGD4VID merged 3 commits into
LabsCrypt:mainfrom
emarkees:fix/unify-stream-creation-validation

Conversation

@emarkees

Copy link
Copy Markdown
Contributor

Description

Resolves audit issue: [Audit] Three divergent implementations of "create a stream"

Previously, stream creation logic had three separate implementations across the codebase (StreamCreationWizard, CreateStreamContent, and DashboardView inline settings form). These entry points enforced divergent validation rules:

  • Only two of three checked Stellar recipient public key format.
  • Only one checked available wallet balance.
  • Template management and draft persistence logic were duplicated independently.

Key Changes

  • Unified Validation & Balance Enforcement: Integrated useStreamForm into DashboardView inline stream creation form (dashboard-view.tsx) and passed walletBalance to validateStreamForm. All three entry points now enforce identical validation rules (recipient Stellar public key format via isValidStellarPublicKey, token selection, positive amount, maximum precision of 7 decimal places, available wallet balance check, and valid duration).
  • Refactored Draft Persistence: Updated saveDraft in useStreamForm.ts so pristine forms with empty recipient and amount fields do not save unwanted draft entries when default initial data is set.
  • Unified Template Storage: Standardized template storage across wizard and dashboard using flowfi.stream.templates.v1.

Verification

  • Unit Tests: Executed full Vitest test suite (39 test files, 367 tests passing, 0 failing).
  • Linting: Passed npm run lint across the frontend workspace with 0 errors.

Closes #1263

emarkees and others added 3 commits August 31, 2026 11:31
…ith full test coverage and integrate into all creation entry points.
- Remove TypeScript syntax (type import, satisfies) from .mjs file
- Rename unused resetForm destructure to _resetForm
@K1NGD4VID
K1NGD4VID merged commit edf6085 into LabsCrypt:main Sep 1, 2026
11 checks passed
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.

[Audit] Three divergent implementations of "create a stream"

3 participants