← Index
Source: docs/issues/issue-65-migrate-create-market-page-to-use-unified-api-admin-create-m.md (auto-generated by scripts/generate-docs-html.mjs — edit the .md, not this file)

Migrate /create-market page to use unified /api/admin/create-market endpoint

Issue #65 | State: OPEN | Created: 2026-01-19T09:08:19Z

Assignees: linked0

Updated: 2026-01-19T09:08:30Z | Closed: N/A


Summary

Migrate the frontend /create-market page from the current two-step flow to use the
unified /api/admin/create-market endpoint.

Current Flow

Frontend → MetaMask (user signs tx) → Contract.createBinaryMarket()
Frontend → POST /api/markets/grouped (DB only)

Problems:

Proposed Flow

Frontend → POST /api/admin/create-market → Server handles contract + DB

Benefits:

Tasks

API Reference

Endpoint: POST /api/admin/create-market

Request:

{                                                                                        
  "title": "Will BTC reach $100k?",                                                      
  "description": "Binary market for BTC price prediction",                               
  "category": "Crypto",                                                                  
  "endTimeMinutes": 60,                                                                  
  "resolutionTimeMinutes": 120                                                           
}                                                                                        
                                                                                         
Response:                                                                                
{                                                                                        
  "success": true,                                                                       
  "market": {                                                                            
    "id": "...",                                                                         
    "conditionId": "0x...",                                                              
    "transactionHash": "0x..."                                                           
  },                                                                                     
  "outcomes": {                                                                          
    "yes": { "id": "...", "tokenId": "..." },                                            
    "no": { "id": "...", "tokenId": "..." }                                              
  }                                                                                      
}                                                                                        
                                                                                         
Related                                                                                  
                                                                                         
- Design doc: docs/task/design/e2e-test-address-flow.md