export type GetApiApiRewardsEpochEpochNumberArgs = {epochNumber: number, hash: string}; export type GetApiApiRewardsEpochEpochNumberOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Get list reward of an epoch * * GET /api/rewards/epoch/{epochNumber} */ export const getApiApiRewardsEpochEpochNumber = async (args: GetApiApiRewardsEpochEpochNumberArgs, options: GetApiApiRewardsEpochEpochNumberOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() const url = `${baseUrl.replace(/\/+$/, '')}/api/rewards/epoch/${encodeURIComponent(String(args.epochNumber))}${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 };