export type DeleteApiApiV1OrdersOrderIdSendArgs = {orderId: string, deadline: number, gasLimit?: number | undefined}; export type DeleteApiApiV1OrdersOrderIdSendOptions = {baseUrl?: string | undefined, TradingApiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Send cancel order transaction through One Click * * DELETE /api/v1/orders/{orderId}/send * * Also accepts auth: TradingApiNonce, TradingApiTimestamp, TradingApiSignature, ApiChainId, ApiProductType */ export const deleteApiApiV1OrdersOrderIdSend = async (args: DeleteApiApiV1OrdersOrderIdSendArgs, options?: DeleteApiApiV1OrdersOrderIdSendOptions) => { const {baseUrl = "https://rwa-api.anchored.finance/rwa/trading", fetch: fetchFn = fetch, TradingApiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "*/*") if (args.deadline != null) query.append("deadline", String(args.deadline)) if (args.gasLimit != null) query.append("gasLimit", String(args.gasLimit)) if (TradingApiKey !== undefined) headers.set("x-api-key", TradingApiKey) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/orders/${encodeURIComponent(String(args.orderId))}/send${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "DELETE", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return res.blob() };