export type GetApiAssetRegistryAssetsArgs = {chainIds?: Array | undefined}; export type GetApiAssetRegistryAssetsOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * The active asset catalog * * GET /asset-registry/assets */ export const getApiAssetRegistryAssets = async (args: GetApiAssetRegistryAssetsArgs, options: GetApiAssetRegistryAssetsOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() for (const item of args.chainIds ?? []) query.append("chainIds", String(item)) const url = `${baseUrl.replace(/\/+$/, '')}/asset-registry/assets${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 };