@reown/appkit-core-react-native 0.0.0-develop-20250728153935 → 0.0.0-develop-20251008155354
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 +157 -91
- package/lib/commonjs/controllers/ApiController.js.map +1 -1
- package/lib/commonjs/controllers/AssetController.js +0 -4
- package/lib/commonjs/controllers/AssetController.js.map +1 -1
- package/lib/commonjs/controllers/BlockchainApiController.js +180 -78
- package/lib/commonjs/controllers/BlockchainApiController.js.map +1 -1
- package/lib/commonjs/controllers/ConnectionsController.js +425 -0
- package/lib/commonjs/controllers/ConnectionsController.js.map +1 -0
- 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/ModalController.js +9 -7
- package/lib/commonjs/controllers/ModalController.js.map +1 -1
- package/lib/commonjs/controllers/OnRampController.js +47 -20
- package/lib/commonjs/controllers/OnRampController.js.map +1 -1
- package/lib/commonjs/controllers/OptionsController.js +28 -10
- package/lib/commonjs/controllers/OptionsController.js.map +1 -1
- package/lib/commonjs/controllers/PublicStateController.js.map +1 -1
- package/lib/commonjs/controllers/RouterController.js +7 -22
- package/lib/commonjs/controllers/RouterController.js.map +1 -1
- package/lib/commonjs/controllers/SendController.js +111 -95
- package/lib/commonjs/controllers/SendController.js.map +1 -1
- package/lib/commonjs/controllers/SnackController.js +29 -5
- package/lib/commonjs/controllers/SnackController.js.map +1 -1
- package/lib/commonjs/controllers/SwapController.js +162 -151
- package/lib/commonjs/controllers/SwapController.js.map +1 -1
- package/lib/commonjs/controllers/ThemeController.js +14 -1
- package/lib/commonjs/controllers/ThemeController.js.map +1 -1
- package/lib/commonjs/controllers/TransactionsController.js +24 -18
- package/lib/commonjs/controllers/TransactionsController.js.map +1 -1
- package/lib/commonjs/controllers/WcController.js +73 -0
- package/lib/commonjs/controllers/WcController.js.map +1 -0
- 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 +33 -40
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/utils/ApiUtil.js +1 -1
- package/lib/commonjs/utils/ApiUtil.js.map +1 -1
- package/lib/commonjs/utils/AssetUtil.js +8 -18
- package/lib/commonjs/utils/AssetUtil.js.map +1 -1
- package/lib/commonjs/utils/ConstantsUtil.js +117 -5
- package/lib/commonjs/utils/ConstantsUtil.js.map +1 -1
- package/lib/commonjs/utils/CoreHelperUtil.js +32 -9
- package/lib/commonjs/utils/CoreHelperUtil.js.map +1 -1
- package/lib/commonjs/utils/EventUtil.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 +131 -150
- package/lib/commonjs/utils/StorageUtil.js.map +1 -1
- package/lib/commonjs/utils/SwapApiUtil.js +15 -21
- package/lib/commonjs/utils/SwapApiUtil.js.map +1 -1
- package/lib/commonjs/utils/SwapCalculationUtil.js.map +1 -1
- package/lib/commonjs/utils/WalletUtil.js +23 -0
- package/lib/commonjs/utils/WalletUtil.js.map +1 -0
- package/lib/module/controllers/ApiController.js +159 -91
- package/lib/module/controllers/ApiController.js.map +1 -1
- package/lib/module/controllers/AssetController.js +2 -4
- package/lib/module/controllers/AssetController.js.map +1 -1
- package/lib/module/controllers/BlockchainApiController.js +182 -78
- package/lib/module/controllers/BlockchainApiController.js.map +1 -1
- package/lib/module/controllers/ConnectionsController.js +422 -0
- package/lib/module/controllers/ConnectionsController.js.map +1 -0
- package/lib/module/controllers/EnsController.js +4 -0
- package/lib/module/controllers/EnsController.js.map +1 -1
- package/lib/module/controllers/EventsController.js +53 -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/ModalController.js +11 -7
- package/lib/module/controllers/ModalController.js.map +1 -1
- package/lib/module/controllers/OnRampController.js +45 -16
- package/lib/module/controllers/OnRampController.js.map +1 -1
- package/lib/module/controllers/OptionsController.js +30 -10
- package/lib/module/controllers/OptionsController.js.map +1 -1
- package/lib/module/controllers/PublicStateController.js +2 -0
- package/lib/module/controllers/PublicStateController.js.map +1 -1
- package/lib/module/controllers/RouterController.js +9 -22
- package/lib/module/controllers/RouterController.js.map +1 -1
- package/lib/module/controllers/SendController.js +113 -95
- package/lib/module/controllers/SendController.js.map +1 -1
- package/lib/module/controllers/SnackController.js +31 -5
- package/lib/module/controllers/SnackController.js.map +1 -1
- package/lib/module/controllers/SwapController.js +164 -151
- package/lib/module/controllers/SwapController.js.map +1 -1
- package/lib/module/controllers/ThemeController.js +16 -1
- package/lib/module/controllers/ThemeController.js.map +1 -1
- package/lib/module/controllers/TransactionsController.js +26 -18
- package/lib/module/controllers/TransactionsController.js.map +1 -1
- package/lib/module/controllers/WcController.js +70 -0
- package/lib/module/controllers/WcController.js.map +1 -0
- 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 +13 -8
- package/lib/module/index.js.map +1 -1
- package/lib/module/utils/ApiUtil.js +3 -1
- package/lib/module/utils/ApiUtil.js.map +1 -1
- package/lib/module/utils/AssetUtil.js +10 -18
- package/lib/module/utils/AssetUtil.js.map +1 -1
- package/lib/module/utils/ConstantsUtil.js +119 -5
- package/lib/module/utils/ConstantsUtil.js.map +1 -1
- package/lib/module/utils/CoreHelperUtil.js +34 -7
- package/lib/module/utils/CoreHelperUtil.js.map +1 -1
- package/lib/module/utils/EventUtil.js +2 -0
- package/lib/module/utils/EventUtil.js.map +1 -1
- package/lib/module/utils/FetchUtil.js +10 -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 +134 -150
- package/lib/module/utils/StorageUtil.js.map +1 -1
- package/lib/module/utils/SwapApiUtil.js +17 -21
- package/lib/module/utils/SwapApiUtil.js.map +1 -1
- package/lib/module/utils/SwapCalculationUtil.js +3 -0
- package/lib/module/utils/SwapCalculationUtil.js.map +1 -1
- package/lib/module/utils/WalletUtil.js +19 -0
- package/lib/module/utils/WalletUtil.js.map +1 -0
- package/lib/typescript/controllers/ApiController.d.ts +9 -8
- package/lib/typescript/controllers/ApiController.d.ts.map +1 -1
- package/lib/typescript/controllers/AssetController.d.ts +0 -2
- package/lib/typescript/controllers/AssetController.d.ts.map +1 -1
- package/lib/typescript/controllers/BlockchainApiController.d.ts +29 -11
- package/lib/typescript/controllers/BlockchainApiController.d.ts.map +1 -1
- package/lib/typescript/controllers/ConnectionsController.d.ts +47 -0
- package/lib/typescript/controllers/ConnectionsController.d.ts.map +1 -0
- package/lib/typescript/controllers/EnsController.d.ts +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/ModalController.d.ts.map +1 -1
- package/lib/typescript/controllers/OnRampController.d.ts +2 -2
- package/lib/typescript/controllers/OnRampController.d.ts.map +1 -1
- package/lib/typescript/controllers/OptionsController.d.ts +11 -6
- package/lib/typescript/controllers/OptionsController.d.ts.map +1 -1
- package/lib/typescript/controllers/PublicStateController.d.ts +1 -1
- package/lib/typescript/controllers/PublicStateController.d.ts.map +1 -1
- package/lib/typescript/controllers/RouterController.d.ts +6 -20
- package/lib/typescript/controllers/RouterController.d.ts.map +1 -1
- package/lib/typescript/controllers/SendController.d.ts +5 -7
- package/lib/typescript/controllers/SendController.d.ts.map +1 -1
- package/lib/typescript/controllers/SnackController.d.ts +3 -3
- package/lib/typescript/controllers/SnackController.d.ts.map +1 -1
- package/lib/typescript/controllers/SwapController.d.ts +12 -12
- package/lib/typescript/controllers/SwapController.d.ts.map +1 -1
- package/lib/typescript/controllers/ThemeController.d.ts +3 -1
- package/lib/typescript/controllers/ThemeController.d.ts.map +1 -1
- package/lib/typescript/controllers/TransactionsController.d.ts +3 -3
- package/lib/typescript/controllers/TransactionsController.d.ts.map +1 -1
- package/lib/typescript/controllers/WcController.d.ts +27 -0
- package/lib/typescript/controllers/WcController.d.ts.map +1 -0
- 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 +7 -9
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/utils/ApiUtil.d.ts +1 -1
- package/lib/typescript/utils/AssetUtil.d.ts +3 -4
- package/lib/typescript/utils/AssetUtil.d.ts.map +1 -1
- package/lib/typescript/utils/ConstantsUtil.d.ts +11 -2
- package/lib/typescript/utils/ConstantsUtil.d.ts.map +1 -1
- package/lib/typescript/utils/CoreHelperUtil.d.ts +8 -6
- package/lib/typescript/utils/CoreHelperUtil.d.ts.map +1 -1
- package/lib/typescript/utils/EventUtil.d.ts +1 -1
- package/lib/typescript/utils/EventUtil.d.ts.map +1 -1
- package/lib/typescript/utils/FetchUtil.d.ts +4 -4
- 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 +15 -16
- package/lib/typescript/utils/StorageUtil.d.ts.map +1 -1
- package/lib/typescript/utils/SwapApiUtil.d.ts +3 -4
- package/lib/typescript/utils/SwapApiUtil.d.ts.map +1 -1
- package/lib/typescript/utils/SwapCalculationUtil.d.ts +1 -1
- package/lib/typescript/utils/SwapCalculationUtil.d.ts.map +1 -1
- package/lib/typescript/utils/WalletUtil.d.ts +5 -0
- package/lib/typescript/utils/WalletUtil.d.ts.map +1 -0
- package/package.json +11 -24
- package/src/controllers/ApiController.ts +167 -84
- package/src/controllers/AssetController.ts +0 -6
- package/src/controllers/BlockchainApiController.ts +168 -66
- package/src/controllers/ConnectionsController.ts +575 -0
- package/src/controllers/EnsController.ts +3 -1
- package/src/controllers/EventsController.ts +73 -2
- package/src/controllers/LogController.ts +250 -0
- package/src/controllers/ModalController.ts +10 -7
- package/src/controllers/OnRampController.ts +54 -19
- package/src/controllers/OptionsController.ts +46 -18
- package/src/controllers/PublicStateController.ts +1 -1
- package/src/controllers/RouterController.ts +20 -57
- package/src/controllers/SendController.ts +147 -111
- package/src/controllers/SnackController.ts +31 -5
- package/src/controllers/SwapController.ts +185 -183
- package/src/controllers/ThemeController.ts +18 -2
- package/src/controllers/TransactionsController.ts +27 -19
- package/src/controllers/WcController.ts +93 -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 +17 -20
- package/src/utils/ApiUtil.ts +1 -1
- package/src/utils/AssetUtil.ts +9 -22
- package/src/utils/ConstantsUtil.ts +121 -6
- package/src/utils/CoreHelperUtil.ts +66 -10
- package/src/utils/EventUtil.ts +1 -1
- package/src/utils/FetchUtil.ts +14 -5
- package/src/utils/LogUtils.ts +179 -0
- package/src/utils/StorageUtil.ts +191 -176
- package/src/utils/SwapApiUtil.ts +30 -37
- package/src/utils/SwapCalculationUtil.ts +1 -2
- package/src/utils/WalletUtil.ts +14 -0
- package/lib/commonjs/controllers/AccountController.js +0 -93
- package/lib/commonjs/controllers/AccountController.js.map +0 -1
- package/lib/commonjs/controllers/ConnectionController.js +0 -126
- package/lib/commonjs/controllers/ConnectionController.js.map +0 -1
- package/lib/commonjs/controllers/ConnectorController.js +0 -49
- package/lib/commonjs/controllers/ConnectorController.js.map +0 -1
- package/lib/commonjs/controllers/NetworkController.js +0 -90
- package/lib/commonjs/controllers/NetworkController.js.map +0 -1
- package/lib/commonjs/controllers/WebviewController.js +0 -52
- package/lib/commonjs/controllers/WebviewController.js.map +0 -1
- package/lib/commonjs/utils/ConnectionUtil.js +0 -33
- package/lib/commonjs/utils/ConnectionUtil.js.map +0 -1
- package/lib/commonjs/utils/NetworkUtil.js +0 -46
- package/lib/commonjs/utils/NetworkUtil.js.map +0 -1
- package/lib/commonjs/utils/RouterUtil.js +0 -25
- package/lib/commonjs/utils/RouterUtil.js.map +0 -1
- package/lib/commonjs/utils/TypeUtil.js +0 -35
- package/lib/commonjs/utils/TypeUtil.js.map +0 -1
- package/lib/module/controllers/AccountController.js +0 -88
- package/lib/module/controllers/AccountController.js.map +0 -1
- package/lib/module/controllers/ConnectionController.js +0 -121
- package/lib/module/controllers/ConnectionController.js.map +0 -1
- package/lib/module/controllers/ConnectorController.js +0 -44
- package/lib/module/controllers/ConnectorController.js.map +0 -1
- package/lib/module/controllers/NetworkController.js +0 -85
- package/lib/module/controllers/NetworkController.js.map +0 -1
- package/lib/module/controllers/WebviewController.js +0 -47
- package/lib/module/controllers/WebviewController.js.map +0 -1
- package/lib/module/utils/ConnectionUtil.js +0 -27
- package/lib/module/utils/ConnectionUtil.js.map +0 -1
- package/lib/module/utils/NetworkUtil.js +0 -40
- package/lib/module/utils/NetworkUtil.js.map +0 -1
- package/lib/module/utils/RouterUtil.js +0 -19
- package/lib/module/utils/RouterUtil.js.map +0 -1
- package/lib/module/utils/TypeUtil.js +0 -28
- package/lib/module/utils/TypeUtil.js.map +0 -1
- package/lib/typescript/controllers/AccountController.d.ts +0 -33
- package/lib/typescript/controllers/AccountController.d.ts.map +0 -1
- package/lib/typescript/controllers/ConnectionController.d.ts +0 -66
- package/lib/typescript/controllers/ConnectionController.d.ts.map +0 -1
- package/lib/typescript/controllers/ConnectorController.d.ts +0 -18
- package/lib/typescript/controllers/ConnectorController.d.ts.map +0 -1
- package/lib/typescript/controllers/NetworkController.d.ts +0 -34
- package/lib/typescript/controllers/NetworkController.d.ts.map +0 -1
- package/lib/typescript/controllers/WebviewController.d.ts +0 -21
- package/lib/typescript/controllers/WebviewController.d.ts.map +0 -1
- package/lib/typescript/utils/ConnectionUtil.d.ts +0 -4
- package/lib/typescript/utils/ConnectionUtil.d.ts.map +0 -1
- package/lib/typescript/utils/NetworkUtil.d.ts +0 -8
- package/lib/typescript/utils/NetworkUtil.d.ts.map +0 -1
- package/lib/typescript/utils/RouterUtil.d.ts +0 -5
- package/lib/typescript/utils/RouterUtil.d.ts.map +0 -1
- package/lib/typescript/utils/TypeUtil.d.ts +0 -850
- package/lib/typescript/utils/TypeUtil.d.ts.map +0 -1
- package/src/controllers/AccountController.ts +0 -128
- package/src/controllers/ConnectionController.ts +0 -200
- package/src/controllers/ConnectorController.ts +0 -63
- package/src/controllers/NetworkController.ts +0 -120
- package/src/controllers/WebviewController.ts +0 -63
- package/src/utils/ConnectionUtil.ts +0 -27
- package/src/utils/NetworkUtil.ts +0 -33
- package/src/utils/RouterUtil.ts +0 -21
- package/src/utils/TypeUtil.ts +0 -1039
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["FetchUtil","constructor","baseUrl","clientId","get","headers","signal","args","url","createUrl","response","fetch","method","processResponse","post","body","JSON","stringify","undefined","put","delete","fetchImage","path","toString","blob","reader","FileReader","readAsDataURL","Promise","resolve","onloadend","result","
|
|
1
|
+
{"version":3,"names":["LogController","FetchUtil","constructor","baseUrl","clientId","get","headers","signal","args","url","createUrl","response","fetch","method","processResponse","post","body","JSON","stringify","undefined","put","delete","fetchImage","path","params","toString","blob","reader","FileReader","readAsDataURL","Promise","resolve","onloadend","result","fullUrl","isAbsoluteUrl","startsWith","endsWith","pathUrl","substring","allParams","queryParams","key","value","push","encodeURIComponent","length","queryString","join","includes","ok","errorData","json","sendError","reject","jsonError","status","statusText","errorText","text"],"sourceRoot":"../../../src","sources":["utils/FetchUtil.ts"],"mappings":";;AACA,SAASA,aAAa,QAAQ,8BAA8B;;AAE5D;;AAkBA;AACA,OAAO,MAAMC,SAAS,CAAC;EAIdC,WAAWA,CAAC;IAAEC,OAAO;IAAEC;EAAkB,CAAC,EAAE;IACjD,IAAI,CAACD,OAAO,GAAGA,OAAO;IACtB,IAAI,CAACC,QAAQ,GAAGA,QAAQ;EAC1B;EAEA,MAAaC,GAAGA,CAAI;IAAEC,OAAO;IAAEC,MAAM;IAAE,GAAGC;EAAuB,CAAC,EAAE;IAClE,MAAMC,GAAG,GAAG,IAAI,CAACC,SAAS,CAACF,IAAI,CAAC;IAChC,MAAMG,QAAQ,GAAG,MAAMC,KAAK,CAACH,GAAG,EAAE;MAAEI,MAAM,EAAE,KAAK;MAAEP,OAAO;MAAEC;IAAO,CAAC,CAAC;IAErE,OAAO,IAAI,CAACO,eAAe,CAAIH,QAAQ,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OAAOrB,OAAO,CAACwB,MAAM,CAACH,SAAS,CAAC;QAClC,CAAC,CAAC,OAAOI,SAAS,EAAE;UAClBvD,aAAa,CAACqD,SAAS,CAACE,SAAS,EAAE,cAAc,EAAE,iBAAiB,CAAC;UAErE,OAAOzB,OAAO,CAACwB,MAAM,CAAC,SAAS3C,QAAQ,CAAC6C,MAAM,MAAM7C,QAAQ,CAAC8C,UAAU,EAAE,CAAC;QAC5E;MACF;MAEA,MAAMC,SAAS,GAAG,MAAM/C,QAAQ,CAACgD,IAAI,CAAC,CAAC;MACvC3D,aAAa,CAACqD,SAAS,CAACK,SAAS,EAAE,cAAc,EAAE,iBAAiB,CAAC;MAErE,OAAO5B,OAAO,CAACwB,MAAM,CAAC,SAAS3C,QAAQ,CAAC6C,MAAM,MAAM7C,QAAQ,CAAC8C,UAAU,MAAMC,SAAS,EAAE,CAAC;IAC3F;IAEA,IAAI/C,QAAQ,CAACL,OAAO,CAACD,GAAG,CAAC,gBAAgB,CAAC,KAAK,GAAG,EAAE;MAClD;IACF;IAEA,IAAIM,QAAQ,CAACL,OAAO,CAACD,GAAG,CAAC,cAAc,CAAC,EAAE4C,QAAQ,CAAC,kBAAkB,CAAC,EAAE;MACtE,OAAOtC,QAAQ,CAACyC,IAAI,CAAC,CAAC;IACxB;IAEA;EACF;AACF","ignoreList":[]}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
// -- Constants ----------------------------------------- //
|
|
4
|
+
const SENSITIVE_KEYS = ['password', 'pass', 'pwd', 'secret', 'token', 'key', 'auth', 'authorization', 'bearer', 'credential', 'api_key', 'apikey', 'access_token', 'refresh_token', 'private_key', 'privatekey', 'mnemonic', 'seed', 'phrase', 'wallet', 'address', 'email', 'phone', 'ssn', 'social', 'credit', 'card', 'cvv', 'connection_string', 'connection', 'user_token'];
|
|
5
|
+
const MAX_STRING_LENGTH = 480; // Maximum length for any string value (account for potential replacements)
|
|
6
|
+
const MAX_STACK_LINES = 10; // Maximum lines in stack trace
|
|
7
|
+
|
|
8
|
+
// -- Data Sanitization Functions ---------------------- //
|
|
9
|
+
export const sanitizeString = value => {
|
|
10
|
+
if (typeof value !== 'string') {
|
|
11
|
+
value = String(value);
|
|
12
|
+
}
|
|
13
|
+
if (value.length > MAX_STRING_LENGTH) {
|
|
14
|
+
return value.substring(0, MAX_STRING_LENGTH) + '... [truncated]';
|
|
15
|
+
}
|
|
16
|
+
return value;
|
|
17
|
+
};
|
|
18
|
+
export const sanitizeStackTrace = stack => {
|
|
19
|
+
if (typeof stack !== 'string') {
|
|
20
|
+
stack = String(stack);
|
|
21
|
+
}
|
|
22
|
+
const lines = stack.split('\n');
|
|
23
|
+
const sanitizedLines = lines.slice(0, MAX_STACK_LINES).map(line => {
|
|
24
|
+
// Remove file paths that might contain sensitive info
|
|
25
|
+
return line.replace(/\/[^\s]*\//g, '/[path]/');
|
|
26
|
+
});
|
|
27
|
+
if (lines.length > MAX_STACK_LINES) {
|
|
28
|
+
sanitizedLines.push('... [stack trace truncated]');
|
|
29
|
+
}
|
|
30
|
+
return sanitizedLines.join('\n');
|
|
31
|
+
};
|
|
32
|
+
export const sanitizeUrl = url => {
|
|
33
|
+
try {
|
|
34
|
+
const urlObj = new URL(url);
|
|
35
|
+
// Remove query parameters that might contain sensitive data
|
|
36
|
+
urlObj.search = '';
|
|
37
|
+
// Keep only the origin and pathname
|
|
38
|
+
|
|
39
|
+
return urlObj.origin + urlObj.pathname;
|
|
40
|
+
} catch {
|
|
41
|
+
// If URL parsing fails, just return sanitized string
|
|
42
|
+
|
|
43
|
+
return sanitizeString(url);
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
const isSensitiveKey = key => {
|
|
47
|
+
const lowerKey = key.toLowerCase();
|
|
48
|
+
return SENSITIVE_KEYS.some(sensitiveKey => lowerKey.includes(sensitiveKey));
|
|
49
|
+
};
|
|
50
|
+
export const sanitizeValue = (value, visited = new WeakSet()) => {
|
|
51
|
+
if (value === null || value === undefined) {
|
|
52
|
+
return value;
|
|
53
|
+
}
|
|
54
|
+
if (typeof value === 'string') {
|
|
55
|
+
// Check if it looks like a URL
|
|
56
|
+
if (value.startsWith('http://') || value.startsWith('https://')) {
|
|
57
|
+
return sanitizeUrl(value);
|
|
58
|
+
}
|
|
59
|
+
return sanitizeString(value);
|
|
60
|
+
}
|
|
61
|
+
if (typeof value === 'number' || typeof value === 'boolean') {
|
|
62
|
+
return value;
|
|
63
|
+
}
|
|
64
|
+
if (Array.isArray(value)) {
|
|
65
|
+
// Prevent circular references in arrays
|
|
66
|
+
if (visited.has(value)) {
|
|
67
|
+
return '[Circular Reference]';
|
|
68
|
+
}
|
|
69
|
+
visited.add(value);
|
|
70
|
+
const result = value.slice(0, 10).map(item => sanitizeValue(item, visited));
|
|
71
|
+
visited.delete(value);
|
|
72
|
+
return result;
|
|
73
|
+
}
|
|
74
|
+
if (typeof value === 'object') {
|
|
75
|
+
return sanitizeObject(value, visited);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// For other types, convert to string and sanitize
|
|
79
|
+
return sanitizeString(String(value));
|
|
80
|
+
};
|
|
81
|
+
export const sanitizeObject = (obj, visited = new WeakSet()) => {
|
|
82
|
+
// Prevent circular references
|
|
83
|
+
if (visited.has(obj)) {
|
|
84
|
+
return {
|
|
85
|
+
'[Circular Reference]': true
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
visited.add(obj);
|
|
89
|
+
const sanitized = {};
|
|
90
|
+
const keys = Object.keys(obj).slice(0, 20); // Limit number of keys
|
|
91
|
+
|
|
92
|
+
for (const key of keys) {
|
|
93
|
+
if (isSensitiveKey(key)) {
|
|
94
|
+
sanitized[key] = '[REDACTED]';
|
|
95
|
+
} else {
|
|
96
|
+
sanitized[key] = sanitizeValue(obj[key], visited);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
if (Object.keys(obj).length > 20) {
|
|
100
|
+
sanitized['...'] = '[additional properties truncated]';
|
|
101
|
+
}
|
|
102
|
+
visited.delete(obj);
|
|
103
|
+
return sanitized;
|
|
104
|
+
};
|
|
105
|
+
export const sanitizeData = data => {
|
|
106
|
+
if (!data) {
|
|
107
|
+
return undefined;
|
|
108
|
+
}
|
|
109
|
+
return sanitizeObject(data);
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
// -- Utility Functions --------------------------------- //
|
|
113
|
+
export const LogUtils = {
|
|
114
|
+
sanitizeString,
|
|
115
|
+
sanitizeStackTrace,
|
|
116
|
+
sanitizeUrl,
|
|
117
|
+
sanitizeValue,
|
|
118
|
+
sanitizeObject,
|
|
119
|
+
sanitizeData
|
|
120
|
+
};
|
|
121
|
+
//# sourceMappingURL=LogUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["SENSITIVE_KEYS","MAX_STRING_LENGTH","MAX_STACK_LINES","sanitizeString","value","String","length","substring","sanitizeStackTrace","stack","lines","split","sanitizedLines","slice","map","line","replace","push","join","sanitizeUrl","url","urlObj","URL","search","origin","pathname","isSensitiveKey","key","lowerKey","toLowerCase","some","sensitiveKey","includes","sanitizeValue","visited","WeakSet","undefined","startsWith","Array","isArray","has","add","result","item","delete","sanitizeObject","obj","sanitized","keys","Object","sanitizeData","data","LogUtils"],"sourceRoot":"../../../src","sources":["utils/LogUtils.ts"],"mappings":";;AAAA;AACA,MAAMA,cAAc,GAAG,CACrB,UAAU,EACV,MAAM,EACN,KAAK,EACL,QAAQ,EACR,OAAO,EACP,KAAK,EACL,MAAM,EACN,eAAe,EACf,QAAQ,EACR,YAAY,EACZ,SAAS,EACT,QAAQ,EACR,cAAc,EACd,eAAe,EACf,aAAa,EACb,YAAY,EACZ,UAAU,EACV,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,OAAO,EACP,OAAO,EACP,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,MAAM,EACN,KAAK,EACL,mBAAmB,EACnB,YAAY,EACZ,YAAY,CACb;AAED,MA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;EACdK,kBAAkB;EAClBW,WAAW;EACXc,aAAa;EACbY,cAAc;EACdK;AACF,CAAC","ignoreList":[]}
|
|
@@ -1,20 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
1
3
|
/* eslint-disable no-console */
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
+
import { DateUtil, SafeStorageKeys } from '@reown/appkit-common-react-native';
|
|
5
|
+
import { OptionsController } from '../controllers/OptionsController';
|
|
6
|
+
import { LogController } from '../controllers/LogController';
|
|
4
7
|
|
|
5
|
-
// -- Helpers -----------------------------------------------------------------
|
|
6
|
-
const WC_DEEPLINK = 'WALLETCONNECT_DEEPLINK_CHOICE';
|
|
7
|
-
const RECENT_WALLET = '@w3m/recent';
|
|
8
|
-
const CONNECTED_WALLET_IMAGE_URL = '@w3m/connected_wallet_image_url';
|
|
9
|
-
const CONNECTED_CONNECTOR = '@w3m/connected_connector';
|
|
10
|
-
const CONNECTED_SOCIAL = '@appkit/connected_social';
|
|
11
|
-
const ONRAMP_PREFERRED_COUNTRY = '@appkit/onramp_preferred_country';
|
|
12
|
-
const ONRAMP_COUNTRIES = '@appkit/onramp_countries';
|
|
13
|
-
const ONRAMP_COUNTRIES_DEFAULTS = '@appkit/onramp_countries_defaults';
|
|
14
|
-
const ONRAMP_SERVICE_PROVIDERS = '@appkit/onramp_service_providers';
|
|
15
|
-
const ONRAMP_FIAT_LIMITS = '@appkit/onramp_fiat_limits';
|
|
16
|
-
const ONRAMP_FIAT_CURRENCIES = '@appkit/onramp_fiat_currencies';
|
|
17
|
-
const ONRAMP_PREFERRED_FIAT_CURRENCY = '@appkit/onramp_preferred_fiat_currency';
|
|
18
8
|
// -- Utility -----------------------------------------------------------------
|
|
19
9
|
export const StorageUtil = {
|
|
20
10
|
setWalletConnectDeepLink({
|
|
@@ -22,30 +12,30 @@ export const StorageUtil = {
|
|
|
22
12
|
name
|
|
23
13
|
}) {
|
|
24
14
|
try {
|
|
25
|
-
|
|
15
|
+
OptionsController.getStorage().setItem(SafeStorageKeys.WC_DEEPLINK, {
|
|
26
16
|
href,
|
|
27
17
|
name
|
|
28
|
-
})
|
|
29
|
-
} catch {
|
|
30
|
-
|
|
18
|
+
});
|
|
19
|
+
} catch (error) {
|
|
20
|
+
LogController.sendError(error, 'StorageUtil.ts', 'setWalletConnectDeepLink');
|
|
31
21
|
}
|
|
32
22
|
},
|
|
33
23
|
async getWalletConnectDeepLink() {
|
|
34
24
|
try {
|
|
35
|
-
const deepLink = await
|
|
25
|
+
const deepLink = await OptionsController.getStorage().getItem(SafeStorageKeys.WC_DEEPLINK);
|
|
36
26
|
if (deepLink) {
|
|
37
|
-
return
|
|
27
|
+
return deepLink;
|
|
38
28
|
}
|
|
39
|
-
} catch {
|
|
40
|
-
|
|
29
|
+
} catch (error) {
|
|
30
|
+
LogController.sendError(error, 'StorageUtil.ts', 'getWalletConnectDeepLink');
|
|
41
31
|
}
|
|
42
32
|
return undefined;
|
|
43
33
|
},
|
|
44
34
|
async removeWalletConnectDeepLink() {
|
|
45
35
|
try {
|
|
46
|
-
await
|
|
47
|
-
} catch {
|
|
48
|
-
|
|
36
|
+
await OptionsController.getStorage().removeItem(SafeStorageKeys.WC_DEEPLINK);
|
|
37
|
+
} catch (error) {
|
|
38
|
+
LogController.sendError(error, 'StorageUtil.ts', 'removeWalletConnectDeepLink');
|
|
49
39
|
}
|
|
50
40
|
},
|
|
51
41
|
async addRecentWallet(wallet) {
|
|
@@ -59,108 +49,76 @@ export const StorageUtil = {
|
|
|
59
49
|
if (recentWallets.length > 2) {
|
|
60
50
|
recentWallets.pop();
|
|
61
51
|
}
|
|
62
|
-
|
|
52
|
+
OptionsController.getStorage().setItem(SafeStorageKeys.RECENT_WALLET, recentWallets);
|
|
63
53
|
return recentWallets;
|
|
64
|
-
} catch {
|
|
65
|
-
|
|
54
|
+
} catch (error) {
|
|
55
|
+
LogController.sendError(error, 'StorageUtil.ts', 'addRecentWallet');
|
|
66
56
|
return undefined;
|
|
67
57
|
}
|
|
68
58
|
},
|
|
69
59
|
async setRecentWallets(wallets) {
|
|
70
60
|
try {
|
|
71
|
-
await
|
|
72
|
-
} catch {
|
|
73
|
-
|
|
61
|
+
await OptionsController.getStorage().setItem(SafeStorageKeys.RECENT_WALLET, wallets);
|
|
62
|
+
} catch (error) {
|
|
63
|
+
LogController.sendError(error, 'StorageUtil.ts', 'setRecentWallets');
|
|
74
64
|
}
|
|
75
65
|
},
|
|
76
66
|
async getRecentWallets() {
|
|
77
67
|
try {
|
|
78
|
-
const recent = await
|
|
79
|
-
return recent
|
|
80
|
-
} catch {
|
|
81
|
-
|
|
68
|
+
const recent = await OptionsController.getStorage().getItem(SafeStorageKeys.RECENT_WALLET);
|
|
69
|
+
return recent ?? [];
|
|
70
|
+
} catch (error) {
|
|
71
|
+
LogController.sendError(error, 'StorageUtil.ts', 'getRecentWallets');
|
|
82
72
|
}
|
|
83
73
|
return [];
|
|
84
74
|
},
|
|
85
|
-
async
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
console.info('Unable to set Connected Connector');
|
|
90
|
-
}
|
|
91
|
-
},
|
|
92
|
-
async getConnectedConnector() {
|
|
93
|
-
try {
|
|
94
|
-
const connector = await AsyncStorage.getItem(CONNECTED_CONNECTOR);
|
|
95
|
-
return connector ? JSON.parse(connector) : undefined;
|
|
96
|
-
} catch {
|
|
97
|
-
console.info('Unable to get Connected Connector');
|
|
98
|
-
}
|
|
99
|
-
return undefined;
|
|
100
|
-
},
|
|
101
|
-
async removeConnectedConnector() {
|
|
102
|
-
try {
|
|
103
|
-
await AsyncStorage.removeItem(CONNECTED_CONNECTOR);
|
|
104
|
-
} catch {
|
|
105
|
-
console.info('Unable to remove Connected Connector');
|
|
106
|
-
}
|
|
107
|
-
},
|
|
108
|
-
async setConnectedWalletImageUrl(url) {
|
|
109
|
-
try {
|
|
110
|
-
await AsyncStorage.setItem(CONNECTED_WALLET_IMAGE_URL, url);
|
|
111
|
-
} catch {
|
|
112
|
-
console.info('Unable to set Connected Wallet Image URL');
|
|
113
|
-
}
|
|
114
|
-
},
|
|
115
|
-
async getConnectedWalletImageUrl() {
|
|
116
|
-
try {
|
|
117
|
-
return await AsyncStorage.getItem(CONNECTED_WALLET_IMAGE_URL);
|
|
118
|
-
} catch {
|
|
119
|
-
console.info('Unable to get Connected Wallet Image URL');
|
|
120
|
-
}
|
|
121
|
-
return undefined;
|
|
122
|
-
},
|
|
123
|
-
async removeConnectedWalletImageUrl() {
|
|
124
|
-
try {
|
|
125
|
-
await AsyncStorage.removeItem(CONNECTED_WALLET_IMAGE_URL);
|
|
126
|
-
} catch {
|
|
127
|
-
console.info('Unable to remove Connected Wallet Image URL');
|
|
128
|
-
}
|
|
129
|
-
},
|
|
130
|
-
async setConnectedSocialProvider(provider) {
|
|
75
|
+
async setConnectedConnectors({
|
|
76
|
+
type,
|
|
77
|
+
namespaces
|
|
78
|
+
}) {
|
|
131
79
|
try {
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
80
|
+
const currentConnectors = (await StorageUtil.getConnectedConnectors()) || [];
|
|
81
|
+
// Only add if it doesn't exist already
|
|
82
|
+
if (!currentConnectors.some(c => c.type === type)) {
|
|
83
|
+
const updatedConnectors = [...currentConnectors, {
|
|
84
|
+
type,
|
|
85
|
+
namespaces
|
|
86
|
+
}];
|
|
87
|
+
await OptionsController.getStorage().setItem(SafeStorageKeys.CONNECTED_CONNECTORS, updatedConnectors);
|
|
88
|
+
}
|
|
89
|
+
} catch (error) {
|
|
90
|
+
LogController.sendError(error, 'StorageUtil.ts', 'setConnectedConnectors');
|
|
135
91
|
}
|
|
136
92
|
},
|
|
137
|
-
async
|
|
93
|
+
async getConnectedConnectors() {
|
|
138
94
|
try {
|
|
139
|
-
const
|
|
140
|
-
return
|
|
141
|
-
} catch {
|
|
142
|
-
|
|
95
|
+
const connectors = await OptionsController.getStorage().getItem(SafeStorageKeys.CONNECTED_CONNECTORS);
|
|
96
|
+
return connectors ?? [];
|
|
97
|
+
} catch (err) {
|
|
98
|
+
LogController.sendError(err, 'StorageUtil.ts', 'getConnectedConnectors');
|
|
143
99
|
}
|
|
144
|
-
return
|
|
100
|
+
return [];
|
|
145
101
|
},
|
|
146
|
-
async
|
|
102
|
+
async removeConnectedConnectors(type) {
|
|
147
103
|
try {
|
|
148
|
-
await
|
|
149
|
-
|
|
150
|
-
|
|
104
|
+
const currentConnectors = await StorageUtil.getConnectedConnectors();
|
|
105
|
+
const updatedConnectors = currentConnectors.filter(c => c.type !== type);
|
|
106
|
+
await OptionsController.getStorage().setItem(SafeStorageKeys.CONNECTED_CONNECTORS, updatedConnectors);
|
|
107
|
+
} catch (error) {
|
|
108
|
+
LogController.sendError(error, 'StorageUtil.ts', 'removeConnectedConnectors');
|
|
151
109
|
}
|
|
152
110
|
},
|
|
153
111
|
async setOnRampPreferredCountry(country) {
|
|
154
112
|
try {
|
|
155
|
-
await
|
|
156
|
-
} catch {
|
|
157
|
-
|
|
113
|
+
await OptionsController.getStorage().setItem(SafeStorageKeys.ONRAMP_PREFERRED_COUNTRY, country);
|
|
114
|
+
} catch (error) {
|
|
115
|
+
LogController.sendError(error, 'StorageUtil.ts', 'setOnRampPreferredCountry');
|
|
158
116
|
}
|
|
159
117
|
},
|
|
160
118
|
async getOnRampPreferredCountry() {
|
|
161
119
|
try {
|
|
162
|
-
const country = await
|
|
163
|
-
return country
|
|
120
|
+
const country = await OptionsController.getStorage().getItem(SafeStorageKeys.ONRAMP_PREFERRED_COUNTRY);
|
|
121
|
+
return country ?? undefined;
|
|
164
122
|
} catch {
|
|
165
123
|
console.info('Unable to get OnRamp Preferred Country');
|
|
166
124
|
}
|
|
@@ -168,164 +126,190 @@ export const StorageUtil = {
|
|
|
168
126
|
},
|
|
169
127
|
async setOnRampPreferredFiatCurrency(currency) {
|
|
170
128
|
try {
|
|
171
|
-
await
|
|
172
|
-
} catch {
|
|
173
|
-
|
|
129
|
+
await OptionsController.getStorage().setItem(SafeStorageKeys.ONRAMP_PREFERRED_FIAT_CURRENCY, currency);
|
|
130
|
+
} catch (error) {
|
|
131
|
+
LogController.sendError(error, 'StorageUtil.ts', 'setOnRampPreferredFiatCurrency');
|
|
174
132
|
}
|
|
175
133
|
},
|
|
176
134
|
async getOnRampPreferredFiatCurrency() {
|
|
177
135
|
try {
|
|
178
|
-
const currency = await
|
|
179
|
-
return currency
|
|
180
|
-
} catch {
|
|
181
|
-
|
|
136
|
+
const currency = await OptionsController.getStorage().getItem(SafeStorageKeys.ONRAMP_PREFERRED_FIAT_CURRENCY);
|
|
137
|
+
return currency ?? undefined;
|
|
138
|
+
} catch (error) {
|
|
139
|
+
LogController.sendError(error, 'StorageUtil.ts', 'getOnRampPreferredFiatCurrency');
|
|
182
140
|
}
|
|
183
141
|
return undefined;
|
|
184
142
|
},
|
|
185
143
|
async setOnRampCountries(countries) {
|
|
186
144
|
try {
|
|
187
|
-
await
|
|
188
|
-
} catch {
|
|
189
|
-
|
|
145
|
+
await OptionsController.getStorage().setItem(SafeStorageKeys.ONRAMP_COUNTRIES, countries);
|
|
146
|
+
} catch (error) {
|
|
147
|
+
LogController.sendError(error, 'StorageUtil.ts', 'setOnRampCountries');
|
|
190
148
|
}
|
|
191
149
|
},
|
|
192
150
|
async getOnRampCountries() {
|
|
193
151
|
try {
|
|
194
|
-
const countries = await
|
|
195
|
-
return countries
|
|
196
|
-
} catch {
|
|
197
|
-
|
|
152
|
+
const countries = await OptionsController.getStorage().getItem(SafeStorageKeys.ONRAMP_COUNTRIES);
|
|
153
|
+
return countries ?? [];
|
|
154
|
+
} catch (error) {
|
|
155
|
+
LogController.sendError(error, 'StorageUtil.ts', 'getOnRampCountries');
|
|
198
156
|
}
|
|
199
157
|
return [];
|
|
200
158
|
},
|
|
201
159
|
async setOnRampCountriesDefaults(countriesDefaults) {
|
|
202
160
|
try {
|
|
203
161
|
const timestamp = Date.now();
|
|
204
|
-
await
|
|
162
|
+
await OptionsController.getStorage().setItem(SafeStorageKeys.ONRAMP_COUNTRIES_DEFAULTS, {
|
|
205
163
|
data: countriesDefaults,
|
|
206
164
|
timestamp
|
|
207
|
-
})
|
|
208
|
-
} catch {
|
|
209
|
-
|
|
165
|
+
});
|
|
166
|
+
} catch (error) {
|
|
167
|
+
LogController.sendError(error, 'StorageUtil.ts', 'setOnRampCountriesDefaults');
|
|
210
168
|
}
|
|
211
169
|
},
|
|
212
170
|
async getOnRampCountriesDefaults() {
|
|
213
171
|
try {
|
|
214
|
-
const result = await
|
|
172
|
+
const result = await OptionsController.getStorage().getItem(SafeStorageKeys.ONRAMP_COUNTRIES_DEFAULTS);
|
|
215
173
|
if (!result) {
|
|
216
174
|
return [];
|
|
217
175
|
}
|
|
218
176
|
const {
|
|
219
177
|
data,
|
|
220
178
|
timestamp
|
|
221
|
-
} =
|
|
179
|
+
} = result;
|
|
222
180
|
|
|
223
181
|
// Cache for 1 week
|
|
224
182
|
if (timestamp && DateUtil.isMoreThanOneWeekAgo(timestamp)) {
|
|
225
183
|
return [];
|
|
226
184
|
}
|
|
227
|
-
return data
|
|
228
|
-
} catch {
|
|
229
|
-
|
|
185
|
+
return data ?? [];
|
|
186
|
+
} catch (error) {
|
|
187
|
+
LogController.sendError(error, 'StorageUtil.ts', 'getOnRampCountriesDefaults');
|
|
230
188
|
}
|
|
231
189
|
return [];
|
|
232
190
|
},
|
|
233
191
|
async setOnRampServiceProviders(serviceProviders) {
|
|
234
192
|
try {
|
|
235
193
|
const timestamp = Date.now();
|
|
236
|
-
await
|
|
194
|
+
await OptionsController.getStorage().setItem(SafeStorageKeys.ONRAMP_SERVICE_PROVIDERS, {
|
|
237
195
|
data: serviceProviders,
|
|
238
196
|
timestamp
|
|
239
|
-
})
|
|
240
|
-
} catch {
|
|
241
|
-
|
|
197
|
+
});
|
|
198
|
+
} catch (error) {
|
|
199
|
+
LogController.sendError(error, 'StorageUtil.ts', 'setOnRampServiceProviders');
|
|
242
200
|
}
|
|
243
201
|
},
|
|
244
202
|
async getOnRampServiceProviders() {
|
|
245
203
|
try {
|
|
246
|
-
const result = await
|
|
204
|
+
const result = await OptionsController.getStorage().getItem(SafeStorageKeys.ONRAMP_SERVICE_PROVIDERS);
|
|
247
205
|
if (!result) {
|
|
248
206
|
return [];
|
|
249
207
|
}
|
|
250
208
|
const {
|
|
251
209
|
data,
|
|
252
210
|
timestamp
|
|
253
|
-
} =
|
|
211
|
+
} = result;
|
|
254
212
|
|
|
255
213
|
// Cache for 1 week
|
|
256
214
|
if (timestamp && DateUtil.isMoreThanOneWeekAgo(timestamp)) {
|
|
257
215
|
return [];
|
|
258
216
|
}
|
|
259
|
-
return data
|
|
217
|
+
return data ?? [];
|
|
260
218
|
} catch (err) {
|
|
261
|
-
|
|
262
|
-
console.info('Unable to get OnRamp Service Providers');
|
|
219
|
+
LogController.sendError(err, 'StorageUtil.ts', 'getOnRampServiceProviders');
|
|
263
220
|
}
|
|
264
221
|
return [];
|
|
265
222
|
},
|
|
266
223
|
async setOnRampFiatLimits(fiatLimits) {
|
|
267
224
|
try {
|
|
268
225
|
const timestamp = Date.now();
|
|
269
|
-
await
|
|
226
|
+
await OptionsController.getStorage().setItem(SafeStorageKeys.ONRAMP_FIAT_LIMITS, {
|
|
270
227
|
data: fiatLimits,
|
|
271
228
|
timestamp
|
|
272
|
-
})
|
|
273
|
-
} catch {
|
|
274
|
-
|
|
229
|
+
});
|
|
230
|
+
} catch (error) {
|
|
231
|
+
LogController.sendError(error, 'StorageUtil.ts', 'setOnRampFiatLimits');
|
|
275
232
|
}
|
|
276
233
|
},
|
|
277
234
|
async getOnRampFiatLimits() {
|
|
278
235
|
try {
|
|
279
|
-
const result = await
|
|
236
|
+
const result = await OptionsController.getStorage().getItem(SafeStorageKeys.ONRAMP_FIAT_LIMITS);
|
|
280
237
|
if (!result) {
|
|
281
238
|
return [];
|
|
282
239
|
}
|
|
283
240
|
const {
|
|
284
241
|
data,
|
|
285
242
|
timestamp
|
|
286
|
-
} =
|
|
243
|
+
} = result;
|
|
287
244
|
|
|
288
245
|
// Cache for 1 week
|
|
289
246
|
if (timestamp && DateUtil.isMoreThanOneWeekAgo(timestamp)) {
|
|
290
247
|
return [];
|
|
291
248
|
}
|
|
292
|
-
return data
|
|
293
|
-
} catch {
|
|
294
|
-
|
|
249
|
+
return data ?? [];
|
|
250
|
+
} catch (error) {
|
|
251
|
+
LogController.sendError(error, 'StorageUtil.ts', 'getOnRampFiatLimits');
|
|
295
252
|
}
|
|
296
253
|
return [];
|
|
297
254
|
},
|
|
298
255
|
async setOnRampFiatCurrencies(fiatCurrencies) {
|
|
299
256
|
try {
|
|
300
257
|
const timestamp = Date.now();
|
|
301
|
-
await
|
|
258
|
+
await OptionsController.getStorage().setItem(SafeStorageKeys.ONRAMP_FIAT_CURRENCIES, {
|
|
302
259
|
data: fiatCurrencies,
|
|
303
260
|
timestamp
|
|
304
|
-
})
|
|
305
|
-
} catch {
|
|
306
|
-
|
|
261
|
+
});
|
|
262
|
+
} catch (error) {
|
|
263
|
+
LogController.sendError(error, 'StorageUtil.ts', 'setOnRampFiatCurrencies');
|
|
307
264
|
}
|
|
308
265
|
},
|
|
309
266
|
async getOnRampFiatCurrencies() {
|
|
310
267
|
try {
|
|
311
|
-
const result = await
|
|
268
|
+
const result = await OptionsController.getStorage().getItem(SafeStorageKeys.ONRAMP_FIAT_CURRENCIES);
|
|
312
269
|
if (!result) {
|
|
313
270
|
return [];
|
|
314
271
|
}
|
|
315
272
|
const {
|
|
316
273
|
data,
|
|
317
274
|
timestamp
|
|
318
|
-
} =
|
|
275
|
+
} = result;
|
|
319
276
|
|
|
320
277
|
// Cache for 1 week
|
|
321
278
|
if (timestamp && DateUtil.isMoreThanOneWeekAgo(timestamp)) {
|
|
322
279
|
return [];
|
|
323
280
|
}
|
|
324
|
-
return data
|
|
325
|
-
} catch {
|
|
326
|
-
|
|
281
|
+
return data ?? [];
|
|
282
|
+
} catch (error) {
|
|
283
|
+
LogController.sendError(error, 'StorageUtil.ts', 'getOnRampFiatCurrencies');
|
|
327
284
|
}
|
|
328
285
|
return [];
|
|
286
|
+
},
|
|
287
|
+
async setActiveNamespace(namespace) {
|
|
288
|
+
try {
|
|
289
|
+
if (!namespace) {
|
|
290
|
+
await OptionsController.getStorage().removeItem(SafeStorageKeys.ACTIVE_NAMESPACE);
|
|
291
|
+
return;
|
|
292
|
+
}
|
|
293
|
+
await OptionsController.getStorage().setItem(SafeStorageKeys.ACTIVE_NAMESPACE, namespace);
|
|
294
|
+
} catch (error) {
|
|
295
|
+
LogController.sendError(error, 'StorageUtil.ts', 'setActiveNamespace');
|
|
296
|
+
}
|
|
297
|
+
},
|
|
298
|
+
async getActiveNamespace() {
|
|
299
|
+
try {
|
|
300
|
+
const namespace = await OptionsController.getStorage().getItem(SafeStorageKeys.ACTIVE_NAMESPACE);
|
|
301
|
+
return namespace ?? undefined;
|
|
302
|
+
} catch (err) {
|
|
303
|
+
LogController.sendError(err, 'StorageUtil.ts', 'getActiveNamespace');
|
|
304
|
+
}
|
|
305
|
+
return undefined;
|
|
306
|
+
},
|
|
307
|
+
async removeActiveNamespace() {
|
|
308
|
+
try {
|
|
309
|
+
await OptionsController.getStorage().removeItem(SafeStorageKeys.ACTIVE_NAMESPACE);
|
|
310
|
+
} catch (error) {
|
|
311
|
+
LogController.sendError(error, 'StorageUtil.ts', 'removeActiveNamespace');
|
|
312
|
+
}
|
|
329
313
|
}
|
|
330
314
|
};
|
|
331
315
|
//# sourceMappingURL=StorageUtil.js.map
|