@reown/appkit-core-react-native 0.0.0-feat-onramp-20250626173252 → 0.0.0-feat-multi-social-20250630195637

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 (166) hide show
  1. package/lib/commonjs/controllers/ApiController.js +11 -11
  2. package/lib/commonjs/controllers/ApiController.js.map +1 -1
  3. package/lib/commonjs/controllers/BlockchainApiController.js +102 -24
  4. package/lib/commonjs/controllers/BlockchainApiController.js.map +1 -1
  5. package/lib/commonjs/controllers/ConnectionController.js +7 -5
  6. package/lib/commonjs/controllers/ConnectionController.js.map +1 -1
  7. package/lib/commonjs/controllers/ConnectionsController.js +217 -0
  8. package/lib/commonjs/controllers/ConnectionsController.js.map +1 -0
  9. package/lib/commonjs/controllers/ConnectorController.js +1 -0
  10. package/lib/commonjs/controllers/ConnectorController.js.map +1 -1
  11. package/lib/commonjs/controllers/EnsController.js +4 -4
  12. package/lib/commonjs/controllers/EnsController.js.map +1 -1
  13. package/lib/commonjs/controllers/EventsController.js +4 -4
  14. package/lib/commonjs/controllers/EventsController.js.map +1 -1
  15. package/lib/commonjs/controllers/ModalController.js.map +1 -1
  16. package/lib/commonjs/controllers/OnRampController.js +20 -60
  17. package/lib/commonjs/controllers/OnRampController.js.map +1 -1
  18. package/lib/commonjs/controllers/OptionsController.js +8 -3
  19. package/lib/commonjs/controllers/OptionsController.js.map +1 -1
  20. package/lib/commonjs/controllers/RouterController.js.map +1 -1
  21. package/lib/commonjs/controllers/SendController.js +10 -10
  22. package/lib/commonjs/controllers/SendController.js.map +1 -1
  23. package/lib/commonjs/controllers/SwapController.js +51 -40
  24. package/lib/commonjs/controllers/SwapController.js.map +1 -1
  25. package/lib/commonjs/controllers/ThemeController.js +9 -1
  26. package/lib/commonjs/controllers/ThemeController.js.map +1 -1
  27. package/lib/commonjs/controllers/TransactionsController.js +5 -5
  28. package/lib/commonjs/controllers/TransactionsController.js.map +1 -1
  29. package/lib/commonjs/index.js +3 -10
  30. package/lib/commonjs/index.js.map +1 -1
  31. package/lib/commonjs/utils/AssetUtil.js +5 -6
  32. package/lib/commonjs/utils/AssetUtil.js.map +1 -1
  33. package/lib/commonjs/utils/ConstantsUtil.js +537 -8
  34. package/lib/commonjs/utils/ConstantsUtil.js.map +1 -1
  35. package/lib/commonjs/utils/CoreHelperUtil.js +3 -3
  36. package/lib/commonjs/utils/CoreHelperUtil.js.map +1 -1
  37. package/lib/commonjs/utils/StorageUtil.js +67 -33
  38. package/lib/commonjs/utils/StorageUtil.js.map +1 -1
  39. package/lib/commonjs/utils/SwapApiUtil.js +19 -10
  40. package/lib/commonjs/utils/SwapApiUtil.js.map +1 -1
  41. package/lib/module/controllers/ApiController.js +11 -11
  42. package/lib/module/controllers/ApiController.js.map +1 -1
  43. package/lib/module/controllers/BlockchainApiController.js +102 -24
  44. package/lib/module/controllers/BlockchainApiController.js.map +1 -1
  45. package/lib/module/controllers/ConnectionController.js +7 -5
  46. package/lib/module/controllers/ConnectionController.js.map +1 -1
  47. package/lib/module/controllers/ConnectionsController.js +212 -0
  48. package/lib/module/controllers/ConnectionsController.js.map +1 -0
  49. package/lib/module/controllers/ConnectorController.js +1 -0
  50. package/lib/module/controllers/ConnectorController.js.map +1 -1
  51. package/lib/module/controllers/EnsController.js +2 -2
  52. package/lib/module/controllers/EnsController.js.map +1 -1
  53. package/lib/module/controllers/EventsController.js +1 -1
  54. package/lib/module/controllers/EventsController.js.map +1 -1
  55. package/lib/module/controllers/ModalController.js.map +1 -1
  56. package/lib/module/controllers/OnRampController.js +20 -60
  57. package/lib/module/controllers/OnRampController.js.map +1 -1
  58. package/lib/module/controllers/OptionsController.js +8 -3
  59. package/lib/module/controllers/OptionsController.js.map +1 -1
  60. package/lib/module/controllers/RouterController.js.map +1 -1
  61. package/lib/module/controllers/SendController.js +7 -7
  62. package/lib/module/controllers/SendController.js.map +1 -1
  63. package/lib/module/controllers/SwapController.js +51 -40
  64. package/lib/module/controllers/SwapController.js.map +1 -1
  65. package/lib/module/controllers/ThemeController.js +9 -1
  66. package/lib/module/controllers/ThemeController.js.map +1 -1
  67. package/lib/module/controllers/TransactionsController.js +3 -3
  68. package/lib/module/controllers/TransactionsController.js.map +1 -1
  69. package/lib/module/index.js +1 -2
  70. package/lib/module/index.js.map +1 -1
  71. package/lib/module/utils/AssetUtil.js +5 -6
  72. package/lib/module/utils/AssetUtil.js.map +1 -1
  73. package/lib/module/utils/ConstantsUtil.js +537 -8
  74. package/lib/module/utils/ConstantsUtil.js.map +1 -1
  75. package/lib/module/utils/CoreHelperUtil.js +3 -3
  76. package/lib/module/utils/CoreHelperUtil.js.map +1 -1
  77. package/lib/module/utils/StorageUtil.js +67 -33
  78. package/lib/module/utils/StorageUtil.js.map +1 -1
  79. package/lib/module/utils/SwapApiUtil.js +19 -10
  80. package/lib/module/utils/SwapApiUtil.js.map +1 -1
  81. package/lib/typescript/controllers/AccountController.d.ts +2 -2
  82. package/lib/typescript/controllers/AccountController.d.ts.map +1 -1
  83. package/lib/typescript/controllers/ApiController.d.ts +1 -1
  84. package/lib/typescript/controllers/ApiController.d.ts.map +1 -1
  85. package/lib/typescript/controllers/BlockchainApiController.d.ts +15 -3
  86. package/lib/typescript/controllers/BlockchainApiController.d.ts.map +1 -1
  87. package/lib/typescript/controllers/ConnectionController.d.ts +2 -2
  88. package/lib/typescript/controllers/ConnectionController.d.ts.map +1 -1
  89. package/lib/typescript/controllers/ConnectionsController.d.ts +44 -0
  90. package/lib/typescript/controllers/ConnectionsController.d.ts.map +1 -0
  91. package/lib/typescript/controllers/ConnectorController.d.ts.map +1 -1
  92. package/lib/typescript/controllers/ModalController.d.ts +1 -1
  93. package/lib/typescript/controllers/ModalController.d.ts.map +1 -1
  94. package/lib/typescript/controllers/NetworkController.d.ts +1 -1
  95. package/lib/typescript/controllers/NetworkController.d.ts.map +1 -1
  96. package/lib/typescript/controllers/OnRampController.d.ts +1 -3
  97. package/lib/typescript/controllers/OnRampController.d.ts.map +1 -1
  98. package/lib/typescript/controllers/OptionsController.d.ts +5 -2
  99. package/lib/typescript/controllers/OptionsController.d.ts.map +1 -1
  100. package/lib/typescript/controllers/PublicStateController.d.ts +1 -1
  101. package/lib/typescript/controllers/PublicStateController.d.ts.map +1 -1
  102. package/lib/typescript/controllers/RouterController.d.ts +4 -2
  103. package/lib/typescript/controllers/RouterController.d.ts.map +1 -1
  104. package/lib/typescript/controllers/SwapController.d.ts +1 -1
  105. package/lib/typescript/controllers/SwapController.d.ts.map +1 -1
  106. package/lib/typescript/controllers/ThemeController.d.ts +1 -1
  107. package/lib/typescript/controllers/ThemeController.d.ts.map +1 -1
  108. package/lib/typescript/index.d.ts +1 -2
  109. package/lib/typescript/index.d.ts.map +1 -1
  110. package/lib/typescript/utils/AssetUtil.d.ts +2 -2
  111. package/lib/typescript/utils/AssetUtil.d.ts.map +1 -1
  112. package/lib/typescript/utils/ConstantsUtil.d.ts +421 -1
  113. package/lib/typescript/utils/ConstantsUtil.d.ts.map +1 -1
  114. package/lib/typescript/utils/CoreHelperUtil.d.ts +3 -3
  115. package/lib/typescript/utils/CoreHelperUtil.d.ts.map +1 -1
  116. package/lib/typescript/utils/FetchUtil.d.ts +1 -1
  117. package/lib/typescript/utils/FetchUtil.d.ts.map +1 -1
  118. package/lib/typescript/utils/NetworkUtil.d.ts +1 -1
  119. package/lib/typescript/utils/NetworkUtil.d.ts.map +1 -1
  120. package/lib/typescript/utils/StorageUtil.d.ts +14 -4
  121. package/lib/typescript/utils/StorageUtil.d.ts.map +1 -1
  122. package/lib/typescript/utils/SwapApiUtil.d.ts.map +1 -1
  123. package/lib/typescript/utils/TypeUtil.d.ts +8 -40
  124. package/lib/typescript/utils/TypeUtil.d.ts.map +1 -1
  125. package/package.json +4 -4
  126. package/src/controllers/AccountController.ts +2 -2
  127. package/src/controllers/ApiController.ts +12 -7
  128. package/src/controllers/BlockchainApiController.ts +135 -27
  129. package/src/controllers/ConnectionController.ts +10 -8
  130. package/src/controllers/ConnectionsController.ts +309 -0
  131. package/src/controllers/ConnectorController.ts +1 -0
  132. package/src/controllers/EnsController.ts +2 -2
  133. package/src/controllers/EventsController.ts +1 -1
  134. package/src/controllers/ModalController.ts +2 -1
  135. package/src/controllers/NetworkController.ts +1 -1
  136. package/src/controllers/OnRampController.ts +32 -91
  137. package/src/controllers/OptionsController.ts +14 -13
  138. package/src/controllers/PublicStateController.ts +1 -1
  139. package/src/controllers/RouterController.ts +3 -3
  140. package/src/controllers/SendController.ts +7 -7
  141. package/src/controllers/SwapController.ts +58 -48
  142. package/src/controllers/ThemeController.ts +11 -2
  143. package/src/controllers/TransactionsController.ts +3 -3
  144. package/src/index.ts +5 -2
  145. package/src/utils/AssetUtil.ts +5 -7
  146. package/src/utils/ConstantsUtil.ts +542 -8
  147. package/src/utils/CoreHelperUtil.ts +14 -6
  148. package/src/utils/FetchUtil.ts +1 -1
  149. package/src/utils/NetworkUtil.ts +1 -1
  150. package/src/utils/StorageUtil.ts +82 -39
  151. package/src/utils/SwapApiUtil.ts +22 -10
  152. package/src/utils/TypeUtil.ts +13 -48
  153. package/lib/commonjs/controllers/WebviewController.js +0 -52
  154. package/lib/commonjs/controllers/WebviewController.js.map +0 -1
  155. package/lib/commonjs/utils/ConnectionUtil.js +0 -33
  156. package/lib/commonjs/utils/ConnectionUtil.js.map +0 -1
  157. package/lib/module/controllers/WebviewController.js +0 -47
  158. package/lib/module/controllers/WebviewController.js.map +0 -1
  159. package/lib/module/utils/ConnectionUtil.js +0 -27
  160. package/lib/module/utils/ConnectionUtil.js.map +0 -1
  161. package/lib/typescript/controllers/WebviewController.d.ts +0 -21
  162. package/lib/typescript/controllers/WebviewController.d.ts.map +0 -1
  163. package/lib/typescript/utils/ConnectionUtil.d.ts +0 -4
  164. package/lib/typescript/utils/ConnectionUtil.d.ts.map +0 -1
  165. package/src/controllers/WebviewController.ts +0 -63
  166. package/src/utils/ConnectionUtil.ts +0 -27
@@ -2,7 +2,6 @@
2
2
  import AsyncStorage from '@react-native-async-storage/async-storage';
3
3
  import type {
4
4
  OnRampCountry,
5
- OnRampCountryDefaults,
6
5
  OnRampFiatCurrency,
7
6
  OnRampFiatLimit,
8
7
  OnRampServiceProvider,
@@ -11,7 +10,9 @@ import type {
11
10
  import {
12
11
  DateUtil,
13
12
  type SocialProvider,
14
- type ConnectorType
13
+ type New_ConnectorType,
14
+ type ConnectorType,
15
+ type ChainNamespace
15
16
  } from '@reown/appkit-common-react-native';
16
17
 
17
18
  // -- Helpers -----------------------------------------------------------------
@@ -19,14 +20,16 @@ const WC_DEEPLINK = 'WALLETCONNECT_DEEPLINK_CHOICE';
19
20
  const RECENT_WALLET = '@w3m/recent';
20
21
  const CONNECTED_WALLET_IMAGE_URL = '@w3m/connected_wallet_image_url';
21
22
  const CONNECTED_CONNECTOR = '@w3m/connected_connector';
23
+ const CONNECTED_CONNECTORS = '@appkit/connected_connectors';
22
24
  const CONNECTED_SOCIAL = '@appkit/connected_social';
23
25
  const ONRAMP_PREFERRED_COUNTRY = '@appkit/onramp_preferred_country';
24
26
  const ONRAMP_COUNTRIES = '@appkit/onramp_countries';
25
- const ONRAMP_COUNTRIES_DEFAULTS = '@appkit/onramp_countries_defaults';
26
27
  const ONRAMP_SERVICE_PROVIDERS = '@appkit/onramp_service_providers';
27
28
  const ONRAMP_FIAT_LIMITS = '@appkit/onramp_fiat_limits';
28
29
  const ONRAMP_FIAT_CURRENCIES = '@appkit/onramp_fiat_currencies';
29
30
  const ONRAMP_PREFERRED_FIAT_CURRENCY = '@appkit/onramp_preferred_fiat_currency';
31
+ const ACTIVE_NAMESPACE = '@appkit/active_namespace';
32
+
30
33
  // -- Utility -----------------------------------------------------------------
31
34
  export const StorageUtil = {
32
35
  setWalletConnectDeepLink({ href, name }: { href: string; name: string }) {
@@ -101,6 +104,7 @@ export const StorageUtil = {
101
104
  return [];
102
105
  },
103
106
 
107
+ //TODO: remove this
104
108
  async setConnectedConnector(connectorType: ConnectorType) {
105
109
  try {
106
110
  await AsyncStorage.setItem(CONNECTED_CONNECTOR, JSON.stringify(connectorType));
@@ -129,6 +133,47 @@ export const StorageUtil = {
129
133
  }
130
134
  },
131
135
 
136
+ async setConnectedConnectors({
137
+ type,
138
+ namespaces
139
+ }: {
140
+ type: New_ConnectorType;
141
+ namespaces: string[];
142
+ }) {
143
+ try {
144
+ const currentConnectors = (await StorageUtil.getConnectedConnectors()) || [];
145
+ // Only add if it doesn't exist already
146
+ if (!currentConnectors.some(c => c.type === type)) {
147
+ const updatedConnectors = [...currentConnectors, { type, namespaces }];
148
+ await AsyncStorage.setItem(CONNECTED_CONNECTORS, JSON.stringify(updatedConnectors));
149
+ }
150
+ } catch {
151
+ console.info('Unable to set Connected Connector');
152
+ }
153
+ },
154
+
155
+ async getConnectedConnectors(): Promise<{ type: New_ConnectorType; namespaces: string[] }[]> {
156
+ try {
157
+ const connectors = await AsyncStorage.getItem(CONNECTED_CONNECTORS);
158
+
159
+ return connectors ? JSON.parse(connectors) : [];
160
+ } catch {
161
+ console.info('Unable to get Connected Connector');
162
+ }
163
+
164
+ return [];
165
+ },
166
+
167
+ async removeConnectedConnectors(type: New_ConnectorType) {
168
+ try {
169
+ const currentConnectors = await StorageUtil.getConnectedConnectors();
170
+ const updatedConnectors = currentConnectors.filter(c => c.type !== type);
171
+ await AsyncStorage.setItem(CONNECTED_CONNECTORS, JSON.stringify(updatedConnectors));
172
+ } catch {
173
+ console.info('Unable to remove Connected Connector');
174
+ }
175
+ },
176
+
132
177
  async setConnectedWalletImageUrl(url: string) {
133
178
  try {
134
179
  await AsyncStorage.setItem(CONNECTED_WALLET_IMAGE_URL, url);
@@ -243,42 +288,6 @@ export const StorageUtil = {
243
288
  return [];
244
289
  },
245
290
 
246
- async setOnRampCountriesDefaults(countriesDefaults: OnRampCountryDefaults[]) {
247
- try {
248
- const timestamp = Date.now();
249
-
250
- await AsyncStorage.setItem(
251
- ONRAMP_COUNTRIES_DEFAULTS,
252
- JSON.stringify({ data: countriesDefaults, timestamp })
253
- );
254
- } catch {
255
- console.info('Unable to set OnRamp Countries Defaults');
256
- }
257
- },
258
-
259
- async getOnRampCountriesDefaults() {
260
- try {
261
- const result = await AsyncStorage.getItem(ONRAMP_COUNTRIES_DEFAULTS);
262
-
263
- if (!result) {
264
- return [];
265
- }
266
-
267
- const { data, timestamp } = JSON.parse(result);
268
-
269
- // Cache for 1 week
270
- if (timestamp && DateUtil.isMoreThanOneWeekAgo(timestamp)) {
271
- return [];
272
- }
273
-
274
- return data ? (data as OnRampCountryDefaults[]) : [];
275
- } catch {
276
- console.info('Unable to get OnRamp Countries Defaults');
277
- }
278
-
279
- return [];
280
- },
281
-
282
291
  async setOnRampServiceProviders(serviceProviders: OnRampServiceProvider[]) {
283
292
  try {
284
293
  const timestamp = Date.now();
@@ -386,5 +395,39 @@ export const StorageUtil = {
386
395
  }
387
396
 
388
397
  return [];
398
+ },
399
+
400
+ async setActiveNamespace(namespace?: ChainNamespace) {
401
+ try {
402
+ if (!namespace) {
403
+ await AsyncStorage.removeItem(ACTIVE_NAMESPACE);
404
+
405
+ return;
406
+ }
407
+
408
+ await AsyncStorage.setItem(ACTIVE_NAMESPACE, namespace);
409
+ } catch {
410
+ console.info('Unable to set Active Namespace');
411
+ }
412
+ },
413
+
414
+ async getActiveNamespace() {
415
+ try {
416
+ const namespace = (await AsyncStorage.getItem(ACTIVE_NAMESPACE)) as ChainNamespace;
417
+
418
+ return namespace ?? undefined;
419
+ } catch (err) {
420
+ console.info('Unable to get Active Namespace');
421
+ }
422
+
423
+ return undefined;
424
+ },
425
+
426
+ async removeActiveNamespace() {
427
+ try {
428
+ await AsyncStorage.removeItem(ACTIVE_NAMESPACE);
429
+ } catch {
430
+ console.info('Unable to remove Active Namespace');
431
+ }
389
432
  }
390
433
  };
@@ -1,19 +1,22 @@
1
1
  import { BlockchainApiController } from '../controllers/BlockchainApiController';
2
2
  import { OptionsController } from '../controllers/OptionsController';
3
- import { NetworkController } from '../controllers/NetworkController';
4
3
  import type {
5
4
  BlockchainApiBalanceResponse,
6
5
  BlockchainApiSwapAllowanceRequest,
7
6
  SwapTokenWithBalance
8
7
  } from './TypeUtil';
9
8
  import { AccountController } from '../controllers/AccountController';
10
- import { ConnectionController } from '../controllers/ConnectionController';
9
+ import { ConnectionsController } from '../controllers/ConnectionsController';
10
+ import type { CaipNetworkId } from '@reown/appkit-common-react-native';
11
+ import { ConstantsUtil } from './ConstantsUtil';
11
12
 
12
13
  export const SwapApiUtil = {
13
14
  async getTokenList() {
15
+ const chainId: CaipNetworkId =
16
+ ConnectionsController.state.activeNetwork?.caipNetworkId ?? 'eip155:1';
14
17
  const response = await BlockchainApiController.fetchSwapTokens({
15
18
  projectId: OptionsController.state.projectId,
16
- chainId: NetworkController.state.caipNetwork?.id
19
+ chainId
17
20
  });
18
21
  const tokens =
19
22
  response?.tokens?.map(
@@ -52,7 +55,7 @@ export const SwapApiUtil = {
52
55
 
53
56
  if (response?.allowance && sourceTokenAmount && sourceTokenDecimals) {
54
57
  const parsedValue =
55
- ConnectionController.parseUnits(sourceTokenAmount, sourceTokenDecimals) || 0;
58
+ ConnectionsController.parseUnits(sourceTokenAmount, sourceTokenDecimals) || 0;
56
59
  const hasAllowance = BigInt(response.allowance) >= parsedValue;
57
60
 
58
61
  return hasAllowance;
@@ -62,14 +65,18 @@ export const SwapApiUtil = {
62
65
  },
63
66
 
64
67
  async getMyTokensWithBalance(forceUpdate?: string) {
65
- const address = AccountController.state.address;
66
- const chainId = NetworkController.state.caipNetwork?.id;
68
+ const { activeAddress, activeNetwork: network } = ConnectionsController.state;
69
+ const address = activeAddress?.split(':')[2];
67
70
 
68
71
  if (!address) {
69
72
  return [];
70
73
  }
71
74
 
72
- const response = await BlockchainApiController.getBalance(address, chainId, forceUpdate);
75
+ const response = await BlockchainApiController.getBalance(
76
+ address,
77
+ network?.caipNetworkId,
78
+ forceUpdate
79
+ );
73
80
  const balances = response?.balances.filter(balance => balance.quantity.decimals !== '0');
74
81
 
75
82
  AccountController.setTokenBalance(balances);
@@ -78,12 +85,17 @@ export const SwapApiUtil = {
78
85
  },
79
86
 
80
87
  mapBalancesToSwapTokens(balances?: BlockchainApiBalanceResponse['balances']) {
88
+ const { activeNamespace, activeCaipNetworkId } = ConnectionsController.state;
89
+ const address = activeNamespace
90
+ ? ConstantsUtil.NATIVE_TOKEN_ADDRESS[activeNamespace]
91
+ : undefined;
92
+
81
93
  return (
82
94
  balances?.map(
83
95
  token =>
84
96
  ({
85
97
  ...token,
86
- address: token?.address || NetworkController.getActiveNetworkTokenAddress(),
98
+ address: token?.address ?? `${token?.chainId ?? activeCaipNetworkId}:${address}`,
87
99
  decimals: parseInt(token.quantity.decimals, 10),
88
100
  logoUri: token.iconUrl,
89
101
  eip2612: false
@@ -94,7 +106,7 @@ export const SwapApiUtil = {
94
106
 
95
107
  async fetchGasPrice() {
96
108
  const projectId = OptionsController.state.projectId;
97
- const caipNetwork = NetworkController.state.caipNetwork;
109
+ const caipNetwork = ConnectionsController.state.activeNetwork;
98
110
 
99
111
  if (!caipNetwork) {
100
112
  return null;
@@ -102,7 +114,7 @@ export const SwapApiUtil = {
102
114
 
103
115
  return await BlockchainApiController.fetchGasPrice({
104
116
  projectId,
105
- chainId: caipNetwork.id
117
+ chainId: caipNetwork.caipNetworkId
106
118
  });
107
119
  }
108
120
  };
@@ -1,28 +1,21 @@
1
1
  import { type EventEmitter } from 'events';
2
+ import type { CaipAddress, CaipNetworkId } from '@reown/appkit-common-react-native';
3
+
2
4
  import type {
3
5
  Balance,
4
6
  SocialProvider,
5
7
  ThemeMode,
6
8
  Transaction,
7
- ConnectorType
9
+ ConnectorType,
10
+ Metadata
8
11
  } from '@reown/appkit-common-react-native';
12
+
9
13
  import { OnRampErrorType } from './ConstantsUtil';
10
14
 
11
15
  export interface BaseError {
12
16
  message?: string;
13
17
  }
14
18
 
15
- export type CaipAddress = `${string}:${string}:${string}`;
16
-
17
- export type CaipNetworkId = `${string}:${string}`;
18
-
19
- export interface CaipNetwork {
20
- id: CaipNetworkId;
21
- name?: string;
22
- imageId?: string;
23
- imageUrl?: string;
24
- }
25
-
26
19
  export type ConnectedWalletInfo =
27
20
  | {
28
21
  name?: string;
@@ -71,12 +64,13 @@ export type CaipNamespaces = Record<
71
64
 
72
65
  export type SdkType = 'appkit';
73
66
 
67
+ //TODO: check this
74
68
  export type SdkVersion =
75
69
  | `react-native-wagmi-${string}`
76
70
  | `react-native-ethers5-${string}`
77
71
  | `react-native-ethers-${string}`;
78
72
 
79
- type EnabledSocials = Exclude<SocialProvider, 'farcaster'>;
73
+ type EnabledSocials = SocialProvider;
80
74
 
81
75
  export type Features = {
82
76
  /**
@@ -90,15 +84,10 @@ export type Features = {
90
84
  */
91
85
  onramp?: boolean;
92
86
  /**
93
- * @description Enable or disable the email feature. Enabled by default.
94
- * @type {boolean}
95
- */
96
- email?: boolean;
97
- /**
98
- * @description Show or hide the regular wallet options when email is enabled. Enabled by default.
87
+ * @description Show or hide the regular wallet options when socials are enabled. Enabled by default.
99
88
  * @type {boolean}
100
89
  */
101
- emailShowWallets?: boolean;
90
+ showWallets?: boolean;
102
91
  /**
103
92
  * @description Enable or disable the socials feature. Enabled by default.
104
93
  * @type {EnabledSocials[]}
@@ -179,6 +168,7 @@ export interface BlockchainApiTransactionsRequest {
179
168
  onramp?: 'coinbase';
180
169
  signal?: AbortSignal;
181
170
  cache?: RequestCache;
171
+ chainId?: CaipNetworkId;
182
172
  }
183
173
 
184
174
  export interface BlockchainApiTransactionsResponse {
@@ -319,7 +309,7 @@ export interface BlockchainApiSwapTokensRequest {
319
309
 
320
310
  export interface BlockchainApiOnRampQuotesRequest {
321
311
  countryCode: string;
322
- paymentMethodType?: string;
312
+ paymentMethodType: string;
323
313
  destinationCurrencyCode: string;
324
314
  sourceAmount: number;
325
315
  sourceCurrencyCode: string;
@@ -346,25 +336,6 @@ export type BlockchainApiOnRampWidgetResponse = {
346
336
  };
347
337
 
348
338
  // -- OptionsController Types ---------------------------------------------------
349
- export interface Token {
350
- address: string;
351
- image?: string;
352
- }
353
-
354
- export type Tokens = Record<CaipNetworkId, Token>;
355
-
356
- export type Metadata = {
357
- name: string;
358
- description: string;
359
- url: string;
360
- icons: string[];
361
- redirect?: {
362
- native?: string;
363
- universal?: string;
364
- linkMode?: boolean;
365
- };
366
- };
367
-
368
339
  export type CustomWallet = Pick<
369
340
  WcWallet,
370
341
  | 'id'
@@ -461,7 +432,7 @@ export type Event =
461
432
  type: 'track';
462
433
  event: 'SWITCH_NETWORK';
463
434
  properties: {
464
- network: string;
435
+ network: number | string;
465
436
  };
466
437
  }
467
438
  | {
@@ -860,12 +831,6 @@ export type OnRampCountry = {
860
831
  name: string;
861
832
  };
862
833
 
863
- export type OnRampCountryDefaults = {
864
- countryCode: string;
865
- defaultCurrencyCode: string;
866
- defaultPaymentMethods: string[];
867
- };
868
-
869
834
  export type OnRampFiatCurrency = {
870
835
  currencyCode: string;
871
836
  name: string;
@@ -941,7 +906,7 @@ export type OnRampTransactionResult = {
941
906
  * Matches type defined for packages/wallet/src/AppKitFrameProvider.ts
942
907
  * It's duplicated in order to decouple scaffold from email package
943
908
  */
944
-
909
+ // TODO: REMOVE THIS
945
910
  export type AppKitFrameAccountType = 'eoa' | 'smartAccount';
946
911
 
947
912
  export interface AppKitFrameProvider {
@@ -1,52 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.WebviewController = void 0;
7
- var _valtio = require("valtio");
8
- // -- Types --------------------------------------------- //
9
-
10
- // -- State --------------------------------------------- //
11
- const state = (0, _valtio.proxy)({
12
- frameViewVisible: false,
13
- webviewVisible: false,
14
- connecting: false,
15
- connectingProvider: undefined,
16
- processingAuth: false
17
- });
18
-
19
- // -- Controller ---------------------------------------- //
20
- const WebviewController = exports.WebviewController = {
21
- state,
22
- subscribe(callback) {
23
- return (0, _valtio.subscribe)(state, () => callback(state));
24
- },
25
- setFrameViewVisible(frameViewVisible) {
26
- state.frameViewVisible = frameViewVisible;
27
- },
28
- setWebviewVisible(visible) {
29
- state.webviewVisible = visible;
30
- },
31
- setWebviewUrl(url) {
32
- state.webviewUrl = url;
33
- },
34
- setConnecting(connecting) {
35
- state.connecting = connecting;
36
- },
37
- setConnectingProvider(provider) {
38
- state.connectingProvider = provider;
39
- },
40
- setProcessingAuth(processingAuth) {
41
- state.processingAuth = processingAuth;
42
- },
43
- reset() {
44
- state.frameViewVisible = false;
45
- state.webviewVisible = false;
46
- state.connecting = false;
47
- state.connectingProvider = undefined;
48
- state.processingAuth = false;
49
- state.webviewUrl = undefined;
50
- }
51
- };
52
- //# sourceMappingURL=WebviewController.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_valtio","require","state","proxy","frameViewVisible","webviewVisible","connecting","connectingProvider","undefined","processingAuth","WebviewController","exports","subscribe","callback","sub","setFrameViewVisible","setWebviewVisible","visible","setWebviewUrl","url","webviewUrl","setConnecting","setConnectingProvider","provider","setProcessingAuth","reset"],"sourceRoot":"../../../src","sources":["controllers/WebviewController.ts"],"mappings":";;;;;;AACA,IAAAA,OAAA,GAAAC,OAAA;AAEA;;AAUA;AACA,MAAMC,KAAK,GAAG,IAAAC,aAAK,EAAyB;EAC1CC,gBAAgB,EAAE,KAAK;EACvBC,cAAc,EAAE,KAAK;EACrBC,UAAU,EAAE,KAAK;EACjBC,kBAAkB,EAAEC,SAAS;EAC7BC,cAAc,EAAE;AAClB,CAAC,CAAC;;AAEF;AACO,MAAMC,iBAAiB,GAAAC,OAAA,CAAAD,iBAAA,GAAG;EAC/BR,KAAK;EAELU,SAASA,CAACC,QAAoD,EAAE;IAC9D,OAAO,IAAAC,iBAAG,EAACZ,KAAK,EAAE,MAAMW,QAAQ,CAACX,KAAK,CAAC,CAAC;EAC1C,CAAC;EAEDa,mBAAmBA,CAACX,gBAA4D,EAAE;IAChFF,KAAK,CAACE,gBAAgB,GAAGA,gBAAgB;EAC3C,CAAC;EAEDY,iBAAiBA,CAACC,OAAiD,EAAE;IACnEf,KAAK,CAACG,cAAc,GAAGY,OAAO;EAChC,CAAC;EAEDC,aAAaA,CAACC,GAAyC,EAAE;IACvDjB,KAAK,CAACkB,UAAU,GAAGD,GAAG;EACxB,CAAC;EAEDE,aAAaA,CAACf,UAAgD,EAAE;IAC9DJ,KAAK,CAACI,UAAU,GAAGA,UAAU;EAC/B,CAAC;EAEDgB,qBAAqBA,CAACC,QAAsD,EAAE;IAC5ErB,KAAK,CAACK,kBAAkB,GAAGgB,QAAQ;EACrC,CAAC;EAEDC,iBAAiBA,CAACf,cAAwD,EAAE;IAC1EP,KAAK,CAACO,cAAc,GAAGA,cAAc;EACvC,CAAC;EAEDgB,KAAKA,CAAA,EAAG;IACNvB,KAAK,CAACE,gBAAgB,GAAG,KAAK;IAC9BF,KAAK,CAACG,cAAc,GAAG,KAAK;IAC5BH,KAAK,CAACI,UAAU,GAAG,KAAK;IACxBJ,KAAK,CAACK,kBAAkB,GAAGC,SAAS;IACpCN,KAAK,CAACO,cAAc,GAAG,KAAK;IAC5BP,KAAK,CAACkB,UAAU,GAAGZ,SAAS;EAC9B;AACF,CAAC"}
@@ -1,33 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.ConnectionUtil = void 0;
7
- var _AccountController = require("../controllers/AccountController");
8
- var _ConnectionController = require("../controllers/ConnectionController");
9
- var _EventsController = require("../controllers/EventsController");
10
- var _ModalController = require("../controllers/ModalController");
11
- var _RouterController = require("../controllers/RouterController");
12
- var _TransactionsController = require("../controllers/TransactionsController");
13
- const ConnectionUtil = exports.ConnectionUtil = {
14
- async disconnect() {
15
- try {
16
- await _ConnectionController.ConnectionController.disconnect();
17
- _ModalController.ModalController.close();
18
- _AccountController.AccountController.setIsConnected(false);
19
- _RouterController.RouterController.reset('Connect');
20
- _TransactionsController.TransactionsController.resetTransactions();
21
- _EventsController.EventsController.sendEvent({
22
- type: 'track',
23
- event: 'DISCONNECT_SUCCESS'
24
- });
25
- } catch (error) {
26
- _EventsController.EventsController.sendEvent({
27
- type: 'track',
28
- event: 'DISCONNECT_ERROR'
29
- });
30
- }
31
- }
32
- };
33
- //# sourceMappingURL=ConnectionUtil.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_AccountController","require","_ConnectionController","_EventsController","_ModalController","_RouterController","_TransactionsController","ConnectionUtil","exports","disconnect","ConnectionController","ModalController","close","AccountController","setIsConnected","RouterController","reset","TransactionsController","resetTransactions","EventsController","sendEvent","type","event","error"],"sourceRoot":"../../../src","sources":["utils/ConnectionUtil.ts"],"mappings":";;;;;;AAAA,IAAAA,kBAAA,GAAAC,OAAA;AACA,IAAAC,qBAAA,GAAAD,OAAA;AACA,IAAAE,iBAAA,GAAAF,OAAA;AACA,IAAAG,gBAAA,GAAAH,OAAA;AACA,IAAAI,iBAAA,GAAAJ,OAAA;AACA,IAAAK,uBAAA,GAAAL,OAAA;AAEO,MAAMM,cAAc,GAAAC,OAAA,CAAAD,cAAA,GAAG;EAC5B,MAAME,UAAUA,CAAA,EAAG;IACjB,IAAI;MACF,MAAMC,0CAAoB,CAACD,UAAU,CAAC,CAAC;MACvCE,gCAAe,CAACC,KAAK,CAAC,CAAC;MACvBC,oCAAiB,CAACC,cAAc,CAAC,KAAK,CAAC;MACvCC,kCAAgB,CAACC,KAAK,CAAC,SAAS,CAAC;MACjCC,8CAAsB,CAACC,iBAAiB,CAAC,CAAC;MAC1CC,kCAAgB,CAACC,SAAS,CAAC;QACzBC,IAAI,EAAE,OAAO;QACbC,KAAK,EAAE;MACT,CAAC,CAAC;IACJ,CAAC,CAAC,OAAOC,KAAK,EAAE;MACdJ,kCAAgB,CAACC,SAAS,CAAC;QACzBC,IAAI,EAAE,OAAO;QACbC,KAAK,EAAE;MACT,CAAC,CAAC;IACJ;EACF;AACF,CAAC"}
@@ -1,47 +0,0 @@
1
- import { proxy, subscribe as sub } from 'valtio';
2
-
3
- // -- Types --------------------------------------------- //
4
-
5
- // -- State --------------------------------------------- //
6
- const state = proxy({
7
- frameViewVisible: false,
8
- webviewVisible: false,
9
- connecting: false,
10
- connectingProvider: undefined,
11
- processingAuth: false
12
- });
13
-
14
- // -- Controller ---------------------------------------- //
15
- export const WebviewController = {
16
- state,
17
- subscribe(callback) {
18
- return sub(state, () => callback(state));
19
- },
20
- setFrameViewVisible(frameViewVisible) {
21
- state.frameViewVisible = frameViewVisible;
22
- },
23
- setWebviewVisible(visible) {
24
- state.webviewVisible = visible;
25
- },
26
- setWebviewUrl(url) {
27
- state.webviewUrl = url;
28
- },
29
- setConnecting(connecting) {
30
- state.connecting = connecting;
31
- },
32
- setConnectingProvider(provider) {
33
- state.connectingProvider = provider;
34
- },
35
- setProcessingAuth(processingAuth) {
36
- state.processingAuth = processingAuth;
37
- },
38
- reset() {
39
- state.frameViewVisible = false;
40
- state.webviewVisible = false;
41
- state.connecting = false;
42
- state.connectingProvider = undefined;
43
- state.processingAuth = false;
44
- state.webviewUrl = undefined;
45
- }
46
- };
47
- //# sourceMappingURL=WebviewController.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["proxy","subscribe","sub","state","frameViewVisible","webviewVisible","connecting","connectingProvider","undefined","processingAuth","WebviewController","callback","setFrameViewVisible","setWebviewVisible","visible","setWebviewUrl","url","webviewUrl","setConnecting","setConnectingProvider","provider","setProcessingAuth","reset"],"sourceRoot":"../../../src","sources":["controllers/WebviewController.ts"],"mappings":"AACA,SAASA,KAAK,EAAEC,SAAS,IAAIC,GAAG,QAAQ,QAAQ;;AAEhD;;AAUA;AACA,MAAMC,KAAK,GAAGH,KAAK,CAAyB;EAC1CI,gBAAgB,EAAE,KAAK;EACvBC,cAAc,EAAE,KAAK;EACrBC,UAAU,EAAE,KAAK;EACjBC,kBAAkB,EAAEC,SAAS;EAC7BC,cAAc,EAAE;AAClB,CAAC,CAAC;;AAEF;AACA,OAAO,MAAMC,iBAAiB,GAAG;EAC/BP,KAAK;EAELF,SAASA,CAACU,QAAoD,EAAE;IAC9D,OAAOT,GAAG,CAACC,KAAK,EAAE,MAAMQ,QAAQ,CAACR,KAAK,CAAC,CAAC;EAC1C,CAAC;EAEDS,mBAAmBA,CAACR,gBAA4D,EAAE;IAChFD,KAAK,CAACC,gBAAgB,GAAGA,gBAAgB;EAC3C,CAAC;EAEDS,iBAAiBA,CAACC,OAAiD,EAAE;IACnEX,KAAK,CAACE,cAAc,GAAGS,OAAO;EAChC,CAAC;EAEDC,aAAaA,CAACC,GAAyC,EAAE;IACvDb,KAAK,CAACc,UAAU,GAAGD,GAAG;EACxB,CAAC;EAEDE,aAAaA,CAACZ,UAAgD,EAAE;IAC9DH,KAAK,CAACG,UAAU,GAAGA,UAAU;EAC/B,CAAC;EAEDa,qBAAqBA,CAACC,QAAsD,EAAE;IAC5EjB,KAAK,CAACI,kBAAkB,GAAGa,QAAQ;EACrC,CAAC;EAEDC,iBAAiBA,CAACZ,cAAwD,EAAE;IAC1EN,KAAK,CAACM,cAAc,GAAGA,cAAc;EACvC,CAAC;EAEDa,KAAKA,CAAA,EAAG;IACNnB,KAAK,CAACC,gBAAgB,GAAG,KAAK;IAC9BD,KAAK,CAACE,cAAc,GAAG,KAAK;IAC5BF,KAAK,CAACG,UAAU,GAAG,KAAK;IACxBH,KAAK,CAACI,kBAAkB,GAAGC,SAAS;IACpCL,KAAK,CAACM,cAAc,GAAG,KAAK;IAC5BN,KAAK,CAACc,UAAU,GAAGT,SAAS;EAC9B;AACF,CAAC"}
@@ -1,27 +0,0 @@
1
- import { AccountController } from '../controllers/AccountController';
2
- import { ConnectionController } from '../controllers/ConnectionController';
3
- import { EventsController } from '../controllers/EventsController';
4
- import { ModalController } from '../controllers/ModalController';
5
- import { RouterController } from '../controllers/RouterController';
6
- import { TransactionsController } from '../controllers/TransactionsController';
7
- export const ConnectionUtil = {
8
- async disconnect() {
9
- try {
10
- await ConnectionController.disconnect();
11
- ModalController.close();
12
- AccountController.setIsConnected(false);
13
- RouterController.reset('Connect');
14
- TransactionsController.resetTransactions();
15
- EventsController.sendEvent({
16
- type: 'track',
17
- event: 'DISCONNECT_SUCCESS'
18
- });
19
- } catch (error) {
20
- EventsController.sendEvent({
21
- type: 'track',
22
- event: 'DISCONNECT_ERROR'
23
- });
24
- }
25
- }
26
- };
27
- //# sourceMappingURL=ConnectionUtil.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["AccountController","ConnectionController","EventsController","ModalController","RouterController","TransactionsController","ConnectionUtil","disconnect","close","setIsConnected","reset","resetTransactions","sendEvent","type","event","error"],"sourceRoot":"../../../src","sources":["utils/ConnectionUtil.ts"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,kCAAkC;AACpE,SAASC,oBAAoB,QAAQ,qCAAqC;AAC1E,SAASC,gBAAgB,QAAQ,iCAAiC;AAClE,SAASC,eAAe,QAAQ,gCAAgC;AAChE,SAASC,gBAAgB,QAAQ,iCAAiC;AAClE,SAASC,sBAAsB,QAAQ,uCAAuC;AAE9E,OAAO,MAAMC,cAAc,GAAG;EAC5B,MAAMC,UAAUA,CAAA,EAAG;IACjB,IAAI;MACF,MAAMN,oBAAoB,CAACM,UAAU,CAAC,CAAC;MACvCJ,eAAe,CAACK,KAAK,CAAC,CAAC;MACvBR,iBAAiB,CAACS,cAAc,CAAC,KAAK,CAAC;MACvCL,gBAAgB,CAACM,KAAK,CAAC,SAAS,CAAC;MACjCL,sBAAsB,CAACM,iBAAiB,CAAC,CAAC;MAC1CT,gBAAgB,CAACU,SAAS,CAAC;QACzBC,IAAI,EAAE,OAAO;QACbC,KAAK,EAAE;MACT,CAAC,CAAC;IACJ,CAAC,CAAC,OAAOC,KAAK,EAAE;MACdb,gBAAgB,CAACU,SAAS,CAAC;QACzBC,IAAI,EAAE,OAAO;QACbC,KAAK,EAAE;MACT,CAAC,CAAC;IACJ;EACF;AACF,CAAC"}
@@ -1,21 +0,0 @@
1
- import type { SocialProvider } from '@reown/appkit-common-react-native';
2
- export interface WebviewControllerState {
3
- frameViewVisible: boolean;
4
- webviewVisible: boolean;
5
- webviewUrl?: string;
6
- connecting?: boolean;
7
- connectingProvider?: SocialProvider;
8
- processingAuth?: boolean;
9
- }
10
- export declare const WebviewController: {
11
- state: WebviewControllerState;
12
- subscribe(callback: (newState: WebviewControllerState) => void): () => void;
13
- setFrameViewVisible(frameViewVisible: WebviewControllerState['frameViewVisible']): void;
14
- setWebviewVisible(visible: WebviewControllerState['webviewVisible']): void;
15
- setWebviewUrl(url: WebviewControllerState['webviewUrl']): void;
16
- setConnecting(connecting: WebviewControllerState['connecting']): void;
17
- setConnectingProvider(provider: WebviewControllerState['connectingProvider']): void;
18
- setProcessingAuth(processingAuth: WebviewControllerState['processingAuth']): void;
19
- reset(): void;
20
- };
21
- //# sourceMappingURL=WebviewController.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"WebviewController.d.ts","sourceRoot":"","sources":["../../../src/controllers/WebviewController.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AAIxE,MAAM,WAAW,sBAAsB;IACrC,gBAAgB,EAAE,OAAO,CAAC;IAC1B,cAAc,EAAE,OAAO,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,kBAAkB,CAAC,EAAE,cAAc,CAAC;IACpC,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAYD,eAAO,MAAM,iBAAiB;;mCAGG,sBAAsB,KAAK,IAAI;0CAIxB,sBAAsB,CAAC,kBAAkB,CAAC;+BAIrD,sBAAsB,CAAC,gBAAgB,CAAC;uBAIhD,sBAAsB,CAAC,YAAY,CAAC;8BAI7B,sBAAsB,CAAC,YAAY,CAAC;oCAI9B,sBAAsB,CAAC,oBAAoB,CAAC;sCAI1C,sBAAsB,CAAC,gBAAgB,CAAC;;CAY3E,CAAC"}
@@ -1,4 +0,0 @@
1
- export declare const ConnectionUtil: {
2
- disconnect(): Promise<void>;
3
- };
4
- //# sourceMappingURL=ConnectionUtil.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ConnectionUtil.d.ts","sourceRoot":"","sources":["../../../src/utils/ConnectionUtil.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,cAAc;;CAmB1B,CAAC"}