@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.
Files changed (247) hide show
  1. package/lib/commonjs/AppKit.js +133 -88
  2. package/lib/commonjs/AppKit.js.map +1 -1
  3. package/lib/commonjs/AppKitContext.js +16 -10
  4. package/lib/commonjs/AppKitContext.js.map +1 -1
  5. package/lib/commonjs/connectors/WalletConnectConnector.js +24 -57
  6. package/lib/commonjs/connectors/WalletConnectConnector.js.map +1 -1
  7. package/lib/commonjs/hooks/useAccount.js +4 -3
  8. package/lib/commonjs/hooks/useAccount.js.map +1 -1
  9. package/lib/commonjs/hooks/useAppKit.js +12 -12
  10. package/lib/commonjs/hooks/useAppKit.js.map +1 -1
  11. package/lib/commonjs/hooks/useAppKitLogs.js +88 -0
  12. package/lib/commonjs/hooks/useAppKitLogs.js.map +1 -0
  13. package/lib/commonjs/hooks/useAppKitState.js +32 -0
  14. package/lib/commonjs/hooks/useAppKitState.js.map +1 -0
  15. package/lib/commonjs/hooks/useProvider.js +14 -8
  16. package/lib/commonjs/hooks/useProvider.js.map +1 -1
  17. package/lib/commonjs/hooks/useWalletInfo.js +6 -4
  18. package/lib/commonjs/hooks/useWalletInfo.js.map +1 -1
  19. package/lib/commonjs/index.js +22 -0
  20. package/lib/commonjs/index.js.map +1 -1
  21. package/lib/commonjs/modal/w3m-modal/index.js +9 -1
  22. package/lib/commonjs/modal/w3m-modal/index.js.map +1 -1
  23. package/lib/commonjs/modal/w3m-router/index.js +19 -21
  24. package/lib/commonjs/modal/w3m-router/index.js.map +1 -1
  25. package/lib/commonjs/partials/w3m-account-wallet-features/index.js +1 -1
  26. package/lib/commonjs/partials/w3m-account-wallet-features/index.js.map +1 -1
  27. package/lib/commonjs/partials/w3m-all-wallets-list/components/WalletItem.js +6 -3
  28. package/lib/commonjs/partials/w3m-all-wallets-list/components/WalletItem.js.map +1 -1
  29. package/lib/commonjs/partials/w3m-all-wallets-list/components/WalletList.js +9 -2
  30. package/lib/commonjs/partials/w3m-all-wallets-list/components/WalletList.js.map +1 -1
  31. package/lib/commonjs/partials/w3m-all-wallets-list/index.js +1 -0
  32. package/lib/commonjs/partials/w3m-all-wallets-list/index.js.map +1 -1
  33. package/lib/commonjs/partials/w3m-all-wallets-search/index.js +3 -1
  34. package/lib/commonjs/partials/w3m-all-wallets-search/index.js.map +1 -1
  35. package/lib/commonjs/partials/w3m-connecting-mobile/index.js +21 -1
  36. package/lib/commonjs/partials/w3m-connecting-mobile/index.js.map +1 -1
  37. package/lib/commonjs/partials/w3m-connecting-qrcode/index.js +5 -1
  38. package/lib/commonjs/partials/w3m-connecting-qrcode/index.js.map +1 -1
  39. package/lib/commonjs/partials/w3m-connecting-web/index.js +8 -2
  40. package/lib/commonjs/partials/w3m-connecting-web/index.js.map +1 -1
  41. package/lib/commonjs/partials/w3m-header/index.js +4 -4
  42. package/lib/commonjs/partials/w3m-header/index.js.map +1 -1
  43. package/lib/commonjs/utils/SIWXUtil.js +278 -0
  44. package/lib/commonjs/utils/SIWXUtil.js.map +1 -0
  45. package/lib/commonjs/views/w3m-account-default-view/index.js +3 -2
  46. package/lib/commonjs/views/w3m-account-default-view/index.js.map +1 -1
  47. package/lib/commonjs/views/w3m-all-wallets-view/index.js +7 -4
  48. package/lib/commonjs/views/w3m-all-wallets-view/index.js.map +1 -1
  49. package/lib/commonjs/views/w3m-connect-view/components/all-wallet-list.js +5 -3
  50. package/lib/commonjs/views/w3m-connect-view/components/all-wallet-list.js.map +1 -1
  51. package/lib/commonjs/views/w3m-connect-view/index.js +6 -3
  52. package/lib/commonjs/views/w3m-connect-view/index.js.map +1 -1
  53. package/lib/commonjs/views/w3m-connecting-external-view/index.js +21 -1
  54. package/lib/commonjs/views/w3m-connecting-external-view/index.js.map +1 -1
  55. package/lib/commonjs/views/w3m-connecting-social-view/index.js +1 -0
  56. package/lib/commonjs/views/w3m-connecting-social-view/index.js.map +1 -1
  57. package/lib/commonjs/views/w3m-connecting-view/index.js +12 -31
  58. package/lib/commonjs/views/w3m-connecting-view/index.js.map +1 -1
  59. package/lib/commonjs/views/w3m-network-switch-view/index.js +1 -0
  60. package/lib/commonjs/views/w3m-network-switch-view/index.js.map +1 -1
  61. package/lib/commonjs/views/w3m-onramp-settings-view/components/Country.js +3 -1
  62. package/lib/commonjs/views/w3m-onramp-settings-view/components/Country.js.map +1 -1
  63. package/lib/commonjs/views/w3m-onramp-settings-view/index.js +2 -1
  64. package/lib/commonjs/views/w3m-onramp-settings-view/index.js.map +1 -1
  65. package/lib/commonjs/views/w3m-onramp-view/components/LoadingView.js +1 -1
  66. package/lib/commonjs/views/w3m-onramp-view/components/LoadingView.js.map +1 -1
  67. package/lib/commonjs/views/{w3m-connecting-siwe-view → w3m-siwx-sign-view}/index.js +7 -43
  68. package/lib/commonjs/views/w3m-siwx-sign-view/index.js.map +1 -0
  69. package/lib/commonjs/views/w3m-siwx-sign-view/styles.js.map +1 -0
  70. package/lib/commonjs/views/w3m-swap-view/index.js +1 -1
  71. package/lib/commonjs/views/w3m-swap-view/index.js.map +1 -1
  72. package/lib/commonjs/views/w3m-what-is-a-wallet-view/index.js +1 -1
  73. package/lib/commonjs/views/w3m-what-is-a-wallet-view/index.js.map +1 -1
  74. package/lib/module/AppKit.js +133 -88
  75. package/lib/module/AppKit.js.map +1 -1
  76. package/lib/module/AppKitContext.js +17 -11
  77. package/lib/module/AppKitContext.js.map +1 -1
  78. package/lib/module/connectors/WalletConnectConnector.js +22 -56
  79. package/lib/module/connectors/WalletConnectConnector.js.map +1 -1
  80. package/lib/module/hooks/useAccount.js +3 -3
  81. package/lib/module/hooks/useAccount.js.map +1 -1
  82. package/lib/module/hooks/useAppKit.js +13 -13
  83. package/lib/module/hooks/useAppKit.js.map +1 -1
  84. package/lib/module/hooks/useAppKitLogs.js +83 -0
  85. package/lib/module/hooks/useAppKitLogs.js.map +1 -0
  86. package/lib/module/hooks/useAppKitState.js +27 -0
  87. package/lib/module/hooks/useAppKitState.js.map +1 -0
  88. package/lib/module/hooks/useProvider.js +13 -8
  89. package/lib/module/hooks/useProvider.js.map +1 -1
  90. package/lib/module/hooks/useWalletInfo.js +6 -4
  91. package/lib/module/hooks/useWalletInfo.js.map +1 -1
  92. package/lib/module/index.js +7 -0
  93. package/lib/module/index.js.map +1 -1
  94. package/lib/module/modal/w3m-modal/index.js +9 -1
  95. package/lib/module/modal/w3m-modal/index.js.map +1 -1
  96. package/lib/module/modal/w3m-router/index.js +20 -22
  97. package/lib/module/modal/w3m-router/index.js.map +1 -1
  98. package/lib/module/partials/w3m-account-wallet-features/index.js +1 -1
  99. package/lib/module/partials/w3m-account-wallet-features/index.js.map +1 -1
  100. package/lib/module/partials/w3m-all-wallets-list/components/WalletItem.js +6 -3
  101. package/lib/module/partials/w3m-all-wallets-list/components/WalletItem.js.map +1 -1
  102. package/lib/module/partials/w3m-all-wallets-list/components/WalletList.js +9 -2
  103. package/lib/module/partials/w3m-all-wallets-list/components/WalletList.js.map +1 -1
  104. package/lib/module/partials/w3m-all-wallets-list/index.js +2 -1
  105. package/lib/module/partials/w3m-all-wallets-list/index.js.map +1 -1
  106. package/lib/module/partials/w3m-all-wallets-search/index.js +4 -2
  107. package/lib/module/partials/w3m-all-wallets-search/index.js.map +1 -1
  108. package/lib/module/partials/w3m-connecting-mobile/index.js +22 -2
  109. package/lib/module/partials/w3m-connecting-mobile/index.js.map +1 -1
  110. package/lib/module/partials/w3m-connecting-qrcode/index.js +6 -2
  111. package/lib/module/partials/w3m-connecting-qrcode/index.js.map +1 -1
  112. package/lib/module/partials/w3m-connecting-web/index.js +9 -3
  113. package/lib/module/partials/w3m-connecting-web/index.js.map +1 -1
  114. package/lib/module/partials/w3m-header/index.js +4 -4
  115. package/lib/module/partials/w3m-header/index.js.map +1 -1
  116. package/lib/module/utils/SIWXUtil.js +275 -0
  117. package/lib/module/utils/SIWXUtil.js.map +1 -0
  118. package/lib/module/views/w3m-account-default-view/index.js +4 -3
  119. package/lib/module/views/w3m-account-default-view/index.js.map +1 -1
  120. package/lib/module/views/w3m-all-wallets-view/index.js +7 -4
  121. package/lib/module/views/w3m-all-wallets-view/index.js.map +1 -1
  122. package/lib/module/views/w3m-connect-view/components/all-wallet-list.js +5 -3
  123. package/lib/module/views/w3m-connect-view/components/all-wallet-list.js.map +1 -1
  124. package/lib/module/views/w3m-connect-view/index.js +6 -3
  125. package/lib/module/views/w3m-connect-view/index.js.map +1 -1
  126. package/lib/module/views/w3m-connecting-external-view/index.js +22 -2
  127. package/lib/module/views/w3m-connecting-external-view/index.js.map +1 -1
  128. package/lib/module/views/w3m-connecting-social-view/index.js +2 -1
  129. package/lib/module/views/w3m-connecting-social-view/index.js.map +1 -1
  130. package/lib/module/views/w3m-connecting-view/index.js +14 -33
  131. package/lib/module/views/w3m-connecting-view/index.js.map +1 -1
  132. package/lib/module/views/w3m-network-switch-view/index.js +2 -1
  133. package/lib/module/views/w3m-network-switch-view/index.js.map +1 -1
  134. package/lib/module/views/w3m-onramp-settings-view/components/Country.js +3 -1
  135. package/lib/module/views/w3m-onramp-settings-view/components/Country.js.map +1 -1
  136. package/lib/module/views/w3m-onramp-settings-view/index.js +2 -1
  137. package/lib/module/views/w3m-onramp-settings-view/index.js.map +1 -1
  138. package/lib/module/views/w3m-onramp-view/components/LoadingView.js +1 -1
  139. package/lib/module/views/w3m-onramp-view/components/LoadingView.js.map +1 -1
  140. package/lib/module/views/{w3m-connecting-siwe-view → w3m-siwx-sign-view}/index.js +7 -43
  141. package/lib/module/views/w3m-siwx-sign-view/index.js.map +1 -0
  142. package/lib/module/views/w3m-siwx-sign-view/styles.js.map +1 -0
  143. package/lib/module/views/w3m-swap-view/index.js +1 -1
  144. package/lib/module/views/w3m-swap-view/index.js.map +1 -1
  145. package/lib/module/views/w3m-what-is-a-wallet-view/index.js +1 -1
  146. package/lib/module/views/w3m-what-is-a-wallet-view/index.js.map +1 -1
  147. package/lib/typescript/AppKit.d.ts +12 -3
  148. package/lib/typescript/AppKit.d.ts.map +1 -1
  149. package/lib/typescript/AppKitContext.d.ts +1 -1
  150. package/lib/typescript/AppKitContext.d.ts.map +1 -1
  151. package/lib/typescript/connectors/WalletConnectConnector.d.ts.map +1 -1
  152. package/lib/typescript/hooks/useAccount.d.ts +1 -1
  153. package/lib/typescript/hooks/useAccount.d.ts.map +1 -1
  154. package/lib/typescript/hooks/useAppKit.d.ts +2 -2
  155. package/lib/typescript/hooks/useAppKit.d.ts.map +1 -1
  156. package/lib/typescript/hooks/useAppKitEvents.d.ts +75 -21
  157. package/lib/typescript/hooks/useAppKitEvents.d.ts.map +1 -1
  158. package/lib/typescript/hooks/useAppKitLogs.d.ts +57 -0
  159. package/lib/typescript/hooks/useAppKitLogs.d.ts.map +1 -0
  160. package/lib/typescript/hooks/useAppKitState.d.ts +38 -0
  161. package/lib/typescript/hooks/useAppKitState.d.ts.map +1 -0
  162. package/lib/typescript/hooks/useProvider.d.ts.map +1 -1
  163. package/lib/typescript/hooks/useWalletInfo.d.ts +1 -0
  164. package/lib/typescript/hooks/useWalletInfo.d.ts.map +1 -1
  165. package/lib/typescript/index.d.ts +6 -0
  166. package/lib/typescript/index.d.ts.map +1 -1
  167. package/lib/typescript/modal/w3m-modal/index.d.ts.map +1 -1
  168. package/lib/typescript/modal/w3m-router/index.d.ts.map +1 -1
  169. package/lib/typescript/partials/w3m-all-wallets-list/components/WalletItem.d.ts +4 -2
  170. package/lib/typescript/partials/w3m-all-wallets-list/components/WalletItem.d.ts.map +1 -1
  171. package/lib/typescript/partials/w3m-all-wallets-list/components/WalletList.d.ts +3 -2
  172. package/lib/typescript/partials/w3m-all-wallets-list/components/WalletList.d.ts.map +1 -1
  173. package/lib/typescript/partials/w3m-all-wallets-list/index.d.ts +1 -1
  174. package/lib/typescript/partials/w3m-all-wallets-list/index.d.ts.map +1 -1
  175. package/lib/typescript/partials/w3m-all-wallets-search/index.d.ts +1 -1
  176. package/lib/typescript/partials/w3m-all-wallets-search/index.d.ts.map +1 -1
  177. package/lib/typescript/partials/w3m-connecting-mobile/index.d.ts.map +1 -1
  178. package/lib/typescript/partials/w3m-connecting-qrcode/index.d.ts.map +1 -1
  179. package/lib/typescript/partials/w3m-connecting-web/index.d.ts.map +1 -1
  180. package/lib/typescript/types.d.ts +6 -7
  181. package/lib/typescript/types.d.ts.map +1 -1
  182. package/lib/typescript/utils/SIWXUtil.d.ts +34 -0
  183. package/lib/typescript/utils/SIWXUtil.d.ts.map +1 -0
  184. package/lib/typescript/views/w3m-account-default-view/index.d.ts.map +1 -1
  185. package/lib/typescript/views/w3m-all-wallets-view/index.d.ts.map +1 -1
  186. package/lib/typescript/views/w3m-connect-view/components/all-wallet-list.d.ts +1 -1
  187. package/lib/typescript/views/w3m-connect-view/components/all-wallet-list.d.ts.map +1 -1
  188. package/lib/typescript/views/w3m-connect-view/index.d.ts.map +1 -1
  189. package/lib/typescript/views/w3m-connecting-external-view/index.d.ts.map +1 -1
  190. package/lib/typescript/views/w3m-connecting-social-view/index.d.ts.map +1 -1
  191. package/lib/typescript/views/w3m-connecting-view/index.d.ts.map +1 -1
  192. package/lib/typescript/views/w3m-network-switch-view/index.d.ts.map +1 -1
  193. package/lib/typescript/views/w3m-onramp-settings-view/components/Country.d.ts +2 -1
  194. package/lib/typescript/views/w3m-onramp-settings-view/components/Country.d.ts.map +1 -1
  195. package/lib/typescript/views/w3m-onramp-settings-view/index.d.ts.map +1 -1
  196. package/lib/typescript/views/w3m-siwx-sign-view/index.d.ts +2 -0
  197. package/lib/typescript/views/w3m-siwx-sign-view/index.d.ts.map +1 -0
  198. package/lib/typescript/views/w3m-siwx-sign-view/styles.d.ts.map +1 -0
  199. package/package.json +9 -9
  200. package/src/AppKit.ts +145 -96
  201. package/src/AppKitContext.tsx +19 -11
  202. package/src/connectors/WalletConnectConnector.ts +33 -69
  203. package/src/hooks/useAccount.ts +9 -4
  204. package/src/hooks/useAppKit.ts +19 -13
  205. package/src/hooks/useAppKitLogs.ts +129 -0
  206. package/src/hooks/useAppKitState.ts +26 -0
  207. package/src/hooks/useProvider.ts +11 -5
  208. package/src/hooks/useWalletInfo.ts +5 -2
  209. package/src/index.ts +14 -0
  210. package/src/modal/w3m-modal/index.tsx +9 -1
  211. package/src/modal/w3m-router/index.tsx +15 -18
  212. package/src/partials/w3m-account-wallet-features/index.tsx +1 -1
  213. package/src/partials/w3m-all-wallets-list/components/WalletItem.tsx +13 -3
  214. package/src/partials/w3m-all-wallets-list/components/WalletList.tsx +9 -2
  215. package/src/partials/w3m-all-wallets-list/index.tsx +3 -1
  216. package/src/partials/w3m-all-wallets-search/index.tsx +9 -3
  217. package/src/partials/w3m-connecting-mobile/index.tsx +24 -2
  218. package/src/partials/w3m-connecting-qrcode/index.tsx +8 -2
  219. package/src/partials/w3m-connecting-web/index.tsx +11 -3
  220. package/src/partials/w3m-header/index.tsx +4 -4
  221. package/src/types.ts +7 -8
  222. package/src/utils/SIWXUtil.ts +359 -0
  223. package/src/views/w3m-account-default-view/index.tsx +5 -3
  224. package/src/views/w3m-all-wallets-view/index.tsx +11 -4
  225. package/src/views/w3m-connect-view/components/all-wallet-list.tsx +6 -4
  226. package/src/views/w3m-connect-view/index.tsx +6 -3
  227. package/src/views/w3m-connecting-external-view/index.tsx +24 -2
  228. package/src/views/w3m-connecting-social-view/index.tsx +3 -1
  229. package/src/views/w3m-connecting-view/index.tsx +16 -33
  230. package/src/views/w3m-network-switch-view/index.tsx +2 -0
  231. package/src/views/w3m-onramp-settings-view/components/Country.tsx +3 -1
  232. package/src/views/w3m-onramp-settings-view/index.tsx +1 -0
  233. package/src/views/w3m-onramp-view/components/LoadingView.tsx +1 -1
  234. package/src/views/{w3m-connecting-siwe-view → w3m-siwx-sign-view}/index.tsx +7 -37
  235. package/src/views/w3m-swap-view/index.tsx +1 -1
  236. package/src/views/w3m-what-is-a-wallet-view/index.tsx +1 -1
  237. package/lib/commonjs/views/w3m-connecting-siwe-view/index.js.map +0 -1
  238. package/lib/commonjs/views/w3m-connecting-siwe-view/styles.js.map +0 -1
  239. package/lib/module/views/w3m-connecting-siwe-view/index.js.map +0 -1
  240. package/lib/module/views/w3m-connecting-siwe-view/styles.js.map +0 -1
  241. package/lib/typescript/views/w3m-connecting-siwe-view/index.d.ts +0 -2
  242. package/lib/typescript/views/w3m-connecting-siwe-view/index.d.ts.map +0 -1
  243. package/lib/typescript/views/w3m-connecting-siwe-view/styles.d.ts.map +0 -1
  244. /package/lib/commonjs/views/{w3m-connecting-siwe-view → w3m-siwx-sign-view}/styles.js +0 -0
  245. /package/lib/module/views/{w3m-connecting-siwe-view → w3m-siwx-sign-view}/styles.js +0 -0
  246. /package/lib/typescript/views/{w3m-connecting-siwe-view → w3m-siwx-sign-view}/styles.d.ts +0 -0
  247. /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 { 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
 
@@ -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 = connection?.caipNetwork
16
- ? // eslint-disable-next-line valtio/state-snapshot-rule
17
- networks.find(network => network.caipNetworkId === connection?.caipNetwork)
18
- : undefined;
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),
@@ -1,6 +1,5 @@
1
- import { useContext } from 'react';
2
- import { useSnapshot } from 'valtio';
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?: string) => void;
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
- return {
29
- open: context.appKit.open.bind(context.appKit),
30
- close: context.appKit.close.bind(context.appKit),
31
- disconnect: (namespace?: string) => context.appKit?.disconnect.bind(context.appKit)(namespace),
32
- switchNetwork: context.appKit.switchNetwork.bind(context.appKit),
33
- isOpen: open
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
+ }
@@ -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
- if (!connection) return { provider: undefined, providerType: undefined };
42
+ const returnValue = useMemo(() => {
43
+ if (!connection) return { provider: undefined, providerType: undefined };
41
44
 
42
- return {
43
- provider: connection.adapter.getProvider(),
44
- providerType: connection.adapter.getSupportedNamespace()
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
- return { walletInfo };
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 { useEffect, useLayoutEffect, 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
- useLayoutEffect(() => {
53
- UiUtil.createViewTransition();
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 'ConnectingSiwe':
71
- return ConnectingSiweView;
67
+ case 'SIWXSignMessage':
68
+ return SIWXSignMessageView;
72
69
  case 'ConnectingSocial':
73
70
  return ConnectingSocialView;
74
- case 'ConnectingWalletConnect':
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={[getAnimatedStyle(), { maxHeight }]}>
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({ item, imageHeaders, onItemPress, style }: WalletItemProps) {
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
  }