(url: string, body: unknown)
| 277 | // ==================== Internal helpers ==================== |
| 278 | |
| 279 | async function postOrder(url: string, body: unknown): Promise<WalletPushResult> { |
| 280 | const res = await fetch(url, { |
| 281 | method: 'POST', |
| 282 | headers: { 'Content-Type': 'application/json' }, |
| 283 | body: JSON.stringify(body), |
| 284 | }) |
| 285 | if (!res.ok) { |
| 286 | const json = (await res.json().catch(() => ({}))) as OrderErrorResponse |
| 287 | throw new OrderEntryError(res.status, { error: json.error ?? `Request failed (${res.status})`, phase: json.phase }) |
| 288 | } |
| 289 | return res.json() |
| 290 | } |
no test coverage detected