@reown/appkit-react-native 2.0.0-alpha.5 → 2.0.0-alpha.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (105) hide show
  1. package/lib/commonjs/AppKit.js +31 -77
  2. package/lib/commonjs/AppKit.js.map +1 -1
  3. package/lib/commonjs/connectors/WalletConnectConnector.js +24 -57
  4. package/lib/commonjs/connectors/WalletConnectConnector.js.map +1 -1
  5. package/lib/commonjs/index.js +7 -0
  6. package/lib/commonjs/index.js.map +1 -1
  7. package/lib/commonjs/modal/w3m-router/index.js +18 -20
  8. package/lib/commonjs/modal/w3m-router/index.js.map +1 -1
  9. package/lib/commonjs/partials/w3m-all-wallets-list/components/WalletItem.js +4 -2
  10. package/lib/commonjs/partials/w3m-all-wallets-list/components/WalletItem.js.map +1 -1
  11. package/lib/commonjs/partials/w3m-all-wallets-list/components/WalletList.js +3 -1
  12. package/lib/commonjs/partials/w3m-all-wallets-list/components/WalletList.js.map +1 -1
  13. package/lib/commonjs/partials/w3m-all-wallets-search/index.js +2 -1
  14. package/lib/commonjs/partials/w3m-all-wallets-search/index.js.map +1 -1
  15. package/lib/commonjs/partials/w3m-header/index.js +3 -3
  16. package/lib/commonjs/partials/w3m-header/index.js.map +1 -1
  17. package/lib/commonjs/utils/SIWXUtil.js +282 -0
  18. package/lib/commonjs/utils/SIWXUtil.js.map +1 -0
  19. package/lib/commonjs/views/w3m-connecting-view/index.js +11 -31
  20. package/lib/commonjs/views/w3m-connecting-view/index.js.map +1 -1
  21. package/lib/commonjs/views/w3m-onramp-settings-view/components/Country.js +3 -1
  22. package/lib/commonjs/views/w3m-onramp-settings-view/components/Country.js.map +1 -1
  23. package/lib/commonjs/views/w3m-onramp-settings-view/index.js +2 -1
  24. package/lib/commonjs/views/w3m-onramp-settings-view/index.js.map +1 -1
  25. package/lib/commonjs/views/{w3m-connecting-siwe-view → w3m-siwx-sign-view}/index.js +6 -43
  26. package/lib/commonjs/views/w3m-siwx-sign-view/index.js.map +1 -0
  27. package/lib/commonjs/views/w3m-siwx-sign-view/styles.js.map +1 -0
  28. package/lib/module/AppKit.js +31 -77
  29. package/lib/module/AppKit.js.map +1 -1
  30. package/lib/module/connectors/WalletConnectConnector.js +22 -56
  31. package/lib/module/connectors/WalletConnectConnector.js.map +1 -1
  32. package/lib/module/index.js +3 -0
  33. package/lib/module/index.js.map +1 -1
  34. package/lib/module/modal/w3m-router/index.js +19 -21
  35. package/lib/module/modal/w3m-router/index.js.map +1 -1
  36. package/lib/module/partials/w3m-all-wallets-list/components/WalletItem.js +4 -2
  37. package/lib/module/partials/w3m-all-wallets-list/components/WalletItem.js.map +1 -1
  38. package/lib/module/partials/w3m-all-wallets-list/components/WalletList.js +3 -1
  39. package/lib/module/partials/w3m-all-wallets-list/components/WalletList.js.map +1 -1
  40. package/lib/module/partials/w3m-all-wallets-search/index.js +2 -1
  41. package/lib/module/partials/w3m-all-wallets-search/index.js.map +1 -1
  42. package/lib/module/partials/w3m-header/index.js +3 -3
  43. package/lib/module/partials/w3m-header/index.js.map +1 -1
  44. package/lib/module/utils/SIWXUtil.js +279 -0
  45. package/lib/module/utils/SIWXUtil.js.map +1 -0
  46. package/lib/module/views/w3m-connecting-view/index.js +12 -32
  47. package/lib/module/views/w3m-connecting-view/index.js.map +1 -1
  48. package/lib/module/views/w3m-onramp-settings-view/components/Country.js +3 -1
  49. package/lib/module/views/w3m-onramp-settings-view/components/Country.js.map +1 -1
  50. package/lib/module/views/w3m-onramp-settings-view/index.js +2 -1
  51. package/lib/module/views/w3m-onramp-settings-view/index.js.map +1 -1
  52. package/lib/module/views/{w3m-connecting-siwe-view → w3m-siwx-sign-view}/index.js +6 -43
  53. package/lib/module/views/w3m-siwx-sign-view/index.js.map +1 -0
  54. package/lib/module/views/w3m-siwx-sign-view/styles.js.map +1 -0
  55. package/lib/typescript/AppKit.d.ts +0 -2
  56. package/lib/typescript/AppKit.d.ts.map +1 -1
  57. package/lib/typescript/connectors/WalletConnectConnector.d.ts.map +1 -1
  58. package/lib/typescript/hooks/useAppKitEvents.d.ts +6 -4
  59. package/lib/typescript/hooks/useAppKitEvents.d.ts.map +1 -1
  60. package/lib/typescript/hooks/useWalletInfo.d.ts +1 -0
  61. package/lib/typescript/hooks/useWalletInfo.d.ts.map +1 -1
  62. package/lib/typescript/index.d.ts +3 -0
  63. package/lib/typescript/index.d.ts.map +1 -1
  64. package/lib/typescript/modal/w3m-router/index.d.ts.map +1 -1
  65. package/lib/typescript/partials/w3m-all-wallets-list/components/WalletItem.d.ts +2 -1
  66. package/lib/typescript/partials/w3m-all-wallets-list/components/WalletItem.d.ts.map +1 -1
  67. package/lib/typescript/partials/w3m-all-wallets-list/components/WalletList.d.ts +2 -1
  68. package/lib/typescript/partials/w3m-all-wallets-list/components/WalletList.d.ts.map +1 -1
  69. package/lib/typescript/types.d.ts +5 -7
  70. package/lib/typescript/types.d.ts.map +1 -1
  71. package/lib/typescript/utils/SIWXUtil.d.ts +34 -0
  72. package/lib/typescript/utils/SIWXUtil.d.ts.map +1 -0
  73. package/lib/typescript/views/w3m-connecting-view/index.d.ts.map +1 -1
  74. package/lib/typescript/views/w3m-onramp-settings-view/components/Country.d.ts +2 -1
  75. package/lib/typescript/views/w3m-onramp-settings-view/components/Country.d.ts.map +1 -1
  76. package/lib/typescript/views/w3m-onramp-settings-view/index.d.ts.map +1 -1
  77. package/lib/typescript/views/w3m-siwx-sign-view/index.d.ts +2 -0
  78. package/lib/typescript/views/w3m-siwx-sign-view/index.d.ts.map +1 -0
  79. package/lib/typescript/views/w3m-siwx-sign-view/styles.d.ts.map +1 -0
  80. package/package.json +6 -7
  81. package/src/AppKit.ts +27 -86
  82. package/src/connectors/WalletConnectConnector.ts +33 -69
  83. package/src/index.ts +10 -0
  84. package/src/modal/w3m-router/index.tsx +14 -17
  85. package/src/partials/w3m-all-wallets-list/components/WalletItem.tsx +3 -1
  86. package/src/partials/w3m-all-wallets-list/components/WalletList.tsx +3 -0
  87. package/src/partials/w3m-all-wallets-search/index.tsx +1 -1
  88. package/src/partials/w3m-header/index.tsx +3 -3
  89. package/src/types.ts +6 -8
  90. package/src/utils/SIWXUtil.ts +364 -0
  91. package/src/views/w3m-connecting-view/index.tsx +13 -32
  92. package/src/views/w3m-onramp-settings-view/components/Country.tsx +3 -1
  93. package/src/views/w3m-onramp-settings-view/index.tsx +1 -0
  94. package/src/views/{w3m-connecting-siwe-view → w3m-siwx-sign-view}/index.tsx +5 -37
  95. package/lib/commonjs/views/w3m-connecting-siwe-view/index.js.map +0 -1
  96. package/lib/commonjs/views/w3m-connecting-siwe-view/styles.js.map +0 -1
  97. package/lib/module/views/w3m-connecting-siwe-view/index.js.map +0 -1
  98. package/lib/module/views/w3m-connecting-siwe-view/styles.js.map +0 -1
  99. package/lib/typescript/views/w3m-connecting-siwe-view/index.d.ts +0 -2
  100. package/lib/typescript/views/w3m-connecting-siwe-view/index.d.ts.map +0 -1
  101. package/lib/typescript/views/w3m-connecting-siwe-view/styles.d.ts.map +0 -1
  102. /package/lib/commonjs/views/{w3m-connecting-siwe-view → w3m-siwx-sign-view}/styles.js +0 -0
  103. /package/lib/module/views/{w3m-connecting-siwe-view → w3m-siwx-sign-view}/styles.js +0 -0
  104. /package/lib/typescript/views/{w3m-connecting-siwe-view → w3m-siwx-sign-view}/styles.d.ts +0 -0
  105. /package/src/views/{w3m-connecting-siwe-view → w3m-siwx-sign-view}/styles.ts +0 -0
package/src/AppKit.ts CHANGED
@@ -37,13 +37,13 @@ import {
37
37
  type Connection,
38
38
  type WcWallet
39
39
  } from '@reown/appkit-common-react-native';
40
- import { SIWEController } from '@reown/appkit-siwe-react-native';
41
40
 
42
41
  import { WalletConnectConnector } from './connectors/WalletConnectConnector';
43
42
  import { WcHelpersUtil } from './utils/HelpersUtil';
44
43
  import { NetworkUtil } from './utils/NetworkUtil';
45
44
  import { RouterUtil } from './utils/RouterUtil';
46
45
  import { type AppKitConfig } from './types';
46
+ import { SIWXUtil } from './utils/SIWXUtil';
47
47
 
48
48
  export class AppKit {
49
49
  private projectId: string;
@@ -131,8 +131,7 @@ export class AppKit {
131
131
  const approvedNamespaces = await connector.connect({
132
132
  namespaces: this.namespaces,
133
133
  defaultNetwork: chain,
134
- universalLink: targetWallet?.link_mode ?? undefined,
135
- siweConfig: this.config?.siweConfig
134
+ universalLink: targetWallet?.link_mode ?? undefined
136
135
  });
137
136
 
138
137
  this.processConnection(connector, approvedNamespaces);
@@ -150,11 +149,7 @@ export class AppKit {
150
149
  }
151
150
  }
152
151
 
153
- private async processConnection(
154
- connector: WalletConnector,
155
- namespaces?: Namespaces,
156
- shouldCloseModal: boolean = true
157
- ) {
152
+ private async processConnection(connector: WalletConnector, namespaces?: Namespaces) {
158
153
  if (!namespaces || Object.keys(namespaces).length === 0) {
159
154
  throw new Error('No namespaces provided');
160
155
  }
@@ -176,19 +171,7 @@ export class AppKit {
176
171
  // Sync accounts
177
172
  await this.syncAccounts(initializedAdapters);
178
173
 
179
- // Handle SIWE if enabled
180
- this.handleSiweConnectionIfEnabled(shouldCloseModal);
181
- }
182
-
183
- private handleSiweConnectionIfEnabled(shouldCloseModal: boolean = true): void {
184
- if (
185
- OptionsController.state.isSiweEnabled &&
186
- ConnectionsController.state.activeNamespace === 'eip155'
187
- ) {
188
- this.handleSiweChange({ isConnection: true });
189
- } else if (shouldCloseModal) {
190
- ModalController.close();
191
- }
174
+ await SIWXUtil.initializeIfEnabled({ onDisconnect: this.disconnect, closeModal: true });
192
175
  }
193
176
 
194
177
  /**
@@ -230,8 +213,8 @@ export class AppKit {
230
213
  );
231
214
  }
232
215
 
233
- if (OptionsController.state.isSiweEnabled) {
234
- await SIWEController.signOut();
216
+ if (SIWXUtil.getSIWX()?.signOutOnDisconnect) {
217
+ await SIWXUtil.clearSessions();
235
218
  }
236
219
 
237
220
  EventsController.sendEvent({
@@ -298,15 +281,11 @@ export class AppKit {
298
281
 
299
282
  async close() {
300
283
  ModalController.close();
284
+ const isSIWXRequired = SIWXUtil.getSIWX()?.getRequired?.();
301
285
 
302
- if (OptionsController.state.isSiweEnabled && ConnectionsController.state.isConnected) {
303
- const session = await SIWEController.getSession();
304
- if (
305
- !session &&
306
- SIWEController.state.status !== 'success' &&
307
- ConnectionsController.state.activeNamespace === 'eip155' &&
308
- !!ConnectionsController.state.activeAddress
309
- ) {
286
+ if (isSIWXRequired && ConnectionsController.state.isConnected) {
287
+ const sessions = await SIWXUtil.getSessions();
288
+ if (!sessions.length) {
310
289
  return await this.disconnect();
311
290
  }
312
291
  }
@@ -326,6 +305,13 @@ export class AppKit {
326
305
  return RouterController.goBack();
327
306
  }
328
307
 
308
+ const isSIWXRequired = SIWXUtil.getSIWX()?.getRequired?.();
309
+
310
+ if (isSIWXRequired) {
311
+ // Don't close the modal if SIWX is required
312
+ return;
313
+ }
314
+
329
315
  return this.close();
330
316
  }
331
317
 
@@ -396,25 +382,27 @@ export class AppKit {
396
382
  * This attempts to restore previous sessions.
397
383
  */
398
384
  private async initConnectors() {
385
+ ModalController.setLoading(true);
399
386
  const connectedConnectors = await StorageUtil.getConnectedConnectors();
400
387
  if (connectedConnectors.length > 0) {
401
- ModalController.setLoading(true);
402
-
403
388
  for (const connected of connectedConnectors) {
404
389
  try {
405
390
  const connector = await this.createConnector(connected.type);
406
391
 
407
392
  const namespaces = connector.getNamespaces();
408
393
 
409
- await this.processConnection(connector, namespaces, false);
394
+ await this.processConnection(connector, namespaces);
410
395
  } catch (error) {
411
396
  // Use console.warn for non-critical initialization failures
412
397
  console.warn(`Failed to initialize connector type ${connected.type}:`, error);
413
398
  await StorageUtil.removeConnectedConnectors(connected.type);
414
399
  }
415
400
  }
416
- ModalController.setLoading(false);
417
401
  }
402
+
403
+ //Always init the walletconnect connector
404
+ await this.createWalletConnectConnector();
405
+ ModalController.setLoading(false);
418
406
  }
419
407
 
420
408
  private setupAdaptersAndSubscribe(
@@ -603,11 +591,7 @@ export class AppKit {
603
591
  private subscribeToAdapterEvents(adapter: BlockchainAdapter): void {
604
592
  adapter.on('accountsChanged', ({ accounts }) => {
605
593
  const namespace = adapter.getSupportedNamespace();
606
- const hasChanged = ConnectionsController.updateAccounts(namespace, accounts);
607
-
608
- if (hasChanged && namespace === 'eip155') {
609
- this.handleSiweChange({ isAccountChange: true });
610
- }
594
+ ConnectionsController.updateAccounts(namespace, accounts);
611
595
  });
612
596
 
613
597
  adapter.on('chainChanged', async ({ chainId }) => {
@@ -639,10 +623,7 @@ export class AppKit {
639
623
  TransactionsController.fetchTransactions(address, true);
640
624
  }
641
625
 
642
- // Check if user needs to sign in again
643
- if (namespace === 'eip155') {
644
- this.handleSiweChange({ isNetworkChange: true });
645
- }
626
+ SIWXUtil.initializeIfEnabled({ onDisconnect: this.disconnect, caipAddress: address });
646
627
  });
647
628
 
648
629
  adapter.on('disconnect', () => {
@@ -688,9 +669,8 @@ export class AppKit {
688
669
 
689
670
  ConnectionsController.setNetworks(this.networks);
690
671
 
691
- if (options.siweConfig) {
692
- SIWEController.setSIWEClient(options.siweConfig);
693
- OptionsController.setIsSiweEnabled(options.siweConfig.options.enabled);
672
+ if (options.siwx) {
673
+ OptionsController.setSiwx(options.siwx);
694
674
  }
695
675
 
696
676
  if (
@@ -796,45 +776,6 @@ export class AppKit {
796
776
  ModalController.open({ view: routeName });
797
777
  }
798
778
  };
799
-
800
- private async handleSiweChange(params?: {
801
- isConnection?: boolean;
802
- isNetworkChange?: boolean;
803
- isAccountChange?: boolean;
804
- }) {
805
- const { isNetworkChange, isAccountChange, isConnection } = params ?? {};
806
- const { enabled, signOutOnAccountChange, signOutOnNetworkChange } =
807
- SIWEController.state._client?.options ?? {};
808
-
809
- if (!enabled || RouterController.state.view === 'ConnectingSiwe') {
810
- // Do nothing if view is connecting siwe or siwe is not enabled
811
- return;
812
- }
813
-
814
- const session = await SIWEController.getSession();
815
- if (session && isAccountChange) {
816
- if (signOutOnAccountChange) {
817
- // If the address has changed and signOnAccountChange is enabled, sign out
818
- await SIWEController.signOut();
819
-
820
- return this.navigate('ConnectingSiwe');
821
- }
822
- } else if (session && isNetworkChange) {
823
- if (signOutOnNetworkChange) {
824
- // If the network has changed and signOnNetworkChange is enabled, sign out
825
- await SIWEController.signOut();
826
-
827
- return this.navigate('ConnectingSiwe');
828
- }
829
- } else if (!session) {
830
- // If it's connected but there's no session, show sign view
831
-
832
- return this.navigate('ConnectingSiwe');
833
- } else if (isConnection) {
834
- // Already connected with 1CA
835
- ModalController.close();
836
- }
837
- }
838
779
  }
839
780
 
840
781
  export function createAppKit(config: AppKitConfig): AppKit {
@@ -1,5 +1,5 @@
1
1
  import { WcController } from '@reown/appkit-core-react-native';
2
- import { UniversalProvider, type IUniversalProvider } from '@walletconnect/universal-provider';
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 { getDidAddress, getDidChainId, SIWEController } from '@reown/appkit-siwe-react-native';
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 IUniversalProvider;
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<IUniversalProvider> {
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 IUniversalProvider;
99
+ return this.provider as UniversalProvider;
94
100
  }
95
101
 
96
102
  override async connect(opts: ConnectOptions) {
97
- const { siweConfig, namespaces, defaultNetwork, universalLink } = opts;
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 IUniversalProvider;
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: IUniversalProvider['session'];
113
+ let session: UniversalProvider['session'];
108
114
 
109
115
  // SIWE
110
116
  const isEVMOnly = Object.keys(namespaces ?? {}).length === 1 && namespaces?.['eip155'];
111
- const params = await siweConfig?.getMessageParams?.();
112
- if (siweConfig?.options?.enabled && params && Object.keys(params).length > 0 && isEVMOnly) {
117
+
118
+ if (isEVMOnly && SIWXUtil.getSIWX()) {
113
119
  // 1CA is only supported on EVM
114
120
 
115
- // @ts-ignore
116
- const result = await provider.authenticate(
117
- {
118
- ...params,
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 IUniversalProvider).connect({
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 = undefined;
142
+ this.wallet = {
143
+ name: 'Unknown Wallet',
144
+ type: 'walletconnect'
145
+ };
182
146
  }
183
147
 
184
148
  if (defaultNetwork?.caipNetworkId) {
185
- (this.provider as IUniversalProvider).setDefaultChain(defaultNetwork.caipNetworkId);
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 IUniversalProvider)?.session?.namespaces as Namespaces) ?? {};
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 IUniversalProvider).setDefaultChain(caipNetworkId);
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 IUniversalProvider).rpcProviders[
226
+ const chainId = (this.provider as UniversalProvider).rpcProviders[
263
227
  namespace
264
228
  ]?.getDefaultChain?.();
265
229
 
package/src/index.ts CHANGED
@@ -17,6 +17,13 @@ export { AppKit } from './modal/w3m-modal';
17
17
  /********** Types **********/
18
18
  export type * from '@reown/appkit-core-react-native';
19
19
  export type { AppKitNetwork, Storage } from '@reown/appkit-common-react-native';
20
+ export type {
21
+ SIWXConfig,
22
+ SIWXMessage,
23
+ SIWXSession,
24
+ SIWXStorage,
25
+ SIWXVerifier
26
+ } from '@reown/appkit-common-react-native';
20
27
  export type { AppKitConfig } from './types';
21
28
 
22
29
  /****** Hooks *******/
@@ -31,6 +38,9 @@ export { useAppKitState } from './hooks/useAppKitState';
31
38
  export { solana, solanaDevnet, solanaTestnet } from '@reown/appkit-common-react-native';
32
39
  export { bitcoin, bitcoinTestnet } from '@reown/appkit-common-react-native';
33
40
 
41
+ /********** SIWX **********/
42
+ export { ReownAuthentication } from '@reown/appkit-core-react-native';
43
+
34
44
  /********** Main **********/
35
45
  export { createAppKit } from './AppKit';
36
46
  export { AppKitProvider } from './AppKitContext';
@@ -1,5 +1,5 @@
1
1
  import { useSnapshot } from 'valtio';
2
- import { useEffect, useMemo } from 'react';
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 { ConnectingSiweView } from '../../views/w3m-connecting-siwe-view';
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
- UiUtil.setRouteTransition(animateTransition);
50
- }, [animateTransition]);
45
+ // useEffect(() => {
46
+ // UiUtil.setRouteTransition(animateTransition);
47
+ // }, [animateTransition]);
51
48
 
52
- useEffect(() => {
53
- UiUtil.createViewTransition();
54
- }, [view]);
49
+ // useEffect(() => {
50
+ // UiUtil.createViewTransition();
51
+ // }, [view]);
55
52
 
56
53
  const ViewComponent = useMemo(() => {
57
54
  switch (view) {
@@ -67,8 +64,8 @@ export function AppKitRouter() {
67
64
  return ConnectSocialsView;
68
65
  case 'ConnectingExternal':
69
66
  return ConnectingExternalView;
70
- case 'ConnectingSiwe':
71
- return ConnectingSiweView;
67
+ case 'SIWXSignMessage':
68
+ return SIWXSignMessageView;
72
69
  case 'ConnectingSocial':
73
70
  return ConnectingSocialView;
74
71
  case 'WalletConnect':
@@ -119,7 +116,7 @@ export function AppKitRouter() {
119
116
  }, [view]);
120
117
 
121
118
  return (
122
- <Animated.View style={[getAnimatedStyle(), { maxHeight }]}>
119
+ <Animated.View style={{ maxHeight }}>
123
120
  <ViewComponent />
124
121
  </Animated.View>
125
122
  );
@@ -10,9 +10,10 @@ interface WalletItemProps {
10
10
  imageHeaders?: Record<string, string>;
11
11
  onItemPress: (wallet: WcWallet) => void;
12
12
  style?: StyleProp<ViewStyle>;
13
+ testID?: string;
13
14
  }
14
15
 
15
- export function WalletItem({ item, imageHeaders, onItemPress, style }: WalletItemProps) {
16
+ export function WalletItem({ item, imageHeaders, onItemPress, style, testID }: WalletItemProps) {
16
17
  const { walletImages } = useSnapshot(AssetController.state);
17
18
  const isInstalled = ApiController.state.installed.find(wallet => wallet?.id === item?.id);
18
19
  const imageSrc = AssetUtil.getWalletImage(item, walletImages);
@@ -29,6 +30,7 @@ export function WalletItem({ item, imageHeaders, onItemPress, style }: WalletIte
29
30
  name={item?.name ?? 'Unknown'}
30
31
  onPress={() => onItemPress(item)}
31
32
  installed={!!isInstalled}
33
+ testID={testID}
32
34
  />
33
35
  );
34
36
  }
@@ -24,6 +24,7 @@ interface Props {
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();
@@ -61,6 +63,7 @@ export function WalletList({
61
63
  imageHeaders={imageHeaders}
62
64
  onItemPress={onItemPress}
63
65
  style={styles.itemContainer}
66
+ testID={testIDKey ? `${testIDKey}-${item?.id}` : undefined}
64
67
  />
65
68
  );
66
69
  }}
@@ -78,5 +78,5 @@ export function AllWalletsSearch({ searchQuery, onItemPress }: AllWalletsSearchP
78
78
  );
79
79
  }
80
80
 
81
- return <WalletList onItemPress={onItemPress} data={results} />;
81
+ return <WalletList onItemPress={onItemPress} data={results} testIDKey="wallet-search-item" />;
82
82
  }
@@ -32,7 +32,7 @@ export function Header() {
32
32
  Connect: 'Connect wallet',
33
33
  ConnectSocials: 'All socials',
34
34
  ConnectingExternal: walletName ?? 'Connect wallet',
35
- ConnectingSiwe: 'Sign in',
35
+ SIWXSignMessage: 'Sign in',
36
36
  ConnectingSocial: socialName ?? 'Connecting Social',
37
37
  WalletConnect: walletName ?? 'WalletConnect',
38
38
  GetWallet: 'Get a wallet',
@@ -58,8 +58,8 @@ export function Header() {
58
58
  }[_view];
59
59
  };
60
60
 
61
- const noCloseViews = ['OnRampSettings', 'ConnectingSiwe'];
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
  /**
@@ -154,13 +154,11 @@ export interface AppKitConfig {
154
154
  themeVariables?: ThemeVariables;
155
155
 
156
156
  /**
157
- * Optional SIWE (Sign-In with Ethereum) configuration.
158
- * Enables authentication flow using Ethereum signatures.
159
- * Must implement the AppKitSIWEClient interface.
160
- *
161
- * @see {@link https://docs.reown.com/appkit/react-native/core/siwe | SIWE Documentation}
157
+ * @experimental - This feature is not production ready.
158
+ * Enable Sign In With X (SIWX) feature.
159
+ * @default undefined
162
160
  */
163
- siweConfig?: AppKitSIWEClient;
161
+ siwx?: SIWXConfig;
164
162
 
165
163
  /**
166
164
  * Optional default network to use when no specific network is selected.