[#26] Donation flow on story page#74
Conversation
Fixes #26 - P5-4a: New DonateWidget component — amount input, PLOT_TOKEN approval, StoryFactory.donate() call, donation indexer trigger - Full tx state UI: approving → confirming → pending → indexing → done - All addresses from lib/contracts/constants.ts - Placed after trading widget on story page Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
project7-interns
left a comment
There was a problem hiding this comment.
LGTM. Clean donation widget — approval flow correctly targets PLOT_TOKEN → STORY_FACTORY, contract addresses from constants.ts, complete tx state machine with indexer trigger.
Minor note (non-blocking): if the indexer POST at line 80 fails after a successful on-chain donation, the catch block shows "error" state even though the donation was recorded on-chain. Consider catching indexer errors separately to show a softer "donation succeeded but indexing failed" message in a follow-up.
Approved.
project7-interns
left a comment
There was a problem hiding this comment.
Verdict: REQUEST CHANGES
Summary
The donate transaction flow is mostly in place, but the post-transaction indexing step is treated as successful even when the donation indexer returns an error.
Findings
- [medium]
DonateWidgetalways advances todoneafter calling/api/index/donationwithout checkingres.okor surfacing any failure. If the transaction succeeds but indexing fails (receipt fetch error, decode failure, Supabase error, etc.), the UI still reports success even though the donation will not appear in the reader dashboard as required by the ticket.- File:
src/components/DonateWidget.tsx:73 - Suggestion: Check the response from
/api/index/donationand treat non-2xx responses as an error or at least a distinct partial-success state so the user isn't told indexing succeeded when it didn't.
- File:
Decision
Requesting changes because the current UI can falsely report a completed donation flow while the indexing step has actually failed.
Shows informative error when on-chain donation succeeds but indexing fails, rather than showing a false success state. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
project7-interns
left a comment
There was a problem hiding this comment.
LGTM. Indexer response now properly checked — informative error message distinguishes on-chain success from indexing failure. Approved.
project7-interns
left a comment
There was a problem hiding this comment.
Verdict: APPROVE
Summary
The donation flow now handles the on-chain tx and post-tx indexing step correctly, including an explicit error path when indexing fails after a successful donation. The PR matches issue #26 and lint-and-typecheck is passing.
Findings
- none
Decision
Approving because the story-page donation widget now presents a correct user flow for approval, donation submission, and indexer feedback.
Summary
DonateWidgetcomponent — amount input, PLOT_TOKEN approval check,StoryFactory.donate()call, donation indexer triggerlib/contracts/constants.ts, reserve label adapts to testnet/mainnetFixes #26
Test plan
npm run lintandnpm run typecheckpass🤖 Generated with Claude Code