@reown/appkit-core-react-native 2.0.0-alpha.6 → 2.0.1
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 +10 -0
- 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/SendController.js +4 -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/TransactionsController.js +2 -0
- package/lib/commonjs/controllers/TransactionsController.js.map +1 -1
- package/lib/commonjs/features/reown-authentication/ReownAuthentication.js +14 -6
- package/lib/commonjs/features/reown-authentication/ReownAuthentication.js.map +1 -1
- package/lib/commonjs/index.js +14 -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.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 +48 -49
- 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 +10 -0
- 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/SendController.js +4 -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/TransactionsController.js +2 -0
- package/lib/module/controllers/TransactionsController.js.map +1 -1
- package/lib/module/features/reown-authentication/ReownAuthentication.js +14 -6
- package/lib/module/features/reown-authentication/ReownAuthentication.js.map +1 -1
- package/lib/module/index.js +2 -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.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 +48 -49
- 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/SendController.d.ts.map +1 -1
- package/lib/typescript/controllers/SwapController.d.ts.map +1 -1
- package/lib/typescript/controllers/TransactionsController.d.ts.map +1 -1
- package/lib/typescript/features/reown-authentication/ReownAuthentication.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +2 -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 +1 -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/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 +2 -2
- package/src/controllers/ApiController.ts +28 -8
- package/src/controllers/BlockchainApiController.ts +39 -29
- package/src/controllers/ConnectionsController.ts +14 -0
- 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/SendController.ts +7 -2
- package/src/controllers/SwapController.ts +10 -2
- package/src/controllers/TransactionsController.ts +2 -0
- package/src/features/reown-authentication/ReownAuthentication.ts +11 -6
- package/src/index.ts +8 -0
- package/src/utils/ApiUtil.ts +1 -1
- package/src/utils/ConstantsUtil.ts +0 -1
- package/src/utils/CoreHelperUtil.ts +1 -1
- package/src/utils/FetchUtil.ts +11 -2
- package/src/utils/LogUtils.ts +179 -0
- package/src/utils/StorageUtil.ts +48 -49
package/src/utils/FetchUtil.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { RequestCache } from '@reown/appkit-common-react-native';
|
|
2
|
+
import { LogController } from '../controllers/LogController';
|
|
2
3
|
|
|
3
4
|
// -- Types ----------------------------------------------------------------------
|
|
4
5
|
interface Options {
|
|
@@ -71,9 +72,13 @@ export class FetchUtil {
|
|
|
71
72
|
return this.processResponse<T>(response);
|
|
72
73
|
}
|
|
73
74
|
|
|
74
|
-
public async fetchImage(
|
|
75
|
+
public async fetchImage(
|
|
76
|
+
path: string,
|
|
77
|
+
headers?: Record<string, string>,
|
|
78
|
+
params?: Record<string, string>
|
|
79
|
+
) {
|
|
75
80
|
try {
|
|
76
|
-
const url = this.createUrl({ path }).toString();
|
|
81
|
+
const url = this.createUrl({ path, params }).toString();
|
|
77
82
|
const response = await fetch(url, { headers });
|
|
78
83
|
const blob = await response.blob();
|
|
79
84
|
const reader = new FileReader();
|
|
@@ -130,14 +135,18 @@ export class FetchUtil {
|
|
|
130
135
|
if (response.headers.get('content-type')?.includes('application/json')) {
|
|
131
136
|
try {
|
|
132
137
|
const errorData = await response.json();
|
|
138
|
+
LogController.sendError(JSON.stringify(errorData), 'FetchUtil.ts', 'processResponse');
|
|
133
139
|
|
|
134
140
|
return Promise.reject(errorData);
|
|
135
141
|
} catch (jsonError) {
|
|
142
|
+
LogController.sendError(jsonError, 'FetchUtil.ts', 'processResponse');
|
|
143
|
+
|
|
136
144
|
return Promise.reject(`Code: ${response.status} - ${response.statusText}`);
|
|
137
145
|
}
|
|
138
146
|
}
|
|
139
147
|
|
|
140
148
|
const errorText = await response.text();
|
|
149
|
+
LogController.sendError(errorText, 'FetchUtil.ts', 'processResponse');
|
|
141
150
|
|
|
142
151
|
return Promise.reject(`Code: ${response.status} - ${response.statusText} - ${errorText}`);
|
|
143
152
|
}
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
// -- Constants ----------------------------------------- //
|
|
2
|
+
const SENSITIVE_KEYS = [
|
|
3
|
+
'password',
|
|
4
|
+
'pass',
|
|
5
|
+
'pwd',
|
|
6
|
+
'secret',
|
|
7
|
+
'token',
|
|
8
|
+
'key',
|
|
9
|
+
'auth',
|
|
10
|
+
'authorization',
|
|
11
|
+
'bearer',
|
|
12
|
+
'credential',
|
|
13
|
+
'api_key',
|
|
14
|
+
'apikey',
|
|
15
|
+
'access_token',
|
|
16
|
+
'refresh_token',
|
|
17
|
+
'private_key',
|
|
18
|
+
'privatekey',
|
|
19
|
+
'mnemonic',
|
|
20
|
+
'seed',
|
|
21
|
+
'phrase',
|
|
22
|
+
'wallet',
|
|
23
|
+
'address',
|
|
24
|
+
'email',
|
|
25
|
+
'phone',
|
|
26
|
+
'ssn',
|
|
27
|
+
'social',
|
|
28
|
+
'credit',
|
|
29
|
+
'card',
|
|
30
|
+
'cvv',
|
|
31
|
+
'connection_string',
|
|
32
|
+
'connection',
|
|
33
|
+
'user_token'
|
|
34
|
+
];
|
|
35
|
+
|
|
36
|
+
const MAX_STRING_LENGTH = 480; // Maximum length for any string value (account for potential replacements)
|
|
37
|
+
const MAX_STACK_LINES = 10; // Maximum lines in stack trace
|
|
38
|
+
|
|
39
|
+
// -- Data Sanitization Functions ---------------------- //
|
|
40
|
+
export const sanitizeString = (value: string): string => {
|
|
41
|
+
if (typeof value !== 'string') {
|
|
42
|
+
value = String(value);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
if (value.length > MAX_STRING_LENGTH) {
|
|
46
|
+
return value.substring(0, MAX_STRING_LENGTH) + '... [truncated]';
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return value;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export const sanitizeStackTrace = (stack: string): string => {
|
|
53
|
+
if (typeof stack !== 'string') {
|
|
54
|
+
stack = String(stack);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const lines = stack.split('\n');
|
|
58
|
+
const sanitizedLines = lines.slice(0, MAX_STACK_LINES).map(line => {
|
|
59
|
+
// Remove file paths that might contain sensitive info
|
|
60
|
+
return line.replace(/\/[^\s]*\//g, '/[path]/');
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
if (lines.length > MAX_STACK_LINES) {
|
|
64
|
+
sanitizedLines.push('... [stack trace truncated]');
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return sanitizedLines.join('\n');
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
export const sanitizeUrl = (url: string): string => {
|
|
71
|
+
try {
|
|
72
|
+
const urlObj = new URL(url);
|
|
73
|
+
// Remove query parameters that might contain sensitive data
|
|
74
|
+
urlObj.search = '';
|
|
75
|
+
// Keep only the origin and pathname
|
|
76
|
+
|
|
77
|
+
return urlObj.origin + urlObj.pathname;
|
|
78
|
+
} catch {
|
|
79
|
+
// If URL parsing fails, just return sanitized string
|
|
80
|
+
|
|
81
|
+
return sanitizeString(url);
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
const isSensitiveKey = (key: string): boolean => {
|
|
86
|
+
const lowerKey = key.toLowerCase();
|
|
87
|
+
|
|
88
|
+
return SENSITIVE_KEYS.some(sensitiveKey => lowerKey.includes(sensitiveKey));
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
export const sanitizeValue = (value: unknown, visited = new WeakSet()): unknown => {
|
|
92
|
+
if (value === null || value === undefined) {
|
|
93
|
+
return value;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
if (typeof value === 'string') {
|
|
97
|
+
// Check if it looks like a URL
|
|
98
|
+
if (value.startsWith('http://') || value.startsWith('https://')) {
|
|
99
|
+
return sanitizeUrl(value);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
return sanitizeString(value);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
if (typeof value === 'number' || typeof value === 'boolean') {
|
|
106
|
+
return value;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
if (Array.isArray(value)) {
|
|
110
|
+
// Prevent circular references in arrays
|
|
111
|
+
if (visited.has(value)) {
|
|
112
|
+
return '[Circular Reference]';
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
visited.add(value);
|
|
116
|
+
const result = value.slice(0, 10).map(item => sanitizeValue(item, visited));
|
|
117
|
+
visited.delete(value);
|
|
118
|
+
|
|
119
|
+
return result;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
if (typeof value === 'object') {
|
|
123
|
+
return sanitizeObject(value as Record<string, unknown>, visited);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// For other types, convert to string and sanitize
|
|
127
|
+
return sanitizeString(String(value));
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
export const sanitizeObject = (
|
|
131
|
+
obj: Record<string, unknown>,
|
|
132
|
+
visited = new WeakSet()
|
|
133
|
+
): Record<string, unknown> => {
|
|
134
|
+
// Prevent circular references
|
|
135
|
+
if (visited.has(obj)) {
|
|
136
|
+
return { '[Circular Reference]': true };
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
visited.add(obj);
|
|
140
|
+
|
|
141
|
+
const sanitized: Record<string, unknown> = {};
|
|
142
|
+
const keys = Object.keys(obj).slice(0, 20); // Limit number of keys
|
|
143
|
+
|
|
144
|
+
for (const key of keys) {
|
|
145
|
+
if (isSensitiveKey(key)) {
|
|
146
|
+
sanitized[key] = '[REDACTED]';
|
|
147
|
+
} else {
|
|
148
|
+
sanitized[key] = sanitizeValue(obj[key], visited);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
if (Object.keys(obj).length > 20) {
|
|
153
|
+
sanitized['...'] = '[additional properties truncated]';
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
visited.delete(obj);
|
|
157
|
+
|
|
158
|
+
return sanitized;
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
export const sanitizeData = (
|
|
162
|
+
data?: Record<string, unknown>
|
|
163
|
+
): Record<string, unknown> | undefined => {
|
|
164
|
+
if (!data) {
|
|
165
|
+
return undefined;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
return sanitizeObject(data);
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
// -- Utility Functions --------------------------------- //
|
|
172
|
+
export const LogUtils = {
|
|
173
|
+
sanitizeString,
|
|
174
|
+
sanitizeStackTrace,
|
|
175
|
+
sanitizeUrl,
|
|
176
|
+
sanitizeValue,
|
|
177
|
+
sanitizeObject,
|
|
178
|
+
sanitizeData
|
|
179
|
+
};
|
package/src/utils/StorageUtil.ts
CHANGED
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
SafeStorageKeys
|
|
14
14
|
} from '@reown/appkit-common-react-native';
|
|
15
15
|
import { OptionsController } from '../controllers/OptionsController';
|
|
16
|
+
import { LogController } from '../controllers/LogController';
|
|
16
17
|
|
|
17
18
|
// -- Utility -----------------------------------------------------------------
|
|
18
19
|
export const StorageUtil = {
|
|
@@ -22,8 +23,8 @@ export const StorageUtil = {
|
|
|
22
23
|
href,
|
|
23
24
|
name
|
|
24
25
|
});
|
|
25
|
-
} catch {
|
|
26
|
-
|
|
26
|
+
} catch (error) {
|
|
27
|
+
LogController.sendError(error, 'StorageUtil.ts', 'setWalletConnectDeepLink');
|
|
27
28
|
}
|
|
28
29
|
},
|
|
29
30
|
|
|
@@ -35,8 +36,8 @@ export const StorageUtil = {
|
|
|
35
36
|
if (deepLink) {
|
|
36
37
|
return deepLink;
|
|
37
38
|
}
|
|
38
|
-
} catch {
|
|
39
|
-
|
|
39
|
+
} catch (error) {
|
|
40
|
+
LogController.sendError(error, 'StorageUtil.ts', 'getWalletConnectDeepLink');
|
|
40
41
|
}
|
|
41
42
|
|
|
42
43
|
return undefined;
|
|
@@ -45,8 +46,8 @@ export const StorageUtil = {
|
|
|
45
46
|
async removeWalletConnectDeepLink() {
|
|
46
47
|
try {
|
|
47
48
|
await OptionsController.getStorage().removeItem(SafeStorageKeys.WC_DEEPLINK);
|
|
48
|
-
} catch {
|
|
49
|
-
|
|
49
|
+
} catch (error) {
|
|
50
|
+
LogController.sendError(error, 'StorageUtil.ts', 'removeWalletConnectDeepLink');
|
|
50
51
|
}
|
|
51
52
|
},
|
|
52
53
|
|
|
@@ -66,8 +67,8 @@ export const StorageUtil = {
|
|
|
66
67
|
OptionsController.getStorage().setItem(SafeStorageKeys.RECENT_WALLET, recentWallets);
|
|
67
68
|
|
|
68
69
|
return recentWallets;
|
|
69
|
-
} catch {
|
|
70
|
-
|
|
70
|
+
} catch (error) {
|
|
71
|
+
LogController.sendError(error, 'StorageUtil.ts', 'addRecentWallet');
|
|
71
72
|
|
|
72
73
|
return undefined;
|
|
73
74
|
}
|
|
@@ -76,8 +77,8 @@ export const StorageUtil = {
|
|
|
76
77
|
async setRecentWallets(wallets: WcWallet[]) {
|
|
77
78
|
try {
|
|
78
79
|
await OptionsController.getStorage().setItem(SafeStorageKeys.RECENT_WALLET, wallets);
|
|
79
|
-
} catch {
|
|
80
|
-
|
|
80
|
+
} catch (error) {
|
|
81
|
+
LogController.sendError(error, 'StorageUtil.ts', 'setRecentWallets');
|
|
81
82
|
}
|
|
82
83
|
},
|
|
83
84
|
|
|
@@ -86,8 +87,8 @@ export const StorageUtil = {
|
|
|
86
87
|
const recent = await OptionsController.getStorage().getItem(SafeStorageKeys.RECENT_WALLET);
|
|
87
88
|
|
|
88
89
|
return recent ?? [];
|
|
89
|
-
} catch {
|
|
90
|
-
|
|
90
|
+
} catch (error) {
|
|
91
|
+
LogController.sendError(error, 'StorageUtil.ts', 'getRecentWallets');
|
|
91
92
|
}
|
|
92
93
|
|
|
93
94
|
return [];
|
|
@@ -110,8 +111,8 @@ export const StorageUtil = {
|
|
|
110
111
|
updatedConnectors
|
|
111
112
|
);
|
|
112
113
|
}
|
|
113
|
-
} catch {
|
|
114
|
-
|
|
114
|
+
} catch (error) {
|
|
115
|
+
LogController.sendError(error, 'StorageUtil.ts', 'setConnectedConnectors');
|
|
115
116
|
}
|
|
116
117
|
},
|
|
117
118
|
|
|
@@ -123,7 +124,7 @@ export const StorageUtil = {
|
|
|
123
124
|
|
|
124
125
|
return connectors ?? [];
|
|
125
126
|
} catch (err) {
|
|
126
|
-
|
|
127
|
+
LogController.sendError(err, 'StorageUtil.ts', 'getConnectedConnectors');
|
|
127
128
|
}
|
|
128
129
|
|
|
129
130
|
return [];
|
|
@@ -137,8 +138,8 @@ export const StorageUtil = {
|
|
|
137
138
|
SafeStorageKeys.CONNECTED_CONNECTORS,
|
|
138
139
|
updatedConnectors
|
|
139
140
|
);
|
|
140
|
-
} catch {
|
|
141
|
-
|
|
141
|
+
} catch (error) {
|
|
142
|
+
LogController.sendError(error, 'StorageUtil.ts', 'removeConnectedConnectors');
|
|
142
143
|
}
|
|
143
144
|
},
|
|
144
145
|
|
|
@@ -148,8 +149,8 @@ export const StorageUtil = {
|
|
|
148
149
|
SafeStorageKeys.ONRAMP_PREFERRED_COUNTRY,
|
|
149
150
|
country
|
|
150
151
|
);
|
|
151
|
-
} catch {
|
|
152
|
-
|
|
152
|
+
} catch (error) {
|
|
153
|
+
LogController.sendError(error, 'StorageUtil.ts', 'setOnRampPreferredCountry');
|
|
153
154
|
}
|
|
154
155
|
},
|
|
155
156
|
|
|
@@ -173,8 +174,8 @@ export const StorageUtil = {
|
|
|
173
174
|
SafeStorageKeys.ONRAMP_PREFERRED_FIAT_CURRENCY,
|
|
174
175
|
currency
|
|
175
176
|
);
|
|
176
|
-
} catch {
|
|
177
|
-
|
|
177
|
+
} catch (error) {
|
|
178
|
+
LogController.sendError(error, 'StorageUtil.ts', 'setOnRampPreferredFiatCurrency');
|
|
178
179
|
}
|
|
179
180
|
},
|
|
180
181
|
|
|
@@ -185,8 +186,8 @@ export const StorageUtil = {
|
|
|
185
186
|
);
|
|
186
187
|
|
|
187
188
|
return currency ?? undefined;
|
|
188
|
-
} catch {
|
|
189
|
-
|
|
189
|
+
} catch (error) {
|
|
190
|
+
LogController.sendError(error, 'StorageUtil.ts', 'getOnRampPreferredFiatCurrency');
|
|
190
191
|
}
|
|
191
192
|
|
|
192
193
|
return undefined;
|
|
@@ -195,8 +196,8 @@ export const StorageUtil = {
|
|
|
195
196
|
async setOnRampCountries(countries: OnRampCountry[]) {
|
|
196
197
|
try {
|
|
197
198
|
await OptionsController.getStorage().setItem(SafeStorageKeys.ONRAMP_COUNTRIES, countries);
|
|
198
|
-
} catch {
|
|
199
|
-
|
|
199
|
+
} catch (error) {
|
|
200
|
+
LogController.sendError(error, 'StorageUtil.ts', 'setOnRampCountries');
|
|
200
201
|
}
|
|
201
202
|
},
|
|
202
203
|
|
|
@@ -207,8 +208,8 @@ export const StorageUtil = {
|
|
|
207
208
|
);
|
|
208
209
|
|
|
209
210
|
return countries ?? [];
|
|
210
|
-
} catch {
|
|
211
|
-
|
|
211
|
+
} catch (error) {
|
|
212
|
+
LogController.sendError(error, 'StorageUtil.ts', 'getOnRampCountries');
|
|
212
213
|
}
|
|
213
214
|
|
|
214
215
|
return [];
|
|
@@ -222,8 +223,8 @@ export const StorageUtil = {
|
|
|
222
223
|
data: countriesDefaults,
|
|
223
224
|
timestamp
|
|
224
225
|
});
|
|
225
|
-
} catch {
|
|
226
|
-
|
|
226
|
+
} catch (error) {
|
|
227
|
+
LogController.sendError(error, 'StorageUtil.ts', 'setOnRampCountriesDefaults');
|
|
227
228
|
}
|
|
228
229
|
},
|
|
229
230
|
|
|
@@ -245,8 +246,8 @@ export const StorageUtil = {
|
|
|
245
246
|
}
|
|
246
247
|
|
|
247
248
|
return (data as OnRampCountryDefaults[]) ?? [];
|
|
248
|
-
} catch {
|
|
249
|
-
|
|
249
|
+
} catch (error) {
|
|
250
|
+
LogController.sendError(error, 'StorageUtil.ts', 'getOnRampCountriesDefaults');
|
|
250
251
|
}
|
|
251
252
|
|
|
252
253
|
return [];
|
|
@@ -260,8 +261,8 @@ export const StorageUtil = {
|
|
|
260
261
|
data: serviceProviders,
|
|
261
262
|
timestamp
|
|
262
263
|
});
|
|
263
|
-
} catch {
|
|
264
|
-
|
|
264
|
+
} catch (error) {
|
|
265
|
+
LogController.sendError(error, 'StorageUtil.ts', 'setOnRampServiceProviders');
|
|
265
266
|
}
|
|
266
267
|
},
|
|
267
268
|
|
|
@@ -284,8 +285,7 @@ export const StorageUtil = {
|
|
|
284
285
|
|
|
285
286
|
return (data as OnRampServiceProvider[]) ?? [];
|
|
286
287
|
} catch (err) {
|
|
287
|
-
|
|
288
|
-
console.info('Unable to get OnRamp Service Providers');
|
|
288
|
+
LogController.sendError(err, 'StorageUtil.ts', 'getOnRampServiceProviders');
|
|
289
289
|
}
|
|
290
290
|
|
|
291
291
|
return [];
|
|
@@ -299,8 +299,8 @@ export const StorageUtil = {
|
|
|
299
299
|
data: fiatLimits,
|
|
300
300
|
timestamp
|
|
301
301
|
});
|
|
302
|
-
} catch {
|
|
303
|
-
|
|
302
|
+
} catch (error) {
|
|
303
|
+
LogController.sendError(error, 'StorageUtil.ts', 'setOnRampFiatLimits');
|
|
304
304
|
}
|
|
305
305
|
},
|
|
306
306
|
|
|
@@ -322,8 +322,8 @@ export const StorageUtil = {
|
|
|
322
322
|
}
|
|
323
323
|
|
|
324
324
|
return (data as OnRampFiatLimit[]) ?? [];
|
|
325
|
-
} catch {
|
|
326
|
-
|
|
325
|
+
} catch (error) {
|
|
326
|
+
LogController.sendError(error, 'StorageUtil.ts', 'getOnRampFiatLimits');
|
|
327
327
|
}
|
|
328
328
|
|
|
329
329
|
return [];
|
|
@@ -337,8 +337,8 @@ export const StorageUtil = {
|
|
|
337
337
|
data: fiatCurrencies,
|
|
338
338
|
timestamp
|
|
339
339
|
});
|
|
340
|
-
} catch {
|
|
341
|
-
|
|
340
|
+
} catch (error) {
|
|
341
|
+
LogController.sendError(error, 'StorageUtil.ts', 'setOnRampFiatCurrencies');
|
|
342
342
|
}
|
|
343
343
|
},
|
|
344
344
|
|
|
@@ -360,8 +360,8 @@ export const StorageUtil = {
|
|
|
360
360
|
}
|
|
361
361
|
|
|
362
362
|
return (data as OnRampFiatCurrency[]) ?? [];
|
|
363
|
-
} catch {
|
|
364
|
-
|
|
363
|
+
} catch (error) {
|
|
364
|
+
LogController.sendError(error, 'StorageUtil.ts', 'getOnRampFiatCurrencies');
|
|
365
365
|
}
|
|
366
366
|
|
|
367
367
|
return [];
|
|
@@ -376,8 +376,8 @@ export const StorageUtil = {
|
|
|
376
376
|
}
|
|
377
377
|
|
|
378
378
|
await OptionsController.getStorage().setItem(SafeStorageKeys.ACTIVE_NAMESPACE, namespace);
|
|
379
|
-
} catch {
|
|
380
|
-
|
|
379
|
+
} catch (error) {
|
|
380
|
+
LogController.sendError(error, 'StorageUtil.ts', 'setActiveNamespace');
|
|
381
381
|
}
|
|
382
382
|
},
|
|
383
383
|
|
|
@@ -389,8 +389,7 @@ export const StorageUtil = {
|
|
|
389
389
|
|
|
390
390
|
return namespace ?? undefined;
|
|
391
391
|
} catch (err) {
|
|
392
|
-
|
|
393
|
-
console.info('Unable to get Active Namespace');
|
|
392
|
+
LogController.sendError(err, 'StorageUtil.ts', 'getActiveNamespace');
|
|
394
393
|
}
|
|
395
394
|
|
|
396
395
|
return undefined;
|
|
@@ -399,8 +398,8 @@ export const StorageUtil = {
|
|
|
399
398
|
async removeActiveNamespace() {
|
|
400
399
|
try {
|
|
401
400
|
await OptionsController.getStorage().removeItem(SafeStorageKeys.ACTIVE_NAMESPACE);
|
|
402
|
-
} catch {
|
|
403
|
-
|
|
401
|
+
} catch (error) {
|
|
402
|
+
LogController.sendError(error, 'StorageUtil.ts', 'removeActiveNamespace');
|
|
404
403
|
}
|
|
405
404
|
}
|
|
406
405
|
};
|