UNPKG

@moonwell-fi/moonwell-sdk

Version:

TypeScript Interface for Moonwell

16 lines 942 B
/** * Drop-in axios method wrappers with retry built in. * * Use these instead of `axios.get` / `axios.post` for outbound HTTP calls in * action files. The retry policy lives in `./retry.ts`. * * Why a wrapper instead of `retry(() => axios.get(...))` at each callsite? * TypeScript's control-flow narrowing (e.g. after `if (!env.url) return [];`) * doesn't propagate into nested closures, so inline `retry(() => axios.get(env.url))` * makes `env.url` `string | undefined` again. Passing the URL as a function * argument keeps the narrowing intact. */ import { type AxiosRequestConfig, type AxiosResponse } from "axios"; export declare function getWithRetry<T = unknown>(url: string, config?: AxiosRequestConfig): Promise<AxiosResponse<T>>; export declare function postWithRetry<T = unknown, D = unknown>(url: string, data?: D, config?: AxiosRequestConfig<D>): Promise<AxiosResponse<T>>; //# sourceMappingURL=axiosWithRetry.d.ts.map