export type GetApiV1AgentPortfolioProxyPolymarketArgs = {addresses: string, aggregated?: boolean | undefined}; export type GetApiV1AgentPortfolioProxyPolymarketOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Get Polymarket positions for a given address * * GET /v1/agent/portfolio/proxy/polymarket */ export const getApiV1AgentPortfolioProxyPolymarket = async (args: GetApiV1AgentPortfolioProxyPolymarketArgs, options: GetApiV1AgentPortfolioProxyPolymarketOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.addresses != null) query.append("addresses", String(args.addresses)) if (args.aggregated != null) query.append("aggregated", String(args.aggregated)) const url = `${baseUrl.replace(/\/+$/, '')}/v1/agent/portfolio/proxy/polymarket${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 undefined };