@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
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { WcController } from '@reown/appkit-core-react-native';
|
|
2
|
-
import
|
|
2
|
+
import UniversalProvider from '@walletconnect/universal-provider';
|
|
3
3
|
import {
|
|
4
4
|
WalletConnector,
|
|
5
5
|
type AppKitNetwork,
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
type ConnectionProperties,
|
|
15
15
|
type RequestArguments
|
|
16
16
|
} from '@reown/appkit-common-react-native';
|
|
17
|
-
import {
|
|
17
|
+
import { SIWXUtil } from '../utils/SIWXUtil';
|
|
18
18
|
|
|
19
19
|
interface WalletConnectConnectorConfig {
|
|
20
20
|
projectId: string;
|
|
@@ -42,7 +42,7 @@ export class WalletConnectConnector extends WalletConnector {
|
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
override async restoreSession(): Promise<boolean> {
|
|
45
|
-
const provider = this.getProvider() as
|
|
45
|
+
const provider = this.getProvider() as UniversalProvider;
|
|
46
46
|
if (!provider) {
|
|
47
47
|
return false;
|
|
48
48
|
}
|
|
@@ -67,9 +67,15 @@ export class WalletConnectConnector extends WalletConnector {
|
|
|
67
67
|
this.wallet = {
|
|
68
68
|
...metadata,
|
|
69
69
|
name: metadata.name,
|
|
70
|
-
icon: metadata.icons?.[0]
|
|
70
|
+
icon: metadata.icons?.[0],
|
|
71
|
+
type: 'walletconnect'
|
|
71
72
|
};
|
|
72
73
|
}
|
|
74
|
+
} else {
|
|
75
|
+
this.wallet = {
|
|
76
|
+
name: 'Unknown Wallet',
|
|
77
|
+
type: 'walletconnect'
|
|
78
|
+
};
|
|
73
79
|
}
|
|
74
80
|
|
|
75
81
|
return true;
|
|
@@ -81,7 +87,7 @@ export class WalletConnectConnector extends WalletConnector {
|
|
|
81
87
|
}: {
|
|
82
88
|
projectId: string;
|
|
83
89
|
metadata: Metadata;
|
|
84
|
-
}): Promise<
|
|
90
|
+
}): Promise<UniversalProvider> {
|
|
85
91
|
if (!this.provider) {
|
|
86
92
|
this.provider = (await UniversalProvider.init({
|
|
87
93
|
projectId,
|
|
@@ -90,82 +96,36 @@ export class WalletConnectConnector extends WalletConnector {
|
|
|
90
96
|
})) as Provider;
|
|
91
97
|
}
|
|
92
98
|
|
|
93
|
-
return this.provider as
|
|
99
|
+
return this.provider as UniversalProvider;
|
|
94
100
|
}
|
|
95
101
|
|
|
96
102
|
override async connect(opts: ConnectOptions) {
|
|
97
|
-
const {
|
|
103
|
+
const { namespaces, defaultNetwork, universalLink } = opts;
|
|
98
104
|
function onUri(uri: string) {
|
|
99
105
|
WcController.setWcUri(uri);
|
|
100
106
|
}
|
|
101
107
|
|
|
102
|
-
const provider = this.getProvider() as
|
|
108
|
+
const provider = this.getProvider() as UniversalProvider;
|
|
103
109
|
|
|
104
110
|
// @ts-ignore
|
|
105
111
|
provider.on('display_uri', onUri);
|
|
106
112
|
|
|
107
|
-
let session:
|
|
113
|
+
let session: UniversalProvider['session'];
|
|
108
114
|
|
|
109
115
|
// SIWE
|
|
110
116
|
const isEVMOnly = Object.keys(namespaces ?? {}).length === 1 && namespaces?.['eip155'];
|
|
111
|
-
|
|
112
|
-
if (
|
|
117
|
+
|
|
118
|
+
if (isEVMOnly && SIWXUtil.getSIWX()) {
|
|
113
119
|
// 1CA is only supported on EVM
|
|
114
120
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
nonce: await siweConfig.getNonce(),
|
|
120
|
-
methods: namespaces?.['eip155']?.methods,
|
|
121
|
-
chains: params.chains
|
|
122
|
-
},
|
|
121
|
+
session = await SIWXUtil.universalProviderAuthenticate({
|
|
122
|
+
universalProvider: this.provider as UniversalProvider,
|
|
123
|
+
chains: namespaces?.['eip155']?.chains ?? [],
|
|
124
|
+
methods: namespaces?.['eip155']?.methods ?? [],
|
|
123
125
|
universalLink
|
|
124
|
-
);
|
|
125
|
-
|
|
126
|
-
// Auths is an array of signed CACAO objects https://github.com/ChainAgnostic/CAIPs/blob/main/CAIPs/caip-74.md
|
|
127
|
-
const signedCacao = result?.auths?.[0];
|
|
128
|
-
if (signedCacao) {
|
|
129
|
-
const { p, s } = signedCacao;
|
|
130
|
-
const chainId = getDidChainId(p.iss);
|
|
131
|
-
const address = getDidAddress(p.iss);
|
|
132
|
-
|
|
133
|
-
try {
|
|
134
|
-
// Kicks off verifyMessage and populates external states
|
|
135
|
-
const message = provider?.client?.formatAuthMessage({
|
|
136
|
-
request: p,
|
|
137
|
-
iss: p.iss
|
|
138
|
-
})!;
|
|
139
|
-
|
|
140
|
-
await SIWEController.verifyMessage({
|
|
141
|
-
message,
|
|
142
|
-
signature: s.s,
|
|
143
|
-
cacao: signedCacao
|
|
144
|
-
});
|
|
145
|
-
|
|
146
|
-
if (address && chainId) {
|
|
147
|
-
const siweSession = {
|
|
148
|
-
address,
|
|
149
|
-
chainId: parseInt(chainId, 10)
|
|
150
|
-
};
|
|
151
|
-
|
|
152
|
-
SIWEController.setSession(siweSession);
|
|
153
|
-
SIWEController.onSignIn?.(siweSession);
|
|
154
|
-
}
|
|
155
|
-
} catch (error) {
|
|
156
|
-
// eslint-disable-next-line no-console
|
|
157
|
-
console.error('Error verifying message', error);
|
|
158
|
-
// eslint-disable-next-line no-console
|
|
159
|
-
await provider.disconnect().catch(console.error);
|
|
160
|
-
// eslint-disable-next-line no-console
|
|
161
|
-
await SIWEController.signOut().catch(console.error);
|
|
162
|
-
throw error;
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
session = result?.session;
|
|
126
|
+
});
|
|
166
127
|
} else {
|
|
167
|
-
session = await (this.provider as
|
|
168
|
-
namespaces: {},
|
|
128
|
+
session = await (this.provider as UniversalProvider).connect({
|
|
169
129
|
optionalNamespaces: namespaces
|
|
170
130
|
});
|
|
171
131
|
}
|
|
@@ -175,14 +135,18 @@ export class WalletConnectConnector extends WalletConnector {
|
|
|
175
135
|
this.wallet = {
|
|
176
136
|
...metadata,
|
|
177
137
|
name: metadata?.name,
|
|
178
|
-
icon: metadata?.icons?.[0]
|
|
138
|
+
icon: metadata?.icons?.[0],
|
|
139
|
+
type: 'walletconnect'
|
|
179
140
|
};
|
|
180
141
|
} else {
|
|
181
|
-
this.wallet =
|
|
142
|
+
this.wallet = {
|
|
143
|
+
name: 'Unknown Wallet',
|
|
144
|
+
type: 'walletconnect'
|
|
145
|
+
};
|
|
182
146
|
}
|
|
183
147
|
|
|
184
148
|
if (defaultNetwork?.caipNetworkId) {
|
|
185
|
-
(this.provider as
|
|
149
|
+
(this.provider as UniversalProvider).setDefaultChain(defaultNetwork.caipNetworkId);
|
|
186
150
|
}
|
|
187
151
|
|
|
188
152
|
if (session?.sessionProperties) {
|
|
@@ -229,7 +193,7 @@ export class WalletConnectConnector extends WalletConnector {
|
|
|
229
193
|
|
|
230
194
|
override getNamespaces(): Namespaces {
|
|
231
195
|
const namespaces =
|
|
232
|
-
((this.provider as
|
|
196
|
+
((this.provider as UniversalProvider)?.session?.namespaces as Namespaces) ?? {};
|
|
233
197
|
this.namespaces = namespaces;
|
|
234
198
|
|
|
235
199
|
return namespaces;
|
|
@@ -244,7 +208,7 @@ export class WalletConnectConnector extends WalletConnector {
|
|
|
244
208
|
|
|
245
209
|
let caipNetworkId = network.caipNetworkId ?? `eip155:${network.id}`;
|
|
246
210
|
|
|
247
|
-
(this.provider as
|
|
211
|
+
(this.provider as UniversalProvider).setDefaultChain(caipNetworkId);
|
|
248
212
|
|
|
249
213
|
return Promise.resolve();
|
|
250
214
|
}
|
|
@@ -259,7 +223,7 @@ export class WalletConnectConnector extends WalletConnector {
|
|
|
259
223
|
return undefined;
|
|
260
224
|
}
|
|
261
225
|
|
|
262
|
-
const chainId = (this.provider as
|
|
226
|
+
const chainId = (this.provider as UniversalProvider).rpcProviders[
|
|
263
227
|
namespace
|
|
264
228
|
]?.getDefaultChain?.();
|
|
265
229
|
|
package/src/hooks/useAccount.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/* eslint-disable valtio/state-snapshot-rule */
|
|
2
|
+
import { useMemo } from 'react';
|
|
1
3
|
import { useSnapshot } from 'valtio';
|
|
2
4
|
import { ConnectionsController, CoreHelperUtil } from '@reown/appkit-core-react-native';
|
|
3
5
|
import { useAppKit } from './useAppKit';
|
|
@@ -12,10 +14,13 @@ export function useAccount() {
|
|
|
12
14
|
networks
|
|
13
15
|
} = useSnapshot(ConnectionsController.state);
|
|
14
16
|
|
|
15
|
-
const activeChain =
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
const activeChain = useMemo(
|
|
18
|
+
() =>
|
|
19
|
+
connection?.caipNetwork
|
|
20
|
+
? networks.find(network => network.caipNetworkId === connection?.caipNetwork)
|
|
21
|
+
: undefined,
|
|
22
|
+
[connection?.caipNetwork, networks]
|
|
23
|
+
);
|
|
19
24
|
|
|
20
25
|
return {
|
|
21
26
|
address: CoreHelperUtil.getPlainAddress(address),
|
package/src/hooks/useAppKit.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { useContext } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import { ModalController } from '@reown/appkit-core-react-native';
|
|
1
|
+
import { useContext, useMemo } from 'react';
|
|
2
|
+
import type { ChainNamespace } from '@reown/appkit-common-react-native';
|
|
4
3
|
|
|
5
4
|
import type { AppKit } from '../AppKit';
|
|
6
5
|
import { AppKitContext } from '../AppKitContext';
|
|
@@ -8,28 +7,35 @@ import { AppKitContext } from '../AppKitContext';
|
|
|
8
7
|
interface UseAppKitReturn {
|
|
9
8
|
open: AppKit['open'];
|
|
10
9
|
close: AppKit['close'];
|
|
11
|
-
disconnect: (namespace?:
|
|
10
|
+
disconnect: (namespace?: ChainNamespace) => void;
|
|
12
11
|
switchNetwork: AppKit['switchNetwork'];
|
|
13
|
-
isOpen: boolean;
|
|
14
12
|
}
|
|
15
13
|
|
|
16
14
|
export const useAppKit = (): UseAppKitReturn => {
|
|
17
15
|
const context = useContext(AppKitContext);
|
|
18
|
-
const { open } = useSnapshot(ModalController.state);
|
|
19
16
|
|
|
20
17
|
if (context === undefined) {
|
|
21
18
|
throw new Error('useAppKit must be used within an AppKitProvider');
|
|
22
19
|
}
|
|
20
|
+
|
|
23
21
|
if (!context.appKit) {
|
|
24
22
|
// This might happen if the provider is rendered before AppKit is initialized
|
|
25
23
|
throw new Error('AppKit instance is not yet available in context.');
|
|
26
24
|
}
|
|
27
25
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
26
|
+
const stableFunctions = useMemo(() => {
|
|
27
|
+
if (!context.appKit) {
|
|
28
|
+
throw new Error('AppKit instance is not available');
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return {
|
|
32
|
+
open: context.appKit.open.bind(context.appKit),
|
|
33
|
+
close: context.appKit.close.bind(context.appKit),
|
|
34
|
+
disconnect: (namespace?: ChainNamespace) =>
|
|
35
|
+
context.appKit!.disconnect.bind(context.appKit!)(namespace),
|
|
36
|
+
switchNetwork: context.appKit.switchNetwork.bind(context.appKit)
|
|
37
|
+
};
|
|
38
|
+
}, [context.appKit]);
|
|
39
|
+
|
|
40
|
+
return stableFunctions;
|
|
35
41
|
};
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { useContext, useMemo } from 'react';
|
|
2
|
+
import { useSnapshot } from 'valtio';
|
|
3
|
+
import { LogController, type LogEntry, type LogLevel } from '@reown/appkit-core-react-native';
|
|
4
|
+
import { AppKitContext } from '../AppKitContext';
|
|
5
|
+
|
|
6
|
+
export interface UseAppKitLogsReturn {
|
|
7
|
+
/**
|
|
8
|
+
* All logs from AppKit
|
|
9
|
+
*/
|
|
10
|
+
logs: LogEntry[];
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Get logs filtered by level
|
|
14
|
+
*/
|
|
15
|
+
getLogsByLevel: (level: LogLevel) => LogEntry[];
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Get recent logs (default: 100)
|
|
19
|
+
*/
|
|
20
|
+
getRecentLogs: (count?: number) => LogEntry[];
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Export all logs as JSON string
|
|
24
|
+
*/
|
|
25
|
+
exportLogs: () => string;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Get logging statistics by level
|
|
29
|
+
*/
|
|
30
|
+
getLogsStats: () => Record<LogLevel, number>;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Clear all logs
|
|
34
|
+
*/
|
|
35
|
+
clearLogs: () => void;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Convenience getters for different log levels (regular arrays, safe for console.log)
|
|
39
|
+
*/
|
|
40
|
+
errorLogs: LogEntry[];
|
|
41
|
+
warningLogs: LogEntry[];
|
|
42
|
+
infoLogs: LogEntry[];
|
|
43
|
+
debugLogs: LogEntry[];
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* React hook for accessing AppKit logs
|
|
48
|
+
*
|
|
49
|
+
* This hook provides reactive access to AppKit's internal logging system.
|
|
50
|
+
* It automatically updates when new logs are added or when logs are cleaned up.
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* ```typescript
|
|
54
|
+
* function MyComponent() {
|
|
55
|
+
* const { logs, errorLogs, exportLogs, clearLogs } = useAppKitLogs();
|
|
56
|
+
*
|
|
57
|
+
* return (
|
|
58
|
+
* <View>
|
|
59
|
+
* <Text>Total logs: {logs.length}</Text>
|
|
60
|
+
* <Text>Error logs: {errorLogs.length}</Text>
|
|
61
|
+
* <Button onPress={clearLogs} title="Clear Logs" />
|
|
62
|
+
* </View>
|
|
63
|
+
* );
|
|
64
|
+
* }
|
|
65
|
+
* ```
|
|
66
|
+
*/
|
|
67
|
+
export const useAppKitLogs = (): UseAppKitLogsReturn => {
|
|
68
|
+
const context = useContext(AppKitContext);
|
|
69
|
+
|
|
70
|
+
if (context === undefined) {
|
|
71
|
+
throw new Error('useAppKitLogs must be used within an AppKitProvider');
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if (!context.appKit) {
|
|
75
|
+
throw new Error('AppKit instance is not yet available in context.');
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const { logs } = useSnapshot(LogController.state);
|
|
79
|
+
|
|
80
|
+
// Memoized functions that don't need to change on every render
|
|
81
|
+
const stableFunctions = useMemo(
|
|
82
|
+
() => ({
|
|
83
|
+
getLogsByLevel: (level: LogLevel) => LogController.getLogsByLevel(level),
|
|
84
|
+
getRecentLogs: (count?: number) => LogController.getRecentLogs(count),
|
|
85
|
+
exportLogs: () => LogController.exportLogs(),
|
|
86
|
+
getLogsStats: () => LogController.getLogsStats(),
|
|
87
|
+
clearLogs: () => LogController.clearLogs()
|
|
88
|
+
}),
|
|
89
|
+
[]
|
|
90
|
+
);
|
|
91
|
+
|
|
92
|
+
const regularArrays = useMemo(() => {
|
|
93
|
+
const allLogs = [...logs]; // Convert proxy to regular array
|
|
94
|
+
const errorLogs: LogEntry[] = [];
|
|
95
|
+
const warningLogs: LogEntry[] = [];
|
|
96
|
+
const infoLogs: LogEntry[] = [];
|
|
97
|
+
const debugLogs: LogEntry[] = [];
|
|
98
|
+
|
|
99
|
+
for (const log of allLogs) {
|
|
100
|
+
switch (log.level) {
|
|
101
|
+
case 'error':
|
|
102
|
+
errorLogs.push(log);
|
|
103
|
+
break;
|
|
104
|
+
case 'warn':
|
|
105
|
+
warningLogs.push(log);
|
|
106
|
+
break;
|
|
107
|
+
case 'info':
|
|
108
|
+
infoLogs.push(log);
|
|
109
|
+
break;
|
|
110
|
+
case 'debug':
|
|
111
|
+
debugLogs.push(log);
|
|
112
|
+
break;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
return {
|
|
117
|
+
logs: allLogs,
|
|
118
|
+
errorLogs,
|
|
119
|
+
warningLogs,
|
|
120
|
+
infoLogs,
|
|
121
|
+
debugLogs
|
|
122
|
+
};
|
|
123
|
+
}, [logs]);
|
|
124
|
+
|
|
125
|
+
return {
|
|
126
|
+
...regularArrays,
|
|
127
|
+
...stableFunctions
|
|
128
|
+
};
|
|
129
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/* eslint-disable valtio/state-snapshot-rule */
|
|
2
|
+
import { useMemo } from 'react';
|
|
3
|
+
import { useSnapshot } from 'valtio';
|
|
4
|
+
import { ConnectionsController, ModalController } from '@reown/appkit-core-react-native';
|
|
5
|
+
import { useAppKit } from './useAppKit';
|
|
6
|
+
|
|
7
|
+
export function useAppKitState() {
|
|
8
|
+
useAppKit(); // Use the hook for checks
|
|
9
|
+
const { activeAddress: address, connection, networks } = useSnapshot(ConnectionsController.state);
|
|
10
|
+
const { open, loading } = useSnapshot(ModalController.state);
|
|
11
|
+
|
|
12
|
+
const activeChain = useMemo(
|
|
13
|
+
() =>
|
|
14
|
+
connection?.caipNetwork
|
|
15
|
+
? networks.find(network => network.caipNetworkId === connection?.caipNetwork)
|
|
16
|
+
: undefined,
|
|
17
|
+
[connection?.caipNetwork, networks]
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
return {
|
|
21
|
+
isOpen: open,
|
|
22
|
+
isLoading: loading,
|
|
23
|
+
isConnected: !!address,
|
|
24
|
+
chain: activeChain
|
|
25
|
+
};
|
|
26
|
+
}
|
package/src/hooks/useProvider.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/* eslint-disable valtio/state-snapshot-rule */
|
|
2
|
+
import { useMemo } from 'react';
|
|
1
3
|
import { useSnapshot } from 'valtio';
|
|
2
4
|
import { ConnectionsController } from '@reown/appkit-core-react-native';
|
|
3
5
|
import type { Provider, ChainNamespace } from '@reown/appkit-common-react-native';
|
|
@@ -37,10 +39,14 @@ interface ProviderResult {
|
|
|
37
39
|
export function useProvider(): ProviderResult {
|
|
38
40
|
const { connection } = useSnapshot(ConnectionsController.state);
|
|
39
41
|
|
|
40
|
-
|
|
42
|
+
const returnValue = useMemo(() => {
|
|
43
|
+
if (!connection) return { provider: undefined, providerType: undefined };
|
|
41
44
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
45
|
+
return {
|
|
46
|
+
provider: connection.adapter.getProvider(),
|
|
47
|
+
providerType: connection.adapter.getSupportedNamespace()
|
|
48
|
+
};
|
|
49
|
+
}, [connection]);
|
|
50
|
+
|
|
51
|
+
return returnValue;
|
|
46
52
|
}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
1
2
|
import { useSnapshot } from 'valtio';
|
|
2
3
|
import { ConnectionsController } from '@reown/appkit-core-react-native';
|
|
3
4
|
import { useAppKit } from './useAppKit';
|
|
4
5
|
|
|
5
6
|
export function useWalletInfo() {
|
|
6
7
|
useAppKit(); // Use the hook for checks
|
|
7
|
-
const { walletInfo } = useSnapshot(ConnectionsController.state);
|
|
8
|
+
const { walletInfo: walletInfoSnapshot } = useSnapshot(ConnectionsController.state);
|
|
8
9
|
|
|
9
|
-
|
|
10
|
+
const walletInfo = useMemo(() => ({ walletInfo: walletInfoSnapshot }), [walletInfoSnapshot]);
|
|
11
|
+
|
|
12
|
+
return walletInfo;
|
|
10
13
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import '@walletconnect/react-native-compat';
|
|
2
|
+
|
|
1
3
|
/********** Components **********/
|
|
2
4
|
export {
|
|
3
5
|
AccountButton as AccountButton,
|
|
@@ -17,6 +19,13 @@ export { AppKit } from './modal/w3m-modal';
|
|
|
17
19
|
/********** Types **********/
|
|
18
20
|
export type * from '@reown/appkit-core-react-native';
|
|
19
21
|
export type { AppKitNetwork, Storage } from '@reown/appkit-common-react-native';
|
|
22
|
+
export type {
|
|
23
|
+
SIWXConfig,
|
|
24
|
+
SIWXMessage,
|
|
25
|
+
SIWXSession,
|
|
26
|
+
SIWXStorage,
|
|
27
|
+
SIWXVerifier
|
|
28
|
+
} from '@reown/appkit-common-react-native';
|
|
20
29
|
export type { AppKitConfig } from './types';
|
|
21
30
|
|
|
22
31
|
/****** Hooks *******/
|
|
@@ -25,11 +34,16 @@ export { useProvider } from './hooks/useProvider';
|
|
|
25
34
|
export { useAccount } from './hooks/useAccount';
|
|
26
35
|
export { useWalletInfo } from './hooks/useWalletInfo';
|
|
27
36
|
export { useAppKitEvents, useAppKitEventSubscription } from './hooks/useAppKitEvents';
|
|
37
|
+
export { useAppKitState } from './hooks/useAppKitState';
|
|
38
|
+
export { useAppKitLogs, type UseAppKitLogsReturn } from './hooks/useAppKitLogs';
|
|
28
39
|
|
|
29
40
|
/********** Networks **********/
|
|
30
41
|
export { solana, solanaDevnet, solanaTestnet } from '@reown/appkit-common-react-native';
|
|
31
42
|
export { bitcoin, bitcoinTestnet } from '@reown/appkit-common-react-native';
|
|
32
43
|
|
|
44
|
+
/********** SIWX **********/
|
|
45
|
+
export { ReownAuthentication } from '@reown/appkit-core-react-native';
|
|
46
|
+
|
|
33
47
|
/********** Main **********/
|
|
34
48
|
export { createAppKit } from './AppKit';
|
|
35
49
|
export { AppKitProvider } from './AppKitContext';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { useSnapshot } from 'valtio';
|
|
2
2
|
import { useCallback, useEffect } from 'react';
|
|
3
|
+
import { useColorScheme } from 'react-native';
|
|
3
4
|
import { Card, Modal, ThemeProvider } from '@reown/appkit-ui-react-native';
|
|
4
5
|
import {
|
|
5
6
|
ApiController,
|
|
@@ -18,10 +19,11 @@ import { useInternalAppKit } from '../../AppKitContext';
|
|
|
18
19
|
import styles from './styles';
|
|
19
20
|
|
|
20
21
|
export function AppKit() {
|
|
22
|
+
const theme = useColorScheme();
|
|
21
23
|
const { bottom, top } = useSafeAreaInsets();
|
|
22
24
|
const { close } = useInternalAppKit();
|
|
23
25
|
const { open } = useSnapshot(ModalController.state);
|
|
24
|
-
const { themeMode, themeVariables } = useSnapshot(ThemeController.state);
|
|
26
|
+
const { themeMode, themeVariables, defaultThemeMode } = useSnapshot(ThemeController.state);
|
|
25
27
|
const { projectId } = useSnapshot(OptionsController.state);
|
|
26
28
|
|
|
27
29
|
const handleBackPress = () => {
|
|
@@ -32,6 +34,12 @@ export function AppKit() {
|
|
|
32
34
|
return handleModalClose();
|
|
33
35
|
};
|
|
34
36
|
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
if (theme && !defaultThemeMode) {
|
|
39
|
+
ThemeController.setThemeMode(theme);
|
|
40
|
+
}
|
|
41
|
+
}, [theme, defaultThemeMode]);
|
|
42
|
+
|
|
35
43
|
const prefetch = useCallback(async () => {
|
|
36
44
|
await ApiController.prefetch();
|
|
37
45
|
EventsController.sendEvent({ type: 'track', event: 'MODAL_LOADED' });
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useSnapshot } from 'valtio';
|
|
2
|
-
import {
|
|
2
|
+
import { useMemo } from 'react';
|
|
3
3
|
import { RouterController } from '@reown/appkit-core-react-native';
|
|
4
4
|
|
|
5
5
|
import { AccountDefaultView } from '../../views/w3m-account-default-view';
|
|
@@ -10,7 +10,7 @@ import { ConnectSocialsView } from '../../views/w3m-connect-socials-view';
|
|
|
10
10
|
import { ConnectingView } from '../../views/w3m-connecting-view';
|
|
11
11
|
import { ConnectingExternalView } from '../../views/w3m-connecting-external-view';
|
|
12
12
|
import { ConnectingSocialView } from '../../views/w3m-connecting-social-view';
|
|
13
|
-
import {
|
|
13
|
+
import { SIWXSignMessageView } from '../../views/w3m-siwx-sign-view';
|
|
14
14
|
import { GetWalletView } from '../../views/w3m-get-wallet-view';
|
|
15
15
|
import { NetworksView } from '../../views/w3m-networks-view';
|
|
16
16
|
import { NetworkSwitchView } from '../../views/w3m-network-switch-view';
|
|
@@ -31,8 +31,8 @@ import { WalletSendPreviewView } from '../../views/w3m-wallet-send-preview-view'
|
|
|
31
31
|
import { WalletSendSelectTokenView } from '../../views/w3m-wallet-send-select-token-view';
|
|
32
32
|
import { WhatIsANetworkView } from '../../views/w3m-what-is-a-network-view';
|
|
33
33
|
import { WhatIsAWalletView } from '../../views/w3m-what-is-a-wallet-view';
|
|
34
|
-
import { UiUtil } from '../../utils/UiUtil';
|
|
35
|
-
import { useRouteTransition } from '../../hooks/useRouteTransition';
|
|
34
|
+
// import { UiUtil } from '../../utils/UiUtil';
|
|
35
|
+
// import { useRouteTransition } from '../../hooks/useRouteTransition';
|
|
36
36
|
|
|
37
37
|
import { Animated } from 'react-native';
|
|
38
38
|
import { useCustomDimensions } from '@reown/appkit-ui-react-native';
|
|
@@ -40,18 +40,15 @@ import { useCustomDimensions } from '@reown/appkit-ui-react-native';
|
|
|
40
40
|
export function AppKitRouter() {
|
|
41
41
|
const { view } = useSnapshot(RouterController.state);
|
|
42
42
|
const { maxHeight } = useCustomDimensions();
|
|
43
|
-
const { animateTransition, getAnimatedStyle } = useRouteTransition(
|
|
44
|
-
duration: 300,
|
|
45
|
-
useNativeDriver: true
|
|
46
|
-
});
|
|
43
|
+
// const { animateTransition, getAnimatedStyle } = useRouteTransition();
|
|
47
44
|
|
|
48
|
-
useEffect(() => {
|
|
49
|
-
|
|
50
|
-
}, [animateTransition]);
|
|
45
|
+
// useEffect(() => {
|
|
46
|
+
// UiUtil.setRouteTransition(animateTransition);
|
|
47
|
+
// }, [animateTransition]);
|
|
51
48
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}, [view]);
|
|
49
|
+
// useEffect(() => {
|
|
50
|
+
// UiUtil.createViewTransition();
|
|
51
|
+
// }, [view]);
|
|
55
52
|
|
|
56
53
|
const ViewComponent = useMemo(() => {
|
|
57
54
|
switch (view) {
|
|
@@ -67,11 +64,11 @@ export function AppKitRouter() {
|
|
|
67
64
|
return ConnectSocialsView;
|
|
68
65
|
case 'ConnectingExternal':
|
|
69
66
|
return ConnectingExternalView;
|
|
70
|
-
case '
|
|
71
|
-
return
|
|
67
|
+
case 'SIWXSignMessage':
|
|
68
|
+
return SIWXSignMessageView;
|
|
72
69
|
case 'ConnectingSocial':
|
|
73
70
|
return ConnectingSocialView;
|
|
74
|
-
case '
|
|
71
|
+
case 'WalletConnect':
|
|
75
72
|
return ConnectingView;
|
|
76
73
|
case 'GetWallet':
|
|
77
74
|
return GetWalletView;
|
|
@@ -119,7 +116,7 @@ export function AppKitRouter() {
|
|
|
119
116
|
}, [view]);
|
|
120
117
|
|
|
121
118
|
return (
|
|
122
|
-
<Animated.View style={
|
|
119
|
+
<Animated.View style={{ maxHeight }}>
|
|
123
120
|
<ViewComponent />
|
|
124
121
|
</Animated.View>
|
|
125
122
|
);
|
|
@@ -21,7 +21,7 @@ export function AccountWalletFeatures() {
|
|
|
21
21
|
const { features, isOnRampEnabled } = useSnapshot(OptionsController.state);
|
|
22
22
|
const { activeNetwork, balances, activeNamespace } = useSnapshot(ConnectionsController.state);
|
|
23
23
|
const balance = CoreHelperUtil.calculateAndFormatBalance(balances as BalanceType[]);
|
|
24
|
-
const network = ConnectionsController.state.activeNetwork?.caipNetworkId
|
|
24
|
+
const network = ConnectionsController.state.activeNetwork?.caipNetworkId;
|
|
25
25
|
const isSmartAccount = ConnectionsController.state.accountType === 'smartAccount';
|
|
26
26
|
const showSend =
|
|
27
27
|
activeNamespace && ConstantsUtil.SEND_SUPPORTED_NAMESPACES.includes(activeNamespace);
|
|
@@ -7,12 +7,21 @@ import { memo } from 'react';
|
|
|
7
7
|
|
|
8
8
|
interface WalletItemProps {
|
|
9
9
|
item: WcWallet;
|
|
10
|
+
displayIndex: number;
|
|
10
11
|
imageHeaders?: Record<string, string>;
|
|
11
|
-
onItemPress: (wallet: WcWallet) => void;
|
|
12
|
+
onItemPress: (wallet: WcWallet, displayIndex: number) => void;
|
|
12
13
|
style?: StyleProp<ViewStyle>;
|
|
14
|
+
testID?: string;
|
|
13
15
|
}
|
|
14
16
|
|
|
15
|
-
export function WalletItem({
|
|
17
|
+
export function WalletItem({
|
|
18
|
+
item,
|
|
19
|
+
displayIndex,
|
|
20
|
+
imageHeaders,
|
|
21
|
+
onItemPress,
|
|
22
|
+
style,
|
|
23
|
+
testID
|
|
24
|
+
}: WalletItemProps) {
|
|
16
25
|
const { walletImages } = useSnapshot(AssetController.state);
|
|
17
26
|
const isInstalled = ApiController.state.installed.find(wallet => wallet?.id === item?.id);
|
|
18
27
|
const imageSrc = AssetUtil.getWalletImage(item, walletImages);
|
|
@@ -27,8 +36,9 @@ export function WalletItem({ item, imageHeaders, onItemPress, style }: WalletIte
|
|
|
27
36
|
style={style}
|
|
28
37
|
imageHeaders={imageHeaders}
|
|
29
38
|
name={item?.name ?? 'Unknown'}
|
|
30
|
-
onPress={() => onItemPress(item)}
|
|
39
|
+
onPress={() => onItemPress(item, displayIndex)}
|
|
31
40
|
installed={!!isInstalled}
|
|
41
|
+
testID={testID}
|
|
32
42
|
/>
|
|
33
43
|
);
|
|
34
44
|
}
|