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

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 (164) hide show
  1. package/lib/commonjs/AppKit.js +107 -15
  2. package/lib/commonjs/AppKit.js.map +1 -1
  3. package/lib/commonjs/hooks/useAppKit.js.map +1 -1
  4. package/lib/commonjs/hooks/useAppKitLogs.js +88 -0
  5. package/lib/commonjs/hooks/useAppKitLogs.js.map +1 -0
  6. package/lib/commonjs/hooks/useProvider.js +20 -8
  7. package/lib/commonjs/hooks/useProvider.js.map +1 -1
  8. package/lib/commonjs/index.js +8 -0
  9. package/lib/commonjs/index.js.map +1 -1
  10. package/lib/commonjs/partials/w3m-account-wallet-features/index.js +1 -1
  11. package/lib/commonjs/partials/w3m-account-wallet-features/index.js.map +1 -1
  12. package/lib/commonjs/partials/w3m-all-wallets-list/components/WalletItem.js +2 -1
  13. package/lib/commonjs/partials/w3m-all-wallets-list/components/WalletItem.js.map +1 -1
  14. package/lib/commonjs/partials/w3m-all-wallets-list/components/WalletList.js +62 -23
  15. package/lib/commonjs/partials/w3m-all-wallets-list/components/WalletList.js.map +1 -1
  16. package/lib/commonjs/partials/w3m-all-wallets-list/index.js +2 -1
  17. package/lib/commonjs/partials/w3m-all-wallets-list/index.js.map +1 -1
  18. package/lib/commonjs/partials/w3m-all-wallets-search/index.js +2 -0
  19. package/lib/commonjs/partials/w3m-all-wallets-search/index.js.map +1 -1
  20. package/lib/commonjs/partials/w3m-connecting-mobile/index.js +21 -1
  21. package/lib/commonjs/partials/w3m-connecting-mobile/index.js.map +1 -1
  22. package/lib/commonjs/partials/w3m-connecting-qrcode/index.js +5 -1
  23. package/lib/commonjs/partials/w3m-connecting-qrcode/index.js.map +1 -1
  24. package/lib/commonjs/partials/w3m-connecting-web/index.js +8 -2
  25. package/lib/commonjs/partials/w3m-connecting-web/index.js.map +1 -1
  26. package/lib/commonjs/utils/SIWXUtil.js +4 -8
  27. package/lib/commonjs/utils/SIWXUtil.js.map +1 -1
  28. package/lib/commonjs/views/w3m-account-default-view/index.js +3 -2
  29. package/lib/commonjs/views/w3m-account-default-view/index.js.map +1 -1
  30. package/lib/commonjs/views/w3m-all-wallets-view/index.js +5 -2
  31. package/lib/commonjs/views/w3m-all-wallets-view/index.js.map +1 -1
  32. package/lib/commonjs/views/w3m-connect-view/components/all-wallet-list.js +33 -6
  33. package/lib/commonjs/views/w3m-connect-view/components/all-wallet-list.js.map +1 -1
  34. package/lib/commonjs/views/w3m-connect-view/index.js +5 -2
  35. package/lib/commonjs/views/w3m-connect-view/index.js.map +1 -1
  36. package/lib/commonjs/views/w3m-connecting-external-view/index.js +21 -1
  37. package/lib/commonjs/views/w3m-connecting-external-view/index.js.map +1 -1
  38. package/lib/commonjs/views/w3m-connecting-social-view/index.js +1 -0
  39. package/lib/commonjs/views/w3m-connecting-social-view/index.js.map +1 -1
  40. package/lib/commonjs/views/w3m-connecting-view/index.js +1 -0
  41. package/lib/commonjs/views/w3m-connecting-view/index.js.map +1 -1
  42. package/lib/commonjs/views/w3m-network-switch-view/index.js +1 -0
  43. package/lib/commonjs/views/w3m-network-switch-view/index.js.map +1 -1
  44. package/lib/commonjs/views/w3m-siwx-sign-view/index.js +1 -0
  45. package/lib/commonjs/views/w3m-siwx-sign-view/index.js.map +1 -1
  46. package/lib/commonjs/views/w3m-swap-view/index.js +1 -1
  47. package/lib/commonjs/views/w3m-swap-view/index.js.map +1 -1
  48. package/lib/commonjs/views/w3m-what-is-a-wallet-view/index.js +1 -1
  49. package/lib/commonjs/views/w3m-what-is-a-wallet-view/index.js.map +1 -1
  50. package/lib/module/AppKit.js +108 -16
  51. package/lib/module/AppKit.js.map +1 -1
  52. package/lib/module/hooks/useAppKit.js.map +1 -1
  53. package/lib/module/hooks/useAppKitLogs.js +83 -0
  54. package/lib/module/hooks/useAppKitLogs.js.map +1 -0
  55. package/lib/module/hooks/useProvider.js +21 -9
  56. package/lib/module/hooks/useProvider.js.map +1 -1
  57. package/lib/module/index.js +3 -0
  58. package/lib/module/index.js.map +1 -1
  59. package/lib/module/partials/w3m-account-wallet-features/index.js +1 -1
  60. package/lib/module/partials/w3m-account-wallet-features/index.js.map +1 -1
  61. package/lib/module/partials/w3m-all-wallets-list/components/WalletItem.js +2 -1
  62. package/lib/module/partials/w3m-all-wallets-list/components/WalletItem.js.map +1 -1
  63. package/lib/module/partials/w3m-all-wallets-list/components/WalletList.js +63 -24
  64. package/lib/module/partials/w3m-all-wallets-list/components/WalletList.js.map +1 -1
  65. package/lib/module/partials/w3m-all-wallets-list/index.js +3 -2
  66. package/lib/module/partials/w3m-all-wallets-list/index.js.map +1 -1
  67. package/lib/module/partials/w3m-all-wallets-search/index.js +3 -1
  68. package/lib/module/partials/w3m-all-wallets-search/index.js.map +1 -1
  69. package/lib/module/partials/w3m-connecting-mobile/index.js +22 -2
  70. package/lib/module/partials/w3m-connecting-mobile/index.js.map +1 -1
  71. package/lib/module/partials/w3m-connecting-qrcode/index.js +6 -2
  72. package/lib/module/partials/w3m-connecting-qrcode/index.js.map +1 -1
  73. package/lib/module/partials/w3m-connecting-web/index.js +9 -3
  74. package/lib/module/partials/w3m-connecting-web/index.js.map +1 -1
  75. package/lib/module/utils/SIWXUtil.js +5 -9
  76. package/lib/module/utils/SIWXUtil.js.map +1 -1
  77. package/lib/module/views/w3m-account-default-view/index.js +4 -3
  78. package/lib/module/views/w3m-account-default-view/index.js.map +1 -1
  79. package/lib/module/views/w3m-all-wallets-view/index.js +5 -2
  80. package/lib/module/views/w3m-all-wallets-view/index.js.map +1 -1
  81. package/lib/module/views/w3m-connect-view/components/all-wallet-list.js +34 -7
  82. package/lib/module/views/w3m-connect-view/components/all-wallet-list.js.map +1 -1
  83. package/lib/module/views/w3m-connect-view/index.js +5 -2
  84. package/lib/module/views/w3m-connect-view/index.js.map +1 -1
  85. package/lib/module/views/w3m-connecting-external-view/index.js +22 -2
  86. package/lib/module/views/w3m-connecting-external-view/index.js.map +1 -1
  87. package/lib/module/views/w3m-connecting-social-view/index.js +2 -1
  88. package/lib/module/views/w3m-connecting-social-view/index.js.map +1 -1
  89. package/lib/module/views/w3m-connecting-view/index.js +2 -1
  90. package/lib/module/views/w3m-connecting-view/index.js.map +1 -1
  91. package/lib/module/views/w3m-network-switch-view/index.js +2 -1
  92. package/lib/module/views/w3m-network-switch-view/index.js.map +1 -1
  93. package/lib/module/views/w3m-siwx-sign-view/index.js +2 -1
  94. package/lib/module/views/w3m-siwx-sign-view/index.js.map +1 -1
  95. package/lib/module/views/w3m-swap-view/index.js +1 -1
  96. package/lib/module/views/w3m-swap-view/index.js.map +1 -1
  97. package/lib/module/views/w3m-what-is-a-wallet-view/index.js +1 -1
  98. package/lib/module/views/w3m-what-is-a-wallet-view/index.js.map +1 -1
  99. package/lib/typescript/AppKit.d.ts +13 -2
  100. package/lib/typescript/AppKit.d.ts.map +1 -1
  101. package/lib/typescript/AppKitContext.d.ts +1 -1
  102. package/lib/typescript/hooks/useAccount.d.ts +1 -1
  103. package/lib/typescript/hooks/useAppKit.d.ts +2 -1
  104. package/lib/typescript/hooks/useAppKit.d.ts.map +1 -1
  105. package/lib/typescript/hooks/useAppKitEvents.d.ts +82 -17
  106. package/lib/typescript/hooks/useAppKitEvents.d.ts.map +1 -1
  107. package/lib/typescript/hooks/useAppKitLogs.d.ts +57 -0
  108. package/lib/typescript/hooks/useAppKitLogs.d.ts.map +1 -0
  109. package/lib/typescript/hooks/useAppKitState.d.ts +1 -1
  110. package/lib/typescript/hooks/useProvider.d.ts.map +1 -1
  111. package/lib/typescript/index.d.ts +2 -0
  112. package/lib/typescript/index.d.ts.map +1 -1
  113. package/lib/typescript/partials/w3m-all-wallets-list/components/WalletItem.d.ts +3 -2
  114. package/lib/typescript/partials/w3m-all-wallets-list/components/WalletItem.d.ts.map +1 -1
  115. package/lib/typescript/partials/w3m-all-wallets-list/components/WalletList.d.ts +3 -2
  116. package/lib/typescript/partials/w3m-all-wallets-list/components/WalletList.d.ts.map +1 -1
  117. package/lib/typescript/partials/w3m-all-wallets-list/index.d.ts +1 -1
  118. package/lib/typescript/partials/w3m-all-wallets-list/index.d.ts.map +1 -1
  119. package/lib/typescript/partials/w3m-all-wallets-search/index.d.ts +1 -1
  120. package/lib/typescript/partials/w3m-all-wallets-search/index.d.ts.map +1 -1
  121. package/lib/typescript/partials/w3m-connecting-mobile/index.d.ts.map +1 -1
  122. package/lib/typescript/partials/w3m-connecting-qrcode/index.d.ts.map +1 -1
  123. package/lib/typescript/partials/w3m-connecting-web/index.d.ts.map +1 -1
  124. package/lib/typescript/types.d.ts +1 -0
  125. package/lib/typescript/types.d.ts.map +1 -1
  126. package/lib/typescript/utils/SIWXUtil.d.ts +1 -1
  127. package/lib/typescript/utils/SIWXUtil.d.ts.map +1 -1
  128. package/lib/typescript/views/w3m-account-default-view/index.d.ts.map +1 -1
  129. package/lib/typescript/views/w3m-all-wallets-view/index.d.ts.map +1 -1
  130. package/lib/typescript/views/w3m-connect-view/components/all-wallet-list.d.ts +1 -1
  131. package/lib/typescript/views/w3m-connect-view/components/all-wallet-list.d.ts.map +1 -1
  132. package/lib/typescript/views/w3m-connect-view/index.d.ts.map +1 -1
  133. package/lib/typescript/views/w3m-connecting-external-view/index.d.ts.map +1 -1
  134. package/lib/typescript/views/w3m-connecting-social-view/index.d.ts.map +1 -1
  135. package/lib/typescript/views/w3m-connecting-view/index.d.ts.map +1 -1
  136. package/lib/typescript/views/w3m-network-switch-view/index.d.ts.map +1 -1
  137. package/lib/typescript/views/w3m-siwx-sign-view/index.d.ts.map +1 -1
  138. package/package.json +5 -5
  139. package/src/AppKit.ts +125 -15
  140. package/src/hooks/useAppKit.ts +3 -2
  141. package/src/hooks/useAppKitLogs.ts +129 -0
  142. package/src/hooks/useProvider.ts +15 -6
  143. package/src/index.ts +3 -0
  144. package/src/partials/w3m-account-wallet-features/index.tsx +1 -1
  145. package/src/partials/w3m-all-wallets-list/components/WalletItem.tsx +11 -3
  146. package/src/partials/w3m-all-wallets-list/components/WalletList.tsx +74 -25
  147. package/src/partials/w3m-all-wallets-list/index.tsx +4 -2
  148. package/src/partials/w3m-all-wallets-search/index.tsx +16 -3
  149. package/src/partials/w3m-connecting-mobile/index.tsx +24 -2
  150. package/src/partials/w3m-connecting-qrcode/index.tsx +8 -2
  151. package/src/partials/w3m-connecting-web/index.tsx +11 -3
  152. package/src/types.ts +1 -0
  153. package/src/utils/SIWXUtil.ts +6 -11
  154. package/src/views/w3m-account-default-view/index.tsx +5 -3
  155. package/src/views/w3m-all-wallets-view/index.tsx +9 -2
  156. package/src/views/w3m-connect-view/components/all-wallet-list.tsx +46 -15
  157. package/src/views/w3m-connect-view/index.tsx +5 -2
  158. package/src/views/w3m-connecting-external-view/index.tsx +24 -2
  159. package/src/views/w3m-connecting-social-view/index.tsx +3 -1
  160. package/src/views/w3m-connecting-view/index.tsx +3 -1
  161. package/src/views/w3m-network-switch-view/index.tsx +2 -0
  162. package/src/views/w3m-siwx-sign-view/index.tsx +2 -0
  163. package/src/views/w3m-swap-view/index.tsx +1 -1
  164. package/src/views/w3m-what-is-a-wallet-view/index.tsx +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"SIWXUtil.d.ts","sourceRoot":"","sources":["../../../src/utils/SIWXUtil.ts"],"names":[],"mappings":"AAAA,OAAO,iBAAiB,MAAM,mCAAmC,CAAC;AAElE,OAAO,EACL,KAAK,aAAa,EAElB,KAAK,WAAW,EACjB,MAAM,mCAAmC,CAAC;AAa3C;;GAEG;AAEH,eAAO,MAAM,QAAQ;;;sBAUH,MAAM,QAAQ,IAAI,CAAC;;;;;oCAyIG,MAAM,QAAQ,IAAI,CAAC;;uBAsChC;QAAE,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,aAAa,CAAC,EAAE,aAAa,CAAA;KAAE;;;2BAwCvD,iBAAiB;gBAC5B,aAAa,EAAE;iBACd,MAAM,EAAE;;;mCAmGY,OAAO;;;;;;CAcvC,CAAC"}
1
+ {"version":3,"file":"SIWXUtil.d.ts","sourceRoot":"","sources":["../../../src/utils/SIWXUtil.ts"],"names":[],"mappings":"AAAA,OAAO,iBAAiB,MAAM,mCAAmC,CAAC;AAElE,OAAO,EACL,KAAK,aAAa,EAElB,KAAK,WAAW,EACjB,MAAM,mCAAmC,CAAC;AAa3C;;GAEG;AAEH,eAAO,MAAM,QAAQ;;;sBAUH,MAAM,QAAQ,IAAI,CAAC;;;;;oCAqIG,MAAM,QAAQ,IAAI,CAAC;;uBAsChC;QAAE,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,aAAa,CAAC,EAAE,aAAa,CAAA;KAAE;;;2BAwCvD,iBAAiB;gBAC5B,aAAa,EAAE;iBACd,MAAM,EAAE;;;mCAkGY,OAAO;;;;;;CAcvC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/views/w3m-account-default-view/index.tsx"],"names":[],"mappings":"AAoCA,wBAAgB,kBAAkB,4CA4TjC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/views/w3m-account-default-view/index.tsx"],"names":[],"mappings":"AAqCA,wBAAgB,kBAAkB,4CA6TjC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/views/w3m-all-wallets-view/index.tsx"],"names":[],"mappings":"AAiBA,wBAAgB,cAAc,4CAkF7B"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/views/w3m-all-wallets-view/index.tsx"],"names":[],"mappings":"AAiBA,wBAAgB,cAAc,4CAyF7B"}
@@ -2,7 +2,7 @@ import { type StyleProp, type ViewStyle } from 'react-native';
2
2
  import { type WcWallet } from '@reown/appkit-common-react-native';
3
3
  interface Props {
4
4
  itemStyle: StyleProp<ViewStyle>;
5
- onWalletPress: (wallet: WcWallet) => void;
5
+ onWalletPress: (wallet: WcWallet, displayIndex: number, isInstalled?: boolean) => void;
6
6
  }
7
7
  export declare function AllWalletList({ itemStyle, onWalletPress }: Props): import("react/jsx-runtime").JSX.Element | import("react/jsx-runtime").JSX.Element[] | null;
8
8
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"all-wallet-list.d.ts","sourceRoot":"","sources":["../../../../../src/views/w3m-connect-view/components/all-wallet-list.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAU9D,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAIlE,UAAU,KAAK;IACb,SAAS,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAChC,aAAa,EAAE,CAAC,MAAM,EAAE,QAAQ,KAAK,IAAI,CAAC;CAC3C;AAED,wBAAgB,aAAa,CAAC,EAAE,SAAS,EAAE,aAAa,EAAE,EAAE,KAAK,8FAgDhE"}
1
+ {"version":3,"file":"all-wallet-list.d.ts","sourceRoot":"","sources":["../../../../../src/views/w3m-connect-view/components/all-wallet-list.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAW9D,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAKlE,UAAU,KAAK;IACb,SAAS,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAChC,aAAa,EAAE,CAAC,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;CACxF;AAED,wBAAgB,aAAa,CAAC,EAAE,SAAS,EAAE,aAAa,EAAE,EAAE,KAAK,8FA6EhE"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/views/w3m-connect-view/index.tsx"],"names":[],"mappings":"AAyBA,wBAAgB,WAAW,4CA6E1B"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/views/w3m-connect-view/index.tsx"],"names":[],"mappings":"AAyBA,wBAAgB,WAAW,4CAgF1B"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/views/w3m-connecting-external-view/index.tsx"],"names":[],"mappings":"AA2BA,wBAAgB,sBAAsB,4CA6GrC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/views/w3m-connecting-external-view/index.tsx"],"names":[],"mappings":"AA6BA,wBAAgB,sBAAsB,4CAiIrC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/views/w3m-connecting-social-view/index.tsx"],"names":[],"mappings":"AAuBA,wBAAgB,oBAAoB,4CA+EnC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/views/w3m-connecting-social-view/index.tsx"],"names":[],"mappings":"AAwBA,wBAAgB,oBAAoB,4CAgFnC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/views/w3m-connecting-view/index.tsx"],"names":[],"mappings":"AAmBA,wBAAgB,cAAc,4CAsG7B"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/views/w3m-connecting-view/index.tsx"],"names":[],"mappings":"AAoBA,wBAAgB,cAAc,4CAuG7B"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/views/w3m-network-switch-view/index.tsx"],"names":[],"mappings":"AAqBA,wBAAgB,iBAAiB,4CAkFhC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/views/w3m-network-switch-view/index.tsx"],"names":[],"mappings":"AAsBA,wBAAgB,iBAAiB,4CAmFhC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/views/w3m-siwx-sign-view/index.tsx"],"names":[],"mappings":"AAsBA,wBAAgB,mBAAmB,4CAyElC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/views/w3m-siwx-sign-view/index.tsx"],"names":[],"mappings":"AAuBA,wBAAgB,mBAAmB,4CA0ElC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reown/appkit-react-native",
3
- "version": "2.0.0-alpha.6",
3
+ "version": "2.0.1",
4
4
  "main": "lib/commonjs/index.js",
5
5
  "types": "lib/typescript/index.d.ts",
6
6
  "module": "lib/module/index.js",
@@ -39,10 +39,10 @@
39
39
  "provenance": true
40
40
  },
41
41
  "dependencies": {
42
- "@reown/appkit-common-react-native": "2.0.0-alpha.6",
43
- "@reown/appkit-core-react-native": "2.0.0-alpha.6",
44
- "@reown/appkit-ui-react-native": "2.0.0-alpha.6",
45
- "@walletconnect/universal-provider": "2.21.9",
42
+ "@reown/appkit-common-react-native": "2.0.1",
43
+ "@reown/appkit-core-react-native": "2.0.1",
44
+ "@reown/appkit-ui-react-native": "2.0.1",
45
+ "@walletconnect/universal-provider": "2.21.10",
46
46
  "valtio": "2.1.8"
47
47
  },
48
48
  "peerDependencies": {
package/src/AppKit.ts CHANGED
@@ -15,6 +15,7 @@ import {
15
15
  SendController,
16
16
  BlockchainApiController,
17
17
  WalletUtil,
18
+ LogController,
18
19
  type RouterControllerState
19
20
  } from '@reown/appkit-core-react-native';
20
21
 
@@ -45,6 +46,13 @@ import { RouterUtil } from './utils/RouterUtil';
45
46
  import { type AppKitConfig } from './types';
46
47
  import { SIWXUtil } from './utils/SIWXUtil';
47
48
 
49
+ const APPKIT_INSTANCE_KEY = Symbol.for('__REOWN_APPKIT_INSTANCE__');
50
+
51
+ // Type helper to access the symbol-keyed property on globalThis
52
+ interface GlobalWithAppKit {
53
+ [key: symbol]: AppKit | undefined;
54
+ }
55
+
48
56
  export class AppKit {
49
57
  private projectId: string;
50
58
  private adapters: BlockchainAdapter[];
@@ -144,7 +152,7 @@ export class AppKit {
144
152
  });
145
153
  }
146
154
  } catch (error) {
147
- console.warn('Connection failed:', error);
155
+ LogController.sendError(error, 'AppKit.ts', 'connect');
148
156
  throw error;
149
157
  }
150
158
  }
@@ -179,7 +187,7 @@ export class AppKit {
179
187
  * @param namespace - The namespace to disconnect from.
180
188
  * @param isInternal - Whether the disconnect is internal (i.e. from the AppKit) or external (i.e. from wallet side).
181
189
  */
182
- async disconnect(namespace?: string, isInternal?: boolean): Promise<void> {
190
+ async disconnect(namespace?: ChainNamespace, isInternal?: boolean): Promise<void> {
183
191
  try {
184
192
  const activeNamespace = namespace ?? ConnectionsController.state.activeNamespace;
185
193
 
@@ -206,6 +214,7 @@ export class AppKit {
206
214
  SendController.resetState();
207
215
  OnRampController.resetState();
208
216
  WcController.resetState();
217
+ EventsController.resetState();
209
218
 
210
219
  if (ConnectionsController.state.activeNamespace === undefined) {
211
220
  ConnectionsController.setActiveNamespace(
@@ -219,9 +228,13 @@ export class AppKit {
219
228
 
220
229
  EventsController.sendEvent({
221
230
  type: 'track',
222
- event: 'DISCONNECT_SUCCESS'
231
+ event: 'DISCONNECT_SUCCESS',
232
+ properties: {
233
+ namespace: activeNamespace
234
+ }
223
235
  });
224
236
  } catch (error) {
237
+ LogController.sendError(error, 'AppKit.ts', 'disconnect');
225
238
  EventsController.sendEvent({
226
239
  type: 'track',
227
240
  event: 'DISCONNECT_ERROR'
@@ -232,7 +245,7 @@ export class AppKit {
232
245
  /**
233
246
  * Returns the provider for a given namespace.
234
247
  * @param namespace - The namespace to get the provider for.
235
- * @returns The provider for the given namespace.
248
+ * @returns The provider for the given namespace, or null if not available or not yet initialized.
236
249
  */
237
250
  getProvider<T extends Provider>(namespace?: string): T | null {
238
251
  const activeNamespace = namespace ?? ConnectionsController.state.activeNamespace;
@@ -243,7 +256,15 @@ export class AppKit {
243
256
  );
244
257
  if (!connection || !connection.adapter || !connection.adapter.connector) return null;
245
258
 
246
- return connection.adapter.connector.getProvider() as T;
259
+ try {
260
+ return connection.adapter.connector.getProvider() as T | null;
261
+ } catch (error) {
262
+ // Provider not initialized yet during session restoration
263
+ // This can happen on app restart when restoring a previous connection
264
+ LogController.sendError(error, 'AppKit.ts', 'getProvider');
265
+
266
+ return null;
267
+ }
247
268
  }
248
269
 
249
270
  getNetworks() {
@@ -268,7 +289,7 @@ export class AppKit {
268
289
  type: 'track',
269
290
  event: 'SWITCH_NETWORK',
270
291
  properties: {
271
- network: network.id
292
+ network: network.caipNetworkId
272
293
  }
273
294
  });
274
295
 
@@ -296,6 +317,7 @@ export class AppKit {
296
317
 
297
318
  RouterUtil.checkOnRampBack();
298
319
  RouterUtil.checkSocialLoginBack();
320
+ EventsController.sendWalletImpressions();
299
321
  }
300
322
 
301
323
  back() {
@@ -383,6 +405,10 @@ export class AppKit {
383
405
  */
384
406
  private async initConnectors() {
385
407
  ModalController.setLoading(true);
408
+
409
+ //Always init the walletconnect connector
410
+ await this.createWalletConnectConnector();
411
+
386
412
  const connectedConnectors = await StorageUtil.getConnectedConnectors();
387
413
  if (connectedConnectors.length > 0) {
388
414
  for (const connected of connectedConnectors) {
@@ -393,15 +419,28 @@ export class AppKit {
393
419
 
394
420
  await this.processConnection(connector, namespaces);
395
421
  } catch (error) {
396
- // Use console.warn for non-critical initialization failures
397
- console.warn(`Failed to initialize connector type ${connected.type}:`, error);
422
+ LogController.sendError(error, 'AppKit.ts', 'initializeConnector', {
423
+ connectorType: connected.type
424
+ });
398
425
  await StorageUtil.removeConnectedConnectors(connected.type);
399
426
  }
400
427
  }
428
+
429
+ const address = ConnectionsController.state.activeAddress;
430
+ const walletInfo = ConnectionsController.state.walletInfo;
431
+ if (address) {
432
+ EventsController.sendEvent({
433
+ type: 'track',
434
+ event: 'CONNECT_SUCCESS',
435
+ address: CoreHelperUtil.getPlainAddress(address),
436
+ properties: {
437
+ name: walletInfo?.name ?? 'Unknown',
438
+ reconnect: true
439
+ }
440
+ });
441
+ }
401
442
  }
402
443
 
403
- //Always init the walletconnect connector
404
- await this.createWalletConnectConnector();
405
444
  ModalController.setLoading(false);
406
445
  }
407
446
 
@@ -494,6 +533,7 @@ export class AppKit {
494
533
  );
495
534
  }
496
535
  } catch (error) {
536
+ LogController.sendError(error, 'AppKit.ts', 'syncIdentity');
497
537
  // Continue processing other addresses even if one fails
498
538
  }
499
539
  }
@@ -512,8 +552,9 @@ export class AppKit {
512
552
  this.syncNativeBalance(adapter, network);
513
553
  }
514
554
  }
515
- } catch {
555
+ } catch (error) {
516
556
  // ignore
557
+ LogController.sendError(error, 'AppKit.ts', 'refreshBalance');
517
558
  }
518
559
  }
519
560
 
@@ -602,6 +643,7 @@ export class AppKit {
602
643
 
603
644
  const namespace = adapter.getSupportedNamespace();
604
645
  const chain = `${namespace}:${chainId}` as CaipNetworkId;
646
+
605
647
  ConnectionsController.setActiveNetwork(namespace, chain);
606
648
 
607
649
  const connection = ConnectionsController.state.connections.get(namespace);
@@ -623,7 +665,13 @@ export class AppKit {
623
665
  TransactionsController.fetchTransactions(address, true);
624
666
  }
625
667
 
626
- SIWXUtil.initializeIfEnabled({ onDisconnect: this.disconnect, caipAddress: address });
668
+ const closeModal = RouterController.state.view === 'UnsupportedChain';
669
+
670
+ SIWXUtil.initializeIfEnabled({
671
+ onDisconnect: this.disconnect,
672
+ caipAddress: address,
673
+ closeModal
674
+ });
627
675
  });
628
676
 
629
677
  adapter.on('disconnect', () => {
@@ -639,6 +687,7 @@ export class AppKit {
639
687
 
640
688
  private async initControllers(options: AppKitConfig) {
641
689
  await this.initStorageAndValues(options);
690
+ let defaultNetwork;
642
691
 
643
692
  OptionsController.setProjectId(options.projectId);
644
693
  OptionsController.setMetadata(options.metadata);
@@ -648,12 +697,20 @@ export class AppKit {
648
697
  OptionsController.setFeaturedWalletIds(options.featuredWalletIds);
649
698
  OptionsController.setEnableAnalytics(options.enableAnalytics);
650
699
  OptionsController.setDebug(options.debug);
700
+
701
+ LogController.sendInfo('AppKit initialization started', 'AppKit.ts', 'initControllers', {
702
+ projectId: options.projectId,
703
+ adapters: this.adapters.map(a => a.constructor.name),
704
+ networks: this.networks.map(n => n.name),
705
+ debug: options.debug
706
+ });
707
+
651
708
  OptionsController.setFeatures(options.features);
652
709
  OptionsController.setRequestedNetworks(this.networks);
653
710
 
654
711
  if (options.defaultNetwork) {
655
- const network = NetworkUtil.formatNetwork(options.defaultNetwork, this.projectId);
656
- OptionsController.setDefaultNetwork(network);
712
+ defaultNetwork = NetworkUtil.formatNetwork(options.defaultNetwork, this.projectId);
713
+ OptionsController.setDefaultNetwork(defaultNetwork);
657
714
  }
658
715
 
659
716
  ThemeController.setDefaultThemeMode(options.themeMode);
@@ -679,6 +736,24 @@ export class AppKit {
679
736
  ) {
680
737
  OptionsController.setIsOnRampEnabled(true);
681
738
  }
739
+
740
+ EventsController.sendEvent({
741
+ type: 'track',
742
+ event: 'INITIALIZE',
743
+ properties: {
744
+ showWallets: options.features?.showWallets,
745
+ themeMode: options.themeMode,
746
+ themeVariables: options.themeVariables,
747
+ networks: this.networks.map(network => network.caipNetworkId).filter(Boolean),
748
+ defaultNetwork: defaultNetwork?.caipNetworkId,
749
+ metadata: options.metadata,
750
+ enableAnalytics: options.enableAnalytics,
751
+ features: options.features,
752
+ adapters: this.adapters.map(adapter => adapter?.constructor?.name).filter(Boolean),
753
+ extraConnectors: this.extraConnectors.map(connector => connector?.type).filter(Boolean),
754
+ siwx: !!options.siwx
755
+ }
756
+ });
682
757
  }
683
758
 
684
759
  private async initActiveNamespace() {
@@ -778,6 +853,41 @@ export class AppKit {
778
853
  };
779
854
  }
780
855
 
856
+ /**
857
+ * Creates or returns the existing AppKit singleton instance.
858
+ *
859
+ * @warning This function implements a singleton pattern. If an instance already exists,
860
+ * it will be returned and the provided config parameter will be IGNORED. If you need to
861
+ * change configuration, you must reload your application or clear the singleton manually.
862
+ *
863
+ * @param config - AppKit configuration options
864
+ * @returns The AppKit singleton instance
865
+ * @throws Error if configuration validation fails
866
+ */
781
867
  export function createAppKit(config: AppKitConfig): AppKit {
782
- return new AppKit(config);
868
+ try {
869
+ const globalWithAppKit = globalThis as GlobalWithAppKit;
870
+
871
+ if (!globalWithAppKit[APPKIT_INSTANCE_KEY]) {
872
+ if (config.debug && __DEV__) {
873
+ // using console.log to avoid possible issues with LogController not being initialized
874
+ //eslint-disable-next-line no-console
875
+ console.log('AppKit: Creating new instance - AppKit.ts:createAppKit');
876
+ }
877
+ globalWithAppKit[APPKIT_INSTANCE_KEY] = new AppKit(config);
878
+ } else if (config.debug && __DEV__) {
879
+ //eslint-disable-next-line no-console
880
+ console.log('AppKit: Reusing existing instance - AppKit.ts:createAppKit');
881
+ }
882
+
883
+ return globalWithAppKit[APPKIT_INSTANCE_KEY]!;
884
+ } catch (error) {
885
+ if (__DEV__) {
886
+ // using console.error to avoid possible issues with LogController not being initialized
887
+ //eslint-disable-next-line no-console
888
+ console.error('AppKit: Failed to create instance - AppKit.ts:createAppKit', error);
889
+ }
890
+
891
+ throw error;
892
+ }
783
893
  }
@@ -1,4 +1,5 @@
1
1
  import { useContext, useMemo } from 'react';
2
+ import type { ChainNamespace } from '@reown/appkit-common-react-native';
2
3
 
3
4
  import type { AppKit } from '../AppKit';
4
5
  import { AppKitContext } from '../AppKitContext';
@@ -6,7 +7,7 @@ import { AppKitContext } from '../AppKitContext';
6
7
  interface UseAppKitReturn {
7
8
  open: AppKit['open'];
8
9
  close: AppKit['close'];
9
- disconnect: (namespace?: string) => void;
10
+ disconnect: (namespace?: ChainNamespace) => void;
10
11
  switchNetwork: AppKit['switchNetwork'];
11
12
  }
12
13
 
@@ -30,7 +31,7 @@ export const useAppKit = (): UseAppKitReturn => {
30
31
  return {
31
32
  open: context.appKit.open.bind(context.appKit),
32
33
  close: context.appKit.close.bind(context.appKit),
33
- disconnect: (namespace?: string) =>
34
+ disconnect: (namespace?: ChainNamespace) =>
34
35
  context.appKit!.disconnect.bind(context.appKit!)(namespace),
35
36
  switchNetwork: context.appKit.switchNetwork.bind(context.appKit)
36
37
  };
@@ -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
+ };
@@ -1,7 +1,7 @@
1
1
  /* eslint-disable valtio/state-snapshot-rule */
2
2
  import { useMemo } from 'react';
3
3
  import { useSnapshot } from 'valtio';
4
- import { ConnectionsController } from '@reown/appkit-core-react-native';
4
+ import { ConnectionsController, LogController } from '@reown/appkit-core-react-native';
5
5
  import type { Provider, ChainNamespace } from '@reown/appkit-common-react-native';
6
6
 
7
7
  /**
@@ -40,12 +40,21 @@ export function useProvider(): ProviderResult {
40
40
  const { connection } = useSnapshot(ConnectionsController.state);
41
41
 
42
42
  const returnValue = useMemo(() => {
43
- if (!connection) return { provider: undefined, providerType: undefined };
43
+ if (!connection || !connection.adapter) {
44
+ return { provider: undefined, providerType: undefined };
45
+ }
44
46
 
45
- return {
46
- provider: connection.adapter.getProvider(),
47
- providerType: connection.adapter.getSupportedNamespace()
48
- };
47
+ try {
48
+ return {
49
+ provider: connection.adapter.getProvider(),
50
+ providerType: connection.adapter.getSupportedNamespace()
51
+ };
52
+ } catch (error) {
53
+ LogController.sendError(error, 'useProvider', 'useProvider');
54
+
55
+ // Provider not initialized yet during session restoration
56
+ return { provider: undefined, providerType: undefined };
57
+ }
49
58
  }, [connection]);
50
59
 
51
60
  return returnValue;
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,
@@ -33,6 +35,7 @@ export { useAccount } from './hooks/useAccount';
33
35
  export { useWalletInfo } from './hooks/useWalletInfo';
34
36
  export { useAppKitEvents, useAppKitEventSubscription } from './hooks/useAppKitEvents';
35
37
  export { useAppKitState } from './hooks/useAppKitState';
38
+ export { useAppKitLogs, type UseAppKitLogsReturn } from './hooks/useAppKitLogs';
36
39
 
37
40
  /********** Networks **********/
38
41
  export { solana, solanaDevnet, solanaTestnet } from '@reown/appkit-common-react-native';
@@ -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,13 +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>;
13
14
  testID?: string;
14
15
  }
15
16
 
16
- export function WalletItem({ item, imageHeaders, onItemPress, style, testID }: WalletItemProps) {
17
+ export function WalletItem({
18
+ item,
19
+ displayIndex,
20
+ imageHeaders,
21
+ onItemPress,
22
+ style,
23
+ testID
24
+ }: WalletItemProps) {
17
25
  const { walletImages } = useSnapshot(AssetController.state);
18
26
  const isInstalled = ApiController.state.installed.find(wallet => wallet?.id === item?.id);
19
27
  const imageSrc = AssetUtil.getWalletImage(item, walletImages);
@@ -28,7 +36,7 @@ export function WalletItem({ item, imageHeaders, onItemPress, style, testID }: W
28
36
  style={style}
29
37
  imageHeaders={imageHeaders}
30
38
  name={item?.name ?? 'Unknown'}
31
- onPress={() => onItemPress(item)}
39
+ onPress={() => onItemPress(item, displayIndex)}
32
40
  installed={!!isInstalled}
33
41
  testID={testID}
34
42
  />