@reown/appkit-react-native 0.0.0-feat-multi-social-20250715153550 → 0.0.0-feat-coinbase-20250722173213

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 (173) hide show
  1. package/lib/commonjs/AppKit.js +45 -14
  2. package/lib/commonjs/AppKit.js.map +1 -1
  3. package/lib/commonjs/modal/w3m-account-button/index.js +4 -1
  4. package/lib/commonjs/modal/w3m-account-button/index.js.map +1 -1
  5. package/lib/commonjs/modal/w3m-button/index.js +1 -1
  6. package/lib/commonjs/modal/w3m-button/index.js.map +1 -1
  7. package/lib/commonjs/modal/w3m-modal/index.js +2 -1
  8. package/lib/commonjs/modal/w3m-modal/index.js.map +1 -1
  9. package/lib/commonjs/modal/w3m-network-button/index.js +11 -5
  10. package/lib/commonjs/modal/w3m-network-button/index.js.map +1 -1
  11. package/lib/commonjs/partials/w3m-account-activity/index.js +13 -4
  12. package/lib/commonjs/partials/w3m-account-activity/index.js.map +1 -1
  13. package/lib/commonjs/partials/w3m-account-tokens/index.js +4 -1
  14. package/lib/commonjs/partials/w3m-account-tokens/index.js.map +1 -1
  15. package/lib/commonjs/partials/w3m-account-wallet-features/index.js +4 -2
  16. package/lib/commonjs/partials/w3m-account-wallet-features/index.js.map +1 -1
  17. package/lib/commonjs/partials/w3m-selector-modal/index.js +4 -1
  18. package/lib/commonjs/partials/w3m-selector-modal/index.js.map +1 -1
  19. package/lib/commonjs/partials/w3m-send-input-token/index.js +10 -7
  20. package/lib/commonjs/partials/w3m-send-input-token/index.js.map +1 -1
  21. package/lib/commonjs/partials/w3m-send-input-token/styles.js +3 -0
  22. package/lib/commonjs/partials/w3m-send-input-token/styles.js.map +1 -1
  23. package/lib/commonjs/utils/NetworkUtil.js +6 -8
  24. package/lib/commonjs/utils/NetworkUtil.js.map +1 -1
  25. package/lib/commonjs/views/w3m-account-default-view/index.js +30 -3
  26. package/lib/commonjs/views/w3m-account-default-view/index.js.map +1 -1
  27. package/lib/commonjs/views/w3m-account-view/index.js +6 -2
  28. package/lib/commonjs/views/w3m-account-view/index.js.map +1 -1
  29. package/lib/commonjs/views/w3m-connect-view/components/custom-wallet-list.js +3 -1
  30. package/lib/commonjs/views/w3m-connect-view/components/custom-wallet-list.js.map +1 -1
  31. package/lib/commonjs/views/w3m-connecting-view/index.js +3 -1
  32. package/lib/commonjs/views/w3m-connecting-view/index.js.map +1 -1
  33. package/lib/commonjs/views/w3m-network-switch-view/index.js +5 -1
  34. package/lib/commonjs/views/w3m-network-switch-view/index.js.map +1 -1
  35. package/lib/commonjs/views/w3m-networks-view/index.js +20 -12
  36. package/lib/commonjs/views/w3m-networks-view/index.js.map +1 -1
  37. package/lib/commonjs/views/w3m-onramp-checkout-view/index.js +4 -1
  38. package/lib/commonjs/views/w3m-onramp-checkout-view/index.js.map +1 -1
  39. package/lib/commonjs/views/w3m-onramp-view/index.js +4 -1
  40. package/lib/commonjs/views/w3m-onramp-view/index.js.map +1 -1
  41. package/lib/commonjs/views/w3m-swap-view/components/select-token-view/index.js +4 -1
  42. package/lib/commonjs/views/w3m-swap-view/components/select-token-view/index.js.map +1 -1
  43. package/lib/commonjs/views/w3m-unsupported-chain-view/index.js +4 -1
  44. package/lib/commonjs/views/w3m-unsupported-chain-view/index.js.map +1 -1
  45. package/lib/commonjs/views/w3m-wallet-compatible-networks-view/index.js +4 -1
  46. package/lib/commonjs/views/w3m-wallet-compatible-networks-view/index.js.map +1 -1
  47. package/lib/commonjs/views/w3m-wallet-receive-view/index.js +5 -2
  48. package/lib/commonjs/views/w3m-wallet-receive-view/index.js.map +1 -1
  49. package/lib/commonjs/views/w3m-wallet-send-preview-view/components/preview-send-details.js +5 -12
  50. package/lib/commonjs/views/w3m-wallet-send-preview-view/components/preview-send-details.js.map +1 -1
  51. package/lib/commonjs/views/w3m-wallet-send-preview-view/index.js +0 -2
  52. package/lib/commonjs/views/w3m-wallet-send-preview-view/index.js.map +1 -1
  53. package/lib/commonjs/views/w3m-wallet-send-select-token-view/index.js +4 -5
  54. package/lib/commonjs/views/w3m-wallet-send-select-token-view/index.js.map +1 -1
  55. package/lib/commonjs/views/w3m-wallet-send-view/index.js +12 -21
  56. package/lib/commonjs/views/w3m-wallet-send-view/index.js.map +1 -1
  57. package/lib/module/AppKit.js +46 -15
  58. package/lib/module/AppKit.js.map +1 -1
  59. package/lib/module/modal/w3m-account-button/index.js +5 -2
  60. package/lib/module/modal/w3m-account-button/index.js.map +1 -1
  61. package/lib/module/modal/w3m-button/index.js +2 -2
  62. package/lib/module/modal/w3m-button/index.js.map +1 -1
  63. package/lib/module/modal/w3m-modal/index.js +2 -1
  64. package/lib/module/modal/w3m-modal/index.js.map +1 -1
  65. package/lib/module/modal/w3m-network-button/index.js +12 -6
  66. package/lib/module/modal/w3m-network-button/index.js.map +1 -1
  67. package/lib/module/partials/w3m-account-activity/index.js +14 -5
  68. package/lib/module/partials/w3m-account-activity/index.js.map +1 -1
  69. package/lib/module/partials/w3m-account-tokens/index.js +5 -2
  70. package/lib/module/partials/w3m-account-tokens/index.js.map +1 -1
  71. package/lib/module/partials/w3m-account-wallet-features/index.js +4 -2
  72. package/lib/module/partials/w3m-account-wallet-features/index.js.map +1 -1
  73. package/lib/module/partials/w3m-selector-modal/index.js +5 -2
  74. package/lib/module/partials/w3m-selector-modal/index.js.map +1 -1
  75. package/lib/module/partials/w3m-send-input-token/index.js +12 -9
  76. package/lib/module/partials/w3m-send-input-token/index.js.map +1 -1
  77. package/lib/module/partials/w3m-send-input-token/styles.js +3 -0
  78. package/lib/module/partials/w3m-send-input-token/styles.js.map +1 -1
  79. package/lib/module/utils/NetworkUtil.js +6 -8
  80. package/lib/module/utils/NetworkUtil.js.map +1 -1
  81. package/lib/module/views/w3m-account-default-view/index.js +31 -4
  82. package/lib/module/views/w3m-account-default-view/index.js.map +1 -1
  83. package/lib/module/views/w3m-account-view/index.js +7 -3
  84. package/lib/module/views/w3m-account-view/index.js.map +1 -1
  85. package/lib/module/views/w3m-connect-view/components/custom-wallet-list.js +4 -2
  86. package/lib/module/views/w3m-connect-view/components/custom-wallet-list.js.map +1 -1
  87. package/lib/module/views/w3m-connecting-view/index.js +3 -1
  88. package/lib/module/views/w3m-connecting-view/index.js.map +1 -1
  89. package/lib/module/views/w3m-network-switch-view/index.js +6 -2
  90. package/lib/module/views/w3m-network-switch-view/index.js.map +1 -1
  91. package/lib/module/views/w3m-networks-view/index.js +21 -13
  92. package/lib/module/views/w3m-networks-view/index.js.map +1 -1
  93. package/lib/module/views/w3m-onramp-checkout-view/index.js +5 -2
  94. package/lib/module/views/w3m-onramp-checkout-view/index.js.map +1 -1
  95. package/lib/module/views/w3m-onramp-view/index.js +5 -2
  96. package/lib/module/views/w3m-onramp-view/index.js.map +1 -1
  97. package/lib/module/views/w3m-swap-view/components/select-token-view/index.js +5 -2
  98. package/lib/module/views/w3m-swap-view/components/select-token-view/index.js.map +1 -1
  99. package/lib/module/views/w3m-unsupported-chain-view/index.js +5 -2
  100. package/lib/module/views/w3m-unsupported-chain-view/index.js.map +1 -1
  101. package/lib/module/views/w3m-wallet-compatible-networks-view/index.js +5 -2
  102. package/lib/module/views/w3m-wallet-compatible-networks-view/index.js.map +1 -1
  103. package/lib/module/views/w3m-wallet-receive-view/index.js +6 -3
  104. package/lib/module/views/w3m-wallet-receive-view/index.js.map +1 -1
  105. package/lib/module/views/w3m-wallet-send-preview-view/components/preview-send-details.js +6 -13
  106. package/lib/module/views/w3m-wallet-send-preview-view/components/preview-send-details.js.map +1 -1
  107. package/lib/module/views/w3m-wallet-send-preview-view/index.js +0 -2
  108. package/lib/module/views/w3m-wallet-send-preview-view/index.js.map +1 -1
  109. package/lib/module/views/w3m-wallet-send-select-token-view/index.js +5 -6
  110. package/lib/module/views/w3m-wallet-send-select-token-view/index.js.map +1 -1
  111. package/lib/module/views/w3m-wallet-send-view/index.js +14 -23
  112. package/lib/module/views/w3m-wallet-send-view/index.js.map +1 -1
  113. package/lib/typescript/AppKit.d.ts +1 -1
  114. package/lib/typescript/AppKit.d.ts.map +1 -1
  115. package/lib/typescript/modal/w3m-account-button/index.d.ts.map +1 -1
  116. package/lib/typescript/modal/w3m-modal/index.d.ts.map +1 -1
  117. package/lib/typescript/modal/w3m-network-button/index.d.ts.map +1 -1
  118. package/lib/typescript/partials/w3m-account-activity/index.d.ts.map +1 -1
  119. package/lib/typescript/partials/w3m-account-tokens/index.d.ts.map +1 -1
  120. package/lib/typescript/partials/w3m-account-wallet-features/index.d.ts.map +1 -1
  121. package/lib/typescript/partials/w3m-selector-modal/index.d.ts.map +1 -1
  122. package/lib/typescript/partials/w3m-send-input-token/index.d.ts +2 -2
  123. package/lib/typescript/partials/w3m-send-input-token/index.d.ts.map +1 -1
  124. package/lib/typescript/partials/w3m-send-input-token/styles.d.ts +3 -0
  125. package/lib/typescript/partials/w3m-send-input-token/styles.d.ts.map +1 -1
  126. package/lib/typescript/utils/NetworkUtil.d.ts +2 -1
  127. package/lib/typescript/utils/NetworkUtil.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-account-view/index.d.ts.map +1 -1
  130. package/lib/typescript/views/w3m-connect-view/components/custom-wallet-list.d.ts.map +1 -1
  131. package/lib/typescript/views/w3m-connecting-view/index.d.ts.map +1 -1
  132. package/lib/typescript/views/w3m-network-switch-view/index.d.ts.map +1 -1
  133. package/lib/typescript/views/w3m-networks-view/index.d.ts.map +1 -1
  134. package/lib/typescript/views/w3m-onramp-checkout-view/index.d.ts.map +1 -1
  135. package/lib/typescript/views/w3m-onramp-view/index.d.ts.map +1 -1
  136. package/lib/typescript/views/w3m-swap-view/components/select-token-view/index.d.ts.map +1 -1
  137. package/lib/typescript/views/w3m-unsupported-chain-view/index.d.ts.map +1 -1
  138. package/lib/typescript/views/w3m-wallet-compatible-networks-view/index.d.ts.map +1 -1
  139. package/lib/typescript/views/w3m-wallet-receive-view/index.d.ts.map +1 -1
  140. package/lib/typescript/views/w3m-wallet-send-preview-view/components/preview-send-details.d.ts +1 -1
  141. package/lib/typescript/views/w3m-wallet-send-preview-view/components/preview-send-details.d.ts.map +1 -1
  142. package/lib/typescript/views/w3m-wallet-send-preview-view/index.d.ts.map +1 -1
  143. package/lib/typescript/views/w3m-wallet-send-select-token-view/index.d.ts.map +1 -1
  144. package/lib/typescript/views/w3m-wallet-send-view/index.d.ts.map +1 -1
  145. package/package.json +6 -6
  146. package/src/AppKit.ts +69 -21
  147. package/src/modal/w3m-account-button/index.tsx +4 -3
  148. package/src/modal/w3m-button/index.tsx +2 -2
  149. package/src/modal/w3m-modal/index.tsx +2 -0
  150. package/src/modal/w3m-network-button/index.tsx +10 -6
  151. package/src/partials/w3m-account-activity/index.tsx +16 -5
  152. package/src/partials/w3m-account-tokens/index.tsx +3 -2
  153. package/src/partials/w3m-account-wallet-features/index.tsx +15 -11
  154. package/src/partials/w3m-selector-modal/index.tsx +3 -2
  155. package/src/partials/w3m-send-input-token/index.tsx +17 -19
  156. package/src/partials/w3m-send-input-token/styles.ts +3 -0
  157. package/src/utils/NetworkUtil.ts +13 -10
  158. package/src/views/w3m-account-default-view/index.tsx +34 -4
  159. package/src/views/w3m-account-view/index.tsx +5 -3
  160. package/src/views/w3m-connect-view/components/custom-wallet-list.tsx +5 -2
  161. package/src/views/w3m-connecting-view/index.tsx +3 -1
  162. package/src/views/w3m-network-switch-view/index.tsx +4 -2
  163. package/src/views/w3m-networks-view/index.tsx +23 -12
  164. package/src/views/w3m-onramp-checkout-view/index.tsx +3 -2
  165. package/src/views/w3m-onramp-view/index.tsx +4 -3
  166. package/src/views/w3m-swap-view/components/select-token-view/index.tsx +3 -2
  167. package/src/views/w3m-unsupported-chain-view/index.tsx +7 -2
  168. package/src/views/w3m-wallet-compatible-networks-view/index.tsx +7 -2
  169. package/src/views/w3m-wallet-receive-view/index.tsx +4 -3
  170. package/src/views/w3m-wallet-send-preview-view/components/preview-send-details.tsx +4 -11
  171. package/src/views/w3m-wallet-send-preview-view/index.tsx +2 -9
  172. package/src/views/w3m-wallet-send-select-token-view/index.tsx +3 -4
  173. package/src/views/w3m-wallet-send-view/index.tsx +19 -22
package/src/AppKit.ts CHANGED
@@ -12,7 +12,9 @@ import {
12
12
  ThemeController,
13
13
  ConnectionController,
14
14
  SwapController,
15
- OnRampController
15
+ OnRampController,
16
+ CoreHelperUtil,
17
+ SendController
16
18
  } from '@reown/appkit-core-react-native';
17
19
 
18
20
  import {
@@ -71,7 +73,6 @@ export class AppKit {
71
73
  private projectId: string;
72
74
  private adapters: BlockchainAdapter[];
73
75
  private networks: AppKitNetwork[];
74
- private defaultNetwork?: AppKitNetwork;
75
76
  private namespaces: ProposalNamespaces;
76
77
  private config: AppKitConfig;
77
78
  private extraConnectors: WalletConnector[];
@@ -79,7 +80,7 @@ export class AppKit {
79
80
 
80
81
  constructor(config: AppKitConfig) {
81
82
  this.projectId = config.projectId;
82
- this.adapters = config.adapters;
83
+ this.adapters = config.adapters ?? [];
83
84
 
84
85
  // Validate adapters to ensure no duplicate chainNamespaces
85
86
  const namespaceMap = new Map<ChainNamespace, string>();
@@ -97,9 +98,6 @@ export class AppKit {
97
98
  }
98
99
 
99
100
  this.networks = NetworkUtil.formatNetworks(config.networks, this.projectId); //TODO: check this
100
- this.defaultNetwork = config.defaultNetwork
101
- ? NetworkUtil.formatNetwork(config.defaultNetwork, this.projectId)
102
- : undefined;
103
101
  this.namespaces = WcHelpersUtil.createNamespaces(this.networks) as ProposalNamespaces;
104
102
  this.config = config;
105
103
  this.extraConnectors = config.extraConnectors || [];
@@ -118,9 +116,13 @@ export class AppKit {
118
116
  const { namespaces, defaultChain, universalLink } = options ?? {};
119
117
  const connector = await this.createConnector(type);
120
118
 
119
+ const chain =
120
+ defaultChain ??
121
+ NetworkUtil.getDefaultChainId(this.namespaces, OptionsController.state.defaultNetwork);
122
+
121
123
  const approvedNamespaces = await connector.connect({
122
124
  namespaces: namespaces ?? this.namespaces,
123
- defaultChain,
125
+ defaultChain: chain,
124
126
  universalLink,
125
127
  siweConfig: this.config?.siweConfig
126
128
  });
@@ -202,9 +204,16 @@ export class AppKit {
202
204
  RouterController.reset('Connect');
203
205
  TransactionsController.resetState();
204
206
  SwapController.resetState();
207
+ SendController.resetState();
205
208
  OnRampController.resetState();
206
209
  ConnectionController.disconnect();
207
210
 
211
+ if (ConnectionsController.state.activeNamespace === undefined) {
212
+ ConnectionsController.setActiveNamespace(
213
+ OptionsController.state.defaultNetwork?.chainNamespace
214
+ );
215
+ }
216
+
208
217
  if (OptionsController.state.isSiweEnabled) {
209
218
  await SIWEController.signOut();
210
219
  }
@@ -243,6 +252,14 @@ export class AppKit {
243
252
  }
244
253
 
245
254
  async switchNetwork(network: AppKitNetwork): Promise<void> {
255
+ const { isConnected } = ConnectionsController.state;
256
+
257
+ if (!isConnected) {
258
+ OptionsController.setDefaultNetwork(network);
259
+
260
+ return Promise.resolve();
261
+ }
262
+
246
263
  const adapter = this.getAdapterByNamespace(network.chainNamespace);
247
264
  if (!adapter) throw new Error('No active adapter');
248
265
 
@@ -256,10 +273,7 @@ export class AppKit {
256
273
  }
257
274
  });
258
275
 
259
- ConnectionsController.setActiveNetwork(
260
- adapter.getSupportedNamespace(),
261
- `${adapter.getSupportedNamespace()}:${network.id}` as CaipNetworkId
262
- );
276
+ ConnectionsController.setActiveNetwork(network.chainNamespace, network.caipNetworkId);
263
277
 
264
278
  if (ConnectionsController.state.activeNamespace !== network.chainNamespace) {
265
279
  ConnectionsController.setActiveNamespace(network.chainNamespace);
@@ -365,6 +379,13 @@ export class AppKit {
365
379
  this.syncAccounts(initializedAdapters);
366
380
 
367
381
  AccountController.setIsConnected(true);
382
+
383
+ if (
384
+ OptionsController.state.isSiweEnabled &&
385
+ ConnectionsController.state.activeNamespace === 'eip155'
386
+ ) {
387
+ this.handleSiweChange();
388
+ }
368
389
  }
369
390
  } catch (error) {
370
391
  // Use console.warn for non-critical initialization failures
@@ -464,8 +485,8 @@ export class AppKit {
464
485
  });
465
486
  });
466
487
 
467
- const updateActiveNamespace = !Object.keys(approvedNamespaces).find(
468
- n => n === ConnectionsController.state.activeNamespace
488
+ const updateActiveNamespace = !Object.keys(approvedNamespaces).some(
489
+ namespace => namespace === ConnectionsController.state.activeNamespace
469
490
  );
470
491
 
471
492
  // If the active namespace is not in the approved namespaces or is undefined, set the first connected adapter's namespace as active
@@ -492,12 +513,15 @@ export class AppKit {
492
513
  const namespace = adapter.getSupportedNamespace();
493
514
  const chain = `${namespace}:${chainId}` as CaipNetworkId;
494
515
  ConnectionsController.setActiveNetwork(namespace, chain);
516
+ const connection = ConnectionsController.state.connections.get(namespace);
517
+ const isAuth = !!connection?.properties?.provider;
495
518
 
496
519
  const network = this.networks.find(n => n.id?.toString() === chainId);
497
520
  this.syncBalances(adapter, network);
521
+ SendController.resetState();
498
522
 
499
- if (OptionsController.state.features?.swaps) {
500
- SwapController.fetchTokens();
523
+ if (isAuth) {
524
+ ConnectionsController.fetchBalance();
501
525
  }
502
526
 
503
527
  if (namespace === 'eip155') {
@@ -526,20 +550,25 @@ export class AppKit {
526
550
  OptionsController.setMetadata(options.metadata);
527
551
  OptionsController.setIncludeWalletIds(options.includeWalletIds);
528
552
  this.setExcludedWallets(options);
553
+ this.setCustomWallets(options);
529
554
  OptionsController.setFeaturedWalletIds(options.featuredWalletIds);
530
555
  OptionsController.setTokens(options.tokens);
531
- OptionsController.setCustomWallets(options.customWallets);
532
556
  OptionsController.setEnableAnalytics(options.enableAnalytics);
533
557
  OptionsController.setDebug(options.debug);
534
558
  OptionsController.setFeatures(options.features);
535
559
  OptionsController.setStorage(options.storage);
536
560
 
561
+ if (options.defaultNetwork) {
562
+ const network = NetworkUtil.formatNetwork(options.defaultNetwork, this.projectId);
563
+ OptionsController.setDefaultNetwork(network);
564
+ }
565
+
537
566
  ThemeController.setThemeMode(options.themeMode);
538
567
  ThemeController.setThemeVariables(options.themeVariables);
539
568
 
540
- //TODO: function to get sdk version based on adapters
541
- // @ts-ignore
542
- OptionsController.setSdkVersion('appkit-react-native-multichain');
569
+ OptionsController.setSdkVersion(
570
+ CoreHelperUtil.generateSdkVersion(this.adapters, ConstantsUtil.VERSION)
571
+ );
543
572
 
544
573
  if (options.clipboardClient) {
545
574
  OptionsController.setClipboardClient(options.clipboardClient);
@@ -563,8 +592,10 @@ export class AppKit {
563
592
  const activeNamespace = await StorageUtil.getActiveNamespace();
564
593
  if (activeNamespace) {
565
594
  ConnectionsController.setActiveNamespace(activeNamespace);
566
- } else if (this.defaultNetwork) {
567
- ConnectionsController.setActiveNamespace(this.defaultNetwork?.chainNamespace);
595
+ } else if (OptionsController.state.defaultNetwork) {
596
+ ConnectionsController.setActiveNamespace(
597
+ OptionsController.state.defaultNetwork?.chainNamespace
598
+ );
568
599
  }
569
600
  }
570
601
 
@@ -605,6 +636,23 @@ export class AppKit {
605
636
  OptionsController.setExcludeWalletIds(excludedWallets);
606
637
  }
607
638
 
639
+ private setCustomWallets(options: AppKitConfig) {
640
+ const { customWallets, extraConnectors, adapters } = options;
641
+
642
+ const customList = [...(customWallets ?? [])];
643
+
644
+ const addPhantom =
645
+ adapters.some(adapter => adapter.getSupportedNamespace() === 'solana') &&
646
+ extraConnectors?.some(connector => connector.type.toLowerCase() === 'phantom') &&
647
+ !customList.some(wallet => wallet.id === ConstantsUtil.PHANTOM_CUSTOM_WALLET.id);
648
+
649
+ if (addPhantom) {
650
+ customList.push(ConstantsUtil.PHANTOM_CUSTOM_WALLET);
651
+ }
652
+
653
+ OptionsController.setCustomWallets(customList);
654
+ }
655
+
608
656
  private async initAsyncValues(options: AppKitConfig) {
609
657
  await this.initActiveNamespace();
610
658
  await this.initRecentWallets(options);
@@ -3,9 +3,9 @@ import {
3
3
  AccountController,
4
4
  CoreHelperUtil,
5
5
  ModalController,
6
- AssetUtil,
7
6
  ThemeController,
8
- ConnectionsController
7
+ ConnectionsController,
8
+ AssetController
9
9
  } from '@reown/appkit-core-react-native';
10
10
 
11
11
  import { AccountButton as AccountButtonUI, ThemeProvider } from '@reown/appkit-ui-react-native';
@@ -22,13 +22,14 @@ export interface AccountButtonProps {
22
22
  export function AccountButton({ balance, disabled, style, testID }: AccountButtonProps) {
23
23
  const { profileImage, profileName } = useSnapshot(AccountController.state);
24
24
  const { themeMode, themeVariables } = useSnapshot(ThemeController.state);
25
+ const { networkImages } = useSnapshot(AssetController.state);
25
26
  const {
26
27
  activeAddress: address,
27
28
  activeBalance,
28
29
  activeNetwork
29
30
  } = useSnapshot(ConnectionsController.state);
30
31
 
31
- const networkImage = AssetUtil.getNetworkImage(activeNetwork?.id);
32
+ const networkImage = activeNetwork ? networkImages[activeNetwork.id] : undefined;
32
33
  const showBalance = balance === 'show';
33
34
 
34
35
  return (
@@ -1,7 +1,7 @@
1
1
  import { useSnapshot } from 'valtio';
2
2
  import { AccountButton, type AccountButtonProps } from '../w3m-account-button';
3
3
  import { ConnectButton, type ConnectButtonProps } from '../w3m-connect-button';
4
- import { AccountController, ModalController } from '@reown/appkit-core-react-native';
4
+ import { ConnectionsController, ModalController } from '@reown/appkit-core-react-native';
5
5
 
6
6
  export interface AppKitButtonProps {
7
7
  balance?: AccountButtonProps['balance'];
@@ -22,7 +22,7 @@ export function AppKitButton({
22
22
  accountStyle,
23
23
  connectStyle
24
24
  }: AppKitButtonProps) {
25
- const { isConnected } = useSnapshot(AccountController.state);
25
+ const { isConnected } = useSnapshot(ConnectionsController.state);
26
26
  const { loading } = useSnapshot(ModalController.state);
27
27
 
28
28
  return !loading && isConnected ? (
@@ -46,7 +46,9 @@ export function AppKit() {
46
46
 
47
47
  const handleClose = async () => {
48
48
  if (OptionsController.state.isSiweEnabled) {
49
+ const session = await SIWEController.getSession();
49
50
  if (
51
+ !session &&
50
52
  SIWEController.state.status !== 'success' &&
51
53
  ConnectionsController.state.activeNamespace === 'eip155' &&
52
54
  !!ConnectionsController.state.activeAddress
@@ -1,12 +1,12 @@
1
1
  import { useSnapshot } from 'valtio';
2
2
  import type { StyleProp, ViewStyle } from 'react-native';
3
3
  import {
4
- AccountController,
5
4
  ApiController,
6
- AssetUtil,
5
+ AssetController,
7
6
  ConnectionsController,
8
7
  EventsController,
9
8
  ModalController,
9
+ OptionsController,
10
10
  ThemeController
11
11
  } from '@reown/appkit-core-react-native';
12
12
  import { NetworkButton as NetworkButtonUI, ThemeProvider } from '@reown/appkit-ui-react-native';
@@ -17,11 +17,15 @@ export interface NetworkButtonProps {
17
17
  }
18
18
 
19
19
  export function NetworkButton({ disabled, style }: NetworkButtonProps) {
20
- const { isConnected } = useSnapshot(AccountController.state);
21
- const { activeNetwork } = useSnapshot(ConnectionsController.state);
20
+ const { activeNetwork, isConnected } = useSnapshot(ConnectionsController.state);
21
+ const { networkImages } = useSnapshot(AssetController.state);
22
+ const { defaultNetwork } = useSnapshot(OptionsController.state);
22
23
  const { loading } = useSnapshot(ModalController.state);
23
24
  const { themeMode, themeVariables } = useSnapshot(ThemeController.state);
24
25
 
26
+ const network = isConnected ? activeNetwork : defaultNetwork;
27
+ const networkImage = network ? networkImages[network.id] : undefined;
28
+
25
29
  const onNetworkPress = () => {
26
30
  ModalController.open({ view: 'Networks' });
27
31
  EventsController.sendEvent({
@@ -33,7 +37,7 @@ export function NetworkButton({ disabled, style }: NetworkButtonProps) {
33
37
  return (
34
38
  <ThemeProvider themeMode={themeMode} themeVariables={themeVariables}>
35
39
  <NetworkButtonUI
36
- imageSrc={AssetUtil.getNetworkImage(activeNetwork?.id)}
40
+ imageSrc={networkImage}
37
41
  imageHeaders={ApiController._getApiHeaders()}
38
42
  disabled={disabled || loading}
39
43
  style={style}
@@ -41,7 +45,7 @@ export function NetworkButton({ disabled, style }: NetworkButtonProps) {
41
45
  loading={loading}
42
46
  testID="network-button"
43
47
  >
44
- {activeNetwork?.name ?? (isConnected ? 'Unknown Network' : 'Select Network')}
48
+ {network?.name ?? (isConnected ? 'Unknown Network' : 'Select Network')}
45
49
  </NetworkButtonUI>
46
50
  </ThemeProvider>
47
51
  );
@@ -12,7 +12,7 @@ import {
12
12
  } from '@reown/appkit-ui-react-native';
13
13
  import { type Transaction, type TransactionImage } from '@reown/appkit-common-react-native';
14
14
  import {
15
- AssetUtil,
15
+ AssetController,
16
16
  ConnectionsController,
17
17
  ConstantsUtil,
18
18
  EventsController,
@@ -33,13 +33,19 @@ export function AccountActivity({ style }: Props) {
33
33
  const [initialLoad, setInitialLoad] = useState(true);
34
34
  const { loading, transactions, next } = useSnapshot(TransactionsController.state);
35
35
  const { activeNetwork } = useSnapshot(ConnectionsController.state);
36
- const networkImage = AssetUtil.getNetworkImage(activeNetwork?.id);
36
+ const { networkImages } = useSnapshot(AssetController.state);
37
+ const networkImage = activeNetwork ? networkImages[activeNetwork.id] : undefined;
37
38
  const isSupported =
38
39
  activeNetwork?.caipNetworkId &&
39
40
  ConstantsUtil.ACTIVITY_SUPPORTED_CHAINS.includes(activeNetwork.caipNetworkId);
40
41
 
41
42
  const handleLoadMore = () => {
42
43
  const address = ConnectionsController.state.activeAddress;
44
+
45
+ if (!address) {
46
+ return;
47
+ }
48
+
43
49
  TransactionsController.fetchTransactions(address);
44
50
  EventsController.sendEvent({
45
51
  type: 'track',
@@ -54,8 +60,13 @@ export function AccountActivity({ style }: Props) {
54
60
  };
55
61
 
56
62
  const onRefresh = useCallback(async () => {
57
- setRefreshing(true);
58
63
  const address = ConnectionsController.state.activeAddress;
64
+
65
+ if (!address) {
66
+ return;
67
+ }
68
+
69
+ setRefreshing(true);
59
70
  await TransactionsController.fetchTransactions(address, true);
60
71
  setRefreshing(false);
61
72
  }, []);
@@ -65,8 +76,8 @@ export function AccountActivity({ style }: Props) {
65
76
  }, [transactions]);
66
77
 
67
78
  useEffect(() => {
68
- if (!TransactionsController.state.transactions.length) {
69
- const address = ConnectionsController.state.activeAddress;
79
+ const address = ConnectionsController.state.activeAddress;
80
+ if (!TransactionsController.state.transactions.length && address) {
70
81
  TransactionsController.fetchTransactions(address, true);
71
82
  }
72
83
  // Set initial load to false after first fetch
@@ -8,7 +8,7 @@ import {
8
8
  } from 'react-native';
9
9
  import { useSnapshot } from 'valtio';
10
10
  import {
11
- AssetUtil,
11
+ AssetController,
12
12
  ConnectionsController,
13
13
  RouterController
14
14
  } from '@reown/appkit-core-react-native';
@@ -31,7 +31,8 @@ export function AccountTokens({ style, isLoading }: Props) {
31
31
  const Theme = useTheme();
32
32
  const [refreshing, setRefreshing] = useState(false);
33
33
  const { activeNetwork, balances } = useSnapshot(ConnectionsController.state);
34
- const networkImage = AssetUtil.getNetworkImage(activeNetwork?.id);
34
+ const { networkImages } = useSnapshot(AssetController.state);
35
+ const networkImage = activeNetwork ? networkImages[activeNetwork.id] : undefined;
35
36
 
36
37
  const getBalance = useCallback(async () => {
37
38
  setRefreshing(true);
@@ -23,10 +23,12 @@ export interface AccountWalletFeaturesProps {
23
23
  export function AccountWalletFeatures({ isBalanceLoading }: AccountWalletFeaturesProps) {
24
24
  const [activeTab, setActiveTab] = useState(0);
25
25
  const { features, isOnRampEnabled } = useSnapshot(OptionsController.state);
26
- const { activeNetwork, balances } = useSnapshot(ConnectionsController.state);
26
+ const { activeNetwork, balances, activeNamespace } = useSnapshot(ConnectionsController.state);
27
27
  const balance = CoreHelperUtil.calculateAndFormatBalance(balances as BalanceType[]);
28
28
  const network = ConnectionsController.state.activeNetwork?.caipNetworkId || '';
29
29
  const isSmartAccount = ConnectionsController.state.accountType === 'smartAccount';
30
+ const showSend =
31
+ activeNamespace && ConstantsUtil.SEND_SUPPORTED_NAMESPACES.includes(activeNamespace);
30
32
  const isSwapsEnabled =
31
33
  features?.swaps &&
32
34
  activeNetwork?.caipNetworkId &&
@@ -122,16 +124,18 @@ export function AccountWalletFeatures({ isBalanceLoading }: AccountWalletFeature
122
124
  style={[styles.action, isSwapsEnabled ? styles.actionCenter : styles.actionLeft]}
123
125
  onPress={onReceivePress}
124
126
  />
125
- <IconLink
126
- icon="paperplane"
127
- size="lg"
128
- iconColor="accent-100"
129
- background
130
- backgroundColor="accent-glass-010"
131
- pressedColor="accent-glass-020"
132
- style={[styles.action, styles.actionRight]}
133
- onPress={onSendPress}
134
- />
127
+ {showSend && (
128
+ <IconLink
129
+ icon="paperplane"
130
+ size="lg"
131
+ iconColor="accent-100"
132
+ background
133
+ backgroundColor="accent-glass-010"
134
+ pressedColor="accent-glass-020"
135
+ style={[styles.action, styles.actionRight]}
136
+ onPress={onSendPress}
137
+ />
138
+ )}
135
139
  </FlexView>
136
140
  <FlexView style={styles.tab}>
137
141
  <Tabs tabs={['Tokens', 'Activity']} onTabChange={onTabChange} />
@@ -13,7 +13,7 @@ import {
13
13
  useTheme
14
14
  } from '@reown/appkit-ui-react-native';
15
15
  import styles from './styles';
16
- import { AssetUtil, ConnectionsController } from '@reown/appkit-core-react-native';
16
+ import { AssetController, ConnectionsController } from '@reown/appkit-core-react-native';
17
17
 
18
18
  interface SelectorModalProps {
19
19
  title?: string;
@@ -46,7 +46,8 @@ export function SelectorModal({
46
46
  }: SelectorModalProps) {
47
47
  const Theme = useTheme();
48
48
  const { activeNetwork } = useSnapshot(ConnectionsController.state);
49
- const networkImage = AssetUtil.getNetworkImage(activeNetwork?.id);
49
+ const { networkImages } = useSnapshot(AssetController.state);
50
+ const networkImage = activeNetwork ? networkImages[activeNetwork.id] : undefined;
50
51
 
51
52
  const renderSeparator = () => {
52
53
  return <View style={{ height: SEPARATOR_HEIGHT }} />;
@@ -1,8 +1,15 @@
1
1
  import { useRef, useState } from 'react';
2
2
  import { TextInput, type StyleProp, type ViewStyle } from 'react-native';
3
- import { FlexView, Link, Text, useTheme, TokenButton } from '@reown/appkit-ui-react-native';
3
+ import {
4
+ FlexView,
5
+ Link,
6
+ Text,
7
+ useTheme,
8
+ TokenButton,
9
+ Shimmer
10
+ } from '@reown/appkit-ui-react-native';
4
11
  import { NumberUtil, type Balance } from '@reown/appkit-common-react-native';
5
- import { ConstantsUtil, SendController } from '@reown/appkit-core-react-native';
12
+ import { SendController } from '@reown/appkit-core-react-native';
6
13
 
7
14
  import { getMaxAmount, getSendValue } from './utils';
8
15
  import styles from './styles';
@@ -10,17 +17,17 @@ import styles from './styles';
10
17
  export interface SendInputTokenProps {
11
18
  token?: Balance;
12
19
  sendTokenAmount?: number;
13
- gasPrice?: number;
14
20
  style?: StyleProp<ViewStyle>;
15
21
  onTokenPress?: () => void;
22
+ loading?: boolean;
16
23
  }
17
24
 
18
25
  export function SendInputToken({
19
26
  token,
20
27
  sendTokenAmount,
21
- gasPrice,
22
28
  style,
23
- onTokenPress
29
+ onTokenPress,
30
+ loading
24
31
  }: SendInputTokenProps) {
25
32
  const Theme = useTheme();
26
33
  const valueInputRef = useRef<TextInput | null>(null);
@@ -39,26 +46,17 @@ export function SendInputToken({
39
46
  };
40
47
 
41
48
  const onMaxPress = () => {
42
- if (token?.quantity?.numeric && gasPrice) {
43
- const isNetworkToken =
44
- token.address === undefined ||
45
- Object.values(ConstantsUtil.NATIVE_TOKEN_ADDRESS).some(
46
- nativeAddress => token?.address?.split(':')[2] === nativeAddress
47
- );
48
-
49
- const numericGas = NumberUtil.bigNumber(gasPrice).shiftedBy(-token.quantity.decimals);
50
-
51
- const maxValue = isNetworkToken
52
- ? NumberUtil.bigNumber(token.quantity.numeric).minus(numericGas)
53
- : NumberUtil.bigNumber(token.quantity.numeric);
54
-
49
+ if (token?.quantity?.numeric) {
50
+ const maxValue = NumberUtil.bigNumber(token.quantity.numeric);
55
51
  SendController.setTokenAmount(Number(maxValue.toFixed(20)));
56
52
  setInputValue(maxValue.toFixed(20));
57
53
  valueInputRef.current?.blur();
58
54
  }
59
55
  };
60
56
 
61
- return (
57
+ return loading ? (
58
+ <Shimmer width="100%" height={100} borderRadius={16} style={styles.inputLoading} />
59
+ ) : (
62
60
  <FlexView
63
61
  style={[
64
62
  styles.container,
@@ -16,5 +16,8 @@ export default StyleSheet.create({
16
16
  sendValue: {
17
17
  flex: 1,
18
18
  marginRight: Spacing.xs
19
+ },
20
+ inputLoading: {
21
+ marginBottom: Spacing.xs
19
22
  }
20
23
  });
@@ -1,5 +1,6 @@
1
1
  import { ConstantsUtil } from '@reown/appkit-common-react-native';
2
2
  import type { AppKitNetwork, CaipNetworkId, Network } from '@reown/appkit-common-react-native';
3
+ import type { CaipNamespaces } from '@reown/appkit-core-react-native';
3
4
 
4
5
  export const NetworkUtil = {
5
6
  formatNetwork(network: Network, projectId: string): AppKitNetwork {
@@ -37,17 +38,19 @@ export const NetworkUtil = {
37
38
  return url.toString();
38
39
  },
39
40
 
40
- getDefaultChainId(network?: AppKitNetwork): CaipNetworkId | undefined {
41
- if (!network) return undefined;
42
-
43
- if (network.caipNetworkId) {
44
- return network.caipNetworkId;
45
- }
46
-
47
- if (network.chainNamespace) {
48
- return `${network.chainNamespace}:${network.id}`;
41
+ getDefaultChainId(
42
+ namespaces: CaipNamespaces,
43
+ defaultNetwork?: AppKitNetwork
44
+ ): CaipNetworkId | undefined {
45
+ if (!defaultNetwork) return undefined;
46
+
47
+ const isValidDefaultNetwork = Object.values(namespaces).some(
48
+ namespace => namespace?.chains?.some(chain => chain === defaultNetwork.caipNetworkId)
49
+ );
50
+ if (isValidDefaultNetwork) {
51
+ return defaultNetwork.caipNetworkId;
49
52
  }
50
53
 
51
- return `eip155:${network.id}`;
54
+ return undefined;
52
55
  }
53
56
  };
@@ -4,7 +4,6 @@ import { Linking, ScrollView } from 'react-native';
4
4
  import {
5
5
  AccountController,
6
6
  ApiController,
7
- AssetUtil,
8
7
  CoreHelperUtil,
9
8
  EventsController,
10
9
  ModalController,
@@ -14,7 +13,8 @@ import {
14
13
  ConstantsUtil,
15
14
  SwapController,
16
15
  OnRampController,
17
- ConnectionsController
16
+ ConnectionsController,
17
+ AssetController
18
18
  } from '@reown/appkit-core-react-native';
19
19
  // import { ConstantsUtil as CommonConstantsUtil } from '@reown/appkit-common-react-native';
20
20
  import {
@@ -50,7 +50,8 @@ export function AccountDefaultView() {
50
50
  const [disconnecting, setDisconnecting] = useState(false);
51
51
  const { features, isOnRampEnabled } = useSnapshot(OptionsController.state);
52
52
  const { history } = useSnapshot(RouterController.state);
53
- const networkImage = AssetUtil.getNetworkImage(activeNetwork?.id);
53
+ const { networkImages } = useSnapshot(AssetController.state);
54
+ const networkImage = activeNetwork ? networkImages[activeNetwork.id] : undefined;
54
55
  const showCopy = OptionsController.isClipboardAvailable();
55
56
  const isAuth = !!connection?.properties?.provider;
56
57
  const showBalance = balance && !isAuth;
@@ -66,6 +67,10 @@ export function AccountDefaultView() {
66
67
  features?.swaps &&
67
68
  activeNetwork?.caipNetworkId &&
68
69
  ConstantsUtil.SWAP_SUPPORTED_NETWORKS.includes(activeNetwork.caipNetworkId);
70
+
71
+ const showSend =
72
+ !isAuth && activeNamespace && ConstantsUtil.SEND_SUPPORTED_NAMESPACES.includes(activeNamespace);
73
+
69
74
  const { padding } = useCustomDimensions();
70
75
 
71
76
  async function onDisconnect() {
@@ -96,7 +101,7 @@ export function AccountDefaultView() {
96
101
  const onCopyAddress = () => {
97
102
  //TODO: Check ENS name
98
103
  if (OptionsController.isClipboardAvailable() && ConnectionsController.state.activeAddress) {
99
- const _address = ConnectionsController.state.activeAddress.split(':')[2];
104
+ const _address = CoreHelperUtil.getPlainAddress(ConnectionsController.state.activeAddress);
100
105
  if (_address) {
101
106
  OptionsController.copyToClipboard(_address);
102
107
  SnackController.showSuccess('Address copied');
@@ -145,6 +150,18 @@ export function AccountDefaultView() {
145
150
  RouterController.push('UpgradeEmailWallet');
146
151
  };
147
152
 
153
+ const onSendPress = () => {
154
+ const network = ConnectionsController.state.activeNetwork?.caipNetworkId || '';
155
+ const isSmartAccount = ConnectionsController.state.accountType === 'smartAccount';
156
+
157
+ EventsController.sendEvent({
158
+ type: 'track',
159
+ event: 'OPEN_SEND',
160
+ properties: { network, isSmartAccount }
161
+ });
162
+ RouterController.push('WalletSend');
163
+ };
164
+
148
165
  const onEmailPress = async () => {
149
166
  // TODO: Uncomment when email update is enabled
150
167
  // const email = ConnectionsController.state.connection?.properties?.email;
@@ -259,6 +276,19 @@ export function AccountDefaultView() {
259
276
  <Text color="fg-100">Buy crypto</Text>
260
277
  </ListItem>
261
278
  )}
279
+ {showSend && (
280
+ <ListItem
281
+ chevron
282
+ icon="paperplane"
283
+ iconColor="accent-100"
284
+ iconBackgroundColor="accent-glass-015"
285
+ onPress={onSendPress}
286
+ testID="button-send"
287
+ style={styles.actionButton}
288
+ >
289
+ <Text color="fg-100">Send</Text>
290
+ </ListItem>
291
+ )}
262
292
  {showSwaps && (
263
293
  <ListItem
264
294
  chevron