Skip to content

Commit 8d1fd57

Browse files
committed
chore: add admin quote pending
1 parent 07699f7 commit 8d1fd57

File tree

8 files changed

+131
-424
lines changed

8 files changed

+131
-424
lines changed

src/constants/endpoints.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,20 @@
11
const INFO = "/v1/info"
22
const BALANCES = "/v1/balances"
33

4+
const ADMIN_QUOTE_PENDING = "/v1/admin/credit/quote/pending"
5+
const ADMIN_QUOTE_ACCEPTED = "/v1/admin/credit/quote/accepted"
6+
const ADMIN_QUOTE_BY_ID = "/v1/admin/credit/quote/:id"
7+
8+
const CREDIT_QUOTE = "/v1/credit/mint/quote"
9+
const CREDIT_QUOTES_BY_ID = "/v1/credit/mint/quote/:id"
10+
411
export {
512
INFO,
613
BALANCES,
14+
15+
ADMIN_QUOTE_PENDING,
16+
ADMIN_QUOTE_ACCEPTED,
17+
ADMIN_QUOTE_BY_ID,
18+
CREDIT_QUOTE,
19+
CREDIT_QUOTES_BY_ID,
720
}

src/lib/api.ts

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { INFO } from "@/constants/endpoints";
1+
import { ADMIN_QUOTE_ACCEPTED, ADMIN_QUOTE_BY_ID, ADMIN_QUOTE_PENDING, INFO } from "@/constants/endpoints";
22
import { apiFetch } from "@/utils/api";
33

44
export interface InfoResponse {
@@ -29,3 +29,52 @@ export async function fetchInfo(): Promise<InfoResponse> {
2929
},
3030
})
3131
}
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

Comments
 (0)