Skip to content

Fix/transaction idempotency#92

Open
Muyideen-js wants to merge 2 commits into
StepFi-app:mainfrom
Muyideen-js:fix/transaction-idempotency
Open

Fix/transaction idempotency#92
Muyideen-js wants to merge 2 commits into
StepFi-app:mainfrom
Muyideen-js:fix/transaction-idempotency

Conversation

@Muyideen-js

Copy link
Copy Markdown

Closes #26

Summary

Closes #[issue number]

Replace the stub StepDeposit component in the sponsor onboarding wizard with a fully functional deposit flow. Sponsors completing the 4-step onboarding can now actually deposit USDC — amount input with $10 minimum validation, unsigned XDR fetched from the API, signed via Freighter, submitted on-chain, and a success state with a Stellar Expert link. On success, onboarding is marked complete and the sponsor is navigated to the dashboard.

This repo is for the React web app only

This app targets sponsors, vendors, and mentors. It does NOT serve learners. Learner features belong in StepFi-App.

  • Changes are inside src/
  • No Rust, Soroban, or contract code
  • No React Native or Expo-specific code
  • No hardcoded hex color values (Tailwind classes only)
  • All icons from lucide-react
  • No API calls directly in page files (uses services/ layer)

Type of change

  • Bug fix
  • New page or component
  • Service layer addition
  • Styling or responsive fix
  • Accessibility improvement
  • Performance improvement

Testing

  • npm run build — 0 errors
  • npm run lint — 0 errors
  • npm test — 36 tests passed, 0 failures
  • Mobile viewport (375px) tested
  • Browser console checked

Context files reviewed

  • context/architecture-context.md
  • context/code-standards.md
  • context/progress-tracker.md updated

What changed

src/pages/SponsorOnboarding.tsx — Replaced the StepDeposit stub (lines 267–316) with a real deposit flow:

Feature Implementation
Amount input Numeric input with $10 minimum validation, inline error messaging (aria-invalid, role="alert")
XDR fetch sponsorsService.deposit(amount) returns UnsignedTransaction<DepositPreview>
Freighter signing Delegated to the existing useTransaction hook which calls @stellar/freighter-api's signTransaction
Submission transactionsService.submit(signedXdr, 'deposit') posts to POST /transactions/submit
Success state Card showing deposit amount, transaction hash, and a clickable Stellar Expert link
Onboarding completion onComplete fires after deposit success → sets onboardingComplete: true → navigates to /sponsors
Error state Inline error card using the same pattern as the Sponsors dashboard
Disconnected state "Connect Freighter Wallet" button with download link + GrantFox fallback

All patterns mirror the existing deposit flow in src/pages/Sponsors.tsxuseTransaction, useToast, invalidatesubtree.pool, and the success card layout.

Acceptance criteria met

  • Deposit amount input with $10 minimum validation
  • Unsigned XDR fetched from API
  • XDR signed via Freighter
  • Signed XDR submitted
  • Success state shown with Stellar Expert link
  • Onboarding marked complete after successful deposit

Files changed

File Change
src/pages/SponsorOnboarding.tsx Replaced StepDeposit stub with full deposit flow (+ 5 new imports)

Add idempotency service with UUID key generation and XDR hash dedup. transactionsService.submit now auto-generates an idempotency key, hashes the signed XDR, checks localStorage for duplicates before calling the API, and stores records with 24h TTL on success. Includes idempotency_key field in the API request body.
@Muyideen-js
Muyideen-js requested a review from EmeditWeb as a code owner July 22, 2026 17:42
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.

core: implement transaction history with Stellar Expert links

1 participant