export type GetApiPortfolioPointsOptions = {baseUrl?: string | undefined, HmacAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get points breakdown * * GET /portfolio/points */ export const getApiPortfolioPoints = async (options?: GetApiPortfolioPointsOptions) => { const {baseUrl = "https://api.limitless.exchange", fetch: fetchFn = fetch, HmacAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (HmacAuth !== undefined) headers.set("lmts-api-key", HmacAuth) const url = `${baseUrl.replace(/\/+$/, '')}/portfolio/points${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 };