export type GetApiV0WalletOptions = {baseUrl: string, apikeyAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get Wallet * * GET /v0/wallet */ export const getApiV0Wallet = async (options: GetApiV0WalletOptions) => { const {baseUrl, fetch: fetchFn = fetch, apikeyAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/json") if (apikeyAuth !== undefined) headers.set("apikey", apikeyAuth) const url = `${baseUrl.replace(/\/+$/, '')}/v0/wallet${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 (await res.json()) as unknown };