export type GetApiV1CalldataParseArgs = {'x-lifi-api-key'?: string | undefined}; export type GetApiV1CalldataParseOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Parse transaction call data (BETA) * * GET /v1/calldata/parse */ export const getApiV1CalldataParse = async (args: GetApiV1CalldataParseArgs, options?: GetApiV1CalldataParseOptions) => { const {baseUrl = "https://li.quest", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args['x-lifi-api-key'] != null) headers.set("x-lifi-api-key", String(args['x-lifi-api-key'])) const url = `${baseUrl.replace(/\/+$/, '')}/v1/calldata/parse${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 };