Repository navigation
fix(markets): fix create-market route, missing fields, and form schema - #1833
Merged
hman38705 merged 1 commit intoOct 20, 2026
Conversation
solutions-plug#1753) The market creation form was posting to /api/v1/blockchain/markets which did not exist in the backend (causing 404/405), and the request body was missing all fields required by the contract's create_market entrypoint. Changes: - frontend/src/lib/validation/marketForm.ts: extend marketFormSchema with resolutionDeadline, oracleAddress, feedId, maxStalenessSeconds, maxConfidenceBps, tier, parentId, parentOutcomeIdx; add cross-field refinement enforcing resolution_deadline >= close_time + 24h - frontend/src/app/markets/create/page.tsx: add form fields for all new schema fields; fix submission body to send all contract-required params (deadline/resolution_deadline as unix seconds, oracle_config object, tier, native_token address, parent_id, parent_outcome_idx) - frontend/src/lib/api/requestSchemas.ts: add createMarketSchema + CreateMarketBody type for boundary validation of the outgoing body - services/api/src/handlers.rs: add OracleConfigRequest, CreateMarketRequest, CreateMarketResponse structs and create_market handler; handler validates all fields and returns 501 with a clear message explaining that wallet signing (tracked in solutions-plug#77) is required for the full on-chain path - services/api/src/main.rs: register POST /api/v1/blockchain/markets in public_routes so the route exists (no more 404) - services/api/openapi.yaml: document new endpoint and add component schemas - docs/API_SPEC.md: add POST /api/v1/blockchain/markets to public routes table Closes solutions-plug#1753
|
@shemaiahdelia03-cmd Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes issue #1753: the market creation page was posting to
/api/v1/blockchain/markets(nonexistent — 404/405) and the request body was missing all fields required by the contract'screate_marketentrypoint.What was implemented
Backend
POST /api/v1/blockchain/marketsregistered inpublic_routes— the route now exists so callers no longer get 404/405.create_marketinhandlers.rswithOracleConfigRequest,CreateMarketRequest, andCreateMarketResponsestructs. The handler validates all required fields (non-empty strings, deadline in future, resolution deadline ≥ deadline + 24 h, ≥ 2 options) and returns501 Not Implementedwith a clear message explaining that the full on-chain path requires client-side wallet signing (tracked in Features/issue 4 featured markets api #77).CreateMarketRequest,OracleConfigRequest), and response schema (CreateMarketResponse).Frontend
marketFormSchemaextended with all missing fields:resolutionDeadline,oracleAddress,feedId,maxStalenessSeconds,maxConfidenceBps,tier,parentId,parentOutcomeIdx.resolutionDeadlinemust be ≥closeTime + 86400 s, mirroring the on-chain invariant to catch invalid submissions before any gas is spent.page.tsx) updated with accessible fields for all new schema values (labels,aria-invalid,aria-describedby, error spans).deadline/resolution_deadlineas unix timestamps (seconds), the fulloracle_configobject,tier,native_token(mapped from the selected asset address),parent_id, andparent_outcome_idx.requestSchemas.tsupdated withcreateMarketSchemaandCreateMarketBodytype for outgoing body validation.Docs
docs/API_SPEC.mdupdated to listPOST /api/v1/blockchain/marketsin the public routes table with a note about the current 501 status.Testing
The CI checks cover this change. No tests were removed. The existing
market-creation.spec.tse2e suite and unit tests remain intact.Closes #1753