feat: centralize Zod validation layer and refactor Freighter wallet integration#144
Merged
Merged
Conversation
…tion Resolves Lumina-eX#101 and Lumina-eX#125 - Add lib/validations/index.ts with centralized Zod schemas for Project, Milestone (create + update), User (profile, auth), and Wallet (address, signature, transaction) covering all backend routes - Update POST /api/milestones and PATCH /api/milestones/[id] to use CreateMilestoneSchema / UpdateMilestoneSchema with structured field errors instead of manual ad-hoc checks - Add lib/hooks/use-freighter.ts as a reusable hook re-exporting useStellarWallet, helpers, and types from the wallet provider - Refactor WalletConnect component to consume the global StellarWalletProvider context via useFreighter instead of managing duplicate local state; adds wrong-network UI feedback Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
@patopatrish 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! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Resolves #101 and #125
lib/validations/index.ts) covering all four scopes:Project,Milestone(create + update),User(profile, auth inputs, roles), andWallet(address regex, signature, transaction payload)POST /api/milestones,PATCH /api/milestones/[id]) updated to useCreateMilestoneSchema/UpdateMilestoneSchemawith structuredfieldErrorsresponses instead of manual ad-hoc checksuseFreighterhook added atlib/hooks/use-freighter.ts— re-exportsuseStellarWallet, helpers (truncateStellarAddress,networkLabel), and types from the wallet provider for consistent usage across the appWalletConnectcomponent refactored to consume the globalStellarWalletProvidercontext viauseFreighterinstead of duplicating local state — eliminates the redundancy and adds wrong-network UI feedback inlineIssues Closed
Test plan
POST /api/milestoneswith missing/invalid fields returns422withfieldErrorsPATCH /api/milestones/:idwith invalidamount(negative) returns422WalletConnectbutton shows "Connect Wallet", triggers Freighter popup, displays truncated address on successuseFreighterfromlib/hooks/use-freighterresolves correctly🤖 Generated with Claude Code