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:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user