@reown/appkit-core-react-native 2.0.0-alpha.4 → 2.0.0-alpha.5

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 (61) hide show
  1. package/lib/commonjs/controllers/ApiController.js +102 -84
  2. package/lib/commonjs/controllers/ApiController.js.map +1 -1
  3. package/lib/commonjs/controllers/BlockchainApiController.js +1 -1
  4. package/lib/commonjs/controllers/BlockchainApiController.js.map +1 -1
  5. package/lib/commonjs/controllers/ConnectionsController.js +31 -18
  6. package/lib/commonjs/controllers/ConnectionsController.js.map +1 -1
  7. package/lib/commonjs/controllers/ModalController.js +4 -1
  8. package/lib/commonjs/controllers/ModalController.js.map +1 -1
  9. package/lib/commonjs/controllers/OnRampController.js +4 -1
  10. package/lib/commonjs/controllers/OnRampController.js.map +1 -1
  11. package/lib/commonjs/controllers/ThemeController.js +5 -0
  12. package/lib/commonjs/controllers/ThemeController.js.map +1 -1
  13. package/lib/commonjs/index.js +0 -7
  14. package/lib/commonjs/index.js.map +1 -1
  15. package/lib/commonjs/utils/ConstantsUtil.js +1 -5
  16. package/lib/commonjs/utils/ConstantsUtil.js.map +1 -1
  17. package/lib/module/controllers/ApiController.js +102 -84
  18. package/lib/module/controllers/ApiController.js.map +1 -1
  19. package/lib/module/controllers/BlockchainApiController.js +1 -1
  20. package/lib/module/controllers/BlockchainApiController.js.map +1 -1
  21. package/lib/module/controllers/ConnectionsController.js +31 -18
  22. package/lib/module/controllers/ConnectionsController.js.map +1 -1
  23. package/lib/module/controllers/ModalController.js +4 -1
  24. package/lib/module/controllers/ModalController.js.map +1 -1
  25. package/lib/module/controllers/OnRampController.js +4 -1
  26. package/lib/module/controllers/OnRampController.js.map +1 -1
  27. package/lib/module/controllers/ThemeController.js +5 -0
  28. package/lib/module/controllers/ThemeController.js.map +1 -1
  29. package/lib/module/index.js +0 -1
  30. package/lib/module/index.js.map +1 -1
  31. package/lib/module/utils/ConstantsUtil.js +1 -5
  32. package/lib/module/utils/ConstantsUtil.js.map +1 -1
  33. package/lib/typescript/controllers/ApiController.d.ts.map +1 -1
  34. package/lib/typescript/controllers/ConnectionsController.d.ts +3 -2
  35. package/lib/typescript/controllers/ConnectionsController.d.ts.map +1 -1
  36. package/lib/typescript/controllers/ModalController.d.ts.map +1 -1
  37. package/lib/typescript/controllers/OnRampController.d.ts.map +1 -1
  38. package/lib/typescript/controllers/RouterController.d.ts +1 -1
  39. package/lib/typescript/controllers/RouterController.d.ts.map +1 -1
  40. package/lib/typescript/controllers/ThemeController.d.ts +2 -0
  41. package/lib/typescript/controllers/ThemeController.d.ts.map +1 -1
  42. package/lib/typescript/index.d.ts +0 -1
  43. package/lib/typescript/index.d.ts.map +1 -1
  44. package/lib/typescript/utils/ConstantsUtil.d.ts.map +1 -1
  45. package/package.json +5 -4
  46. package/src/controllers/ApiController.ts +93 -73
  47. package/src/controllers/BlockchainApiController.ts +1 -1
  48. package/src/controllers/ConnectionsController.ts +47 -17
  49. package/src/controllers/ModalController.ts +5 -1
  50. package/src/controllers/OnRampController.ts +5 -1
  51. package/src/controllers/RouterController.ts +2 -2
  52. package/src/controllers/ThemeController.ts +7 -0
  53. package/src/index.ts +0 -1
  54. package/src/utils/ConstantsUtil.ts +1 -5
  55. package/lib/commonjs/utils/RouterUtil.js +0 -25
  56. package/lib/commonjs/utils/RouterUtil.js.map +0 -1
  57. package/lib/module/utils/RouterUtil.js +0 -21
  58. package/lib/module/utils/RouterUtil.js.map +0 -1
  59. package/lib/typescript/utils/RouterUtil.d.ts +0 -5
  60. package/lib/typescript/utils/RouterUtil.d.ts.map +0 -1
  61. package/src/utils/RouterUtil.ts +0 -21
@@ -108,87 +108,104 @@ export const ApiController = {
108
108
  },
109
109
 
110
110
  async fetchInstalledWallets() {
111
- const { includeWalletIds, customWallets } = OptionsController.state;
112
- const path = Platform.select({ default: 'getIosData', android: 'getAndroidData' });
113
- const response = await api.get<ApiGetDataWalletsResponse>({
114
- path,
115
- headers: ApiController._getApiHeaders()
116
- });
111
+ // Add timeout to prevent hanging
112
+ const controller = new AbortController();
113
+ let timeoutId: NodeJS.Timeout | undefined;
117
114
 
118
- if (!response) return;
119
-
120
- let { data: walletData } = response;
115
+ try {
116
+ const { includeWalletIds, customWallets } = OptionsController.state;
117
+ const path = Platform.select({ default: 'getIosData', android: 'getAndroidData' });
118
+ const response = await api.get<ApiGetDataWalletsResponse>({
119
+ path,
120
+ headers: ApiController._getApiHeaders()
121
+ });
121
122
 
122
- if (includeWalletIds?.length) {
123
- walletData = walletData.filter(({ id }) => includeWalletIds.includes(id));
124
- }
123
+ if (!response) return;
125
124
 
126
- const promises = walletData.map(async item => {
127
- return {
128
- id: item.id,
129
- isInstalled: await CoreHelperUtil.checkInstalled(item)
130
- };
131
- });
125
+ let { data: walletData } = response;
132
126
 
133
- const customPromises = customWallets?.map(async item => {
134
- return {
135
- id: item.id,
136
- isInstalled: await CoreHelperUtil.checkInstalled(item)
137
- };
138
- });
127
+ if (includeWalletIds?.length) {
128
+ walletData = walletData.filter(({ id }) => includeWalletIds.includes(id));
129
+ }
139
130
 
140
- const results = await Promise.all(promises);
141
- const installed = results.filter(({ isInstalled }) => isInstalled).map(({ id }) => id);
142
- const { excludeWalletIds } = OptionsController.state;
143
- const chains = CoreHelperUtil.getRequestedCaipNetworkIds();
131
+ const promises = walletData.map(async item => {
132
+ return {
133
+ id: item.id,
134
+ isInstalled: await CoreHelperUtil.checkInstalled(item)
135
+ };
136
+ });
144
137
 
145
- // Collect API-sourced installed wallets
146
- let apiInstalledWallets: WcWallet[] = [];
147
- if (installed.length > 0) {
148
- const walletResponse = await api.get<ApiGetWalletsResponse>({
149
- path: '/getWallets',
150
- headers: ApiController._getApiHeaders(),
151
- params: {
152
- page: '1',
153
- platform: this.platform(),
154
- entries: installed?.length.toString(),
155
- include: installed?.join(','),
156
- exclude: excludeWalletIds?.join(','),
157
- chains: chains.join(',')
158
- }
138
+ const customPromises = customWallets?.map(async item => {
139
+ return {
140
+ id: item.id,
141
+ isInstalled: await CoreHelperUtil.checkInstalled(item)
142
+ };
159
143
  });
160
144
 
161
- if (walletResponse?.data) {
162
- const walletImages = walletResponse.data.map(d => d.image_id).filter(Boolean);
163
- await CoreHelperUtil.allSettled(
164
- (walletImages as string[]).map(id => ApiController._fetchWalletImage(id))
165
- );
166
- apiInstalledWallets = walletResponse.data;
145
+ const results = await Promise.all(promises);
146
+ const installed = results.filter(({ isInstalled }) => isInstalled).map(({ id }) => id);
147
+ const { excludeWalletIds } = OptionsController.state;
148
+ const chains = CoreHelperUtil.getRequestedCaipNetworkIds();
149
+
150
+ // Add timeout to prevent hanging
151
+ timeoutId = setTimeout(() => controller.abort(), 10000);
152
+
153
+ // Collect API-sourced installed wallets
154
+ let apiInstalledWallets: WcWallet[] = [];
155
+ if (installed.length > 0) {
156
+ const walletResponse = await api.get<ApiGetWalletsResponse>({
157
+ path: '/getWallets',
158
+ headers: ApiController._getApiHeaders(),
159
+ params: {
160
+ page: '1',
161
+ platform: this.platform(),
162
+ entries: installed?.length.toString(),
163
+ include: installed?.join(','),
164
+ exclude: excludeWalletIds?.join(','),
165
+ chains: chains.join(',')
166
+ },
167
+ signal: controller.signal
168
+ });
169
+
170
+ if (walletResponse?.data) {
171
+ const walletImages = walletResponse.data.map(d => d.image_id).filter(Boolean);
172
+ await CoreHelperUtil.allSettled(
173
+ (walletImages as string[]).map(id => ApiController._fetchWalletImage(id))
174
+ );
175
+ apiInstalledWallets = walletResponse.data;
176
+ }
167
177
  }
168
- }
169
178
 
170
- // Collect custom installed wallets
171
- let customInstalledWallets: CustomWallet[] = [];
172
- if (customPromises?.length) {
173
- const customResults = await Promise.all(customPromises);
174
- const customInstalled = customResults
175
- .filter(({ isInstalled }) => isInstalled)
176
- .map(({ id }) => id);
177
- customInstalledWallets =
178
- customWallets?.filter(wallet => customInstalled.includes(wallet.id)) ?? [];
179
- }
179
+ clearTimeout(timeoutId);
180
+
181
+ // Collect custom installed wallets
182
+ let customInstalledWallets: CustomWallet[] = [];
183
+ if (customPromises?.length) {
184
+ const customResults = await Promise.all(customPromises);
185
+ const customInstalled = customResults
186
+ .filter(({ isInstalled }) => isInstalled)
187
+ .map(({ id }) => id);
188
+ customInstalledWallets =
189
+ customWallets?.filter(wallet => customInstalled.includes(wallet.id)) ?? [];
190
+ }
180
191
 
181
- // Merge and de-duplicate by id, preserving order (API first, then custom)
182
- const byId = new Map<string, WcWallet>();
183
- [...apiInstalledWallets, ...customInstalledWallets].forEach(wallet => {
184
- if (!byId.has(wallet.id)) {
185
- byId.set(wallet.id, wallet);
192
+ // Merge and de-duplicate by id, preserving order (API first, then custom)
193
+ const byId = new Map<string, WcWallet>();
194
+ [...apiInstalledWallets, ...customInstalledWallets].forEach(wallet => {
195
+ if (!byId.has(wallet.id)) {
196
+ byId.set(wallet.id, wallet);
197
+ }
198
+ });
199
+ const combinedInstalled = Array.from(byId.values());
200
+ state.installed = combinedInstalled;
201
+ if (combinedInstalled.length) {
202
+ this.updateRecentWalletsInfo(combinedInstalled);
186
203
  }
187
- });
188
- const combinedInstalled = Array.from(byId.values());
189
- state.installed = combinedInstalled;
190
- if (combinedInstalled.length) {
191
- this.updateRecentWalletsInfo(combinedInstalled);
204
+ } catch (error) {
205
+ state.installed = [];
206
+ clearTimeout(timeoutId);
207
+ // eslint-disable-next-line no-console
208
+ console.log('Error fetching installed wallets', error);
192
209
  }
193
210
  },
194
211
 
@@ -375,19 +392,22 @@ export const ApiController = {
375
392
  try {
376
393
  state.prefetchError = false;
377
394
  state.prefetchLoading = true;
378
- // this fetch must resolve first so we filter them in the other wallet requests
379
- await ApiController.fetchInstalledWallets();
380
395
 
381
396
  const promises = [
382
- ApiController.fetchFeaturedWallets(),
383
- ApiController.fetchRecommendedWallets(),
384
397
  ApiController.fetchNetworkImages(),
385
398
  ApiController.fetchCustomWalletImages()
386
399
  ];
400
+
387
401
  if (OptionsController.state.enableAnalytics === undefined) {
388
402
  promises.push(ApiController.fetchAnalyticsConfig());
389
403
  }
390
404
 
405
+ // this fetch must resolve first so we filter them in the other wallet requests
406
+ await ApiController.fetchInstalledWallets();
407
+
408
+ promises.push(ApiController.fetchFeaturedWallets());
409
+ promises.push(ApiController.fetchRecommendedWallets());
410
+
391
411
  state.prefetchPromise = Promise.race([
392
412
  CoreHelperUtil.allSettled(promises),
393
413
  CoreHelperUtil.wait(3000)
@@ -119,7 +119,7 @@ export const BlockchainApiController = {
119
119
 
120
120
  async fetchTransactions(params: BlockchainApiTransactionsRequest) {
121
121
  const { account, projectId, cursor, signal, cache, chainId } = params;
122
- const isSupported = await BlockchainApiController.isNetworkSupported(chainId);
122
+ const isSupported = ConstantsUtil.ACTIVITY_SUPPORTED_CHAINS.includes(chainId);
123
123
 
124
124
  if (!isSupported) {
125
125
  return { data: [], next: undefined };
@@ -80,11 +80,13 @@ const updateConnection = (
80
80
  namespace: ChainNamespace,
81
81
  connection: Connection,
82
82
  updates: Partial<Connection>
83
- ) => {
84
- if (!connection) return;
83
+ ): Connection => {
85
84
  const newConnectionsMap = new Map(baseState.connections);
86
- newConnectionsMap.set(namespace, { ...connection, ...updates });
85
+ const newConnection = { ...connection, ...updates };
86
+ newConnectionsMap.set(namespace, newConnection);
87
87
  baseState.connections = newConnectionsMap;
88
+
89
+ return newConnection;
88
90
  };
89
91
 
90
92
  const getActiveIdentity = (connection: Connection): Identity | undefined => {
@@ -206,6 +208,10 @@ export const ConnectionsController = {
206
208
  state: derivedState,
207
209
 
208
210
  setActiveNamespace(namespace?: ChainNamespace) {
211
+ if (baseState.activeNamespace === namespace) {
212
+ return;
213
+ }
214
+
209
215
  baseState.activeNamespace = namespace;
210
216
  StorageUtil.setActiveNamespace(namespace);
211
217
  },
@@ -247,16 +253,19 @@ export const ConnectionsController = {
247
253
  baseState.connections = newConnectionsMap;
248
254
  },
249
255
 
250
- updateAccounts(namespace: ChainNamespace, accounts: CaipAddress[]) {
256
+ updateAccounts(namespace: ChainNamespace, accounts: CaipAddress[]): boolean {
251
257
  const connection = baseState.connections.get(namespace);
252
258
  if (!connection) {
253
- return;
259
+ return false;
254
260
  }
255
261
 
256
- const newConnectionsMap = new Map(baseState.connections);
257
- const updatedConnection = { ...connection, accounts };
258
- newConnectionsMap.set(namespace, updatedConnection);
259
- baseState.connections = newConnectionsMap;
262
+ if (connection.accounts.toString() === accounts.toString()) {
263
+ return false;
264
+ }
265
+
266
+ updateConnection(namespace, connection, { accounts });
267
+
268
+ return true;
260
269
  },
261
270
 
262
271
  updateBalance(namespace: ChainNamespace, address: CaipAddress, balance: Balance) {
@@ -327,10 +336,9 @@ export const ConnectionsController = {
327
336
  return;
328
337
  }
329
338
 
330
- baseState.connections.set(namespace, {
331
- ...connection,
332
- caipNetwork: networkId
333
- });
339
+ updateConnection(namespace, connection, { caipNetwork: networkId });
340
+
341
+ this.setActiveNamespace(namespace);
334
342
  },
335
343
 
336
344
  setNetworks(networks: AppKitNetwork[]) {
@@ -338,6 +346,11 @@ export const ConnectionsController = {
338
346
  },
339
347
 
340
348
  getConnectedNetworks() {
349
+ const connection = getActiveConnection(baseState);
350
+ if (!connection) {
351
+ return [];
352
+ }
353
+
341
354
  return baseState.networks.filter(
342
355
  network =>
343
356
  baseState.connections
@@ -346,14 +359,31 @@ export const ConnectionsController = {
346
359
  );
347
360
  },
348
361
 
362
+ getAvailableNetworks() {
363
+ const connection = getActiveConnection(baseState);
364
+
365
+ if (!connection) {
366
+ return baseState.networks;
367
+ }
368
+
369
+ const canAddEvmChain = connection.properties?.canAddEvmChain;
370
+
371
+ return baseState.networks.filter(
372
+ network =>
373
+ baseState.connections
374
+ .get(network.chainNamespace)
375
+ ?.accounts.some(account => account.startsWith(network.caipNetworkId)) ||
376
+ (canAddEvmChain && network.chainNamespace === 'eip155')
377
+ );
378
+ },
379
+
349
380
  setAccountType(namespace: ChainNamespace, type: AccountType) {
350
381
  const connection = baseState.connections.get(namespace);
351
382
  if (!connection) return;
352
383
 
353
- const newConnectionsMap = new Map(baseState.connections);
354
- const newConnection = { ...connection, type };
355
- newConnectionsMap.set(namespace, newConnection);
356
- baseState.connections = newConnectionsMap;
384
+ const newConnection = updateConnection(namespace, connection, { type });
385
+
386
+ return getActiveAddress(newConnection);
357
387
  },
358
388
 
359
389
  async disconnect(namespace: ChainNamespace, isInternal = true) {
@@ -30,10 +30,14 @@ export const ModalController = {
30
30
  async open(options?: ModalControllerArguments['open']) {
31
31
  await ApiController.state.prefetchPromise;
32
32
  const isConnected = ConnectionsController.state.isConnected;
33
+ const isUniversalWallet = !!ConnectionsController.state.connection?.properties?.provider;
33
34
  if (options?.view) {
35
+ if (options.view === 'Account' && !isUniversalWallet) {
36
+ options.view = 'AccountDefault';
37
+ }
38
+
34
39
  RouterController.reset(options.view);
35
40
  } else if (isConnected) {
36
- const isUniversalWallet = !!ConnectionsController.state.connection?.properties?.provider;
37
41
  RouterController.reset(isUniversalWallet ? 'Account' : 'AccountDefault');
38
42
  } else {
39
43
  RouterController.reset('Connect');
@@ -124,7 +124,11 @@ export const OnRampController = {
124
124
  state.countriesDefaults?.find(d => d.countryCode === country.countryCode)
125
125
  ?.defaultCurrencyCode || 'USD';
126
126
 
127
- const currency = state.paymentCurrencies?.find(c => c.currencyCode === currencyCode);
127
+ let currency = state.paymentCurrencies?.find(c => c.currencyCode === currencyCode);
128
+
129
+ if (!currency) {
130
+ currency = state.paymentCurrencies?.find(c => c.currencyCode === 'USD');
131
+ }
128
132
 
129
133
  if (currency) {
130
134
  this.setPaymentCurrency(currency);
@@ -17,15 +17,15 @@ export interface RouterControllerState {
17
17
  | 'ConnectingExternal'
18
18
  | 'ConnectingSiwe'
19
19
  | 'ConnectingSocial'
20
- | 'ConnectingWalletConnect'
20
+ | 'WalletConnect'
21
21
  | 'GetWallet'
22
22
  | 'Networks'
23
+ | 'SwitchNetwork'
23
24
  | 'OnRamp'
24
25
  | 'OnRampCheckout'
25
26
  | 'OnRampLoading'
26
27
  | 'OnRampSettings'
27
28
  | 'OnRampTransaction'
28
- | 'SwitchNetwork'
29
29
  | 'Swap'
30
30
  | 'SwapPreview'
31
31
  | 'Transactions'
@@ -5,12 +5,14 @@ import type { ThemeMode, ThemeVariables } from '@reown/appkit-common-react-nativ
5
5
  // -- Types --------------------------------------------- //
6
6
  export interface ThemeControllerState {
7
7
  themeMode?: ThemeMode;
8
+ defaultThemeMode?: ThemeMode;
8
9
  themeVariables?: ThemeVariables;
9
10
  }
10
11
 
11
12
  // -- State --------------------------------------------- //
12
13
  const state = proxy<ThemeControllerState>({
13
14
  themeMode: undefined,
15
+ defaultThemeMode: undefined,
14
16
  themeVariables: {}
15
17
  });
16
18
 
@@ -30,6 +32,11 @@ export const ThemeController = {
30
32
  }
31
33
  },
32
34
 
35
+ setDefaultThemeMode(themeMode: ThemeControllerState['defaultThemeMode']) {
36
+ state.defaultThemeMode = themeMode;
37
+ this.setThemeMode(themeMode);
38
+ },
39
+
33
40
  setThemeVariables(themeVariables: ThemeControllerState['themeVariables']) {
34
41
  if (!themeVariables) {
35
42
  state.themeVariables = {};
package/src/index.ts CHANGED
@@ -53,7 +53,6 @@ export { ConstantsUtil } from './utils/ConstantsUtil';
53
53
  export { CoreHelperUtil } from './utils/CoreHelperUtil';
54
54
  export { StorageUtil } from './utils/StorageUtil';
55
55
  export { EventUtil } from './utils/EventUtil';
56
- export { RouterUtil } from './utils/RouterUtil';
57
56
  export { WalletUtil } from './utils/WalletUtil';
58
57
 
59
58
  // Types are now exported from @reown/appkit-common-react-native
@@ -219,8 +219,6 @@ export const ConstantsUtil = {
219
219
  'eip155:1499',
220
220
  // Sonic
221
221
  'eip155:7007',
222
- // Swellchain
223
- 'eip155:7777777',
224
222
  // Taiko
225
223
  'eip155:167000',
226
224
  // Viction
@@ -238,9 +236,7 @@ export const ConstantsUtil = {
238
236
  // ZkLink Nova
239
237
  'eip155:810180',
240
238
  // re.al
241
- 'eip155:666',
242
- // Zora
243
- 'eip155:7777777'
239
+ 'eip155:666'
244
240
  ],
245
241
 
246
242
  SWAP_SUPPORTED_NETWORKS: [
@@ -1,25 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.RouterUtil = void 0;
7
- var _RouterController = require("../controllers/RouterController");
8
- var _ModalController = require("../controllers/ModalController");
9
- const RouterUtil = exports.RouterUtil = {
10
- navigateAfterNetworkSwitch(excludeViews = []) {
11
- if (excludeViews.includes(_RouterController.RouterController.state.view)) {
12
- return;
13
- }
14
- const {
15
- history
16
- } = _RouterController.RouterController.state;
17
- const networkSelectIndex = history.findIndex(name => name === 'Networks' || name === 'UnsupportedChain');
18
- if (networkSelectIndex >= 1) {
19
- _RouterController.RouterController.goBackToIndex(networkSelectIndex - 1);
20
- } else {
21
- _ModalController.ModalController.close();
22
- }
23
- }
24
- };
25
- //# sourceMappingURL=RouterUtil.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_RouterController","require","_ModalController","RouterUtil","exports","navigateAfterNetworkSwitch","excludeViews","includes","RouterController","state","view","history","networkSelectIndex","findIndex","name","goBackToIndex","ModalController","close"],"sourceRoot":"../../../src","sources":["utils/RouterUtil.ts"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,gBAAA,GAAAD,OAAA;AAEO,MAAME,UAAU,GAAAC,OAAA,CAAAD,UAAA,GAAG;EACxBE,0BAA0BA,CAACC,YAA6C,GAAG,EAAE,EAAE;IAC7E,IAAIA,YAAY,CAACC,QAAQ,CAACC,kCAAgB,CAACC,KAAK,CAACC,IAAI,CAAC,EAAE;MACtD;IACF;IAEA,MAAM;MAAEC;IAAQ,CAAC,GAAGH,kCAAgB,CAACC,KAAK;IAC1C,MAAMG,kBAAkB,GAAGD,OAAO,CAACE,SAAS,CAC1CC,IAAI,IAAIA,IAAI,KAAK,UAAU,IAAIA,IAAI,KAAK,kBAC1C,CAAC;IAED,IAAIF,kBAAkB,IAAI,CAAC,EAAE;MAC3BJ,kCAAgB,CAACO,aAAa,CAACH,kBAAkB,GAAG,CAAC,CAAC;IACxD,CAAC,MAAM;MACLI,gCAAe,CAACC,KAAK,CAAC,CAAC;IACzB;EACF;AACF,CAAC","ignoreList":[]}
@@ -1,21 +0,0 @@
1
- "use strict";
2
-
3
- import { RouterController } from '../controllers/RouterController';
4
- import { ModalController } from '../controllers/ModalController';
5
- export const RouterUtil = {
6
- navigateAfterNetworkSwitch(excludeViews = []) {
7
- if (excludeViews.includes(RouterController.state.view)) {
8
- return;
9
- }
10
- const {
11
- history
12
- } = RouterController.state;
13
- const networkSelectIndex = history.findIndex(name => name === 'Networks' || name === 'UnsupportedChain');
14
- if (networkSelectIndex >= 1) {
15
- RouterController.goBackToIndex(networkSelectIndex - 1);
16
- } else {
17
- ModalController.close();
18
- }
19
- }
20
- };
21
- //# sourceMappingURL=RouterUtil.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["RouterController","ModalController","RouterUtil","navigateAfterNetworkSwitch","excludeViews","includes","state","view","history","networkSelectIndex","findIndex","name","goBackToIndex","close"],"sourceRoot":"../../../src","sources":["utils/RouterUtil.ts"],"mappings":";;AAAA,SAASA,gBAAgB,QAAoC,iCAAiC;AAC9F,SAASC,eAAe,QAAQ,gCAAgC;AAEhE,OAAO,MAAMC,UAAU,GAAG;EACxBC,0BAA0BA,CAACC,YAA6C,GAAG,EAAE,EAAE;IAC7E,IAAIA,YAAY,CAACC,QAAQ,CAACL,gBAAgB,CAACM,KAAK,CAACC,IAAI,CAAC,EAAE;MACtD;IACF;IAEA,MAAM;MAAEC;IAAQ,CAAC,GAAGR,gBAAgB,CAACM,KAAK;IAC1C,MAAMG,kBAAkB,GAAGD,OAAO,CAACE,SAAS,CAC1CC,IAAI,IAAIA,IAAI,KAAK,UAAU,IAAIA,IAAI,KAAK,kBAC1C,CAAC;IAED,IAAIF,kBAAkB,IAAI,CAAC,EAAE;MAC3BT,gBAAgB,CAACY,aAAa,CAACH,kBAAkB,GAAG,CAAC,CAAC;IACxD,CAAC,MAAM;MACLR,eAAe,CAACY,KAAK,CAAC,CAAC;IACzB;EACF;AACF,CAAC","ignoreList":[]}
@@ -1,5 +0,0 @@
1
- import { type RouterControllerState } from '../controllers/RouterController';
2
- export declare const RouterUtil: {
3
- navigateAfterNetworkSwitch(excludeViews?: RouterControllerState['view'][]): void;
4
- };
5
- //# sourceMappingURL=RouterUtil.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"RouterUtil.d.ts","sourceRoot":"","sources":["../../../src/utils/RouterUtil.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AAG/F,eAAO,MAAM,UAAU;8CACoB,qBAAqB,CAAC,MAAM,CAAC,EAAE;CAgBzE,CAAC"}
@@ -1,21 +0,0 @@
1
- import { RouterController, type RouterControllerState } from '../controllers/RouterController';
2
- import { ModalController } from '../controllers/ModalController';
3
-
4
- export const RouterUtil = {
5
- navigateAfterNetworkSwitch(excludeViews: RouterControllerState['view'][] = []) {
6
- if (excludeViews.includes(RouterController.state.view)) {
7
- return;
8
- }
9
-
10
- const { history } = RouterController.state;
11
- const networkSelectIndex = history.findIndex(
12
- name => name === 'Networks' || name === 'UnsupportedChain'
13
- );
14
-
15
- if (networkSelectIndex >= 1) {
16
- RouterController.goBackToIndex(networkSelectIndex - 1);
17
- } else {
18
- ModalController.close();
19
- }
20
- }
21
- };