@reown/appkit-react-native 0.0.0-develop-20251008155354 → 0.0.0-develop-20251114152149
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.
- package/lib/commonjs/AppKit.js +20 -6
- package/lib/commonjs/AppKit.js.map +1 -1
- package/lib/commonjs/hooks/useAccount.js +68 -5
- package/lib/commonjs/hooks/useAccount.js.map +1 -1
- package/lib/commonjs/hooks/useAppKit.js +41 -9
- package/lib/commonjs/hooks/useAppKit.js.map +1 -1
- package/lib/commonjs/hooks/useAppKitContext.js +46 -0
- package/lib/commonjs/hooks/useAppKitContext.js.map +1 -0
- package/lib/commonjs/hooks/useAppKitEvents.js +64 -4
- package/lib/commonjs/hooks/useAppKitEvents.js.map +1 -1
- package/lib/commonjs/hooks/useAppKitLogs.js +2 -8
- package/lib/commonjs/hooks/useAppKitLogs.js.map +1 -1
- package/lib/commonjs/hooks/useAppKitState.js +35 -2
- package/lib/commonjs/hooks/useAppKitState.js.map +1 -1
- package/lib/commonjs/hooks/useAppKitTheme.js +74 -0
- package/lib/commonjs/hooks/useAppKitTheme.js.map +1 -0
- package/lib/commonjs/hooks/useProvider.js +3 -4
- package/lib/commonjs/hooks/useProvider.js.map +1 -1
- package/lib/commonjs/hooks/useWalletInfo.js +33 -2
- package/lib/commonjs/hooks/useWalletInfo.js.map +1 -1
- package/lib/commonjs/index.js +7 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/modal/w3m-modal/styles.js +2 -1
- package/lib/commonjs/modal/w3m-modal/styles.js.map +1 -1
- package/lib/commonjs/partials/w3m-connecting-body/index.js +2 -0
- package/lib/commonjs/partials/w3m-connecting-body/index.js.map +1 -1
- package/lib/commonjs/partials/w3m-connecting-mobile/components/StoreLink.js +4 -0
- package/lib/commonjs/partials/w3m-connecting-mobile/components/StoreLink.js.map +1 -1
- package/lib/commonjs/partials/w3m-connecting-qrcode/index.js +5 -1
- package/lib/commonjs/partials/w3m-connecting-qrcode/index.js.map +1 -1
- package/lib/commonjs/partials/w3m-header/index.js +1 -0
- package/lib/commonjs/partials/w3m-header/index.js.map +1 -1
- package/lib/commonjs/partials/w3m-header/styles.js +3 -0
- package/lib/commonjs/partials/w3m-header/styles.js.map +1 -1
- package/lib/commonjs/partials/w3m-send-input-token/index.js +6 -3
- package/lib/commonjs/partials/w3m-send-input-token/index.js.map +1 -1
- package/lib/commonjs/partials/w3m-swap-input/index.js +6 -3
- package/lib/commonjs/partials/w3m-swap-input/index.js.map +1 -1
- package/lib/commonjs/views/w3m-account-default-view/index.js +2 -1
- package/lib/commonjs/views/w3m-account-default-view/index.js.map +1 -1
- package/lib/commonjs/views/w3m-connecting-external-view/index.js +4 -8
- package/lib/commonjs/views/w3m-connecting-external-view/index.js.map +1 -1
- package/lib/commonjs/views/w3m-connecting-view/index.js +17 -7
- package/lib/commonjs/views/w3m-connecting-view/index.js.map +1 -1
- package/lib/commonjs/views/w3m-onramp-settings-view/index.js +2 -0
- package/lib/commonjs/views/w3m-onramp-settings-view/index.js.map +1 -1
- package/lib/commonjs/views/w3m-onramp-view/index.js +3 -2
- package/lib/commonjs/views/w3m-onramp-view/index.js.map +1 -1
- package/lib/commonjs/views/w3m-swap-view/components/select-token-modal/index.js +2 -1
- package/lib/commonjs/views/w3m-swap-view/components/select-token-modal/index.js.map +1 -1
- package/lib/commonjs/views/w3m-swap-view/index.js +4 -2
- package/lib/commonjs/views/w3m-swap-view/index.js.map +1 -1
- package/lib/commonjs/views/w3m-wallet-send-view/index.js +2 -1
- package/lib/commonjs/views/w3m-wallet-send-view/index.js.map +1 -1
- package/lib/module/AppKit.js +20 -6
- package/lib/module/AppKit.js.map +1 -1
- package/lib/module/hooks/useAccount.js +69 -5
- package/lib/module/hooks/useAccount.js.map +1 -1
- package/lib/module/hooks/useAppKit.js +43 -10
- package/lib/module/hooks/useAppKit.js.map +1 -1
- package/lib/module/hooks/useAppKitContext.js +42 -0
- package/lib/module/hooks/useAppKitContext.js.map +1 -0
- package/lib/module/hooks/useAppKitEvents.js +65 -4
- package/lib/module/hooks/useAppKitEvents.js.map +1 -1
- package/lib/module/hooks/useAppKitLogs.js +3 -9
- package/lib/module/hooks/useAppKitLogs.js.map +1 -1
- package/lib/module/hooks/useAppKitState.js +36 -2
- package/lib/module/hooks/useAppKitState.js.map +1 -1
- package/lib/module/hooks/useAppKitTheme.js +71 -0
- package/lib/module/hooks/useAppKitTheme.js.map +1 -0
- package/lib/module/hooks/useProvider.js +3 -4
- package/lib/module/hooks/useProvider.js.map +1 -1
- package/lib/module/hooks/useWalletInfo.js +34 -2
- package/lib/module/hooks/useWalletInfo.js.map +1 -1
- package/lib/module/index.js +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/modal/w3m-modal/styles.js +2 -1
- package/lib/module/modal/w3m-modal/styles.js.map +1 -1
- package/lib/module/partials/w3m-connecting-body/index.js +2 -0
- package/lib/module/partials/w3m-connecting-body/index.js.map +1 -1
- package/lib/module/partials/w3m-connecting-mobile/components/StoreLink.js +4 -0
- package/lib/module/partials/w3m-connecting-mobile/components/StoreLink.js.map +1 -1
- package/lib/module/partials/w3m-connecting-qrcode/index.js +5 -1
- package/lib/module/partials/w3m-connecting-qrcode/index.js.map +1 -1
- package/lib/module/partials/w3m-header/index.js +1 -0
- package/lib/module/partials/w3m-header/index.js.map +1 -1
- package/lib/module/partials/w3m-header/styles.js +3 -0
- package/lib/module/partials/w3m-header/styles.js.map +1 -1
- package/lib/module/partials/w3m-send-input-token/index.js +6 -3
- package/lib/module/partials/w3m-send-input-token/index.js.map +1 -1
- package/lib/module/partials/w3m-swap-input/index.js +6 -3
- package/lib/module/partials/w3m-swap-input/index.js.map +1 -1
- package/lib/module/views/w3m-account-default-view/index.js +2 -1
- package/lib/module/views/w3m-account-default-view/index.js.map +1 -1
- package/lib/module/views/w3m-connecting-external-view/index.js +4 -8
- package/lib/module/views/w3m-connecting-external-view/index.js.map +1 -1
- package/lib/module/views/w3m-connecting-view/index.js +17 -7
- package/lib/module/views/w3m-connecting-view/index.js.map +1 -1
- package/lib/module/views/w3m-onramp-settings-view/index.js +2 -0
- package/lib/module/views/w3m-onramp-settings-view/index.js.map +1 -1
- package/lib/module/views/w3m-onramp-view/index.js +3 -2
- package/lib/module/views/w3m-onramp-view/index.js.map +1 -1
- package/lib/module/views/w3m-swap-view/components/select-token-modal/index.js +2 -1
- package/lib/module/views/w3m-swap-view/components/select-token-modal/index.js.map +1 -1
- package/lib/module/views/w3m-swap-view/index.js +4 -2
- package/lib/module/views/w3m-swap-view/index.js.map +1 -1
- package/lib/module/views/w3m-wallet-send-view/index.js +2 -1
- package/lib/module/views/w3m-wallet-send-view/index.js.map +1 -1
- package/lib/typescript/AppKit.d.ts +9 -2
- package/lib/typescript/AppKit.d.ts.map +1 -1
- package/lib/typescript/AppKitContext.d.ts +2 -2
- package/lib/typescript/AppKitContext.d.ts.map +1 -1
- package/lib/typescript/hooks/useAccount.d.ts +57 -33
- package/lib/typescript/hooks/useAccount.d.ts.map +1 -1
- package/lib/typescript/hooks/useAppKit.d.ts +42 -0
- package/lib/typescript/hooks/useAppKit.d.ts.map +1 -1
- package/lib/typescript/hooks/useAppKitContext.d.ts +27 -0
- package/lib/typescript/hooks/useAppKitContext.d.ts.map +1 -0
- package/lib/typescript/hooks/useAppKitEvents.d.ts +66 -0
- package/lib/typescript/hooks/useAppKitEvents.d.ts.map +1 -1
- package/lib/typescript/hooks/useAppKitLogs.d.ts.map +1 -1
- package/lib/typescript/hooks/useAppKitState.d.ts +32 -0
- package/lib/typescript/hooks/useAppKitState.d.ts.map +1 -1
- package/lib/typescript/hooks/useAppKitTheme.d.ts +59 -0
- package/lib/typescript/hooks/useAppKitTheme.d.ts.map +1 -0
- package/lib/typescript/hooks/useProvider.d.ts +1 -4
- package/lib/typescript/hooks/useProvider.d.ts.map +1 -1
- package/lib/typescript/hooks/useWalletInfo.d.ts +31 -0
- package/lib/typescript/hooks/useWalletInfo.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +2 -1
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/modal/w3m-modal/styles.d.ts +1 -0
- package/lib/typescript/modal/w3m-modal/styles.d.ts.map +1 -1
- package/lib/typescript/partials/w3m-connecting-body/index.d.ts.map +1 -1
- package/lib/typescript/partials/w3m-connecting-qrcode/index.d.ts.map +1 -1
- package/lib/typescript/partials/w3m-header/index.d.ts.map +1 -1
- package/lib/typescript/partials/w3m-header/styles.d.ts +3 -0
- package/lib/typescript/partials/w3m-header/styles.d.ts.map +1 -1
- package/lib/typescript/partials/w3m-send-input-token/index.d.ts +2 -1
- package/lib/typescript/partials/w3m-send-input-token/index.d.ts.map +1 -1
- package/lib/typescript/partials/w3m-swap-input/index.d.ts +2 -1
- package/lib/typescript/partials/w3m-swap-input/index.d.ts.map +1 -1
- package/lib/typescript/views/w3m-account-default-view/index.d.ts.map +1 -1
- package/lib/typescript/views/w3m-connecting-external-view/index.d.ts.map +1 -1
- package/lib/typescript/views/w3m-connecting-view/index.d.ts.map +1 -1
- package/lib/typescript/views/w3m-onramp-settings-view/index.d.ts.map +1 -1
- package/lib/typescript/views/w3m-onramp-view/index.d.ts.map +1 -1
- package/lib/typescript/views/w3m-swap-view/index.d.ts.map +1 -1
- package/lib/typescript/views/w3m-wallet-send-view/index.d.ts.map +1 -1
- package/package.json +5 -4
- package/src/AppKit.ts +27 -7
- package/src/AppKitContext.tsx +1 -1
- package/src/hooks/useAccount.ts +93 -5
- package/src/hooks/useAppKit.ts +45 -12
- package/src/hooks/useAppKitContext.ts +43 -0
- package/src/hooks/useAppKitEvents.ts +63 -3
- package/src/hooks/useAppKitLogs.ts +3 -11
- package/src/hooks/useAppKitState.ts +35 -2
- package/src/hooks/useAppKitTheme.ts +81 -0
- package/src/hooks/useProvider.ts +3 -4
- package/src/hooks/useWalletInfo.ts +33 -2
- package/src/index.ts +2 -1
- package/src/modal/w3m-modal/styles.ts +2 -1
- package/src/partials/w3m-connecting-body/index.tsx +3 -1
- package/src/partials/w3m-connecting-mobile/components/StoreLink.tsx +4 -1
- package/src/partials/w3m-connecting-qrcode/index.tsx +10 -1
- package/src/partials/w3m-header/index.tsx +6 -1
- package/src/partials/w3m-header/styles.ts +3 -0
- package/src/partials/w3m-send-input-token/index.tsx +5 -1
- package/src/partials/w3m-swap-input/index.tsx +5 -1
- package/src/views/w3m-account-default-view/index.tsx +6 -1
- package/src/views/w3m-connecting-external-view/index.tsx +4 -8
- package/src/views/w3m-connecting-view/index.tsx +24 -8
- package/src/views/w3m-onramp-settings-view/index.tsx +7 -1
- package/src/views/w3m-onramp-view/index.tsx +3 -2
- package/src/views/w3m-swap-view/components/select-token-modal/index.tsx +1 -1
- package/src/views/w3m-swap-view/index.tsx +2 -0
- package/src/views/w3m-wallet-send-view/index.tsx +1 -0
|
@@ -1,5 +1,37 @@
|
|
|
1
1
|
import { type EventsControllerState } from '@reown/appkit-core-react-native';
|
|
2
2
|
import { type EventName } from '@reown/appkit-common-react-native';
|
|
3
|
+
/**
|
|
4
|
+
* Hook to subscribe to all AppKit events
|
|
5
|
+
*
|
|
6
|
+
* @remarks
|
|
7
|
+
* This hook provides reactive access to AppKit's event system, allowing you to
|
|
8
|
+
* monitor all events that occur within the AppKit lifecycle (connections, disconnections,
|
|
9
|
+
* network changes, etc.). The callback is invoked whenever a new event is emitted.
|
|
10
|
+
*
|
|
11
|
+
* @param callback - Optional callback function invoked when any event occurs
|
|
12
|
+
*
|
|
13
|
+
* @returns An object containing:
|
|
14
|
+
* - `data`: The most recent event data
|
|
15
|
+
* - `timestamp`: The timestamp of the most recent event
|
|
16
|
+
*
|
|
17
|
+
* @throws {Error} If used outside of an AppKitProvider
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```tsx
|
|
21
|
+
* function MyComponent() {
|
|
22
|
+
* const { data, timestamp } = useAppKitEvents((event) => {
|
|
23
|
+
* console.log('Event occurred:', event.data.event);
|
|
24
|
+
* });
|
|
25
|
+
*
|
|
26
|
+
* return (
|
|
27
|
+
* <View>
|
|
28
|
+
* <Text>Last event: {data?.event}</Text>
|
|
29
|
+
* <Text>Time: {timestamp}</Text>
|
|
30
|
+
* </View>
|
|
31
|
+
* );
|
|
32
|
+
* }
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
3
35
|
export declare function useAppKitEvents(callback?: (newEvent: EventsControllerState) => void): {
|
|
4
36
|
data: {
|
|
5
37
|
readonly type: "track";
|
|
@@ -92,6 +124,13 @@ export declare function useAppKitEvents(callback?: (newEvent: EventsControllerSt
|
|
|
92
124
|
readonly properties: {
|
|
93
125
|
readonly message: string;
|
|
94
126
|
};
|
|
127
|
+
} | {
|
|
128
|
+
readonly type: "track";
|
|
129
|
+
readonly address?: string | undefined;
|
|
130
|
+
readonly event: "USER_REJECTED";
|
|
131
|
+
readonly properties: {
|
|
132
|
+
readonly message: string;
|
|
133
|
+
};
|
|
95
134
|
} | {
|
|
96
135
|
readonly type: "track";
|
|
97
136
|
readonly event: "DISCONNECT_SUCCESS";
|
|
@@ -371,5 +410,32 @@ export declare function useAppKitEvents(callback?: (newEvent: EventsControllerSt
|
|
|
371
410
|
};
|
|
372
411
|
timestamp: number;
|
|
373
412
|
};
|
|
413
|
+
/**
|
|
414
|
+
* Hook to subscribe to a specific AppKit event
|
|
415
|
+
*
|
|
416
|
+
* @remarks
|
|
417
|
+
* This hook allows you to listen for a specific event type rather than all events.
|
|
418
|
+
* It's more efficient than `useAppKitEvents` when you only care about a particular event.
|
|
419
|
+
*
|
|
420
|
+
* @param event - The specific event name to subscribe to (e.g., 'MODAL_OPEN', 'CONNECT_SUCCESS')
|
|
421
|
+
* @param callback - Callback function invoked when the specified event occurs
|
|
422
|
+
*
|
|
423
|
+
* @throws {Error} If used outside of an AppKitProvider
|
|
424
|
+
*
|
|
425
|
+
* @example
|
|
426
|
+
* ```tsx
|
|
427
|
+
* function MyComponent() {
|
|
428
|
+
* useAppKitEventSubscription('CONNECT_SUCCESS', (event) => {
|
|
429
|
+
* console.log('Wallet connected!', event.data);
|
|
430
|
+
* });
|
|
431
|
+
*
|
|
432
|
+
* useAppKitEventSubscription('DISCONNECT_SUCCESS', (event) => {
|
|
433
|
+
* console.log('Wallet disconnected!', event.data);
|
|
434
|
+
* });
|
|
435
|
+
*
|
|
436
|
+
* return <View>{/ Your component /}</View>;
|
|
437
|
+
* }
|
|
438
|
+
* ```
|
|
439
|
+
*/
|
|
374
440
|
export declare function useAppKitEventSubscription(event: EventName, callback: (newEvent: EventsControllerState) => void): void;
|
|
375
441
|
//# sourceMappingURL=useAppKitEvents.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAppKitEvents.d.ts","sourceRoot":"","sources":["../../../src/hooks/useAppKitEvents.ts"],"names":[],"mappings":"AAEA,OAAO,EAAoB,KAAK,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AAC/F,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,mCAAmC,CAAC;AAGnE,wBAAgB,eAAe,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,qBAAqB,KAAK,IAAI
|
|
1
|
+
{"version":3,"file":"useAppKitEvents.d.ts","sourceRoot":"","sources":["../../../src/hooks/useAppKitEvents.ts"],"names":[],"mappings":"AAEA,OAAO,EAAoB,KAAK,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AAC/F,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,mCAAmC,CAAC;AAGnE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAgB,eAAe,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,qBAAqB,KAAK,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;AACH,eAAO,MAAM,aAAa,QAAO,
|
|
1
|
+
{"version":3,"file":"useAppKitLogs.d.ts","sourceRoot":"","sources":["../../../src/hooks/useAppKitLogs.ts"],"names":[],"mappings":"AAEA,OAAO,EAAiB,KAAK,QAAQ,EAAE,KAAK,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAG9F,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,IAAI,EAAE,QAAQ,EAAE,CAAC;IAEjB;;OAEG;IACH,cAAc,EAAE,CAAC,KAAK,EAAE,QAAQ,KAAK,QAAQ,EAAE,CAAC;IAEhD;;OAEG;IACH,aAAa,EAAE,CAAC,KAAK,CAAC,EAAE,MAAM,KAAK,QAAQ,EAAE,CAAC;IAE9C;;OAEG;IACH,UAAU,EAAE,MAAM,MAAM,CAAC;IAEzB;;OAEG;IACH,YAAY,EAAE,MAAM,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IAE7C;;OAEG;IACH,SAAS,EAAE,MAAM,IAAI,CAAC;IAEtB;;OAEG;IACH,SAAS,EAAE,QAAQ,EAAE,CAAC;IACtB,WAAW,EAAE,QAAQ,EAAE,CAAC;IACxB,QAAQ,EAAE,QAAQ,EAAE,CAAC;IACrB,SAAS,EAAE,QAAQ,EAAE,CAAC;CACvB;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,aAAa,QAAO,mBAsDhC,CAAC"}
|
|
@@ -1,3 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hook to access the overall state of the AppKit modal and connection
|
|
3
|
+
*
|
|
4
|
+
* @remarks
|
|
5
|
+
* This hook provides a high-level view of the AppKit's current state, including
|
|
6
|
+
* whether the modal is open, if it's loading, connection status, and the active chain.
|
|
7
|
+
* It's useful for coordinating UI elements with the AppKit's state.
|
|
8
|
+
*
|
|
9
|
+
* @returns An object containing:
|
|
10
|
+
* - `isOpen`: Whether the AppKit modal is currently open
|
|
11
|
+
* - `isLoading`: Whether the AppKit is in a loading state
|
|
12
|
+
* - `isConnected`: Whether a wallet is currently connected
|
|
13
|
+
* - `chain`: The currently active blockchain network
|
|
14
|
+
*
|
|
15
|
+
* @throws {Error} If used outside of an AppKitProvider
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```tsx
|
|
19
|
+
* function MyComponent() {
|
|
20
|
+
* const { isOpen, isLoading, isConnected, chain } = useAppKitState();
|
|
21
|
+
*
|
|
22
|
+
* return (
|
|
23
|
+
* <View>
|
|
24
|
+
* <Text>Modal: {isOpen ? 'Open' : 'Closed'}</Text>
|
|
25
|
+
* <Text>Loading: {isLoading ? 'Yes' : 'No'}</Text>
|
|
26
|
+
* <Text>Connected: {isConnected ? 'Yes' : 'No'}</Text>
|
|
27
|
+
* {chain && <Text>Chain: {chain.name}</Text>}
|
|
28
|
+
* </View>
|
|
29
|
+
* );
|
|
30
|
+
* }
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
1
33
|
export declare function useAppKitState(): {
|
|
2
34
|
isOpen: boolean;
|
|
3
35
|
isLoading: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAppKitState.d.ts","sourceRoot":"","sources":["../../../src/hooks/useAppKitState.ts"],"names":[],"mappings":"AAMA,wBAAgB,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmB7B"}
|
|
1
|
+
{"version":3,"file":"useAppKitState.d.ts","sourceRoot":"","sources":["../../../src/hooks/useAppKitState.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,wBAAgB,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmB7B"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { ThemeMode, ThemeVariables } from '@reown/appkit-common-react-native';
|
|
2
|
+
/**
|
|
3
|
+
* Interface representing the result of the useAppKitTheme hook
|
|
4
|
+
*/
|
|
5
|
+
export interface UseAppKitThemeReturn {
|
|
6
|
+
/** The current theme mode ('dark' or 'light'), or undefined if using system default */
|
|
7
|
+
themeMode?: ThemeMode;
|
|
8
|
+
/** The current theme variables, currently only supports 'accent' color */
|
|
9
|
+
themeVariables: ThemeVariables;
|
|
10
|
+
/** Function to set the theme mode */
|
|
11
|
+
setThemeMode: (themeMode: ThemeMode | undefined) => void;
|
|
12
|
+
/** Function to set theme variables */
|
|
13
|
+
setThemeVariables: (themeVariables: ThemeVariables | undefined) => void;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Hook to control the visual appearance of the AppKit modal
|
|
17
|
+
*
|
|
18
|
+
* @remarks
|
|
19
|
+
* This hook provides access to the theme mode and theme variables, allowing you to
|
|
20
|
+
* customize the modal's appearance. Use this hook when you need to implement dark/light
|
|
21
|
+
* mode or match the modal's appearance with your application's theme.
|
|
22
|
+
*
|
|
23
|
+
* Currently, the only supported theme variable is `accent`, which controls the primary
|
|
24
|
+
* accent color used throughout the modal interface.
|
|
25
|
+
*
|
|
26
|
+
* @returns {UseAppKitThemeReturn} An object containing:
|
|
27
|
+
* - `themeMode`: The current theme mode ('dark' or 'light')
|
|
28
|
+
* - `themeVariables`: The current theme variables (only 'accent' is supported)
|
|
29
|
+
* - `setThemeMode`: Function to change the theme mode
|
|
30
|
+
* - `setThemeVariables`: Function to update theme variables
|
|
31
|
+
*
|
|
32
|
+
* @throws {Error} If used outside of an AppKitProvider
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```typescript
|
|
36
|
+
* import { useAppKitTheme } from '@reown/appkit-react-native';
|
|
37
|
+
*
|
|
38
|
+
* function MyComponent() {
|
|
39
|
+
* const { themeMode, themeVariables, setThemeMode, setThemeVariables } = useAppKitTheme();
|
|
40
|
+
*
|
|
41
|
+
* // Set theme to dark mode
|
|
42
|
+
* setThemeMode('dark');
|
|
43
|
+
*
|
|
44
|
+
* // Customize the accent color
|
|
45
|
+
* setThemeVariables({
|
|
46
|
+
* accent: '#00BB7F'
|
|
47
|
+
* });
|
|
48
|
+
*
|
|
49
|
+
* return (
|
|
50
|
+
* <View>
|
|
51
|
+
* <Text>Current theme: {themeMode}</Text>
|
|
52
|
+
* <Text>Accent color: {themeVariables?.accent}</Text>
|
|
53
|
+
* </View>
|
|
54
|
+
* );
|
|
55
|
+
* }
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
58
|
+
export declare function useAppKitTheme(): UseAppKitThemeReturn;
|
|
59
|
+
//# sourceMappingURL=useAppKitTheme.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAppKitTheme.d.ts","sourceRoot":"","sources":["../../../src/hooks/useAppKitTheme.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AAInF;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,uFAAuF;IACvF,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,0EAA0E;IAC1E,cAAc,EAAE,cAAc,CAAC;IAC/B,qCAAqC;IACrC,YAAY,EAAE,CAAC,SAAS,EAAE,SAAS,GAAG,SAAS,KAAK,IAAI,CAAC;IACzD,sCAAsC;IACtC,iBAAiB,EAAE,CAAC,cAAc,EAAE,cAAc,GAAG,SAAS,KAAK,IAAI,CAAC;CACzE;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,wBAAgB,cAAc,IAAI,oBAAoB,CAiBrD"}
|
|
@@ -23,10 +23,7 @@ interface ProviderResult {
|
|
|
23
23
|
*
|
|
24
24
|
* if (provider) {
|
|
25
25
|
* // Use the provider for blockchain operations
|
|
26
|
-
* const balance = await provider.request({
|
|
27
|
-
* method: 'eth_getBalance',
|
|
28
|
-
* params: [address, 'latest']
|
|
29
|
-
* });
|
|
26
|
+
* const balance = await provider.request({...});
|
|
30
27
|
* }
|
|
31
28
|
* ```
|
|
32
29
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useProvider.d.ts","sourceRoot":"","sources":["../../../src/hooks/useProvider.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;
|
|
1
|
+
{"version":3,"file":"useProvider.d.ts","sourceRoot":"","sources":["../../../src/hooks/useProvider.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AAGlF;;GAEG;AACH,UAAU,cAAc;IACtB,8CAA8C;IAC9C,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,oDAAoD;IACpD,YAAY,CAAC,EAAE,cAAc,CAAC;CAC/B;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,WAAW,IAAI,cAAc,CAuB5C"}
|
|
@@ -1,3 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hook to access information about the currently connected wallet
|
|
3
|
+
*
|
|
4
|
+
* @remarks
|
|
5
|
+
* This hook provides access to metadata about the connected wallet, such as its name,
|
|
6
|
+
* icon, and other identifying information. It automatically subscribes to wallet info
|
|
7
|
+
* changes via valtio.
|
|
8
|
+
*
|
|
9
|
+
* @returns An object containing:
|
|
10
|
+
* - `walletInfo`: Metadata about the currently connected wallet (name, icon, etc.)
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```tsx
|
|
14
|
+
* function MyComponent() {
|
|
15
|
+
* const { walletInfo } = useWalletInfo();
|
|
16
|
+
*
|
|
17
|
+
* return (
|
|
18
|
+
* <View>
|
|
19
|
+
* {walletInfo && (
|
|
20
|
+
* <>
|
|
21
|
+
* <Image source={{ uri: walletInfo.icon }} />
|
|
22
|
+
* <Text>{walletInfo.name}</Text>
|
|
23
|
+
* </>
|
|
24
|
+
* )}
|
|
25
|
+
* </View>
|
|
26
|
+
* );
|
|
27
|
+
* }
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* @throws {Error} If used outside of an AppKitProvider
|
|
31
|
+
*/
|
|
1
32
|
export declare function useWalletInfo(): {
|
|
2
33
|
walletInfo: {
|
|
3
34
|
readonly [x: string]: unknown;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useWalletInfo.d.ts","sourceRoot":"","sources":["../../../src/hooks/useWalletInfo.ts"],"names":[],"mappings":"AAKA,wBAAgB,aAAa;;;;;;;;;;;;;;;EAO5B"}
|
|
1
|
+
{"version":3,"file":"useWalletInfo.d.ts","sourceRoot":"","sources":["../../../src/hooks/useWalletInfo.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,aAAa;;;;;;;;;;;;;;;EAO5B"}
|
|
@@ -13,7 +13,8 @@ export type { AppKitConfig } from './types';
|
|
|
13
13
|
/****** Hooks *******/
|
|
14
14
|
export { useAppKit } from './hooks/useAppKit';
|
|
15
15
|
export { useProvider } from './hooks/useProvider';
|
|
16
|
-
export { useAccount } from './hooks/useAccount';
|
|
16
|
+
export { useAccount, type Account as UseAccountReturn } from './hooks/useAccount';
|
|
17
|
+
export { useAppKitTheme, type UseAppKitThemeReturn } from './hooks/useAppKitTheme';
|
|
17
18
|
export { useWalletInfo } from './hooks/useWalletInfo';
|
|
18
19
|
export { useAppKitEvents, useAppKitEventSubscription } from './hooks/useAppKitEvents';
|
|
19
20
|
export { useAppKitState } from './hooks/useAppKitState';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,oCAAoC,CAAC;AAE5C,kCAAkC;AAClC,OAAO,EACL,aAAa,IAAI,aAAa,EAC9B,KAAK,kBAAkB,EACxB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,KAAK,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAC1E,OAAO,EACL,a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AAa,EAAE,OAAO,EAAE,MAAM,mCAAmC,CAAC;AAChF,YAAY,EACV,UAAU,EACV,WAAW,EACX,WAAW,EACX,WAAW,EACX,YAAY,EACb,MAAM,mCAAmC,CAAC;AAC3C,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C,sBAAsB;AACtB,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,KAAK,OAAO,IAAI,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAClF,OAAO,EAAE,cAAc,EAAE,KAAK,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACnF,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAC;AACtF,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,KAAK,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAEhF,gCAAgC;AAChC,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AACxF,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AAE5E,4BAA4B;AAC5B,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAEtE,4BAA4B;AAC5B,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../src/modal/w3m-modal/styles.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../src/modal/w3m-modal/styles.ts"],"names":[],"mappings":";;;;;;;AAEA,wBAMG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/partials/w3m-connecting-body/index.tsx"],"names":[],"mappings":"AAGA,cAAc,SAAS,CAAC;AAExB,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,wBAAgB,cAAc,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,EAAE,mBAAmB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/partials/w3m-connecting-body/index.tsx"],"names":[],"mappings":"AAGA,cAAc,SAAS,CAAC;AAExB,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,wBAAgB,cAAc,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,EAAE,mBAAmB,2CAazE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/partials/w3m-connecting-qrcode/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/partials/w3m-connecting-qrcode/index.tsx"],"names":[],"mappings":"AAyBA,wBAAgB,gBAAgB,4CAqE/B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/partials/w3m-header/index.tsx"],"names":[],"mappings":"AAYA,wBAAgB,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/partials/w3m-header/index.tsx"],"names":[],"mappings":"AAYA,wBAAgB,MAAM,mDAyGrB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../src/partials/w3m-header/styles.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../src/partials/w3m-header/styles.ts"],"names":[],"mappings":";;;;;;;;;AAEA,wBAQG"}
|
|
@@ -6,6 +6,7 @@ export interface SendInputTokenProps {
|
|
|
6
6
|
style?: StyleProp<ViewStyle>;
|
|
7
7
|
onTokenPress?: () => void;
|
|
8
8
|
loading?: boolean;
|
|
9
|
+
testID?: string;
|
|
9
10
|
}
|
|
10
|
-
export declare function SendInputToken({ token, sendTokenAmount, style, onTokenPress, loading }: SendInputTokenProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export declare function SendInputToken({ token, sendTokenAmount, style, onTokenPress, loading, testID }: SendInputTokenProps): import("react/jsx-runtime").JSX.Element;
|
|
11
12
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/partials/w3m-send-input-token/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAa,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AASzE,OAAO,EAAc,KAAK,OAAO,EAAE,MAAM,mCAAmC,CAAC;AAM7E,MAAM,WAAW,mBAAmB;IAClC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,OAAO,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/partials/w3m-send-input-token/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAa,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AASzE,OAAO,EAAc,KAAK,OAAO,EAAE,MAAM,mCAAmC,CAAC;AAM7E,MAAM,WAAW,mBAAmB;IAClC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,wBAAgB,cAAc,CAAC,EAC7B,KAAK,EACL,eAAe,EACf,KAAK,EACL,YAAY,EACZ,OAAO,EACP,MAAM,EACP,EAAE,mBAAmB,2CAwFrB"}
|
|
@@ -15,6 +15,7 @@ export interface SwapInputProps {
|
|
|
15
15
|
marketValue?: number;
|
|
16
16
|
editable?: boolean;
|
|
17
17
|
autoFocus?: boolean;
|
|
18
|
+
testID?: string;
|
|
18
19
|
}
|
|
19
|
-
export declare function SwapInput({ token, value, style, loading, loadingValues, onTokenPress, onMaxPress, onChange, marketValue, editable, autoFocus }: SwapInputProps): import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
export declare function SwapInput({ token, value, style, loading, loadingValues, onTokenPress, onMaxPress, onChange, marketValue, editable, autoFocus, testID }: SwapInputProps): import("react/jsx-runtime").JSX.Element;
|
|
20
21
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/partials/w3m-swap-input/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,SAAS,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAa,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAYzE,OAAO,EAAc,KAAK,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AAE1F,MAAM,WAAW,cAAc;IAC7B,KAAK,CAAC,EAAE,oBAAoB,CAAC;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,K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EAAE,OAAO,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAID,wBAAgB,SAAS,CAAC,EACxB,KAAK,EACL,KAAK,EACL,KAAK,EACL,OAAO,EACP,aAAa,EACb,YAAY,EACZ,UAAU,EACV,QAAQ,EACR,WAAW,EACX,QAAQ,EACR,SAAS,EACT,MAAM,EACP,EAAE,cAAc,2CAqHhB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/views/w3m-account-default-view/index.tsx"],"names":[],"mappings":"AAqCA,wBAAgB,kBAAkB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/views/w3m-account-default-view/index.tsx"],"names":[],"mappings":"AAqCA,wBAAgB,kBAAkB,4CAkUjC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/views/w3m-connecting-external-view/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/views/w3m-connecting-external-view/index.tsx"],"names":[],"mappings":"AA8BA,wBAAgB,sBAAsB,4CA4HrC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/views/w3m-connecting-view/index.tsx"],"names":[],"mappings":"AAoBA,wBAAgB,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/views/w3m-connecting-view/index.tsx"],"names":[],"mappings":"AAoBA,wBAAgB,cAAc,4CAuH7B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/views/w3m-onramp-settings-view/index.tsx"],"names":[],"mappings":"AA0BA,wBAAgB,kBAAkB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/views/w3m-onramp-settings-view/index.tsx"],"names":[],"mappings":"AA0BA,wBAAgB,kBAAkB,4CAqIjC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/views/w3m-onramp-view/index.tsx"],"names":[],"mappings":"AAuCA,wBAAgB,UAAU,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/views/w3m-onramp-view/index.tsx"],"names":[],"mappings":"AAuCA,wBAAgB,UAAU,4CAuOzB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/views/w3m-swap-view/index.tsx"],"names":[],"mappings":"AA0BA,wBAAgB,QAAQ,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/views/w3m-swap-view/index.tsx"],"names":[],"mappings":"AA0BA,wBAAgB,QAAQ,4CAgMvB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/views/w3m-wallet-send-view/index.tsx"],"names":[],"mappings":"AAeA,wBAAgB,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/views/w3m-wallet-send-view/index.tsx"],"names":[],"mappings":"AAeA,wBAAgB,cAAc,4CA0G7B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reown/appkit-react-native",
|
|
3
|
-
"version": "0.0.0-develop-
|
|
3
|
+
"version": "0.0.0-develop-20251114152149",
|
|
4
4
|
"main": "lib/commonjs/index.js",
|
|
5
5
|
"types": "lib/typescript/index.d.ts",
|
|
6
6
|
"module": "lib/module/index.js",
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
"scripts": {
|
|
10
10
|
"build": "bob build",
|
|
11
11
|
"clean": "rm -rf lib",
|
|
12
|
+
"test": "jest",
|
|
12
13
|
"lint": "eslint . --ext .js,.jsx,.ts,.tsx"
|
|
13
14
|
},
|
|
14
15
|
"files": [
|
|
@@ -39,9 +40,9 @@
|
|
|
39
40
|
"provenance": true
|
|
40
41
|
},
|
|
41
42
|
"dependencies": {
|
|
42
|
-
"@reown/appkit-common-react-native": "0.0.0-develop-
|
|
43
|
-
"@reown/appkit-core-react-native": "0.0.0-develop-
|
|
44
|
-
"@reown/appkit-ui-react-native": "0.0.0-develop-
|
|
43
|
+
"@reown/appkit-common-react-native": "0.0.0-develop-20251114152149",
|
|
44
|
+
"@reown/appkit-core-react-native": "0.0.0-develop-20251114152149",
|
|
45
|
+
"@reown/appkit-ui-react-native": "0.0.0-develop-20251114152149",
|
|
45
46
|
"@walletconnect/universal-provider": "2.21.10",
|
|
46
47
|
"valtio": "2.1.8"
|
|
47
48
|
},
|
package/src/AppKit.ts
CHANGED
|
@@ -271,29 +271,49 @@ export class AppKit {
|
|
|
271
271
|
return this.networks;
|
|
272
272
|
}
|
|
273
273
|
|
|
274
|
-
|
|
274
|
+
/**
|
|
275
|
+
* Switches to a different network.
|
|
276
|
+
* @param network - Either an AppKitNetwork object or a CAIP network ID string (e.g., 'eip155:1')
|
|
277
|
+
* @throws {Error} When the network is not found in configured networks
|
|
278
|
+
* @throws {Error} When no active adapter is available (only when connected)
|
|
279
|
+
* @returns Promise that resolves when the network switch is complete
|
|
280
|
+
*/
|
|
281
|
+
async switchNetwork(network: AppKitNetwork | CaipNetworkId): Promise<void> {
|
|
275
282
|
const { isConnected } = ConnectionsController.state;
|
|
276
283
|
|
|
284
|
+
const appKitNetwork =
|
|
285
|
+
typeof network === 'string' ? this.networks.find(n => n.caipNetworkId === network) : network;
|
|
286
|
+
|
|
287
|
+
if (!appKitNetwork) {
|
|
288
|
+
const error = new Error(`Network not found: ${network}`);
|
|
289
|
+
LogController.sendError(`Network not found: ${network}`, 'AppKit.ts', 'switchNetwork');
|
|
290
|
+
|
|
291
|
+
throw error;
|
|
292
|
+
}
|
|
293
|
+
|
|
277
294
|
if (!isConnected) {
|
|
278
|
-
OptionsController.setDefaultNetwork(
|
|
295
|
+
OptionsController.setDefaultNetwork(appKitNetwork);
|
|
279
296
|
|
|
280
|
-
return
|
|
297
|
+
return;
|
|
281
298
|
}
|
|
282
299
|
|
|
283
|
-
const adapter = this.getAdapterByNamespace(
|
|
300
|
+
const adapter = this.getAdapterByNamespace(appKitNetwork.chainNamespace);
|
|
284
301
|
if (!adapter) throw new Error('No active adapter');
|
|
285
302
|
|
|
286
|
-
await adapter.switchNetwork(
|
|
303
|
+
await adapter.switchNetwork(appKitNetwork);
|
|
287
304
|
|
|
288
305
|
EventsController.sendEvent({
|
|
289
306
|
type: 'track',
|
|
290
307
|
event: 'SWITCH_NETWORK',
|
|
291
308
|
properties: {
|
|
292
|
-
network:
|
|
309
|
+
network: appKitNetwork.caipNetworkId
|
|
293
310
|
}
|
|
294
311
|
});
|
|
295
312
|
|
|
296
|
-
ConnectionsController.setActiveNetwork(
|
|
313
|
+
ConnectionsController.setActiveNetwork(
|
|
314
|
+
appKitNetwork.chainNamespace,
|
|
315
|
+
appKitNetwork.caipNetworkId
|
|
316
|
+
);
|
|
297
317
|
}
|
|
298
318
|
|
|
299
319
|
open(options?: AppKitOpenOptions) {
|
package/src/AppKitContext.tsx
CHANGED
package/src/hooks/useAccount.ts
CHANGED
|
@@ -1,19 +1,106 @@
|
|
|
1
1
|
/* eslint-disable valtio/state-snapshot-rule */
|
|
2
|
+
import {
|
|
3
|
+
ConnectionsController,
|
|
4
|
+
CoreHelperUtil,
|
|
5
|
+
LogController
|
|
6
|
+
} from '@reown/appkit-core-react-native';
|
|
2
7
|
import { useMemo } from 'react';
|
|
3
8
|
import { useSnapshot } from 'valtio';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
9
|
+
import type { AccountType, AppKitNetwork } from '@reown/appkit-common-react-native';
|
|
10
|
+
import { useAppKitContext } from './useAppKitContext';
|
|
6
11
|
|
|
12
|
+
/**
|
|
13
|
+
* Represents a blockchain account with its associated metadata
|
|
14
|
+
*/
|
|
15
|
+
export interface Account {
|
|
16
|
+
/** The blockchain address of the account */
|
|
17
|
+
address: string;
|
|
18
|
+
/** The blockchain namespace (e.g., 'eip155' for Ethereum, 'solana' for Solana) */
|
|
19
|
+
namespace: string;
|
|
20
|
+
/** The chain ID where this account is active */
|
|
21
|
+
chainId: string;
|
|
22
|
+
/** Optional account type (e.g. 'eoa' or 'smartAccount') */
|
|
23
|
+
type?: AccountType;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Hook to access the current account state and connection information
|
|
28
|
+
*
|
|
29
|
+
* @remarks
|
|
30
|
+
* This hook provides access to all connected accounts, the currently active account,
|
|
31
|
+
* connection status, and active chain information. It automatically subscribes to
|
|
32
|
+
* connection state changes via valtio.
|
|
33
|
+
*
|
|
34
|
+
* The hook parses account data from CAIP-10 format (namespace:chainId:address)
|
|
35
|
+
* and provides a normalized structure.
|
|
36
|
+
*
|
|
37
|
+
* @returns An object containing:
|
|
38
|
+
* - `allAccounts` - Array of all connected accounts across all connections
|
|
39
|
+
* - `address` - The plain address of the currently active account (without namespace or chain prefix)
|
|
40
|
+
* - `isConnected` - Boolean indicating if a wallet is currently connected
|
|
41
|
+
* - `chainId` - The ID of the currently active chain
|
|
42
|
+
* - `chain` - The full chain/network object of the currently active chain
|
|
43
|
+
* - `namespace` - The namespace of the currently active account (e.g. 'eip155', 'solana' or 'bip122')
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```tsx
|
|
47
|
+
* function MyComponent() {
|
|
48
|
+
* const { address, isConnected, chainId, allAccounts } = useAccount();
|
|
49
|
+
*
|
|
50
|
+
* if (!isConnected) {
|
|
51
|
+
* return <Text>Not connected</Text>;
|
|
52
|
+
* }
|
|
53
|
+
*
|
|
54
|
+
* return (
|
|
55
|
+
* <View>
|
|
56
|
+
* <Text>Connected: {address}</Text>
|
|
57
|
+
* <Text>Chain: {chainId}</Text>
|
|
58
|
+
* <Text>Total accounts: {allAccounts.length}</Text>
|
|
59
|
+
* </View>
|
|
60
|
+
* );
|
|
61
|
+
* }
|
|
62
|
+
* ```
|
|
63
|
+
*
|
|
64
|
+
* @throws Will log errors via LogController if account parsing fails
|
|
65
|
+
*/
|
|
7
66
|
export function useAccount() {
|
|
8
|
-
|
|
67
|
+
useAppKitContext();
|
|
9
68
|
|
|
10
69
|
const {
|
|
11
70
|
activeAddress: address,
|
|
12
71
|
activeNamespace,
|
|
13
72
|
connection,
|
|
73
|
+
connections,
|
|
14
74
|
networks
|
|
15
75
|
} = useSnapshot(ConnectionsController.state);
|
|
16
76
|
|
|
77
|
+
const allAccounts: Account[] = useMemo(() => {
|
|
78
|
+
if (!address) return [];
|
|
79
|
+
|
|
80
|
+
return Array.from(connections.values()).flatMap(
|
|
81
|
+
_connection =>
|
|
82
|
+
_connection.accounts
|
|
83
|
+
.map(account => {
|
|
84
|
+
const [namespace, chainId, plainAddress] = account.split(':');
|
|
85
|
+
if (!plainAddress || !namespace || !chainId) {
|
|
86
|
+
LogController.sendError('Invalid account', 'useAccount.ts', 'useAccount', {
|
|
87
|
+
account
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
return undefined;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
return {
|
|
94
|
+
address: plainAddress,
|
|
95
|
+
namespace,
|
|
96
|
+
chainId,
|
|
97
|
+
type: _connection.type
|
|
98
|
+
};
|
|
99
|
+
})
|
|
100
|
+
.filter(account => account !== undefined) as Account[]
|
|
101
|
+
);
|
|
102
|
+
}, [connections, address]);
|
|
103
|
+
|
|
17
104
|
const activeChain = useMemo(
|
|
18
105
|
() =>
|
|
19
106
|
connection?.caipNetwork
|
|
@@ -23,10 +110,11 @@ export function useAccount() {
|
|
|
23
110
|
);
|
|
24
111
|
|
|
25
112
|
return {
|
|
113
|
+
allAccounts,
|
|
26
114
|
address: CoreHelperUtil.getPlainAddress(address),
|
|
27
115
|
isConnected: !!address,
|
|
28
|
-
chainId: activeChain?.id,
|
|
29
|
-
chain: activeChain,
|
|
116
|
+
chainId: activeChain?.id !== undefined ? String(activeChain.id) : undefined,
|
|
117
|
+
chain: activeChain as AppKitNetwork | undefined,
|
|
30
118
|
namespace: activeNamespace
|
|
31
119
|
};
|
|
32
120
|
}
|