|
1 |
| -import { INFO } from "@/constants/endpoints"; |
| 1 | +import { ADMIN_QUOTE_ACCEPTED, ADMIN_QUOTE_BY_ID, ADMIN_QUOTE_PENDING, INFO } from "@/constants/endpoints"; |
2 | 2 | import { apiFetch } from "@/utils/api";
|
3 | 3 |
|
4 | 4 | export interface InfoResponse {
|
@@ -29,3 +29,52 @@ export async function fetchInfo(): Promise<InfoResponse> {
|
29 | 29 | },
|
30 | 30 | })
|
31 | 31 | }
|
| 32 | + |
| 33 | + |
| 34 | +interface QuotePending { |
| 35 | + id: string |
| 36 | + bill: string |
| 37 | + endorser: string |
| 38 | + submitted: number |
| 39 | + suggested_expiration: number |
| 40 | +} |
| 41 | +interface QuoteAccepted { |
| 42 | + id: string |
| 43 | + bill: string |
| 44 | + endorser: string |
| 45 | + ttl: number |
| 46 | + signatures: unknown[] |
| 47 | +} |
| 48 | +interface QuoteDeclined { |
| 49 | + id: string |
| 50 | + bill: string |
| 51 | + endorser: string |
| 52 | +} |
| 53 | + |
| 54 | +export type QuoteInfoReply = QuotePending | QuoteAccepted | QuoteDeclined |
| 55 | + |
| 56 | +export interface QuoteListResponse { |
| 57 | + quotes: string[] |
| 58 | +} |
| 59 | + |
| 60 | +export async function fetchAdminQuoteById(id: string): Promise<QuoteInfoReply> { |
| 61 | + return apiFetch<QuoteInfoReply>(ADMIN_QUOTE_BY_ID.replace(":id", id), { |
| 62 | + headers: { |
| 63 | + "Content-Type": "application/json", |
| 64 | + }, |
| 65 | + }) |
| 66 | +} |
| 67 | +export async function fetchAdminQuotePending(): Promise<QuoteListResponse> { |
| 68 | + return apiFetch<QuoteListResponse>(ADMIN_QUOTE_PENDING, { |
| 69 | + headers: { |
| 70 | + "Content-Type": "application/json", |
| 71 | + }, |
| 72 | + }) |
| 73 | +} |
| 74 | +export async function fetchAdminQuoteAccepted(): Promise<QuoteListResponse> { |
| 75 | + return apiFetch<QuoteListResponse>(ADMIN_QUOTE_ACCEPTED, { |
| 76 | + headers: { |
| 77 | + "Content-Type": "application/json", |
| 78 | + }, |
| 79 | + }) |
| 80 | +} |
0 commit comments