mirror of
https://github.com/neynarxyz/create-farcaster-mini-app.git
synced 2025-12-11 11:52:35 -05:00
Merge branch 'main' into veganbeef/deploy-script-update
This commit is contained in:
@@ -2,11 +2,11 @@ import { type AccountAssociation } from '@farcaster/miniapp-node';
|
||||
|
||||
/**
|
||||
* Application constants and configuration values.
|
||||
*
|
||||
*
|
||||
* This file contains all the configuration constants used throughout the mini app.
|
||||
* These values are either sourced from environment variables or hardcoded and provide
|
||||
* configuration for the app's appearance, behavior, and integration settings.
|
||||
*
|
||||
*
|
||||
* NOTE: This file is automatically updated by the init script.
|
||||
* Manual changes may be overwritten during project initialization.
|
||||
*/
|
||||
@@ -84,7 +84,7 @@ export const APP_BUTTON_TEXT: string = 'Launch NSK';
|
||||
// --- Integration Configuration ---
|
||||
/**
|
||||
* Webhook URL for receiving events from Neynar.
|
||||
*
|
||||
*
|
||||
* If Neynar API key and client ID are configured, uses the official
|
||||
* Neynar webhook endpoint. Otherwise, falls back to a local webhook
|
||||
* endpoint for development and testing.
|
||||
@@ -95,7 +95,7 @@ export const APP_WEBHOOK_URL: string = process.env.NEYNAR_API_KEY && process.env
|
||||
|
||||
/**
|
||||
* Flag to enable/disable wallet functionality.
|
||||
*
|
||||
*
|
||||
* When true, wallet-related components and features are rendered.
|
||||
* When false, wallet functionality is completely hidden from the UI.
|
||||
* Useful for mini apps that don't require wallet integration.
|
||||
@@ -104,9 +104,25 @@ export const USE_WALLET: boolean = true;
|
||||
|
||||
/**
|
||||
* Flag to enable/disable analytics tracking.
|
||||
*
|
||||
*
|
||||
* When true, usage analytics are collected and sent to Neynar.
|
||||
* When false, analytics collection is disabled.
|
||||
* Useful for privacy-conscious users or development environments.
|
||||
*/
|
||||
export const ANALYTICS_ENABLED: boolean = true;
|
||||
|
||||
// PLEASE DO NOT UPDATE THIS
|
||||
export const SIGNED_KEY_REQUEST_VALIDATOR_EIP_712_DOMAIN = {
|
||||
name: 'Farcaster SignedKeyRequestValidator',
|
||||
version: '1',
|
||||
chainId: 10,
|
||||
verifyingContract:
|
||||
'0x00000000fc700472606ed4fa22623acf62c60553' as `0x${string}`,
|
||||
};
|
||||
|
||||
// PLEASE DO NOT UPDATE THIS
|
||||
export const SIGNED_KEY_REQUEST_TYPE = [
|
||||
{ name: 'requestFid', type: 'uint256' },
|
||||
{ name: 'key', type: 'bytes' },
|
||||
{ name: 'deadline', type: 'uint256' },
|
||||
];
|
||||
|
||||
27
src/lib/devices.ts
Normal file
27
src/lib/devices.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
function isAndroid(): boolean {
|
||||
return (
|
||||
typeof navigator !== 'undefined' && /android/i.test(navigator.userAgent)
|
||||
);
|
||||
}
|
||||
|
||||
function isSmallIOS(): boolean {
|
||||
return (
|
||||
typeof navigator !== 'undefined' && /iPhone|iPod/.test(navigator.userAgent)
|
||||
);
|
||||
}
|
||||
|
||||
function isLargeIOS(): boolean {
|
||||
return (
|
||||
typeof navigator !== 'undefined' &&
|
||||
(/iPad/.test(navigator.userAgent) ||
|
||||
(navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1))
|
||||
);
|
||||
}
|
||||
|
||||
function isIOS(): boolean {
|
||||
return isSmallIOS() || isLargeIOS();
|
||||
}
|
||||
|
||||
export function isMobile(): boolean {
|
||||
return isAndroid() || isIOS();
|
||||
}
|
||||
25
src/lib/localStorage.ts
Normal file
25
src/lib/localStorage.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
export function setItem<T>(key: string, value: T) {
|
||||
try {
|
||||
localStorage.setItem(key, JSON.stringify(value));
|
||||
} catch (error) {
|
||||
console.warn('Failed to save item:', error);
|
||||
}
|
||||
}
|
||||
|
||||
export function getItem<T>(key: string): T | null {
|
||||
try {
|
||||
const stored = localStorage.getItem(key);
|
||||
return stored ? JSON.parse(stored) : null;
|
||||
} catch (error) {
|
||||
console.warn('Failed to load item:', error);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
export function removeItem(key: string) {
|
||||
try {
|
||||
localStorage.removeItem(key);
|
||||
} catch (error) {
|
||||
console.warn('Failed to remove item:', error);
|
||||
}
|
||||
}
|
||||
@@ -19,17 +19,6 @@ export function cn(...inputs: ClassValue[]) {
|
||||
return twMerge(clsx(inputs));
|
||||
}
|
||||
|
||||
export function getSecretEnvVars() {
|
||||
const seedPhrase = process.env.SEED_PHRASE;
|
||||
const fid = process.env.FID;
|
||||
|
||||
if (!seedPhrase || !fid) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return { seedPhrase, fid };
|
||||
}
|
||||
|
||||
export function getMiniAppEmbedMetadata(ogImageUrl?: string) {
|
||||
return {
|
||||
version: "next",
|
||||
|
||||
Reference in New Issue
Block a user