MiniKitProvider Setup
The MiniKitProvider wraps your app and provides MiniKit context to all child components. It configures wagmi, react-query, and the Farcaster connector automatically.app/providers.tsx
The provider configures wagmi and react-query and uses the Farcaster connector when available.
Provider Configuration
Required Props
Prop | Type | Description |
---|---|---|
apiKey | string | Your OnchainKit API key from Coinbase Developer Platform |
chain | Chain | The blockchain network (typically base ) |
Optional Configuration
Property | Type | Description |
---|---|---|
config.appearance.mode | ’auto’ | ‘light’ | ‘dark’ | Theme mode for UI components |
config.appearance.theme | string | Theme name for styling |
config.appearance.name | string | App name displayed in UI |
config.appearance.logo | string | Logo URL for branding |
Frame Initialization
Initialize MiniKit in your main component to signal frame readiness:app/App.tsx
useMiniKit Hook
TheuseMiniKit
hook provides access to frame state and user context:
any-component.tsx
Context Properties
Property | Type | Description |
---|---|---|
context.user.fid | string | Farcaster ID of the current user |
context.client.added | boolean | Whether user has saved the Mini App |
context.location | string | Where the Mini App was launched from |
Context data can be spoofed and should not be used for authentication. Use
useAuthenticate
for secure user verification.