Skip to content

feat: implement preflight balance checks#162

Open
Majormaxx wants to merge 1 commit intoGildado:mainfrom
Majormaxx:feature/issue-152-preflight-checks
Open

feat: implement preflight balance checks#162
Majormaxx wants to merge 1 commit intoGildado:mainfrom
Majormaxx:feature/issue-152-preflight-checks

Conversation

@Majormaxx
Copy link

@Majormaxx Majormaxx commented Feb 25, 2026

Summary

Implements the Preflight Balance Check Service as specified in Issue #152. Introduces a validation layer that runs before the existing transaction simulation step, catching account-level issues early and providing clear, actionable feedback to the admin.

Problem

Previously, payroll batch submissions went straight to Horizon simulation without first verifying that the organization has adequate XLM to cover fees or that employee destination accounts exist with proper trustlines. This resulted in opaque simulation failures that were difficult for admins to diagnose.

Changes

File Action Description
frontend/src/services/stellarValidation.ts NEW Validation service that checks org XLM balance against estimated fees, verifies employee account existence on-chain via Horizon loadAccount, and confirms non-XLM trustlines.
frontend/src/hooks/useFeeEstimation.ts MODIFIED Extended with validatePreflight() wrapper that estimates batch fees and invokes the validation service in a single call.
frontend/src/pages/PayrollScheduler.tsx MODIFIED Integrated preflight checks into the handleInitialize flow. Validation errors now block simulation and surface via the new panel. Added an employee wallet address input field.
frontend/src/components/PreflightReportPanel.tsx NEW Dedicated error panel that renders org-level and per-employee validation failures with a CSV export button and a retry action.

Acceptance Criteria

  • Organization wallet XLM balance verified against estimated fee budget
  • Employee destination account existence checked on-chain
  • Non-XLM asset trustline validation for each employee
  • Per-employee error breakdown surfaced in the UI
  • CSV download of failed preflight checks
  • Retry button to re-run validation after corrections

Testing

  • npx tsc --noEmit passes with zero errors
  • All existing tests unaffected (no breaking changes to public APIs)

Closes #152.

@Wilfred007
Copy link
Collaborator

@Majormaxx check out the conflicts and resolve so I can merge

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.

#079: Preflight Balance Check Service

2 participants