fix: correct Gamma API field names in getMarketOptions (all camelCase)

The Gamma API returns camelCase field names but the code used snake_case,
causing all lookups to return undefined:
  - end_date_iso  → endDate  (full ISO datetime, not date-only endDateIso)
  - game_start_time → removed (field doesn't exist)
  - minimum_tick_size → orderPriceMinTickSize
  - neg_risk      → negRisk
  - condition_id  → conditionId
  - accepting_orders → acceptingOrders

Because endDate was always null, the MIN_MARKET_TIME_LEFT expiry guard
was silently skipped on every buy — allowing buys into expired markets.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
direkturcrypto
2026-02-25 03:49:38 +07:00
parent 59295b08cb
commit 0650cb9ef7
+7 -7
View File
@@ -56,13 +56,13 @@ async function getMarketOptions(tokenId) {
const marketInfo = await fetchMarketByTokenId(tokenId);
if (marketInfo) {
return {
tickSize: String(marketInfo.minimum_tick_size || '0.01'),
negRisk: marketInfo.neg_risk || false,
conditionId: marketInfo.condition_id || '',
question: marketInfo.question || '',
endDateIso: marketInfo.end_date_iso || marketInfo.game_start_time || null,
active: marketInfo.active !== false,
acceptingOrders: marketInfo.accepting_orders !== false,
tickSize: String(marketInfo.orderPriceMinTickSize || '0.01'),
negRisk: marketInfo.negRisk || false,
conditionId: marketInfo.conditionId || '',
question: marketInfo.question || '',
endDateIso: marketInfo.endDate || null,
active: marketInfo.active !== false,
acceptingOrders: marketInfo.acceptingOrders !== false,
};
}
} catch (err) {