@reown/appkit-core-react-native 0.0.0-chore-spring-effect-20250909214820 → 0.0.0-chore-examples-20251009175707
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 +19 -8
- package/lib/commonjs/controllers/ApiController.js.map +1 -1
- package/lib/commonjs/controllers/BlockchainApiController.js +31 -28
- package/lib/commonjs/controllers/BlockchainApiController.js.map +1 -1
- package/lib/commonjs/controllers/ConnectionsController.js +13 -3
- package/lib/commonjs/controllers/ConnectionsController.js.map +1 -1
- package/lib/commonjs/controllers/EnsController.js +2 -0
- package/lib/commonjs/controllers/EnsController.js.map +1 -1
- package/lib/commonjs/controllers/EventsController.js +51 -1
- package/lib/commonjs/controllers/EventsController.js.map +1 -1
- package/lib/commonjs/controllers/LogController.js +188 -0
- package/lib/commonjs/controllers/LogController.js.map +1 -0
- package/lib/commonjs/controllers/OnRampController.js +14 -0
- 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 +18 -2
- package/lib/commonjs/controllers/SendController.js.map +1 -1
- package/lib/commonjs/controllers/SwapController.js +10 -2
- package/lib/commonjs/controllers/SwapController.js.map +1 -1
- package/lib/commonjs/controllers/ThemeController.js +5 -0
- package/lib/commonjs/controllers/ThemeController.js.map +1 -1
- package/lib/commonjs/controllers/TransactionsController.js +2 -0
- package/lib/commonjs/controllers/TransactionsController.js.map +1 -1
- package/lib/commonjs/features/reown-authentication/ReownAuthentication.js +272 -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 +28 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/utils/ApiUtil.js +1 -1
- package/lib/commonjs/utils/ApiUtil.js.map +1 -1
- package/lib/commonjs/utils/ConstantsUtil.js +0 -1
- 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 +7 -2
- package/lib/commonjs/utils/FetchUtil.js.map +1 -1
- package/lib/commonjs/utils/LogUtils.js +131 -0
- package/lib/commonjs/utils/LogUtils.js.map +1 -0
- package/lib/commonjs/utils/StorageUtil.js +75 -76
- package/lib/commonjs/utils/StorageUtil.js.map +1 -1
- package/lib/module/controllers/ApiController.js +19 -8
- package/lib/module/controllers/ApiController.js.map +1 -1
- package/lib/module/controllers/BlockchainApiController.js +31 -28
- package/lib/module/controllers/BlockchainApiController.js.map +1 -1
- package/lib/module/controllers/ConnectionsController.js +14 -4
- package/lib/module/controllers/ConnectionsController.js.map +1 -1
- package/lib/module/controllers/EnsController.js +2 -0
- package/lib/module/controllers/EnsController.js.map +1 -1
- package/lib/module/controllers/EventsController.js +51 -1
- package/lib/module/controllers/EventsController.js.map +1 -1
- package/lib/module/controllers/LogController.js +185 -0
- package/lib/module/controllers/LogController.js.map +1 -0
- package/lib/module/controllers/OnRampController.js +14 -0
- 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 +18 -2
- package/lib/module/controllers/SendController.js.map +1 -1
- package/lib/module/controllers/SwapController.js +10 -2
- package/lib/module/controllers/SwapController.js.map +1 -1
- package/lib/module/controllers/ThemeController.js +5 -0
- package/lib/module/controllers/ThemeController.js.map +1 -1
- package/lib/module/controllers/TransactionsController.js +2 -0
- package/lib/module/controllers/TransactionsController.js.map +1 -1
- package/lib/module/features/reown-authentication/ReownAuthentication.js +268 -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 +6 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/utils/ApiUtil.js +1 -1
- package/lib/module/utils/ApiUtil.js.map +1 -1
- package/lib/module/utils/ConstantsUtil.js +0 -1
- 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 +8 -2
- package/lib/module/utils/FetchUtil.js.map +1 -1
- package/lib/module/utils/LogUtils.js +121 -0
- package/lib/module/utils/LogUtils.js.map +1 -0
- package/lib/module/utils/StorageUtil.js +76 -77
- package/lib/module/utils/StorageUtil.js.map +1 -1
- package/lib/typescript/controllers/ApiController.d.ts +6 -4
- package/lib/typescript/controllers/ApiController.d.ts.map +1 -1
- package/lib/typescript/controllers/BlockchainApiController.d.ts.map +1 -1
- package/lib/typescript/controllers/ConnectionsController.d.ts +1 -0
- package/lib/typescript/controllers/ConnectionsController.d.ts.map +1 -1
- package/lib/typescript/controllers/EnsController.d.ts.map +1 -1
- package/lib/typescript/controllers/EventsController.d.ts +13 -1
- package/lib/typescript/controllers/EventsController.d.ts.map +1 -1
- package/lib/typescript/controllers/LogController.d.ts +65 -0
- package/lib/typescript/controllers/LogController.d.ts.map +1 -0
- 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/SwapController.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/controllers/TransactionsController.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 +4 -0
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/utils/ApiUtil.d.ts +1 -1
- package/lib/typescript/utils/ConstantsUtil.d.ts +0 -1
- package/lib/typescript/utils/ConstantsUtil.d.ts.map +1 -1
- package/lib/typescript/utils/CoreHelperUtil.d.ts +3 -2
- package/lib/typescript/utils/CoreHelperUtil.d.ts.map +1 -1
- package/lib/typescript/utils/FetchUtil.d.ts +2 -2
- package/lib/typescript/utils/FetchUtil.d.ts.map +1 -1
- package/lib/typescript/utils/LogUtils.d.ts +15 -0
- package/lib/typescript/utils/LogUtils.d.ts.map +1 -0
- package/lib/typescript/utils/StorageUtil.d.ts.map +1 -1
- package/package.json +6 -5
- package/src/controllers/ApiController.ts +28 -8
- package/src/controllers/BlockchainApiController.ts +39 -29
- package/src/controllers/ConnectionsController.ts +27 -3
- package/src/controllers/EnsController.ts +2 -0
- package/src/controllers/EventsController.ts +73 -2
- package/src/controllers/LogController.ts +250 -0
- package/src/controllers/OnRampController.ts +12 -0
- package/src/controllers/OptionsController.ts +11 -6
- package/src/controllers/RouterController.ts +3 -3
- package/src/controllers/SendController.ts +28 -3
- package/src/controllers/SwapController.ts +10 -2
- package/src/controllers/ThemeController.ts +7 -0
- package/src/controllers/TransactionsController.ts +2 -0
- package/src/features/reown-authentication/ReownAuthentication.ts +475 -0
- package/src/features/reown-authentication/ReownAuthenticationMessenger.ts +80 -0
- package/src/features/reown-authentication/index.ts +2 -0
- package/src/index.ts +12 -0
- package/src/utils/ApiUtil.ts +1 -1
- package/src/utils/ConstantsUtil.ts +0 -1
- package/src/utils/CoreHelperUtil.ts +21 -3
- package/src/utils/FetchUtil.ts +12 -3
- package/src/utils/LogUtils.ts +179 -0
- package/src/utils/StorageUtil.ts +85 -102
|
@@ -19,6 +19,7 @@ import { OptionsController } from './OptionsController';
|
|
|
19
19
|
import { ConstantsUtil, OnRampErrorType } from '../utils/ConstantsUtil';
|
|
20
20
|
import { StorageUtil } from '../utils/StorageUtil';
|
|
21
21
|
import { SnackController } from './SnackController';
|
|
22
|
+
import { LogController } from './LogController';
|
|
22
23
|
import { EventsController } from './EventsController';
|
|
23
24
|
import { BlockchainApiController, EXCLUDED_ONRAMP_PROVIDERS } from './BlockchainApiController';
|
|
24
25
|
import { ConnectionsController } from './ConnectionsController';
|
|
@@ -142,6 +143,7 @@ export const OnRampController = {
|
|
|
142
143
|
|
|
143
144
|
StorageUtil.setOnRampPreferredCountry(country);
|
|
144
145
|
} catch (error) {
|
|
146
|
+
LogController.sendError(error, 'OnRampController.ts', 'setSelectedCountry');
|
|
145
147
|
state.loading = false;
|
|
146
148
|
state.error = {
|
|
147
149
|
type: OnRampErrorType.FAILED_TO_LOAD_COUNTRIES,
|
|
@@ -240,6 +242,7 @@ export const OnRampController = {
|
|
|
240
242
|
countries.find(c => c.countryCode === countryCode) || countries[0] || undefined;
|
|
241
243
|
}
|
|
242
244
|
} catch (error) {
|
|
245
|
+
LogController.sendError(error, 'OnRampController.ts', 'fetchCountries');
|
|
243
246
|
state.error = {
|
|
244
247
|
type: OnRampErrorType.FAILED_TO_LOAD_COUNTRIES,
|
|
245
248
|
message: 'Failed to load countries'
|
|
@@ -261,6 +264,7 @@ export const OnRampController = {
|
|
|
261
264
|
|
|
262
265
|
state.countriesDefaults = countriesDefaults;
|
|
263
266
|
} catch (error) {
|
|
267
|
+
LogController.sendError(error, 'OnRampController.ts', 'fetchCountriesDefaults');
|
|
264
268
|
state.error = {
|
|
265
269
|
type: OnRampErrorType.FAILED_TO_LOAD_COUNTRIES,
|
|
266
270
|
message: 'Failed to load countries defaults'
|
|
@@ -282,6 +286,7 @@ export const OnRampController = {
|
|
|
282
286
|
|
|
283
287
|
state.serviceProviders = serviceProviders || [];
|
|
284
288
|
} catch (error) {
|
|
289
|
+
LogController.sendError(error, 'OnRampController.ts', 'fetchServiceProviders');
|
|
285
290
|
state.error = {
|
|
286
291
|
type: OnRampErrorType.FAILED_TO_LOAD_PROVIDERS,
|
|
287
292
|
message: 'Failed to load service providers'
|
|
@@ -313,6 +318,7 @@ export const OnRampController = {
|
|
|
313
318
|
|
|
314
319
|
state.selectedPaymentMethod = state.paymentMethods[0];
|
|
315
320
|
} catch (error) {
|
|
321
|
+
LogController.sendError(error, 'OnRampController.ts', 'fetchPaymentMethods');
|
|
316
322
|
state.error = {
|
|
317
323
|
type: OnRampErrorType.FAILED_TO_LOAD_METHODS,
|
|
318
324
|
message: 'Failed to load payment methods'
|
|
@@ -342,6 +348,7 @@ export const OnRampController = {
|
|
|
342
348
|
|
|
343
349
|
state.purchaseCurrency = selectedCurrency || undefined;
|
|
344
350
|
} catch (error) {
|
|
351
|
+
LogController.sendError(error, 'OnRampController.ts', 'fetchCryptoCurrencies');
|
|
345
352
|
state.error = {
|
|
346
353
|
type: OnRampErrorType.FAILED_TO_LOAD_CURRENCIES,
|
|
347
354
|
message: 'Failed to load crypto currencies'
|
|
@@ -385,6 +392,7 @@ export const OnRampController = {
|
|
|
385
392
|
this.setPaymentCurrency(defaultCurrency);
|
|
386
393
|
}
|
|
387
394
|
} catch (error) {
|
|
395
|
+
LogController.sendError(error, 'OnRampController.ts', 'fetchFiatCurrencies');
|
|
388
396
|
state.error = {
|
|
389
397
|
type: OnRampErrorType.FAILED_TO_LOAD_CURRENCIES,
|
|
390
398
|
message: 'Failed to load fiat currencies'
|
|
@@ -503,6 +511,7 @@ export const OnRampController = {
|
|
|
503
511
|
sp => sp.serviceProvider === state.selectedQuote?.serviceProvider
|
|
504
512
|
);
|
|
505
513
|
} catch (error: any) {
|
|
514
|
+
LogController.sendError(error, 'OnRampController.ts', 'getQuotes');
|
|
506
515
|
if (error.name === 'AbortError') {
|
|
507
516
|
// Do nothing, another request was made
|
|
508
517
|
return;
|
|
@@ -553,6 +562,7 @@ export const OnRampController = {
|
|
|
553
562
|
|
|
554
563
|
state.paymentCurrenciesLimits = limits;
|
|
555
564
|
} catch (error) {
|
|
565
|
+
LogController.sendError(error, 'OnRampController.ts', 'fetchFiatLimits');
|
|
556
566
|
state.error = {
|
|
557
567
|
type: OnRampErrorType.FAILED_TO_LOAD_LIMITS,
|
|
558
568
|
message: 'Failed to load fiat limits'
|
|
@@ -617,6 +627,7 @@ export const OnRampController = {
|
|
|
617
627
|
|
|
618
628
|
return widget;
|
|
619
629
|
} catch (e: any) {
|
|
630
|
+
LogController.sendError(e, 'OnRampController.ts', 'generateWidget', { quote });
|
|
620
631
|
EventsController.sendEvent({
|
|
621
632
|
type: 'track',
|
|
622
633
|
event: 'BUY_FAIL',
|
|
@@ -662,6 +673,7 @@ export const OnRampController = {
|
|
|
662
673
|
this.fetchFiatCurrencies()
|
|
663
674
|
]);
|
|
664
675
|
} catch (error) {
|
|
676
|
+
LogController.sendError(error, 'OnRampController.ts', 'loadOnRampData');
|
|
665
677
|
if (!state.error) {
|
|
666
678
|
state.error = {
|
|
667
679
|
type: OnRampErrorType.FAILED_TO_LOAD,
|
|
@@ -7,7 +7,8 @@ import type {
|
|
|
7
7
|
Features,
|
|
8
8
|
ProjectId,
|
|
9
9
|
SdkType,
|
|
10
|
-
SdkVersion
|
|
10
|
+
SdkVersion,
|
|
11
|
+
SIWXConfig
|
|
11
12
|
} from '@reown/appkit-common-react-native';
|
|
12
13
|
|
|
13
14
|
import { ConstantsUtil } from '../utils/ConstantsUtil';
|
|
@@ -29,7 +30,7 @@ export interface OptionsControllerState {
|
|
|
29
30
|
sdkType: SdkType;
|
|
30
31
|
sdkVersion: SdkVersion;
|
|
31
32
|
metadata?: Metadata;
|
|
32
|
-
|
|
33
|
+
siwx?: SIWXConfig;
|
|
33
34
|
isOnRampEnabled?: boolean;
|
|
34
35
|
features?: Features;
|
|
35
36
|
debug?: boolean;
|
|
@@ -87,10 +88,6 @@ export const OptionsController = {
|
|
|
87
88
|
state.metadata = metadata;
|
|
88
89
|
},
|
|
89
90
|
|
|
90
|
-
setIsSiweEnabled(isSiweEnabled: OptionsControllerState['isSiweEnabled']) {
|
|
91
|
-
state.isSiweEnabled = isSiweEnabled;
|
|
92
|
-
},
|
|
93
|
-
|
|
94
91
|
setFeatures(features: OptionsControllerState['features']) {
|
|
95
92
|
state.features = { ...ConstantsUtil.DEFAULT_FEATURES, ...features };
|
|
96
93
|
},
|
|
@@ -117,6 +114,14 @@ export const OptionsController = {
|
|
|
117
114
|
state.requestedNetworks = requestedNetworks;
|
|
118
115
|
},
|
|
119
116
|
|
|
117
|
+
setSiwx(siwx?: OptionsControllerState['siwx']) {
|
|
118
|
+
if (siwx && (siwx?.signOutOnDisconnect === undefined || siwx?.signOutOnDisconnect === null)) {
|
|
119
|
+
siwx.signOutOnDisconnect = true;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
state.siwx = siwx;
|
|
123
|
+
},
|
|
124
|
+
|
|
120
125
|
isClipboardAvailable() {
|
|
121
126
|
return !!state.clipboardClient;
|
|
122
127
|
},
|
|
@@ -15,23 +15,23 @@ export interface RouterControllerState {
|
|
|
15
15
|
| 'Connect'
|
|
16
16
|
| 'ConnectSocials'
|
|
17
17
|
| 'ConnectingExternal'
|
|
18
|
-
| 'ConnectingSiwe'
|
|
19
18
|
| 'ConnectingSocial'
|
|
20
|
-
| 'ConnectingWalletConnect'
|
|
21
19
|
| 'GetWallet'
|
|
22
20
|
| 'Networks'
|
|
23
|
-
| 'SwitchNetwork'
|
|
24
21
|
| 'OnRamp'
|
|
25
22
|
| 'OnRampCheckout'
|
|
26
23
|
| 'OnRampLoading'
|
|
27
24
|
| 'OnRampSettings'
|
|
28
25
|
| 'OnRampTransaction'
|
|
26
|
+
| 'SIWXSignMessage'
|
|
29
27
|
| 'Swap'
|
|
30
28
|
| 'SwapPreview'
|
|
29
|
+
| 'SwitchNetwork'
|
|
31
30
|
| 'Transactions'
|
|
32
31
|
| 'UnsupportedChain'
|
|
33
32
|
| 'UpgradeEmailWallet'
|
|
34
33
|
| 'WalletCompatibleNetworks'
|
|
34
|
+
| 'WalletConnect'
|
|
35
35
|
| 'WalletReceive'
|
|
36
36
|
| 'WalletSend'
|
|
37
37
|
| 'WalletSendPreview'
|
|
@@ -8,6 +8,8 @@ import { EventsController } from './EventsController';
|
|
|
8
8
|
import { RouterController } from './RouterController';
|
|
9
9
|
import { ConnectionsController } from './ConnectionsController';
|
|
10
10
|
import { SwapController } from './SwapController';
|
|
11
|
+
import { ConstantsUtil as CoreConstantsUtil } from '../utils/ConstantsUtil';
|
|
12
|
+
import { LogController } from './LogController';
|
|
11
13
|
|
|
12
14
|
// -- Types --------------------------------------------- //
|
|
13
15
|
export interface TxParams {
|
|
@@ -85,7 +87,7 @@ export const SendController = {
|
|
|
85
87
|
isSmartAccount: ConnectionsController.state.accountType === 'smartAccount',
|
|
86
88
|
token: this.state.token?.address ?? this.state.token?.symbol ?? '',
|
|
87
89
|
amount: this.state.sendTokenAmount || 0,
|
|
88
|
-
network: ConnectionsController.state.activeNetwork?.caipNetworkId
|
|
90
|
+
network: ConnectionsController.state.activeNetwork?.caipNetworkId
|
|
89
91
|
};
|
|
90
92
|
|
|
91
93
|
try {
|
|
@@ -118,13 +120,22 @@ export const SendController = {
|
|
|
118
120
|
});
|
|
119
121
|
RouterController.reset(isAuth ? 'Account' : 'AccountDefault');
|
|
120
122
|
this.resetState();
|
|
121
|
-
} catch (error) {
|
|
123
|
+
} catch (error: any) {
|
|
124
|
+
LogController.sendError(error, 'SendController.ts', 'sendToken');
|
|
122
125
|
EventsController.sendEvent({
|
|
123
126
|
type: 'track',
|
|
124
127
|
event: 'SEND_ERROR',
|
|
125
128
|
properties: eventProperties
|
|
126
129
|
});
|
|
127
|
-
|
|
130
|
+
|
|
131
|
+
if (
|
|
132
|
+
error?.message &&
|
|
133
|
+
(error?.message.includes('user rejected') || error?.message.includes('canceled'))
|
|
134
|
+
) {
|
|
135
|
+
SnackController.showError('Transaction cancelled');
|
|
136
|
+
} else {
|
|
137
|
+
SnackController.showError('Something went wrong');
|
|
138
|
+
}
|
|
128
139
|
} finally {
|
|
129
140
|
this.state.loading = false;
|
|
130
141
|
}
|
|
@@ -222,7 +233,21 @@ export const SendController = {
|
|
|
222
233
|
throw new Error('Invalid address');
|
|
223
234
|
}
|
|
224
235
|
|
|
236
|
+
let tokenMint: string | undefined;
|
|
237
|
+
|
|
238
|
+
if (
|
|
239
|
+
SendController.state.token &&
|
|
240
|
+
SendController.state.token.address !== CoreConstantsUtil.NATIVE_TOKEN_ADDRESS.solana
|
|
241
|
+
) {
|
|
242
|
+
if (CoreHelperUtil.isCaipAddress(SendController.state.token.address)) {
|
|
243
|
+
tokenMint = CoreHelperUtil.getPlainAddress(SendController.state.token.address);
|
|
244
|
+
} else {
|
|
245
|
+
tokenMint = SendController.state.token.address;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
|
|
225
249
|
await ConnectionsController.sendTransaction({
|
|
250
|
+
tokenMint,
|
|
226
251
|
fromAddress: plainAddress,
|
|
227
252
|
toAddress: this.state.receiverAddress,
|
|
228
253
|
amount: this.state.sendTokenAmount,
|
|
@@ -14,6 +14,7 @@ import { BlockchainApiController } from './BlockchainApiController';
|
|
|
14
14
|
import { OptionsController } from './OptionsController';
|
|
15
15
|
import { SwapCalculationUtil } from '../utils/SwapCalculationUtil';
|
|
16
16
|
import { SnackController } from './SnackController';
|
|
17
|
+
import { LogController } from './LogController';
|
|
17
18
|
import { RouterController } from './RouterController';
|
|
18
19
|
import { CoreHelperUtil } from '../utils/CoreHelperUtil';
|
|
19
20
|
import { TransactionsController } from './TransactionsController';
|
|
@@ -249,6 +250,7 @@ export const SwapController = {
|
|
|
249
250
|
this.setSourceTokenAmount('1');
|
|
250
251
|
}
|
|
251
252
|
} catch (error) {
|
|
253
|
+
LogController.sendError(error, 'SwapController.ts', 'initializeState');
|
|
252
254
|
SnackController.showError('Failed to initialize swap');
|
|
253
255
|
RouterController.goBack();
|
|
254
256
|
} finally {
|
|
@@ -491,6 +493,7 @@ export const SwapController = {
|
|
|
491
493
|
this.setTransactionDetails();
|
|
492
494
|
}
|
|
493
495
|
} catch (error) {
|
|
496
|
+
LogController.sendError(error, 'SwapController.ts', 'getQuote');
|
|
494
497
|
SnackController.showError('Failed to get swap quote');
|
|
495
498
|
} finally {
|
|
496
499
|
state.loadingQuote = false;
|
|
@@ -729,7 +732,7 @@ export const SwapController = {
|
|
|
729
732
|
type: 'track',
|
|
730
733
|
event: 'SWAP_SUCCESS',
|
|
731
734
|
properties: {
|
|
732
|
-
network: ConnectionsController.state.activeNetwork?.caipNetworkId
|
|
735
|
+
network: ConnectionsController.state.activeNetwork?.caipNetworkId,
|
|
733
736
|
swapFromToken: this.state.sourceToken?.symbol || '',
|
|
734
737
|
swapToToken: this.state.toToken?.symbol || '',
|
|
735
738
|
swapFromAmount: this.state.sourceTokenAmount || '',
|
|
@@ -750,6 +753,11 @@ export const SwapController = {
|
|
|
750
753
|
return transactionHash;
|
|
751
754
|
} catch (err) {
|
|
752
755
|
const error = err as TransactionError;
|
|
756
|
+
LogController.sendError(error, 'SwapController.ts', 'sendTransactionForSwap', {
|
|
757
|
+
sourceToken: this.state.sourceToken?.symbol,
|
|
758
|
+
toToken: this.state.toToken?.symbol,
|
|
759
|
+
amount: this.state.sourceTokenAmount
|
|
760
|
+
});
|
|
753
761
|
state.transactionError = error?.shortMessage;
|
|
754
762
|
state.loadingTransaction = false;
|
|
755
763
|
SnackController.showError(error?.shortMessage ?? 'Transaction error');
|
|
@@ -758,7 +766,7 @@ export const SwapController = {
|
|
|
758
766
|
event: 'SWAP_ERROR',
|
|
759
767
|
properties: {
|
|
760
768
|
message: error?.shortMessage ?? error?.message ?? 'Unknown',
|
|
761
|
-
network: ConnectionsController.state.activeNetwork?.caipNetworkId
|
|
769
|
+
network: ConnectionsController.state.activeNetwork?.caipNetworkId,
|
|
762
770
|
swapFromToken: this.state.sourceToken?.symbol || '',
|
|
763
771
|
swapToToken: this.state.toToken?.symbol || '',
|
|
764
772
|
swapFromAmount: this.state.sourceTokenAmount || '',
|
|
@@ -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 = {};
|
|
@@ -5,6 +5,7 @@ import { EventsController } from './EventsController';
|
|
|
5
5
|
import { SnackController } from './SnackController';
|
|
6
6
|
import { BlockchainApiController } from './BlockchainApiController';
|
|
7
7
|
import { ConnectionsController } from './ConnectionsController';
|
|
8
|
+
import { LogController } from './LogController';
|
|
8
9
|
|
|
9
10
|
// -- Types --------------------------------------------- //
|
|
10
11
|
type TransactionByMonthMap = Record<string, Transaction[]>;
|
|
@@ -74,6 +75,7 @@ export const TransactionsController = {
|
|
|
74
75
|
state.empty = nonSpamTransactions.length === 0;
|
|
75
76
|
state.next = response?.next ? response.next : undefined;
|
|
76
77
|
} catch (error) {
|
|
78
|
+
LogController.sendError(error, 'TransactionsController.ts', 'fetchTransactions');
|
|
77
79
|
EventsController.sendEvent({
|
|
78
80
|
type: 'track',
|
|
79
81
|
event: 'ERROR_FETCH_TRANSACTIONS',
|