# Watchee MiniKit SDK Documentation for LLMs Watchee MiniKit is the SDK for building Mini Apps on the Watchee TV platform. It bridges your web application with native Watchee functionality, including wallet authentication (Aptos), payments, and social features. ## Installation npm install watchee-minikit ## Usage import { minikit } from 'watchee-minikit'; ## Core API Reference ### Wallet & Authentication - `minikit.walletAuth()` - **Returns**: `Promise` ({ address: string, publicKey: string }) - **Description**: Connects to the user's Watchee wallet. - `minikit.signMessage(message: string | { message: string, nonce: string })` - **Returns**: `Promise<{ signature: string, full_message: string }>` - **Description**: Signs a message with the user's wallet key. - `minikit.sendTransaction(payload: any, options?: any)` - **Returns**: `Promise<{ signature: string, transaction_hash: string }>` - **Description**: Submits an Aptos transaction payload. ### Payments - `minikit.pay(details: PaymentDetails)` - **Returns**: `Promise` - **Description**: Requests a payment from the user. - **Input**: `PaymentDetails { amount: number, currency: string, recipient: string, reference?: string }` ### Content & Social - `minikit.publishContent(data: PublishContentData)` - **Returns**: `Promise` - **Description**: Publishes content to Watchee. - `minikit.share(content: ShareContent)` - **Description**: Opens native share sheet. - `minikit.hapticFeedback(type: 'success' | 'warning' | 'error' | 'light' | 'medium' | 'heavy' | 'selection')` - **Description**: Triggers device haptic feedback. ### User Data - `minikit.getProfile()` - **Returns**: `Promise` (User profile data) - `minikit.getOwnedNFTs(options?: any)` - **Returns**: `Promise` - `minikit.trackEvent(event: { name: string, data?: any })` - **Description**: Sends analytics event. ## Types interface AptosAccount { address: string; publicKey: string; network?: Network; } interface PaymentDetails { amount: number; currency: string; // e.g. 'APT', 'USD' recipient: string; // Wallet address reference?: string; } interface PublishContentData { title: string; description?: string; mediaUrl: string; thumbnailUrl?: string; metadata?: Record; } interface ShareContent { message?: string; url?: string; title?: string; } type HapticFeedbackType = 'success' | 'warning' | 'error' | 'light' | 'medium' | 'heavy'; ## Example: Authentication Flow ```typescript const connectWallet = async () => { try { const account = await minikit.walletAuth(); console.log('Connected:', account.address); // Verify ownership const signRes = await minikit.signMessage("Verify Login"); console.log('Signature:', signRes.signature); } catch (error) { console.error('Auth failed:', error); } }; ``` ## Example: Payment Flow ```typescript const handlePayment = async () => { try { const result = await minikit.pay({ amount: 100, // Amount in lowest denomination usually, depending on currency logic currency: 'APT', recipient: '0xRecipientAddress...' }); console.log('Payment success:', result); } catch (error) { console.error('Payment failed:', error); } }; ``` ## Environment The SDK throws an error if not running within the Watchee App environment (`window.WatcheeSDK` must be present). Ensure your app handles this case or provides a mock for development outside the app. ## Template A full feature-complete template is available at `packages/minikit-template`. Refer to `src/app/demos/` for comprehensive usage examples of all features.