import { type EventsControllerState } from '@reown/appkit-core-react-native'; import { type EventName } from '@reown/appkit-common-react-native'; /** * Hook to subscribe to all AppKit events * * @remarks * This hook provides reactive access to AppKit's event system, allowing you to * monitor all events that occur within the AppKit lifecycle (connections, disconnections, * network changes, etc.). The callback is invoked whenever a new event is emitted. * * @param callback - Optional callback function invoked when any event occurs * * @returns An object containing: * - `data`: The most recent event data * - `timestamp`: The timestamp of the most recent event * * @throws {Error} If used outside of an AppKitProvider * * @example * ```tsx * function MyComponent() { * const { data, timestamp } = useAppKitEvents((event) => { * console.log('Event occurred:', event.data.event); * }); * * return ( * * Last event: {data?.event} * Time: {timestamp} * * ); * } * ``` */ export declare function useAppKitEvents(callback?: (newEvent: EventsControllerState) => void): { data: { readonly type: "track"; readonly event: "MODAL_CREATED"; } | { readonly type: "track"; readonly event: "MODAL_LOADED"; } | { readonly type: "track"; readonly event: "MODAL_OPEN"; readonly properties: { readonly connected: boolean; }; } | { readonly type: "track"; readonly event: "INITIALIZE"; readonly properties: { readonly showWallets?: boolean | undefined; readonly themeMode?: import("@reown/appkit-common-react-native").ThemeMode | undefined; readonly themeVariables?: { readonly accent?: string | undefined; } | undefined; readonly networks: readonly `${string}:${string}`[]; readonly defaultNetwork?: `${string}:${string}` | undefined; readonly metadata?: { readonly name: string; readonly description: string; readonly url: string; readonly icons: readonly string[]; readonly redirect?: { readonly native?: string | undefined; readonly universal?: string | undefined; readonly linkMode?: boolean | undefined; } | undefined; } | undefined; readonly enableAnalytics?: boolean | undefined; readonly features?: { readonly swaps?: boolean | undefined; readonly onramp?: boolean | undefined; readonly showWallets?: boolean | undefined; readonly socials?: false | readonly import("@reown/appkit-common-react-native").SocialProvider[] | undefined; } | undefined; readonly adapters?: readonly string[] | undefined; readonly extraConnectors?: readonly string[] | undefined; readonly siwx?: boolean | undefined; }; } | { readonly type: "track"; readonly event: "MODAL_CLOSE"; readonly properties: { readonly connected: boolean; }; } | { readonly type: "track"; readonly event: "CLICK_ALL_WALLETS"; } | { readonly type: "track"; readonly event: "CLICK_NETWORKS"; } | { readonly type: "track"; readonly event: "SWITCH_NETWORK"; readonly properties: { readonly network: `${string}:${string}`; }; } | { readonly type: "track"; readonly event: "SELECT_WALLET"; readonly properties: { readonly name: string; readonly platform?: import("@reown/appkit-common-react-native").Platform | undefined; readonly explorerId?: string | undefined; readonly walletRank?: number | undefined; readonly displayIndex?: number | undefined; readonly view?: "AllWallets" | "Connect" | undefined; }; } | { readonly type: "track"; readonly event: "CONNECT_SUCCESS"; readonly address?: string | undefined; readonly properties: { readonly name: string; readonly caipNetworkId?: `${string}:${string}` | undefined; readonly method?: import("@reown/appkit-common-react-native").Platform | undefined; readonly explorerId?: string | undefined; readonly reconnect?: boolean | undefined; }; } | { readonly type: "track"; readonly event: "CONNECT_ERROR"; readonly properties: { readonly message: string; }; } | { readonly type: "track"; readonly address?: string | undefined; readonly event: "USER_REJECTED"; readonly properties: { readonly message: string; }; } | { readonly type: "track"; readonly event: "DISCONNECT_SUCCESS"; readonly properties: { readonly namespace?: import("@reown/appkit-common-react-native").ChainNamespace | undefined; }; } | { readonly type: "track"; readonly event: "DISCONNECT_ERROR"; } | { readonly type: "track"; readonly event: "CLICK_WALLET_HELP"; } | { readonly type: "track"; readonly event: "CLICK_NETWORK_HELP"; } | { readonly type: "track"; readonly event: "CLICK_GET_WALLET_HELP"; } | { readonly type: "track"; readonly event: "GET_WALLET"; readonly properties: { readonly name: string; readonly explorerId?: string | undefined; readonly link?: string | undefined; readonly linkType?: "appstore" | "playstore" | undefined; readonly walletRank?: number | undefined; }; } | { readonly type: "track"; readonly event: "EMAIL_LOGIN_SELECTED"; } | { readonly type: "track"; readonly event: "EMAIL_VERIFICATION_CODE_PASS"; } | { readonly type: "track"; readonly event: "EMAIL_VERIFICATION_CODE_FAIL"; } | { readonly type: "track"; readonly event: "EMAIL_EDIT"; } | { readonly type: "track"; readonly event: "EMAIL_EDIT_COMPLETE"; } | { readonly type: "track"; readonly event: "EMAIL_UPGRADE_FROM_MODAL"; } | { readonly type: "track"; readonly address?: string | undefined; readonly event: "CLICK_SIGN_SIWX_MESSAGE"; readonly properties: { readonly network?: `${string}:${string}` | undefined; readonly isSmartAccount: boolean; }; } | { readonly type: "track"; readonly event: "CLICK_CANCEL_SIWX"; readonly properties: { readonly network?: `${string}:${string}` | undefined; readonly isSmartAccount: boolean; }; } | { readonly type: "track"; readonly event: "SIWX_AUTH_SUCCESS"; readonly properties: { readonly network?: `${string}:${string}` | undefined; readonly isSmartAccount: boolean; }; } | { readonly type: "track"; readonly event: "SIWX_AUTH_ERROR"; readonly properties: { readonly network?: `${string}:${string}` | undefined; readonly isSmartAccount: boolean; readonly message?: string | undefined; }; } | { readonly type: "track"; readonly event: "CLICK_TRANSACTIONS"; readonly properties: { readonly isSmartAccount: boolean; }; } | { readonly type: "track"; readonly event: "ERROR_FETCH_TRANSACTIONS"; readonly properties: { readonly address: string; readonly projectId: string; readonly cursor: string | undefined; readonly isSmartAccount: boolean; }; } | { readonly type: "track"; readonly event: "LOAD_MORE_TRANSACTIONS"; readonly properties: { readonly address: string | undefined; readonly projectId: string; readonly cursor: string | undefined; readonly isSmartAccount: boolean; }; } | { readonly type: "track"; readonly event: "OPEN_SEND"; readonly properties: { readonly isSmartAccount: boolean; readonly network?: `${string}:${string}` | undefined; }; } | { readonly type: "track"; readonly event: "OPEN_SWAP"; readonly properties: { readonly isSmartAccount: boolean; readonly network?: `${string}:${string}` | undefined; }; } | { readonly type: "track"; readonly event: "INITIATE_SWAP"; readonly properties: { readonly isSmartAccount: boolean; readonly network?: `${string}:${string}` | undefined; readonly swapFromToken: string; readonly swapToToken: string; readonly swapFromAmount: string; readonly swapToAmount: string; }; } | { readonly type: "track"; readonly event: "SWAP_SUCCESS"; readonly properties: { readonly isSmartAccount: boolean; readonly network?: `${string}:${string}` | undefined; readonly swapFromToken: string; readonly swapToToken: string; readonly swapFromAmount: string; readonly swapToAmount: string; }; } | { readonly type: "track"; readonly event: "SWAP_ERROR"; readonly properties: { readonly isSmartAccount: boolean; readonly network?: `${string}:${string}` | undefined; readonly swapFromToken: string; readonly swapToToken: string; readonly swapFromAmount: string; readonly swapToAmount: string; readonly message: string; }; } | { readonly type: "track"; readonly event: "SEND_INITIATED"; readonly properties: { readonly isSmartAccount: boolean; readonly network?: `${string}:${string}` | undefined; readonly token: string; readonly amount: number; }; } | { readonly type: "track"; readonly event: "SEND_SUCCESS"; readonly properties: { readonly isSmartAccount: boolean; readonly network?: `${string}:${string}` | undefined; readonly token: string; readonly amount: number; }; } | { readonly type: "track"; readonly event: "SEND_ERROR"; readonly properties: { readonly isSmartAccount: boolean; readonly network?: `${string}:${string}` | undefined; readonly token: string; readonly amount: number; }; } | { readonly type: "track"; readonly event: "SOCIAL_LOGIN_STARTED"; readonly properties: { readonly provider: import("@reown/appkit-common-react-native").SocialProvider; }; } | { readonly type: "track"; readonly event: "SOCIAL_LOGIN_SUCCESS"; readonly properties: { readonly provider: import("@reown/appkit-common-react-native").SocialProvider; }; } | { readonly type: "track"; readonly event: "SOCIAL_LOGIN_REQUEST_USER_DATA"; readonly properties: { readonly provider: import("@reown/appkit-common-react-native").SocialProvider; }; } | { readonly type: "track"; readonly event: "SOCIAL_LOGIN_CANCELED"; readonly properties: { readonly provider: import("@reown/appkit-common-react-native").SocialProvider; }; } | { readonly type: "track"; readonly event: "SOCIAL_LOGIN_ERROR"; readonly properties: { readonly provider: import("@reown/appkit-common-react-native").SocialProvider; }; } | { readonly type: "track"; readonly event: "SET_PREFERRED_ACCOUNT_TYPE"; readonly properties: { readonly accountType: import("@reown/appkit-common-react-native").AccountType; readonly network: string; }; } | { readonly type: "track"; readonly event: "SELECT_BUY_CRYPTO"; } | { readonly type: "track"; readonly event: "SELECT_BUY_ASSET"; readonly properties: { readonly asset: string; }; } | { readonly type: "track"; readonly event: "BUY_SUBMITTED"; readonly properties: { readonly asset?: string | undefined; readonly network?: string | undefined; readonly amount?: string | undefined; readonly currency?: string | undefined; readonly provider?: string | undefined; readonly serviceProvider?: string | undefined; readonly paymentMethod?: string | undefined; }; } | { readonly type: "track"; readonly event: "BUY_SUCCESS"; readonly properties: { readonly asset?: string | null | undefined; readonly network?: string | null | undefined; readonly amount?: string | null | undefined; readonly currency?: string | null | undefined; readonly provider?: string | null | undefined; readonly orderId?: string | null | undefined; }; } | { readonly type: "track"; readonly event: "BUY_FAIL"; readonly properties: { readonly asset?: string | undefined; readonly network?: string | undefined; readonly amount?: string | undefined; readonly currency?: string | undefined; readonly provider?: string | undefined; readonly serviceProvider?: string | undefined; readonly paymentMethod?: string | undefined; readonly message?: string | undefined; }; } | { readonly type: "track"; readonly event: "BUY_CANCEL"; readonly properties?: { readonly message?: string | undefined; } | undefined; } | { readonly type: "track"; readonly event: "WALLET_IMPRESSION"; readonly items: readonly { readonly name: string; readonly walletRank: number | undefined; readonly explorerId: string; readonly view: "AllWallets" | "Connect"; readonly displayIndex?: number | undefined; readonly query?: string | undefined; readonly certified?: boolean | undefined; readonly installed?: boolean | undefined; }[]; }; timestamp: number; }; /** * Hook to subscribe to a specific AppKit event * * @remarks * This hook allows you to listen for a specific event type rather than all events. * It's more efficient than `useAppKitEvents` when you only care about a particular event. * * @param event - The specific event name to subscribe to (e.g., 'MODAL_OPEN', 'CONNECT_SUCCESS') * @param callback - Callback function invoked when the specified event occurs * * @throws {Error} If used outside of an AppKitProvider * * @example * ```tsx * function MyComponent() { * useAppKitEventSubscription('CONNECT_SUCCESS', (event) => { * console.log('Wallet connected!', event.data); * }); * * useAppKitEventSubscription('DISCONNECT_SUCCESS', (event) => { * console.log('Wallet disconnected!', event.data); * }); * * return {/ Your component /}; * } * ``` */ export declare function useAppKitEventSubscription(event: EventName, callback: (newEvent: EventsControllerState) => void): void; //# sourceMappingURL=useAppKitEvents.d.ts.map