@reown/appkit-core-react-native 2.0.0-alpha.4 → 2.0.0-alpha.6
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 +102 -84
- 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 +34 -21
- package/lib/commonjs/controllers/ConnectionsController.js.map +1 -1
- package/lib/commonjs/controllers/ModalController.js +4 -1
- package/lib/commonjs/controllers/ModalController.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 +6 -3
- package/lib/commonjs/controllers/OptionsController.js.map +1 -1
- package/lib/commonjs/controllers/SendController.js +15 -1
- package/lib/commonjs/controllers/SendController.js.map +1 -1
- package/lib/commonjs/controllers/ThemeController.js +5 -0
- package/lib/commonjs/controllers/ThemeController.js.map +1 -1
- package/lib/commonjs/features/reown-authentication/ReownAuthentication.js +264 -0
- package/lib/commonjs/features/reown-authentication/ReownAuthentication.js.map +1 -0
- package/lib/commonjs/features/reown-authentication/ReownAuthenticationMessenger.js +48 -0
- package/lib/commonjs/features/reown-authentication/ReownAuthenticationMessenger.js.map +1 -0
- package/lib/commonjs/features/reown-authentication/index.js +28 -0
- package/lib/commonjs/features/reown-authentication/index.js.map +1 -0
- package/lib/commonjs/index.js +12 -5
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/utils/ConstantsUtil.js +1 -5
- package/lib/commonjs/utils/ConstantsUtil.js.map +1 -1
- package/lib/commonjs/utils/CoreHelperUtil.js +13 -2
- package/lib/commonjs/utils/CoreHelperUtil.js.map +1 -1
- package/lib/commonjs/utils/FetchUtil.js.map +1 -1
- package/lib/commonjs/utils/StorageUtil.js +27 -27
- package/lib/commonjs/utils/StorageUtil.js.map +1 -1
- package/lib/module/controllers/ApiController.js +102 -84
- 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 +35 -22
- package/lib/module/controllers/ConnectionsController.js.map +1 -1
- package/lib/module/controllers/ModalController.js +4 -1
- package/lib/module/controllers/ModalController.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 +6 -3
- package/lib/module/controllers/OptionsController.js.map +1 -1
- package/lib/module/controllers/SendController.js +15 -1
- package/lib/module/controllers/SendController.js.map +1 -1
- package/lib/module/controllers/ThemeController.js +5 -0
- package/lib/module/controllers/ThemeController.js.map +1 -1
- package/lib/module/features/reown-authentication/ReownAuthentication.js +260 -0
- package/lib/module/features/reown-authentication/ReownAuthentication.js.map +1 -0
- package/lib/module/features/reown-authentication/ReownAuthenticationMessenger.js +43 -0
- package/lib/module/features/reown-authentication/ReownAuthenticationMessenger.js.map +1 -0
- package/lib/module/features/reown-authentication/index.js +5 -0
- package/lib/module/features/reown-authentication/index.js.map +1 -0
- package/lib/module/index.js +4 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/utils/ConstantsUtil.js +1 -5
- package/lib/module/utils/ConstantsUtil.js.map +1 -1
- package/lib/module/utils/CoreHelperUtil.js +13 -2
- package/lib/module/utils/CoreHelperUtil.js.map +1 -1
- package/lib/module/utils/FetchUtil.js.map +1 -1
- package/lib/module/utils/StorageUtil.js +28 -28
- package/lib/module/utils/StorageUtil.js.map +1 -1
- package/lib/typescript/controllers/ApiController.d.ts.map +1 -1
- package/lib/typescript/controllers/ConnectionsController.d.ts +3 -2
- package/lib/typescript/controllers/ConnectionsController.d.ts.map +1 -1
- package/lib/typescript/controllers/ModalController.d.ts.map +1 -1
- package/lib/typescript/controllers/OnRampController.d.ts.map +1 -1
- package/lib/typescript/controllers/OptionsController.d.ts +3 -3
- 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/controllers/SendController.d.ts.map +1 -1
- package/lib/typescript/controllers/ThemeController.d.ts +2 -0
- package/lib/typescript/controllers/ThemeController.d.ts.map +1 -1
- package/lib/typescript/features/reown-authentication/ReownAuthentication.d.ts +174 -0
- package/lib/typescript/features/reown-authentication/ReownAuthentication.d.ts.map +1 -0
- package/lib/typescript/features/reown-authentication/ReownAuthenticationMessenger.d.ts +16 -0
- package/lib/typescript/features/reown-authentication/ReownAuthenticationMessenger.d.ts.map +1 -0
- package/lib/typescript/features/reown-authentication/index.d.ts +3 -0
- package/lib/typescript/features/reown-authentication/index.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +2 -1
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/utils/ConstantsUtil.d.ts.map +1 -1
- package/lib/typescript/utils/CoreHelperUtil.d.ts +2 -1
- package/lib/typescript/utils/CoreHelperUtil.d.ts.map +1 -1
- package/lib/typescript/utils/FetchUtil.d.ts +1 -1
- package/lib/typescript/utils/FetchUtil.d.ts.map +1 -1
- package/lib/typescript/utils/StorageUtil.d.ts.map +1 -1
- package/package.json +6 -5
- package/src/controllers/ApiController.ts +93 -73
- package/src/controllers/BlockchainApiController.ts +1 -1
- package/src/controllers/ConnectionsController.ts +60 -20
- package/src/controllers/ModalController.ts +5 -1
- package/src/controllers/OnRampController.ts +5 -1
- package/src/controllers/OptionsController.ts +11 -6
- package/src/controllers/RouterController.ts +3 -3
- package/src/controllers/SendController.ts +22 -2
- package/src/controllers/ThemeController.ts +7 -0
- package/src/features/reown-authentication/ReownAuthentication.ts +470 -0
- package/src/features/reown-authentication/ReownAuthenticationMessenger.ts +80 -0
- package/src/features/reown-authentication/index.ts +2 -0
- package/src/index.ts +4 -1
- package/src/utils/ConstantsUtil.ts +1 -5
- package/src/utils/CoreHelperUtil.ts +20 -2
- package/src/utils/FetchUtil.ts +1 -1
- package/src/utils/StorageUtil.ts +37 -53
- 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
package/src/utils/StorageUtil.ts
CHANGED
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
type ConnectorType,
|
|
11
11
|
type ChainNamespace,
|
|
12
12
|
type WalletDeepLink,
|
|
13
|
-
|
|
13
|
+
SafeStorageKeys
|
|
14
14
|
} from '@reown/appkit-common-react-native';
|
|
15
15
|
import { OptionsController } from '../controllers/OptionsController';
|
|
16
16
|
|
|
@@ -18,7 +18,7 @@ import { OptionsController } from '../controllers/OptionsController';
|
|
|
18
18
|
export const StorageUtil = {
|
|
19
19
|
setWalletConnectDeepLink({ href, name }: WalletDeepLink) {
|
|
20
20
|
try {
|
|
21
|
-
OptionsController.getStorage().setItem(
|
|
21
|
+
OptionsController.getStorage().setItem(SafeStorageKeys.WC_DEEPLINK, {
|
|
22
22
|
href,
|
|
23
23
|
name
|
|
24
24
|
});
|
|
@@ -30,7 +30,7 @@ export const StorageUtil = {
|
|
|
30
30
|
async getWalletConnectDeepLink() {
|
|
31
31
|
try {
|
|
32
32
|
const deepLink = await OptionsController.getStorage().getItem<WalletDeepLink>(
|
|
33
|
-
|
|
33
|
+
SafeStorageKeys.WC_DEEPLINK
|
|
34
34
|
);
|
|
35
35
|
if (deepLink) {
|
|
36
36
|
return deepLink;
|
|
@@ -44,7 +44,7 @@ export const StorageUtil = {
|
|
|
44
44
|
|
|
45
45
|
async removeWalletConnectDeepLink() {
|
|
46
46
|
try {
|
|
47
|
-
await OptionsController.getStorage().removeItem(
|
|
47
|
+
await OptionsController.getStorage().removeItem(SafeStorageKeys.WC_DEEPLINK);
|
|
48
48
|
} catch {
|
|
49
49
|
console.info('Unable to remove WalletConnect deep link');
|
|
50
50
|
}
|
|
@@ -63,10 +63,7 @@ export const StorageUtil = {
|
|
|
63
63
|
if (recentWallets.length > 2) {
|
|
64
64
|
recentWallets.pop();
|
|
65
65
|
}
|
|
66
|
-
OptionsController.getStorage().setItem(
|
|
67
|
-
ConstantsUtil.STORAGE_KEYS.RECENT_WALLET,
|
|
68
|
-
recentWallets
|
|
69
|
-
);
|
|
66
|
+
OptionsController.getStorage().setItem(SafeStorageKeys.RECENT_WALLET, recentWallets);
|
|
70
67
|
|
|
71
68
|
return recentWallets;
|
|
72
69
|
} catch {
|
|
@@ -78,10 +75,7 @@ export const StorageUtil = {
|
|
|
78
75
|
|
|
79
76
|
async setRecentWallets(wallets: WcWallet[]) {
|
|
80
77
|
try {
|
|
81
|
-
await OptionsController.getStorage().setItem(
|
|
82
|
-
ConstantsUtil.STORAGE_KEYS.RECENT_WALLET,
|
|
83
|
-
wallets
|
|
84
|
-
);
|
|
78
|
+
await OptionsController.getStorage().setItem(SafeStorageKeys.RECENT_WALLET, wallets);
|
|
85
79
|
} catch {
|
|
86
80
|
console.info('Unable to set recent wallets');
|
|
87
81
|
}
|
|
@@ -89,9 +83,7 @@ export const StorageUtil = {
|
|
|
89
83
|
|
|
90
84
|
async getRecentWallets(): Promise<WcWallet[]> {
|
|
91
85
|
try {
|
|
92
|
-
const recent = await OptionsController.getStorage().getItem(
|
|
93
|
-
ConstantsUtil.STORAGE_KEYS.RECENT_WALLET
|
|
94
|
-
);
|
|
86
|
+
const recent = await OptionsController.getStorage().getItem(SafeStorageKeys.RECENT_WALLET);
|
|
95
87
|
|
|
96
88
|
return recent ?? [];
|
|
97
89
|
} catch {
|
|
@@ -114,7 +106,7 @@ export const StorageUtil = {
|
|
|
114
106
|
if (!currentConnectors.some(c => c.type === type)) {
|
|
115
107
|
const updatedConnectors = [...currentConnectors, { type, namespaces }];
|
|
116
108
|
await OptionsController.getStorage().setItem(
|
|
117
|
-
|
|
109
|
+
SafeStorageKeys.CONNECTED_CONNECTORS,
|
|
118
110
|
updatedConnectors
|
|
119
111
|
);
|
|
120
112
|
}
|
|
@@ -127,7 +119,7 @@ export const StorageUtil = {
|
|
|
127
119
|
try {
|
|
128
120
|
const connectors = await OptionsController.getStorage().getItem<
|
|
129
121
|
{ type: ConnectorType; namespaces: string[] }[]
|
|
130
|
-
>(
|
|
122
|
+
>(SafeStorageKeys.CONNECTED_CONNECTORS);
|
|
131
123
|
|
|
132
124
|
return connectors ?? [];
|
|
133
125
|
} catch (err) {
|
|
@@ -142,7 +134,7 @@ export const StorageUtil = {
|
|
|
142
134
|
const currentConnectors = await StorageUtil.getConnectedConnectors();
|
|
143
135
|
const updatedConnectors = currentConnectors.filter(c => c.type !== type);
|
|
144
136
|
await OptionsController.getStorage().setItem(
|
|
145
|
-
|
|
137
|
+
SafeStorageKeys.CONNECTED_CONNECTORS,
|
|
146
138
|
updatedConnectors
|
|
147
139
|
);
|
|
148
140
|
} catch {
|
|
@@ -153,7 +145,7 @@ export const StorageUtil = {
|
|
|
153
145
|
async setOnRampPreferredCountry(country: OnRampCountry) {
|
|
154
146
|
try {
|
|
155
147
|
await OptionsController.getStorage().setItem(
|
|
156
|
-
|
|
148
|
+
SafeStorageKeys.ONRAMP_PREFERRED_COUNTRY,
|
|
157
149
|
country
|
|
158
150
|
);
|
|
159
151
|
} catch {
|
|
@@ -164,7 +156,7 @@ export const StorageUtil = {
|
|
|
164
156
|
async getOnRampPreferredCountry() {
|
|
165
157
|
try {
|
|
166
158
|
const country = await OptionsController.getStorage().getItem<OnRampCountry>(
|
|
167
|
-
|
|
159
|
+
SafeStorageKeys.ONRAMP_PREFERRED_COUNTRY
|
|
168
160
|
);
|
|
169
161
|
|
|
170
162
|
return country ?? undefined;
|
|
@@ -178,7 +170,7 @@ export const StorageUtil = {
|
|
|
178
170
|
async setOnRampPreferredFiatCurrency(currency: OnRampFiatCurrency) {
|
|
179
171
|
try {
|
|
180
172
|
await OptionsController.getStorage().setItem(
|
|
181
|
-
|
|
173
|
+
SafeStorageKeys.ONRAMP_PREFERRED_FIAT_CURRENCY,
|
|
182
174
|
currency
|
|
183
175
|
);
|
|
184
176
|
} catch {
|
|
@@ -189,7 +181,7 @@ export const StorageUtil = {
|
|
|
189
181
|
async getOnRampPreferredFiatCurrency() {
|
|
190
182
|
try {
|
|
191
183
|
const currency = await OptionsController.getStorage().getItem<OnRampFiatCurrency>(
|
|
192
|
-
|
|
184
|
+
SafeStorageKeys.ONRAMP_PREFERRED_FIAT_CURRENCY
|
|
193
185
|
);
|
|
194
186
|
|
|
195
187
|
return currency ?? undefined;
|
|
@@ -202,10 +194,7 @@ export const StorageUtil = {
|
|
|
202
194
|
|
|
203
195
|
async setOnRampCountries(countries: OnRampCountry[]) {
|
|
204
196
|
try {
|
|
205
|
-
await OptionsController.getStorage().setItem(
|
|
206
|
-
ConstantsUtil.STORAGE_KEYS.ONRAMP_COUNTRIES,
|
|
207
|
-
countries
|
|
208
|
-
);
|
|
197
|
+
await OptionsController.getStorage().setItem(SafeStorageKeys.ONRAMP_COUNTRIES, countries);
|
|
209
198
|
} catch {
|
|
210
199
|
console.info('Unable to set OnRamp Countries');
|
|
211
200
|
}
|
|
@@ -214,7 +203,7 @@ export const StorageUtil = {
|
|
|
214
203
|
async getOnRampCountries() {
|
|
215
204
|
try {
|
|
216
205
|
const countries = await OptionsController.getStorage().getItem<OnRampCountry[]>(
|
|
217
|
-
|
|
206
|
+
SafeStorageKeys.ONRAMP_COUNTRIES
|
|
218
207
|
);
|
|
219
208
|
|
|
220
209
|
return countries ?? [];
|
|
@@ -229,10 +218,10 @@ export const StorageUtil = {
|
|
|
229
218
|
try {
|
|
230
219
|
const timestamp = Date.now();
|
|
231
220
|
|
|
232
|
-
await OptionsController.getStorage().setItem(
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
);
|
|
221
|
+
await OptionsController.getStorage().setItem(SafeStorageKeys.ONRAMP_COUNTRIES_DEFAULTS, {
|
|
222
|
+
data: countriesDefaults,
|
|
223
|
+
timestamp
|
|
224
|
+
});
|
|
236
225
|
} catch {
|
|
237
226
|
console.info('Unable to set OnRamp Countries Defaults');
|
|
238
227
|
}
|
|
@@ -241,7 +230,7 @@ export const StorageUtil = {
|
|
|
241
230
|
async getOnRampCountriesDefaults() {
|
|
242
231
|
try {
|
|
243
232
|
const result = await OptionsController.getStorage().getItem(
|
|
244
|
-
|
|
233
|
+
SafeStorageKeys.ONRAMP_COUNTRIES_DEFAULTS
|
|
245
234
|
);
|
|
246
235
|
|
|
247
236
|
if (!result) {
|
|
@@ -267,10 +256,10 @@ export const StorageUtil = {
|
|
|
267
256
|
try {
|
|
268
257
|
const timestamp = Date.now();
|
|
269
258
|
|
|
270
|
-
await OptionsController.getStorage().setItem(
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
);
|
|
259
|
+
await OptionsController.getStorage().setItem(SafeStorageKeys.ONRAMP_SERVICE_PROVIDERS, {
|
|
260
|
+
data: serviceProviders,
|
|
261
|
+
timestamp
|
|
262
|
+
});
|
|
274
263
|
} catch {
|
|
275
264
|
console.info('Unable to set OnRamp Service Providers');
|
|
276
265
|
}
|
|
@@ -279,7 +268,7 @@ export const StorageUtil = {
|
|
|
279
268
|
async getOnRampServiceProviders() {
|
|
280
269
|
try {
|
|
281
270
|
const result = await OptionsController.getStorage().getItem(
|
|
282
|
-
|
|
271
|
+
SafeStorageKeys.ONRAMP_SERVICE_PROVIDERS
|
|
283
272
|
);
|
|
284
273
|
|
|
285
274
|
if (!result) {
|
|
@@ -306,7 +295,7 @@ export const StorageUtil = {
|
|
|
306
295
|
try {
|
|
307
296
|
const timestamp = Date.now();
|
|
308
297
|
|
|
309
|
-
await OptionsController.getStorage().setItem(
|
|
298
|
+
await OptionsController.getStorage().setItem(SafeStorageKeys.ONRAMP_FIAT_LIMITS, {
|
|
310
299
|
data: fiatLimits,
|
|
311
300
|
timestamp
|
|
312
301
|
});
|
|
@@ -318,7 +307,7 @@ export const StorageUtil = {
|
|
|
318
307
|
async getOnRampFiatLimits() {
|
|
319
308
|
try {
|
|
320
309
|
const result = await OptionsController.getStorage().getItem(
|
|
321
|
-
|
|
310
|
+
SafeStorageKeys.ONRAMP_FIAT_LIMITS
|
|
322
311
|
);
|
|
323
312
|
|
|
324
313
|
if (!result) {
|
|
@@ -344,10 +333,10 @@ export const StorageUtil = {
|
|
|
344
333
|
try {
|
|
345
334
|
const timestamp = Date.now();
|
|
346
335
|
|
|
347
|
-
await OptionsController.getStorage().setItem(
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
);
|
|
336
|
+
await OptionsController.getStorage().setItem(SafeStorageKeys.ONRAMP_FIAT_CURRENCIES, {
|
|
337
|
+
data: fiatCurrencies,
|
|
338
|
+
timestamp
|
|
339
|
+
});
|
|
351
340
|
} catch {
|
|
352
341
|
console.info('Unable to set OnRamp Fiat Currencies');
|
|
353
342
|
}
|
|
@@ -356,7 +345,7 @@ export const StorageUtil = {
|
|
|
356
345
|
async getOnRampFiatCurrencies() {
|
|
357
346
|
try {
|
|
358
347
|
const result = await OptionsController.getStorage().getItem(
|
|
359
|
-
|
|
348
|
+
SafeStorageKeys.ONRAMP_FIAT_CURRENCIES
|
|
360
349
|
);
|
|
361
350
|
|
|
362
351
|
if (!result) {
|
|
@@ -381,17 +370,12 @@ export const StorageUtil = {
|
|
|
381
370
|
async setActiveNamespace(namespace?: ChainNamespace) {
|
|
382
371
|
try {
|
|
383
372
|
if (!namespace) {
|
|
384
|
-
await OptionsController.getStorage().removeItem(
|
|
385
|
-
ConstantsUtil.STORAGE_KEYS.ACTIVE_NAMESPACE
|
|
386
|
-
);
|
|
373
|
+
await OptionsController.getStorage().removeItem(SafeStorageKeys.ACTIVE_NAMESPACE);
|
|
387
374
|
|
|
388
375
|
return;
|
|
389
376
|
}
|
|
390
377
|
|
|
391
|
-
await OptionsController.getStorage().setItem(
|
|
392
|
-
ConstantsUtil.STORAGE_KEYS.ACTIVE_NAMESPACE,
|
|
393
|
-
namespace
|
|
394
|
-
);
|
|
378
|
+
await OptionsController.getStorage().setItem(SafeStorageKeys.ACTIVE_NAMESPACE, namespace);
|
|
395
379
|
} catch {
|
|
396
380
|
console.info('Unable to set Active Namespace');
|
|
397
381
|
}
|
|
@@ -400,7 +384,7 @@ export const StorageUtil = {
|
|
|
400
384
|
async getActiveNamespace() {
|
|
401
385
|
try {
|
|
402
386
|
const namespace = (await OptionsController.getStorage().getItem(
|
|
403
|
-
|
|
387
|
+
SafeStorageKeys.ACTIVE_NAMESPACE
|
|
404
388
|
)) as ChainNamespace;
|
|
405
389
|
|
|
406
390
|
return namespace ?? undefined;
|
|
@@ -414,7 +398,7 @@ export const StorageUtil = {
|
|
|
414
398
|
|
|
415
399
|
async removeActiveNamespace() {
|
|
416
400
|
try {
|
|
417
|
-
await OptionsController.getStorage().removeItem(
|
|
401
|
+
await OptionsController.getStorage().removeItem(SafeStorageKeys.ACTIVE_NAMESPACE);
|
|
418
402
|
} catch {
|
|
419
403
|
console.info('Unable to remove Active Namespace');
|
|
420
404
|
}
|
|
@@ -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
|
-
};
|