import { getFrameMetadata as getFrameMetadata_ } from '../utils/getFrameMetadata.js' /** * Extracts frame metadata from a given URL, designed to be used with Next.js' `generateMetadata` export function. * * @example * // app/page.tsx * import { getFrameMetadata } from 'frog' * import type { Metadata } from 'next' * * export async function generateMetadata(): Promise { * const frameMetadata = await getFrameMetadata(`https://myframe.com/api`) * return { * other: frameMetadata, * } * } */ export async function getFrameMetadata( url: string, ): Promise> { const metadata = await getFrameMetadata_(url).catch(() => {}) if (!metadata) return {} const result: Record = {} for (const { property, content } of metadata) result[property] = content return result }