export type DeleteApiApiV1OrdersOrderIdCalldataArgs = {orderId: string, deadline: number}; export type DeleteApiApiV1OrdersOrderIdCalldataOptions = {baseUrl?: string | undefined, TradingApiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Build cancel order calldata * * DELETE /api/v1/orders/{orderId}/calldata * * Also accepts auth: TradingApiNonce, TradingApiTimestamp, TradingApiSignature, ApiChainId, ApiProductType */ export const deleteApiApiV1OrdersOrderIdCalldata = async (args: DeleteApiApiV1OrdersOrderIdCalldataArgs, options?: DeleteApiApiV1OrdersOrderIdCalldataOptions) => { 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 (TradingApiKey !== undefined) headers.set("x-api-key", TradingApiKey) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/orders/${encodeURIComponent(String(args.orderId))}/calldata${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() };