export type GetApiValueTransferTokensArgs = {chainIds?: Array | undefined}; export type GetApiValueTransferTokensOptions = {baseUrl: string, bearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * Supported-token universe, cached and per-chain sliced * * GET /value-transfer/tokens */ export const getApiValueTransferTokens = async (args: GetApiValueTransferTokensArgs, options: GetApiValueTransferTokensOptions) => { const {baseUrl, fetch: fetchFn = fetch, bearer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() for (const item of args.chainIds ?? []) query.append("chainIds", String(item)) if (bearer !== undefined) headers.set('authorization', `Bearer ${bearer}`) const url = `${baseUrl.replace(/\/+$/, '')}/value-transfer/tokens${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 };