Skip to content

feat: Implement market detail page and betting flow#812

Merged
GoSTEAN merged 5 commits into
Netwalls:mainfrom
janipauwels-sys:feat/market-detail-and-betting
May 28, 2026
Merged

feat: Implement market detail page and betting flow#812
GoSTEAN merged 5 commits into
Netwalls:mainfrom
janipauwels-sys:feat/market-detail-and-betting

Conversation

@janipauwels-sys
Copy link
Copy Markdown
Contributor

@janipauwels-sys janipauwels-sys commented May 28, 2026

Overview

This PR implements the complete market detail page and betting flow for BOXMEOUT, addressing issues #768, #769, #770, and #771.

Changes

1. usePlaceBet() Hook (#771)

  • Mutation hook for signing and broadcasting place_bet transactions
  • State machine: idle → signing → broadcasting → confirming → success | error
  • Exposes { placeBet, txStatus, txHash, error, reset }
  • Integrates with Freighter wallet via submitBet()
  • Updates app store on transaction status changes

2. BetForm Component (#770)

  • Three outcome buttons: Fighter A / Draw / Fighter B
  • Amount input with min validation (1 XLM minimum)
  • Real-time projected payout calculation
  • Connect Wallet prompt when not connected
  • Disabled state with reason when market is Locked/Resolved/Cancelled
  • Integrates with usePlaceBet() mutation hook
  • Shows TransactionStatus component during/after submission

3. Market Detail Page Supporting Components (#769)

  • FighterCard: Displays fighter name, odds, and pool size
  • OddsDisplay: Shows live odds for all three outcomes
  • PoolBar: Visual representation of pool proportions
  • BetList: Displays recent bets in table format

4. Market Detail Page (#769)

  • Shows two FighterCard components side by side
  • Shows OddsDisplay with live odds for all outcomes
  • Shows PoolBar with pool proportions visualization
  • Shows CountdownTimer to fight start
  • Shows BetForm when market is Open
  • Shows BetList at the bottom with recent bets
  • Polls for updates every 10 seconds via useMarket hook
  • Displays oracle info after market resolution

Acceptance Criteria Met

✅ All 4 issues addressed with separate commits
✅ usePlaceBet() builds transaction XDR, signs with Freighter, submits transaction
✅ State machine properly implemented
✅ BetForm has all required features and validations
✅ Market Detail page shows all required components
✅ Polling for updates every 10 seconds
✅ Frontend builds successfully with no errors

Testing

  • Build verified: npm run build completes successfully
  • All TypeScript types properly defined
  • Components follow existing patterns and conventions
  • Responsive design for mobile and desktop

Files Changed

  • frontend/src/hooks/usePlaceBet.ts - New mutation hook
  • frontend/src/components/bet/BetForm.tsx - New bet form component
  • frontend/src/components/market/FighterCard.tsx - New fighter card component
  • frontend/src/components/market/OddsDisplay.tsx - New odds display component
  • frontend/src/components/market/PoolBar.tsx - New pool visualization component
  • frontend/src/components/bet/BetList.tsx - New bet list component
  • frontend/src/app/markets/[market_id]/MarketDetailContent.tsx - Updated market detail page
  • frontend/src/components/ui/ErrorBoundary.tsx - Added 'use client' directive

Related Issues

Closes #768
Closes #769
Closes #770
Closes #771

- Mutation hook for signing and broadcasting place_bet transactions
- State machine: idle → signing → broadcasting → confirming → success | error
- Exposes { placeBet, txStatus, txHash, error, reset }
- Integrates with Freighter wallet via submitBet()
- Updates app store on transaction status changes
- Three outcome buttons: Fighter A / Draw / Fighter B
- Amount input with min validation (1 XLM minimum)
- Real-time projected payout calculation
- Connect Wallet prompt when not connected
- Disabled state with reason when market is Locked/Resolved/Cancelled
- Integrates with usePlaceBet() mutation hook
- Shows TransactionStatus component during/after submission
- FighterCard: displays fighter name, odds, and pool size
- OddsDisplay: shows live odds for all three outcomes
- PoolBar: visual representation of pool proportions
- BetList: displays recent bets in table format
- Shows two FighterCard components side by side
- Shows OddsDisplay with live odds for all outcomes
- Shows PoolBar with pool proportions visualization
- Shows CountdownTimer to fight start
- Shows BetForm when market is Open
- Shows BetList at the bottom with recent bets
- Polls for updates every 10 seconds via useMarket hook
- Displays oracle info after market resolution
- Remove babel.config.js to let Next.js handle TypeScript compilation
- Add 'use client' directive to ErrorBoundary class component
- Add @stellar/stellar-sdk to dependencies for wallet integration
@GoSTEAN GoSTEAN merged commit 70aa4f5 into Netwalls:main May 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants