export type CreateApiCronApyArgs = {'X-CRON-API-KEY': string}; export type CreateApiCronApyOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Refresh cash-equivalent reserve APY from Aave and USTB (cron) * * POST /cron/apy */ export const createApiCronApy = async (args: CreateApiCronApyArgs, options: CreateApiCronApyOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args['X-CRON-API-KEY'] != null) headers.set("X-CRON-API-KEY", String(args['X-CRON-API-KEY'])) const url = `${baseUrl.replace(/\/+$/, '')}/cron/apy${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };