Skip to content

feat: implement preflight balance checks#162

Open
Majormaxx wants to merge 2 commits intoGildado:mainfrom
Majormaxx:feature/issue-152-preflight-checks
Open

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

Conversation

@Majormaxx
Copy link
Copy Markdown

@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
Copy Markdown
Collaborator

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

@drips-wave
Copy link
Copy Markdown

drips-wave bot commented Mar 24, 2026

@Majormaxx 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

@Majormaxx
Copy link
Copy Markdown
Author

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

Done

Saber1Y added a commit to Saber1Y/PayD that referenced this pull request Mar 26, 2026
- Created TransactionPendingOverlay component with pending/success/error states
- Integrated overlay into PayrollScheduler for claimable balance broadcasts
- Integrated overlay into CrossAssetPayment for cross-asset settlements
- Added unit tests for the overlay component
- Overlay is non-blocking with Stellar-themed design and tx hash explorer links

Closes Gildado#162
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