fix(client): wire FundCampaignModal to real useFundCampaign - #218
Closed
shinzoxD wants to merge 1 commit into
Closed
fix(client): wire FundCampaignModal to real useFundCampaign#218shinzoxD wants to merge 1 commit into
shinzoxD wants to merge 1 commit into
Conversation
Replace mocked campaignService.fundCampaign (setTimeout + Math.random hash) with the ProductionEscrow fund_campaign mutation. Keep client-side validation, require a connected wallet, and parse amounts as bigint contract units. Success no longer invents a fake transaction hash. Closes Cylo-Traders#139
Author
|
Closing this PR. GrantFox assigned #139 to @Mosas2000 after I opened it — I won't compete with the assigned contributor. |
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
FundCampaignModalsubmitted through mockedcampaignService.fundCampaign(setTimeout+Math.randomhash) instead of the real escrow mutation. A user could see "Contribution Successful!" with a fake transaction hash without moving any tokens.This PR:
useFundCampaign()inhooks/contract/useEscrowMutations.tsuseWallet().publicKeyas the investor (drops the hardcodedGDF4...M9XZdefault)validateContribution(zero / negative / exceeds remaining target)bigintcontract units (i128), matching create-campaign / admin formsfundCampaignhelper so it cannot be re-wired by a pagecampaignService.tsin place for validation and ownership-share helpers still used by the modalSuccess no longer invents a fake
0xtransaction hash. Mutation toasts still come fromuseFundCampaign; inline errors usetoUserFacingError.Distinct from:
FundCampaignModalonto soil/leaf tokens; does not wireuseFundCampaign):id)Closes #139
Test plan
useFundCampaignand asserts{ campaignId, investor, amount: 500n }0xtx hashcampaignServicevalidation tests converted to vitest (no fake hash assertions)20 passed.
GrantFox claim already posted. Wallet:
GBVHELLD2JE235Y2NGTDT3MWI3T65ON6SY4N6FBHYVDAQ5FZC2CP5QXH