Skip to content

feat: Implement member contribution modal with full Soroban transaction flow - #35

Open
derekliutao-cmd wants to merge 1 commit into
coopfinance:mainfrom
derekliutao-cmd:feat/contribute-modal
Open

feat: Implement member contribution modal with full Soroban transaction flow#35
derekliutao-cmd wants to merge 1 commit into
coopfinance:mainfrom
derekliutao-cmd:feat/contribute-modal

Conversation

@derekliutao-cmd

Copy link
Copy Markdown
Contributor

Summary

Closes #12

Implements src/components/groups/contribute-modal.tsx — the full member contribution flow with real Soroban transaction submission.

Changes

src/components/groups/contribute-modal.tsx (new file, 394 lines):

Transaction Flow

  1. Amount input (USDC, validated against group.rules.minContribution)
  2. Period selector (auto-populated with current cycle YYYY-QN, editable)
  3. Wallet balance displayed before submitting
  4. On submit:
    • Builds Soroban transaction calling treasury.contribute(member, amount, period)
    • Simulates transaction first (catches errors before signing)
    • Signs with useWallet().signTransaction()
    • Submits via SorobanRpc.Server.sendTransaction()
    • Polls for transaction result (up to 30 attempts × 3s)

Transaction States

  • idle → Form editable, submit enabled
  • signing → Waiting for wallet signature, form disabled
  • pending → Transaction submitted, polling for confirmation
  • success → Tx hash + Stellar Explorer link shown, queries invalidated
  • error → Error message + Try Again button

Acceptance Criteria

  • Full Soroban transaction built correctly (not simulated — actually submitted)
  • Wallet balance displayed before submitting
  • Amount validated against group minimum contribution
  • All 4 transaction states handled: idle / signing / pending / success / error
  • Tx hash displayed on success with explorer link
  • Group balance and member history refresh after success (queryClient.invalidateQueries)

Error Handling

  • Simulation failures
  • Wallet rejection (rejected/denied/cancelled)
  • Network errors
  • On-chain transaction failures
  • Confirmation timeout

Uses existing dependencies (@radix-ui/react-dialog, @stellar/stellar-sdk, @tanstack/react-query, lucide-react).

@derekliutao-cmd

Copy link
Copy Markdown
Contributor Author

Submitted PR #35 with full Soroban transaction flow. All acceptance criteria met. Happy to address any feedback!

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.

[Frontend] Implement member contribution form on the group detail page

1 participant