export type GetApiApiV1OrdersArgs = {page?: number | undefined, limit?: number | undefined}; export type GetApiApiV1OrdersOptions = {baseUrl?: string | undefined, TradingApiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * List channel-submitted orders * * GET /api/v1/orders * * Also accepts auth: TradingApiNonce, TradingApiTimestamp, TradingApiSignature, ApiChainId, ApiProductType */ export const getApiApiV1Orders = async (args: GetApiApiV1OrdersArgs, options?: GetApiApiV1OrdersOptions) => { 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.page != null) query.append("page", String(args.page)) if (args.limit != null) query.append("limit", String(args.limit)) if (TradingApiKey !== undefined) headers.set("x-api-key", TradingApiKey) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/orders${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return res.blob() };