@reown/appkit-react-native 0.0.0-chore-qr-borders-20251104183806 → 0.0.0-chore-use-theme-hook-20251105193739

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/lib/commonjs/hooks/useAccount.js +4 -4
  2. package/lib/commonjs/hooks/useAccount.js.map +1 -1
  3. package/lib/commonjs/hooks/useAppKit.js +41 -9
  4. package/lib/commonjs/hooks/useAppKit.js.map +1 -1
  5. package/lib/commonjs/hooks/useAppKitContext.js +46 -0
  6. package/lib/commonjs/hooks/useAppKitContext.js.map +1 -0
  7. package/lib/commonjs/hooks/useAppKitEvents.js +64 -4
  8. package/lib/commonjs/hooks/useAppKitEvents.js.map +1 -1
  9. package/lib/commonjs/hooks/useAppKitLogs.js +2 -8
  10. package/lib/commonjs/hooks/useAppKitLogs.js.map +1 -1
  11. package/lib/commonjs/hooks/useAppKitState.js +35 -2
  12. package/lib/commonjs/hooks/useAppKitState.js.map +1 -1
  13. package/lib/commonjs/hooks/useAppKitTheme.js +74 -0
  14. package/lib/commonjs/hooks/useAppKitTheme.js.map +1 -0
  15. package/lib/commonjs/hooks/useProvider.js +3 -4
  16. package/lib/commonjs/hooks/useProvider.js.map +1 -1
  17. package/lib/commonjs/hooks/useWalletInfo.js +33 -2
  18. package/lib/commonjs/hooks/useWalletInfo.js.map +1 -1
  19. package/lib/commonjs/index.js +7 -0
  20. package/lib/commonjs/index.js.map +1 -1
  21. package/lib/module/hooks/useAccount.js +4 -4
  22. package/lib/module/hooks/useAccount.js.map +1 -1
  23. package/lib/module/hooks/useAppKit.js +43 -10
  24. package/lib/module/hooks/useAppKit.js.map +1 -1
  25. package/lib/module/hooks/useAppKitContext.js +42 -0
  26. package/lib/module/hooks/useAppKitContext.js.map +1 -0
  27. package/lib/module/hooks/useAppKitEvents.js +65 -4
  28. package/lib/module/hooks/useAppKitEvents.js.map +1 -1
  29. package/lib/module/hooks/useAppKitLogs.js +3 -9
  30. package/lib/module/hooks/useAppKitLogs.js.map +1 -1
  31. package/lib/module/hooks/useAppKitState.js +36 -2
  32. package/lib/module/hooks/useAppKitState.js.map +1 -1
  33. package/lib/module/hooks/useAppKitTheme.js +71 -0
  34. package/lib/module/hooks/useAppKitTheme.js.map +1 -0
  35. package/lib/module/hooks/useProvider.js +3 -4
  36. package/lib/module/hooks/useProvider.js.map +1 -1
  37. package/lib/module/hooks/useWalletInfo.js +34 -2
  38. package/lib/module/hooks/useWalletInfo.js.map +1 -1
  39. package/lib/module/index.js +1 -0
  40. package/lib/module/index.js.map +1 -1
  41. package/lib/typescript/AppKitContext.d.ts +1 -1
  42. package/lib/typescript/AppKitContext.d.ts.map +1 -1
  43. package/lib/typescript/hooks/useAccount.d.ts.map +1 -1
  44. package/lib/typescript/hooks/useAppKit.d.ts +42 -0
  45. package/lib/typescript/hooks/useAppKit.d.ts.map +1 -1
  46. package/lib/typescript/hooks/useAppKitContext.d.ts +27 -0
  47. package/lib/typescript/hooks/useAppKitContext.d.ts.map +1 -0
  48. package/lib/typescript/hooks/useAppKitEvents.d.ts +59 -0
  49. package/lib/typescript/hooks/useAppKitEvents.d.ts.map +1 -1
  50. package/lib/typescript/hooks/useAppKitLogs.d.ts.map +1 -1
  51. package/lib/typescript/hooks/useAppKitState.d.ts +32 -0
  52. package/lib/typescript/hooks/useAppKitState.d.ts.map +1 -1
  53. package/lib/typescript/hooks/useAppKitTheme.d.ts +59 -0
  54. package/lib/typescript/hooks/useAppKitTheme.d.ts.map +1 -0
  55. package/lib/typescript/hooks/useProvider.d.ts +1 -4
  56. package/lib/typescript/hooks/useProvider.d.ts.map +1 -1
  57. package/lib/typescript/hooks/useWalletInfo.d.ts +31 -0
  58. package/lib/typescript/hooks/useWalletInfo.d.ts.map +1 -1
  59. package/lib/typescript/index.d.ts +1 -0
  60. package/lib/typescript/index.d.ts.map +1 -1
  61. package/package.json +5 -4
  62. package/src/AppKitContext.tsx +1 -1
  63. package/src/hooks/useAccount.ts +5 -3
  64. package/src/hooks/useAppKit.ts +45 -12
  65. package/src/hooks/useAppKitContext.ts +43 -0
  66. package/src/hooks/useAppKitEvents.ts +63 -3
  67. package/src/hooks/useAppKitLogs.ts +3 -11
  68. package/src/hooks/useAppKitState.ts +35 -2
  69. package/src/hooks/useAppKitTheme.ts +81 -0
  70. package/src/hooks/useProvider.ts +3 -4
  71. package/src/hooks/useWalletInfo.ts +33 -2
  72. package/src/index.ts +1 -0
@@ -1,16 +1,49 @@
1
1
  "use strict";
2
2
 
3
- import { useContext, useMemo } from 'react';
4
- import { AppKitContext } from '../AppKitContext';
3
+ import { useMemo } from 'react';
4
+ import { useAppKitContext } from './useAppKitContext';
5
+
6
+ /**
7
+ * Interface representing the return value of the useAppKit hook
8
+ */
9
+
10
+ /**
11
+ * Hook to access core AppKit functionality for controlling the modal
12
+ *
13
+ * @remarks
14
+ * This hook provides access to the main AppKit instance methods for opening/closing
15
+ * the modal, disconnecting wallets, and switching networks. All functions are memoized
16
+ * and properly bound to ensure stable references across renders.
17
+ *
18
+ * @returns {UseAppKitReturn} An object containing:
19
+ * - `open`: Opens the AppKit modal, optionally with a specific view
20
+ * - `close`: Closes the AppKit modal
21
+ * - `disconnect`: Disconnects the current wallet connection (optionally for a specific namespace)
22
+ * - `switchNetwork`: Switches to a different blockchain network
23
+ *
24
+ * @throws {Error} If used outside of an AppKitProvider
25
+ * @throws {Error} If AppKit instance is not available in context
26
+ *
27
+ * @example
28
+ * ```tsx
29
+ * function MyComponent() {
30
+ * const { open, close, disconnect, switchNetwork } = useAppKit();
31
+ *
32
+ * return (
33
+ * <View>
34
+ * <Button onPress={() => open()} title="Connect Wallet" />
35
+ * <Button onPress={() => disconnect()} title="Disconnect" />
36
+ * <Button
37
+ * onPress={() => switchNetwork('eip155:1')}
38
+ * title="Switch to Ethereum"
39
+ * />
40
+ * </View>
41
+ * );
42
+ * }
43
+ * ```
44
+ */
5
45
  export const useAppKit = () => {
6
- const context = useContext(AppKitContext);
7
- if (context === undefined) {
8
- throw new Error('useAppKit must be used within an AppKitProvider');
9
- }
10
- if (!context.appKit) {
11
- // This might happen if the provider is rendered before AppKit is initialized
12
- throw new Error('AppKit instance is not yet available in context.');
13
- }
46
+ const context = useAppKitContext();
14
47
  const stableFunctions = useMemo(() => {
15
48
  if (!context.appKit) {
16
49
  throw new Error('AppKit instance is not available');
@@ -1 +1 @@
1
- {"version":3,"names":["useContext","useMemo","AppKitContext","useAppKit","context","undefined","Error","appKit","stableFunctions","open","bind","close","disconnect","namespace","switchNetwork"],"sourceRoot":"../../../src","sources":["hooks/useAppKit.ts"],"mappings":";;AAAA,SAASA,UAAU,EAAEC,OAAO,QAAQ,OAAO;AAI3C,SAASC,aAAa,QAAQ,kBAAkB;AAShD,OAAO,MAAMC,SAAS,GAAGA,CAAA,KAAuB;EAC9C,MAAMC,OAAO,GAAGJ,UAAU,CAACE,aAAa,CAAC;EAEzC,IAAIE,OAAO,KAAKC,SAAS,EAAE;IACzB,MAAM,IAAIC,KAAK,CAAC,iDAAiD,CAAC;EACpE;EAEA,IAAI,CAACF,OAAO,CAACG,MAAM,EAAE;IACnB;IACA,MAAM,IAAID,KAAK,CAAC,kDAAkD,CAAC;EACrE;EAEA,MAAME,eAAe,GAAGP,OAAO,CAAC,MAAM;IACpC,IAAI,CAACG,OAAO,CAACG,MAAM,EAAE;MACnB,MAAM,IAAID,KAAK,CAAC,kCAAkC,CAAC;IACrD;IAEA,OAAO;MACLG,IAAI,EAAEL,OAAO,CAACG,MAAM,CAACE,IAAI,CAACC,IAAI,CAACN,OAAO,CAACG,MAAM,CAAC;MAC9CI,KAAK,EAAEP,OAAO,CAACG,MAAM,CAACI,KAAK,CAACD,IAAI,CAACN,OAAO,CAACG,MAAM,CAAC;MAChDK,UAAU,EAAGC,SAA0B,IACrCT,OAAO,CAACG,MAAM,CAAEK,UAAU,CAACF,IAAI,CAACN,OAAO,CAACG,MAAO,CAAC,CAACM,SAAS,CAAC;MAC7DC,aAAa,EAAEV,OAAO,CAACG,MAAM,CAACO,aAAa,CAACJ,IAAI,CAACN,OAAO,CAACG,MAAM;IACjE,CAAC;EACH,CAAC,EAAE,CAACH,OAAO,CAACG,MAAM,CAAC,CAAC;EAEpB,OAAOC,eAAe;AACxB,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["useMemo","useAppKitContext","useAppKit","context","stableFunctions","appKit","Error","open","bind","close","disconnect","namespace","switchNetwork"],"sourceRoot":"../../../src","sources":["hooks/useAppKit.ts"],"mappings":";;AAAA,SAASA,OAAO,QAAQ,OAAO;AAI/B,SAASC,gBAAgB,QAAQ,oBAAoB;;AAErD;AACA;AACA;;AAYA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,SAAS,GAAGA,CAAA,KAAuB;EAC9C,MAAMC,OAAO,GAAGF,gBAAgB,CAAC,CAAC;EAElC,MAAMG,eAAe,GAAGJ,OAAO,CAAC,MAAM;IACpC,IAAI,CAACG,OAAO,CAACE,MAAM,EAAE;MACnB,MAAM,IAAIC,KAAK,CAAC,kCAAkC,CAAC;IACrD;IAEA,OAAO;MACLC,IAAI,EAAEJ,OAAO,CAACE,MAAM,CAACE,IAAI,CAACC,IAAI,CAACL,OAAO,CAACE,MAAM,CAAC;MAC9CI,KAAK,EAAEN,OAAO,CAACE,MAAM,CAACI,KAAK,CAACD,IAAI,CAACL,OAAO,CAACE,MAAM,CAAC;MAChDK,UAAU,EAAGC,SAA0B,IACrCR,OAAO,CAACE,MAAM,CAAEK,UAAU,CAACF,IAAI,CAACL,OAAO,CAACE,MAAO,CAAC,CAACM,SAAS,CAAC;MAC7DC,aAAa,EAAET,OAAO,CAACE,MAAM,CAACO,aAAa,CAACJ,IAAI,CAACL,OAAO,CAACE,MAAM;IACjE,CAAC;EACH,CAAC,EAAE,CAACF,OAAO,CAACE,MAAM,CAAC,CAAC;EAEpB,OAAOD,eAAe;AACxB,CAAC","ignoreList":[]}
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+
3
+ import { useContext } from 'react';
4
+ import { AppKitContext } from '../AppKitContext';
5
+
6
+ /**
7
+ * Hook to access the AppKit context
8
+ *
9
+ * @remarks
10
+ * This is an internal hook used by other AppKit hooks to ensure they're used within
11
+ * the AppKitProvider. You typically don't need to use this hook directly - use the
12
+ * higher-level hooks like `useAppKit`, `useAccount`, `useAppKitTheme`, etc. instead.
13
+ *
14
+ * @returns {AppKitContextType} The AppKit context containing the AppKit instance
15
+ *
16
+ * @throws {Error} If used outside of an AppKitProvider
17
+ * @throws {Error} If the AppKit instance is not yet available in context
18
+ *
19
+ * @internal
20
+ *
21
+ * @example
22
+ * ```tsx
23
+ * // This is typically used internally by other hooks
24
+ * function MyCustomHook() {
25
+ * const context = useAppKitContext();
26
+ * // Use context.appKit...
27
+ * }
28
+ * ```
29
+ */
30
+
31
+ export const useAppKitContext = () => {
32
+ const context = useContext(AppKitContext);
33
+ if (context === undefined) {
34
+ throw new Error('useAppKit must be used within an AppKitProvider');
35
+ }
36
+ if (!context.appKit) {
37
+ // This might happen if the provider is rendered before AppKit is initialized
38
+ throw new Error('AppKit instance is not yet available in context.');
39
+ }
40
+ return context;
41
+ };
42
+ //# sourceMappingURL=useAppKitContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useContext","AppKitContext","useAppKitContext","context","undefined","Error","appKit"],"sourceRoot":"../../../src","sources":["hooks/useAppKitContext.ts"],"mappings":";;AAAA,SAASA,UAAU,QAAQ,OAAO;AAElC,SAASC,aAAa,QAAgC,kBAAkB;;AAExE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAO,MAAMC,gBAAgB,GAAGA,CAAA,KAAyB;EACvD,MAAMC,OAAO,GAAGH,UAAU,CAACC,aAAa,CAAC;EAEzC,IAAIE,OAAO,KAAKC,SAAS,EAAE;IACzB,MAAM,IAAIC,KAAK,CAAC,iDAAiD,CAAC;EACpE;EAEA,IAAI,CAACF,OAAO,CAACG,MAAM,EAAE;IACnB;IACA,MAAM,IAAID,KAAK,CAAC,kDAAkD,CAAC;EACrE;EAEA,OAAOF,OAAO;AAChB,CAAC","ignoreList":[]}
@@ -3,9 +3,42 @@
3
3
  import { useEffect } from 'react';
4
4
  import { useSnapshot } from 'valtio';
5
5
  import { EventsController } from '@reown/appkit-core-react-native';
6
- import { useAppKit } from './useAppKit';
6
+ import { useAppKitContext } from './useAppKitContext';
7
+
8
+ /**
9
+ * Hook to subscribe to all AppKit events
10
+ *
11
+ * @remarks
12
+ * This hook provides reactive access to AppKit's event system, allowing you to
13
+ * monitor all events that occur within the AppKit lifecycle (connections, disconnections,
14
+ * network changes, etc.). The callback is invoked whenever a new event is emitted.
15
+ *
16
+ * @param callback - Optional callback function invoked when any event occurs
17
+ *
18
+ * @returns An object containing:
19
+ * - `data`: The most recent event data
20
+ * - `timestamp`: The timestamp of the most recent event
21
+ *
22
+ * @throws {Error} If used outside of an AppKitProvider
23
+ *
24
+ * @example
25
+ * ```tsx
26
+ * function MyComponent() {
27
+ * const { data, timestamp } = useAppKitEvents((event) => {
28
+ * console.log('Event occurred:', event.data.event);
29
+ * });
30
+ *
31
+ * return (
32
+ * <View>
33
+ * <Text>Last event: {data?.event}</Text>
34
+ * <Text>Time: {timestamp}</Text>
35
+ * </View>
36
+ * );
37
+ * }
38
+ * ```
39
+ */
7
40
  export function useAppKitEvents(callback) {
8
- useAppKit(); // Use the hook for checks
41
+ useAppKitContext();
9
42
  const {
10
43
  data,
11
44
  timestamp
@@ -23,9 +56,37 @@ export function useAppKitEvents(callback) {
23
56
  timestamp
24
57
  };
25
58
  }
26
- export function useAppKitEventSubscription(event, callback) {
27
- useAppKit(); // Use the hook for checks
28
59
 
60
+ /**
61
+ * Hook to subscribe to a specific AppKit event
62
+ *
63
+ * @remarks
64
+ * This hook allows you to listen for a specific event type rather than all events.
65
+ * It's more efficient than `useAppKitEvents` when you only care about a particular event.
66
+ *
67
+ * @param event - The specific event name to subscribe to (e.g., 'MODAL_OPEN', 'CONNECT_SUCCESS')
68
+ * @param callback - Callback function invoked when the specified event occurs
69
+ *
70
+ * @throws {Error} If used outside of an AppKitProvider
71
+ *
72
+ * @example
73
+ * ```tsx
74
+ * function MyComponent() {
75
+ * useAppKitEventSubscription('CONNECT_SUCCESS', (event) => {
76
+ * console.log('Wallet connected!', event.data);
77
+ * });
78
+ *
79
+ * useAppKitEventSubscription('DISCONNECT_SUCCESS', (event) => {
80
+ * console.log('Wallet disconnected!', event.data);
81
+ * });
82
+ *
83
+ * return <View>{/ Your component /}</View>;
84
+ * }
85
+ * ```
86
+ */
87
+
88
+ export function useAppKitEventSubscription(event, callback) {
89
+ useAppKitContext();
29
90
  useEffect(() => {
30
91
  const unsubscribe = EventsController?.subscribeEvent(event, callback);
31
92
  return () => {
@@ -1 +1 @@
1
- {"version":3,"names":["useEffect","useSnapshot","EventsController","useAppKit","useAppKitEvents","callback","data","timestamp","state","unsubscribe","subscribe","newEvent","useAppKitEventSubscription","event","subscribeEvent"],"sourceRoot":"../../../src","sources":["hooks/useAppKitEvents.ts"],"mappings":";;AAAA,SAASA,SAAS,QAAQ,OAAO;AACjC,SAASC,WAAW,QAAQ,QAAQ;AACpC,SAASC,gBAAgB,QAAoC,iCAAiC;AAE9F,SAASC,SAAS,QAAQ,aAAa;AAEvC,OAAO,SAASC,eAAeA,CAACC,QAAoD,EAAE;EACpFF,SAAS,CAAC,CAAC,CAAC,CAAC;EACb,MAAM;IAAEG,IAAI;IAAEC;EAAU,CAAC,GAAGN,WAAW,CAACC,gBAAgB,CAACM,KAAK,CAAC;EAE/DR,SAAS,CAAC,MAAM;IACd,MAAMS,WAAW,GAAGP,gBAAgB,CAACQ,SAAS,CAACC,QAAQ,IAAI;MACzDN,QAAQ,GAAGM,QAAQ,CAAC;IACtB,CAAC,CAAC;IAEF,OAAO,MAAM;MACXF,WAAW,GAAG,CAAC;IACjB,CAAC;EACH,CAAC,EAAE,CAACJ,QAAQ,CAAC,CAAC;EAEd,OAAO;IAAEC,IAAI;IAAEC;EAAU,CAAC;AAC5B;AAEA,OAAO,SAASK,0BAA0BA,CACxCC,KAAgB,EAChBR,QAAmD,EACnD;EACAF,SAAS,CAAC,CAAC,CAAC,CAAC;;EAEbH,SAAS,CAAC,MAAM;IACd,MAAMS,WAAW,GAAGP,gBAAgB,EAAEY,cAAc,CAACD,KAAK,EAAER,QAAQ,CAAC;IAErE,OAAO,MAAM;MACXI,WAAW,GAAG,CAAC;IACjB,CAAC;EACH,CAAC,EAAE,CAACJ,QAAQ,EAAEQ,KAAK,CAAC,CAAC;AACvB","ignoreList":[]}
1
+ {"version":3,"names":["useEffect","useSnapshot","EventsController","useAppKitContext","useAppKitEvents","callback","data","timestamp","state","unsubscribe","subscribe","newEvent","useAppKitEventSubscription","event","subscribeEvent"],"sourceRoot":"../../../src","sources":["hooks/useAppKitEvents.ts"],"mappings":";;AAAA,SAASA,SAAS,QAAQ,OAAO;AACjC,SAASC,WAAW,QAAQ,QAAQ;AACpC,SAASC,gBAAgB,QAAoC,iCAAiC;AAE9F,SAASC,gBAAgB,QAAQ,oBAAoB;;AAErD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,eAAeA,CAACC,QAAoD,EAAE;EACpFF,gBAAgB,CAAC,CAAC;EAClB,MAAM;IAAEG,IAAI;IAAEC;EAAU,CAAC,GAAGN,WAAW,CAACC,gBAAgB,CAACM,KAAK,CAAC;EAE/DR,SAAS,CAAC,MAAM;IACd,MAAMS,WAAW,GAAGP,gBAAgB,CAACQ,SAAS,CAACC,QAAQ,IAAI;MACzDN,QAAQ,GAAGM,QAAQ,CAAC;IACtB,CAAC,CAAC;IAEF,OAAO,MAAM;MACXF,WAAW,GAAG,CAAC;IACjB,CAAC;EACH,CAAC,EAAE,CAACJ,QAAQ,CAAC,CAAC;EAEd,OAAO;IAAEC,IAAI;IAAEC;EAAU,CAAC;AAC5B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAO,SAASK,0BAA0BA,CACxCC,KAAgB,EAChBR,QAAmD,EACnD;EACAF,gBAAgB,CAAC,CAAC;EAElBH,SAAS,CAAC,MAAM;IACd,MAAMS,WAAW,GAAGP,gBAAgB,EAAEY,cAAc,CAACD,KAAK,EAAER,QAAQ,CAAC;IAErE,OAAO,MAAM;MACXI,WAAW,GAAG,CAAC;IACjB,CAAC;EACH,CAAC,EAAE,CAACJ,QAAQ,EAAEQ,KAAK,CAAC,CAAC;AACvB","ignoreList":[]}
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
 
3
- import { useContext, useMemo } from 'react';
3
+ import { useMemo } from 'react';
4
4
  import { useSnapshot } from 'valtio';
5
5
  import { LogController } from '@reown/appkit-core-react-native';
6
- import { AppKitContext } from '../AppKitContext';
6
+ import { useAppKitContext } from './useAppKitContext';
7
7
  /**
8
8
  * React hook for accessing AppKit logs
9
9
  *
@@ -26,13 +26,7 @@ import { AppKitContext } from '../AppKitContext';
26
26
  * ```
27
27
  */
28
28
  export const useAppKitLogs = () => {
29
- const context = useContext(AppKitContext);
30
- if (context === undefined) {
31
- throw new Error('useAppKitLogs must be used within an AppKitProvider');
32
- }
33
- if (!context.appKit) {
34
- throw new Error('AppKit instance is not yet available in context.');
35
- }
29
+ useAppKitContext();
36
30
  const {
37
31
  logs
38
32
  } = useSnapshot(LogController.state);
@@ -1 +1 @@
1
- {"version":3,"names":["useContext","useMemo","useSnapshot","LogController","AppKitContext","useAppKitLogs","context","undefined","Error","appKit","logs","state","stableFunctions","getLogsByLevel","level","getRecentLogs","count","exportLogs","getLogsStats","clearLogs","regularArrays","allLogs","errorLogs","warningLogs","infoLogs","debugLogs","log","push"],"sourceRoot":"../../../src","sources":["hooks/useAppKitLogs.ts"],"mappings":";;AAAA,SAASA,UAAU,EAAEC,OAAO,QAAQ,OAAO;AAC3C,SAASC,WAAW,QAAQ,QAAQ;AACpC,SAASC,aAAa,QAAsC,iCAAiC;AAC7F,SAASC,aAAa,QAAQ,kBAAkB;AA0ChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,aAAa,GAAGA,CAAA,KAA2B;EACtD,MAAMC,OAAO,GAAGN,UAAU,CAACI,aAAa,CAAC;EAEzC,IAAIE,OAAO,KAAKC,SAAS,EAAE;IACzB,MAAM,IAAIC,KAAK,CAAC,qDAAqD,CAAC;EACxE;EAEA,IAAI,CAACF,OAAO,CAACG,MAAM,EAAE;IACnB,MAAM,IAAID,KAAK,CAAC,kDAAkD,CAAC;EACrE;EAEA,MAAM;IAAEE;EAAK,CAAC,GAAGR,WAAW,CAACC,aAAa,CAACQ,KAAK,CAAC;;EAEjD;EACA,MAAMC,eAAe,GAAGX,OAAO,CAC7B,OAAO;IACLY,cAAc,EAAGC,KAAe,IAAKX,aAAa,CAACU,cAAc,CAACC,KAAK,CAAC;IACxEC,aAAa,EAAGC,KAAc,IAAKb,aAAa,CAACY,aAAa,CAACC,KAAK,CAAC;IACrEC,UAAU,EAAEA,CAAA,KAAMd,aAAa,CAACc,UAAU,CAAC,CAAC;IAC5CC,YAAY,EAAEA,CAAA,KAAMf,aAAa,CAACe,YAAY,CAAC,CAAC;IAChDC,SAAS,EAAEA,CAAA,KAAMhB,aAAa,CAACgB,SAAS,CAAC;EAC3C,CAAC,CAAC,EACF,EACF,CAAC;EAED,MAAMC,aAAa,GAAGnB,OAAO,CAAC,MAAM;IAClC,MAAMoB,OAAO,GAAG,CAAC,GAAGX,IAAI,CAAC,CAAC,CAAC;IAC3B,MAAMY,SAAqB,GAAG,EAAE;IAChC,MAAMC,WAAuB,GAAG,EAAE;IAClC,MAAMC,QAAoB,GAAG,EAAE;IAC/B,MAAMC,SAAqB,GAAG,EAAE;IAEhC,KAAK,MAAMC,GAAG,IAAIL,OAAO,EAAE;MACzB,QAAQK,GAAG,CAACZ,KAAK;QACf,KAAK,OAAO;UACVQ,SAAS,CAACK,IAAI,CAACD,GAAG,CAAC;UACnB;QACF,KAAK,MAAM;UACTH,WAAW,CAACI,IAAI,CAACD,GAAG,CAAC;UACrB;QACF,KAAK,MAAM;UACTF,QAAQ,CAACG,IAAI,CAACD,GAAG,CAAC;UAClB;QACF,KAAK,OAAO;UACVD,SAAS,CAACE,IAAI,CAACD,GAAG,CAAC;UACnB;MACJ;IACF;IAEA,OAAO;MACLhB,IAAI,EAAEW,OAAO;MACbC,SAAS;MACTC,WAAW;MACXC,QAAQ;MACRC;IACF,CAAC;EACH,CAAC,EAAE,CAACf,IAAI,CAAC,CAAC;EAEV,OAAO;IACL,GAAGU,aAAa;IAChB,GAAGR;EACL,CAAC;AACH,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["useMemo","useSnapshot","LogController","useAppKitContext","useAppKitLogs","logs","state","stableFunctions","getLogsByLevel","level","getRecentLogs","count","exportLogs","getLogsStats","clearLogs","regularArrays","allLogs","errorLogs","warningLogs","infoLogs","debugLogs","log","push"],"sourceRoot":"../../../src","sources":["hooks/useAppKitLogs.ts"],"mappings":";;AAAA,SAASA,OAAO,QAAQ,OAAO;AAC/B,SAASC,WAAW,QAAQ,QAAQ;AACpC,SAASC,aAAa,QAAsC,iCAAiC;AAC7F,SAASC,gBAAgB,QAAQ,oBAAoB;AA0CrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,aAAa,GAAGA,CAAA,KAA2B;EACtDD,gBAAgB,CAAC,CAAC;EAElB,MAAM;IAAEE;EAAK,CAAC,GAAGJ,WAAW,CAACC,aAAa,CAACI,KAAK,CAAC;;EAEjD;EACA,MAAMC,eAAe,GAAGP,OAAO,CAC7B,OAAO;IACLQ,cAAc,EAAGC,KAAe,IAAKP,aAAa,CAACM,cAAc,CAACC,KAAK,CAAC;IACxEC,aAAa,EAAGC,KAAc,IAAKT,aAAa,CAACQ,aAAa,CAACC,KAAK,CAAC;IACrEC,UAAU,EAAEA,CAAA,KAAMV,aAAa,CAACU,UAAU,CAAC,CAAC;IAC5CC,YAAY,EAAEA,CAAA,KAAMX,aAAa,CAACW,YAAY,CAAC,CAAC;IAChDC,SAAS,EAAEA,CAAA,KAAMZ,aAAa,CAACY,SAAS,CAAC;EAC3C,CAAC,CAAC,EACF,EACF,CAAC;EAED,MAAMC,aAAa,GAAGf,OAAO,CAAC,MAAM;IAClC,MAAMgB,OAAO,GAAG,CAAC,GAAGX,IAAI,CAAC,CAAC,CAAC;IAC3B,MAAMY,SAAqB,GAAG,EAAE;IAChC,MAAMC,WAAuB,GAAG,EAAE;IAClC,MAAMC,QAAoB,GAAG,EAAE;IAC/B,MAAMC,SAAqB,GAAG,EAAE;IAEhC,KAAK,MAAMC,GAAG,IAAIL,OAAO,EAAE;MACzB,QAAQK,GAAG,CAACZ,KAAK;QACf,KAAK,OAAO;UACVQ,SAAS,CAACK,IAAI,CAACD,GAAG,CAAC;UACnB;QACF,KAAK,MAAM;UACTH,WAAW,CAACI,IAAI,CAACD,GAAG,CAAC;UACrB;QACF,KAAK,MAAM;UACTF,QAAQ,CAACG,IAAI,CAACD,GAAG,CAAC;UAClB;QACF,KAAK,OAAO;UACVD,SAAS,CAACE,IAAI,CAACD,GAAG,CAAC;UACnB;MACJ;IACF;IAEA,OAAO;MACLhB,IAAI,EAAEW,OAAO;MACbC,SAAS;MACTC,WAAW;MACXC,QAAQ;MACRC;IACF,CAAC;EACH,CAAC,EAAE,CAACf,IAAI,CAAC,CAAC;EAEV,OAAO;IACL,GAAGU,aAAa;IAChB,GAAGR;EACL,CAAC;AACH,CAAC","ignoreList":[]}
@@ -4,9 +4,43 @@
4
4
  import { useMemo } from 'react';
5
5
  import { useSnapshot } from 'valtio';
6
6
  import { ConnectionsController, ModalController } from '@reown/appkit-core-react-native';
7
- import { useAppKit } from './useAppKit';
7
+ import { useAppKitContext } from './useAppKitContext';
8
+
9
+ /**
10
+ * Hook to access the overall state of the AppKit modal and connection
11
+ *
12
+ * @remarks
13
+ * This hook provides a high-level view of the AppKit's current state, including
14
+ * whether the modal is open, if it's loading, connection status, and the active chain.
15
+ * It's useful for coordinating UI elements with the AppKit's state.
16
+ *
17
+ * @returns An object containing:
18
+ * - `isOpen`: Whether the AppKit modal is currently open
19
+ * - `isLoading`: Whether the AppKit is in a loading state
20
+ * - `isConnected`: Whether a wallet is currently connected
21
+ * - `chain`: The currently active blockchain network
22
+ *
23
+ * @throws {Error} If used outside of an AppKitProvider
24
+ *
25
+ * @example
26
+ * ```tsx
27
+ * function MyComponent() {
28
+ * const { isOpen, isLoading, isConnected, chain } = useAppKitState();
29
+ *
30
+ * return (
31
+ * <View>
32
+ * <Text>Modal: {isOpen ? 'Open' : 'Closed'}</Text>
33
+ * <Text>Loading: {isLoading ? 'Yes' : 'No'}</Text>
34
+ * <Text>Connected: {isConnected ? 'Yes' : 'No'}</Text>
35
+ * {chain && <Text>Chain: {chain.name}</Text>}
36
+ * </View>
37
+ * );
38
+ * }
39
+ * ```
40
+ */
41
+
8
42
  export function useAppKitState() {
9
- useAppKit(); // Use the hook for checks
43
+ useAppKitContext();
10
44
  const {
11
45
  activeAddress: address,
12
46
  connection,
@@ -1 +1 @@
1
- {"version":3,"names":["useMemo","useSnapshot","ConnectionsController","ModalController","useAppKit","useAppKitState","activeAddress","address","connection","networks","state","open","loading","activeChain","caipNetwork","find","network","caipNetworkId","undefined","isOpen","isLoading","isConnected","chain"],"sourceRoot":"../../../src","sources":["hooks/useAppKitState.ts"],"mappings":";;AAAA;AACA,SAASA,OAAO,QAAQ,OAAO;AAC/B,SAASC,WAAW,QAAQ,QAAQ;AACpC,SAASC,qBAAqB,EAAEC,eAAe,QAAQ,iCAAiC;AACxF,SAASC,SAAS,QAAQ,aAAa;AAEvC,OAAO,SAASC,cAAcA,CAAA,EAAG;EAC/BD,SAAS,CAAC,CAAC,CAAC,CAAC;EACb,MAAM;IAAEE,aAAa,EAAEC,OAAO;IAAEC,UAAU;IAAEC;EAAS,CAAC,GAAGR,WAAW,CAACC,qBAAqB,CAACQ,KAAK,CAAC;EACjG,MAAM;IAAEC,IAAI;IAAEC;EAAQ,CAAC,GAAGX,WAAW,CAACE,eAAe,CAACO,KAAK,CAAC;EAE5D,MAAMG,WAAW,GAAGb,OAAO,CACzB,MACEQ,UAAU,EAAEM,WAAW,GACnBL,QAAQ,CAACM,IAAI,CAACC,OAAO,IAAIA,OAAO,CAACC,aAAa,KAAKT,UAAU,EAAEM,WAAW,CAAC,GAC3EI,SAAS,EACf,CAACV,UAAU,EAAEM,WAAW,EAAEL,QAAQ,CACpC,CAAC;EAED,OAAO;IACLU,MAAM,EAAER,IAAI;IACZS,SAAS,EAAER,OAAO;IAClBS,WAAW,EAAE,CAAC,CAACd,OAAO;IACtBe,KAAK,EAAET;EACT,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"names":["useMemo","useSnapshot","ConnectionsController","ModalController","useAppKitContext","useAppKitState","activeAddress","address","connection","networks","state","open","loading","activeChain","caipNetwork","find","network","caipNetworkId","undefined","isOpen","isLoading","isConnected","chain"],"sourceRoot":"../../../src","sources":["hooks/useAppKitState.ts"],"mappings":";;AAAA;AACA,SAASA,OAAO,QAAQ,OAAO;AAC/B,SAASC,WAAW,QAAQ,QAAQ;AACpC,SAASC,qBAAqB,EAAEC,eAAe,QAAQ,iCAAiC;AACxF,SAASC,gBAAgB,QAAQ,oBAAoB;;AAErD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAO,SAASC,cAAcA,CAAA,EAAG;EAC/BD,gBAAgB,CAAC,CAAC;EAClB,MAAM;IAAEE,aAAa,EAAEC,OAAO;IAAEC,UAAU;IAAEC;EAAS,CAAC,GAAGR,WAAW,CAACC,qBAAqB,CAACQ,KAAK,CAAC;EACjG,MAAM;IAAEC,IAAI;IAAEC;EAAQ,CAAC,GAAGX,WAAW,CAACE,eAAe,CAACO,KAAK,CAAC;EAE5D,MAAMG,WAAW,GAAGb,OAAO,CACzB,MACEQ,UAAU,EAAEM,WAAW,GACnBL,QAAQ,CAACM,IAAI,CAACC,OAAO,IAAIA,OAAO,CAACC,aAAa,KAAKT,UAAU,EAAEM,WAAW,CAAC,GAC3EI,SAAS,EACf,CAACV,UAAU,EAAEM,WAAW,EAAEL,QAAQ,CACpC,CAAC;EAED,OAAO;IACLU,MAAM,EAAER,IAAI;IACZS,SAAS,EAAER,OAAO;IAClBS,WAAW,EAAE,CAAC,CAACd,OAAO;IACtBe,KAAK,EAAET;EACT,CAAC;AACH","ignoreList":[]}
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+
3
+ import { useMemo } from 'react';
4
+ import { useSnapshot } from 'valtio';
5
+ import { ThemeController } from '@reown/appkit-core-react-native';
6
+ import { useAppKitContext } from './useAppKitContext';
7
+
8
+ /**
9
+ * Interface representing the result of the useAppKitTheme hook
10
+ */
11
+
12
+ /**
13
+ * Hook to control the visual appearance of the AppKit modal
14
+ *
15
+ * @remarks
16
+ * This hook provides access to the theme mode and theme variables, allowing you to
17
+ * customize the modal's appearance. Use this hook when you need to implement dark/light
18
+ * mode or match the modal's appearance with your application's theme.
19
+ *
20
+ * Currently, the only supported theme variable is `accent`, which controls the primary
21
+ * accent color used throughout the modal interface.
22
+ *
23
+ * @returns {UseAppKitThemeReturn} An object containing:
24
+ * - `themeMode`: The current theme mode ('dark' or 'light')
25
+ * - `themeVariables`: The current theme variables (only 'accent' is supported)
26
+ * - `setThemeMode`: Function to change the theme mode
27
+ * - `setThemeVariables`: Function to update theme variables
28
+ *
29
+ * @throws {Error} If used outside of an AppKitProvider
30
+ *
31
+ * @example
32
+ * ```typescript
33
+ * import { useAppKitTheme } from '@reown/appkit-react-native';
34
+ *
35
+ * function MyComponent() {
36
+ * const { themeMode, themeVariables, setThemeMode, setThemeVariables } = useAppKitTheme();
37
+ *
38
+ * // Set theme to dark mode
39
+ * setThemeMode('dark');
40
+ *
41
+ * // Customize the accent color
42
+ * setThemeVariables({
43
+ * accent: '#00BB7F'
44
+ * });
45
+ *
46
+ * return (
47
+ * <View>
48
+ * <Text>Current theme: {themeMode}</Text>
49
+ * <Text>Accent color: {themeVariables?.accent}</Text>
50
+ * </View>
51
+ * );
52
+ * }
53
+ * ```
54
+ */
55
+ export function useAppKitTheme() {
56
+ useAppKitContext();
57
+ const {
58
+ themeMode,
59
+ themeVariables
60
+ } = useSnapshot(ThemeController.state);
61
+ const stableFunctions = useMemo(() => ({
62
+ setThemeMode: ThemeController.setThemeMode.bind(ThemeController),
63
+ setThemeVariables: ThemeController.setThemeVariables.bind(ThemeController)
64
+ }), []);
65
+ return {
66
+ themeMode,
67
+ themeVariables,
68
+ ...stableFunctions
69
+ };
70
+ }
71
+ //# sourceMappingURL=useAppKitTheme.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useMemo","useSnapshot","ThemeController","useAppKitContext","useAppKitTheme","themeMode","themeVariables","state","stableFunctions","setThemeMode","bind","setThemeVariables"],"sourceRoot":"../../../src","sources":["hooks/useAppKitTheme.ts"],"mappings":";;AAAA,SAASA,OAAO,QAAQ,OAAO;AAC/B,SAASC,WAAW,QAAQ,QAAQ;AAEpC,SAASC,eAAe,QAAQ,iCAAiC;AACjE,SAASC,gBAAgB,QAAQ,oBAAoB;;AAErD;AACA;AACA;;AAYA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,cAAcA,CAAA,EAAyB;EACrDD,gBAAgB,CAAC,CAAC;EAClB,MAAM;IAAEE,SAAS;IAAEC;EAAe,CAAC,GAAGL,WAAW,CAACC,eAAe,CAACK,KAAK,CAAC;EAExE,MAAMC,eAAe,GAAGR,OAAO,CAC7B,OAAO;IACLS,YAAY,EAAEP,eAAe,CAACO,YAAY,CAACC,IAAI,CAACR,eAAe,CAAC;IAChES,iBAAiB,EAAET,eAAe,CAACS,iBAAiB,CAACD,IAAI,CAACR,eAAe;EAC3E,CAAC,CAAC,EACF,EACF,CAAC;EAED,OAAO;IACLG,SAAS;IACTC,cAAc;IACd,GAAGE;EACL,CAAC;AACH","ignoreList":[]}
@@ -4,6 +4,7 @@
4
4
  import { useMemo } from 'react';
5
5
  import { useSnapshot } from 'valtio';
6
6
  import { ConnectionsController, LogController } from '@reown/appkit-core-react-native';
7
+ import { useAppKitContext } from './useAppKitContext';
7
8
 
8
9
  /**
9
10
  * Interface representing the result of the useProvider hook
@@ -24,14 +25,12 @@ import { ConnectionsController, LogController } from '@reown/appkit-core-react-n
24
25
  *
25
26
  * if (provider) {
26
27
  * // Use the provider for blockchain operations
27
- * const balance = await provider.request({
28
- * method: 'eth_getBalance',
29
- * params: [address, 'latest']
30
- * });
28
+ * const balance = await provider.request({...});
31
29
  * }
32
30
  * ```
33
31
  */
34
32
  export function useProvider() {
33
+ useAppKitContext();
35
34
  const {
36
35
  connection
37
36
  } = useSnapshot(ConnectionsController.state);
@@ -1 +1 @@
1
- {"version":3,"names":["useMemo","useSnapshot","ConnectionsController","LogController","useProvider","connection","state","returnValue","adapter","provider","undefined","providerType","getProvider","getSupportedNamespace","error","sendError"],"sourceRoot":"../../../src","sources":["hooks/useProvider.ts"],"mappings":";;AAAA;AACA,SAASA,OAAO,QAAQ,OAAO;AAC/B,SAASC,WAAW,QAAQ,QAAQ;AACpC,SAASC,qBAAqB,EAAEC,aAAa,QAAQ,iCAAiC;;AAGtF;AACA;AACA;;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,WAAWA,CAAA,EAAmB;EAC5C,MAAM;IAAEC;EAAW,CAAC,GAAGJ,WAAW,CAACC,qBAAqB,CAACI,KAAK,CAAC;EAE/D,MAAMC,WAAW,GAAGP,OAAO,CAAC,MAAM;IAChC,IAAI,CAACK,UAAU,IAAI,CAACA,UAAU,CAACG,OAAO,EAAE;MACtC,OAAO;QAAEC,QAAQ,EAAEC,SAAS;QAAEC,YAAY,EAAED;MAAU,CAAC;IACzD;IAEA,IAAI;MACF,OAAO;QACLD,QAAQ,EAAEJ,UAAU,CAACG,OAAO,CAACI,WAAW,CAAC,CAAC;QAC1CD,YAAY,EAAEN,UAAU,CAACG,OAAO,CAACK,qBAAqB,CAAC;MACzD,CAAC;IACH,CAAC,CAAC,OAAOC,KAAK,EAAE;MACdX,aAAa,CAACY,SAAS,CAACD,KAAK,EAAE,aAAa,EAAE,aAAa,CAAC;;MAE5D;MACA,OAAO;QAAEL,QAAQ,EAAEC,SAAS;QAAEC,YAAY,EAAED;MAAU,CAAC;IACzD;EACF,CAAC,EAAE,CAACL,UAAU,CAAC,CAAC;EAEhB,OAAOE,WAAW;AACpB","ignoreList":[]}
1
+ {"version":3,"names":["useMemo","useSnapshot","ConnectionsController","LogController","useAppKitContext","useProvider","connection","state","returnValue","adapter","provider","undefined","providerType","getProvider","getSupportedNamespace","error","sendError"],"sourceRoot":"../../../src","sources":["hooks/useProvider.ts"],"mappings":";;AAAA;AACA,SAASA,OAAO,QAAQ,OAAO;AAC/B,SAASC,WAAW,QAAQ,QAAQ;AACpC,SAASC,qBAAqB,EAAEC,aAAa,QAAQ,iCAAiC;AAEtF,SAASC,gBAAgB,QAAQ,oBAAoB;;AAErD;AACA;AACA;;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,WAAWA,CAAA,EAAmB;EAC5CD,gBAAgB,CAAC,CAAC;EAClB,MAAM;IAAEE;EAAW,CAAC,GAAGL,WAAW,CAACC,qBAAqB,CAACK,KAAK,CAAC;EAE/D,MAAMC,WAAW,GAAGR,OAAO,CAAC,MAAM;IAChC,IAAI,CAACM,UAAU,IAAI,CAACA,UAAU,CAACG,OAAO,EAAE;MACtC,OAAO;QAAEC,QAAQ,EAAEC,SAAS;QAAEC,YAAY,EAAED;MAAU,CAAC;IACzD;IAEA,IAAI;MACF,OAAO;QACLD,QAAQ,EAAEJ,UAAU,CAACG,OAAO,CAACI,WAAW,CAAC,CAAC;QAC1CD,YAAY,EAAEN,UAAU,CAACG,OAAO,CAACK,qBAAqB,CAAC;MACzD,CAAC;IACH,CAAC,CAAC,OAAOC,KAAK,EAAE;MACdZ,aAAa,CAACa,SAAS,CAACD,KAAK,EAAE,aAAa,EAAE,aAAa,CAAC;;MAE5D;MACA,OAAO;QAAEL,QAAQ,EAAEC,SAAS;QAAEC,YAAY,EAAED;MAAU,CAAC;IACzD;EACF,CAAC,EAAE,CAACL,UAAU,CAAC,CAAC;EAEhB,OAAOE,WAAW;AACpB","ignoreList":[]}
@@ -3,9 +3,41 @@
3
3
  import { useMemo } from 'react';
4
4
  import { useSnapshot } from 'valtio';
5
5
  import { ConnectionsController } from '@reown/appkit-core-react-native';
6
- import { useAppKit } from './useAppKit';
6
+ import { useAppKitContext } from './useAppKitContext';
7
+
8
+ /**
9
+ * Hook to access information about the currently connected wallet
10
+ *
11
+ * @remarks
12
+ * This hook provides access to metadata about the connected wallet, such as its name,
13
+ * icon, and other identifying information. It automatically subscribes to wallet info
14
+ * changes via valtio.
15
+ *
16
+ * @returns An object containing:
17
+ * - `walletInfo`: Metadata about the currently connected wallet (name, icon, etc.)
18
+ *
19
+ * @example
20
+ * ```tsx
21
+ * function MyComponent() {
22
+ * const { walletInfo } = useWalletInfo();
23
+ *
24
+ * return (
25
+ * <View>
26
+ * {walletInfo && (
27
+ * <>
28
+ * <Image source={{ uri: walletInfo.icon }} />
29
+ * <Text>{walletInfo.name}</Text>
30
+ * </>
31
+ * )}
32
+ * </View>
33
+ * );
34
+ * }
35
+ * ```
36
+ *
37
+ * @throws {Error} If used outside of an AppKitProvider
38
+ */
7
39
  export function useWalletInfo() {
8
- useAppKit(); // Use the hook for checks
40
+ useAppKitContext();
9
41
  const {
10
42
  walletInfo: walletInfoSnapshot
11
43
  } = useSnapshot(ConnectionsController.state);
@@ -1 +1 @@
1
- {"version":3,"names":["useMemo","useSnapshot","ConnectionsController","useAppKit","useWalletInfo","walletInfo","walletInfoSnapshot","state"],"sourceRoot":"../../../src","sources":["hooks/useWalletInfo.ts"],"mappings":";;AAAA,SAASA,OAAO,QAAQ,OAAO;AAC/B,SAASC,WAAW,QAAQ,QAAQ;AACpC,SAASC,qBAAqB,QAAQ,iCAAiC;AACvE,SAASC,SAAS,QAAQ,aAAa;AAEvC,OAAO,SAASC,aAAaA,CAAA,EAAG;EAC9BD,SAAS,CAAC,CAAC,CAAC,CAAC;EACb,MAAM;IAAEE,UAAU,EAAEC;EAAmB,CAAC,GAAGL,WAAW,CAACC,qBAAqB,CAACK,KAAK,CAAC;EAEnF,MAAMF,UAAU,GAAGL,OAAO,CAAC,OAAO;IAAEK,UAAU,EAAEC;EAAmB,CAAC,CAAC,EAAE,CAACA,kBAAkB,CAAC,CAAC;EAE5F,OAAOD,UAAU;AACnB","ignoreList":[]}
1
+ {"version":3,"names":["useMemo","useSnapshot","ConnectionsController","useAppKitContext","useWalletInfo","walletInfo","walletInfoSnapshot","state"],"sourceRoot":"../../../src","sources":["hooks/useWalletInfo.ts"],"mappings":";;AAAA,SAASA,OAAO,QAAQ,OAAO;AAC/B,SAASC,WAAW,QAAQ,QAAQ;AACpC,SAASC,qBAAqB,QAAQ,iCAAiC;AACvE,SAASC,gBAAgB,QAAQ,oBAAoB;;AAErD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,aAAaA,CAAA,EAAG;EAC9BD,gBAAgB,CAAC,CAAC;EAClB,MAAM;IAAEE,UAAU,EAAEC;EAAmB,CAAC,GAAGL,WAAW,CAACC,qBAAqB,CAACK,KAAK,CAAC;EAEnF,MAAMF,UAAU,GAAGL,OAAO,CAAC,OAAO;IAAEK,UAAU,EAAEC;EAAmB,CAAC,CAAC,EAAE,CAACA,kBAAkB,CAAC,CAAC;EAE5F,OAAOD,UAAU;AACnB","ignoreList":[]}
@@ -15,6 +15,7 @@ export { AppKit } from './modal/w3m-modal';
15
15
  export { useAppKit } from './hooks/useAppKit';
16
16
  export { useProvider } from './hooks/useProvider';
17
17
  export { useAccount } from './hooks/useAccount';
18
+ export { useAppKitTheme } from './hooks/useAppKitTheme';
18
19
  export { useWalletInfo } from './hooks/useWalletInfo';
19
20
  export { useAppKitEvents, useAppKitEventSubscription } from './hooks/useAppKitEvents';
20
21
  export { useAppKitState } from './hooks/useAppKitState';
@@ -1 +1 @@
1
- {"version":3,"names":["AccountButton","AppKitButton","ConnectButton","NetworkButton","AppKit","useAppKit","useProvider","useAccount","useWalletInfo","useAppKitEvents","useAppKitEventSubscription","useAppKitState","useAppKitLogs","solana","solanaDevnet","solanaTestnet","bitcoin","bitcoinTestnet","ReownAuthentication","createAppKit","AppKitProvider"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;AAAA,OAAO,oCAAoC;;AAE3C;AACA,SACEA,aAA8B,QAEzB,4BAA4B;AACnC,SAASC,YAAY,QAAgC,oBAAoB;AACzE,SACEC,aAA8B,QAEzB,4BAA4B;AACnC,SACEC,aAA8B,QAEzB,4BAA4B;AACnC,SAASC,MAAM,QAAQ,mBAAmB;;AAE1C;;AAYA;AACA,SAASC,SAAS,QAAQ,mBAAmB;AAC7C,SAASC,WAAW,QAAQ,qBAAqB;AACjD,SAASC,UAAU,QAA0C,oBAAoB;AACjF,SAASC,aAAa,QAAQ,uBAAuB;AACrD,SAASC,eAAe,EAAEC,0BAA0B,QAAQ,yBAAyB;AACrF,SAASC,cAAc,QAAQ,wBAAwB;AACvD,SAASC,aAAa,QAAkC,uBAAuB;;AAE/E;AACA,SAASC,MAAM,EAAEC,YAAY,EAAEC,aAAa,QAAQ,mCAAmC;AACvF,SAASC,OAAO,EAAEC,cAAc,QAAQ,mCAAmC;;AAE3E;AACA,SAASC,mBAAmB,QAAQ,iCAAiC;;AAErE;AACA,SAASC,YAAY,QAAQ,UAAU;AACvC,SAASC,cAAc,QAAQ,iBAAiB","ignoreList":[]}
1
+ {"version":3,"names":["AccountButton","AppKitButton","ConnectButton","NetworkButton","AppKit","useAppKit","useProvider","useAccount","useAppKitTheme","useWalletInfo","useAppKitEvents","useAppKitEventSubscription","useAppKitState","useAppKitLogs","solana","solanaDevnet","solanaTestnet","bitcoin","bitcoinTestnet","ReownAuthentication","createAppKit","AppKitProvider"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;AAAA,OAAO,oCAAoC;;AAE3C;AACA,SACEA,aAA8B,QAEzB,4BAA4B;AACnC,SAASC,YAAY,QAAgC,oBAAoB;AACzE,SACEC,aAA8B,QAEzB,4BAA4B;AACnC,SACEC,aAA8B,QAEzB,4BAA4B;AACnC,SAASC,MAAM,QAAQ,mBAAmB;;AAE1C;;AAYA;AACA,SAASC,SAAS,QAAQ,mBAAmB;AAC7C,SAASC,WAAW,QAAQ,qBAAqB;AACjD,SAASC,UAAU,QAA0C,oBAAoB;AACjF,SAASC,cAAc,QAAmC,wBAAwB;AAClF,SAASC,aAAa,QAAQ,uBAAuB;AACrD,SAASC,eAAe,EAAEC,0BAA0B,QAAQ,yBAAyB;AACrF,SAASC,cAAc,QAAQ,wBAAwB;AACvD,SAASC,aAAa,QAAkC,uBAAuB;;AAE/E;AACA,SAASC,MAAM,EAAEC,YAAY,EAAEC,aAAa,QAAQ,mCAAmC;AACvF,SAASC,OAAO,EAAEC,cAAc,QAAQ,mCAAmC;;AAE3E;AACA,SAASC,mBAAmB,QAAQ,iCAAiC;;AAErE;AACA,SAASC,YAAY,QAAQ,UAAU;AACvC,SAASC,cAAc,QAAQ,iBAAiB","ignoreList":[]}
@@ -1,6 +1,6 @@
1
1
  import React, { type ReactNode } from 'react';
2
2
  import { AppKit } from './AppKit';
3
- interface AppKitContextType {
3
+ export interface AppKitContextType {
4
4
  appKit: AppKit | null;
5
5
  }
6
6
  export declare const AppKitContext: React.Context<AppKitContextType>;
@@ -1 +1 @@
1
- {"version":3,"file":"AppKitContext.d.ts","sourceRoot":"","sources":["../../src/AppKitContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAsC,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAClF,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,UAAU,iBAAiB;IACzB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB;AAED,eAAO,MAAM,aAAa,kCAAqD,CAAC;AAEhF,UAAU,mBAAmB;IAC3B,QAAQ,EAAE,SAAS,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAExD,CAAC;AAEF,eAAO,MAAM,iBAAiB;;;;;;;;;CA4B7B,CAAC"}
1
+ {"version":3,"file":"AppKitContext.d.ts","sourceRoot":"","sources":["../../src/AppKitContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAsC,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAClF,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB;AAED,eAAO,MAAM,aAAa,kCAAqD,CAAC;AAEhF,UAAU,mBAAmB;IAC3B,QAAQ,EAAE,SAAS,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAExD,CAAC;AAEF,eAAO,MAAM,iBAAiB;;;;;;;;;CA4B7B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"useAccount.d.ts","sourceRoot":"","sources":["../../../src/hooks/useAccount.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAEpF;;GAEG;AACH,MAAM,WAAW,OAAO;IACtB,4CAA4C;IAC5C,OAAO,EAAE,MAAM,CAAC;IAChB,kFAAkF;IAClF,SAAS,EAAE,MAAM,CAAC;IAClB,gDAAgD;IAChD,OAAO,EAAE,MAAM,CAAC;IAChB,2DAA2D;IAC3D,IAAI,CAAC,EAAE,WAAW,CAAC;CACpB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,wBAAgB,UAAU;;;;;;;EAoDzB"}
1
+ {"version":3,"file":"useAccount.d.ts","sourceRoot":"","sources":["../../../src/hooks/useAccount.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAGpF;;GAEG;AACH,MAAM,WAAW,OAAO;IACtB,4CAA4C;IAC5C,OAAO,EAAE,MAAM,CAAC;IAChB,kFAAkF;IAClF,SAAS,EAAE,MAAM,CAAC;IAClB,gDAAgD;IAChD,OAAO,EAAE,MAAM,CAAC;IAChB,2DAA2D;IAC3D,IAAI,CAAC,EAAE,WAAW,CAAC;CACpB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,wBAAgB,UAAU;;;;;;;EAsDzB"}
@@ -1,11 +1,53 @@
1
1
  import type { ChainNamespace } from '@reown/appkit-common-react-native';
2
2
  import type { AppKit } from '../AppKit';
3
+ /**
4
+ * Interface representing the return value of the useAppKit hook
5
+ */
3
6
  interface UseAppKitReturn {
7
+ /** Function to open the AppKit modal with optional view configuration */
4
8
  open: AppKit['open'];
9
+ /** Function to close the AppKit modal */
5
10
  close: AppKit['close'];
11
+ /** Function to disconnect the wallet, optionally scoped to a specific namespace */
6
12
  disconnect: (namespace?: ChainNamespace) => void;
13
+ /** Function to switch to a different network */
7
14
  switchNetwork: AppKit['switchNetwork'];
8
15
  }
16
+ /**
17
+ * Hook to access core AppKit functionality for controlling the modal
18
+ *
19
+ * @remarks
20
+ * This hook provides access to the main AppKit instance methods for opening/closing
21
+ * the modal, disconnecting wallets, and switching networks. All functions are memoized
22
+ * and properly bound to ensure stable references across renders.
23
+ *
24
+ * @returns {UseAppKitReturn} An object containing:
25
+ * - `open`: Opens the AppKit modal, optionally with a specific view
26
+ * - `close`: Closes the AppKit modal
27
+ * - `disconnect`: Disconnects the current wallet connection (optionally for a specific namespace)
28
+ * - `switchNetwork`: Switches to a different blockchain network
29
+ *
30
+ * @throws {Error} If used outside of an AppKitProvider
31
+ * @throws {Error} If AppKit instance is not available in context
32
+ *
33
+ * @example
34
+ * ```tsx
35
+ * function MyComponent() {
36
+ * const { open, close, disconnect, switchNetwork } = useAppKit();
37
+ *
38
+ * return (
39
+ * <View>
40
+ * <Button onPress={() => open()} title="Connect Wallet" />
41
+ * <Button onPress={() => disconnect()} title="Disconnect" />
42
+ * <Button
43
+ * onPress={() => switchNetwork('eip155:1')}
44
+ * title="Switch to Ethereum"
45
+ * />
46
+ * </View>
47
+ * );
48
+ * }
49
+ * ```
50
+ */
9
51
  export declare const useAppKit: () => UseAppKitReturn;
10
52
  export {};
11
53
  //# sourceMappingURL=useAppKit.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useAppKit.d.ts","sourceRoot":"","sources":["../../../src/hooks/useAppKit.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AAExE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAGxC,UAAU,eAAe;IACvB,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;IACvB,UAAU,EAAE,CAAC,SAAS,CAAC,EAAE,cAAc,KAAK,IAAI,CAAC;IACjD,aAAa,EAAE,MAAM,CAAC,eAAe,CAAC,CAAC;CACxC;AAED,eAAO,MAAM,SAAS,QAAO,eA2B5B,CAAC"}
1
+ {"version":3,"file":"useAppKit.d.ts","sourceRoot":"","sources":["../../../src/hooks/useAppKit.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AAExE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAGxC;;GAEG;AACH,UAAU,eAAe;IACvB,yEAAyE;IACzE,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;IACrB,yCAAyC;IACzC,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;IACvB,mFAAmF;IACnF,UAAU,EAAE,CAAC,SAAS,CAAC,EAAE,cAAc,KAAK,IAAI,CAAC;IACjD,gDAAgD;IAChD,aAAa,EAAE,MAAM,CAAC,eAAe,CAAC,CAAC;CACxC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,eAAO,MAAM,SAAS,QAAO,eAkB5B,CAAC"}
@@ -0,0 +1,27 @@
1
+ import { type AppKitContextType } from '../AppKitContext';
2
+ /**
3
+ * Hook to access the AppKit context
4
+ *
5
+ * @remarks
6
+ * This is an internal hook used by other AppKit hooks to ensure they're used within
7
+ * the AppKitProvider. You typically don't need to use this hook directly - use the
8
+ * higher-level hooks like `useAppKit`, `useAccount`, `useAppKitTheme`, etc. instead.
9
+ *
10
+ * @returns {AppKitContextType} The AppKit context containing the AppKit instance
11
+ *
12
+ * @throws {Error} If used outside of an AppKitProvider
13
+ * @throws {Error} If the AppKit instance is not yet available in context
14
+ *
15
+ * @internal
16
+ *
17
+ * @example
18
+ * ```tsx
19
+ * // This is typically used internally by other hooks
20
+ * function MyCustomHook() {
21
+ * const context = useAppKitContext();
22
+ * // Use context.appKit...
23
+ * }
24
+ * ```
25
+ */
26
+ export declare const useAppKitContext: () => AppKitContextType;
27
+ //# sourceMappingURL=useAppKitContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useAppKitContext.d.ts","sourceRoot":"","sources":["../../../src/hooks/useAppKitContext.ts"],"names":[],"mappings":"AAEA,OAAO,EAAiB,KAAK,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAEzE;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,eAAO,MAAM,gBAAgB,QAAO,iBAanC,CAAC"}