feat(market): basic page + submit
This commit is contained in:
@@ -7,7 +7,9 @@ import type {
|
||||
SubmissionFile,
|
||||
UserInfo,
|
||||
TournamentSubmissions,
|
||||
TournamentPuzzleResults
|
||||
TournamentPuzzleResults,
|
||||
Market,
|
||||
UserBet
|
||||
} from '../types'
|
||||
|
||||
// API Configuration
|
||||
@@ -215,6 +217,38 @@ export class ApiService {
|
||||
async getUserInfo(): Promise<ApiResponse<UserInfo>> {
|
||||
return this.request<UserInfo>('/user')
|
||||
}
|
||||
|
||||
// Market endpoints
|
||||
async getMarkets(): Promise<ApiResponse<Market[]>> {
|
||||
return this.request<Market[]>('/market/')
|
||||
}
|
||||
|
||||
async placeBet(marketUuid: string, betData: {
|
||||
option_uuid: string
|
||||
amount: number
|
||||
}): Promise<ApiResponse<UserBet>> {
|
||||
return this.request<UserBet>(`/market/${marketUuid}/bets`, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(betData),
|
||||
})
|
||||
}
|
||||
|
||||
async getUserBets(): Promise<ApiResponse<UserBet[]>> {
|
||||
return this.request<UserBet[]>('/market/user/bets')
|
||||
}
|
||||
|
||||
async closeMarket(marketUuid: string): Promise<ApiResponse<{ status: string }>> {
|
||||
return this.request<{ status: string }>(`/market/${marketUuid}/actions/close`, {
|
||||
method: 'POST',
|
||||
})
|
||||
}
|
||||
|
||||
async resolveMarket(marketUuid: string, winningOptionUuid: string): Promise<ApiResponse<Market>> {
|
||||
return this.request<Market>(`/market/${marketUuid}/actions/resolve`, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({ winning_option_uuid: winningOptionUuid }),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// Singleton instance
|
||||
|
||||
Reference in New Issue
Block a user