@reown/appkit-react-native 0.0.0-feat-multichain-20250730193426 → 0.0.0-feat-multichain-20250801190527

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 (213) hide show
  1. package/lib/commonjs/AppKit.js +46 -64
  2. package/lib/commonjs/AppKit.js.map +1 -1
  3. package/lib/commonjs/AppKitContext.js +3 -5
  4. package/lib/commonjs/AppKitContext.js.map +1 -1
  5. package/lib/commonjs/connectors/WalletConnectConnector.js +1 -1
  6. package/lib/commonjs/connectors/WalletConnectConnector.js.map +1 -1
  7. package/lib/commonjs/modal/w3m-account-button/index.js +1 -1
  8. package/lib/commonjs/modal/w3m-account-button/index.js.map +1 -1
  9. package/lib/commonjs/modal/w3m-modal/index.js +1 -1
  10. package/lib/commonjs/modal/w3m-modal/index.js.map +1 -1
  11. package/lib/commonjs/modal/w3m-network-button/index.js +1 -1
  12. package/lib/commonjs/modal/w3m-network-button/index.js.map +1 -1
  13. package/lib/commonjs/partials/w3m-account-activity/index.js +1 -1
  14. package/lib/commonjs/partials/w3m-account-activity/index.js.map +1 -1
  15. package/lib/commonjs/partials/w3m-account-tokens/index.js +1 -1
  16. package/lib/commonjs/partials/w3m-account-tokens/index.js.map +1 -1
  17. package/lib/commonjs/partials/w3m-connecting-mobile/index.js +6 -7
  18. package/lib/commonjs/partials/w3m-connecting-mobile/index.js.map +1 -1
  19. package/lib/commonjs/partials/w3m-connecting-qrcode/index.js +4 -9
  20. package/lib/commonjs/partials/w3m-connecting-qrcode/index.js.map +1 -1
  21. package/lib/commonjs/partials/w3m-connecting-web/index.js +6 -7
  22. package/lib/commonjs/partials/w3m-connecting-web/index.js.map +1 -1
  23. package/lib/commonjs/partials/w3m-header/index.js +1 -1
  24. package/lib/commonjs/partials/w3m-header/index.js.map +1 -1
  25. package/lib/commonjs/partials/w3m-selector-modal/index.js +1 -1
  26. package/lib/commonjs/partials/w3m-selector-modal/index.js.map +1 -1
  27. package/lib/commonjs/utils/HelpersUtil.js.map +1 -1
  28. package/lib/commonjs/utils/UiUtil.js +0 -14
  29. package/lib/commonjs/utils/UiUtil.js.map +1 -1
  30. package/lib/commonjs/views/w3m-account-default-view/index.js +2 -2
  31. package/lib/commonjs/views/w3m-account-default-view/index.js.map +1 -1
  32. package/lib/commonjs/views/w3m-account-view/index.js +1 -1
  33. package/lib/commonjs/views/w3m-account-view/index.js.map +1 -1
  34. package/lib/commonjs/views/w3m-all-wallets-view/index.js +3 -3
  35. package/lib/commonjs/views/w3m-all-wallets-view/index.js.map +1 -1
  36. package/lib/commonjs/views/w3m-connect-view/components/all-wallet-list.js +1 -1
  37. package/lib/commonjs/views/w3m-connect-view/components/all-wallet-list.js.map +1 -1
  38. package/lib/commonjs/views/w3m-connect-view/components/custom-wallet-list.js +1 -1
  39. package/lib/commonjs/views/w3m-connect-view/components/custom-wallet-list.js.map +1 -1
  40. package/lib/commonjs/views/w3m-connect-view/components/recent-wallet-list.js +1 -1
  41. package/lib/commonjs/views/w3m-connect-view/components/recent-wallet-list.js.map +1 -1
  42. package/lib/commonjs/views/w3m-connect-view/index.js +1 -1
  43. package/lib/commonjs/views/w3m-connect-view/index.js.map +1 -1
  44. package/lib/commonjs/views/w3m-connecting-external-view/index.js +5 -6
  45. package/lib/commonjs/views/w3m-connecting-external-view/index.js.map +1 -1
  46. package/lib/commonjs/views/w3m-connecting-siwe-view/index.js +6 -10
  47. package/lib/commonjs/views/w3m-connecting-siwe-view/index.js.map +1 -1
  48. package/lib/commonjs/views/w3m-connecting-social-view/index.js +6 -8
  49. package/lib/commonjs/views/w3m-connecting-social-view/index.js.map +1 -1
  50. package/lib/commonjs/views/w3m-connecting-view/index.js +7 -7
  51. package/lib/commonjs/views/w3m-connecting-view/index.js.map +1 -1
  52. package/lib/commonjs/views/w3m-network-switch-view/index.js +4 -3
  53. package/lib/commonjs/views/w3m-network-switch-view/index.js.map +1 -1
  54. package/lib/commonjs/views/w3m-networks-view/index.js +2 -2
  55. package/lib/commonjs/views/w3m-networks-view/index.js.map +1 -1
  56. package/lib/commonjs/views/w3m-onramp-checkout-view/index.js +1 -1
  57. package/lib/commonjs/views/w3m-onramp-checkout-view/index.js.map +1 -1
  58. package/lib/commonjs/views/w3m-onramp-view/components/Header.js +1 -1
  59. package/lib/commonjs/views/w3m-onramp-view/components/Header.js.map +1 -1
  60. package/lib/commonjs/views/w3m-onramp-view/index.js +1 -1
  61. package/lib/commonjs/views/w3m-onramp-view/index.js.map +1 -1
  62. package/lib/commonjs/views/w3m-swap-view/components/select-token-view/index.js +1 -1
  63. package/lib/commonjs/views/w3m-swap-view/components/select-token-view/index.js.map +1 -1
  64. package/lib/commonjs/views/w3m-unsupported-chain-view/index.js +2 -4
  65. package/lib/commonjs/views/w3m-unsupported-chain-view/index.js.map +1 -1
  66. package/lib/commonjs/views/w3m-wallet-compatible-networks-view/index.js +1 -1
  67. package/lib/commonjs/views/w3m-wallet-compatible-networks-view/index.js.map +1 -1
  68. package/lib/commonjs/views/w3m-wallet-receive-view/index.js +2 -2
  69. package/lib/commonjs/views/w3m-wallet-receive-view/index.js.map +1 -1
  70. package/lib/commonjs/views/w3m-wallet-send-preview-view/components/preview-send-details.js +1 -1
  71. package/lib/commonjs/views/w3m-wallet-send-preview-view/components/preview-send-details.js.map +1 -1
  72. package/lib/commonjs/views/w3m-wallet-send-select-token-view/index.js +1 -1
  73. package/lib/commonjs/views/w3m-wallet-send-select-token-view/index.js.map +1 -1
  74. package/lib/module/AppKit.js +47 -65
  75. package/lib/module/AppKit.js.map +1 -1
  76. package/lib/module/AppKitContext.js +1 -3
  77. package/lib/module/AppKitContext.js.map +1 -1
  78. package/lib/module/connectors/WalletConnectConnector.js +2 -2
  79. package/lib/module/connectors/WalletConnectConnector.js.map +1 -1
  80. package/lib/module/modal/w3m-account-button/index.js +2 -2
  81. package/lib/module/modal/w3m-account-button/index.js.map +1 -1
  82. package/lib/module/modal/w3m-modal/index.js +2 -2
  83. package/lib/module/modal/w3m-modal/index.js.map +1 -1
  84. package/lib/module/modal/w3m-network-button/index.js +2 -2
  85. package/lib/module/modal/w3m-network-button/index.js.map +1 -1
  86. package/lib/module/partials/w3m-account-activity/index.js +2 -2
  87. package/lib/module/partials/w3m-account-activity/index.js.map +1 -1
  88. package/lib/module/partials/w3m-account-tokens/index.js +2 -2
  89. package/lib/module/partials/w3m-account-tokens/index.js.map +1 -1
  90. package/lib/module/partials/w3m-connecting-mobile/index.js +7 -8
  91. package/lib/module/partials/w3m-connecting-mobile/index.js.map +1 -1
  92. package/lib/module/partials/w3m-connecting-qrcode/index.js +5 -10
  93. package/lib/module/partials/w3m-connecting-qrcode/index.js.map +1 -1
  94. package/lib/module/partials/w3m-connecting-web/index.js +7 -8
  95. package/lib/module/partials/w3m-connecting-web/index.js.map +1 -1
  96. package/lib/module/partials/w3m-header/index.js +2 -2
  97. package/lib/module/partials/w3m-header/index.js.map +1 -1
  98. package/lib/module/partials/w3m-selector-modal/index.js +2 -2
  99. package/lib/module/partials/w3m-selector-modal/index.js.map +1 -1
  100. package/lib/module/utils/HelpersUtil.js.map +1 -1
  101. package/lib/module/utils/UiUtil.js +2 -15
  102. package/lib/module/utils/UiUtil.js.map +1 -1
  103. package/lib/module/views/w3m-account-default-view/index.js +4 -4
  104. package/lib/module/views/w3m-account-default-view/index.js.map +1 -1
  105. package/lib/module/views/w3m-account-view/index.js +2 -2
  106. package/lib/module/views/w3m-account-view/index.js.map +1 -1
  107. package/lib/module/views/w3m-all-wallets-view/index.js +4 -4
  108. package/lib/module/views/w3m-all-wallets-view/index.js.map +1 -1
  109. package/lib/module/views/w3m-connect-view/components/all-wallet-list.js +2 -2
  110. package/lib/module/views/w3m-connect-view/components/all-wallet-list.js.map +1 -1
  111. package/lib/module/views/w3m-connect-view/components/custom-wallet-list.js +2 -2
  112. package/lib/module/views/w3m-connect-view/components/custom-wallet-list.js.map +1 -1
  113. package/lib/module/views/w3m-connect-view/components/recent-wallet-list.js +2 -2
  114. package/lib/module/views/w3m-connect-view/components/recent-wallet-list.js.map +1 -1
  115. package/lib/module/views/w3m-connect-view/index.js +1 -1
  116. package/lib/module/views/w3m-connect-view/index.js.map +1 -1
  117. package/lib/module/views/w3m-connecting-external-view/index.js +7 -8
  118. package/lib/module/views/w3m-connecting-external-view/index.js.map +1 -1
  119. package/lib/module/views/w3m-connecting-siwe-view/index.js +8 -12
  120. package/lib/module/views/w3m-connecting-siwe-view/index.js.map +1 -1
  121. package/lib/module/views/w3m-connecting-social-view/index.js +8 -10
  122. package/lib/module/views/w3m-connecting-social-view/index.js.map +1 -1
  123. package/lib/module/views/w3m-connecting-view/index.js +9 -9
  124. package/lib/module/views/w3m-connecting-view/index.js.map +1 -1
  125. package/lib/module/views/w3m-network-switch-view/index.js +7 -5
  126. package/lib/module/views/w3m-network-switch-view/index.js.map +1 -1
  127. package/lib/module/views/w3m-networks-view/index.js +4 -4
  128. package/lib/module/views/w3m-networks-view/index.js.map +1 -1
  129. package/lib/module/views/w3m-onramp-checkout-view/index.js +2 -2
  130. package/lib/module/views/w3m-onramp-checkout-view/index.js.map +1 -1
  131. package/lib/module/views/w3m-onramp-view/components/Header.js +2 -2
  132. package/lib/module/views/w3m-onramp-view/components/Header.js.map +1 -1
  133. package/lib/module/views/w3m-onramp-view/index.js +2 -2
  134. package/lib/module/views/w3m-onramp-view/index.js.map +1 -1
  135. package/lib/module/views/w3m-swap-view/components/select-token-view/index.js +2 -2
  136. package/lib/module/views/w3m-swap-view/components/select-token-view/index.js.map +1 -1
  137. package/lib/module/views/w3m-unsupported-chain-view/index.js +4 -6
  138. package/lib/module/views/w3m-unsupported-chain-view/index.js.map +1 -1
  139. package/lib/module/views/w3m-wallet-compatible-networks-view/index.js +2 -2
  140. package/lib/module/views/w3m-wallet-compatible-networks-view/index.js.map +1 -1
  141. package/lib/module/views/w3m-wallet-receive-view/index.js +3 -3
  142. package/lib/module/views/w3m-wallet-receive-view/index.js.map +1 -1
  143. package/lib/module/views/w3m-wallet-send-preview-view/components/preview-send-details.js +2 -2
  144. package/lib/module/views/w3m-wallet-send-preview-view/components/preview-send-details.js.map +1 -1
  145. package/lib/module/views/w3m-wallet-send-select-token-view/index.js +2 -2
  146. package/lib/module/views/w3m-wallet-send-select-token-view/index.js.map +1 -1
  147. package/lib/typescript/AppKit.d.ts +6 -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/modal/w3m-account-button/index.d.ts.map +1 -1
  152. package/lib/typescript/modal/w3m-network-button/index.d.ts.map +1 -1
  153. package/lib/typescript/partials/w3m-account-activity/index.d.ts.map +1 -1
  154. package/lib/typescript/partials/w3m-account-tokens/index.d.ts.map +1 -1
  155. package/lib/typescript/partials/w3m-connecting-mobile/index.d.ts.map +1 -1
  156. package/lib/typescript/partials/w3m-connecting-qrcode/index.d.ts.map +1 -1
  157. package/lib/typescript/partials/w3m-connecting-web/index.d.ts.map +1 -1
  158. package/lib/typescript/utils/HelpersUtil.d.ts +3 -2
  159. package/lib/typescript/utils/HelpersUtil.d.ts.map +1 -1
  160. package/lib/typescript/utils/UiUtil.d.ts +0 -4
  161. package/lib/typescript/utils/UiUtil.d.ts.map +1 -1
  162. package/lib/typescript/views/w3m-account-default-view/index.d.ts.map +1 -1
  163. package/lib/typescript/views/w3m-account-view/index.d.ts.map +1 -1
  164. package/lib/typescript/views/w3m-connecting-external-view/index.d.ts.map +1 -1
  165. package/lib/typescript/views/w3m-connecting-siwe-view/index.d.ts.map +1 -1
  166. package/lib/typescript/views/w3m-connecting-social-view/index.d.ts.map +1 -1
  167. package/lib/typescript/views/w3m-network-switch-view/index.d.ts.map +1 -1
  168. package/lib/typescript/views/w3m-networks-view/index.d.ts.map +1 -1
  169. package/lib/typescript/views/w3m-onramp-checkout-view/index.d.ts.map +1 -1
  170. package/lib/typescript/views/w3m-onramp-view/index.d.ts.map +1 -1
  171. package/lib/typescript/views/w3m-swap-view/components/select-token-view/index.d.ts.map +1 -1
  172. package/lib/typescript/views/w3m-unsupported-chain-view/index.d.ts.map +1 -1
  173. package/lib/typescript/views/w3m-wallet-compatible-networks-view/index.d.ts.map +1 -1
  174. package/lib/typescript/views/w3m-wallet-receive-view/index.d.ts.map +1 -1
  175. package/lib/typescript/views/w3m-wallet-send-select-token-view/index.d.ts.map +1 -1
  176. package/package.json +5 -5
  177. package/src/AppKit.ts +64 -81
  178. package/src/AppKitContext.tsx +1 -2
  179. package/src/connectors/WalletConnectConnector.ts +2 -2
  180. package/src/modal/w3m-account-button/index.tsx +3 -2
  181. package/src/modal/w3m-modal/index.tsx +2 -2
  182. package/src/modal/w3m-network-button/index.tsx +2 -1
  183. package/src/partials/w3m-account-activity/index.tsx +2 -1
  184. package/src/partials/w3m-account-tokens/index.tsx +2 -1
  185. package/src/partials/w3m-connecting-mobile/index.tsx +7 -8
  186. package/src/partials/w3m-connecting-qrcode/index.tsx +5 -11
  187. package/src/partials/w3m-connecting-web/index.tsx +7 -9
  188. package/src/partials/w3m-header/index.tsx +2 -2
  189. package/src/partials/w3m-selector-modal/index.tsx +2 -2
  190. package/src/utils/HelpersUtil.ts +3 -2
  191. package/src/utils/UiUtil.ts +1 -25
  192. package/src/views/w3m-account-default-view/index.tsx +5 -4
  193. package/src/views/w3m-account-view/index.tsx +2 -1
  194. package/src/views/w3m-all-wallets-view/index.tsx +5 -5
  195. package/src/views/w3m-connect-view/components/all-wallet-list.tsx +3 -3
  196. package/src/views/w3m-connect-view/components/custom-wallet-list.tsx +3 -3
  197. package/src/views/w3m-connect-view/components/recent-wallet-list.tsx +2 -2
  198. package/src/views/w3m-connect-view/index.tsx +2 -2
  199. package/src/views/w3m-connecting-external-view/index.tsx +7 -8
  200. package/src/views/w3m-connecting-siwe-view/index.tsx +5 -9
  201. package/src/views/w3m-connecting-social-view/index.tsx +8 -10
  202. package/src/views/w3m-connecting-view/index.tsx +9 -9
  203. package/src/views/w3m-network-switch-view/index.tsx +8 -6
  204. package/src/views/w3m-networks-view/index.tsx +5 -4
  205. package/src/views/w3m-onramp-checkout-view/index.tsx +2 -1
  206. package/src/views/w3m-onramp-view/components/Header.tsx +2 -2
  207. package/src/views/w3m-onramp-view/index.tsx +3 -2
  208. package/src/views/w3m-swap-view/components/select-token-view/index.tsx +2 -1
  209. package/src/views/w3m-unsupported-chain-view/index.tsx +4 -5
  210. package/src/views/w3m-wallet-compatible-networks-view/index.tsx +2 -1
  211. package/src/views/w3m-wallet-receive-view/index.tsx +6 -2
  212. package/src/views/w3m-wallet-send-preview-view/components/preview-send-details.tsx +2 -2
  213. package/src/views/w3m-wallet-send-select-token-view/index.tsx +2 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/views/w3m-wallet-send-select-token-view/index.tsx"],"names":[],"mappings":"AAgBA,wBAAgB,yBAAyB,4CA+DxC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/views/w3m-wallet-send-select-token-view/index.tsx"],"names":[],"mappings":"AAiBA,wBAAgB,yBAAyB,4CA+DxC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reown/appkit-react-native",
3
- "version": "0.0.0-feat-multichain-20250730193426",
3
+ "version": "0.0.0-feat-multichain-20250801190527",
4
4
  "main": "lib/commonjs/index.js",
5
5
  "types": "lib/typescript/index.d.ts",
6
6
  "module": "lib/module/index.js",
@@ -38,10 +38,10 @@
38
38
  "access": "public"
39
39
  },
40
40
  "dependencies": {
41
- "@reown/appkit-common-react-native": "0.0.0-feat-multichain-20250730193426",
42
- "@reown/appkit-core-react-native": "0.0.0-feat-multichain-20250730193426",
43
- "@reown/appkit-siwe-react-native": "0.0.0-feat-multichain-20250730193426",
44
- "@reown/appkit-ui-react-native": "0.0.0-feat-multichain-20250730193426",
41
+ "@reown/appkit-common-react-native": "0.0.0-feat-multichain-20250801190527",
42
+ "@reown/appkit-core-react-native": "0.0.0-feat-multichain-20250801190527",
43
+ "@reown/appkit-siwe-react-native": "0.0.0-feat-multichain-20250801190527",
44
+ "@reown/appkit-ui-react-native": "0.0.0-feat-multichain-20250801190527",
45
45
  "@walletconnect/universal-provider": "2.21.5",
46
46
  "valtio": "2.1.5"
47
47
  },
package/src/AppKit.ts CHANGED
@@ -9,12 +9,13 @@ import {
9
9
  StorageUtil,
10
10
  type OptionsControllerState,
11
11
  ThemeController,
12
- ConnectionController,
12
+ WcController,
13
13
  SwapController,
14
14
  OnRampController,
15
15
  CoreHelperUtil,
16
16
  SendController,
17
- BlockchainApiController
17
+ BlockchainApiController,
18
+ type UniversalProviderConfigOverride
18
19
  } from '@reown/appkit-core-react-native';
19
20
 
20
21
  import {
@@ -39,7 +40,8 @@ import {
39
40
  type AccountType,
40
41
  type AppKitOpenOptions,
41
42
  ConstantsUtil,
42
- type Connection
43
+ type Connection,
44
+ type Tokens
43
45
  } from '@reown/appkit-common-react-native';
44
46
  import { SIWEController } from '@reown/appkit-siwe-react-native';
45
47
 
@@ -60,7 +62,7 @@ interface AppKitConfig {
60
62
  excludeWalletIds?: OptionsControllerState['excludeWalletIds'];
61
63
  featuredWalletIds?: OptionsControllerState['featuredWalletIds'];
62
64
  customWallets?: OptionsControllerState['customWallets'];
63
- tokens?: OptionsControllerState['tokens']; //TODO: check if needed in OptionsController
65
+ tokens?: Tokens;
64
66
  enableAnalytics?: OptionsControllerState['enableAnalytics'];
65
67
  debug?: OptionsControllerState['debug'];
66
68
  themeMode?: ThemeMode;
@@ -68,7 +70,7 @@ interface AppKitConfig {
68
70
  siweConfig?: AppKitSIWEClient;
69
71
  defaultNetwork?: Network;
70
72
  features?: Features;
71
- // chainImages?: Record<number, string>; //TODO: rename to networkImages
73
+ universalProviderConfigOverride?: UniversalProviderConfigOverride;
72
74
  }
73
75
 
74
76
  export class AppKit {
@@ -115,7 +117,10 @@ export class AppKit {
115
117
  });
116
118
 
117
119
  this.networks = networksWithAdapters;
118
- this.namespaces = WcHelpersUtil.createNamespaces(this.networks) as ProposalNamespaces;
120
+ this.namespaces = WcHelpersUtil.createNamespaces(
121
+ this.networks,
122
+ config.universalProviderConfigOverride
123
+ ) as ProposalNamespaces;
119
124
  this.config = config;
120
125
  this.extraConnectors = config.extraConnectors || [];
121
126
 
@@ -144,47 +149,59 @@ export class AppKit {
144
149
  siweConfig: this.config?.siweConfig
145
150
  });
146
151
 
147
- const walletInfo = connector.getWalletInfo();
148
- const properties = connector.getProperties();
152
+ this.processConnection(connector, approvedNamespaces);
149
153
 
150
- if (!approvedNamespaces || Object.keys(approvedNamespaces).length === 0) {
151
- throw new Error('Connection cancelled or failed: No approved namespaces returned.');
154
+ // Save connector type and namespaces in storage
155
+ if (approvedNamespaces && Object.keys(approvedNamespaces).length > 0) {
156
+ await StorageUtil.setConnectedConnectors({
157
+ type: connector.type,
158
+ namespaces: Object.keys(approvedNamespaces)
159
+ });
152
160
  }
161
+ } catch (error) {
162
+ console.warn('Connection failed:', error);
163
+ throw error;
164
+ }
165
+ }
153
166
 
154
- // Setup adapters and subscribe to adapter events
155
- const approvedAdapters = this.setupAdaptersAndSubscribe(
156
- connector,
157
- Object.keys(approvedNamespaces)
158
- );
167
+ private processConnection(
168
+ connector: WalletConnector,
169
+ namespaces?: Namespaces,
170
+ shouldCloseModal: boolean = true
171
+ ) {
172
+ if (!namespaces || Object.keys(namespaces).length === 0) {
173
+ throw new Error('No namespaces provided');
174
+ }
159
175
 
160
- // Check if any compatible adapters were found for the *approved* namespaces
161
- if (approvedAdapters.length === 0) {
162
- //TODO: handle case where devs want to connect to a namespace that has no adapters. Could use the provider directly.
163
- throw new Error('No compatible adapters found for the approved namespaces');
164
- }
176
+ const walletInfo = connector.getWalletInfo();
177
+ const properties = connector.getProperties();
165
178
 
166
- // Store the connection details for the successfully connected adapters
167
- this.setConnection(approvedAdapters, approvedNamespaces, walletInfo, properties);
179
+ const initializedAdapters = this.setupAdaptersAndSubscribe(connector, Object.keys(namespaces));
168
180
 
169
- // Store connector type and namespaces in storage
170
- await StorageUtil.setConnectedConnectors({
171
- type: connector.type,
172
- namespaces: Object.keys(approvedNamespaces)
173
- });
181
+ if (initializedAdapters.length === 0) {
182
+ console.warn('No compatible adapters found for namespaces:', Object.keys(namespaces));
174
183
 
175
- this.syncAccounts(approvedAdapters);
184
+ return;
185
+ }
176
186
 
177
- if (
178
- OptionsController.state.isSiweEnabled &&
179
- ConnectionsController.state.activeNamespace === 'eip155'
180
- ) {
181
- this.handleSiweChange({ isConnection: true });
182
- } else {
183
- ModalController.close();
184
- }
185
- } catch (error) {
186
- console.warn('Connection failed:', error);
187
- throw error;
187
+ // Store the connection details
188
+ this.setConnection(initializedAdapters, namespaces, walletInfo, properties);
189
+
190
+ // Sync accounts
191
+ this.syncAccounts(initializedAdapters);
192
+
193
+ // Handle SIWE if enabled
194
+ this.handleSiweConnectionIfEnabled(shouldCloseModal);
195
+ }
196
+
197
+ private handleSiweConnectionIfEnabled(shouldCloseModal: boolean = true): void {
198
+ if (
199
+ OptionsController.state.isSiweEnabled &&
200
+ ConnectionsController.state.activeNamespace === 'eip155'
201
+ ) {
202
+ this.handleSiweChange({ isConnection: true });
203
+ } else if (shouldCloseModal) {
204
+ ModalController.close();
188
205
  }
189
206
  }
190
207
 
@@ -219,7 +236,7 @@ export class AppKit {
219
236
  SwapController.resetState();
220
237
  SendController.resetState();
221
238
  OnRampController.resetState();
222
- ConnectionController.disconnect();
239
+ WcController.resetState();
223
240
 
224
241
  if (ConnectionsController.state.activeNamespace === undefined) {
225
242
  ConnectionsController.setActiveNamespace(
@@ -383,13 +400,12 @@ export class AppKit {
383
400
  return this.walletConnectConnector;
384
401
  }
385
402
 
386
- //TODO: reuse logic with connect method
387
403
  /**
388
404
  * Initializes connectors based on stored connection data.
389
405
  * This attempts to restore previous sessions.
390
406
  */
391
407
  private async initConnectors() {
392
- const connectedConnectors = await StorageUtil.getConnectedConnectors(); // Fetch stored connectors
408
+ const connectedConnectors = await StorageUtil.getConnectedConnectors();
393
409
  if (connectedConnectors.length > 0) {
394
410
  ModalController.setLoading(true);
395
411
 
@@ -398,31 +414,8 @@ export class AppKit {
398
414
  const connector = await this.createConnector(connected.type);
399
415
 
400
416
  const namespaces = connector.getNamespaces();
401
- const walletInfo = connector.getWalletInfo();
402
- const properties = connector.getProperties();
403
-
404
- if (namespaces && Object.keys(namespaces).length > 0) {
405
- // Ensure namespaces is not empty
406
- // Setup adapters and subscribe to events
407
- const initializedAdapters = this.setupAdaptersAndSubscribe(
408
- connector,
409
- Object.keys(namespaces)
410
- );
411
-
412
- // If adapters were successfully initialized, store the connection details
413
- if (initializedAdapters.length > 0) {
414
- this.setConnection(initializedAdapters, namespaces, walletInfo, properties);
415
- }
416
-
417
- this.syncAccounts(initializedAdapters);
418
-
419
- if (
420
- OptionsController.state.isSiweEnabled &&
421
- ConnectionsController.state.activeNamespace === 'eip155'
422
- ) {
423
- this.handleSiweChange({ isConnection: true });
424
- }
425
- }
417
+
418
+ this.processConnection(connector, namespaces, false);
426
419
  } catch (error) {
427
420
  // Use console.warn for non-critical initialization failures
428
421
  console.warn(`Failed to initialize connector type ${connected.type}:`, error);
@@ -449,7 +442,7 @@ export class AppKit {
449
442
  }
450
443
 
451
444
  adapters.forEach(adapter => {
452
- adapter.setConnector(connector);
445
+ adapter.init({ connector });
453
446
  this.subscribeToAdapterEvents(adapter);
454
447
  });
455
448
 
@@ -569,9 +562,7 @@ export class AppKit {
569
562
  private subscribeToAdapterEvents(adapter: BlockchainAdapter): void {
570
563
  adapter.on('accountsChanged', ({ accounts }) => {
571
564
  const namespace = adapter.getSupportedNamespace();
572
- //eslint-disable-next-line no-console
573
- console.log('accountsChanged', accounts, namespace);
574
- //TODO: check this
565
+ ConnectionsController.updateAccounts(namespace, accounts);
575
566
 
576
567
  if (namespace === 'eip155') {
577
568
  this.handleSiweChange({ isAccountChange: true });
@@ -605,7 +596,6 @@ export class AppKit {
605
596
  this.disconnect(namespace, false);
606
597
  });
607
598
 
608
- //TODO: Add types to this events
609
599
  adapter.on('balanceChanged', ({ address, balance }) => {
610
600
  //eslint-disable-next-line no-console
611
601
  console.log('balanceChanged', address, balance);
@@ -623,7 +613,6 @@ export class AppKit {
623
613
  this.setExcludedWallets(options);
624
614
  this.setCustomWallets(options);
625
615
  OptionsController.setFeaturedWalletIds(options.featuredWalletIds);
626
- OptionsController.setTokens(options.tokens);
627
616
  OptionsController.setEnableAnalytics(options.enableAnalytics);
628
617
  OptionsController.setDebug(options.debug);
629
618
  OptionsController.setFeatures(options.features);
@@ -671,8 +660,6 @@ export class AppKit {
671
660
 
672
661
  private async initRecentWallets(options: AppKitConfig) {
673
662
  const wallets = await StorageUtil.getRecentWallets();
674
- const connectedWalletImage = await StorageUtil.getConnectedWalletImageUrl();
675
-
676
663
  const filteredWallets = wallets.filter(wallet => {
677
664
  const { includeWalletIds, excludeWalletIds } = options;
678
665
  if (includeWalletIds) {
@@ -685,11 +672,7 @@ export class AppKit {
685
672
  return true;
686
673
  });
687
674
 
688
- ConnectionController.setRecentWallets(filteredWallets);
689
-
690
- if (connectedWalletImage) {
691
- ConnectionController.setConnectedWalletImageUrl(connectedWalletImage);
692
- }
675
+ WcController.setRecentWallets(filteredWallets);
693
676
  }
694
677
 
695
678
  private setExcludedWallets(options: AppKitConfig) {
@@ -699,7 +682,7 @@ export class AppKit {
699
682
  const excludeCoinbase = !this.extraConnectors.some(connector => connector.type === 'coinbase');
700
683
 
701
684
  if (excludeCoinbase) {
702
- excludedWallets.push(ConstantsUtil.COINBASE_EXPLORER_ID);
685
+ excludedWallets.push(ConstantsUtil.COINBASE_CUSTOM_WALLET.id);
703
686
  }
704
687
 
705
688
  OptionsController.setExcludeWalletIds(excludedWallets);
@@ -16,8 +16,7 @@ export const AppKitProvider: React.FC<AppKitProviderProps> = ({ children, instan
16
16
  return <AppKitContext.Provider value={{ appKit: instance }}>{children}</AppKitContext.Provider>;
17
17
  };
18
18
 
19
- //TODO: rename this so it doesn't conflict with the useAppKit hook in the hooks folder
20
- export const useAppKit = () => {
19
+ export const useInternalAppKit = () => {
21
20
  const context = useContext(AppKitContext);
22
21
  if (context === undefined) {
23
22
  throw new Error('useAppKit must be used within an AppKitProvider');
@@ -1,4 +1,4 @@
1
- import { ConnectionController } from '@reown/appkit-core-react-native';
1
+ import { WcController } from '@reown/appkit-core-react-native';
2
2
  import { UniversalProvider, type IUniversalProvider } from '@walletconnect/universal-provider';
3
3
  import {
4
4
  WalletConnector,
@@ -95,7 +95,7 @@ export class WalletConnectConnector extends WalletConnector {
95
95
  override async connect(opts: ConnectOptions) {
96
96
  const { siweConfig, namespaces, defaultChain, universalLink } = opts;
97
97
  function onUri(uri: string) {
98
- ConnectionController.setWcUri(uri);
98
+ WcController.setWcUri(uri);
99
99
  }
100
100
 
101
101
  const provider = this.getProvider() as IUniversalProvider;
@@ -5,7 +5,8 @@ import {
5
5
  ModalController,
6
6
  ThemeController,
7
7
  ConnectionsController,
8
- AssetController
8
+ AssetController,
9
+ AssetUtil
9
10
  } from '@reown/appkit-core-react-native';
10
11
  import { AccountButton as AccountButtonUI, ThemeProvider } from '@reown/appkit-ui-react-native';
11
12
 
@@ -26,7 +27,7 @@ export function AccountButton({ balance, disabled, style, testID }: AccountButto
26
27
  identity
27
28
  } = useSnapshot(ConnectionsController.state);
28
29
 
29
- const networkImage = activeNetwork ? networkImages[activeNetwork.id] : undefined;
30
+ const networkImage = AssetUtil.getNetworkImage(activeNetwork, networkImages);
30
31
  const showBalance = balance === 'show';
31
32
 
32
33
  return (
@@ -15,11 +15,11 @@ import { AppKitRouter } from '../w3m-router';
15
15
  import { Header } from '../../partials/w3m-header';
16
16
  import { Snackbar } from '../../partials/w3m-snackbar';
17
17
  import { useCustomDimensions } from '../../hooks/useCustomDimensions';
18
- import { useAppKit } from '../../AppKitContext';
18
+ import { useInternalAppKit } from '../../AppKitContext';
19
19
  import styles from './styles';
20
20
 
21
21
  export function AppKit() {
22
- const { close } = useAppKit();
22
+ const { close } = useInternalAppKit();
23
23
  const { open } = useSnapshot(ModalController.state);
24
24
  const { themeMode, themeVariables } = useSnapshot(ThemeController.state);
25
25
  const { projectId } = useSnapshot(OptionsController.state);
@@ -3,6 +3,7 @@ import type { StyleProp, ViewStyle } from 'react-native';
3
3
  import {
4
4
  ApiController,
5
5
  AssetController,
6
+ AssetUtil,
6
7
  ConnectionsController,
7
8
  EventsController,
8
9
  ModalController,
@@ -24,7 +25,7 @@ export function NetworkButton({ disabled, style }: NetworkButtonProps) {
24
25
  const { themeMode, themeVariables } = useSnapshot(ThemeController.state);
25
26
 
26
27
  const network = isConnected ? activeNetwork : defaultNetwork;
27
- const networkImage = network ? networkImages[network.id] : undefined;
28
+ const networkImage = AssetUtil.getNetworkImage(network, networkImages);
28
29
 
29
30
  const onNetworkPress = () => {
30
31
  ModalController.open({ view: 'Networks' });
@@ -13,6 +13,7 @@ import {
13
13
  import { type Transaction, type TransactionImage } from '@reown/appkit-common-react-native';
14
14
  import {
15
15
  AssetController,
16
+ AssetUtil,
16
17
  ConnectionsController,
17
18
  ConstantsUtil,
18
19
  EventsController,
@@ -34,7 +35,7 @@ export function AccountActivity({ style }: Props) {
34
35
  const { loading, transactions, next } = useSnapshot(TransactionsController.state);
35
36
  const { activeNetwork } = useSnapshot(ConnectionsController.state);
36
37
  const { networkImages } = useSnapshot(AssetController.state);
37
- const networkImage = activeNetwork ? networkImages[activeNetwork.id] : undefined;
38
+ const networkImage = AssetUtil.getNetworkImage(activeNetwork, networkImages);
38
39
  const isSupported =
39
40
  activeNetwork?.caipNetworkId &&
40
41
  ConstantsUtil.ACTIVITY_SUPPORTED_CHAINS.includes(activeNetwork.caipNetworkId);
@@ -9,6 +9,7 @@ import {
9
9
  import { useSnapshot } from 'valtio';
10
10
  import {
11
11
  AssetController,
12
+ AssetUtil,
12
13
  ConnectionsController,
13
14
  RouterController
14
15
  } from '@reown/appkit-core-react-native';
@@ -32,7 +33,7 @@ export function AccountTokens({ style, isLoading }: Props) {
32
33
  const [refreshing, setRefreshing] = useState(false);
33
34
  const { activeNetwork, balances } = useSnapshot(ConnectionsController.state);
34
35
  const { networkImages } = useSnapshot(AssetController.state);
35
- const networkImage = activeNetwork ? networkImages[activeNetwork.id] : undefined;
36
+ const networkImage = AssetUtil.getNetworkImage(activeNetwork, networkImages);
36
37
 
37
38
  const getBalance = useCallback(async () => {
38
39
  setRefreshing(true);
@@ -5,7 +5,7 @@ import {
5
5
  RouterController,
6
6
  ApiController,
7
7
  AssetUtil,
8
- ConnectionController,
8
+ WcController,
9
9
  CoreHelperUtil,
10
10
  OptionsController,
11
11
  EventsController,
@@ -21,7 +21,6 @@ import {
21
21
  } from '@reown/appkit-ui-react-native';
22
22
 
23
23
  import { useCustomDimensions } from '../../hooks/useCustomDimensions';
24
- import { UiUtil } from '../../utils/UiUtil';
25
24
  import { StoreLink } from './components/StoreLink';
26
25
  import { ConnectingBody, getMessage, type BodyErrorType } from '../w3m-connecting-body';
27
26
  import styles from './styles';
@@ -35,7 +34,7 @@ interface Props {
35
34
  export function ConnectingMobile({ onRetry, onCopyUri, isInstalled }: Props) {
36
35
  const { data } = RouterController.state;
37
36
  const { maxWidth: width } = useCustomDimensions();
38
- const { wcUri, wcError } = useSnapshot(ConnectionController.state);
37
+ const { wcUri, wcError } = useSnapshot(WcController.state);
39
38
  const [errorType, setErrorType] = useState<BodyErrorType>();
40
39
  const showCopy =
41
40
  OptionsController.isClipboardAvailable() &&
@@ -52,7 +51,7 @@ export function ConnectingMobile({ onRetry, onCopyUri, isInstalled }: Props) {
52
51
 
53
52
  const onRetryPress = () => {
54
53
  setErrorType(undefined);
55
- ConnectionController.setWcError(false);
54
+ WcController.setWcError(false);
56
55
  onRetry?.();
57
56
  };
58
57
 
@@ -68,11 +67,11 @@ export function ConnectingMobile({ onRetry, onCopyUri, isInstalled }: Props) {
68
67
  if (name && mobile_link && wcUri) {
69
68
  const { redirect, href } = CoreHelperUtil.formatNativeUrl(mobile_link, wcUri);
70
69
  const wcLinking = { name, href };
71
- ConnectionController.setWcLinking(wcLinking);
72
- ConnectionController.setPressedWallet(data?.wallet);
70
+ WcController.setWcLinking(wcLinking);
71
+ WcController.setPressedWallet(data?.wallet);
73
72
  await CoreHelperUtil.openLink(redirect);
74
- await ConnectionController.state.wcPromise;
75
- UiUtil.storeConnectedWallet(wcLinking, data?.wallet);
73
+ await WcController.state.wcPromise;
74
+ WcController.setConnectedWallet(wcLinking, data?.wallet);
76
75
  EventsController.sendEvent({
77
76
  type: 'track',
78
77
  event: 'CONNECT_SUCCESS',
@@ -1,32 +1,30 @@
1
1
  import { useEffect } from 'react';
2
2
  import { useSnapshot } from 'valtio';
3
3
  import {
4
- AssetUtil,
5
- ConnectionController,
4
+ WcController,
6
5
  EventsController,
7
6
  OptionsController,
8
7
  SnackController
9
8
  } from '@reown/appkit-core-react-native';
10
9
  import { FlexView, Link, QrCode, Text, Spacing } from '@reown/appkit-ui-react-native';
11
- import { ConstantsUtil } from '@reown/appkit-common-react-native';
12
10
  import { useCustomDimensions } from '../../hooks/useCustomDimensions';
13
11
  import styles from './styles';
14
12
 
15
13
  export function ConnectingQrCode() {
16
- const { wcUri } = useSnapshot(ConnectionController.state);
14
+ const { wcUri } = useSnapshot(WcController.state);
17
15
  const showCopy = OptionsController.isClipboardAvailable();
18
16
  const { maxWidth: windowSize, isPortrait } = useCustomDimensions();
19
17
  const qrSize = (windowSize - Spacing.xl * 2) / (isPortrait ? 1 : 1.5);
20
18
 
21
19
  const onCopyAddress = () => {
22
- if (ConnectionController.state.wcUri) {
23
- OptionsController.copyToClipboard(ConnectionController.state.wcUri);
20
+ if (WcController.state.wcUri) {
21
+ OptionsController.copyToClipboard(WcController.state.wcUri);
24
22
  SnackController.showSuccess('Link copied');
25
23
  }
26
24
  };
27
25
 
28
26
  const onConnect = async () => {
29
- await ConnectionController.state.wcPromise;
27
+ await WcController.state.wcPromise;
30
28
 
31
29
  EventsController.sendEvent({
32
30
  type: 'track',
@@ -36,10 +34,6 @@ export function ConnectingQrCode() {
36
34
  name: 'WalletConnect'
37
35
  }
38
36
  });
39
-
40
- //TODO: check this
41
- const url = AssetUtil.getConnectorImage(ConstantsUtil.WALLET_CONNECT_IMAGE_ID);
42
- ConnectionController.setConnectedWalletImageUrl(url);
43
37
  };
44
38
 
45
39
  useEffect(() => {
@@ -5,7 +5,7 @@ import {
5
5
  RouterController,
6
6
  ApiController,
7
7
  AssetUtil,
8
- ConnectionController,
8
+ WcController,
9
9
  CoreHelperUtil,
10
10
  OptionsController,
11
11
  EventsController
@@ -19,7 +19,6 @@ import {
19
19
  IconBox
20
20
  } from '@reown/appkit-ui-react-native';
21
21
 
22
- import { UiUtil } from '../../utils/UiUtil';
23
22
  import { ConnectingBody, getMessage } from '../w3m-connecting-body';
24
23
  import styles from './styles';
25
24
 
@@ -29,7 +28,7 @@ interface ConnectingWebProps {
29
28
 
30
29
  export function ConnectingWeb({ onCopyUri }: ConnectingWebProps) {
31
30
  const { data } = RouterController.state;
32
- const { wcUri, wcError } = useSnapshot(ConnectionController.state);
31
+ const { wcUri, wcError } = useSnapshot(WcController.state);
33
32
  const showCopy = OptionsController.isClipboardAvailable();
34
33
  const bodyMessage = getMessage({
35
34
  walletName: data?.wallet?.name,
@@ -41,15 +40,14 @@ export function ConnectingWeb({ onCopyUri }: ConnectingWebProps) {
41
40
  try {
42
41
  const { name, webapp_link } = data?.wallet ?? {};
43
42
  if (name && webapp_link && wcUri) {
44
- ConnectionController.setWcError(false);
43
+ WcController.setWcError(false);
45
44
  const { redirect, href } = CoreHelperUtil.formatUniversalUrl(webapp_link, wcUri);
46
45
  const wcLinking = { name, href };
47
- ConnectionController.setWcLinking(wcLinking);
48
- ConnectionController.setPressedWallet(data?.wallet);
46
+ WcController.setWcLinking(wcLinking);
47
+ WcController.setPressedWallet(data?.wallet);
49
48
  await Linking.openURL(redirect);
50
- await ConnectionController.state.wcPromise;
51
-
52
- UiUtil.storeConnectedWallet(wcLinking, data?.wallet);
49
+ await WcController.state.wcPromise;
50
+ WcController.setConnectedWallet(wcLinking, data?.wallet);
53
51
 
54
52
  EventsController.sendEvent({
55
53
  type: 'track',
@@ -8,10 +8,10 @@ import { IconLink, Text, FlexView } from '@reown/appkit-ui-react-native';
8
8
  import { StringUtil } from '@reown/appkit-common-react-native';
9
9
 
10
10
  import styles from './styles';
11
- import { useAppKit } from '../../AppKitContext';
11
+ import { useInternalAppKit } from '../../AppKitContext';
12
12
 
13
13
  export function Header() {
14
- const { close, back } = useAppKit();
14
+ const { close, back } = useInternalAppKit();
15
15
  const { data, view } = useSnapshot(RouterController.state);
16
16
  const onHelpPress = () => {
17
17
  RouterController.push('WhatIsAWallet');
@@ -12,7 +12,7 @@ import {
12
12
  useTheme
13
13
  } from '@reown/appkit-ui-react-native';
14
14
  import styles from './styles';
15
- import { AssetController, ConnectionsController } from '@reown/appkit-core-react-native';
15
+ import { AssetController, AssetUtil, ConnectionsController } from '@reown/appkit-core-react-native';
16
16
 
17
17
  interface SelectorModalProps {
18
18
  title?: string;
@@ -46,7 +46,7 @@ export function SelectorModal({
46
46
  const Theme = useTheme();
47
47
  const { activeNetwork } = useSnapshot(ConnectionsController.state);
48
48
  const { networkImages } = useSnapshot(AssetController.state);
49
- const networkImage = activeNetwork ? networkImages[activeNetwork.id] : undefined;
49
+ const networkImage = AssetUtil.getNetworkImage(activeNetwork, networkImages);
50
50
 
51
51
  const renderSeparator = () => {
52
52
  return <View style={{ height: SEPARATOR_HEIGHT }} />;
@@ -6,6 +6,7 @@ import {
6
6
  solana,
7
7
  solanaDevnet
8
8
  } from '@reown/appkit-common-react-native';
9
+ import type { UniversalProviderConfigOverride } from '@reown/appkit-core-react-native';
9
10
 
10
11
  export const DEFAULT_METHODS = {
11
12
  solana: [
@@ -64,7 +65,7 @@ export const WcHelpersUtil = {
64
65
 
65
66
  applyNamespaceOverrides(
66
67
  baseNamespaces: NamespaceConfig,
67
- overrides?: any //TODO: add OptionsControllerState['universalProviderConfigOverride']
68
+ overrides?: UniversalProviderConfigOverride
68
69
  ): NamespaceConfig {
69
70
  if (!overrides) {
70
71
  return { ...baseNamespaces };
@@ -160,7 +161,7 @@ export const WcHelpersUtil = {
160
161
 
161
162
  createNamespaces(
162
163
  caipNetworks: AppKitNetwork[],
163
- configOverride?: any //TODO: fix this
164
+ configOverride?: UniversalProviderConfigOverride
164
165
  ): NamespaceConfig {
165
166
  const defaultNamespaces = caipNetworks.reduce<NamespaceConfig>((acc, chain) => {
166
167
  const { id, rpcUrls } = chain;
@@ -1,11 +1,4 @@
1
- import {
2
- AssetUtil,
3
- ConnectionController,
4
- RouterController,
5
- StorageUtil,
6
- type WcWallet
7
- } from '@reown/appkit-core-react-native';
8
- import type { WalletDeepLink } from '@reown/appkit-common-react-native';
1
+ import { RouterController } from '@reown/appkit-core-react-native';
9
2
 
10
3
  // Global animation instance to coordinate transitions
11
4
  let currentRouteTransition: ((direction: 'forward' | 'backward' | 'none') => Promise<void>) | null =
@@ -25,22 +18,5 @@ export const UiUtil = {
25
18
  const { navigationDirection } = RouterController.state;
26
19
  await currentRouteTransition(navigationDirection);
27
20
  }
28
- },
29
-
30
- storeConnectedWallet: async (wcLinking: WalletDeepLink, pressedWallet?: WcWallet) => {
31
- StorageUtil.setWalletConnectDeepLink(wcLinking);
32
-
33
- if (pressedWallet) {
34
- UiUtil.storeRecentWallet(pressedWallet);
35
- const url = AssetUtil.getWalletImage(pressedWallet);
36
- ConnectionController.setConnectedWalletImageUrl(url);
37
- }
38
- },
39
-
40
- storeRecentWallet: async (wallet: WcWallet) => {
41
- const recentWallets = await StorageUtil.addRecentWallet(wallet);
42
- if (recentWallets) {
43
- ConnectionController.setRecentWallets(recentWallets);
44
- }
45
21
  }
46
22
  };