@reown/appkit-core-react-native 0.0.0-feat-multichain-20250818141206 → 0.0.0-feat-multichain-20250902153701
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.
- package/lib/commonjs/controllers/ApiController.js +114 -86
- package/lib/commonjs/controllers/ApiController.js.map +1 -1
- package/lib/commonjs/controllers/BlockchainApiController.js +1 -1
- package/lib/commonjs/controllers/BlockchainApiController.js.map +1 -1
- package/lib/commonjs/controllers/ConnectionsController.js +6 -1
- package/lib/commonjs/controllers/ConnectionsController.js.map +1 -1
- package/lib/commonjs/controllers/OnRampController.js +4 -1
- package/lib/commonjs/controllers/OnRampController.js.map +1 -1
- package/lib/commonjs/controllers/OptionsController.js +3 -0
- package/lib/commonjs/controllers/OptionsController.js.map +1 -1
- package/lib/commonjs/controllers/RouterController.js.map +1 -1
- package/lib/commonjs/index.js +0 -7
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/utils/CoreHelperUtil.js +7 -0
- package/lib/commonjs/utils/CoreHelperUtil.js.map +1 -1
- package/lib/module/controllers/ApiController.js +114 -86
- package/lib/module/controllers/ApiController.js.map +1 -1
- package/lib/module/controllers/BlockchainApiController.js +1 -1
- package/lib/module/controllers/BlockchainApiController.js.map +1 -1
- package/lib/module/controllers/ConnectionsController.js +6 -1
- package/lib/module/controllers/ConnectionsController.js.map +1 -1
- package/lib/module/controllers/OnRampController.js +4 -1
- package/lib/module/controllers/OnRampController.js.map +1 -1
- package/lib/module/controllers/OptionsController.js +3 -0
- package/lib/module/controllers/OptionsController.js.map +1 -1
- package/lib/module/controllers/RouterController.js.map +1 -1
- package/lib/module/index.js +0 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/utils/CoreHelperUtil.js +7 -0
- package/lib/module/utils/CoreHelperUtil.js.map +1 -1
- package/lib/typescript/controllers/ApiController.d.ts.map +1 -1
- package/lib/typescript/controllers/ConnectionsController.d.ts +2 -2
- package/lib/typescript/controllers/ConnectionsController.d.ts.map +1 -1
- package/lib/typescript/controllers/OnRampController.d.ts.map +1 -1
- package/lib/typescript/controllers/OptionsController.d.ts +2 -0
- package/lib/typescript/controllers/OptionsController.d.ts.map +1 -1
- package/lib/typescript/controllers/RouterController.d.ts +1 -1
- package/lib/typescript/controllers/RouterController.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +0 -1
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/utils/CoreHelperUtil.d.ts +1 -0
- package/lib/typescript/utils/CoreHelperUtil.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/controllers/ApiController.ts +105 -75
- package/src/controllers/BlockchainApiController.ts +1 -1
- package/src/controllers/ConnectionsController.ts +10 -2
- package/src/controllers/OnRampController.ts +5 -1
- package/src/controllers/OptionsController.ts +5 -0
- package/src/controllers/RouterController.ts +0 -1
- package/src/index.ts +0 -1
- package/src/utils/CoreHelperUtil.ts +10 -0
- package/lib/commonjs/utils/RouterUtil.js +0 -25
- package/lib/commonjs/utils/RouterUtil.js.map +0 -1
- package/lib/module/utils/RouterUtil.js +0 -21
- package/lib/module/utils/RouterUtil.js.map +0 -1
- package/lib/typescript/utils/RouterUtil.d.ts +0 -5
- package/lib/typescript/utils/RouterUtil.d.ts.map +0 -1
- package/src/utils/RouterUtil.ts +0 -21
|
@@ -108,91 +108,111 @@ export const ApiController = {
|
|
|
108
108
|
},
|
|
109
109
|
|
|
110
110
|
async fetchInstalledWallets() {
|
|
111
|
-
|
|
112
|
-
const
|
|
113
|
-
|
|
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
|
-
|
|
119
|
-
|
|
120
|
-
|
|
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
|
-
|
|
123
|
-
walletData = walletData.filter(({ id }) => includeWalletIds.includes(id));
|
|
124
|
-
}
|
|
123
|
+
if (!response) return;
|
|
125
124
|
|
|
126
|
-
|
|
127
|
-
return {
|
|
128
|
-
id: item.id,
|
|
129
|
-
isInstalled: await CoreHelperUtil.checkInstalled(item)
|
|
130
|
-
};
|
|
131
|
-
});
|
|
125
|
+
let { data: walletData } = response;
|
|
132
126
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
isInstalled: await CoreHelperUtil.checkInstalled(item)
|
|
137
|
-
};
|
|
138
|
-
});
|
|
127
|
+
if (includeWalletIds?.length) {
|
|
128
|
+
walletData = walletData.filter(({ id }) => includeWalletIds.includes(id));
|
|
129
|
+
}
|
|
139
130
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
131
|
+
const promises = walletData.map(async item => {
|
|
132
|
+
return {
|
|
133
|
+
id: item.id,
|
|
134
|
+
isInstalled: await CoreHelperUtil.checkInstalled(item)
|
|
135
|
+
};
|
|
136
|
+
});
|
|
143
137
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
headers: ApiController._getApiHeaders(),
|
|
150
|
-
params: {
|
|
151
|
-
page: '1',
|
|
152
|
-
platform: this.platform(),
|
|
153
|
-
entries: installed?.length.toString(),
|
|
154
|
-
include: installed?.join(','),
|
|
155
|
-
exclude: excludeWalletIds?.join(',')
|
|
156
|
-
}
|
|
138
|
+
const customPromises = customWallets?.map(async item => {
|
|
139
|
+
return {
|
|
140
|
+
id: item.id,
|
|
141
|
+
isInstalled: await CoreHelperUtil.checkInstalled(item)
|
|
142
|
+
};
|
|
157
143
|
});
|
|
158
144
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
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
|
+
}
|
|
165
177
|
}
|
|
166
|
-
}
|
|
167
178
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
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
|
+
}
|
|
178
191
|
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
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);
|
|
184
203
|
}
|
|
185
|
-
})
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
204
|
+
} catch (error) {
|
|
205
|
+
state.installed = [];
|
|
206
|
+
clearTimeout(timeoutId);
|
|
207
|
+
// eslint-disable-next-line no-console
|
|
208
|
+
console.log('Error fetching installed wallets', error);
|
|
190
209
|
}
|
|
191
210
|
},
|
|
192
211
|
|
|
193
212
|
async fetchFeaturedWallets() {
|
|
194
213
|
const { featuredWalletIds } = OptionsController.state;
|
|
195
214
|
const exclude = state.installed.map(({ id }) => id);
|
|
215
|
+
const chains = CoreHelperUtil.getRequestedCaipNetworkIds();
|
|
196
216
|
|
|
197
217
|
if (featuredWalletIds?.length) {
|
|
198
218
|
const response = await api.get<ApiGetWalletsResponse>({
|
|
@@ -205,7 +225,8 @@ export const ApiController = {
|
|
|
205
225
|
? String(featuredWalletIds.length)
|
|
206
226
|
: recommendedEntries,
|
|
207
227
|
include: featuredWalletIds?.join(','),
|
|
208
|
-
exclude: exclude?.join(',')
|
|
228
|
+
exclude: exclude?.join(','),
|
|
229
|
+
chains: chains.join(',')
|
|
209
230
|
}
|
|
210
231
|
});
|
|
211
232
|
if (!response) return;
|
|
@@ -237,6 +258,7 @@ export const ApiController = {
|
|
|
237
258
|
async fetchRecommendedWallets() {
|
|
238
259
|
const { installed } = ApiController.state;
|
|
239
260
|
const { includeWalletIds, excludeWalletIds, featuredWalletIds } = OptionsController.state;
|
|
261
|
+
const chains = CoreHelperUtil.getRequestedCaipNetworkIds();
|
|
240
262
|
|
|
241
263
|
const exclude = [
|
|
242
264
|
...installed.map(({ id }) => id),
|
|
@@ -252,7 +274,8 @@ export const ApiController = {
|
|
|
252
274
|
platform: this.platform(),
|
|
253
275
|
entries: recommendedEntries,
|
|
254
276
|
include: includeWalletIds?.join(','),
|
|
255
|
-
exclude: exclude?.join(',')
|
|
277
|
+
exclude: exclude?.join(','),
|
|
278
|
+
chains: chains.join(',')
|
|
256
279
|
}
|
|
257
280
|
});
|
|
258
281
|
|
|
@@ -275,6 +298,7 @@ export const ApiController = {
|
|
|
275
298
|
|
|
276
299
|
async fetchWallets({ page }: Pick<ApiGetWalletsRequest, 'page'>) {
|
|
277
300
|
const { includeWalletIds, excludeWalletIds, featuredWalletIds } = OptionsController.state;
|
|
301
|
+
const chains = CoreHelperUtil.getRequestedCaipNetworkIds();
|
|
278
302
|
const exclude = [
|
|
279
303
|
...state.installed.map(({ id }) => id),
|
|
280
304
|
...state.recommended.map(({ id }) => id),
|
|
@@ -289,7 +313,8 @@ export const ApiController = {
|
|
|
289
313
|
platform: this.platform(),
|
|
290
314
|
entries: String(defaultEntries),
|
|
291
315
|
include: includeWalletIds?.join(','),
|
|
292
|
-
exclude: exclude.join(',')
|
|
316
|
+
exclude: exclude.join(','),
|
|
317
|
+
chains: chains.join(',')
|
|
293
318
|
}
|
|
294
319
|
});
|
|
295
320
|
|
|
@@ -312,6 +337,7 @@ export const ApiController = {
|
|
|
312
337
|
|
|
313
338
|
async searchWallet({ search }: Pick<ApiGetWalletsRequest, 'search'>) {
|
|
314
339
|
const { includeWalletIds, excludeWalletIds } = OptionsController.state;
|
|
340
|
+
const chains = CoreHelperUtil.getRequestedCaipNetworkIds();
|
|
315
341
|
state.search = [];
|
|
316
342
|
const response = await api.get<ApiGetWalletsResponse>({
|
|
317
343
|
path: '/getWallets',
|
|
@@ -322,7 +348,8 @@ export const ApiController = {
|
|
|
322
348
|
entries: String(defaultEntries),
|
|
323
349
|
search,
|
|
324
350
|
include: includeWalletIds?.join(','),
|
|
325
|
-
exclude: excludeWalletIds?.join(',')
|
|
351
|
+
exclude: excludeWalletIds?.join(','),
|
|
352
|
+
chains: chains.join(',')
|
|
326
353
|
}
|
|
327
354
|
});
|
|
328
355
|
|
|
@@ -365,19 +392,22 @@ export const ApiController = {
|
|
|
365
392
|
try {
|
|
366
393
|
state.prefetchError = false;
|
|
367
394
|
state.prefetchLoading = true;
|
|
368
|
-
// this fetch must resolve first so we filter them in the other wallet requests
|
|
369
|
-
await ApiController.fetchInstalledWallets();
|
|
370
395
|
|
|
371
396
|
const promises = [
|
|
372
|
-
ApiController.fetchFeaturedWallets(),
|
|
373
|
-
ApiController.fetchRecommendedWallets(),
|
|
374
397
|
ApiController.fetchNetworkImages(),
|
|
375
398
|
ApiController.fetchCustomWalletImages()
|
|
376
399
|
];
|
|
400
|
+
|
|
377
401
|
if (OptionsController.state.enableAnalytics === undefined) {
|
|
378
402
|
promises.push(ApiController.fetchAnalyticsConfig());
|
|
379
403
|
}
|
|
380
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
|
+
|
|
381
411
|
state.prefetchPromise = Promise.race([
|
|
382
412
|
CoreHelperUtil.allSettled(promises),
|
|
383
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 =
|
|
122
|
+
const isSupported = ConstantsUtil.ACTIVITY_SUPPORTED_CHAINS.includes(chainId);
|
|
123
123
|
|
|
124
124
|
if (!isSupported) {
|
|
125
125
|
return { data: [], next: undefined };
|
|
@@ -247,16 +247,22 @@ export const ConnectionsController = {
|
|
|
247
247
|
baseState.connections = newConnectionsMap;
|
|
248
248
|
},
|
|
249
249
|
|
|
250
|
-
updateAccounts(namespace: ChainNamespace, accounts: CaipAddress[]) {
|
|
250
|
+
updateAccounts(namespace: ChainNamespace, accounts: CaipAddress[]): boolean {
|
|
251
251
|
const connection = baseState.connections.get(namespace);
|
|
252
252
|
if (!connection) {
|
|
253
|
-
return;
|
|
253
|
+
return false;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
if (connection.accounts.toString() === accounts.toString()) {
|
|
257
|
+
return false;
|
|
254
258
|
}
|
|
255
259
|
|
|
256
260
|
const newConnectionsMap = new Map(baseState.connections);
|
|
257
261
|
const updatedConnection = { ...connection, accounts };
|
|
258
262
|
newConnectionsMap.set(namespace, updatedConnection);
|
|
259
263
|
baseState.connections = newConnectionsMap;
|
|
264
|
+
|
|
265
|
+
return true;
|
|
260
266
|
},
|
|
261
267
|
|
|
262
268
|
updateBalance(namespace: ChainNamespace, address: CaipAddress, balance: Balance) {
|
|
@@ -354,6 +360,8 @@ export const ConnectionsController = {
|
|
|
354
360
|
const newConnection = { ...connection, type };
|
|
355
361
|
newConnectionsMap.set(namespace, newConnection);
|
|
356
362
|
baseState.connections = newConnectionsMap;
|
|
363
|
+
|
|
364
|
+
return getActiveAddress(newConnection);
|
|
357
365
|
},
|
|
358
366
|
|
|
359
367
|
async disconnect(namespace: ChainNamespace, isInternal = true) {
|
|
@@ -124,7 +124,11 @@ export const OnRampController = {
|
|
|
124
124
|
state.countriesDefaults?.find(d => d.countryCode === country.countryCode)
|
|
125
125
|
?.defaultCurrencyCode || 'USD';
|
|
126
126
|
|
|
127
|
-
|
|
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);
|
|
@@ -34,6 +34,7 @@ export interface OptionsControllerState {
|
|
|
34
34
|
features?: Features;
|
|
35
35
|
debug?: boolean;
|
|
36
36
|
defaultNetwork?: AppKitNetwork;
|
|
37
|
+
requestedNetworks?: AppKitNetwork[];
|
|
37
38
|
}
|
|
38
39
|
|
|
39
40
|
// -- State --------------------------------------------- //
|
|
@@ -112,6 +113,10 @@ export const OptionsController = {
|
|
|
112
113
|
state.defaultNetwork = defaultNetwork;
|
|
113
114
|
},
|
|
114
115
|
|
|
116
|
+
setRequestedNetworks(requestedNetworks?: OptionsControllerState['requestedNetworks']) {
|
|
117
|
+
state.requestedNetworks = requestedNetworks;
|
|
118
|
+
},
|
|
119
|
+
|
|
115
120
|
isClipboardAvailable() {
|
|
116
121
|
return !!state.clipboardClient;
|
|
117
122
|
},
|
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
|
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
import * as ct from 'countries-and-timezones';
|
|
19
19
|
|
|
20
20
|
import { ConstantsUtil } from './ConstantsUtil';
|
|
21
|
+
import { OptionsController } from '../controllers/OptionsController';
|
|
21
22
|
|
|
22
23
|
// -- Helpers -----------------------------------------------------------------
|
|
23
24
|
async function isAppInstalledIos(deepLink?: string): Promise<boolean> {
|
|
@@ -345,5 +346,14 @@ export const CoreHelperUtil = {
|
|
|
345
346
|
.join(',');
|
|
346
347
|
|
|
347
348
|
return `react-native-${adapterNames}-${version}`;
|
|
349
|
+
},
|
|
350
|
+
|
|
351
|
+
getRequestedCaipNetworkIds() {
|
|
352
|
+
const chains = OptionsController.state.requestedNetworks;
|
|
353
|
+
if (!chains) return [];
|
|
354
|
+
|
|
355
|
+
const requestedIds = chains.map(caipNetwork => caipNetwork.caipNetworkId);
|
|
356
|
+
|
|
357
|
+
return requestedIds;
|
|
348
358
|
}
|
|
349
359
|
};
|
|
@@ -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 +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"}
|
package/src/utils/RouterUtil.ts
DELETED
|
@@ -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
|
-
};
|