mirror of
https://github.com/neynarxyz/create-farcaster-mini-app.git
synced 2025-11-16 08:08:56 -05:00
63 lines
1.6 KiB
TypeScript
63 lines
1.6 KiB
TypeScript
import { type ClassValue, clsx } from 'clsx';
|
|
import { twMerge } from 'tailwind-merge';
|
|
import { type Manifest } from '@farcaster/miniapp-node';
|
|
import {
|
|
APP_BUTTON_TEXT,
|
|
APP_DESCRIPTION,
|
|
APP_ICON_URL,
|
|
APP_NAME,
|
|
APP_OG_IMAGE_URL,
|
|
APP_PRIMARY_CATEGORY,
|
|
APP_SPLASH_BACKGROUND_COLOR,
|
|
APP_SPLASH_URL,
|
|
APP_TAGS,
|
|
APP_URL,
|
|
APP_WEBHOOK_URL,
|
|
APP_ACCOUNT_ASSOCIATION,
|
|
} from './constants';
|
|
|
|
export function cn(...inputs: ClassValue[]) {
|
|
return twMerge(clsx(inputs));
|
|
}
|
|
|
|
export function getMiniAppEmbedMetadata(ogImageUrl?: string) {
|
|
return {
|
|
version: 'next',
|
|
imageUrl: ogImageUrl ?? APP_OG_IMAGE_URL,
|
|
button: {
|
|
title: APP_BUTTON_TEXT,
|
|
action: {
|
|
type: 'launch_frame',
|
|
name: APP_NAME,
|
|
url: APP_URL,
|
|
splashImageUrl: APP_SPLASH_URL,
|
|
iconUrl: APP_ICON_URL,
|
|
splashBackgroundColor: APP_SPLASH_BACKGROUND_COLOR,
|
|
description: APP_DESCRIPTION,
|
|
primaryCategory: APP_PRIMARY_CATEGORY,
|
|
tags: APP_TAGS,
|
|
},
|
|
},
|
|
};
|
|
}
|
|
|
|
export async function getFarcasterDomainManifest(): Promise<Manifest> {
|
|
return {
|
|
accountAssociation: APP_ACCOUNT_ASSOCIATION,
|
|
miniapp: {
|
|
version: '1',
|
|
name: APP_NAME ?? 'Neynar Starter Kit',
|
|
iconUrl: APP_ICON_URL,
|
|
homeUrl: APP_URL,
|
|
imageUrl: APP_OG_IMAGE_URL,
|
|
buttonTitle: APP_BUTTON_TEXT ?? 'Launch Mini App',
|
|
splashImageUrl: APP_SPLASH_URL,
|
|
splashBackgroundColor: APP_SPLASH_BACKGROUND_COLOR,
|
|
webhookUrl: APP_WEBHOOK_URL,
|
|
description: APP_DESCRIPTION,
|
|
primaryCategory: APP_PRIMARY_CATEGORY,
|
|
tags: APP_TAGS,
|
|
},
|
|
};
|
|
}
|