@reown/appkit-react-native 0.0.0-chore-spring-effect-20250909214820 → 0.0.0-chore-added-import-20251002170458
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 +133 -88
- package/lib/commonjs/AppKit.js.map +1 -1
- package/lib/commonjs/AppKitContext.js +16 -10
- package/lib/commonjs/AppKitContext.js.map +1 -1
- package/lib/commonjs/connectors/WalletConnectConnector.js +24 -57
- package/lib/commonjs/connectors/WalletConnectConnector.js.map +1 -1
- package/lib/commonjs/hooks/useAccount.js +4 -3
- package/lib/commonjs/hooks/useAccount.js.map +1 -1
- package/lib/commonjs/hooks/useAppKit.js +12 -12
- package/lib/commonjs/hooks/useAppKit.js.map +1 -1
- package/lib/commonjs/hooks/useAppKitLogs.js +88 -0
- package/lib/commonjs/hooks/useAppKitLogs.js.map +1 -0
- package/lib/commonjs/hooks/useAppKitState.js +32 -0
- package/lib/commonjs/hooks/useAppKitState.js.map +1 -0
- package/lib/commonjs/hooks/useProvider.js +14 -8
- package/lib/commonjs/hooks/useProvider.js.map +1 -1
- package/lib/commonjs/hooks/useWalletInfo.js +6 -4
- package/lib/commonjs/hooks/useWalletInfo.js.map +1 -1
- package/lib/commonjs/index.js +22 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/modal/w3m-modal/index.js +9 -1
- package/lib/commonjs/modal/w3m-modal/index.js.map +1 -1
- package/lib/commonjs/modal/w3m-router/index.js +19 -21
- package/lib/commonjs/modal/w3m-router/index.js.map +1 -1
- package/lib/commonjs/partials/w3m-account-wallet-features/index.js +1 -1
- package/lib/commonjs/partials/w3m-account-wallet-features/index.js.map +1 -1
- package/lib/commonjs/partials/w3m-all-wallets-list/components/WalletItem.js +6 -3
- package/lib/commonjs/partials/w3m-all-wallets-list/components/WalletItem.js.map +1 -1
- package/lib/commonjs/partials/w3m-all-wallets-list/components/WalletList.js +9 -2
- package/lib/commonjs/partials/w3m-all-wallets-list/components/WalletList.js.map +1 -1
- package/lib/commonjs/partials/w3m-all-wallets-list/index.js +1 -0
- package/lib/commonjs/partials/w3m-all-wallets-list/index.js.map +1 -1
- package/lib/commonjs/partials/w3m-all-wallets-search/index.js +3 -1
- package/lib/commonjs/partials/w3m-all-wallets-search/index.js.map +1 -1
- package/lib/commonjs/partials/w3m-connecting-mobile/index.js +21 -1
- package/lib/commonjs/partials/w3m-connecting-mobile/index.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-connecting-web/index.js +8 -2
- package/lib/commonjs/partials/w3m-connecting-web/index.js.map +1 -1
- package/lib/commonjs/partials/w3m-header/index.js +4 -4
- package/lib/commonjs/partials/w3m-header/index.js.map +1 -1
- package/lib/commonjs/utils/SIWXUtil.js +278 -0
- package/lib/commonjs/utils/SIWXUtil.js.map +1 -0
- package/lib/commonjs/views/w3m-account-default-view/index.js +3 -2
- package/lib/commonjs/views/w3m-account-default-view/index.js.map +1 -1
- package/lib/commonjs/views/w3m-all-wallets-view/index.js +7 -4
- package/lib/commonjs/views/w3m-all-wallets-view/index.js.map +1 -1
- package/lib/commonjs/views/w3m-connect-view/components/all-wallet-list.js +5 -3
- package/lib/commonjs/views/w3m-connect-view/components/all-wallet-list.js.map +1 -1
- package/lib/commonjs/views/w3m-connect-view/index.js +6 -3
- package/lib/commonjs/views/w3m-connect-view/index.js.map +1 -1
- package/lib/commonjs/views/w3m-connecting-external-view/index.js +21 -1
- package/lib/commonjs/views/w3m-connecting-external-view/index.js.map +1 -1
- package/lib/commonjs/views/w3m-connecting-social-view/index.js +1 -0
- package/lib/commonjs/views/w3m-connecting-social-view/index.js.map +1 -1
- package/lib/commonjs/views/w3m-connecting-view/index.js +12 -31
- package/lib/commonjs/views/w3m-connecting-view/index.js.map +1 -1
- package/lib/commonjs/views/w3m-network-switch-view/index.js +1 -0
- package/lib/commonjs/views/w3m-network-switch-view/index.js.map +1 -1
- package/lib/commonjs/views/w3m-onramp-settings-view/components/Country.js +3 -1
- package/lib/commonjs/views/w3m-onramp-settings-view/components/Country.js.map +1 -1
- package/lib/commonjs/views/w3m-onramp-settings-view/index.js +2 -1
- package/lib/commonjs/views/w3m-onramp-settings-view/index.js.map +1 -1
- package/lib/commonjs/views/w3m-onramp-view/components/LoadingView.js +1 -1
- package/lib/commonjs/views/w3m-onramp-view/components/LoadingView.js.map +1 -1
- package/lib/commonjs/views/{w3m-connecting-siwe-view → w3m-siwx-sign-view}/index.js +7 -43
- package/lib/commonjs/views/w3m-siwx-sign-view/index.js.map +1 -0
- package/lib/commonjs/views/w3m-siwx-sign-view/styles.js.map +1 -0
- package/lib/commonjs/views/w3m-swap-view/index.js +1 -1
- package/lib/commonjs/views/w3m-swap-view/index.js.map +1 -1
- package/lib/commonjs/views/w3m-what-is-a-wallet-view/index.js +1 -1
- package/lib/commonjs/views/w3m-what-is-a-wallet-view/index.js.map +1 -1
- package/lib/module/AppKit.js +133 -88
- package/lib/module/AppKit.js.map +1 -1
- package/lib/module/AppKitContext.js +17 -11
- package/lib/module/AppKitContext.js.map +1 -1
- package/lib/module/connectors/WalletConnectConnector.js +22 -56
- package/lib/module/connectors/WalletConnectConnector.js.map +1 -1
- package/lib/module/hooks/useAccount.js +3 -3
- package/lib/module/hooks/useAccount.js.map +1 -1
- package/lib/module/hooks/useAppKit.js +13 -13
- package/lib/module/hooks/useAppKit.js.map +1 -1
- package/lib/module/hooks/useAppKitLogs.js +83 -0
- package/lib/module/hooks/useAppKitLogs.js.map +1 -0
- package/lib/module/hooks/useAppKitState.js +27 -0
- package/lib/module/hooks/useAppKitState.js.map +1 -0
- package/lib/module/hooks/useProvider.js +13 -8
- package/lib/module/hooks/useProvider.js.map +1 -1
- package/lib/module/hooks/useWalletInfo.js +6 -4
- package/lib/module/hooks/useWalletInfo.js.map +1 -1
- package/lib/module/index.js +7 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/modal/w3m-modal/index.js +9 -1
- package/lib/module/modal/w3m-modal/index.js.map +1 -1
- package/lib/module/modal/w3m-router/index.js +20 -22
- package/lib/module/modal/w3m-router/index.js.map +1 -1
- package/lib/module/partials/w3m-account-wallet-features/index.js +1 -1
- package/lib/module/partials/w3m-account-wallet-features/index.js.map +1 -1
- package/lib/module/partials/w3m-all-wallets-list/components/WalletItem.js +6 -3
- package/lib/module/partials/w3m-all-wallets-list/components/WalletItem.js.map +1 -1
- package/lib/module/partials/w3m-all-wallets-list/components/WalletList.js +9 -2
- package/lib/module/partials/w3m-all-wallets-list/components/WalletList.js.map +1 -1
- package/lib/module/partials/w3m-all-wallets-list/index.js +2 -1
- package/lib/module/partials/w3m-all-wallets-list/index.js.map +1 -1
- package/lib/module/partials/w3m-all-wallets-search/index.js +4 -2
- package/lib/module/partials/w3m-all-wallets-search/index.js.map +1 -1
- package/lib/module/partials/w3m-connecting-mobile/index.js +22 -2
- package/lib/module/partials/w3m-connecting-mobile/index.js.map +1 -1
- package/lib/module/partials/w3m-connecting-qrcode/index.js +6 -2
- package/lib/module/partials/w3m-connecting-qrcode/index.js.map +1 -1
- package/lib/module/partials/w3m-connecting-web/index.js +9 -3
- package/lib/module/partials/w3m-connecting-web/index.js.map +1 -1
- package/lib/module/partials/w3m-header/index.js +4 -4
- package/lib/module/partials/w3m-header/index.js.map +1 -1
- package/lib/module/utils/SIWXUtil.js +275 -0
- package/lib/module/utils/SIWXUtil.js.map +1 -0
- package/lib/module/views/w3m-account-default-view/index.js +4 -3
- package/lib/module/views/w3m-account-default-view/index.js.map +1 -1
- package/lib/module/views/w3m-all-wallets-view/index.js +7 -4
- package/lib/module/views/w3m-all-wallets-view/index.js.map +1 -1
- package/lib/module/views/w3m-connect-view/components/all-wallet-list.js +5 -3
- package/lib/module/views/w3m-connect-view/components/all-wallet-list.js.map +1 -1
- package/lib/module/views/w3m-connect-view/index.js +6 -3
- package/lib/module/views/w3m-connect-view/index.js.map +1 -1
- package/lib/module/views/w3m-connecting-external-view/index.js +22 -2
- package/lib/module/views/w3m-connecting-external-view/index.js.map +1 -1
- package/lib/module/views/w3m-connecting-social-view/index.js +2 -1
- package/lib/module/views/w3m-connecting-social-view/index.js.map +1 -1
- package/lib/module/views/w3m-connecting-view/index.js +14 -33
- package/lib/module/views/w3m-connecting-view/index.js.map +1 -1
- package/lib/module/views/w3m-network-switch-view/index.js +2 -1
- package/lib/module/views/w3m-network-switch-view/index.js.map +1 -1
- package/lib/module/views/w3m-onramp-settings-view/components/Country.js +3 -1
- package/lib/module/views/w3m-onramp-settings-view/components/Country.js.map +1 -1
- package/lib/module/views/w3m-onramp-settings-view/index.js +2 -1
- package/lib/module/views/w3m-onramp-settings-view/index.js.map +1 -1
- package/lib/module/views/w3m-onramp-view/components/LoadingView.js +1 -1
- package/lib/module/views/w3m-onramp-view/components/LoadingView.js.map +1 -1
- package/lib/module/views/{w3m-connecting-siwe-view → w3m-siwx-sign-view}/index.js +7 -43
- package/lib/module/views/w3m-siwx-sign-view/index.js.map +1 -0
- package/lib/module/views/w3m-siwx-sign-view/styles.js.map +1 -0
- package/lib/module/views/w3m-swap-view/index.js +1 -1
- package/lib/module/views/w3m-swap-view/index.js.map +1 -1
- package/lib/module/views/w3m-what-is-a-wallet-view/index.js +1 -1
- package/lib/module/views/w3m-what-is-a-wallet-view/index.js.map +1 -1
- package/lib/typescript/AppKit.d.ts +12 -3
- package/lib/typescript/AppKit.d.ts.map +1 -1
- package/lib/typescript/AppKitContext.d.ts +1 -1
- package/lib/typescript/AppKitContext.d.ts.map +1 -1
- package/lib/typescript/connectors/WalletConnectConnector.d.ts.map +1 -1
- package/lib/typescript/hooks/useAccount.d.ts +1 -1
- package/lib/typescript/hooks/useAccount.d.ts.map +1 -1
- package/lib/typescript/hooks/useAppKit.d.ts +2 -2
- package/lib/typescript/hooks/useAppKit.d.ts.map +1 -1
- package/lib/typescript/hooks/useAppKitEvents.d.ts +75 -21
- package/lib/typescript/hooks/useAppKitEvents.d.ts.map +1 -1
- package/lib/typescript/hooks/useAppKitLogs.d.ts +57 -0
- package/lib/typescript/hooks/useAppKitLogs.d.ts.map +1 -0
- package/lib/typescript/hooks/useAppKitState.d.ts +38 -0
- package/lib/typescript/hooks/useAppKitState.d.ts.map +1 -0
- package/lib/typescript/hooks/useProvider.d.ts.map +1 -1
- package/lib/typescript/hooks/useWalletInfo.d.ts +1 -0
- package/lib/typescript/hooks/useWalletInfo.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +6 -0
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/modal/w3m-modal/index.d.ts.map +1 -1
- package/lib/typescript/modal/w3m-router/index.d.ts.map +1 -1
- package/lib/typescript/partials/w3m-all-wallets-list/components/WalletItem.d.ts +4 -2
- package/lib/typescript/partials/w3m-all-wallets-list/components/WalletItem.d.ts.map +1 -1
- package/lib/typescript/partials/w3m-all-wallets-list/components/WalletList.d.ts +3 -2
- package/lib/typescript/partials/w3m-all-wallets-list/components/WalletList.d.ts.map +1 -1
- package/lib/typescript/partials/w3m-all-wallets-list/index.d.ts +1 -1
- package/lib/typescript/partials/w3m-all-wallets-list/index.d.ts.map +1 -1
- package/lib/typescript/partials/w3m-all-wallets-search/index.d.ts +1 -1
- package/lib/typescript/partials/w3m-all-wallets-search/index.d.ts.map +1 -1
- package/lib/typescript/partials/w3m-connecting-mobile/index.d.ts.map +1 -1
- package/lib/typescript/partials/w3m-connecting-qrcode/index.d.ts.map +1 -1
- package/lib/typescript/partials/w3m-connecting-web/index.d.ts.map +1 -1
- package/lib/typescript/types.d.ts +6 -7
- package/lib/typescript/types.d.ts.map +1 -1
- package/lib/typescript/utils/SIWXUtil.d.ts +34 -0
- package/lib/typescript/utils/SIWXUtil.d.ts.map +1 -0
- package/lib/typescript/views/w3m-account-default-view/index.d.ts.map +1 -1
- package/lib/typescript/views/w3m-all-wallets-view/index.d.ts.map +1 -1
- package/lib/typescript/views/w3m-connect-view/components/all-wallet-list.d.ts +1 -1
- package/lib/typescript/views/w3m-connect-view/components/all-wallet-list.d.ts.map +1 -1
- package/lib/typescript/views/w3m-connect-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-social-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-network-switch-view/index.d.ts.map +1 -1
- package/lib/typescript/views/w3m-onramp-settings-view/components/Country.d.ts +2 -1
- package/lib/typescript/views/w3m-onramp-settings-view/components/Country.d.ts.map +1 -1
- package/lib/typescript/views/w3m-onramp-settings-view/index.d.ts.map +1 -1
- package/lib/typescript/views/w3m-siwx-sign-view/index.d.ts +2 -0
- package/lib/typescript/views/w3m-siwx-sign-view/index.d.ts.map +1 -0
- package/lib/typescript/views/w3m-siwx-sign-view/styles.d.ts.map +1 -0
- package/package.json +9 -9
- package/src/AppKit.ts +145 -96
- package/src/AppKitContext.tsx +19 -11
- package/src/connectors/WalletConnectConnector.ts +33 -69
- package/src/hooks/useAccount.ts +9 -4
- package/src/hooks/useAppKit.ts +19 -13
- package/src/hooks/useAppKitLogs.ts +129 -0
- package/src/hooks/useAppKitState.ts +26 -0
- package/src/hooks/useProvider.ts +11 -5
- package/src/hooks/useWalletInfo.ts +5 -2
- package/src/index.ts +14 -0
- package/src/modal/w3m-modal/index.tsx +9 -1
- package/src/modal/w3m-router/index.tsx +15 -18
- package/src/partials/w3m-account-wallet-features/index.tsx +1 -1
- package/src/partials/w3m-all-wallets-list/components/WalletItem.tsx +13 -3
- package/src/partials/w3m-all-wallets-list/components/WalletList.tsx +9 -2
- package/src/partials/w3m-all-wallets-list/index.tsx +3 -1
- package/src/partials/w3m-all-wallets-search/index.tsx +9 -3
- package/src/partials/w3m-connecting-mobile/index.tsx +24 -2
- package/src/partials/w3m-connecting-qrcode/index.tsx +8 -2
- package/src/partials/w3m-connecting-web/index.tsx +11 -3
- package/src/partials/w3m-header/index.tsx +4 -4
- package/src/types.ts +7 -8
- package/src/utils/SIWXUtil.ts +359 -0
- package/src/views/w3m-account-default-view/index.tsx +5 -3
- package/src/views/w3m-all-wallets-view/index.tsx +11 -4
- package/src/views/w3m-connect-view/components/all-wallet-list.tsx +6 -4
- package/src/views/w3m-connect-view/index.tsx +6 -3
- package/src/views/w3m-connecting-external-view/index.tsx +24 -2
- package/src/views/w3m-connecting-social-view/index.tsx +3 -1
- package/src/views/w3m-connecting-view/index.tsx +16 -33
- package/src/views/w3m-network-switch-view/index.tsx +2 -0
- package/src/views/w3m-onramp-settings-view/components/Country.tsx +3 -1
- package/src/views/w3m-onramp-settings-view/index.tsx +1 -0
- package/src/views/w3m-onramp-view/components/LoadingView.tsx +1 -1
- package/src/views/{w3m-connecting-siwe-view → w3m-siwx-sign-view}/index.tsx +7 -37
- package/src/views/w3m-swap-view/index.tsx +1 -1
- package/src/views/w3m-what-is-a-wallet-view/index.tsx +1 -1
- package/lib/commonjs/views/w3m-connecting-siwe-view/index.js.map +0 -1
- package/lib/commonjs/views/w3m-connecting-siwe-view/styles.js.map +0 -1
- package/lib/module/views/w3m-connecting-siwe-view/index.js.map +0 -1
- package/lib/module/views/w3m-connecting-siwe-view/styles.js.map +0 -1
- package/lib/typescript/views/w3m-connecting-siwe-view/index.d.ts +0 -2
- package/lib/typescript/views/w3m-connecting-siwe-view/index.d.ts.map +0 -1
- package/lib/typescript/views/w3m-connecting-siwe-view/styles.d.ts.map +0 -1
- /package/lib/commonjs/views/{w3m-connecting-siwe-view → w3m-siwx-sign-view}/styles.js +0 -0
- /package/lib/module/views/{w3m-connecting-siwe-view → w3m-siwx-sign-view}/styles.js +0 -0
- /package/lib/typescript/views/{w3m-connecting-siwe-view → w3m-siwx-sign-view}/styles.d.ts +0 -0
- /package/src/views/{w3m-connecting-siwe-view → w3m-siwx-sign-view}/styles.ts +0 -0
|
@@ -18,12 +18,13 @@ const ITEM_HEIGHT_WITH_GAP = ITEM_HEIGHT + Spacing['3xs'];
|
|
|
18
18
|
|
|
19
19
|
interface Props {
|
|
20
20
|
data: WcWallet[];
|
|
21
|
-
onItemPress: (wallet: WcWallet) => void;
|
|
21
|
+
onItemPress: (wallet: WcWallet, displayIndex: number) => void;
|
|
22
22
|
onEndReached?: () => void;
|
|
23
23
|
onEndReachedThreshold?: number;
|
|
24
24
|
isLoading?: boolean;
|
|
25
25
|
loadingItems?: number;
|
|
26
26
|
style?: StyleProp<ViewStyle>;
|
|
27
|
+
testIDKey?: string;
|
|
27
28
|
}
|
|
28
29
|
|
|
29
30
|
export function WalletList({
|
|
@@ -33,6 +34,7 @@ export function WalletList({
|
|
|
33
34
|
onEndReachedThreshold,
|
|
34
35
|
isLoading = false,
|
|
35
36
|
loadingItems = 20,
|
|
37
|
+
testIDKey,
|
|
36
38
|
style
|
|
37
39
|
}: Props) {
|
|
38
40
|
const { padding, maxHeight } = useCustomDimensions();
|
|
@@ -50,7 +52,7 @@ export function WalletList({
|
|
|
50
52
|
data={displayData}
|
|
51
53
|
style={[styles.list, { height: maxHeight }, style]}
|
|
52
54
|
columnWrapperStyle={styles.columnWrapperStyle}
|
|
53
|
-
renderItem={({ item }) => {
|
|
55
|
+
renderItem={({ item, index }) => {
|
|
54
56
|
if (isLoading) {
|
|
55
57
|
return <CardSelectLoader style={styles.itemContainer} />;
|
|
56
58
|
}
|
|
@@ -59,12 +61,17 @@ export function WalletList({
|
|
|
59
61
|
<WalletItem
|
|
60
62
|
item={item}
|
|
61
63
|
imageHeaders={imageHeaders}
|
|
64
|
+
displayIndex={index}
|
|
62
65
|
onItemPress={onItemPress}
|
|
63
66
|
style={styles.itemContainer}
|
|
67
|
+
testID={testIDKey ? `${testIDKey}-${item?.id}` : undefined}
|
|
64
68
|
/>
|
|
65
69
|
);
|
|
66
70
|
}}
|
|
67
71
|
contentContainerStyle={[styles.contentContainer, { paddingHorizontal: padding }]}
|
|
72
|
+
initialNumToRender={32}
|
|
73
|
+
maxToRenderPerBatch={12}
|
|
74
|
+
windowSize={10}
|
|
68
75
|
onEndReached={onEndReached}
|
|
69
76
|
onEndReachedThreshold={onEndReachedThreshold}
|
|
70
77
|
keyExtractor={(item, index) => item?.id ?? `item-${index}`}
|
|
@@ -2,6 +2,7 @@ import { useEffect, useState } from 'react';
|
|
|
2
2
|
import { useSnapshot } from 'valtio';
|
|
3
3
|
import {
|
|
4
4
|
ApiController,
|
|
5
|
+
LogController,
|
|
5
6
|
OptionsController,
|
|
6
7
|
SnackController,
|
|
7
8
|
type OptionsControllerState
|
|
@@ -14,7 +15,7 @@ import { Loading } from './components/Loading';
|
|
|
14
15
|
import { WalletList } from './components/WalletList';
|
|
15
16
|
|
|
16
17
|
interface AllWalletsListProps {
|
|
17
|
-
onItemPress: (wallet: WcWallet) => void;
|
|
18
|
+
onItemPress: (wallet: WcWallet, displayIndex: number) => void;
|
|
18
19
|
headerHeight?: number;
|
|
19
20
|
}
|
|
20
21
|
|
|
@@ -61,6 +62,7 @@ export function AllWalletsList({ onItemPress }: AllWalletsListProps) {
|
|
|
61
62
|
await ApiController.fetchWallets({ page: 1 });
|
|
62
63
|
setLoading(false);
|
|
63
64
|
} catch (error) {
|
|
65
|
+
LogController.sendError(error, 'AllWalletsList.tsx', 'initialFetch');
|
|
64
66
|
SnackController.showError('Failed to load wallets');
|
|
65
67
|
setLoading(false);
|
|
66
68
|
setLoadingError(true);
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { useSnapshot } from 'valtio';
|
|
2
2
|
import { useCallback, useEffect, useState } from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
ApiController,
|
|
5
|
+
LogController,
|
|
6
|
+
OptionsController,
|
|
7
|
+
SnackController
|
|
8
|
+
} from '@reown/appkit-core-react-native';
|
|
4
9
|
import { type WcWallet } from '@reown/appkit-common-react-native';
|
|
5
10
|
import { useCustomDimensions } from '@reown/appkit-ui-react-native';
|
|
6
11
|
import { Placeholder } from '../w3m-placeholder';
|
|
@@ -10,7 +15,7 @@ import { Loading } from '../w3m-all-wallets-list/components/Loading';
|
|
|
10
15
|
import { WalletList } from '../w3m-all-wallets-list/components/WalletList';
|
|
11
16
|
|
|
12
17
|
export interface AllWalletsSearchProps {
|
|
13
|
-
onItemPress: (wallet: WcWallet) => void;
|
|
18
|
+
onItemPress: (wallet: WcWallet, displayIndex: number) => void;
|
|
14
19
|
searchQuery?: string;
|
|
15
20
|
}
|
|
16
21
|
|
|
@@ -36,6 +41,7 @@ export function AllWalletsSearch({ searchQuery, onItemPress }: AllWalletsSearchP
|
|
|
36
41
|
await ApiController.searchWallet({ search: searchQuery });
|
|
37
42
|
setLoading(false);
|
|
38
43
|
} catch (error) {
|
|
44
|
+
LogController.sendError(error, 'AllWalletsSearch.tsx', 'searchFetch');
|
|
39
45
|
SnackController.showError('Failed to load wallets');
|
|
40
46
|
setLoading(false);
|
|
41
47
|
setLoadingError(true);
|
|
@@ -78,5 +84,5 @@ export function AllWalletsSearch({ searchQuery, onItemPress }: AllWalletsSearchP
|
|
|
78
84
|
);
|
|
79
85
|
}
|
|
80
86
|
|
|
81
|
-
return <WalletList onItemPress={onItemPress} data={results} />;
|
|
87
|
+
return <WalletList onItemPress={onItemPress} data={results} testIDKey="wallet-search-item" />;
|
|
82
88
|
}
|
|
@@ -10,7 +10,9 @@ import {
|
|
|
10
10
|
OptionsController,
|
|
11
11
|
EventsController,
|
|
12
12
|
ConstantsUtil,
|
|
13
|
-
AssetController
|
|
13
|
+
AssetController,
|
|
14
|
+
LogController,
|
|
15
|
+
ConnectionsController
|
|
14
16
|
} from '@reown/appkit-core-react-native';
|
|
15
17
|
import {
|
|
16
18
|
Button,
|
|
@@ -60,6 +62,21 @@ export function ConnectingMobile({ onRetry, onCopyUri, isInstalled }: Props) {
|
|
|
60
62
|
const onStorePress = () => {
|
|
61
63
|
if (storeUrl) {
|
|
62
64
|
CoreHelperUtil.openLink(storeUrl);
|
|
65
|
+
EventsController.sendEvent({
|
|
66
|
+
type: 'track',
|
|
67
|
+
event: 'GET_WALLET',
|
|
68
|
+
properties: {
|
|
69
|
+
name: data?.wallet?.name ?? 'Unknown',
|
|
70
|
+
link: storeUrl,
|
|
71
|
+
linkType: Platform.select({
|
|
72
|
+
ios: 'appstore',
|
|
73
|
+
android: 'playstore',
|
|
74
|
+
default: undefined
|
|
75
|
+
}),
|
|
76
|
+
explorerId: data?.wallet?.id,
|
|
77
|
+
walletRank: data?.wallet?.order
|
|
78
|
+
}
|
|
79
|
+
});
|
|
63
80
|
}
|
|
64
81
|
};
|
|
65
82
|
|
|
@@ -74,17 +91,22 @@ export function ConnectingMobile({ onRetry, onCopyUri, isInstalled }: Props) {
|
|
|
74
91
|
await CoreHelperUtil.openLink(redirect);
|
|
75
92
|
await WcController.state.wcPromise;
|
|
76
93
|
WcController.setConnectedWallet(wcLinking, data?.wallet);
|
|
94
|
+
const address = ConnectionsController.state.activeAddress;
|
|
95
|
+
const caipNetworkId = ConnectionsController.state.activeNetwork?.caipNetworkId;
|
|
77
96
|
EventsController.sendEvent({
|
|
78
97
|
type: 'track',
|
|
79
98
|
event: 'CONNECT_SUCCESS',
|
|
99
|
+
address: CoreHelperUtil.getPlainAddress(address),
|
|
80
100
|
properties: {
|
|
81
101
|
method: 'mobile',
|
|
82
102
|
name: data?.wallet?.name ?? 'Unknown',
|
|
83
|
-
|
|
103
|
+
explorerId: data?.wallet?.id,
|
|
104
|
+
caipNetworkId
|
|
84
105
|
}
|
|
85
106
|
});
|
|
86
107
|
}
|
|
87
108
|
} catch (error: any) {
|
|
109
|
+
LogController.sendError(error, 'ConnectingMobile.tsx', 'onConnect');
|
|
88
110
|
if (error.message.includes(ConstantsUtil.LINKING_ERROR)) {
|
|
89
111
|
setErrorType('not_installed');
|
|
90
112
|
} else {
|
|
@@ -4,7 +4,9 @@ import {
|
|
|
4
4
|
WcController,
|
|
5
5
|
EventsController,
|
|
6
6
|
OptionsController,
|
|
7
|
-
SnackController
|
|
7
|
+
SnackController,
|
|
8
|
+
ConnectionsController,
|
|
9
|
+
CoreHelperUtil
|
|
8
10
|
} from '@reown/appkit-core-react-native';
|
|
9
11
|
import {
|
|
10
12
|
FlexView,
|
|
@@ -35,13 +37,17 @@ export function ConnectingQrCode() {
|
|
|
35
37
|
|
|
36
38
|
const onConnect = async () => {
|
|
37
39
|
await WcController.state.wcPromise;
|
|
40
|
+
const address = ConnectionsController.state.activeAddress;
|
|
41
|
+
const caipNetworkId = ConnectionsController.state.activeNetwork?.caipNetworkId;
|
|
38
42
|
|
|
39
43
|
EventsController.sendEvent({
|
|
40
44
|
type: 'track',
|
|
41
45
|
event: 'CONNECT_SUCCESS',
|
|
46
|
+
address: CoreHelperUtil.getPlainAddress(address),
|
|
42
47
|
properties: {
|
|
43
48
|
method: 'qrcode',
|
|
44
|
-
name: 'WalletConnect'
|
|
49
|
+
name: 'WalletConnect',
|
|
50
|
+
caipNetworkId
|
|
45
51
|
}
|
|
46
52
|
});
|
|
47
53
|
};
|
|
@@ -9,7 +9,9 @@ import {
|
|
|
9
9
|
CoreHelperUtil,
|
|
10
10
|
OptionsController,
|
|
11
11
|
EventsController,
|
|
12
|
-
AssetController
|
|
12
|
+
AssetController,
|
|
13
|
+
LogController,
|
|
14
|
+
ConnectionsController
|
|
13
15
|
} from '@reown/appkit-core-react-native';
|
|
14
16
|
import {
|
|
15
17
|
Button,
|
|
@@ -50,18 +52,24 @@ export function ConnectingWeb({ onCopyUri }: ConnectingWebProps) {
|
|
|
50
52
|
await Linking.openURL(redirect);
|
|
51
53
|
await WcController.state.wcPromise;
|
|
52
54
|
WcController.setConnectedWallet(wcLinking, data?.wallet);
|
|
55
|
+
const address = ConnectionsController.state.activeAddress;
|
|
56
|
+
const caipNetworkId = ConnectionsController.state.activeNetwork?.caipNetworkId;
|
|
53
57
|
|
|
54
58
|
EventsController.sendEvent({
|
|
55
59
|
type: 'track',
|
|
56
60
|
event: 'CONNECT_SUCCESS',
|
|
61
|
+
address: CoreHelperUtil.getPlainAddress(address),
|
|
57
62
|
properties: {
|
|
58
63
|
method: 'web',
|
|
59
64
|
name: data?.wallet?.name ?? 'Unknown',
|
|
60
|
-
|
|
65
|
+
explorerId: data?.wallet?.id,
|
|
66
|
+
caipNetworkId
|
|
61
67
|
}
|
|
62
68
|
});
|
|
63
69
|
}
|
|
64
|
-
} catch {
|
|
70
|
+
} catch (error) {
|
|
71
|
+
LogController.sendError(error, 'ConnectingWeb.tsx', 'onConnect');
|
|
72
|
+
}
|
|
65
73
|
}, [data?.wallet, wcUri]);
|
|
66
74
|
|
|
67
75
|
return (
|
|
@@ -32,9 +32,9 @@ export function Header() {
|
|
|
32
32
|
Connect: 'Connect wallet',
|
|
33
33
|
ConnectSocials: 'All socials',
|
|
34
34
|
ConnectingExternal: walletName ?? 'Connect wallet',
|
|
35
|
-
|
|
35
|
+
SIWXSignMessage: 'Sign in',
|
|
36
36
|
ConnectingSocial: socialName ?? 'Connecting Social',
|
|
37
|
-
|
|
37
|
+
WalletConnect: walletName ?? 'WalletConnect',
|
|
38
38
|
GetWallet: 'Get a wallet',
|
|
39
39
|
Networks: 'Select network',
|
|
40
40
|
OnRamp: undefined,
|
|
@@ -58,8 +58,8 @@ export function Header() {
|
|
|
58
58
|
}[_view];
|
|
59
59
|
};
|
|
60
60
|
|
|
61
|
-
const noCloseViews = ['OnRampSettings', '
|
|
62
|
-
const noBackViews = ['UnsupportedChain'];
|
|
61
|
+
const noCloseViews = ['OnRampSettings', 'SIWXSignMessage'];
|
|
62
|
+
const noBackViews = ['UnsupportedChain', 'SIWXSignMessage'];
|
|
63
63
|
const showClose = !noCloseViews.includes(view);
|
|
64
64
|
const header = headings(data, view);
|
|
65
65
|
|
package/src/types.ts
CHANGED
|
@@ -7,10 +7,10 @@ import {
|
|
|
7
7
|
type Metadata,
|
|
8
8
|
type Network,
|
|
9
9
|
type Storage,
|
|
10
|
-
type AppKitSIWEClient,
|
|
11
10
|
type ThemeMode,
|
|
12
11
|
type ThemeVariables,
|
|
13
|
-
type Tokens
|
|
12
|
+
type Tokens,
|
|
13
|
+
type SIWXConfig
|
|
14
14
|
} from '@reown/appkit-common-react-native';
|
|
15
15
|
|
|
16
16
|
/**
|
|
@@ -129,6 +129,7 @@ export interface AppKitConfig {
|
|
|
129
129
|
/**
|
|
130
130
|
* Optional flag to enable debug mode.
|
|
131
131
|
* When enabled, additional logging and debugging information will be output.
|
|
132
|
+
* Only enabled in development mode.
|
|
132
133
|
*
|
|
133
134
|
* @see {@link https://docs.reown.com/appkit/react-native/core/options#debug | Debug Documentation}
|
|
134
135
|
* @default false
|
|
@@ -154,13 +155,11 @@ export interface AppKitConfig {
|
|
|
154
155
|
themeVariables?: ThemeVariables;
|
|
155
156
|
|
|
156
157
|
/**
|
|
157
|
-
*
|
|
158
|
-
*
|
|
159
|
-
*
|
|
160
|
-
*
|
|
161
|
-
* @see {@link https://docs.reown.com/appkit/react-native/core/siwe | SIWE Documentation}
|
|
158
|
+
* @experimental - This feature is not production ready.
|
|
159
|
+
* Enable Sign In With X (SIWX) feature.
|
|
160
|
+
* @default undefined
|
|
162
161
|
*/
|
|
163
|
-
|
|
162
|
+
siwx?: SIWXConfig;
|
|
164
163
|
|
|
165
164
|
/**
|
|
166
165
|
* Optional default network to use when no specific network is selected.
|
|
@@ -0,0 +1,359 @@
|
|
|
1
|
+
import UniversalProvider from '@walletconnect/universal-provider';
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
type CaipNetworkId,
|
|
5
|
+
type ChainNamespace,
|
|
6
|
+
type SIWXSession
|
|
7
|
+
} from '@reown/appkit-common-react-native';
|
|
8
|
+
|
|
9
|
+
import {
|
|
10
|
+
ModalController,
|
|
11
|
+
OptionsController,
|
|
12
|
+
RouterController,
|
|
13
|
+
SnackController,
|
|
14
|
+
CoreHelperUtil,
|
|
15
|
+
ConnectionsController,
|
|
16
|
+
EventsController,
|
|
17
|
+
LogController
|
|
18
|
+
} from '@reown/appkit-core-react-native';
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* SIWXUtil holds the methods to interact with the SIWX plugin and must be called internally on AppKit.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
export const SIWXUtil = {
|
|
25
|
+
getSIWX() {
|
|
26
|
+
return OptionsController.state.siwx;
|
|
27
|
+
},
|
|
28
|
+
|
|
29
|
+
async initializeIfEnabled({
|
|
30
|
+
onDisconnect,
|
|
31
|
+
caipAddress = ConnectionsController.state.activeAddress,
|
|
32
|
+
closeModal = false
|
|
33
|
+
}: {
|
|
34
|
+
onDisconnect: () => Promise<void>;
|
|
35
|
+
caipAddress?: string;
|
|
36
|
+
closeModal?: boolean;
|
|
37
|
+
}) {
|
|
38
|
+
const siwx = OptionsController.state.siwx;
|
|
39
|
+
|
|
40
|
+
if (!siwx || !caipAddress) {
|
|
41
|
+
if (closeModal) {
|
|
42
|
+
ModalController.close();
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const [namespace, chainId, address] = caipAddress.split(':') as [
|
|
49
|
+
ChainNamespace,
|
|
50
|
+
string,
|
|
51
|
+
string
|
|
52
|
+
];
|
|
53
|
+
|
|
54
|
+
const isSupportedNetwork = ConnectionsController.getAvailableNetworks().find(
|
|
55
|
+
network => network.caipNetworkId === `${namespace}:${chainId}`
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
if (!isSupportedNetwork) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
try {
|
|
63
|
+
const sessions = await siwx.getSessions(`${namespace}:${chainId}`, address);
|
|
64
|
+
|
|
65
|
+
if (sessions.length) {
|
|
66
|
+
ModalController.close();
|
|
67
|
+
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
if (ModalController.state.open) {
|
|
72
|
+
RouterController.push('SIWXSignMessage');
|
|
73
|
+
} else {
|
|
74
|
+
ModalController.open({ view: 'SIWXSignMessage' });
|
|
75
|
+
}
|
|
76
|
+
} catch (error: unknown) {
|
|
77
|
+
LogController.sendError(error, 'SIWXUtil.ts', 'initializeIfEnabled');
|
|
78
|
+
|
|
79
|
+
EventsController.sendEvent({
|
|
80
|
+
type: 'track',
|
|
81
|
+
event: 'SIWX_AUTH_ERROR',
|
|
82
|
+
properties: this.getSIWXEventProperties(error)
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
await onDisconnect();
|
|
86
|
+
SnackController.showError('A problem occurred while trying initialize authentication');
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
async requestSignMessage() {
|
|
90
|
+
EventsController.sendEvent({
|
|
91
|
+
type: 'track',
|
|
92
|
+
event: 'CLICK_SIGN_SIWX_MESSAGE',
|
|
93
|
+
properties: this.getSIWXEventProperties()
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
const siwx = OptionsController.state.siwx;
|
|
97
|
+
|
|
98
|
+
const address = ConnectionsController.state.activeAddress;
|
|
99
|
+
const plainAddress = CoreHelperUtil.getPlainAddress(address);
|
|
100
|
+
const network = ConnectionsController.state.activeNetwork;
|
|
101
|
+
|
|
102
|
+
if (!siwx) {
|
|
103
|
+
throw new Error('SIWX is not enabled');
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
if (!address || !plainAddress) {
|
|
107
|
+
throw new Error('No ActiveCaipAddress found');
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
if (!network) {
|
|
111
|
+
throw new Error('No ActiveCaipNetwork or client found');
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
try {
|
|
115
|
+
const siwxMessage = await siwx.createMessage({
|
|
116
|
+
chainId: network.caipNetworkId,
|
|
117
|
+
accountAddress: plainAddress
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
const message = siwxMessage.toString();
|
|
121
|
+
|
|
122
|
+
const signature = await ConnectionsController.signMessage(address, message);
|
|
123
|
+
|
|
124
|
+
if (!signature) {
|
|
125
|
+
throw new Error('Error signing message');
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
SnackController.showLoading('Authenticating...', true);
|
|
129
|
+
|
|
130
|
+
// Add a small delay to allow the app to fully restore network connectivity
|
|
131
|
+
// after returning from background (wallet redirect)
|
|
132
|
+
await new Promise(resolve => setTimeout(resolve, 500));
|
|
133
|
+
|
|
134
|
+
await siwx.addSession({
|
|
135
|
+
data: siwxMessage,
|
|
136
|
+
message,
|
|
137
|
+
signature
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
SnackController.hide();
|
|
141
|
+
|
|
142
|
+
ModalController.close();
|
|
143
|
+
|
|
144
|
+
EventsController.sendEvent({
|
|
145
|
+
type: 'track',
|
|
146
|
+
event: 'SIWX_AUTH_SUCCESS',
|
|
147
|
+
properties: this.getSIWXEventProperties()
|
|
148
|
+
});
|
|
149
|
+
} catch (error) {
|
|
150
|
+
if (!ModalController.state.open) {
|
|
151
|
+
await ModalController.open({
|
|
152
|
+
view: 'SIWXSignMessage'
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
SnackController.hide();
|
|
156
|
+
SnackController.showError('Error signing message');
|
|
157
|
+
EventsController.sendEvent({
|
|
158
|
+
type: 'track',
|
|
159
|
+
event: 'SIWX_AUTH_ERROR',
|
|
160
|
+
properties: this.getSIWXEventProperties(error)
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
// eslint-disable-next-line no-console
|
|
164
|
+
console.error('SIWXUtil:requestSignMessage', error);
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
async cancelSignMessage(onDisconnect: () => Promise<void>) {
|
|
168
|
+
try {
|
|
169
|
+
const siwx = this.getSIWX();
|
|
170
|
+
const isRequired = siwx?.getRequired?.();
|
|
171
|
+
if (isRequired) {
|
|
172
|
+
await onDisconnect();
|
|
173
|
+
} else {
|
|
174
|
+
ModalController.close();
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
EventsController.sendEvent({
|
|
178
|
+
event: 'CLICK_CANCEL_SIWX',
|
|
179
|
+
type: 'track',
|
|
180
|
+
properties: this.getSIWXEventProperties()
|
|
181
|
+
});
|
|
182
|
+
} catch (error) {
|
|
183
|
+
// eslint-disable-next-line no-console
|
|
184
|
+
console.error('SIWXUtil:cancelSignMessage', error);
|
|
185
|
+
}
|
|
186
|
+
},
|
|
187
|
+
async getAllSessions() {
|
|
188
|
+
const siwx = this.getSIWX();
|
|
189
|
+
const allRequestedCaipNetworks = ConnectionsController.state.networks;
|
|
190
|
+
const sessions = [] as SIWXSession[];
|
|
191
|
+
await Promise.all(
|
|
192
|
+
allRequestedCaipNetworks.map(async caipNetwork => {
|
|
193
|
+
const session = await siwx?.getSessions(
|
|
194
|
+
caipNetwork.caipNetworkId,
|
|
195
|
+
CoreHelperUtil.getPlainAddress(ConnectionsController.state.activeAddress) || ''
|
|
196
|
+
);
|
|
197
|
+
if (session) {
|
|
198
|
+
sessions.push(...session);
|
|
199
|
+
}
|
|
200
|
+
})
|
|
201
|
+
);
|
|
202
|
+
|
|
203
|
+
return sessions;
|
|
204
|
+
},
|
|
205
|
+
async getSessions(args?: { address?: string; caipNetworkId?: CaipNetworkId }) {
|
|
206
|
+
const siwx = OptionsController.state.siwx;
|
|
207
|
+
let address = args?.address;
|
|
208
|
+
if (!address) {
|
|
209
|
+
const activeCaipAddress = ConnectionsController.state.activeAddress;
|
|
210
|
+
address = CoreHelperUtil.getPlainAddress(activeCaipAddress);
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
let network = args?.caipNetworkId;
|
|
214
|
+
if (!network) {
|
|
215
|
+
const activeCaipNetwork = ConnectionsController.state.activeNetwork;
|
|
216
|
+
network = activeCaipNetwork?.caipNetworkId;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
if (!siwx || !address || !network) {
|
|
220
|
+
return [];
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
return siwx.getSessions(network, address);
|
|
224
|
+
},
|
|
225
|
+
async isSIWXCloseDisabled() {
|
|
226
|
+
const siwx = this.getSIWX();
|
|
227
|
+
|
|
228
|
+
if (siwx) {
|
|
229
|
+
const isSiwxSignMessage = RouterController.state.view === 'SIWXSignMessage';
|
|
230
|
+
|
|
231
|
+
if (isSiwxSignMessage) {
|
|
232
|
+
return siwx.getRequired?.() && (await this.getSessions()).length === 0;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
return false;
|
|
237
|
+
},
|
|
238
|
+
|
|
239
|
+
async universalProviderAuthenticate({
|
|
240
|
+
universalProvider,
|
|
241
|
+
chains,
|
|
242
|
+
methods,
|
|
243
|
+
universalLink
|
|
244
|
+
}: {
|
|
245
|
+
universalProvider: UniversalProvider;
|
|
246
|
+
chains: CaipNetworkId[];
|
|
247
|
+
methods: string[];
|
|
248
|
+
universalLink?: string;
|
|
249
|
+
}) {
|
|
250
|
+
const siwx = SIWXUtil.getSIWX();
|
|
251
|
+
const namespaces = new Set(chains.map(chain => chain.split(':')[0] as ChainNamespace));
|
|
252
|
+
|
|
253
|
+
if (!siwx || namespaces.size !== 1 || !namespaces.has('eip155')) {
|
|
254
|
+
return undefined;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
// Ignores chainId and account address to get other message data
|
|
258
|
+
const siwxMessage = await siwx.createMessage({
|
|
259
|
+
chainId: OptionsController.state.defaultNetwork?.caipNetworkId || ('' as CaipNetworkId),
|
|
260
|
+
accountAddress: ''
|
|
261
|
+
});
|
|
262
|
+
|
|
263
|
+
let messageChains = chains;
|
|
264
|
+
|
|
265
|
+
if (OptionsController.state.defaultNetwork?.caipNetworkId) {
|
|
266
|
+
// The first chainId is what is used for universal provider to build the message
|
|
267
|
+
messageChains = [
|
|
268
|
+
OptionsController.state.defaultNetwork?.caipNetworkId,
|
|
269
|
+
...chains.filter(chain => chain !== OptionsController.state.defaultNetwork?.caipNetworkId)
|
|
270
|
+
];
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
const result = await universalProvider.authenticate(
|
|
274
|
+
{
|
|
275
|
+
nonce: siwxMessage.nonce,
|
|
276
|
+
domain: siwxMessage.domain,
|
|
277
|
+
uri: siwxMessage.uri,
|
|
278
|
+
exp: siwxMessage.expirationTime,
|
|
279
|
+
iat: siwxMessage.issuedAt,
|
|
280
|
+
nbf: siwxMessage.notBefore,
|
|
281
|
+
requestId: siwxMessage.requestId,
|
|
282
|
+
version: siwxMessage.version,
|
|
283
|
+
resources: siwxMessage.resources,
|
|
284
|
+
statement: siwxMessage.statement,
|
|
285
|
+
chainId: siwxMessage.chainId,
|
|
286
|
+
methods,
|
|
287
|
+
chains: messageChains
|
|
288
|
+
},
|
|
289
|
+
universalLink
|
|
290
|
+
);
|
|
291
|
+
|
|
292
|
+
if (result?.auths?.length) {
|
|
293
|
+
const sessions = result.auths.map<SIWXSession>(cacao => {
|
|
294
|
+
const message = universalProvider.client.formatAuthMessage({
|
|
295
|
+
request: cacao.p,
|
|
296
|
+
iss: cacao.p.iss
|
|
297
|
+
});
|
|
298
|
+
|
|
299
|
+
return {
|
|
300
|
+
data: {
|
|
301
|
+
...cacao.p,
|
|
302
|
+
accountAddress: cacao.p.iss.split(':').slice(-1).join(''),
|
|
303
|
+
chainId: cacao.p.iss.split(':').slice(2, 4).join(':') as CaipNetworkId,
|
|
304
|
+
uri: cacao.p.aud,
|
|
305
|
+
version: cacao.p.version || siwxMessage.version,
|
|
306
|
+
expirationTime: cacao.p.exp,
|
|
307
|
+
issuedAt: cacao.p.iat,
|
|
308
|
+
notBefore: cacao.p.nbf
|
|
309
|
+
},
|
|
310
|
+
message,
|
|
311
|
+
signature: cacao.s.s,
|
|
312
|
+
cacao
|
|
313
|
+
};
|
|
314
|
+
});
|
|
315
|
+
|
|
316
|
+
try {
|
|
317
|
+
SnackController.showLoading('Authenticating...', true);
|
|
318
|
+
await siwx.setSessions(sessions);
|
|
319
|
+
|
|
320
|
+
EventsController.sendEvent({
|
|
321
|
+
type: 'track',
|
|
322
|
+
event: 'SIWX_AUTH_SUCCESS',
|
|
323
|
+
properties: SIWXUtil.getSIWXEventProperties()
|
|
324
|
+
});
|
|
325
|
+
} catch (error) {
|
|
326
|
+
// eslint-disable-next-line no-console
|
|
327
|
+
console.error('SIWX:universalProviderAuth - failed to set sessions', error);
|
|
328
|
+
|
|
329
|
+
EventsController.sendEvent({
|
|
330
|
+
type: 'track',
|
|
331
|
+
event: 'SIWX_AUTH_ERROR',
|
|
332
|
+
properties: SIWXUtil.getSIWXEventProperties(error)
|
|
333
|
+
});
|
|
334
|
+
|
|
335
|
+
// eslint-disable-next-line no-console
|
|
336
|
+
await universalProvider.disconnect().catch(console.error);
|
|
337
|
+
throw error;
|
|
338
|
+
} finally {
|
|
339
|
+
SnackController.hide();
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
return result?.session;
|
|
344
|
+
},
|
|
345
|
+
getSIWXEventProperties(error?: unknown) {
|
|
346
|
+
return {
|
|
347
|
+
network: ConnectionsController.state.activeNetwork?.caipNetworkId,
|
|
348
|
+
isSmartAccount: ConnectionsController.state.accountType === 'smartAccount',
|
|
349
|
+
message: error ? CoreHelperUtil.parseError(error) : undefined
|
|
350
|
+
};
|
|
351
|
+
},
|
|
352
|
+
async clearSessions() {
|
|
353
|
+
const siwx = this.getSIWX();
|
|
354
|
+
|
|
355
|
+
if (siwx) {
|
|
356
|
+
await siwx.setSessions([]);
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
};
|
|
@@ -14,7 +14,8 @@ import {
|
|
|
14
14
|
OnRampController,
|
|
15
15
|
ConnectionsController,
|
|
16
16
|
AssetController,
|
|
17
|
-
AssetUtil
|
|
17
|
+
AssetUtil,
|
|
18
|
+
LogController
|
|
18
19
|
} from '@reown/appkit-core-react-native';
|
|
19
20
|
// import { ConstantsUtil as CommonConstantsUtil } from '@reown/appkit-common-react-native';
|
|
20
21
|
import {
|
|
@@ -94,6 +95,7 @@ export function AccountDefaultView() {
|
|
|
94
95
|
switchAccountType(namespace, newType, network);
|
|
95
96
|
}
|
|
96
97
|
} catch (error) {
|
|
98
|
+
LogController.sendError(error, 'AccountDefaultView.tsx', 'onSwitchAccountType');
|
|
97
99
|
SnackController.showError('Error switching account type');
|
|
98
100
|
}
|
|
99
101
|
};
|
|
@@ -120,7 +122,7 @@ export function AccountDefaultView() {
|
|
|
120
122
|
type: 'track',
|
|
121
123
|
event: 'OPEN_SWAP',
|
|
122
124
|
properties: {
|
|
123
|
-
network: ConnectionsController.state.activeNetwork?.caipNetworkId
|
|
125
|
+
network: ConnectionsController.state.activeNetwork?.caipNetworkId,
|
|
124
126
|
isSmartAccount: false
|
|
125
127
|
}
|
|
126
128
|
});
|
|
@@ -156,7 +158,7 @@ export function AccountDefaultView() {
|
|
|
156
158
|
};
|
|
157
159
|
|
|
158
160
|
const onSendPress = () => {
|
|
159
|
-
const network = ConnectionsController.state.activeNetwork?.caipNetworkId
|
|
161
|
+
const network = ConnectionsController.state.activeNetwork?.caipNetworkId;
|
|
160
162
|
const isSmartAccount = ConnectionsController.state.accountType === 'smartAccount';
|
|
161
163
|
|
|
162
164
|
EventsController.sendEvent({
|