export type GetApiApiV1DeferredSellDebtsArgs = {stockAddress?: string | undefined}; export type GetApiApiV1DeferredSellDebtsOptions = {baseUrl?: string | undefined, TradingApiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * List the authenticated user's outstanding deferred-sell debts * * GET /api/v1/deferred-sell/debts * * Also accepts auth: TradingApiNonce, TradingApiTimestamp, TradingApiSignature, ApiChainId, ApiProductType */ export const getApiApiV1DeferredSellDebts = async (args: GetApiApiV1DeferredSellDebtsArgs, options?: GetApiApiV1DeferredSellDebtsOptions) => { 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.stockAddress != null) query.append("stockAddress", String(args.stockAddress)) if (TradingApiKey !== undefined) headers.set("x-api-key", TradingApiKey) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/deferred-sell/debts${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() };