import { Hono } from 'hono'; import { type ImageResponseOptions } from 'hono-og'; import type { HonoOptions } from 'hono/hono-base'; import type { Schema } from 'hono/types'; import type { Env } from './types/env.js'; import type { FrameImageAspectRatio, FrameResponse } from './types/frame.js'; import type { Hub } from './types/hub.js'; import type { HandlerInterface, MiddlewareHandlerInterface } from './types/routes.js'; export type FrogConstructorParameters = Pick & { /** * The base path for assets. * * @example '/' (commonly for Vercel Serverless Functions) */ assetsPath?: basePath | string | undefined; /** * The base path for the server instance. * * @example '/api' (commonly for Vercel Serverless Functions) */ basePath?: basePath | string | undefined; /** * Options for built-in devtools. */ dev?: { /** * Enables built-in devtools * * @default true */ enabled?: boolean | undefined; /** Custom app fid to auth with. */ appFid?: number | undefined; /** Custom app mnemonic to auth with. */ appMnemonic?: string | undefined; } | undefined; /** * HTTP response headers. */ headers?: Record | undefined; /** * Options to forward to the `Hono` instance. */ honoOptions?: HonoOptions | undefined; /** * @deprecated Use `hub` instead. * * Farcaster Hub API URL. */ hubApiUrl?: string | undefined; /** * Farcaster Hub API configuration. */ hub?: Hub | undefined; /** * Default image options. * * @see https://vercel.com/docs/functions/og-image-generation/og-image-api * @see https://vercel.com/docs/functions/og-image-generation/og-image-examples#using-a-custom-font * * @example * { width: 1200, height: 630 } * * @example * async () => { * const fontData = await fetch( * new URL('./assets/inter.ttf', import.meta.url), * ).then((res) => res.arrayBuffer()); * * return { fonts: [{ name: 'Inter', data: fontData, style: 'normal'}] } * } */ imageOptions?: ImageResponseOptions | (() => Promise) | undefined; /** * Default image aspect ratio. * * @default '1.91:1' */ imageAspectRatio?: FrameImageAspectRatio | undefined; /** * Initial state for the frames. * * @example * ```ts * initialState: { * index: 0, * todos: [], * } * ``` */ initialState?: _state | undefined; /** * Key used to sign secret data. * * It is used for: * - Signing frame state, and * - Signing auth session cookies in the devtools. * * It's strongly recommended to add a strong secret key before deploying to production. * * @example * '1zN3Uvl5QQd7OprLfp83IU96W6ip6KNPQ+l0MECPIZh8FBLYKQ+mPXE1CTxfwXGz' */ secret?: string | undefined; /** * Whether or not to verify frame data via the Farcaster Hub's `validateMessage` API. * * - When `true`, the frame will go through verification and throw an error if it fails. * - When `"silent"`, the frame will go through verification, but not throw an error if it fails. * Instead, the frame will receive `verified: false` in its context. * - When `false`, the frame will not go through verification. * * @default true. */ verify?: boolean | 'silent' | undefined; }; export type RouteOptions = Pick & { fonts?: ImageResponseOptions['fonts'] | (() => Promise); }; /** * A Frog instance. * * @param parameters - {@link FrogConstructorParameters} * @returns instance. {@link Frog} * * @example * ``` * import { Frog } from 'frog' * * const app = new Frog() * * app.frame('/', (c) => { * const { buttonValue, inputText, status } = c * const fruit = inputText || buttonValue * return c.res({ * image: ( *
* {fruit ? `You selected: ${fruit}` : 'Welcome!'} *
* ), * intents: [ * , * , * , * ] * }) * }) * ``` */ export declare class FrogBase { _initialState: env['State']; /** Path for assets. */ assetsPath: string; /** Base path of the server instance. */ basePath: string; /** URL to redirect to when the user is coming to the page via a browser. */ browserLocation: string | undefined; dev: FrogConstructorParameters['dev'] | undefined; headers: FrogConstructorParameters['headers'] | undefined; /** Hono instance. */ hono: Hono; /** Farcaster Hub API URL. */ hubApiUrl: string | undefined; /** Farcaster Hub API config. */ hub: Hub | undefined; /** Image aspect ratio. */ imageAspectRatio: FrameImageAspectRatio; /** Image options. */ imageOptions: ImageResponseOptions | (() => Promise) | undefined; fetch: Hono['fetch']; get: Hono['get']; post: Hono['post']; /** Key used to sign secret data. */ secret: FrogConstructorParameters['secret'] | undefined; /** Whether or not frames should be verified. */ verify: FrogConstructorParameters['verify']; constructor({ assetsPath, basePath, browserLocation, dev, headers, honoOptions, hubApiUrl, hub, imageAspectRatio, imageOptions, initialState, secret, verify, }?: FrogConstructorParameters); frame: HandlerInterface; route(path: subPath, frog: FrogBase): this; transaction: HandlerInterface; use: MiddlewareHandlerInterface; } //# sourceMappingURL=frog-base.d.ts.map